Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
authorJakub Kicinski <kuba@kernel.org>
Sat, 14 Nov 2020 17:13:40 +0000 (09:13 -0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 14 Nov 2020 17:13:41 +0000 (09:13 -0800)
Daniel Borkmann says:

====================
pull-request: bpf-next 2020-11-14

1) Add BTF generation for kernel modules and extend BTF infra in kernel
   e.g. support for split BTF loading and validation, from Andrii Nakryiko.

2) Support for pointers beyond pkt_end to recognize LLVM generated patterns
   on inlined branch conditions, from Alexei Starovoitov.

3) Implements bpf_local_storage for task_struct for BPF LSM, from KP Singh.

4) Enable FENTRY/FEXIT/RAW_TP tracing program to use the bpf_sk_storage
   infra, from Martin KaFai Lau.

5) Add XDP bulk APIs that introduce a defer/flush mechanism to optimize the
   XDP_REDIRECT path, from Lorenzo Bianconi.

6) Fix a potential (although rather theoretical) deadlock of hashtab in NMI
   context, from Song Liu.

7) Fixes for cross and out-of-tree build of bpftool and runqslower allowing build
   for different target archs on same source tree, from Jean-Philippe Brucker.

8) Fix error path in htab_map_alloc() triggered from syzbot, from Eric Dumazet.

9) Move functionality from test_tcpbpf_user into the test_progs framework so it
   can run in BPF CI, from Alexander Duyck.

10) Lift hashtab key_size limit to be larger than MAX_BPF_STACK, from Florian Lehner.

Note that for the fix from Song we have seen a sparse report on context
imbalance which requires changes in sparse itself for proper annotation
detection where this is currently being discussed on linux-sparse among
developers [0]. Once we have more clarification/guidance after their fix,
Song will follow-up.

  [0] https://lore.kernel.org/linux-sparse/CAHk-=wh4bx8A8dHnX612MsDO13st6uzAz1mJ1PaHHVevJx_ZCw@mail.gmail.com/T/
      https://lore.kernel.org/linux-sparse/20201109221345.uklbp3lzgq6g42zb@ltop.local/T/

* git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (66 commits)
  net: mlx5: Add xdp tx return bulking support
  net: mvpp2: Add xdp tx return bulking support
  net: mvneta: Add xdp tx return bulking support
  net: page_pool: Add bulk support for ptr_ring
  net: xdp: Introduce bulking for xdp tx return path
  bpf: Expose bpf_d_path helper to sleepable LSM hooks
  bpf: Augment the set of sleepable LSM hooks
  bpf: selftest: Use bpf_sk_storage in FENTRY/FEXIT/RAW_TP
  bpf: Allow using bpf_sk_storage in FENTRY/FEXIT/RAW_TP
  bpf: Rename some functions in bpf_sk_storage
  bpf: Folding omem_charge() into sk_storage_charge()
  selftests/bpf: Add asm tests for pkt vs pkt_end comparison.
  selftests/bpf: Add skb_pkt_end test
  bpf: Support for pointers beyond pkt_end.
  tools/bpf: Always run the *-clean recipes
  tools/bpf: Add bootstrap/ to .gitignore
  bpf: Fix NULL dereference in bpf_task_storage
  tools/bpftool: Fix build slowdown
  tools/runqslower: Build bpftool using HOSTCC
  tools/runqslower: Enable out-of-tree build
  ...
====================

Link: https://lore.kernel.org/r/20201114020819.29584-1-daniel@iogearbox.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3527 files changed:
CREDITS
Documentation/ABI/README
Documentation/ABI/obsolete/sysfs-class-dax
Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra
Documentation/ABI/obsolete/sysfs-gpio
Documentation/ABI/removed/devfs
Documentation/ABI/removed/raw1394
Documentation/ABI/removed/sysfs-class-rfkill
Documentation/ABI/removed/video1394
Documentation/ABI/stable/firewire-cdev
Documentation/ABI/stable/sysfs-acpi-pmprofile
Documentation/ABI/stable/sysfs-bus-firewire
Documentation/ABI/stable/sysfs-bus-nvmem
Documentation/ABI/stable/sysfs-bus-usb
Documentation/ABI/stable/sysfs-bus-vmbus
Documentation/ABI/stable/sysfs-bus-w1
Documentation/ABI/stable/sysfs-class-backlight
Documentation/ABI/stable/sysfs-class-infiniband
Documentation/ABI/stable/sysfs-class-rfkill
Documentation/ABI/stable/sysfs-class-tpm
Documentation/ABI/stable/sysfs-devices
Documentation/ABI/stable/sysfs-driver-dma-ioatdma
Documentation/ABI/stable/sysfs-driver-firmware-zynqmp
Documentation/ABI/stable/sysfs-driver-ib_srp
Documentation/ABI/stable/sysfs-driver-speakup
Documentation/ABI/stable/sysfs-firmware-efi-vars
Documentation/ABI/stable/sysfs-firmware-opal-dump
Documentation/ABI/stable/sysfs-firmware-opal-elog
Documentation/ABI/stable/sysfs-hypervisor-xen
Documentation/ABI/stable/vdso
Documentation/ABI/testing/configfs-acpi
Documentation/ABI/testing/configfs-most
Documentation/ABI/testing/configfs-spear-pcie-gadget
Documentation/ABI/testing/configfs-usb-gadget
Documentation/ABI/testing/configfs-usb-gadget-ecm
Documentation/ABI/testing/configfs-usb-gadget-eem
Documentation/ABI/testing/configfs-usb-gadget-hid
Documentation/ABI/testing/configfs-usb-gadget-loopback
Documentation/ABI/testing/configfs-usb-gadget-mass-storage
Documentation/ABI/testing/configfs-usb-gadget-midi
Documentation/ABI/testing/configfs-usb-gadget-printer
Documentation/ABI/testing/configfs-usb-gadget-rndis
Documentation/ABI/testing/configfs-usb-gadget-sourcesink
Documentation/ABI/testing/configfs-usb-gadget-subset
Documentation/ABI/testing/configfs-usb-gadget-uac1
Documentation/ABI/testing/configfs-usb-gadget-uac2
Documentation/ABI/testing/configfs-usb-gadget-uvc
Documentation/ABI/testing/debugfs-cec-error-inj
Documentation/ABI/testing/debugfs-driver-habanalabs
Documentation/ABI/testing/debugfs-ec
Documentation/ABI/testing/debugfs-moxtet
Documentation/ABI/testing/debugfs-pfo-nx-crypto
Documentation/ABI/testing/debugfs-pktcdvd
Documentation/ABI/testing/debugfs-turris-mox-rwtm
Documentation/ABI/testing/debugfs-wilco-ec
Documentation/ABI/testing/dell-smbios-wmi
Documentation/ABI/testing/dev-kmsg
Documentation/ABI/testing/evm
Documentation/ABI/testing/gpio-cdev
Documentation/ABI/testing/ima_policy
Documentation/ABI/testing/procfs-diskstats
Documentation/ABI/testing/procfs-smaps_rollup
Documentation/ABI/testing/pstore
Documentation/ABI/testing/sysfs-block
Documentation/ABI/testing/sysfs-block-device
Documentation/ABI/testing/sysfs-block-rnbd
Documentation/ABI/testing/sysfs-bus-acpi
Documentation/ABI/testing/sysfs-bus-coresight-devices-cti
Documentation/ABI/testing/sysfs-bus-coresight-devices-etb10
Documentation/ABI/testing/sysfs-bus-coresight-devices-etm3x
Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
Documentation/ABI/testing/sysfs-bus-coresight-devices-stm
Documentation/ABI/testing/sysfs-bus-coresight-devices-tmc
Documentation/ABI/testing/sysfs-bus-css
Documentation/ABI/testing/sysfs-bus-dfl
Documentation/ABI/testing/sysfs-bus-event_source-devices-dfl_fme
Documentation/ABI/testing/sysfs-bus-event_source-devices-format
Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7
Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_gpci
Documentation/ABI/testing/sysfs-bus-fcoe
Documentation/ABI/testing/sysfs-bus-fsl-mc
Documentation/ABI/testing/sysfs-bus-i2c-devices-fsa9480
Documentation/ABI/testing/sysfs-bus-i2c-devices-pca954x
Documentation/ABI/testing/sysfs-bus-i3c
Documentation/ABI/testing/sysfs-bus-iio
Documentation/ABI/testing/sysfs-bus-iio-adc-envelope-detector
Documentation/ABI/testing/sysfs-bus-iio-adc-hi8435
Documentation/ABI/testing/sysfs-bus-iio-adc-stm32
Documentation/ABI/testing/sysfs-bus-iio-cros-ec
Documentation/ABI/testing/sysfs-bus-iio-dfsdm-adc-stm32
Documentation/ABI/testing/sysfs-bus-iio-distance-srf08
Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523
Documentation/ABI/testing/sysfs-bus-iio-frequency-adf4371
Documentation/ABI/testing/sysfs-bus-iio-health-afe440x
Documentation/ABI/testing/sysfs-bus-iio-light-isl29018
Documentation/ABI/testing/sysfs-bus-iio-lptimer-stm32
Documentation/ABI/testing/sysfs-bus-iio-magnetometer-hmc5843
Documentation/ABI/testing/sysfs-bus-iio-temperature-max31856
Documentation/ABI/testing/sysfs-bus-iio-timer-stm32
Documentation/ABI/testing/sysfs-bus-intel_th-devices-gth
Documentation/ABI/testing/sysfs-bus-intel_th-devices-msc
Documentation/ABI/testing/sysfs-bus-most
Documentation/ABI/testing/sysfs-bus-moxtet-devices
Documentation/ABI/testing/sysfs-bus-nfit
Documentation/ABI/testing/sysfs-bus-nvdimm
Documentation/ABI/testing/sysfs-bus-papr-pmem
Documentation/ABI/testing/sysfs-bus-pci
Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats
Documentation/ABI/testing/sysfs-bus-pci-devices-catpt
Documentation/ABI/testing/sysfs-bus-pci-drivers-ehci_hcd
Documentation/ABI/testing/sysfs-bus-rapidio
Documentation/ABI/testing/sysfs-bus-rbd
Documentation/ABI/testing/sysfs-bus-siox
Documentation/ABI/testing/sysfs-bus-thunderbolt
Documentation/ABI/testing/sysfs-bus-usb
Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg
Documentation/ABI/testing/sysfs-bus-vfio-mdev
Documentation/ABI/testing/sysfs-c2port
Documentation/ABI/testing/sysfs-class-backlight
Documentation/ABI/testing/sysfs-class-backlight-adp8860
Documentation/ABI/testing/sysfs-class-backlight-driver-adp8870
Documentation/ABI/testing/sysfs-class-backlight-driver-lm3533
Documentation/ABI/testing/sysfs-class-bdi
Documentation/ABI/testing/sysfs-class-chromeos
Documentation/ABI/testing/sysfs-class-cxl
Documentation/ABI/testing/sysfs-class-devfreq
Documentation/ABI/testing/sysfs-class-devlink
Documentation/ABI/testing/sysfs-class-extcon
Documentation/ABI/testing/sysfs-class-fpga-manager
Documentation/ABI/testing/sysfs-class-gnss
Documentation/ABI/testing/sysfs-class-led
Documentation/ABI/testing/sysfs-class-led-driver-el15203000
Documentation/ABI/testing/sysfs-class-led-driver-lm3533
Documentation/ABI/testing/sysfs-class-led-driver-sc27xx [deleted file]
Documentation/ABI/testing/sysfs-class-led-flash
Documentation/ABI/testing/sysfs-class-led-multicolor
Documentation/ABI/testing/sysfs-class-led-trigger-netdev
Documentation/ABI/testing/sysfs-class-led-trigger-pattern
Documentation/ABI/testing/sysfs-class-led-trigger-usbport
Documentation/ABI/testing/sysfs-class-leds-gt683r
Documentation/ABI/testing/sysfs-class-mic
Documentation/ABI/testing/sysfs-class-net
Documentation/ABI/testing/sysfs-class-net-cdc_ncm
Documentation/ABI/testing/sysfs-class-net-phydev
Documentation/ABI/testing/sysfs-class-ocxl
Documentation/ABI/testing/sysfs-class-pktcdvd
Documentation/ABI/testing/sysfs-class-power
Documentation/ABI/testing/sysfs-class-power-mp2629
Documentation/ABI/testing/sysfs-class-power-twl4030
Documentation/ABI/testing/sysfs-class-power-wilco
Documentation/ABI/testing/sysfs-class-rapidio
Documentation/ABI/testing/sysfs-class-rc
Documentation/ABI/testing/sysfs-class-regulator
Documentation/ABI/testing/sysfs-class-remoteproc
Documentation/ABI/testing/sysfs-class-rnbd-client
Documentation/ABI/testing/sysfs-class-rtc-rtc0-device-rtc_calibration
Documentation/ABI/testing/sysfs-class-rtrs-client
Documentation/ABI/testing/sysfs-class-scsi_host
Documentation/ABI/testing/sysfs-class-typec
Documentation/ABI/testing/sysfs-class-uwb_rc
Documentation/ABI/testing/sysfs-class-watchdog
Documentation/ABI/testing/sysfs-dev
Documentation/ABI/testing/sysfs-devices-mapping
Documentation/ABI/testing/sysfs-devices-memory
Documentation/ABI/testing/sysfs-devices-platform-ACPI-TAD
Documentation/ABI/testing/sysfs-devices-platform-_UDC_-gadget
Documentation/ABI/testing/sysfs-devices-platform-docg3
Documentation/ABI/testing/sysfs-devices-platform-ipmi
Documentation/ABI/testing/sysfs-devices-platform-sh_mobile_lcdc_fb
Documentation/ABI/testing/sysfs-devices-platform-stratix10-rsu
Documentation/ABI/testing/sysfs-devices-system-cpu
Documentation/ABI/testing/sysfs-devices-system-ibm-rtl
Documentation/ABI/testing/sysfs-driver-bd9571mwv-regulator
Documentation/ABI/testing/sysfs-driver-genwqe
Documentation/ABI/testing/sysfs-driver-hid-lenovo
Documentation/ABI/testing/sysfs-driver-hid-logitech-lg4ff
Documentation/ABI/testing/sysfs-driver-hid-ntrig
Documentation/ABI/testing/sysfs-driver-hid-roccat-kone
Documentation/ABI/testing/sysfs-driver-hid-wiimote
Documentation/ABI/testing/sysfs-driver-input-exc3000
Documentation/ABI/testing/sysfs-driver-jz4780-efuse
Documentation/ABI/testing/sysfs-driver-pciback
Documentation/ABI/testing/sysfs-driver-samsung-laptop
Documentation/ABI/testing/sysfs-driver-toshiba_acpi
Documentation/ABI/testing/sysfs-driver-toshiba_haps
Documentation/ABI/testing/sysfs-driver-ufs
Documentation/ABI/testing/sysfs-driver-w1_ds28e17
Documentation/ABI/testing/sysfs-driver-w1_therm
Documentation/ABI/testing/sysfs-driver-wacom
Documentation/ABI/testing/sysfs-driver-xen-blkback
Documentation/ABI/testing/sysfs-driver-xen-blkfront
Documentation/ABI/testing/sysfs-firmware-acpi
Documentation/ABI/testing/sysfs-firmware-dmi-entries
Documentation/ABI/testing/sysfs-firmware-efi-esrt
Documentation/ABI/testing/sysfs-firmware-efi-runtime-map
Documentation/ABI/testing/sysfs-firmware-gsmi
Documentation/ABI/testing/sysfs-firmware-memmap
Documentation/ABI/testing/sysfs-firmware-qemu_fw_cfg
Documentation/ABI/testing/sysfs-firmware-sfi
Documentation/ABI/testing/sysfs-firmware-sgi_uv
Documentation/ABI/testing/sysfs-firmware-turris-mox-rwtm
Documentation/ABI/testing/sysfs-fs-ext4
Documentation/ABI/testing/sysfs-fs-f2fs
Documentation/ABI/testing/sysfs-hypervisor-xen
Documentation/ABI/testing/sysfs-kernel-boot_params
Documentation/ABI/testing/sysfs-kernel-mm-hugepages
Documentation/ABI/testing/sysfs-kernel-mm-ksm
Documentation/ABI/testing/sysfs-kernel-slab
Documentation/ABI/testing/sysfs-module
Documentation/ABI/testing/sysfs-platform-asus-laptop
Documentation/ABI/testing/sysfs-platform-asus-wmi
Documentation/ABI/testing/sysfs-platform-at91
Documentation/ABI/testing/sysfs-platform-dell-laptop
Documentation/ABI/testing/sysfs-platform-dell-smbios
Documentation/ABI/testing/sysfs-platform-dfl-fme
Documentation/ABI/testing/sysfs-platform-dptf
Documentation/ABI/testing/sysfs-platform-eeepc-laptop
Documentation/ABI/testing/sysfs-platform-i2c-demux-pinctrl
Documentation/ABI/testing/sysfs-platform-ideapad-laptop
Documentation/ABI/testing/sysfs-platform-intel-wmi-sbl-fw-update
Documentation/ABI/testing/sysfs-platform-intel-wmi-thunderbolt
Documentation/ABI/testing/sysfs-platform-kim
Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2
Documentation/ABI/testing/sysfs-platform-renesas_usb3
Documentation/ABI/testing/sysfs-platform-sst-atom
Documentation/ABI/testing/sysfs-platform-usbip-vudc
Documentation/ABI/testing/sysfs-platform-wilco-ec
Documentation/ABI/testing/sysfs-power
Documentation/ABI/testing/sysfs-profiling
Documentation/ABI/testing/sysfs-ptp
Documentation/ABI/testing/sysfs-uevent
Documentation/ABI/testing/sysfs-wusb_cbaf
Documentation/ABI/testing/usb-charger-uevent
Documentation/ABI/testing/usb-uevent
Documentation/Kconfig
Documentation/Makefile
Documentation/admin-guide/LSM/SafeSetID.rst
Documentation/admin-guide/abi-obsolete.rst [new file with mode: 0644]
Documentation/admin-guide/abi-removed.rst [new file with mode: 0644]
Documentation/admin-guide/abi-stable.rst [new file with mode: 0644]
Documentation/admin-guide/abi-testing.rst [new file with mode: 0644]
Documentation/admin-guide/abi.rst [new file with mode: 0644]
Documentation/admin-guide/cpu-load.rst
Documentation/admin-guide/index.rst
Documentation/admin-guide/kernel-parameters.txt
Documentation/admin-guide/pm/cpuidle.rst
Documentation/admin-guide/sysctl/net.rst
Documentation/admin-guide/sysctl/vm.rst
Documentation/arm/sunxi.rst
Documentation/arm64/hugetlbpage.rst
Documentation/arm64/memory-tagging-extension.rst
Documentation/arm64/silicon-errata.rst
Documentation/block/queue-sysfs.rst
Documentation/conf.py
Documentation/core-api/dma-api.rst
Documentation/dev-tools/kasan.rst
Documentation/dev-tools/kunit/start.rst
Documentation/dev-tools/kunit/usage.rst
Documentation/devicetree/bindings/arm/actions.yaml
Documentation/devicetree/bindings/arm/altera.yaml
Documentation/devicetree/bindings/arm/amazon,al.yaml
Documentation/devicetree/bindings/arm/amlogic.yaml
Documentation/devicetree/bindings/arm/arm,integrator.yaml
Documentation/devicetree/bindings/arm/arm,realview.yaml
Documentation/devicetree/bindings/arm/arm,versatile.yaml
Documentation/devicetree/bindings/arm/arm,vexpress-juno.yaml
Documentation/devicetree/bindings/arm/atmel-at91.yaml
Documentation/devicetree/bindings/arm/axxia.yaml
Documentation/devicetree/bindings/arm/bcm/bcm2835.yaml
Documentation/devicetree/bindings/arm/bcm/brcm,bcm11351.yaml
Documentation/devicetree/bindings/arm/bcm/brcm,bcm21664.yaml
Documentation/devicetree/bindings/arm/bcm/brcm,bcm23550.yaml
Documentation/devicetree/bindings/arm/bcm/brcm,bcm4708.yaml
Documentation/devicetree/bindings/arm/bcm/brcm,cygnus.yaml
Documentation/devicetree/bindings/arm/bcm/brcm,hr2.yaml
Documentation/devicetree/bindings/arm/bcm/brcm,ns2.yaml
Documentation/devicetree/bindings/arm/bcm/brcm,nsp.yaml
Documentation/devicetree/bindings/arm/bcm/brcm,stingray.yaml
Documentation/devicetree/bindings/arm/bcm/brcm,vulcan-soc.yaml
Documentation/devicetree/bindings/arm/bitmain.yaml
Documentation/devicetree/bindings/arm/calxeda.yaml
Documentation/devicetree/bindings/arm/digicolor.yaml
Documentation/devicetree/bindings/arm/fsl.yaml
Documentation/devicetree/bindings/arm/hisilicon/hisilicon.yaml
Documentation/devicetree/bindings/arm/intel,keembay.yaml
Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml
Documentation/devicetree/bindings/arm/keystone/ti,k3-sci-common.yaml
Documentation/devicetree/bindings/arm/marvell/armada-7k-8k.yaml
Documentation/devicetree/bindings/arm/mediatek.yaml
Documentation/devicetree/bindings/arm/microchip,sparx5.yaml
Documentation/devicetree/bindings/arm/moxart.yaml
Documentation/devicetree/bindings/arm/mrvl/mrvl.yaml
Documentation/devicetree/bindings/arm/mstar/mstar.yaml
Documentation/devicetree/bindings/arm/nxp/lpc32xx.yaml
Documentation/devicetree/bindings/arm/omap/prm-inst.txt
Documentation/devicetree/bindings/arm/qcom.yaml
Documentation/devicetree/bindings/arm/rda.yaml
Documentation/devicetree/bindings/arm/realtek.yaml
Documentation/devicetree/bindings/arm/renesas.yaml
Documentation/devicetree/bindings/arm/rockchip.yaml
Documentation/devicetree/bindings/arm/samsung/pmu.yaml
Documentation/devicetree/bindings/arm/samsung/samsung-boards.yaml
Documentation/devicetree/bindings/arm/sirf.yaml
Documentation/devicetree/bindings/arm/socionext/milbeaut.yaml
Documentation/devicetree/bindings/arm/socionext/uniphier.yaml
Documentation/devicetree/bindings/arm/spear.yaml
Documentation/devicetree/bindings/arm/sprd/sprd.yaml
Documentation/devicetree/bindings/arm/sti.yaml
Documentation/devicetree/bindings/arm/stm32/stm32.yaml
Documentation/devicetree/bindings/arm/sunxi.yaml
Documentation/devicetree/bindings/arm/tegra.yaml
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.txt
Documentation/devicetree/bindings/arm/ti/k3.txt [deleted file]
Documentation/devicetree/bindings/arm/ti/k3.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/arm/ti/nspire.yaml
Documentation/devicetree/bindings/arm/ti/ti,davinci.yaml
Documentation/devicetree/bindings/arm/toshiba.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/arm/ux500.yaml
Documentation/devicetree/bindings/arm/vt8500.yaml
Documentation/devicetree/bindings/arm/xilinx.yaml
Documentation/devicetree/bindings/arm/zte.yaml
Documentation/devicetree/bindings/bus/brcm,gisb-arb.txt
Documentation/devicetree/bindings/clock/hi6220-clock.txt
Documentation/devicetree/bindings/crypto/allwinner,sun4i-a10-crypto.yaml
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
Documentation/devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml
Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml
Documentation/devicetree/bindings/eeprom/at25.yaml
Documentation/devicetree/bindings/fuse/nvidia,tegra20-fuse.txt
Documentation/devicetree/bindings/gpio/kontron,sl28cpld-gpio.yaml
Documentation/devicetree/bindings/gpu/arm,mali-utgard.yaml
Documentation/devicetree/bindings/i2c/google,cros-ec-i2c-tunnel.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.txt [deleted file]
Documentation/devicetree/bindings/i2c/ingenic,i2c.yaml
Documentation/devicetree/bindings/iio/adc/adi,ad7291.yaml
Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
Documentation/devicetree/bindings/iio/adc/cosmic,10001-adc.yaml
Documentation/devicetree/bindings/iio/adc/holt,hi8435.yaml
Documentation/devicetree/bindings/iio/adc/lltc,ltc2497.yaml
Documentation/devicetree/bindings/iio/humidity/ti,hdc2010.yaml
Documentation/devicetree/bindings/input/adc-joystick.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/input/cros-ec-keyb.txt [deleted file]
Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/input/touchscreen/zinitix.txt [new file with mode: 0644]
Documentation/devicetree/bindings/interrupt-controller/allwinner,sun7i-a20-sc-nmi.yaml
Documentation/devicetree/bindings/interrupt-controller/ti,pruss-intc.yaml
Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml
Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.yaml
Documentation/devicetree/bindings/leds/backlight/common.yaml
Documentation/devicetree/bindings/leds/common.yaml
Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
Documentation/devicetree/bindings/leds/leds-lp50xx.yaml
Documentation/devicetree/bindings/mailbox/mtk-gce.txt
Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml
Documentation/devicetree/bindings/media/allwinner,sun4i-a10-ir.yaml
Documentation/devicetree/bindings/memory-controllers/mediatek,smi-common.txt
Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.txt
Documentation/devicetree/bindings/mfd/ene-kb3930.yaml
Documentation/devicetree/bindings/mfd/google,cros-ec.yaml
Documentation/devicetree/bindings/mips/ingenic/devices.yaml
Documentation/devicetree/bindings/mips/loongson/devices.yaml
Documentation/devicetree/bindings/misc/nvidia,tegra186-misc.txt
Documentation/devicetree/bindings/misc/nvidia,tegra20-apbmisc.txt
Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml
Documentation/devicetree/bindings/mmc/microchip,dw-sparx5-sdhci.yaml
Documentation/devicetree/bindings/mmc/sdhci-am654.yaml
Documentation/devicetree/bindings/net/can/can-controller.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt [deleted file]
Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/net/ftgmac100.txt
Documentation/devicetree/bindings/net/intel,dwmac-plat.yaml
Documentation/devicetree/bindings/net/ti,dp83822.yaml
Documentation/devicetree/bindings/nvmem/vf610-ocotp.txt
Documentation/devicetree/bindings/pci/socionext,uniphier-pcie-ep.yaml
Documentation/devicetree/bindings/phy/socionext,uniphier-ahci-phy.yaml
Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml
Documentation/devicetree/bindings/pinctrl/actions,s500-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/pinctrl-mt8192.yaml
Documentation/devicetree/bindings/pinctrl/qcom,msm8226-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/toshiba,visconti-pinctrl.yaml
Documentation/devicetree/bindings/power/amlogic,meson-ee-pwrc.yaml
Documentation/devicetree/bindings/power/brcm,bcm63xx-power.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/renesas,rcar-sysc.yaml
Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml
Documentation/devicetree/bindings/power/supply/summit,smb347-charger.yaml
Documentation/devicetree/bindings/regulator/mps,mp886x.yaml
Documentation/devicetree/bindings/regulator/pfuze100.yaml
Documentation/devicetree/bindings/reset/renesas,rst.yaml
Documentation/devicetree/bindings/reset/xlnx,zynqmp-reset.txt
Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml
Documentation/devicetree/bindings/riscv/sifive.yaml
Documentation/devicetree/bindings/rng/imx-rng.yaml
Documentation/devicetree/bindings/serial/fsl-imx-uart.yaml
Documentation/devicetree/bindings/soc/ti/k3-ringacc.yaml
Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml
Documentation/devicetree/bindings/sound/mchp,spdifrx.yaml
Documentation/devicetree/bindings/sound/mchp,spdiftx.yaml
Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
Documentation/devicetree/bindings/sound/realtek,rt1015p.yaml
Documentation/devicetree/bindings/sram/allwinner,sun4i-a10-system-control.yaml
Documentation/devicetree/bindings/timer/arm,sp804.yaml
Documentation/devicetree/bindings/usb/cdns,usb3.yaml
Documentation/devicetree/bindings/usb/ti,hd3ss3220.yaml
Documentation/devicetree/bindings/vendor-prefixes.yaml
Documentation/devicetree/bindings/w1/fsl-imx-owire.yaml
Documentation/driver-api/index.rst
Documentation/fault-injection/provoke-crashes.rst
Documentation/fb/fbcon.rst
Documentation/filesystems/api-summary.rst
Documentation/filesystems/debugfs.rst
Documentation/filesystems/ext4/journal.rst
Documentation/filesystems/ext4/super.rst
Documentation/filesystems/journalling.rst
Documentation/firmware-guide/acpi/acpi-lid.rst
Documentation/firmware-guide/acpi/gpio-properties.rst
Documentation/firmware-guide/acpi/method-tracing.rst
Documentation/gpu/amdgpu.rst
Documentation/hwmon/adm1266.rst
Documentation/hwmon/index.rst
Documentation/hwmon/mp2975.rst
Documentation/leds/index.rst
Documentation/leds/leds-el15203000.rst [new file with mode: 0644]
Documentation/leds/leds-sc27xx.rst [new file with mode: 0644]
Documentation/locking/lockdep-design.rst
Documentation/misc-devices/index.rst
Documentation/misc-devices/mic/index.rst [deleted file]
Documentation/misc-devices/mic/mic_overview.rst [deleted file]
Documentation/misc-devices/mic/scif_overview.rst [deleted file]
Documentation/networking/devlink/ice.rst
Documentation/networking/devlink/netdevsim.rst
Documentation/networking/index.rst
Documentation/networking/ip-sysctl.rst
Documentation/networking/j1939.rst
Documentation/networking/kapi.rst
Documentation/networking/mptcp-sysctl.rst [new file with mode: 0644]
Documentation/networking/netdev-FAQ.rst
Documentation/networking/phy.rst
Documentation/networking/statistics.rst
Documentation/process/deprecated.rst
Documentation/process/magic-number.rst
Documentation/process/stable-kernel-rules.rst
Documentation/process/submitting-patches.rst
Documentation/sphinx/automarkup.py
Documentation/sphinx/kernel_abi.py [new file with mode: 0644]
Documentation/sphinx/kernellog.py
Documentation/translations/it_IT/process/magic-number.rst
Documentation/translations/it_IT/process/stable-kernel-rules.rst
Documentation/translations/zh_CN/admin-guide/index.rst
Documentation/translations/zh_CN/arm64/hugetlbpage.rst [new file with mode: 0644]
Documentation/translations/zh_CN/arm64/index.rst
Documentation/translations/zh_CN/process/magic-number.rst
Documentation/userspace-api/index.rst
Documentation/virt/kvm/api.rst
Documentation/virt/kvm/cpuid.rst
Documentation/vm/mmu_notifier.rst
Documentation/vm/page_migration.rst
Documentation/vm/page_owner.rst
Documentation/vm/slub.rst
Documentation/x86/x86_64/mm.rst
MAINTAINERS
Makefile
arch/arc/include/asm/linkage.h
arch/arc/include/asm/mach_desc.h
arch/arc/kernel/head.S
arch/arc/kernel/stacktrace.c
arch/arc/plat-hsdk/platform.c
arch/arm/Kconfig
arch/arm/Kconfig.debug
arch/arm/Makefile
arch/arm/boot/dts/Makefile
arch/arm/boot/dts/alpine.dtsi
arch/arm/boot/dts/am335x-lxm.dts
arch/arm/boot/dts/am335x-moxa-uc-8100-common.dtsi [new file with mode: 0644]
arch/arm/boot/dts/am335x-moxa-uc-8100-me-t.dts
arch/arm/boot/dts/am335x-sbc-t335.dts
arch/arm/boot/dts/am33xx-l4.dtsi
arch/arm/boot/dts/am33xx.dtsi
arch/arm/boot/dts/am3517-evm-ui.dtsi
arch/arm/boot/dts/am3517-evm.dts
arch/arm/boot/dts/am3874-iceboard.dts
arch/arm/boot/dts/am4372.dtsi
arch/arm/boot/dts/am437x-cm-t43.dts
arch/arm/boot/dts/am437x-gp-evm.dts
arch/arm/boot/dts/am437x-idk-evm.dts
arch/arm/boot/dts/am437x-l4.dtsi
arch/arm/boot/dts/am437x-sbc-t43.dts
arch/arm/boot/dts/am437x-sk-evm.dts
arch/arm/boot/dts/am43x-epos-evm.dts
arch/arm/boot/dts/am571x-idk.dts
arch/arm/boot/dts/am5729-beagleboneai.dts
arch/arm/boot/dts/am572x-idk.dts
arch/arm/boot/dts/am574x-idk.dts
arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi
arch/arm/boot/dts/am57xx-cl-som-am57x.dts
arch/arm/boot/dts/am57xx-idk-common.dtsi
arch/arm/boot/dts/am57xx-sbc-am57x.dts
arch/arm/boot/dts/animeo_ip.dts
arch/arm/boot/dts/arm-realview-eb.dtsi
arch/arm/boot/dts/arm-realview-pb11mp.dts
arch/arm/boot/dts/arm-realview-pbx.dtsi
arch/arm/boot/dts/aspeed-bmc-facebook-cmm.dts
arch/arm/boot/dts/aspeed-bmc-facebook-minipack.dts
arch/arm/boot/dts/aspeed-bmc-facebook-wedge40.dts
arch/arm/boot/dts/aspeed-bmc-facebook-wedge400.dts [new file with mode: 0644]
arch/arm/boot/dts/aspeed-bmc-facebook-yamp.dts
arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts
arch/arm/boot/dts/aspeed-bmc-opp-mowgli.dts [new file with mode: 0644]
arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts
arch/arm/boot/dts/aspeed-g5.dtsi
arch/arm/boot/dts/ast2500-facebook-netbmc-common.dtsi
arch/arm/boot/dts/at91-ariag25.dts
arch/arm/boot/dts/at91-ariettag25.dts
arch/arm/boot/dts/at91-cosino.dtsi
arch/arm/boot/dts/at91-cosino_mega2560.dts
arch/arm/boot/dts/at91-foxg20.dts
arch/arm/boot/dts/at91-kizbox.dts
arch/arm/boot/dts/at91-kizbox2-common.dtsi
arch/arm/boot/dts/at91-kizboxmini-common.dtsi
arch/arm/boot/dts/at91-linea.dtsi
arch/arm/boot/dts/at91-qil_a9260.dts
arch/arm/boot/dts/at91-sam9_l9260.dts
arch/arm/boot/dts/at91-sama5d3_xplained.dts
arch/arm/boot/dts/at91-sama5d4_ma5d4.dtsi
arch/arm/boot/dts/at91-sama5d4_xplained.dts
arch/arm/boot/dts/at91-sama5d4ek.dts
arch/arm/boot/dts/at91-som60.dtsi
arch/arm/boot/dts/at91-vinco.dts
arch/arm/boot/dts/at91-wb45n.dtsi
arch/arm/boot/dts/at91-wb50n.dtsi
arch/arm/boot/dts/at91rm9200.dtsi
arch/arm/boot/dts/at91rm9200ek.dts
arch/arm/boot/dts/at91sam9260.dtsi
arch/arm/boot/dts/at91sam9260ek.dts
arch/arm/boot/dts/at91sam9261.dtsi
arch/arm/boot/dts/at91sam9261ek.dts
arch/arm/boot/dts/at91sam9263.dtsi
arch/arm/boot/dts/at91sam9263ek.dts
arch/arm/boot/dts/at91sam9g20.dtsi
arch/arm/boot/dts/at91sam9g20ek_common.dtsi
arch/arm/boot/dts/at91sam9g25-gardena-smart-gateway.dts [new file with mode: 0644]
arch/arm/boot/dts/at91sam9g45.dtsi
arch/arm/boot/dts/at91sam9m10g45ek.dts
arch/arm/boot/dts/at91sam9n12.dtsi
arch/arm/boot/dts/at91sam9n12ek.dts
arch/arm/boot/dts/at91sam9rl.dtsi
arch/arm/boot/dts/at91sam9rlek.dts
arch/arm/boot/dts/at91sam9x5.dtsi
arch/arm/boot/dts/at91sam9x5cm.dtsi
arch/arm/boot/dts/at91sam9x5ek.dtsi
arch/arm/boot/dts/at91sam9xe.dtsi
arch/arm/boot/dts/bcm-cygnus.dtsi
arch/arm/boot/dts/bcm-nsp.dtsi
arch/arm/boot/dts/bcm2711-rpi-4-b.dts
arch/arm/boot/dts/bcm2711.dtsi
arch/arm/boot/dts/bcm53016-meraki-mr32.dts [new file with mode: 0644]
arch/arm/boot/dts/bcm5301x.dtsi
arch/arm/boot/dts/bcm958525xmc.dts
arch/arm/boot/dts/bcm958625k.dts
arch/arm/boot/dts/dra7-evm.dts
arch/arm/boot/dts/dra7-l4.dtsi
arch/arm/boot/dts/dra7.dtsi
arch/arm/boot/dts/dra71-evm.dts
arch/arm/boot/dts/dra72-evm-common.dtsi
arch/arm/boot/dts/dra72-evm-revc.dts
arch/arm/boot/dts/dra72-evm.dts
arch/arm/boot/dts/dra76-evm.dts
arch/arm/boot/dts/emev2.dtsi
arch/arm/boot/dts/ethernut5.dts
arch/arm/boot/dts/exynos3250-artik5.dtsi
arch/arm/boot/dts/exynos3250-monk.dts
arch/arm/boot/dts/exynos3250-rinato.dts
arch/arm/boot/dts/exynos3250.dtsi
arch/arm/boot/dts/exynos4210-i9100.dts
arch/arm/boot/dts/exynos4210-origen.dts
arch/arm/boot/dts/exynos4210-smdkv310.dts
arch/arm/boot/dts/exynos4210-trats.dts
arch/arm/boot/dts/exynos4210-universal_c210.dts
arch/arm/boot/dts/exynos4210.dtsi
arch/arm/boot/dts/exynos4412-galaxy-s3.dtsi
arch/arm/boot/dts/exynos4412-i9300.dts
arch/arm/boot/dts/exynos4412-i9305.dts
arch/arm/boot/dts/exynos4412-midas.dtsi
arch/arm/boot/dts/exynos4412-n710x.dts
arch/arm/boot/dts/exynos4412-odroid-common.dtsi
arch/arm/boot/dts/exynos4412-odroidu3.dts
arch/arm/boot/dts/exynos4412-origen.dts
arch/arm/boot/dts/exynos4412-smdk4412.dts
arch/arm/boot/dts/exynos4412-tiny4412.dts
arch/arm/boot/dts/exynos4412-trats2.dts
arch/arm/boot/dts/exynos4412.dtsi
arch/arm/boot/dts/exynos5.dtsi
arch/arm/boot/dts/exynos5250-arndale.dts
arch/arm/boot/dts/exynos5250-smdk5250.dts
arch/arm/boot/dts/exynos5250-spring.dts
arch/arm/boot/dts/exynos5250.dtsi
arch/arm/boot/dts/exynos5260.dtsi
arch/arm/boot/dts/exynos5410-odroidxu.dts
arch/arm/boot/dts/exynos5410-smdk5410.dts
arch/arm/boot/dts/exynos5410.dtsi
arch/arm/boot/dts/exynos5420-smdk5420.dts
arch/arm/boot/dts/exynos5420.dtsi
arch/arm/boot/dts/exynos5422-odroid-core.dtsi
arch/arm/boot/dts/exynos5422-odroidxu3-audio.dtsi
arch/arm/boot/dts/exynos5422-odroidxu4.dts
arch/arm/boot/dts/hi3620.dtsi
arch/arm/boot/dts/hip04.dtsi
arch/arm/boot/dts/hisi-x5hd2.dtsi
arch/arm/boot/dts/imx23-evk.dts
arch/arm/boot/dts/imx23.dtsi
arch/arm/boot/dts/imx25-pinfunc.h
arch/arm/boot/dts/imx27-phytec-phycard-s-som.dtsi
arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts
arch/arm/boot/dts/imx27.dtsi
arch/arm/boot/dts/imx28-apf28.dts
arch/arm/boot/dts/imx28-apx4devkit.dts
arch/arm/boot/dts/imx28-evk.dts
arch/arm/boot/dts/imx28-m28.dtsi
arch/arm/boot/dts/imx28-m28cu3.dts
arch/arm/boot/dts/imx28.dtsi
arch/arm/boot/dts/imx50-evk.dts
arch/arm/boot/dts/imx51-apf51dev.dts
arch/arm/boot/dts/imx53-m53menlo.dts
arch/arm/boot/dts/imx53-smd.dts
arch/arm/boot/dts/imx53-tqma53.dtsi
arch/arm/boot/dts/imx53-voipac-dmm-668.dtsi
arch/arm/boot/dts/imx6-logicpd-baseboard.dtsi
arch/arm/boot/dts/imx6dl-aristainetos_4.dts
arch/arm/boot/dts/imx6dl-eckelmann-ci4x10.dts
arch/arm/boot/dts/imx6dl-prtrvt.dts
arch/arm/boot/dts/imx6dl-prtvt7.dts
arch/arm/boot/dts/imx6dl-tqma6a.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx6dl-tqma6b.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx6dl-yapp4-common.dtsi
arch/arm/boot/dts/imx6dl-yapp4-hydra.dts
arch/arm/boot/dts/imx6dl-yapp4-orion.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6dl-yapp4-ursa.dts
arch/arm/boot/dts/imx6dl.dtsi
arch/arm/boot/dts/imx6q-b450v3.dts
arch/arm/boot/dts/imx6q-b650v3.dts
arch/arm/boot/dts/imx6q-b850v3.dts
arch/arm/boot/dts/imx6q-ba16.dtsi
arch/arm/boot/dts/imx6q-bx50v3.dtsi
arch/arm/boot/dts/imx6q-cm-fx6.dts
arch/arm/boot/dts/imx6q-dhcom-som.dtsi
arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
arch/arm/boot/dts/imx6q-dms-ba16.dts
arch/arm/boot/dts/imx6q-gw5400-a.dts
arch/arm/boot/dts/imx6q-kontron-samx6i.dtsi
arch/arm/boot/dts/imx6q-logicpd.dts
arch/arm/boot/dts/imx6q-prti6q.dts
arch/arm/boot/dts/imx6q-tqma6a.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx6q-tqma6b.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx6q-var-dt6customboard.dts
arch/arm/boot/dts/imx6q.dtsi
arch/arm/boot/dts/imx6qdl-apalis.dtsi
arch/arm/boot/dts/imx6qdl-aristainetos.dtsi
arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi
arch/arm/boot/dts/imx6qdl-colibri.dtsi
arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi
arch/arm/boot/dts/imx6qdl-emcon.dtsi
arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
arch/arm/boot/dts/imx6qdl-gw551x.dtsi
arch/arm/boot/dts/imx6qdl-gw552x.dtsi
arch/arm/boot/dts/imx6qdl-gw553x.dtsi
arch/arm/boot/dts/imx6qdl-gw560x.dtsi
arch/arm/boot/dts/imx6qdl-gw5903.dtsi
arch/arm/boot/dts/imx6qdl-gw5904.dtsi
arch/arm/boot/dts/imx6qdl-gw5907.dtsi
arch/arm/boot/dts/imx6qdl-gw5910.dtsi
arch/arm/boot/dts/imx6qdl-gw5912.dtsi
arch/arm/boot/dts/imx6qdl-gw5913.dtsi
arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi
arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi
arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi
arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
arch/arm/boot/dts/imx6qdl-pico.dtsi
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
arch/arm/boot/dts/imx6qdl-sabresd.dtsi
arch/arm/boot/dts/imx6qdl-tqma6.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx6qdl-tqma6a.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx6qdl-tqma6b.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx6qdl-ts4900.dtsi
arch/arm/boot/dts/imx6qdl-ts7970.dtsi
arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
arch/arm/boot/dts/imx6qdl.dtsi
arch/arm/boot/dts/imx6qp-sabreauto.dts
arch/arm/boot/dts/imx6qp-tqma6b.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx6sl-evk.dts
arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6sl.dtsi
arch/arm/boot/dts/imx6sll-evk.dts
arch/arm/boot/dts/imx6sll.dtsi
arch/arm/boot/dts/imx6sx-sdb.dtsi
arch/arm/boot/dts/imx6sx-softing-vining-2000.dts
arch/arm/boot/dts/imx6sx.dtsi
arch/arm/boot/dts/imx6ul-kontron-n6x1x-s.dtsi
arch/arm/boot/dts/imx6ul-kontron-n6x1x-som-common.dtsi
arch/arm/boot/dts/imx6ul-phytec-segin.dtsi
arch/arm/boot/dts/imx6ul.dtsi
arch/arm/boot/dts/imx6ull-colibri.dtsi
arch/arm/boot/dts/imx6ull.dtsi
arch/arm/boot/dts/imx7-colibri.dtsi
arch/arm/boot/dts/imx7d-sdb.dts
arch/arm/boot/dts/imx7d-zii-rmu2.dts
arch/arm/boot/dts/imx7d-zii-rpu2.dts
arch/arm/boot/dts/imx7s.dtsi
arch/arm/boot/dts/iwg20d-q7-common.dtsi
arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi
arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi
arch/arm/boot/dts/meson.dtsi
arch/arm/boot/dts/meson8.dtsi
arch/arm/boot/dts/mmp2-olpc-xo-1-75.dts
arch/arm/boot/dts/mmp3.dtsi
arch/arm/boot/dts/motorola-mapphone-common.dtsi
arch/arm/boot/dts/mpa1600.dts
arch/arm/boot/dts/mps2.dtsi
arch/arm/boot/dts/mstar-infinity-msc313-breadbee_crust.dts [moved from arch/arm/boot/dts/infinity-msc313-breadbee_crust.dts with 90% similarity]
arch/arm/boot/dts/mstar-infinity-msc313.dtsi [moved from arch/arm/boot/dts/mercury5-ssc8336n.dtsi with 87% similarity]
arch/arm/boot/dts/mstar-infinity.dtsi [moved from arch/arm/boot/dts/infinity.dtsi with 100% similarity]
arch/arm/boot/dts/mstar-infinity3-msc313e-breadbee.dts [moved from arch/arm/boot/dts/infinity3-msc313e-breadbee.dts with 89% similarity]
arch/arm/boot/dts/mstar-infinity3-msc313e.dtsi [moved from arch/arm/boot/dts/infinity-msc313.dtsi with 87% similarity]
arch/arm/boot/dts/mstar-infinity3.dtsi [moved from arch/arm/boot/dts/infinity3.dtsi with 84% similarity]
arch/arm/boot/dts/mstar-mercury5-ssc8336n-midrived08.dts [moved from arch/arm/boot/dts/mercury5-ssc8336n-midrived08.dts with 89% similarity]
arch/arm/boot/dts/mstar-mercury5-ssc8336n.dtsi [moved from arch/arm/boot/dts/infinity3-msc313e.dtsi with 87% similarity]
arch/arm/boot/dts/mstar-mercury5.dtsi [moved from arch/arm/boot/dts/mercury5.dtsi with 100% similarity]
arch/arm/boot/dts/mstar-v7.dtsi
arch/arm/boot/dts/mt2701.dtsi
arch/arm/boot/dts/mt7623.dtsi
arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
arch/arm/boot/dts/mt7623n-rfb-emmc.dts
arch/arm/boot/dts/mt7623n.dtsi [new file with mode: 0644]
arch/arm/boot/dts/nspire.dtsi
arch/arm/boot/dts/omap3-beagle-xm.dts
arch/arm/boot/dts/omap3-beagle.dts
arch/arm/boot/dts/omap3-cm-t3517.dts
arch/arm/boot/dts/omap3-cm-t3530.dts
arch/arm/boot/dts/omap3-cm-t3730.dts
arch/arm/boot/dts/omap3-cm-t3x.dtsi
arch/arm/boot/dts/omap3-cpu-thermal.dtsi
arch/arm/boot/dts/omap3-devkit8000-common.dtsi
arch/arm/boot/dts/omap3-gta04.dtsi
arch/arm/boot/dts/omap3-ha-lcd.dts
arch/arm/boot/dts/omap3-igep0020-common.dtsi
arch/arm/boot/dts/omap3-n9.dts
arch/arm/boot/dts/omap3-n900.dts
arch/arm/boot/dts/omap3-n950.dts
arch/arm/boot/dts/omap3-overo-common-dvi.dtsi
arch/arm/boot/dts/omap3-overo-common-lcd35.dtsi
arch/arm/boot/dts/omap3-overo-common-lcd43.dtsi
arch/arm/boot/dts/omap3-pandora-common.dtsi
arch/arm/boot/dts/omap3-panel-sharp-ls037v7dw01.dtsi
arch/arm/boot/dts/omap3-thunder.dts
arch/arm/boot/dts/omap3.dtsi
arch/arm/boot/dts/omap34xx.dtsi
arch/arm/boot/dts/omap36xx.dtsi
arch/arm/boot/dts/omap4-duovero-parlor.dts
arch/arm/boot/dts/omap4-l4-abe.dtsi
arch/arm/boot/dts/omap4-panda-common.dtsi
arch/arm/boot/dts/omap4-sdp.dts
arch/arm/boot/dts/omap4.dtsi
arch/arm/boot/dts/omap443x.dtsi
arch/arm/boot/dts/omap5-board-common.dtsi
arch/arm/boot/dts/omap5-cm-t54.dts
arch/arm/boot/dts/omap5-l4-abe.dtsi
arch/arm/boot/dts/omap5.dtsi
arch/arm/boot/dts/owl-s500-labrador-base-m.dts [new file with mode: 0644]
arch/arm/boot/dts/owl-s500-labrador-v2.dtsi [new file with mode: 0644]
arch/arm/boot/dts/owl-s500-roseapplepi.dts [new file with mode: 0644]
arch/arm/boot/dts/owl-s500.dtsi
arch/arm/boot/dts/picoxcell-pc3x2.dtsi
arch/arm/boot/dts/picoxcell-pc3x3.dtsi
arch/arm/boot/dts/pm9g45.dts
arch/arm/boot/dts/prima2.dtsi
arch/arm/boot/dts/qcom-mdm9615.dtsi
arch/arm/boot/dts/r7s72100.dtsi
arch/arm/boot/dts/r7s9210.dtsi
arch/arm/boot/dts/r8a73a4.dtsi
arch/arm/boot/dts/r8a7740.dtsi
arch/arm/boot/dts/r8a7742-iwg21d-q7-dbcm-ca.dts
arch/arm/boot/dts/r8a7742-iwg21d-q7.dts
arch/arm/boot/dts/r8a7742-iwg21m.dtsi
arch/arm/boot/dts/r8a7742.dtsi
arch/arm/boot/dts/r8a7743.dtsi
arch/arm/boot/dts/r8a7744.dtsi
arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts
arch/arm/boot/dts/r8a7745.dtsi
arch/arm/boot/dts/r8a77470.dtsi
arch/arm/boot/dts/r8a7778.dtsi
arch/arm/boot/dts/r8a7779.dtsi
arch/arm/boot/dts/r8a7790.dtsi
arch/arm/boot/dts/r8a7791.dtsi
arch/arm/boot/dts/r8a7792.dtsi
arch/arm/boot/dts/r8a7793.dtsi
arch/arm/boot/dts/r8a7794.dtsi
arch/arm/boot/dts/r9a06g032.dtsi
arch/arm/boot/dts/rk3066a-bqcurie2.dts
arch/arm/boot/dts/rk3066a-marsboard.dts
arch/arm/boot/dts/rk3066a-rayeager.dts
arch/arm/boot/dts/rk3066a.dtsi
arch/arm/boot/dts/rk3288-evb.dtsi
arch/arm/boot/dts/rk3288-firefly-reload-core.dtsi
arch/arm/boot/dts/rk3288-firefly.dtsi
arch/arm/boot/dts/rk3288-miqi.dts
arch/arm/boot/dts/rk3288-popmetal.dts
arch/arm/boot/dts/rk3288-r89.dts
arch/arm/boot/dts/rk3288-rock2-square.dts
arch/arm/boot/dts/rk3288-tinker.dtsi
arch/arm/boot/dts/rk3288-vyasa.dts
arch/arm/boot/dts/s3c2416-smdk2416.dts
arch/arm/boot/dts/s3c2416.dtsi
arch/arm/boot/dts/s3c24xx.dtsi
arch/arm/boot/dts/s3c6410-mini6410.dts
arch/arm/boot/dts/s3c6410-smdk6410.dts
arch/arm/boot/dts/s3c64xx.dtsi
arch/arm/boot/dts/s5pv210-aquila.dts
arch/arm/boot/dts/s5pv210-aries.dtsi
arch/arm/boot/dts/s5pv210-fascinate4g.dts
arch/arm/boot/dts/s5pv210-galaxys.dts
arch/arm/boot/dts/s5pv210-goni.dts
arch/arm/boot/dts/s5pv210-smdkc110.dts
arch/arm/boot/dts/s5pv210-smdkv210.dts
arch/arm/boot/dts/s5pv210-torbreck.dts
arch/arm/boot/dts/s5pv210.dtsi
arch/arm/boot/dts/sam9x60.dtsi
arch/arm/boot/dts/sama5d2.dtsi
arch/arm/boot/dts/sama5d3.dtsi
arch/arm/boot/dts/sama5d3xcm.dtsi
arch/arm/boot/dts/sama5d3xcm_cmp.dtsi
arch/arm/boot/dts/sama5d4.dtsi
arch/arm/boot/dts/sd5203.dts [new file with mode: 0644]
arch/arm/boot/dts/sh73a0.dtsi
arch/arm/boot/dts/spear13xx.dtsi
arch/arm/boot/dts/ste-href.dtsi
arch/arm/boot/dts/ste-ux500-samsung-golden.dts
arch/arm/boot/dts/ste-ux500-samsung-skomer.dts
arch/arm/boot/dts/stm32h743.dtsi
arch/arm/boot/dts/stm32mp15-pinctrl.dtsi
arch/arm/boot/dts/stm32mp151.dtsi
arch/arm/boot/dts/stm32mp153.dtsi
arch/arm/boot/dts/stm32mp153c-dhcom-drc02.dts [new file with mode: 0644]
arch/arm/boot/dts/stm32mp157c-dhcom-pdk2.dts
arch/arm/boot/dts/stm32mp157c-ed1.dts
arch/arm/boot/dts/stm32mp157c-ev1.dts
arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts
arch/arm/boot/dts/stm32mp157c-odyssey-som.dtsi [new file with mode: 0644]
arch/arm/boot/dts/stm32mp157c-odyssey.dts [new file with mode: 0644]
arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi [new file with mode: 0644]
arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi
arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi
arch/arm/boot/dts/stm32mp15xx-dkx.dtsi
arch/arm/boot/dts/sun4i-a10-a1000.dts
arch/arm/boot/dts/sun4i-a10.dtsi
arch/arm/boot/dts/sun8i-a33-olinuxino.dts
arch/arm/boot/dts/sun8i-a33.dtsi
arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
arch/arm/boot/dts/sun8i-r40.dtsi
arch/arm/boot/dts/sun8i-s3-pinecube.dts [new file with mode: 0644]
arch/arm/boot/dts/sun8i-v3.dtsi
arch/arm/boot/dts/sun8i-v3s.dtsi
arch/arm/boot/dts/tango4-common.dtsi
arch/arm/boot/dts/tegra20-acer-a500-picasso.dts
arch/arm/boot/dts/tegra30-asus-nexus7-grouper-common.dtsi
arch/arm/boot/dts/tny_a9260_common.dtsi
arch/arm/boot/dts/tny_a9263.dts
arch/arm/boot/dts/usb_a9260.dts
arch/arm/boot/dts/usb_a9263.dts
arch/arm/boot/dts/usb_a9g20_common.dtsi
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
arch/arm/boot/dts/vexpress-v2m.dtsi
arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
arch/arm/boot/dts/vexpress-v2p-ca9.dts
arch/arm/boot/dts/vf610-zii-cfu1.dts
arch/arm/boot/dts/vf610-zii-spb4.dts
arch/arm/boot/dts/vf610-zii-ssmb-dtu.dts
arch/arm/boot/dts/vf610-zii-ssmb-spu3.dts
arch/arm/boot/dts/zx296702.dtsi
arch/arm/common/sa1111.c
arch/arm/configs/aspeed_g4_defconfig
arch/arm/configs/aspeed_g5_defconfig
arch/arm/configs/exynos_defconfig
arch/arm/configs/imx_v4_v5_defconfig
arch/arm/configs/imx_v6_v7_defconfig
arch/arm/configs/multi_v5_defconfig
arch/arm/configs/multi_v7_defconfig
arch/arm/configs/omap2plus_defconfig
arch/arm/configs/realview_defconfig
arch/arm/configs/shmobile_defconfig
arch/arm/configs/versatile_defconfig
arch/arm/include/asm/cache.h
arch/arm/include/asm/cpuidle.h
arch/arm/include/asm/idmap.h
arch/arm/include/asm/mach/arch.h
arch/arm/include/asm/setup.h
arch/arm/include/asm/smp.h
arch/arm/include/asm/tcm.h
arch/arm/include/debug/brcmstb.S
arch/arm/kernel/cpuidle.c
arch/arm/kernel/devtree.c
arch/arm/kernel/vmlinux.lds.S
arch/arm/mach-at91/pm.c
arch/arm/mach-at91/pm.h
arch/arm/mach-at91/pm_suspend.S
arch/arm/mach-bcm/Kconfig
arch/arm/mach-davinci/board-dm644x-evm.c
arch/arm/mach-davinci/board-dm646x-evm.c
arch/arm/mach-exynos/Kconfig
arch/arm/mach-exynos/Makefile
arch/arm/mach-exynos/common.h
arch/arm/mach-exynos/exynos.c
arch/arm/mach-exynos/include/mach/map.h [deleted file]
arch/arm/mach-exynos/platsmp.c
arch/arm/mach-exynos/pm.c
arch/arm/mach-hisi/Kconfig
arch/arm/mach-imx/3ds_debugboard.c [deleted file]
arch/arm/mach-imx/3ds_debugboard.h [deleted file]
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/Makefile
arch/arm/mach-imx/board-mx31lilly.h [deleted file]
arch/arm/mach-imx/board-mx31lite.h [deleted file]
arch/arm/mach-imx/board-mx31moboard.h [deleted file]
arch/arm/mach-imx/common.h
arch/arm/mach-imx/cpu-imx27.c
arch/arm/mach-imx/cpu-imx31.c
arch/arm/mach-imx/cpu-imx35.c
arch/arm/mach-imx/devices-imx21.h [deleted file]
arch/arm/mach-imx/devices-imx27.h [deleted file]
arch/arm/mach-imx/devices-imx31.h [deleted file]
arch/arm/mach-imx/devices-imx35.h [deleted file]
arch/arm/mach-imx/devices/Kconfig [deleted file]
arch/arm/mach-imx/devices/Makefile [deleted file]
arch/arm/mach-imx/devices/devices-common.h [deleted file]
arch/arm/mach-imx/devices/devices.c [deleted file]
arch/arm/mach-imx/devices/platform-fec.c [deleted file]
arch/arm/mach-imx/devices/platform-flexcan.c [deleted file]
arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c [deleted file]
arch/arm/mach-imx/devices/platform-gpio-mxc.c [deleted file]
arch/arm/mach-imx/devices/platform-gpio_keys.c [deleted file]
arch/arm/mach-imx/devices/platform-imx-dma.c [deleted file]
arch/arm/mach-imx/devices/platform-imx-fb.c [deleted file]
arch/arm/mach-imx/devices/platform-imx-i2c.c [deleted file]
arch/arm/mach-imx/devices/platform-imx-keypad.c [deleted file]
arch/arm/mach-imx/devices/platform-imx-ssi.c [deleted file]
arch/arm/mach-imx/devices/platform-imx-uart.c [deleted file]
arch/arm/mach-imx/devices/platform-imx2-wdt.c [deleted file]
arch/arm/mach-imx/devices/platform-imx21-hcd.c [deleted file]
arch/arm/mach-imx/devices/platform-imx27-coda.c [deleted file]
arch/arm/mach-imx/devices/platform-ipu-core.c [deleted file]
arch/arm/mach-imx/devices/platform-mx2-camera.c [deleted file]
arch/arm/mach-imx/devices/platform-mx2-emma.c [deleted file]
arch/arm/mach-imx/devices/platform-mxc-ehci.c [deleted file]
arch/arm/mach-imx/devices/platform-mxc-mmc.c [deleted file]
arch/arm/mach-imx/devices/platform-mxc_nand.c [deleted file]
arch/arm/mach-imx/devices/platform-mxc_rtc.c [deleted file]
arch/arm/mach-imx/devices/platform-mxc_w1.c [deleted file]
arch/arm/mach-imx/devices/platform-pata_imx.c [deleted file]
arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c [deleted file]
arch/arm/mach-imx/devices/platform-spi_imx.c [deleted file]
arch/arm/mach-imx/ehci-imx27.c [deleted file]
arch/arm/mach-imx/ehci-imx31.c [deleted file]
arch/arm/mach-imx/ehci-imx35.c [deleted file]
arch/arm/mach-imx/ehci.h [deleted file]
arch/arm/mach-imx/hardware.h
arch/arm/mach-imx/imx27-dt.c [deleted file]
arch/arm/mach-imx/iomux-imx31.c [deleted file]
arch/arm/mach-imx/iomux-mx21.h [deleted file]
arch/arm/mach-imx/iomux-mx27.h [deleted file]
arch/arm/mach-imx/iomux-mx2x.h [deleted file]
arch/arm/mach-imx/iomux-mx3.h [deleted file]
arch/arm/mach-imx/iomux-mx35.h [deleted file]
arch/arm/mach-imx/iomux-v1.c [deleted file]
arch/arm/mach-imx/iomux-v1.h [deleted file]
arch/arm/mach-imx/iomux-v3.c [deleted file]
arch/arm/mach-imx/iomux-v3.h [deleted file]
arch/arm/mach-imx/mach-armadillo5x0.c [deleted file]
arch/arm/mach-imx/mach-bug.c [deleted file]
arch/arm/mach-imx/mach-imx27.c [new file with mode: 0644]
arch/arm/mach-imx/mach-imx27_visstrim_m10.c [deleted file]
arch/arm/mach-imx/mach-imx31.c [moved from arch/arm/mach-imx/imx31-dt.c with 100% similarity]
arch/arm/mach-imx/mach-imx35.c [moved from arch/arm/mach-imx/imx35-dt.c with 100% similarity]
arch/arm/mach-imx/mach-imx7ulp.c
arch/arm/mach-imx/mach-kzm_arm11_01.c [deleted file]
arch/arm/mach-imx/mach-mx21ads.c [deleted file]
arch/arm/mach-imx/mach-mx27_3ds.c [deleted file]
arch/arm/mach-imx/mach-mx27ads.c [deleted file]
arch/arm/mach-imx/mach-mx31_3ds.c [deleted file]
arch/arm/mach-imx/mach-mx31ads.c [deleted file]
arch/arm/mach-imx/mach-mx31lilly.c [deleted file]
arch/arm/mach-imx/mach-mx31lite.c [deleted file]
arch/arm/mach-imx/mach-mx31moboard.c [deleted file]
arch/arm/mach-imx/mach-mx35_3ds.c [deleted file]
arch/arm/mach-imx/mach-pca100.c [deleted file]
arch/arm/mach-imx/mach-pcm037.c [deleted file]
arch/arm/mach-imx/mach-pcm037_eet.c [deleted file]
arch/arm/mach-imx/mach-pcm043.c [deleted file]
arch/arm/mach-imx/mach-qong.c [deleted file]
arch/arm/mach-imx/mach-vpr200.c [deleted file]
arch/arm/mach-imx/mm-imx21.c [deleted file]
arch/arm/mach-imx/mm-imx27.c [deleted file]
arch/arm/mach-imx/mm-imx3.c
arch/arm/mach-imx/mx21.h [deleted file]
arch/arm/mach-imx/mx27.h
arch/arm/mach-imx/mx31.h
arch/arm/mach-imx/mx31lilly-db.c [deleted file]
arch/arm/mach-imx/mx31lite-db.c [deleted file]
arch/arm/mach-imx/mx31moboard-devboard.c [deleted file]
arch/arm/mach-imx/mx31moboard-marxbot.c [deleted file]
arch/arm/mach-imx/mx31moboard-smartbot.c [deleted file]
arch/arm/mach-imx/mx35.h
arch/arm/mach-imx/pcm037.h [deleted file]
arch/arm/mach-imx/pm-imx27.c
arch/arm/mach-imx/ulpi.h [deleted file]
arch/arm/mach-mstar/Kconfig
arch/arm/mach-mvebu/coherency_ll.S
arch/arm/mach-omap1/include/mach/mux.h
arch/arm/mach-omap2/Kconfig
arch/arm/mach-omap2/am33xx.h
arch/arm/mach-omap2/board-generic.c
arch/arm/mach-omap2/clockdomains33xx_data.c
arch/arm/mach-omap2/clockdomains81xx_data.c
arch/arm/mach-omap2/cm-regbits-33xx.h
arch/arm/mach-omap2/cm-regbits-54xx.h
arch/arm/mach-omap2/cm-regbits-7xx.h
arch/arm/mach-omap2/cm1_54xx.h
arch/arm/mach-omap2/cm1_7xx.h
arch/arm/mach-omap2/cm2_54xx.h
arch/arm/mach-omap2/cm2_7xx.h
arch/arm/mach-omap2/cm33xx.c
arch/arm/mach-omap2/cm33xx.h
arch/arm/mach-omap2/cm81xx.h
arch/arm/mach-omap2/cpuidle44xx.c
arch/arm/mach-omap2/display.c
arch/arm/mach-omap2/dma.c
arch/arm/mach-omap2/l3_2xxx.h
arch/arm/mach-omap2/l3_3xxx.h
arch/arm/mach-omap2/l4_2xxx.h
arch/arm/mach-omap2/omap-iommu.c
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
arch/arm/mach-omap2/omap_hwmod_33xx_data.c
arch/arm/mach-omap2/omap_hwmod_43xx_data.c
arch/arm/mach-omap2/omap_hwmod_44xx_data.c
arch/arm/mach-omap2/omap_hwmod_54xx_data.c
arch/arm/mach-omap2/omap_hwmod_7xx_data.c
arch/arm/mach-omap2/omap_hwmod_81xx_data.c
arch/arm/mach-omap2/omap_opp_data.h
arch/arm/mach-omap2/omap_phy_internal.c
arch/arm/mach-omap2/opp3xxx_data.c
arch/arm/mach-omap2/opp4xxx_data.c
arch/arm/mach-omap2/pm-debug.c
arch/arm/mach-omap2/pm.c
arch/arm/mach-omap2/pm.h
arch/arm/mach-omap2/pm33xx-core.c
arch/arm/mach-omap2/pm34xx.c
arch/arm/mach-omap2/powerdomains33xx_data.c
arch/arm/mach-omap2/prcm43xx.h
arch/arm/mach-omap2/prcm_mpu54xx.h
arch/arm/mach-omap2/prcm_mpu7xx.h
arch/arm/mach-omap2/prm-regbits-33xx.h
arch/arm/mach-omap2/prm33xx.c
arch/arm/mach-omap2/prm33xx.h
arch/arm/mach-omap2/prm54xx.h
arch/arm/mach-omap2/prm7xx.h
arch/arm/mach-omap2/scrm54xx.h
arch/arm/mach-omap2/sleep33xx.S
arch/arm/mach-omap2/sleep43xx.S
arch/arm/mach-omap2/ti81xx.h
arch/arm/mach-omap2/voltagedomains54xx_data.c
arch/arm/mach-s3c/Kconfig [moved from arch/arm/plat-samsung/Kconfig with 69% similarity]
arch/arm/mach-s3c/Kconfig.s3c24xx [moved from arch/arm/mach-s3c24xx/Kconfig with 97% similarity]
arch/arm/mach-s3c/Kconfig.s3c64xx [moved from arch/arm/mach-s3c64xx/Kconfig with 98% similarity]
arch/arm/mach-s3c/Makefile [moved from arch/arm/plat-samsung/Makefile with 62% similarity]
arch/arm/mach-s3c/Makefile.boot [moved from arch/arm/mach-s3c24xx/Makefile.boot with 100% similarity]
arch/arm/mach-s3c/Makefile.s3c24xx [moved from arch/arm/mach-s3c24xx/Makefile with 81% similarity]
arch/arm/mach-s3c/Makefile.s3c64xx [moved from arch/arm/mach-s3c64xx/Makefile with 56% similarity]
arch/arm/mach-s3c/adc-core.h [moved from arch/arm/plat-samsung/include/plat/adc-core.h with 100% similarity]
arch/arm/mach-s3c/adc.c [moved from arch/arm/plat-samsung/adc.c with 99% similarity]
arch/arm/mach-s3c/anubis.h [moved from arch/arm/mach-s3c24xx/anubis.h with 100% similarity]
arch/arm/mach-s3c/ata-core-s3c64xx.h [moved from arch/arm/mach-s3c64xx/ata-core.h with 78% similarity]
arch/arm/mach-s3c/backlight-s3c64xx.h [moved from arch/arm/mach-s3c64xx/backlight.h with 78% similarity]
arch/arm/mach-s3c/bast-ide.c [moved from arch/arm/mach-s3c24xx/bast-ide.c with 97% similarity]
arch/arm/mach-s3c/bast-irq.c [moved from arch/arm/mach-s3c24xx/bast-irq.c with 95% similarity]
arch/arm/mach-s3c/bast.h [moved from arch/arm/mach-s3c24xx/bast.h with 100% similarity]
arch/arm/mach-s3c/common-smdk-s3c24xx.c [moved from arch/arm/mach-s3c24xx/common-smdk.c with 96% similarity]
arch/arm/mach-s3c/common-smdk-s3c24xx.h [moved from arch/arm/mach-s3c24xx/common-smdk.h with 100% similarity]
arch/arm/mach-s3c/cpu.c [moved from arch/arm/plat-samsung/cpu.c with 62% similarity]
arch/arm/mach-s3c/cpu.h [moved from arch/arm/plat-samsung/include/plat/cpu.h with 89% similarity]
arch/arm/mach-s3c/cpufreq-utils-s3c24xx.c [moved from arch/arm/mach-s3c24xx/cpufreq-utils.c with 68% similarity]
arch/arm/mach-s3c/cpuidle-s3c64xx.c [moved from arch/arm/mach-s3c64xx/cpuidle.c with 92% similarity]
arch/arm/mach-s3c/crag6410.h [moved from arch/arm/mach-s3c64xx/crag6410.h with 95% similarity]
arch/arm/mach-s3c/dev-audio-s3c64xx.c [moved from arch/arm/mach-s3c64xx/dev-audio.c with 97% similarity]
arch/arm/mach-s3c/dev-backlight-s3c64xx.c [moved from arch/arm/mach-s3c64xx/dev-backlight.c with 98% similarity]
arch/arm/mach-s3c/dev-uart-s3c64xx.c [moved from arch/arm/mach-s3c64xx/dev-uart.c with 95% similarity]
arch/arm/mach-s3c/dev-uart.c [moved from arch/arm/plat-samsung/dev-uart.c with 97% similarity]
arch/arm/mach-s3c/devs.c [moved from arch/arm/plat-samsung/devs.c with 96% similarity]
arch/arm/mach-s3c/devs.h [moved from arch/arm/plat-samsung/include/plat/devs.h with 100% similarity]
arch/arm/mach-s3c/dma-s3c24xx.h [moved from arch/arm/mach-s3c24xx/include/mach/dma.h with 100% similarity]
arch/arm/mach-s3c/dma-s3c64xx.h [moved from arch/arm/mach-s3c64xx/include/mach/dma.h with 100% similarity]
arch/arm/mach-s3c/dma.h [new file with mode: 0644]
arch/arm/mach-s3c/fb-core-s3c24xx.h [moved from arch/arm/mach-s3c24xx/fb-core.h with 78% similarity]
arch/arm/mach-s3c/fb.h [moved from arch/arm/plat-samsung/include/plat/fb.h with 100% similarity]
arch/arm/mach-s3c/gpio-cfg-helpers.h [moved from arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h with 100% similarity]
arch/arm/mach-s3c/gpio-cfg.h [moved from arch/arm/plat-samsung/include/plat/gpio-cfg.h with 100% similarity]
arch/arm/mach-s3c/gpio-core.h [moved from arch/arm/plat-samsung/include/plat/gpio-core.h with 99% similarity]
arch/arm/mach-s3c/gpio-samsung-s3c24xx.h [moved from arch/arm/mach-s3c24xx/include/mach/gpio-samsung.h with 99% similarity]
arch/arm/mach-s3c/gpio-samsung-s3c64xx.h [moved from arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h with 100% similarity]
arch/arm/mach-s3c/gpio-samsung.c [moved from arch/arm/plat-samsung/gpio-samsung.c with 99% similarity]
arch/arm/mach-s3c/gpio-samsung.h [new file with mode: 0644]
arch/arm/mach-s3c/gta02.h [moved from arch/arm/mach-s3c24xx/gta02.h with 94% similarity]
arch/arm/mach-s3c/h1940-bluetooth.c [moved from arch/arm/mach-s3c24xx/h1940-bluetooth.c with 96% similarity]
arch/arm/mach-s3c/h1940.h [moved from arch/arm/mach-s3c24xx/h1940.h with 100% similarity]
arch/arm/mach-s3c/hardware-s3c24xx.h [moved from arch/arm/mach-s3c24xx/include/mach/hardware.h with 54% similarity]
arch/arm/mach-s3c/iic-core.h [moved from arch/arm/plat-samsung/include/plat/iic-core.h with 100% similarity]
arch/arm/mach-s3c/include/mach/io-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/include/mach/io.h [new file with mode: 0644]
arch/arm/mach-s3c/include/mach/irqs-s3c24xx.h [moved from arch/arm/mach-s3c24xx/include/mach/irqs.h with 100% similarity]
arch/arm/mach-s3c/include/mach/irqs-s3c64xx.h [moved from arch/arm/mach-s3c64xx/include/mach/irqs.h with 100% similarity]
arch/arm/mach-s3c/include/mach/irqs.h [new file with mode: 0644]
arch/arm/mach-s3c/include/mach/map-base.h [moved from arch/arm/plat-samsung/include/plat/map-base.h with 100% similarity]
arch/arm/mach-s3c/init.c [moved from arch/arm/plat-samsung/init.c with 98% similarity]
arch/arm/mach-s3c/iotiming-s3c2410.c [moved from arch/arm/mach-s3c24xx/iotiming-s3c2410.c with 97% similarity]
arch/arm/mach-s3c/iotiming-s3c2412.c [moved from arch/arm/mach-s3c24xx/iotiming-s3c2412.c with 98% similarity]
arch/arm/mach-s3c/irq-pm-s3c24xx.c [moved from arch/arm/mach-s3c24xx/irq-pm.c with 93% similarity]
arch/arm/mach-s3c/irq-pm-s3c64xx.c [moved from arch/arm/mach-s3c64xx/irq-pm.c with 97% similarity]
arch/arm/mach-s3c/irq-s3c24xx-fiq-exports.c [new file with mode: 0644]
arch/arm/mach-s3c/irq-s3c24xx-fiq.S [moved from drivers/spi/spi-s3c24xx-fiq.S with 94% similarity]
arch/arm/mach-s3c/irq-s3c24xx.c [moved from drivers/irqchip/irq-s3c24xx.c with 99% similarity]
arch/arm/mach-s3c/irq-uart-s3c64xx.h [moved from arch/arm/mach-s3c64xx/irq-uart.h with 100% similarity]
arch/arm/mach-s3c/keypad.h [moved from arch/arm/plat-samsung/include/plat/keypad.h with 100% similarity]
arch/arm/mach-s3c/mach-amlm5900.c [moved from arch/arm/mach-s3c24xx/mach-amlm5900.c with 83% similarity]
arch/arm/mach-s3c/mach-anubis.c [moved from arch/arm/mach-s3c24xx/mach-anubis.c with 97% similarity]
arch/arm/mach-s3c/mach-anw6410.c [moved from arch/arm/mach-s3c64xx/mach-anw6410.c with 93% similarity]
arch/arm/mach-s3c/mach-at2440evb.c [moved from arch/arm/mach-s3c24xx/mach-at2440evb.c with 87% similarity]
arch/arm/mach-s3c/mach-bast.c [moved from arch/arm/mach-s3c24xx/mach-bast.c with 97% similarity]
arch/arm/mach-s3c/mach-crag6410-module.c [moved from arch/arm/mach-s3c64xx/mach-crag6410-module.c with 98% similarity]
arch/arm/mach-s3c/mach-crag6410.c [moved from arch/arm/mach-s3c64xx/mach-crag6410.c with 97% similarity]
arch/arm/mach-s3c/mach-gta02.c [moved from arch/arm/mach-s3c24xx/mach-gta02.c with 92% similarity]
arch/arm/mach-s3c/mach-h1940.c [moved from arch/arm/mach-s3c24xx/mach-h1940.c with 94% similarity]
arch/arm/mach-s3c/mach-hmt.c [moved from arch/arm/mach-s3c64xx/mach-hmt.c with 95% similarity]
arch/arm/mach-s3c/mach-jive.c [moved from arch/arm/mach-s3c24xx/mach-jive.c with 97% similarity]
arch/arm/mach-s3c/mach-mini2440.c [moved from arch/arm/mach-s3c24xx/mach-mini2440.c with 94% similarity]
arch/arm/mach-s3c/mach-mini6410.c [moved from arch/arm/mach-s3c64xx/mach-mini6410.c with 95% similarity]
arch/arm/mach-s3c/mach-n30.c [moved from arch/arm/mach-s3c24xx/mach-n30.c with 94% similarity]
arch/arm/mach-s3c/mach-ncp.c [moved from arch/arm/mach-s3c64xx/mach-ncp.c with 87% similarity]
arch/arm/mach-s3c/mach-nexcoder.c [moved from arch/arm/mach-s3c24xx/mach-nexcoder.c with 90% similarity]
arch/arm/mach-s3c/mach-osiris-dvs.c [moved from arch/arm/mach-s3c24xx/mach-osiris-dvs.c with 98% similarity]
arch/arm/mach-s3c/mach-osiris.c [moved from arch/arm/mach-s3c24xx/mach-osiris.c with 96% similarity]
arch/arm/mach-s3c/mach-otom.c [moved from arch/arm/mach-s3c24xx/mach-otom.c with 88% similarity]
arch/arm/mach-s3c/mach-qt2410.c [moved from arch/arm/mach-s3c24xx/mach-qt2410.c with 88% similarity]
arch/arm/mach-s3c/mach-real6410.c [moved from arch/arm/mach-s3c64xx/mach-real6410.c with 95% similarity]
arch/arm/mach-s3c/mach-rx1950.c [moved from arch/arm/mach-s3c24xx/mach-rx1950.c with 94% similarity]
arch/arm/mach-s3c/mach-rx3715.c [moved from arch/arm/mach-s3c24xx/mach-rx3715.c with 89% similarity]
arch/arm/mach-s3c/mach-s3c2416-dt.c [moved from arch/arm/mach-s3c24xx/mach-s3c2416-dt.c with 92% similarity]
arch/arm/mach-s3c/mach-s3c64xx-dt.c [moved from arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c with 70% similarity]
arch/arm/mach-s3c/mach-smartq.c [moved from arch/arm/mach-s3c64xx/mach-smartq.c with 96% similarity]
arch/arm/mach-s3c/mach-smartq.h [moved from arch/arm/mach-s3c64xx/mach-smartq.h with 100% similarity]
arch/arm/mach-s3c/mach-smartq5.c [moved from arch/arm/mach-s3c64xx/mach-smartq5.c with 91% similarity]
arch/arm/mach-s3c/mach-smartq7.c [moved from arch/arm/mach-s3c64xx/mach-smartq7.c with 92% similarity]
arch/arm/mach-s3c/mach-smdk2410.c [moved from arch/arm/mach-s3c24xx/mach-smdk2410.c with 86% similarity]
arch/arm/mach-s3c/mach-smdk2413.c [moved from arch/arm/mach-s3c24xx/mach-smdk2413.c with 86% similarity]
arch/arm/mach-s3c/mach-smdk2416.c [moved from arch/arm/mach-s3c24xx/mach-smdk2416.c with 93% similarity]
arch/arm/mach-s3c/mach-smdk2440.c [moved from arch/arm/mach-s3c24xx/mach-smdk2440.c with 87% similarity]
arch/arm/mach-s3c/mach-smdk2443.c [moved from arch/arm/mach-s3c24xx/mach-smdk2443.c with 90% similarity]
arch/arm/mach-s3c/mach-smdk6400.c [moved from arch/arm/mach-s3c64xx/mach-smdk6400.c with 87% similarity]
arch/arm/mach-s3c/mach-smdk6410.c [moved from arch/arm/mach-s3c64xx/mach-smdk6410.c with 97% similarity]
arch/arm/mach-s3c/mach-tct_hammer.c [moved from arch/arm/mach-s3c24xx/mach-tct_hammer.c with 81% similarity]
arch/arm/mach-s3c/mach-vr1000.c [moved from arch/arm/mach-s3c24xx/mach-vr1000.c with 96% similarity]
arch/arm/mach-s3c/mach-vstms.c [moved from arch/arm/mach-s3c24xx/mach-vstms.c with 88% similarity]
arch/arm/mach-s3c/map-s3c.h [moved from arch/arm/plat-samsung/include/plat/map-s3c.h with 87% similarity]
arch/arm/mach-s3c/map-s3c24xx.h [moved from arch/arm/mach-s3c24xx/include/mach/map.h with 97% similarity]
arch/arm/mach-s3c/map-s3c64xx.h [moved from arch/arm/mach-s3c64xx/include/mach/map.h with 98% similarity]
arch/arm/mach-s3c/map-s5p.h [moved from arch/arm/plat-samsung/include/plat/map-s5p.h with 85% similarity]
arch/arm/mach-s3c/map.h [new file with mode: 0644]
arch/arm/mach-s3c/nand-core-s3c24xx.h [moved from arch/arm/mach-s3c24xx/nand-core.h with 77% similarity]
arch/arm/mach-s3c/onenand-core-s3c64xx.h [moved from arch/arm/mach-s3c64xx/onenand-core.h with 82% similarity]
arch/arm/mach-s3c/osiris.h [moved from arch/arm/mach-s3c24xx/osiris.h with 100% similarity]
arch/arm/mach-s3c/otom.h [moved from arch/arm/mach-s3c24xx/otom.h with 100% similarity]
arch/arm/mach-s3c/pl080.c [moved from arch/arm/mach-s3c64xx/pl080.c with 98% similarity]
arch/arm/mach-s3c/platformdata.c [moved from arch/arm/plat-samsung/platformdata.c with 96% similarity]
arch/arm/mach-s3c/pll-s3c2410.c [moved from arch/arm/mach-s3c24xx/pll-s3c2410.c with 97% similarity]
arch/arm/mach-s3c/pll-s3c2440-12000000.c [moved from arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c with 97% similarity]
arch/arm/mach-s3c/pll-s3c2440-16934400.c [moved from arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c with 98% similarity]
arch/arm/mach-s3c/pm-common.c [moved from arch/arm/plat-samsung/pm-common.c with 95% similarity]
arch/arm/mach-s3c/pm-common.h [new file with mode: 0644]
arch/arm/mach-s3c/pm-core-s3c24xx.h [moved from arch/arm/mach-s3c24xx/include/mach/pm-core.h with 94% similarity]
arch/arm/mach-s3c/pm-core-s3c64xx.h [moved from arch/arm/mach-s3c64xx/include/mach/pm-core.h with 58% similarity]
arch/arm/mach-s3c/pm-core.h [new file with mode: 0644]
arch/arm/mach-s3c/pm-gpio.c [moved from arch/arm/plat-samsung/pm-gpio.c with 99% similarity]
arch/arm/mach-s3c/pm-h1940.S [moved from arch/arm/mach-s3c24xx/pm-h1940.S with 80% similarity]
arch/arm/mach-s3c/pm-s3c2410.c [moved from arch/arm/mach-s3c24xx/pm-s3c2410.c with 96% similarity]
arch/arm/mach-s3c/pm-s3c2412.c [moved from arch/arm/mach-s3c24xx/pm-s3c2412.c with 94% similarity]
arch/arm/mach-s3c/pm-s3c2416.c [moved from arch/arm/mach-s3c24xx/pm-s3c2416.c with 95% similarity]
arch/arm/mach-s3c/pm-s3c24xx.c [moved from arch/arm/mach-s3c24xx/pm.c with 93% similarity]
arch/arm/mach-s3c/pm-s3c64xx.c [moved from arch/arm/mach-s3c64xx/pm.c with 81% similarity]
arch/arm/mach-s3c/pm.c [moved from arch/arm/plat-samsung/pm.c with 94% similarity]
arch/arm/mach-s3c/pm.h [moved from arch/arm/plat-samsung/include/plat/pm.h with 98% similarity]
arch/arm/mach-s3c/pwm-core.h [moved from arch/arm/plat-samsung/include/plat/pwm-core.h with 100% similarity]
arch/arm/mach-s3c/regs-adc.h [moved from arch/arm/plat-samsung/include/plat/regs-adc.h with 100% similarity]
arch/arm/mach-s3c/regs-clock-s3c24xx.h [moved from arch/arm/mach-s3c24xx/include/mach/regs-clock.h with 99% similarity]
arch/arm/mach-s3c/regs-clock-s3c64xx.h [moved from arch/arm/mach-s3c64xx/include/mach/regs-clock.h with 100% similarity]
arch/arm/mach-s3c/regs-clock.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-dsc-s3c24xx.h [moved from arch/arm/mach-s3c24xx/regs-dsc.h with 77% similarity]
arch/arm/mach-s3c/regs-gpio-memport-s3c64xx.h [moved from arch/arm/mach-s3c64xx/regs-gpio-memport.h with 100% similarity]
arch/arm/mach-s3c/regs-gpio-s3c24xx.h [moved from arch/arm/mach-s3c24xx/include/mach/regs-gpio.h with 99% similarity]
arch/arm/mach-s3c/regs-gpio-s3c64xx.h [moved from arch/arm/mach-s3c64xx/include/mach/regs-gpio.h with 100% similarity]
arch/arm/mach-s3c/regs-gpio.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-irq-s3c24xx.h [moved from arch/arm/mach-s3c24xx/include/mach/regs-irq.h with 98% similarity]
arch/arm/mach-s3c/regs-irq-s3c64xx.h [moved from arch/arm/mach-s3c64xx/include/mach/regs-irq.h with 100% similarity]
arch/arm/mach-s3c/regs-irq.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-irqtype.h [moved from arch/arm/plat-samsung/include/plat/regs-irqtype.h with 100% similarity]
arch/arm/mach-s3c/regs-mem-s3c24xx.h [moved from arch/arm/mach-s3c24xx/regs-mem.h with 98% similarity]
arch/arm/mach-s3c/regs-modem-s3c64xx.h [moved from arch/arm/mach-s3c64xx/regs-modem.h with 100% similarity]
arch/arm/mach-s3c/regs-s3c2443-clock.h [moved from arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h with 81% similarity]
arch/arm/mach-s3c/regs-srom-s3c64xx.h [moved from arch/arm/mach-s3c64xx/regs-srom.h with 100% similarity]
arch/arm/mach-s3c/regs-sys-s3c64xx.h [moved from arch/arm/mach-s3c64xx/regs-sys.h with 100% similarity]
arch/arm/mach-s3c/regs-syscon-power-s3c64xx.h [moved from arch/arm/mach-s3c64xx/regs-syscon-power.h with 100% similarity]
arch/arm/mach-s3c/regs-usb-hsotg-phy-s3c64xx.h [moved from arch/arm/mach-s3c64xx/regs-usb-hsotg-phy.h with 100% similarity]
arch/arm/mach-s3c/rtc-core-s3c24xx.h [moved from arch/arm/mach-s3c24xx/include/mach/rtc-core.h with 81% similarity]
arch/arm/mach-s3c/s3c2410.c [moved from arch/arm/mach-s3c24xx/s3c2410.c with 88% similarity]
arch/arm/mach-s3c/s3c2412-power.h [moved from arch/arm/mach-s3c24xx/s3c2412-power.h with 100% similarity]
arch/arm/mach-s3c/s3c2412.c [moved from arch/arm/mach-s3c24xx/s3c2412.c with 92% similarity]
arch/arm/mach-s3c/s3c2412.h [moved from arch/arm/mach-s3c24xx/include/mach/s3c2412.h with 96% similarity]
arch/arm/mach-s3c/s3c2416.c [moved from arch/arm/mach-s3c24xx/s3c2416.c with 84% similarity]
arch/arm/mach-s3c/s3c2440.c [moved from arch/arm/mach-s3c24xx/s3c2440.c with 85% similarity]
arch/arm/mach-s3c/s3c2442.c [moved from arch/arm/mach-s3c24xx/s3c2442.c with 82% similarity]
arch/arm/mach-s3c/s3c2443.c [moved from arch/arm/mach-s3c24xx/s3c2443.c with 83% similarity]
arch/arm/mach-s3c/s3c244x.c [moved from arch/arm/mach-s3c24xx/s3c244x.c with 90% similarity]
arch/arm/mach-s3c/s3c24xx.c [moved from arch/arm/mach-s3c24xx/common.c with 97% similarity]
arch/arm/mach-s3c/s3c24xx.h [moved from arch/arm/mach-s3c24xx/common.h with 85% similarity]
arch/arm/mach-s3c/s3c6400.c [moved from arch/arm/mach-s3c64xx/s3c6400.c with 88% similarity]
arch/arm/mach-s3c/s3c6410.c [moved from arch/arm/mach-s3c64xx/s3c6410.c with 87% similarity]
arch/arm/mach-s3c/s3c64xx.c [moved from arch/arm/mach-s3c64xx/common.c with 91% similarity]
arch/arm/mach-s3c/s3c64xx.h [moved from arch/arm/mach-s3c64xx/common.h with 80% similarity]
arch/arm/mach-s3c/sdhci.h [moved from arch/arm/plat-samsung/include/plat/sdhci.h with 99% similarity]
arch/arm/mach-s3c/setup-fb-24bpp-s3c64xx.c [moved from arch/arm/mach-s3c64xx/setup-fb-24bpp.c with 86% similarity]
arch/arm/mach-s3c/setup-i2c-s3c24xx.c [moved from arch/arm/mach-s3c24xx/setup-i2c.c with 79% similarity]
arch/arm/mach-s3c/setup-i2c0-s3c64xx.c [moved from arch/arm/mach-s3c64xx/setup-i2c0.c with 90% similarity]
arch/arm/mach-s3c/setup-i2c1-s3c64xx.c [moved from arch/arm/mach-s3c64xx/setup-i2c1.c with 90% similarity]
arch/arm/mach-s3c/setup-ide-s3c64xx.c [moved from arch/arm/mach-s3c64xx/setup-ide.c with 89% similarity]
arch/arm/mach-s3c/setup-keypad-s3c64xx.c [moved from arch/arm/mach-s3c64xx/setup-keypad.c with 86% similarity]
arch/arm/mach-s3c/setup-sdhci-gpio-s3c24xx.c [moved from arch/arm/mach-s3c24xx/setup-sdhci-gpio.c with 89% similarity]
arch/arm/mach-s3c/setup-sdhci-gpio-s3c64xx.c [moved from arch/arm/mach-s3c64xx/setup-sdhci-gpio.c with 95% similarity]
arch/arm/mach-s3c/setup-spi-s3c24xx.c [moved from arch/arm/mach-s3c24xx/setup-spi.c with 85% similarity]
arch/arm/mach-s3c/setup-spi-s3c64xx.c [moved from arch/arm/mach-s3c64xx/setup-spi.c with 83% similarity]
arch/arm/mach-s3c/setup-ts-s3c24xx.c [moved from arch/arm/mach-s3c24xx/setup-ts.c with 81% similarity]
arch/arm/mach-s3c/setup-usb-phy-s3c64xx.c [moved from arch/arm/mach-s3c64xx/setup-usb-phy.c with 92% similarity]
arch/arm/mach-s3c/simtec-audio.c [moved from arch/arm/mach-s3c24xx/simtec-audio.c with 86% similarity]
arch/arm/mach-s3c/simtec-nor.c [moved from arch/arm/mach-s3c24xx/simtec-nor.c with 98% similarity]
arch/arm/mach-s3c/simtec-pm.c [moved from arch/arm/mach-s3c24xx/simtec-pm.c with 91% similarity]
arch/arm/mach-s3c/simtec-usb.c [moved from arch/arm/mach-s3c24xx/simtec-usb.c with 96% similarity]
arch/arm/mach-s3c/simtec.h [moved from arch/arm/mach-s3c24xx/simtec.h with 100% similarity]
arch/arm/mach-s3c/sleep-s3c2410.S [moved from arch/arm/mach-s3c24xx/sleep-s3c2410.S with 90% similarity]
arch/arm/mach-s3c/sleep-s3c2412.S [moved from arch/arm/mach-s3c24xx/sleep-s3c2412.S with 93% similarity]
arch/arm/mach-s3c/sleep-s3c24xx.S [moved from arch/arm/mach-s3c24xx/sleep.S with 92% similarity]
arch/arm/mach-s3c/sleep-s3c64xx.S [moved from arch/arm/mach-s3c64xx/sleep.S with 97% similarity]
arch/arm/mach-s3c/spi-core-s3c24xx.h [moved from arch/arm/mach-s3c24xx/spi-core.h with 81% similarity]
arch/arm/mach-s3c/usb-phy.h [moved from arch/arm/plat-samsung/include/plat/usb-phy.h with 100% similarity]
arch/arm/mach-s3c/vr1000.h [moved from arch/arm/mach-s3c24xx/vr1000.h with 100% similarity]
arch/arm/mach-s3c/wakeup-mask.c [moved from arch/arm/plat-samsung/wakeup-mask.c with 94% similarity]
arch/arm/mach-s3c/wakeup-mask.h [moved from arch/arm/plat-samsung/include/plat/wakeup-mask.h with 100% similarity]
arch/arm/mach-s3c24xx/include/mach/fb.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/io.h [deleted file]
arch/arm/mach-s3c24xx/setup-camif.c [deleted file]
arch/arm/mach-s3c64xx/include/mach/hardware.h [deleted file]
arch/arm/mach-s3c64xx/watchdog-reset.h [deleted file]
arch/arm/mach-s5pv210/Kconfig
arch/arm/mach-s5pv210/Makefile
arch/arm/mach-s5pv210/pm.c
arch/arm/mach-s5pv210/regs-clock.h
arch/arm/mach-s5pv210/s5pv210.c
arch/arm/mach-shmobile/rcar-gen2.h
arch/arm/mach-shmobile/setup-rcar-gen2.c
arch/arm/mach-stm32/Makefile.boot
arch/arm/mm/init.c
arch/arm/plat-omap/Kconfig
arch/arm/plat-samsung/include/plat/samsung-time.h [deleted file]
arch/arm/plat-samsung/watchdog-reset.c [deleted file]
arch/arm64/Kconfig
arch/arm64/Kconfig.platforms
arch/arm64/boot/dts/Makefile
arch/arm64/boot/dts/actions/s700.dtsi
arch/arm64/boot/dts/allwinner/Makefile
arch/arm64/boot/dts/allwinner/sun50i-a100-allwinner-perf1.dts [new file with mode: 0644]
arch/arm64/boot/dts/allwinner/sun50i-a100.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts
arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
arch/arm64/boot/dts/amazon/alpine-v2.dtsi
arch/arm64/boot/dts/amlogic/Makefile
arch/arm64/boot/dts/amlogic/meson-axg-s400.dts
arch/arm64/boot/dts/amlogic/meson-axg.dtsi
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts [new file with mode: 0644]
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/amlogic/meson-gx.dtsi
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc-v2.dts [new file with mode: 0644]
arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts
arch/arm64/boot/dts/apm/apm-shadowcat.dtsi
arch/arm64/boot/dts/apm/apm-storm.dtsi
arch/arm64/boot/dts/arm/juno-motherboard.dtsi
arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi
arch/arm64/boot/dts/broadcom/stingray/bcm958742-base.dtsi
arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi
arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
arch/arm64/boot/dts/exynos/exynos5433.dtsi
arch/arm64/boot/dts/freescale/Makefile
arch/arm64/boot/dts/freescale/fsl-ls1012a-oxalis.dts
arch/arm64/boot/dts/freescale/fsl-ls1012a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-kbox-a-230-ls.dts
arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var3-ads2.dts
arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts
arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts
arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi
arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi
arch/arm64/boot/dts/freescale/imx8mm-beacon-baseboard.dtsi
arch/arm64/boot/dts/freescale/imx8mm-beacon-som.dtsi
arch/arm64/boot/dts/freescale/imx8mm-ddr4-evk.dts [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mm-evk.dts
arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mm-var-som-symphony.dts [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mm-var-som.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mm.dtsi
arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
arch/arm64/boot/dts/freescale/imx8mn-evk.dts
arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mn-var-som.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mn.dtsi
arch/arm64/boot/dts/freescale/imx8mp-evk.dts
arch/arm64/boot/dts/freescale/imx8mp-pinfunc.h
arch/arm64/boot/dts/freescale/imx8mp.dtsi
arch/arm64/boot/dts/freescale/imx8mq-evk.dts
arch/arm64/boot/dts/freescale/imx8mq-hummingboard-pulse.dts
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
arch/arm64/boot/dts/freescale/imx8mq-librem5-r2.dts [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mq-librem5-r3.dts [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
arch/arm64/boot/dts/freescale/imx8mq-pico-pi.dts
arch/arm64/boot/dts/freescale/imx8mq-sr-som.dtsi
arch/arm64/boot/dts/freescale/imx8mq-thor96.dts
arch/arm64/boot/dts/freescale/imx8mq-zii-ultra-rmb3.dts
arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi
arch/arm64/boot/dts/freescale/imx8mq.dtsi
arch/arm64/boot/dts/freescale/imx8qxp-colibri.dtsi
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts
arch/arm64/boot/dts/hisilicon/hi3660.dtsi
arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts
arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
arch/arm64/boot/dts/hisilicon/hi6220.dtsi
arch/arm64/boot/dts/hisilicon/hip05-d02.dts
arch/arm64/boot/dts/hisilicon/hip06-d03.dts
arch/arm64/boot/dts/hisilicon/hip07-d05.dts
arch/arm64/boot/dts/intel/socfpga_agilex.dtsi
arch/arm64/boot/dts/lg/lg1312.dtsi
arch/arm64/boot/dts/lg/lg1313.dtsi
arch/arm64/boot/dts/marvell/armada-3720-espressobin-v7-emmc.dts
arch/arm64/boot/dts/marvell/armada-3720-espressobin-v7.dts
arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi
arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi
arch/arm64/boot/dts/mediatek/mt8183-evb.dts
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
arch/arm64/boot/dts/mediatek/mt8183.dtsi
arch/arm64/boot/dts/mediatek/pumpkin-common.dtsi
arch/arm64/boot/dts/microchip/sparx5.dtsi
arch/arm64/boot/dts/microchip/sparx5_nand.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/microchip/sparx5_pcb125.dts
arch/arm64/boot/dts/microchip/sparx5_pcb134.dts
arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi
arch/arm64/boot/dts/microchip/sparx5_pcb134_emmc.dts
arch/arm64/boot/dts/microchip/sparx5_pcb135.dts
arch/arm64/boot/dts/microchip/sparx5_pcb135_board.dtsi
arch/arm64/boot/dts/microchip/sparx5_pcb135_emmc.dts
arch/arm64/boot/dts/nvidia/Makefile
arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts
arch/arm64/boot/dts/nvidia/tegra186-p3310.dtsi
arch/arm64/boot/dts/nvidia/tegra186.dtsi
arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi
arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts
arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0000.dts
arch/arm64/boot/dts/nvidia/tegra194-p3668-0000.dtsi
arch/arm64/boot/dts/nvidia/tegra194.dtsi
arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi
arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts
arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts
arch/arm64/boot/dts/nvidia/tegra210.dtsi
arch/arm64/boot/dts/nvidia/tegra234-sim-vdk.dts [new file with mode: 0644]
arch/arm64/boot/dts/nvidia/tegra234.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/qcom/Makefile
arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
arch/arm64/boot/dts/qcom/ipq6018-cp01-c1.dts
arch/arm64/boot/dts/qcom/ipq6018.dtsi
arch/arm64/boot/dts/qcom/ipq8074-hk01.dts
arch/arm64/boot/dts/qcom/ipq8074.dtsi
arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
arch/arm64/boot/dts/qcom/msm8916-mtp.dtsi
arch/arm64/boot/dts/qcom/msm8916-pm8916.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi
arch/arm64/boot/dts/qcom/msm8916-samsung-a3u-eur.dts
arch/arm64/boot/dts/qcom/msm8916.dtsi
arch/arm64/boot/dts/qcom/msm8992.dtsi
arch/arm64/boot/dts/qcom/msm8994-sony-xperia-kitakami.dtsi
arch/arm64/boot/dts/qcom/msm8996.dtsi
arch/arm64/boot/dts/qcom/pm660.dtsi
arch/arm64/boot/dts/qcom/pm8916.dtsi
arch/arm64/boot/dts/qcom/qcs404-evb-4000.dts
arch/arm64/boot/dts/qcom/qcs404-evb.dtsi
arch/arm64/boot/dts/qcom/qrb5165-rb5.dts [new file with mode: 0644]
arch/arm64/boot/dts/qcom/sc7180-idp.dts
arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts [new file with mode: 0644]
arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1-kb.dts [new file with mode: 0644]
arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1-lte.dts [new file with mode: 0644]
arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts [new file with mode: 0644]
arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/qcom/sc7180-trogdor-r1-lte.dts [new file with mode: 0644]
arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts [new file with mode: 0644]
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/qcom/sc7180.dtsi
arch/arm64/boot/dts/qcom/sdm630.dtsi
arch/arm64/boot/dts/qcom/sdm845-db845c.dts
arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts [new file with mode: 0644]
arch/arm64/boot/dts/qcom/sdm845.dtsi
arch/arm64/boot/dts/qcom/sm8150.dtsi
arch/arm64/boot/dts/qcom/sm8250-mtp.dts
arch/arm64/boot/dts/qcom/sm8250.dtsi
arch/arm64/boot/dts/renesas/Makefile
arch/arm64/boot/dts/renesas/r8a774a1.dtsi
arch/arm64/boot/dts/renesas/r8a774b1-hihope-rzg2n-ex.dts
arch/arm64/boot/dts/renesas/r8a774b1.dtsi
arch/arm64/boot/dts/renesas/r8a774c0.dtsi
arch/arm64/boot/dts/renesas/r8a774e1-hihope-rzg2h-ex-idk-1110wr.dts [new file with mode: 0644]
arch/arm64/boot/dts/renesas/r8a774e1-hihope-rzg2h-ex.dts
arch/arm64/boot/dts/renesas/r8a774e1-hihope-rzg2h.dts
arch/arm64/boot/dts/renesas/r8a774e1.dtsi
arch/arm64/boot/dts/renesas/r8a77951.dtsi
arch/arm64/boot/dts/renesas/r8a77960.dtsi
arch/arm64/boot/dts/renesas/r8a77961-salvator-xs.dts
arch/arm64/boot/dts/renesas/r8a77961.dtsi
arch/arm64/boot/dts/renesas/r8a77965.dtsi
arch/arm64/boot/dts/renesas/r8a77970.dtsi
arch/arm64/boot/dts/renesas/r8a77980.dtsi
arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
arch/arm64/boot/dts/renesas/r8a77990.dtsi
arch/arm64/boot/dts/renesas/r8a77995-draak.dts
arch/arm64/boot/dts/renesas/r8a77995.dtsi
arch/arm64/boot/dts/renesas/r8a779a0-falcon-cpu.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/renesas/r8a779a0-falcon.dts [new file with mode: 0644]
arch/arm64/boot/dts/renesas/r8a779a0.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/renesas/ulcb.dtsi
arch/arm64/boot/dts/rockchip/Makefile
arch/arm64/boot/dts/rockchip/rk3308.dtsi
arch/arm64/boot/dts/rockchip/rk3318-a95x-z2.dts [new file with mode: 0644]
arch/arm64/boot/dts/rockchip/rk3328-evb.dts
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts [new file with mode: 0644]
arch/arm64/boot/dts/rockchip/rk3368-evb.dtsi
arch/arm64/boot/dts/rockchip/rk3368-orion-r68-meta.dts
arch/arm64/boot/dts/rockchip/rk3368-r88.dts
arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi
arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts
arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi [moved from arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts with 95% similarity]
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4a.dts [new file with mode: 0644]
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts [new file with mode: 0644]
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts [new file with mode: 0644]
arch/arm64/boot/dts/ti/Makefile
arch/arm64/boot/dts/ti/k3-am65-main.dtsi
arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
arch/arm64/boot/dts/ti/k3-am65.dtsi
arch/arm64/boot/dts/ti/k3-am654-base-board.dts
arch/arm64/boot/dts/ti/k3-am654-industrial-thermal.dtsi
arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts [new file with mode: 0644]
arch/arm64/boot/dts/ti/k3-j7200-main.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/ti/k3-j7200-som-p0.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/ti/k3-j7200.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi
arch/arm64/boot/dts/ti/k3-j721e-som-p0.dtsi
arch/arm64/boot/dts/ti/k3-j721e.dtsi
arch/arm64/boot/dts/toshiba/Makefile [new file with mode: 0644]
arch/arm64/boot/dts/toshiba/tmpv7708-rm-mbrc.dts [new file with mode: 0644]
arch/arm64/boot/dts/toshiba/tmpv7708.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/toshiba/tmpv7708_pins.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/xilinx/zynqmp-clk-ccf.dtsi
arch/arm64/boot/dts/xilinx/zynqmp-zcu100-revC.dts
arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts
arch/arm64/boot/dts/xilinx/zynqmp.dtsi
arch/arm64/configs/defconfig
arch/arm64/include/asm/brk-imm.h
arch/arm64/include/asm/cache.h
arch/arm64/include/asm/cpucaps.h
arch/arm64/include/asm/cpufeature.h
arch/arm64/include/asm/cputype.h
arch/arm64/include/asm/debug-monitors.h
arch/arm64/include/asm/kprobes.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/include/asm/sysreg.h
arch/arm64/include/asm/virt.h
arch/arm64/kernel/cpu_errata.c
arch/arm64/kernel/cpuinfo.c
arch/arm64/kernel/efi-header.S
arch/arm64/kernel/efi.c
arch/arm64/kernel/entry.S
arch/arm64/kernel/image-vars.h
arch/arm64/kernel/kexec_image.c
arch/arm64/kernel/machine_kexec_file.c
arch/arm64/kernel/probes/kprobes.c
arch/arm64/kernel/proton-pack.c
arch/arm64/kernel/smp.c
arch/arm64/kernel/smp_spin_table.c
arch/arm64/kernel/vdso32/Makefile
arch/arm64/kernel/vmlinux.lds.S
arch/arm64/kvm/arm.c
arch/arm64/kvm/hyp/include/hyp/switch.h
arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h
arch/arm64/kvm/hyp/nvhe/host.S
arch/arm64/kvm/hyp/nvhe/hyp-init.S
arch/arm64/kvm/hyp/nvhe/switch.c
arch/arm64/kvm/hyp/nvhe/tlb.c
arch/arm64/kvm/hyp/pgtable.c
arch/arm64/kvm/hyp/vhe/switch.c
arch/arm64/kvm/hypercalls.c
arch/arm64/kvm/mmu.c
arch/arm64/kvm/sys_regs.c
arch/arm64/kvm/sys_regs.h
arch/arm64/lib/memcpy.S
arch/arm64/lib/memmove.S
arch/arm64/lib/memset.S
arch/arm64/mm/fault.c
arch/arm64/mm/mmu.c
arch/csky/include/asm/tcm.h
arch/ia64/include/asm/cache.h
arch/microblaze/kernel/setup.c
arch/mips/boot/dts/brcm/bcm63268.dtsi
arch/mips/boot/dts/brcm/bcm6328.dtsi
arch/mips/boot/dts/brcm/bcm6362.dtsi
arch/mips/configs/gpr_defconfig
arch/mips/configs/mtx1_defconfig
arch/mips/include/asm/cache.h
arch/mips/include/asm/machine.h
arch/mips/kernel/setup.c
arch/mips/mm/init.c
arch/parisc/include/asm/cache.h
arch/parisc/include/asm/ldcw.h
arch/parisc/kernel/ftrace.c
arch/parisc/kernel/sys_parisc.c
arch/parisc/kernel/syscalls/syscall.tbl
arch/parisc/kernel/time.c
arch/parisc/mm/init.c
arch/powerpc/include/asm/asm-const.h
arch/powerpc/include/asm/cache.h
arch/powerpc/include/asm/cputable.h
arch/powerpc/include/asm/machdep.h
arch/powerpc/include/asm/nohash/32/kup-8xx.h
arch/powerpc/include/asm/nohash/32/mmu-8xx.h
arch/powerpc/include/asm/nohash/32/pte-8xx.h
arch/powerpc/include/asm/topology.h
arch/powerpc/include/asm/uaccess.h
arch/powerpc/kernel/btext.c
arch/powerpc/kernel/cputable.c
arch/powerpc/kernel/eeh.c
arch/powerpc/kernel/eeh_cache.c
arch/powerpc/kernel/head_40x.S
arch/powerpc/kernel/head_8xx.S
arch/powerpc/kernel/head_book3s_32.S
arch/powerpc/kernel/mce.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/smp.c
arch/powerpc/kernel/traps.c
arch/powerpc/kvm/book3s_64_vio_hv.c
arch/powerpc/platforms/powernv/opal-dump.c
arch/powerpc/platforms/powernv/opal-elog.c
arch/powerpc/platforms/pseries/ras.c
arch/riscv/Kconfig
arch/riscv/include/asm/soc.h
arch/riscv/include/asm/thread_info.h
arch/riscv/include/asm/uaccess.h
arch/riscv/kernel/cpu_ops.c
arch/riscv/kernel/ftrace.c
arch/riscv/kernel/head.S
arch/riscv/kernel/process.c
arch/riscv/kernel/setup.c
arch/riscv/kernel/vdso/.gitignore
arch/riscv/kernel/vdso/Makefile
arch/riscv/kernel/vdso/so2s.sh [new file with mode: 0755]
arch/riscv/lib/Makefile
arch/riscv/mm/fault.c
arch/riscv/mm/init.c
arch/s390/boot/startup.c
arch/s390/configs/debug_defconfig
arch/s390/configs/defconfig
arch/s390/configs/zfcpdump_defconfig
arch/s390/include/asm/cache.h
arch/s390/include/asm/pgtable.h
arch/s390/include/asm/sections.h
arch/s390/include/asm/vdso/vdso.h [deleted file]
arch/s390/kernel/asm-offsets.c
arch/s390/kernel/smp.c
arch/s390/mm/init.c
arch/s390/pci/pci_event.c
arch/sh/boards/of-generic.c
arch/sh/include/asm/cache.h
arch/sh/include/asm/machvec.h
arch/sh/include/asm/smp.h
arch/sparc/include/asm/cache.h
arch/sparc/kernel/btext.c
arch/um/include/shared/init.h
arch/um/kernel/um_arch.c
arch/x86/boot/compressed/head_64.S
arch/x86/boot/compressed/ident_map_64.c
arch/x86/boot/compressed/kaslr.c
arch/x86/boot/compressed/mem_encrypt.S
arch/x86/boot/compressed/misc.h
arch/x86/boot/compressed/pgtable_64.c
arch/x86/boot/tty.c
arch/x86/boot/video.h
arch/x86/crypto/poly1305_glue.c
arch/x86/entry/syscalls/syscall_64.tbl
arch/x86/hyperv/hv_apic.c
arch/x86/include/asm/apic.h
arch/x86/include/asm/cache.h
arch/x86/include/asm/intel-mid.h
arch/x86/include/asm/irqflags.h
arch/x86/include/asm/mem_encrypt.h
arch/x86/include/asm/setup.h
arch/x86/include/asm/uaccess.h
arch/x86/include/uapi/asm/kvm_para.h
arch/x86/kernel/Makefile
arch/x86/kernel/alternative.c
arch/x86/kernel/apic/x2apic_uv_x.c
arch/x86/kernel/cpu/bugs.c
arch/x86/kernel/cpu/cpu.h
arch/x86/kernel/head64.c
arch/x86/kernel/head_64.S
arch/x86/kernel/kexec-bzimage64.c
arch/x86/kernel/sev-es-shared.c
arch/x86/kernel/sev-es.c
arch/x86/kernel/sev_verify_cbit.S [new file with mode: 0644]
arch/x86/kernel/traps.c
arch/x86/kernel/unwind_orc.c
arch/x86/kvm/cpuid.c
arch/x86/kvm/cpuid.h
arch/x86/kvm/ioapic.c
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/spte.c
arch/x86/kvm/mmu/spte.h
arch/x86/kvm/mmu/tdp_mmu.c
arch/x86/kvm/vmx/evmcs.c
arch/x86/kvm/vmx/evmcs.h
arch/x86/kvm/vmx/posted_intr.c
arch/x86/kvm/vmx/posted_intr.h
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c
arch/x86/kvm/x86.h
arch/x86/lib/memcpy_64.S
arch/x86/lib/memmove_64.S
arch/x86/lib/memset_64.S
arch/x86/mm/mem_encrypt.c
arch/x86/mm/mem_encrypt_identity.c
arch/x86/platform/pvh/enlighten.c
arch/x86/purgatory/purgatory.c
arch/x86/xen/enlighten.c
arch/x86/xen/enlighten_pvh.c
arch/x86/xen/smp.c
arch/x86/xen/xen-ops.h
arch/xtensa/kernel/setup.c
arch/xtensa/mm/init.c
block/bio.c
block/blk-cgroup.c
block/blk-core.c
block/blk-flush.c
block/blk-mq-cpumap.c
block/blk-mq.c
drivers/acpi/acpi_dbg.c
drivers/acpi/acpi_processor.c
drivers/acpi/acpi_video.c
drivers/acpi/acpica/hwgpe.c
drivers/acpi/battery.c
drivers/acpi/button.c
drivers/acpi/dock.c
drivers/acpi/dptf/Kconfig
drivers/acpi/dptf/dptf_pch_fivr.c
drivers/acpi/dptf/dptf_power.c
drivers/acpi/dptf/int340x_thermal.c
drivers/acpi/event.c
drivers/acpi/evged.c
drivers/acpi/fan.c
drivers/acpi/internal.h
drivers/acpi/nfit/core.c
drivers/acpi/pci_irq.c
drivers/acpi/pci_link.c
drivers/acpi/pci_mcfg.c
drivers/acpi/power.c
drivers/acpi/processor_perflib.c
drivers/acpi/reboot.c
drivers/acpi/sbs.c
drivers/acpi/sbshc.c
drivers/acpi/sbshc.h
drivers/acpi/scan.c
drivers/acpi/utils.c
drivers/acpi/video_detect.c
drivers/acpi/wakeup.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-scsi.c
drivers/ata/pata_ns87415.c
drivers/ata/sata_nv.c
drivers/ata/sata_rcar.c
drivers/base/core.c
drivers/base/dd.c
drivers/base/power/domain.c
drivers/base/power/main.c
drivers/base/power/runtime.c
drivers/block/nbd.c
drivers/block/null_blk.h
drivers/block/null_blk_zoned.c
drivers/block/rnbd/rnbd-clt.c
drivers/block/skd_main.c
drivers/block/xen-blkback/xenbus.c
drivers/block/xen-blkfront.c
drivers/block/xsysace.c
drivers/block/zram/zram_drv.c
drivers/bluetooth/btintel.h
drivers/bus/brcmstb_gisb.c
drivers/bus/mhi/core/main.c
drivers/char/random.c
drivers/char/tpm/eventlog/efi.c
drivers/char/tpm/tpm_tis.c
drivers/clk/clk.c
drivers/clk/imx/clk-imx27.c
drivers/clk/imx/clk-imx31.c
drivers/clk/imx/clk-imx35.c
drivers/clk/samsung/clk-s3c2410-dclk.c
drivers/clk/samsung/clk-s3c2410.c
drivers/clk/samsung/clk-s3c2412.c
drivers/clk/samsung/clk-s3c2443.c
drivers/clk/samsung/clk-s3c64xx.c
drivers/clocksource/timer-probe.c
drivers/cpufreq/Kconfig
drivers/cpufreq/Kconfig.arm
drivers/cpufreq/acpi-cpufreq.c
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq_governor.h
drivers/cpufreq/cpufreq_performance.c
drivers/cpufreq/cpufreq_powersave.c
drivers/cpufreq/e_powersaver.c
drivers/cpufreq/intel_pstate.c
drivers/cpufreq/longhaul.c
drivers/cpufreq/s3c2410-cpufreq.c
drivers/cpufreq/s3c2412-cpufreq.c
drivers/cpufreq/s3c2440-cpufreq.c
drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
drivers/cpufreq/s3c24xx-cpufreq.c
drivers/cpufreq/scmi-cpufreq.c
drivers/cpufreq/speedstep-lib.c
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-trng.c
drivers/crypto/caam/qi.c
drivers/dma/Kconfig
drivers/dma/Makefile
drivers/dma/mic_x100_dma.c [deleted file]
drivers/dma/mic_x100_dma.h [deleted file]
drivers/dma/ti/k3-udma-glue.c
drivers/firmware/Kconfig
drivers/firmware/Makefile
drivers/firmware/arm_scmi/Makefile
drivers/firmware/arm_scmi/base.c
drivers/firmware/arm_scmi/bus.c
drivers/firmware/arm_scmi/clock.c
drivers/firmware/arm_scmi/common.h
drivers/firmware/arm_scmi/driver.c
drivers/firmware/arm_scmi/mailbox.c
drivers/firmware/arm_scmi/notify.c
drivers/firmware/arm_scmi/perf.c
drivers/firmware/arm_scmi/power.c
drivers/firmware/arm_scmi/reset.c
drivers/firmware/arm_scmi/sensors.c
drivers/firmware/arm_scmi/smc.c
drivers/firmware/arm_scmi/system.c [new file with mode: 0644]
drivers/firmware/imx/scu-pd.c
drivers/firmware/smccc/smccc.c
drivers/firmware/tegra/bpmp.c
drivers/firmware/ti_sci.c
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
drivers/gpu/drm/amd/amdgpu/cik.c
drivers/gpu/drm/amd/amdgpu/cik_sdma.c
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
drivers/gpu/drm/amd/amdgpu/nv.c
drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
drivers/gpu/drm/amd/amdgpu/soc15.c
drivers/gpu/drm/amd/amdkfd/kfd_crat.c
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v10.c
drivers/gpu/drm/amd/display/Kconfig
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
drivers/gpu/drm/amd/display/dc/gpio/dcn30/hw_factory_dcn30.c
drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c
drivers/gpu/drm/amd/display/dc/os_types.h
drivers/gpu/drm/amd/display/include/dal_asic_id.h
drivers/gpu/drm/amd/include/amd_shared.h
drivers/gpu/drm/amd/pm/inc/hwmgr.h
drivers/gpu/drm/amd/pm/inc/smu_types.h
drivers/gpu/drm/amd/pm/inc/smumgr.h
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ci_baco.c
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c
drivers/gpu/drm/amd/pm/powerplay/smumgr/smumgr.c
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
drivers/gpu/drm/drm_dp_helper.c
drivers/gpu/drm/drm_edid.c
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/drm_gem_shmem_helper.c
drivers/gpu/drm/drm_prime.c
drivers/gpu/drm/i915/Kconfig.debug
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
drivers/gpu/drm/i915/display/intel_psr.c
drivers/gpu/drm/i915/gem/i915_gem_domain.c
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
drivers/gpu/drm/i915/gem/i915_gem_stolen.c
drivers/gpu/drm/i915/gem/i915_gem_stolen.h
drivers/gpu/drm/i915/gt/gen6_ppgtt.c
drivers/gpu/drm/i915/gt/gen8_ppgtt.c
drivers/gpu/drm/i915/gt/intel_engine.h
drivers/gpu/drm/i915/gt/intel_engine_types.h
drivers/gpu/drm/i915/gt/intel_lrc.c
drivers/gpu/drm/i915/gt/intel_mocs.c
drivers/gpu/drm/i915/gt/intel_timeline.c
drivers/gpu/drm/i915/gt/intel_timeline_types.h
drivers/gpu/drm/i915/gt/selftest_reset.c
drivers/gpu/drm/i915/gvt/handlers.c
drivers/gpu/drm/i915/gvt/scheduler.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/i915/i915_pci.c
drivers/gpu/drm/i915/i915_vma.c
drivers/gpu/drm/i915/intel_memory_region.c
drivers/gpu/drm/i915/intel_uncore.c
drivers/gpu/drm/i915/selftests/intel_memory_region.c
drivers/gpu/drm/i915/selftests/mock_region.c
drivers/gpu/drm/imx/dw_hdmi-imx.c
drivers/gpu/drm/imx/imx-drm-core.c
drivers/gpu/drm/imx/imx-ldb.c
drivers/gpu/drm/imx/imx-tve.c
drivers/gpu/drm/imx/parallel-display.c
drivers/gpu/drm/mediatek/mtk_drm_crtc.c
drivers/gpu/drm/nouveau/dispnv50/core.h
drivers/gpu/drm/nouveau/dispnv50/core507d.c
drivers/gpu/drm/nouveau/dispnv50/core907d.c
drivers/gpu/drm/nouveau/dispnv50/core917d.c
drivers/gpu/drm/nouveau/include/nvhw/class/cl507d.h
drivers/gpu/drm/nouveau/include/nvhw/class/cl907d.h
drivers/gpu/drm/nouveau/nouveau_connector.c
drivers/gpu/drm/nouveau/nouveau_dp.c
drivers/gpu/drm/nouveau/nouveau_gem.c
drivers/gpu/drm/nouveau/nouveau_svm.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
drivers/gpu/drm/panfrost/panfrost_drv.c
drivers/gpu/drm/panfrost/panfrost_gem.c
drivers/gpu/drm/panfrost/panfrost_gem.h
drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c
drivers/gpu/drm/sun4i/sun4i_frontend.c
drivers/gpu/drm/sun4i/sun4i_frontend.h
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/v3d/v3d_gem.c
drivers/gpu/drm/vc4/vc4_bo.c
drivers/gpu/drm/vc4/vc4_drv.c
drivers/gpu/drm/vc4/vc4_drv.h
drivers/gpu/drm/vc4/vc4_gem.c
drivers/gpu/drm/vc4/vc4_hdmi.c
drivers/gpu/drm/vc4/vc4_hvs.c
drivers/gpu/drm/vc4/vc4_kms.c
drivers/gpu/drm/vc4/vc4_v3d.c
drivers/gpu/ipu-v3/ipu-common.c
drivers/hid/hid-rmi.c
drivers/hv/hv_balloon.c
drivers/hwmon/s3c-hwmon.c
drivers/hwtracing/coresight/coresight-core.c
drivers/hwtracing/coresight/coresight-cti-sysfs.c
drivers/hwtracing/coresight/coresight-etm-perf.c
drivers/i2c/busses/Kconfig
drivers/i2c/busses/i2c-designware-slave.c
drivers/i2c/busses/i2c-mlxbf.c
drivers/i2c/busses/i2c-mt65xx.c
drivers/i2c/busses/i2c-sh_mobile.c
drivers/i2c/i2c-core-acpi.c
drivers/idle/intel_idle.c
drivers/infiniband/core/cma.c
drivers/infiniband/core/uverbs_std_types_device.c
drivers/infiniband/hw/hfi1/driver.c
drivers/infiniband/hw/hfi1/ipoib.h
drivers/infiniband/hw/hfi1/ipoib_main.c
drivers/infiniband/hw/hfi1/ipoib_tx.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/qedr/qedr_iw_cm.c
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h
drivers/infiniband/sw/rdmavt/vt.c
drivers/infiniband/sw/rxe/rxe_av.c
drivers/infiniband/sw/rxe/rxe_net.c
drivers/infiniband/sw/rxe/rxe_verbs.c
drivers/infiniband/sw/siw/siw_main.c
drivers/infiniband/ulp/iser/iser_verbs.c
drivers/infiniband/ulp/rtrs/rtrs-clt.c
drivers/infiniband/ulp/srpt/ib_srpt.c
drivers/infiniband/ulp/srpt/ib_srpt.h
drivers/input/evdev.c
drivers/input/input-mt.c
drivers/input/joystick/Kconfig
drivers/input/joystick/Makefile
drivers/input/joystick/adc-joystick.c [new file with mode: 0644]
drivers/input/keyboard/ep93xx_keypad.c
drivers/input/keyboard/omap4-keypad.c
drivers/input/keyboard/twl4030_keypad.c
drivers/input/misc/soc_button_array.c
drivers/input/mouse/synaptics.c
drivers/input/rmi4/Kconfig
drivers/input/rmi4/Makefile
drivers/input/rmi4/rmi_bus.c
drivers/input/rmi4/rmi_driver.h
drivers/input/rmi4/rmi_f30.c
drivers/input/rmi4/rmi_f34v7.c
drivers/input/rmi4/rmi_f3a.c [new file with mode: 0644]
drivers/input/serio/hil_mlc.c
drivers/input/serio/hp_sdc_mlc.c
drivers/input/serio/sun4i-ps2.c
drivers/input/touchscreen/Kconfig
drivers/input/touchscreen/Makefile
drivers/input/touchscreen/elants_i2c.c
drivers/input/touchscreen/imx6ul_tsc.c
drivers/input/touchscreen/raydium_i2c_ts.c
drivers/input/touchscreen/s3c2410_ts.c
drivers/input/touchscreen/stmfts.c
drivers/input/touchscreen/zinitix.c [new file with mode: 0644]
drivers/interconnect/core.c
drivers/interconnect/qcom/icc-rpmh.c
drivers/interconnect/qcom/sc7180.c
drivers/interconnect/qcom/sdm845.c
drivers/interconnect/qcom/sm8150.c
drivers/interconnect/qcom/sm8250.c
drivers/iommu/amd/amd_iommu_types.h
drivers/iommu/intel/iommu.c
drivers/iommu/intel/svm.c
drivers/iommu/iommu.c
drivers/irqchip/Kconfig
drivers/irqchip/Makefile
drivers/irqchip/irq-bcm2836.c
drivers/irqchip/irq-mst-intc.c
drivers/irqchip/irq-renesas-intc-irqpin.c
drivers/irqchip/irq-sifive-plic.c
drivers/irqchip/irq-stm32-exti.c
drivers/irqchip/irq-ti-sci-inta.c
drivers/irqchip/irqchip.c
drivers/lightnvm/core.c
drivers/mailbox/tegra-hsp.c
drivers/memory/Kconfig
drivers/memory/Makefile
drivers/memory/brcmstb_dpfe.c
drivers/memory/emif.c
drivers/memory/fsl-corenet-cf.c
drivers/memory/mtk-smi.c
drivers/memory/omap-gpmc.c
drivers/memory/renesas-rpc-if.c
drivers/memory/samsung/exynos5422-dmc.c
drivers/memory/tegra/tegra124-emc.c
drivers/memory/tegra/tegra124.c
drivers/memory/tegra/tegra186-emc.c
drivers/memory/tegra/tegra210-emc-cc-r21021.c
drivers/memory/tegra/tegra210.c
drivers/message/fusion/mptscsih.c
drivers/misc/Kconfig
drivers/misc/Makefile
drivers/misc/mei/hw.h
drivers/misc/mic/Kconfig [deleted file]
drivers/misc/mic/Makefile [deleted file]
drivers/misc/mic/bus/Makefile [deleted file]
drivers/misc/mic/bus/cosm_bus.c [deleted file]
drivers/misc/mic/bus/cosm_bus.h [deleted file]
drivers/misc/mic/bus/mic_bus.c [deleted file]
drivers/misc/mic/bus/scif_bus.c [deleted file]
drivers/misc/mic/bus/scif_bus.h [deleted file]
drivers/misc/mic/bus/vop_bus.c [deleted file]
drivers/misc/mic/bus/vop_bus.h [deleted file]
drivers/misc/mic/card/Makefile [deleted file]
drivers/misc/mic/card/mic_debugfs.c [deleted file]
drivers/misc/mic/card/mic_device.c [deleted file]
drivers/misc/mic/card/mic_device.h [deleted file]
drivers/misc/mic/card/mic_x100.c [deleted file]
drivers/misc/mic/card/mic_x100.h [deleted file]
drivers/misc/mic/common/mic_dev.h [deleted file]
drivers/misc/mic/cosm/Makefile [deleted file]
drivers/misc/mic/cosm/cosm_debugfs.c [deleted file]
drivers/misc/mic/cosm/cosm_main.c [deleted file]
drivers/misc/mic/cosm/cosm_main.h [deleted file]
drivers/misc/mic/cosm/cosm_scif_server.c [deleted file]
drivers/misc/mic/cosm/cosm_sysfs.c [deleted file]
drivers/misc/mic/cosm_client/Makefile [deleted file]
drivers/misc/mic/cosm_client/cosm_scif_client.c [deleted file]
drivers/misc/mic/host/Makefile [deleted file]
drivers/misc/mic/host/mic_boot.c [deleted file]
drivers/misc/mic/host/mic_debugfs.c [deleted file]
drivers/misc/mic/host/mic_device.h [deleted file]
drivers/misc/mic/host/mic_intr.c [deleted file]
drivers/misc/mic/host/mic_intr.h [deleted file]
drivers/misc/mic/host/mic_main.c [deleted file]
drivers/misc/mic/host/mic_smpt.c [deleted file]
drivers/misc/mic/host/mic_smpt.h [deleted file]
drivers/misc/mic/host/mic_x100.c [deleted file]
drivers/misc/mic/host/mic_x100.h [deleted file]
drivers/misc/mic/scif/Makefile [deleted file]
drivers/misc/mic/scif/scif_api.c [deleted file]
drivers/misc/mic/scif/scif_debugfs.c [deleted file]
drivers/misc/mic/scif/scif_dma.c [deleted file]
drivers/misc/mic/scif/scif_epd.c [deleted file]
drivers/misc/mic/scif/scif_epd.h [deleted file]
drivers/misc/mic/scif/scif_fd.c [deleted file]
drivers/misc/mic/scif/scif_fence.c [deleted file]
drivers/misc/mic/scif/scif_main.c [deleted file]
drivers/misc/mic/scif/scif_main.h [deleted file]
drivers/misc/mic/scif/scif_map.h [deleted file]
drivers/misc/mic/scif/scif_mmap.c [deleted file]
drivers/misc/mic/scif/scif_nm.c [deleted file]
drivers/misc/mic/scif/scif_nodeqp.c [deleted file]
drivers/misc/mic/scif/scif_nodeqp.h [deleted file]
drivers/misc/mic/scif/scif_peer_bus.c [deleted file]
drivers/misc/mic/scif/scif_peer_bus.h [deleted file]
drivers/misc/mic/scif/scif_ports.c [deleted file]
drivers/misc/mic/scif/scif_rb.c [deleted file]
drivers/misc/mic/scif/scif_rb.h [deleted file]
drivers/misc/mic/scif/scif_rma.c [deleted file]
drivers/misc/mic/scif/scif_rma.h [deleted file]
drivers/misc/mic/scif/scif_rma_list.c [deleted file]
drivers/misc/mic/scif/scif_rma_list.h [deleted file]
drivers/misc/mic/vop/Makefile [deleted file]
drivers/misc/mic/vop/vop_debugfs.c [deleted file]
drivers/misc/mic/vop/vop_main.c [deleted file]
drivers/misc/mic/vop/vop_main.h [deleted file]
drivers/misc/mic/vop/vop_vringh.c [deleted file]
drivers/mmc/host/Kconfig
drivers/mmc/host/s3cmci.c
drivers/mmc/host/sdhci-esdhc.h
drivers/mmc/host/sdhci-of-esdhc.c
drivers/mmc/host/sdhci.c
drivers/mtd/nand/raw/fsl_ifc_nand.c
drivers/mtd/nand/raw/mxc_nand.c
drivers/mtd/nand/raw/stm32_fmc2_nand.c
drivers/mtd/spi-nor/core.c
drivers/net/Kconfig
drivers/net/Makefile
drivers/net/bareudp.c
drivers/net/bonding/bond_main.c
drivers/net/can/dev.c
drivers/net/can/flexcan.c
drivers/net/can/peak_canfd/peak_canfd.c
drivers/net/can/rx-offload.c
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c
drivers/net/can/ti_hecc.c
drivers/net/can/usb/peak_usb/pcan_usb_core.c
drivers/net/can/usb/peak_usb/pcan_usb_fd.c
drivers/net/can/xilinx_can.c
drivers/net/dsa/Kconfig
drivers/net/dsa/Makefile
drivers/net/dsa/hirschmann/Kconfig [new file with mode: 0644]
drivers/net/dsa/hirschmann/Makefile [new file with mode: 0644]
drivers/net/dsa/hirschmann/hellcreek.c [new file with mode: 0644]
drivers/net/dsa/hirschmann/hellcreek.h [new file with mode: 0644]
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c [new file with mode: 0644]
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h [new file with mode: 0644]
drivers/net/dsa/hirschmann/hellcreek_ptp.c [new file with mode: 0644]
drivers/net/dsa/hirschmann/hellcreek_ptp.h [new file with mode: 0644]
drivers/net/dsa/mt7530.c
drivers/net/dsa/mt7530.h
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/mv88e6xxx/chip.h
drivers/net/dsa/mv88e6xxx/devlink.c
drivers/net/dsa/mv88e6xxx/global1.h
drivers/net/dsa/mv88e6xxx/global1_vtu.c
drivers/net/dsa/ocelot/felix.c
drivers/net/dsa/qca8k.c
drivers/net/dummy.c
drivers/net/ethernet/8390/mac8390.c
drivers/net/ethernet/8390/ne.c
drivers/net/ethernet/8390/ne2k-pci.c
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/cadence/macb.h
drivers/net/ethernet/cadence/macb_main.c
drivers/net/ethernet/cavium/liquidio/cn68xx_device.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
drivers/net/ethernet/chelsio/cxgb4/sge.c
drivers/net/ethernet/chelsio/cxgb4/t4_tcb.h
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.h
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_hw.c
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c
drivers/net/ethernet/davicom/Kconfig
drivers/net/ethernet/davicom/dm9000.c
drivers/net/ethernet/dec/tulip/de2104x.c
drivers/net/ethernet/dec/tulip/tulip_core.c
drivers/net/ethernet/faraday/ftgmac100.c
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
drivers/net/ethernet/freescale/enetc/enetc.c
drivers/net/ethernet/freescale/enetc/enetc.h
drivers/net/ethernet/freescale/enetc/enetc_hw.h
drivers/net/ethernet/freescale/enetc/enetc_pf.c
drivers/net/ethernet/freescale/enetc/enetc_qos.c
drivers/net/ethernet/freescale/enetc/enetc_vf.c
drivers/net/ethernet/freescale/fec.h
drivers/net/ethernet/freescale/fec_main.c
drivers/net/ethernet/freescale/gianfar.c
drivers/net/ethernet/freescale/ucc_geth.c
drivers/net/ethernet/google/gve/gve_adminq.h
drivers/net/ethernet/google/gve/gve_main.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
drivers/net/ethernet/ibm/ibmveth.c
drivers/net/ethernet/ibm/ibmvnic.c
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
drivers/net/ethernet/intel/i40e/i40e_xsk.c
drivers/net/ethernet/intel/igc/igc_main.c
drivers/net/ethernet/marvell/octeontx2/af/cgx.c
drivers/net/ethernet/marvell/octeontx2/af/cgx.h
drivers/net/ethernet/marvell/octeontx2/af/common.h
drivers/net/ethernet/marvell/octeontx2/af/mbox.h
drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h
drivers/net/ethernet/marvell/octeontx2/af/rvu.c
drivers/net/ethernet/marvell/octeontx2/af/rvu.h
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h
drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
drivers/net/ethernet/marvell/prestera/Kconfig
drivers/net/ethernet/marvell/sky2.c
drivers/net/ethernet/mellanox/mlx4/en_rx.c
drivers/net/ethernet/mellanox/mlx4/fw_qos.h
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
drivers/net/ethernet/mellanox/mlx5/core/Makefile
drivers/net/ethernet/mellanox/mlx5/core/en/params.c
drivers/net/ethernet/mellanox/mlx5/core/en/params.h
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.h
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.h
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/eswitch.c
drivers/net/ethernet/mellanox/mlx5/core/fpga/sdk.h
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
drivers/net/ethernet/mellanox/mlx5/core/lib/mlx5.h
drivers/net/ethernet/mellanox/mlx5/core/lib/vxlan.c
drivers/net/ethernet/mellanox/mlx5/core/lib/vxlan.h
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_buddy.c [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h
drivers/net/ethernet/mellanox/mlxsw/core.c
drivers/net/ethernet/mellanox/mlxsw/reg.h
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h
drivers/net/ethernet/microchip/lan743x_ethtool.c
drivers/net/ethernet/microchip/lan743x_main.c
drivers/net/ethernet/microchip/lan743x_main.h
drivers/net/ethernet/mscc/ocelot.c
drivers/net/ethernet/mscc/ocelot.h
drivers/net/ethernet/mscc/ocelot_net.c
drivers/net/ethernet/neterion/s2io.c
drivers/net/ethernet/neterion/s2io.h
drivers/net/ethernet/neterion/vxge/vxge-config.c
drivers/net/ethernet/netronome/nfp/nfp_main.c
drivers/net/ethernet/nvidia/forcedeth.c
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
drivers/net/ethernet/pensando/ionic/ionic_dev.c
drivers/net/ethernet/pensando/ionic/ionic_dev.h
drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
drivers/net/ethernet/pensando/ionic/ionic_fw.c
drivers/net/ethernet/pensando/ionic/ionic_lif.c
drivers/net/ethernet/pensando/ionic/ionic_main.c
drivers/net/ethernet/pensando/ionic/ionic_stats.h
drivers/net/ethernet/pensando/ionic/ionic_txrx.c
drivers/net/ethernet/pensando/ionic/ionic_txrx.h
drivers/net/ethernet/realtek/r8169_main.c
drivers/net/ethernet/renesas/ravb_main.c
drivers/net/ethernet/sfc/bitfield.h
drivers/net/ethernet/sfc/ef100_nic.c
drivers/net/ethernet/sfc/ef100_tx.c
drivers/net/ethernet/smsc/Kconfig
drivers/net/ethernet/smsc/smc911x.c
drivers/net/ethernet/smsc/smc91x.c
drivers/net/ethernet/stmicro/stmmac/common.h
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
drivers/net/ethernet/stmicro/stmmac/dwmac4.h
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
drivers/net/ethernet/stmicro/stmmac/hwif.h
drivers/net/ethernet/stmicro/stmmac/stmmac.h
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
drivers/net/ethernet/ti/am65-cpsw-nuss.c
drivers/net/ethernet/ti/am65-cpsw-nuss.h
drivers/net/ethernet/ti/cpsw_ale.c
drivers/net/ethernet/ti/cpsw_ale.h
drivers/net/ethernet/ti/cpsw_ethtool.c
drivers/net/ethernet/ti/cpsw_priv.c
drivers/net/ethernet/ti/cpsw_switchdev.c
drivers/net/ethernet/ti/tlan.c
drivers/net/ethernet/xilinx/Kconfig
drivers/net/ethernet/xilinx/xilinx_axienet.h
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
drivers/net/ethernet/xilinx/xilinx_emaclite.c
drivers/net/fddi/skfp/drvfbi.c
drivers/net/fddi/skfp/ecm.c
drivers/net/fddi/skfp/ess.c
drivers/net/fddi/skfp/hwt.c
drivers/net/fddi/skfp/pcmplc.c
drivers/net/fddi/skfp/pmf.c
drivers/net/fddi/skfp/queue.c
drivers/net/fddi/skfp/rmt.c
drivers/net/fddi/skfp/smtdef.c
drivers/net/fddi/skfp/smtinit.c
drivers/net/fddi/skfp/smttimer.c
drivers/net/fddi/skfp/srf.c
drivers/net/geneve.c
drivers/net/gtp.c
drivers/net/hamradio/hdlcdrv.c
drivers/net/ieee802154/ca8210.c
drivers/net/ifb.c
drivers/net/ipa/gsi.c
drivers/net/ipa/gsi.h
drivers/net/ipa/gsi_reg.h
drivers/net/ipa/gsi_trans.c
drivers/net/ipa/ipa_data-sc7180.c
drivers/net/ipa/ipa_data-sdm845.c
drivers/net/ipa/ipa_data.h
drivers/net/ipa/ipa_endpoint.c
drivers/net/ipa/ipa_main.c
drivers/net/ipa/ipa_mem.c
drivers/net/ipa/ipa_reg.h
drivers/net/ipa/ipa_uc.c
drivers/net/macsec.c
drivers/net/macvlan.c
drivers/net/mhi_net.c [new file with mode: 0644]
drivers/net/mii.c
drivers/net/net_failover.c
drivers/net/netconsole.c
drivers/net/netdevsim/dev.c
drivers/net/netdevsim/fib.c
drivers/net/netdevsim/netdevsim.h
drivers/net/phy/adin.c
drivers/net/phy/aquantia_main.c
drivers/net/phy/at803x.c
drivers/net/phy/bcm-cygnus.c
drivers/net/phy/bcm-phy-lib.c
drivers/net/phy/bcm-phy-lib.h
drivers/net/phy/bcm54140.c
drivers/net/phy/bcm63xx.c
drivers/net/phy/bcm87xx.c
drivers/net/phy/broadcom.c
drivers/net/phy/cicada.c
drivers/net/phy/davicom.c
drivers/net/phy/marvell.c
drivers/net/phy/microchip_t1.c
drivers/net/phy/mscc/mscc_main.c
drivers/net/phy/mscc/mscc_ptp.c
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c
drivers/net/phy/phy_led_triggers.c
drivers/net/phy/phylink.c
drivers/net/phy/realtek.c
drivers/net/phy/sfp.c
drivers/net/team/team.c
drivers/net/tun.c
drivers/net/usb/Makefile
drivers/net/usb/aqc111.c
drivers/net/usb/asix_devices.c
drivers/net/usb/ax88172a.c
drivers/net/usb/ax88179_178a.c
drivers/net/usb/cdc_mbim.c
drivers/net/usb/cdc_ncm.c
drivers/net/usb/dm9601.c
drivers/net/usb/int51x1.c
drivers/net/usb/lan78xx.c
drivers/net/usb/mcs7830.c
drivers/net/usb/qmi_wwan.c
drivers/net/usb/r8152.c
drivers/net/usb/r8153_ecm.c [new file with mode: 0644]
drivers/net/usb/rndis_host.c
drivers/net/usb/sierra_net.c
drivers/net/usb/smsc75xx.c
drivers/net/usb/smsc95xx.c
drivers/net/usb/sr9700.c
drivers/net/usb/sr9800.c
drivers/net/usb/usbnet.c
drivers/net/vrf.c
drivers/net/vxlan.c
drivers/net/wan/Kconfig
drivers/net/wan/Makefile
drivers/net/wan/cosa.c
drivers/net/wan/hdlc_fr.c
drivers/net/wan/lmc/lmc_main.c
drivers/net/wan/x25_asy.c [deleted file]
drivers/net/wan/x25_asy.h [deleted file]
drivers/net/wimax/Kconfig [deleted file]
drivers/net/wimax/Makefile [deleted file]
drivers/net/wireguard/device.c
drivers/net/wireless/Kconfig
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/debug.c
drivers/net/wireless/ath/ath9k/init.c
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/carl9170/mac.c
drivers/net/wireless/ath/carl9170/main.c
drivers/net/wireless/broadcom/b43/main.c
drivers/net/wireless/broadcom/b43legacy/main.c
drivers/net/wireless/quantenna/qtnfmac/core.c
drivers/net/wireless/quantenna/qtnfmac/core.h
drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c
drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c
drivers/net/wireless/ralink/rt2x00/rt2x00config.c
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
drivers/net/wireless/rndis_wlan.c
drivers/net/xen-netfront.c
drivers/ntb/hw/amd/ntb_hw_amd.c
drivers/ntb/hw/intel/ntb_hw_gen1.c
drivers/ntb/test/ntb_msi_test.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/host/tcp.c
drivers/nvme/target/core.c
drivers/nvme/target/passthru.c
drivers/nvme/target/trace.h
drivers/of/device.c
drivers/of/of_reserved_mem.c
drivers/opp/core.c
drivers/opp/of.c
drivers/pci/controller/dwc/pcie-designware-host.c
drivers/pci/controller/pci-mvebu.c
drivers/pci/pci.c
drivers/platform/x86/thinkpad_acpi.c
drivers/pnp/core.c
drivers/power/Kconfig
drivers/power/Makefile
drivers/power/avs/Kconfig [deleted file]
drivers/power/avs/Makefile [deleted file]
drivers/power/supply/s3c_adc_battery.c
drivers/powercap/Kconfig
drivers/powercap/intel_rapl_common.c
drivers/powercap/intel_rapl_msr.c
drivers/powercap/powercap_sys.c
drivers/ptp/ptp_idt82p33.c
drivers/ptp/ptp_idt82p33.h
drivers/pwm/Kconfig
drivers/regulator/core.c
drivers/reset/Kconfig
drivers/reset/core.c
drivers/reset/reset-imx7.c
drivers/reset/reset-zynqmp.c
drivers/reset/sti/reset-syscfg.c
drivers/s390/crypto/ap_bus.c
drivers/s390/crypto/pkey_api.c
drivers/s390/crypto/zcrypt_card.c
drivers/s390/crypto/zcrypt_queue.c
drivers/s390/net/ism_drv.c
drivers/scsi/53c700.c
drivers/scsi/arcmsr/arcmsr.h
drivers/scsi/arcmsr/arcmsr_hba.c
drivers/scsi/bfa/bfad.c
drivers/scsi/dc395x.c
drivers/scsi/device_handler/scsi_dh_alua.c
drivers/scsi/fcoe/fcoe_sysfs.c
drivers/scsi/fnic/vnic_wq_copy.c
drivers/scsi/gdth.c
drivers/scsi/hisi_sas/hisi_sas_main.c
drivers/scsi/hpsa.c
drivers/scsi/ibmvscsi/ibmvscsi.c
drivers/scsi/initio.c
drivers/scsi/isci/remote_node_table.h
drivers/scsi/mpt3sas/mpt3sas_base.c
drivers/scsi/myrb.c
drivers/scsi/pm8001/pm8001_ctl.c
drivers/scsi/pm8001/pm8001_defs.h
drivers/scsi/pm8001/pm8001_hwi.c
drivers/scsi/pm8001/pm8001_init.c
drivers/scsi/pm8001/pm8001_sas.h
drivers/scsi/pm8001/pm80xx_hwi.c
drivers/scsi/qla2xxx/qla_dfs.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_nvme.c
drivers/scsi/qla2xxx/qla_nx2.c
drivers/scsi/qla2xxx/qla_tmpl.c
drivers/scsi/qla4xxx/ql4_nx.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_scan.c
drivers/scsi/sd.c
drivers/scsi/snic/vnic_cq.c
drivers/scsi/sr.c
drivers/scsi/sym53c8xx_2/sym_hipd.c
drivers/soc/actions/owl-sps-helper.c
drivers/soc/amlogic/meson-ee-pwrc.c
drivers/soc/amlogic/meson-gx-pwrc-vpu.c
drivers/soc/bcm/Kconfig
drivers/soc/bcm/Makefile
drivers/soc/bcm/bcm63xx/Kconfig [new file with mode: 0644]
drivers/soc/bcm/bcm63xx/Makefile [new file with mode: 0644]
drivers/soc/bcm/bcm63xx/bcm63xx-power.c [new file with mode: 0644]
drivers/soc/bcm/brcmstb/biuctrl.c
drivers/soc/fsl/dpio/qbman-portal.c
drivers/soc/fsl/qbman/bman.c
drivers/soc/fsl/qbman/qman.c
drivers/soc/fsl/qbman/qman_test_api.c
drivers/soc/fsl/qbman/qman_test_stash.c
drivers/soc/fsl/qe/ucc.c
drivers/soc/imx/gpcv2.c
drivers/soc/mediatek/mtk-cmdq-helper.c
drivers/soc/mediatek/mtk-infracfg.c
drivers/soc/qcom/Kconfig
drivers/soc/qcom/Makefile
drivers/soc/qcom/apr.c
drivers/soc/qcom/cpr.c [moved from drivers/power/avs/qcom-cpr.c with 100% similarity]
drivers/soc/qcom/llcc-qcom.c
drivers/soc/qcom/pdr_internal.h
drivers/soc/qcom/rpmh-internal.h
drivers/soc/qcom/rpmh-rsc.c
drivers/soc/qcom/socinfo.c
drivers/soc/renesas/Kconfig
drivers/soc/renesas/Makefile
drivers/soc/renesas/r8a779a0-sysc.c [new file with mode: 0644]
drivers/soc/renesas/rcar-rst.c
drivers/soc/renesas/renesas-soc.c
drivers/soc/rockchip/Kconfig
drivers/soc/rockchip/Makefile
drivers/soc/rockchip/io-domain.c [moved from drivers/power/avs/rockchip-io-domain.c with 100% similarity]
drivers/soc/samsung/Kconfig
drivers/soc/samsung/Makefile
drivers/soc/samsung/s3c-pm-check.c [moved from arch/arm/plat-samsung/pm-check.c with 99% similarity]
drivers/soc/samsung/s3c-pm-debug.c [moved from arch/arm/plat-samsung/pm-debug.c with 78% similarity]
drivers/soc/sunxi/sunxi_sram.c
drivers/soc/tegra/Kconfig
drivers/soc/tegra/fuse/fuse-tegra.c
drivers/soc/tegra/fuse/fuse-tegra30.c
drivers/soc/tegra/fuse/fuse.h
drivers/soc/tegra/fuse/tegra-apbmisc.c
drivers/soc/tegra/pmc.c
drivers/soc/ti/Kconfig
drivers/soc/ti/Makefile
drivers/soc/ti/k3-ringacc.c
drivers/soc/ti/k3-socinfo.c
drivers/soc/ti/knav_dma.c
drivers/soc/ti/knav_qmss_queue.c
drivers/soc/ti/omap_prm.c
drivers/soc/ti/pm33xx.c
drivers/soc/ti/pruss.c [new file with mode: 0644]
drivers/soc/ti/smartreflex.c [moved from drivers/power/avs/smartreflex.c with 100% similarity]
drivers/soc/ti/ti_sci_pm_domains.c
drivers/soc/versatile/soc-integrator.c
drivers/soc/xilinx/zynqmp_power.c
drivers/spi/Kconfig
drivers/spi/Makefile
drivers/spi/spi-bcm2835.c
drivers/spi/spi-fsl-dspi.c
drivers/spi/spi-imx.c
drivers/spi/spi-s3c24xx-regs.h [moved from arch/arm/plat-samsung/include/plat/regs-spi.h with 89% similarity]
drivers/spi/spi-s3c24xx.c
drivers/staging/Kconfig
drivers/staging/Makefile
drivers/staging/comedi/drivers/cb_pcidas.c
drivers/staging/fieldbus/anybuss/arcx-anybus.c
drivers/staging/octeon/ethernet-mdio.c
drivers/staging/octeon/ethernet-rx.c
drivers/staging/octeon/ethernet.c
drivers/staging/rtl8192e/rtllib_crypt_tkip.c
drivers/staging/rtl8192e/rtllib_crypt_wep.c
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml
drivers/staging/wfx/bh.c
drivers/staging/wfx/data_tx.c
drivers/staging/wimax/Documentation/i2400m.rst [moved from Documentation/admin-guide/wimax/i2400m.rst with 100% similarity]
drivers/staging/wimax/Documentation/index.rst [moved from Documentation/admin-guide/wimax/index.rst with 100% similarity]
drivers/staging/wimax/Documentation/wimax.rst [moved from Documentation/admin-guide/wimax/wimax.rst with 100% similarity]
drivers/staging/wimax/Kconfig [moved from net/wimax/Kconfig with 94% similarity]
drivers/staging/wimax/Makefile [moved from net/wimax/Makefile with 83% similarity]
drivers/staging/wimax/TODO [new file with mode: 0644]
drivers/staging/wimax/debug-levels.h [moved from net/wimax/debug-levels.h with 96% similarity]
drivers/staging/wimax/debugfs.c [moved from net/wimax/debugfs.c with 97% similarity]
drivers/staging/wimax/i2400m/Kconfig [moved from drivers/net/wimax/i2400m/Kconfig with 100% similarity]
drivers/staging/wimax/i2400m/Makefile [moved from drivers/net/wimax/i2400m/Makefile with 100% similarity]
drivers/staging/wimax/i2400m/control.c [moved from drivers/net/wimax/i2400m/control.c with 99% similarity]
drivers/staging/wimax/i2400m/debug-levels.h [moved from drivers/net/wimax/i2400m/debug-levels.h with 96% similarity]
drivers/staging/wimax/i2400m/debugfs.c [moved from drivers/net/wimax/i2400m/debugfs.c with 100% similarity]
drivers/staging/wimax/i2400m/driver.c [moved from drivers/net/wimax/i2400m/driver.c with 99% similarity]
drivers/staging/wimax/i2400m/fw.c [moved from drivers/net/wimax/i2400m/fw.c with 100% similarity]
drivers/staging/wimax/i2400m/i2400m-usb.h [moved from drivers/net/wimax/i2400m/i2400m-usb.h with 100% similarity]
drivers/staging/wimax/i2400m/i2400m.h [moved from drivers/net/wimax/i2400m/i2400m.h with 99% similarity]
drivers/staging/wimax/i2400m/linux-wimax-i2400m.h [moved from include/uapi/linux/wimax/i2400m.h with 100% similarity]
drivers/staging/wimax/i2400m/netdev.c [moved from drivers/net/wimax/i2400m/netdev.c with 100% similarity]
drivers/staging/wimax/i2400m/op-rfkill.c [moved from drivers/net/wimax/i2400m/op-rfkill.c with 99% similarity]
drivers/staging/wimax/i2400m/rx.c [moved from drivers/net/wimax/i2400m/rx.c with 100% similarity]
drivers/staging/wimax/i2400m/sysfs.c [moved from drivers/net/wimax/i2400m/sysfs.c with 100% similarity]
drivers/staging/wimax/i2400m/tx.c [moved from drivers/net/wimax/i2400m/tx.c with 100% similarity]
drivers/staging/wimax/i2400m/usb-debug-levels.h [moved from drivers/net/wimax/i2400m/usb-debug-levels.h with 95% similarity]
drivers/staging/wimax/i2400m/usb-fw.c [moved from drivers/net/wimax/i2400m/usb-fw.c with 100% similarity]
drivers/staging/wimax/i2400m/usb-notif.c [moved from drivers/net/wimax/i2400m/usb-notif.c with 100% similarity]
drivers/staging/wimax/i2400m/usb-rx.c [moved from drivers/net/wimax/i2400m/usb-rx.c with 100% similarity]
drivers/staging/wimax/i2400m/usb-tx.c [moved from drivers/net/wimax/i2400m/usb-tx.c with 100% similarity]
drivers/staging/wimax/i2400m/usb.c [moved from drivers/net/wimax/i2400m/usb.c with 99% similarity]
drivers/staging/wimax/id-table.c [moved from net/wimax/id-table.c with 99% similarity]
drivers/staging/wimax/linux-wimax-debug.h [moved from include/linux/wimax/debug.h with 99% similarity]
drivers/staging/wimax/linux-wimax.h [moved from include/uapi/linux/wimax.h with 100% similarity]
drivers/staging/wimax/net-wimax.h [moved from include/net/wimax.h with 99% similarity]
drivers/staging/wimax/op-msg.c [moved from net/wimax/op-msg.c with 99% similarity]
drivers/staging/wimax/op-reset.c [moved from net/wimax/op-reset.c with 98% similarity]
drivers/staging/wimax/op-rfkill.c [moved from net/wimax/op-rfkill.c with 99% similarity]
drivers/staging/wimax/op-state-get.c [moved from net/wimax/op-state-get.c with 96% similarity]
drivers/staging/wimax/stack.c [moved from net/wimax/stack.c with 97% similarity]
drivers/staging/wimax/wimax-internal.h [moved from net/wimax/wimax-internal.h with 99% similarity]
drivers/target/target_core_rd.c
drivers/target/target_core_user.c
drivers/tee/optee/core.c
drivers/tee/optee/optee_msg.h
drivers/tee/optee/optee_private.h
drivers/tee/optee/optee_smc.h
drivers/tee/optee/rpc.c
drivers/tee/tee_core.c
drivers/tee/tee_shm.c
drivers/thermal/thermal_core.h
drivers/tty/serial/21285.c
drivers/tty/serial/8250/8250_mtk.c
drivers/tty/serial/Kconfig
drivers/tty/serial/fsl_lpuart.c
drivers/tty/serial/serial_txx9.c
drivers/tty/tty_io.c
drivers/tty/vt/keyboard.c
drivers/tty/vt/vt.c
drivers/tty/vt/vt_ioctl.c
drivers/usb/cdns3/ep0.c
drivers/usb/cdns3/gadget.c
drivers/usb/cdns3/gadget.h
drivers/usb/class/cdc-acm.c
drivers/usb/class/cdc-acm.h
drivers/usb/core/driver.c
drivers/usb/core/generic.c
drivers/usb/core/quirks.c
drivers/usb/core/usb.h
drivers/usb/dwc2/platform.c
drivers/usb/dwc3/core.c
drivers/usb/dwc3/core.h
drivers/usb/dwc3/dwc3-pci.c
drivers/usb/dwc3/ep0.c
drivers/usb/gadget/composite.c
drivers/usb/gadget/legacy/raw_gadget.c
drivers/usb/gadget/udc/fsl_udc_core.c
drivers/usb/gadget/udc/goku_udc.c
drivers/usb/gadget/udc/s3c-hsudc.c
drivers/usb/gadget/udc/s3c2410_udc.c
drivers/usb/gadget/udc/s3c2410_udc.h
drivers/usb/gadget/udc/s3c2410_udc_regs.h [moved from arch/arm/plat-samsung/include/plat/regs-udc.h with 100% similarity]
drivers/usb/host/ehci-tegra.c
drivers/usb/host/fsl-mph-dr-of.c
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci-pci.c
drivers/usb/host/xhci.c
drivers/usb/host/xhci.h
drivers/usb/misc/apple-mfi-fastcharge.c
drivers/usb/mtu3/mtu3_gadget.c
drivers/usb/serial/cyberjack.c
drivers/usb/serial/option.c
drivers/usb/typec/mux.c
drivers/usb/typec/stusb160x.c
drivers/usb/typec/tcpm/tcpm.c
drivers/vdpa/mlx5/core/mr.c
drivers/vdpa/vdpa_sim/vdpa_sim.c
drivers/vfio/fsl-mc/vfio_fsl_mc.c
drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c
drivers/vfio/pci/vfio_pci.c
drivers/vfio/pci/vfio_pci_rdwr.c
drivers/vfio/platform/vfio_platform_common.c
drivers/vfio/vfio_iommu_type1.c
drivers/vhost/vdpa.c
drivers/video/fbdev/hyperv_fb.c
drivers/video/fbdev/s3c2410fb-regs-lcd.h [moved from arch/arm/mach-s3c24xx/include/mach/regs-lcd.h with 84% similarity]
drivers/video/fbdev/s3c2410fb.c
drivers/watchdog/Kconfig
drivers/xen/events/events_2l.c
drivers/xen/events/events_base.c
drivers/xen/events/events_fifo.c
drivers/xen/events/events_internal.h
drivers/xen/swiotlb-xen.c
fs/9p/vfs_super.c
fs/adfs/super.c
fs/affs/super.c
fs/afs/cell.c
fs/afs/dir.c
fs/afs/dir_edit.c
fs/afs/file.c
fs/afs/internal.h
fs/afs/write.c
fs/afs/xattr.c
fs/afs/yfsclient.c
fs/befs/linuxvfs.c
fs/bfs/inode.c
fs/binfmt_elf.c
fs/btrfs/backref.c
fs/btrfs/block-group.c
fs/btrfs/block-rsv.c
fs/btrfs/ctree.h
fs/btrfs/dev-replace.c
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/extent-tree.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/qgroup.c
fs/btrfs/reada.c
fs/btrfs/ref-verify.c
fs/btrfs/relocation.c
fs/btrfs/scrub.c
fs/btrfs/tree-checker.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h
fs/cachefiles/rdwr.c
fs/ceph/caps.c
fs/ceph/mds_client.c
fs/ceph/mds_client.h
fs/ceph/quota.c
fs/ceph/snap.c
fs/ceph/super.c
fs/cifs/cifsfs.h
fs/cifs/cifsglob.h
fs/cifs/inode.c
fs/cifs/smb2inode.c
fs/cifs/smb2ops.c
fs/cifs/smb2pdu.h
fs/cifs/smb2proto.h
fs/cifs/smbfsctl.h
fs/cramfs/inode.c
fs/crypto/keysetup.c
fs/debugfs/file.c
fs/efs/super.c
fs/erofs/inode.c
fs/erofs/super.c
fs/erofs/zdata.c
fs/exfat/super.c
fs/ext2/super.c
fs/ext4/dir.c
fs/ext4/ext4.h
fs/ext4/extents.c
fs/ext4/fast_commit.c
fs/ext4/fast_commit.h
fs/ext4/file.c
fs/ext4/fsmap.c
fs/ext4/fsync.c
fs/ext4/hash.c
fs/ext4/inline.c
fs/ext4/inode.c
fs/ext4/mballoc.c
fs/ext4/namei.c
fs/ext4/super.c
fs/ext4/sysfs.c
fs/f2fs/super.c
fs/fat/inode.c
fs/gfs2/glock.c
fs/gfs2/glops.c
fs/gfs2/glops.h
fs/gfs2/inode.c
fs/gfs2/lops.c
fs/gfs2/lops.h
fs/gfs2/ops_fstype.c
fs/gfs2/recovery.c
fs/gfs2/rgrp.c
fs/gfs2/super.c
fs/hfs/btree.h
fs/hfs/super.c
fs/hfsplus/hfsplus_fs.h
fs/hfsplus/super.c
fs/hpfs/super.c
fs/io-wq.c
fs/io-wq.h
fs/io_uring.c
fs/iomap/buffered-io.c
fs/isofs/inode.c
fs/isofs/rock.h
fs/jbd2/checkpoint.c
fs/jbd2/commit.c
fs/jbd2/journal.c
fs/jbd2/recovery.c
fs/jbd2/transaction.c
fs/minix/inode.c
fs/namei.c
fs/namespace.c
fs/nfs/dir.c
fs/nfs/nfs42xattr.c
fs/nfs/nfs42xdr.c
fs/nfs/nfsroot.c
fs/nfsd/nfs3proc.c
fs/nfsd/nfs3xdr.c
fs/nfsd/nfs4proc.c
fs/nilfs2/super.c
fs/ntfs/super.c
fs/ocfs2/journal.c
fs/omfs/inode.c
fs/proc/base.c
fs/proc/cpuinfo.c
fs/proc/generic.c
fs/proc/inode.c
fs/proc/stat.c
fs/proc_namespace.c
fs/qnx4/inode.c
fs/qnx6/inode.c
fs/romfs/super.c
fs/select.c
fs/seq_file.c
fs/splice.c
fs/squashfs/super.c
fs/stat.c
fs/statfs.c
fs/sysv/inode.c
fs/udf/super.c
fs/ufs/super.c
fs/xfs/libxfs/xfs_alloc.c
fs/xfs/libxfs/xfs_bmap.h
fs/xfs/scrub/inode.c
fs/xfs/xfs_aops.c
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_file.c
fs/xfs/xfs_iops.c
fs/xfs/xfs_linux.h
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_message.h
fs/xfs/xfs_reflink.c
fs/xfs/xfs_super.c
fs/zonefs/super.c
include/asm-generic/bug.h
include/asm-generic/error-injection.h
include/asm-generic/kprobes.h
include/asm-generic/uaccess.h
include/asm-generic/vmlinux.lds.h
include/drm/drm_dp_helper.h
include/drm/drm_edid.h
include/drm/drm_print.h
include/dt-bindings/clock/tegra234-clock.h [new file with mode: 0644]
include/dt-bindings/mux/mux-j721e-wiz.h [deleted file]
include/dt-bindings/mux/ti-serdes.h [new file with mode: 0644]
include/dt-bindings/pinctrl/omap.h
include/dt-bindings/power/meson-axg-power.h [new file with mode: 0644]
include/dt-bindings/reset/imx8mq-reset.h
include/dt-bindings/reset/tegra234-reset.h [new file with mode: 0644]
include/dt-bindings/reset/xlnx-versal-resets.h [new file with mode: 0644]
include/dt-bindings/soc/bcm6318-pm.h [new file with mode: 0644]
include/dt-bindings/soc/bcm63268-pm.h [new file with mode: 0644]
include/dt-bindings/soc/bcm6328-pm.h [new file with mode: 0644]
include/dt-bindings/soc/bcm6362-pm.h [new file with mode: 0644]
include/kunit/test.h
include/linux/acpi.h
include/linux/arm-smccc.h
include/linux/blk-mq.h
include/linux/blk_types.h
include/linux/cache.h
include/linux/can/skb.h
include/linux/clk/samsung.h [new file with mode: 0644]
include/linux/compiler-gcc.h
include/linux/compiler.h
include/linux/compiler_attributes.h
include/linux/compiler_types.h
include/linux/cpu.h
include/linux/cpufreq.h
include/linux/cpuidle.h
include/linux/debugfs.h
include/linux/dma-map-ops.h
include/linux/dma-mapping.h
include/linux/dma/ti-cppi5.h
include/linux/dynamic_debug.h
include/linux/export.h
include/linux/fcntl.h
include/linux/filter.h
include/linux/firmware.h
include/linux/fs.h
include/linux/hil_mlc.h
include/linux/ieee80211.h
include/linux/if_bridge.h
include/linux/inetdevice.h
include/linux/init.h
include/linux/init_task.h
include/linux/intel_rapl.h
include/linux/interrupt.h
include/linux/io_uring.h
include/linux/iocontext.h
include/linux/iomap.h
include/linux/jbd2.h
include/linux/jhash.h
include/linux/kernel.h
include/linux/linkage.h
include/linux/lsm_hooks.h
include/linux/mailbox/mtk-cmdq-mailbox.h
include/linux/mailbox/zynqmp-ipi-message.h
include/linux/marvell_phy.h
include/linux/mhi.h
include/linux/mic_bus.h [deleted file]
include/linux/mlx5/driver.h
include/linux/mlx5/mlx5_ifc.h
include/linux/mm.h
include/linux/module.h
include/linux/moduleparam.h
include/linux/mount.h
include/linux/mtd/xip.h
include/linux/netdev_features.h
include/linux/netdevice.h
include/linux/netfilter/ipset/ip_set.h
include/linux/netfilter/nfnetlink.h
include/linux/netfilter_ipv4.h
include/linux/netfilter_ipv6.h
include/linux/objtool.h
include/linux/of.h
include/linux/pagemap.h
include/linux/percpu-defs.h
include/linux/pgtable.h
include/linux/phy.h
include/linux/platform_data/clk-s3c2410.h [new file with mode: 0644]
include/linux/platform_data/cros_ec_commands.h
include/linux/platform_data/cros_ec_proto.h
include/linux/platform_data/fb-s3c2410.h [moved from arch/arm/plat-samsung/include/plat/fb-s3c2410.h with 57% similarity]
include/linux/platform_data/hirschmann-hellcreek.h [new file with mode: 0644]
include/linux/platform_data/mmc-s3cmci.h
include/linux/platform_data/pm33xx.h
include/linux/platform_data/s3c-hsudc.h
include/linux/pm_domain.h
include/linux/pm_runtime.h
include/linux/prandom.h
include/linux/printk.h
include/linux/pruss_driver.h [new file with mode: 0644]
include/linux/qcom-geni-se.h
include/linux/rcupdate.h
include/linux/refcount.h
include/linux/rmi.h
include/linux/sched/debug.h
include/linux/scif.h [deleted file]
include/linux/scmi_protocol.h
include/linux/sctp.h
include/linux/seq_file.h
include/linux/seqlock.h
include/linux/serial_core.h
include/linux/signal.h
include/linux/skbuff.h
include/linux/slab.h
include/linux/soc/mediatek/mtk-cmdq.h
include/linux/soc/samsung/s3c-adc.h [moved from arch/arm/plat-samsung/include/plat/adc.h with 85% similarity]
include/linux/soc/samsung/s3c-cpu-freq.h [moved from arch/arm/plat-samsung/include/plat/cpu-freq.h with 97% similarity]
include/linux/soc/samsung/s3c-cpufreq-core.h [moved from arch/arm/plat-samsung/include/plat/cpu-freq-core.h with 95% similarity]
include/linux/soc/samsung/s3c-pm.h [moved from arch/arm/plat-samsung/include/plat/pm-common.h with 55% similarity]
include/linux/spi/s3c24xx-fiq.h [moved from drivers/spi/spi-s3c24xx-fiq.h with 66% similarity]
include/linux/spi/s3c24xx.h
include/linux/spinlock.h
include/linux/splice.h
include/linux/stat.h
include/linux/statfs.h
include/linux/swiotlb.h
include/linux/syscalls.h
include/linux/tee_drv.h
include/linux/time64.h
include/linux/trace_events.h
include/linux/tracepoint.h
include/linux/uaccess.h
include/linux/usb/composite.h
include/linux/usb/r8152.h [new file with mode: 0644]
include/linux/usb/usbnet.h
include/linux/vdpa.h
include/media/drv-intf/s3c_camif.h
include/net/cfg80211.h
include/net/dsa.h
include/net/dst.h
include/net/ieee80211_radiotap.h
include/net/ip.h
include/net/ip_tunnels.h
include/net/mac80211.h
include/net/mptcp.h
include/net/netfilter/ipv4/nf_reject.h
include/net/netfilter/ipv6/nf_reject.h
include/net/netns/sctp.h
include/net/nexthop.h
include/net/pkt_sched.h
include/net/sctp/constants.h
include/net/sctp/sctp.h
include/net/sctp/sm.h
include/net/sctp/structs.h
include/net/tcp.h
include/net/udp.h
include/net/xsk_buff_pool.h
include/rdma/rdma_cm.h
include/scsi/scsi_cmnd.h
include/soc/fsl/qman.h
include/soc/mscc/ocelot.h
include/soc/tegra/fuse.h
include/sound/control.h
include/sound/core.h
include/sound/pcm.h
include/trace/bpf_probe.h
include/trace/events/afs.h
include/trace/events/ext4.h
include/trace/events/sunrpc.h
include/trace/trace_events.h
include/uapi/linux/cfm_bridge.h [new file with mode: 0644]
include/uapi/linux/icmpv6.h
include/uapi/linux/if_bridge.h
include/uapi/linux/if_ether.h
include/uapi/linux/if_packet.h
include/uapi/linux/input-event-codes.h
include/uapi/linux/mic_common.h [deleted file]
include/uapi/linux/mic_ioctl.h [deleted file]
include/uapi/linux/mount.h
include/uapi/linux/netfilter/ipset/ip_set.h
include/uapi/linux/nl80211.h
include/uapi/linux/perf_event.h
include/uapi/linux/rtnetlink.h
include/uapi/linux/sctp.h
include/uapi/linux/snmp.h
include/uapi/linux/tee.h
include/uapi/linux/vhost.h
include/uapi/linux/vhost_types.h
include/uapi/sound/compress_offload.h
include/video/imx-ipu-v3.h
include/xen/events.h
kernel/bpf/Makefile
kernel/bpf/bpf_lsm.c
kernel/bpf/core.c
kernel/bpf/hashtab.c
kernel/bpf/preload/Kconfig
kernel/capability.c
kernel/dma/remap.c
kernel/dma/swiotlb.c
kernel/entry/common.c
kernel/events/core.c
kernel/exit.c
kernel/fork.c
kernel/futex.c
kernel/groups.c
kernel/hung_task.c
kernel/irq/Kconfig
kernel/kallsyms.c
kernel/kcov.c
kernel/kprobes.c
kernel/kthread.c
kernel/locking/lockdep.c
kernel/params.c
kernel/power/process.c
kernel/printk/printk_ringbuffer.c
kernel/rcu/tree.c
kernel/sched/core.c
kernel/sched/cpufreq_schedutil.c
kernel/sched/deadline.c
kernel/sched/fair.c
kernel/sched/idle.c
kernel/sched/rt.c
kernel/sched/sched.h
kernel/sched/stop_task.c
kernel/signal.c
kernel/stop_machine.c
kernel/sys.c
kernel/time/hrtimer.c
kernel/time/itimer.c
kernel/time/sched_clock.c
kernel/time/timer.c
kernel/trace/ring_buffer.c
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_events_synth.c
kernel/trace/trace_export.c
kernel/trace/trace_selftest.c
kernel/tracepoint.c
lib/Kconfig.debug
lib/crc32test.c
lib/fonts/font_10x18.c
lib/fonts/font_6x10.c
lib/fonts/font_6x11.c
lib/fonts/font_6x8.c
lib/fonts/font_7x14.c
lib/fonts/font_8x16.c
lib/fonts/font_8x8.c
lib/fonts/font_acorn_8x8.c
lib/fonts/font_mini_4x6.c
lib/fonts/font_pearl_8x8.c
lib/fonts/font_sun12x22.c
lib/fonts/font_sun8x16.c
lib/fonts/font_ter16x32.c
lib/random32.c
lib/scatterlist.c
lib/test_kasan.c
mm/hugetlb.c
mm/memcontrol.c
mm/mempolicy.c
mm/memremap.c
mm/process_vm_access.c
mm/truncate.c
net/9p/client.c
net/9p/trans_common.c
net/9p/trans_fd.c
net/9p/trans_rdma.c
net/9p/trans_virtio.c
net/Kconfig
net/Makefile
net/appletalk/aarp.c
net/appletalk/ddp.c
net/atm/lec.c
net/bluetooth/msft.c
net/bridge/Kconfig
net/bridge/Makefile
net/bridge/br_cfm.c [new file with mode: 0644]
net/bridge/br_cfm_netlink.c [new file with mode: 0644]
net/bridge/br_device.c
net/bridge/br_if.c
net/bridge/br_input.c
net/bridge/br_mdb.c
net/bridge/br_mrp.c
net/bridge/br_mrp_netlink.c
net/bridge/br_multicast.c
net/bridge/br_netlink.c
net/bridge/br_private.h
net/bridge/br_private_cfm.h [new file with mode: 0644]
net/bridge/br_private_mrp.h
net/bridge/netfilter/Kconfig
net/bridge/netfilter/nft_reject_bridge.c
net/can/Kconfig
net/can/isotp.c
net/can/j1939/socket.c
net/can/proc.c
net/core/dev.c
net/core/dev_ioctl.c
net/core/devlink.c
net/core/flow_dissector.c
net/core/skbuff.c
net/dcb/dcbnl.c
net/dccp/ackvec.c
net/dccp/ccid.c
net/dccp/ccids/ccid2.c
net/dccp/ccids/ccid3.c
net/dccp/ccids/lib/loss_interval.c
net/dccp/ccids/lib/packet_history.c
net/dccp/feat.c
net/dccp/output.c
net/dccp/qpolicy.c
net/dccp/timer.c
net/dsa/Kconfig
net/dsa/Makefile
net/dsa/dsa.c
net/dsa/dsa_priv.h
net/dsa/slave.c
net/dsa/tag_ar9331.c
net/dsa/tag_brcm.c
net/dsa/tag_dsa.c
net/dsa/tag_edsa.c
net/dsa/tag_gswip.c
net/dsa/tag_hellcreek.c [new file with mode: 0644]
net/dsa/tag_ksz.c
net/dsa/tag_lan9303.c
net/dsa/tag_mtk.c
net/dsa/tag_ocelot.c
net/dsa/tag_qca.c
net/dsa/tag_trailer.c
net/ethtool/features.c
net/ethtool/ioctl.c
net/ipv4/devinet.c
net/ipv4/fib_semantics.c
net/ipv4/fib_trie.c
net/ipv4/ip_gre.c
net/ipv4/ip_tunnel.c
net/ipv4/ip_tunnel_core.c
net/ipv4/ip_vti.c
net/ipv4/ipconfig.c
net/ipv4/ipip.c
net/ipv4/netfilter.c
net/ipv4/netfilter/iptable_mangle.c
net/ipv4/netfilter/nf_reject_ipv4.c
net/ipv4/nexthop.c
net/ipv4/proc.c
net/ipv4/route.c
net/ipv4/syncookies.c
net/ipv4/tcp.c
net/ipv4/tcp_input.c
net/ipv4/tcp_lp.c
net/ipv4/tcp_output.c
net/ipv4/tcp_recovery.c
net/ipv4/udp.c
net/ipv4/udp_diag.c
net/ipv4/udp_offload.c
net/ipv4/xfrm4_tunnel.c
net/ipv6/addrconf.c
net/ipv6/calipso.c
net/ipv6/icmp.c
net/ipv6/ip6_gre.c
net/ipv6/ip6_tunnel.c
net/ipv6/ip6_vti.c
net/ipv6/mcast.c
net/ipv6/netfilter.c
net/ipv6/netfilter/ip6table_mangle.c
net/ipv6/netfilter/nf_reject_ipv6.c
net/ipv6/proc.c
net/ipv6/reassembly.c
net/ipv6/route.c
net/ipv6/rpl.c
net/ipv6/rpl_iptunnel.c
net/ipv6/sit.c
net/ipv6/syncookies.c
net/ipv6/udp.c
net/ipv6/udp_offload.c
net/ipv6/xfrm6_tunnel.c
net/iucv/af_iucv.c
net/l3mdev/l3mdev.c
net/llc/llc_conn.c
net/mac80211/cfg.c
net/mac80211/chan.c
net/mac80211/debugfs_netdev.c
net/mac80211/debugfs_sta.c
net/mac80211/ieee80211_i.h
net/mac80211/iface.c
net/mac80211/main.c
net/mac80211/mesh.c
net/mac80211/mlme.c
net/mac80211/pm.c
net/mac80211/rx.c
net/mac80211/sta_info.c
net/mac80211/sta_info.h
net/mac80211/tx.c
net/mac80211/util.c
net/mac80211/wme.c
net/mac802154/main.c
net/mpls/af_mpls.c
net/mptcp/ctrl.c
net/mptcp/pm_netlink.c
net/mptcp/protocol.c
net/mptcp/protocol.h
net/mptcp/token.c
net/netfilter/Kconfig
net/netfilter/Makefile
net/netfilter/ipset/ip_set_core.c
net/netfilter/ipset/ip_set_hash_gen.h
net/netfilter/ipset/ip_set_hash_ip.c
net/netfilter/ipset/ip_set_hash_ipmac.c
net/netfilter/ipset/ip_set_hash_ipmark.c
net/netfilter/ipset/ip_set_hash_ipport.c
net/netfilter/ipset/ip_set_hash_ipportip.c
net/netfilter/ipset/ip_set_hash_ipportnet.c
net/netfilter/ipset/ip_set_hash_mac.c
net/netfilter/ipset/ip_set_hash_net.c
net/netfilter/ipset/ip_set_hash_netiface.c
net/netfilter/ipset/ip_set_hash_netnet.c
net/netfilter/ipset/ip_set_hash_netport.c
net/netfilter/ipset/ip_set_hash_netportnet.c
net/netfilter/ipvs/ip_vs_core.c
net/netfilter/nf_nat_proto.c
net/netfilter/nf_synproxy_core.c
net/netfilter/nf_tables_api.c
net/netfilter/nfnetlink.c
net/netfilter/nft_chain_route.c
net/netfilter/nft_reject.c
net/netfilter/nft_reject_inet.c
net/netfilter/nft_reject_netdev.c [new file with mode: 0644]
net/netfilter/utils.c
net/netlabel/netlabel_calipso.c
net/netlabel/netlabel_unlabeled.c
net/nfc/core.c
net/nfc/digital_core.c
net/nfc/nci/core.c
net/openvswitch/datapath.c
net/openvswitch/flow.c
net/openvswitch/flow_table.c
net/openvswitch/meter.c
net/openvswitch/vport.c
net/packet/af_packet.c
net/packet/internal.h
net/qrtr/ns.c
net/qrtr/qrtr.c
net/rds/ib_cm.c
net/sched/act_api.c
net/sched/act_bpf.c
net/sched/act_mpls.c
net/sched/cls_api.c
net/sched/cls_rsvp.h
net/sched/em_cmp.c
net/sched/sch_atm.c
net/sched/sch_netem.c
net/sched/sch_pie.c
net/sctp/Kconfig
net/sctp/associola.c
net/sctp/ipv6.c
net/sctp/offload.c
net/sctp/output.c
net/sctp/protocol.c
net/sctp/sm_make_chunk.c
net/sctp/sm_sideeffect.c
net/sctp/sm_statefuns.c
net/sctp/socket.c
net/sctp/sysctl.c
net/smc/af_smc.c
net/smc/smc_cdc.c
net/smc/smc_clc.h
net/smc/smc_core.c
net/smc/smc_core.h
net/smc/smc_wr.c
net/sunrpc/sysctl.c
net/tipc/bearer.c
net/tipc/core.c
net/tipc/core.h
net/tipc/crypto.c
net/tipc/link.c
net/tipc/msg.c
net/tipc/name_distr.c
net/tipc/netlink_compat.c
net/tipc/node.c
net/tipc/socket.c
net/tipc/socket.h
net/tipc/topsrv.c
net/vmw_vsock/af_vsock.c
net/wireless/chan.c
net/wireless/core.c
net/wireless/core.h
net/wireless/nl80211.c
net/wireless/rdev-ops.h
net/wireless/reg.c
net/wireless/scan.c
net/wireless/trace.h
net/wireless/util.c
net/wireless/wext-compat.c
net/x25/af_x25.c
net/xdp/xsk.c
net/xdp/xsk_buff_pool.c
net/xfrm/xfrm_input.c
net/xfrm/xfrm_interface.c
net/xfrm/xfrm_state.c
samples/bpf/task_fd_query_user.c
samples/bpf/tracex2_user.c
samples/bpf/tracex3_user.c
samples/bpf/xdp_redirect_cpu_user.c
samples/bpf/xdp_rxq_info_user.c
samples/mic/mpssd/.gitignore [deleted file]
samples/mic/mpssd/Makefile [deleted file]
samples/mic/mpssd/micctrl [deleted file]
samples/mic/mpssd/mpss [deleted file]
samples/mic/mpssd/mpssd.c [deleted file]
samples/mic/mpssd/mpssd.h [deleted file]
samples/mic/mpssd/sysfs.c [deleted file]
scripts/bpf_helpers_doc.py
scripts/checkpatch.pl
scripts/get_abi.pl
scripts/kernel-doc
scripts/mod/modpost.c
security/integrity/ima/ima.h
security/safesetid/lsm.c
security/safesetid/lsm.h
security/safesetid/securityfs.c
sound/core/control.c
sound/core/pcm_dmaengine.c
sound/core/pcm_lib.c
sound/core/pcm_native.c
sound/hda/ext/hdac_ext_controller.c
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_controller.h
sound/pci/hda/hda_intel.c
sound/pci/hda/hda_jack.c
sound/pci/hda/patch_ca0132.c
sound/pci/hda/patch_realtek.c
sound/soc/atmel/mchp-spdiftx.c
sound/soc/codecs/cs42l51.c
sound/soc/codecs/wcd9335.c
sound/soc/codecs/wcd934x.c
sound/soc/codecs/wsa881x.c
sound/soc/intel/Kconfig
sound/soc/intel/atom/Makefile
sound/soc/intel/atom/sst/Makefile
sound/soc/intel/boards/kbl_rt5663_max98927.c
sound/soc/intel/catpt/dsp.c
sound/soc/intel/catpt/pcm.c
sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c
sound/soc/qcom/lpass-cpu.c
sound/soc/qcom/lpass-sc7180.c
sound/soc/qcom/sdm845.c
sound/soc/samsung/Kconfig
sound/soc/samsung/s3c2412-i2s.c
sound/soc/samsung/s3c24xx-i2s.c
sound/soc/soc-core.c
sound/soc/soc-dapm.c
sound/soc/sof/loader.c
sound/sparc/dbri.c
sound/usb/format.c
sound/usb/pcm.c
sound/usb/quirks.c
tools/arch/arm64/include/uapi/asm/kvm.h
tools/arch/s390/include/uapi/asm/sie.h
tools/arch/x86/include/asm/cpufeatures.h
tools/arch/x86/include/asm/disabled-features.h
tools/arch/x86/include/asm/msr-index.h
tools/arch/x86/include/asm/required-features.h
tools/arch/x86/include/uapi/asm/kvm.h
tools/arch/x86/include/uapi/asm/svm.h
tools/bpf/bpftool/feature.c
tools/bpf/bpftool/prog.c
tools/bpf/bpftool/skeleton/profiler.bpf.c
tools/build/feature/test-all.c
tools/include/linux/compiler-gcc.h
tools/include/linux/compiler.h
tools/include/linux/objtool.h
tools/include/uapi/asm-generic/unistd.h
tools/include/uapi/drm/i915_drm.h
tools/include/uapi/linux/fscrypt.h
tools/include/uapi/linux/kvm.h
tools/include/uapi/linux/mman.h
tools/include/uapi/linux/mount.h
tools/include/uapi/linux/perf_event.h
tools/include/uapi/linux/prctl.h
tools/include/uapi/linux/vhost.h
tools/lib/bpf/hashmap.h
tools/lib/bpf/xsk.c
tools/perf/Makefile.config
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
tools/perf/builtin-trace.c
tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
tools/perf/tests/dwarf-unwind.c
tools/perf/ui/browsers/hists.c
tools/perf/util/build-id.c
tools/perf/util/hashmap.c
tools/perf/util/hashmap.h
tools/perf/util/machine.c
tools/perf/util/scripting-engines/trace-event-python.c
tools/perf/util/session.c
tools/perf/util/symbol.c
tools/perf/util/symbol.h
tools/power/cpupower/Makefile
tools/power/cpupower/debug/i386/intel_gsic.c
tools/power/x86/turbostat/Makefile
tools/power/x86/turbostat/turbostat.8
tools/power/x86/turbostat/turbostat.c
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
tools/testing/kunit/kunit_parser.py
tools/testing/kunit/kunit_tool_test.py
tools/testing/kunit/test_data/test_config_printk_time.log
tools/testing/kunit/test_data/test_interrupted_tap_output.log
tools/testing/kunit/test_data/test_kernel_panic_interrupt.log
tools/testing/kunit/test_data/test_multiple_prefixes.log
tools/testing/kunit/test_data/test_pound_no_prefix.log
tools/testing/kunit/test_data/test_pound_sign.log
tools/testing/selftests/arm64/mte/check_buffer_fill.c
tools/testing/selftests/arm64/mte/check_child_memory.c
tools/testing/selftests/arm64/mte/check_ksm_options.c
tools/testing/selftests/arm64/mte/check_mmap_options.c
tools/testing/selftests/arm64/mte/check_tags_inclusion.c
tools/testing/selftests/arm64/mte/check_user_mem.c
tools/testing/selftests/bpf/prog_tests/map_init.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/profiler.inc.h
tools/testing/selftests/bpf/progs/test_map_init.c [new file with mode: 0644]
tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c
tools/testing/selftests/core/close_range_test.c
tools/testing/selftests/drivers/net/netdevsim/nexthop.sh [new file with mode: 0755]
tools/testing/selftests/filesystems/binderfs/binderfs_test.c
tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
tools/testing/selftests/ftrace/test.d/dynevent/add_remove_kprobe.tc
tools/testing/selftests/ftrace/test.d/dynevent/clear_select_events.tc
tools/testing/selftests/ftrace/test.d/dynevent/generic_clear_event.tc
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc
tools/testing/selftests/ftrace/test.d/functions
tools/testing/selftests/ftrace/test.d/kprobe/add_and_remove.tc
tools/testing/selftests/ftrace/test.d/kprobe/busy_check.tc
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args.tc
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_comm.tc
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_multiprobe.tc
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_args.tc
tools/testing/selftests/ftrace/test.d/kprobe/profile.tc
tools/testing/selftests/kselftest_harness.h
tools/testing/selftests/kvm/.gitignore
tools/testing/selftests/kvm/Makefile
tools/testing/selftests/kvm/aarch64/get-reg-list-sve.c [new file with mode: 0644]
tools/testing/selftests/kvm/aarch64/get-reg-list.c [new file with mode: 0644]
tools/testing/selftests/kvm/clear_dirty_log_test.c [deleted file]
tools/testing/selftests/kvm/demand_paging_test.c
tools/testing/selftests/kvm/dirty_log_perf_test.c [new file with mode: 0644]
tools/testing/selftests/kvm/dirty_log_test.c
tools/testing/selftests/kvm/include/kvm_util.h
tools/testing/selftests/kvm/include/perf_test_util.h [new file with mode: 0644]
tools/testing/selftests/kvm/include/test_util.h
tools/testing/selftests/kvm/include/x86_64/processor.h
tools/testing/selftests/kvm/include/x86_64/vmx.h
tools/testing/selftests/kvm/lib/aarch64/processor.c
tools/testing/selftests/kvm/lib/aarch64/ucall.c
tools/testing/selftests/kvm/lib/kvm_util.c
tools/testing/selftests/kvm/lib/kvm_util_internal.h
tools/testing/selftests/kvm/lib/s390x/processor.c
tools/testing/selftests/kvm/lib/s390x/ucall.c
tools/testing/selftests/kvm/lib/test_util.c
tools/testing/selftests/kvm/lib/x86_64/handlers.S [new file with mode: 0644]
tools/testing/selftests/kvm/lib/x86_64/processor.c
tools/testing/selftests/kvm/lib/x86_64/ucall.c
tools/testing/selftests/kvm/lib/x86_64/vmx.c
tools/testing/selftests/kvm/x86_64/kvm_pv_test.c [new file with mode: 0644]
tools/testing/selftests/kvm/x86_64/vmx_apic_access_test.c [new file with mode: 0644]
tools/testing/selftests/lib.mk
tools/testing/selftests/mount/.gitignore
tools/testing/selftests/mount/Makefile
tools/testing/selftests/mount/nosymfollow-test.c [new file with mode: 0644]
tools/testing/selftests/mount/run_nosymfollow.sh [new file with mode: 0755]
tools/testing/selftests/mount/run_unprivileged_remount.sh [moved from tools/testing/selftests/mount/run_tests.sh with 100% similarity]
tools/testing/selftests/net/Makefile
tools/testing/selftests/net/bareudp.sh [new file with mode: 0755]
tools/testing/selftests/net/config
tools/testing/selftests/net/forwarding/bridge_igmp.sh
tools/testing/selftests/net/forwarding/bridge_mld.sh [new file with mode: 0755]
tools/testing/selftests/net/forwarding/lib.sh
tools/testing/selftests/net/mptcp/config
tools/testing/selftests/net/mptcp/mptcp_join.sh
tools/testing/selftests/net/pmtu.sh
tools/testing/selftests/net/psock_fanout.c
tools/testing/selftests/net/timestamping.c
tools/testing/selftests/pidfd/config
tools/testing/selftests/pidfd/pidfd_getfd_test.c
tools/testing/selftests/pidfd/pidfd_open_test.c
tools/testing/selftests/pidfd/pidfd_poll_test.c
tools/testing/selftests/pidfd/pidfd_setns_test.c
tools/testing/selftests/pidfd/pidfd_test.c
tools/testing/selftests/powerpc/alignment/alignment_handler.c
tools/testing/selftests/proc/proc-loadavg-001.c
tools/testing/selftests/proc/proc-self-syscall.c
tools/testing/selftests/proc/proc-uptime-002.c
tools/testing/selftests/tc-testing/tc-tests/filters/tests.json
tools/testing/selftests/timens/Makefile
tools/testing/selftests/timens/futex.c [new file with mode: 0644]
tools/testing/selftests/wireguard/netns.sh
tools/testing/selftests/wireguard/qemu/kernel.config

diff --git a/CREDITS b/CREDITS
index cb02b99..8592e45 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -1910,6 +1910,15 @@ S: 660 Harvard Ave. #7
 S: Santa Clara, CA 95051
 S: USA
 
+N: Kukjin Kim
+E: kgene@kernel.org
+D: Samsung S3C, S5P and Exynos ARM architectures
+
+N: Sangbeom Kim
+E: sbkim73@samsung.com
+D: Samsung SoC Audio (ASoC) drivers
+D: Samsung PMIC (RTC, regulators, MFD) drivers
+
 N: Russell King
 E: rmk@arm.linux.org.uk
 D: Linux/arm integrator, maintainer & hacker
index 3121029..8bac9cb 100644 (file)
@@ -32,7 +32,7 @@ The different levels of stability are:
        layout of the files below for details on how to do this.)
 
   obsolete/
-       This directory documents interfaces that are still remaining in
+       This directory documents interfaces that are still remaining in
        the kernel, but are marked to be removed at some later point in
        time.  The description of the interface will document the reason
        why it is obsolete and when it can be expected to be removed.
@@ -58,6 +58,14 @@ Users:               All users of this interface who wish to be notified when
                be changed further.
 
 
+Note:
+   The fields should be use a simple notation, compatible with ReST markup.
+   Also, the file **should not** have a top-level index, like::
+
+       ===
+       foo
+       ===
+
 How things move between levels:
 
 Interfaces in stable may move to obsolete, as long as the proper
index 2cb9fc5..0faf135 100644 (file)
@@ -8,11 +8,11 @@ Description:  Device DAX is the device-centric analogue of Filesystem
                system.  Device DAX is strict, precise and predictable.
                Specifically this interface:
 
-               1/ Guarantees fault granularity with respect to a given
-               page size (pte, pmd, or pud) set at configuration time.
+               1. Guarantees fault granularity with respect to a given
+                  page size (pte, pmd, or pud) set at configuration time.
 
-               2/ Enforces deterministic behavior by being strict about
-               what fault scenarios are supported.
+               2. Enforces deterministic behavior by being strict about
+                  what fault scenarios are supported.
 
                The /sys/class/dax/ interface enumerates all the
                device-dax instances in the system. The ABI is
index 5d41eba..66545c5 100644 (file)
@@ -7,10 +7,13 @@ Description:  It is possible to switch the cpi setting of the mouse with the
                setting reported by the mouse. This number has to be further
                processed to receive the real dpi value:
 
+               ===== ====
                VALUE DPI
+               ===== ====
                1     400
                2     800
                4     1600
+               ===== ====
 
                This file is readonly.
                Has never been used. If bookkeeping is done, it's done in userland tools.
index e0d4e5e..b8b0fd3 100644 (file)
@@ -13,6 +13,8 @@ Description:
   GPIOs are identified as they are inside the kernel, using integers in
   the range 0..INT_MAX.  See Documentation/admin-guide/gpio for more information.
 
+  ::
+
     /sys/class/gpio
        /export ... asks the kernel to export a GPIO to userspace
        /unexport ... to return a GPIO to the kernel
index 0020c49..24fb35a 100644 (file)
@@ -5,6 +5,7 @@ Description:
        devfs has been unmaintained for a number of years, has unfixable
        races, contains a naming policy within the kernel that is
        against the LSB, and can be replaced by using udev.
+
        The files fs/devfs/*, include/linux/devfs_fs*.h were removed,
        along with the assorted devfs function calls throughout the
        kernel tree.
index ec333e6..9ec7ec4 100644 (file)
@@ -7,6 +7,7 @@ Description:
        to implement sensible device security policies, and its low level
        of abstraction that required userspace clients to duplicate much
        of the kernel's ieee1394 core functionality.
+
        Replaced by /dev/fw*, i.e. the <linux/firewire-cdev.h> ABI of
        firewire-core.
 
index 9c08c7f..f25174e 100644 (file)
@@ -10,4 +10,4 @@ Description:  This file was deprecated because there no longer was a way to
                claim just control over a single rfkill instance.
                This file was scheduled to be removed in 2012, and was removed
                in 2016.
-Values:        0: Kernel handles events
+Values:                0: Kernel handles events
index c39c25a..1905d35 100644 (file)
@@ -8,6 +8,7 @@ Description:
        performance issues in its first generation.  Any video1394 user had
        to use raw1394 + libraw1394 too because video1394 did not provide
        asynchronous I/O for device discovery and configuration.
+
        Replaced by /dev/fw*, i.e. the <linux/firewire-cdev.h> ABI of
        firewire-core.
 
index f72ed65..261f85b 100644 (file)
@@ -14,13 +14,17 @@ Description:
                Each /dev/fw* is associated with one IEEE 1394 node, which can
                be remote or local nodes.  Operations on a /dev/fw* file have
                different scope:
+
                  - The 1394 node which is associated with the file:
+
                          - Asynchronous request transmission
                          - Get the Configuration ROM
                          - Query node ID
                          - Query maximum speed of the path between this node
                            and local node
+
                  - The 1394 bus (i.e. "card") to which the node is attached to:
+
                          - Isochronous stream transmission and reception
                          - Asynchronous stream transmission and reception
                          - Asynchronous broadcast request transmission
@@ -31,7 +35,9 @@ Description:
                            manager
                          - Query cycle time
                          - Bus reset initiation, bus reset event reception
+
                  - All 1394 buses:
+
                          - Allocation of IEEE 1212 address ranges on the local
                            link layers, reception of inbound requests to such
                            an address range, asynchronous response transmission
@@ -43,6 +49,7 @@ Description:
                userland implement different access permission models, some
                operations are restricted to /dev/fw* files that are associated
                with a local node:
+
                          - Addition of descriptors or directories to the local
                            nodes' Configuration ROM
                          - PHY packet transmission and reception
@@ -55,50 +62,50 @@ Description:
                The following file operations are supported:
 
                open(2)
-               Currently the only useful flags are O_RDWR.
+                   Currently the only useful flags are O_RDWR.
 
                ioctl(2)
-               Initiate various actions.  Some take immediate effect, others
-               are performed asynchronously while or after the ioctl returns.
-               See the inline documentation in <linux/firewire-cdev.h> for
-               descriptions of all ioctls.
+                   Initiate various actions.  Some take immediate effect, others
+                   are performed asynchronously while or after the ioctl returns.
+                   See the inline documentation in <linux/firewire-cdev.h> for
+                   descriptions of all ioctls.
 
                poll(2), select(2), epoll_wait(2) etc.
-               Watch for events to become available to be read.
+                   Watch for events to become available to be read.
 
                read(2)
-               Receive various events.  There are solicited events like
-               outbound asynchronous transaction completion or isochronous
-               buffer completion, and unsolicited events such as bus resets,
-               request reception, or PHY packet reception.  Always use a read
-               buffer which is large enough to receive the largest event that
-               could ever arrive.  See <linux/firewire-cdev.h> for descriptions
-               of all event types and for which ioctls affect reception of
-               events.
+                   Receive various events.  There are solicited events like
+                   outbound asynchronous transaction completion or isochronous
+                   buffer completion, and unsolicited events such as bus resets,
+                   request reception, or PHY packet reception.  Always use a read
+                   buffer which is large enough to receive the largest event that
+                   could ever arrive.  See <linux/firewire-cdev.h> for descriptions
+                   of all event types and for which ioctls affect reception of
+                   events.
 
                mmap(2)
-               Allocate a DMA buffer for isochronous reception or transmission
-               and map it into the process address space.  The arguments should
-               be used as follows:  addr = NULL, length = the desired buffer
-               size, i.e. number of packets times size of largest packet,
-               prot = at least PROT_READ for reception and at least PROT_WRITE
-               for transmission, flags = MAP_SHARED, fd = the handle to the
-               /dev/fw*, offset = 0.
+                   Allocate a DMA buffer for isochronous reception or transmission
+                   and map it into the process address space.  The arguments should
+                   be used as follows:  addr = NULL, length = the desired buffer
+                   size, i.e. number of packets times size of largest packet,
+                   prot = at least PROT_READ for reception and at least PROT_WRITE
+                   for transmission, flags = MAP_SHARED, fd = the handle to the
+                   /dev/fw*, offset = 0.
 
                Isochronous reception works in packet-per-buffer fashion except
                for multichannel reception which works in buffer-fill mode.
 
                munmap(2)
-               Unmap the isochronous I/O buffer from the process address space.
+                   Unmap the isochronous I/O buffer from the process address space.
 
                close(2)
-               Besides stopping and freeing I/O contexts that were associated
-               with the file descriptor, back out any changes to the local
-               nodes' Configuration ROM.  Deallocate isochronous channels and
-               bandwidth at the IRM that were marked for kernel-assisted
-               re- and deallocation.
-
-Users:         libraw1394
-               libdc1394
-               libhinawa
+                   Besides stopping and freeing I/O contexts that were associated
+                   with the file descriptor, back out any changes to the local
+                   nodes' Configuration ROM.  Deallocate isochronous channels and
+                   bandwidth at the IRM that were marked for kernel-assisted
+                   re- and deallocation.
+
+Users:         libraw1394;
+               libdc1394;
+               libhinawa;
                tools like linux-firewire-utils, fwhack, ...
index 964c7a8..2d6314f 100644 (file)
@@ -1,22 +1,26 @@
-What:          /sys/firmware/acpi/pm_profile
+What:          /sys/firmware/acpi/pm_profile
 Date:          03-Nov-2011
 KernelVersion: v3.2
 Contact:       linux-acpi@vger.kernel.org
-Description:   The ACPI pm_profile sysfs interface exports the platform
+Description:   The ACPI pm_profile sysfs interface exports the platform
                power management (and performance) requirement expectations
                as provided by BIOS. The integer value is directly passed as
                retrieved from the FADT ACPI table.
-Values:         For possible values see ACPI specification:
+
+Values:                For possible values see ACPI specification:
                5.2.9 Fixed ACPI Description Table (FADT)
                Field: Preferred_PM_Profile
 
                Currently these values are defined by spec:
-               0 Unspecified
-               1 Desktop
-               2 Mobile
-               3 Workstation
-               4 Enterprise Server
-               5 SOHO Server
-               6 Appliance PC
-               7 Performance Server
+
+               == =================
+               0  Unspecified
+               1  Desktop
+               2  Mobile
+               3  Workstation
+               4  Enterprise Server
+               5  SOHO Server
+               6  Appliance PC
+               7  Performance Server
                >7 Reserved
+               == =================
index 41e5a0c..9ac9edd 100644 (file)
@@ -47,6 +47,7 @@ Description:
                IEEE 1394 node device attribute.
                Read-only and immutable.
 Values:                1: The sysfs entry represents a local node (a controller card).
+
                0: The sysfs entry represents a remote node.
 
 
@@ -125,7 +126,9 @@ Description:
                Read-only attribute, immutable during the target's lifetime.
                Format, as exposed by firewire-sbp2 since 2.6.22, May 2007:
                Colon-separated hexadecimal string representations of
+
                        u64 EUI-64 : u24 directory_ID : u16 LUN
+
                without 0x prefixes, without whitespace.  The former sbp2 driver
                (removed in 2.6.37 after being superseded by firewire-sbp2) used
                a somewhat shorter format which was not as close to SAM.
index 9ffba85..c399323 100644 (file)
@@ -9,13 +9,14 @@ Description:
                Note: This file is only present if CONFIG_NVMEM_SYSFS
                is enabled
 
-               ex:
-               hexdump /sys/bus/nvmem/devices/qfprom0/nvmem
+               ex::
 
-               0000000 0000 0000 0000 0000 0000 0000 0000 0000
-               *
-               00000a0 db10 2240 0000 e000 0c00 0c00 0000 0c00
-               0000000 0000 0000 0000 0000 0000 0000 0000 0000
-               ...
-               *
-               0001000
+                 hexdump /sys/bus/nvmem/devices/qfprom0/nvmem
+
+                 0000000 0000 0000 0000 0000 0000 0000 0000 0000
+                 *
+                 00000a0 db10 2240 0000 e000 0c00 0c00 0000 0c00
+                 0000000 0000 0000 0000 0000 0000 0000 0000 0000
+                 ...
+                 *
+                 0001000
index b832eef..cad4bc2 100644 (file)
@@ -50,8 +50,10 @@ Description:
 
                Tools can use this file and the connected_duration file to
                compute the percentage of time that a device has been active.
-               For example,
-               echo $((100 * `cat active_duration` / `cat connected_duration`))
+               For example::
+
+                 echo $((100 * `cat active_duration` / `cat connected_duration`))
+
                will give an integer percentage.  Note that this does not
                account for counter wrap.
 Users:
index 8e8d167..c27b7b8 100644 (file)
@@ -63,13 +63,6 @@ Contact:     Stephen Hemminger <sthemmin@microsoft.com>
 Description:   VCPU (sub)channel is affinitized to
 Users:         tools/hv/lsvmbus and other debugging tools
 
-What:          /sys/bus/vmbus/devices/<UUID>/channels/<N>/cpu
-Date:          September. 2017
-KernelVersion: 4.14
-Contact:       Stephen Hemminger <sthemmin@microsoft.com>
-Description:   VCPU (sub)channel is affinitized to
-Users:         tools/hv/lsvmbus and other debugging tools
-
 What:          /sys/bus/vmbus/devices/<UUID>/channels/<N>/in_mask
 Date:          September. 2017
 KernelVersion: 4.14
index 992dfb1..5cd5e87 100644 (file)
@@ -6,6 +6,7 @@ Description:    Bus scanning interval, microseconds component.
                control systems are attached/generate presence for as short as
                100 ms - hence the tens-to-hundreds milliseconds scan intervals
                are required.
+
                see Documentation/w1/w1-generic.rst for detailed information.
 Users:         any user space application which wants to know bus scanning
                interval
index 70302f3..023fb52 100644 (file)
@@ -4,6 +4,7 @@ KernelVersion:  2.6.12
 Contact:       Richard Purdie <rpurdie@rpsys.net>
 Description:
                Control BACKLIGHT power, values are FB_BLANK_* from fb.h
+
                 - FB_BLANK_UNBLANK (0)   : power on.
                 - FB_BLANK_POWERDOWN (4) : power off
 Users:         HAL
index 87b11f9..348c4ac 100644 (file)
@@ -8,12 +8,14 @@ Date:         Apr, 2005
 KernelVersion: v2.6.12
 Contact:       linux-rdma@vger.kernel.org
 Description:
+               =============== ===========================================
                node_type:      (RO) Node type (CA, RNIC, usNIC, usNIC UDP,
                                switch or router)
 
                node_guid:      (RO) Node GUID
 
                sys_image_guid: (RO) System image GUID
+               =============== ===========================================
 
 
 What:          /sys/class/infiniband/<device>/node_desc
@@ -47,6 +49,7 @@ KernelVersion:        v2.6.12
 Contact:       linux-rdma@vger.kernel.org
 Description:
 
+               =============== ===============================================
                lid:            (RO) Port LID
 
                rate:           (RO) Port data rate (active width * active
@@ -66,8 +69,9 @@ Description:
 
                cap_mask:       (RO) Port capability mask. 2 bits here are
                                settable- IsCommunicationManagementSupported
-                               (set when CM module is loaded) and IsSM (set via
-                               open of issmN file).
+                               (set when CM module is loaded) and IsSM (set
+                               via open of issmN file).
+               =============== ===============================================
 
 
 What:          /sys/class/infiniband/<device>/ports/<port-num>/link_layer
@@ -103,8 +107,7 @@ Date:               Apr, 2005
 KernelVersion: v2.6.12
 Contact:       linux-rdma@vger.kernel.org
 Description:
-               Errors info:
-               -----------
+               **Errors info**:
 
                symbol_error: (RO) Total number of minor link errors detected on
                one or more physical lanes.
@@ -142,8 +145,7 @@ Description:
                intervention. It can also indicate hardware issues or extremely
                poor link signal integrity
 
-               Data info:
-               ---------
+               **Data info**:
 
                port_xmit_data: (RO) Total number of data octets, divided by 4
                (lanes), transmitted on all VLs. This is 64 bit counter
@@ -176,8 +178,7 @@ Description:
                transmitted on all VLs from the port. This may include multicast
                packets with errors.
 
-               Misc info:
-               ---------
+               **Misc info**:
 
                port_xmit_discards: (RO) Total number of outbound packets
                discarded by the port because the port is down or congested.
@@ -244,9 +245,11 @@ Description:
                two umad devices and two issm devices, while a switch will have
                one device of each type (for switch port 0).
 
+               ======= =====================================
                ibdev:  (RO) Show Infiniband (IB) device name
 
                port:   (RO) Display port number
+               ======= =====================================
 
 
 What:          /sys/class/infiniband_mad/abi_version
@@ -264,10 +267,12 @@ Date:             Sept, 2005
 KernelVersion: v2.6.14
 Contact:       linux-rdma@vger.kernel.org
 Description:
+               =============== ===========================================
                ibdev:          (RO) Display Infiniband (IB) device name
 
                abi_version:    (RO) Show ABI version of IB device specific
                                interfaces.
+               =============== ===========================================
 
 
 What:          /sys/class/infiniband_verbs/abi_version
@@ -289,12 +294,14 @@ Date:             Apr, 2005
 KernelVersion: v2.6.12
 Contact:       linux-rdma@vger.kernel.org
 Description:
+               =============== ================================================
                hw_rev:         (RO) Hardware revision number
 
                hca_type:       (RO) Host Channel Adapter type: MT23108, MT25208
                                (MT23108 compat mode), MT25208 or MT25204
 
                board_id:       (RO) Manufacturing board ID
+               =============== ================================================
 
 
 sysfs interface for Mellanox ConnectX HCA IB driver (mlx4)
@@ -307,11 +314,13 @@ Date:             Sep, 2007
 KernelVersion: v2.6.24
 Contact:       linux-rdma@vger.kernel.org
 Description:
+               =============== ===============================
                hw_rev:         (RO) Hardware revision number
 
                hca_type:       (RO) Host channel adapter type
 
                board_id:       (RO) Manufacturing board ID
+               =============== ===============================
 
 
 What:          /sys/class/infiniband/mlx4_X/iov/ports/<port-num>/gids/<n>
@@ -337,6 +346,7 @@ Description:
                example, ports/1/pkeys/10 contains the value at index 10 in port
                1's P_Key table.
 
+               ======================= ==========================================
                gids/<n>:               (RO) The physical port gids n = 0..127
 
                admin_guids/<n>:        (RW) Allows examining or changing the
@@ -365,6 +375,7 @@ Description:
                                        guest, whenever it uses its pkey index
                                        1, will actually be using the real pkey
                                        index 10.
+               ======================= ==========================================
 
 
 What:          /sys/class/infiniband/mlx4_X/iov/<pci-slot-num>/ports/<m>/smi_enabled
@@ -376,12 +387,14 @@ Description:
                Enabling QP0 on VFs for selected VF/port. By default, no VFs are
                enabled for QP0 operation.
 
-               smi_enabled:    (RO) Indicates whether smi is currently enabled
-                               for the indicated VF/port
+               ================= ==== ===========================================
+               smi_enabled:      (RO) Indicates whether smi is currently enabled
+                                      for the indicated VF/port
 
-               enable_smi_admin:(RW) Used by the admin to request that smi
-                               capability be enabled or disabled for the
-                               indicated VF/port. 0 = disable, 1 = enable.
+               enable_smi_admin: (RW) Used by the admin to request that smi
+                                      capability be enabled or disabled for the
+                                      indicated VF/port. 0 = disable, 1 = enable.
+               ================= ==== ===========================================
 
                The requested enablement will occur at the next reset of the VF
                (e.g. driver restart on the VM which owns the VF).
@@ -398,6 +411,7 @@ KernelVersion:      v2.6.35
 Contact:       linux-rdma@vger.kernel.org
 Description:
 
+               =============== =============================================
                hw_rev:         (RO) Hardware revision number
 
                hca_type:       (RO) Driver short name. Should normally match
@@ -406,6 +420,7 @@ Description:
 
                board_id:       (RO) Manufacturing board id. (Vendor + device
                                information)
+               =============== =============================================
 
 
 sysfs interface for Intel IB driver qib
@@ -426,6 +441,7 @@ Date:               May, 2010
 KernelVersion: v2.6.35
 Contact:       linux-rdma@vger.kernel.org
 Description:
+               =============== ======================================================
                version:        (RO) Display version information of installed software
                                and drivers.
 
@@ -452,6 +468,7 @@ Description:
                chip_reset:     (WO) Reset the chip if possible by writing
                                "reset" to this file. Only allowed if no user
                                contexts are open that use chip resources.
+               =============== ======================================================
 
 
 What:          /sys/class/infiniband/qibX/ports/N/sl2vl/[0-15]
@@ -471,14 +488,16 @@ Contact:  linux-rdma@vger.kernel.org
 Description:
                Per-port congestion control. Both are binary attributes.
 
-               cc_table_bin:   (RO) Congestion control table size followed by
+               =============== ================================================
+               cc_table_bin    (RO) Congestion control table size followed by
                                table entries.
 
-               cc_settings_bin:(RO) Congestion settings: port control, control
+               cc_settings_bin (RO) Congestion settings: port control, control
                                map and an array of 16 entries for the
                                congestion entries - increase, timer, event log
                                trigger threshold and the minimum injection rate
                                delay.
+               =============== ================================================
 
 What:          /sys/class/infiniband/qibX/ports/N/linkstate/loopback
 What:          /sys/class/infiniband/qibX/ports/N/linkstate/led_override
@@ -491,6 +510,7 @@ Contact:    linux-rdma@vger.kernel.org
 Description:
                [to be documented]
 
+               =============== ===============================================
                loopback:       (WO)
                led_override:   (WO)
                hrtbt_enable:   (RW)
@@ -501,6 +521,7 @@ Description:
                                errors. Possible states are- "Initted",
                                "Present", "IB_link_up", "IB_configured" or
                                "Fatal_Hardware_Error".
+               =============== ===============================================
 
 What:          /sys/class/infiniband/qibX/ports/N/diag_counters/rc_resends
 What:          /sys/class/infiniband/qibX/ports/N/diag_counters/seq_naks
@@ -549,6 +570,7 @@ Contact:    Christian Benvenuti <benve@cisco.com>,
                linux-rdma@vger.kernel.org
 Description:
 
+               =============== ===============================================
                board_id:       (RO) Manufacturing board id
 
                config:         (RO) Report the configuration for this PF
@@ -561,6 +583,7 @@ Description:
 
                iface:          (RO) Shows which network interface this usNIC
                                entry is associated to (visible with ifconfig).
+               =============== ===============================================
 
 What:          /sys/class/infiniband/usnic_X/qpn/summary
 What:          /sys/class/infiniband/usnic_X/qpn/context
@@ -605,6 +628,7 @@ Date:               May, 2016
 KernelVersion: v4.6
 Contact:       linux-rdma@vger.kernel.org
 Description:
+               =============== =============================================
                hw_rev:         (RO) Hardware revision number
 
                board_id:       (RO) Manufacturing board id
@@ -623,6 +647,7 @@ Description:
                                available.
 
                tempsense:      (RO) Thermal sense information
+               =============== =============================================
 
 
 What:          /sys/class/infiniband/hfi1_X/ports/N/CCMgtA/cc_settings_bin
@@ -634,19 +659,21 @@ Contact:  linux-rdma@vger.kernel.org
 Description:
                Per-port congestion control.
 
-               cc_table_bin:   (RO) CCA tables used by PSM2 Congestion control
+               =============== ================================================
+               cc_table_bin    (RO) CCA tables used by PSM2 Congestion control
                                table size followed by table entries. Binary
                                attribute.
 
-               cc_settings_bin:(RO) Congestion settings: port control, control
+               cc_settings_bin (RO) Congestion settings: port control, control
                                map and an array of 16 entries for the
                                congestion entries - increase, timer, event log
                                trigger threshold and the minimum injection rate
                                delay. Binary attribute.
 
-               cc_prescan:     (RW) enable prescanning for faster BECN
+               cc_prescan      (RW) enable prescanning for faster BECN
                                response. Write "on" to enable and "off" to
                                disable.
+               =============== ================================================
 
 What:          /sys/class/infiniband/hfi1_X/ports/N/sc2vl/[0-31]
 What:          /sys/class/infiniband/hfi1_X/ports/N/sl2sc/[0-31]
@@ -655,11 +682,13 @@ Date:             May, 2016
 KernelVersion: v4.6
 Contact:       linux-rdma@vger.kernel.org
 Description:
+               =============== ===================================================
                sc2vl/:         (RO) 32 files (0 - 31) used to translate sl->vl
 
                sl2sc/:         (RO) 32 files (0 - 31) used to translate sl->sc
 
                vl2mtu/:        (RO) 16 files (0 - 15) used to determine MTU for vl
+               =============== ===================================================
 
 
 What:          /sys/class/infiniband/hfi1_X/sdma_N/cpu_list
@@ -670,26 +699,28 @@ Contact:  linux-rdma@vger.kernel.org
 Description:
                sdma<N>/ contains one directory per sdma engine (0 - 15)
 
+               =============== ==============================================
                cpu_list:       (RW) List of cpus for user-process to sdma
                                engine assignment.
 
                vl:             (RO) Displays the virtual lane (vl) the sdma
                                engine maps to.
+               =============== ==============================================
 
                This interface gives the user control on the affinity settings
                for the device. As an example, to set an sdma engine irq
                affinity and thread affinity of a user processes to use the
                sdma engine, which is "near" in terms of NUMA configuration, or
-               physical cpu location, the user will do:
+               physical cpu location, the user will do::
 
-               echo "3" > /proc/irq/<N>/smp_affinity_list
-               echo "4-7" > /sys/devices/.../sdma3/cpu_list
-               cat /sys/devices/.../sdma3/vl
-               0
-               echo "8" > /proc/irq/<M>/smp_affinity_list
-               echo "9-12" > /sys/devices/.../sdma4/cpu_list
-               cat /sys/devices/.../sdma4/vl
-               1
+                 echo "3" > /proc/irq/<N>/smp_affinity_list
+                 echo "4-7" > /sys/devices/.../sdma3/cpu_list
+                 cat /sys/devices/.../sdma3/vl
+                 0
+                 echo "8" > /proc/irq/<M>/smp_affinity_list
+                 echo "9-12" > /sys/devices/.../sdma4/cpu_list
+                 cat /sys/devices/.../sdma4/vl
+                 1
 
                to make sure that when a process runs on cpus 4,5,6, or 7, and
                uses vl=0, then sdma engine 3 is selected by the driver, and
@@ -711,11 +742,13 @@ Date:             Jan, 2016
 KernelVersion: v4.10
 Contact:       linux-rdma@vger.kernel.org
 Description:
+               =============== ==== ========================
                hw_rev:         (RO) Hardware revision number
 
                hca_type:       (RO) Show HCA type (I40IW)
 
                board_id:       (RO) I40IW board ID
+               =============== ==== ========================
 
 
 sysfs interface for QLogic qedr NIC Driver
@@ -728,9 +761,11 @@ KernelVersion:     v4.10
 Contact:       linux-rdma@vger.kernel.org
 Description:
 
+               =============== ==== ========================
                hw_rev:         (RO) Hardware revision number
 
                hca_type:       (RO) Display HCA type
+               =============== ==== ========================
 
 
 sysfs interface for VMware Paravirtual RDMA driver
@@ -744,11 +779,13 @@ KernelVersion:    v4.10
 Contact:       linux-rdma@vger.kernel.org
 Description:
 
+               =============== ==== =====================================
                hw_rev:         (RO) Hardware revision number
 
                hca_type:       (RO) Host channel adapter type
 
                board_id:       (RO) Display PVRDMA manufacturing board ID
+               =============== ==== =====================================
 
 
 sysfs interface for Broadcom NetXtreme-E RoCE driver
@@ -760,6 +797,8 @@ Date:               Feb, 2017
 KernelVersion: v4.11
 Contact:       linux-rdma@vger.kernel.org
 Description:
+               =============== ==== =========================
                hw_rev:         (RO) Hardware revision number
 
                hca_type:       (RO) Host channel adapter type
+               =============== ==== =========================
index 5b154f9..037979f 100644 (file)
@@ -2,7 +2,7 @@ rfkill - radio frequency (RF) connector kill switch support
 
 For details to this subsystem look at Documentation/driver-api/rfkill.rst.
 
-For the deprecated /sys/class/rfkill/*/claim knobs of this interface look in
+For the deprecated ``/sys/class/rfkill/*/claim`` knobs of this interface look in
 Documentation/ABI/removed/sysfs-class-rfkill.
 
 What:          /sys/class/rfkill
@@ -36,9 +36,10 @@ KernelVersion        v2.6.22
 Contact:       linux-wireless@vger.kernel.org
 Description:   Whether the soft blocked state is initialised from non-volatile
                storage at startup.
-Values:        A numeric value.
-               0: false
-               1: true
+Values:        A numeric value:
+
+               - 0: false
+               - 1: true
 
 
 What:          /sys/class/rfkill/rfkill[0-9]+/state
@@ -54,6 +55,7 @@ Description:  Current state of the transmitter.
                through this interface. There will likely be another attempt to
                remove it in the future.
 Values:        A numeric value.
+
                0: RFKILL_STATE_SOFT_BLOCKED
                        transmitter is turned off by software
                1: RFKILL_STATE_UNBLOCKED
@@ -69,6 +71,7 @@ KernelVersion v2.6.34
 Contact:       linux-wireless@vger.kernel.org
 Description:   Current hardblock state. This file is read only.
 Values:        A numeric value.
+
                0: inactive
                        The transmitter is (potentially) active.
                1: active
@@ -82,7 +85,9 @@ KernelVersion v2.6.34
 Contact:       linux-wireless@vger.kernel.org
 Description:   Current softblock state. This file is read and write.
 Values:        A numeric value.
+
                0: inactive
                        The transmitter is (potentially) active.
+
                1: active
                        The transmitter is turned off by software.
index 58e94e7..91ca63e 100644 (file)
@@ -32,11 +32,11 @@ KernelVersion:      2.6.12
 Contact:       linux-integrity@vger.kernel.org
 Description:   The "caps" property contains TPM manufacturer and version info.
 
-               Example output:
+               Example output::
 
-               Manufacturer: 0x53544d20
-               TCG version: 1.2
-               Firmware version: 8.16
+                 Manufacturer: 0x53544d20
+                 TCG version: 1.2
+                 Firmware version: 8.16
 
                Manufacturer is a hex dump of the 4 byte manufacturer info
                space in a TPM. TCG version shows the TCG TPM spec level that
@@ -54,9 +54,9 @@ Description:  The "durations" property shows the 3 vendor-specific values
                any longer than necessary before starting to poll for a
                result.
 
-               Example output:
+               Example output::
 
-               3015000 4508000 180995000 [original]
+                 3015000 4508000 180995000 [original]
 
                Here the short, medium and long durations are displayed in
                usecs. "[original]" indicates that the values are displayed
@@ -92,14 +92,14 @@ Description:        The "pcrs" property will dump the current value of all Platform
                values may be constantly changing, the output is only valid
                for a snapshot in time.
 
-               Example output:
+               Example output::
 
-               PCR-00: 3A 3F 78 0F 11 A4 B4 99 69 FC AA 80 CD 6E 39 57 C3 3B 22 75
-               PCR-01: 3A 3F 78 0F 11 A4 B4 99 69 FC AA 80 CD 6E 39 57 C3 3B 22 75
-               PCR-02: 3A 3F 78 0F 11 A4 B4 99 69 FC AA 80 CD 6E 39 57 C3 3B 22 75
-               PCR-03: 3A 3F 78 0F 11 A4 B4 99 69 FC AA 80 CD 6E 39 57 C3 3B 22 75
-               PCR-04: 3A 3F 78 0F 11 A4 B4 99 69 FC AA 80 CD 6E 39 57 C3 3B 22 75
-               ...
+                 PCR-00: 3A 3F 78 0F 11 A4 B4 99 69 FC AA 80 CD 6E 39 57 C3 3B 22 75
+                 PCR-01: 3A 3F 78 0F 11 A4 B4 99 69 FC AA 80 CD 6E 39 57 C3 3B 22 75
+                 PCR-02: 3A 3F 78 0F 11 A4 B4 99 69 FC AA 80 CD 6E 39 57 C3 3B 22 75
+                 PCR-03: 3A 3F 78 0F 11 A4 B4 99 69 FC AA 80 CD 6E 39 57 C3 3B 22 75
+                 PCR-04: 3A 3F 78 0F 11 A4 B4 99 69 FC AA 80 CD 6E 39 57 C3 3B 22 75
+                 ...
 
                The number of PCRs and hex bytes needed to represent a PCR
                value will vary depending on TPM chip version. For TPM 1.1 and
@@ -119,44 +119,44 @@ Description:      The "pubek" property will return the TPM's public endorsement
                ated at TPM manufacture time and exists for the life of the
                chip.
 
-               Example output:
-
-               Algorithm: 00 00 00 01
-               Encscheme: 00 03
-               Sigscheme: 00 01
-               Parameters: 00 00 08 00 00 00 00 02 00 00 00 00
-               Modulus length: 256
-               Modulus:
-               B4 76 41 82 C9 20 2C 10 18 40 BC 8B E5 44 4C 6C
-               3A B2 92 0C A4 9B 2A 83 EB 5C 12 85 04 48 A0 B6
-               1E E4 81 84 CE B2 F2 45 1C F0 85 99 61 02 4D EB
-               86 C4 F7 F3 29 60 52 93 6B B2 E5 AB 8B A9 09 E3
-               D7 0E 7D CA 41 BF 43 07 65 86 3C 8C 13 7A D0 8B
-               82 5E 96 0B F8 1F 5F 34 06 DA A2 52 C1 A9 D5 26
-               0F F4 04 4B D9 3F 2D F2 AC 2F 74 64 1F 8B CD 3E
-               1E 30 38 6C 70 63 69 AB E2 50 DF 49 05 2E E1 8D
-               6F 78 44 DA 57 43 69 EE 76 6C 38 8A E9 8E A3 F0
-               A7 1F 3C A8 D0 12 15 3E CA 0E BD FA 24 CD 33 C6
-               47 AE A4 18 83 8E 22 39 75 93 86 E6 FD 66 48 B6
-               10 AD 94 14 65 F9 6A 17 78 BD 16 53 84 30 BF 70
-               E0 DC 65 FD 3C C6 B0 1E BF B9 C1 B5 6C EF B1 3A
-               F8 28 05 83 62 26 11 DC B4 6B 5A 97 FF 32 26 B6
-               F7 02 71 CF 15 AE 16 DD D1 C1 8E A8 CF 9B 50 7B
-               C3 91 FF 44 1E CF 7C 39 FE 17 77 21 20 BD CE 9B
-
-               Possible values:
-
-               Algorithm:      TPM_ALG_RSA                     (1)
-               Encscheme:      TPM_ES_RSAESPKCSv15             (2)
+               Example output::
+
+                 Algorithm: 00 00 00 01
+                 Encscheme: 00 03
+                 Sigscheme: 00 01
+                 Parameters: 00 00 08 00 00 00 00 02 00 00 00 00
+                 Modulus length: 256
+                 Modulus:
+                 B4 76 41 82 C9 20 2C 10 18 40 BC 8B E5 44 4C 6C
+                 3A B2 92 0C A4 9B 2A 83 EB 5C 12 85 04 48 A0 B6
+                 1E E4 81 84 CE B2 F2 45 1C F0 85 99 61 02 4D EB
+                 86 C4 F7 F3 29 60 52 93 6B B2 E5 AB 8B A9 09 E3
+                 D7 0E 7D CA 41 BF 43 07 65 86 3C 8C 13 7A D0 8B
+                 82 5E 96 0B F8 1F 5F 34 06 DA A2 52 C1 A9 D5 26
+                 0F F4 04 4B D9 3F 2D F2 AC 2F 74 64 1F 8B CD 3E
+                 1E 30 38 6C 70 63 69 AB E2 50 DF 49 05 2E E1 8D
+                 6F 78 44 DA 57 43 69 EE 76 6C 38 8A E9 8E A3 F0
+                 A7 1F 3C A8 D0 12 15 3E CA 0E BD FA 24 CD 33 C6
+                 47 AE A4 18 83 8E 22 39 75 93 86 E6 FD 66 48 B6
+                 10 AD 94 14 65 F9 6A 17 78 BD 16 53 84 30 BF 70
+                 E0 DC 65 FD 3C C6 B0 1E BF B9 C1 B5 6C EF B1 3A
+                 F8 28 05 83 62 26 11 DC B4 6B 5A 97 FF 32 26 B6
+                 F7 02 71 CF 15 AE 16 DD D1 C1 8E A8 CF 9B 50 7B
+                 C3 91 FF 44 1E CF 7C 39 FE 17 77 21 20 BD CE 9B
+
+               Possible values::
+
+                 Algorithm:    TPM_ALG_RSA                     (1)
+                 Encscheme:    TPM_ES_RSAESPKCSv15             (2)
                                TPM_ES_RSAESOAEP_SHA1_MGF1      (3)
-               Sigscheme:      TPM_SS_NONE                     (1)
-               Parameters, a byte string of 3 u32 values:
+                 Sigscheme:    TPM_SS_NONE                     (1)
+                 Parameters, a byte string of 3 u32 values:
                        Key Length (bits):      00 00 08 00     (2048)
                        Num primes:             00 00 00 02     (2)
                        Exponent Size:          00 00 00 00     (0 means the
                                                                 default exp)
-               Modulus Length: 256 (bytes)
-               Modulus:        The 256 byte Endorsement Key modulus
+                 Modulus Length: 256 (bytes)
+                 Modulus:      The 256 byte Endorsement Key modulus
 
 What:          /sys/class/tpm/tpmX/device/temp_deactivated
 Date:          April 2006
@@ -176,9 +176,9 @@ Description:        The "timeouts" property shows the 4 vendor-specific values
                timeouts is defined by the TPM interface spec that the chip
                conforms to.
 
-               Example output:
+               Example output::
 
-               750000 750000 750000 750000 [original]
+                 750000 750000 750000 750000 [original]
 
                The four timeout values are shown in usecs, with a trailing
                "[original]" or "[adjusted]" depending on whether the values
@@ -191,6 +191,6 @@ Contact:    linux-integrity@vger.kernel.org
 Description:   The "tpm_version_major" property shows the TCG spec major version
                implemented by the TPM device.
 
-               Example output:
+               Example output::
 
-               2
+                 2
index 4404bd9..42bf1ea 100644 (file)
@@ -1,5 +1,6 @@
-# Note: This documents additional properties of any device beyond what
-# is documented in Documentation/admin-guide/sysfs-rules.rst
+Note:
+  This documents additional properties of any device beyond what
+  is documented in Documentation/admin-guide/sysfs-rules.rst
 
 What:          /sys/devices/*/of_node
 Date:          February 2015
index 420c1d0..3a4e2cd 100644 (file)
@@ -1,29 +1,29 @@
-What:           sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/cap
+What:           /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/cap
 Date:           December 3, 2009
 KernelVersion:  2.6.32
 Contact:        dmaengine@vger.kernel.org
 Description:   Capabilities the DMA supports.Currently there are DMA_PQ, DMA_PQ_VAL,
                DMA_XOR,DMA_XOR_VAL,DMA_INTERRUPT.
 
-What:           sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/ring_active
+What:           /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/ring_active
 Date:           December 3, 2009
 KernelVersion:  2.6.32
 Contact:        dmaengine@vger.kernel.org
 Description:   The number of descriptors active in the ring.
 
-What:           sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/ring_size
+What:           /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/ring_size
 Date:           December 3, 2009
 KernelVersion:  2.6.32
 Contact:        dmaengine@vger.kernel.org
 Description:   Descriptor ring size, total number of descriptors available.
 
-What:           sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/version
+What:           /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/version
 Date:           December 3, 2009
 KernelVersion:  2.6.32
 Contact:        dmaengine@vger.kernel.org
 Description:   Version of ioatdma device.
 
-What:           sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/intr_coalesce
+What:           /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/intr_coalesce
 Date:           August 8, 2017
 KernelVersion:  4.14
 Contact:        dmaengine@vger.kernel.org
index 00fa04c..f5724bb 100644 (file)
@@ -12,13 +12,15 @@ Description:
                resets. Three registers are used by the FSBL and
                other Xilinx software products: GLOBAL_GEN_STORAGE{4:6}.
 
-               Usage:
-               # cat /sys/devices/platform/firmware\:zynqmp-firmware/ggs0
-               # echo <value> > /sys/devices/platform/firmware\:zynqmp-firmware/ggs0
+               Usage::
+
+                   # cat /sys/devices/platform/firmware\:zynqmp-firmware/ggs0
+                   # echo <value> > /sys/devices/platform/firmware\:zynqmp-firmware/ggs0
+
+               Example::
 
-               Example:
-               # cat /sys/devices/platform/firmware\:zynqmp-firmware/ggs0
-               # echo 0x1234ABCD > /sys/devices/platform/firmware\:zynqmp-firmware/ggs0
+                   # cat /sys/devices/platform/firmware\:zynqmp-firmware/ggs0
+                   # echo 0x1234ABCD > /sys/devices/platform/firmware\:zynqmp-firmware/ggs0
 
 Users:         Xilinx
 
@@ -39,13 +41,15 @@ Description:
                software products: PERS_GLOB_GEN_STORAGE{4:7}.
                Register is reset only by a POR reset.
 
-               Usage:
-               # cat /sys/devices/platform/firmware\:zynqmp-firmware/pggs0
-               # echo <value> > /sys/devices/platform/firmware\:zynqmp-firmware/pggs0
+               Usage::
+
+                   # cat /sys/devices/platform/firmware\:zynqmp-firmware/pggs0
+                   # echo <value> > /sys/devices/platform/firmware\:zynqmp-firmware/pggs0
+
+               Example::
 
-               Example:
-               # cat /sys/devices/platform/firmware\:zynqmp-firmware/pggs0
-               # echo 0x1234ABCD > /sys/devices/platform/firmware\:zynqmp-firmware/pggs0
+                   # cat /sys/devices/platform/firmware\:zynqmp-firmware/pggs0
+                   # echo 0x1234ABCD > /sys/devices/platform/firmware\:zynqmp-firmware/pggs0
 
 Users:         Xilinx
 
@@ -61,23 +65,28 @@ Description:
 
                Following are available shutdown scopes(subtypes):
 
-               subsystem:      Only the APU along with all of its peripherals
+               subsystem:
+                               Only the APU along with all of its peripherals
                                not used by other processing units will be
                                shut down. This may result in the FPD power
                                domain being shut down provided that no other
                                processing unit uses FPD peripherals or DRAM.
-               ps_only:        The complete PS will be shut down, including the
+               ps_only:
+                               The complete PS will be shut down, including the
                                RPU, PMU, etc.  Only the PL domain (FPGA)
                                remains untouched.
-               system:         The complete system/device is shut down.
+               system:
+                               The complete system/device is shut down.
 
-               Usage:
-               # cat /sys/devices/platform/firmware\:zynqmp-firmware/shutdown_scope
-               # echo <scope> > /sys/devices/platform/firmware\:zynqmp-firmware/shutdown_scope
+               Usage::
+
+                   # cat /sys/devices/platform/firmware\:zynqmp-firmware/shutdown_scope
+                   # echo <scope> > /sys/devices/platform/firmware\:zynqmp-firmware/shutdown_scope
+
+               Example::
 
-               Example:
-               # cat /sys/devices/platform/firmware\:zynqmp-firmware/shutdown_scope
-               # echo "subsystem" > /sys/devices/platform/firmware\:zynqmp-firmware/shutdown_scope
+                   # cat /sys/devices/platform/firmware\:zynqmp-firmware/shutdown_scope
+                   # echo "subsystem" > /sys/devices/platform/firmware\:zynqmp-firmware/shutdown_scope
 
 Users:         Xilinx
 
@@ -94,10 +103,13 @@ Description:
                system restart.
 
                Usage:
-               Set healthy bit
-               # echo 1 > /sys/devices/platform/firmware\:zynqmp-firmware/health_status
 
-               Unset healthy bit
-               # echo 0 > /sys/devices/platform/firmware\:zynqmp-firmware/health_status
+               Set healthy bit::
+
+                   # echo 1 > /sys/devices/platform/firmware\:zynqmp-firmware/health_status
+
+               Unset healthy bit::
+
+                   # echo 0 > /sys/devices/platform/firmware\:zynqmp-firmware/health_status
 
 Users:         Xilinx
index 84972a5..bada15a 100644 (file)
@@ -6,6 +6,7 @@ Description:    Interface for making ib_srp connect to a new target.
                One can request ib_srp to connect to a new target by writing
                a comma-separated list of login parameters to this sysfs
                attribute. The supported parameters are:
+
                * id_ext, a 16-digit hexadecimal number specifying the eight
                  byte identifier extension in the 16-byte SRP target port
                  identifier. The target port identifier is sent by ib_srp
index c6a32c4..792f58b 100644 (file)
@@ -69,6 +69,7 @@ Description:  Controls if typing interrupts output from speakup. With
                speakup if for example
                the say screen command is used before the
                entire screen  is read.
+
                With no_interrupt set to one, if the say
                screen command is used, and one then types on the keyboard,
                speakup will continue to say the whole screen regardless until
@@ -215,8 +216,10 @@ Description:       This file contains names for key states.
                Again, these are part of the help system.  For instance, if you
                had pressed speakup + keypad 3, you would hear:
                "speakup keypad 3 is go to bottom edge."
+
                The speakup key is depressed, so the name of the key state is
                speakup.
+
                This part of the message comes from the states collection.
 
 What:          /sys/accessibility/speakup/i18n/characters
@@ -297,6 +300,7 @@ KernelVersion:      2.6
 Contact:       speakup@linux-speakup.org
 Description:   Controls if punctuation is spoken by speakup, or by the
                synthesizer.
+
                For example, speakup speaks ">" as "greater", while
                the espeak synthesizer used by the soft driver speaks "greater
                than". Zero lets speakup speak the punctuation. One lets the
index 5def20b..46ccd23 100644 (file)
@@ -17,6 +17,7 @@ Description:
                directory has a name of the form "<key>-<vendor guid>"
                and contains the following files:
 
+               =============== ========================================
                attributes:     A read-only text file enumerating the
                                EFI variable flags.  Potential values
                                include:
@@ -59,12 +60,14 @@ Description:
 
                size:           As ASCII representation of the size of
                                the variable's value.
+               =============== ========================================
 
 
                In addition, two other magic binary files are provided
                in the top-level directory and are used for adding and
                removing variables:
 
+               =============== ========================================
                new_var:        Takes a "struct efi_variable" and
                                instructs the EFI firmware to create a
                                new variable.
@@ -73,3 +76,4 @@ Description:
                                instructs the EFI firmware to remove any
                                variable that has a matching vendor GUID
                                and variable key name.
+               =============== ========================================
index 32fe7f5..1f74f45 100644 (file)
@@ -7,6 +7,7 @@ Description:
 
                This is only for the powerpc/powernv platform.
 
+               =============== ===============================================
                initiate_dump:  When '1' is written to it,
                                we will initiate a dump.
                                Read this file for supported commands.
@@ -19,8 +20,11 @@ Description:
                                and ID of the dump, use the id and type files.
                                Do not rely on any particular size of dump
                                type or dump id.
+               =============== ===============================================
 
                Each dump has the following files:
+
+               =============== ===============================================
                id:             An ASCII representation of the dump ID
                                in hex (e.g. '0x01')
                type:           An ASCII representation of the type of
@@ -39,3 +43,4 @@ Description:
                                inaccessible.
                                Reading this file will get a list of
                                supported actions.
+               =============== ===============================================
index 2536434..7c8a61a 100644 (file)
@@ -38,6 +38,7 @@ Description:
                For each log entry (directory), there are the following
                files:
 
+               ==============  ================================================
                id:             An ASCII representation of the ID of the
                                error log, in hex - e.g. "0x01".
 
@@ -58,3 +59,4 @@ Description:
                                entry will be removed from sysfs.
                                Reading this file will list the supported
                                operations (currently just acknowledge).
+               ==============  ================================================
index 3cf5cdf..748593c 100644 (file)
@@ -33,6 +33,8 @@ Description:  If running under Xen:
                Space separated list of supported guest system types. Each type
                is in the format: <class>-<major>.<minor>-<arch>
                With:
+
+                       ======== ============================================
                        <class>: "xen" -- x86: paravirtualized, arm: standard
                                 "hvm" -- x86 only: fully virtualized
                        <major>: major guest interface version
@@ -43,6 +45,7 @@ Description:  If running under Xen:
                                 "x86_64": 64 bit x86 guest
                                 "armv7l": 32 bit arm guest
                                 "aarch64": 64 bit arm guest
+                       ======== ============================================
 
 What:          /sys/hypervisor/properties/changeset
 Date:          March 2009
index 55406ec..951838d 100644 (file)
@@ -1,3 +1,9 @@
+What:          vDSO
+Date:          July 2011
+KernelVersion: 3.0
+Contact:       Andy Lutomirski <luto@kernel.org>
+Description:
+
 On some architectures, when the kernel loads any userspace program it
 maps an ELF DSO into that program's address space.  This DSO is called
 the vDSO and it often contains useful and highly-optimized alternatives
@@ -23,6 +29,7 @@ Unless otherwise noted, the set of symbols with any given version and the
 ABI of those symbols is considered stable.  It may vary across architectures,
 though.
 
-(As of this writing, this ABI documentation as been confirmed for x86_64.
+Note:
+ As of this writing, this ABI documentation as been confirmed for x86_64.
  The maintainers of the other vDSO-using architectures should confirm
- that it is correct for their architecture.)
+ that it is correct for their architecture.
index 4ab4e99..c09b640 100644 (file)
@@ -14,7 +14,8 @@ Description:
                This group contains the configuration for user defined ACPI
                tables. The attributes of a user define table are:
 
-               aml             - a binary attribute that the user can use to
+               aml
+                             - a binary attribute that the user can use to
                                fill in the ACPI aml definitions. Once the aml
                                data is written to this file and the file is
                                closed the table will be loaded and ACPI devices
@@ -26,11 +27,26 @@ Description:
                The rest of the attributes are read-only and are valid only
                after the table has been loaded by filling the aml entry:
 
-               signature       - ASCII table signature
-               length          - length of table in bytes, including the header
-               revision        - ACPI Specification minor version number
-               oem_id          - ASCII OEM identification
-               oem_table_id    - ASCII OEM table identification
-               oem_revision    - OEM revision number
-               asl_compiler_id - ASCII ASL compiler vendor ID
-               asl_compiler_revision - ASL compiler version
+               signature
+                               - ASCII table signature
+
+               length
+                               - length of table in bytes, including the header
+
+               revision
+                               - ACPI Specification minor version number
+
+               oem_id
+                               - ASCII OEM identification
+
+               oem_table_id
+                               - ASCII OEM table identification
+
+               oem_revision
+                               - OEM revision number
+
+               asl_compiler_id
+                               - ASCII ASL compiler vendor ID
+
+               asl_compiler_revision
+                               - ASL compiler version
index ed67a4d..bc6b8bd 100644 (file)
@@ -15,22 +15,28 @@ KernelVersion:  5.2
 Description:
                The attributes:
 
-               buffer_size     configure the buffer size for this channel
+               buffer_size
+                               configure the buffer size for this channel
 
-               subbuffer_size  configure the sub-buffer size for this channel
+               subbuffer_size
+                               configure the sub-buffer size for this channel
                                (needed for synchronous and isochrnous data)
 
 
-               num_buffers     configure number of buffers used for this
+               num_buffers
+                               configure number of buffers used for this
                                channel
 
-               datatype        configure type of data that will travel over
+               datatype
+                               configure type of data that will travel over
                                this channel
 
-               direction       configure whether this link will be an input
+               direction
+                               configure whether this link will be an input
                                or output
 
-               dbr_size        configure DBR data buffer size (this is used
+               dbr_size
+                               configure DBR data buffer size (this is used
                                for MediaLB communication only)
 
                packets_per_xact
@@ -39,18 +45,23 @@ Description:
                                transmitted via USB (this is used for USB
                                communication only)
 
-               device          name of the device the link is to be attached to
+               device
+                               name of the device the link is to be attached to
 
-               channel         name of the channel the link is to be attached to
+               channel
+                               name of the channel the link is to be attached to
 
-               comp_params     pass parameters needed by some components
+               comp_params
+                               pass parameters needed by some components
 
-               create_link     write '1' to this attribute to trigger the
+               create_link
+                               write '1' to this attribute to trigger the
                                creation of the link. In case of speculative
                                configuration, the creation is post-poned until
                                a physical device is being attached to the bus.
 
-               destroy_link    write '1' to this attribute to destroy an
+               destroy_link
+                               write '1' to this attribute to destroy an
                                active link
 
 What:          /sys/kernel/config/most_video/<link>
@@ -59,22 +70,28 @@ KernelVersion:  5.2
 Description:
                The attributes:
 
-               buffer_size     configure the buffer size for this channel
+               buffer_size
+                               configure the buffer size for this channel
 
-               subbuffer_size  configure the sub-buffer size for this channel
+               subbuffer_size
+                               configure the sub-buffer size for this channel
                                (needed for synchronous and isochrnous data)
 
 
-               num_buffers     configure number of buffers used for this
+               num_buffers
+                               configure number of buffers used for this
                                channel
 
-               datatype        configure type of data that will travel over
+               datatype
+                               configure type of data that will travel over
                                this channel
 
-               direction       configure whether this link will be an input
+               direction
+                               configure whether this link will be an input
                                or output
 
-               dbr_size        configure DBR data buffer size (this is used
+               dbr_size
+                               configure DBR data buffer size (this is used
                                for MediaLB communication only)
 
                packets_per_xact
@@ -83,18 +100,23 @@ Description:
                                transmitted via USB (this is used for USB
                                communication only)
 
-               device          name of the device the link is to be attached to
+               device
+                               name of the device the link is to be attached to
 
-               channel         name of the channel the link is to be attached to
+               channel
+                               name of the channel the link is to be attached to
 
-               comp_params     pass parameters needed by some components
+               comp_params
+                               pass parameters needed by some components
 
-               create_link     write '1' to this attribute to trigger the
+               create_link
+                               write '1' to this attribute to trigger the
                                creation of the link. In case of speculative
                                configuration, the creation is post-poned until
                                a physical device is being attached to the bus.
 
-               destroy_link    write '1' to this attribute to destroy an
+               destroy_link
+                               write '1' to this attribute to destroy an
                                active link
 
 What:          /sys/kernel/config/most_net/<link>
@@ -103,22 +125,28 @@ KernelVersion:  5.2
 Description:
                The attributes:
 
-               buffer_size     configure the buffer size for this channel
+               buffer_size
+                               configure the buffer size for this channel
 
-               subbuffer_size  configure the sub-buffer size for this channel
+               subbuffer_size
+                               configure the sub-buffer size for this channel
                                (needed for synchronous and isochrnous data)
 
 
-               num_buffers     configure number of buffers used for this
+               num_buffers
+                               configure number of buffers used for this
                                channel
 
-               datatype        configure type of data that will travel over
+               datatype
+                               configure type of data that will travel over
                                this channel
 
-               direction       configure whether this link will be an input
+               direction
+                               configure whether this link will be an input
                                or output
 
-               dbr_size        configure DBR data buffer size (this is used
+               dbr_size
+                               configure DBR data buffer size (this is used
                                for MediaLB communication only)
 
                packets_per_xact
@@ -127,18 +155,23 @@ Description:
                                transmitted via USB (this is used for USB
                                communication only)
 
-               device          name of the device the link is to be attached to
+               device
+                               name of the device the link is to be attached to
 
-               channel         name of the channel the link is to be attached to
+               channel
+                               name of the channel the link is to be attached to
 
-               comp_params     pass parameters needed by some components
+               comp_params
+                               pass parameters needed by some components
 
-               create_link     write '1' to this attribute to trigger the
+               create_link
+                               write '1' to this attribute to trigger the
                                creation of the link. In case of speculative
                                configuration, the creation is post-poned until
                                a physical device is being attached to the bus.
 
-               destroy_link    write '1' to this attribute to destroy an
+               destroy_link
+                               write '1' to this attribute to destroy an
                                active link
 
 What:          /sys/kernel/config/most_sound/<card>
@@ -147,7 +180,8 @@ KernelVersion:  5.2
 Description:
                The attributes:
 
-               create_card     write '1' to this attribute to trigger the
+               create_card
+                               write '1' to this attribute to trigger the
                                 registration of the sound card with the ALSA
                                subsystem.
 
@@ -157,22 +191,28 @@ KernelVersion:  5.2
 Description:
                The attributes:
 
-               buffer_size     configure the buffer size for this channel
+               buffer_size
+                               configure the buffer size for this channel
 
-               subbuffer_size  configure the sub-buffer size for this channel
+               subbuffer_size
+                               configure the sub-buffer size for this channel
                                (needed for synchronous and isochrnous data)
 
 
-               num_buffers     configure number of buffers used for this
+               num_buffers
+                               configure number of buffers used for this
                                channel
 
-               datatype        configure type of data that will travel over
+               datatype
+                               configure type of data that will travel over
                                this channel
 
-               direction       configure whether this link will be an input
+               direction
+                               configure whether this link will be an input
                                or output
 
-               dbr_size        configure DBR data buffer size (this is used
+               dbr_size
+                               configure DBR data buffer size (this is used
                                for MediaLB communication only)
 
                packets_per_xact
@@ -181,16 +221,21 @@ Description:
                                transmitted via USB (this is used for USB
                                communication only)
 
-               device          name of the device the link is to be attached to
+               device
+                               name of the device the link is to be attached to
 
-               channel         name of the channel the link is to be attached to
+               channel
+                               name of the channel the link is to be attached to
 
-               comp_params     pass parameters needed by some components
+               comp_params
+                               pass parameters needed by some components
 
-               create_link     write '1' to this attribute to trigger the
+               create_link
+                               write '1' to this attribute to trigger the
                                creation of the link. In case of speculative
                                configuration, the creation is post-poned until
                                a physical device is being attached to the bus.
 
-               destroy_link    write '1' to this attribute to destroy an
+               destroy_link
+                               write '1' to this attribute to destroy an
                                active link
index 840c324..cf877bd 100644 (file)
@@ -10,22 +10,24 @@ Description:
        This interfaces can be used to show spear's PCIe device capability.
 
        Nodes are only visible when configfs is mounted. To mount configfs
-       in /config directory use:
-       # mount -t configfs none /config/
+       in /config directory use::
 
-       For nth PCIe Device Controller
-       /config/pcie-gadget.n/
-               link ... used to enable ltssm and read its status.
-               int_type ...used to configure and read type of supported
-                       interrupt
-               no_of_msi ... used to configure number of MSI vector needed and
+         # mount -t configfs none /config/
+
+       For nth PCIe Device Controller /config/pcie-gadget.n/:
+
+       =============== ======================================================
+       link            used to enable ltssm and read its status.
+       int_type        used to configure and read type of supported interrupt
+       no_of_msi       used to configure number of MSI vector needed and
                        to read no of MSI granted.
-               inta ... write 1 to assert INTA and 0 to de-assert.
-               send_msi ... write MSI vector to be sent.
-               vendor_id ... used to write and read vendor id (hex)
-               device_id ... used to write and read device id (hex)
-               bar0_size ... used to write and read bar0_size
-               bar0_address ... used to write and read bar0 mapped area in hex.
-               bar0_rw_offset ... used to write and read offset of bar0 where
-                       bar0_data will be written or read.
-               bar0_data ... used to write and read data at bar0_rw_offset.
+       inta            write 1 to assert INTA and 0 to de-assert.
+       send_msi        write MSI vector to be sent.
+       vendor_id       used to write and read vendor id (hex)
+       device_id       used to write and read device id (hex)
+       bar0_size       used to write and read bar0_size
+       bar0_address    used to write and read bar0 mapped area in hex.
+       bar0_rw_offset  used to write and read offset of bar0 where bar0_data
+                       will be written or read.
+       bar0_data       used to write and read data at bar0_rw_offset.
+       =============== ======================================================
index 4594cc2..dc351e9 100644 (file)
@@ -12,22 +12,24 @@ Description:
 
                The attributes of a gadget:
 
-               UDC             - bind a gadget to UDC/unbind a gadget;
-                               write UDC's name found in /sys/class/udc/*
-                               to bind a gadget, empty string "" to unbind.
-
-               max_speed       - maximum speed the driver supports. Valid
-                               names are super-speed-plus, super-speed,
-                               high-speed, full-speed, and low-speed.
-
-               bDeviceClass    - USB device class code
-               bDeviceSubClass - USB device subclass code
-               bDeviceProtocol - USB device protocol code
-               bMaxPacketSize0 - maximum endpoint 0 packet size
-               bcdDevice       - bcd device release number
-               bcdUSB          - bcd USB specification version number
-               idProduct       - product ID
-               idVendor        - vendor ID
+               ================  ============================================
+               UDC               bind a gadget to UDC/unbind a gadget;
+                                 write UDC's name found in /sys/class/udc/*
+                                 to bind a gadget, empty string "" to unbind.
+
+               max_speed         maximum speed the driver supports. Valid
+                                 names are super-speed-plus, super-speed,
+                                 high-speed, full-speed, and low-speed.
+
+               bDeviceClass      USB device class code
+               bDeviceSubClass   USB device subclass code
+               bDeviceProtocol   USB device protocol code
+               bMaxPacketSize0   maximum endpoint 0 packet size
+               bcdDevice         bcd device release number
+               bcdUSB            bcd USB specification version number
+               idProduct         product ID
+               idVendor          vendor ID
+               ================  ============================================
 
 What:          /config/usb-gadget/gadget/configs
 Date:          Jun 2013
@@ -41,8 +43,10 @@ KernelVersion:       3.11
 Description:
                The attributes of a configuration:
 
-               bmAttributes    - configuration characteristics
-               MaxPower        - maximum power consumption from the bus
+               ================  ======================================
+               bmAttributes      configuration characteristics
+               MaxPower          maximum power consumption from the bus
+               ================  ======================================
 
 What:          /config/usb-gadget/gadget/configs/config/strings
 Date:          Jun 2013
@@ -57,7 +61,9 @@ KernelVersion:        3.11
 Description:
                The attributes:
 
-               configuration   - configuration description
+               ================  =========================
+               configuration     configuration description
+               ================  =========================
 
 
 What:          /config/usb-gadget/gadget/functions
@@ -76,8 +82,10 @@ Description:
 
                The attributes:
 
-               compatible_id           - 8-byte string for "Compatible ID"
-               sub_compatible_id       - 8-byte string for "Sub Compatible ID"
+               =================       =====================================
+               compatible_id           8-byte string for "Compatible ID"
+               sub_compatible_id       8-byte string for "Sub Compatible ID"
+               =================       =====================================
 
 What:          /config/usb-gadget/gadget/functions/<func>.<inst>/interface.<n>/<property>
 Date:          May 2014
@@ -89,16 +97,19 @@ Description:
 
                The attributes:
 
-               type            - value 1..7 for interpreting the data
-                               1: unicode string
-                               2: unicode string with environment variable
-                               3: binary
-                               4: little-endian 32-bit
-                               5: big-endian 32-bit
-                               6: unicode string with a symbolic link
-                               7: multiple unicode strings
-               data            - blob of data to be interpreted depending on
+               =====           ===============================================
+               type            value 1..7 for interpreting the data
+
+                               - 1: unicode string
+                               - 2: unicode string with environment variable
+                               - 3: binary
+                               - 4: little-endian 32-bit
+                               - 5: big-endian 32-bit
+                               - 6: unicode string with a symbolic link
+                               - 7: multiple unicode strings
+               data            blob of data to be interpreted depending on
                                type
+               =====           ===============================================
 
 What:          /config/usb-gadget/gadget/strings
 Date:          Jun 2013
@@ -113,9 +124,11 @@ KernelVersion:     3.11
 Description:
                The attributes:
 
-               serialnumber    - gadget's serial number (string)
-               product         - gadget's product description
-               manufacturer    - gadget's manufacturer description
+               ============    =================================
+               serialnumber    gadget's serial number (string)
+               product         gadget's product description
+               manufacturer    gadget's manufacturer description
+               ============    =================================
 
 What:          /config/usb-gadget/gadget/os_desc
 Date:          May 2014
@@ -123,8 +136,10 @@ KernelVersion:     3.16
 Description:
                This group contains "OS String" extension handling attributes.
 
-               use             - flag turning "OS Desctiptors" support on/off
-               b_vendor_code   - one-byte value used for custom per-device and
+               =============   ===============================================
+               use             flag turning "OS Desctiptors" support on/off
+               b_vendor_code   one-byte value used for custom per-device and
                                per-interface requests
-               qw_sign         an identifier to be reported as "OS String"
+               qw_sign         an identifier to be reported as "OS String"
                                proper
+               =============   ===============================================
index 0addf77..272bc1e 100644 (file)
@@ -4,13 +4,17 @@ KernelVersion:        3.11
 Description:
                The attributes:
 
-               ifname          - network device interface name associated with
+               ifname
+                             - network device interface name associated with
                                this function instance
-               qmult           - queue length multiplier for high and
+               qmult   
+                             - queue length multiplier for high and
                                super speed
-               host_addr       - MAC address of host's end of this
+               host_addr
+                             - MAC address of host's end of this
                                Ethernet over USB link
-               dev_addr        - MAC address of device's end of this
+               dev_addr
+                             - MAC address of device's end of this
                                Ethernet over USB link
 
 
index a4c5715..178c3d5 100644 (file)
@@ -4,11 +4,13 @@ KernelVersion:        3.11
 Description:
                The attributes:
 
-               ifname          - network device interface name associated with
+               ==========      =============================================
+               ifname          network device interface name associated with
                                this function instance
-               qmult           queue length multiplier for high and
+               qmult           queue length multiplier for high and
                                super speed
-               host_addr       MAC address of host's end of this
+               host_addr       MAC address of host's end of this
                                Ethernet over USB link
-               dev_addr        MAC address of device's end of this
+               dev_addr        MAC address of device's end of this
                                Ethernet over USB link
+               ==========      =============================================
index f12e00e..748705c 100644 (file)
@@ -4,8 +4,10 @@ KernelVersion: 3.19
 Description:
                The attributes:
 
-               protocol        - HID protocol to use
-               report_desc     - blob corresponding to HID report descriptors
+               =============   ============================================
+               protocol        HID protocol to use
+               report_desc     blob corresponding to HID report descriptors
                                except the data passed through /dev/hidg<N>
-               report_length   - HID report length
-               subclass        - HID device subclass to use
+               report_length   HID report length
+               subclass        HID device subclass to use
+               =============   ============================================
index 06beefb..e6c6ba5 100644 (file)
@@ -4,5 +4,7 @@ KernelVersion:  3.13
 Description:
                The attributes:
 
-               qlen            - depth of loopback queue
-               buflen          - buffer length
+               =======         =======================
+               qlen            depth of loopback queue
+               buflen          buffer length
+               =======         =======================
index 9931fb0..c86b63a 100644 (file)
@@ -4,12 +4,14 @@ KernelVersion:        3.13
 Description:
                The attributes:
 
-               stall           - Set to permit function to halt bulk endpoints.
+               ===========     ==============================================
+               stall           Set to permit function to halt bulk endpoints.
                                Disabled on some USB devices known not to work
                                correctly. You should set it to true.
-               num_buffers     Number of pipeline buffers. Valid numbers
+               num_buffers     Number of pipeline buffers. Valid numbers
                                are 2..4. Available only if
                                CONFIG_USB_GADGET_DEBUG_FILES is set.
+               ===========     ==============================================
 
 What:          /config/usb-gadget/gadget/functions/mass_storage.name/lun.name
 Date:          Oct 2013
@@ -17,15 +19,17 @@ KernelVersion:      3.13
 Description:
                The attributes:
 
-               file            - The path to the backing file for the LUN.
+               ===========     ==============================================
+               file            The path to the backing file for the LUN.
                                Required if LUN is not marked as removable.
-               ro              Flag specifying access to the LUN shall be
+               ro              Flag specifying access to the LUN shall be
                                read-only. This is implied if CD-ROM emulation
                                is enabled as well as when it was impossible
                                to open "filename" in R/W mode.
-               removable       Flag specifying that LUN shall be indicated as
+               removable       Flag specifying that LUN shall be indicated as
                                being removable.
-               cdrom           Flag specifying that LUN shall be reported as
+               cdrom           Flag specifying that LUN shall be reported as
                                being a CD-ROM.
-               nofua           Flag specifying that FUA flag
+               nofua           Flag specifying that FUA flag
                                in SCSI WRITE(10,12)
+               ===========     ==============================================
index 6b341df..07389cd 100644 (file)
@@ -4,9 +4,11 @@ KernelVersion: 3.19
 Description:
                The attributes:
 
-               index           - index value for the USB MIDI adapter
-               id              - ID string for the USB MIDI adapter
-               buflen          - MIDI buffer length
-               qlen            - USB read request queue length
-               in_ports        - number of MIDI input ports
-               out_ports       - number of MIDI output ports
+               ==========      ====================================
+               index           index value for the USB MIDI adapter
+               id              ID string for the USB MIDI adapter
+               buflen          MIDI buffer length
+               qlen            USB read request queue length
+               in_ports        number of MIDI input ports
+               out_ports       number of MIDI output ports
+               ==========      ====================================
index 6b0714e..7aa731b 100644 (file)
@@ -4,6 +4,8 @@ KernelVersion:  4.1
 Description:
                The attributes:
 
-               pnp_string      - Data to be passed to the host in pnp string
-               q_len           - Number of requests per endpoint
+               ==========      ===========================================
+               pnp_string      Data to be passed to the host in pnp string
+               q_len           Number of requests per endpoint
+               ==========      ===========================================
 
index 1373990..9416eda 100644 (file)
@@ -4,14 +4,16 @@ KernelVersion:        3.11
 Description:
                The attributes:
 
-               ifname          - network device interface name associated with
+               =========       =============================================
+               ifname          network device interface name associated with
                                this function instance
-               qmult           queue length multiplier for high and
+               qmult           queue length multiplier for high and
                                super speed
-               host_addr       MAC address of host's end of this
+               host_addr       MAC address of host's end of this
                                Ethernet over USB link
-               dev_addr        MAC address of device's end of this
+               dev_addr        MAC address of device's end of this
                                Ethernet over USB link
-               class           - USB interface class, default is 02 (hex)
-               subclass        - USB interface subclass, default is 06 (hex)
-               protocol        - USB interface protocol, default is 00 (hex)
+               class           USB interface class, default is 02 (hex)
+               subclass        USB interface subclass, default is 06 (hex)
+               protocol        USB interface protocol, default is 00 (hex)
+               =========       =============================================
index f56335a..1f3d31b 100644 (file)
@@ -4,11 +4,13 @@ KernelVersion:        3.13
 Description:
                The attributes:
 
-               pattern         - 0 (all zeros), 1 (mod63), 2 (none)
-               isoc_interval   - 1..16
-               isoc_maxpacket  - 0 - 1023 (fs), 0 - 1024 (hs/ss)
-               isoc_mult       - 0..2 (hs/ss only)
-               isoc_maxburst   - 0..15 (ss only)
-               buflen          - buffer length
-               bulk_qlen       - depth of queue for bulk
-               iso_qlen        - depth of queue for iso
+               ==============    ==================================
+               pattern           0 (all zeros), 1 (mod63), 2 (none)
+               isoc_interval     1..16
+               isoc_maxpacket    0 - 1023 (fs), 0 - 1024 (hs/ss)
+               isoc_mult         0..2 (hs/ss only)
+               isoc_maxburst     0..15 (ss only)
+               buflen            buffer length
+               bulk_qlen         depth of queue for bulk
+               iso_qlen          depth of queue for iso
+               ==============    ==================================
index 9373e2c..0061b86 100644 (file)
@@ -4,11 +4,13 @@ KernelVersion:        3.11
 Description:
                The attributes:
 
-               ifname          - network device interface name associated with
+               ==========      =============================================
+               ifname          network device interface name associated with
                                this function instance
-               qmult           queue length multiplier for high and
+               qmult           queue length multiplier for high and
                                super speed
-               host_addr       MAC address of host's end of this
+               host_addr       MAC address of host's end of this
                                Ethernet over USB link
-               dev_addr        MAC address of device's end of this
+               dev_addr        MAC address of device's end of this
                                Ethernet over USB link
+               ==========      =============================================
index abfe447..dc23fd7 100644 (file)
@@ -4,11 +4,13 @@ KernelVersion:        4.14
 Description:
                The attributes:
 
-               c_chmask - capture channel mask
-               c_srate - capture sampling rate
-               c_ssize - capture sample size (bytes)
-               p_chmask - playback channel mask
-               p_srate - playback sampling rate
-               p_ssize - playback sample size (bytes)
-               req_number - the number of pre-allocated request
-                       for both capture and playback
+               ==========      ===================================
+               c_chmask        capture channel mask
+               c_srate         capture sampling rate
+               c_ssize         capture sample size (bytes)
+               p_chmask        playback channel mask
+               p_srate         playback sampling rate
+               p_ssize         playback sample size (bytes)
+               req_number      the number of pre-allocated request
+                               for both capture and playback
+               ==========      ===================================
index 2bfdd4e..d4356c8 100644 (file)
@@ -4,9 +4,11 @@ KernelVersion: 3.18
 Description:
                The attributes:
 
-               c_chmask - capture channel mask
-               c_srate - capture sampling rate
-               c_ssize - capture sample size (bytes)
-               p_chmask - playback channel mask
-               p_srate - playback sampling rate
-               p_ssize - playback sample size (bytes)
+               =========  ============================
+               c_chmask   capture channel mask
+               c_srate    capture sampling rate
+               c_ssize    capture sample size (bytes)
+               p_chmask   playback channel mask
+               p_srate    playback sampling rate
+               p_ssize    playback sample size (bytes)
+               =========  ============================
index 809765b..ac5e11a 100644 (file)
@@ -3,9 +3,11 @@ Date:          Dec 2014
 KernelVersion: 4.0
 Description:   UVC function directory
 
-               streaming_maxburst      - 0..15 (ss only)
-               streaming_maxpacket     - 1..1023 (fs), 1..3072 (hs/ss)
-               streaming_interval      - 1..16
+               ===================     =============================
+               streaming_maxburst      0..15 (ss only)
+               streaming_maxpacket     1..1023 (fs), 1..3072 (hs/ss)
+               streaming_interval      1..16
+               ===================     =============================
 
 What:          /config/usb-gadget/gadget/functions/uvc.name/control
 Date:          Dec 2014
@@ -13,8 +15,11 @@ KernelVersion:       4.0
 Description:   Control descriptors
 
                All attributes read only:
-               bInterfaceNumber        - USB interface number for this
-                                         streaming interface
+
+               ================        =============================
+               bInterfaceNumber        USB interface number for this
+                                       streaming interface
+               ================        =============================
 
 What:          /config/usb-gadget/gadget/functions/uvc.name/control/class
 Date:          Dec 2014
@@ -47,13 +52,16 @@ KernelVersion:      4.0
 Description:   Default output terminal descriptors
 
                All attributes read only:
-               iTerminal       - index of string descriptor
-               bSourceID       - id of the terminal to which this terminal
+
+               ==============  =============================================
+               iTerminal       index of string descriptor
+               bSourceID       id of the terminal to which this terminal
                                is connected
-               bAssocTerminal  id of the input terminal to which this output
+               bAssocTerminal  id of the input terminal to which this output
                                terminal is associated
-               wTerminalType   - terminal type
-               bTerminalID     - a non-zero id of this terminal
+               wTerminalType   terminal type
+               bTerminalID     a non-zero id of this terminal
+               ==============  =============================================
 
 What:          /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera
 Date:          Dec 2014
@@ -66,16 +74,19 @@ KernelVersion:      4.0
 Description:   Default camera terminal descriptors
 
                All attributes read only:
-               bmControls              - bitmap specifying which controls are
-                                       supported for the video stream
-               wOcularFocalLength      - the value of Locular
-               wObjectiveFocalLengthMax- the value of Lmin
-               wObjectiveFocalLengthMin- the value of Lmax
-               iTerminal               - index of string descriptor
-               bAssocTerminal          - id of the output terminal to which
-                                       this terminal is connected
-               wTerminalType           - terminal type
-               bTerminalID             - a non-zero id of this terminal
+
+               ========================  ====================================
+               bmControls                bitmap specifying which controls are
+                                         supported for the video stream
+               wOcularFocalLength        the value of Locular
+               wObjectiveFocalLengthMax  the value of Lmin
+               wObjectiveFocalLengthMin  the value of Lmax
+               iTerminal                 index of string descriptor
+               bAssocTerminal            id of the output terminal to which
+                                         this terminal is connected
+               wTerminalType             terminal type
+               bTerminalID               a non-zero id of this terminal
+               ========================  ====================================
 
 What:          /config/usb-gadget/gadget/functions/uvc.name/control/processing
 Date:          Dec 2014
@@ -88,13 +99,16 @@ KernelVersion:      4.0
 Description:   Default processing unit descriptors
 
                All attributes read only:
-               iProcessing     - index of string descriptor
-               bmControls      - bitmap specifying which controls are
+
+               =============== ========================================
+               iProcessing     index of string descriptor
+               bmControls      bitmap specifying which controls are
                                supported for the video stream
-               wMaxMultiplier  maximum digital magnification x100
-               bSourceID       id of the terminal to which this unit is
+               wMaxMultiplier  maximum digital magnification x100
+               bSourceID       id of the terminal to which this unit is
                                connected
-               bUnitID         - a non-zero id of this unit
+               bUnitID         a non-zero id of this unit
+               =============== ========================================
 
 What:          /config/usb-gadget/gadget/functions/uvc.name/control/header
 Date:          Dec 2014
@@ -114,8 +128,11 @@ KernelVersion:     4.0
 Description:   Streaming descriptors
 
                All attributes read only:
-               bInterfaceNumber        - USB interface number for this
-                                         streaming interface
+
+               ================        =============================
+               bInterfaceNumber        USB interface number for this
+                                       streaming interface
+               ================        =============================
 
 What:          /config/usb-gadget/gadget/functions/uvc.name/streaming/class
 Date:          Dec 2014
@@ -148,13 +165,16 @@ KernelVersion:    4.0
 Description:   Default color matching descriptors
 
                All attributes read only:
-               bMatrixCoefficients     - matrix used to compute luma and
-                                       chroma values from the color primaries
-               bTransferCharacteristics- optoelectronic transfer
-                                       characteristic of the source picutre,
-                                       also called the gamma function
-               bColorPrimaries         - color primaries and the reference
-                                       white
+
+               ========================  ======================================
+               bMatrixCoefficients       matrix used to compute luma and
+                                         chroma values from the color primaries
+               bTransferCharacteristics  optoelectronic transfer
+                                         characteristic of the source picutre,
+                                         also called the gamma function
+               bColorPrimaries           color primaries and the reference
+                                         white
+               ========================  ======================================
 
 What:          /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg
 Date:          Dec 2014
@@ -168,47 +188,52 @@ Description:      Specific MJPEG format descriptors
 
                All attributes read only,
                except bmaControls and bDefaultFrameIndex:
-               bFormatIndex            - unique id for this format descriptor;
+
+               ===================     =====================================
+               bFormatIndex            unique id for this format descriptor;
                                        only defined after parent header is
                                        linked into the streaming class;
                                        read-only
-               bmaControls             this format's data for bmaControls in
+               bmaControls             this format's data for bmaControls in
                                        the streaming header
-               bmInterfaceFlags        specifies interlace information,
+               bmInterfaceFlags        specifies interlace information,
                                        read-only
-               bAspectRatioY           the X dimension of the picture aspect
+               bAspectRatioY           the X dimension of the picture aspect
                                        ratio, read-only
-               bAspectRatioX           the Y dimension of the picture aspect
+               bAspectRatioX           the Y dimension of the picture aspect
                                        ratio, read-only
-               bmFlags                 characteristics of this format,
+               bmFlags                 characteristics of this format,
                                        read-only
-               bDefaultFrameIndex      - optimum frame index for this stream
+               bDefaultFrameIndex      optimum frame index for this stream
+               ===================     =====================================
 
 What:          /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name/name
 Date:          Dec 2014
 KernelVersion: 4.0
 Description:   Specific MJPEG frame descriptors
 
-               bFrameIndex             - unique id for this framedescriptor;
-                                       only defined after parent format is
-                                       linked into the streaming header;
-                                       read-only
-               dwFrameInterval         - indicates how frame interval can be
-                                       programmed; a number of values
-                                       separated by newline can be specified
-               dwDefaultFrameInterval  - the frame interval the device would
-                                       like to use as default
-               dwMaxVideoFrameBufferSize- the maximum number of bytes the
-                                       compressor will produce for a video
-                                       frame or still image
-               dwMaxBitRate            - the maximum bit rate at the shortest
-                                       frame interval in bps
-               dwMinBitRate            - the minimum bit rate at the longest
-                                       frame interval in bps
-               wHeight                 - height of decoded bitmap frame in px
-               wWidth                  - width of decoded bitmam frame in px
-               bmCapabilities          - still image support, fixed frame-rate
-                                       support
+               =========================  =====================================
+               bFrameIndex                unique id for this framedescriptor;
+                                          only defined after parent format is
+                                          linked into the streaming header;
+                                          read-only
+               dwFrameInterval            indicates how frame interval can be
+                                          programmed; a number of values
+                                          separated by newline can be specified
+               dwDefaultFrameInterval     the frame interval the device would
+                                          like to use as default
+               dwMaxVideoFrameBufferSize  the maximum number of bytes the
+                                          compressor will produce for a video
+                                          frame or still image
+               dwMaxBitRate               the maximum bit rate at the shortest
+                                          frame interval in bps
+               dwMinBitRate               the minimum bit rate at the longest
+                                          frame interval in bps
+               wHeight                    height of decoded bitmap frame in px
+               wWidth                     width of decoded bitmam frame in px
+               bmCapabilities             still image support, fixed frame-rate
+                                          support
+               =========================  =====================================
 
 What:          /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed
 Date:          Dec 2014
@@ -220,50 +245,54 @@ Date:             Dec 2014
 KernelVersion: 4.0
 Description:   Specific uncompressed format descriptors
 
-               bFormatIndex            - unique id for this format descriptor;
+               ==================      =======================================
+               bFormatIndex            unique id for this format descriptor;
                                        only defined after parent header is
                                        linked into the streaming class;
                                        read-only
-               bmaControls             this format's data for bmaControls in
+               bmaControls             this format's data for bmaControls in
                                        the streaming header
-               bmInterfaceFlags        specifies interlace information,
+               bmInterfaceFlags        specifies interlace information,
                                        read-only
-               bAspectRatioY           the X dimension of the picture aspect
+               bAspectRatioY           the X dimension of the picture aspect
                                        ratio, read-only
-               bAspectRatioX           the Y dimension of the picture aspect
+               bAspectRatioX           the Y dimension of the picture aspect
                                        ratio, read-only
-               bDefaultFrameIndex      optimum frame index for this stream
-               bBitsPerPixel           number of bits per pixel used to
+               bDefaultFrameIndex      optimum frame index for this stream
+               bBitsPerPixel           number of bits per pixel used to
                                        specify color in the decoded video
                                        frame
-               guidFormat              globally unique id used to identify
+               guidFormat              globally unique id used to identify
                                        stream-encoding format
+               ==================      =======================================
 
 What:          /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name/name
 Date:          Dec 2014
 KernelVersion: 4.0
 Description:   Specific uncompressed frame descriptors
 
-               bFrameIndex             - unique id for this framedescriptor;
-                                       only defined after parent format is
-                                       linked into the streaming header;
-                                       read-only
-               dwFrameInterval         - indicates how frame interval can be
-                                       programmed; a number of values
-                                       separated by newline can be specified
-               dwDefaultFrameInterval  - the frame interval the device would
-                                       like to use as default
-               dwMaxVideoFrameBufferSize- the maximum number of bytes the
-                                       compressor will produce for a video
-                                       frame or still image
-               dwMaxBitRate            - the maximum bit rate at the shortest
-                                       frame interval in bps
-               dwMinBitRate            - the minimum bit rate at the longest
-                                       frame interval in bps
-               wHeight                 - height of decoded bitmap frame in px
-               wWidth                  - width of decoded bitmam frame in px
-               bmCapabilities          - still image support, fixed frame-rate
-                                       support
+               =========================  =====================================
+               bFrameIndex                unique id for this framedescriptor;
+                                          only defined after parent format is
+                                          linked into the streaming header;
+                                          read-only
+               dwFrameInterval            indicates how frame interval can be
+                                          programmed; a number of values
+                                          separated by newline can be specified
+               dwDefaultFrameInterval     the frame interval the device would
+                                          like to use as default
+               dwMaxVideoFrameBufferSize  the maximum number of bytes the
+                                          compressor will produce for a video
+                                          frame or still image
+               dwMaxBitRate               the maximum bit rate at the shortest
+                                          frame interval in bps
+               dwMinBitRate               the minimum bit rate at the longest
+                                          frame interval in bps
+               wHeight                    height of decoded bitmap frame in px
+               wWidth                     width of decoded bitmam frame in px
+               bmCapabilities             still image support, fixed frame-rate
+                                          support
+               =========================  =====================================
 
 What:          /config/usb-gadget/gadget/functions/uvc.name/streaming/header
 Date:          Dec 2014
@@ -276,17 +305,20 @@ KernelVersion:    4.0
 Description:   Specific streaming header descriptors
 
                All attributes read only:
-               bTriggerUsage           - how the host software will respond to
+
+               ====================    =====================================
+               bTriggerUsage           how the host software will respond to
                                        a hardware trigger interrupt event
-               bTriggerSupport         flag specifying if hardware
+               bTriggerSupport         flag specifying if hardware
                                        triggering is supported
-               bStillCaptureMethod     method of still image caputre
+               bStillCaptureMethod     method of still image caputre
                                        supported
-               bTerminalLink           id of the output terminal to which
+               bTerminalLink           id of the output terminal to which
                                        the video endpoint of this interface
                                        is connected
-               bmInfo                  capabilities of this video streaming
+               bmInfo                  capabilities of this video streaming
                                        interface
+               ====================    =====================================
 
 What:          /sys/class/udc/udc.name/device/gadget/video4linux/video.name/function_name
 Date:          May 2018
index 5afcd78..8debcb0 100644 (file)
@@ -23,7 +23,7 @@ error injections without having to know the details of the driver-specific
 commands.
 
 Note that the output of 'error-inj' shall be valid as input to 'error-inj'.
-So this must work:
+So this must work::
 
        $ cat error-inj >einj.txt
        $ cat einj.txt >error-inj
index 2e9ae31..c5d678d 100644 (file)
@@ -20,9 +20,13 @@ Description:    Allow the root user to disable/enable in runtime the clock
                 The user can supply a bitmask value, each bit represents
                 a different engine to disable/enable its clock gating feature.
                 The bitmask is composed of 20 bits:
-                0  -  7 : DMA channels
-                8  - 11 : MME engines
-                12 - 19 : TPC engines
+
+               =======   ============
+                0  -  7   DMA channels
+                8  - 11   MME engines
+                12 - 19   TPC engines
+               =======   ============
+
                 The bit's location of a specific engine can be determined
                 using (1 << GAUDI_ENGINE_ID_*). GAUDI_ENGINE_ID_* values
                 are defined in uapi habanalabs.h file in enum gaudi_engine_id
@@ -59,6 +63,7 @@ Description:    Allows the root user to read or write directly through the
                 the generic Linux user-space PCI mapping) because the DDR bar
                 is very small compared to the DDR memory and only the driver can
                 move the bar before and after the transaction.
+
                 If the IOMMU is disabled, it also allows the root user to read
                 or write from the host a device VA of a host mapped memory
 
@@ -73,6 +78,7 @@ Description:    Allows the root user to read or write 64 bit data directly
                 the generic Linux user-space PCI mapping) because the DDR bar
                 is very small compared to the DDR memory and only the driver can
                 move the bar before and after the transaction.
+
                 If the IOMMU is disabled, it also allows the root user to read
                 or write from the host a device VA of a host mapped memory
 
index 6546115..ab6099d 100644 (file)
@@ -6,7 +6,7 @@ Description:
 General information like which GPE is assigned to the EC and whether
 the global lock should get used.
 Knowing the EC GPE one can watch the amount of HW events related to
-the EC here (XY -> GPE number from /sys/kernel/debug/ec/*/gpe):
+the EC here (XY -> GPE number from `/sys/kernel/debug/ec/*/gpe`):
 /sys/firmware/acpi/interrupts/gpeXY
 
 The io file is binary and a userspace tool located here:
@@ -14,7 +14,8 @@ ftp://ftp.suse.com/pub/people/trenn/sources/ec/
 should get used to read out the 256 Embedded Controller registers
 or writing to them.
 
-CAUTION: Do not write to the Embedded Controller if you don't know
-what you are doing! Rebooting afterwards also is a good idea.
-This can influence the way your machine is cooled and fans may
-not get switched on again after you did a wrong write.
+CAUTION:
+  Do not write to the Embedded Controller if you don't know
+  what you are doing! Rebooting afterwards also is a good idea.
+  This can influence the way your machine is cooled and fans may
+  not get switched on again after you did a wrong write.
index 67b1717..6eee10c 100644 (file)
@@ -2,13 +2,19 @@ What:         /sys/kernel/debug/moxtet/input
 Date:          March 2019
 KernelVersion: 5.3
 Contact:       Marek Behún <marek.behun@nic.cz>
-Description:   (R) Read input from the shift registers, in hexadecimal.
+Description:   (Read) Read input from the shift registers, in hexadecimal.
                Returns N+1 bytes, where N is the number of Moxtet connected
                modules. The first byte is from the CPU board itself.
-               Example: 101214
-                        10: CPU board with SD card
-                        12: 2 = PCIe module, 1 = IRQ not active
-                        14: 4 = Peridot module, 1 = IRQ not active
+
+               Example::
+
+                       101214
+
+               ==  =======================================
+               10  CPU board with SD card
+               12  2 = PCIe module, 1 = IRQ not active
+               14  4 = Peridot module, 1 = IRQ not active
+               ==  =======================================
 
 What:          /sys/kernel/debug/moxtet/output
 Date:          March 2019
@@ -17,7 +23,13 @@ Contact:     Marek Behún <marek.behun@nic.cz>
 Description:   (RW) Read last written value to the shift registers, in
                hexadecimal, or write values to the shift registers, also
                in hexadecimal.
-               Example: 0102
-                        01: 01 was last written, or is to be written, to the
-                            first module's shift register
-                        02: the same for second module
+
+               Example::
+
+                   0102
+
+               ==  ================================================
+               01  01 was last written, or is to be written, to the
+                   first module's shift register
+               02  the same for second module
+               ==  ================================================
index 685d5a4..f75a655 100644 (file)
@@ -4,42 +4,42 @@ KernelVersion:        3.4
 Contact:       Kent Yoder <key@linux.vnet.ibm.com>
 Description:
 
-  These debugfs interfaces are built by the nx-crypto driver, built in
+These debugfs interfaces are built by the nx-crypto driver, built in
 arch/powerpc/crypto/nx.
 
 Error Detection
 ===============
 
 errors:
-- A u32 providing a total count of errors since the driver was loaded. The
-only errors counted here are those returned from the hcall, H_COP_OP.
+  A u32 providing a total count of errors since the driver was loaded. The
+  only errors counted here are those returned from the hcall, H_COP_OP.
 
 last_error:
-- The most recent non-zero return code from the H_COP_OP hcall. -EBUSY is not
-recorded here (the hcall will retry until -EBUSY goes away).
+  The most recent non-zero return code from the H_COP_OP hcall. -EBUSY is not
+  recorded here (the hcall will retry until -EBUSY goes away).
 
 last_error_pid:
-- The process ID of the process who received the most recent error from the
-hcall.
+  The process ID of the process who received the most recent error from the
+  hcall.
 
 Device Use
 ==========
 
 aes_bytes:
-- The total number of bytes encrypted using AES in any of the driver's
-supported modes.
+  The total number of bytes encrypted using AES in any of the driver's
+  supported modes.
 
 aes_ops:
-- The total number of AES operations submitted to the hardware.
+  The total number of AES operations submitted to the hardware.
 
 sha256_bytes:
-- The total number of bytes hashed by the hardware using SHA-256.
+  The total number of bytes hashed by the hardware using SHA-256.
 
 sha256_ops:
-- The total number of SHA-256 operations submitted to the hardware.
+  The total number of SHA-256 operations submitted to the hardware.
 
 sha512_bytes:
-- The total number of bytes hashed by the hardware using SHA-512.
+  The total number of bytes hashed by the hardware using SHA-512.
 
 sha512_ops:
-- The total number of SHA-512 operations submitted to the hardware.
+  The total number of SHA-512 operations submitted to the hardware.
index cf11736..f6f65a4 100644 (file)
@@ -4,16 +4,15 @@ KernelVersion:  2.6.20
 Contact:        Thomas Maier <balagi@justmail.de>
 Description:
 
-debugfs interface
------------------
-
 The pktcdvd module (packet writing driver) creates
 these files in debugfs:
 
 /sys/kernel/debug/pktcdvd/pktcdvd[0-7]/
-    info            (0444) Lots of driver statistics and infos.
 
-Example:
--------
+    ====            ====== ====================================
+    info            0444   Lots of driver statistics and infos.
+    ====            ====== ====================================
+
+Example::
 
-cat /sys/kernel/debug/pktcdvd/pktcdvd0/info
+    cat /sys/kernel/debug/pktcdvd/pktcdvd0/info
index 2b3255e..326df1b 100644 (file)
@@ -2,8 +2,13 @@ What:          /sys/kernel/debug/turris-mox-rwtm/do_sign
 Date:          Jun 2020
 KernelVersion: 5.8
 Contact:       Marek Behún <marek.behun@nic.cz>
-Description:   (W) Message to sign with the ECDSA private key stored in
-                   device's OTP. The message must be exactly 64 bytes (since
-                   this is intended for SHA-512 hashes).
-               (R) The resulting signature, 136 bytes. This contains the R and
-                   S values of the ECDSA signature, both in big-endian format.
+Description:
+
+               ======= ===========================================================
+               (Write) Message to sign with the ECDSA private key stored in
+                       device's OTP. The message must be exactly 64 bytes
+                       (since this is intended for SHA-512 hashes).
+               (Read)  The resulting signature, 136 bytes. This contains the
+                       R and S values of the ECDSA signature, both in
+                       big-endian format.
+               ======= ===========================================================
index 9d8d9d2..682e3c0 100644 (file)
@@ -27,16 +27,17 @@ Description:
                for writing, two for the type and at least a single byte of
                data.
 
-               Example:
-               // Request EC info type 3 (EC firmware build date)
-               // Corresponds with sending type 0x00f0 with
-               // MBOX = [38, 00, 03, 00]
-               $ echo 00 f0 38 00 03 00 > /sys/kernel/debug/wilco_ec/raw
-               // View the result. The decoded ASCII result "12/21/18" is
-               // included after the raw hex.
-               // Corresponds with MBOX = [00, 00, 31, 32, 2f, 32, 31, 38, ...]
-               $ cat /sys/kernel/debug/wilco_ec/raw
-               00 00 31 32 2f 32 31 2f 31 38 00 38 00 01 00 2f 00  ..12/21/18.8...
+               Example::
+
+                   // Request EC info type 3 (EC firmware build date)
+                   // Corresponds with sending type 0x00f0 with
+                   // MBOX = [38, 00, 03, 00]
+                   $ echo 00 f0 38 00 03 00 > /sys/kernel/debug/wilco_ec/raw
+                   // View the result. The decoded ASCII result "12/21/18" is
+                   // included after the raw hex.
+                   // Corresponds with MBOX = [00, 00, 31, 32, 2f, 32, 31, 38, ...]
+                   $ cat /sys/kernel/debug/wilco_ec/raw
+                   00 00 31 32 2f 32 31 2f 31 38 00 38 00 01 00 2f 00  ..12/21/18.8...
 
                Note that the first 16 bytes of the received MBOX[] will be
                printed, even if some of the data is junk, and skipping bytes
index fc919ce..5f3a0dc 100644 (file)
@@ -10,29 +10,29 @@ Description:
                <uapi/linux/wmi.h>
 
                1) To perform an SMBIOS call from userspace, you'll need to
-               first determine the minimum size of the calling interface
-               buffer for your machine.
-               Platforms that contain larger buffers can return larger
-               objects from the system firmware.
-               Commonly this size is either 4k or 32k.
+                  first determine the minimum size of the calling interface
+                  buffer for your machine.
+                  Platforms that contain larger buffers can return larger
+                  objects from the system firmware.
+                  Commonly this size is either 4k or 32k.
 
-               To determine the size of the buffer read() a u64 dword from
-               the WMI character device /dev/wmi/dell-smbios.
+                  To determine the size of the buffer read() a u64 dword from
+                  the WMI character device /dev/wmi/dell-smbios.
 
                2) After you've determined the minimum size of the calling
-               interface buffer, you can allocate a structure that represents
-               the structure documented above.
+                  interface buffer, you can allocate a structure that represents
+                  the structure documented above.
 
                3) In the 'length' object store the size of the buffer you
-               determined above and allocated.
+                  determined above and allocated.
 
                4) In this buffer object, prepare as necessary for the SMBIOS
-               call you're interested in.  Typically SMBIOS buffers have
-               "class", "select", and "input" defined to values that coincide
-               with the data you are interested in.
-               Documenting class/select/input values is outside of the scope
-               of this documentation. Check with the libsmbios project for
-               further documentation on these values.
+                  call you're interested in.  Typically SMBIOS buffers have
+                  "class", "select", and "input" defined to values that coincide
+                  with the data you are interested in.
+                  Documenting class/select/input values is outside of the scope
+                  of this documentation. Check with the libsmbios project for
+                  further documentation on these values.
 
                6) Run the call by using ioctl() as described in the header.
 
index 3c0bb76..a377b6c 100644 (file)
@@ -6,6 +6,7 @@ Description:    The /dev/kmsg character device node provides userspace access
                to the kernel's printk buffer.
 
                Injecting messages:
+
                Every write() to the opened device node places a log entry in
                the kernel's printk buffer.
 
@@ -21,6 +22,7 @@ Description:  The /dev/kmsg character device node provides userspace access
                the messages can always be reliably determined.
 
                Accessing the buffer:
+
                Every read() from the opened device node receives one record
                of the kernel's printk buffer.
 
@@ -48,6 +50,7 @@ Description:  The /dev/kmsg character device node provides userspace access
                if needed, without limiting the interface to a single reader.
 
                The device supports seek with the following parameters:
+
                SEEK_SET, 0
                  seek to the first entry in the buffer
                SEEK_END, 0
@@ -87,18 +90,22 @@ Description:        The /dev/kmsg character device node provides userspace access
                readable context of the message, for reliable processing in
                userspace.
 
-               Example:
-               7,160,424069,-;pci_root PNP0A03:00: host bridge window [io  0x0000-0x0cf7] (ignored)
-                SUBSYSTEM=acpi
-                DEVICE=+acpi:PNP0A03:00
-               6,339,5140900,-;NET: Registered protocol family 10
-               30,340,5690716,-;udevd[80]: starting version 181
+               Example::
+
+                 7,160,424069,-;pci_root PNP0A03:00: host bridge window [io  0x0000-0x0cf7] (ignored)
+                  SUBSYSTEM=acpi
+                  DEVICE=+acpi:PNP0A03:00
+                 6,339,5140900,-;NET: Registered protocol family 10
+                 30,340,5690716,-;udevd[80]: starting version 181
 
                The DEVICE= key uniquely identifies devices the following way:
-                 b12:8        - block dev_t
-                 c127:3       - char dev_t
-                 n8           - netdev ifindex
-                 +sound:card0 - subsystem:devname
+
+                 ============  =================
+                 b12:8         block dev_t
+                 c127:3        char dev_t
+                 n8            netdev ifindex
+                 +sound:card0  subsystem:devname
+                 ============  =================
 
                The flags field carries '-' by default. A 'c' indicates a
                fragment of a line. Note, that these hints about continuation
index 201d103..3c477ba 100644 (file)
@@ -17,26 +17,33 @@ Description:
                echoing a value to <securityfs>/evm made up of the
                following bits:
 
+               ===       ==================================================
                Bit       Effect
+               ===       ==================================================
                0         Enable HMAC validation and creation
                1         Enable digital signature validation
                2         Permit modification of EVM-protected metadata at
                          runtime. Not supported if HMAC validation and
                          creation is enabled.
                31        Disable further runtime modification of EVM policy
+               ===       ==================================================
 
-               For example:
+               For example::
 
-               echo 1 ><securityfs>/evm
+                 echo 1 ><securityfs>/evm
 
                will enable HMAC validation and creation
 
-               echo 0x80000003 ><securityfs>/evm
+               ::
+
+                 echo 0x80000003 ><securityfs>/evm
 
                will enable HMAC and digital signature validation and
                HMAC creation and disable all further modification of policy.
 
-               echo 0x80000006 ><securityfs>/evm
+               ::
+
+                 echo 0x80000006 ><securityfs>/evm
 
                will enable digital signature validation, permit
                modification of EVM-protected metadata and
@@ -65,7 +72,7 @@ Description:
                Shows the set of extended attributes used to calculate or
                validate the EVM signature, and allows additional attributes
                to be added at runtime. Any signatures generated after
-               additional attributes are added (and on files posessing those
+               additional attributes are added (and on files possessing those
                additional attributes) will only be valid if the same
                additional attributes are configured on system boot. Writing
                a single period (.) will lock the xattr list from any further
index 7b265fb..66bdcd1 100644 (file)
@@ -12,15 +12,16 @@ Description:
                The following file operations are supported:
 
                open(2)
-               Currently the only useful flags are O_RDWR.
+                 Currently the only useful flags are O_RDWR.
 
                ioctl(2)
-               Initiate various actions.
-               See the inline documentation in [include/uapi]<linux/gpio.h>
-               for descriptions of all ioctls.
+                 Initiate various actions.
+
+                 See the inline documentation in [include/uapi]<linux/gpio.h>
+                 for descriptions of all ioctls.
 
                close(2)
-               Stops and free up the I/O contexts that was associated
-               with the file descriptor.
+                 Stops and free up the I/O contexts that was associated
+                 with the file descriptor.
 
 Users:         TBD
index cd57291..e35263f 100644 (file)
@@ -15,19 +15,22 @@ Description:
                IMA appraisal, if configured, uses these file measurements
                for local measurement appraisal.
 
-               rule format: action [condition ...]
+               ::
 
-               action: measure | dont_measure | appraise | dont_appraise |
-                       audit | hash | dont_hash
-               condition:= base | lsm  [option]
+                 rule format: action [condition ...]
+
+                 action: measure | dont_measure | appraise | dont_appraise |
+                         audit | hash | dont_hash
+                 condition:= base | lsm  [option]
                        base:   [[func=] [mask=] [fsmagic=] [fsuuid=] [uid=]
                                [euid=] [fowner=] [fsname=]]
                        lsm:    [[subj_user=] [subj_role=] [subj_type=]
                                 [obj_user=] [obj_role=] [obj_type=]]
                        option: [[appraise_type=]] [template=] [permit_directio]
                                [appraise_flag=] [keyrings=]
-               base:   func:= [BPRM_CHECK][MMAP_CHECK][CREDS_CHECK][FILE_CHECK][MODULE_CHECK]
-                               [FIRMWARE_CHECK]
+                 base:
+                       func:= [BPRM_CHECK][MMAP_CHECK][CREDS_CHECK][FILE_CHECK]MODULE_CHECK]
+                               [FIRMWARE_CHECK]
                                [KEXEC_KERNEL_CHECK] [KEXEC_INITRAMFS_CHECK]
                                [KEXEC_CMDLINE] [KEY_CHECK]
                        mask:= [[^]MAY_READ] [[^]MAY_WRITE] [[^]MAY_APPEND]
@@ -37,8 +40,9 @@ Description:
                        uid:= decimal value
                        euid:= decimal value
                        fowner:= decimal value
-               lsm:    are LSM specific
-               option: appraise_type:= [imasig] [imasig|modsig]
+                 lsm:  are LSM specific
+                 option:
+                       appraise_type:= [imasig] [imasig|modsig]
                        appraise_flag:= [check_blacklist]
                        Currently, blacklist check is only for files signed with appended
                        signature.
@@ -49,7 +53,7 @@ Description:
                        (eg, ima-ng). Only valid when action is "measure".
                        pcr:= decimal value
 
-               default policy:
+                 default policy:
                        # PROC_SUPER_MAGIC
                        dont_measure fsmagic=0x9fa0
                        dont_appraise fsmagic=0x9fa0
@@ -97,7 +101,8 @@ Description:
 
                Examples of LSM specific definitions:
 
-               SELinux:
+               SELinux::
+
                        dont_measure obj_type=var_log_t
                        dont_appraise obj_type=var_log_t
                        dont_measure obj_type=auditd_log_t
@@ -105,10 +110,11 @@ Description:
                        measure subj_user=system_u func=FILE_CHECK mask=MAY_READ
                        measure subj_role=system_r func=FILE_CHECK mask=MAY_READ
 
-               Smack:
+               Smack::
+
                        measure subj_user=_ func=FILE_CHECK mask=MAY_READ
 
-               Example of measure rules using alternate PCRs:
+               Example of measure rules using alternate PCRs::
 
                        measure func=KEXEC_KERNEL_CHECK pcr=4
                        measure func=KEXEC_INITRAMFS_CHECK pcr=5
index 70dcaf2..e58d641 100644 (file)
@@ -6,32 +6,38 @@ Description:
                of block devices. Each line contains the following 14
                fields:
 
-                1 - major number
-                2 - minor mumber
-                3 - device name
-                4 - reads completed successfully
-                5 - reads merged
-                6 - sectors read
-                7 - time spent reading (ms)
-                8 - writes completed
-                9 - writes merged
-               10 - sectors written
-               11 - time spent writing (ms)
-               12 - I/Os currently in progress
-               13 - time spent doing I/Os (ms)
-               14 - weighted time spent doing I/Os (ms)
+               ==  ===================================
+                1  major number
+                2  minor mumber
+                3  device name
+                4  reads completed successfully
+                5  reads merged
+                6  sectors read
+                7  time spent reading (ms)
+                8  writes completed
+                9  writes merged
+               10  sectors written
+               11  time spent writing (ms)
+               12  I/Os currently in progress
+               13  time spent doing I/Os (ms)
+               14  weighted time spent doing I/Os (ms)
+               ==  ===================================
 
                Kernel 4.18+ appends four more fields for discard
                tracking putting the total at 18:
 
-               15 - discards completed successfully
-               16 - discards merged
-               17 - sectors discarded
-               18 - time spent discarding
+               ==  ===================================
+               15  discards completed successfully
+               16  discards merged
+               17  sectors discarded
+               18  time spent discarding
+               ==  ===================================
 
                Kernel 5.5+ appends two more fields for flush requests:
 
-               19 - flush requests completed successfully
-               20 - time spent flushing
+               ==  =====================================
+               19  flush requests completed successfully
+               20  time spent flushing
+               ==  =====================================
 
                For more details refer to Documentation/admin-guide/iostats.rst
index 0469781..a4e31c4 100644 (file)
@@ -14,28 +14,28 @@ Description:
                For more details, see Documentation/filesystems/proc.rst
                and the procfs man page.
 
-               Typical output looks like this:
+               Typical output looks like this::
 
-               00100000-ff709000 ---p 00000000 00:00 0          [rollup]
-               Size:               1192 kB
-               KernelPageSize:        4 kB
-               MMUPageSize:           4 kB
-               Rss:                 884 kB
-               Pss:                 385 kB
-               Pss_Anon:            301 kB
-               Pss_File:             80 kB
-               Pss_Shmem:             4 kB
-               Shared_Clean:        696 kB
-               Shared_Dirty:          0 kB
-               Private_Clean:       120 kB
-               Private_Dirty:        68 kB
-               Referenced:          884 kB
-               Anonymous:            68 kB
-               LazyFree:              0 kB
-               AnonHugePages:         0 kB
-               ShmemPmdMapped:        0 kB
-               Shared_Hugetlb:        0 kB
-               Private_Hugetlb:       0 kB
-               Swap:                  0 kB
-               SwapPss:               0 kB
-               Locked:              385 kB
+                       00100000-ff709000 ---p 00000000 00:00 0          [rollup]
+                       Size:               1192 kB
+                       KernelPageSize:        4 kB
+                       MMUPageSize:           4 kB
+                       Rss:                 884 kB
+                       Pss:                 385 kB
+                       Pss_Anon:            301 kB
+                       Pss_File:             80 kB
+                       Pss_Shmem:             4 kB
+                       Shared_Clean:        696 kB
+                       Shared_Dirty:          0 kB
+                       Private_Clean:       120 kB
+                       Private_Dirty:        68 kB
+                       Referenced:          884 kB
+                       Anonymous:            68 kB
+                       LazyFree:              0 kB
+                       AnonHugePages:         0 kB
+                       ShmemPmdMapped:        0 kB
+                       Shared_Hugetlb:        0 kB
+                       Private_Hugetlb:       0 kB
+                       Swap:                  0 kB
+                       SwapPss:               0 kB
+                       Locked:              385 kB
index d45209a..5b02540 100644 (file)
@@ -9,25 +9,25 @@ Description:  Generic interface to platform dependent persistent storage.
                provide a generic interface to show records captured in
                the dying moments.  In the case of a panic the last part
                of the console log is captured, but other interesting
-               data can also be saved.
+               data can also be saved::
 
-               # mount -t pstore -o kmsg_bytes=8000 - /sys/fs/pstore
+                   # mount -t pstore -o kmsg_bytes=8000 - /sys/fs/pstore
 
-               $ ls -l /sys/fs/pstore/
-               total 0
-               -r--r--r-- 1 root root 7896 Nov 30 15:38 dmesg-erst-1
+                   $ ls -l /sys/fs/pstore/
+                   total 0
+                   -r--r--r-- 1 root root 7896 Nov 30 15:38 dmesg-erst-1
 
                Different users of this interface will result in different
                filename prefixes.  Currently two are defined:
 
-               "dmesg" - saved console log
-               "mce"   - architecture dependent data from fatal h/w error
+               "dmesg" - saved console log
+               "mce"   - architecture dependent data from fatal h/w error
 
                Once the information in a file has been read, removing
                the file will signal to the underlying persistent storage
-               device that it can reclaim the space for later re-use.
+               device that it can reclaim the space for later re-use::
 
-               $ rm /sys/fs/pstore/dmesg-erst-1
+                   $ rm /sys/fs/pstore/dmesg-erst-1
 
                The expectation is that all files in /sys/fs/pstore/
                will be saved elsewhere and erased from persistent store
@@ -44,4 +44,3 @@ Description:  Generic interface to platform dependent persistent storage.
                backends are available, the preferred backend may be
                set by passing the pstore.backend= argument to the kernel at
                boot time.
-
index 2322eb7..e34cdee 100644 (file)
@@ -4,23 +4,27 @@ Contact:      Jerome Marchand <jmarchan@redhat.com>
 Description:
                The /sys/block/<disk>/stat files displays the I/O
                statistics of disk <disk>. They contain 11 fields:
-                1 - reads completed successfully
-                2 - reads merged
-                3 - sectors read
-                4 - time spent reading (ms)
-                5 - writes completed
-                6 - writes merged
-                7 - sectors written
-                8 - time spent writing (ms)
-                9 - I/Os currently in progress
-               10 - time spent doing I/Os (ms)
-               11 - weighted time spent doing I/Os (ms)
-               12 - discards completed
-               13 - discards merged
-               14 - sectors discarded
-               15 - time spent discarding (ms)
-               16 - flush requests completed
-               17 - time spent flushing (ms)
+
+               ==  ==============================================
+                1  reads completed successfully
+                2  reads merged
+                3  sectors read
+                4  time spent reading (ms)
+                5  writes completed
+                6  writes merged
+                7  sectors written
+                8  time spent writing (ms)
+                9  I/Os currently in progress
+               10  time spent doing I/Os (ms)
+               11  weighted time spent doing I/Os (ms)
+               12  discards completed
+               13  discards merged
+               14  sectors discarded
+               15  time spent discarding (ms)
+               16  flush requests completed
+               17  time spent flushing (ms)
+               ==  ==============================================
+
                For more details refer Documentation/admin-guide/iostats.rst
 
 
index 17f2bc7..aa0fb50 100644 (file)
@@ -8,11 +8,13 @@ Description:
 
                It has the following valid values:
 
+               ==      ========================================================
                0       OFF - the LED is not activated on activity
                1       BLINK_ON - the LED blinks on every 10ms when activity is
                        detected.
                2       BLINK_OFF - the LED is on when idle, and blinks off
                        every 10ms when activity is detected.
+               ==      ========================================================
 
                Note that the user must turn sw_activity OFF it they wish to
                control the activity LED via the em_message file.
index 8f070b4..14a6fe9 100644 (file)
@@ -9,9 +9,9 @@ Description:    To unmap a volume, "normal" or "force" has to be written to:
                is using the device.  When "force" is used, the device is also unmapped
                when device is in use.  All I/Os that are in progress will fail.
 
-               Example:
+               Example::
 
-               # echo "normal" > /sys/block/rnbd0/rnbd/unmap_device
+                 # echo "normal" > /sys/block/rnbd0/rnbd/unmap_device
 
 What:          /sys/block/rnbd<N>/rnbd/state
 Date:          Feb 2020
index e7898cf..58abacf 100644 (file)
@@ -5,6 +5,7 @@ Description:
                This attribute indicates the full path of ACPI namespace
                object associated with the device object.  For example,
                \_SB_.PCI0.
+
                This file is not present for device objects representing
                fixed ACPI hardware features (like power and sleep
                buttons).
@@ -67,14 +68,16 @@ Description:
                The return value is a decimal integer representing the device's
                status bitmap:
 
-               Bit [0] –  Set if the device is present.
-               Bit [1] –  Set if the device is enabled and decoding its
-                          resources.
-               Bit [2] –  Set if the device should be shown in the UI.
-               Bit [3] –  Set if the device is functioning properly (cleared if
-                          device failed its diagnostics).
-               Bit [4] –  Set if the battery is present.
-               Bits [31:5] –  Reserved (must be cleared)
+               ===========  ==================================================
+               Bit [0]      Set if the device is present.
+               Bit [1]      Set if the device is enabled and decoding its
+                            resources.
+               Bit [2]      Set if the device should be shown in the UI.
+               Bit [3]      Set if the device is functioning properly (cleared
+                            if device failed its diagnostics).
+               Bit [4]      Set if the battery is present.
+               Bits [31:5]  Reserved (must be cleared)
+               ===========  ==================================================
 
                If bit [0] is clear, then bit 1 must also be clear (a device
                that is not present cannot be enabled).
index 9d11502..bf2869c 100644 (file)
@@ -8,50 +8,50 @@ What:         /sys/bus/coresight/devices/<cti-name>/powered
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) Indicate if the CTI hardware is powered.
+Description:   (Read) Indicate if the CTI hardware is powered.
 
 What:          /sys/bus/coresight/devices/<cti-name>/ctmid
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) Display the associated CTM ID
+Description:   (Read) Display the associated CTM ID
 
 What:          /sys/bus/coresight/devices/<cti-name>/nr_trigger_cons
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) Number of devices connected to triggers on this CTI
+Description:   (Read) Number of devices connected to triggers on this CTI
 
 What:          /sys/bus/coresight/devices/<cti-name>/triggers<N>/name
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) Name of connected device <N>
+Description:   (Read) Name of connected device <N>
 
 What:          /sys/bus/coresight/devices/<cti-name>/triggers<N>/in_signals
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) Input trigger signals from connected device <N>
+Description:   (Read) Input trigger signals from connected device <N>
 
 What:          /sys/bus/coresight/devices/<cti-name>/triggers<N>/in_types
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) Functional types for the input trigger signals
+Description:   (Read) Functional types for the input trigger signals
                from connected device <N>
 
 What:          /sys/bus/coresight/devices/<cti-name>/triggers<N>/out_signals
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) Output trigger signals to connected device <N>
+Description:   (Read) Output trigger signals to connected device <N>
 
 What:          /sys/bus/coresight/devices/<cti-name>/triggers<N>/out_types
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) Functional types for the output trigger signals
+Description:   (Read) Functional types for the output trigger signals
                to connected device <N>
 
 What:          /sys/bus/coresight/devices/<cti-name>/regs/inout_sel
@@ -88,7 +88,7 @@ What:         /sys/bus/coresight/devices/<cti-name>/regs/intack
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (W) Write the INTACK register.
+Description:   (Write) Write the INTACK register.
 
 What:          /sys/bus/coresight/devices/<cti-name>/regs/appset
 Date:          March 2020
@@ -101,99 +101,99 @@ What:             /sys/bus/coresight/devices/<cti-name>/regs/appclear
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (W) Write APPCLEAR register to deactivate channel.
+Description:   (Write) Write APPCLEAR register to deactivate channel.
 
 What:          /sys/bus/coresight/devices/<cti-name>/regs/apppulse
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (W) Write APPPULSE to pulse a channel active for one clock
+Description:   (Write) Write APPPULSE to pulse a channel active for one clock
                cycle.
 
 What:          /sys/bus/coresight/devices/<cti-name>/regs/chinstatus
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) Read current status of channel inputs.
+Description:   (Read) Read current status of channel inputs.
 
 What:          /sys/bus/coresight/devices/<cti-name>/regs/choutstatus
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) read current status of channel outputs.
+Description:   (Read) read current status of channel outputs.
 
 What:          /sys/bus/coresight/devices/<cti-name>/regs/triginstatus
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) read current status of input trigger signals
+Description:   (Read) read current status of input trigger signals
 
 What:          /sys/bus/coresight/devices/<cti-name>/regs/trigoutstatus
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) read current status of output trigger signals.
+Description:   (Read) read current status of output trigger signals.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/trigin_attach
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (W) Attach a CTI input trigger to a CTM channel.
+Description:   (Write) Attach a CTI input trigger to a CTM channel.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/trigin_detach
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (W) Detach a CTI input trigger from a CTM channel.
+Description:   (Write) Detach a CTI input trigger from a CTM channel.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/trigout_attach
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (W) Attach a CTI output trigger to a CTM channel.
+Description:   (Write) Attach a CTI output trigger to a CTM channel.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/trigout_detach
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (W) Detach a CTI output trigger from a CTM channel.
+Description:   (Write) Detach a CTI output trigger from a CTM channel.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/chan_gate_enable
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (RW) Enable CTIGATE for single channel (W) or list enabled
+Description:   (RW) Enable CTIGATE for single channel (Write) or list enabled
                channels through the gate (R).
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/chan_gate_disable
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (W) Disable CTIGATE for single channel.
+Description:   (Write) Disable CTIGATE for single channel.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/chan_set
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (W) Activate a single channel.
+Description:   (Write) Activate a single channel.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/chan_clear
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (W) Deactivate a single channel.
+Description:   (Write) Deactivate a single channel.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/chan_pulse
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (W) Pulse a single channel - activate for a single clock cycle.
+Description:   (Write) Pulse a single channel - activate for a single clock cycle.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/trigout_filtered
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) List of output triggers filtered across all connections.
+Description:   (Read) List of output triggers filtered across all connections.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/trig_filter_enable
 Date:          March 2020
@@ -205,13 +205,13 @@ What:             /sys/bus/coresight/devices/<cti-name>/channels/chan_inuse
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) show channels with at least one attached trigger signal.
+Description:   (Read) show channels with at least one attached trigger signal.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/chan_free
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) show channels with no attached trigger signals.
+Description:   (Read) show channels with no attached trigger signals.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/chan_xtrigs_sel
 Date:          March 2020
@@ -224,18 +224,18 @@ What:             /sys/bus/coresight/devices/<cti-name>/channels/chan_xtrigs_in
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) Read to see input triggers connected to selected view
+Description:   (Read) Read to see input triggers connected to selected view
                channel.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/chan_xtrigs_out
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (R) Read to see output triggers connected to selected view
+Description:   (Read) Read to see output triggers connected to selected view
                channel.
 
 What:          /sys/bus/coresight/devices/<cti-name>/channels/chan_xtrigs_reset
 Date:          March 2020
 KernelVersion  5.7
 Contact:       Mike Leach or Mathieu Poirier
-Description:   (W) Clear all channel / trigger programming.
+Description:   (Write) Clear all channel / trigger programming.
index b5f5260..9a383f6 100644 (file)
@@ -4,7 +4,10 @@ KernelVersion: 3.19
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
 Description:   (RW) Add/remove a sink from a trace path.  There can be multiple
                source for a single sink.
-               ex: echo 1 > /sys/bus/coresight/devices/20010000.etb/enable_sink
+
+               ex::
+
+                 echo 1 > /sys/bus/coresight/devices/20010000.etb/enable_sink
 
 What:          /sys/bus/coresight/devices/<memory_map>.etb/trigger_cntr
 Date:          November 2014
@@ -20,21 +23,21 @@ What:               /sys/bus/coresight/devices/<memory_map>.etb/mgmt/rdp
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Defines the depth, in words, of the trace RAM in powers of
+Description:   (Read) Defines the depth, in words, of the trace RAM in powers of
                2.  The value is read directly from HW register RDP, 0x004.
 
 What:          /sys/bus/coresight/devices/<memory_map>.etb/mgmt/sts
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the ETB status register.  The value
+Description:   (Read) Shows the value held by the ETB status register.  The value
                is read directly from HW register STS, 0x00C.
 
 What:          /sys/bus/coresight/devices/<memory_map>.etb/mgmt/rrp
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the ETB RAM Read Pointer register
+Description:   (Read) Shows the value held by the ETB RAM Read Pointer register
                that is used to read entries from the Trace RAM over the APB
                interface.  The value is read directly from HW register RRP,
                0x014.
@@ -43,7 +46,7 @@ What:         /sys/bus/coresight/devices/<memory_map>.etb/mgmt/rwp
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the ETB RAM Write Pointer register
+Description:   (Read) Shows the value held by the ETB RAM Write Pointer register
                that is used to sets the write pointer to write entries from
                the CoreSight bus into the Trace RAM. The value is read directly
                from HW register RWP, 0x018.
@@ -52,21 +55,21 @@ What:               /sys/bus/coresight/devices/<memory_map>.etb/mgmt/trg
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Similar to "trigger_cntr" above except that this value is
+Description:   (Read) Similar to "trigger_cntr" above except that this value is
                read directly from HW register TRG, 0x01C.
 
 What:          /sys/bus/coresight/devices/<memory_map>.etb/mgmt/ctl
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the ETB Control register. The value
+Description:   (Read) Shows the value held by the ETB Control register. The value
                is read directly from HW register CTL, 0x020.
 
 What:          /sys/bus/coresight/devices/<memory_map>.etb/mgmt/ffsr
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the ETB Formatter and Flush Status
+Description:   (Read) Shows the value held by the ETB Formatter and Flush Status
                register.  The value is read directly from HW register FFSR,
                0x300.
 
@@ -74,6 +77,6 @@ What:         /sys/bus/coresight/devices/<memory_map>.etb/mgmt/ffcr
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the ETB Formatter and Flush Control
+Description:   (Read) Shows the value held by the ETB Formatter and Flush Control
                register.  The value is read directly from HW register FFCR,
                0x304.
index 924265a..651602a 100644 (file)
@@ -146,28 +146,28 @@ What:             /sys/bus/coresight/devices/<memory_map>.[etm|ptm]/nr_addr_cmp
 Date:          November 2014
 KernelVersion: 3.19
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Provides the number of address comparators pairs accessible
+Description:   (Read) Provides the number of address comparators pairs accessible
                on a trace unit, as specified by bit 3:0 of register ETMCCR.
 
 What:          /sys/bus/coresight/devices/<memory_map>.[etm|ptm]/nr_cntr
 Date:          November 2014
 KernelVersion: 3.19
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Provides the number of counters accessible on a trace unit,
+Description:   (Read) Provides the number of counters accessible on a trace unit,
                as specified by bit 15:13 of register ETMCCR.
 
 What:          /sys/bus/coresight/devices/<memory_map>.[etm|ptm]/nr_ctxid_cmp
 Date:          November 2014
 KernelVersion: 3.19
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Provides the number of context ID comparator available on a
+Description:   (Read) Provides the number of context ID comparator available on a
                trace unit, as specified by bit 25:24 of register ETMCCR.
 
 What:          /sys/bus/coresight/devices/<memory_map>.[etm|ptm]/reset
 Date:          November 2014
 KernelVersion: 3.19
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (W) Cancels all configuration on a trace unit and set it back
+Description:   (Write) Cancels all configuration on a trace unit and set it back
                to its boot configuration.
 
 What:          /sys/bus/coresight/devices/<memory_map>.[etm|ptm]/seq_12_event
@@ -216,7 +216,7 @@ What:               /sys/bus/coresight/devices/<memory_map>.[etm|ptm]/curr_seq_state
 Date:          November 2014
 KernelVersion: 3.19
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Holds the current state of the sequencer.
+Description:   (Read) Holds the current state of the sequencer.
 
 What:          /sys/bus/coresight/devices/<memory_map>.[etm|ptm]/sync_freq
 Date:          November 2014
index 614874e..881f0cd 100644 (file)
@@ -12,75 +12,75 @@ What:               /sys/bus/coresight/devices/etm<N>/cpu
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) The CPU this tracing entity is associated with.
+Description:   (Read) The CPU this tracing entity is associated with.
 
 What:          /sys/bus/coresight/devices/etm<N>/nr_pe_cmp
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Indicates the number of PE comparator inputs that are
+Description:   (Read) Indicates the number of PE comparator inputs that are
                available for tracing.
 
 What:          /sys/bus/coresight/devices/etm<N>/nr_addr_cmp
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Indicates the number of address comparator pairs that are
+Description:   (Read) Indicates the number of address comparator pairs that are
                available for tracing.
 
 What:          /sys/bus/coresight/devices/etm<N>/nr_cntr
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Indicates the number of counters that are available for
+Description:   (Read) Indicates the number of counters that are available for
                tracing.
 
 What:          /sys/bus/coresight/devices/etm<N>/nr_ext_inp
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Indicates how many external inputs are implemented.
+Description:   (Read) Indicates how many external inputs are implemented.
 
 What:          /sys/bus/coresight/devices/etm<N>/numcidc
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Indicates the number of Context ID comparators that are
+Description:   (Read) Indicates the number of Context ID comparators that are
                available for tracing.
 
 What:          /sys/bus/coresight/devices/etm<N>/numvmidc
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Indicates the number of VMID comparators that are available
+Description:   (Read) Indicates the number of VMID comparators that are available
                for tracing.
 
 What:          /sys/bus/coresight/devices/etm<N>/nrseqstate
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Indicates the number of sequencer states that are
+Description:   (Read) Indicates the number of sequencer states that are
                implemented.
 
 What:          /sys/bus/coresight/devices/etm<N>/nr_resource
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Indicates the number of resource selection pairs that are
+Description:   (Read) Indicates the number of resource selection pairs that are
                available for tracing.
 
 What:          /sys/bus/coresight/devices/etm<N>/nr_ss_cmp
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Indicates the number of single-shot comparator controls that
+Description:   (Read) Indicates the number of single-shot comparator controls that
                are available for tracing.
 
 What:          /sys/bus/coresight/devices/etm<N>/reset
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (W) Cancels all configuration on a trace unit and set it back
+Description:   (Write) Cancels all configuration on a trace unit and set it back
                to its boot configuration.
 
 What:          /sys/bus/coresight/devices/etm<N>/mode
@@ -300,7 +300,7 @@ What:               /sys/bus/coresight/devices/etm<N>/addr_cmp_view
 Date:          December 2019
 KernelVersion: 5.5
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the current settings for the selected address
+Description:   (Read) Print the current settings for the selected address
                comparator.
 
 What:          /sys/bus/coresight/devices/etm<N>/sshot_idx
@@ -319,7 +319,7 @@ What:               /sys/bus/coresight/devices/etm<N>/sshot_status
 Date:          December 2019
 KernelVersion: 5.5
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the current value of the selected single shot
+Description:   (Read) Print the current value of the selected single shot
                status register.
 
 What:          /sys/bus/coresight/devices/etm<N>/sshot_pe_ctrl
@@ -333,111 +333,111 @@ What:           /sys/bus/coresight/devices/etm<N>/mgmt/trcoslsr
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the OS Lock Status Register (0x304).
+Description:   (Read) Print the content of the OS Lock Status Register (0x304).
                The value it taken directly  from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/mgmt/trcpdcr
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the Power Down Control Register
+Description:   (Read) Print the content of the Power Down Control Register
                (0x310).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/mgmt/trcpdsr
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the Power Down Status Register
+Description:   (Read) Print the content of the Power Down Status Register
                (0x314).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/mgmt/trclsr
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the SW Lock Status Register
+Description:   (Read) Print the content of the SW Lock Status Register
                (0xFB4).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/mgmt/trcauthstatus
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the Authentication Status Register
+Description:   (Read) Print the content of the Authentication Status Register
                (0xFB8).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/mgmt/trcdevid
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the Device ID Register
+Description:   (Read) Print the content of the Device ID Register
                (0xFC8).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/mgmt/trcdevtype
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the Device Type Register
+Description:   (Read) Print the content of the Device Type Register
                (0xFCC).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/mgmt/trcpidr0
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the Peripheral ID0 Register
+Description:   (Read) Print the content of the Peripheral ID0 Register
                (0xFE0).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/mgmt/trcpidr1
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the Peripheral ID1 Register
+Description:   (Read) Print the content of the Peripheral ID1 Register
                (0xFE4).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/mgmt/trcpidr2
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the Peripheral ID2 Register
+Description:   (Read) Print the content of the Peripheral ID2 Register
                (0xFE8).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/mgmt/trcpidr3
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the Peripheral ID3 Register
+Description:   (Read) Print the content of the Peripheral ID3 Register
                (0xFEC).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/mgmt/trcconfig
 Date:          February 2016
 KernelVersion: 4.07
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the trace configuration register
+Description:   (Read) Print the content of the trace configuration register
                (0x010) as currently set by SW.
 
 What:          /sys/bus/coresight/devices/etm<N>/mgmt/trctraceid
 Date:          February 2016
 KernelVersion: 4.07
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Print the content of the trace ID register (0x040).
+Description:   (Read) Print the content of the trace ID register (0x040).
 
 What:          /sys/bus/coresight/devices/etm<N>/trcidr/trcidr0
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Returns the tracing capabilities of the trace unit (0x1E0).
+Description:   (Read) Returns the tracing capabilities of the trace unit (0x1E0).
                The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/trcidr/trcidr1
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Returns the tracing capabilities of the trace unit (0x1E4).
+Description:   (Read) Returns the tracing capabilities of the trace unit (0x1E4).
                The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/trcidr/trcidr2
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Returns the maximum size of the data value, data address,
+Description:   (Read) Returns the maximum size of the data value, data address,
                VMID, context ID and instuction address in the trace unit
                (0x1E8).  The value is taken directly from the HW.
 
@@ -445,7 +445,7 @@ What:               /sys/bus/coresight/devices/etm<N>/trcidr/trcidr3
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Returns the value associated with various resources
+Description:   (Read) Returns the value associated with various resources
                available to the trace unit.  See the Trace Macrocell
                architecture specification for more details (0x1E8).
                The value is taken directly from the HW.
@@ -454,42 +454,42 @@ What:             /sys/bus/coresight/devices/etm<N>/trcidr/trcidr4
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Returns how many resources the trace unit supports (0x1F0).
+Description:   (Read) Returns how many resources the trace unit supports (0x1F0).
                The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/trcidr/trcidr5
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Returns how many resources the trace unit supports (0x1F4).
+Description:   (Read) Returns how many resources the trace unit supports (0x1F4).
                The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/trcidr/trcidr8
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Returns the maximum speculation depth of the instruction
+Description:   (Read) Returns the maximum speculation depth of the instruction
                trace stream. (0x180).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/trcidr/trcidr9
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Returns the number of P0 right-hand keys that the trace unit
+Description:   (Read) Returns the number of P0 right-hand keys that the trace unit
                can use (0x184).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/trcidr/trcidr10
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Returns the number of P1 right-hand keys that the trace unit
+Description:   (Read) Returns the number of P1 right-hand keys that the trace unit
                can use (0x188).  The value is taken directly from the HW.
 
 What:          /sys/bus/coresight/devices/etm<N>/trcidr/trcidr11
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Returns the number of special P1 right-hand keys that the
+Description:   (Read) Returns the number of special P1 right-hand keys that the
                trace unit can use (0x18C).  The value is taken directly from
                the HW.
 
@@ -497,7 +497,7 @@ What:               /sys/bus/coresight/devices/etm<N>/trcidr/trcidr12
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Returns the number of conditional P1 right-hand keys that
+Description:   (Read) Returns the number of conditional P1 right-hand keys that
                the trace unit can use (0x190).  The value is taken directly
                from the HW.
 
@@ -505,6 +505,6 @@ What:               /sys/bus/coresight/devices/etm<N>/trcidr/trcidr13
 Date:          April 2015
 KernelVersion: 4.01
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Returns the number of special conditional P1 right-hand keys
+Description:   (Read) Returns the number of special conditional P1 right-hand keys
                that the trace unit can use (0x194).  The value is taken
                directly from the HW.
index 1dffabe..53e1f48 100644 (file)
@@ -42,7 +42,7 @@ What:         /sys/bus/coresight/devices/<memory_map>.stm/status
 Date:          April 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) List various control and status registers.  The specific
+Description:   (Read) List various control and status registers.  The specific
                layout and content is driver specific.
 
 What:          /sys/bus/coresight/devices/<memory_map>.stm/traceid
index ab49b9a..6aa5272 100644 (file)
@@ -11,21 +11,21 @@ What:           /sys/bus/coresight/devices/<memory_map>.tmc/mgmt/rsz
 Date:           March 2016
 KernelVersion:  4.7
 Contact:        Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:    (R) Defines the size, in 32-bit words, of the local RAM buffer.
+Description:    (Read) Defines the size, in 32-bit words, of the local RAM buffer.
                 The value is read directly from HW register RSZ, 0x004.
 
 What:           /sys/bus/coresight/devices/<memory_map>.tmc/mgmt/sts
 Date:           March 2016
 KernelVersion:  4.7
 Contact:        Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the TMC status register.  The value
+Description:   (Read) Shows the value held by the TMC status register.  The value
                 is read directly from HW register STS, 0x00C.
 
 What:          /sys/bus/coresight/devices/<memory_map>.tmc/mgmt/rrp
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the TMC RAM Read Pointer register
+Description:   (Read) Shows the value held by the TMC RAM Read Pointer register
                that is used to read entries from the Trace RAM over the APB
                interface.  The value is read directly from HW register RRP,
                0x014.
@@ -34,7 +34,7 @@ What:         /sys/bus/coresight/devices/<memory_map>.tmc/mgmt/rwp
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the TMC RAM Write Pointer register
+Description:   (Read) Shows the value held by the TMC RAM Write Pointer register
                that is used to sets the write pointer to write entries from
                the CoreSight bus into the Trace RAM. The value is read directly
                from HW register RWP, 0x018.
@@ -43,21 +43,21 @@ What:               /sys/bus/coresight/devices/<memory_map>.tmc/mgmt/trg
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Similar to "trigger_cntr" above except that this value is
+Description:   (Read) Similar to "trigger_cntr" above except that this value is
                read directly from HW register TRG, 0x01C.
 
 What:          /sys/bus/coresight/devices/<memory_map>.tmc/mgmt/ctl
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the TMC Control register. The value
+Description:   (Read) Shows the value held by the TMC Control register. The value
                is read directly from HW register CTL, 0x020.
 
 What:          /sys/bus/coresight/devices/<memory_map>.tmc/mgmt/ffsr
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the TMC Formatter and Flush Status
+Description:   (Read) Shows the value held by the TMC Formatter and Flush Status
                register.  The value is read directly from HW register FFSR,
                0x300.
 
@@ -65,7 +65,7 @@ What:         /sys/bus/coresight/devices/<memory_map>.tmc/mgmt/ffcr
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the TMC Formatter and Flush Control
+Description:   (Read) Shows the value held by the TMC Formatter and Flush Control
                register.  The value is read directly from HW register FFCR,
                0x304.
 
@@ -73,7 +73,7 @@ What:         /sys/bus/coresight/devices/<memory_map>.tmc/mgmt/mode
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Shows the value held by the TMC Mode register, which
+Description:   (Read) Shows the value held by the TMC Mode register, which
                indicate the mode the device has been configured to enact.  The
                The value is read directly from the MODE register, 0x028.
 
@@ -81,7 +81,7 @@ What:         /sys/bus/coresight/devices/<memory_map>.tmc/mgmt/devid
 Date:          March 2016
 KernelVersion: 4.7
 Contact:       Mathieu Poirier <mathieu.poirier@linaro.org>
-Description:   (R) Indicates the capabilities of the Coresight TMC.
+Description:   (Read) Indicates the capabilities of the Coresight TMC.
                The value is read directly from the DEVID register, 0xFC8,
 
 What:          /sys/bus/coresight/devices/<memory_map>.tmc/buffer_size
index 966f850..12a733f 100644 (file)
@@ -20,6 +20,7 @@ Contact:      Cornelia Huck <cornelia.huck@de.ibm.com>
 Description:   Contains the ids of the channel paths used by this
                subchannel, as reported by the channel subsystem
                during subchannel recognition.
+
                Note: This is an I/O-subchannel specific attribute.
 Users:         s390-tools, HAL
 
@@ -31,6 +32,7 @@ Description:  Contains the PIM/PAM/POM values, as reported by the
                channel subsystem when last queried by the common I/O
                layer (this implies that this attribute is not necessarily
                in sync with the values current in the channel subsystem).
+
                Note: This is an I/O-subchannel specific attribute.
 Users:         s390-tools, HAL
 
@@ -53,6 +55,7 @@ Description:  This file allows the driver for a device to be specified. When
                opt-out of driver binding using a driver_override name such as
                "none".  Only a single driver may be specified in the override,
                there is no support for parsing delimiters.
+
                Note that unlike the mechanism of the same name for pci, this
                file does not allow to override basic matching rules. I.e.,
                the driver must still match the subchannel type of the device.
index 23543be..b0265ab 100644 (file)
@@ -4,6 +4,7 @@ KernelVersion:  5.10
 Contact:       Xu Yilun <yilun.xu@intel.com>
 Description:   Read-only. It returns type of DFL FIU of the device. Now DFL
                supports 2 FIU types, 0 for FME, 1 for PORT.
+
                Format: 0x%x
 
 What:          /sys/bus/dfl/devices/dfl_dev.X/feature_id
@@ -12,4 +13,5 @@ KernelVersion:        5.10
 Contact:       Xu Yilun <yilun.xu@intel.com>
 Description:   Read-only. It returns feature identifier local to its DFL FIU
                type.
+
                Format: 0x%x
index c9278a3..63a32dd 100644 (file)
@@ -8,13 +8,13 @@ Description:  Read-only. Attribute group to describe the magic bits
 
                Each attribute under this group defines a bit range of the
                perf_event_attr.config. All supported attributes are listed
-               below.
+               below::
 
                    event  = "config:0-11"  - event ID
                    evtype = "config:12-15" - event type
                    portid = "config:16-23" - event source
 
-               For example,
+               For example::
 
                    fab_mmio_read = "event=0x06,evtype=0x02,portid=0xff"
 
@@ -40,11 +40,11 @@ Description:        Read-only. Attribute group to describe performance monitoring
 
                All supported performance monitoring events are listed below.
 
-               Basic events (evtype=0x00)
+               Basic events (evtype=0x00)::
 
                    clock = "event=0x00,evtype=0x00,portid=0xff"
 
-               Cache events (evtype=0x01)
+               Cache events (evtype=0x01)::
 
                    cache_read_hit      = "event=0x00,evtype=0x01,portid=0xff"
                    cache_read_miss     = "event=0x01,evtype=0x01,portid=0xff"
@@ -59,7 +59,7 @@ Description:  Read-only. Attribute group to describe performance monitoring
                    cache_rx_req_stall  = "event=0x09,evtype=0x01,portid=0xff"
                    cache_eviction      = "event=0x0a,evtype=0x01,portid=0xff"
 
-               Fabric events (evtype=0x02)
+               Fabric events (evtype=0x02)::
 
                    fab_pcie0_read       = "event=0x00,evtype=0x02,portid=0xff"
                    fab_pcie0_write      = "event=0x01,evtype=0x02,portid=0xff"
@@ -78,7 +78,7 @@ Description:  Read-only. Attribute group to describe performance monitoring
                    fab_port_mmio_read   = "event=0x06,evtype=0x02,portid=?"
                    fab_port_mmio_write  = "event=0x07,evtype=0x02,portid=?"
 
-               VTD events (evtype=0x03)
+               VTD events (evtype=0x03)::
 
                    vtd_port_read_transaction  = "event=0x00,evtype=0x03,portid=?"
                    vtd_port_write_transaction = "event=0x01,evtype=0x03,portid=?"
@@ -88,7 +88,7 @@ Description:  Read-only. Attribute group to describe performance monitoring
                    vtd_port_devtlb_2m_fill    = "event=0x05,evtype=0x03,portid=?"
                    vtd_port_devtlb_1g_fill    = "event=0x06,evtype=0x03,portid=?"
 
-               VTD SIP events (evtype=0x04)
+               VTD SIP events (evtype=0x04)::
 
                    vtd_sip_iotlb_4k_hit  = "event=0x00,evtype=0x04,portid=0xff"
                    vtd_sip_iotlb_2m_hit  = "event=0x01,evtype=0x04,portid=0xff"
index 5bb793e..df7ccc1 100644 (file)
@@ -10,7 +10,8 @@ Description:
                name/value pairs.
 
                Userspace must be prepared for the possibility that attributes
-               define overlapping bit ranges. For example:
+               define overlapping bit ranges. For example::
+
                        attr1 = 'config:0-23'
                        attr2 = 'config:0-7'
                        attr3 = 'config:12-35'
index 2273627..de390a0 100644 (file)
@@ -7,7 +7,7 @@ Description:    Read-only. Attribute group to describe the magic bits
 
                 Each attribute under this group defines a bit range of the
                 perf_event_attr.config. All supported attributes are listed
-                below.
+                below::
 
                                chip = "config:16-31"
                                core  = "config:16-31"
@@ -16,9 +16,9 @@ Description:    Read-only. Attribute group to describe the magic bits
                                offset = "config:32-63"
                                vcpu = "config:16-31"
 
-               For example,
+                For example::
 
-               PM_PB_CYC =  "domain=1,offset=0x80,chip=?,lpar=0x0"
+                 PM_PB_CYC =  "domain=1,offset=0x80,chip=?,lpar=0x0"
 
                In this event, '?' after chip specifies that
                this value will be provided by user while running this event.
index 6a023b4..12e2bf9 100644 (file)
@@ -7,7 +7,7 @@ Description:    Read-only. Attribute group to describe the magic bits
 
                 Each attribute under this group defines a bit range of the
                 perf_event_attr.config. All supported attributes are listed
-                below.
+                below::
 
                                counter_info_version  = "config:16-23"
                                length  = "config:24-31"
@@ -20,9 +20,9 @@ Description:    Read-only. Attribute group to describe the magic bits
                                secondary_index = "config:0-15"
                                starting_index = "config:32-63"
 
-               For example,
+                For example::
 
-               processor_core_utilization_instructions_completed = "request=0x94,
+                 processor_core_utilization_instructions_completed = "request=0x94,
                                        phys_processor_idx=?,counter_info_version=0x8,
                                        length=8,offset=0x18"
 
@@ -36,6 +36,7 @@ Description:
                '0' if the hypervisor is configured to forbid access to event
                counters being accumulated by other guests and to physical
                domain event counters.
+
                '1' if that access is allowed.
 
 What:          /sys/bus/event_source/devices/hv_gpci/interface/ga
index 657df13..8fe787c 100644 (file)
@@ -3,16 +3,19 @@ Date:         August 2012
 KernelVersion: TBD
 Contact:       Robert Love <robert.w.love@intel.com>, devel@open-fcoe.org
 Description:   The FCoE bus. Attributes in this directory are control interfaces.
+
 Attributes:
 
-       ctlr_create: 'FCoE Controller' instance creation interface. Writing an
+       ctlr_create:
+                    'FCoE Controller' instance creation interface. Writing an
                     <ifname> to this file will allocate and populate sysfs with a
                     fcoe_ctlr_device (ctlr_X). The user can then configure any
                     per-port settings and finally write to the fcoe_ctlr_device's
                     'start' attribute to begin the kernel's discovery and login
                     process.
 
-       ctlr_destroy: 'FCoE Controller' instance removal interface. Writing a
+       ctlr_destroy:
+                      'FCoE Controller' instance removal interface. Writing a
                       fcoe_ctlr_device's sysfs name to this file will log the
                       fcoe_ctlr_device out of the fabric or otherwise connected
                       FCoE devices. It will also free all kernel memory allocated
@@ -32,11 +35,13 @@ Description:        'FCoE Controller' instances on the fcoe bus.
 
 Attributes:
 
-       fcf_dev_loss_tmo: Device loss timeout period (see below). Changing
+       fcf_dev_loss_tmo:
+                         Device loss timeout period (see below). Changing
                          this value will change the dev_loss_tmo for all
                          FCFs discovered by this controller.
 
-       mode:             Display or change the FCoE Controller's mode. Possible
+       mode:
+                         Display or change the FCoE Controller's mode. Possible
                          modes are 'Fabric' and 'VN2VN'. If a FCoE Controller
                          is started in 'Fabric' mode then FIP FCF discovery is
                          initiated and ultimately a fabric login is attempted.
@@ -44,23 +49,30 @@ Attributes:
                          FIP VN2VN discovery and login is performed. A FCoE
                          Controller only supports one mode at a time.
 
-       enabled:          Whether an FCoE controller is enabled or disabled.
+       enabled:
+                         Whether an FCoE controller is enabled or disabled.
                          0 if disabled, 1 if enabled. Writing either 0 or 1
                          to this file will enable or disable the FCoE controller.
 
-       lesb/link_fail:   Link Error Status Block (LESB) link failure count.
+       lesb/link_fail:
+                         Link Error Status Block (LESB) link failure count.
 
-       lesb/vlink_fail:  Link Error Status Block (LESB) virtual link
+       lesb/vlink_fail:
+                         Link Error Status Block (LESB) virtual link
                          failure count.
 
-       lesb/miss_fka:    Link Error Status Block (LESB) missed FCoE
+       lesb/miss_fka:
+                         Link Error Status Block (LESB) missed FCoE
                          Initialization Protocol (FIP) Keep-Alives (FKA).
 
-       lesb/symb_err:    Link Error Status Block (LESB) symbolic error count.
+       lesb/symb_err:
+                         Link Error Status Block (LESB) symbolic error count.
 
-       lesb/err_block:   Link Error Status Block (LESB) block error count.
+       lesb/err_block:
+                         Link Error Status Block (LESB) block error count.
 
-       lesb/fcs_error:   Link Error Status Block (LESB) Fibre Channel
+       lesb/fcs_error:
+                         Link Error Status Block (LESB) Fibre Channel
                          Services error count.
 
 Notes: ctlr_X (global increment starting at 0)
@@ -75,31 +87,41 @@ Description:        'FCoE FCF' instances on the fcoe bus. A FCF is a Fibre Channel
                Fibre Channel frames into a FC fabric. It can also take
                outbound FC frames and pack them in Ethernet packets to
                be sent to their destination on the Ethernet segment.
+
 Attributes:
 
-       fabric_name: Identifies the fabric that the FCF services.
+       fabric_name:
+                    Identifies the fabric that the FCF services.
 
-       switch_name: Identifies the FCF.
+       switch_name:
+                    Identifies the FCF.
 
-       priority:    The switch's priority amongst other FCFs on the same
+       priority:
+                    The switch's priority amongst other FCFs on the same
                     fabric.
 
-       selected:    1 indicates that the switch has been selected for use;
+       selected:
+                    1 indicates that the switch has been selected for use;
                     0 indicates that the switch will not be used.
 
-       fc_map:      The Fibre Channel MAP
+       fc_map:
+                    The Fibre Channel MAP
 
-       vfid:        The Virtual Fabric ID
+       vfid:
+                    The Virtual Fabric ID
 
-       mac:         The FCF's MAC address
+       mac:
+                    The FCF's MAC address
 
-       fka_period:  The FIP Keep-Alive period
+       fka_period:
+                    The FIP Keep-Alive period
 
        fabric_state: The internal kernel state
-                     "Unknown" - Initialization value
-                     "Disconnected" - No link to the FCF/fabric
-                     "Connected" - Host is connected to the FCF
-                     "Deleted" - FCF is being removed from the system
+
+                     - "Unknown" - Initialization value
+                     - "Disconnected" - No link to the FCF/fabric
+                     - "Connected" - Host is connected to the FCF
+                     - "Deleted" - FCF is being removed from the system
 
        dev_loss_tmo: The device loss timeout period for this FCF.
 
index 80256b8..bf3c6af 100644 (file)
@@ -6,8 +6,10 @@ Description:
                the driver to attempt to bind to the device found at
                this location. The format for the location is Object.Id
                and is the same as found in /sys/bus/fsl-mc/devices/.
-                For example:
-               # echo dpni.2 > /sys/bus/fsl-mc/drivers/fsl_dpaa2_eth/bind
+
+                For example::
+
+                 # echo dpni.2 > /sys/bus/fsl-mc/drivers/fsl_dpaa2_eth/bind
 
 What:          /sys/bus/fsl-mc/drivers/.../unbind
 Date:          December 2016
@@ -17,5 +19,7 @@ Description:
                driver to attempt to unbind from the device found at
                this location. The format for the location is Object.Id
                and is the same as found in /sys/bus/fsl-mc/devices/.
-                For example:
-               # echo dpni.2 > /sys/bus/fsl-mc/drivers/fsl_dpaa2_eth/unbind
+
+                For example::
+
+                 # echo dpni.2 > /sys/bus/fsl-mc/drivers/fsl_dpaa2_eth/unbind
index 9de269b..42dfc93 100644 (file)
@@ -3,19 +3,25 @@ Date:         February 2011
 Contact:       Minkyu Kang <mk7.kang@samsung.com>
 Description:
                show what device is attached
-               NONE - no device
-               USB - USB device is attached
-               UART - UART is attached
-               CHARGER - Charger is attaced
-               JIG - JIG is attached
+
+               =======  ======================
+               NONE     no device
+               USB      USB device is attached
+               UART     UART is attached
+               CHARGER  Charger is attaced
+               JIG      JIG is attached
+               =======  ======================
 
 What:          /sys/bus/i2c/devices/.../switch
 Date:          February 2011
 Contact:       Minkyu Kang <mk7.kang@samsung.com>
 Description:
                show or set the state of manual switch
-               VAUDIO - switch to VAUDIO path
-               UART - switch to UART path
-               AUDIO - switch to AUDIO path
-               DHOST - switch to DHOST path
-               AUTO - switch automatically by device
+
+               =======  ==============================
+               VAUDIO   switch to VAUDIO path
+               UART     switch to UART path
+               AUDIO    switch to AUDIO path
+               DHOST    switch to DHOST path
+               AUTO     switch automatically by device
+               =======  ==============================
index 0b0de8c..b6c69eb 100644 (file)
@@ -6,15 +6,18 @@ Description:
                Value that exists only for mux devices that can be
                written to control the behaviour of the multiplexer on
                idle. Possible values:
-               -2 - disconnect on idle, i.e. deselect the last used
-                    channel, which is useful when there is a device
-                    with an address that conflicts with another
-                    device on another mux on the same parent bus.
-               -1 - leave the mux as-is, which is the most optimal
-                    setting in terms of I2C operations and is the
-                    default mode.
-               0..<nchans> - set the mux to a predetermined channel,
-                    which is useful if there is one channel that is
-                    used almost always, and you want to reduce the
-                    latency for normal operations after rare
-                    transactions on other channels
+
+               ===========  ===============================================
+               -2           disconnect on idle, i.e. deselect the last used
+                            channel, which is useful when there is a device
+                            with an address that conflicts with another
+                            device on another mux on the same parent bus.
+               -1           leave the mux as-is, which is the most optimal
+                            setting in terms of I2C operations and is the
+                            default mode.
+               0..<nchans>  set the mux to a predetermined channel,
+                            which is useful if there is one channel that is
+                            used almost always, and you want to reduce the
+                            latency for normal operations after rare
+                            transactions on other channels
+               ===========  ===============================================
index 2f332ec..1f4a266 100644 (file)
@@ -84,6 +84,7 @@ Description:
                by space. Modes can be "hdr-ddr", "hdr-tsp" and "hdr-tsl".
                See the I3C specification for more details about these HDR
                modes.
+
                This entry describes the HDRCAP of the master controller
                driving the bus.
 
@@ -135,6 +136,7 @@ Description:
                Expose the HDR (High Data Rate) capabilities of a device.
                Returns a list of supported HDR mode, each element is separated
                by space. Modes can be "hdr-ddr", "hdr-tsp" and "hdr-tsl".
+
                See the I3C specification for more details about these HDR
                modes.
 
index a9d5181..df42bed 100644 (file)
@@ -15,6 +15,7 @@ Description:
                based on hardware generated events (e.g. data ready) or
                provided by a separate driver for other hardware (e.g.
                periodic timer, GPIO or high resolution timer).
+
                Contains trigger type specific elements. These do not
                generalize well and hence are not documented in this file.
                X is the IIO index of the trigger.
@@ -65,6 +66,7 @@ Contact:      linux-iio@vger.kernel.org
 Description:
                When the internal sampling clock can only take a specific set of
                frequencies, we can specify the available values with:
+
                - a small discrete set of values like "0 2 4 6 8"
                - a range with minimum, step and maximum frequencies like
                  "[min step max]"
@@ -665,6 +667,7 @@ Description:
                <type>[Y][_name]_<raw|input>_thresh_falling_value may take
                different values, but the device can only enable both thresholds
                or neither.
+
                Note the driver will assume the last p events requested are
                to be enabled where p is how many it supports (which may vary
                depending on the exact set requested. So if you want to be
@@ -719,6 +722,7 @@ Description:
                <type>[Y][_name]_<raw|input>_roc_falling_value may take
                different values, but the device can only enable both rate of
                change thresholds or neither.
+
                Note the driver will assume the last p events requested are
                to be enabled where p is however many it supports (which may
                vary depending on the exact set requested. So if you want to be
@@ -774,9 +778,11 @@ Description:
                Specifies the value of threshold that the device is comparing
                against for the events enabled by
                <type>Y[_name]_thresh[_rising|falling]_en.
+
                If separate attributes exist for the two directions, but
                direction is not specified for this attribute, then a single
                threshold value applies to both directions.
+
                The raw or input element of the name indicates whether the
                value is in raw device units or in processed units (as _raw
                and _input do on sysfs direct channel read attributes).
@@ -859,6 +865,7 @@ Description:
                If separate attributes exist for the two directions, but
                direction is not specified for this attribute, then a single
                hysteresis value applies to both directions.
+
                For falling events the hysteresis is added to the _value attribute for
                this event to get the upper threshold for when the event goes back to
                normal, for rising events the hysteresis is subtracted from the _value
@@ -905,6 +912,7 @@ Description:
                Specifies the value of rate of change threshold that the
                device is comparing against for the events enabled by
                <type>[Y][_name]_roc[_rising|falling]_en.
+
                If separate attributes exist for the two directions,
                but direction is not specified for this attribute,
                then a single threshold value applies to both directions.
@@ -1304,6 +1312,7 @@ Description:
                Proximity measurement indicating that some
                object is near the sensor, usually by observing
                reflectivity of infrared or ultrasound emitted.
+
                Often these sensors are unit less and as such conversion
                to SI units is not possible. Higher proximity measurements
                indicate closer objects, and vice versa. Units after
@@ -1449,9 +1458,12 @@ Contact: linux-iio@vger.kernel.org
 Description:
                A single positive integer specifying the maximum number of scan
                elements to wait for.
+
                Poll will block until the watermark is reached.
+
                Blocking read will wait until the minimum between the requested
                read amount or the low water mark is available.
+
                Non-blocking read will retrieve the available samples from the
                buffer even if there are less samples then watermark level. This
                allows the application to block on poll with a timeout and read
@@ -1480,11 +1492,13 @@ Description:
                device settings allows it (e.g. if a trigger is set that samples
                data differently that the hardware fifo does then hardware fifo
                will not enabled).
+
                If the hardware fifo is enabled and the level of the hardware
                fifo reaches the hardware fifo watermark level the device will
                flush its hardware fifo to the device buffer. Doing a non
                blocking read on the device when no samples are present in the
                device buffer will also force a flush.
+
                When the hardware fifo is enabled there is no need to use a
                trigger to use buffer mode since the watermark settings
                guarantees that the hardware fifo is flushed to the device
@@ -1522,6 +1536,7 @@ Description:
                A single positive integer specifying the minimum watermark level
                for the hardware fifo of this device. If the device does not
                have a hardware fifo this entry is not present.
+
                If the user sets buffer/watermark to a value less than this one,
                then the hardware watermark will remain unset.
 
@@ -1532,6 +1547,7 @@ Description:
                A single positive integer specifying the maximum watermark level
                for the hardware fifo of this device. If the device does not
                have a hardware fifo this entry is not present.
+
                If the user sets buffer/watermark to a value greater than this
                one, then the hardware watermark will be capped at this value.
 
@@ -1543,6 +1559,7 @@ Description:
                levels for the hardware fifo. This entry is optional and if it
                is not present it means that all the values between
                hwfifo_watermark_min and hwfifo_watermark_max are supported.
+
                If the user sets buffer/watermark to a value greater than
                hwfifo_watermak_min but not equal to any of the values in this
                list, the driver will chose an appropriate value for the
@@ -1604,7 +1621,8 @@ KernelVersion:    4.1.0
 Contact:       linux-iio@vger.kernel.org
 Description:
                '1' (enable) or '0' (disable) specifying the enable
-               of heater function. Same reading values apply
+               of heater function. Same reading values apply.
+
                This ABI is especially applicable for humidity sensors
                to heatup the device and get rid of any condensation
                in some humidity environment
@@ -1627,17 +1645,21 @@ Description:
                Mounting matrix for IIO sensors. This is a rotation matrix which
                informs userspace about sensor chip's placement relative to the
                main hardware it is mounted on.
+
                Main hardware placement is defined according to the local
                reference frame related to the physical quantity the sensor
                measures.
+
                Given that the rotation matrix is defined in a board specific
                way (platform data and / or device-tree), the main hardware
                reference frame definition is left to the implementor's choice
                (see below for a magnetometer example).
+
                Applications should apply this rotation matrix to samples so
                that when main hardware reference frame is aligned onto local
                reference frame, then sensor chip reference frame is also
                perfectly aligned with it.
+
                Matrix is a 3x3 unitary matrix and typically looks like
                [0, 1, 0; 1, 0, 0; 0, 0, -1]. Identity matrix
                [1, 0, 0; 0, 1, 0; 0, 0, 1] means sensor chip and main hardware
@@ -1646,8 +1668,10 @@ Description:
                For example, a mounting matrix for a magnetometer sensor informs
                userspace about sensor chip's ORIENTATION relative to the main
                hardware.
+
                More specifically, main hardware orientation is defined with
                respect to the LOCAL EARTH GEOMAGNETIC REFERENCE FRAME where :
+
                * Y is in the ground plane and positive towards magnetic North ;
                * X is in the ground plane, perpendicular to the North axis and
                  positive towards the East ;
@@ -1656,13 +1680,16 @@ Description:
                An implementor might consider that for a hand-held device, a
                'natural' orientation would be 'front facing camera at the top'.
                The main hardware reference frame could then be described as :
+
                * Y is in the plane of the screen and is positive towards the
                  top of the screen ;
                * X is in the plane of the screen, perpendicular to Y axis, and
                  positive towards the right hand side of the screen ;
                * Z is perpendicular to the screen plane and positive out of the
                  screen.
+
                Another example for a quadrotor UAV might be :
+
                * Y is in the plane of the propellers and positive towards the
                  front-view camera;
                * X is in the plane of the propellers, perpendicular to Y axis,
@@ -1704,6 +1731,7 @@ Description:
                This interface is deprecated; please use the Counter subsystem.
 
                A list of possible counting directions which are:
+
                - "up"  : counter device is increasing.
                - "down": counter device is decreasing.
 
index 2071f9b..1c2a07f 100644 (file)
@@ -5,7 +5,8 @@ Contact:        Peter Rosin <peda@axentia.se>
 Description:
                The DAC is used to find the peak level of an alternating
                voltage input signal by a binary search using the output
-               of a comparator wired to an interrupt pin. Like so:
+               of a comparator wired to an interrupt pin. Like so::
+
                                           _
                                          | \
                     input +------>-------|+ \
@@ -19,10 +20,12 @@ Description:
                            |    irq|------<-------'
                            |       |
                            '-------'
+
                The boolean invert attribute (0/1) should be set when the
                input signal is centered around the maximum value of the
                dac instead of zero. The envelope detector will search
                from below in this case and will also invert the result.
+
                The edge/level of the interrupt is also switched to its
                opposite value.
 
index f30b4c4..4b01150 100644 (file)
@@ -19,9 +19,11 @@ Description:
                is separately set for "GND-Open" and "Supply-Open" modes.
                Channels 0..31 have common low threshold values, but could have different
                sensing_modes.
+
                The low voltage threshold range is between 2..21V.
                Hysteresis between low and high thresholds can not be lower then 2 and
                can not be odd.
+
                If falling threshold results hysteresis to odd value then rising
                threshold is automatically subtracted by one.
 
@@ -34,10 +36,13 @@ Description:
                this value then the threshold rising event is pushed.
                Depending on in_voltageY_sensing_mode the high voltage threshold
                is separately set for "GND-Open" and "Supply-Open" modes.
+
                Channels 0..31 have common high threshold values, but could have different
                sensing_modes.
+
                The high voltage threshold range is between 3..22V.
                Hysteresis between low and high thresholds can not be lower then 2 and
                can not be odd.
+
                If rising threshold results hysteresis to odd value then falling
                threshold is automatically appended by one.
index efe4c85..1975c7a 100644 (file)
@@ -5,10 +5,13 @@ Description:
                The STM32 ADC can be configured to use external trigger sources
                (e.g. timers, pwm or exti gpio). Then, it can be tuned to start
                conversions on external trigger by either:
+
                - "rising-edge"
                - "falling-edge"
                - "both-edges".
+
                Reading returns current trigger polarity.
+
                Writing value before enabling conversions sets trigger polarity.
 
 What:          /sys/bus/iio/devices/triggerX/trigger_polarity_available
index 6158f83..adf24c4 100644 (file)
@@ -4,7 +4,7 @@ KernelVersion:  4.7
 Contact:       linux-iio@vger.kernel.org
 Description:
                Writing '1' will perform a FOC (Fast Online Calibration). The
-                corresponding calibration offsets can be read from *_calibbias
+                corresponding calibration offsets can be read from `*_calibbias`
                 entries.
 
 What:          /sys/bus/iio/devices/iio:deviceX/location
index 0e66ae9..91439d6 100644 (file)
@@ -3,14 +3,20 @@ KernelVersion:        4.14
 Contact:       arnaud.pouliquen@st.com
 Description:
                For audio purpose only.
+
                Used by audio driver to set/get the spi input frequency.
+
                This is mandatory if DFSDM is slave on SPI bus, to
                provide information on the SPI clock frequency during runtime
                Notice that the SPI frequency should be a multiple of sample
                frequency to ensure the precision.
-               if DFSDM input is SPI master
+
+               if DFSDM input is SPI master:
+
                        Reading  SPI clkout frequency,
                        error on writing
+
                If DFSDM input is SPI Slave:
+
                        Reading returns value previously set.
                        Writing value before starting conversions.
index a133fd8..40df5c9 100644 (file)
@@ -15,8 +15,11 @@ Description:
                first object echoed in meters. Default value is 6.020.
                This setting limits the time the driver is waiting for a
                echo.
+
                Showing the range of available values is represented as the
                minimum value, the step and the maximum value, all enclosed
                in square brackets.
-               Example:
-               [0.043 0.043 11.008]
+
+               Example::
+
+                       [0.043 0.043 11.008]
index a91aeab..d065cda 100644 (file)
@@ -8,7 +8,9 @@ KernelVersion:  3.4.0
 Contact:       linux-iio@vger.kernel.org
 Description:
                Reading returns either '1' or '0'.
+
                '1' means that the clock in question is present.
+
                '0' means that the clock is missing.
 
 What:          /sys/bus/iio/devices/iio:deviceX/pllY_locked
index 302de64..544548e 100644 (file)
@@ -27,12 +27,12 @@ What:               /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_name
 KernelVersion:
 Contact:       linux-iio@vger.kernel.org
 Description:
-               Reading returns the datasheet name for channel Y:
+               Reading returns the datasheet name for channel Y::
 
-               out_altvoltage0_name: RF8x
-               out_altvoltage1_name: RFAUX8x
-               out_altvoltage2_name: RF16x
-               out_altvoltage3_name: RF32x
+                 out_altvoltage0_name: RF8x
+                 out_altvoltage1_name: RFAUX8x
+                 out_altvoltage2_name: RF16x
+                 out_altvoltage3_name: RF32x
 
 What:          /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_powerdown
 KernelVersion:
index 6adba90..66b621f 100644 (file)
@@ -6,10 +6,14 @@ Description:
                Get measured values from the ADC for these stages. Y is the
                specific stage number corresponding to datasheet stage names
                as follows:
-               1 -> LED2
-               2 -> ALED2/LED3
-               3 -> LED1
-               4 -> ALED1/LED4
+
+               == ==========
+               1  LED2
+               2  ALED2/LED3
+               3  LED1
+               4  ALED1/LED4
+               == ==========
+
                Note that channels 5 and 6 represent LED2-ALED2 and LED1-ALED1
                respectively which simply helper channels containing the
                calculated difference in the value of stage 1 - 2 and 3 - 4.
index f0ce0a0..220206a 100644 (file)
@@ -15,5 +15,7 @@ Description:
                Scheme 0 has wider dynamic range, Scheme 1 proximity detection
                is less affected by the ambient IR noise variation.
 
-               0 Sensing IR from LED and ambient
-               1 Sensing IR from LED with ambient IR rejection
+               == =============================================
+               0  Sensing IR from LED and ambient
+               1  Sensing IR from LED with ambient IR rejection
+               == =============================================
index ad2cc63..73498ff 100644 (file)
@@ -17,9 +17,11 @@ KernelVersion:       4.13
 Contact:       fabrice.gasnier@st.com
 Description:
                Configure the device counter quadrature modes:
+
                - non-quadrature:
                        Encoder IN1 input servers as the count input (up
                        direction).
+
                - quadrature:
                        Encoder IN1 and IN2 inputs are mixed to get direction
                        and count.
@@ -35,23 +37,26 @@ KernelVersion:      4.13
 Contact:       fabrice.gasnier@st.com
 Description:
                Configure the device encoder/counter active edge:
+
                - rising-edge
                - falling-edge
                - both-edges
 
                In non-quadrature mode, device counts up on active edge.
+
                In quadrature mode, encoder counting scenarios are as follows:
-               ----------------------------------------------------------------
+
+               +---------+----------+--------------------+--------------------+
                | Active  | Level on |      IN1 signal    |     IN2 signal     |
-               | edge    | opposite |------------------------------------------
+               | edge    | opposite +----------+---------+----------+---------+
                |         | signal   |  Rising  | Falling |  Rising  | Falling |
-               ----------------------------------------------------------------
-               | Rising  | High ->  |   Down   |    -    |    Up    |    -    |
-               | edge    | Low  ->  |    Up    |    -    |   Down   |    -    |
-               ----------------------------------------------------------------
-               | Falling | High ->  |    -     |    Up   |    -     |   Down  |
-               | edge    | Low  ->  |    -     |   Down  |    -     |    Up   |
-               ----------------------------------------------------------------
-               | Both    | High ->  |   Down   |    Up   |    Up    |   Down  |
-               | edges   | Low  ->  |    Up    |   Down  |   Down   |    Up   |
-               ----------------------------------------------------------------
+               +---------+----------+----------+---------+----------+---------+
+               | Rising  | High ->  |   Down   |    -    |   Up     |    -    |
+               | edge    | Low  ->  |   Up     |    -    |   Down   |    -    |
+               +---------+----------+----------+---------+----------+---------+
+               | Falling | High ->  |    -     |   Up    |    -     |   Down  |
+               | edge    | Low  ->  |    -     |   Down  |    -     |   Up    |
+               +---------+----------+----------+---------+----------+---------+
+               | Both    | High ->  |   Down   |   Up    |   Up     |   Down  |
+               | edges   | Low  ->  |   Up     |   Down  |   Down   |   Up    |
+               +---------+----------+----------+---------+----------+---------+
index 6275e9f..13f099e 100644 (file)
@@ -5,11 +5,16 @@ Contact:        linux-iio@vger.kernel.org
 Description:
                 Current configuration and available configurations
                for the bias current.
-               normal          - Normal measurement configurations (default)
-               positivebias    - Positive bias configuration
-               negativebias    - Negative bias configuration
-               disabled        - Only available on HMC5983. Disables magnetic
+
+               ============      ============================================
+               normal            Normal measurement configurations (default)
+               positivebias      Positive bias configuration
+               negativebias      Negative bias configuration
+               disabled          Only available on HMC5983. Disables magnetic
                                  sensor and enables temperature sensor.
-               Note: The effect of this configuration may vary
-               according to the device. For exact documentation
-               check the device's datasheet.
+               ============      ============================================
+
+               Note:
+                 The effect of this configuration may vary
+                 according to the device. For exact documentation
+                 check the device's datasheet.
index 3b3509a..e5ef6d8 100644 (file)
@@ -5,9 +5,12 @@ Description:
                Open-circuit fault. The detection of open-circuit faults,
                such as those caused by broken thermocouple wires.
                Reading returns either '1' or '0'.
-               '1' = An open circuit such as broken thermocouple wires
-                     has been detected.
-               '0' = No open circuit or broken thermocouple wires are detected
+
+               ===  =======================================================
+               '1'  An open circuit such as broken thermocouple wires
+                    has been detected.
+               '0'  No open circuit or broken thermocouple wires are detected
+               ===  =======================================================
 
 What:          /sys/bus/iio/devices/iio:deviceX/fault_ovuv
 KernelVersion: 5.1
@@ -18,7 +21,11 @@ Description:
                cables by integrated MOSFETs at the T+ and T- inputs, and the
                BIAS output. These MOSFETs turn off when the input voltage is
                negative or greater than VDD.
+
                Reading returns either '1' or '0'.
-               '1' = The input voltage is negative or greater than VDD.
-               '0' = The input voltage is positive and less than VDD (normal
-               state).
+
+               ===  =======================================================
+               '1'  The input voltage is negative or greater than VDD.
+               '0'  The input voltage is positive and less than VDD (normal
+                    state).
+               ===  =======================================================
index b725923..a10a4de 100644 (file)
@@ -3,67 +3,85 @@ KernelVersion:        4.11
 Contact:       benjamin.gaignard@st.com
 Description:
                Reading returns the list possible master modes which are:
-               - "reset"     : The UG bit from the TIMx_EGR register is
+
+
+               - "reset"
+                               The UG bit from the TIMx_EGR register is
                                used as trigger output (TRGO).
-               - "enable"    : The Counter Enable signal CNT_EN is used
+               - "enable"
+                               The Counter Enable signal CNT_EN is used
                                as trigger output.
-               - "update"    : The update event is selected as trigger output.
+               - "update"
+                               The update event is selected as trigger output.
                                For instance a master timer can then be used
                                as a prescaler for a slave timer.
-               - "compare_pulse" : The trigger output send a positive pulse
-                                   when the CC1IF flag is to be set.
-               - "OC1REF"    : OC1REF signal is used as trigger output.
-               - "OC2REF"    : OC2REF signal is used as trigger output.
-               - "OC3REF"    : OC3REF signal is used as trigger output.
-               - "OC4REF"    : OC4REF signal is used as trigger output.
+               - "compare_pulse"
+                               The trigger output send a positive pulse
+                               when the CC1IF flag is to be set.
+               - "OC1REF"
+                               OC1REF signal is used as trigger output.
+               - "OC2REF"
+                               OC2REF signal is used as trigger output.
+               - "OC3REF"
+                               OC3REF signal is used as trigger output.
+               - "OC4REF"
+                               OC4REF signal is used as trigger output.
+
                Additional modes (on TRGO2 only):
-               - "OC5REF"    : OC5REF signal is used as trigger output.
-               - "OC6REF"    : OC6REF signal is used as trigger output.
+
+               - "OC5REF"
+                               OC5REF signal is used as trigger output.
+               - "OC6REF"
+                               OC6REF signal is used as trigger output.
                - "compare_pulse_OC4REF":
-                 OC4REF rising or falling edges generate pulses.
+                               OC4REF rising or falling edges generate pulses.
                - "compare_pulse_OC6REF":
-                 OC6REF rising or falling edges generate pulses.
+                               OC6REF rising or falling edges generate pulses.
                - "compare_pulse_OC4REF_r_or_OC6REF_r":
-                 OC4REF or OC6REF rising edges generate pulses.
+                               OC4REF or OC6REF rising edges generate pulses.
                - "compare_pulse_OC4REF_r_or_OC6REF_f":
-                 OC4REF rising or OC6REF falling edges generate pulses.
+                               OC4REF rising or OC6REF falling edges generate
+                               pulses.
                - "compare_pulse_OC5REF_r_or_OC6REF_r":
-                 OC5REF or OC6REF rising edges generate pulses.
+                               OC5REF or OC6REF rising edges generate pulses.
                - "compare_pulse_OC5REF_r_or_OC6REF_f":
-                 OC5REF rising or OC6REF falling edges generate pulses.
-
-               +-----------+   +-------------+            +---------+
-               | Prescaler +-> | Counter     |        +-> | Master  | TRGO(2)
-               +-----------+   +--+--------+-+        |-> | Control +-->
-                                  |        |          ||  +---------+
-                               +--v--------+-+ OCxREF ||  +---------+
-                               | Chx compare +----------> | Output  | ChX
-                               +-----------+-+         |  | Control +-->
-                                     .     |           |  +---------+
-                                     .     |           |    .
-                               +-----------v-+ OC6REF  |    .
-                               | Ch6 compare +---------+>
-                               +-------------+
-
-               Example with: "compare_pulse_OC4REF_r_or_OC6REF_r":
-
-                               X
-                             X   X
-                           X .   . X
-                         X   .   .   X
-                       X     .   .     X
-               count X .     .   .     . X
-                       .     .   .     .
-                       .     .   .     .
-                       +---------------+
-               OC4REF  |     .   .     |
-                     +-+     .   .     +-+
-                       .     +---+     .
-               OC6REF  .     |   |     .
-                     +-------+   +-------+
-                       +-+   +-+
-               TRGO2   | |   | |
-                     +-+ +---+ +---------+
+                               OC5REF rising or OC6REF falling edges generate
+                               pulses.
+
+               ::
+
+                 +-----------+   +-------------+            +---------+
+                 | Prescaler +-> | Counter     |        +-> | Master  | TRGO(2)
+                 +-----------+   +--+--------+-+        |-> | Control +-->
+                                    |        |          ||  +---------+
+                                 +--v--------+-+ OCxREF ||  +---------+
+                                 | Chx compare +----------> | Output  | ChX
+                                 +-----------+-+         |  | Control +-->
+                                       .     |           |  +---------+
+                                       .     |           |    .
+                                 +-----------v-+ OC6REF  |    .
+                                 | Ch6 compare +---------+>
+                                 +-------------+
+
+               Example with: "compare_pulse_OC4REF_r_or_OC6REF_r"::
+
+                                 X
+                               X   X
+                             X .   . X
+                           X   .   .   X
+                         X     .   .     X
+                 count X .     .   .     . X
+                         .     .   .     .
+                         .     .   .     .
+                         +---------------+
+                 OC4REF  |     .   .     |
+                       +-+     .   .     +-+
+                         .     +---+     .
+                 OC6REF  .     |   |     .
+                       +-------+   +-------+
+                         +-+   +-+
+                 TRGO2   | |   | |
+                       +-+ +---+ +---------+
 
 What:          /sys/bus/iio/devices/triggerX/master_mode
 KernelVersion: 4.11
@@ -91,6 +109,30 @@ Description:
                When counting down the counter start from preset value
                and fire event when reach 0.
 
+What:          /sys/bus/iio/devices/iio:deviceX/in_count_quadrature_mode_available
+KernelVersion: 4.12
+Contact:       benjamin.gaignard@st.com
+Description:
+               Reading returns the list possible quadrature modes.
+
+What:          /sys/bus/iio/devices/iio:deviceX/in_count0_quadrature_mode
+KernelVersion: 4.12
+Contact:       benjamin.gaignard@st.com
+Description:
+               Configure the device counter quadrature modes:
+
+               channel_A:
+                       Encoder A input servers as the count input and B as
+                       the UP/DOWN direction control input.
+
+               channel_B:
+                       Encoder B input serves as the count input and A as
+                       the UP/DOWN direction control input.
+
+               quadrature:
+                       Encoder A and B inputs are mixed to get direction
+                       and count with a scale of 0.25.
+
 What:          /sys/bus/iio/devices/iio:deviceX/in_count_enable_mode_available
 KernelVersion: 4.12
 Contact:       benjamin.gaignard@st.com
@@ -104,6 +146,7 @@ Description:
                Configure the device counter enable modes, in all case
                counting direction is set by in_count0_count_direction
                attribute and the counter is clocked by the internal clock.
+
                always:
                        Counter is always ON.
 
index 22d0843..b7b2278 100644 (file)
@@ -10,10 +10,13 @@ Date:               June 2015
 KernelVersion: 4.3
 Contact:       Alexander Shishkin <alexander.shishkin@linux.intel.com>
 Description:   (RO) Output port type:
-                 0: not present,
-                 1: MSU (Memory Storage Unit)
-                 2: CTP (Common Trace Port)
-                 4: PTI (MIPI PTI).
+
+                ==  =========================
+                 0  not present,
+                 1  MSU (Memory Storage Unit)
+                 2  CTP (Common Trace Port)
+                 4  PTI (MIPI PTI).
+                ==  =========================
 
 What:          /sys/bus/intel_th/devices/<intel_th_id>-gth/outputs/[0-7]_drop
 Date:          June 2015
index 7fd2601..a74252e 100644 (file)
@@ -9,11 +9,13 @@ Date:         June 2015
 KernelVersion: 4.3
 Contact:       Alexander Shishkin <alexander.shishkin@linux.intel.com>
 Description:   (RW) Configure MSC operating mode:
+
                  - "single", for contiguous buffer mode (high-order alloc);
                  - "multi", for multiblock mode;
                  - "ExI", for DCI handler mode;
                  - "debug", for debug mode;
                  - any of the currently loaded buffer sinks.
+
                If operating mode changes, existing buffer is deallocated,
                provided there are no active users and tracing is not enabled,
                otherwise the write will fail.
@@ -23,10 +25,12 @@ Date:               June 2015
 KernelVersion: 4.3
 Contact:       Alexander Shishkin <alexander.shishkin@linux.intel.com>
 Description:   (RW) Configure MSC buffer size for "single" or "multi" modes.
+
                In single mode, this is a single number of pages, has to be
                power of 2. In multiblock mode, this is a comma-separated list
                of numbers of pages for each window to be allocated. Number of
                windows is not limited.
+
                Writing to this file deallocates existing buffer (provided
                there are no active users and tracing is not enabled) and then
                allocates a new one.
index ec0a603..38cc03e 100644 (file)
@@ -235,7 +235,8 @@ KernelVersion:      4.15
 Contact:       Christian Gromm <christian.gromm@microchip.com>
 Description:
                This is to read back the configured direction of the channel.
-               The following strings will be accepted:
+               The following strings will be accepted::
+
                        'tx',
                        'rx'
 Users:
@@ -246,7 +247,8 @@ KernelVersion:      4.15
 Contact:       Christian Gromm <christian.gromm@microchip.com>
 Description:
                This is to read back the configured data type of the channel.
-               The following strings will be accepted:
+               The following strings will be accepted::
+
                        'control',
                        'async',
                        'sync',
index 3559585..4a6d61b 100644 (file)
@@ -2,16 +2,16 @@ What:         /sys/bus/moxtet/devices/moxtet-<name>.<addr>/module_description
 Date:          March 2019
 KernelVersion: 5.3
 Contact:       Marek Behún <marek.behun@nic.cz>
-Description:   (R) Moxtet module description. Format: string
+Description:   (Read) Moxtet module description. Format: string
 
 What:          /sys/bus/moxtet/devices/moxtet-<name>.<addr>/module_id
 Date:          March 2019
 KernelVersion: 5.3
 Contact:       Marek Behún <marek.behun@nic.cz>
-Description:   (R) Moxtet module ID. Format: %x
+Description:   (Read) Moxtet module ID. Format: %x
 
 What:          /sys/bus/moxtet/devices/moxtet-<name>.<addr>/module_name
 Date:          March 2019
 KernelVersion: 5.3
 Contact:       Marek Behún <marek.behun@nic.cz>
-Description:   (R) Moxtet module name. Format: string
+Description:   (Read) Moxtet module name. Format: string
index e4f76e7..63ef0b9 100644 (file)
@@ -1,4 +1,4 @@
-For all of the nmem device attributes under nfit/*, see the 'NVDIMM Firmware
+For all of the nmem device attributes under ``nfit/*``, see the 'NVDIMM Firmware
 Interface Table (NFIT)' section in the ACPI specification
 (http://www.uefi.org/specifications) for more details.
 
index d643802..bff84a1 100644 (file)
@@ -1,2 +1,8 @@
+What:          nvdimm
+Date:          July 2020
+KernelVersion: 5.8
+Contact:       Dan Williams <dan.j.williams@intel.com>
+Description:
+
 The libnvdimm sub-system implements a common sysfs interface for
 platform nvdimm resources. See Documentation/driver-api/nvdimm/.
index c1a6727..8316c33 100644 (file)
@@ -11,19 +11,26 @@ Description:
                at 'Documentation/powerpc/papr_hcalls.rst' . Below are
                the flags reported in this sysfs file:
 
-               * "not_armed"   : Indicates that NVDIMM contents will not
+               * "not_armed"
+                                 Indicates that NVDIMM contents will not
                                  survive a power cycle.
-               * "flush_fail"  : Indicates that NVDIMM contents
+               * "flush_fail"
+                                 Indicates that NVDIMM contents
                                  couldn't be flushed during last
                                  shut-down event.
-               * "restore_fail": Indicates that NVDIMM contents
+               * "restore_fail"
+                                 Indicates that NVDIMM contents
                                  couldn't be restored during NVDIMM
                                  initialization.
-               * "encrypted"   : NVDIMM contents are encrypted.
-               * "smart_notify": There is health event for the NVDIMM.
-               * "scrubbed"    : Indicating that contents of the
+               * "encrypted"
+                                 NVDIMM contents are encrypted.
+               * "smart_notify"
+                                 There is health event for the NVDIMM.
+               * "scrubbed"
+                                 Indicating that contents of the
                                  NVDIMM have been scrubbed.
-               * "locked"      : Indicating that NVDIMM contents cant
+               * "locked"
+                                 Indicating that NVDIMM contents cant
                                  be modified until next power cycle.
 
 What:          /sys/bus/nd/devices/nmemX/papr/perf_stats
@@ -51,4 +58,4 @@ Description:
                * "MedWDur " : Media Write Duration
                * "CchRHCnt" : Cache Read Hit Count
                * "CchWHCnt" : Cache Write Hit Count
-               * "FastWCnt" : Fast Write Count
\ No newline at end of file
+               * "FastWCnt" : Fast Write Count
index 450296c..77ad9ec 100644 (file)
@@ -7,8 +7,10 @@ Description:
                this location.  This is useful for overriding default
                bindings.  The format for the location is: DDDD:BB:DD.F.
                That is Domain:Bus:Device.Function and is the same as
-               found in /sys/bus/pci/devices/.  For example:
-               # echo 0000:00:19.0 > /sys/bus/pci/drivers/foo/bind
+               found in /sys/bus/pci/devices/.  For example::
+
+                 # echo 0000:00:19.0 > /sys/bus/pci/drivers/foo/bind
+
                (Note: kernels before 2.6.28 may require echo -n).
 
 What:          /sys/bus/pci/drivers/.../unbind
@@ -20,8 +22,10 @@ Description:
                this location.  This may be useful when overriding default
                bindings.  The format for the location is: DDDD:BB:DD.F.
                That is Domain:Bus:Device.Function and is the same as
-               found in /sys/bus/pci/devices/. For example:
-               # echo 0000:00:19.0 > /sys/bus/pci/drivers/foo/unbind
+               found in /sys/bus/pci/devices/. For example::
+
+                 # echo 0000:00:19.0 > /sys/bus/pci/drivers/foo/unbind
+
                (Note: kernels before 2.6.28 may require echo -n).
 
 What:          /sys/bus/pci/drivers/.../new_id
@@ -38,8 +42,9 @@ Description:
                Class, Class Mask, and Private Driver Data.  The Vendor ID
                and Device ID fields are required, the rest are optional.
                Upon successfully adding an ID, the driver will probe
-               for the device and attempt to bind to it.  For example:
-               # echo "8086 10f5" > /sys/bus/pci/drivers/foo/new_id
+               for the device and attempt to bind to it.  For example::
+
+                 # echo "8086 10f5" > /sys/bus/pci/drivers/foo/new_id
 
 What:          /sys/bus/pci/drivers/.../remove_id
 Date:          February 2009
@@ -54,8 +59,9 @@ Description:
                required, the rest are optional.  After successfully
                removing an ID, the driver will no longer support the
                device.  This is useful to ensure auto probing won't
-               match the driver to the device.  For example:
-               # echo "8086 10f5" > /sys/bus/pci/drivers/foo/remove_id
+               match the driver to the device.  For example::
+
+                 # echo "8086 10f5" > /sys/bus/pci/drivers/foo/remove_id
 
 What:          /sys/bus/pci/rescan
 Date:          January 2009
index 3c9a8c4..860db53 100644 (file)
@@ -1,6 +1,6 @@
-==========================
 PCIe Device AER statistics
-==========================
+--------------------------
+
 These attributes show up under all the devices that are AER capable. These
 statistical counters indicate the errors "as seen/reported by the device".
 Note that this may mean that if an endpoint is causing problems, the AER
@@ -17,19 +17,18 @@ Description:        List of correctable errors seen and reported by this
                PCI device using ERR_COR. Note that since multiple errors may
                be reported using a single ERR_COR message, thus
                TOTAL_ERR_COR at the end of the file may not match the actual
-               total of all the errors in the file. Sample output:
--------------------------------------------------------------------------
-localhost /sys/devices/pci0000:00/0000:00:1c.0 # cat aer_dev_correctable
-Receiver Error 2
-Bad TLP 0
-Bad DLLP 0
-RELAY_NUM Rollover 0
-Replay Timer Timeout 0
-Advisory Non-Fatal 0
-Corrected Internal Error 0
-Header Log Overflow 0
-TOTAL_ERR_COR 2
--------------------------------------------------------------------------
+               total of all the errors in the file. Sample output::
+
+                   localhost /sys/devices/pci0000:00/0000:00:1c.0 # cat aer_dev_correctable
+                   Receiver Error 2
+                   Bad TLP 0
+                   Bad DLLP 0
+                   RELAY_NUM Rollover 0
+                   Replay Timer Timeout 0
+                   Advisory Non-Fatal 0
+                   Corrected Internal Error 0
+                   Header Log Overflow 0
+                   TOTAL_ERR_COR 2
 
 What:          /sys/bus/pci/devices/<dev>/aer_dev_fatal
 Date:          July 2018
@@ -39,28 +38,27 @@ Description:        List of uncorrectable fatal errors seen and reported by this
                PCI device using ERR_FATAL. Note that since multiple errors may
                be reported using a single ERR_FATAL message, thus
                TOTAL_ERR_FATAL at the end of the file may not match the actual
-               total of all the errors in the file. Sample output:
--------------------------------------------------------------------------
-localhost /sys/devices/pci0000:00/0000:00:1c.0 # cat aer_dev_fatal
-Undefined 0
-Data Link Protocol 0
-Surprise Down Error 0
-Poisoned TLP 0
-Flow Control Protocol 0
-Completion Timeout 0
-Completer Abort 0
-Unexpected Completion 0
-Receiver Overflow 0
-Malformed TLP 0
-ECRC 0
-Unsupported Request 0
-ACS Violation 0
-Uncorrectable Internal Error 0
-MC Blocked TLP 0
-AtomicOp Egress Blocked 0
-TLP Prefix Blocked Error 0
-TOTAL_ERR_FATAL 0
--------------------------------------------------------------------------
+               total of all the errors in the file. Sample output::
+
+                   localhost /sys/devices/pci0000:00/0000:00:1c.0 # cat aer_dev_fatal
+                   Undefined 0
+                   Data Link Protocol 0
+                   Surprise Down Error 0
+                   Poisoned TLP 0
+                   Flow Control Protocol 0
+                   Completion Timeout 0
+                   Completer Abort 0
+                   Unexpected Completion 0
+                   Receiver Overflow 0
+                   Malformed TLP 0
+                   ECRC 0
+                   Unsupported Request 0
+                   ACS Violation 0
+                   Uncorrectable Internal Error 0
+                   MC Blocked TLP 0
+                   AtomicOp Egress Blocked 0
+                   TLP Prefix Blocked Error 0
+                   TOTAL_ERR_FATAL 0
 
 What:          /sys/bus/pci/devices/<dev>/aer_dev_nonfatal
 Date:          July 2018
@@ -70,32 +68,31 @@ Description:        List of uncorrectable nonfatal errors seen and reported by this
                PCI device using ERR_NONFATAL. Note that since multiple errors
                may be reported using a single ERR_FATAL message, thus
                TOTAL_ERR_NONFATAL at the end of the file may not match the
-               actual total of all the errors in the file. Sample output:
--------------------------------------------------------------------------
-localhost /sys/devices/pci0000:00/0000:00:1c.0 # cat aer_dev_nonfatal
-Undefined 0
-Data Link Protocol 0
-Surprise Down Error 0
-Poisoned TLP 0
-Flow Control Protocol 0
-Completion Timeout 0
-Completer Abort 0
-Unexpected Completion 0
-Receiver Overflow 0
-Malformed TLP 0
-ECRC 0
-Unsupported Request 0
-ACS Violation 0
-Uncorrectable Internal Error 0
-MC Blocked TLP 0
-AtomicOp Egress Blocked 0
-TLP Prefix Blocked Error 0
-TOTAL_ERR_NONFATAL 0
--------------------------------------------------------------------------
+               actual total of all the errors in the file. Sample output::
+
+                   localhost /sys/devices/pci0000:00/0000:00:1c.0 # cat aer_dev_nonfatal
+                   Undefined 0
+                   Data Link Protocol 0
+                   Surprise Down Error 0
+                   Poisoned TLP 0
+                   Flow Control Protocol 0
+                   Completion Timeout 0
+                   Completer Abort 0
+                   Unexpected Completion 0
+                   Receiver Overflow 0
+                   Malformed TLP 0
+                   ECRC 0
+                   Unsupported Request 0
+                   ACS Violation 0
+                   Uncorrectable Internal Error 0
+                   MC Blocked TLP 0
+                   AtomicOp Egress Blocked 0
+                   TLP Prefix Blocked Error 0
+                   TOTAL_ERR_NONFATAL 0
 
-============================
 PCIe Rootport AER statistics
-============================
+----------------------------
+
 These attributes show up under only the rootports (or root complex event
 collectors) that are AER capable. These indicate the number of error messages as
 "reported to" the rootport. Please note that the rootports also transmit
index 8a200f4..f85db86 100644 (file)
@@ -4,6 +4,7 @@ Contact:        Cezary Rojewski <cezary.rojewski@intel.com>
 Description:
                Version of AudioDSP firmware ASoC catpt driver is
                communicating with.
+
                Format: %d.%d.%d.%d, type:major:minor:build.
 
 What:          /sys/devices/pci0000:00/<dev>/fw_info
index 60c60fa..c90d97a 100644 (file)
@@ -21,11 +21,11 @@ Description:
                number returns the port to normal operation.
 
                For example: To force the high-speed device attached to
-               port 4 on bus 2 to run at full speed:
+               port 4 on bus 2 to run at full speed::
 
                        echo 4 >/sys/bus/usb/devices/usb2/../companion
 
-               To return the port to high-speed operation:
+               To return the port to high-speed operation::
 
                        echo -4 >/sys/bus/usb/devices/usb2/../companion
 
index 13208b2..634ea20 100644 (file)
@@ -4,24 +4,27 @@ Description:
                an individual subdirectory with the following name format of
                device_name "nn:d:iiii", where:
 
-               nn   - two-digit hexadecimal ID of RapidIO network where the
+               ====   ========================================================
+               nn     two-digit hexadecimal ID of RapidIO network where the
                       device resides
-               d    - device type: 'e' - for endpoint or 's' - for switch
-               iiii - four-digit device destID for endpoints, or switchID for
+               d      device type: 'e' - for endpoint or 's' - for switch
+               iiii   four-digit device destID for endpoints, or switchID for
                       switches
+               ====   ========================================================
 
                For example, below is a list of device directories that
                represents a typical RapidIO network with one switch, one host,
                and two agent endpoints, as it is seen by the enumerating host
-               (with destID = 1):
+               (with destID = 1)::
 
-               /sys/bus/rapidio/devices/00:e:0000
-               /sys/bus/rapidio/devices/00:e:0002
-               /sys/bus/rapidio/devices/00:s:0001
+                 /sys/bus/rapidio/devices/00:e:0000
+                 /sys/bus/rapidio/devices/00:e:0002
+                 /sys/bus/rapidio/devices/00:s:0001
 
-               NOTE: An enumerating or discovering endpoint does not create a
-               sysfs entry for itself, this is why an endpoint with destID=1 is
-               not shown in the list.
+               NOTE:
+                 An enumerating or discovering endpoint does not create a
+                 sysfs entry for itself, this is why an endpoint with destID=1
+                 is not shown in the list.
 
 Attributes Common for All RapidIO Devices
 -----------------------------------------
index cc30bee..417a2fe 100644 (file)
@@ -7,6 +7,8 @@ Description:
 
                Usage: <mon ip addr> <options> <pool name> <rbd image name> [<snap name>]
 
+               Example::
+
                 $ echo "192.168.0.1 name=admin rbd foo" > /sys/bus/rbd/add
 
                The snapshot name can be "-" or omitted to map the image
@@ -23,6 +25,8 @@ Description:
 
                Usage: <dev-id> [force]
 
+               Example::
+
                 $ echo 2 > /sys/bus/rbd/remove
 
                Optional "force" argument which when passed will wait for
@@ -80,26 +84,29 @@ Date:               Oct, 2010
 KernelVersion: v2.6.37
 Contact:       Sage Weil <sage@newdream.net>
 Description:
-               size:           (RO) The size (in bytes) of the mapped block
+
+               ==============  ================================================
+               size            (RO) The size (in bytes) of the mapped block
                                device.
 
-               major:          (RO) The block device major number.
+               major           (RO) The block device major number.
 
-               client_id:      (RO) The ceph unique client id that was assigned
+               client_id       (RO) The ceph unique client id that was assigned
                                for this specific session.
 
-               pool:           (RO) The name of the storage pool where this rbd
+               pool            (RO) The name of the storage pool where this rbd
                                image resides. An rbd image name is unique
                                within its pool.
 
-               name:           (RO) The name of the rbd image.
+               name            (RO) The name of the rbd image.
 
-               refresh:        (WO) Writing to this file will reread the image
+               refresh         (WO) Writing to this file will reread the image
                                header data and set all relevant data structures
                                accordingly.
 
-               current_snap:   (RO) The current snapshot for which the device
+               current_snap    (RO) The current snapshot for which the device
                                is mapped.
+               ==============  ================================================
 
 
 What:          /sys/bus/rbd/devices/<dev-id>/pool_id
@@ -117,11 +124,13 @@ Date:             Oct, 2012
 KernelVersion: v3.7
 Contact:       Sage Weil <sage@newdream.net>
 Description:
-               image_id:       (RO) The unique id for the rbd image. (For rbd
+               =========       ===============================================
+               image_id        (RO) The unique id for the rbd image. (For rbd
                                image format 1 this is empty.)
 
-               features:       (RO) A hexadecimal encoding of the feature bits
+               features        (RO) A hexadecimal encoding of the feature bits
                                for this image.
+               =========       ===============================================
 
 
 What:          /sys/bus/rbd/devices/<dev-id>/parent
@@ -149,14 +158,16 @@ Date:             Aug, 2016
 KernelVersion: v4.9
 Contact:       Sage Weil <sage@newdream.net>
 Description:
-               snap_id:        (RO) The current snapshot's id.
+               ============    ================================================
+               snap_id         (RO) The current snapshot's id.
 
-               config_info:    (RO) The string written into
+               config_info     (RO) The string written into
                                /sys/bus/rbd/add{,_single_major}.
 
-               cluster_fsid:   (RO) The ceph cluster UUID.
+               cluster_fsid    (RO) The ceph cluster UUID.
 
-               client_addr:    (RO) The ceph unique client
+               client_addr     (RO) The ceph unique client
                                entity_addr_t (address + nonce). The format is
                                <address>:<port>/<nonce>: '1.2.3.4:1234/5678' or
                                '[1:2:3:4:5:6:7:8]:1234/5678'.
+               ============    ================================================
index c2a403f..50e8023 100644 (file)
@@ -8,6 +8,7 @@ Description:
                When the file contains a "1" the bus is operated and periodically
                does a push-pull cycle to write and read data from the
                connected devices.
+
                When writing a "0" or "1" the bus moves to the described state.
 
 What:          /sys/bus/siox/devices/siox-X/device_add
@@ -21,8 +22,10 @@ Description:
                to add a new device dynamically. <type> is the name that is used to match
                to a driver (similar to the platform bus). <inbytes> and <outbytes> define
                the length of the input and output shift register in bytes respectively.
+
                <statustype> defines the 4 bit device type that is check to identify connection
                problems.
+
                The new device is added to the end of the existing chain.
 
 What:          /sys/bus/siox/devices/siox-X/device_remove
index dd565c3..0b4ab9e 100644 (file)
@@ -37,16 +37,18 @@ Contact:    thunderbolt-software@lists.01.org
 Description:   This attribute holds current Thunderbolt security level
                set by the system BIOS. Possible values are:
 
-               none: All devices are automatically authorized
-               user: Devices are only authorized based on writing
-                     appropriate value to the authorized attribute
-               secure: Require devices that support secure connect at
-                       minimum. User needs to authorize each device.
-               dponly: Automatically tunnel Display port (and USB). No
-                       PCIe tunnels are created.
-               usbonly: Automatically tunnel USB controller of the
+               =======  ==================================================
+               none     All devices are automatically authorized
+               user     Devices are only authorized based on writing
+                        appropriate value to the authorized attribute
+               secure   Require devices that support secure connect at
+                        minimum. User needs to authorize each device.
+               dponly   Automatically tunnel Display port (and USB). No
+                        PCIe tunnels are created.
+               usbonly  Automatically tunnel USB controller of the
                         connected Thunderbolt dock (and Display Port). All
                         PCIe links downstream of the dock are removed.
+               =======  ==================================================
 
 What: /sys/bus/thunderbolt/devices/.../authorized
 Date:          Sep 2017
@@ -61,17 +63,23 @@ Description:        This attribute is used to authorize Thunderbolt devices
                yet authorized.
 
                Possible values are supported:
-               1: The device will be authorized and connected
+
+               ==  ===========================================
+               1   The device will be authorized and connected
+               ==  ===========================================
 
                When key attribute contains 32 byte hex string the possible
                values are:
-               1: The 32 byte hex string is added to the device NVM and
-                  the device is authorized.
-               2: Send a challenge based on the 32 byte hex string. If the
-                  challenge response from device is valid, the device is
-                  authorized. In case of failure errno will be ENOKEY if
-                  the device did not contain a key at all, and
-                  EKEYREJECTED if the challenge response did not match.
+
+               ==  ========================================================
+               1   The 32 byte hex string is added to the device NVM and
+                   the device is authorized.
+               2   Send a challenge based on the 32 byte hex string. If the
+                   challenge response from device is valid, the device is
+                   authorized. In case of failure errno will be ENOKEY if
+                   the device did not contain a key at all, and
+                   EKEYREJECTED if the challenge response did not match.
+               ==  ========================================================
 
 What: /sys/bus/thunderbolt/devices/.../boot
 Date:          Jun 2018
@@ -185,10 +193,11 @@ Description:      When new NVM image is written to the non-active NVM
                verification fails an error code is returned instead.
 
                This file will accept writing values "1" or "2"
+
                - Writing "1" will flush the image to the storage
-               area and authenticate the image in one action.
+                 area and authenticate the image in one action.
                - Writing "2" will run some basic validation on the image
-               and flush it to the storage area.
+                 and flush it to the storage area.
 
                When read holds status of the last authentication
                operation if an error occurred during the process. This
@@ -205,9 +214,11 @@ Description:       This contains name of the property directory the XDomain
                question. Following directories are already reserved by
                the Apple XDomain specification:
 
-               network:  IP/ethernet over Thunderbolt
-               targetdm: Target disk mode protocol over Thunderbolt
-               extdisp:  External display mode protocol over Thunderbolt
+               ========  ===============================================
+               network   IP/ethernet over Thunderbolt
+               targetdm  Target disk mode protocol over Thunderbolt
+               extdisp   External display mode protocol over Thunderbolt
+               ========  ===============================================
 
 What:          /sys/bus/thunderbolt/devices/<xdomain>.<service>/modalias
 Date:          Jan 2018
@@ -285,7 +296,8 @@ Description:        For supported devices, automatically authenticate the new Thunderbo
                image when the device is disconnected from the host system.
 
                This file will accept writing values "1" or "2"
+
                - Writing "1" will flush the image to the storage
-               area and prepare the device for authentication on disconnect.
+                 area and prepare the device for authentication on disconnect.
                - Writing "2" will run some basic validation on the image
-               and flush it to the storage area.
+                 and flush it to the storage area.
index 614d216..bf2c196 100644 (file)
@@ -9,6 +9,7 @@ Description:
                by writing INTERFACE to /sys/bus/usb/drivers_probe
                This allows to avoid side-effects with drivers
                that need multiple interfaces.
+
                A deauthorized interface cannot be probed or claimed.
 
 What:          /sys/bus/usb/devices/usbX/interface_authorized_default
@@ -72,24 +73,27 @@ Description:
                table at compile time. The format for the device ID is:
                idVendor idProduct bInterfaceClass RefIdVendor RefIdProduct
                The vendor ID and device ID fields are required, the
-               rest is optional. The Ref* tuple can be used to tell the
+               rest is optional. The `Ref*` tuple can be used to tell the
                driver to use the same driver_data for the new device as
                it is used for the reference device.
                Upon successfully adding an ID, the driver will probe
-               for the device and attempt to bind to it.  For example:
-               # echo "8086 10f5" > /sys/bus/usb/drivers/foo/new_id
+               for the device and attempt to bind to it.  For example::
+
+                 # echo "8086 10f5" > /sys/bus/usb/drivers/foo/new_id
 
                Here add a new device (0458:7045) using driver_data from
-               an already supported device (0458:704c):
-               # echo "0458 7045 0 0458 704c" > /sys/bus/usb/drivers/foo/new_id
+               an already supported device (0458:704c)::
+
+                 # echo "0458 7045 0 0458 704c" > /sys/bus/usb/drivers/foo/new_id
 
                Reading from this file will list all dynamically added
                device IDs in the same format, with one entry per
-               line. For example:
-               # cat /sys/bus/usb/drivers/foo/new_id
-               8086 10f5
-               dead beef 06
-               f00d cafe
+               line. For example::
+
+                 # cat /sys/bus/usb/drivers/foo/new_id
+                 8086 10f5
+                 dead beef 06
+                 f00d cafe
 
                The list will be truncated at PAGE_SIZE bytes due to
                sysfs restrictions.
@@ -209,9 +213,11 @@ Description:
                advance, and behaves well according to the specification.
                This attribute is a bit-field that controls the behavior of
                a specific port:
+
                 - Bit 0 of this field selects the "old" enumeration scheme,
                   as it is considerably faster (it only causes one USB reset
                   instead of 2).
+
                   The old enumeration scheme can also be selected globally
                   using /sys/module/usbcore/parameters/old_scheme_first, but
                   it is often not desirable as the new scheme was introduced to
@@ -233,10 +239,10 @@ Description:
                poll() for monitoring changes to this value in user space.
 
                Any time this value changes the corresponding hub device will send a
-               udev event with the following attributes:
+               udev event with the following attributes::
 
-               OVER_CURRENT_PORT=/sys/bus/usb/devices/.../(hub interface)/portX
-               OVER_CURRENT_COUNT=[current value of this sysfs attribute]
+                 OVER_CURRENT_PORT=/sys/bus/usb/devices/.../(hub interface)/portX
+                 OVER_CURRENT_COUNT=[current value of this sysfs attribute]
 
 What:          /sys/bus/usb/devices/.../(hub interface)/portX/usb3_lpm_permit
 Date:          November 2015
index 9ade80f..2f86e42 100644 (file)
@@ -12,8 +12,11 @@ KernelVersion:       2.6.26
 Contact:       Harrison Metzger <harrisonmetz@gmail.com>
 Description:   Controls the devices display mode.
                For a 6 character display the values are
+
                        MSB 0x06; LSB 0x3F, and
+
                for an 8 character display the values are
+
                        MSB 0x08; LSB 0xFF.
 
 What:          /sys/bus/usb/.../textmode
@@ -37,7 +40,7 @@ KernelVersion:        2.6.26
 Contact:       Harrison Metzger <harrisonmetz@gmail.com>
 Description:   Controls the decimal places on the device.
                To set the nth decimal place, give this field
-               the value of 10 ** n. Assume this field has
+               the value of ``10 ** n``. Assume this field has
                the value k and has 1 or more decimal places set,
                to set the mth place (where m is not already set),
-               change this fields value to k + 10 ** m.
+               change this fields value to ``k + 10 ** m``.
index 452dbe3..59fc804 100644 (file)
@@ -28,8 +28,9 @@ Description:
                Writing UUID to this file will create mediated device of
                type <type-id> for parent device <device>. This is a
                write-only file.
-               For example:
-               # echo "83b8f4f2-509f-382f-3c1e-e6bfe0fa1001" > \
+               For example::
+
+                 # echo "83b8f4f2-509f-382f-3c1e-e6bfe0fa1001" >       \
                       /sys/devices/foo/mdev_supported_types/foo-1/create
 
 What:           /sys/.../mdev_supported_types/<type-id>/devices/
@@ -107,5 +108,6 @@ Description:
                Writing '1' to this file destroys the mediated device. The
                vendor driver can fail the remove() callback if that device
                is active and the vendor driver doesn't support hot unplug.
-               Example:
-               # echo 1 > /sys/bus/mdev/devices/<UUID>/remove
+               Example::
+
+                 # echo 1 > /sys/bus/mdev/devices/<UUID>/remove
index 716cffc..f7b8cf6 100644 (file)
@@ -66,13 +66,6 @@ Description:
                the "erase" command on the on-board flash of the connected
                micro.
 
-What:          /sys/class/c2port/c2portX/flash_erase
-Date:          October 2008
-Contact:       Rodolfo Giometti <giometti@linux.it>
-Description:
-               The /sys/class/c2port/c2portX/flash_erase file show the
-               on-board flash size of the connected micro.
-
 What:          /sys/class/c2port/c2portX/reset
 Date:          October 2008
 Contact:       Rodolfo Giometti <giometti@linux.it>
index 3ab175a..1fc8640 100644 (file)
@@ -24,3 +24,63 @@ Description:
                non-linear
                  The brightness changes non-linearly with each step. Brightness
                  controls should use a linear mapping for a linear perception.
+
+What:          /sys/class/backlight/<backlight>/ambient_light_level
+Date:          Apr, 2010
+KernelVersion: v2.6.35
+Contact:       Michael Hennerich <michael.hennerich@analog.com>
+Description:
+               (RO) Get conversion value of the light sensor.
+
+               The value is automatically updated every 80 ms when the
+               light sensor is enabled.
+
+               The value range is device-driver specific:
+
+               For ADP8870:
+
+                 It returns integer between 0 (dark) and 8000 (max ambient
+                 brightness).
+
+               For ADP8860:
+
+                 It returns a 13-bits integer.
+
+What:          /sys/class/backlight/<backlight>/ambient_light_zone
+Date:          Apr, 2010
+KernelVersion: v2.6.35
+Contact:       Michael Hennerich <michael.hennerich@analog.com>,
+               device-drivers-devel@blackfin.uclinux.org
+
+Description:
+               (RW) Read or write the specific brightness level at which the
+               backlight operates.
+
+               The value meaning is device-driver specific:
+
+               For ADP8860:
+
+                 ==    ==========================
+                  0    Off: Backlight set to 0 mA
+                  1    Level 1: daylight
+                  2    Level 2: bright
+                  3    Level 3: dark
+                 ==    ==========================
+
+               For ADP8870:
+
+                 ==    ==========================
+                  0    Off: Backlight set to 0 mA
+                  1    Level 1: daylight
+                  2    Level 2: bright
+                  3    Level 3: office
+                  4    Level 4: indoor
+                  5    Level 5: dark
+                 ==    ==========================
+
+               Writing 0 returns to normal/automatic ambient light level
+               operation.
+
+               It can be enabled by writing the value stored in
+               /sys/class/backlight/<backlight>/max_brightness to
+               /sys/class/backlight/<backlight>/brightness.
index 54d61c7..6610ac7 100644 (file)
@@ -6,25 +6,8 @@ adp8860, adp8861 and adp8863 devices: daylight (level 1), office (level 2) and
 dark (level 3). By default the brightness operates at the daylight brightness
 level.
 
-What:          /sys/class/backlight/<backlight>/ambient_light_level
-Date:          Apr, 2010
-KernelVersion: v2.6.35
-Contact:       Michael Hennerich <michael.hennerich@analog.com>
-Description:
-               (RO) 13-bit conversion value for the first light sensor—high
-               byte (Bit 12 to Bit 8). The value is updated every 80 ms (when
-               the light sensor is enabled).
-
-
-What:          /sys/class/backlight/<backlight>/ambient_light_zone
-Date:          Apr, 2010
-KernelVersion: v2.6.35
-Contact:       Michael Hennerich <michael.hennerich@analog.com>
-Description:
-               (RW) Read or write the specific level at which the backlight
-               operates. Value "0" enables automatic ambient light sensing, and
-               values "1", "2" or "3" set the control to daylight, office or
-               dark respectively.
+See also /sys/class/backlight/<backlight>/ambient_light_level and
+/sys/class/backlight/<backlight>/ambient_light_zone.
 
 
 What:          /sys/class/backlight/<backlight>/l1_daylight_max
index 33e6488..b08ca91 100644 (file)
@@ -1,3 +1,6 @@
+See also /sys/class/backlight/<backlight>/ambient_light_level and
+/sys/class/backlight/<backlight>/ambient_light_zone.
+
 What:          /sys/class/backlight/<backlight>/<ambient light zone>_max
 What:          /sys/class/backlight/<backlight>/l1_daylight_max
 What:          /sys/class/backlight/<backlight>/l2_bright_max
@@ -27,30 +30,3 @@ Description:
                set to 0. Full off when the backlight is disabled.
                This file will also show the dim brightness level stored for
                this <ambient light zone>.
-
-What:          /sys/class/backlight/<backlight>/ambient_light_level
-Date:          May 2011
-KernelVersion: 3.0
-Contact:       device-drivers-devel@blackfin.uclinux.org
-Description:
-               Get conversion value of the light sensor.
-               This value is updated every 80 ms (when the light sensor
-               is enabled). Returns integer between 0 (dark) and
-               8000 (max ambient brightness)
-
-What:          /sys/class/backlight/<backlight>/ambient_light_zone
-Date:          May 2011
-KernelVersion: 3.0
-Contact:       device-drivers-devel@blackfin.uclinux.org
-Description:
-               Get/Set current ambient light zone. Reading returns
-               integer between 1..5 (1 = daylight, 2 = bright, ..., 5 = dark).
-               Writing a value between 1..5 forces the backlight controller
-               to enter the corresponding ambient light zone.
-               Writing 0 returns to normal/automatic ambient light level
-               operation. The ambient light sensing feature on these devices
-               is an extension to the API documented in
-               Documentation/ABI/stable/sysfs-class-backlight.
-               It can be enabled by writing the value stored in
-               /sys/class/backlight/<backlight>/max_brightness to
-               /sys/class/backlight/<backlight>/brightness.
index c0e0a9a..8251e78 100644 (file)
@@ -6,8 +6,10 @@ Description:
                Get the ALS output channel used as input in
                ALS-current-control mode (0, 1), where:
 
-               0 - out_current0 (backlight 0)
-               1 - out_current1 (backlight 1)
+               ==  ==========================
+               0   out_current0 (backlight 0)
+               1   out_current1 (backlight 1)
+               ==  ==========================
 
 What:          /sys/class/backlight/<backlight>/als_en
 Date:          May 2012
@@ -30,8 +32,10 @@ Contact:     Johan Hovold <jhovold@gmail.com>
 Description:
                Set the brightness-mapping mode (0, 1), where:
 
-               0 - exponential mode
-               1 - linear mode
+               ==  ================
+               0   exponential mode
+               1   linear mode
+               ==  ================
 
 What:          /sys/class/backlight/<backlight>/pwm
 Date:          April 2012
@@ -40,9 +44,11 @@ Contact:     Johan Hovold <jhovold@gmail.com>
 Description:
                Set the PWM-input control mask (5 bits), where:
 
-               bit 5 - PWM-input enabled in Zone 4
-               bit 4 - PWM-input enabled in Zone 3
-               bit 3 - PWM-input enabled in Zone 2
-               bit 2 - PWM-input enabled in Zone 1
-               bit 1 - PWM-input enabled in Zone 0
-               bit 0 - PWM-input enabled
+               =====   ===========================
+               bit 5   PWM-input enabled in Zone 4
+               bit 4   PWM-input enabled in Zone 3
+               bit 3   PWM-input enabled in Zone 2
+               bit 2   PWM-input enabled in Zone 1
+               bit 1   PWM-input enabled in Zone 0
+               bit 0   PWM-input enabled
+               =====   ===========================
index d773d56..5402bd7 100644 (file)
@@ -24,7 +24,6 @@ default
        filesystems which do not provide their own BDI.
 
 Files under /sys/class/bdi/<bdi>/
----------------------------------
 
 read_ahead_kb (read-write)
 
index 5819699..74ece94 100644 (file)
@@ -17,13 +17,14 @@ Date:               August 2015
 KernelVersion: 4.2
 Description:
                Tell the EC to reboot in various ways. Options are:
-               "cancel": Cancel a pending reboot.
-               "ro": Jump to RO without rebooting.
-               "rw": Jump to RW without rebooting.
-               "cold": Cold reboot.
-               "disable-jump": Disable jump until next reboot.
-               "hibernate": Hibernate the EC.
-               "at-shutdown": Reboot after an AP shutdown.
+
+               - "cancel": Cancel a pending reboot.
+               - "ro": Jump to RO without rebooting.
+               - "rw": Jump to RW without rebooting.
+               - "cold": Cold reboot.
+               - "disable-jump": Disable jump until next reboot.
+               - "hibernate": Hibernate the EC.
+               - "at-shutdown": Reboot after an AP shutdown.
 
 What:          /sys/class/chromeos/<ec-device-name>/version
 Date:          August 2015
index 7970e37..818f559 100644 (file)
@@ -72,11 +72,16 @@ Description:    read/write
                 when performing the START_WORK ioctl. Only applicable when
                 running under hashed page table mmu.
                 Possible values:
-                        none: No prefaulting (default)
-                        work_element_descriptor: Treat the work element
-                                 descriptor as an effective address and
-                                 prefault what it points to.
-                        all: all segments process calling START_WORK maps.
+
+                =======================  ======================================
+               none                     No prefaulting (default)
+               work_element_descriptor  Treat the work element
+                                        descriptor as an effective address and
+                                        prefault what it points to.
+                all                     all segments process calling
+                                        START_WORK maps.
+                =======================  ======================================
+
 Users:         https://github.com/ibm-capi/libcxl
 
 What:           /sys/class/cxl/<afu>/reset
@@ -212,6 +217,7 @@ Description:    read/write
                 card.  A power cycle is required to load the image.
                 "none" could be useful for debugging because the trace arrays
                 are preserved.
+
                 "user" and "factory" means PERST will cause either the user or
                 user or factory image to be loaded.
                 Default is to reload on PERST whichever image the card has
@@ -235,8 +241,11 @@ Contact:   linuxppc-dev@lists.ozlabs.org
 Description:   read/write
                Trust that when an image is reloaded via PERST, it will not
                have changed.
-               0 = don't trust, the image may be different (default)
-               1 = trust that the image will not change.
+
+               ==  =================================================
+               0   don't trust, the image may be different (default)
+               1   trust that the image will not change.
+               ==  =================================================
 Users:         https://github.com/ibm-capi/libcxl
 
 What:           /sys/class/cxl/<card>/psl_timebase_synced
index deefffb..b8ebff4 100644 (file)
@@ -62,7 +62,8 @@ Description:
                driver should provide the list of available frequencies
                with its profile. If need to reset the statistics of devfreq
                behavior on a specific device, enter 0(zero) to 'trans_stat'
-               as following:
+               as following::
+
                        echo 0 > /sys/class/devfreq/.../trans_stat
 
 What:          /sys/class/devfreq/.../userspace/set_freq
@@ -117,6 +118,7 @@ Description:
                This work timer is used by devfreq workqueue in order to
                monitor the device status such as utilization. The user
                can change the work timer on runtime according to their demand
-               as following:
+               as following::
+
                        echo deferrable > /sys/class/devfreq/.../timer
                        echo delayed > /sys/class/devfreq/.../timer
index 64791b6..b662f74 100644 (file)
@@ -18,9 +18,9 @@ Description:
 
                This will be one of the following strings:
 
-               'consumer unbind'
-               'supplier unbind'
-               'never'
+               'consumer unbind'
+               'supplier unbind'
+               'never'
 
                'consumer unbind' means the device link will be removed when
                the consumer's driver is unbound from the consumer device.
@@ -49,8 +49,10 @@ Description:
 
                This will be one of the following strings:
 
-               '0' - Does not affect runtime power management
-               '1' - Affects runtime power management
+               ===   ========================================
+               '0'   Does not affect runtime power management
+               '1'   Affects runtime power management
+               ===   ========================================
 
 What:          /sys/class/devlink/.../status
 Date:          May 2020
@@ -68,13 +70,13 @@ Description:
 
                This will be one of the following strings:
 
-               'not tracked'
-               'dormant'
-               'available'
-               'consumer probing'
-               'active'
-               'supplier unbinding'
-               'unknown'
+               'not tracked'
+               'dormant'
+               'available'
+               'consumer probing'
+               'active'
+               'supplier unbinding'
+               'unknown'
 
                'not tracked' means this device link does not track the status
                and has no impact on the binding, unbinding and syncing the
@@ -114,8 +116,10 @@ Description:
 
                This will be one of the following strings:
 
+               ===  ================================
                '0'
-               '1' - Affects runtime power management
+               '1'  Affects runtime power management
+               ===  ================================
 
                '0' means the device link can affect other device behaviors
                like binding/unbinding, suspend/resume, runtime power
index 57a7262..fde0fec 100644 (file)
@@ -39,19 +39,22 @@ Description:
                callback.
 
                If the default callback for showing function is used, the
-               format is like this:
-               # cat state
-               USB_OTG=1
-               HDMI=0
-               TA=1
-               EAR_JACK=0
-               #
+               format is like this::
+
+                   # cat state
+                   USB_OTG=1
+                   HDMI=0
+                   TA=1
+                   EAR_JACK=0
+                   #
+
                In this example, the extcon device has USB_OTG and TA
                cables attached and HDMI and EAR_JACK cables detached.
 
                In order to update the state of an extcon device, enter a hex
-               state number starting with 0x:
-               # echo 0xHEX > state
+               state number starting with 0x::
+
+                   # echo 0xHEX > state
 
                This updates the whole state of the extcon device.
                Inputs of all the methods are required to meet the
@@ -84,12 +87,13 @@ Contact:    MyungJoo Ham <myungjoo.ham@samsung.com>
 Description:
                Shows the relations of mutually exclusiveness. For example,
                if the mutually_exclusive array of extcon device is
-               {0x3, 0x5, 0xC, 0x0}, then the output is:
-               # ls mutually_exclusive/
-               0x3
-               0x5
-               0xc
-               #
+               {0x3, 0x5, 0xC, 0x0}, then the output is::
+
+                   # ls mutually_exclusive/
+                   0x3
+                   0x5
+                   0xc
+                   #
 
                Note that mutually_exclusive is a sub-directory of the extcon
                device and the file names under the mutually_exclusive
index 5284fa3..d78689c 100644 (file)
@@ -28,8 +28,7 @@ Description:  Read fpga manager state as a string.
                * firmware request      = firmware class request in progress
                * firmware request error = firmware request failed
                * write init            = preparing FPGA for programming
-               * write init error      = Error while preparing FPGA for
-                                         programming
+               * write init error      = Error while preparing FPGA for programming
                * write                 = FPGA ready to receive image data
                * write error           = Error while programming
                * write complete        = Doing post programming steps
@@ -47,7 +46,7 @@ Description:  Read fpga manager status as a string.
                programming errors to userspace. This is a list of strings for
                the supported status.
 
-               * reconfig operation error      - invalid operations detected by
+               * reconfig operation error      - invalid operations detected by
                                                  reconfiguration hardware.
                                                  e.g. start reconfiguration
                                                  with errors not cleared
index 2467b69..c8553d9 100644 (file)
@@ -6,9 +6,11 @@ Description:
                The GNSS receiver type. The currently identified types reflect
                the protocol(s) supported by the receiver:
 
+                       ======          ===========
                        "NMEA"          NMEA 0183
                        "SiRF"          SiRF Binary
                        "UBX"           UBX
+                       ======          ===========
 
                Note that also non-"NMEA" type receivers typically support a
                subset of NMEA 0183 with vendor extensions (e.g. to allow
index 5f67f7a..2e24ac3 100644 (file)
@@ -3,9 +3,26 @@ Date:          March 2006
 KernelVersion: 2.6.17
 Contact:       Richard Purdie <rpurdie@rpsys.net>
 Description:
-               Set the brightness of the LED. Most LEDs don't
-               have hardware brightness support, so will just be turned on for
-               non-zero brightness settings. The value is between 0 and
+               Set the brightness of the LED.
+
+               Most LEDs don't have hardware brightness support, so will
+               just be turned on for non-zero brightness settings.
+
+               .. Note::
+
+                 For multicolor LEDs, writing to this file will update all
+                 LEDs within the group to a calculated percentage of what
+                 each color LED intensity is set to.
+
+                 The percentage is calculated for each grouped LED via
+                 the equation below::
+
+                   led_brightness = brightness * multi_intensity/max_brightness
+
+                 For additional details please refer to
+                 Documentation/leds/leds-class-multicolor.rst.
+
+               The value is between 0 and
                /sys/class/leds/<led>/max_brightness.
 
                Writing 0 to this file clears active trigger.
@@ -13,6 +30,8 @@ Description:
                Writing non-zero to this file while trigger is active changes the
                top brightness trigger is going to use.
 
+
+
 What:          /sys/class/leds/<led>/max_brightness
 Date:          March 2006
 KernelVersion: 2.6.17
@@ -47,10 +66,11 @@ Contact:    Richard Purdie <rpurdie@rpsys.net>
 Description:
                Set the trigger for this LED. A trigger is a kernel based source
                of LED events.
+
                You can change triggers in a similar manner to the way an IO
                scheduler is chosen. Trigger specific parameters can appear in
                /sys/class/leds/<led> once a given trigger is selected. For
-               their documentation see sysfs-class-led-trigger-*.
+               their documentation see `sysfs-class-led-trigger-*`.
 
 What:          /sys/class/leds/<led>/inverted
 Date:          January 2011
index f520ece..04f3ffd 100644 (file)
@@ -1,133 +1,3 @@
-What:          /sys/class/leds/<led>/hw_pattern
-Date:          September 2019
-KernelVersion: 5.5
-Description:
-               Specify a hardware pattern for the EL15203000 LED.
-               The LEDs board supports only predefined patterns by firmware
-               for specific LEDs.
-
-               Breathing mode for Screen frame light tube:
-               "0 4000 1 4000"
-
-                   ^
-                   |
-               Max-|     ---
-                   |    /   \
-                   |   /     \
-                   |  /       \     /
-                   | /         \   /
-               Min-|-           ---
-                   |
-                   0------4------8--> time (sec)
-
-               Cascade mode for Pipe LED:
-               "1 800 2 800 4 800 8 800 16 800"
-
-                     ^
-                     |
-               0 On -|----+                   +----+                   +---
-                     |    |                   |    |                   |
-                 Off-|    +-------------------+    +-------------------+
-                     |
-               1 On -|    +----+                   +----+
-                     |    |    |                   |    |
-                 Off |----+    +-------------------+    +------------------
-                     |
-               2 On -|         +----+                   +----+
-                     |         |    |                   |    |
-                 Off-|---------+    +-------------------+    +-------------
-                     |
-               3 On -|              +----+                   +----+
-                     |              |    |                   |    |
-                 Off-|--------------+    +-------------------+    +--------
-                     |
-               4 On -|                   +----+                   +----+
-                     |                   |    |                   |    |
-                 Off-|-------------------+    +-------------------+    +---
-                     |
-                     0---0.8--1.6--2.4--3.2---4---4.8--5.6--6.4--7.2---8--> time (sec)
-
-               Inverted cascade mode for Pipe LED:
-               "30 800 29 800 27 800 23 800 15 800"
-
-                     ^
-                     |
-               0 On -|    +-------------------+    +-------------------+
-                     |    |                   |    |                   |
-                 Off-|----+                   +----+                   +---
-                     |
-               1 On -|----+    +-------------------+    +------------------
-                     |    |    |                   |    |
-                 Off |    +----+                   +----+
-                     |
-               2 On -|---------+    +-------------------+    +-------------
-                     |         |    |                   |    |
-                 Off-|         +----+                   +----+
-                     |
-               3 On -|--------------+    +-------------------+    +--------
-                     |              |    |                   |    |
-                 Off-|              +----+                   +----+
-                     |
-               4 On -|-------------------+    +-------------------+    +---
-                     |                   |    |                   |    |
-                 Off-|                   +----+                   +----+
-                     |
-                     0---0.8--1.6--2.4--3.2---4---4.8--5.6--6.4--7.2---8--> time (sec)
-
-               Bounce mode for Pipe LED:
-               "1 800 2 800 4 800 8 800 16 800 16 800 8 800 4 800 2 800 1 800"
-
-                     ^
-                     |
-               0 On -|----+                                       +--------
-                     |    |                                       |
-                 Off-|    +---------------------------------------+
-                     |
-               1 On -|    +----+                             +----+
-                     |    |    |                             |    |
-                 Off |----+    +-----------------------------+    +--------
-                     |
-               2 On -|         +----+                   +----+
-                     |         |    |                   |    |
-                 Off-|---------+    +-------------------+    +-------------
-                     |
-               3 On -|              +----+         +----+
-                     |              |    |         |    |
-                 Off-|--------------+    +---------+    +------------------
-                     |
-               4 On -|                   +---------+
-                     |                   |         |
-                 Off-|-------------------+         +-----------------------
-                     |
-                     0---0.8--1.6--2.4--3.2---4---4.8--5.6--6.4--7.2---8--> time (sec)
-
-               Inverted bounce mode for Pipe LED:
-               "30 800 29 800 27 800 23 800 15 800 15 800 23 800 27 800 29 800 30 800"
-
-                     ^
-                     |
-               0 On -|    +---------------------------------------+
-                     |    |                                       |
-                 Off-|----+                                       +--------
-                     |
-               1 On -|----+    +-----------------------------+    +--------
-                     |    |    |                             |    |
-                 Off |    +----+                             +----+
-                     |
-               2 On -|---------+    +-------------------+    +-------------
-                     |         |    |                   |    |
-                 Off-|         +----+                   +----+
-                     |
-               3 On -|--------------+    +---------+    +------------------
-                     |              |    |         |    |
-                 Off-|              +----+         +----+
-                     |
-               4 On -|-------------------+         +-----------------------
-                     |                   |         |
-                 Off-|                   +---------+
-                     |
-                     0---0.8--1.6--2.4--3.2---4---4.8--5.6--6.4--7.2---8--> time (sec)
-
 What:          /sys/class/leds/<led>/repeat
 Date:          September 2019
 KernelVersion: 5.5
index e4c89b2..e38a835 100644 (file)
@@ -6,8 +6,10 @@ Description:
                Set the ALS output channel to use as input in
                ALS-current-control mode (1, 2), where:
 
-               1 - out_current1
-               2 - out_current2
+               ==  ============
+               1   out_current1
+               2   out_current2
+               ==  ============
 
 What:          /sys/class/leds/<led>/als_en
 Date:          May 2012
@@ -24,14 +26,16 @@ Contact:    Johan Hovold <jhovold@gmail.com>
 Description:
                Set the pattern generator fall and rise times (0..7), where:
 
-               0 - 2048 us
-               1 - 262 ms
-               2 - 524 ms
-               3 - 1.049 s
-               4 - 2.097 s
-               5 - 4.194 s
-               6 - 8.389 s
-               7 - 16.78 s
+               ==  =======
+               0   2048 us
+               1   262 ms
+               2   524 ms
+               3   1.049 s
+               4   2.097 s
+               5   4.194 s
+               6   8.389 s
+               7   16.78 s
+               ==  =======
 
 What:          /sys/class/leds/<led>/id
 Date:          April 2012
@@ -47,8 +51,10 @@ Contact:     Johan Hovold <jhovold@gmail.com>
 Description:
                Set the brightness-mapping mode (0, 1), where:
 
-               0 - exponential mode
-               1 - linear mode
+               ==  ================
+               0   exponential mode
+               1   linear mode
+               ==  ================
 
 What:          /sys/class/leds/<led>/pwm
 Date:          April 2012
@@ -57,9 +63,11 @@ Contact:     Johan Hovold <jhovold@gmail.com>
 Description:
                Set the PWM-input control mask (5 bits), where:
 
-               bit 5 - PWM-input enabled in Zone 4
-               bit 4 - PWM-input enabled in Zone 3
-               bit 3 - PWM-input enabled in Zone 2
-               bit 2 - PWM-input enabled in Zone 1
-               bit 1 - PWM-input enabled in Zone 0
-               bit 0 - PWM-input enabled
+               =====  ===========================
+               bit 5  PWM-input enabled in Zone 4
+               bit 4  PWM-input enabled in Zone 3
+               bit 3  PWM-input enabled in Zone 2
+               bit 2  PWM-input enabled in Zone 1
+               bit 1  PWM-input enabled in Zone 0
+               bit 0  PWM-input enabled
+               =====  ===========================
diff --git a/Documentation/ABI/testing/sysfs-class-led-driver-sc27xx b/Documentation/ABI/testing/sysfs-class-led-driver-sc27xx
deleted file mode 100644 (file)
index 45b1e60..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-What:          /sys/class/leds/<led>/hw_pattern
-Date:          September 2018
-KernelVersion: 4.20
-Description:
-               Specify a hardware pattern for the SC27XX LED. For the SC27XX
-               LED controller, it only supports 4 stages to make a single
-               hardware pattern, which is used to configure the rise time,
-               high time, fall time and low time for the breathing mode.
-
-               For the breathing mode, the SC27XX LED only expects one brightness
-               for the high stage. To be compatible with the hardware pattern
-               format, we should set brightness as 0 for rise stage, fall
-               stage and low stage.
-
-               Min stage duration: 125 ms
-               Max stage duration: 31875 ms
-
-               Since the stage duration step is 125 ms, the duration should be
-               a multiplier of 125, like 125ms, 250ms, 375ms, 500ms ... 31875ms.
-
-               Thus the format of the hardware pattern values should be:
-               "0 rise_duration brightness high_duration 0 fall_duration 0 low_duration".
index 220a027..11e5677 100644 (file)
@@ -55,26 +55,35 @@ Description:        read only
                Flash faults are re-read after strobing the flash. Possible
                flash faults:
 
-               * led-over-voltage - flash controller voltage to the flash LED
+               * led-over-voltage
+                       flash controller voltage to the flash LED
                        has exceeded the limit specific to the flash controller
-               * flash-timeout-exceeded - the flash strobe was still on when
+               * flash-timeout-exceeded
+                       the flash strobe was still on when
                        the timeout set by the user has expired; not all flash
                        controllers may set this in all such conditions
-               * controller-over-temperature - the flash controller has
+               * controller-over-temperature
+                       the flash controller has
                        overheated
-               * controller-short-circuit - the short circuit protection
+               * controller-short-circuit
+                       the short circuit protection
                        of the flash controller has been triggered
-               * led-power-supply-over-current - current in the LED power
+               * led-power-supply-over-current
+                       current in the LED power
                        supply has exceeded the limit specific to the flash
                        controller
-               * indicator-led-fault - the flash controller has detected
+               * indicator-led-fault
+                       the flash controller has detected
                        a short or open circuit condition on the indicator LED
-               * led-under-voltage - flash controller voltage to the flash
+               * led-under-voltage
+                       flash controller voltage to the flash
                        LED has been below the minimum limit specific to
                        the flash
-               * controller-under-voltage - the input voltage of the flash
+               * controller-under-voltage
+                       the input voltage of the flash
                        controller is below the limit under which strobing the
                        flash at full current will not be possible;
                        the condition persists until this flag is no longer set
-               * led-over-temperature - the temperature of the LED has exceeded
+               * led-over-temperature
+                       the temperature of the LED has exceeded
                        its allowed upper limit
index eeeddcb..16fc827 100644 (file)
@@ -1,20 +1,3 @@
-What:          /sys/class/leds/<led>/brightness
-Date:          March 2020
-KernelVersion: 5.9
-Contact:       Dan Murphy <dmurphy@ti.com>
-Description:   read/write
-               Writing to this file will update all LEDs within the group to a
-               calculated percentage of what each color LED intensity is set
-               to. The percentage is calculated for each grouped LED via the
-               equation below:
-
-               led_brightness = brightness * multi_intensity/max_brightness
-
-               For additional details please refer to
-               Documentation/leds/leds-class-multicolor.rst.
-
-               The value of the LED is from 0 to
-               /sys/class/leds/<led>/max_brightness.
 
 What:          /sys/class/leds/<led>/multi_index
 Date:          March 2020
@@ -25,6 +8,9 @@ Description:   read
                as an array of strings as they are indexed in the
                multi_intensity file.
 
+               For additional details please refer to
+               Documentation/leds/leds-class-multicolor.rst.
+
 What:          /sys/class/leds/<led>/multi_intensity
 Date:          March 2020
 KernelVersion: 5.9
@@ -33,3 +19,6 @@ Description:  read/write
                This file contains array of integers. Order of components is
                described by the multi_index array. The maximum intensity should
                not exceed /sys/class/leds/<led>/max_brightness.
+
+               For additional details please refer to
+               Documentation/leds/leds-class-multicolor.rst.
index 451af6d..6465409 100644 (file)
@@ -19,18 +19,23 @@ KernelVersion:      4.16
 Contact:       linux-leds@vger.kernel.org
 Description:
                Signal the link state of the named network device.
+
                If set to 0 (default), the LED's normal state is off.
+
                If set to 1, the LED's normal state reflects the link state
                of the named network device.
                Setting this value also immediately changes the LED state.
 
+
 What:          /sys/class/leds/<led>/tx
 Date:          Dec 2017
 KernelVersion: 4.16
 Contact:       linux-leds@vger.kernel.org
 Description:
                Signal transmission of data on the named network device.
+
                If set to 0 (default), the LED will not blink on transmission.
+
                If set to 1, the LED will blink for the milliseconds specified
                in interval to signal transmission.
 
@@ -40,6 +45,8 @@ KernelVersion:        4.16
 Contact:       linux-leds@vger.kernel.org
 Description:
                Signal reception of data on the named network device.
+
                If set to 0 (default), the LED will not blink on reception.
+
                If set to 1, the LED will blink for the milliseconds specified
                in interval to signal reception.
index bd92ef9..d91a077 100644 (file)
@@ -23,8 +23,8 @@ Description:
 
                Since different LED hardware can have different semantics of
                hardware patterns, each driver is expected to provide its own
-               description for the hardware patterns in their ABI documentation
-               file.
+               description for the hardware patterns in their documentation
+               file at Documentation/leds/.
 
 What:          /sys/class/leds/<led>/repeat
 Date:          September 2018
index f440e69..eb81152 100644 (file)
@@ -8,5 +8,6 @@ Description:
                selected for the USB port trigger. Selecting ports makes trigger
                observing them for any connected devices and lighting on LED if
                there are any.
+
                Echoing "1" value selects USB port. Echoing "0" unselects it.
                Current state can be also read.
index 6adab27..b57ffb2 100644 (file)
@@ -7,9 +7,11 @@ Description:
                of one LED will update the mode of its two sibling devices as
                well. Possible values are:
 
-               0 - normal
-               1 - audio
-               2 - breathing
+               ==  =========
+               0   normal
+               1   audio
+               2   breathing
+               ==  =========
 
                Normal: LEDs are fully on when enabled
                Audio:  LEDs brightness depends on sound level
index 6ef6826..bd0e780 100644 (file)
@@ -41,24 +41,33 @@ Description:
                When read, this entry provides the current state of an Intel
                MIC device in the context of the card OS. Possible values that
                will be read are:
-               "ready" - The MIC device is ready to boot the card OS. On
-               reading this entry after an OSPM resume, a "boot" has to be
-               written to this entry if the card was previously shutdown
-               during OSPM suspend.
-               "booting" - The MIC device has initiated booting a card OS.
-               "online" - The MIC device has completed boot and is online
-               "shutting_down" - The card OS is shutting down.
-               "resetting" - A reset has been initiated for the MIC device
-               "reset_failed" - The MIC device has failed to reset.
+
+
+               ===============  ===============================================
+               "ready"          The MIC device is ready to boot the card OS.
+                                On reading this entry after an OSPM resume,
+                                a "boot" has to be written to this entry if
+                                the card was previously shutdown during OSPM
+                                suspend.
+               "booting"        The MIC device has initiated booting a card OS.
+               "online"         The MIC device has completed boot and is online
+               "shutting_down"  The card OS is shutting down.
+               "resetting"      A reset has been initiated for the MIC device
+               "reset_failed"   The MIC device has failed to reset.
+               ===============  ===============================================
 
                When written, this sysfs entry triggers different state change
                operations depending upon the current state of the card OS.
                Acceptable values are:
-               "boot" - Boot the card OS image specified by the combination
-                        of firmware, ramdisk, cmdline and bootmode
-                       sysfs entries.
-               "reset" - Initiates device reset.
-               "shutdown" - Initiates card OS shutdown.
+
+
+               ==========  ===================================================
+               "boot"      Boot the card OS image specified by the combination
+                           of firmware, ramdisk, cmdline and bootmode
+                           sysfs entries.
+               "reset"     Initiates device reset.
+               "shutdown"  Initiates card OS shutdown.
+               ==========  ===================================================
 
 What:          /sys/class/mic/mic(x)/shutdown_status
 Date:          October 2013
@@ -69,12 +78,15 @@ Description:
                OS can shutdown because of various reasons. When read, this
                entry provides the status on why the card OS was shutdown.
                Possible values are:
-               "nop" -  shutdown status is not applicable, when the card OS is
-                       "online"
-               "crashed" - Shutdown because of a HW or SW crash.
-               "halted" - Shutdown because of a halt command.
-               "poweroff" - Shutdown because of a poweroff command.
-               "restart" - Shutdown because of a restart command.
+
+               ==========  ===================================================
+               "nop"       shutdown status is not applicable, when the card OS
+                           is "online"
+               "crashed"   Shutdown because of a HW or SW crash.
+               "halted"    Shutdown because of a halt command.
+               "poweroff"  Shutdown because of a poweroff command.
+               "restart"   Shutdown because of a restart command.
+               ==========  ===================================================
 
 What:          /sys/class/mic/mic(x)/cmdline
 Date:          October 2013
index 3b40457..1f2002d 100644 (file)
@@ -4,10 +4,13 @@ KernelVersion:        3.17
 Contact:       netdev@vger.kernel.org
 Description:
                Indicates the name assignment type. Possible values are:
-               1: enumerated by the kernel, possibly in an unpredictable way
-               2: predictably named by the kernel
-               3: named by userspace
-               4: renamed
+
+               == ==========================================================
+               1  enumerated by the kernel, possibly in an unpredictable way
+               2  predictably named by the kernel
+               3  named by userspace
+               4  renamed
+               == ==========================================================
 
 What:          /sys/class/net/<iface>/addr_assign_type
 Date:          July 2010
@@ -15,10 +18,13 @@ KernelVersion:      3.2
 Contact:       netdev@vger.kernel.org
 Description:
                Indicates the address assignment type. Possible values are:
-               0: permanent address
-               1: randomly generated
-               2: stolen from another device
-               3: set using dev_set_mac_address
+
+               == =============================
+               0  permanent address
+               1  randomly generated
+               2  stolen from another device
+               3  set using dev_set_mac_address
+               == =============================
 
 What:          /sys/class/net/<iface>/addr_len
 Date:          April 2005
@@ -51,9 +57,12 @@ Description:
                Default value 0 does not forward any link local frames.
 
                Restricted bits:
-               0: 01-80-C2-00-00-00 Bridge Group Address used for STP
-               1: 01-80-C2-00-00-01 (MAC Control) 802.3 used for MAC PAUSE
-               2: 01-80-C2-00-00-02 (Link Aggregation) 802.3ad
+
+               == ========================================================
+               0  01-80-C2-00-00-00 Bridge Group Address used for STP
+               1  01-80-C2-00-00-01 (MAC Control) 802.3 used for MAC PAUSE
+               2  01-80-C2-00-00-02 (Link Aggregation) 802.3ad
+               == ========================================================
 
                Any values not setting these bits can be used. Take special
                care when forwarding control frames e.g. 802.1X-PAE or LLDP.
@@ -74,8 +83,11 @@ Contact:     netdev@vger.kernel.org
 Description:
                Indicates the current physical link state of the interface.
                Posssible values are:
-               0: physical link is down
-               1: physical link is up
+
+               == =====================
+               0  physical link is down
+               1  physical link is up
+               == =====================
 
                Note: some special devices, e.g: bonding and team drivers will
                allow this attribute to be written to force a link state for
@@ -131,21 +143,27 @@ Contact:  netdev@vger.kernel.org
 Description:
                Indicates whether the interface is under test. Possible
                values are:
-               0: interface is not being tested
-               1: interface is being tested
+
+               == =============================
+               0  interface is not being tested
+               1  interface is being tested
+               == =============================
 
                When an interface is under test, it cannot be expected
                to pass packets as normal.
 
-What:          /sys/clas/net/<iface>/duplex
+What:          /sys/class/net/<iface>/duplex
 Date:          October 2009
 KernelVersion: 2.6.33
 Contact:       netdev@vger.kernel.org
 Description:
                Indicates the interface latest or current duplex value. Possible
                values are:
-               half: half duplex
-               full: full duplex
+
+               ====  ===========
+               half  half duplex
+               full  full duplex
+               ====  ===========
 
                Note: This attribute is only valid for interfaces that implement
                the ethtool get_link_ksettings method (mostly Ethernet).
@@ -196,8 +214,11 @@ Description:
                Indicates the interface link mode, as a decimal number. This
                attribute should be used in conjunction with 'dormant' attribute
                to determine the interface usability. Possible values:
-               0: default link mode
-               1: dormant link mode
+
+               ==  =================
+               0   default link mode
+               1   dormant link mode
+               ==  =================
 
 What:          /sys/class/net/<iface>/mtu
 Date:          April 2005
@@ -226,7 +247,9 @@ KernelVersion:      2.6.17
 Contact:       netdev@vger.kernel.org
 Description:
                Indicates the interface RFC2863 operational state as a string.
+
                Possible values are:
+
                "unknown", "notpresent", "down", "lowerlayerdown", "testing",
                "dormant", "up".
 
index f7be0e8..06416d0 100644 (file)
@@ -91,9 +91,9 @@ Date:         May 2014
 KernelVersion: 3.16
 Contact:       Bjørn Mork <bjorn@mork.no>
 Description:
-               Bit 0: 16-bit NTB supported (set to 1)
-               Bit 1: 32-bit NTB supported
-               Bits 2 – 15: reserved (reset to zero; must be ignored by host)
+               Bit 0: 16-bit NTB supported (set to 1)
+               Bit 1: 32-bit NTB supported
+               Bits 2 – 15: reserved (reset to zero; must be ignored by host)
 
 What:          /sys/class/net/<iface>/cdc_ncm/dwNtbInMaxSize
 Date:          May 2014
index 206cbf5..40ced0e 100644 (file)
@@ -35,7 +35,9 @@ Description:
                Ethernet driver during bus enumeration, encoded in string.
                This interface mode is used to configure the Ethernet MAC with the
                appropriate mode for its data lines to the PHY hardware.
+
                Possible values are:
+
                <empty> (not available), mii, gmii, sgmii, tbi, rev-mii,
                rmii, rgmii, rgmii-id, rgmii-rxid, rgmii-txid, rtbi, smii
                xgmii, moca, qsgmii, trgmii, 1000base-x, 2500base-x, rxaui,
index ae1276e..847a7ed 100644 (file)
@@ -11,8 +11,11 @@ Contact:     linuxppc-dev@lists.ozlabs.org
 Description:   read only
                Number of contexts for the AFU, in the format <n>/<max>
                where:
-                       n:      number of currently active contexts, for debug
-                       max:    maximum number of contexts supported by the AFU
+
+                       ====    ===============================================
+                       n       number of currently active contexts, for debug
+                       max     maximum number of contexts supported by the AFU
+                       ====    ===============================================
 
 What:          /sys/class/ocxl/<afu name>/pp_mmio_size
 Date:          January 2018
@@ -40,7 +43,9 @@ Contact:      linuxppc-dev@lists.ozlabs.org
 Description:   read/write
                Control whether the FPGA is reloaded on a link reset. Enabled
                through a vendor-specific logic block on the FPGA.
-                       0       Do not reload FPGA image from flash
-                       1       Reload FPGA image from flash
-                       unavailable
-                               The device does not support this capability
+
+                       ===========  ===========================================
+                       0            Do not reload FPGA image from flash
+                       1            Reload FPGA image from flash
+                       unavailable  The device does not support this capability
+                       ===========  ===========================================
index dde4f26..ba1ce62 100644 (file)
@@ -11,15 +11,17 @@ KernelVersion:      2.6.20
 Contact:       Thomas Maier <balagi@justmail.de>
 Description:
 
-               add:            (WO) Write a block device id (major:minor) to
+               ==========      ==============================================
+               add             (WO) Write a block device id (major:minor) to
                                create a new pktcdvd device and map it to the
                                block device.
 
-               remove:         (WO) Write the pktcdvd device id (major:minor)
+               remove          (WO) Write the pktcdvd device id (major:minor)
                                to remove the pktcdvd device.
 
-               device_map:     (RO) Shows the device mapping in format:
+               device_map      (RO) Shows the device mapping in format:
                                pktcdvd[0-7] <pktdevid> <blkdevid>
+               ==========      ==============================================
 
 
 What:          /sys/class/pktcdvd/pktcdvd[0-7]/dev
@@ -65,29 +67,31 @@ Date:               Oct. 2006
 KernelVersion: 2.6.20
 Contact:       Thomas Maier <balagi@justmail.de>
 Description:
-               size:           (RO) Contains the size of the bio write queue.
+               ==============  ================================================
+               size            (RO) Contains the size of the bio write queue.
 
-               congestion_off: (RW) If bio write queue size is below this mark,
+               congestion_off  (RW) If bio write queue size is below this mark,
                                accept new bio requests from the block layer.
 
-               congestion_on:  (RW) If bio write queue size is higher as this
+               congestion_on   (RW) If bio write queue size is higher as this
                                mark, do no longer accept bio write requests
                                from the block layer and wait till the pktcdvd
                                device has processed enough bio's so that bio
                                write queue size is below congestion off mark.
                                A value of <= 0 disables congestion control.
+               ==============  ================================================
 
 
 Example:
 --------
-To use the pktcdvd sysfs interface directly, you can do:
-
-# create a new pktcdvd device mapped to /dev/hdc
-echo "22:0" >/sys/class/pktcdvd/add
-cat /sys/class/pktcdvd/device_map
-# assuming device pktcdvd0 was created, look at stat's
-cat /sys/class/pktcdvd/pktcdvd0/stat/kb_written
-# print the device id of the mapped block device
-fgrep pktcdvd0 /sys/class/pktcdvd/device_map
-# remove device, using pktcdvd0 device id   253:0
-echo "253:0" >/sys/class/pktcdvd/remove
+To use the pktcdvd sysfs interface directly, you can do::
+
+    # create a new pktcdvd device mapped to /dev/hdc
+    echo "22:0" >/sys/class/pktcdvd/add
+    cat /sys/class/pktcdvd/device_map
+    # assuming device pktcdvd0 was created, look at stat's
+    cat /sys/class/pktcdvd/pktcdvd0/stat/kb_written
+    # print the device id of the mapped block device
+    fgrep pktcdvd0 /sys/class/pktcdvd/device_map
+    # remove device, using pktcdvd0 device id   253:0
+    echo "253:0" >/sys/class/pktcdvd/remove
index dbccb2f..ca830c6 100644 (file)
@@ -1,4 +1,4 @@
-===== General Properties =====
+**General Properties**
 
 What:          /sys/class/power_supply/<supply_name>/manufacturer
 Date:          May 2007
@@ -36,14 +36,238 @@ Description:
                Access: Read
                Valid values: "Battery", "UPS", "Mains", "USB", "Wireless"
 
-===== Battery Properties =====
+**Battery and USB properties**
+
+What:          /sys/class/power_supply/<supply_name>/current_avg
+Date:          May 2007
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Battery:
+
+                 Reports an average IBAT current reading for the battery, over
+                 a fixed period. Normally devices will provide a fixed interval
+                 in which they average readings to smooth out the reported
+                 value.
+
+               USB:
+
+                 Reports an average IBUS current reading over a fixed period.
+                 Normally devices will provide a fixed interval in which they
+                 average readings to smooth out the reported value.
+
+               Access: Read
+
+               Valid values: Represented in microamps. Negative values are
+               used for discharging batteries, positive values for charging
+               batteries and for USB IBUS current.
+
+What:          /sys/class/power_supply/<supply_name>/current_max
+Date:          October 2010
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Battery:
+
+                 Reports the maximum IBAT current allowed into the battery.
+
+               USB:
+
+                 Reports the maximum IBUS current the supply can support.
+
+               Access: Read
+               Valid values: Represented in microamps
+
+What:          /sys/class/power_supply/<supply_name>/current_now
+Date:          May 2007
+Contact:       linux-pm@vger.kernel.org
+Description:
+
+               Battery:
+
+                 Reports an instant, single IBAT current reading for the
+                 battery. This value is not averaged/smoothed.
+
+                 Access: Read
+
+               USB:
+
+                 Reports the IBUS current supplied now. This value is generally
+                 read-only reporting, unless the 'online' state of the supply
+                 is set to be programmable, in which case this value can be set
+                 within the reported min/max range.
+
+                 Access: Read, Write
+
+               Valid values: Represented in microamps. Negative values are
+               used for discharging batteries, positive values for charging
+               batteries and for USB IBUS current.
+
+What:          /sys/class/power_supply/<supply_name>/temp
+Date:          May 2007
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Battery:
+
+                 Reports the current TBAT battery temperature reading.
+
+               USB:
+
+                 Reports the current supply temperature reading. This would
+                 normally be the internal temperature of the device itself
+                 (e.g TJUNC temperature of an IC)
+
+               Access: Read
+
+               Valid values: Represented in 1/10 Degrees Celsius
+
+What:          /sys/class/power_supply/<supply_name>/temp_alert_max
+Date:          July 2012
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Battery:
+
+                 Maximum TBAT temperature trip-wire value where the supply will
+                 notify user-space of the event.
+
+               USB:
+
+                 Maximum supply temperature trip-wire value where the supply
+                 will notify user-space of the event.
+
+               This is normally used for the charging scenario where
+               user-space needs to know if the temperature has crossed an
+               upper threshold so it can take appropriate action (e.g. warning
+               user that the temperature is critically high, and charging has
+               stopped).
+
+               Access: Read
+
+               Valid values: Represented in 1/10 Degrees Celsius
+
+What:          /sys/class/power_supply/<supply_name>/temp_alert_min
+Date:          July 2012
+Contact:       linux-pm@vger.kernel.org
+Description:
+
+               Battery:
+
+                 Minimum TBAT temperature trip-wire value where the supply will
+                 notify user-space of the event.
+
+               USB:
+
+                 Minimum supply temperature trip-wire value where the supply
+                 will notify user-space of the event.
+
+               This is normally used for the charging scenario where user-space
+               needs to know if the temperature has crossed a lower threshold
+               so it can take appropriate action (e.g. warning user that
+               temperature level is high, and charging current has been
+               reduced accordingly to remedy the situation).
+
+               Access: Read
+
+               Valid values: Represented in 1/10 Degrees Celsius
+
+What:          /sys/class/power_supply/<supply_name>/temp_max
+Date:          July 2014
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Battery:
+
+                 Reports the maximum allowed TBAT battery temperature for
+                 charging.
+
+               USB:
+
+                 Reports the maximum allowed supply temperature for operation.
+
+               Access: Read
+
+               Valid values: Represented in 1/10 Degrees Celsius
+
+What:          /sys/class/power_supply/<supply_name>/temp_min
+Date:          July 2014
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Battery:
+
+                 Reports the minimum allowed TBAT battery temperature for
+                 charging.
+
+               USB:
+
+                 Reports the minimum allowed supply temperature for operation.
+
+               Access: Read
+
+               Valid values: Represented in 1/10 Degrees Celsius
+
+What:          /sys/class/power_supply/<supply_name>/voltage_max,
+Date:          January 2008
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Battery:
+
+                 Reports the maximum safe VBAT voltage permitted for the
+                 battery, during charging.
+
+               USB:
+
+                 Reports the maximum VBUS voltage the supply can support.
+
+               Access: Read
+
+               Valid values: Represented in microvolts
+
+What:          /sys/class/power_supply/<supply_name>/voltage_min,
+Date:          January 2008
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Battery:
+
+                 Reports the minimum safe VBAT voltage permitted for the
+                 battery, during discharging.
+
+               USB:
+
+                 Reports the minimum VBUS voltage the supply can support.
+
+               Access: Read
+
+               Valid values: Represented in microvolts
+
+What:          /sys/class/power_supply/<supply_name>/voltage_now,
+Date:          May 2007
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Battery:
+
+                 Reports an instant, single VBAT voltage reading for the
+                 battery. This value is not averaged/smoothed.
+
+                 Access: Read
+
+               USB:
+
+                 Reports the VBUS voltage supplied now. This value is generally
+                 read-only reporting, unless the 'online' state of the supply
+                 is set to be programmable, in which case this value can be set
+                 within the reported min/max range.
+
+                 Access: Read, Write
+
+               Valid values: Represented in microvolts
+
+**Battery Properties**
 
 What:          /sys/class/power_supply/<supply_name>/capacity
 Date:          May 2007
 Contact:       linux-pm@vger.kernel.org
 Description:
                Fine grain representation of battery capacity.
+
                Access: Read
+
                Valid values: 0 - 100 (percent)
 
 What:          /sys/class/power_supply/<supply_name>/capacity_alert_max
@@ -58,6 +282,7 @@ Description:
                low).
 
                Access: Read, Write
+
                Valid values: 0 - 100 (percent)
 
 What:          /sys/class/power_supply/<supply_name>/capacity_alert_min
@@ -72,6 +297,7 @@ Description:
                critically low).
 
                Access: Read, Write
+
                Valid values: 0 - 100 (percent)
 
 What:          /sys/class/power_supply/<supply_name>/capacity_error_margin
@@ -87,6 +313,7 @@ Description:
                completely useless.
 
                Access: Read
+
                Valid values: 0 - 100 (percent)
 
 What:          /sys/class/power_supply/<supply_name>/capacity_level
@@ -96,40 +323,10 @@ Description:
                Coarse representation of battery capacity.
 
                Access: Read
-               Valid values: "Unknown", "Critical", "Low", "Normal", "High",
-                             "Full"
-
-What:          /sys/class/power_supply/<supply_name>/current_avg
-Date:          May 2007
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports an average IBAT current reading for the battery, over a
-               fixed period. Normally devices will provide a fixed interval in
-               which they average readings to smooth out the reported value.
-
-               Access: Read
-               Valid values: Represented in microamps. Negative values are used
-               for discharging batteries, positive values for charging batteries.
 
-What:          /sys/class/power_supply/<supply_name>/current_max
-Date:          October 2010
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the maximum IBAT current allowed into the battery.
-
-               Access: Read
-               Valid values: Represented in microamps
-
-What:          /sys/class/power_supply/<supply_name>/current_now
-Date:          May 2007
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports an instant, single IBAT current reading for the battery.
-               This value is not averaged/smoothed.
-
-               Access: Read
-               Valid values: Represented in microamps. Negative values are used
-               for discharging batteries, positive values for charging batteries.
+               Valid values:
+                             "Unknown", "Critical", "Low", "Normal", "High",
+                             "Full"
 
 What:          /sys/class/power_supply/<supply_name>/charge_control_limit
 Date:          Oct 2012
@@ -139,6 +336,7 @@ Description:
                throttling for thermal cooling or improving battery health.
 
                Access: Read, Write
+
                Valid values: Represented in microamps
 
 What:          /sys/class/power_supply/<supply_name>/charge_control_limit_max
@@ -148,6 +346,7 @@ Description:
                Maximum legal value for the charge_control_limit property.
 
                Access: Read
+
                Valid values: Represented in microamps
 
 What:          /sys/class/power_supply/<supply_name>/charge_control_start_threshold
@@ -168,6 +367,7 @@ Description:
                stop.
 
                Access: Read, Write
+
                Valid values: 0 - 100 (percent)
 
 What:          /sys/class/power_supply/<supply_name>/charge_type
@@ -183,7 +383,9 @@ Description:
                different algorithm.
 
                Access: Read, Write
-               Valid values: "Unknown", "N/A", "Trickle", "Fast", "Standard",
+
+               Valid values:
+                             "Unknown", "N/A", "Trickle", "Fast", "Standard",
                              "Adaptive", "Custom"
 
 What:          /sys/class/power_supply/<supply_name>/charge_term_current
@@ -194,6 +396,7 @@ Description:
                when the battery is considered full and charging should end.
 
                Access: Read
+
                Valid values: Represented in microamps
 
 What:          /sys/class/power_supply/<supply_name>/health
@@ -204,7 +407,9 @@ Description:
                functionality.
 
                Access: Read
-               Valid values: "Unknown", "Good", "Overheat", "Dead",
+
+               Valid values:
+                             "Unknown", "Good", "Overheat", "Dead",
                              "Over voltage", "Unspecified failure", "Cold",
                              "Watchdog timer expire", "Safety timer expire",
                              "Over current", "Calibration required", "Warm",
@@ -218,6 +423,7 @@ Description:
                for a battery charge cycle.
 
                Access: Read
+
                Valid values: Represented in microamps
 
 What:          /sys/class/power_supply/<supply_name>/present
@@ -227,9 +433,13 @@ Description:
                Reports whether a battery is present or not in the system.
 
                Access: Read
+
                Valid values:
+
+                       == =======
                        0: Absent
                        1: Present
+                       == =======
 
 What:          /sys/class/power_supply/<supply_name>/status
 Date:          May 2007
@@ -240,7 +450,9 @@ Description:
                used to enable/disable charging to the battery.
 
                Access: Read, Write
-               Valid values: "Unknown", "Charging", "Discharging",
+
+               Valid values:
+                             "Unknown", "Charging", "Discharging",
                              "Not charging", "Full"
 
 What:          /sys/class/power_supply/<supply_name>/technology
@@ -250,66 +462,11 @@ Description:
                Describes the battery technology supported by the supply.
 
                Access: Read
-               Valid values: "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe",
-                             "NiCd", "LiMn"
-
-What:          /sys/class/power_supply/<supply_name>/temp
-Date:          May 2007
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the current TBAT battery temperature reading.
-
-               Access: Read
-               Valid values: Represented in 1/10 Degrees Celsius
-
-What:          /sys/class/power_supply/<supply_name>/temp_alert_max
-Date:          July 2012
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Maximum TBAT temperature trip-wire value where the supply will
-               notify user-space of the event. This is normally used for the
-               battery charging scenario where user-space needs to know the
-               battery temperature has crossed an upper threshold so it can
-               take appropriate action (e.g. warning user that battery level is
-               critically high, and charging has stopped).
-
-               Access: Read
-               Valid values: Represented in 1/10 Degrees Celsius
-
-What:          /sys/class/power_supply/<supply_name>/temp_alert_min
-Date:          July 2012
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Minimum TBAT temperature trip-wire value where the supply will
-               notify user-space of the event. This is normally used for the
-               battery charging scenario where user-space needs to know the
-               battery temperature has crossed a lower threshold so it can take
-               appropriate action (e.g. warning user that battery level is
-               high, and charging current has been reduced accordingly to
-               remedy the situation).
-
-               Access: Read
-               Valid values: Represented in 1/10 Degrees Celsius
-
-What:          /sys/class/power_supply/<supply_name>/temp_max
-Date:          July 2014
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the maximum allowed TBAT battery temperature for
-               charging.
-
-               Access: Read
-               Valid values: Represented in 1/10 Degrees Celsius
 
-What:          /sys/class/power_supply/<supply_name>/temp_min
-Date:          July 2014
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the minimum allowed TBAT battery temperature for
-               charging.
+               Valid values:
+                             "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe",
+                             "NiCd", "LiMn"
 
-               Access: Read
-               Valid values: Represented in 1/10 Degrees Celsius
 
 What:          /sys/class/power_supply/<supply_name>/voltage_avg,
 Date:          May 2007
@@ -320,72 +477,10 @@ Description:
                which they average readings to smooth out the reported value.
 
                Access: Read
-               Valid values: Represented in microvolts
-
-What:          /sys/class/power_supply/<supply_name>/voltage_max,
-Date:          January 2008
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the maximum safe VBAT voltage permitted for the battery,
-               during charging.
-
-               Access: Read
-               Valid values: Represented in microvolts
-
-What:          /sys/class/power_supply/<supply_name>/voltage_min,
-Date:          January 2008
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the minimum safe VBAT voltage permitted for the battery,
-               during discharging.
 
-               Access: Read
                Valid values: Represented in microvolts
 
-What:          /sys/class/power_supply/<supply_name>/voltage_now,
-Date:          May 2007
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports an instant, single VBAT voltage reading for the battery.
-               This value is not averaged/smoothed.
-
-               Access: Read
-               Valid values: Represented in microvolts
-
-===== USB Properties =====
-
-What:          /sys/class/power_supply/<supply_name>/current_avg
-Date:          May 2007
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports an average IBUS current reading over a fixed period.
-               Normally devices will provide a fixed interval in which they
-               average readings to smooth out the reported value.
-
-               Access: Read
-               Valid values: Represented in microamps
-
-
-What:          /sys/class/power_supply/<supply_name>/current_max
-Date:          October 2010
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the maximum IBUS current the supply can support.
-
-               Access: Read
-               Valid values: Represented in microamps
-
-What:          /sys/class/power_supply/<supply_name>/current_now
-Date:          May 2007
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the IBUS current supplied now. This value is generally
-               read-only reporting, unless the 'online' state of the supply
-               is set to be programmable, in which case this value can be set
-               within the reported min/max range.
-
-               Access: Read, Write
-               Valid values: Represented in microamps
+**USB Properties**
 
 What:          /sys/class/power_supply/<supply_name>/input_current_limit
 Date:          July 2014
@@ -399,6 +494,7 @@ Description:
                solved using power limit use input_current_limit.
 
                Access: Read, Write
+
                Valid values: Represented in microamps
 
 What:          /sys/class/power_supply/<supply_name>/input_voltage_limit
@@ -416,6 +512,7 @@ Description:
                solved using power limit use input_voltage_limit.
 
                Access: Read, Write
+
                Valid values: Represented in microvolts
 
 What:          /sys/class/power_supply/<supply_name>/input_power_limit
@@ -429,6 +526,7 @@ Description:
                limit only for problems that can be solved using power limit.
 
                Access: Read, Write
+
                Valid values: Represented in microwatts
 
 What:          /sys/class/power_supply/<supply_name>/online,
@@ -441,69 +539,14 @@ Description:
                USB supply so voltage and current can be controlled).
 
                Access: Read, Write
+
                Valid values:
+
+                       == ==================================================
                        0: Offline
                        1: Online Fixed - Fixed Voltage Supply
                        2: Online Programmable - Programmable Voltage Supply
-
-What:          /sys/class/power_supply/<supply_name>/temp
-Date:          May 2007
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the current supply temperature reading. This would
-               normally be the internal temperature of the device itself (e.g
-               TJUNC temperature of an IC)
-
-               Access: Read
-               Valid values: Represented in 1/10 Degrees Celsius
-
-What:          /sys/class/power_supply/<supply_name>/temp_alert_max
-Date:          July 2012
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Maximum supply temperature trip-wire value where the supply will
-               notify user-space of the event. This is normally used for the
-               charging scenario where user-space needs to know the supply
-               temperature has crossed an upper threshold so it can take
-               appropriate action (e.g. warning user that the supply
-               temperature is critically high, and charging has stopped to
-               remedy the situation).
-
-               Access: Read
-               Valid values: Represented in 1/10 Degrees Celsius
-
-What:          /sys/class/power_supply/<supply_name>/temp_alert_min
-Date:          July 2012
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Minimum supply temperature trip-wire value where the supply will
-               notify user-space of the event. This is normally used for the
-               charging scenario where user-space needs to know the supply
-               temperature has crossed a lower threshold so it can take
-               appropriate action (e.g. warning user that the supply
-               temperature is high, and charging current has been reduced
-               accordingly to remedy the situation).
-
-               Access: Read
-               Valid values: Represented in 1/10 Degrees Celsius
-
-What:          /sys/class/power_supply/<supply_name>/temp_max
-Date:          July 2014
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the maximum allowed supply temperature for operation.
-
-               Access: Read
-               Valid values: Represented in 1/10 Degrees Celsius
-
-What:          /sys/class/power_supply/<supply_name>/temp_min
-Date:          July 2014
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the mainimum allowed supply temperature for operation.
-
-               Access: Read
-               Valid values: Represented in 1/10 Degrees Celsius
+                       == ==================================================
 
 What:          /sys/class/power_supply/<supply_name>/usb_type
 Date:          March 2018
@@ -514,40 +557,12 @@ Description:
                is attached.
 
                Access: Read-Only
-               Valid values: "Unknown", "SDP", "DCP", "CDP", "ACA", "C", "PD",
-                             "PD_DRP", "PD_PPS", "BrickID"
-
-What:          /sys/class/power_supply/<supply_name>/voltage_max
-Date:          January 2008
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the maximum VBUS voltage the supply can support.
-
-               Access: Read
-               Valid values: Represented in microvolts
-
-What:          /sys/class/power_supply/<supply_name>/voltage_min
-Date:          January 2008
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the minimum VBUS voltage the supply can support.
 
-               Access: Read
-               Valid values: Represented in microvolts
-
-What:          /sys/class/power_supply/<supply_name>/voltage_now
-Date:          May 2007
-Contact:       linux-pm@vger.kernel.org
-Description:
-               Reports the VBUS voltage supplied now. This value is generally
-               read-only reporting, unless the 'online' state of the supply
-               is set to be programmable, in which case this value can be set
-               within the reported min/max range.
-
-               Access: Read, Write
-               Valid values: Represented in microvolts
+               Valid values:
+                             "Unknown", "SDP", "DCP", "CDP", "ACA", "C", "PD",
+                             "PD_DRP", "PD_PPS", "BrickID"
 
-===== Device Specific Properties =====
+**Device Specific Properties**
 
 What:          /sys/class/power/ds2760-battery.*/charge_now
 Date:          May 2010
@@ -581,6 +596,7 @@ Description:
                will drop to 0 A) and will trigger interrupt.
 
                Valid values:
+
                - 5, 6 or 7 (hours),
                - 0: disabled.
 
@@ -595,6 +611,7 @@ Description:
                will drop to 0 A) and will trigger interrupt.
 
                Valid values:
+
                - 4 - 16 (hours), step by 2 (rounded down)
                - 0: disabled.
 
@@ -609,6 +626,7 @@ Description:
                interrupt and start top-off charging mode.
 
                Valid values:
+
                - 100000 - 200000 (microamps), step by 25000 (rounded down)
                - 200000 - 350000 (microamps), step by 50000 (rounded down)
                - 0: disabled.
@@ -624,6 +642,7 @@ Description:
                will drop to 0 A) and will trigger interrupt.
 
                Valid values:
+
                - 0 - 70 (minutes), step by 10 (rounded down)
 
 What:          /sys/class/power_supply/bq24257-charger/ovp_voltage
@@ -637,6 +656,7 @@ Description:
                device datasheet for details.
 
                Valid values:
+
                - 6000000, 6500000, 7000000, 8000000, 9000000, 9500000, 10000000,
                  10500000 (all uV)
 
@@ -652,6 +672,7 @@ Description:
                lower than the set value. See device datasheet for details.
 
                Valid values:
+
                - 4200000, 4280000, 4360000, 4440000, 4520000, 4600000, 4680000,
                  4760000 (all uV)
 
@@ -666,6 +687,7 @@ Description:
                the charger operates normally. See device datasheet for details.
 
                Valid values:
+
                - 1: enabled
                - 0: disabled
 
@@ -681,6 +703,7 @@ Description:
                from the system. See device datasheet for details.
 
                Valid values:
+
                - 1: enabled
                - 0: disabled
 
@@ -692,6 +715,7 @@ Description:
                manufactured.
 
                Access: Read
+
                Valid values: Reported as integer
 
 What:          /sys/class/power_supply/<supply_name>/manufacture_month
@@ -701,6 +725,7 @@ Description:
                Reports the month when the device has been manufactured.
 
                Access: Read
+
                Valid values: 1-12
 
 What:          /sys/class/power_supply/<supply_name>/manufacture_day
index 327a07e..914d67c 100644 (file)
@@ -5,4 +5,5 @@ Description:
                Represents a battery impedance compensation to accelerate charging.
 
                 Access: Read, Write
+
                 Valid values: Represented in milli-ohms. Valid range is [0, 140].
index b4fd32d..b52f702 100644 (file)
@@ -4,18 +4,20 @@ Description:
        Writing to this can disable charging.
 
        Possible values are:
-               "auto" - draw power as appropriate for detected
-                        power source and battery status.
-               "off"  - do not draw any power.
-               "continuous"
-                      - activate mode described as "linear" in
-                        TWL data sheets.  This uses whatever
-                        current is available and doesn't switch off
-                        when voltage drops.
 
-                        This is useful for unstable power sources
-                        such as bicycle dynamo, but care should
-                        be taken that battery is not over-charged.
+               =============   ===========================================
+               "auto"          draw power as appropriate for detected
+                               power source and battery status.
+               "off"           do not draw any power.
+               "continuous"    activate mode described as "linear" in
+                               TWL data sheets.  This uses whatever
+                               current is available and doesn't switch off
+                               when voltage drops.
+
+                               This is useful for unstable power sources
+                               such as bicycle dynamo, but care should
+                               be taken that battery is not over-charged.
+               =============   ===========================================
 
 What: /sys/class/power_supply/twl4030_ac/mode
 Description:
@@ -23,6 +25,9 @@ Description:
        Writing to this can disable charging.
 
        Possible values are:
-               "auto" - draw power as appropriate for detected
-                        power source and battery status.
-               "off"  - do not draw any power.
+
+               ======  ===========================================
+               "auto"  draw power as appropriate for detected
+                       power source and battery status.
+               "off"   do not draw any power.
+               ======  ===========================================
index 84fde1d..82af180 100644 (file)
@@ -4,17 +4,23 @@ KernelVersion:        5.2
 Description:
                What charging algorithm to use:
 
-               Standard: Fully charges battery at a standard rate.
-               Adaptive: Battery settings adaptively optimized based on
+               Standard:
+                       Fully charges battery at a standard rate.
+               Adaptive:
+                       Battery settings adaptively optimized based on
                        typical battery usage pattern.
-               Fast: Battery charges over a shorter period.
-               Trickle: Extends battery lifespan, intended for users who
+               Fast:
+                       Battery charges over a shorter period.
+               Trickle:
+                       Extends battery lifespan, intended for users who
                        primarily use their Chromebook while connected to AC.
-               Custom: A low and high threshold percentage is specified.
+               Custom:
+                       A low and high threshold percentage is specified.
                        Charging begins when level drops below
                        charge_control_start_threshold, and ceases when
                        level is above charge_control_end_threshold.
-               Long Life: Customized charge rate for last longer battery life.
+               Long Life:
+                       Customized charge rate for last longer battery life.
                        On Wilco device this mode is pre-configured in the factory
                        through EC's private PID. Swiching to a different mode will
                        be denied by Wilco EC when Long Life mode is enabled.
index 8716bee..19aefb2 100644 (file)
@@ -6,6 +6,7 @@ Description:
                The /sys/class/rapidio_port subdirectory contains individual
                subdirectories named as "rapidioN" where N = mport ID registered
                with RapidIO subsystem.
+
                NOTE: An mport ID is not a RapidIO destination ID assigned to a
                given local mport device.
 
@@ -16,7 +17,9 @@ Contact:      Matt Porter <mporter@kernel.crashing.org>,
                Alexandre Bounine <alexandre.bounine@idt.com>
 Description:
                (RO) reports RapidIO common transport system size:
+
                0 = small (8-bit destination ID, max. 256 devices),
+
                1 = large (16-bit destination ID, max. 65536 devices).
 
 What:          /sys/class/rapidio_port/rapidioN/port_destid
@@ -25,31 +28,32 @@ KernelVersion:      v3.15
 Contact:       Matt Porter <mporter@kernel.crashing.org>,
                Alexandre Bounine <alexandre.bounine@idt.com>
 Description:
-               (RO) reports RapidIO destination ID assigned to the given
-               RapidIO mport device. If value 0xFFFFFFFF is returned this means
-               that no valid destination ID have been assigned to the mport
-               (yet). Normally, before enumeration/discovery have been executed
-               only fabric enumerating mports have a valid destination ID
-               assigned to them using "hdid=..." rapidio module parameter.
+
+(RO) reports RapidIO destination ID assigned to the given
+RapidIO mport device. If value 0xFFFFFFFF is returned this means
+that no valid destination ID have been assigned to the mport
+(yet). Normally, before enumeration/discovery have been executed
+only fabric enumerating mports have a valid destination ID
+assigned to them using "hdid=..." rapidio module parameter.
 
 After enumeration or discovery was performed for a given mport device,
 the corresponding subdirectory will also contain subdirectories for each
 child RapidIO device connected to the mport.
 
 The example below shows mport device subdirectory with several child RapidIO
-devices attached to it.
-
-[rio@rapidio ~]$ ls /sys/class/rapidio_port/rapidio0/ -l
-total 0
-drwxr-xr-x 3 root root    0 Feb 11 15:10 00:e:0001
-drwxr-xr-x 3 root root    0 Feb 11 15:10 00:e:0004
-drwxr-xr-x 3 root root    0 Feb 11 15:10 00:e:0007
-drwxr-xr-x 3 root root    0 Feb 11 15:10 00:s:0002
-drwxr-xr-x 3 root root    0 Feb 11 15:10 00:s:0003
-drwxr-xr-x 3 root root    0 Feb 11 15:10 00:s:0005
-lrwxrwxrwx 1 root root    0 Feb 11 15:11 device -> ../../../0000:01:00.0
--r--r--r-- 1 root root 4096 Feb 11 15:11 port_destid
-drwxr-xr-x 2 root root    0 Feb 11 15:11 power
-lrwxrwxrwx 1 root root    0 Feb 11 15:04 subsystem -> ../../../../../../class/rapidio_port
--r--r--r-- 1 root root 4096 Feb 11 15:11 sys_size
--rw-r--r-- 1 root root 4096 Feb 11 15:04 uevent
+devices attached to it::
+
+    [rio@rapidio ~]$ ls /sys/class/rapidio_port/rapidio0/ -l
+    total 0
+    drwxr-xr-x 3 root root    0 Feb 11 15:10 00:e:0001
+    drwxr-xr-x 3 root root    0 Feb 11 15:10 00:e:0004
+    drwxr-xr-x 3 root root    0 Feb 11 15:10 00:e:0007
+    drwxr-xr-x 3 root root    0 Feb 11 15:10 00:s:0002
+    drwxr-xr-x 3 root root    0 Feb 11 15:10 00:s:0003
+    drwxr-xr-x 3 root root    0 Feb 11 15:10 00:s:0005
+    lrwxrwxrwx 1 root root    0 Feb 11 15:11 device -> ../../../0000:01:00.0
+    -r--r--r-- 1 root root 4096 Feb 11 15:11 port_destid
+    drwxr-xr-x 2 root root    0 Feb 11 15:11 power
+    lrwxrwxrwx 1 root root    0 Feb 11 15:04 subsystem -> ../../../../../../class/rapidio_port
+    -r--r--r-- 1 root root 4096 Feb 11 15:11 sys_size
+    -rw-r--r-- 1 root root 4096 Feb 11 15:04 uevent
index 6c0d6c8..9c8ff79 100644 (file)
@@ -21,15 +21,22 @@ KernelVersion:      2.6.36
 Contact:       Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
 Description:
                Reading this file returns a list of available protocols,
-               something like:
+               something like::
+
                    "rc5 [rc6] nec jvc [sony]"
+
                Enabled protocols are shown in [] brackets.
+
                Writing "+proto" will add a protocol to the list of enabled
                protocols.
+
                Writing "-proto" will remove a protocol from the list of enabled
                protocols.
+
                Writing "proto" will enable only "proto".
+
                Writing "none" will disable all protocols.
+
                Write fails with EINVAL if an invalid protocol combination or
                unknown protocol name is used.
 
@@ -39,11 +46,13 @@ KernelVersion:      3.15
 Contact:       Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
 Description:
                Sets the scancode filter expected value.
+
                Use in combination with /sys/class/rc/rcN/filter_mask to set the
                expected value of the bits set in the filter mask.
                If the hardware supports it then scancodes which do not match
                the filter will be ignored. Otherwise the write will fail with
                an error.
+
                This value may be reset to 0 if the current protocol is altered.
 
 What:          /sys/class/rc/rcN/filter_mask
@@ -56,9 +65,11 @@ Description:
                of the scancode which should be compared against the expected
                value. A value of 0 disables the filter to allow all valid
                scancodes to be processed.
+
                If the hardware supports it then scancodes which do not match
                the filter will be ignored. Otherwise the write will fail with
                an error.
+
                This value may be reset to 0 if the current protocol is altered.
 
 What:          /sys/class/rc/rcN/wakeup_protocols
@@ -67,15 +78,22 @@ KernelVersion:      4.11
 Contact:       Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
 Description:
                Reading this file returns a list of available protocols to use
-               for the wakeup filter, something like:
+               for the wakeup filter, something like::
+
                    "rc-5 nec nec-x rc-6-0 rc-6-6a-24 [rc-6-6a-32] rc-6-mce"
+
                Note that protocol variants are listed, so "nec", "sony",
                "rc-5", "rc-6" have their different bit length encodings
                listed if available.
+
                The enabled wakeup protocol is shown in [] brackets.
+
                Only one protocol can be selected at a time.
+
                Writing "proto" will use "proto" for wakeup events.
+
                Writing "none" will disable wakeup.
+
                Write fails with EINVAL if an invalid protocol combination or
                unknown protocol name is used, or if wakeup is not supported by
                the hardware.
@@ -86,13 +104,17 @@ KernelVersion:     3.15
 Contact:       Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
 Description:
                Sets the scancode wakeup filter expected value.
+
                Use in combination with /sys/class/rc/rcN/wakeup_filter_mask to
                set the expected value of the bits set in the wakeup filter mask
                to trigger a system wake event.
+
                If the hardware supports it and wakeup_filter_mask is not 0 then
                scancodes which match the filter will wake the system from e.g.
                suspend to RAM or power off.
+
                Otherwise the write will fail with an error.
+
                This value may be reset to 0 if the wakeup protocol is altered.
 
 What:          /sys/class/rc/rcN/wakeup_filter_mask
@@ -101,11 +123,15 @@ KernelVersion:    3.15
 Contact:       Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
 Description:
                Sets the scancode wakeup filter mask of bits to compare.
+
                Use in combination with /sys/class/rc/rcN/wakeup_filter to set
                the bits of the scancode which should be compared against the
                expected value to trigger a system wake event.
+
                If the hardware supports it and wakeup_filter_mask is not 0 then
                scancodes which match the filter will wake the system from e.g.
                suspend to RAM or power off.
+
                Otherwise the write will fail with an error.
+
                This value may be reset to 0 if the wakeup protocol is altered.
index bc578bc..8516f08 100644 (file)
@@ -35,13 +35,13 @@ Description:
 
                This will be one of the following strings:
 
-                       off
-                       on
-                       error
-                       fast
-                       normal
-                       idle
-                       standby
+                       off
+                       on
+                       error
+                       fast
+                       normal
+                       idle
+                       standby
 
                "off" means the regulator is not supplying power to the
                system.
@@ -74,9 +74,9 @@ Description:
 
                This will be one of the following strings:
 
-               'voltage'
-               'current'
-               'unknown'
+               'voltage'
+               'current'
+               'unknown'
 
                'voltage' means the regulator output voltage can be controlled
                by software.
@@ -129,11 +129,11 @@ Description:
 
                The opmode value can be one of the following strings:
 
-               'fast'
-               'normal'
-               'idle'
-               'standby'
-               'unknown'
+               'fast'
+               'normal'
+               'idle'
+               'standby'
+               'unknown'
 
                The modes are described in include/linux/regulator/consumer.h
 
@@ -360,9 +360,9 @@ Description:
 
                This will be one of the following strings:
 
-               'enabled'
-               'disabled'
-               'unknown'
+               'enabled'
+               'disabled'
+               'unknown'
 
                'enabled' means the regulator is in bypass mode.
 
index 066b9b6..0c9ee55 100644 (file)
@@ -16,11 +16,11 @@ Description:        Remote processor state
 
                Reports the state of the remote processor, which will be one of:
 
-               "offline"
-               "suspended"
-               "running"
-               "crashed"
-               "invalid"
+               "offline"
+               "suspended"
+               "running"
+               "crashed"
+               "invalid"
 
                "offline" means the remote processor is powered off.
 
@@ -38,8 +38,8 @@ Description:  Remote processor state
                Writing this file controls the state of the remote processor.
                The following states can be written:
 
-               "start"
-               "stop"
+               "start"
+               "stop"
 
                Writing "start" will attempt to start the processor running the
                firmware indicated by, or written to,
index c084f20..00c0286 100644 (file)
@@ -5,62 +5,70 @@ Contact:      Jack Wang <jinpu.wang@cloud.ionos.com> Danil Kipnis <danil.kipnis@cloud
 Description:   Provide information about RNBD-client.
                All sysfs files that are not read-only provide the usage information on read:
 
-               Example:
-               # cat /sys/class/rnbd-client/ctl/map_device
+               Example::
 
-               > Usage: echo "sessname=<name of the rtrs session> path=<[srcaddr,]dstaddr>
-               > [path=<[srcaddr,]dstaddr>] device_path=<full path on remote side>
-               > [access_mode=<ro|rw|migration>] > map_device
-               >
-               > addr ::= [ ip:<ipv4> | ip:<ipv6> | gid:<gid> ]
+                   # cat /sys/class/rnbd-client/ctl/map_device
+
+                   > Usage: echo "sessname=<name of the rtrs session> path=<[srcaddr,]dstaddr>
+                   > [path=<[srcaddr,]dstaddr>] device_path=<full path on remote side>
+                   > [access_mode=<ro|rw|migration>] > map_device
+                   >
+                   > addr ::= [ ip:<ipv4> | ip:<ipv6> | gid:<gid> ]
 
 What:          /sys/class/rnbd-client/ctl/map_device
 Date:          Feb 2020
 KernelVersion: 5.7
 Contact:       Jack Wang <jinpu.wang@cloud.ionos.com> Danil Kipnis <danil.kipnis@cloud.ionos.com>
-Description:   Expected format is the following:
+Description:   Expected format is the following::
 
-               sessname=<name of the rtrs session>
-               path=<[srcaddr,]dstaddr> [path=<[srcaddr,]dstaddr> ...]
-               device_path=<full path on remote side>
-               [access_mode=<ro|rw|migration>]
+                   sessname=<name of the rtrs session>
+                   path=<[srcaddr,]dstaddr> [path=<[srcaddr,]dstaddr> ...]
+                   device_path=<full path on remote side>
+                   [access_mode=<ro|rw|migration>]
 
                Where:
 
-               sessname: accepts a string not bigger than 256 chars, which identifies
-               a given session on the client and on the server.
-               I.e. "clt_hostname-srv_hostname" could be a natural choice.
+               sessname:
+                   accepts a string not bigger than 256 chars, which identifies
+                   a given session on the client and on the server.
+                   I.e. "clt_hostname-srv_hostname" could be a natural choice.
+
+               path:
+                   describes a connection between the client and the server by
+                   specifying destination and, when required, the source address.
+                   The addresses are to be provided in the following format::
 
-               path:     describes a connection between the client and the server by
-               specifying destination and, when required, the source address.
-               The addresses are to be provided in the following format:
+                       ip:<IPv6>
+                       ip:<IPv4>
+                       gid:<GID>
 
-               ip:<IPv6>
-               ip:<IPv4>
-               gid:<GID>
+               for example::
 
-               for example:
+                   path=ip:10.0.0.66
 
-               path=ip:10.0.0.66
                The single addr is treated as the destination.
                The connection will be established to this server from any client IP address.
 
-               path=ip:10.0.0.66,ip:10.0.1.66
+               ::
+
+                   path=ip:10.0.0.66,ip:10.0.1.66
+
                First addr is the source address and the second is the destination.
 
                If multiple "path=" options are specified multiple connection
                will be established and data will be sent according to
                the selected multipath policy (see RTRS mp_policy sysfs entry description).
 
-               device_path: Path to the block device on the server side. Path is specified
-               relative to the directory on server side configured in the
-               'dev_search_path' module parameter of the rnbd_server.
-               The rnbd_server prepends the <device_path> received from client
-               with <dev_search_path> and tries to open the
-               <dev_search_path>/<device_path> block device.  On success,
-               a /dev/rnbd<N> device file, a /sys/block/rnbd_client/rnbd<N>/
-               directory and an entry in /sys/class/rnbd-client/ctl/devices
-               will be created.
+               device_path:
+                   Path to the block device on the server side. Path is specified
+                   relative to the directory on server side configured in the
+                   'dev_search_path' module parameter of the rnbd_server.
+                   The rnbd_server prepends the <device_path> received from client
+                   with <dev_search_path> and tries to open the
+                   <dev_search_path>/<device_path> block device.  On success,
+                   a /dev/rnbd<N> device file, a /sys/block/rnbd_client/rnbd<N>/
+                   directory and an entry in /sys/class/rnbd-client/ctl/devices
+                   will be created.
 
                If 'dev_search_path' contains '%SESSNAME%', then each session can
                have different devices namespace, e.g. server was configured with
@@ -68,11 +76,12 @@ Description:        Expected format is the following:
                client has this string "sessname=blya device_path=sda", then server
                will try to open: /run/rnbd-devs/blya/sda.
 
-               access_mode: the access_mode parameter specifies if the device is to be
-               mapped as "ro" read-only or "rw" read-write. The server allows
-               a device to be exported in rw mode only once. The "migration"
-               access mode has to be specified if a second mapping in read-write
-               mode is desired.
+               access_mode:
+                   the access_mode parameter specifies if the device is to be
+                   mapped as "ro" read-only or "rw" read-write. The server allows
+                   a device to be exported in rw mode only once. The "migration"
+                   access mode has to be specified if a second mapping in read-write
+                   mode is desired.
 
                By default "rw" is used.
 
@@ -91,7 +100,7 @@ Description: Expected format is the following:
                is the same as the device name.  By extracting the last part of the
                path the path to the device /dev/<dev-name> can be build.
 
-               o /dev/block/$(cat /sys/class/rnbd-client/ctl/devices/<device_id>/dev)
+               * /dev/block/$(cat /sys/class/rnbd-client/ctl/devices/<device_id>/dev)
 
                How to find the <device_id> of the device is described on the next
                section.
@@ -106,6 +115,6 @@ Description:        For each device mapped on the client a new symbolic link is created
                The <device_id> of each device is created as follows:
 
                - If the 'device_path' provided during mapping contains slashes ("/"),
-               they are replaced by exclamation mark ("!") and used as as the
-               <device_id>. Otherwise, the <device_id> will be the same as the
-               "device_path" provided.
+                 they are replaced by exclamation mark ("!") and used as as the
+                 <device_id>. Otherwise, the <device_id> will be the same as the
+                 "device_path" provided.
index ec950c9..ee8ed64 100644 (file)
@@ -7,6 +7,7 @@ Description:    Attribute for calibrating ST-Ericsson AB8500 Real Time Clock
                 calibrate the AB8500.s 32KHz Real Time Clock.
                 Every 60 seconds the AB8500 will correct the RTC's value
                 by adding to it the value of this attribute.
+
                 The range of the attribute is -127 to +127 in units of
                 30.5 micro-seconds (half-parts-per-million of the 32KHz clock)
 Users:          The /vendor/st-ericsson/base_utilities/core/rtc_calibration
index e7e718d..0f7165a 100644 (file)
@@ -10,10 +10,10 @@ Date:               Feb 2020
 KernelVersion: 5.7
 Contact:       Jack Wang <jinpu.wang@cloud.ionos.com> Danil Kipnis <danil.kipnis@cloud.ionos.com>
 Description:   RW, adds a new path (connection) to an existing session. Expected format is the
-               following:
+               following::
 
-               <[source addr,]destination addr>
-               *addr ::= [ ip:<ipv4|ipv6> | gid:<gid> ]
+                   <[source addr,]destination addr>
+                   *addr ::= [ ip:<ipv4|ipv6> | gid:<gid> ]
 
 What:          /sys/class/rtrs-client/<session-name>/max_reconnect_attempts
 Date:          Feb 2020
@@ -29,10 +29,10 @@ Contact:    Jack Wang <jinpu.wang@cloud.ionos.com> Danil Kipnis <danil.kipnis@cloud
 Description:   Multipath policy specifies which path should be selected on each IO:
 
                round-robin (0):
-               select path in per CPU round-robin manner.
+                   select path in per CPU round-robin manner.
 
                min-inflight (1):
-               select path with minimum inflights.
+                   select path with minimum inflights.
 
 What:          /sys/class/rtrs-client/<session-name>/paths/
 Date:          Feb 2020
@@ -109,8 +109,11 @@ Description:       RTRS expects that each HCA IRQ is pinned to a separate CPU. If it's
                not the case, the processing of an I/O response could be processed on a
                different CPU than where it was originally submitted.  This file shows
                how many interrupts where generated on a non expected CPU.
-               "from:" is the CPU on which the IRQ was expected, but not generated.
-               "to:" is the CPU on which the IRQ was generated, but not expected.
+
+               "from:"
+                   is the CPU on which the IRQ was expected, but not generated.
+               "to:"
+                   is the CPU on which the IRQ was generated, but not expected.
 
 What:          /sys/class/rtrs-client/<session-name>/paths/<src@dst>/stats/reconnects
 Date:          Feb 2020
@@ -125,7 +128,7 @@ Date:               Feb 2020
 KernelVersion: 5.7
 Contact:       Jack Wang <jinpu.wang@cloud.ionos.com> Danil Kipnis <danil.kipnis@cloud.ionos.com>
 Description:   Contains statistics regarding rdma operations and inflight operations.
-               The output consists of 6 values:
+               The output consists of 6 values::
 
-               <read-count> <read-total-size> <write-count> <write-total-size> \
-               <inflights> <failovered>
+                   <read-count> <read-total-size> <write-count> \
+                   <write-total-size> <inflights> <failovered>
index bafc59f..7c98d8f 100644 (file)
@@ -56,8 +56,9 @@ Description:
                management) on top, which makes it match the Windows IRST (Intel
                Rapid Storage Technology) driver settings. This setting is also
                close to min_power, except that:
+
                a) It does not use host-initiated slumber mode, but it does
-               allow device-initiated slumber
+                  allow device-initiated slumber
                b) It does not enable low power device sleep mode (DevSlp).
 
 What:          /sys/class/scsi_host/hostX/em_message
@@ -70,8 +71,8 @@ Description:
                protocol, writes and reads correspond to the LED message format
                as defined in the AHCI spec.
 
-               The user must turn sw_activity (under /sys/block/*/device/) OFF
-               it they wish to control the activity LED via the em_message
+               The user must turn sw_activity (under `/sys/block/*/device/`)
+               OFF it they wish to control the activity LED via the em_message
                file.
 
                em_message_type: (RO) Displays the current enclosure management
index b834671..b7794e0 100644 (file)
@@ -40,10 +40,13 @@ Description:
                attribute will not return until the operation has finished.
 
                Valid values:
-               - source (The port will behave as source only DFP port)
-               - sink (The port will behave as sink only UFP port)
-               - dual (The port will behave as dual-role-data and
+
+               ======  ==============================================
+               source  (The port will behave as source only DFP port)
+               sink    (The port will behave as sink only UFP port)
+               dual    (The port will behave as dual-role-data and
                        dual-role-power port)
+               ======  ==============================================
 
 What:          /sys/class/typec/<port>/vconn_source
 Date:          April 2017
@@ -59,6 +62,7 @@ Description:
                generates uevent KOBJ_CHANGE.
 
                Valid values:
+
                - "no" when the port is not the VCONN Source
                - "yes" when the port is the VCONN Source
 
@@ -72,6 +76,7 @@ Description:
                power operation mode should show "usb_power_delivery".
 
                Valid values:
+
                - default
                - 1.5A
                - 3.0A
@@ -191,6 +196,7 @@ Date:               April 2017
 Contact:       Heikki Krogerus <heikki.krogerus@linux.intel.com>
 Description:
                Shows type of the plug on the cable:
+
                - type-a - Standard A
                - type-b - Standard B
                - type-c
index a057875..6c5dcad 100644 (file)
@@ -66,11 +66,14 @@ Description:
                 <channel> <type> [<bpst offset>]
 
                 to start (or stop) scanning on a channel.  <type> is one of:
-                    0 - scan
-                    1 - scan outside BP
-                    2 - scan while inactive
-                    3 - scanning disabled
-                    4 - scan (with start time of <bpst offset>)
+
+                  ==   =======================================
+                    0   scan
+                    1   scan outside BP
+                    2   scan while inactive
+                    3   scanning disabled
+                    4   scan (with start time of <bpst offset>)
+                  ==   =======================================
 
 What:           /sys/class/uwb_rc/uwbN/mac_address
 Date:           July 2008
index 9860a8b..585caec 100644 (file)
@@ -91,10 +91,13 @@ Description:
                h/w strapping (for WDT2 only).
 
                At alternate flash the 'access_cs0' sysfs node provides:
-                       ast2400: a way to get access to the primary SPI flash
+
+                       ast2400:
+                               a way to get access to the primary SPI flash
                                chip at CS0 after booting from the alternate
                                chip at CS1.
-                       ast2500: a way to restore the normal address mapping
+                       ast2500:
+                               a way to restore the normal address mapping
                                from (CS0->CS1, CS1->CS0) to (CS0->CS0,
                                CS1->CS1).
 
index a9f2b8b..d173906 100644 (file)
@@ -9,9 +9,10 @@ Description:   The /sys/dev tree provides a method to look up the sysfs
                the form "<major>:<minor>".  These links point to the
                corresponding sysfs path for the given device.
 
-               Example:
-               $ readlink /sys/dev/block/8:32
-               ../../block/sdc
+               Example::
+
+                 $ readlink /sys/dev/block/8:32
+                 ../../block/sdc
 
                Entries in /sys/dev/char and /sys/dev/block will be
                dynamically created and destroyed as devices enter and
index 490ccfd..8d202ba 100644 (file)
@@ -8,26 +8,27 @@ Description:
                 block.
                 For example, on 4-die Xeon platform with up to 6 IIO stacks per
                 die and, therefore, 6 IIO PMON blocks per die, the mapping of
-                IIO PMON block 0 exposes as the following:
+                IIO PMON block 0 exposes as the following::
 
-                $ ls /sys/devices/uncore_iio_0/die*
-                -r--r--r-- /sys/devices/uncore_iio_0/die0
-                -r--r--r-- /sys/devices/uncore_iio_0/die1
-                -r--r--r-- /sys/devices/uncore_iio_0/die2
-                -r--r--r-- /sys/devices/uncore_iio_0/die3
+                   $ ls /sys/devices/uncore_iio_0/die*
+                   -r--r--r-- /sys/devices/uncore_iio_0/die0
+                   -r--r--r-- /sys/devices/uncore_iio_0/die1
+                   -r--r--r-- /sys/devices/uncore_iio_0/die2
+                   -r--r--r-- /sys/devices/uncore_iio_0/die3
 
-                $ tail /sys/devices/uncore_iio_0/die*
-                ==> /sys/devices/uncore_iio_0/die0 <==
-                0000:00
-                ==> /sys/devices/uncore_iio_0/die1 <==
-                0000:40
-                ==> /sys/devices/uncore_iio_0/die2 <==
-                0000:80
-                ==> /sys/devices/uncore_iio_0/die3 <==
-                0000:c0
+                   $ tail /sys/devices/uncore_iio_0/die*
+                   ==> /sys/devices/uncore_iio_0/die0 <==
+                   0000:00
+                   ==> /sys/devices/uncore_iio_0/die1 <==
+                   0000:40
+                   ==> /sys/devices/uncore_iio_0/die2 <==
+                   0000:80
+                   ==> /sys/devices/uncore_iio_0/die3 <==
+                   0000:c0
 
-                Which means:
-                IIO PMU 0 on die 0 belongs to PCI RP on bus 0x00, domain 0x0000
-                IIO PMU 0 on die 1 belongs to PCI RP on bus 0x40, domain 0x0000
-                IIO PMU 0 on die 2 belongs to PCI RP on bus 0x80, domain 0x0000
-                IIO PMU 0 on die 3 belongs to PCI RP on bus 0xc0, domain 0x0000
+                Which means::
+
+                   IIO PMU 0 on die 0 belongs to PCI RP on bus 0x00, domain 0x0000
+                   IIO PMU 0 on die 1 belongs to PCI RP on bus 0x40, domain 0x0000
+                   IIO PMU 0 on die 2 belongs to PCI RP on bus 0x80, domain 0x0000
+                   IIO PMU 0 on die 3 belongs to PCI RP on bus 0xc0, domain 0x0000
index deef3b5..2da2b1f 100644 (file)
@@ -47,16 +47,19 @@ Description:
                online/offline state of the memory section.  When written,
                root can toggle the the online/offline state of a removable
                memory section (see removable file description above)
-               using the following commands.
-               # echo online > /sys/devices/system/memory/memoryX/state
-               # echo offline > /sys/devices/system/memory/memoryX/state
+               using the following commands::
+
+                 # echo online > /sys/devices/system/memory/memoryX/state
+                 # echo offline > /sys/devices/system/memory/memoryX/state
 
                For example, if /sys/devices/system/memory/memory22/removable
                contains a value of 1 and
                /sys/devices/system/memory/memory22/state contains the
                string "online" the following command can be executed by
-               by root to offline that section.
-               # echo offline > /sys/devices/system/memory/memory22/state
+               by root to offline that section::
+
+                 # echo offline > /sys/devices/system/memory/memory22/state
+
 Users:         hotplug memory remove tools
                http://www.ibm.com/developerworks/wikis/display/LinuxP/powerpc-utils
 
@@ -78,6 +81,7 @@ Description:
 
                For example, the following symbolic link is created for
                memory section 9 on node0:
+
                /sys/devices/system/memory/memory9/node0 -> ../../node/node0
 
 
@@ -90,4 +94,5 @@ Description:
                points to the corresponding /sys/devices/system/memory/memoryY
                memory section directory.  For example, the following symbolic
                link is created for memory section 9 on node0.
+
                /sys/devices/system/node/node0/memory9 -> ../../memory/memory9
index 7e43cdc..f7b360a 100644 (file)
@@ -7,6 +7,7 @@ Description:
                (RO) Hexadecimal bitmask of the TAD attributes are reported by
                the platform firmware (see ACPI 6.2, section 9.18.2):
 
+               ======= ======================================================
                BIT(0): AC wakeup implemented if set
                BIT(1): DC wakeup implemented if set
                BIT(2): Get/set real time features implemented if set
@@ -16,6 +17,7 @@ Description:
                BIT(6): The AC timer wakes up from S5 if set
                BIT(7): The DC timer wakes up from S4 if set
                BIT(8): The DC timer wakes up from S5 if set
+               ======= ======================================================
 
                The other bits are reserved.
 
@@ -62,9 +64,11 @@ Description:
                timer status with the following meaning of bits (see ACPI 6.2,
                Section 9.18.5):
 
+               ======= ======================================================
                Bit(0): The timer has expired if set.
                Bit(1): The timer has woken up the system from a sleep state
                        (S3 or S4/S5 if supported) if set.
+               ======= ======================================================
 
                The other bits are reserved.
 
index d548eaa..40f29a0 100644 (file)
@@ -3,8 +3,9 @@ Date:           April 2010
 Contact:       Fabien Chouteau <fabien.chouteau@barco.com>
 Description:
                Show the suspend state of an USB composite gadget.
-               1 -> suspended
-               0 -> resumed
+
+               - 1 -> suspended
+               - 0 -> resumed
 
                (_UDC_ is the name of the USB Device Controller driver)
 
@@ -17,5 +18,6 @@ Description:
                Storage mode.
 
                Possible values are:
-                       1 -> ignore the FUA flag
-                       0 -> obey the FUA flag
+
+                       - 1 -> ignore the FUA flag
+                       - 0 -> obey the FUA flag
index 8aa3671..378c426 100644 (file)
@@ -9,8 +9,10 @@ Description:
                The protection has information embedded whether it blocks reads,
                writes or both.
                The result is:
-               0 -> the DPS is not keylocked
-               1 -> the DPS is keylocked
+
+               - 0 -> the DPS is not keylocked
+               - 1 -> the DPS is keylocked
+
 Users:         None identified so far.
 
 What:          /sys/devices/platform/docg3/f[0-3]_dps[01]_protection_key
@@ -27,8 +29,12 @@ Description:
                Entering the correct value toggle the lock, and can be observed
                through f[0-3]_dps[01]_is_keylocked.
                Possible values are:
+
                        - 8 bytes
+
                Typical values are:
+
                        - "00000000"
                        - "12345678"
+
 Users:         None identified so far.
index afb5db8..07df0dd 100644 (file)
@@ -123,38 +123,40 @@ KernelVersion:    v4.15
 Contact:       openipmi-developer@lists.sourceforge.net
 Description:
 
-               idles:                  (RO) Number of times the interface was
+               ======================  ========================================
+               idles                   (RO) Number of times the interface was
                                        idle while being polled.
 
-               watchdog_pretimeouts:   (RO) Number of watchdog pretimeouts.
+               watchdog_pretimeouts    (RO) Number of watchdog pretimeouts.
 
-               complete_transactions:  (RO) Number of completed messages.
+               complete_transactions   (RO) Number of completed messages.
 
-               events:                 (RO) Number of IPMI events received from
+               events                  (RO) Number of IPMI events received from
                                        the hardware.
 
-               interrupts:             (RO) Number of interrupts the driver
+               interrupts              (RO) Number of interrupts the driver
                                        handled.
 
-               hosed_count:            (RO) Number of times the hardware didn't
+               hosed_count             (RO) Number of times the hardware didn't
                                        follow the state machine.
 
-               long_timeouts:          (RO) Number of times the driver
+               long_timeouts           (RO) Number of times the driver
                                        requested a timer while nothing was in
                                        progress.
 
-               flag_fetches:           (RO) Number of times the driver
+               flag_fetches            (RO) Number of times the driver
                                        requested flags from the hardware.
 
-               attentions:             (RO) Number of time the driver got an
+               attentions              (RO) Number of time the driver got an
                                        ATTN from the hardware.
 
-               incoming_messages:      (RO) Number of asynchronous messages
+               incoming_messages       (RO) Number of asynchronous messages
                                        received.
 
-               short_timeouts:         (RO) Number of times the driver
+               short_timeouts          (RO) Number of times the driver
                                        requested a timer while an operation was
                                        in progress.
+               ======================  ========================================
 
 
 What:          /sys/devices/platform/ipmi_si.*/interrupts_enabled
@@ -201,38 +203,40 @@ Date:             Sep, 2017
 KernelVersion: v4.15
 Contact:       openipmi-developer@lists.sourceforge.net
 Description:
-               hosed:                  (RO) Number of times the hardware didn't
+               ======================  ========================================
+               hosed                   (RO) Number of times the hardware didn't
                                        follow the state machine.
 
-               alerts:                 (RO) Number of alerts received.
+               alerts                  (RO) Number of alerts received.
 
-               sent_messages:          (RO) Number of total messages sent.
+               sent_messages           (RO) Number of total messages sent.
 
-               sent_message_parts:     (RO) Number of message parts sent.
+               sent_message_parts      (RO) Number of message parts sent.
                                        Messages may be broken into parts if
                                        they are long.
 
-               received_messages:      (RO) Number of message responses
+               received_messages       (RO) Number of message responses
                                        received.
 
-               received_message_parts: (RO) Number of message fragments
+               received_message_parts  (RO) Number of message fragments
                                        received.
 
-               events:                 (RO) Number of received events.
+               events                  (RO) Number of received events.
 
-               watchdog_pretimeouts:   (RO) Number of watchdog pretimeouts.
+               watchdog_pretimeouts    (RO) Number of watchdog pretimeouts.
 
-               flag_fetches:           (RO) Number of times a flag fetch was
+               flag_fetches            (RO) Number of times a flag fetch was
                                        requested.
 
-               send_retries:           (RO) Number of time a message was
+               send_retries            (RO) Number of time a message was
                                        retried.
 
-               receive_retries:        (RO) Number of times the receive of a
+               receive_retries         (RO) Number of times the receive of a
                                        message was retried.
 
-               send_errors:            (RO) Number of times the send of a
+               send_errors             (RO) Number of times the send of a
                                        message failed.
 
-               receive_errors:         (RO) Number of errors in receiving
+               receive_errors          (RO) Number of errors in receiving
                                        messages.
+               ======================  ========================================
index 2107082..e45ac2e 100644 (file)
@@ -17,10 +17,10 @@ Description:
                to overlay planes.
 
                Selects the composition mode for the overlay. Possible values
-               are
+               are:
 
-               0 - Alpha Blending
-               1 - ROP3
+               0 - Alpha Blending
+               1 - ROP3
 
 What:          /sys/devices/platform/sh_mobile_lcdc_fb.[0-3]/graphics/fb[0-9]/ovl_position
 Date:          May 2012
@@ -30,7 +30,7 @@ Description:
                to overlay planes.
 
                Stores the x,y overlay position on the display in pixels. The
-               position format is `[0-9]+,[0-9]+'.
+               position format is `[0-9]+,[0-9]+`.
 
 What:          /sys/devices/platform/sh_mobile_lcdc_fb.[0-3]/graphics/fb[0-9]/ovl_rop3
 Date:          May 2012
index a8daceb..ee253b0 100644 (file)
@@ -102,6 +102,8 @@ Description:
                b[15:0]
                        inform firmware the current software execution
                        stage.
+
+                       ==      ===========================================
                        0       the first stage bootloader didn't run or
                                didn't reach the point of launching second
                                stage bootloader.
@@ -111,21 +113,29 @@ Description:
                        2       both first and second stage bootloader ran
                                and the operating system launch was
                                attempted.
+                       ==      ===========================================
 
                b[16]
+                       ==      ===========================================
                        1       firmware to reset current image retry
                                counter.
                        0       no action.
+                       ==      ===========================================
 
                b[17]
+                       ==      ===========================================
                        1       firmware to clear RSU log
                        0       no action.
+                       ==      ===========================================
 
                b[18]
                        this is negative logic
+
+                       ==      ===========================================
                        1       no action
                        0       firmware record the notify code defined
                                in b[15:0].
+                       ==      ===========================================
 
 What:          /sys/devices/platform/stratix10-rsu.0/dcmf0
 Date:          June 2020
index b555df8..1a04ca8 100644 (file)
@@ -151,23 +151,28 @@ Description:
                The processor idle states which are available for use have the
                following attributes:
 
-               name: (RO) Name of the idle state (string).
+               ======== ==== =================================================
+               name:    (RO) Name of the idle state (string).
 
                latency: (RO) The latency to exit out of this idle state (in
-               microseconds).
+                             microseconds).
 
-               power: (RO) The power consumed while in this idle state (in
-               milliwatts).
+               power:   (RO) The power consumed while in this idle state (in
+                             milliwatts).
 
-               time: (RO) The total time spent in this idle state (in microseconds).
+               time:    (RO) The total time spent in this idle state
+                             (in microseconds).
 
-               usage: (RO) Number of times this state was entered (a count).
+               usage:   (RO) Number of times this state was entered (a count).
 
-               above: (RO) Number of times this state was entered, but the
-                      observed CPU idle duration was too short for it (a count).
+               above:   (RO) Number of times this state was entered, but the
+                             observed CPU idle duration was too short for it
+                             (a count).
 
-               below: (RO) Number of times this state was entered, but the
-                      observed CPU idle duration was too long for it (a count).
+               below:   (RO) Number of times this state was entered, but the
+                             observed CPU idle duration was too long for it
+                             (a count).
+               ======== ==== =================================================
 
 What:          /sys/devices/system/cpu/cpuX/cpuidle/stateN/desc
 Date:          February 2008
@@ -290,6 +295,7 @@ Description:        Processor frequency boosting control
                This switch controls the boost setting for the whole system.
                Boosting allows the CPU and the firmware to run at a frequency
                beyound it's nominal limit.
+
                More details can be found in
                Documentation/admin-guide/pm/cpufreq.rst
 
@@ -337,43 +343,57 @@ Contact:  Sudeep Holla <sudeep.holla@arm.com>
 Description:   Parameters for the CPU cache attributes
 
                allocation_policy:
-                       - WriteAllocate: allocate a memory location to a cache line
-                                        on a cache miss because of a write
-                       - ReadAllocate: allocate a memory location to a cache line
+                       - WriteAllocate:
+                                       allocate a memory location to a cache line
+                                       on a cache miss because of a write
+                       - ReadAllocate:
+                                       allocate a memory location to a cache line
                                        on a cache miss because of a read
-                       - ReadWriteAllocate: both writeallocate and readallocate
+                       - ReadWriteAllocate:
+                                       both writeallocate and readallocate
 
-               attributes: LEGACY used only on IA64 and is same as write_policy
+               attributes:
+                           LEGACY used only on IA64 and is same as write_policy
 
-               coherency_line_size: the minimum amount of data in bytes that gets
+               coherency_line_size:
+                                    the minimum amount of data in bytes that gets
                                     transferred from memory to cache
 
-               level: the cache hierarchy in the multi-level cache configuration
+               level:
+                       the cache hierarchy in the multi-level cache configuration
 
-               number_of_sets: total number of sets in the cache, a set is a
+               number_of_sets:
+                               total number of sets in the cache, a set is a
                                collection of cache lines with the same cache index
 
-               physical_line_partition: number of physical cache line per cache tag
+               physical_line_partition:
+                               number of physical cache line per cache tag
 
-               shared_cpu_list: the list of logical cpus sharing the cache
+               shared_cpu_list:
+                               the list of logical cpus sharing the cache
 
-               shared_cpu_map: logical cpu mask containing the list of cpus sharing
+               shared_cpu_map:
+                               logical cpu mask containing the list of cpus sharing
                                the cache
 
-               size: the total cache size in kB
+               size:
+                       the total cache size in kB
 
                type:
                        - Instruction: cache that only holds instructions
                        - Data: cache that only caches data
                        - Unified: cache that holds both data and instructions
 
-               ways_of_associativity: degree of freedom in placing a particular block
-                                       of memory in the cache
+               ways_of_associativity:
+                       degree of freedom in placing a particular block
+                       of memory in the cache
 
                write_policy:
-                       - WriteThrough: data is written to both the cache line
+                       - WriteThrough:
+                                       data is written to both the cache line
                                        and to the block in the lower-level memory
-                       - WriteBack: data is written only to the cache line and
+                       - WriteBack:
+                                    data is written only to the cache line and
                                     the modified cache line is written to main
                                     memory only when it is replaced
 
@@ -414,30 +434,30 @@ Description:      POWERNV CPUFreq driver's frequency throttle stats directory and
                throttle attributes exported in the 'throttle_stats' directory:
 
                - turbo_stat : This file gives the total number of times the max
-               frequency is throttled to lower frequency in turbo (at and above
-               nominal frequency) range of frequencies.
+                 frequency is throttled to lower frequency in turbo (at and above
+                 nominal frequency) range of frequencies.
 
                - sub_turbo_stat : This file gives the total number of times the
-               max frequency is throttled to lower frequency in sub-turbo(below
-               nominal frequency) range of frequencies.
+                 max frequency is throttled to lower frequency in sub-turbo(below
+                 nominal frequency) range of frequencies.
 
                - unthrottle : This file gives the total number of times the max
-               frequency is unthrottled after being throttled.
+                 frequency is unthrottled after being throttled.
 
                - powercap : This file gives the total number of times the max
-               frequency is throttled due to 'Power Capping'.
+                 frequency is throttled due to 'Power Capping'.
 
                - overtemp : This file gives the total number of times the max
-               frequency is throttled due to 'CPU Over Temperature'.
+                 frequency is throttled due to 'CPU Over Temperature'.
 
                - supply_fault : This file gives the total number of times the
-               max frequency is throttled due to 'Power Supply Failure'.
+                 max frequency is throttled due to 'Power Supply Failure'.
 
                - overcurrent : This file gives the total number of times the
-               max frequency is throttled due to 'Overcurrent'.
+                 max frequency is throttled due to 'Overcurrent'.
 
                - occ_reset : This file gives the total number of times the max
-               frequency is throttled due to 'OCC Reset'.
+                 frequency is throttled due to 'OCC Reset'.
 
                The sysfs attributes representing different throttle reasons like
                powercap, overtemp, supply_fault, overcurrent and occ_reset map to
@@ -469,8 +489,9 @@ What:               /sys/devices/system/cpu/cpuX/regs/
 Date:          June 2016
 Contact:       Linux ARM Kernel Mailing list <linux-arm-kernel@lists.infradead.org>
 Description:   AArch64 CPU registers
+
                'identification' directory exposes the CPU ID registers for
-                identifying model and revision of the CPU.
+               identifying model and revision of the CPU.
 
 What:          /sys/devices/system/cpu/cpu#/cpu_capacity
 Date:          December 2016
@@ -497,9 +518,11 @@ Description:       Information about CPU vulnerabilities
                vulnerabilities. The output of those files reflects the
                state of the CPUs in the system. Possible output values:
 
+               ================  ==============================================
                "Not affected"    CPU is not affected by the vulnerability
                "Vulnerable"      CPU is affected and no mitigation in effect
                "Mitigation: $M"  CPU is affected and mitigation $M is in effect
+               ================  ==============================================
 
                See also: Documentation/admin-guide/hw-vuln/index.rst
 
@@ -515,12 +538,14 @@ Description:      Control Symetric Multi Threading (SMT)
                control: Read/write interface to control SMT. Possible
                         values:
 
+                        ================ =========================================
                         "on"             SMT is enabled
                         "off"            SMT is disabled
                         "forceoff"       SMT is force disabled. Cannot be changed.
                         "notsupported"   SMT is not supported by the CPU
                         "notimplemented" SMT runtime toggling is not
                                          implemented for the architecture
+                        ================ =========================================
 
                         If control status is "forceoff" or "notsupported" writes
                         are rejected.
@@ -576,7 +601,7 @@ Description:        Secure Virtual Machine
                Facility in POWER9 and newer processors. i.e., it is a Secure
                Virtual Machine.
 
-What:          /sys/devices/system/cpu/cpuX/purr
+What:          /sys/devices/system/cpu/cpuX/purr
 Date:          Apr 2005
 Contact:       Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
 Description:   PURR ticks for this CPU since the system boot.
index 470def0..1a8ee26 100644 (file)
@@ -5,8 +5,10 @@ Contact:        Vernon Mauery <vernux@us.ibm.com>
 Description:    The state file allows a means by which to change in and
                 out of Premium Real-Time Mode (PRTM), as well as the
                 ability to query the current state.
-                    0 => PRTM off
-                    1 => PRTM enabled
+
+                    - 0 => PRTM off
+                    - 1 => PRTM enabled
+
 Users:          The ibm-prtm userspace daemon uses this interface.
 
 
index 4d63a79..42214b4 100644 (file)
@@ -6,11 +6,13 @@ Description:  Read/write the current state of DDR Backup Mode, which controls
                if DDR power rails will be kept powered during system suspend.
                ("on"/"1" = enabled, "off"/"0" = disabled).
                Two types of power switches (or control signals) can be used:
+
                  A. With a momentary power switch (or pulse signal), DDR
                     Backup Mode is enabled by default when available, as the
                     PMIC will be configured only during system suspend.
                  B. With a toggle power switch (or level signal), the
                     following steps must be followed exactly:
+
                       1. Configure PMIC for backup mode, to change the role of
                          the accessory power switch from a power switch to a
                          wake-up switch,
@@ -20,8 +22,10 @@ Description: Read/write the current state of DDR Backup Mode, which controls
                       3. Suspend system,
                       4. Switch accessory power switch on, to resume the
                          system.
+
                     DDR Backup Mode must be explicitly enabled by the user,
                     to invoke step 1.
+
                See also Documentation/devicetree/bindings/mfd/bd9571mwv.txt.
 Users:         User space applications for embedded boards equipped with a
                BD9571MWV PMIC.
index 64ac6d5..69d855d 100644 (file)
@@ -29,8 +29,12 @@ What:           /sys/class/genwqe/genwqe<n>_card/reload_bitstream
 Date:           May 2014
 Contact:        klebers@linux.vnet.ibm.com
 Description:    Interface to trigger a PCIe card reset to reload the bitstream.
+
+               ::
+
                   sudo sh -c 'echo 1 > \
                     /sys/class/genwqe/genwqe0_card/reload_bitstream'
+
                 If successfully, the card will come back with the bitstream set
                 on 'next_bitstream'.
 
@@ -64,8 +68,11 @@ Description:    Base clock frequency of the card.
 What:           /sys/class/genwqe/genwqe<n>_card/device/sriov_numvfs
 Date:           Oct 2013
 Contact:        haver@linux.vnet.ibm.com
-Description:    Enable VFs (1..15):
+Description:    Enable VFs (1..15)::
+
                   sudo sh -c 'echo 15 > \
                     /sys/bus/pci/devices/0000\:1b\:00.0/sriov_numvfs'
-                Disable VFs:
+
+                Disable VFs::
+
                   Write a 0 into the same sysfs entry.
index 53a0725..aee85ca 100644 (file)
@@ -3,14 +3,18 @@ Date:         July 2011
 Contact:       linux-input@vger.kernel.org
 Description:   This controls if mouse clicks should be generated if the trackpoint is quickly pressed. How fast this press has to be
                is being controlled by press_speed.
+
                Values are 0 or 1.
+
                Applies to Thinkpad USB Keyboard with TrackPoint.
 
 What:          /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/dragging
 Date:          July 2011
 Contact:       linux-input@vger.kernel.org
 Description:   If this setting is enabled, it is possible to do dragging by pressing the trackpoint. This requires press_to_select to be enabled.
+
                Values are 0 or 1.
+
                Applies to Thinkpad USB Keyboard with TrackPoint.
 
 What:          /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/release_to_select
@@ -25,7 +29,9 @@ Date:         July 2011
 Contact:       linux-input@vger.kernel.org
 Description:   This setting controls if the mouse click events generated by pressing the trackpoint (if press_to_select is enabled) generate
                a left or right mouse button click.
+
                Values are 0 or 1.
+
                Applies to Thinkpad USB Keyboard with TrackPoint.
 
 What:          /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/sensitivity
@@ -39,12 +45,16 @@ What:               /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-
 Date:          July 2011
 Contact:       linux-input@vger.kernel.org
 Description:   This setting controls how fast the trackpoint needs to be pressed to generate a mouse click if press_to_select is enabled.
+
                Values are decimal integers from 1 (slowest) to 255 (fastest).
+
                Applies to Thinkpad USB Keyboard with TrackPoint.
 
 What:          /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/fn_lock
 Date:          July 2014
 Contact:       linux-input@vger.kernel.org
 Description:   This setting controls whether Fn Lock is enabled on the keyboard (i.e. if F1 is Mute or F1)
+
                Values are 0 or 1
+
                Applies to ThinkPad Compact (USB|Bluetooth) Keyboard with TrackPoint.
index 305dffd..de07be3 100644 (file)
@@ -12,7 +12,9 @@ KernelVersion:        4.1
 Contact:       Michal Malý <madcatxster@devoid-pointer.net>
 Description:   Displays a set of alternate modes supported by a wheel. Each
                mode is listed as follows:
+
                  Tag: Mode Name
+
                Currently active mode is marked with an asterisk. List also
                contains an abstract item "native" which always denotes the
                native mode of the wheel. Echoing the mode tag switches the
@@ -24,24 +26,30 @@ Description:        Displays a set of alternate modes supported by a wheel. Each
                This entry is not created for devices that have only one mode.
 
                Currently supported mode switches:
-               Driving Force Pro:
+
+               Driving Force Pro::
+
                  DF-EX --> DFP
 
-               G25:
+               G25::
+
                  DF-EX --> DFP --> G25
 
-               G27:
+               G27::
+
                  DF-EX <*> DFP <-> G25 <-> G27
                  DF-EX <*--------> G25 <-> G27
                  DF-EX <*----------------> G27
 
-               G29:
+               G29::
+
                  DF-EX <*> DFP <-> G25 <-> G27 <-> G29
                  DF-EX <*--------> G25 <-> G27 <-> G29
                  DF-EX <*----------------> G27 <-> G29
                  DF-EX <*------------------------> G29
 
-               DFGT:
+               DFGT::
+
                  DF-EX <*> DFP <-> DFGT
                  DF-EX <*--------> DFGT
 
index e574a56..0e323a5 100644 (file)
@@ -29,12 +29,13 @@ Contact:    linux-input@vger.kernel.org
 Description:
                Threholds to override activation slack.
 
-               activation_width:       (RW) Width threshold to immediately
+               =================       =====================================
+               activation_width        (RW) Width threshold to immediately
                                        start processing touch events.
 
-               activation_height:      (RW) Height threshold to immediately
+               activation_height       (RW) Height threshold to immediately
                                        start processing touch events.
-
+               =================       =====================================
 
 What:          /sys/bus/hid/drivers/ntrig/<dev>/min_width
 What:          /sys/bus/hid/drivers/ntrig/<dev>/min_height
@@ -44,11 +45,13 @@ Contact:    linux-input@vger.kernel.org
 Description:
                Minimum size contact accepted.
 
-               min_width:      (RW) Minimum touch contact width to decide
+               ==========      ===========================================
+               min_width       (RW) Minimum touch contact width to decide
                                activation and activity.
 
-               min_height:     (RW) Minimum touch contact height to decide
+               min_height      (RW) Minimum touch contact height to decide
                                activation and activity.
+               ==========      ===========================================
 
 
 What:          /sys/bus/hid/drivers/ntrig/<dev>/sensor_physical_width
index 8f7982c..11cd9bf 100644 (file)
@@ -3,17 +3,21 @@ Date:         March 2010
 Contact:       Stefan Achatz <erazor_de@users.sourceforge.net>
 Description:   It is possible to switch the dpi setting of the mouse with the
                press of a button.
+
                When read, this file returns the raw number of the actual dpi
                setting reported by the mouse. This number has to be further
                processed to receive the real dpi value:
 
+               ===== =====
                VALUE DPI
+               ===== =====
                1     800
                2     1200
                3     1600
                4     2000
                5     2400
                6     3200
+               ===== =====
 
                This file is readonly.
 Users:         http://roccat.sourceforge.net
@@ -22,6 +26,7 @@ What:         /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-
 Date:          March 2010
 Contact:       Stefan Achatz <erazor_de@users.sourceforge.net>
 Description:   When read, this file returns the number of the actual profile.
+
                This file is readonly.
 Users:         http://roccat.sourceforge.net
 
@@ -33,6 +38,7 @@ Description:  When read, this file returns the raw integer version number of the
                further usage in other programs. To receive the real version
                number the decimal point has to be shifted 2 positions to the
                left. E.g. a returned value of 138 means 1.38
+
                This file is readonly.
 Users:         http://roccat.sourceforge.net
 
@@ -43,10 +49,13 @@ Description:        The mouse can store 5 profiles which can be switched by the
                 press of a button. A profile holds information like button
                 mappings, sensitivity, the colors of the 5 leds and light
                 effects.
+
                 When read, these files return the respective profile. The
                 returned data is 975 bytes in size.
+
                When written, this file lets one write the respective profile
                data back to the mouse. The data has to be 975 bytes long.
+
                The mouse will reject invalid data, whereas the profile number
                stored in the profile doesn't need to fit the number of the
                store.
@@ -58,6 +67,7 @@ Contact:      Stefan Achatz <erazor_de@users.sourceforge.net>
 Description:   When read, this file returns the settings stored in the mouse.
                The size of the data is 36 bytes and holds information like the
                startup_profile, tcu state and calibration_data.
+
                When written, this file lets write settings back to the mouse.
                The data has to be 36 bytes long. The mouse will reject invalid
                data.
@@ -67,8 +77,10 @@ What:                /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-
 Date:          March 2010
 Contact:       Stefan Achatz <erazor_de@users.sourceforge.net>
 Description:   The integer value of this attribute ranges from 1 to 5.
+
                 When read, this attribute returns the number of the profile
                 that's active when the mouse is powered on.
+
                When written, this file sets the number of the startup profile
                and the mouse activates this profile immediately.
 Users:         http://roccat.sourceforge.net
@@ -80,9 +92,12 @@ Description: The mouse has a "Tracking Control Unit" which lets the user
                calibrate the laser power to fit the mousepad surface.
                When read, this file returns the current state of the TCU,
                where 0 means off and 1 means on.
+
                Writing 0 in this file will switch the TCU off.
+
                Writing 1 in this file will start the calibration which takes
                around 6 seconds to complete and activates the TCU.
+
 Users:         http://roccat.sourceforge.net
 
 What:          /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/kone/roccatkone<minor>/weight
@@ -93,14 +108,18 @@ Description:       The mouse can be equipped with one of four supplied weights
                and its value can be read out. When read, this file returns the
                raw value returned by the mouse which eases further processing
                in other software.
+
                The values map to the weights as follows:
 
+               ===== ======
                VALUE WEIGHT
+               ===== ======
                0     none
                1     5g
                2     10g
                3     15g
                4     20g
+               ===== ======
 
                This file is readonly.
 Users:         http://roccat.sourceforge.net
index 39dfa5c..3bf43d9 100644 (file)
@@ -20,6 +20,7 @@ Description:  This file contains the currently connected and initialized
                the official Nintendo Nunchuck extension and classic is the
                Nintendo Classic Controller extension. The motionp extension can
                be combined with the other two.
+
                Starting with kernel-version 3.11 Motion Plus hotplugging is
                supported and if detected, it's no longer reported as static
                extension. You will get uevent notifications for the motion-plus
@@ -39,9 +40,13 @@ Description: While a device is initialized by the wiimote driver, we perform
                Other strings for each device-type are available and may be
                added if new device-specific detections are added.
                Currently supported are:
-                       gen10: First Wii Remote generation
-                       gen20: Second Wii Remote Plus generation (builtin MP)
+
+                       ============= =======================================
+                       gen10:        First Wii Remote generation
+                       gen20:        Second Wii Remote Plus generation
+                                     (builtin MP)
                        balanceboard: Wii Balance Board
+                       ============= =======================================
 
 What:          /sys/bus/hid/drivers/wiimote/<dev>/bboard_calib
 Date:          May 2013
@@ -54,6 +59,7 @@ Description:  This attribute is only provided if the device was detected as a
                First, 0kg values for all 4 sensors are written, followed by the
                17kg values for all 4 sensors and last the 34kg values for all 4
                sensors.
+
                Calibration data is already applied by the kernel to all input
                values but may be used by user-space to perform other
                transformations.
@@ -68,9 +74,11 @@ Description: This attribute is only provided if the device was detected as a
                is prefixed with a +/-. Each value is a signed 16bit number.
                Data is encoded as decimal numbers and specifies the offsets of
                the analog sticks of the pro-controller.
+
                Calibration data is already applied by the kernel to all input
                values but may be used by user-space to perform other
                transformations.
+
                Calibration data is detected by the kernel during device setup.
                You can write "scan\n" into this file to re-trigger calibration.
                You can also write data directly in the form "x1:y1 x2:y2" to
index 3d316d5..cd7c578 100644 (file)
@@ -4,6 +4,7 @@ Contact:        linux-input@vger.kernel.org
 Description:    Reports the firmware version provided by the touchscreen, for example "00_T6" on a EXC80H60
 
                Access: Read
+
                Valid values: Represented as string
 
 What:          /sys/bus/i2c/devices/xxx/model
@@ -12,4 +13,5 @@ Contact:      linux-input@vger.kernel.org
 Description:    Reports the model identification provided by the touchscreen, for example "Orion_1320" on a EXC80H60
 
                Access: Read
+
                Valid values: Represented as string
index bb6f5d6..4cf595d 100644 (file)
@@ -4,7 +4,9 @@ Contact:        PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
 Description:   read-only access to the efuse on the Ingenic JZ4780 SoC
                The SoC has a one time programmable 8K efuse that is
                split into segments. The driver supports read only.
-               The segments are
+               The segments are:
+
+               ===== ======== =================
                0x000   64 bit Random Number
                0x008  128 bit Ingenic Chip ID
                0x018  128 bit Customer ID
@@ -12,5 +14,7 @@ Description:  read-only access to the efuse on the Ingenic JZ4780 SoC
                0x1E0    8 bit Protect Segment
                0x1E1 2296 bit HDMI Key
                0x300 2048 bit Security boot key
+               ===== ======== =================
+
 Users:         any user space application which wants to read the Chip
                and Customer ID
index 73308c2..49f5fd0 100644 (file)
@@ -7,8 +7,10 @@ Description:
                 the format of DDDD:BB:DD.F-REG:SIZE:MASK will allow the guest
                 to write and read from the PCI device. That is Domain:Bus:
                 Device.Function-Register:Size:Mask (Domain is optional).
-                For example:
-                #echo 00:19.0-E0:2:FF > /sys/bus/pci/drivers/pciback/quirks
+                For example::
+
+                  #echo 00:19.0-E0:2:FF > /sys/bus/pci/drivers/pciback/quirks
+
                 will allow the guest to read and write to the configuration
                 register 0x0E.
 
index 34d3a33..28c9c04 100644 (file)
@@ -9,10 +9,12 @@ Description:  Some Samsung laptops have different "performance levels"
                their fans quiet at all costs.  Reading from this file
                will show the current performance level.  Writing to the
                file can change this value.
+
                        Valid options:
-                               "silent"
-                               "normal"
-                               "overclock"
+                               - "silent"
+                               - "normal"
+                               - "overclock"
+
                Note that not all laptops support all of these options.
                Specifically, not all support the "overclock" option,
                and it's still unknown if this value even changes
@@ -25,8 +27,9 @@ Contact:      Corentin Chary <corentin.chary@gmail.com>
 Description:   Max battery charge level can be modified, battery cycle
                life can be extended by reducing the max battery charge
                level.
-               0 means normal battery mode (100% charge)
-               1 means battery life extender mode (80% charge)
+
+               - 0 means normal battery mode (100% charge)
+               - 1 means battery life extender mode (80% charge)
 
 What:          /sys/devices/platform/samsung/usb_charge
 Date:          December 1, 2011
index f34221b..e5a438d 100644 (file)
@@ -4,10 +4,12 @@ KernelVersion:        3.15
 Contact:       Azael Avalos <coproscefalo@gmail.com>
 Description:   This file controls the keyboard backlight operation mode, valid
                values are:
+
                        * 0x1  -> FN-Z
                        * 0x2  -> AUTO (also called TIMER)
                        * 0x8  -> ON
                        * 0x10 -> OFF
+
                Note that from kernel 3.16 onwards this file accepts all listed
                parameters, kernel 3.15 only accepts the first two (FN-Z and
                AUTO).
@@ -41,8 +43,10 @@ KernelVersion:       3.15
 Contact:       Azael Avalos <coproscefalo@gmail.com>
 Description:   This files controls the status of the touchpad and pointing
                stick (if available), valid values are:
+
                        * 0 -> OFF
                        * 1 -> ON
+
 Users:         KToshiba
 
 What:          /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/available_kbd_modes
@@ -51,10 +55,12 @@ KernelVersion:      3.16
 Contact:       Azael Avalos <coproscefalo@gmail.com>
 Description:   This file shows the supported keyboard backlight modes
                the system supports, which can be:
+
                        * 0x1  -> FN-Z
                        * 0x2  -> AUTO (also called TIMER)
                        * 0x8  -> ON
                        * 0x10 -> OFF
+
                Note that not all keyboard types support the listed modes.
                See the entry named "available_kbd_modes"
 Users:         KToshiba
@@ -65,6 +71,7 @@ KernelVersion:        3.16
 Contact:       Azael Avalos <coproscefalo@gmail.com>
 Description:   This file shows the current keyboard backlight type,
                which can be:
+
                        * 1 -> Type 1, supporting modes FN-Z and AUTO
                        * 2 -> Type 2, supporting modes TIMER, ON and OFF
 Users:         KToshiba
@@ -75,10 +82,12 @@ KernelVersion:      4.0
 Contact:       Azael Avalos <coproscefalo@gmail.com>
 Description:   This file controls the USB Sleep & Charge charging mode, which
                can be:
+
                        * 0 -> Disabled         (0x00)
                        * 1 -> Alternate        (0x09)
                        * 2 -> Auto             (0x21)
                        * 3 -> Typical          (0x11)
+
                Note that from kernel 4.1 onwards this file accepts all listed
                values, kernel 4.0 only supports the first three.
                Note that this feature only works when connected to power, if
@@ -93,8 +102,10 @@ Contact:    Azael Avalos <coproscefalo@gmail.com>
 Description:   This file controls the USB Sleep Functions under battery, and
                set the level at which point they will be disabled, accepted
                values can be:
+
                        * 0     -> Disabled
                        * 1-100 -> Battery level to disable sleep functions
+
                Currently it prints two values, the first one indicates if the
                feature is enabled or disabled, while the second one shows the
                current battery level set.
@@ -107,8 +118,10 @@ Date:              January 23, 2015
 KernelVersion: 4.0
 Contact:       Azael Avalos <coproscefalo@gmail.com>
 Description:   This file controls the USB Rapid Charge state, which can be:
+
                        * 0 -> Disabled
                        * 1 -> Enabled
+
                Note that toggling this value requires a reboot for changes to
                take effect.
 Users:         KToshiba
@@ -118,8 +131,10 @@ Date:              January 23, 2015
 KernelVersion: 4.0
 Contact:       Azael Avalos <coproscefalo@gmail.com>
 Description:   This file controls the Sleep & Music state, which values can be:
+
                        * 0 -> Disabled
                        * 1 -> Enabled
+
                Note that this feature only works when connected to power, if
                you want to use it under battery, see the entry named
                "sleep_functions_on_battery"
@@ -138,6 +153,7 @@ KernelVersion:      4.0
 Contact:       Azael Avalos <coproscefalo@gmail.com>
 Description:   This file controls the state of the internal fan, valid
                values are:
+
                        * 0 -> OFF
                        * 1 -> ON
 
@@ -147,8 +163,10 @@ KernelVersion:     4.0
 Contact:       Azael Avalos <coproscefalo@gmail.com>
 Description:   This file controls the Special Functions (hotkeys) operation
                mode, valid values are:
+
                        * 0 -> Normal Operation
                        * 1 -> Special Functions
+
                In the "Normal Operation" mode, the F{1-12} keys are as usual
                and the hotkeys are accessed via FN-F{1-12}.
                In the "Special Functions" mode, the F{1-12} keys trigger the
@@ -163,8 +181,10 @@ KernelVersion:     4.0
 Contact:       Azael Avalos <coproscefalo@gmail.com>
 Description:   This file controls whether the laptop should turn ON whenever
                the LID is opened, valid values are:
+
                        * 0 -> Disabled
                        * 1 -> Enabled
+
                Note that toggling this value requires a reboot for changes to
                take effect.
 Users:         KToshiba
@@ -174,8 +194,10 @@ Date:              February 12, 2015
 KernelVersion: 4.0
 Contact:       Azael Avalos <coproscefalo@gmail.com>
 Description:   This file controls the USB 3 functionality, valid values are:
+
                        * 0 -> Disabled (Acts as a regular USB 2)
                        * 1 -> Enabled (Full USB 3 functionality)
+
                Note that toggling this value requires a reboot for changes to
                take effect.
 Users:         KToshiba
@@ -188,10 +210,14 @@ Description:      This file controls the Cooling Method feature.
                Reading this file prints two values, the first is the actual cooling method
                and the second is the maximum cooling method supported.
                When the maximum cooling method is ONE, valid values are:
+
                        * 0 -> Maximum Performance
                        * 1 -> Battery Optimized
+
                When the maximum cooling method is TWO, valid values are:
+
                        * 0 -> Maximum Performance
                        * 1 -> Performance
                        * 2 -> Battery Optimized
+
 Users:         KToshiba
index a662370..c938690 100644 (file)
@@ -4,10 +4,12 @@ KernelVersion:        3.17
 Contact:       Azael Avalos <coproscefalo@gmail.com>
 Description:   This file controls the built-in accelerometer protection level,
                valid values are:
+
                        * 0 -> Disabled
                        * 1 -> Low
                        * 2 -> Medium
                        * 3 -> High
+
                The default potection value is set to 2 (Medium).
 Users:         KToshiba
 
index d1a3521..adc0d0e 100644 (file)
@@ -18,6 +18,7 @@ Contact:      Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the device type. This is one of the UFS
                device descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/device_class
@@ -26,6 +27,7 @@ Contact:      Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the device class. This is one of the UFS
                device descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/device_sub_class
@@ -34,6 +36,7 @@ Contact:      Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the UFS storage subclass. This is one of
                the UFS device descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/protocol
@@ -43,6 +46,7 @@ Description:  This file shows the protocol supported by an UFS device.
                This is one of the UFS device descriptor parameters.
                The full information about the descriptor could be found
                at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/number_of_luns
@@ -51,6 +55,7 @@ Contact:      Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows number of logical units. This is one of
                the UFS device descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/number_of_wluns
@@ -60,6 +65,7 @@ Description:  This file shows number of well known logical units.
                This is one of the UFS device descriptor parameters.
                The full information about the descriptor could be found
                at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/boot_enable
@@ -69,6 +75,7 @@ Description:  This file shows value that indicates whether the device is
                enabled for boot. This is one of the UFS device descriptor
                parameters. The full information about the descriptor could
                be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/descriptor_access_enable
@@ -79,6 +86,7 @@ Description:  This file shows value that indicates whether the device
                of the boot sequence. This is one of the UFS device descriptor
                parameters. The full information about the descriptor could
                be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/initial_power_mode
@@ -88,6 +96,7 @@ Description:  This file shows value that defines the power mode after
                device initialization or hardware reset. This is one of
                the UFS device descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/high_priority_lun
@@ -96,6 +105,7 @@ Contact:     Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the high priority lun. This is one of
                the UFS device descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/secure_removal_type
@@ -104,6 +114,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the secure removal type. This is one of
                the UFS device descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/support_security_lun
@@ -113,6 +124,7 @@ Description:        This file shows whether the security lun is supported.
                This is one of the UFS device descriptor parameters.
                The full information about the descriptor could be found
                at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/bkops_termination_latency
@@ -122,6 +134,7 @@ Description:        This file shows the background operations termination
                latency. This is one of the UFS device descriptor parameters.
                The full information about the descriptor could be found
                at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/initial_active_icc_level
@@ -130,6 +143,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the initial active ICC level. This is one
                of the UFS device descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/specification_version
@@ -138,6 +152,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the specification version. This is one
                of the UFS device descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/manufacturing_date
@@ -147,6 +162,7 @@ Description:        This file shows the manufacturing date in BCD format.
                This is one of the UFS device descriptor parameters.
                The full information about the descriptor could be found
                at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/manufacturer_id
@@ -155,6 +171,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the manufacturee ID. This is one of the
                UFS device descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/rtt_capability
@@ -164,6 +181,7 @@ Description:        This file shows the maximum number of outstanding RTTs
                supported by the device. This is one of the UFS device
                descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/rtc_update
@@ -173,6 +191,7 @@ Description:        This file shows the frequency and method of the realtime
                clock update. This is one of the UFS device descriptor
                parameters. The full information about the descriptor
                could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/ufs_features
@@ -182,6 +201,7 @@ Description:        This file shows which features are supported by the device.
                This is one of the UFS device descriptor parameters.
                The full information about the descriptor could be
                found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/ffu_timeout
@@ -190,6 +210,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the FFU timeout. This is one of the
                UFS device descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/queue_depth
@@ -198,6 +219,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the device queue depth. This is one of the
                UFS device descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/device_version
@@ -206,6 +228,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the device version. This is one of the
                UFS device descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/number_of_secure_wpa
@@ -215,6 +238,7 @@ Description:        This file shows number of secure write protect areas
                supported by the device. This is one of the UFS device
                descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/psa_max_data_size
@@ -225,6 +249,7 @@ Description:        This file shows the maximum amount of data that may be
                This is one of the UFS device descriptor parameters.
                The full information about the descriptor could be found
                at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/psa_state_timeout
@@ -234,6 +259,7 @@ Description:        This file shows the command maximum timeout for a change
                in PSA state. This is one of the UFS device descriptor
                parameters. The full information about the descriptor could
                be found at UFS specifications 2.1.
+
                The file is read only.
 
 
@@ -244,6 +270,7 @@ Description:        This file shows the MIPI UniPro version number in BCD format.
                This is one of the UFS interconnect descriptor parameters.
                The full information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/interconnect_descriptor/mphy_version
@@ -253,6 +280,7 @@ Description:        This file shows the MIPI M-PHY version number in BCD format.
                This is one of the UFS interconnect descriptor parameters.
                The full information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 
@@ -264,6 +292,7 @@ Description:        This file shows the total memory quantity available to
                of the UFS geometry descriptor parameters. The full
                information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/max_number_of_luns
@@ -273,6 +302,7 @@ Description:        This file shows the maximum number of logical units
                supported by the UFS device. This is one of the UFS
                geometry descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/segment_size
@@ -281,6 +311,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the segment size. This is one of the UFS
                geometry descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/allocation_unit_size
@@ -289,6 +320,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the allocation unit size. This is one of
                the UFS geometry descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/min_addressable_block_size
@@ -298,6 +330,7 @@ Description:        This file shows the minimum addressable block size. This
                is one of the UFS geometry descriptor parameters. The full
                information about the descriptor could be found at UFS
                specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/optimal_read_block_size
@@ -307,6 +340,7 @@ Description:        This file shows the optimal read block size. This is one
                of the UFS geometry descriptor parameters. The full
                information about the descriptor could be found at UFS
                specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/optimal_write_block_size
@@ -316,6 +350,7 @@ Description:        This file shows the optimal write block size. This is one
                of the UFS geometry descriptor parameters. The full
                information about the descriptor could be found at UFS
                specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/max_in_buffer_size
@@ -325,6 +360,7 @@ Description:        This file shows the maximum data-in buffer size. This
                is one of the UFS geometry descriptor parameters. The full
                information about the descriptor could be found at UFS
                specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/max_out_buffer_size
@@ -334,6 +370,7 @@ Description:        This file shows the maximum data-out buffer size. This
                is one of the UFS geometry descriptor parameters. The full
                information about the descriptor could be found at UFS
                specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/rpmb_rw_size
@@ -343,6 +380,7 @@ Description:        This file shows the maximum number of RPMB frames allowed
                in Security Protocol In/Out. This is one of the UFS geometry
                descriptor parameters. The full information about the
                descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/dyn_capacity_resource_policy
@@ -352,6 +390,7 @@ Description:        This file shows the dynamic capacity resource policy. This
                is one of the UFS geometry descriptor parameters. The full
                information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/data_ordering
@@ -361,6 +400,7 @@ Description:        This file shows support for out-of-order data transfer.
                This is one of the UFS geometry descriptor parameters.
                The full information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/max_number_of_contexts
@@ -370,6 +410,7 @@ Description:        This file shows maximum available number of contexts which
                are supported by the device. This is one of the UFS geometry
                descriptor parameters. The full information about the
                descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/sys_data_tag_unit_size
@@ -378,6 +419,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows system data tag unit size. This is one of
                the UFS geometry descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/sys_data_tag_resource_size
@@ -388,6 +430,7 @@ Description:        This file shows maximum storage area size allocated by
                This is one of the UFS geometry descriptor parameters.
                The full information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/secure_removal_types
@@ -397,6 +440,7 @@ Description:        This file shows supported secure removal types. This is
                one of the UFS geometry descriptor parameters. The full
                information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/memory_types
@@ -406,6 +450,7 @@ Description:        This file shows supported memory types. This is one of
                the UFS geometry descriptor parameters. The full
                information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/*_memory_max_alloc_units
@@ -416,6 +461,7 @@ Description:        This file shows the maximum number of allocation units for
                enhanced type 1-4). This is one of the UFS geometry
                descriptor parameters. The full information about the
                descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/*_memory_capacity_adjustment_factor
@@ -426,6 +472,7 @@ Description:        This file shows the memory capacity adjustment factor for
                enhanced type 1-4). This is one of the UFS geometry
                descriptor parameters. The full information about the
                descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 
@@ -436,6 +483,7 @@ Description:        This file shows preend of life information. This is one
                of the UFS health descriptor parameters. The full
                information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/health_descriptor/life_time_estimation_a
@@ -445,6 +493,7 @@ Description:        This file shows indication of the device life time
                (method a). This is one of the UFS health descriptor
                parameters. The full information about the descriptor
                could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/health_descriptor/life_time_estimation_b
@@ -454,6 +503,7 @@ Description:        This file shows indication of the device life time
                (method b). This is one of the UFS health descriptor
                parameters. The full information about the descriptor
                could be found at UFS specifications 2.1.
+
                The file is read only.
 
 
@@ -464,6 +514,7 @@ Description:        This file shows maximum VCC, VCCQ and VCCQ2 value for
                active ICC levels from 0 to 15. This is one of the UFS
                power descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 
@@ -473,6 +524,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file contains a device manufactureer name string.
                The full information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/string_descriptors/product_name
@@ -480,6 +532,7 @@ Date:               February 2018
 Contact:       Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file contains a product name string. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/string_descriptors/oem_id
@@ -487,6 +540,7 @@ Date:               February 2018
 Contact:       Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file contains a OEM ID string. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/string_descriptors/serial_number
@@ -495,6 +549,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file contains a device serial number string. The full
                information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/string_descriptors/product_revision
@@ -503,6 +558,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file contains a product revision string. The full
                information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 
@@ -512,6 +568,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows boot LUN information. This is one of
                the UFS unit descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/lun_write_protect
@@ -520,6 +577,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows LUN write protection status. This is one of
                the UFS unit descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/lun_queue_depth
@@ -528,6 +586,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows LUN queue depth. This is one of the UFS
                unit descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/psa_sensitive
@@ -536,6 +595,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows PSA sensitivity. This is one of the UFS
                unit descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/lun_memory_type
@@ -544,6 +604,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows LUN memory type. This is one of the UFS
                unit descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/data_reliability
@@ -553,6 +614,7 @@ Description:        This file defines the device behavior when a power failure
                occurs during a write operation. This is one of the UFS
                unit descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/logical_block_size
@@ -562,6 +624,7 @@ Description:        This file shows the size of addressable logical blocks
                (calculated as an exponent with base 2). This is one of
                the UFS unit descriptor parameters. The full information about
                the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/logical_block_count
@@ -571,6 +634,7 @@ Description:        This file shows total number of addressable logical blocks.
                This is one of the UFS unit descriptor parameters. The full
                information about the descriptor could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/erase_block_size
@@ -579,6 +643,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the erase block size. This is one of
                the UFS unit descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/provisioning_type
@@ -587,6 +652,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the thin provisioning type. This is one of
                the UFS unit descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/physical_memory_resourse_count
@@ -595,6 +661,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the total physical memory resources. This is
                one of the UFS unit descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/context_capabilities
@@ -603,6 +670,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the context capabilities. This is one of
                the UFS unit descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/large_unit_granularity
@@ -611,6 +679,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the granularity of the LUN. This is one of
                the UFS unit descriptor parameters. The full information
                about the descriptor could be found at UFS specifications 2.1.
+
                The file is read only.
 
 
@@ -619,6 +688,7 @@ Date:               February 2018
 Contact:       Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the device init status. The full information
                about the flag could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/flags/permanent_wpe
@@ -627,6 +697,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows whether permanent write protection is enabled.
                The full information about the flag could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/flags/power_on_wpe
@@ -636,6 +707,7 @@ Description:        This file shows whether write protection is enabled on all
                logical units configured as power on write protected. The
                full information about the flag could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/flags/bkops_enable
@@ -644,6 +716,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows whether the device background operations are
                enabled. The full information about the flag could be
                found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/flags/life_span_mode_enable
@@ -652,6 +725,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows whether the device life span mode is enabled.
                The full information about the flag could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/flags/phy_resource_removal
@@ -660,6 +734,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows whether physical resource removal is enable.
                The full information about the flag could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/flags/busy_rtc
@@ -668,6 +743,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows whether the device is executing internal
                operation related to real time clock. The full information
                about the flag could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/flags/disable_fw_update
@@ -676,6 +752,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows whether the device FW update is permanently
                disabled. The full information about the flag could be found
                at UFS specifications 2.1.
+
                The file is read only.
 
 
@@ -685,6 +762,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file provides the boot lun enabled UFS device attribute.
                The full information about the attribute could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/current_power_mode
@@ -693,6 +771,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file provides the current power mode UFS device attribute.
                The full information about the attribute could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/active_icc_level
@@ -701,6 +780,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file provides the active icc level UFS device attribute.
                The full information about the attribute could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/ooo_data_enabled
@@ -709,6 +789,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file provides the out of order data transfer enabled UFS
                device attribute. The full information about the attribute
                could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/bkops_status
@@ -717,6 +798,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file provides the background operations status UFS device
                attribute. The full information about the attribute could
                be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/purge_status
@@ -725,6 +807,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file provides the purge operation status UFS device
                attribute. The full information about the attribute could
                be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/max_data_in_size
@@ -733,6 +816,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the maximum data size in a DATA IN
                UPIU. The full information about the attribute could
                be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/max_data_out_size
@@ -741,6 +825,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file shows the maximum number of bytes that can be
                requested with a READY TO TRANSFER UPIU. The full information
                about the attribute could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/reference_clock_frequency
@@ -749,6 +834,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file provides the reference clock frequency UFS device
                attribute. The full information about the attribute could
                be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/configuration_descriptor_lock
@@ -765,6 +851,7 @@ Description:        This file provides the maximum current number of
                outstanding RTTs in device that is allowed. The full
                information about the attribute could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/exception_event_control
@@ -773,6 +860,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file provides the exception event control UFS device
                attribute. The full information about the attribute could
                be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/exception_event_status
@@ -781,6 +869,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file provides the exception event status UFS device
                attribute. The full information about the attribute could
                be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/ffu_status
@@ -789,6 +878,7 @@ Contact:    Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file provides the ffu status UFS device attribute.
                The full information about the attribute could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/psa_state
@@ -796,6 +886,7 @@ Date:               February 2018
 Contact:       Stanislav Nijnikov <stanislav.nijnikov@wdc.com>
 Description:   This file show the PSA feature status. The full information
                about the attribute could be found at UFS specifications 2.1.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/psa_data_size
@@ -805,6 +896,7 @@ Description:        This file shows the amount of data that the host plans to
                load to all logical units in pre-soldering state.
                The full information about the attribute could be found at
                UFS specifications 2.1.
+
                The file is read only.
 
 
@@ -815,6 +907,7 @@ Description:        This file shows the The amount of physical memory needed
                to be removed from the physical memory resources pool of
                the particular logical unit. The full information about
                the attribute could be found at UFS specifications 2.1.
+
                The file is read only.
 
 
@@ -824,24 +917,28 @@ Contact:  Subhash Jadavani <subhashj@codeaurora.org>
 Description:   This entry could be used to set or show the UFS device
                runtime power management level. The current driver
                implementation supports 6 levels with next target states:
-               0 - an UFS device will stay active, an UIC link will
-               stay active
-               1 - an UFS device will stay active, an UIC link will
-               hibernate
-               2 - an UFS device will moved to sleep, an UIC link will
-               stay active
-               3 - an UFS device will moved to sleep, an UIC link will
-               hibernate
-               4 - an UFS device will be powered off, an UIC link will
-               hibernate
-               5 - an UFS device will be powered off, an UIC link will
-               be powered off
+
+               ==  ====================================================
+               0   an UFS device will stay active, an UIC link will
+                   stay active
+               1   an UFS device will stay active, an UIC link will
+                   hibernate
+               2   an UFS device will moved to sleep, an UIC link will
+                   stay active
+               3   an UFS device will moved to sleep, an UIC link will
+                   hibernate
+               4   an UFS device will be powered off, an UIC link will
+                   hibernate
+               5   an UFS device will be powered off, an UIC link will
+                   be powered off
+               ==  ====================================================
 
 What:          /sys/bus/platform/drivers/ufshcd/*/rpm_target_dev_state
 Date:          February 2018
 Contact:       Subhash Jadavani <subhashj@codeaurora.org>
 Description:   This entry shows the target power mode of an UFS device
                for the chosen runtime power management level.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/rpm_target_link_state
@@ -849,6 +946,7 @@ Date:               February 2018
 Contact:       Subhash Jadavani <subhashj@codeaurora.org>
 Description:   This entry shows the target state of an UFS UIC link
                for the chosen runtime power management level.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/spm_lvl
@@ -857,24 +955,28 @@ Contact:  Subhash Jadavani <subhashj@codeaurora.org>
 Description:   This entry could be used to set or show the UFS device
                system power management level. The current driver
                implementation supports 6 levels with next target states:
-               0 - an UFS device will stay active, an UIC link will
-               stay active
-               1 - an UFS device will stay active, an UIC link will
-               hibernate
-               2 - an UFS device will moved to sleep, an UIC link will
-               stay active
-               3 - an UFS device will moved to sleep, an UIC link will
-               hibernate
-               4 - an UFS device will be powered off, an UIC link will
-               hibernate
-               5 - an UFS device will be powered off, an UIC link will
-               be powered off
+
+               ==  ====================================================
+               0   an UFS device will stay active, an UIC link will
+                   stay active
+               1   an UFS device will stay active, an UIC link will
+                   hibernate
+               2   an UFS device will moved to sleep, an UIC link will
+                   stay active
+               3   an UFS device will moved to sleep, an UIC link will
+                   hibernate
+               4   an UFS device will be powered off, an UIC link will
+                   hibernate
+               5   an UFS device will be powered off, an UIC link will
+                   be powered off
+               ==  ====================================================
 
 What:          /sys/bus/platform/drivers/ufshcd/*/spm_target_dev_state
 Date:          February 2018
 Contact:       Subhash Jadavani <subhashj@codeaurora.org>
 Description:   This entry shows the target power mode of an UFS device
                for the chosen system power management level.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/spm_target_link_state
@@ -882,18 +984,21 @@ Date:             February 2018
 Contact:       Subhash Jadavani <subhashj@codeaurora.org>
 Description:   This entry shows the target state of an UFS UIC link
                for the chosen system power management level.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/wb_presv_us_en
 Date:          June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   This entry shows if preserve user-space was configured
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/wb_shared_alloc_units
 Date:          June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   This entry shows the shared allocated units of WB buffer
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/device_descriptor/wb_type
@@ -901,6 +1006,7 @@ Date:              June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   This entry shows the configured WB type.
                0x1 for shared buffer mode. 0x0 for dedicated buffer mode.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/wb_buff_cap_adj
@@ -910,6 +1016,7 @@ Description:       This entry shows the total user-space decrease in shared
                buffer mode.
                The value of this parameter is 3 for TLC NAND when SLC mode
                is used as WriteBooster Buffer. 2 for MLC NAND.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/wb_max_alloc_units
@@ -917,6 +1024,7 @@ Date:              June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   This entry shows the Maximum total WriteBooster Buffer size
                which is supported by the entire device.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/wb_max_wb_luns
@@ -924,6 +1032,7 @@ Date:              June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   This entry shows the maximum number of luns that can support
                WriteBooster.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/wb_sup_red_type
@@ -937,46 +1046,59 @@ Description:     The supportability of user space reduction mode
                preserve user space type.
                02h: Device can be configured in either user space
                reduction type or preserve user space type.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/wb_sup_wb_type
 Date:          June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   The supportability of WriteBooster Buffer type.
-               00h: LU based WriteBooster Buffer configuration
-               01h: Single shared WriteBooster Buffer
-               configuration
-               02h: Supporting both LU based WriteBooster
-               Buffer and Single shared WriteBooster Buffer
-               configuration
+
+               ===  ==========================================================
+               00h  LU based WriteBooster Buffer configuration
+               01h  Single shared WriteBooster Buffer configuration
+               02h  Supporting both LU based WriteBooster.
+                    Buffer and Single shared WriteBooster Buffer configuration
+               ===  ==========================================================
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/flags/wb_enable
 Date:          June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   This entry shows the status of WriteBooster.
-               0: WriteBooster is not enabled.
-               1: WriteBooster is enabled
+
+               == ============================
+               0  WriteBooster is not enabled.
+               1  WriteBooster is enabled
+               == ============================
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/flags/wb_flush_en
 Date:          June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   This entry shows if flush is enabled.
-               0: Flush operation is not performed.
-               1: Flush operation is performed.
+
+               == =================================
+               0  Flush operation is not performed.
+               1  Flush operation is performed.
+               == =================================
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/flags/wb_flush_during_h8
 Date:          June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   Flush WriteBooster Buffer during hibernate state.
-               0: Device is not allowed to flush the
-               WriteBooster Buffer during link hibernate
-               state.
-               1: Device is allowed to flush the
-               WriteBooster Buffer during link hibernate
-               state
+
+               == =================================================
+               0  Device is not allowed to flush the
+                  WriteBooster Buffer during link hibernate state.
+               1  Device is allowed to flush the
+                  WriteBooster Buffer during link hibernate state.
+               == =================================================
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/wb_avail_buf
@@ -984,23 +1106,30 @@ Date:            June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   This entry shows the amount of unused WriteBooster buffer
                available.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/wb_cur_buf
 Date:          June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   This entry shows the amount of unused current buffer.
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/wb_flush_status
 Date:          June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   This entry shows the flush operation status.
-               00h: idle
-               01h: Flush operation in progress
-               02h: Flush operation stopped prematurely.
-               03h: Flush operation completed successfully
-               04h: Flush operation general failure
+
+
+               ===  ======================================
+               00h  idle
+               01h  Flush operation in progress
+               02h  Flush operation stopped prematurely.
+               03h  Flush operation completed successfully
+               04h  Flush operation general failure
+               ===  ======================================
+
                The file is read only.
 
 What:          /sys/bus/platform/drivers/ufshcd/*/attributes/wb_life_time_est
@@ -1008,9 +1137,13 @@ Date:            June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   This entry shows an indication of the WriteBooster Buffer
                lifetime based on the amount of performed program/erase cycles
-               01h: 0% - 10% WriteBooster Buffer life time used
+
+               ===  =============================================
+               01h  0% - 10% WriteBooster Buffer life time used
                ...
-               0Ah: 90% - 100% WriteBooster Buffer life time used
+               0Ah  90% - 100% WriteBooster Buffer life time used
+               ===  =============================================
+
                The file is read only.
 
 What:          /sys/class/scsi_device/*/device/unit_descriptor/wb_buf_alloc_units
@@ -1018,4 +1151,5 @@ Date:             June 2020
 Contact:       Asutosh Das <asutoshd@codeaurora.org>
 Description:   This entry shows the configured size of WriteBooster buffer.
                0400h corresponds to 4GB.
+
                The file is read only.
index d301e70..e92aba4 100644 (file)
@@ -5,7 +5,9 @@ Contact:        Jan Kandziora <jjj@gmx.de>
 Description:   When written, this file sets the I2C speed on the connected
                DS28E17 chip. When read, it reads the current setting from
                the DS28E17 chip.
+
                Valid values: 100, 400, 900 [kBaud].
+
                Default 100, can be set by w1_ds28e17.speed= module parameter.
 Users:         w1_ds28e17 driver
 
@@ -17,5 +19,6 @@ Description:  When written, this file sets the multiplier used to calculate
                the busy timeout for I2C operations on the connected DS28E17
                chip. When read, returns the current setting.
                Valid values: 1 to 9.
+
                Default 1, can be set by w1_ds28e17.stretch= module parameter.
 Users:         w1_ds28e17 driver
index 8873bbb..6a37dc3 100644 (file)
@@ -22,8 +22,10 @@ Description:
                device data to its embedded EEPROM, either restore data
                embedded in device EEPROM. Be aware that devices support
                limited EEPROM writing cycles (typical 50k)
+
                        * 'save': save device RAM to EEPROM
                        * 'restore': restore EEPROM data in device RAM
+
 Users:         any user space application which wants to communicate with
                w1_term device
 
@@ -33,9 +35,11 @@ Date:                May 2020
 Contact:       Akira Shimahara <akira215corp@gmail.com>
 Description:
                (RO) return the power status by asking the device
+
                        * '0': device parasite powered
                        * '1': device externally powered
                        * '-xx': xx is kernel error when reading power status
+
 Users:         any user space application which wants to communicate with
                w1_term device
 
@@ -49,10 +53,12 @@ Description:
                will be changed only in device RAM, so it will be cleared when
                power is lost. Trigger a 'save' to EEPROM command to keep
                values after power-on. Read or write are :
+
                        * '9..14': device resolution in bit
-                       or resolution to set in bit
+                         or resolution to set in bit
                        * '-xx': xx is kernel error when reading the resolution
                        * Anything else: do nothing
+
                Some DS18B20 clones are fixed in 12-bit resolution, so the
                actual resolution is read back from the chip and verified. Error
                is reported if the results differ.
@@ -65,16 +71,18 @@ Date:               May 2020
 Contact:       Akira Shimahara <akira215corp@gmail.com>
 Description:
                (RO) return the temperature in 1/1000 degC.
+
                        * If a bulk read has been triggered, it will directly
-                       return the temperature computed when the bulk read
-                       occurred, if available. If not yet available, nothing
-                       is returned (a debug kernel message is sent), you
-                       should retry later on.
+                         return the temperature computed when the bulk read
+                         occurred, if available. If not yet available, nothing
+                         is returned (a debug kernel message is sent), you
+                         should retry later on.
                        * If no bulk read has been triggered, it will trigger
-                       a conversion and send the result. Note that the
-                       conversion duration depend on the resolution (if
-                       device support this feature). It takes 94ms in 9bits
-                       resolution, 750ms for 12bits.
+                         a conversion and send the result. Note that the
+                         conversion duration depend on the resolution (if
+                         device support this feature). It takes 94ms in 9bits
+                         resolution, 750ms for 12bits.
+
 Users:         any user space application which wants to communicate with
                w1_term device
 
@@ -86,12 +94,14 @@ Description:
                (RW) return the temperature in 1/1000 degC.
                *read*: return 2 lines with the hexa output data sent on the
                bus, return the CRC check and temperature in 1/1000 degC
-               *write* :
+               *write*:
+
                        * '0' : save the 2 or 3 bytes to the device EEPROM
-                       (i.e. TH, TL and config register)
+                         (i.e. TH, TL and config register)
                        * '9..14' : set the device resolution in RAM
-                       (if supported)
+                         (if supported)
                        * Anything else: do nothing
+
                refer to Documentation/w1/slaves/w1_therm.rst for detailed
                information.
 Users:         any user space application which wants to communicate with
@@ -103,14 +113,21 @@ Date:             May 2020
 Contact:       Akira Shimahara <akira215corp@gmail.com>
 Description:
                (RW) trigger a bulk read conversion. read the status
+
                *read*:
-                       * '-1': conversion in progress on at least 1 sensor
-                       * '1' : conversion complete but at least one sensor
+                       * '-1':
+                               conversion in progress on at least 1 sensor
+                       * '1' :
+                               conversion complete but at least one sensor
                                value has not been read yet
-                       * '0' : no bulk operation. Reading temperature will
+                       * '0' :
+                               no bulk operation. Reading temperature will
                                trigger a conversion on each device
-               *write*: 'trigger': trigger a bulk read on all supporting
+
+               *write*:
+                       'trigger': trigger a bulk read on all supporting
                        devices on the bus
+
                Note that if a bulk read is sent but one sensor is not read
                immediately, the next access to temperature on this device
                will return the temperature measured at the time of issue
@@ -128,14 +145,19 @@ Description:
                reset to default (datasheet) conversion time for a new
                resolution.
 
-               *read*: Actual conversion time in milliseconds. *write*:
-                       '0': Set the default conversion time from the datasheet.
-                       '1': Measure and set the conversion time. Make a single
+               *read*:
+                       Actual conversion time in milliseconds.
+
+               *write*:
+                       * '0':
+                            Set the default conversion time from the datasheet.
+                       * '1':
+                            Measure and set the conversion time. Make a single
                             temperature conversion, measure an actual value.
                             Increase it by 20% for temperature range. A new
                             conversion time can be obtained by reading this
                             same attribute.
-                       other positive value:
+                       other positive value:
                             Set the conversion time in milliseconds.
 
 Users:         An application using the w1_term device
@@ -148,16 +170,21 @@ Description:
                (RW) Control optional driver settings.
                Bit masks to read/write (bitwise OR):
 
-                1: Enable check for conversion success. If byte 6 of
+               == ============================================================
+                 1 Enable check for conversion success. If byte 6 of
                    scratchpad memory is 0xC after conversion, and
                    temperature reads 85.00 (powerup value) or 127.94
                    (insufficient power) - return a conversion error.
 
-                2: Enable poll for conversion completion. Generate read cycles
+                2  Enable poll for conversion completion. Generate read cycles
                    after the conversion start and wait for 1's. In parasite
                    power mode this feature is not available.
+               == ============================================================
+
+               *read*:
+                   Currently selected features.
 
-               *read*:  Currently selected features.
-               *write*: Select features.
+               *write*:
+                   Select features.
 
 Users:         An application using the w1_term device
index afc48fc..16acaa5 100644 (file)
@@ -79,7 +79,9 @@ Description:
                When the Wacom Intuos 4 is connected over Bluetooth, the
                image has to contain 256 bytes (64x32 px 1 bit colour).
                The format is also scrambled, like in the USB mode, and it can
-               be summarized by converting 76543210 into GECA6420.
+               be summarized by converting::
+
+                                           76543210 into GECA6420.
                                            HGFEDCBA      HFDB7531
 
 What:          /sys/bus/hid/devices/<bus>:<vid>:<pid>.<n>/wacom_remote/unpair_remote
index ecb7942..ac2947b 100644 (file)
@@ -35,3 +35,12 @@ Description:
                 controls the duration in milliseconds that blkback will not
                 cache any page not backed by a grant mapping.
                 The default is 10ms.
+
+What:           /sys/module/xen_blkback/parameters/feature_persistent
+Date:           September 2020
+KernelVersion:  5.10
+Contact:        SeongJae Park <sjpark@amazon.de>
+Description:
+                Whether to enable the persistent grants feature or not.  Note
+                that this option only takes effect on newly created backends.
+                The default is Y (enable).
index c0a6cb7..2800890 100644 (file)
@@ -1,4 +1,4 @@
-What:           /sys/module/xen_blkfront/parameters/max
+What:           /sys/module/xen_blkfront/parameters/max_indirect_segments
 Date:           June 2013
 KernelVersion:  3.11
 Contact:        Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
@@ -8,3 +8,12 @@ Description:
                 is 32 - higher value means more potential throughput but more
                 memory usage. The backend picks the minimum of the frontend
                 and its default backend value.
+
+What:           /sys/module/xen_blkfront/parameters/feature_persistent
+Date:           September 2020
+KernelVersion:  5.10
+Contact:        SeongJae Park <sjpark@amazon.de>
+Description:
+                Whether to enable the persistent grants feature or not.  Note
+                that this option only takes effect on newly created frontends.
+                The default is Y (enable).
index 613f42a..b16d30a 100644 (file)
@@ -12,11 +12,14 @@ Description:
                image: The image bitmap. Currently a 32-bit BMP.
                status: 1 if the image is valid, 0 if firmware invalidated it.
                type: 0 indicates image is in BMP format.
+
+               ======== ===================================================
                version: The version of the BGRT. Currently 1.
                xoffset: The number of pixels between the left of the screen
                         and the left edge of the image.
                yoffset: The number of pixels between the top of the screen
                         and the top edge of the image.
+               ======== ===================================================
 
 What:          /sys/firmware/acpi/hotplug/
 Date:          February 2013
@@ -33,12 +36,14 @@ Description:
                The following setting is available to user space for each
                hotplug profile:
 
+               ======== =======================================================
                enabled: If set, the ACPI core will handle notifications of
-                       hotplug events associated with the given class of
-                       devices and will allow those devices to be ejected with
-                       the help of the _EJ0 control method.  Unsetting it
-                       effectively disables hotplug for the correspoinding
-                       class of devices.
+                        hotplug events associated with the given class of
+                        devices and will allow those devices to be ejected with
+                        the help of the _EJ0 control method.  Unsetting it
+                        effectively disables hotplug for the correspoinding
+                        class of devices.
+               ======== =======================================================
 
                The value of the above attribute is an integer number: 1 (set)
                or 0 (unset).  Attempts to write any other values to it will
@@ -71,86 +76,90 @@ Description:
                To figure out where all the SCI's are coming from,
                /sys/firmware/acpi/interrupts contains a file listing
                every possible source, and the count of how many
-               times it has triggered.
-
-               $ cd /sys/firmware/acpi/interrupts
-               $ grep . *
-               error:       0
-               ff_gbl_lock:       0   enable
-               ff_pmtimer:       0  invalid
-               ff_pwr_btn:       0   enable
-               ff_rt_clk:       2  disable
-               ff_slp_btn:       0  invalid
-               gpe00:       0  invalid
-               gpe01:       0   enable
-               gpe02:     108   enable
-               gpe03:       0  invalid
-               gpe04:       0  invalid
-               gpe05:       0  invalid
-               gpe06:       0   enable
-               gpe07:       0   enable
-               gpe08:       0  invalid
-               gpe09:       0  invalid
-               gpe0A:       0  invalid
-               gpe0B:       0  invalid
-               gpe0C:       0  invalid
-               gpe0D:       0  invalid
-               gpe0E:       0  invalid
-               gpe0F:       0  invalid
-               gpe10:       0  invalid
-               gpe11:       0  invalid
-               gpe12:       0  invalid
-               gpe13:       0  invalid
-               gpe14:       0  invalid
-               gpe15:       0  invalid
-               gpe16:       0  invalid
-               gpe17:    1084   enable
-               gpe18:       0   enable
-               gpe19:       0  invalid
-               gpe1A:       0  invalid
-               gpe1B:       0  invalid
-               gpe1C:       0  invalid
-               gpe1D:       0  invalid
-               gpe1E:       0  invalid
-               gpe1F:       0  invalid
-               gpe_all:    1192
-               sci:    1194
-               sci_not:     0  
-
-               sci - The number of times the ACPI SCI
-               has been called and claimed an interrupt.
-
-               sci_not - The number of times the ACPI SCI
-               has been called and NOT claimed an interrupt.
-
-               gpe_all - count of SCI caused by GPEs.
-
-               gpeXX - count for individual GPE source
-
-               ff_gbl_lock - Global Lock
-
-               ff_pmtimer - PM Timer
-
-               ff_pwr_btn - Power Button
-
-               ff_rt_clk - Real Time Clock
-
-               ff_slp_btn - Sleep Button
-
-               error - an interrupt that can't be accounted for above.
-
-               invalid: it's either a GPE or a Fixed Event that
-                       doesn't have an event handler.
-
-               disable: the GPE/Fixed Event is valid but disabled.
-
-               enable: the GPE/Fixed Event is valid and enabled.
-
-               Root has permission to clear any of these counters.  Eg.
-               # echo 0 > gpe11
-
-               All counters can be cleared by clearing the total "sci":
-               # echo 0 > sci
+               times it has triggered::
+
+                 $ cd /sys/firmware/acpi/interrupts
+                 $ grep . *
+                 error:             0
+                 ff_gbl_lock:       0   enable
+                 ff_pmtimer:        0  invalid
+                 ff_pwr_btn:        0   enable
+                 ff_rt_clk:         2  disable
+                 ff_slp_btn:        0  invalid
+                 gpe00:             0  invalid
+                 gpe01:             0   enable
+                 gpe02:           108   enable
+                 gpe03:             0  invalid
+                 gpe04:             0  invalid
+                 gpe05:             0  invalid
+                 gpe06:             0   enable
+                 gpe07:             0   enable
+                 gpe08:             0  invalid
+                 gpe09:             0  invalid
+                 gpe0A:             0  invalid
+                 gpe0B:             0  invalid
+                 gpe0C:             0  invalid
+                 gpe0D:             0  invalid
+                 gpe0E:             0  invalid
+                 gpe0F:             0  invalid
+                 gpe10:             0  invalid
+                 gpe11:             0  invalid
+                 gpe12:             0  invalid
+                 gpe13:             0  invalid
+                 gpe14:             0  invalid
+                 gpe15:             0  invalid
+                 gpe16:             0  invalid
+                 gpe17:          1084   enable
+                 gpe18:             0   enable
+                 gpe19:             0  invalid
+                 gpe1A:             0  invalid
+                 gpe1B:             0  invalid
+                 gpe1C:             0  invalid
+                 gpe1D:             0  invalid
+                 gpe1E:             0  invalid
+                 gpe1F:             0  invalid
+                 gpe_all:        1192
+                 sci:            1194
+                 sci_not:           0
+
+               ===========  ==================================================
+               sci          The number of times the ACPI SCI
+                            has been called and claimed an interrupt.
+
+               sci_not      The number of times the ACPI SCI
+                            has been called and NOT claimed an interrupt.
+
+               gpe_all      count of SCI caused by GPEs.
+
+               gpeXX        count for individual GPE source
+
+               ff_gbl_lock  Global Lock
+
+               ff_pmtimer   PM Timer
+
+               ff_pwr_btn   Power Button
+
+               ff_rt_clk    Real Time Clock
+
+               ff_slp_btn   Sleep Button
+
+               error        an interrupt that can't be accounted for above.
+
+               invalid      it's either a GPE or a Fixed Event that
+                            doesn't have an event handler.
+
+               disable      the GPE/Fixed Event is valid but disabled.
+
+               enable       the GPE/Fixed Event is valid and enabled.
+               ===========  ==================================================
+
+               Root has permission to clear any of these counters.  Eg.::
+
+                 # echo 0 > gpe11
+
+               All counters can be cleared by clearing the total "sci"::
+
+                 # echo 0 > sci
 
                None of these counters has an effect on the function
                of the system, they are simply statistics.
@@ -165,32 +174,34 @@ Description:
 
                Let's take power button fixed event for example, please kill acpid
                and other user space applications so that the machine won't shutdown
-               when pressing the power button.
-               # cat ff_pwr_btn
-               0       enabled
-               # press the power button for 3 times;
-               # cat ff_pwr_btn
-               3       enabled
-               # echo disable > ff_pwr_btn
-               # cat ff_pwr_btn
-               3       disabled
-               # press the power button for 3 times;
-               # cat ff_pwr_btn
-               3       disabled
-               # echo enable > ff_pwr_btn
-               # cat ff_pwr_btn
-               4       enabled
-               /*
-                * this is because the status bit is set even if the enable bit is cleared,
-                * and it triggers an ACPI fixed event when the enable bit is set again
-                */
-               # press the power button for 3 times;
-               # cat ff_pwr_btn
-               7       enabled
-               # echo disable > ff_pwr_btn
-               # press the power button for 3 times;
-               # echo clear > ff_pwr_btn       /* clear the status bit */
-               # echo disable > ff_pwr_btn
-               # cat ff_pwr_btn
-               7       enabled
+               when pressing the power button::
+
+                 # cat ff_pwr_btn
+                 0     enabled
+                 # press the power button for 3 times;
+                 # cat ff_pwr_btn
+                 3     enabled
+                 # echo disable > ff_pwr_btn
+                 # cat ff_pwr_btn
+                 3     disabled
+                 # press the power button for 3 times;
+                 # cat ff_pwr_btn
+                 3     disabled
+                 # echo enable > ff_pwr_btn
+                 # cat ff_pwr_btn
+                 4     enabled
+                 /*
+                  * this is because the status bit is set even if the enable
+                  * bit is cleared, and it triggers an ACPI fixed event when
+                  * the enable bit is set again
+                  */
+                 # press the power button for 3 times;
+                 # cat ff_pwr_btn
+                 7     enabled
+                 # echo disable > ff_pwr_btn
+                 # press the power button for 3 times;
+                 # echo clear > ff_pwr_btn     /* clear the status bit */
+                 # echo disable > ff_pwr_btn
+                 # cat ff_pwr_btn
+                 7     enabled
 
index 210ad44..fe0289c 100644 (file)
@@ -33,7 +33,7 @@ Description:
                doesn't matter), they will be represented in sysfs as
                entries "T-0" through "T-(N-1)":
 
-               Example entry directories:
+               Example entry directories::
 
                        /sys/firmware/dmi/entries/17-0
                        /sys/firmware/dmi/entries/17-1
@@ -50,61 +50,65 @@ Description:
                Each DMI entry in sysfs has the common header values
                exported as attributes:
 
-               handle  : The 16bit 'handle' that is assigned to this
+               ========  =================================================
+               handle    The 16bit 'handle' that is assigned to this
                          entry by the firmware.  This handle may be
                          referred to by other entries.
-               length  : The length of the entry, as presented in the
+               length    The length of the entry, as presented in the
                          entry itself.  Note that this is _not the
                          total count of bytes associated with the
-                         entry_.  This value represents the length of
+                         entry.  This value represents the length of
                          the "formatted" portion of the entry.  This
                          "formatted" region is sometimes followed by
                          the "unformatted" region composed of nul
                          terminated strings, with termination signalled
                          by a two nul characters in series.
-               raw     : The raw bytes of the entry. This includes the
+               raw       The raw bytes of the entry. This includes the
                          "formatted" portion of the entry, the
                          "unformatted" strings portion of the entry,
                          and the two terminating nul characters.
-               type    : The type of the entry.  This value is the same
+               type      The type of the entry.  This value is the same
                          as found in the directory name.  It indicates
                          how the rest of the entry should be interpreted.
-               instance: The instance ordinal of the entry for the
+               instance  The instance ordinal of the entry for the
                          given type.  This value is the same as found
                          in the parent directory name.
-               position: The ordinal position (zero-based) of the entry
+               position  The ordinal position (zero-based) of the entry
                          within the entirety of the DMI entry table.
+               ========  =================================================
 
-               === Entry Specialization ===
+               **Entry Specialization**
 
                Some entry types may have other information available in
                sysfs.  Not all types are specialized.
 
-               --- Type 15 - System Event Log ---
+               **Type 15 - System Event Log**
 
                This entry allows the firmware to export a log of
                events the system has taken.  This information is
                typically backed by nvram, but the implementation
                details are abstracted by this table.  This entry's data
-               is exported in the directory:
+               is exported in the directory::
 
-               /sys/firmware/dmi/entries/15-0/system_event_log
+                 /sys/firmware/dmi/entries/15-0/system_event_log
 
                and has the following attributes (documented in the
                SMBIOS / DMI specification under "System Event Log (Type 15)":
 
-               area_length
-               header_start_offset
-               data_start_offset
-               access_method
-               status
-               change_token
-               access_method_address
-               header_format
-               per_log_type_descriptor_length
-               type_descriptors_supported_count
+               area_length
+               header_start_offset
+               data_start_offset
+               access_method
+               status
+               change_token
+               access_method_address
+               header_format
+               per_log_type_descriptor_length
+               type_descriptors_supported_count
 
                As well, the kernel exports the binary attribute:
 
-               raw_event_log   : The raw binary bits of the event log
+               =============     ====================================
+               raw_event_log     The raw binary bits of the event log
                                  as described by the DMI entry.
+               =============     ====================================
index 6e431d1..31b5767 100644 (file)
@@ -35,10 +35,13 @@ What:               /sys/firmware/efi/esrt/entries/entry$N/fw_type
 Date:          February 2015
 Contact:       Peter Jones <pjones@redhat.com>
 Description:   What kind of firmware entry this is:
-               0 - Unknown
-               1 - System Firmware
-               2 - Device Firmware
-               3 - UEFI Driver
+
+               ==  ===============
+               0   Unknown
+               1   System Firmware
+               2   Device Firmware
+               3   UEFI Driver
+               ==  ===============
 
 What:          /sys/firmware/efi/esrt/entries/entry$N/fw_class
 Date:          February 2015
@@ -71,11 +74,14 @@ Date:               February 2015
 Contact:       Peter Jones <pjones@redhat.com>
 Description:   The result of the last firmware update attempt for the
                firmware resource entry.
-               0 - Success
-               1 - Insufficient resources
-               2 - Incorrect version
-               3 - Invalid format
-               4 - Authentication error
-               5 - AC power event
-               6 - Battery power event
+
+               ==  ======================
+               0   Success
+               1   Insufficient resources
+               2   Incorrect version
+               3   Invalid format
+               4   Authentication error
+               5   AC power event
+               6   Battery power event
+               ==  ======================
 
index c61b9b3..9c4d581 100644 (file)
@@ -14,7 +14,7 @@ Description:  Switching efi runtime services to virtual mode requires
                /sys/firmware/efi/runtime-map/ is the directory the kernel
                exports that information in.
 
-               subdirectories are named with the number of the memory range:
+               subdirectories are named with the number of the memory range::
 
                        /sys/firmware/efi/runtime-map/0
                        /sys/firmware/efi/runtime-map/1
@@ -24,11 +24,13 @@ Description:        Switching efi runtime services to virtual mode requires
 
                Each subdirectory contains five files:
 
-               attribute : The attributes of the memory range.
-               num_pages : The size of the memory range in pages.
-               phys_addr : The physical address of the memory range.
-               type      : The type of the memory range.
-               virt_addr : The virtual address of the memory range.
+               =========   =========================================
+               attribute   The attributes of the memory range.
+               num_pages   The size of the memory range in pages.
+               phys_addr   The physical address of the memory range.
+               type        The type of the memory range.
+               virt_addr   The virtual address of the memory range.
+               =========   =========================================
 
                Above values are all hexadecimal numbers with the '0x' prefix.
 Users:         Kexec
index 0faa0aa..7a55835 100644 (file)
@@ -20,7 +20,7 @@ Description:
 
                        This directory has the same layout (and
                        underlying implementation as /sys/firmware/efi/vars.
-                       See Documentation/ABI/*/sysfs-firmware-efi-vars
+                       See `Documentation/ABI/*/sysfs-firmware-efi-vars`
                        for more information on how to interact with
                        this structure.
 
index eca0d65..1f6f4d3 100644 (file)
@@ -20,7 +20,7 @@ Description:
                the raw memory map to userspace.
 
                The structure is as follows: Under /sys/firmware/memmap there
-               are subdirectories with the number of the entry as their name:
+               are subdirectories with the number of the entry as their name::
 
                        /sys/firmware/memmap/0
                        /sys/firmware/memmap/1
@@ -34,14 +34,16 @@ Description:
 
                Each directory contains three files:
 
-               start   : The start address (as hexadecimal number with the
+               ========  =====================================================
+               start     The start address (as hexadecimal number with the
                          '0x' prefix).
-               end     : The end address, inclusive (regardless whether the
+               end       The end address, inclusive (regardless whether the
                          firmware provides inclusive or exclusive ranges).
-               type    : Type of the entry as string. See below for a list of
+               type      Type of the entry as string. See below for a list of
                          valid types.
+               ========  =====================================================
 
-               So, for example:
+               So, for example::
 
                        /sys/firmware/memmap/0/start
                        /sys/firmware/memmap/0/end
@@ -57,9 +59,8 @@ Description:
                  - reserved
 
                Following shell snippet can be used to display that memory
-               map in a human-readable format:
+               map in a human-readable format::
 
-               -------------------- 8< ----------------------------------------
                  #!/bin/bash
                  cd /sys/firmware/memmap
                  for dir in * ; do
@@ -68,4 +69,3 @@ Description:
                      type=$(cat $dir/type)
                      printf "%016x-%016x (%s)\n" $start $[ $end +1] "$type"
                  done
-               -------------------- >8 ----------------------------------------
index 011dda4..ee0d6db 100644 (file)
@@ -15,7 +15,7 @@ Description:
                to the fw_cfg device can be found in "docs/specs/fw_cfg.txt"
                in the QEMU source tree.
 
-               === SysFS fw_cfg Interface ===
+               **SysFS fw_cfg Interface**
 
                The fw_cfg sysfs interface described in this document is only
                intended to display discoverable blobs (i.e., those registered
@@ -31,7 +31,7 @@ Description:
 
                        /sys/firmware/qemu_fw_cfg/rev
 
-               --- Discoverable fw_cfg blobs by selector key ---
+               **Discoverable fw_cfg blobs by selector key**
 
                All discoverable blobs listed in the fw_cfg file directory are
                displayed as entries named after their unique selector key
@@ -45,24 +45,26 @@ Description:
                Each such fw_cfg sysfs entry has the following values exported
                as attributes:
 
-               name    : The 56-byte nul-terminated ASCII string used as the
+               ====      ====================================================
+               name      The 56-byte nul-terminated ASCII string used as the
                          blob's 'file name' in the fw_cfg directory.
-               size    : The length of the blob, as given in the fw_cfg
+               size      The length of the blob, as given in the fw_cfg
                          directory.
-               key     : The value of the blob's selector key as given in the
+               key       The value of the blob's selector key as given in the
                          fw_cfg directory. This value is the same as used in
                          the parent directory name.
-               raw     : The raw bytes of the blob, obtained by selecting the
+               raw       The raw bytes of the blob, obtained by selecting the
                          entry via the control register, and reading a number
                          of bytes equal to the blob size from the data
                          register.
+               ====      ====================================================
 
-               --- Listing fw_cfg blobs by file name ---
+               **Listing fw_cfg blobs by file name**
 
                While the fw_cfg device does not impose any specific naming
                convention on the blobs registered in the file directory,
                QEMU developers have traditionally used path name semantics
-               to give each blob a descriptive name. For example:
+               to give each blob a descriptive name. For example::
 
                        "bootorder"
                        "genroms/kvmvapic.bin"
@@ -81,7 +83,7 @@ Description:
                of directories matching the path name components of fw_cfg
                blob names, ending in symlinks to the by_key entry for each
                "basename", as illustrated below (assume current directory is
-               /sys/firmware):
+               /sys/firmware)::
 
                    qemu_fw_cfg/by_name/bootorder -> ../by_key/38
                    qemu_fw_cfg/by_name/etc/e820 -> ../../by_key/35
index 4be7d44..5210e0f 100644 (file)
@@ -9,7 +9,7 @@ Description:
                http://simplefirmware.org/documentation
 
                While the tables are used by the kernel, user-space
-               can observe them this way:
+               can observe them this way::
 
-               # cd /sys/firmware/sfi/tables
-               # cat $TABLENAME > $TABLENAME.bin
+                 # cd /sys/firmware/sfi/tables
+                 # cat $TABLENAME > $TABLENAME.bin
index 4573fd4..66800ba 100644 (file)
@@ -5,7 +5,7 @@ Description:
                The /sys/firmware/sgi_uv directory contains information
                about the SGI UV platform.
 
-               Under that directory are a number of files:
+               Under that directory are a number of files::
 
                        partition_id
                        coherence_id
@@ -14,7 +14,7 @@ Description:
                SGI UV systems can be partitioned into multiple physical
                machines, which each partition running a unique copy
                of the operating system.  Each partition will have a unique
-               partition id.  To display the partition id, use the command:
+               partition id.  To display the partition id, use the command::
 
                        cat /sys/firmware/sgi_uv/partition_id
 
@@ -22,6 +22,6 @@ Description:
                A partitioned SGI UV system can have one or more coherence
                domain.  The coherence id indicates which coherence domain
                this partition is in.  To display the coherence id, use the
-               command:
+               command::
 
                        cat /sys/firmware/sgi_uv/coherence_id
index 15595fa..b8631f5 100644 (file)
@@ -2,21 +2,21 @@ What:         /sys/firmware/turris-mox-rwtm/board_version
 Date:          August 2019
 KernelVersion: 5.4
 Contact:       Marek Behún <marek.behun@nic.cz>
-Description:   (R) Board version burned into eFuses of this Turris Mox board.
+Description:   (Read) Board version burned into eFuses of this Turris Mox board.
                Format: %i
 
 What:          /sys/firmware/turris-mox-rwtm/mac_address*
 Date:          August 2019
 KernelVersion: 5.4
 Contact:       Marek Behún <marek.behun@nic.cz>
-Description:   (R) MAC addresses burned into eFuses of this Turris Mox board.
+Description:   (Read) MAC addresses burned into eFuses of this Turris Mox board.
                Format: %pM
 
 What:          /sys/firmware/turris-mox-rwtm/pubkey
 Date:          August 2019
 KernelVersion: 5.4
 Contact:       Marek Behún <marek.behun@nic.cz>
-Description:   (R) ECDSA public key (in pubkey hex compressed form) computed
+Description:   (Read) ECDSA public key (in pubkey hex compressed form) computed
                as pair to the ECDSA private key burned into eFuses of this
                Turris Mox Board.
                Format: string
@@ -25,7 +25,7 @@ What:         /sys/firmware/turris-mox-rwtm/ram_size
 Date:          August 2019
 KernelVersion: 5.4
 Contact:       Marek Behún <marek.behun@nic.cz>
-Description:   (R) RAM size in MiB of this Turris Mox board as was detected
+Description:   (Read) RAM size in MiB of this Turris Mox board as was detected
                during manufacturing and burned into eFuses. Can be 512 or 1024.
                Format: %i
 
@@ -33,5 +33,5 @@ What:         /sys/firmware/turris-mox-rwtm/serial_number
 Date:          August 2019
 KernelVersion: 5.4
 Contact:       Marek Behún <marek.behun@nic.cz>
-Description:   (R) Serial number burned into eFuses of this Turris Mox device.
+Description:   (Read) Serial number burned into eFuses of this Turris Mox device.
                Format: %016X
index 78604db..99e3d92 100644 (file)
@@ -45,8 +45,8 @@ Description:
                parameter will have their blocks allocated out of a
                block group specific preallocation pool, so that small
                files are packed closely together.  Each large file
-                will have its blocks allocated out of its own unique
-                preallocation pool.
+               will have its blocks allocated out of its own unique
+               preallocation pool.
 
 What:          /sys/fs/ext4/<disk>/inode_readahead_blks
 Date:          March 2008
index 834d0be..67b3ed8 100644 (file)
@@ -20,10 +20,13 @@ What:               /sys/fs/f2fs/<disk>/gc_idle
 Date:          July 2013
 Contact:       "Namjae Jeon" <namjae.jeon@samsung.com>
 Description:   Controls the victim selection policy for garbage collection.
-               Setting gc_idle = 0(default) will disable this option. Setting
-               gc_idle = 1 will select the Cost Benefit approach & setting
-               gc_idle = 2 will select the greedy approach & setting
-               gc_idle = 3 will select the age-threshold based approach.
+               Setting gc_idle = 0(default) will disable this option. Setting:
+
+               ===========  ===============================================
+               gc_idle = 1  will select the Cost Benefit approach & setting
+               gc_idle = 2  will select the greedy approach & setting
+               gc_idle = 3  will select the age-threshold based approach.
+               ===========  ===============================================
 
 What:          /sys/fs/f2fs/<disk>/reclaim_segments
 Date:          October 2013
@@ -46,10 +49,17 @@ Date:               November 2013
 Contact:       "Jaegeuk Kim" <jaegeuk.kim@samsung.com>
 Description:   Controls the in-place-update policy.
                updates in f2fs. User can set:
-               0x01: F2FS_IPU_FORCE, 0x02: F2FS_IPU_SSR,
-               0x04: F2FS_IPU_UTIL,  0x08: F2FS_IPU_SSR_UTIL,
-               0x10: F2FS_IPU_FSYNC, 0x20: F2FS_IPU_ASYNC,
-               0x40: F2FS_IPU_NOCACHE.
+
+               ====  =================
+               0x01  F2FS_IPU_FORCE
+               0x02  F2FS_IPU_SSR
+               0x04  F2FS_IPU_UTIL
+               0x08  F2FS_IPU_SSR_UTIL
+               0x10  F2FS_IPU_FSYNC
+               0x20  F2FS_IPU_ASYNC,
+               0x40  F2FS_IPU_NOCACHE
+               ====  =================
+
                Refer segment.h for details.
 
 What:          /sys/fs/f2fs/<disk>/min_ipu_util
@@ -332,18 +342,28 @@ Date:             April 2020
 Contact:       "Jaegeuk Kim" <jaegeuk@kernel.org>
 Description:   Give a way to attach REQ_META|FUA to data writes
                given temperature-based bits. Now the bits indicate:
-               *      REQ_META     |      REQ_FUA      |
-               *    5 |    4 |   3 |    2 |    1 |   0 |
-               * Cold | Warm | Hot | Cold | Warm | Hot |
+
+               +-------------------+-------------------+
+               |      REQ_META     |      REQ_FUA      |
+               +------+------+-----+------+------+-----+
+               |    5 |    4 |   3 |    2 |    1 |   0 |
+               +------+------+-----+------+------+-----+
+               | Cold | Warm | Hot | Cold | Warm | Hot |
+               +------+------+-----+------+------+-----+
 
 What:          /sys/fs/f2fs/<disk>/node_io_flag
 Date:          June 2020
 Contact:       "Jaegeuk Kim" <jaegeuk@kernel.org>
 Description:   Give a way to attach REQ_META|FUA to node writes
                given temperature-based bits. Now the bits indicate:
-               *      REQ_META     |      REQ_FUA      |
-               *    5 |    4 |   3 |    2 |    1 |   0 |
-               * Cold | Warm | Hot | Cold | Warm | Hot |
+
+               +-------------------+-------------------+
+               |      REQ_META     |      REQ_FUA      |
+               +------+------+-----+------+------+-----+
+               |    5 |    4 |   3 |    2 |    1 |   0 |
+               +------+------+-----+------+------+-----+
+               | Cold | Warm | Hot | Cold | Warm | Hot |
+               +------+------+-----+------+------+-----+
 
 What:          /sys/fs/f2fs/<disk>/iostat_period_ms
 Date:          April 2020
index 53b7b2e..4dbe0c4 100644 (file)
@@ -15,14 +15,17 @@ KernelVersion:      4.3
 Contact:       Boris Ostrovsky <boris.ostrovsky@oracle.com>
 Description:   If running under Xen:
                Describes mode that Xen's performance-monitoring unit (PMU)
-               uses. Accepted values are
-                       "off"  -- PMU is disabled
-                       "self" -- The guest can profile itself
-                       "hv"   -- The guest can profile itself and, if it is
+               uses. Accepted values are:
+
+                       ======    ============================================
+                       "off"     PMU is disabled
+                       "self"    The guest can profile itself
+                       "hv"      The guest can profile itself and, if it is
                                  privileged (e.g. dom0), the hypervisor
-                       "all" --  The guest can profile itself, the hypervisor
+                       "all"     The guest can profile itself, the hypervisor
                                  and all other guests. Only available to
                                  privileged guests.
+                       ======    ============================================
 
 What:           /sys/hypervisor/pmu/pmu_features
 Date:           August 2015
index eca38ce..7f9bda4 100644 (file)
@@ -23,16 +23,17 @@ Description:        The /sys/kernel/boot_params directory contains two
                representation of setup_data type. "data" file is the binary
                representation of setup_data payload.
 
-               The whole boot_params directory structure is like below:
-               /sys/kernel/boot_params
-               |__ data
-               |__ setup_data
-               |   |__ 0
-               |   |   |__ data
-               |   |   |__ type
-               |   |__ 1
-               |       |__ data
-               |       |__ type
-               |__ version
+               The whole boot_params directory structure is like below::
+
+                 /sys/kernel/boot_params
+                 |__ data
+                 |__ setup_data
+                 |   |__ 0
+                 |   |   |__ data
+                 |   |   |__ type
+                 |   |__ 1
+                 |       |__ data
+                 |       |__ type
+                 |__ version
 
 Users:         Kexec
index fdaa216..294387e 100644 (file)
@@ -7,9 +7,11 @@ Description:
                of the hugepages supported by the kernel/CPU combination.
 
                Under these directories are a number of files:
-                       nr_hugepages
-                       nr_overcommit_hugepages
-                       free_hugepages
-                       surplus_hugepages
-                       resv_hugepages
+
+                       - nr_hugepages
+                       - nr_overcommit_hugepages
+                       - free_hugepages
+                       - surplus_hugepages
+                       - resv_hugepages
+
                See Documentation/admin-guide/mm/hugetlbpage.rst for details.
index dfc1324..1c9bed5 100644 (file)
@@ -34,8 +34,9 @@ Description:  Kernel Samepage Merging daemon sysfs interface
                in a tree.
 
                run: write 0 to disable ksm, read 0 while ksm is disabled.
-                       write 1 to run ksm, read 1 while ksm is running.
-                       write 2 to disable ksm and unmerge all its pages.
+
+                       - write 1 to run ksm, read 1 while ksm is running.
+                       - write 2 to disable ksm and unmerge all its pages.
 
                sleep_millisecs: how many milliseconds ksm should sleep between
                scans.
index ed35833..c9f12ba 100644 (file)
@@ -346,6 +346,7 @@ Description:
                number of objects per slab.  If a slab cannot be allocated
                because of fragmentation, SLUB will retry with the minimum order
                possible depending on its characteristics.
+
                When debug_guardpage_minorder=N (N > 0) parameter is specified
                (see Documentation/admin-guide/kernel-parameters.rst), the minimum possible
                order is used and this sysfs entry can not be used to change
@@ -361,6 +362,7 @@ Description:
                new slab has not been possible at the cache's order and instead
                fallen back to its minimum possible order.  It can be written to
                clear the current count.
+
                Available when CONFIG_SLUB_STATS is enabled.
 
 What:          /sys/kernel/slab/cache/partial
@@ -410,6 +412,7 @@ Description:
                slab from a remote node as opposed to allocating a new slab on
                the local node.  This reduces the amount of wasted memory over
                the entire system but can be expensive.
+
                Available when CONFIG_NUMA is enabled.
 
 What:          /sys/kernel/slab/cache/sanity_checks
index 0aac02e..353c0db 100644 (file)
@@ -17,14 +17,15 @@ KernelVersion:      3.1
 Contact:       Kirill Smelkov <kirr@mns.spb.ru>
 Description:   Maximum time allowed for periodic transfers per microframe (μs)
 
-               [ USB 2.0 sets maximum allowed time for periodic transfers per
+               Note:
+                 USB 2.0 sets maximum allowed time for periodic transfers per
                  microframe to be 80%, that is 100 microseconds out of 125
                  microseconds (full microframe).
 
                  However there are cases, when 80% max isochronous bandwidth is
                  too limiting. For example two video streams could require 110
                  microseconds of isochronous bandwidth per microframe to work
-                 together. ]
+                 together. 
 
                Through this setting it is possible to raise the limit so that
                the host controller would allow allocating more than 100
@@ -45,8 +46,10 @@ Date:                Jan 2012
 KernelVersion:»·3.3
 Contact:       Kay Sievers <kay.sievers@vrfy.org>
 Description:   Module taint flags:
-                       P - proprietary module
-                       O - out-of-tree module
-                       F - force-loaded module
-                       C - staging driver module
-                       E - unsigned module
+                       ==  =====================
+                       P   proprietary module
+                       O   out-of-tree module
+                       F   force-loaded module
+                       C   staging driver module
+                       E   unsigned module
+                       ==  =====================
index 8b0e820..c78d358 100644 (file)
@@ -4,13 +4,16 @@ KernelVersion:        2.6.20
 Contact:       "Corentin Chary" <corentincj@iksaif.net>
 Description:
                This file allows display switching. The value
-               is composed by 4 bits and defined as follow:
-               4321
-               |||`- LCD
-               ||`-- CRT
-               |`--- TV
-               `---- DVI
-               Ex: - 0 (0000b) means no display
+               is composed by 4 bits and defined as follow::
+
+                 4321
+                 |||`- LCD
+                 ||`-- CRT
+                 |`--- TV
+                 `---- DVI
+
+               Ex:
+                   - 0 (0000b) means no display
                    - 3 (0011b) CRT+LCD.
 
 What:          /sys/devices/platform/asus_laptop/gps
@@ -28,8 +31,10 @@ Contact:     "Corentin Chary" <corentincj@iksaif.net>
 Description:
                Some models like the W1N have a LED display that can be
                used to display several items of information.
-               To control the LED display, use the following :
+               To control the LED display, use the following::
+
                    echo 0x0T000DDD > /sys/devices/platform/asus_laptop/
+
                where T control the 3 letters display, and DDD the 3 digits display.
                The DDD table can be found in Documentation/admin-guide/laptops/asus-laptop.rst
 
index 1efac0d..0488573 100644 (file)
@@ -5,6 +5,7 @@ Contact:        "Corentin Chary" <corentincj@iksaif.net>
 Description:
                Change CPU clock configuration (write-only).
                There are three available clock configuration:
+
                    * 0 -> Super Performance Mode
                    * 1 -> High Performance Mode
                    * 2 -> Power Saving Mode
index 4cc6a86..b146be7 100644 (file)
@@ -18,8 +18,10 @@ Description:
                In order to use an extended can_id add the
                CAN_EFF_FLAG (0x80000000U) to the can_id. Example:
 
-               - standard id 0x7ff:
-               echo 0x7ff      > /sys/class/net/can0/mb0_id
+               - standard id 0x7ff::
 
-               - extended id 0x1fffffff:
-               echo 0x9fffffff > /sys/class/net/can0/mb0_id
+                   echo 0x7ff      > /sys/class/net/can0/mb0_id
+
+               - extended id 0x1fffffff::
+
+                   echo 0x9fffffff > /sys/class/net/can0/mb0_id
index 9b917c7..82bcfe9 100644 (file)
@@ -34,9 +34,12 @@ Description:
                this file. To disable a trigger, write its name preceded
                by '-' instead.
 
-               For example, to enable the keyboard as trigger run:
+               For example, to enable the keyboard as trigger run::
+
                    echo +keyboard > /sys/class/leds/dell::kbd_backlight/start_triggers
-               To disable it:
+
+               To disable it::
+
                    echo -keyboard > /sys/class/leds/dell::kbd_backlight/start_triggers
 
                Note that not all the available triggers can be configured.
@@ -57,7 +60,8 @@ Description:
                with any the above units. If no unit is specified, the value
                is assumed to be expressed in seconds.
 
-               For example, to set the timeout to 10 minutes run:
+               For example, to set the timeout to 10 minutes run::
+
                    echo 10m > /sys/class/leds/dell::kbd_backlight/stop_timeout
 
                Note that when this file is read, the returned value might be
index 205d3b6..e6e0f7f 100644 (file)
@@ -13,8 +13,8 @@ Description:
                For example the token ID "5" would be available
                as the following attributes:
 
-               0005_location
-               0005_value
+               0005_location
+               0005_value
 
                Tokens will vary from machine to machine, and
                only tokens available on that machine will be
index 3683cb1..d6ab34e 100644 (file)
@@ -113,8 +113,11 @@ KernelVersion:     5.5
 Contact:       Wu Hao <hao.wu@intel.com>
 Description:   Read-Only. Read this file to get the name of hwmon device, it
                supports values:
-                   'dfl_fme_thermal' - thermal hwmon device name
-                   'dfl_fme_power'   - power hwmon device name
+
+               =================  =========================
+               'dfl_fme_thermal'  thermal hwmon device name
+               'dfl_fme_power'    power hwmon device name
+               =================  =========================
 
 What:          /sys/bus/platform/devices/dfl-fme.0/hwmon/hwmonX/temp1_input
 Date:          October 2019
@@ -169,8 +172,11 @@ KernelVersion:     5.5
 Contact:       Wu Hao <hao.wu@intel.com>
 Description:   Read-Only. Read this file to get the policy of hardware threshold1
                (see 'temp1_max'). It only supports two values (policies):
-                   0 - AP2 state (90% throttling)
-                   1 - AP1 state (50% throttling)
+
+               ==  ==========================
+                0  AP2 state (90% throttling)
+                1  AP1 state (50% throttling)
+               ==  ==========================
 
 What:          /sys/bus/platform/devices/dfl-fme.0/hwmon/hwmonX/power1_input
 Date:          October 2019
index 2cbc660..1418343 100644 (file)
@@ -27,12 +27,15 @@ KernelVersion:      v4.10
 Contact:       linux-acpi@vger.kernel.org
 Description:
                (RO) Display the platform power source
+
+               ========= ============================
                bits[3:0] Current power source
-                       0x00 = DC
-                       0x01 = AC
-                       0x02 = USB
-                       0x03 = Wireless Charger
+                         - 0x00 = DC
+                         - 0x01 = AC
+                         - 0x02 = USB
+                         - 0x03 = Wireless Charger
                bits[7:4] Power source sequence number
+               ========= ============================
 
 What:          /sys/bus/platform/devices/INT3407:00/dptf_power/battery_steady_power
 Date:          Jul, 2016
index 5b026c6..70dbe07 100644 (file)
@@ -4,9 +4,11 @@ KernelVersion: 2.6.26
 Contact:       "Corentin Chary" <corentincj@iksaif.net>
 Description:
                This file allows display switching.
+
                - 1 = LCD
                - 2 = CRT
                - 3 = LCD+CRT
+
                If you run X11, you should use xrandr instead.
 
 What:          /sys/devices/platform/eeepc/camera
@@ -30,16 +32,20 @@ Contact:    "Corentin Chary" <corentincj@iksaif.net>
 Description:
                Change CPU clock configuration.
                On the Eee PC 1000H there are three available clock configuration:
+
                    * 0 -> Super Performance Mode
                    * 1 -> High Performance Mode
                    * 2 -> Power Saving Mode
+
                On Eee PC 701 there is only 2 available clock configurations.
                Available configuration are listed in available_cpufv file.
                Reading this file will show the raw hexadecimal value which
-               is defined as follow:
-               | 8 bit | 8 bit |
-                   |       `---- Current mode
-                   `------------ Availables modes
+               is defined as follow::
+
+                 | 8 bit | 8 bit |
+                     |       `---- Current mode
+                     `------------ Availables modes
+
                For example, 0x301 means: mode 1 selected, 3 available modes.
 
 What:          /sys/devices/platform/eeepc/available_cpufv
index c394b80..b6a138b 100644 (file)
@@ -5,9 +5,9 @@ Contact:        Wolfram Sang <wsa+renesas@sang-engineering.com>
 Description:
                Reading the file will give you a list of masters which can be
                selected for a demultiplexed bus. The format is
-               "<index>:<name>". Example from a Renesas Lager board:
+               "<index>:<name>". Example from a Renesas Lager board::
 
-               0:/i2c@e6500000 1:/i2c@e6508000
+                 0:/i2c@e6500000 1:/i2c@e6508000
 
 What:          /sys/devices/platform/<i2c-demux-name>/current_master
 Date:          January 2016
index 1b31be3..fd2ac02 100644 (file)
@@ -12,6 +12,7 @@ Contact:      "Maxim Mikityanskiy <maxtram95@gmail.com>"
 Description:
                Change fan mode
                There are four available modes:
+
                        * 0 -> Super Silent Mode
                        * 1 -> Standard Mode
                        * 2 -> Dust Cleaning
@@ -32,9 +33,11 @@ KernelVersion:       4.18
 Contact:       "Oleg Keri <ezhi99@gmail.com>"
 Description:
                Control fn-lock mode.
+
                        * 1 -> Switched On
                        * 0 -> Switched Off
 
-               For example:
-               # echo "0" >    \
-               /sys/bus/pci/devices/0000:00:1f.0/PNP0C09:00/VPC2004:00/fn_lock
+               For example::
+
+                 # echo "0" >  \
+                 /sys/bus/pci/devices/0000:00:1f.0/PNP0C09:00/VPC2004:00/fn_lock
index 5aa6189..02ae1e9 100644 (file)
@@ -8,5 +8,6 @@ Description:
                of 0 and userspace can signal SBL to update firmware,
                on next reboot, by writing a value of 1.
                There are two available states:
+
                    * 0 -> Skip firmware update while rebooting
                    * 1 -> Attempt firmware update on next reboot
index 8af6505..e19144f 100644 (file)
@@ -7,5 +7,6 @@ Description:
                Thunderbolt controllers to turn on or off when no
                devices are connected (write-only)
                There are two available states:
+
                    * 0 -> Force power disabled
                    * 1 -> Force power enabled
index c165327..a7f81de 100644 (file)
@@ -5,6 +5,7 @@ Contact:        "Pavan Savoy" <pavan_savoy@ti.com>
 Description:
                Name of the UART device at which the WL128x chip
                is connected. example: "/dev/ttyS0".
+
                The device name flows down to architecture specific board
                initialization file from the SFI/ATAGS bootloader
                firmware. The name exposed is read from the user-space
index 401d202..e79ca22 100644 (file)
@@ -5,10 +5,13 @@ Contact:      "Liming Sun <lsun@mellanox.com>"
 Description:
                The Life-cycle state of the SoC, which could be one of the
                following values.
-                 Production - Production state and can be updated to secure
-                 GA Secured - Secure chip and not able to change state
-                 GA Non-Secured - Non-Secure chip and not able to change state
-                 RMA - Return Merchandise Authorization
+
+               ==============  =============================================
+               Production      Production state and can be updated to secure
+               GA Secured      Secure chip and not able to change state
+               GA Non-Secured  Non-Secure chip and not able to change state
+               RMA             Return Merchandise Authorization
+               ==============  =============================================
 
 What:          /sys/bus/platform/devices/MLNXBF04:00/post_reset_wdog
 Date:          Oct 2019
@@ -25,10 +28,13 @@ KernelVersion:      5.5
 Contact:       "Liming Sun <lsun@mellanox.com>"
 Description:
                The source of the boot stream for the next reset. It could be
-               one of the following values.
-                 external - boot from external source (USB or PCIe)
-                 emmc - boot from the onchip eMMC
-                 emmc_legacy - boot from the onchip eMMC in legacy (slow) mode
+               one of the following values:
+
+               ===========  ===============================================
+               external     boot from external source (USB or PCIe)
+               emmc         boot from the onchip eMMC
+               emmc_legacy  boot from the onchip eMMC in legacy (slow) mode
+               ===========  ===============================================
 
 What:          /sys/bus/platform/devices/MLNXBF04:00/second_reset_action
 Date:          Oct 2019
@@ -38,11 +44,14 @@ Description:
                Update the source of the boot stream after next reset. It could
                be one of the following values and will be applied after next
                reset.
-                 external - boot from external source (USB or PCIe)
-                 emmc - boot from the onchip eMMC
-                 emmc_legacy - boot from the onchip eMMC in legacy (slow) mode
-                 swap_emmc - swap the primary / secondary boot partition
-                 none - cancel the action
+
+               ===========  ===============================================
+               external     boot from external source (USB or PCIe)
+               emmc         boot from the onchip eMMC
+               emmc_legacy  boot from the onchip eMMC in legacy (slow) mode
+               swap_emmc    swap the primary / secondary boot partition
+               none         cancel the action
+               ===========  ===============================================
 
 What:          /sys/bus/platform/devices/MLNXBF04:00/secure_boot_fuse_state
 Date:          Oct 2019
@@ -50,9 +59,12 @@ KernelVersion:       5.5
 Contact:       "Liming Sun <lsun@mellanox.com>"
 Description:
                The state of eFuse versions with the following values.
-                 InUse - burnt, valid and currently in use
-                 Used - burnt and valid
-                 Free - not burnt and free to use
-                 Skipped - not burnt but not free (skipped)
-                 Wasted - burnt and invalid
-                 Invalid - not burnt but marked as valid (error state).
+
+               =======  ===============================================
+               InUse    burnt, valid and currently in use
+               Used     burnt and valid
+               Free     not burnt and free to use
+               Skipped  not burnt but not free (skipped)
+               Wasted   burnt and invalid
+               Invalid  not burnt but marked as valid (error state).
+               =======  ===============================================
index 6212697..bc510cc 100644 (file)
@@ -7,9 +7,11 @@ Description:
                The file can show/change the phy mode for role swap of usb.
 
                Write the following strings to change the mode:
-                "host" - switching mode from peripheral to host.
-                "peripheral" - switching mode from host to peripheral.
+
+                - "host" - switching mode from peripheral to host.
+                - "peripheral" - switching mode from host to peripheral.
 
                Read the file, then it shows the following strings:
-                "host" - The mode is host now.
-                "peripheral" - The mode is peripheral now.
+
+                - "host" - The mode is host now.
+                - "peripheral" - The mode is peripheral now.
index 5621c15..8af5b9c 100644 (file)
@@ -7,9 +7,11 @@ Description:
                The file can show/change the drd mode of usb.
 
                Write the following string to change the mode:
-                "host" - switching mode from peripheral to host.
-                "peripheral" - switching mode from host to peripheral.
+
+               - "host" - switching mode from peripheral to host.
+               - "peripheral" - switching mode from host to peripheral.
 
                Read the file, then it shows the following strings:
-                "host" - The mode is host now.
-                "peripheral" - The mode is peripheral now.
+               
+               - "host" - The mode is host now.
+               - "peripheral" - The mode is peripheral now.
index 0d07c03..d5f6e21 100644 (file)
@@ -5,13 +5,22 @@ Contact:      "Sebastien Guiriec" <sebastien.guiriec@intel.com>
 Description:
                LPE Firmware version for SST driver on all atom
                plaforms (BYT/CHT/Merrifield/BSW).
-               If the FW has never been loaded it will display:
+               If the FW has never been loaded it will display::
+
                        "FW not yet loaded"
-               If FW has been loaded it will display:
+
+               If FW has been loaded it will display::
+
                        "v01.aa.bb.cc"
+
                aa: Major version is reflecting SoC version:
+
+                       === =============
                        0d: BYT FW
                        0b: BSW FW
                        07: Merrifield FW
+                       === =============
+
                bb: Minor version
+
                cc: Build version
index 81fcfb4..53622d3 100644 (file)
@@ -16,10 +16,13 @@ Contact:    Krzysztof Opasiak <k.opasiak@samsung.com>
 Description:
                Current status of the device.
                Allowed values:
-               1 - Device is available and can be exported
-               2 - Device is currently exported
-               3 - Fatal error occurred during communication
-                 with peer
+
+               ==  ==========================================
+               1   Device is available and can be exported
+               2   Device is currently exported
+               3   Fatal error occurred during communication
+                   with peer
+               ==  ==========================================
 
 What:          /sys/devices/platform/usbip-vudc.%d/usbip_sockfd
 Date:          April 2016
index 5f60b18..4439d06 100644 (file)
@@ -39,6 +39,7 @@ Description:
                which affects charging via the special USB PowerShare port
                (marked with a small lightning bolt or battery icon) when in
                low power states:
+
                - In S0, the port will always provide power.
                - In S0ix, if usb_charge is enabled, then power will be
                  supplied to the port when on AC or if battery is > 50%.
index 5e6ead2..51c0f57 100644 (file)
@@ -47,14 +47,18 @@ Description:
                suspend-to-disk mechanism.  Reading from this file returns
                the name of the method by which the system will be put to
                sleep on the next suspend.  There are four methods supported:
+
                'firmware' - means that the memory image will be saved to disk
                by some firmware, in which case we also assume that the
                firmware will handle the system suspend.
+
                'platform' - the memory image will be saved by the kernel and
                the system will be put to sleep by the platform driver (e.g.
                ACPI or other PM registers).
+
                'shutdown' - the memory image will be saved by the kernel and
                the system will be powered off.
+
                'reboot' - the memory image will be saved by the kernel and
                the system will be rebooted.
 
@@ -74,12 +78,12 @@ Description:
                The suspend-to-disk method may be chosen by writing to this
                file one of the accepted strings:
 
-               'firmware'
-               'platform'
-               'shutdown'
-               'reboot'
-               'testproc'
-               'test'
+               'firmware'
+               'platform'
+               'shutdown'
+               'reboot'
+               'testproc'
+               'test'
 
                It will only change to 'firmware' or 'platform' if the system
                supports that.
@@ -114,9 +118,9 @@ Description:
                string representing a nonzero integer into it.
 
                To use this debugging feature you should attempt to suspend
-               the machine, then reboot it and run
+               the machine, then reboot it and run::
 
-               dmesg -s 1000000 | grep 'hash matches'
+                 dmesg -s 1000000 | grep 'hash matches'
 
                If you do not get any matches (or they appear to be false
                positives), it is possible that the last PM event point
@@ -244,6 +248,7 @@ Description:
                wakeup sources created with the help of /sys/power/wake_lock.
                When a string is written to /sys/power/wake_unlock, it will be
                assumed to represent the name of a wakeup source to deactivate.
+
                If a wakeup source object of that name exists and is active at
                the moment, it will be deactivated.
 
index 8a8e466..e39dd3a 100644 (file)
@@ -5,7 +5,7 @@ Description:
                /sys/kernel/profiling is the runtime equivalent
                of the boot-time profile= option.
 
-               You can get the same effect running:
+               You can get the same effect running::
 
                        echo 2 > /sys/kernel/profiling
 
index a17f817..2363ad8 100644 (file)
@@ -69,7 +69,7 @@ Description:
                pin offered by the PTP hardware clock. The file name
                is the hardware dependent pin name. Reading from this
                file produces two numbers, the assigned function (see
-               the PTP_PF_ enumeration values in linux/ptp_clock.h)
+               the `PTP_PF_` enumeration values in linux/ptp_clock.h)
                and the channel number. The function and channel
                assignment may be changed by two writing numbers into
                the file.
index aa39f8d..0b62277 100644 (file)
@@ -6,42 +6,46 @@ Description:
                 Enable passing additional variables for synthetic uevents that
                 are generated by writing /sys/.../uevent file.
 
-                Recognized extended format is ACTION [UUID [KEY=VALUE ...].
+                Recognized extended format is::
 
-                The ACTION is compulsory - it is the name of the uevent action
-                ("add", "change", "remove"). There is no change compared to
-                previous functionality here. The rest of the extended format
-                is optional.
+                       ACTION [UUID [KEY=VALUE ...]
+
+                The ACTION is compulsory - it is the name of the uevent
+                action (``add``, ``change``, ``remove``). There is no change
+                compared to previous functionality here. The rest of the
+                extended format is optional.
 
                 You need to pass UUID first before any KEY=VALUE pairs.
-                The UUID must be in "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
+                The UUID must be in ``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx``
                 format where 'x' is a hex digit. The UUID is considered to be
                 a transaction identifier so it's possible to use the same UUID
                 value for one or more synthetic uevents in which case we
                 logically group these uevents together for any userspace
                 listeners. The UUID value appears in uevent as
-                "SYNTH_UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" environment
+                ``SYNTH_UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`` environment
                 variable.
 
                 If UUID is not passed in, the generated synthetic uevent gains
-                "SYNTH_UUID=0" environment variable automatically.
+                ``SYNTH_UUID=0`` environment variable automatically.
 
                 The KEY=VALUE pairs can contain alphanumeric characters only.
+
                 It's possible to define zero or more pairs - each pair is then
                 delimited by a space character ' '. Each pair appears in
-                synthetic uevent as "SYNTH_ARG_KEY=VALUE". That means the KEY
-                name gains "SYNTH_ARG_" prefix to avoid possible collisions
+                synthetic uevent as ``SYNTH_ARG_KEY=VALUE``. That means the KEY
+                name gains ``SYNTH_ARG_`` prefix to avoid possible collisions
                 with existing variables.
 
-                Example of valid sequence written to the uevent file:
+                Example of valid sequence written to the uevent file::
 
                     add fe4d7c9d-b8c6-4a70-9ef1-3d8a58d18eed A=1 B=abc
 
-                This generates synthetic uevent including these variables:
+                This generates synthetic uevent including these variables::
 
                     ACTION=add
                     SYNTH_ARG_A=1
                     SYNTH_ARG_B=abc
                     SYNTH_UUID=fe4d7c9d-b8c6-4a70-9ef1-3d8a58d18eed
+
 Users:
                 udev, userspace tools generating synthetic uevents
index a99c5f8..2969d36 100644 (file)
@@ -45,7 +45,8 @@ Description:
                 7. Device is unplugged.
 
                 References:
-                  [WUSB-AM] Association Models Supplement to the
+                  [WUSB-AM]
+                           Association Models Supplement to the
                             Certified Wireless Universal Serial Bus
                             Specification, version 1.0.
 
index 419a92d..1db89b0 100644 (file)
@@ -3,44 +3,52 @@ Date:         2020-01-14
 KernelVersion: 5.6
 Contact:       linux-usb@vger.kernel.org
 Description:   There are two USB charger states:
-               USB_CHARGER_ABSENT
-               USB_CHARGER_PRESENT
+
+               - USB_CHARGER_ABSENT
+               - USB_CHARGER_PRESENT
+
                There are five USB charger types:
-               USB_CHARGER_UNKNOWN_TYPE: Charger type is unknown
-               USB_CHARGER_SDP_TYPE: Standard Downstream Port
-               USB_CHARGER_CDP_TYPE: Charging Downstream Port
-               USB_CHARGER_DCP_TYPE: Dedicated Charging Port
-               USB_CHARGER_ACA_TYPE: Accessory Charging Adapter
+
+               ========================  ==========================
+               USB_CHARGER_UNKNOWN_TYPE  Charger type is unknown
+               USB_CHARGER_SDP_TYPE      Standard Downstream Port
+               USB_CHARGER_CDP_TYPE      Charging Downstream Port
+               USB_CHARGER_DCP_TYPE      Dedicated Charging Port
+               USB_CHARGER_ACA_TYPE      Accessory Charging Adapter
+               ========================  ==========================
+
                https://www.usb.org/document-library/battery-charging-v12-spec-and-adopters-agreement
 
-               Here are two examples taken using udevadm monitor -p when
-               USB charger is online:
-               UDEV  change   /devices/soc0/usbphynop1 (platform)
-               ACTION=change
-               DEVPATH=/devices/soc0/usbphynop1
-               DRIVER=usb_phy_generic
-               MODALIAS=of:Nusbphynop1T(null)Cusb-nop-xceiv
-               OF_COMPATIBLE_0=usb-nop-xceiv
-               OF_COMPATIBLE_N=1
-               OF_FULLNAME=/usbphynop1
-               OF_NAME=usbphynop1
-               SEQNUM=2493
-               SUBSYSTEM=platform
-               USB_CHARGER_STATE=USB_CHARGER_PRESENT
-               USB_CHARGER_TYPE=USB_CHARGER_SDP_TYPE
-               USEC_INITIALIZED=227422826
-
-               USB charger is offline:
-               KERNEL change   /devices/soc0/usbphynop1 (platform)
-               ACTION=change
-               DEVPATH=/devices/soc0/usbphynop1
-               DRIVER=usb_phy_generic
-               MODALIAS=of:Nusbphynop1T(null)Cusb-nop-xceiv
-               OF_COMPATIBLE_0=usb-nop-xceiv
-               OF_COMPATIBLE_N=1
-               OF_FULLNAME=/usbphynop1
-               OF_NAME=usbphynop1
-               SEQNUM=2494
-               SUBSYSTEM=platform
-               USB_CHARGER_STATE=USB_CHARGER_ABSENT
-               USB_CHARGER_TYPE=USB_CHARGER_UNKNOWN_TYPE
+               Here are two examples taken using ``udevadm monitor -p`` when
+               USB charger is online::
+
+                   UDEV  change   /devices/soc0/usbphynop1 (platform)
+                   ACTION=change
+                   DEVPATH=/devices/soc0/usbphynop1
+                   DRIVER=usb_phy_generic
+                   MODALIAS=of:Nusbphynop1T(null)Cusb-nop-xceiv
+                   OF_COMPATIBLE_0=usb-nop-xceiv
+                   OF_COMPATIBLE_N=1
+                   OF_FULLNAME=/usbphynop1
+                   OF_NAME=usbphynop1
+                   SEQNUM=2493
+                   SUBSYSTEM=platform
+                   USB_CHARGER_STATE=USB_CHARGER_PRESENT
+                   USB_CHARGER_TYPE=USB_CHARGER_SDP_TYPE
+                   USEC_INITIALIZED=227422826
+
+               USB charger is offline::
+
+                   KERNEL change   /devices/soc0/usbphynop1 (platform)
+                   ACTION=change
+                   DEVPATH=/devices/soc0/usbphynop1
+                   DRIVER=usb_phy_generic
+                   MODALIAS=of:Nusbphynop1T(null)Cusb-nop-xceiv
+                   OF_COMPATIBLE_0=usb-nop-xceiv
+                   OF_COMPATIBLE_N=1
+                   OF_FULLNAME=/usbphynop1
+                   OF_NAME=usbphynop1
+                   SEQNUM=2494
+                   SUBSYSTEM=platform
+                   USB_CHARGER_STATE=USB_CHARGER_ABSENT
+                   USB_CHARGER_TYPE=USB_CHARGER_UNKNOWN_TYPE
index d35c3ca..2b8eca4 100644 (file)
@@ -6,22 +6,22 @@ Description:  When the USB Host Controller has entered a state where it is no
                longer functional a uevent will be raised. The uevent will
                contain ACTION=offline and ERROR=DEAD.
 
-               Here is an example taken using udevadm monitor -p:
+               Here is an example taken using udevadm monitor -p::
 
-               KERNEL[130.428945] offline  /devices/pci0000:00/0000:00:10.0/usb2 (usb)
-               ACTION=offline
-               BUSNUM=002
-               DEVNAME=/dev/bus/usb/002/001
-               DEVNUM=001
-               DEVPATH=/devices/pci0000:00/0000:00:10.0/usb2
-               DEVTYPE=usb_device
-               DRIVER=usb
-               ERROR=DEAD
-               MAJOR=189
-               MINOR=128
-               PRODUCT=1d6b/2/414
-               SEQNUM=2168
-               SUBSYSTEM=usb
-               TYPE=9/0/1
+                   KERNEL[130.428945] offline  /devices/pci0000:00/0000:00:10.0/usb2 (usb)
+                   ACTION=offline
+                   BUSNUM=002
+                   DEVNAME=/dev/bus/usb/002/001
+                   DEVNUM=001
+                   DEVPATH=/devices/pci0000:00/0000:00:10.0/usb2
+                   DEVTYPE=usb_device
+                   DRIVER=usb
+                   ERROR=DEAD
+                   MAJOR=189
+                   MINOR=128
+                   PRODUCT=1d6b/2/414
+                   SEQNUM=2168
+                   SUBSYSTEM=usb
+                   TYPE=9/0/1
 
 Users:         chromium-os-dev@chromium.org
index 66046fa..e549a61 100644 (file)
@@ -10,4 +10,14 @@ config WARN_MISSING_DOCUMENTS
 
           If unsure, select 'N'.
 
+config WARN_ABI_ERRORS
+       bool "Warn if there are errors at ABI files"
+       depends on COMPILE_TEST
+       help
+          The files under Documentation/ABI should follow what's
+          described at Documentation/ABI/README. Yet, as they're manually
+          written, it would be possible that some of those files would
+          have errors that would break them for being parsed by
+          scripts/get_abi.pl. Add a check to verify them.
 
+          If unsure, select 'N'.
index 6b12dd8..61a7310 100644 (file)
@@ -10,6 +10,11 @@ ifeq ($(CONFIG_WARN_MISSING_DOCUMENTS),y)
 $(shell $(srctree)/scripts/documentation-file-ref-check --warn)
 endif
 
+# Check for broken ABI files
+ifeq ($(CONFIG_WARN_ABI_ERRORS),y)
+$(shell $(srctree)/scripts/get_abi.pl validate --dir $(srctree)/Documentation/ABI)
+endif
+
 # You can set these variables from the command line.
 SPHINXBUILD   = sphinx-build
 SPHINXOPTS    =
@@ -21,6 +26,10 @@ BUILDDIR      = $(obj)/output
 PDFLATEX      = xelatex
 LATEXOPTS     = -interaction=batchmode
 
+ifeq ($(KBUILD_VERBOSE),0)
+SPHINXOPTS    += "-q"
+endif
+
 # User-friendly check for sphinx-build
 HAVE_SPHINX := $(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi)
 
index 7bff07c..0ec3486 100644 (file)
@@ -3,9 +3,9 @@ SafeSetID
 =========
 SafeSetID is an LSM module that gates the setid family of syscalls to restrict
 UID/GID transitions from a given UID/GID to only those approved by a
-system-wide whitelist. These restrictions also prohibit the given UIDs/GIDs
+system-wide allowlist. These restrictions also prohibit the given UIDs/GIDs
 from obtaining auxiliary privileges associated with CAP_SET{U/G}ID, such as
-allowing a user to set up user namespace UID mappings.
+allowing a user to set up user namespace UID/GID mappings.
 
 
 Background
@@ -98,10 +98,21 @@ Directions for use
 ==================
 This LSM hooks the setid syscalls to make sure transitions are allowed if an
 applicable restriction policy is in place. Policies are configured through
-securityfs by writing to the safesetid/add_whitelist_policy and
-safesetid/flush_whitelist_policies files at the location where securityfs is
-mounted. The format for adding a policy is '<UID>:<UID>', using literal
-numbers, such as '123:456'. To flush the policies, any write to the file is
-sufficient. Again, configuring a policy for a UID will prevent that UID from
-obtaining auxiliary setid privileges, such as allowing a user to set up user
-namespace UID mappings.
+securityfs by writing to the safesetid/uid_allowlist_policy and
+safesetid/gid_allowlist_policy files at the location where securityfs is
+mounted. The format for adding a policy is '<UID>:<UID>' or '<GID>:<GID>',
+using literal numbers, and ending with a newline character such as '123:456\n'.
+Writing an empty string "" will flush the policy. Again, configuring a policy
+for a UID/GID will prevent that UID/GID from obtaining auxiliary setid
+privileges, such as allowing a user to set up user namespace UID/GID mappings.
+
+Note on GID policies and setgroups()
+====================================
+In v5.9 we are adding support for limiting CAP_SETGID privileges as was done
+previously for CAP_SETUID. However, for compatibility with common sandboxing
+related code conventions in userspace, we currently allow arbitrary
+setgroups() calls for processes with CAP_SETGID restrictions. Until we add
+support in a future release for restricting setgroups() calls, these GID
+policies add no meaningful security. setgroups() restrictions will be enforced
+once we have the policy checking code in place, which will rely on GID policy
+configuration code added in v5.9.
diff --git a/Documentation/admin-guide/abi-obsolete.rst b/Documentation/admin-guide/abi-obsolete.rst
new file mode 100644 (file)
index 0000000..d095867
--- /dev/null
@@ -0,0 +1,11 @@
+ABI obsolete symbols
+====================
+
+Documents interfaces that are still remaining in the kernel, but are
+marked to be removed at some later point in time.
+
+The description of the interface will document the reason why it is
+obsolete and when it can be expected to be removed.
+
+.. kernel-abi:: $srctree/Documentation/ABI/obsolete
+   :rst:
diff --git a/Documentation/admin-guide/abi-removed.rst b/Documentation/admin-guide/abi-removed.rst
new file mode 100644 (file)
index 0000000..f7e9e43
--- /dev/null
@@ -0,0 +1,5 @@
+ABI removed symbols
+===================
+
+.. kernel-abi:: $srctree/Documentation/ABI/removed
+   :rst:
diff --git a/Documentation/admin-guide/abi-stable.rst b/Documentation/admin-guide/abi-stable.rst
new file mode 100644 (file)
index 0000000..7049073
--- /dev/null
@@ -0,0 +1,14 @@
+ABI stable symbols
+==================
+
+Documents the interfaces that the developer has defined to be stable.
+
+Userspace programs are free to use these interfaces with no
+restrictions, and backward compatibility for them will be guaranteed
+for at least 2 years.
+
+Most interfaces (like syscalls) are expected to never change and always
+be available.
+
+.. kernel-abi:: $srctree/Documentation/ABI/stable
+   :rst:
diff --git a/Documentation/admin-guide/abi-testing.rst b/Documentation/admin-guide/abi-testing.rst
new file mode 100644 (file)
index 0000000..b205b16
--- /dev/null
@@ -0,0 +1,20 @@
+ABI testing symbols
+===================
+
+Documents interfaces that are felt to be stable,
+as the main development of this interface has been completed.
+
+The interface can be changed to add new features, but the
+current interface will not break by doing this, unless grave
+errors or security problems are found in them.
+
+Userspace programs can start to rely on these interfaces, but they must
+be aware of changes that can occur before these interfaces move to
+be marked stable.
+
+Programs that use these interfaces are strongly encouraged to add their
+name to the description of these interfaces, so that the kernel
+developers can easily notify them if any changes occur.
+
+.. kernel-abi:: $srctree/Documentation/ABI/testing
+   :rst:
diff --git a/Documentation/admin-guide/abi.rst b/Documentation/admin-guide/abi.rst
new file mode 100644 (file)
index 0000000..bcab3ef
--- /dev/null
@@ -0,0 +1,11 @@
+=====================
+Linux ABI description
+=====================
+
+.. toctree::
+   :maxdepth: 2
+
+   abi-stable
+   abi-testing
+   abi-obsolete
+   abi-removed
index ebdecf8..f3ada90 100644 (file)
@@ -61,43 +61,46 @@ will lead to quite erratic information inside ``/proc/stat``::
 
        static volatile sig_atomic_t stop;
 
-       static void sighandler (int signr)
+       static void sighandler(int signr)
        {
-       (void) signr;
-       stop = 1;
+               (void) signr;
+               stop = 1;
        }
+
        static unsigned long hog (unsigned long niters)
        {
-       stop = 0;
-       while (!stop && --niters);
-       return niters;
+               stop = 0;
+               while (!stop && --niters);
+               return niters;
        }
+
        int main (void)
        {
-       int i;
-       struct itimerval it = { .it_interval = { .tv_sec = 0, .tv_usec = 1 },
-                               .it_value = { .tv_sec = 0, .tv_usec = 1 } };
-       sigset_t set;
-       unsigned long v[HIST];
-       double tmp = 0.0;
-       unsigned long n;
-       signal (SIGALRM, &sighandler);
-       setitimer (ITIMER_REAL, &it, NULL);
-
-       hog (ULONG_MAX);
-       for (i = 0; i < HIST; ++i) v[i] = ULONG_MAX - hog (ULONG_MAX);
-       for (i = 0; i < HIST; ++i) tmp += v[i];
-       tmp /= HIST;
-       n = tmp - (tmp / 3.0);
-
-       sigemptyset (&set);
-       sigaddset (&set, SIGALRM);
-
-       for (;;) {
-               hog (n);
-               sigwait (&set, &i);
-       }
-       return 0;
+               int i;
+               struct itimerval it = {
+                       .it_interval = { .tv_sec = 0, .tv_usec = 1 },
+                       .it_value    = { .tv_sec = 0, .tv_usec = 1 } };
+               sigset_t set;
+               unsigned long v[HIST];
+               double tmp = 0.0;
+               unsigned long n;
+               signal(SIGALRM, &sighandler);
+               setitimer(ITIMER_REAL, &it, NULL);
+
+               hog (ULONG_MAX);
+               for (i = 0; i < HIST; ++i) v[i] = ULONG_MAX - hog(ULONG_MAX);
+               for (i = 0; i < HIST; ++i) tmp += v[i];
+               tmp /= HIST;
+               n = tmp - (tmp / 3.0);
+
+               sigemptyset(&set);
+               sigaddset(&set, SIGALRM);
+
+               for (;;) {
+                       hog(n);
+                       sigwait(&set, &i);
+               }
+               return 0;
        }
 
 
index ed1cf94..5857347 100644 (file)
@@ -18,6 +18,8 @@ etc.
    devices
    sysctl/index
 
+   abi
+
 This section describes CPU vulnerabilities and their mitigations.
 
 .. toctree::
@@ -115,7 +117,6 @@ configure specific aspects of kernel behavior to your liking.
    unicode
    vga-softcursor
    video-output
-   wimax/index
    xfs
 
 .. only::  subproject and html
index 02d4adb..526d65d 100644 (file)
                        After which time (jiffies) the event handling loop
                        should start to delay EOI handling. Default is 2.
 
+       xen.fifo_events=        [XEN]
+                       Boolean parameter to disable using fifo event handling
+                       even if available. Normally fifo event handling is
+                       preferred over the 2-level event handling, as it is
+                       fairer and the number of possible event channels is
+                       much higher. Default is on (use fifo events).
+
        nopv=           [X86,XEN,KVM,HYPER_V,VMWARE]
                        Disables the PV optimizations forcing the guest to run
                        as generic guest with no PV drivers. Currently support
index 37940a0..10fde58 100644 (file)
@@ -478,7 +478,7 @@ order to ask the hardware to enter that state.  Also, for each
 statistics of the given idle state.  That information is exposed by the kernel
 via ``sysfs``.
 
-For each CPU in the system, there is a :file:`/sys/devices/system/cpu<N>/cpuidle/`
+For each CPU in the system, there is a :file:`/sys/devices/system/cpu/cpu<N>/cpuidle/`
 directory in ``sysfs``, where the number ``<N>`` is assigned to the given
 CPU at the initialization time.  That directory contains a set of subdirectories
 called :file:`state0`, :file:`state1` and so on, up to the number of idle state
@@ -494,7 +494,7 @@ object corresponding to it, as follows:
        residency.
 
 ``below``
-       Total number of times this idle state had been asked for, but cerainly
+       Total number of times this idle state had been asked for, but certainly
        a deeper idle state would have been a better match for the observed idle
        duration.
 
index 57fd6ce..f2ab8a5 100644 (file)
@@ -300,6 +300,7 @@ Note:
       0:    0     1     2     3     4     5     6     7
   RSS hash key:
   84:50:f4:00:a8:15:d1:a7:e9:7f:1d:60:35:c7:47:25:42:97:74:ca:56:bb:b6:a1:d8:43:e3:c9:0c:fd:17:55:c2:3a:4d:69:ed:f1:42:89
+
 netdev_tstamp_prequeue
 ----------------------
 
index 4b9d2e8..f455fa0 100644 (file)
@@ -27,6 +27,7 @@ Currently, these files are in /proc/sys/vm:
 - admin_reserve_kbytes
 - block_dump
 - compact_memory
+- compaction_proactiveness
 - compact_unevictable_allowed
 - dirty_background_bytes
 - dirty_background_ratio
@@ -37,6 +38,7 @@ Currently, these files are in /proc/sys/vm:
 - dirty_writeback_centisecs
 - drop_caches
 - extfrag_threshold
+- highmem_is_dirtyable
 - hugetlb_shm_group
 - laptop_mode
 - legacy_va_layout
index 62b533d..0c536ae 100644 (file)
@@ -148,3 +148,13 @@ SunXi family
         * User Manual
 
           http://dl.linux-sunxi.org/A64/Allwinner%20A64%20User%20Manual%20v1.0.pdf
+
+      - Allwinner H6
+
+       * Datasheet
+
+         https://linux-sunxi.org/images/5/5c/Allwinner_H6_V200_Datasheet_V1.1.pdf
+
+       * User Manual
+
+         https://linux-sunxi.org/images/4/46/Allwinner_H6_V200_User_Manual_V1.1.pdf
index b44f939..a110124 100644 (file)
@@ -1,3 +1,5 @@
+.. _hugetlbpage_index:
+
 ====================
 HugeTLBpage on ARM64
 ====================
index 034d37c..b540178 100644 (file)
@@ -102,7 +102,9 @@ applications.
 system call) are not checked if the user thread tag checking mode is
 ``PR_MTE_TCF_NONE`` or ``PR_MTE_TCF_ASYNC``. If the tag checking mode is
 ``PR_MTE_TCF_SYNC``, the kernel makes a best effort to check its user
-address accesses, however it cannot always guarantee it.
+address accesses, however it cannot always guarantee it. Kernel accesses
+to user addresses are always performed with an effective ``PSTATE.TCO``
+value of zero, regardless of the user configuration.
 
 Excluding Tags in the ``IRG``, ``ADDG`` and ``SUBG`` instructions
 -----------------------------------------------------------------
index d358780..7195102 100644 (file)
@@ -90,6 +90,8 @@ stable kernels.
 +----------------+-----------------+-----------------+-----------------------------+
 | ARM            | Cortex-A76      | #1463225        | ARM64_ERRATUM_1463225       |
 +----------------+-----------------+-----------------+-----------------------------+
+| ARM            | Cortex-A77      | #1508412        | ARM64_ERRATUM_1508412       |
++----------------+-----------------+-----------------+-----------------------------+
 | ARM            | Neoverse-N1     | #1188873,1418040| ARM64_ERRATUM_1418040       |
 +----------------+-----------------+-----------------+-----------------------------+
 | ARM            | Neoverse-N1     | #1349291        | N/A                         |
index f261a5c..2638d34 100644 (file)
@@ -124,6 +124,10 @@ For zoned block devices (zoned attribute indicating "host-managed" or
 EXPLICIT OPEN, IMPLICIT OPEN or CLOSED, is limited by this value.
 If this value is 0, there is no limit.
 
+If the host attempts to exceed this limit, the driver should report this error
+with BLK_STS_ZONE_ACTIVE_RESOURCE, which user space may see as the EOVERFLOW
+errno.
+
 max_open_zones (RO)
 -------------------
 For zoned block devices (zoned attribute indicating "host-managed" or
@@ -131,6 +135,10 @@ For zoned block devices (zoned attribute indicating "host-managed" or
 EXPLICIT OPEN or IMPLICIT OPEN, is limited by this value.
 If this value is 0, there is no limit.
 
+If the host attempts to exceed this limit, the driver should report this error
+with BLK_STS_ZONE_OPEN_RESOURCE, which user space may see as the ETOOMANYREFS
+errno.
+
 max_sectors_kb (RW)
 -------------------
 This is the maximum number of kilobytes that the block layer will allow
index 376dd0d..ed2b43e 100644 (file)
@@ -38,7 +38,8 @@ needs_sphinx = '1.3'
 # ones.
 extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include',
               'kfigure', 'sphinx.ext.ifconfig', 'automarkup',
-              'maintainers_include', 'sphinx.ext.autosectionlabel' ]
+              'maintainers_include', 'sphinx.ext.autosectionlabel',
+              'kernel_abi']
 
 #
 # cdomain is badly broken in Sphinx 3+.  Leaving it out generates *most*
@@ -50,7 +51,7 @@ if major >= 3:
         support for Sphinx v3.0 and above is brand new. Be prepared for
         possible issues in the generated output.
         ''')
-    if minor > 0 or patch >= 2:
+    if (major > 3) or (minor > 0 or patch >= 2):
         # Sphinx c function parser is more pedantic with regards to type
         # checking. Due to that, having macros at c:function cause problems.
         # Those needed to be scaped by using c_id_attributes[] array
index ea04132..75cb757 100644 (file)
@@ -519,10 +519,9 @@ routines, e.g.:::
 Part II - Non-coherent DMA allocations
 --------------------------------------
 
-These APIs allow to allocate pages in the kernel direct mapping that are
-guaranteed to be DMA addressable.  This means that unlike dma_alloc_coherent,
-virt_to_page can be called on the resulting address, and the resulting
-struct page can be used for everything a struct page is suitable for.
+These APIs allow to allocate pages that are guaranteed to be DMA addressable
+by the passed in device, but which need explicit management of memory ownership
+for the kernel vs the device.
 
 If you don't understand how cache line coherency works between a processor and
 an I/O device, you should not be using this part of the API.
@@ -537,7 +536,7 @@ an I/O device, you should not be using this part of the API.
 This routine allocates a region of <size> bytes of consistent memory.  It
 returns a pointer to the allocated region (in the processor's virtual address
 space) or NULL if the allocation failed.  The returned memory may or may not
-be in the kernels direct mapping.  Drivers must not call virt_to_page on
+be in the kernel direct mapping.  Drivers must not call virt_to_page on
 the returned memory region.
 
 It also returns a <dma_handle> which may be cast to an unsigned integer the
@@ -565,7 +564,45 @@ reused.
 Free a region of memory previously allocated using dma_alloc_noncoherent().
 dev, size and dma_handle and dir must all be the same as those passed into
 dma_alloc_noncoherent().  cpu_addr must be the virtual address returned by
-the dma_alloc_noncoherent().
+dma_alloc_noncoherent().
+
+::
+
+       struct page *
+       dma_alloc_pages(struct device *dev, size_t size, dma_addr_t *dma_handle,
+                       enum dma_data_direction dir, gfp_t gfp)
+
+This routine allocates a region of <size> bytes of non-coherent memory.  It
+returns a pointer to first struct page for the region, or NULL if the
+allocation failed. The resulting struct page can be used for everything a
+struct page is suitable for.
+
+It also returns a <dma_handle> which may be cast to an unsigned integer the
+same width as the bus and given to the device as the DMA address base of
+the region.
+
+The dir parameter specified if data is read and/or written by the device,
+see dma_map_single() for details.
+
+The gfp parameter allows the caller to specify the ``GFP_`` flags (see
+kmalloc()) for the allocation, but rejects flags used to specify a memory
+zone such as GFP_DMA or GFP_HIGHMEM.
+
+Before giving the memory to the device, dma_sync_single_for_device() needs
+to be called, and before reading memory written by the device,
+dma_sync_single_for_cpu(), just like for streaming DMA mappings that are
+reused.
+
+::
+
+       void
+       dma_free_pages(struct device *dev, size_t size, struct page *page,
+                       dma_addr_t dma_handle, enum dma_data_direction dir)
+
+Free a region of memory previously allocated using dma_alloc_pages().
+dev, size and dma_handle and dir must all be the same as those passed into
+dma_alloc_noncoherent().  page must be the pointer returned by
+dma_alloc_pages().
 
 ::
 
index c09c9ca..2b68add 100644 (file)
@@ -295,11 +295,13 @@ print the number of the test and the status of the test:
 pass::
 
         ok 28 - kmalloc_double_kzfree
+
 or, if kmalloc failed::
 
         # kmalloc_large_oob_right: ASSERTION FAILED at lib/test_kasan.c:163
         Expected ptr is not null, but is
         not ok 4 - kmalloc_large_oob_right
+
 or, if a KASAN report was expected, but not found::
 
         # kmalloc_double_kzfree: EXPECTATION FAILED at lib/test_kasan.c:629
index d23385e..454f307 100644 (file)
@@ -197,7 +197,7 @@ Now add the following to ``drivers/misc/Kconfig``:
 
        config MISC_EXAMPLE_TEST
                bool "Test for my example"
-               depends on MISC_EXAMPLE && KUNIT
+               depends on MISC_EXAMPLE && KUNIT=y
 
 and the following to ``drivers/misc/Makefile``:
 
index 961d3ea..62142a4 100644 (file)
@@ -561,6 +561,11 @@ Once the kernel is built and installed, a simple
 
 ...will run the tests.
 
+.. note::
+   Note that you should make sure your test depends on ``KUNIT=y`` in Kconfig
+   if the test does not support module build.  Otherwise, it will trigger
+   compile errors if ``CONFIG_KUNIT`` is ``m``.
+
 Writing new tests for other architectures
 -----------------------------------------
 
index 14023f0..02dc72c 100644 (file)
@@ -20,6 +20,12 @@ properties:
           - enum:
               - allo,sparky # Allo.com Sparky
               - cubietech,cubieboard6 # Cubietech CubieBoard6
+              - roseapplepi,roseapplepi # RoseapplePi.org RoseapplePi
+          - const: actions,s500
+      - items:
+          - enum:
+              - caninos,labrador-base-m # Labrador Base Board M v1
+          - const: caninos,labrador-v2  # Labrador Core v2
           - const: actions,s500
       - items:
           - enum:
@@ -30,6 +36,11 @@ properties:
       # The Actions Semi S700 is a quad-core ARM Cortex-A53 SoC.
       - items:
           - enum:
+              - caninos,labrador-base-m2 # Labrador Base Board M v2
+          - const: caninos,labrador-v3   # Labrador Core v3
+          - const: actions,s700
+      - items:
+          - enum:
               - cubietech,cubieboard7 # Cubietech CubieBoard7
           - const: actions,s700
 
@@ -38,3 +49,5 @@ properties:
           - enum:
               - ucrobotics,bubblegum-96 # uCRobotics Bubblegum-96
           - const: actions,s900
+
+additionalProperties: true
index 0bc5020..c15c92f 100644 (file)
@@ -19,4 +19,7 @@ properties:
           - altr,socfpga-arria5
           - altr,socfpga-arria10
       - const: altr,socfpga
+
+additionalProperties: true
+
 ...
index a3a4d71..0f03135 100644 (file)
@@ -30,4 +30,6 @@ properties:
               - amazon,al-alpine-v3-evp
           - const: amazon,al-alpine-v3
 
+additionalProperties: true
+
 ...
index 5eba9f4..3341788 100644 (file)
@@ -96,6 +96,7 @@ properties:
               - hwacom,amazetv
               - khadas,vim
               - libretech,aml-s905x-cc
+              - libretech,aml-s905x-cc-v2
               - nexbox,a95x
           - const: amlogic,s905x
           - const: amlogic,meson-gxl
@@ -153,6 +154,7 @@ properties:
               - azw,gtking
               - azw,gtking-pro
               - hardkernel,odroid-n2
+              - hardkernel,odroid-n2-plus
               - khadas,vim3
               - ugoos,am6
           - const: amlogic,s922x
@@ -171,4 +173,7 @@ properties:
           - enum:
               - amlogic,ad401
           - const: amlogic,a1
+
+additionalProperties: true
+
 ...
index 31b0c54..6fc5a22 100644 (file)
@@ -41,6 +41,7 @@ properties:
               - overkiz,kizboxmini-mb   # Overkiz kizbox Mini Mother Board
               - overkiz,kizboxmini-rd   # Overkiz kizbox Mini RailDIN
               - overkiz,smartkiz        # Overkiz SmartKiz Board
+              - gardena,smart-gateway-at91sam # GARDENA smart Gateway (Article No. 19000)
           - const: atmel,at91sam9g25
           - const: atmel,at91sam9x5
           - const: atmel,at91sam9
@@ -183,4 +184,6 @@ properties:
           - const: atmel,samv71
           - const: atmel,samv7
 
+additionalProperties: true
+
 ...
index 3ea5f2f..e0d2bb7 100644 (file)
@@ -18,4 +18,6 @@ properties:
       - const: lsi,axm5516-amarillo
       - const: lsi,axm5516
 
+additionalProperties: true
+
 ...
index dd52e29..812ae8c 100644 (file)
@@ -51,4 +51,6 @@ properties:
               - raspberrypi,3-compute-module-lite
           - const: brcm,bcm2837
 
+additionalProperties: true
+
 ...
index 497600a..c603243 100644 (file)
@@ -18,4 +18,6 @@ properties:
           - brcm,bcm28155-ap
       - const: brcm,bcm11351
 
+additionalProperties: true
+
 ...
index e0ee931..b302075 100644 (file)
@@ -18,4 +18,6 @@ properties:
           - brcm,bcm21664-garnet
       - const: brcm,bcm21664
 
+additionalProperties: true
+
 ...
index 40d12ea..37f3a6f 100644 (file)
@@ -18,4 +18,6 @@ properties:
           - brcm,bcm23550-sparrow
       - const: brcm,bcm23550
 
+additionalProperties: true
+
 ...
index d48313c..434d3c6 100644 (file)
@@ -83,6 +83,11 @@ properties:
               - brcm,bcm953012er
               - brcm,bcm953012hr
               - brcm,bcm953012k
+              - meraki,mr32
           - const: brcm,brcm53012
+          - const: brcm,brcm53016
           - const: brcm,bcm4708
+
+additionalProperties: true
+
 ...
index 9ba7b16..432ccf9 100644 (file)
@@ -26,4 +26,6 @@ properties:
           - brcm,bcm58305
       - const: brcm,cygnus
 
+additionalProperties: true
+
 ...
index ae614b6..2949483 100644 (file)
@@ -25,4 +25,6 @@ properties:
       - const: brcm,bcm53342
       - const: brcm,hr2
 
+additionalProperties: true
+
 ...
index 0749adf..c4847ab 100644 (file)
@@ -20,4 +20,6 @@ properties:
           - brcm,ns2-xmc
       - const: brcm,ns2
 
+additionalProperties: true
+
 ...
index 8c2cacb..476bc23 100644 (file)
@@ -33,4 +33,6 @@ properties:
           - brcm,bcm88312
       - const: brcm,nsp
 
+additionalProperties: true
+
 ...
index c13cb96..c638e04 100644 (file)
@@ -21,4 +21,6 @@ properties:
           - brcm,bcm958802a802x
       - const: brcm,stingray
 
+additionalProperties: true
+
 ...
index ccdf9f9..4eba182 100644 (file)
@@ -19,4 +19,6 @@ properties:
           - cavium,thunderx2-cn9900
       - const: brcm,vulcan-soc
 
+additionalProperties: true
+
 ...
index 5880083..90ba02b 100644 (file)
@@ -17,4 +17,7 @@ properties:
       - enum:
           - bitmain,sophon-edge
       - const: bitmain,bm1880
+
+additionalProperties: true
+
 ...
index aa5571d..46f78ad 100644 (file)
@@ -20,3 +20,5 @@ properties:
       - enum:
           - calxeda,highbank
           - calxeda,ecx-2000
+
+additionalProperties: true
index 849e205..a35de3c 100644 (file)
@@ -15,4 +15,6 @@ properties:
   compatible:
     const: cnxt,cx92755
 
+additionalProperties: true
+
 ...
index 6da9d73..9342894 100644 (file)
@@ -120,6 +120,7 @@ properties:
               - fsl,imx6q-sabrelite
               - fsl,imx6q-sabresd
               - kontron,imx6q-samx6i      # Kontron i.MX6 Dual/Quad SMARC Module
+              - logicpd,imx6q-logicpd
               - prt,prti6q                # Protonic PRTI6Q board
               - prt,prtwd2                # Protonic WD2 board
               - technexion,imx6q-pico-dwarf   # TechNexion i.MX6Q Pico-Dwarf
@@ -156,6 +157,21 @@ properties:
           - const: gw,ventana
           - const: fsl,imx6q
 
+      - description: i.MX6Q PHYTEC phyBOARD-Mira
+        items:
+          - enum:
+              - phytec,imx6q-pbac06-emmc  # PHYTEC phyBOARD-Mira eMMC RDK
+              - phytec,imx6q-pbac06-nand  # PHYTEC phyBOARD-Mira NAND RDK
+          - const: phytec,imx6q-pbac06    # PHYTEC phyBOARD-Mira
+          - const: phytec,imx6qdl-pcm058  # PHYTEC phyCORE-i.MX6
+          - const: fsl,imx6q
+
+      - description: i.MX6Q PHYTEC phyFLEX-i.MX6
+        items:
+          - const: phytec,imx6q-pbab01    # PHYTEC phyFLEX carrier board
+          - const: phytec,imx6q-pfla02    # PHYTEC phyFLEX-i.MX6 Quad
+          - const: fsl,imx6q
+
       - description: i.MX6QP based Boards
         items:
           - enum:
@@ -163,6 +179,13 @@ properties:
               - fsl,imx6qp-sabresd        # i.MX6 Quad Plus SABRE Smart Device Board
           - const: fsl,imx6qp
 
+      - description: i.MX6QP PHYTEC phyBOARD-Mira
+        items:
+          - const: phytec,imx6qp-pbac06-nand
+          - const: phytec,imx6qp-pbac06   # PHYTEC phyBOARD-Mira
+          - const: phytec,imx6qdl-pcm058  # PHYTEC phyCORE-i.MX6
+          - const: fsl,imx6qp
+
       - description: i.MX6DL based Boards
         items:
           - enum:
@@ -188,6 +211,7 @@ properties:
               - toradex,colibri_imx6dl-v1_1-eval-v3 # Colibri iMX6 Module V1.1 on Colibri Evaluation Board V3
               - ysoft,imx6dl-yapp4-draco  # i.MX6 DualLite Y Soft IOTA Draco board
               - ysoft,imx6dl-yapp4-hydra  # i.MX6 DualLite Y Soft IOTA Hydra board
+              - ysoft,imx6dl-yapp4-orion  # i.MX6 DualLite Y Soft IOTA Orion board
               - ysoft,imx6dl-yapp4-ursa   # i.MX6 Solo Y Soft IOTA Ursa board
           - const: fsl,imx6dl
 
@@ -211,10 +235,26 @@ properties:
           - const: gw,ventana
           - const: fsl,imx6dl
 
+      - description: i.MX6DL PHYTEC phyBOARD-Mira
+        items:
+          - enum:
+              - phytec,imx6dl-pbac06-emmc # PHYTEC phyBOARD-Mira eMMC RDK
+              - phytec,imx6dl-pbac06-nand # PHYTEC phyBOARD-Mira NAND RDK
+          - const: phytec,imx6dl-pbac06   # PHYTEC phyBOARD-Mira
+          - const: phytec,imx6qdl-pcm058  # PHYTEC phyCORE-i.MX6
+          - const: fsl,imx6dl
+
+      - description: i.MX6DL PHYTEC phyFLEX-i.MX6
+        items:
+          - const: phytec,imx6dl-pbab01   # PHYTEC phyFLEX carrier board
+          - const: phytec,imx6dl-pfla02   # PHYTEC phyFLEX-i.MX6 Quad
+          - const: fsl,imx6dl
+
       - description: i.MX6SL based Boards
         items:
           - enum:
               - fsl,imx6sl-evk            # i.MX6 SoloLite EVK Board
+              - kobo,tolino-shine2hd
               - kobo,tolino-shine3
           - const: fsl,imx6sl
 
@@ -246,6 +286,15 @@ properties:
               - technexion,imx6ul-pico-pi      # TechNexion i.MX6UL Pico-Pi
           - const: fsl,imx6ul
 
+      - description: i.MX6UL PHYTEC phyBOARD-Segin
+        items:
+          - enum:
+              - phytec,imx6ul-pbacd10-emmc
+              - phytec,imx6ul-pbacd10-nand
+          - const: phytec,imx6ul-pbacd10  # PHYTEC phyBOARD-Segin with i.MX6 UL
+          - const: phytec,imx6ul-pcl063   # PHYTEC phyCORE-i.MX 6UL
+          - const: fsl,imx6ul
+
       - description: Kontron N6310 S Board
         items:
           - const: kontron,imx6ul-n6310-s
@@ -277,6 +326,15 @@ properties:
               - toradex,colibri-imx6ull-wifi-eval # Colibri iMX6ULL Wi-Fi / BT Module on Colibri Eval Board
           - const: fsl,imx6ull
 
+      - description: i.MX6ULL PHYTEC phyBOARD-Segin
+        items:
+          - enum:
+              - phytec,imx6ull-pbacd10-emmc
+              - phytec,imx6ull-pbacd10-nand
+          - const: phytec,imx6ull-pbacd10 # PHYTEC phyBOARD-Segin with i.MX6 ULL
+          - const: phytec,imx6ull-pcl063  # PHYTEC phyCORE-i.MX 6ULL
+          - const: fsl,imx6ull
+
       - description: Kontron N6411 S Board
         items:
           - const: kontron,imx6ull-n6411-s
@@ -344,7 +402,16 @@ properties:
       - description: i.MX8MM based Boards
         items:
           - enum:
+              - beacon,imx8mm-beacon-kit  # i.MX8MM Beacon Development Kit
+              - fsl,imx8mm-ddr4-evk       # i.MX8MM DDR4 EVK Board
               - fsl,imx8mm-evk            # i.MX8MM EVK Board
+              - variscite,var-som-mx8mm   # i.MX8MM Variscite VAR-SOM-MX8MM module
+          - const: fsl,imx8mm
+
+      - description: Variscite VAR-SOM-MX8MM based boards
+        items:
+          - const: variscite,var-som-mx8mm-symphony
+          - const: variscite,var-som-mx8mm
           - const: fsl,imx8mm
 
       - description: i.MX8MN based Boards
@@ -354,6 +421,12 @@ properties:
               - fsl,imx8mn-evk            # i.MX8MN LPDDR4 EVK Board
           - const: fsl,imx8mn
 
+      - description: Variscite VAR-SOM-MX8MN based boards
+        items:
+          - const: variscite,var-som-mx8mn-symphony
+          - const: variscite,var-som-mx8mn
+          - const: fsl,imx8mn
+
       - description: i.MX8MP based Boards
         items:
           - enum:
@@ -372,13 +445,35 @@ properties:
               - technexion,pico-pi-imx8m  # TechNexion PICO-PI-8M evk
           - const: fsl,imx8mq
 
+      - description: Purism Librem5 phones
+        items:
+          - enum:
+              - purism,librem5r2          # Purism Librem5 phone "Chestnut"
+              - purism,librem5r3          # Purism Librem5 phone "Dogwood"
+          - const: purism,librem5
+          - const: fsl,imx8mq
+
+      - description: Zodiac Inflight Innovations Ultra Boards
+        items:
+          - enum:
+              - zii,imx8mq-ultra-rmb3
+              - zii,imx8mq-ultra-zest
+          - const: zii,imx8mq-ultra
+          - const: fsl,imx8mq
+
       - description: i.MX8QXP based Boards
         items:
           - enum:
               - einfochips,imx8qxp-ai_ml  # i.MX8QXP AI_ML Board
               - fsl,imx8qxp-mek           # i.MX8QXP MEK Board
               - toradex,colibri-imx8x         # Colibri iMX8X Module
+          - const: fsl,imx8qxp
+
+      - description: Toradex Colibri i.MX8 Evaluation Board
+        items:
+          - enum:
               - toradex,colibri-imx8x-eval-v3 # Colibri iMX8X Module on Colibri Evaluation Board V3
+          - const: toradex,colibri-imx8x
           - const: fsl,imx8qxp
 
       - description:
@@ -526,4 +621,6 @@ properties:
               - fsl,s32v234-evb           # S32V234-EVB2 Customer Evaluation Board
           - const: fsl,s32v234
 
+additionalProperties: true
+
 ...
index 43b8ce2..b384580 100644 (file)
@@ -64,4 +64,7 @@ properties:
         items:
           - const: H836ASDJ
           - const: hisilicon,sd5203
+
+additionalProperties: true
+
 ...
index 06a7b05..69cd308 100644 (file)
@@ -16,4 +16,7 @@ properties:
       - enum:
           - intel,keembay-evm
       - const: intel,keembay
+
+additionalProperties: true
+
 ...
index f18302e..d72e92b 100644 (file)
@@ -22,3 +22,5 @@ properties:
           - enum:
               - gateworks,gw2358
           - const: intel,ixp43x
+
+additionalProperties: true
index 7597bc9..5cbcaca 100644 (file)
@@ -42,3 +42,5 @@ properties:
       - description: TI-SCI processor id for the remote processor device
       - description: TI-SCI host id to which processor control ownership
                      should be transferred to
+
+additionalProperties: true
index a9828c5..e9bf305 100644 (file)
@@ -59,3 +59,5 @@ properties:
           - const: marvell,cn9130
           - const: marvell,armada-ap807-quad
           - const: marvell,armada-ap807
+
+additionalProperties: true
index 3090896..f736e8c 100644 (file)
@@ -119,4 +119,7 @@ properties:
           - const: google,krane-sku176
           - const: google,krane
           - const: mediatek,mt8183
+
+additionalProperties: true
+
 ...
index c068df5..670d24c 100644 (file)
@@ -16,4 +16,5 @@ properties:
       - const: moxa,moxart-uc-7112-lx
       - const: moxa,moxart
 
+additionalProperties: true
 ...
index 3235ec9..d581161 100644 (file)
@@ -35,4 +35,7 @@ properties:
           - enum:
               - dell,wyse-ariel
           - const: marvell,mmp3
+
+additionalProperties: true
+
 ...
index c2f980b..7c78740 100644 (file)
@@ -31,3 +31,5 @@ properties:
           - enum:
               - 70mai,midrived08 # 70mai midrive d08
           - const: mstar,mercury5
+
+additionalProperties: true
index f7f0249..214c97b 100644 (file)
@@ -21,4 +21,6 @@ properties:
               - ea,ea3250
               - phytec,phy3250
           - const: nxp,lpc3250
+
+additionalProperties: true
 ...
index fcd3456..42db138 100644 (file)
@@ -18,6 +18,7 @@ Required properties:
                (base address and length)
 
 Optional properties:
+- #power-domain-cells: Should be 0 if the instance is a power domain provider.
 - #reset-cells:        Should be 1 if the PRM instance in question supports resets.
 
 Example:
@@ -25,5 +26,6 @@ Example:
 prm_dsp2: prm@1b00 {
        compatible = "ti,dra7-prm-inst", "ti,omap-prm-inst";
        reg = <0x1b00 0x40>;
+       #power-domain-cells = <0>;
        #reset-cells = <1>;
 };
index ae6284b..c97d4a5 100644 (file)
@@ -40,6 +40,7 @@ description: |
         sdm630
         sdm660
         sdm845
+        sm8250
 
   The 'board' element must be one of the following strings:
 
@@ -47,6 +48,8 @@ description: |
         cp01-c1
         dragonboard
         hk01
+        hk10-c1
+        hk10-c2
         idp
         liquid
         mtp
@@ -150,6 +153,8 @@ properties:
       - items:
           - enum:
               - qcom,ipq8074-hk01
+              - qcom,ipq8074-hk10-c1
+              - qcom,ipq8074-hk10-c2
           - const: qcom,ipq8074
 
       - items:
@@ -167,4 +172,12 @@ properties:
               - qcom,ipq6018-cp01-c1
           - const: qcom,ipq6018
 
+      - items:
+          - enum:
+              - qcom,qrb5165-rb5
+              - qcom,sm8250-mtp
+          - const: qcom,sm8250
+
+additionalProperties: true
+
 ...
index 9672aa0..a5c0444 100644 (file)
@@ -19,4 +19,6 @@ properties:
           - xunlong,orangepi-i96        # Orange Pi i96
       - const: rda,8810pl
 
+additionalProperties: true
+
 ...
index 845f9c7..9fb0297 100644 (file)
@@ -54,4 +54,7 @@ properties:
           - enum:
               - realtek,mjolnir # Realtek Mjolnir EVB
           - const: realtek,rtd1619
+
+additionalProperties: true
+
 ...
index 0d4dabb..ff94c45 100644 (file)
@@ -281,10 +281,24 @@ properties:
               - renesas,draak # Draak (RTP0RC77995SEB0010S)
           - const: renesas,r8a77995
 
+      - description: R-Car V3U (R8A779A0)
+        items:
+          - enum:
+              - renesas,falcon-cpu # Falcon CPU board (RTP0RC779A0CPB0010S)
+          - const: renesas,r8a779a0
+
+      - items:
+          - enum:
+              - renesas,falcon-breakout # Falcon BreakOut board (RTP0RC779A0BOB0010S)
+          - const: renesas,falcon-cpu
+          - const: renesas,r8a779a0
+
       - description: RZ/N1D (R9A06G032)
         items:
           - enum:
               - renesas,rzn1d400-db # RZN1D-DB (RZ/N1D Demo Board for the RZ/N1D 400 pins package)
           - const: renesas,r9a06g032
 
+additionalProperties: true
+
 ...
index db2e357..b621752 100644 (file)
@@ -104,6 +104,11 @@ properties:
               - firefly,roc-rk3399-pc-mezzanine
           - const: rockchip,rk3399
 
+      - description: FriendlyElec NanoPi R2S
+        items:
+          - const: friendlyarm,nanopi-r2s
+          - const: rockchip,rk3328
+
       - description: FriendlyElec NanoPi4 series boards
         items:
           - enum:
@@ -430,8 +435,12 @@ properties:
           - const: radxa,rock
           - const: rockchip,rk3188
 
-      - description: Radxa ROCK Pi 4
+      - description: Radxa ROCK Pi 4A/B/C
         items:
+          - enum:
+              - radxa,rockpi4a
+              - radxa,rockpi4b
+              - radxa,rockpi4c
           - const: radxa,rockpi4
           - const: rockchip,rk3399
 
@@ -555,4 +564,12 @@ properties:
         items:
           - const: tronsmart,orion-r68-meta
           - const: rockchip,rk3368
+
+      - description: Zkmagic A95X Z2
+        items:
+          - const: zkmagic,a95x-z2
+          - const: rockchip,rk3318
+
+additionalProperties: true
+
 ...
index cde9c5e..17678d9 100644 (file)
@@ -24,6 +24,7 @@ select:
           - samsung,exynos5420-pmu
           - samsung,exynos5433-pmu
           - samsung,exynos7-pmu
+          - samsung-s5pv210-pmu
   required:
     - compatible
 
@@ -40,6 +41,7 @@ properties:
           - samsung,exynos5420-pmu
           - samsung,exynos5433-pmu
           - samsung,exynos7-pmu
+          - samsung-s5pv210-pmu
       - const: syscon
 
   reg:
@@ -88,12 +90,28 @@ properties:
 required:
   - compatible
   - reg
-  - '#clock-cells'
-  - clock-names
-  - clocks
 
 additionalProperties: false
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - samsung,exynos3250-pmu
+              - samsung,exynos4210-pmu
+              - samsung,exynos4412-pmu
+              - samsung,exynos5250-pmu
+              - samsung,exynos5410-pmu
+              - samsung,exynos5420-pmu
+              - samsung,exynos5433-pmu
+    then:
+      required:
+        - '#clock-cells'
+        - clock-names
+        - clocks
+
 examples:
   - |
     #include <dt-bindings/clock/exynos5250.h>
index 0b59703..b25eb35 100644 (file)
@@ -24,4 +24,7 @@ properties:
       - items:
           - const: sirf,prima2-cb
           - const: sirf,prima2
+
+additionalProperties: true
+
 ...
index 2bd519d..aa1d4af 100644 (file)
@@ -19,4 +19,7 @@ properties:
           - enum:
               - socionext,milbeaut-m10v-evb
           - const: socionext,sc2000a
+
+additionalProperties: true
+
 ...
index 6caf1f9..8c0e916 100644 (file)
@@ -60,3 +60,5 @@ properties:
           - enum:
               - socionext,uniphier-pxs3-ref
           - const: socionext,uniphier-pxs3
+
+additionalProperties: true
index f6ec731..605ad3f 100644 (file)
@@ -22,4 +22,7 @@ properties:
           - st,spear320
           - st,spear1310
           - st,spear1340
+
+additionalProperties: true
+
 ...
index 0258a96..7b6ae30 100644 (file)
@@ -30,4 +30,6 @@ properties:
               - sprd,sp9863a-1h10
           - const: sprd,sc9863a
 
+additionalProperties: true
+
 ...
index 47f9b8e..b1f28d1 100644 (file)
@@ -20,4 +20,7 @@ properties:
           - st,stih407
           - st,stih410
           - st,stih418
+
+additionalProperties: true
+
 ...
index 696a010..009b424 100644 (file)
@@ -52,4 +52,13 @@ properties:
           - const: st,stm32mp157c-ev1
           - const: st,stm32mp157c-ed1
           - const: st,stm32mp157
+      - description: Odyssey STM32MP1 SoM based Boards
+        items:
+          - enum:
+              - seeed,stm32mp157c-odyssey
+          - const: seeed,stm32mp157c-odyssey-som
+          - const: st,stm32mp157
+
+additionalProperties: true
+
 ...
index efc9118..cab8e1b 100644 (file)
@@ -16,6 +16,11 @@ properties:
   compatible:
     oneOf:
 
+      - description: Allwinner A100 Perf1 Board
+        items:
+          - const: allwinner,a100-perf1
+          - const: allwinner,sun50i-a100
+
       - description: Allwinner A23 Evaluation Board
         items:
           - const: allwinner,sun8i-a23-evb
@@ -626,6 +631,11 @@ properties:
           - const: pine64,pine64-plus
           - const: allwinner,sun50i-a64
 
+      - description: Pine64 PineCube
+        items:
+          - const: pine64,pinecube
+          - const: allwinner,sun8i-s3
+
       - description: Pine64 PineH64 model A
         items:
           - const: pine64,pine-h64
@@ -883,3 +893,5 @@ properties:
         items:
           - const: xunlong,orangepi-zero-plus2-h3
           - const: allwinner,sun8i-h3
+
+additionalProperties: true
index b4d5329..767e863 100644 (file)
@@ -121,3 +121,9 @@ properties:
         items:
           - const: nvidia,p3509-0000+p3668-0000
           - const: nvidia,tegra194
+      - items:
+          - enum:
+              - nvidia,tegra234-vdk
+          - const: nvidia,tegra234
+
+additionalProperties: true
index 2d89cdc..576462f 100644 (file)
@@ -4,6 +4,7 @@ Required properties:
 - compatible: Should contain one of the following:
   - "nvidia,tegra186-pmc": for Tegra186
   - "nvidia,tegra194-pmc": for Tegra194
+  - "nvidia,tegra234-pmc": for Tegra234
 - reg: Must contain an (offset, length) pair of the register set for each
   entry in reg-names.
 - reg-names: Must include the following entries:
@@ -11,7 +12,7 @@ Required properties:
   - "wake"
   - "aotag"
   - "scratch"
-  - "misc" (Only for Tegra194)
+  - "misc" (Only for Tegra194 and later)
 
 Optional properties:
 - nvidia,invert-interrupt: If present, inverts the PMU interrupt signal.
diff --git a/Documentation/devicetree/bindings/arm/ti/k3.txt b/Documentation/devicetree/bindings/arm/ti/k3.txt
deleted file mode 100644 (file)
index 333e725..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-Texas Instruments K3 Multicore SoC architecture device tree bindings
---------------------------------------------------------------------
-
-Platforms based on Texas Instruments K3 Multicore SoC architecture
-shall follow the following scheme:
-
-SoCs
-----
-
-Each device tree root node must specify which exact SoC in K3 Multicore SoC
-architecture it uses, using one of the following compatible values:
-
-- AM654
-  compatible = "ti,am654";
-
-- J721E
-  compatible = "ti,j721e";
-
-Boards
-------
-
-In addition, each device tree root node must specify which one or more
-of the following board-specific compatible values:
-
-- AM654 EVM
-  compatible = "ti,am654-evm", "ti,am654";
diff --git a/Documentation/devicetree/bindings/arm/ti/k3.yaml b/Documentation/devicetree/bindings/arm/ti/k3.yaml
new file mode 100644 (file)
index 0000000..c6e1c1e
--- /dev/null
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/ti/k3.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments K3 Multicore SoC architecture device tree bindings
+
+maintainers:
+  - Nishanth Menon <nm@ti.com>
+
+description: |
+  Platforms based on Texas Instruments K3 Multicore SoC architecture
+  shall have the following properties.
+
+properties:
+  $nodename:
+    const: '/'
+  compatible:
+    oneOf:
+
+      - description: K3 AM654 SoC
+        items:
+          - enum:
+              - ti,am654-evm
+          - const: ti,am654
+
+      - description: K3 J721E SoC
+        items:
+          - const: ti,j721e
+
+      - description: K3 J7200 SoC
+        items:
+          - const: ti,j7200
+
+additionalProperties: true
+
+...
index e372b43..cc2023b 100644 (file)
@@ -21,4 +21,7 @@ properties:
           - ti,nspire-tp
           # Clickpad models
           - ti,nspire-clp
+
+additionalProperties: true
+
 ...
index a8765ba..c022d32 100644 (file)
@@ -23,4 +23,7 @@ properties:
           - enbw,cmc        # EnBW AM1808 based CMC board
           - lego,ev3        # LEGO MINDSTORMS EV3 (AM1808 based)
       - const: ti,da850
+
+additionalProperties: true
+
 ...
diff --git a/Documentation/devicetree/bindings/arm/toshiba.yaml b/Documentation/devicetree/bindings/arm/toshiba.yaml
new file mode 100644 (file)
index 0000000..001bbbc
--- /dev/null
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/toshiba.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Toshiba Visconti Platform Device Tree Bindings
+
+maintainers:
+  - Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
+
+properties:
+  $nodename:
+    const: '/'
+  compatible:
+    oneOf:
+      - description: Visconti5 TMPV7708
+        items:
+          - enum:
+              - toshiba,tmpv7708-rm-mbrc  # TMPV7708 RM main board
+          - const: toshiba,tmpv7708
+
+additionalProperties: true
+
+...
index accaee9..5db7cfb 100644 (file)
@@ -34,3 +34,5 @@ properties:
         items:
           - const: samsung,golden
           - const: st-ericsson,u8500
+
+additionalProperties: true
index 7b25b6f..29ff399 100644 (file)
@@ -21,3 +21,6 @@ properties:
           - wm,wm8650
           - wm,wm8750
           - wm,wm8850
+          
+additionalProperties: true
+
index c73b1f5..e0c6787 100644 (file)
@@ -111,4 +111,6 @@ properties:
           - const: xlnx,zynqmp-zcu111
           - const: xlnx,zynqmp
 
+additionalProperties: true
+
 ...
index 2d3fefd..672f812 100644 (file)
@@ -23,4 +23,6 @@ properties:
               - zte,zx296718-evb
           - const: zte,zx296718
 
+additionalProperties: true
+
 ...
index 729def6..10f6d0a 100644 (file)
@@ -10,7 +10,8 @@ Required properties:
     "brcm,bcm7038-gisb-arb" for 130nm chips
 - reg: specifies the base physical address and size of the registers
 - interrupts: specifies the two interrupts (timeout and TEA) to be used from
-  the parent interrupt controller
+  the parent interrupt controller. A third optional interrupt may be specified
+  for breakpoints.
 
 Optional properties:
 
index ef3deb7..17ac4a3 100644 (file)
@@ -4,7 +4,7 @@ Clock control registers reside in different Hi6220 system controllers,
 please refer the following document to know more about the binding rules
 for these system controllers:
 
-Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt
+Documentation/devicetree/bindings/arm/hisilicon/hisilicon.yaml
 
 Required Properties:
 
index fc82357..0429fb7 100644 (file)
@@ -23,7 +23,9 @@ properties:
       - items:
           - const: allwinner,sun7i-a20-crypto
           - const: allwinner,sun4i-a10-crypto
+      - const: allwinner,sun8i-a33-crypto
       - items:
+          - const: allwinner,sun8i-v3s-crypto
           - const: allwinner,sun8i-a33-crypto
 
   reg:
@@ -59,7 +61,9 @@ if:
   properties:
     compatible:
       contains:
-        const: allwinner,sun6i-a31-crypto
+        enum:
+          - allwinner,sun6i-a31-crypto
+          - allwinner,sun8i-a33-crypto
 
 then:
   required:
index 31f085d..fd3113a 100644 (file)
@@ -7,17 +7,17 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Toshiba TC358775 DSI to LVDS bridge bindings
 
 maintainers:
- - Vinay Simha BN <simhavcs@gmail.com>
 - Vinay Simha BN <simhavcs@gmail.com>
 
 description: |
- This binding supports DSI to LVDS bridge TC358775
 This binding supports DSI to LVDS bridge TC358775
 
- MIPI DSI-RX Data 4-lane, CLK 1-lane with data rates up to 800 Mbps/lane.
- Video frame size:
- Up to 1600x1200 24-bit/pixel resolution for single-link LVDS display panel
- limited by 135 MHz LVDS speed
- Up to WUXGA (1920x1200 24-bit pixels) resolution for dual-link LVDS display
- panel, limited by 270 MHz LVDS speed.
 MIPI DSI-RX Data 4-lane, CLK 1-lane with data rates up to 800 Mbps/lane.
 Video frame size:
 Up to 1600x1200 24-bit/pixel resolution for single-link LVDS display panel
 limited by 135 MHz LVDS speed
 Up to WUXGA (1920x1200 24-bit pixels) resolution for dual-link LVDS display
 panel, limited by 270 MHz LVDS speed.
 
 properties:
   compatible:
@@ -29,7 +29,7 @@ properties:
 
   vdd-supply:
     maxItems: 1
-    description:  1.2V LVDS Power Supply
+    description: 1.2V LVDS Power Supply
 
   vddio-supply:
     maxItems: 1
@@ -77,16 +77,18 @@ properties:
       - port@1
 
 required:
- - compatible
- - reg
- - vdd-supply
- - vddio-supply
- - stby-gpios
- - reset-gpios
- - ports
+  - compatible
+  - reg
+  - vdd-supply
+  - vddio-supply
+  - stby-gpios
+  - reset-gpios
+  - ports
+
+additionalProperties: false
 
 examples:
- - |
 - |
     #include <dt-bindings/gpio/gpio.h>
 
     /* For single-link LVDS display panel */
@@ -147,7 +149,7 @@ examples:
          };
      };
 
- - |
 - |
     /* For dual-link LVDS display panel */
 
     i2c@78b8000 {
index c60b3bd..b2fcec4 100644 (file)
@@ -13,9 +13,8 @@ properties:
   compatible:
     items:
       - enum:
-        - bananapi,lhr050h41
-        - feixin,k101-im2byl02
-
+          - bananapi,lhr050h41
+          - feixin,k101-im2byl02
       - const: ilitek,ili9881c
 
   backlight: true
index 937323c..51f4232 100644 (file)
@@ -37,6 +37,9 @@ properties:
 
   reset-gpios: true
 
+  'mantix,tp-rstn-gpios':
+    description: second reset line that triggers DSI config load
+
   backlight: true
 
 required:
@@ -63,6 +66,7 @@ examples:
             avee-supply = <&reg_avee>;
             vddi-supply = <&reg_1v8_p>;
             reset-gpios = <&gpio1 29 GPIO_ACTIVE_LOW>;
+            mantix,tp-rstn-gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
             backlight = <&backlight>;
         };
     };
index 9e53472..372679d 100644 (file)
@@ -19,9 +19,12 @@ properties:
     description: The cell is the request line number.
 
   compatible:
-    enum:
-      - allwinner,sun50i-a64-dma
-      - allwinner,sun50i-h6-dma
+    oneOf:
+      - const: allwinner,sun50i-a64-dma
+      - const: allwinner,sun50i-h6-dma
+      - items:
+          - const: allwinner,sun8i-r40-dma
+          - const: allwinner,sun50i-a64-dma
 
   reg:
     maxItems: 1
index 9810619..7449736 100644 (file)
@@ -81,14 +81,14 @@ properties:
   at25,byte-len:
     $ref: /schemas/types.yaml#/definitions/uint32
     description:
-       Total eeprom size in bytes. Deprecated, use "size" property instead.
+      Total eeprom size in bytes. Deprecated, use "size" property instead.
     deprecated: true
 
   at25,addr-mode:
     $ref: /schemas/types.yaml#/definitions/uint32
     description:
-       Addr-mode flags, as defined in include/linux/spi/eeprom.h.
-       Deprecated, use "address-width" property instead.
+      Addr-mode flags, as defined in include/linux/spi/eeprom.h.
+      Deprecated, use "address-width" property instead.
     deprecated: true
 
   at25,page-size:
index 2aaf661..b109911 100644 (file)
@@ -7,6 +7,7 @@ Required properties:
   For Tegra132 must contain "nvidia,tegra132-efuse", "nvidia,tegra124-efuse".
   For Tegra210 must contain "nvidia,tegra210-efuse". For Tegra186 must contain
   "nvidia,tegra186-efuse". For Tegra194 must contain "nvidia,tegra194-efuse".
+  For Tegra234 must contain "nvidia,tegra234-efuse".
   Details:
   nvidia,tegra20-efuse: Tegra20 requires using APB DMA to read the fuse data
        due to a hardware bug. Tegra20 also lacks certain information which is
index e2d2c10..b032471 100644 (file)
@@ -43,8 +43,8 @@ properties:
   gpio-controller: true
 
   gpio-line-names:
-      minItems: 1
-      maxItems: 8
+    minItems: 1
+    maxItems: 8
 
 required:
   - compatible
index 53708fe..eceaa17 100644 (file)
@@ -25,6 +25,7 @@ properties:
               - allwinner,sun4i-a10-mali
               - allwinner,sun7i-a20-mali
               - allwinner,sun8i-h3-mali
+              - allwinner,sun8i-r40-mali
               - allwinner,sun50i-a64-mali
               - rockchip,rk3036-mali
               - rockchip,rk3066-mali
@@ -131,6 +132,7 @@ allOf:
             enum:
               - allwinner,sun4i-a10-mali
               - allwinner,sun7i-a20-mali
+              - allwinner,sun8i-r40-mali
               - allwinner,sun50i-a64-mali
               - allwinner,sun50i-h5-mali
               - amlogic,meson8-mali
diff --git a/Documentation/devicetree/bindings/i2c/google,cros-ec-i2c-tunnel.yaml b/Documentation/devicetree/bindings/i2c/google,cros-ec-i2c-tunnel.yaml
new file mode 100644 (file)
index 0000000..b386e41
--- /dev/null
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+
+$id: http://devicetree.org/schemas/i2c/google,cros-ec-i2c-tunnel.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: I2C bus that tunnels through the ChromeOS EC (cros-ec)
+
+maintainers:
+  - Doug Anderson <dianders@chromium.org>
+  - Benson Leung <bleung@chromium.org>
+  - Enric Balletbo i Serra <enric.balletbo@collabora.com>
+
+description: |
+  On some ChromeOS board designs we've got a connection to the EC
+  (embedded controller) but no direct connection to some devices on the
+  other side of the EC (like a battery and PMIC).  To get access to
+  those devices we need to tunnel our i2c commands through the EC.
+
+  The node for this device should be under a cros-ec node like
+  google,cros-ec-spi or google,cros-ec-i2c.
+
+allOf:
+  - $ref: i2c-controller.yaml#
+
+properties:
+  compatible:
+    const: google,cros-ec-i2c-tunnel
+
+  google,remote-bus:
+    description: The EC bus we'd like to talk to.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+required:
+  - compatible
+  - google,remote-bus
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    spi0 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        cros-ec@0 {
+            compatible = "google,cros-ec-spi";
+            reg = <0>;
+            spi-max-frequency = <5000000>;
+
+            i2c-tunnel {
+                compatible = "google,cros-ec-i2c-tunnel";
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                google,remote-bus = <0>;
+
+                battery: sbs-battery@b {
+                    compatible = "sbs,sbs-battery";
+                    reg = <0xb>;
+                    sbs,poll-retry-count = <1>;
+                };
+            };
+        };
+    };
diff --git a/Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.txt b/Documentation/devicetree/bindings/i2c/i2c-cros-ec-tunnel.txt
deleted file mode 100644 (file)
index 898f030..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-I2C bus that tunnels through the ChromeOS EC (cros-ec)
-======================================================
-On some ChromeOS board designs we've got a connection to the EC (embedded
-controller) but no direct connection to some devices on the other side of
-the EC (like a battery and PMIC).  To get access to those devices we need
-to tunnel our i2c commands through the EC.
-
-The node for this device should be under a cros-ec node like google,cros-ec-spi
-or google,cros-ec-i2c.
-
-
-Required properties:
-- compatible: google,cros-ec-i2c-tunnel
-- google,remote-bus: The EC bus we'd like to talk to.
-
-Optional child nodes:
-- One node per I2C device connected to the tunnelled I2C bus.
-
-
-Example:
-       cros-ec@0 {
-               compatible = "google,cros-ec-spi";
-
-               ...
-
-               i2c-tunnel {
-                       compatible = "google,cros-ec-i2c-tunnel";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-
-                       google,remote-bus = <0>;
-
-                       battery: sbs-battery@b {
-                               compatible = "sbs,sbs-battery";
-                               reg = <0xb>;
-                               sbs,poll-retry-count = <1>;
-                       };
-               };
-       }
index 0e7b4b8..e1e65eb 100644 (file)
@@ -19,11 +19,11 @@ properties:
   compatible:
     oneOf:
       - enum:
-        - ingenic,jz4770-i2c
-        - ingenic,x1000-i2c
+          - ingenic,jz4770-i2c
+          - ingenic,x1000-i2c
       - items:
-        - const: ingenic,jz4780-i2c
-        - const: ingenic,jz4770-i2c
+          - const: ingenic,jz4780-i2c
+          - const: ingenic,jz4770-i2c
 
   reg:
     maxItems: 1
index 6feafb7..930f9e3 100644 (file)
@@ -43,4 +43,5 @@ examples:
         vref-supply = <&adc_vref>;
       };
     };
-...
\ No newline at end of file
+...
+
index d3733ad..8f32800 100644 (file)
@@ -46,7 +46,8 @@ properties:
   spi-max-frequency: true
 
   spi-cpol: true
-  spi-cpha : true
+
+  spi-cpha: true
 
   "#io-channel-cells":
     const: 1
index 5d92b47..4e695b9 100644 (file)
@@ -22,8 +22,8 @@ properties:
   adc-reserved-channels:
     $ref: /schemas/types.yaml#/definitions/uint32
     description:
-       Bitmask of reserved channels, i.e. channels that cannot be
-       used by the OS.
+      Bitmask of reserved channels, i.e. channels that cannot be
+      used by the OS.
 
   clocks:
     maxItems: 1
index 9514c33..52490cb 100644 (file)
@@ -21,7 +21,7 @@ properties:
 
   gpios:
     description:
-       GPIO used for controlling the reset pin
+      GPIO used for controlling the reset pin
     maxItems: 1
 
   spi-max-frequency: true
index 6a176f5..c1772b5 100644 (file)
@@ -28,6 +28,8 @@ required:
   - reg
   - vref-supply
 
+additionalProperties: false
+
 examples:
   - |
     i2c {
diff --git a/Documentation/devicetree/bindings/input/adc-joystick.yaml b/Documentation/devicetree/bindings/input/adc-joystick.yaml
new file mode 100644 (file)
index 0000000..054406b
--- /dev/null
@@ -0,0 +1,121 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2019-2020 Artur Rojek
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/input/adc-joystick.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: ADC attached joystick
+
+maintainers:
+  - Artur Rojek <contact@artur-rojek.eu>
+
+description: >
+  Bindings for joystick devices connected to ADC controllers supporting
+  the Industrial I/O subsystem.
+
+properties:
+  compatible:
+    const: adc-joystick
+
+  io-channels:
+    minItems: 1
+    maxItems: 1024
+    description: >
+      List of phandle and IIO specifier pairs.
+      Each pair defines one ADC channel to which a joystick axis is connected.
+      See Documentation/devicetree/bindings/iio/iio-bindings.txt for details.
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+required:
+  - compatible
+  - io-channels
+  - '#address-cells'
+  - '#size-cells'
+
+additionalProperties: false
+
+patternProperties:
+  "^axis@[0-9a-f]+$":
+    type: object
+    description: >
+      Represents a joystick axis bound to the given ADC channel.
+      For each entry in the io-channels list, one axis subnode with a matching
+      reg property must be specified.
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 1023
+        description: Index of an io-channels list entry bound to this axis.
+
+      linux,code:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: EV_ABS specific event code generated by the axis.
+
+      abs-range:
+        allOf:
+          - $ref: /schemas/types.yaml#/definitions/uint32-array
+          - items:
+              - description: minimum value
+              - description: maximum value
+        description: >
+          Minimum and maximum values produced by the axis.
+          For an ABS_X axis this will be the left-most and right-most
+          inclination of the joystick. If min > max, it is left to userspace to
+          treat the axis as inverted.
+          This property is interpreted as two signed 32 bit values.
+
+      abs-fuzz:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: >
+          Amount of noise in the input value.
+          Omitting this property indicates the axis is precise.
+
+      abs-flat:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: >
+          Axial "deadzone", or area around the center position, where the axis
+          is considered to be at rest.
+          Omitting this property indicates the axis always returns to exactly
+          the center position.
+
+    required:
+      - reg
+      - linux,code
+      - abs-range
+
+    additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/iio/adc/ingenic,adc.h>
+    #include <dt-bindings/input/input.h>
+
+    joystick: adc-joystick {
+      compatible = "adc-joystick";
+      io-channels = <&adc INGENIC_ADC_TOUCH_XP>,
+                    <&adc INGENIC_ADC_TOUCH_YP>;
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      axis@0 {
+              reg = <0>;
+              linux,code = <ABS_X>;
+              abs-range = <3300 0>;
+              abs-fuzz = <4>;
+              abs-flat = <200>;
+      };
+      axis@1 {
+              reg = <1>;
+              linux,code = <ABS_Y>;
+              abs-range = <0 3300>;
+              abs-fuzz = <4>;
+              abs-flat = <200>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/input/cros-ec-keyb.txt b/Documentation/devicetree/bindings/input/cros-ec-keyb.txt
deleted file mode 100644 (file)
index 0f6355c..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-ChromeOS EC Keyboard
-
-Google's ChromeOS EC Keyboard is a simple matrix keyboard implemented on
-a separate EC (Embedded Controller) device. It provides a message for reading
-key scans from the EC. These are then converted into keycodes for processing
-by the kernel.
-
-This binding is based on matrix-keymap.txt and extends/modifies it as follows:
-
-Required properties:
-- compatible: "google,cros-ec-keyb"
-
-Optional properties:
-- google,needs-ghost-filter: True to enable a ghost filter for the matrix
-keyboard. This is recommended if the EC does not have its own logic or
-hardware for this.
-
-
-Example:
-
-cros-ec-keyb {
-       compatible = "google,cros-ec-keyb";
-       keypad,num-rows = <8>;
-       keypad,num-columns = <13>;
-       google,needs-ghost-filter;
-       /*
-        * Keymap entries take the form of 0xRRCCKKKK where
-        * RR=Row CC=Column KKKK=Key Code
-        * The values below are for a US keyboard layout and
-        * are taken from the Linux driver. Note that the
-        * 102ND key is not used for US keyboards.
-        */
-       linux,keymap = <
-               /* CAPSLCK F1         B          F10     */
-               0x0001003a 0x0002003b 0x00030030 0x00040044
-               /* N       =          R_ALT      ESC     */
-               0x00060031 0x0008000d 0x000a0064 0x01010001
-               /* F4      G          F7         H       */
-               0x0102003e 0x01030022 0x01040041 0x01060023
-               /* '       F9         BKSPACE    L_CTRL  */
-               0x01080028 0x01090043 0x010b000e 0x0200001d
-               /* TAB     F3         T          F6      */
-               0x0201000f 0x0202003d 0x02030014 0x02040040
-               /* ]       Y          102ND      [       */
-               0x0205001b 0x02060015 0x02070056 0x0208001a
-               /* F8      GRAVE      F2         5       */
-               0x02090042 0x03010029 0x0302003c 0x03030006
-               /* F5      6          -          \       */
-               0x0304003f 0x03060007 0x0308000c 0x030b002b
-               /* R_CTRL  A          D          F       */
-               0x04000061 0x0401001e 0x04020020 0x04030021
-               /* S       K          J          ;       */
-               0x0404001f 0x04050025 0x04060024 0x04080027
-               /* L       ENTER      Z          C       */
-               0x04090026 0x040b001c 0x0501002c 0x0502002e
-               /* V       X          ,          M       */
-               0x0503002f 0x0504002d 0x05050033 0x05060032
-               /* L_SHIFT /          .          SPACE   */
-               0x0507002a 0x05080035 0x05090034 0x050B0039
-               /* 1       3          4          2       */
-               0x06010002 0x06020004 0x06030005 0x06040003
-               /* 8       7          0          9       */
-               0x06050009 0x06060008 0x0608000b 0x0609000a
-               /* L_ALT   DOWN       RIGHT      Q       */
-               0x060a0038 0x060b006c 0x060c006a 0x07010010
-               /* E       R          W          I       */
-               0x07020012 0x07030013 0x07040011 0x07050017
-               /* U       R_SHIFT    P          O       */
-               0x07060016 0x07070036 0x07080019 0x07090018
-               /* UP      LEFT    */
-               0x070b0067 0x070c0069>;
-};
diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
new file mode 100644 (file)
index 0000000..8e50c14
--- /dev/null
@@ -0,0 +1,92 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+
+$id: http://devicetree.org/schemas/input/google,cros-ec-keyb.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ChromeOS EC Keyboard
+
+maintainers:
+  - Simon Glass <sjg@chromium.org>
+  - Benson Leung <bleung@chromium.org>
+  - Enric Balletbo i Serra <enric.balletbo@collabora.com>
+
+description: |
+  Google's ChromeOS EC Keyboard is a simple matrix keyboard
+  implemented on a separate EC (Embedded Controller) device. It provides
+  a message for reading key scans from the EC. These are then converted
+  into keycodes for processing by the kernel.
+
+allOf:
+  - $ref: "/schemas/input/matrix-keymap.yaml#"
+
+properties:
+  compatible:
+    const: google,cros-ec-keyb
+
+  google,needs-ghost-filter:
+    description:
+      Enable a ghost filter for the matrix keyboard. This is recommended
+      if the EC does not have its own logic or hardware for this.
+    type: boolean
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    cros-ec-keyb {
+        compatible = "google,cros-ec-keyb";
+        keypad,num-rows = <8>;
+        keypad,num-columns = <13>;
+        google,needs-ghost-filter;
+        /*
+         * Keymap entries take the form of 0xRRCCKKKK where
+         * RR=Row CC=Column KKKK=Key Code
+         * The values below are for a US keyboard layout and
+         * are taken from the Linux driver. Note that the
+         * 102ND key is not used for US keyboards.
+         */
+        linux,keymap = <
+            /* CAPSLCK F1         B          F10     */
+            0x0001003a 0x0002003b 0x00030030 0x00040044
+            /* N       =          R_ALT      ESC     */
+            0x00060031 0x0008000d 0x000a0064 0x01010001
+            /* F4      G          F7         H       */
+            0x0102003e 0x01030022 0x01040041 0x01060023
+            /* '       F9         BKSPACE    L_CTRL  */
+            0x01080028 0x01090043 0x010b000e 0x0200001d
+            /* TAB     F3         T          F6      */
+            0x0201000f 0x0202003d 0x02030014 0x02040040
+            /* ]       Y          102ND      [       */
+            0x0205001b 0x02060015 0x02070056 0x0208001a
+            /* F8      GRAVE      F2         5       */
+            0x02090042 0x03010029 0x0302003c 0x03030006
+            /* F5      6          -          \       */
+            0x0304003f 0x03060007 0x0308000c 0x030b002b
+            /* R_CTRL  A          D          F       */
+            0x04000061 0x0401001e 0x04020020 0x04030021
+            /* S       K          J          ;       */
+            0x0404001f 0x04050025 0x04060024 0x04080027
+            /* L       ENTER      Z          C       */
+            0x04090026 0x040b001c 0x0501002c 0x0502002e
+            /* V       X          ,          M       */
+            0x0503002f 0x0504002d 0x05050033 0x05060032
+            /* L_SHIFT /          .          SPACE   */
+            0x0507002a 0x05080035 0x05090034 0x050B0039
+            /* 1       3          4          2       */
+            0x06010002 0x06020004 0x06030005 0x06040003
+            /* 8       7          0          9       */
+            0x06050009 0x06060008 0x0608000b 0x0609000a
+            /* L_ALT   DOWN       RIGHT      Q       */
+            0x060a0038 0x060b006c 0x060c006a 0x07010010
+            /* E       R          W          I       */
+            0x07020012 0x07030013 0x07040011 0x07050017
+            /* U       R_SHIFT    P          O       */
+            0x07060016 0x07070036 0x07080019 0x07090018
+            /* UP      LEFT    */
+            0x070b0067 0x070c0069>;
+    };
diff --git a/Documentation/devicetree/bindings/input/touchscreen/zinitix.txt b/Documentation/devicetree/bindings/input/touchscreen/zinitix.txt
new file mode 100644 (file)
index 0000000..446efb9
--- /dev/null
@@ -0,0 +1,40 @@
+Device tree bindings for Zinitx BT541 touchscreen controller
+
+Required properties:
+
+ - compatible          : Should be "zinitix,bt541"
+ - reg                 : I2C address of the chip. Should be 0x20
+ - interrupts          : Interrupt to which the chip is connected
+
+Optional properties:
+
+ - vdd-supply          : Analog power supply regulator on VCCA pin
+ - vddo-supply         : Digital power supply regulator on VDD pin
+ - zinitix,mode                : Mode of reporting touch points. Some modes may not work
+                         with a particular ts firmware for unknown reasons. Available
+                         modes are 1 and 2. Mode 2 is the default and preferred.
+
+The touchscreen-* properties are documented in touchscreen.txt in this
+directory.
+
+Example:
+
+       i2c@00000000 {
+               /* ... */
+
+               bt541@20 {
+                       compatible = "zinitix,bt541";
+                       reg = <0x20>;
+                       interrupt-parent = <&msmgpio>;
+                       interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&tsp_default>;
+                       vdd-supply = <&reg_vdd_tsp>;
+                       vddo-supply = <&pm8916_l6>;
+                       touchscreen-size-x = <540>;
+                       touchscreen-size-y = <960>;
+                       zinitix,mode = <2>;
+               };
+
+               /* ... */
+       };
index 7cd6b8b..8acca0a 100644 (file)
@@ -29,11 +29,14 @@ properties:
       - items:
           - const: allwinner,sun8i-a83t-r-intc
           - const: allwinner,sun6i-a31-r-intc
-      - const: allwinner,sun9i-a80-sc-nmi
+      - const: allwinner,sun9i-a80-nmi
       - items:
           - const: allwinner,sun50i-a64-r-intc
           - const: allwinner,sun6i-a31-r-intc
       - items:
+          - const: allwinner,sun50i-a100-nmi
+          - const: allwinner,sun9i-a80-nmi
+      - items:
           - const: allwinner,sun50i-h6-r-intc
           - const: allwinner,sun6i-a31-r-intc
 
index bbf79d1..1c4c009 100644 (file)
@@ -94,12 +94,12 @@ properties:
               instances.
 
 required:
- - compatible
- - reg
- - interrupts
- - interrupt-names
- - interrupt-controller
- - "#interrupt-cells"
 - compatible
 - reg
 - interrupts
 - interrupt-names
 - interrupt-controller
 - "#interrupt-cells"
 
 additionalProperties: false
 
index c7cd056..b5af120 100644 (file)
@@ -32,6 +32,11 @@ description: |
                        | | vint  | bit  |  | 0 |.....|63| vintx  |
                        | +--------------+  +------------+        |
                        |                                         |
+                       |      Unmap                              |
+                       | +--------------+                        |
+  Unmapped events ---->| |   umapidx    |-------------------------> Globalevents
+                       | +--------------+                        |
+                       |                                         |
                        +-----------------------------------------+
 
   Configuration of these Intmap registers that maps global events to vint is
@@ -70,6 +75,11 @@ properties:
         - description: |
             "limit" specifies the limit for translation
 
+  ti,unmapped-event-sources:
+    $ref: /schemas/types.yaml#definitions/phandle-array
+    description:
+      Array of phandles to DMA controllers where the unmapped events originate.
+
 required:
   - compatible
   - reg
@@ -79,6 +89,8 @@ required:
   - ti,sci-dev-id
   - ti,interrupt-ranges
 
+unevaluatedProperties: false
+
 examples:
   - |
     bus {
index cff6a95..e12aee4 100644 (file)
@@ -88,6 +88,8 @@ required:
   - ti,sci-dev-id
   - ti,interrupt-ranges
 
+unevaluatedProperties: false
+
 examples:
   - |
     main_gpio_intr: interrupt-controller0 {
index 4e7e95e..bc817f7 100644 (file)
@@ -32,3 +32,5 @@ properties:
       that a LED can be made so bright that it gets damaged or causes damage
       due to restrictions in a specific system, such as mounting conditions.
     $ref: /schemas/types.yaml#definitions/uint32
+
+additionalProperties: true
index 08b6700..f1211e7 100644 (file)
@@ -43,7 +43,7 @@ properties:
       LED_COLOR_ID available, add a new one.
     $ref: /schemas/types.yaml#definitions/uint32
     minimum: 0
-    maximum: 8
+    maximum: 9
 
   function-enumerator:
     description:
index b1a53f0..37445c6 100644 (file)
@@ -16,7 +16,7 @@ description: |
   modules. This is achieved by adding multi-led nodes layer to the
   monochrome LED bindings.
   The nodes and properties defined in this document are unique to the multicolor
-  LED class.  Common LED nodes and properties are inherited from the common.txt
+  LED class.  Common LED nodes and properties are inherited from the common.yaml
   within this documentation directory.
 
 patternProperties:
@@ -25,10 +25,11 @@ patternProperties:
     description: Represents the LEDs that are to be grouped.
     properties:
       color:
-        const: 8  # LED_COLOR_ID_MULTI
         description: |
-          For multicolor LED support this property should be defined as
-          LED_COLOR_ID_MULTI which can be found in include/linux/leds/common.h.
+          For multicolor LED support this property should be defined as either
+          LED_COLOR_ID_RGB or LED_COLOR_ID_MULTI which can be found in
+          include/linux/leds/common.h.
+        enum: [ 8, 9 ]
 
     $ref: "common.yaml#"
 
index 947542a..c192b5f 100644 (file)
@@ -46,6 +46,12 @@ properties:
   vled-supply:
     description: LED supply.
 
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
 patternProperties:
   '^multi-led@[0-9a-f]$':
     type: object
@@ -69,6 +75,8 @@ required:
   - compatible
   - reg
 
+additionalProperties: false
+
 examples:
   - |
    #include <dt-bindings/gpio/gpio.h>
index cf48cd8..7771eca 100644 (file)
@@ -47,7 +47,7 @@ Example:
                interrupts = <GIC_SPI 135 IRQ_TYPE_LEVEL_LOW>;
                clocks = <&infracfg CLK_INFRA_GCE>;
                clock-names = "gce";
-               #mbox-cells = <3>;
+               #mbox-cells = <2>;
        };
 
 Example for a client device:
index 8f810fc..ffd09b6 100644 (file)
@@ -16,6 +16,7 @@ maintainers:
 properties:
   compatible:
     enum:
+      - qcom,ipq6018-apcs-apps-global
       - qcom,ipq8074-apcs-apps-global
       - qcom,msm8916-apcs-kpss-global
       - qcom,msm8994-apcs-kpss-global
index 7838804..5fa19d4 100644 (file)
@@ -18,10 +18,13 @@ properties:
     oneOf:
       - const: allwinner,sun4i-a10-ir
       - const: allwinner,sun5i-a13-ir
+      - const: allwinner,sun6i-a31-ir
       - items:
           - const: allwinner,sun8i-a83t-ir
           - const: allwinner,sun6i-a31-ir
-      - const: allwinner,sun6i-a31-ir
+      - items:
+          - const: allwinner,sun8i-r40-ir
+          - const: allwinner,sun6i-a31-ir
       - items:
           - const: allwinner,sun50i-a64-ir
           - const: allwinner,sun6i-a31-ir
index b645736..dbafffe 100644 (file)
@@ -5,7 +5,7 @@ The hardware block diagram please check bindings/iommu/mediatek,iommu.txt
 Mediatek SMI have two generations of HW architecture, here is the list
 which generation the SoCs use:
 generation 1: mt2701 and mt7623.
-generation 2: mt2712, mt6779, mt8173 and mt8183.
+generation 2: mt2712, mt6779, mt8167, mt8173 and mt8183.
 
 There's slight differences between the two SMI, for generation 2, the
 register which control the iommu port is at each larb's register base. But
@@ -20,6 +20,7 @@ Required properties:
        "mediatek,mt2712-smi-common"
        "mediatek,mt6779-smi-common"
        "mediatek,mt7623-smi-common", "mediatek,mt2701-smi-common"
+       "mediatek,mt8167-smi-common"
        "mediatek,mt8173-smi-common"
        "mediatek,mt8183-smi-common"
 - reg : the register and size of the SMI block.
index 8f19dfe..0c5de12 100644 (file)
@@ -8,6 +8,7 @@ Required properties:
                "mediatek,mt2712-smi-larb"
                "mediatek,mt6779-smi-larb"
                "mediatek,mt7623-smi-larb", "mediatek,mt2701-smi-larb"
+               "mediatek,mt8167-smi-larb"
                "mediatek,mt8173-smi-larb"
                "mediatek,mt8183-smi-larb"
 - reg : the register and size of this local arbiter.
@@ -22,7 +23,7 @@ Required properties:
   - "gals": the clock for GALS(Global Async Local Sync).
   Here is the list which has this GALS: mt8183.
 
-Required property for mt2701, mt2712, mt6779 and mt7623:
+Required property for mt2701, mt2712, mt6779, mt7623 and mt8167:
 - mediatek,larb-id :the hardware id of this larb.
 
 Example:
index 074243c..08af356 100644 (file)
@@ -17,7 +17,7 @@ properties:
   compatible:
     items:
       - enum:
-        - dell,wyse-ariel-ec  # Dell Wyse Ariel board (3020)
+          - dell,wyse-ariel-ec  # Dell Wyse Ariel board (3020)
       - const: ene,kb3930
   reg:
     maxItems: 1
index f49c0d5..76bf16e 100644 (file)
@@ -59,6 +59,14 @@ properties:
       whether this nvram is present or not.
     type: boolean
 
+  mtk,rpmsg-name:
+    description:
+      Must be defined if the cros-ec is a rpmsg device for a Mediatek
+      ARM Cortex M4 Co-processor. Contains the name pf the rpmsg
+      device. Used to match the subnode to the rpmsg device announced by
+      the SCP.
+    $ref: "/schemas/types.yaml#/definitions/string"
+
   spi-max-frequency:
     description: Maximum SPI frequency of the device in Hz.
 
@@ -71,6 +79,54 @@ properties:
   wakeup-source:
     description: Button can wake-up the system.
 
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+  typec:
+    $ref: "/schemas/chrome/google,cros-ec-typec.yaml#"
+
+  ec-pwm:
+    $ref: "/schemas/pwm/google,cros-ec-pwm.yaml#"
+
+  keyboard-controller:
+    $ref: "/schemas/input/google,cros-ec-keyb.yaml#"
+
+  codecs:
+    type: object
+    additionalProperties: false
+
+    properties:
+      '#address-cells':
+        const: 2
+
+      '#size-cells':
+        const: 1
+
+    patternProperties:
+      "^ec-codec@[a-f0-9]+$":
+        type: object
+        $ref: "/schemas/sound/google,cros-ec-codec.yaml#"
+
+    required:
+      - "#address-cells"
+      - "#size-cells"
+
+patternProperties:
+  "^i2c-tunnel[0-9]*$":
+    type: object
+    $ref: "/schemas/i2c/google,cros-ec-i2c-tunnel.yaml#"
+
+  "^regulator@[0-9]+$":
+    type: object
+    $ref: "/schemas/regulator/google,cros-ec-regulator.yaml#"
+
+  "^extcon[0-9]*$":
+    type: object
+    $ref: "/schemas/extcon/extcon-usbc-cros-ec.yaml#"
+
 required:
   - compatible
 
index dc21b46..ee00d41 100644 (file)
@@ -52,4 +52,7 @@ properties:
         items:
           - const: yna,cu2000-neo
           - const: ingenic,x2000e
+
+additionalProperties: true
+
 ...
index d25e80a..9fee670 100644 (file)
@@ -36,4 +36,7 @@ properties:
       - description: Virtual Loongson64 Quad Core + VirtIO
         items:
           - const: loongson,loongson64v-4core-virtio
+
+additionalProperties: true
+
 ...
index 892ba43..43d777e 100644 (file)
@@ -1,11 +1,13 @@
-NVIDIA Tegra186 MISC register block
+NVIDIA Tegra186 (and later) MISC register block
 
-The MISC register block found on Tegra186 SoCs contains registers that can be
-used to identify a given chip and various strapping options.
+The MISC register block found on Tegra186 and later SoCs contains registers
+that can be used to identify a given chip and various strapping options.
 
 Required properties:
 - compatible: Must be:
   - Tegra186: "nvidia,tegra186-misc"
+  - Tegra194: "nvidia,tegra194-misc"
+  - Tegra234: "nvidia,tegra234-misc"
 - reg: Should contain 2 entries: The first entry gives the physical address
        and length of the register region which contains revision and debug
        features. The second entry specifies the physical address and length
index 4556359..83f6a25 100644 (file)
@@ -1,10 +1,13 @@
-NVIDIA Tegra20/Tegra30/Tegr114/Tegra124 apbmisc block
+NVIDIA Tegra APBMISC block
 
 Required properties:
-- compatible : For Tegra20, must be "nvidia,tegra20-apbmisc".  For Tegra30,
-  must be "nvidia,tegra30-apbmisc".  Otherwise, must contain
-  "nvidia,<chip>-apbmisc", plus one of the above, where <chip> is tegra114,
-  tegra124, tegra132.
+- compatible: Must be:
+  - Tegra20: "nvidia,tegra20-apbmisc"
+  - Tegra30: "nvidia,tegra30-apbmisc", "nvidia,tegra20-apbmisc"
+  - Tegra114: "nvidia,tegra114-apbmisc", "nvidia,tegra20-apbmisc"
+  - Tegra124: "nvidia,tegra124-apbmisc", "nvidia,tegra20-apbmisc"
+  - Tegra132: "nvidia,tegra124-apbmisc", "nvidia,tegra20-apbmisc"
+  - Tegra210: "nvidia,tegra210-apbmisc", "nvidia,tegra20-apbmisc"
 - reg: Should contain 2 entries: the first entry gives the physical address
        and length of the registers which contain revision and debug features.
        The second entry gives the physical address and length of the
index 58fe9d0..0753289 100644 (file)
@@ -32,11 +32,11 @@ allOf:
         clock-output-names:
           oneOf:
             - items:
-              - const: clk_out_sd0
-              - const: clk_in_sd0
+                - const: clk_out_sd0
+                - const: clk_in_sd0
             - items:
-              - const: clk_out_sd1
-              - const: clk_in_sd1
+                - const: clk_out_sd1
+                - const: clk_in_sd1
 
 properties:
   compatible:
index 5588329..69ff065 100644 (file)
@@ -46,6 +46,8 @@ required:
   - clocks
   - clock-names
 
+unevaluatedProperties: false
+
 examples:
   - |
     #include <dt-bindings/interrupt-controller/arm-gic.h>
index ac79f3a..1ae9454 100644 (file)
@@ -3,7 +3,7 @@
 %YAML 1.2
 ---
 $id: "http://devicetree.org/schemas/mmc/sdhci-am654.yaml#"
-$schema : "http://devicetree.org/meta-schemas/core.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
 
 title: TI AM654 MMC Controller
 
@@ -163,13 +163,12 @@ properties:
   ti,driver-strength-ohm:
     description: DLL drive strength in ohms
     $ref: "/schemas/types.yaml#/definitions/uint32"
-    oneOf:
-      - enum:
-        - 33
-        - 40
-        - 50
-        - 66
-        - 100
+    enum:
+      - 33
+      - 40
+      - 50
+      - 66
+      - 100
 
   ti,strobe-sel:
     description: strobe select delay for HS400 speed mode.
@@ -187,6 +186,8 @@ required:
   - clock-names
   - ti,otap-del-sel-legacy
 
+unevaluatedProperties: false
+
 examples:
   - |
     #include <dt-bindings/interrupt-controller/irq.h>
diff --git a/Documentation/devicetree/bindings/net/can/can-controller.yaml b/Documentation/devicetree/bindings/net/can/can-controller.yaml
new file mode 100644 (file)
index 0000000..9cf2ae0
--- /dev/null
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/can-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: CAN Controller Generic Binding
+
+maintainers:
+  - Marc Kleine-Budde <mkl@pengutronix.de>
+
+properties:
+  $nodename:
+    pattern: "^can(@.*)?$"
+
+additionalProperties: true
+
+...
diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
new file mode 100644 (file)
index 0000000..43df15b
--- /dev/null
@@ -0,0 +1,135 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/fsl,flexcan.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title:
+  Flexcan CAN controller on Freescale's ARM and PowerPC system-on-a-chip (SOC).
+
+maintainers:
+  - Marc Kleine-Budde <mkl@pengutronix.de>
+
+allOf:
+  - $ref: can-controller.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - fsl,imx8qm-flexcan
+          - fsl,imx8mp-flexcan
+          - fsl,imx6q-flexcan
+          - fsl,imx53-flexcan
+          - fsl,imx35-flexcan
+          - fsl,imx28-flexcan
+          - fsl,imx25-flexcan
+          - fsl,p1010-flexcan
+          - fsl,vf610-flexcan
+          - fsl,ls1021ar2-flexcan
+          - fsl,lx2160ar1-flexcan
+      - items:
+          - enum:
+              - fsl,imx7d-flexcan
+              - fsl,imx6ul-flexcan
+              - fsl,imx6sx-flexcan
+          - const: fsl,imx6q-flexcan
+      - items:
+          - enum:
+              - fsl,ls1028ar1-flexcan
+          - const: fsl,lx2160ar1-flexcan
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: ipg
+      - const: per
+
+  clock-frequency:
+    description: |
+      The oscillator frequency driving the flexcan device, filled in by the
+      boot loader. This property should only be used the used operating system
+      doesn't support the clocks and clock-names property.
+
+  xceiver-supply:
+    description: Regulator that powers the CAN transceiver.
+
+  big-endian:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: |
+      This means the registers of FlexCAN controller are big endian. This is
+      optional property.i.e. if this property is not present in device tree
+      node then controller is assumed to be little endian. If this property is
+      present then controller is assumed to be big endian.
+
+  fsl,stop-mode:
+    description: |
+      Register bits of stop mode control.
+
+      The format should be as follows:
+      <gpr req_gpr req_bit>
+      gpr is the phandle to general purpose register node.
+      req_gpr is the gpr register offset of CAN stop request.
+      req_bit is the bit offset of CAN stop request.
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      - description: The 'gpr' is the phandle to general purpose register node.
+      - description: The 'req_gpr' is the gpr register offset of CAN stop request.
+        maximum: 0xff
+      - description: The 'req_bit' is the bit offset of CAN stop request.
+        maximum: 0x1f
+
+  fsl,clk-source:
+    description: |
+      Select the clock source to the CAN Protocol Engine (PE). It's SoC
+      implementation dependent. Refer to RM for detailed definition. If this
+      property is not set in device tree node then driver selects clock source 1
+      by default.
+      0: clock source 0 (oscillator clock)
+      1: clock source 1 (peripheral clock)
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 1
+    minimum: 0
+    maximum: 1
+
+  wakeup-source:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Enable CAN remote wakeup.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    can@1c000 {
+        compatible = "fsl,p1010-flexcan";
+        reg = <0x1c000 0x1000>;
+        interrupts = <48 0x2>;
+        interrupt-parent = <&mpic>;
+        clock-frequency = <200000000>;
+        fsl,clk-source = <0>;
+    };
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    can@2090000 {
+        compatible = "fsl,imx6q-flexcan";
+        reg = <0x02090000 0x4000>;
+        interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clks 1>, <&clks 2>;
+        clock-names = "ipg", "per";
+        fsl,stop-mode = <&gpr 0x34 28>;
+    };
diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
deleted file mode 100644 (file)
index e10b6eb..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-Flexcan CAN controller on Freescale's ARM and PowerPC system-on-a-chip (SOC).
-
-Required properties:
-
-- compatible : Should be "fsl,<processor>-flexcan"
-
-  where <processor> is imx8qm, imx6q, imx28, imx53, imx35, imx25, p1010,
-  vf610, ls1021ar2, lx2160ar1, ls1028ar1.
-
-  The ls1028ar1 must be followed by lx2160ar1, e.g.
-   - "fsl,ls1028ar1-flexcan", "fsl,lx2160ar1-flexcan"
-
-  An implementation should also claim any of the following compatibles
-  that it is fully backwards compatible with:
-
-  - fsl,p1010-flexcan
-
-- reg : Offset and length of the register set for this device
-- interrupts : Interrupt tuple for this device
-
-Optional properties:
-
-- clock-frequency : The oscillator frequency driving the flexcan device
-
-- xceiver-supply: Regulator that powers the CAN transceiver
-
-- big-endian: This means the registers of FlexCAN controller are big endian.
-              This is optional property.i.e. if this property is not present in
-              device tree node then controller is assumed to be little endian.
-              if this property is present then controller is assumed to be big
-              endian.
-
-- fsl,stop-mode: register bits of stop mode control, the format is
-                <&gpr req_gpr req_bit>.
-                gpr is the phandle to general purpose register node.
-                req_gpr is the gpr register offset of CAN stop request.
-                req_bit is the bit offset of CAN stop request.
-
-- fsl,clk-source: Select the clock source to the CAN Protocol Engine (PE).
-                 It's SoC Implementation dependent. Refer to RM for detailed
-                 definition. If this property is not set in device tree node
-                 then driver selects clock source 1 by default.
-                 0: clock source 0 (oscillator clock)
-                 1: clock source 1 (peripheral clock)
-
-- wakeup-source: enable CAN remote wakeup
-
-Example:
-
-       can@1c000 {
-               compatible = "fsl,p1010-flexcan";
-               reg = <0x1c000 0x1000>;
-               interrupts = <48 0x2>;
-               interrupt-parent = <&mpic>;
-               clock-frequency = <200000000>; // filled in by bootloader
-               fsl,clk-source = <0>; // select clock source 0 for PE
-       };
diff --git a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
new file mode 100644 (file)
index 0000000..5592f58
--- /dev/null
@@ -0,0 +1,127 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/dsa/hirschmann,hellcreek.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Hirschmann Hellcreek TSN Switch Device Tree Bindings
+
+allOf:
+  - $ref: dsa.yaml#
+
+maintainers:
+  - Andrew Lunn <andrew@lunn.ch>
+  - Florian Fainelli <f.fainelli@gmail.com>
+  - Vivien Didelot <vivien.didelot@gmail.com>
+  - Kurt Kanzenbach <kurt@linutronix.de>
+
+description:
+  The Hellcreek TSN Switch IP is a 802.1Q Ethernet compliant switch. It supports
+  the Precision Time Protocol, Hardware Timestamping as well the Time Aware
+  Shaper.
+
+properties:
+  compatible:
+    items:
+      - const: hirschmann,hellcreek-de1soc-r1
+
+  reg:
+    description:
+      The physical base address and size of TSN and PTP memory base
+    minItems: 2
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: tsn
+      - const: ptp
+
+  leds:
+    type: object
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^led@[01]$":
+        type: object
+        description: Hellcreek leds
+        $ref: ../../leds/common.yaml#
+
+        properties:
+          reg:
+            items:
+              - enum: [0, 1]
+            description: Led number
+
+          label: true
+
+          default-state: true
+
+        required:
+          - reg
+
+        additionalProperties: false
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - ethernet-ports
+  - leds
+
+unevaluatedProperties: false
+
+examples:
+  - |
+        switch0: switch@ff240000 {
+            compatible = "hirschmann,hellcreek-de1soc-r1";
+            reg = <0xff240000 0x1000>,
+                  <0xff250000 0x1000>;
+            reg-names = "tsn", "ptp";
+            dsa,member = <0 0>;
+
+            ethernet-ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                port@0 {
+                    reg = <0>;
+                    label = "cpu";
+                    ethernet = <&gmac0>;
+                };
+
+                port@2 {
+                    reg = <2>;
+                    label = "lan0";
+                    phy-handle = <&phy1>;
+                };
+
+                port@3 {
+                    reg = <3>;
+                    label = "lan1";
+                    phy-handle = <&phy2>;
+                };
+            };
+
+            leds {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                led@0 {
+                    reg = <0>;
+                    label = "sync_good";
+                    default-state = "on";
+                };
+
+                led@1 {
+                    reg = <1>;
+                    label = "is_gm";
+                    default-state = "off";
+                };
+            };
+        };
index f878c11..2923402 100644 (file)
@@ -15,6 +15,7 @@ Required properties:
 - interrupts: Should contain ethernet controller interrupt
 
 Optional properties:
+- phy-handle: See ethernet.txt file in the same directory.
 - phy-mode: See ethernet.txt file in the same directory. If the property is
   absent, "rgmii" is assumed. Supported values are "rgmii*" and "rmii" for
   aspeed parts. Other (unknown) parts will accept any value.
@@ -32,6 +33,9 @@ Optional properties:
       - "MACCLK": The MAC IP clock
       - "RCLK": Clock gate for the RMII RCLK
 
+Optional subnodes:
+- mdio: See mdio.txt file in the same directory.
+
 Example:
 
        mac0: ethernet@1e660000 {
@@ -40,3 +44,24 @@ Example:
                interrupts = <2>;
                use-ncsi;
        };
+
+Example with phy-handle:
+
+       mac1: ethernet@1e680000 {
+               compatible = "aspeed,ast2500-mac", "faraday,ftgmac100";
+               reg = <0x1e680000 0x180>;
+               interrupts = <2>;
+
+               phy-handle = <&phy>;
+               phy-mode = "rgmii";
+
+               mdio {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       phy: ethernet-phy@1 {
+                               compatible = "ethernet-phy-ieee802.3-c22";
+                               reg = <1>;
+                       };
+               };
+       };
index fa3ebba..c1948ce 100644 (file)
@@ -46,6 +46,8 @@ required:
   - clocks
   - clock-names
 
+unevaluatedProperties: false
+
 examples:
 # FIXME: Remove defines and include the correct header file
 # once it is available in mainline.
index 5591353..75e8712 100644 (file)
@@ -65,6 +65,8 @@ properties:
 required:
   - reg
 
+unevaluatedProperties: false
+
 examples:
   - |
     mdio0 {
index 56ed481..72ba628 100644 (file)
@@ -2,7 +2,7 @@ On-Chip OTP Memory for Freescale Vybrid
 
 Required Properties:
   compatible:
-  - "fsl,vf610-ocotp" for VF5xx/VF6xx
+  - "fsl,vf610-ocotp", "syscon" for VF5xx/VF6xx
   #address-cells : Should be 1
   #size-cells : Should be 1
   reg : Address and length of OTP controller and fuse map registers
@@ -11,7 +11,7 @@ Required Properties:
 Example for Vybrid VF5xx/VF6xx:
 
        ocotp: ocotp@400a5000 {
-               compatible = "fsl,vf610-ocotp";
+               compatible = "fsl,vf610-ocotp", "syscon";
                #address-cells = <1>;
                #size-cells = <1>;
                reg = <0x400a5000 0xCF0>;
index f4292d2..d6cf8a5 100644 (file)
@@ -29,16 +29,16 @@ properties:
   reg-names:
     oneOf:
       - items:
-        - const: dbi
-        - const: dbi2
-        - const: link
-        - const: addr_space
+          - const: dbi
+          - const: dbi2
+          - const: link
+          - const: addr_space
       - items:
-        - const: dbi
-        - const: dbi2
-        - const: link
-        - const: addr_space
-        - const: atu
+          - const: dbi
+          - const: dbi2
+          - const: link
+          - const: addr_space
+          - const: atu
 
   clocks:
     maxItems: 2
index bab2ff4..3475634 100644 (file)
@@ -31,10 +31,10 @@ properties:
   clock-names:
     oneOf:
       - items:          # for PXs2
-        - const: link
+          - const: link
       - items:          # for others
-        - const: link
-        - const: phy
+          - const: link
+          - const: phy
 
   resets:
     maxItems: 2
index 15207ca..83d5d0a 100644 (file)
@@ -7,23 +7,23 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: OMAP USB2 PHY
 
 maintainers:
- - Kishon Vijay Abraham I <kishon@ti.com>
- - Roger Quadros <rogerq@ti.com>
 - Kishon Vijay Abraham I <kishon@ti.com>
 - Roger Quadros <rogerq@ti.com>
 
 properties:
   compatible:
     oneOf:
       - items:
-        - enum:
-          - ti,dra7x-usb2
-          - ti,dra7x-usb2-phy2
-          - ti,am654-usb2
-        - enum:
-          - ti,omap-usb2
+          - enum:
+              - ti,dra7x-usb2
+              - ti,dra7x-usb2-phy2
+              - ti,am654-usb2
+          - enum:
+              - ti,omap-usb2
       - items:
-        - const: ti,am437x-usb2
+          - const: ti,am437x-usb2
       - items:
-        - const: ti,omap-usb2
+          - const: ti,omap-usb2
 
   reg:
     maxItems: 1
@@ -62,6 +62,8 @@ required:
   - clocks
   - clock-names
 
+additionalProperties: false
+
 examples:
   - |
     usb0_phy: phy@4100000 {
index 33391d3..ccdd9e3 100644 (file)
@@ -76,22 +76,22 @@ patternProperties:
             items:
               oneOf:
                 - enum: [lcd0_d18_mfp, rmii_crs_dv_mfp, rmii_txd0_mfp,
-                    rmii_txd1_mfp, rmii_txen_mfp, rmii_rxen_mfp, rmii_rxd1_mfp,
-                    rmii_rxd0_mfp, rmii_ref_clk_mfp, i2s_d0_mfp, i2s_pcm1_mfp,
-                    i2s0_pcm0_mfp, i2s1_pcm0_mfp, i2s_d1_mfp, ks_in2_mfp,
-                    ks_in1_mfp, ks_in0_mfp, ks_in3_mfp, ks_out0_mfp,
-                    ks_out1_mfp, ks_out2_mfp, lvds_o_pn_mfp, dsi_dn0_mfp,
-                    dsi_dp2_mfp, lcd0_d17_mfp, dsi_dp3_mfp, dsi_dn3_mfp,
-                    dsi_dp0_mfp, lvds_ee_pn_mfp, spi0_i2c_pcm_mfp,
-                    spi0_i2s_pcm_mfp, dsi_dnp1_cp_mfp, lvds_e_pn_mfp,
-                    dsi_dn2_mfp, uart2_rtsb_mfp, uart2_ctsb_mfp, uart3_rtsb_mfp,
-                    uart3_ctsb_mfp, sd0_d0_mfp, sd0_d1_mfp, sd0_d2_d3_mfp,
-                    sd1_d0_d3_mfp, sd0_cmd_mfp, sd0_clk_mfp, sd1_cmd_mfp,
-                    uart0_rx_mfp, clko_25m_mfp, csi_cn_cp_mfp, sens0_ckout_mfp,
-                    uart0_tx_mfp, i2c0_mfp, csi_dn_dp_mfp, sen0_pclk_mfp,
-                    pcm1_in_mfp, pcm1_clk_mfp, pcm1_sync_mfp, pcm1_out_mfp,
-                    dnand_data_wr_mfp, dnand_acle_ce0_mfp, nand_ceb2_mfp,
-                    nand_ceb3_mfp]
+                         rmii_txd1_mfp, rmii_txen_mfp, rmii_rxen_mfp, rmii_rxd1_mfp,
+                         rmii_rxd0_mfp, rmii_ref_clk_mfp, i2s_d0_mfp, i2s_pcm1_mfp,
+                         i2s0_pcm0_mfp, i2s1_pcm0_mfp, i2s_d1_mfp, ks_in2_mfp,
+                         ks_in1_mfp, ks_in0_mfp, ks_in3_mfp, ks_out0_mfp,
+                         ks_out1_mfp, ks_out2_mfp, lvds_o_pn_mfp, dsi_dn0_mfp,
+                         dsi_dp2_mfp, lcd0_d17_mfp, dsi_dp3_mfp, dsi_dn3_mfp,
+                         dsi_dp0_mfp, lvds_ee_pn_mfp, spi0_i2c_pcm_mfp,
+                         spi0_i2s_pcm_mfp, dsi_dnp1_cp_mfp, lvds_e_pn_mfp,
+                         dsi_dn2_mfp, uart2_rtsb_mfp, uart2_ctsb_mfp, uart3_rtsb_mfp,
+                         uart3_ctsb_mfp, sd0_d0_mfp, sd0_d1_mfp, sd0_d2_d3_mfp,
+                         sd1_d0_d3_mfp, sd0_cmd_mfp, sd0_clk_mfp, sd1_cmd_mfp,
+                         uart0_rx_mfp, clko_25m_mfp, csi_cn_cp_mfp, sens0_ckout_mfp,
+                         uart0_tx_mfp, i2c0_mfp, csi_dn_dp_mfp, sen0_pclk_mfp,
+                         pcm1_in_mfp, pcm1_clk_mfp, pcm1_sync_mfp, pcm1_out_mfp,
+                         dnand_data_wr_mfp, dnand_acle_ce0_mfp, nand_ceb2_mfp,
+                         nand_ceb3_mfp]
             minItems: 1
             maxItems: 32
 
@@ -100,10 +100,10 @@ patternProperties:
               Specify the alternative function to be configured for the
               given gpio pin groups.
             enum: [nor, eth_rmii, eth_smii, spi0, spi1, spi2, spi3, sens0,
-              sens1, uart0, uart1, uart2, uart3, uart4, uart5, uart6, i2s0,
-              i2s1, pcm1, pcm0, ks, jtag, pwm0, pwm1, pwm2, pwm3, pwm4, pwm5,
-              p0, sd0, sd1, sd2, i2c0, i2c1, i2c3, dsi, lvds, usb30, clko_25m,
-              mipi_csi, nand, spdif, ts, lcd0]
+                   sens1, uart0, uart1, uart2, uart3, uart4, uart5, uart6, i2s0,
+                   i2s1, pcm1, pcm0, ks, jtag, pwm0, pwm1, pwm2, pwm3, pwm4, pwm5,
+                   p0, sd0, sd1, sd2, i2c0, i2c1, i2c3, dsi, lvds, usb30, clko_25m,
+                   mipi_csi, nand, spdif, ts, lcd0]
 
         required:
           - groups
@@ -126,14 +126,14 @@ patternProperties:
             items:
               oneOf:
                 - enum: [sirq_drv, rmii_txd01_txen_drv, rmii_rxer_drv,
-                    rmii_crs_drv, rmii_rxd10_drv, rmii_ref_clk_drv,
-                    smi_mdc_mdio_drv, i2s_d0_drv, i2s_bclk0_drv, i2s3_drv,
-                    i2s13_drv, pcm1_drv, ks_in_drv, ks_out_drv, lvds_all_drv,
-                    lcd_dsi_drv, dsi_drv, sd0_d0_d3_drv, sd1_d0_d3_drv,
-                    sd0_cmd_drv, sd0_clk_drv, sd1_cmd_drv, sd1_clk_drv,
-                    spi0_all_drv, uart0_rx_drv, uart0_tx_drv, uart2_all_drv,
-                    i2c0_all_drv, i2c12_all_drv, sens0_pclk_drv,
-                    sens0_ckout_drv, uart3_all_drv]
+                         rmii_crs_drv, rmii_rxd10_drv, rmii_ref_clk_drv,
+                         smi_mdc_mdio_drv, i2s_d0_drv, i2s_bclk0_drv, i2s3_drv,
+                         i2s13_drv, pcm1_drv, ks_in_drv, ks_out_drv, lvds_all_drv,
+                         lcd_dsi_drv, dsi_drv, sd0_d0_d3_drv, sd1_d0_d3_drv,
+                         sd0_cmd_drv, sd0_clk_drv, sd1_cmd_drv, sd1_clk_drv,
+                         spi0_all_drv, uart0_rx_drv, uart0_tx_drv, uart2_all_drv,
+                         i2c0_all_drv, i2c12_all_drv, sens0_pclk_drv,
+                         sens0_ckout_drv, uart3_all_drv]
             minItems: 1
             maxItems: 32
 
@@ -144,29 +144,29 @@ patternProperties:
             items:
               oneOf:
                 - enum: [dnand_dqs, dnand_dqsn, eth_txd0, eth_txd1, eth_txen,
-                    eth_rxer, eth_crs_dv, eth_rxd1, eth_rxd0, eth_ref_clk,
-                    eth_mdc, eth_mdio, sirq0, sirq1, sirq2, i2s_d0, i2s_bclk0,
-                    i2s_lrclk0, i2s_mclk0, i2s_d1, i2s_bclk1, i2s_lrclk1,
-                    i2s_mclk1, ks_in0, ks_in1, ks_in2, ks_in3, ks_out0, ks_out1,
-                    ks_out2, lvds_oep, lvds_oen, lvds_odp, lvds_odn, lvds_ocp,
-                    lvds_ocn, lvds_obp, lvds_obn, lvds_oap, lvds_oan, lvds_eep,
-                    lvds_een, lvds_edp, lvds_edn, lvds_ecp, lvds_ecn, lvds_ebp,
-                    lvds_ebn, lvds_eap, lvds_ean, lcd0_d18, lcd0_d17, dsi_dp3,
-                    dsi_dn3, dsi_dp1, dsi_dn1, dsi_cp, dsi_cn, dsi_dp0, dsi_dn0,
-                    dsi_dp2, dsi_dn2, sd0_d0, sd0_d1, sd0_d2, sd0_d3, sd1_d0,
-                    sd1_d1, sd1_d2, sd1_d3, sd0_cmd, sd0_clk, sd1_cmd, sd1_clk,
-                    spi0_sclk, spi0_ss, spi0_miso, spi0_mosi, uart0_rx,
-                    uart0_tx, i2c0_sclk, i2c0_sdata, sensor0_pclk,
-                    sensor0_ckout, dnand_ale, dnand_cle, dnand_ceb0, dnand_ceb1,
-                    dnand_ceb2, dnand_ceb3, uart2_rx, uart2_tx, uart2_rtsb,
-                    uart2_ctsb, uart3_rx, uart3_tx, uart3_rtsb, uart3_ctsb,
-                    pcm1_in, pcm1_clk, pcm1_sync, pcm1_out, i2c1_sclk,
-                    i2c1_sdata, i2c2_sclk, i2c2_sdata, csi_dn0, csi_dp0,
-                    csi_dn1, csi_dp1, csi_dn2, csi_dp2, csi_dn3, csi_dp3,
-                    csi_cn, csi_cp, dnand_d0, dnand_d1, dnand_d2, dnand_d3,
-                    dnand_d4, dnand_d5, dnand_d6, dnand_d7, dnand_rb, dnand_rdb,
-                    dnand_rdbn, dnand_wrb, porb, clko_25m, bsel, pkg0, pkg1,
-                    pkg2, pkg3]
+                         eth_rxer, eth_crs_dv, eth_rxd1, eth_rxd0, eth_ref_clk,
+                         eth_mdc, eth_mdio, sirq0, sirq1, sirq2, i2s_d0, i2s_bclk0,
+                         i2s_lrclk0, i2s_mclk0, i2s_d1, i2s_bclk1, i2s_lrclk1,
+                         i2s_mclk1, ks_in0, ks_in1, ks_in2, ks_in3, ks_out0, ks_out1,
+                         ks_out2, lvds_oep, lvds_oen, lvds_odp, lvds_odn, lvds_ocp,
+                         lvds_ocn, lvds_obp, lvds_obn, lvds_oap, lvds_oan, lvds_eep,
+                         lvds_een, lvds_edp, lvds_edn, lvds_ecp, lvds_ecn, lvds_ebp,
+                         lvds_ebn, lvds_eap, lvds_ean, lcd0_d18, lcd0_d17, dsi_dp3,
+                         dsi_dn3, dsi_dp1, dsi_dn1, dsi_cp, dsi_cn, dsi_dp0, dsi_dn0,
+                         dsi_dp2, dsi_dn2, sd0_d0, sd0_d1, sd0_d2, sd0_d3, sd1_d0,
+                         sd1_d1, sd1_d2, sd1_d3, sd0_cmd, sd0_clk, sd1_cmd, sd1_clk,
+                         spi0_sclk, spi0_ss, spi0_miso, spi0_mosi, uart0_rx,
+                         uart0_tx, i2c0_sclk, i2c0_sdata, sensor0_pclk,
+                         sensor0_ckout, dnand_ale, dnand_cle, dnand_ceb0, dnand_ceb1,
+                         dnand_ceb2, dnand_ceb3, uart2_rx, uart2_tx, uart2_rtsb,
+                         uart2_ctsb, uart3_rx, uart3_tx, uart3_rtsb, uart3_ctsb,
+                         pcm1_in, pcm1_clk, pcm1_sync, pcm1_out, i2c1_sclk,
+                         i2c1_sdata, i2c2_sclk, i2c2_sdata, csi_dn0, csi_dp0,
+                         csi_dn1, csi_dp1, csi_dn2, csi_dp2, csi_dn3, csi_dp3,
+                         csi_cn, csi_cp, dnand_d0, dnand_d1, dnand_d2, dnand_d3,
+                         dnand_d4, dnand_d5, dnand_d6, dnand_d7, dnand_rb, dnand_rdb,
+                         dnand_rdbn, dnand_wrb, porb, clko_25m, bsel, pkg0, pkg1,
+                         pkg2, pkg3]
             minItems: 1
             maxItems: 64
 
index 5556def..c4c0712 100644 (file)
@@ -106,7 +106,7 @@ patternProperties:
     required:
       - pinmux
 
-    additionalProperties:  false
+    additionalProperties: false
 
 required:
   - compatible
index 1f0f575..040d2ad 100644 (file)
@@ -71,9 +71,9 @@ patternProperties:
           Specify the alternative function to be configured for the specified
           pins. Functions are only valid for gpio pins.
         enum: [ gpio, cci_i2c0, blsp_uim1, blsp_uim2, blsp_uim3, blsp_uim5,
-          blsp_i2c1, blsp_i2c2, blsp_i2c3, blsp_i2c5, blsp_spi1,
-          blsp_spi2, blsp_spi3, blsp_spi5, blsp_uart1, blsp_uart2,
-          blsp_uart3, blsp_uart5, cam_mclk0, cam_mclk1, wlan ]
+                blsp_i2c1, blsp_i2c2, blsp_i2c3, blsp_i2c5, blsp_spi1,
+                blsp_spi2, blsp_spi3, blsp_spi5, blsp_uart1, blsp_uart2,
+                blsp_uart3, blsp_uart5, cam_mclk0, cam_mclk1, wlan ]
 
       drive-strength:
         enum: [2, 4, 6, 8, 10, 12, 14, 16]
index d0d1a01..9f1dab0 100644 (file)
@@ -40,24 +40,24 @@ patternProperties:
           Function to mux.
         $ref: "/schemas/types.yaml#/definitions/string"
         enum: [i2c0, i2c1, i2c2, i2c3, i2c4, i2c5, i2c6, i2c7, i2c8,
-          spi0, spi1, spi2, spi3, spi4, spi5, spi6,
-          uart0, uart1, uart2, uart3, pwm, pcmif_out, pcmif_in]
+               spi0, spi1, spi2, spi3, spi4, spi5, spi6,
+               uart0, uart1, uart2, uart3, pwm, pcmif_out, pcmif_in]
 
       groups:
         description:
           Name of the pin group to use for the functions.
         $ref: "/schemas/types.yaml#/definitions/string"
         enum: [i2c0_grp, i2c1_grp, i2c2_grp, i2c3_grp, i2c4_grp,
-          i2c5_grp, i2c6_grp, i2c7_grp, i2c8_grp,
-          spi0_grp, spi0_cs0_grp, spi0_cs1_grp, spi0_cs2_grp,
-          spi1_grp, spi2_grp, spi3_grp, spi4_grp, spi5_grp, spi6_grp,
-          uart0_grp, uart1_grp, uart2_grp, uart3_grp,
-          pwm0_gpio4_grp, pwm0_gpio8_grp, pwm0_gpio12_grp,
-          pwm0_gpio16_grp, pwm1_gpio5_grp, pwm1_gpio9_grp,
-          pwm1_gpio13_grp, pwm1_gpio17_grp, pwm2_gpio6_grp,
-          pwm2_gpio10_grp, pwm2_gpio14_grp, pwm2_gpio18_grp,
-          pwm3_gpio7_grp, pwm3_gpio11_grp, pwm3_gpio15_grp,
-          pwm3_gpio19_grp, pcmif_out_grp, pcmif_in_grp]
+               i2c5_grp, i2c6_grp, i2c7_grp, i2c8_grp,
+               spi0_grp, spi0_cs0_grp, spi0_cs1_grp, spi0_cs2_grp,
+               spi1_grp, spi2_grp, spi3_grp, spi4_grp, spi5_grp, spi6_grp,
+               uart0_grp, uart1_grp, uart2_grp, uart3_grp,
+               pwm0_gpio4_grp, pwm0_gpio8_grp, pwm0_gpio12_grp,
+               pwm0_gpio16_grp, pwm1_gpio5_grp, pwm1_gpio9_grp,
+               pwm1_gpio13_grp, pwm1_gpio17_grp, pwm2_gpio6_grp,
+               pwm2_gpio10_grp, pwm2_gpio14_grp, pwm2_gpio18_grp,
+               pwm3_gpio7_grp, pwm3_gpio11_grp, pwm3_gpio15_grp,
+               pwm3_gpio19_grp, pcmif_out_grp, pcmif_in_grp]
 
       drive-strength:
         enum: [2, 4, 6, 8, 16, 24, 32]
index 4f524f8..d30f85c 100644 (file)
@@ -27,6 +27,7 @@ properties:
       - amlogic,meson8b-pwrc
       - amlogic,meson8m2-pwrc
       - amlogic,meson-gxbb-pwrc
+      - amlogic,meson-axg-pwrc
       - amlogic,meson-g12a-pwrc
       - amlogic,meson-sm1-pwrc
 
@@ -42,11 +43,11 @@ properties:
       - const: vapb
 
   resets:
-    minItems: 11
+    minItems: 5
     maxItems: 12
 
   reset-names:
-    minItems: 11
+    minItems: 5
     maxItems: 12
 
   "#power-domain-cells":
@@ -111,6 +112,24 @@ allOf:
       properties:
         compatible:
           enum:
+            - amlogic,meson-axg-pwrc
+    then:
+      properties:
+        reset-names:
+          items:
+            - const: viu
+            - const: venc
+            - const: vcbus
+            - const: vencl
+            - const: vid_lock
+      required:
+        - resets
+        - reset-names
+
+  - if:
+      properties:
+        compatible:
+          enum:
             - amlogic,meson-g12a-pwrc
             - amlogic,meson-sm1-pwrc
     then:
diff --git a/Documentation/devicetree/bindings/power/brcm,bcm63xx-power.yaml b/Documentation/devicetree/bindings/power/brcm,bcm63xx-power.yaml
new file mode 100644 (file)
index 0000000..63b15ac
--- /dev/null
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/brcm,bcm63xx-power.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: BCM63xx power domain driver
+
+maintainers:
+  - Álvaro Fernández Rojas <noltari@gmail.com>
+
+description: |
+  BCM6318, BCM6328, BCM6362 and BCM63268 SoCs have a power domain controller
+  to enable/disable certain components in order to save power.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - brcm,bcm6318-power-controller
+          - brcm,bcm6328-power-controller
+          - brcm,bcm6362-power-controller
+          - brcm,bcm63268-power-controller
+
+  reg:
+    maxItems: 1
+
+  "#power-domain-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - "#power-domain-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    periph_pwr: power-controller@10001848 {
+        compatible = "brcm,bcm6328-power-controller";
+        reg = <0x10001848 0x4>;
+        #power-domain-cells = <1>;
+    };
index ec2aaee..99e8042 100644 (file)
@@ -40,6 +40,7 @@ properties:
       - renesas,r8a77980-sysc # R-Car V3H
       - renesas,r8a77990-sysc # R-Car E3
       - renesas,r8a77995-sysc # R-Car D3
+      - renesas,r8a779a0-sysc # R-Car V3U
 
   reg:
     maxItems: 1
index a6c9102..9c6fda6 100644 (file)
@@ -28,14 +28,16 @@ description: |
 
 properties:
   mode-normal:
-      $ref: /schemas/types.yaml#/definitions/uint32
-      description: |
-        Default value to set on a reboot if no command was provided.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Default value to set on a reboot if no command was provided.
 
 patternProperties:
   "^mode-.*$":
     $ref: /schemas/types.yaml#/definitions/uint32
 
+additionalProperties: false
+
 examples:
   - |
     reboot-mode {
index 867e3e6..76c227a 100644 (file)
@@ -15,10 +15,10 @@ properties:
     oneOf:
       - const: ingenic,jz4740-battery
       - items:
-        - enum:
-          - ingenic,jz4725b-battery
-          - ingenic,jz4770-battery
-        - const: ingenic,jz4740-battery
+          - enum:
+              - ingenic,jz4725b-battery
+              - ingenic,jz4770-battery
+          - const: ingenic,jz4740-battery
 
   io-channels:
     maxItems: 1
index 193a23a..983fc21 100644 (file)
@@ -84,12 +84,12 @@ allOf:
     then:
       properties:
         summit,mains-current-limit-microamp:
-          enum: [ 300000,  500000,  700000, 1000000,
-                 1500000, 1800000, 2000000]
+          enum: [ 300000, 500000, 700000, 1000000,
+                  1500000, 1800000, 2000000]
 
         summit,usb-current-limit-microamp:
-          enum: [ 300000,  500000,  700000, 1000000,
-                 1500000, 1800000, 2000000]
+          enum: [ 300000, 500000, 700000, 1000000,
+                  1500000, 1800000, 2000000]
 
         summit,charge-current-compensation-microamp:
           enum: [200000, 450000, 600000, 900000]
@@ -97,12 +97,12 @@ allOf:
     else:
       properties:
         summit,mains-current-limit-microamp:
-          enum: [ 300000,  500000,  700000,  900000, 1200000,
-                 1500000, 1800000, 2000000, 2200000, 2500000]
+          enum: [ 300000, 500000, 700000, 900000, 1200000,
+                  1500000, 1800000, 2000000, 2200000, 2500000]
 
         summit,usb-current-limit-microamp:
-          enum: [ 300000,  500000,  700000,  900000, 1200000,
-                 1500000, 1800000, 2000000, 2200000, 2500000]
+          enum: [ 300000, 500000, 700000, 900000, 1200000,
+                  1500000, 1800000, 2000000, 2200000, 2500000]
 
         summit,charge-current-compensation-microamp:
           enum: [250000, 700000, 900000, 1200000]
index ba175b3..9245b71 100644 (file)
@@ -41,6 +41,8 @@ required:
   - enable-gpios
   - mps,fb-voltage-divider
 
+unevaluatedProperties: false
+
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
index c6de496..f578e72 100644 (file)
@@ -80,6 +80,8 @@ required:
   - compatible
   - reg
 
+additionalProperties: false
+
 examples:
   - |
     i2c {
index 2849ce4..620cd05 100644 (file)
@@ -47,6 +47,7 @@ properties:
       - renesas,r8a77980-rst      # R-Car V3H
       - renesas,r8a77990-rst      # R-Car E3
       - renesas,r8a77995-rst      # R-Car D3
+      - renesas,r8a779a0-rst      # R-Car V3U
 
   reg:
     maxItems: 1
index 27a45fe..ed83686 100644 (file)
@@ -1,7 +1,7 @@
 --------------------------------------------------------------------------
- =  Zynq UltraScale+ MPSoC reset driver binding =
+ =  Zynq UltraScale+ MPSoC and Versal reset driver binding =
 --------------------------------------------------------------------------
-The Zynq UltraScale+ MPSoC has several different resets.
+The Zynq UltraScale+ MPSoC and Versal has several different resets.
 
 See Chapter 36 of the Zynq UltraScale+ MPSoC TRM (UG) for more information
 about zynqmp resets.
@@ -10,7 +10,8 @@ Please also refer to reset.txt in this directory for common reset
 controller binding usage.
 
 Required Properties:
-- compatible:  "xlnx,zynqmp-reset"
+- compatible:  "xlnx,zynqmp-reset" for Zynq UltraScale+ MPSoC platform
+               "xlnx,versal-reset" for Versal platform
 - #reset-cells:        Specifies the number of cells needed to encode reset
                line, should be 1
 
@@ -37,8 +38,10 @@ Device nodes that need access to reset lines should
 specify them as a reset phandle in their corresponding node as
 specified in reset.txt.
 
-For list of all valid reset indicies see
+For list of all valid reset indices for Zynq UltraScale+ MPSoC see
 <dt-bindings/reset/xlnx-zynqmp-resets.h>
+For list of all valid reset indices for Versal see
+<dt-bindings/reset/xlnx-versal-resets.h>
 
 Example:
 
index 3f4a193..efc0198 100644 (file)
@@ -25,8 +25,8 @@ select:
   properties:
     compatible:
       items:
-       - enum:
-          - sifive,fu540-c000-ccache
+        - enum:
+            - sifive,fu540-c000-ccache
 
   required:
     - compatible
index 3ab5327..3a8647d 100644 (file)
@@ -22,4 +22,7 @@ properties:
           - sifive,hifive-unleashed-a00
       - const: sifive,fu540-c000
       - const: sifive,fu540
+
+additionalProperties: true
+
 ...
index 4ad1e45..07f6ff8 100644 (file)
@@ -19,9 +19,9 @@ properties:
           - const: fsl,imx21-rnga
       - items:
           - enum:
-            - fsl,imx6sl-rngb
-            - fsl,imx6sll-rngb
-            - fsl,imx6ull-rngb
+              - fsl,imx6sl-rngb
+              - fsl,imx6sll-rngb
+              - fsl,imx6ull-rngb
           - const: fsl,imx25-rngb
       - const: fsl,imx35-rngc
 
index 9ff85bc..9702c07 100644 (file)
@@ -20,30 +20,30 @@ properties:
       - const: fsl,imx21-uart
       - items:
           - enum:
-            - fsl,imx25-uart
-            - fsl,imx27-uart
-            - fsl,imx31-uart
-            - fsl,imx35-uart
-            - fsl,imx50-uart
-            - fsl,imx51-uart
-            - fsl,imx53-uart
-            - fsl,imx6q-uart
+              - fsl,imx25-uart
+              - fsl,imx27-uart
+              - fsl,imx31-uart
+              - fsl,imx35-uart
+              - fsl,imx50-uart
+              - fsl,imx51-uart
+              - fsl,imx53-uart
+              - fsl,imx6q-uart
           - const: fsl,imx21-uart
       - items:
           - enum:
-            - fsl,imx6sl-uart
-            - fsl,imx6sll-uart
-            - fsl,imx6sx-uart
+              - fsl,imx6sl-uart
+              - fsl,imx6sll-uart
+              - fsl,imx6sx-uart
           - const: fsl,imx6q-uart
           - const: fsl,imx21-uart
       - items:
           - enum:
-            - fsl,imx6ul-uart
-            - fsl,imx7d-uart
-            - fsl,imx8mm-uart
-            - fsl,imx8mn-uart
-            - fsl,imx8mp-uart
-            - fsl,imx8mq-uart
+              - fsl,imx6ul-uart
+              - fsl,imx7d-uart
+              - fsl,imx8mm-uart
+              - fsl,imx8mn-uart
+              - fsl,imx8mp-uart
+              - fsl,imx8mq-uart
           - const: fsl,imx6q-uart
 
   reg:
index ae33fc9..c3c595e 100644 (file)
@@ -62,11 +62,6 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     description: TI-SCI device id of the ring accelerator
 
-  ti,dma-ring-reset-quirk:
-    $ref: /schemas/types.yaml#definitions/flag
-    description: |
-      enable ringacc/udma ring state interoperability issue software w/a
-
 required:
   - compatible
   - reg
@@ -94,7 +89,6 @@ examples:
             reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target";
             ti,num-rings = <818>;
             ti,sci-rm-range-gp-rings = <0x2>; /* GP ring range */
-            ti,dma-ring-reset-quirk;
             ti,sci = <&dmsc>;
             ti,sci-dev-id = <187>;
             msi-parent = <&inta_main_udmass>;
diff --git a/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml b/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
new file mode 100644 (file)
index 0000000..037c51b
--- /dev/null
@@ -0,0 +1,439 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/ti/ti,pruss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: |+
+  TI Programmable Real-Time Unit and Industrial Communication Subsystem
+
+maintainers:
+  - Suman Anna <s-anna@ti.com>
+
+description: |+
+
+  The Programmable Real-Time Unit and Industrial Communication Subsystem
+  (PRU-ICSS a.k.a. PRUSS) is present on various TI SoCs such as AM335x, AM437x,
+  Keystone 66AK2G, OMAP-L138/DA850 etc. A PRUSS consists of dual 32-bit RISC
+  cores (Programmable Real-Time Units, or PRUs), shared RAM, data and
+  instruction RAMs, some internal peripheral modules to facilitate industrial
+  communication, and an interrupt controller.
+
+  The programmable nature of the PRUs provide flexibility to implement custom
+  peripheral interfaces, fast real-time responses, or specialized data handling.
+  The common peripheral modules include the following,
+    - an Ethernet MII_RT module with two MII ports
+    - an MDIO port to control external Ethernet PHYs
+    - an Industrial Ethernet Peripheral (IEP) to manage/generate Industrial
+      Ethernet functions
+    - an Enhanced Capture Module (eCAP)
+    - an Industrial Ethernet Timer with 7/9 capture and 16 compare events
+    - a 16550-compatible UART to support PROFIBUS
+    - Enhanced GPIO with async capture and serial support
+
+  A PRU-ICSS subsystem can have up to three shared data memories. A PRU core
+  acts on a primary Data RAM (there are usually 2 Data RAMs) at its address
+  0x0, but also has access to a secondary Data RAM (primary to the other PRU
+  core) at its address 0x2000. A shared Data RAM, if present, can be accessed
+  by both the PRU cores. The Interrupt Controller (INTC) and a CFG module are
+  common to both the PRU cores. Each PRU core also has a private instruction
+  RAM, and specific register spaces for Control and Debug functionalities.
+
+  Various sub-modules within a PRU-ICSS subsystem are represented as individual
+  nodes and are defined using a parent-child hierarchy depending on their
+  integration within the IP and the SoC. These nodes are described in the
+  following sections.
+
+
+  PRU-ICSS Node
+  ==============
+  Each PRU-ICSS instance is represented as its own node with the individual PRU
+  processor cores, the memories node, an INTC node and an MDIO node represented
+  as child nodes within this PRUSS node. This node shall be a child of the
+  corresponding interconnect bus nodes or target-module nodes.
+
+  See ../../mfd/syscon.yaml for generic SysCon binding details.
+
+
+properties:
+  $nodename:
+    pattern: "^(pruss|icssg)@[0-9a-f]+$"
+
+  compatible:
+    enum:
+      - ti,am3356-pruss  # for AM335x SoC family
+      - ti,am4376-pruss0 # for AM437x SoC family and PRUSS unit 0
+      - ti,am4376-pruss1 # for AM437x SoC family and PRUSS unit 1
+      - ti,am5728-pruss  # for AM57xx SoC family
+      - ti,k2g-pruss     # for 66AK2G SoC family
+      - ti,am654-icssg   # for K3 AM65x SoC family
+      - ti,j721e-icssg   # for K3 J721E SoC family
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 1
+
+  ranges:
+    maxItems: 1
+
+  power-domains:
+    description: |
+      This property is as per sci-pm-domain.txt.
+
+patternProperties:
+
+  memories@[a-f0-9]+$:
+    description: |
+      The various Data RAMs within a single PRU-ICSS unit are represented as a
+      single node with the name 'memories'.
+
+    type: object
+
+    properties:
+      reg:
+        minItems: 2 # On AM437x one of two PRUSS units don't contain Shared RAM.
+        maxItems: 3
+        items:
+          - description: Address and size of the Data RAM0.
+          - description: Address and size of the Data RAM1.
+          - description: |
+              Address and size of the Shared Data RAM. Note that on AM437x one
+              of two PRUSS units don't contain Shared RAM, while the second one
+              has it.
+
+      reg-names:
+        minItems: 2
+        maxItems: 3
+        items:
+          - const: dram0
+          - const: dram1
+          - const: shrdram2
+
+    required:
+      - reg
+      - reg-names
+
+    additionalProperties: false
+
+  cfg@[a-f0-9]+$:
+    description: |
+      PRU-ICSS configuration space. CFG sub-module represented as a SysCon.
+
+    type: object
+
+    properties:
+      compatible:
+        items:
+          - const: ti,pruss-cfg
+          - const: syscon
+
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 1
+
+      reg:
+        maxItems: 1
+
+      ranges:
+        maxItems: 1
+
+      clocks:
+        type: object
+
+        properties:
+          "#address-cells":
+            const: 1
+
+          "#size-cells":
+            const: 0
+
+        patternProperties:
+          coreclk-mux@[a-f0-9]+$:
+            description: |
+              This is applicable only for ICSSG (K3 SoCs). The ICSSG modules
+              core clock can be set to one of the 2 sources: ICSSG_CORE_CLK or
+              ICSSG_ICLK.  This node models this clock mux and should have the
+              name "coreclk-mux".
+
+            type: object
+
+            properties:
+              '#clock-cells':
+                const: 0
+
+              clocks:
+                items:
+                  - description: ICSSG_CORE Clock
+                  - description: ICSSG_ICLK Clock
+
+              assigned-clocks:
+                maxItems: 1
+
+              assigned-clock-parents:
+                maxItems: 1
+                description: |
+                  Standard assigned-clocks-parents definition used for selecting
+                  mux parent (one of the mux input).
+
+              reg:
+                maxItems: 1
+
+            required:
+              - clocks
+
+            additionalProperties: false
+
+          iepclk-mux@[a-f0-9]+$:
+            description: |
+              The IEP module can get its clock from 2 sources: ICSSG_IEP_CLK or
+              CORE_CLK (OCP_CLK in older SoCs). This node models this clock
+              mux and should have the name "iepclk-mux".
+
+            type: object
+
+            properties:
+              '#clock-cells':
+                const: 0
+
+              clocks:
+                items:
+                  - description: ICSSG_IEP Clock
+                  - description: Core Clock (OCP Clock in older SoCs)
+
+              assigned-clocks:
+                maxItems: 1
+
+              assigned-clock-parents:
+                maxItems: 1
+                description: |
+                  Standard assigned-clocks-parents definition used for selecting
+                  mux parent (one of the mux input).
+
+              reg:
+                maxItems: 1
+
+            required:
+              - clocks
+
+            additionalProperties: false
+
+        additionalProperties: false
+
+  iep@[a-f0-9]+$:
+    description: |
+      Industrial Ethernet Peripheral to manage/generate Industrial Ethernet
+      functions such as time stamping. Each PRUSS has either 1 IEP (on AM335x,
+      AM437x, AM57xx & 66AK2G SoCs) or 2 IEPs (on K3 AM65x & J721E SoCs ). IEP
+      is used for creating PTP clocks and generating PPS signals.
+
+    type: object
+
+  mii-rt@[a-f0-9]+$:
+    description: |
+      Real-Time Ethernet to support multiple industrial communication protocols.
+      MII-RT sub-module represented as a SysCon.
+
+    type: object
+
+    properties:
+      compatible:
+        items:
+          - const: ti,pruss-mii
+          - const: syscon
+
+      reg:
+        maxItems: 1
+
+    additionalProperties: false
+
+  mii-g-rt@[a-f0-9]+$:
+    description: |
+      The Real-time Media Independent Interface to support multiple industrial
+      communication protocols (G stands for Gigabit). MII-G-RT sub-module
+      represented as a SysCon.
+
+    type: object
+
+    properties:
+      compatible:
+        items:
+          - const: ti,pruss-mii-g
+          - const: syscon
+
+      reg:
+        maxItems: 1
+
+    additionalProperties: false
+
+  interrupt-controller@[a-f0-9]+$:
+    description: |
+      PRUSS INTC Node. Each PRUSS has a single interrupt controller instance
+      that is common to all the PRU cores. This should be represented as an
+      interrupt-controller node.
+
+    type: object
+
+  mdio@[a-f0-9]+$:
+    description: |
+      MDIO Node. Each PRUSS has an MDIO module that can be used to control
+      external PHYs. The MDIO module used within the PRU-ICSS is an instance of
+      the MDIO Controller used in TI Davinci SoCs.
+
+    allOf:
+      - $ref: /schemas/net/ti,davinci-mdio.yaml#
+
+    type: object
+
+  "^(pru|rtu|txpru)@[0-9a-f]+$":
+    description: |
+      PRU Node. Each PRUSS has dual PRU cores, each represented as a RemoteProc
+      device through a PRU child node each. Each node can optionally be rendered
+      inactive by using the standard DT string property, "status". The ICSSG IP
+      present on K3 SoCs have additional auxiliary PRU cores with slightly
+      different IP integration.
+
+    type: object
+
+required:
+  - compatible
+  - reg
+  - ranges
+
+additionalProperties: false
+
+# Due to inability of correctly verifying sub-nodes with an @address through
+# the "required" list, the required sub-nodes below are commented out for now.
+
+#required:
+# - memories
+# - interrupt-controller
+# - pru
+
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - ti,k2g-pruss
+          - ti,am654-icssg
+          - ti,j721e-icssg
+then:
+  required:
+    - power-domains
+
+examples:
+  - |
+
+    /* Example 1 AM33xx PRU-ICSS */
+    pruss: pruss@0 {
+        compatible = "ti,am3356-pruss";
+        reg = <0x0 0x80000>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+
+        pruss_mem: memories@0 {
+            reg = <0x0 0x2000>,
+                  <0x2000 0x2000>,
+                  <0x10000 0x3000>;
+            reg-names = "dram0", "dram1", "shrdram2";
+        };
+
+        pruss_cfg: cfg@26000 {
+            compatible = "ti,pruss-cfg", "syscon";
+            #address-cells = <1>;
+            #size-cells = <1>;
+            reg = <0x26000 0x2000>;
+            ranges = <0x00 0x26000 0x2000>;
+
+            clocks {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                pruss_iepclk_mux: iepclk-mux@30 {
+                    reg = <0x30>;
+                    #clock-cells = <0>;
+                    clocks = <&l3_gclk>,        /* icss_iep */
+                             <&pruss_ocp_gclk>; /* icss_ocp */
+                };
+            };
+        };
+
+        pruss_mii_rt: mii-rt@32000 {
+            compatible = "ti,pruss-mii", "syscon";
+            reg = <0x32000 0x58>;
+        };
+
+        pruss_mdio: mdio@32400 {
+            compatible = "ti,davinci_mdio";
+            reg = <0x32400 0x90>;
+            clocks = <&dpll_core_m4_ck>;
+            clock-names = "fck";
+            bus_freq = <1000000>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+        };
+    };
+
+  - |
+
+    /* Example 2 AM43xx PRU-ICSS with PRUSS1 node */
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    pruss1: pruss@0 {
+        compatible = "ti,am4376-pruss1";
+        reg = <0x0 0x40000>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+
+        pruss1_mem: memories@0 {
+            reg = <0x0 0x2000>,
+                  <0x2000 0x2000>,
+                  <0x10000 0x8000>;
+            reg-names = "dram0", "dram1", "shrdram2";
+        };
+
+        pruss1_cfg: cfg@26000 {
+            compatible = "ti,pruss-cfg", "syscon";
+            #address-cells = <1>;
+            #size-cells = <1>;
+            reg = <0x26000 0x2000>;
+            ranges = <0x00 0x26000 0x2000>;
+
+            clocks {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                pruss1_iepclk_mux: iepclk-mux@30 {
+                    reg = <0x30>;
+                    #clock-cells = <0>;
+                    clocks = <&sysclk_div>,     /* icss_iep */
+                             <&pruss_ocp_gclk>; /* icss_ocp */
+                };
+            };
+        };
+
+        pruss1_mii_rt: mii-rt@32000 {
+            compatible = "ti,pruss-mii", "syscon";
+            reg = <0x32000 0x58>;
+        };
+
+        pruss1_mdio: mdio@32400 {
+            compatible = "ti,davinci_mdio";
+            reg = <0x32400 0x90>;
+            clocks = <&dpll_core_m4_ck>;
+            clock-names = "fck";
+            bus_freq = <1000000>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+        };
+    };
+
+...
index 3b9143a..acfb9db 100644 (file)
@@ -11,9 +11,10 @@ maintainers:
 
 description: |
   Google's ChromeOS EC codec is a digital mic codec provided by the
-  Embedded Controller (EC) and is controlled via a host-command interface.
-  An EC codec node should only be found as a sub-node of the EC node (see
-  Documentation/devicetree/bindings/mfd/google,cros-ec.yaml).
+  Embedded Controller (EC) and is controlled via a host-command
+  interface.  An EC codec node should only be found inside the "codecs"
+  subnode of a cros-ec node.
+  (see Documentation/devicetree/bindings/mfd/google,cros-ec.yaml).
 
 properties:
   compatible:
@@ -54,14 +55,19 @@ examples:
         #size-cells = <0>;
         cros-ec@0 {
             compatible = "google,cros-ec-spi";
-            #address-cells = <2>;
-            #size-cells = <1>;
             reg = <0>;
-            cros_ec_codec: ec-codec@10500000 {
-                compatible = "google,cros-ec-codec";
-                #sound-dai-cells = <1>;
-                reg = <0x0 0x10500000 0x80000>;
-                memory-region = <&reserved_mem>;
+
+            codecs {
+                #address-cells = <2>;
+                #size-cells = <1>;
+
+                cros_ec_codec: ec-codec@10500000 {
+                    compatible = "google,cros-ec-codec";
+                    #sound-dai-cells = <1>;
+                    reg = <0x0 0x10500000 0x80000>;
+                    memory-region = <&reserved_mem>;
+                };
+
             };
         };
     };
index 7d8bd4e..4a21290 100644 (file)
@@ -10,8 +10,8 @@ maintainers:
   - Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
 
 description:
-        The Microchip Sony/Philips Digital Interface Receiver is a
-        serial port compliant with the IEC-60958 standard.
+  The Microchip Sony/Philips Digital Interface Receiver is a serial port 
+  compliant with the IEC-60958 standard.
 
 properties:
   "#sound-dai-cells":
index a03b0b8..bdfb633 100644 (file)
@@ -10,8 +10,8 @@ maintainers:
   - Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
 
 description:
-        The Microchip Sony/Philips Digital Interface Transmitter is a
-        serial port compliant with the IEC-60958 standard.
+  The Microchip Sony/Philips Digital Interface Transmitter is a serial port 
+  compliant with the IEC-60958 standard.
 
 properties:
   "#sound-dai-cells":
index f6f9fb4..1e23c0e 100644 (file)
@@ -26,8 +26,10 @@ properties:
   reg:
     maxItems: 2
     description: LPAIF core registers
+
   reg-names:
-     maxItems: 2
+    maxItems: 2
+
   clocks:
     minItems: 3
     maxItems: 6
@@ -39,8 +41,10 @@ properties:
   interrupts:
     maxItems: 2
     description: LPAIF DMA buffer interrupt
+
   interrupt-names:
     maxItems: 2
+
   qcom,adsp:
     $ref: /schemas/types.yaml#/definitions/phandle
     description: Phandle for the audio DSP node
@@ -141,31 +145,31 @@ allOf:
       properties:
         clock-names:
           oneOf:
-           - items:   #for I2S
-              - const: pcnoc-sway-clk
-              - const: audio-core
-              - const: mclk0
-              - const: pcnoc-mport-clk
-              - const: mi2s-bit-clk0
-              - const: mi2s-bit-clk1
-           - items:   #for HDMI
-              - const: pcnoc-sway-clk
-              - const: audio-core
-              - const: pcnoc-mport-clk
+            - items:   #for I2S
+                - const: pcnoc-sway-clk
+                - const: audio-core
+                - const: mclk0
+                - const: pcnoc-mport-clk
+                - const: mi2s-bit-clk0
+                - const: mi2s-bit-clk1
+            - items:   #for HDMI
+                - const: pcnoc-sway-clk
+                - const: audio-core
+                - const: pcnoc-mport-clk
         reg-names:
           anyOf:
             - items:   #for I2S
-              - const: lpass-lpaif
+                - const: lpass-lpaif
             - items:   #for I2S and HDMI
-              - const: lpass-hdmiif
-              - const: lpass-lpaif
+                - const: lpass-hdmiif
+                - const: lpass-lpaif
         interrupt-names:
           anyOf:
             - items:   #for I2S
-              - const: lpass-irq-lpaif
+                - const: lpass-irq-lpaif
             - items:   #for I2S and HDMI
-              - const: lpass-irq-lpaif
-              - const: lpass-irq-hdmi
+                - const: lpass-irq-lpaif
+                - const: lpass-irq-hdmi
       required:
         - iommus
         - power-domains
index def1db2..644b68e 100644 (file)
@@ -26,6 +26,8 @@ properties:
 required:
   - compatible
 
+additionalProperties: false
+
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
index f582593..b66a07e 100644 (file)
@@ -33,6 +33,12 @@ properties:
           - const: allwinner,sun4i-a10-system-control
       - const: allwinner,sun8i-a23-system-control
       - const: allwinner,sun8i-h3-system-control
+      - items:
+          - const: allwinner,sun8i-v3s-system-control
+          - const: allwinner,sun8i-h3-system-control
+      - items:
+          - const: allwinner,sun8i-r40-system-control
+          - const: allwinner,sun4i-a10-system-control
       - const: allwinner,sun50i-a64-sram-controller
         deprecated: true
       - const: allwinner,sun50i-a64-system-control
@@ -87,6 +93,9 @@ patternProperties:
                   - const: allwinner,sun8i-h3-sram-c1
                   - const: allwinner,sun4i-a10-sram-c1
               - items:
+                  - const: allwinner,sun8i-r40-sram-c1
+                  - const: allwinner,sun4i-a10-sram-c1
+              - items:
                   - const: allwinner,sun50i-a64-sram-c1
                   - const: allwinner,sun4i-a10-sram-c1
               - items:
index e35d305..960e2bd 100644 (file)
@@ -33,8 +33,8 @@ properties:
   compatible:
     items:
       - enum:
-        - arm,sp804
-        - hisilicon,sp804
+          - arm,sp804
+          - hisilicon,sp804
       - const: arm,primecell
 
   interrupts:
@@ -58,11 +58,11 @@ properties:
       clock is used for all clock inputs.
     oneOf:
       - items:
-        - description: clock for timer 1
-        - description: clock for timer 2
-        - description: bus clock
+          - description: clock for timer 1
+          - description: clock for timer 2
+          - description: bus clock
       - items:
-        - description: unified clock for both timers and the bus
+          - description: unified clock for both timers and the bus
 
   clock-names: true
     # The original binding did not specify any clock names, and there is no
index ac20b98..d6af279 100644 (file)
@@ -44,8 +44,8 @@ properties:
     enum: [super-speed, high-speed, full-speed]
 
   phys:
-   minItems: 1
-   maxItems: 2
+    minItems: 1
+    maxItems: 2
 
   phy-names:
     minItems: 1
index 5fe9e62..52ceb07 100644 (file)
@@ -17,7 +17,7 @@ description: |-
 
 properties:
   compatible:
-   const: ti,hd3ss3220
+    const: ti,hd3ss3220
 
   reg:
     maxItems: 1
index ad38504..bc8347c 100644 (file)
@@ -179,6 +179,8 @@ patternProperties:
     description: CALAO Systems SAS
   "^calxeda,.*":
     description: Calxeda
+  "^caninos,.*":
+    description: Caninos Loucos Program
   "^capella,.*":
     description: Capella Microsystems, Inc
   "^cascoda,.*":
@@ -439,6 +441,8 @@ patternProperties:
     description: HiDeep Inc.
   "^himax,.*":
     description: Himax Technologies, Inc.
+  "^hirschmann,.*":
+    description: Hirschmann Automation and Control GmbH
   "^hisilicon,.*":
     description: Hisilicon Limited.
   "^hit,.*":
@@ -912,6 +916,8 @@ patternProperties:
     description: Ronbo Electronics
   "^roofull,.*":
     description: Shenzhen Roofull Technology Co, Ltd
+  "^roseapplepi,.*":
+    description: RoseapplePi.org
   "^samsung,.*":
     description: Samsung Semiconductor
   "^samtec,.*":
@@ -928,6 +934,8 @@ patternProperties:
     description: Schindler
   "^seagate,.*":
     description: Seagate Technology PLC
+  "^seeed,.*":
+    description: Seeed Technology Co., Ltd
   "^seirobotics,.*":
     description: Shenzhen SEI Robotics Co., Ltd
   "^semtech,.*":
@@ -1222,6 +1230,10 @@ patternProperties:
     description: Shenzhen Zidoo Technology Co., Ltd.
   "^zii,.*":
     description: Zodiac Inflight Innovations
+  "^zinitix,.*":
+    description: Zinitix Co., Ltd
+  "^zkmagic,.*":
+    description: Shenzhen Zkmagic Technology Co., Ltd.
   "^zte,.*":
     description: ZTE Corp.
   "^zyxel,.*":
index 1aaf3e7..55adea8 100644 (file)
@@ -15,10 +15,10 @@ properties:
       - const: fsl,imx21-owire
       - items:
           - enum:
-            - fsl,imx27-owire
-            - fsl,imx50-owire
-            - fsl,imx51-owire
-            - fsl,imx53-owire
+              - fsl,imx27-owire
+              - fsl,imx50-owire
+              - fsl,imx51-owire
+              - fsl,imx53-owire
           - const: fsl,imx21-owire
 
   reg:
index 987d6e7..f357f3e 100644 (file)
@@ -77,7 +77,6 @@ available subsections can be seen below.
    console
    dcdbas
    eisa
-   ipmb
    isa
    isapnp
    io-mapping
index 9279a3e..a20ba5d 100644 (file)
@@ -1,16 +1,19 @@
-===============
-Provoke crashes
-===============
+.. SPDX-License-Identifier: GPL-2.0
 
-The lkdtm module provides an interface to crash or injure the kernel at
-predefined crashpoints to evaluate the reliability of crash dumps obtained
-using different dumping solutions. The module uses KPROBEs to instrument
-crashing points, but can also crash the kernel directly without KRPOBE
-support.
+============================================================
+Provoking crashes with Linux Kernel Dump Test Module (LKDTM)
+============================================================
 
+The lkdtm module provides an interface to disrupt (and usually crash)
+the kernel at predefined code locations to evaluate the reliability of
+the kernel's exception handling and to test crash dumps obtained using
+different dumping solutions. The module uses KPROBEs to instrument the
+trigger location, but can also trigger the kernel directly without KPROBE
+support via debugfs.
 
-You can provide the way either through module arguments when inserting
-the module, or through a debugfs interface.
+You can select the location of the trigger ("crash point name") and the
+type of action ("crash point type") either through module arguments when
+inserting the module, or through the debugfs interface.
 
 Usage::
 
@@ -18,31 +21,38 @@ Usage::
                        [cpoint_count={>0}]
 
 recur_count
-       Recursion level for the stack overflow test. Default is 10.
+       Recursion level for the stack overflow test. By default this is
+       dynamically calculated based on kernel configuration, with the
+       goal of being just large enough to exhaust the kernel stack. The
+       value can be seen at `/sys/module/lkdtm/parameters/recur_count`.
 
 cpoint_name
-       Crash point where the kernel is to be crashed. It can be
+       Where in the kernel to trigger the action. It can be
        one of INT_HARDWARE_ENTRY, INT_HW_IRQ_EN, INT_TASKLET_ENTRY,
        FS_DEVRW, MEM_SWAPOUT, TIMERADD, SCSI_DISPATCH_CMD,
-       IDE_CORE_CP, DIRECT
+       IDE_CORE_CP, or DIRECT
 
 cpoint_type
        Indicates the action to be taken on hitting the crash point.
-       It can be one of PANIC, BUG, EXCEPTION, LOOP, OVERFLOW,
-       CORRUPT_STACK, UNALIGNED_LOAD_STORE_WRITE, OVERWRITE_ALLOCATION,
-       WRITE_AFTER_FREE,
+       These are numerous, and best queried directly from debugfs. Some
+       of the common ones are PANIC, BUG, EXCEPTION, LOOP, and OVERFLOW.
+       See the contents of `/sys/kernel/debug/provoke-crash/DIRECT` for
+       a complete list.
 
 cpoint_count
        Indicates the number of times the crash point is to be hit
-       to trigger an action. The default is 10.
+       before triggering the action. The default is 10 (except for
+       DIRECT, which always fires immediately).
 
 You can also induce failures by mounting debugfs and writing the type to
-<mountpoint>/provoke-crash/<crashpoint>. E.g.::
+<debugfs>/provoke-crash/<crashpoint>. E.g.::
 
-  mount -t debugfs debugfs /mnt
-  echo EXCEPTION > /mnt/provoke-crash/INT_HARDWARE_ENTRY
+  mount -t debugfs debugfs /sys/kernel/debug
+  echo EXCEPTION > /sys/kernel/debug/provoke-crash/INT_HARDWARE_ENTRY
 
+The special file `DIRECT` will induce the action directly without KPROBE
+instrumentation. This mode is the only one available when the module is
+built for a kernel without KPROBEs support::
 
-A special file is `DIRECT` which will induce the crash directly without
-KPROBE instrumentation. This mode is the only one available when the module
-is built on a kernel without KPROBEs support.
+  # Instead of having a BUG kill your shell, have it kill "cat":
+  cat <(echo WRITE_RO) >/sys/kernel/debug/provoke-crash/DIRECT
index 9aad964..57f66de 100644 (file)
@@ -81,7 +81,7 @@ C. Boot options
 1. fbcon=font:<name>
 
        Select the initial font to use. The value 'name' can be any of the
-       compiled-in fonts: 10x18, 6x10, 7x14, Acorn8x8, MINI4x6,
+       compiled-in fonts: 10x18, 6x10, 6x8, 7x14, Acorn8x8, MINI4x6,
        PEARL8x8, ProFont6x11, SUN12x22, SUN8x16, TER16x32, VGA8x16, VGA8x8.
 
        Note, not all drivers can handle font with widths not divisible by 8,
index bbb0c1c..a94f17d 100644 (file)
@@ -86,9 +86,6 @@ Other Functions
 .. kernel-doc:: fs/dax.c
    :export:
 
-.. kernel-doc:: fs/direct-io.c
-   :export:
-
 .. kernel-doc:: fs/libfs.c
    :export:
 
index 728ab57..0f2292e 100644 (file)
@@ -199,7 +199,7 @@ of its elements. Note: Once array is created its size can not be changed.
 
 There is a helper function to create device related seq_file::
 
-   struct dentry *debugfs_create_devm_seqfile(struct device *dev,
+   void debugfs_create_devm_seqfile(struct device *dev,
                                const char *name,
                                struct dentry *parent,
                                int (*read_fn)(struct seq_file *s,
index 805a1e9..849d5b1 100644 (file)
@@ -256,6 +256,10 @@ which is 1024 bytes long:
      - s\_padding2
      -
    * - 0x54
+     - \_\_be32
+     - s\_num\_fc\_blocks
+     - Number of fast commit blocks in the journal.
+   * - 0x58
      - \_\_u32
      - s\_padding[42]
      -
@@ -310,6 +314,8 @@ The journal incompat features are any combination of the following:
      - This journal uses v3 of the checksum on-disk format. This is the same as
        v2, but the journal block tag size is fixed regardless of the size of
        block numbers. (JBD2\_FEATURE\_INCOMPAT\_CSUM\_V3)
+   * - 0x20
+     - Journal has fast commit blocks. (JBD2\_FEATURE\_INCOMPAT\_FAST\_COMMIT)
 
 .. _jbd2_checksum_type:
 
index 93e55d7..2eb1ab2 100644 (file)
@@ -596,6 +596,13 @@ following:
      - Sparse Super Block, v2. If this flag is set, the SB field s\_backup\_bgs
        points to the two block groups that contain backup superblocks
        (COMPAT\_SPARSE\_SUPER2).
+   * - 0x400
+     - Fast commits supported. Although fast commits blocks are
+       backward incompatible, fast commit blocks are not always
+       present in the journal. If fast commit blocks are present in
+       the journal, JBD2 incompat feature
+       (JBD2\_FEATURE\_INCOMPAT\_FAST\_COMMIT) gets
+       set (COMPAT\_FAST\_COMMIT).
 
 .. _super_incompat:
 
index 5a5f70b..e18f90f 100644 (file)
@@ -136,10 +136,8 @@ Fast commits
 ~~~~~~~~~~~~
 
 JBD2 to also allows you to perform file-system specific delta commits known as
-fast commits. In order to use fast commits, you first need to call
-:c:func:`jbd2_fc_init` and tell how many blocks at the end of journal
-area should be reserved for fast commits. Along with that, you will also need
-to set following callbacks that perform correspodning work:
+fast commits. In order to use fast commits, you will need to set following
+callbacks that perform correspodning work:
 
 `journal->j_fc_cleanup_cb`: Cleanup function called after every full commit and
 fast commit.
index 874ce0e..71b9af1 100644 (file)
@@ -19,9 +19,9 @@ report the "current" state of the lid as either "opened" or "closed".
 
 For most platforms, both the _LID method and the lid notifications are
 reliable. However, there are exceptions. In order to work with these
-exceptional buggy platforms, special restrictions and expections should be
+exceptional buggy platforms, special restrictions and exceptions should be
 taken into account. This document describes the restrictions and the
-expections of the Linux ACPI lid device driver.
+exceptions of the Linux ACPI lid device driver.
 
 
 Restrictions of the returning value of the _LID control method
@@ -46,7 +46,7 @@ state is changed to "closed". The "closed" notification is normally used to
 trigger some system power saving operations on Windows. Since it is fully
 tested, it is reliable from all AML tables.
 
-Expections for the userspace users of the ACPI lid device driver
+Exceptions for the userspace users of the ACPI lid device driver
 ================================================================
 
 The ACPI button driver exports the lid state to the userspace via the
@@ -100,7 +100,7 @@ use the following kernel parameter:
 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
+   ensure that the reliable "closed" notifications can always be delivered
    to the userspace by always pairing "closed" input events with complement
    "opened" input events. But there is still no guarantee that the "opened"
    notifications can be delivered to the userspace when the lid is actually
index bb6d74f..59aad61 100644 (file)
@@ -20,9 +20,9 @@ index, like the ASL example below shows::
 
       Name (_CRS, ResourceTemplate ()
       {
-          GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionInputOnly,
+          GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
                   "\\_SB.GPO0", 0, ResourceConsumer) {15}
-          GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionInputOnly,
+          GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
                   "\\_SB.GPO0", 0, ResourceConsumer) {27, 31}
       })
 
@@ -49,15 +49,41 @@ index
 pin
   Pin in the GpioIo()/GpioInt() resource. Typically this is zero.
 active_low
-  If 1 the GPIO is marked as active_low.
+  If 1, the GPIO is marked as active_low.
 
 Since ACPI GpioIo() resource does not have a field saying whether it is
 active low or high, the "active_low" argument can be used here.  Setting
 it to 1 marks the GPIO as active low.
 
+Note, active_low in _DSD does not make sense for GpioInt() resource and
+must be 0. GpioInt() resource has its own means of defining it.
+
 In our Bluetooth example the "reset-gpios" refers to the second GpioIo()
 resource, second pin in that resource with the GPIO number of 31.
 
+The GpioIo() resource unfortunately doesn't explicitly provide an initial
+state of the output pin which driver should use during its initialization.
+
+Linux tries to use common sense here and derives the state from the bias
+and polarity settings. The table below shows the expectations:
+
+=========  =============  ==============
+Pull Bias     Polarity     Requested...
+=========  =============  ==============
+Implicit     x            AS IS (assumed firmware configured for us)
+Explicit     x (no _DSD)  as Pull Bias (Up == High, Down == Low),
+                          assuming non-active (Polarity = !Pull Bias)
+Down         Low          as low, assuming active
+Down         High         as low, assuming non-active
+Up           Low          as high, assuming non-active
+Up           High         as high, assuming active
+=========  =============  ==============
+
+That said, for our above example the both GPIOs, since the bias setting
+is explicit and _DSD is present, will be treated as active with a high
+polarity and Linux will configure the pins in this state until a driver
+reprograms them differently.
+
 It is possible to leave holes in the array of GPIOs. This is useful in
 cases like with SPI host controllers where some chip selects may be
 implemented as GPIOs and some as native signals. For example a SPI host
@@ -112,8 +138,8 @@ Example::
   Package () {
       "gpio-line-names",
       Package () {
-          "SPI0_CS_N", "EXP2_INT", "MUX6_IO", "UART0_RXD", "MUX7_IO",
-          "LVL_C_A1", "MUX0_IO", "SPI1_MISO"
+          "SPI0_CS_N", "EXP2_INT", "MUX6_IO", "UART0_RXD",
+          "MUX7_IO", "LVL_C_A1", "MUX0_IO", "SPI1_MISO",
       }
   }
 
@@ -137,7 +163,7 @@ to the GPIO lines it is going to use and provide the GPIO subsystem with a
 mapping between those names and the ACPI GPIO resources corresponding to them.
 
 To do that, the driver needs to define a mapping table as a NULL-terminated
-array of struct acpi_gpio_mapping objects that each contain a name, a pointer
+array of struct acpi_gpio_mapping objects that each contains a name, a pointer
 to an array of line data (struct acpi_gpio_params) objects and the size of that
 array.  Each struct acpi_gpio_params object consists of three fields,
 crs_entry_index, line_index, active_low, representing the index of the target
@@ -154,13 +180,14 @@ question would look like this::
   static const struct acpi_gpio_mapping bluetooth_acpi_gpios[] = {
     { "reset-gpios", &reset_gpio, 1 },
     { "shutdown-gpios", &shutdown_gpio, 1 },
-    { },
+    { }
   };
 
 Next, the mapping table needs to be passed as the second argument to
-acpi_dev_add_driver_gpios() that will register it with the ACPI device object
-pointed to by its first argument.  That should be done in the driver's .probe()
-routine.  On removal, the driver should unregister its GPIO mapping table by
+acpi_dev_add_driver_gpios() or its managed analogue that will
+register it with the ACPI device object pointed to by its first
+argument. That should be done in the driver's .probe() routine.
+On removal, the driver should unregister its GPIO mapping table by
 calling acpi_dev_remove_driver_gpios() on the ACPI device object where that
 table was previously registered.
 
@@ -191,12 +218,12 @@ The driver might expect to get the right GPIO when it does::
 but since there is no way to know the mapping between "reset" and
 the GpioIo() in _CRS desc will hold ERR_PTR(-ENOENT).
 
-The driver author can solve this by passing the mapping explictly
-(the recommended way and documented in the above chapter).
+The driver author can solve this by passing the mapping explicitly
+(this is the recommended way and it's documented in the above chapter).
 
 The ACPI GPIO mapping tables should not contaminate drivers that are not
 knowing about which exact device they are servicing on. It implies that
-the ACPI GPIO mapping tables are hardly linked to ACPI ID and certain
+the ACPI GPIO mapping tables are hardly linked to an ACPI ID and certain
 objects, as listed in the above chapter, of the device in question.
 
 Getting GPIO descriptor
@@ -229,5 +256,5 @@ Case 2 explicitly tells GPIO core to look for resources in _CRS.
 Be aware that gpiod_get_index() in cases 1 and 2, assuming that there
 are two versions of ACPI device description provided and no mapping is
 present in the driver, will return different resources. That's why a
-certain driver has to handle them carefully as explained in previous
+certain driver has to handle them carefully as explained in the previous
 chapter.
index 0aa7e2c..6ab6c09 100644 (file)
@@ -98,7 +98,7 @@ subject to change::
    [    0.188903]   exdebug-0398 ex_trace_point        : Method End [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.
 
 Developers can utilize these special log entries to track the AML
-interpretion, thus can aid issue debugging and performance tuning. Note
+interpretation, thus can aid issue debugging and performance tuning. Note
 that, as the "AML tracer" logs are implemented via ACPI_DEBUG_PRINT()
 macro, CONFIG_ACPI_DEBUG is also required to be enabled for enabling
 "AML tracer" logs.
index 1f9ea82..2062a60 100644 (file)
@@ -83,10 +83,6 @@ AMDGPU XGMI Support
 ===================
 
 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
-   :doc: AMDGPU XGMI Support
-
-.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
-   :internal:
 
 AMDGPU RAS Support
 ==================
@@ -124,9 +120,6 @@ RAS VRAM Bad Pages sysfs Interface
 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
    :doc: AMDGPU RAS sysfs gpu_vram_bad_pages Interface
 
-.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
-   :internal:
-
 Sample Code
 -----------
 Sample code for testing error injection can be found here:
index 9257f8a..2b87701 100644 (file)
@@ -20,7 +20,7 @@ ADM1266 is a sequencer that features voltage readback from 17 channels via an
 integrated 12 bit SAR ADC, accessed using a PMBus interface.
 
 The driver is a client driver to the core PMBus driver. Please see
-Documentation/hwmon/pmbus for details on PMBus client drivers.
+Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
 
 
 Sysfs entries
index e6b91ab..b797db7 100644 (file)
@@ -132,6 +132,7 @@ Hardware Monitoring Kernel Drivers
    mcp3021
    menf21bmc
    mlxreg-fan
+   mp2975
    nct6683
    nct6775
    nct7802
index 5b0609c..81d816b 100644 (file)
@@ -20,6 +20,7 @@ This driver implements support for Monolithic Power Systems, Inc. (MPS)
 vendor dual-loop, digital, multi-phase controller MP2975.
 
 This device:
+
 - Supports up to two power rail.
 - Provides 8 pulse-width modulations (PWMs), and can be configured up
   to 8-phase operation for rail 1 and up to 4-phase operation for rail
@@ -32,10 +33,12 @@ This device:
   10-mV DAC, IMVP9 mode with 5-mV DAC.
 
 Device supports:
+
 - SVID interface.
 - AVSBus interface.
 
 Device complaint with:
+
 - PMBus rev 1.3 interface.
 
 Device supports direct format for reading output current, output voltage,
@@ -45,11 +48,14 @@ Device supports VID and direct formats for reading output voltage.
 The below VID modes are supported: VR12, VR13, IMVP9.
 
 The driver provides the next attributes for the current:
+
 - for current in: input, maximum alarm;
 - for current out input, maximum alarm and highest values;
 - for phase current: input and label.
-attributes.
+  attributes.
+
 The driver exports the following attributes via the 'sysfs' files, where
+
 - 'n' is number of telemetry pages (from 1 to 2);
 - 'k' is number of configured phases (from 1 to 8);
 - indexes 1, 1*n for "iin";
@@ -65,11 +71,14 @@ The driver exports the following attributes via the 'sysfs' files, where
 **curr[1-{2n+k}]_label**
 
 The driver provides the next attributes for the voltage:
+
 - for voltage in: input, high critical threshold, high critical alarm, all only
   from page 0;
 - for voltage out: input, low and high critical thresholds, low and high
   critical alarms, from pages 0 and 1;
+
 The driver exports the following attributes via the 'sysfs' files, where
+
 - 'n' is number of telemetry pages (from 1 to 2);
 - indexes 1 for "iin";
 - indexes n+1, n+2 for "vout";
@@ -87,9 +96,12 @@ The driver exports the following attributes via the 'sysfs' files, where
 **in[2-{n+1}1_lcrit_alarm**
 
 The driver provides the next attributes for the power:
+
 - for power in alarm and input.
 - for power out: highest and input.
+
 The driver exports the following attributes via the 'sysfs' files, where
+
 - 'n' is number of telemetry pages (from 1 to 2);
 - indexes 1 for "pin";
 - indexes n+1, n+2 for "pout";
index bc70c6a..e5d63b9 100644 (file)
@@ -17,6 +17,7 @@ LEDs
    uleds
 
    leds-blinkm
+   leds-el15203000
    leds-lm3556
    leds-lp3944
    leds-lp5521
@@ -24,3 +25,4 @@ LEDs
    leds-lp5562
    leds-lp55xx
    leds-mlxcpld
+   leds-sc27xx
diff --git a/Documentation/leds/leds-el15203000.rst b/Documentation/leds/leds-el15203000.rst
new file mode 100644 (file)
index 0000000..12c23d7
--- /dev/null
@@ -0,0 +1,140 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+==================================
+Kernel driver for Crane EL15203000
+==================================
+
+/sys/class/leds/<led>/hw_pattern
+--------------------------------
+
+Specify a hardware pattern for the EL15203000 LED.
+
+The LEDs board supports only predefined patterns by firmware
+for specific LEDs.
+
+Breathing mode for Screen frame light tube::
+
+    "0 4000 1 4000"
+
+       ^
+       |
+    Max-|     ---
+       |    /   \
+       |   /     \
+       |  /       \     /
+       | /         \   /
+    Min-|-           ---
+       |
+       0------4------8--> time (sec)
+
+Cascade mode for Pipe LED::
+
+    "1 800 2 800 4 800 8 800 16 800"
+
+       ^
+       |
+  0 On -|----+                   +----+                   +---
+       |    |                   |    |                   |
+    Off-|    +-------------------+    +-------------------+
+       |
+  1 On -|    +----+                   +----+
+       |    |    |                   |    |
+    Off |----+    +-------------------+    +------------------
+       |
+  2 On -|         +----+                   +----+
+       |         |    |                   |    |
+    Off-|---------+    +-------------------+    +-------------
+       |
+  3 On -|              +----+                   +----+
+       |              |    |                   |    |
+    Off-|--------------+    +-------------------+    +--------
+       |
+  4 On -|                   +----+                   +----+
+       |                   |    |                   |    |
+    Off-|-------------------+    +-------------------+    +---
+       |
+       0---0.8--1.6--2.4--3.2---4---4.8--5.6--6.4--7.2---8--> time (sec)
+
+Inverted cascade mode for Pipe LED::
+
+    "30 800 29 800 27 800 23 800 15 800"
+
+       ^
+       |
+  0 On -|    +-------------------+    +-------------------+
+       |    |                   |    |                   |
+    Off-|----+                   +----+                   +---
+       |
+  1 On -|----+    +-------------------+    +------------------
+       |    |    |                   |    |
+    Off |    +----+                   +----+
+       |
+  2 On -|---------+    +-------------------+    +-------------
+       |         |    |                   |    |
+    Off-|         +----+                   +----+
+       |
+  3 On -|--------------+    +-------------------+    +--------
+       |              |    |                   |    |
+    Off-|              +----+                   +----+
+       |
+  4 On -|-------------------+    +-------------------+    +---
+       |                   |    |                   |    |
+    Off-|                   +----+                   +----+
+       |
+       0---0.8--1.6--2.4--3.2---4---4.8--5.6--6.4--7.2---8--> time (sec)
+
+Bounce mode for Pipe LED::
+
+    "1 800 2 800 4 800 8 800 16 800 16 800 8 800 4 800 2 800 1 800"
+
+       ^
+       |
+  0 On -|----+                                       +--------
+       |    |                                       |
+    Off-|    +---------------------------------------+
+       |
+  1 On -|    +----+                             +----+
+       |    |    |                             |    |
+    Off |----+    +-----------------------------+    +--------
+       |
+  2 On -|         +----+                   +----+
+       |         |    |                   |    |
+    Off-|---------+    +-------------------+    +-------------
+       |
+  3 On -|              +----+         +----+
+       |              |    |         |    |
+    Off-|--------------+    +---------+    +------------------
+       |
+  4 On -|                   +---------+
+       |                   |         |
+    Off-|-------------------+         +-----------------------
+       |
+       0---0.8--1.6--2.4--3.2---4---4.8--5.6--6.4--7.2---8--> time (sec)
+
+Inverted bounce mode for Pipe LED::
+
+    "30 800 29 800 27 800 23 800 15 800 15 800 23 800 27 800 29 800 30 800"
+
+       ^
+       |
+  0 On -|    +---------------------------------------+
+       |    |                                       |
+    Off-|----+                                       +--------
+       |
+  1 On -|----+    +-----------------------------+    +--------
+       |    |    |                             |    |
+    Off |    +----+                             +----+
+       |
+  2 On -|---------+    +-------------------+    +-------------
+       |         |    |                   |    |
+    Off-|         +----+                   +----+
+       |
+  3 On -|--------------+    +---------+    +------------------
+       |              |    |         |    |
+    Off-|              +----+         +----+
+       |
+  4 On -|-------------------+         +-----------------------
+       |                   |         |
+    Off-|                   +---------+
+       |
+       0---0.8--1.6--2.4--3.2---4---4.8--5.6--6.4--7.2---8--> time (sec)
diff --git a/Documentation/leds/leds-sc27xx.rst b/Documentation/leds/leds-sc27xx.rst
new file mode 100644 (file)
index 0000000..6bdf6ba
--- /dev/null
@@ -0,0 +1,27 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+===================================
+Kernel driver for Spreadtrum SC27XX
+===================================
+
+/sys/class/leds/<led>/hw_pattern
+--------------------------------
+
+Specify a hardware pattern for the SC27XX LED. For the SC27XX
+LED controller, it only supports 4 stages to make a single
+hardware pattern, which is used to configure the rise time,
+high time, fall time and low time for the breathing mode.
+
+For the breathing mode, the SC27XX LED only expects one brightness
+for the high stage. To be compatible with the hardware pattern
+format, we should set brightness as 0 for rise stage, fall
+stage and low stage.
+
+- Min stage duration: 125 ms
+- Max stage duration: 31875 ms
+
+Since the stage duration step is 125 ms, the duration should be
+a multiplier of 125, like 125ms, 250ms, 375ms, 500ms ... 31875ms.
+
+Thus the format of the hardware pattern values should be:
+"0 rise_duration brightness high_duration 0 fall_duration 0 low_duration".
index cec03bd..9f3cfca 100644 (file)
@@ -42,6 +42,7 @@ The validator tracks lock-class usage history and divides the usage into
 (4 usages * n STATEs + 1) categories:
 
 where the 4 usages can be:
+
 - 'ever held in STATE context'
 - 'ever held as readlock in STATE context'
 - 'ever held with STATE enabled'
@@ -49,10 +50,12 @@ where the 4 usages can be:
 
 where the n STATEs are coded in kernel/locking/lockdep_states.h and as of
 now they include:
+
 - hardirq
 - softirq
 
 where the last 1 category is:
+
 - 'ever used'                                       [ == !unused        ]
 
 When locking rules are violated, these usage bits are presented in the
@@ -96,9 +99,9 @@ exact case is for the lock as of the reporting time.
   +--------------+-------------+--------------+
   |              | irq enabled | irq disabled |
   +--------------+-------------+--------------+
-  | ever in irq  |      ?      |       -      |
+  | ever in irq  |     '?'     |      '-'     |
   +--------------+-------------+--------------+
-  | never in irq |      +      |       .      |
+  | never in irq |     '+'     |      '.'     |
   +--------------+-------------+--------------+
 
 The character '-' suggests irq is disabled because if otherwise the
@@ -216,7 +219,7 @@ looks like this::
        BD_MUTEX_PARTITION
   };
 
-mutex_lock_nested(&bdev->bd_contains->bd_mutex, BD_MUTEX_PARTITION);
+  mutex_lock_nested(&bdev->bd_contains->bd_mutex, BD_MUTEX_PARTITION);
 
 In this case the locking is done on a bdev object that is known to be a
 partition.
@@ -334,7 +337,7 @@ Troubleshooting:
 ----------------
 
 The validator tracks a maximum of MAX_LOCKDEP_KEYS number of lock classes.
-Exceeding this number will trigger the following lockdep warning:
+Exceeding this number will trigger the following lockdep warning::
 
        (DEBUG_LOCKS_WARN_ON(id >= MAX_LOCKDEP_KEYS))
 
@@ -420,7 +423,8 @@ the critical section of another reader of the same lock instance.
 
 The difference between recursive readers and non-recursive readers is because:
 recursive readers get blocked only by a write lock *holder*, while non-recursive
-readers could get blocked by a write lock *waiter*. Considering the follow example:
+readers could get blocked by a write lock *waiter*. Considering the follow
+example::
 
        TASK A:                 TASK B:
 
@@ -448,20 +452,22 @@ There are simply four block conditions:
 
 Block condition matrix, Y means the row blocks the column, and N means otherwise.
 
-           | E | r | R |
        +---+---+---+---+
-         E | Y | Y | Y |
+       |   | E | r | R |
+       +---+---+---+---+
+       | E | Y | Y | Y |
+       +---+---+---+---+
+       | r | Y | Y | N |
        +---+---+---+---+
-         r | Y | Y | N |
+       | R | Y | Y | N |
        +---+---+---+---+
-         R | Y | Y | N |
 
        (W: writers, r: non-recursive readers, R: recursive readers)
 
 
 acquired recursively. Unlike non-recursive read locks, recursive read locks
 only get blocked by current write lock *holders* other than write lock
-*waiters*, for example:
+*waiters*, for example::
 
        TASK A:                 TASK B:
 
@@ -491,7 +497,7 @@ Recursive locks don't block each other, while non-recursive locks do (this is
 even true for two non-recursive read locks). A non-recursive lock can block the
 corresponding recursive lock, and vice versa.
 
-A deadlock case with recursive locks involved is as follow:
+A deadlock case with recursive locks involved is as follow::
 
        TASK A:                 TASK B:
 
@@ -510,7 +516,7 @@ because there are 3 types for lockers, there are, in theory, 9 types of lock
 dependencies, but we can show that 4 types of lock dependencies are enough for
 deadlock detection.
 
-For each lock dependency:
+For each lock dependency::
 
        L1 -> L2
 
@@ -525,20 +531,25 @@ same types).
 With the above combination for simplification, there are 4 types of dependency edges
 in the lockdep graph:
 
-1) -(ER)->: exclusive writer to recursive reader dependency, "X -(ER)-> Y" means
+1) -(ER)->:
+           exclusive writer to recursive reader dependency, "X -(ER)-> Y" means
            X -> Y and X is a writer and Y is a recursive reader.
 
-2) -(EN)->: exclusive writer to non-recursive locker dependency, "X -(EN)-> Y" means
+2) -(EN)->:
+           exclusive writer to non-recursive locker dependency, "X -(EN)-> Y" means
            X -> Y and X is a writer and Y is either a writer or non-recursive reader.
 
-3) -(SR)->: shared reader to recursive reader dependency, "X -(SR)-> Y" means
+3) -(SR)->:
+           shared reader to recursive reader dependency, "X -(SR)-> Y" means
            X -> Y and X is a reader (recursive or not) and Y is a recursive reader.
 
-4) -(SN)->: shared reader to non-recursive locker dependency, "X -(SN)-> Y" means
+4) -(SN)->:
+           shared reader to non-recursive locker dependency, "X -(SN)-> Y" means
            X -> Y and X is a reader (recursive or not) and Y is either a writer or
            non-recursive reader.
 
-Note that given two locks, they may have multiple dependencies between them, for example:
+Note that given two locks, they may have multiple dependencies between them,
+for example::
 
        TASK A:
 
@@ -592,11 +603,11 @@ circles that won't cause deadlocks.
 
 Proof for sufficiency (Lemma 1):
 
-Let's say we have a strong circle:
+Let's say we have a strong circle::
 
        L1 -> L2 ... -> Ln -> L1
 
-, which means we have dependencies:
+, which means we have dependencies::
 
        L1 -> L2
        L2 -> L3
@@ -633,7 +644,7 @@ a lock held by P2, and P2 is waiting for a lock held by P3, ... and Pn is waitin
 for a lock held by P1. Let's name the lock Px is waiting as Lx, so since P1 is waiting
 for L1 and holding Ln, so we will have Ln -> L1 in the dependency graph. Similarly,
 we have L1 -> L2, L2 -> L3, ..., Ln-1 -> Ln in the dependency graph, which means we
-have a circle:
+have a circle::
 
        Ln -> L1 -> L2 -> ... -> Ln
 
index 46072ce..64420b3 100644 (file)
@@ -24,7 +24,6 @@ fit into other categories.
    isl29003
    lis3lv02d
    max6875
-   mic/index
    pci-endpoint-test
    spear-pcie-gadget
    uacce
diff --git a/Documentation/misc-devices/mic/index.rst b/Documentation/misc-devices/mic/index.rst
deleted file mode 100644 (file)
index 3a8d063..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-=============================================
-Intel Many Integrated Core (MIC) architecture
-=============================================
-
-.. toctree::
-    :maxdepth: 1
-
-    mic_overview
-    scif_overview
-
-.. only::  subproject and html
-
-   Indices
-   =======
-
-   * :ref:`genindex`
diff --git a/Documentation/misc-devices/mic/mic_overview.rst b/Documentation/misc-devices/mic/mic_overview.rst
deleted file mode 100644 (file)
index 17d956b..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-======================================================
-Intel Many Integrated Core (MIC) architecture overview
-======================================================
-
-An Intel MIC X100 device is a PCIe form factor add-in coprocessor
-card based on the Intel Many Integrated Core (MIC) architecture
-that runs a Linux OS. It is a PCIe endpoint in a platform and therefore
-implements the three required standard address spaces i.e. configuration,
-memory and I/O. The host OS loads a device driver as is typical for
-PCIe devices. The card itself runs a bootstrap after reset that
-transfers control to the card OS downloaded from the host driver. The
-host driver supports OSPM suspend and resume operations. It shuts down
-the card during suspend and reboots the card OS during resume.
-The card OS as shipped by Intel is a Linux kernel with modifications
-for the X100 devices.
-
-Since it is a PCIe card, it does not have the ability to host hardware
-devices for networking, storage and console. We provide these devices
-on X100 coprocessors thus enabling a self-bootable equivalent
-environment for applications. A key benefit of our solution is that it
-leverages the standard virtio framework for network, disk and console
-devices, though in our case the virtio framework is used across a PCIe
-bus. A Virtio Over PCIe (VOP) driver allows creating user space
-backends or devices on the host which are used to probe virtio drivers
-for these devices on the MIC card. The existing VRINGH infrastructure
-in the kernel is used to access virtio rings from the host. The card
-VOP driver allows card virtio drivers to communicate with their user
-space backends on the host via a device page. Ring 3 apps on the host
-can add, remove and configure virtio devices. A thin MIC specific
-virtio_config_ops is implemented which is borrowed heavily from
-previous similar implementations in lguest and s390.
-
-MIC PCIe card has a dma controller with 8 channels. These channels are
-shared between the host s/w and the card s/w. 0 to 3 are used by host
-and 4 to 7 by card. As the dma device doesn't show up as PCIe device,
-a virtual bus called mic bus is created and virtual dma devices are
-created on it by the host/card drivers. On host the channels are private
-and used only by the host driver to transfer data for the virtio devices.
-
-The Symmetric Communication Interface (SCIF (pronounced as skiff)) is a
-low level communications API across PCIe currently implemented for MIC.
-More details are available at scif_overview.txt.
-
-The Coprocessor State Management (COSM) driver on the host allows for
-boot, shutdown and reset of Intel MIC devices. It communicates with a COSM
-"client" driver on the MIC cards over SCIF to perform these functions.
-
-Here is a block diagram of the various components described above. The
-virtio backends are situated on the host rather than the card given better
-single threaded performance for the host compared to MIC, the ability of
-the host to initiate DMA's to/from the card using the MIC DMA engine and
-the fact that the virtio block storage backend can only be on the host::
-
-               +----------+           |             +----------+
-               | Card OS  |           |             | Host OS  |
-               +----------+           |             +----------+
-                                      |
-        +-------+ +--------+ +------+ | +---------+  +--------+ +--------+
-        | Virtio| |Virtio  | |Virtio| | |Virtio   |  |Virtio  | |Virtio  |
-        | Net   | |Console | |Block | | |Net      |  |Console | |Block   |
-        | Driver| |Driver  | |Driver| | |backend  |  |backend | |backend |
-        +---+---+ +---+----+ +--+---+ | +---------+  +----+---+ +--------+
-            |         |         |     |      |            |         |
-            |         |         |     |User  |            |         |
-            |         |         |     |------|------------|--+------|-------
-            +---------+---------+     |Kernel                |
-                      |               |                      |
-  +---------+     +---+----+ +------+ | +------+ +------+ +--+---+  +-------+
-  |MIC DMA  |     |  VOP   | | SCIF | | | SCIF | | COSM | | VOP  |  |MIC DMA|
-  +---+-----+     +---+----+ +--+---+ | +--+---+ +--+---+ +------+  +----+--+
-      |               |         |     |    |        |                    |
-  +---+-----+     +---+----+ +--+---+ | +--+---+ +--+---+ +------+  +----+--+
-  |MIC      |     |  VOP   | |SCIF  | | |SCIF  | | COSM | | VOP  |  | MIC   |
-  |HW Bus   |     |  HW Bus| |HW Bus| | |HW Bus| | Bus  | |HW Bus|  |HW Bus |
-  +---------+     +--------+ +--+---+ | +--+---+ +------+ +------+  +-------+
-      |               |         |     |       |     |                    |
-      |   +-----------+--+      |     |       |    +---------------+     |
-      |   |Intel MIC     |      |     |       |    |Intel MIC      |     |
-      |   |Card Driver   |      |     |       |    |Host Driver    |     |
-      +---+--------------+------+     |       +----+---------------+-----+
-                 |                    |                   |
-             +-------------------------------------------------------------+
-             |                                                             |
-             |                    PCIe Bus                                 |
-             +-------------------------------------------------------------+
diff --git a/Documentation/misc-devices/mic/scif_overview.rst b/Documentation/misc-devices/mic/scif_overview.rst
deleted file mode 100644 (file)
index 4c8ad9e..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-========================================
-Symmetric Communication Interface (SCIF)
-========================================
-
-The Symmetric Communication Interface (SCIF (pronounced as skiff)) is a low
-level communications API across PCIe currently implemented for MIC. Currently
-SCIF provides inter-node communication within a single host platform, where a
-node is a MIC Coprocessor or Xeon based host. SCIF abstracts the details of
-communicating over the PCIe bus while providing an API that is symmetric
-across all the nodes in the PCIe network. An important design objective for SCIF
-is to deliver the maximum possible performance given the communication
-abilities of the hardware. SCIF has been used to implement an offload compiler
-runtime and OFED support for MPI implementations for MIC coprocessors.
-
-SCIF API Components
-===================
-
-The SCIF API has the following parts:
-
-1. Connection establishment using a client server model
-2. Byte stream messaging intended for short messages
-3. Node enumeration to determine online nodes
-4. Poll semantics for detection of incoming connections and messages
-5. Memory registration to pin down pages
-6. Remote memory mapping for low latency CPU accesses via mmap
-7. Remote DMA (RDMA) for high bandwidth DMA transfers
-8. Fence APIs for RDMA synchronization
-
-SCIF exposes the notion of a connection which can be used by peer processes on
-nodes in a SCIF PCIe "network" to share memory "windows" and to communicate. A
-process in a SCIF node initiates a SCIF connection to a peer process on a
-different node via a SCIF "endpoint". SCIF endpoints support messaging APIs
-which are similar to connection oriented socket APIs. Connected SCIF endpoints
-can also register local memory which is followed by data transfer using either
-DMA, CPU copies or remote memory mapping via mmap. SCIF supports both user and
-kernel mode clients which are functionally equivalent.
-
-SCIF Performance for MIC
-========================
-
-DMA bandwidth comparison between the TCP (over ethernet over PCIe) stack versus
-SCIF shows the performance advantages of SCIF for HPC applications and
-runtimes::
-
-             Comparison of TCP and SCIF based BW
-
-  Throughput (GB/sec)
-    8 +                                             PCIe Bandwidth ******
-      +                                                        TCP ######
-    7 +    **************************************             SCIF %%%%%%
-      |                       %%%%%%%%%%%%%%%%%%%
-    6 +                   %%%%
-      |                 %%
-      |               %%%
-    5 +              %%
-      |            %%
-    4 +           %%
-      |          %%
-    3 +         %%
-      |        %
-    2 +      %%
-      |     %%
-      |    %
-    1 +
-      +    ######################################
-    0 +++---+++--+--+-+--+--+-++-+--+-++-+--+-++-+-
-      1       10     100      1000   10000   100000
-                   Transfer Size (KBytes)
-
-SCIF allows memory sharing via mmap(..) between processes on different PCIe
-nodes and thus provides bare-metal PCIe latency. The round trip SCIF mmap
-latency from the host to an x100 MIC for an 8 byte message is 0.44 usecs.
-
-SCIF has a user space library which is a thin IOCTL wrapper providing a user
-space API similar to the kernel API in scif.h. The SCIF user space library
-is distributed @ https://software.intel.com/en-us/mic-developer
-
-Here is some pseudo code for an example of how two applications on two PCIe
-nodes would typically use the SCIF API::
-
-  Process A (on node A)                        Process B (on node B)
-
-  /* get online node information */
-  scif_get_node_ids(..)                        scif_get_node_ids(..)
-  scif_open(..)                                scif_open(..)
-  scif_bind(..)                                scif_bind(..)
-  scif_listen(..)
-  scif_accept(..)                              scif_connect(..)
-  /* SCIF connection established */
-
-  /* Send and receive short messages */
-  scif_send(..)/scif_recv(..)          scif_send(..)/scif_recv(..)
-
-  /* Register memory */
-  scif_register(..)                    scif_register(..)
-
-  /* RDMA */
-  scif_readfrom(..)/scif_writeto(..)   scif_readfrom(..)/scif_writeto(..)
-
-  /* Fence DMAs */
-  scif_fence_signal(..)                        scif_fence_signal(..)
-
-  mmap(..)                             mmap(..)
-
-  /* Access remote registered memory */
-
-  /* Close the endpoints */
-  scif_close(..)                               scif_close(..)
index b165181..a432dc4 100644 (file)
@@ -70,6 +70,7 @@ The ``ice`` driver reports the following versions
         that both the name (as reported by ``fw.app.name``) and version are
         required to uniquely identify the package.
     * - ``fw.app.bundle_id``
+      - running
       - 0xc0000001
       - Unique identifier for the DDP package loaded in the device. Also
         referred to as the DDP Track ID. Can be used to uniquely identify
index 2a266b7..02c2d20 100644 (file)
@@ -46,7 +46,7 @@ Resources
 =========
 
 The ``netdevsim`` driver exposes resources to control the number of FIB
-entries and FIB rule entries that the driver will allow.
+entries, FIB rule entries and nexthops that the driver will allow.
 
 .. code:: shell
 
@@ -54,6 +54,7 @@ entries and FIB rule entries that the driver will allow.
     $ devlink resource set netdevsim/netdevsim0 path /IPv4/fib-rules size 16
     $ devlink resource set netdevsim/netdevsim0 path /IPv6/fib size 64
     $ devlink resource set netdevsim/netdevsim0 path /IPv6/fib-rules size 16
+    $ devlink resource set netdevsim/netdevsim0 path /nexthops size 16
     $ devlink dev reload netdevsim/netdevsim0
 
 Driver-specific Traps
index 63ef386..70c71c9 100644 (file)
@@ -70,6 +70,7 @@ Contents:
    lapb-module
    mac80211-injection
    mpls-sysctl
+   mptcp-sysctl
    multiqueue
    netconsole
    netdev-features
index 25e6673..dd2b12a 100644 (file)
@@ -1554,6 +1554,9 @@ igmpv3_unsolicited_report_interval - INTEGER
 
        Default: 1000 (1 seconds)
 
+ignore_routes_with_linkdown - BOOLEAN
+        Ignore routes whose link is down when performing a FIB lookup.
+
 promote_secondaries - BOOLEAN
        When a primary IP address is removed from this interface
        promote a corresponding secondary IP address instead of
@@ -2642,6 +2645,37 @@ addr_scope_policy - INTEGER
 
        Default: 1
 
+udp_port - INTEGER
+       The listening port for the local UDP tunneling sock. Normally it's
+       using the IANA-assigned UDP port number 9899 (sctp-tunneling).
+
+       This UDP sock is used for processing the incoming UDP-encapsulated
+       SCTP packets (from RFC6951), and shared by all applications in the
+       same net namespace. This UDP sock will be closed when the value is
+       set to 0.
+
+       The value will also be used to set the src port of the UDP header
+       for the outgoing UDP-encapsulated SCTP packets. For the dest port,
+       please refer to 'encap_port' below.
+
+       Default: 0
+
+encap_port - INTEGER
+       The default remote UDP encapsulation port.
+
+       This value is used to set the dest port of the UDP header for the
+       outgoing UDP-encapsulated SCTP packets by default. Users can also
+       change the value for each sock/asoc/transport by using setsockopt.
+       For further information, please refer to RFC6951.
+
+       Note that when connecting to a remote server, the client should set
+       this to the port that the UDP tunneling sock on the peer server is
+       listening to and the local UDP tunneling sock on the client also
+       must be started. On the server, it would get the encap_port from
+       the incoming packet's source port.
+
+       Default: 0
+
 
 ``/proc/sys/net/core/*``
 ========================
index f5be243..0a4b73b 100644 (file)
@@ -10,9 +10,9 @@ Overview / What Is J1939
 SAE J1939 defines a higher layer protocol on CAN. It implements a more
 sophisticated addressing scheme and extends the maximum packet size above 8
 bytes. Several derived specifications exist, which differ from the original
-J1939 on the application level, like MilCAN A, NMEA2000 and especially
+J1939 on the application level, like MilCAN A, NMEA2000, and especially
 ISO-11783 (ISOBUS). This last one specifies the so-called ETP (Extended
-Transport Protocol) which is has been included in this implementation. This
+Transport Protocol), which has been included in this implementation. This
 results in a maximum packet size of ((2 ^ 24) - 1) * 7 bytes == 111 MiB.
 
 Specifications used
@@ -32,15 +32,15 @@ sockets, we found some reasons to justify a kernel implementation for the
 addressing and transport methods used by J1939.
 
 * **Addressing:** when a process on an ECU communicates via J1939, it should
-  not necessarily know its source address. Although at least one process per
+  not necessarily know its source address. Although, at least one process per
   ECU should know the source address. Other processes should be able to reuse
   that address. This way, address parameters for different processes
   cooperating for the same ECU, are not duplicated. This way of working is
-  closely related to the UNIX concept where programs do just one thing, and do
+  closely related to the UNIX concept, where programs do just one thing and do
   it well.
 
 * **Dynamic addressing:** Address Claiming in J1939 is time critical.
-  Furthermore data transport should be handled properly during the address
+  Furthermore, data transport should be handled properly during the address
   negotiation. Putting this functionality in the kernel eliminates it as a
   requirement for _every_ user space process that communicates via J1939. This
   results in a consistent J1939 bus with proper addressing.
@@ -58,7 +58,7 @@ Therefore, these parts are left to user space.
 
 The J1939 sockets operate on CAN network devices (see SocketCAN). Any J1939
 user space library operating on CAN raw sockets will still operate properly.
-Since such library does not communicate with the in-kernel implementation, care
+Since such library does not communicate with the in-kernel implementation, care
 must be taken that these two do not interfere. In practice, this means they
 cannot share ECU addresses. A single ECU (or virtual ECU) address is used by
 the library exclusively, or by the in-kernel system exclusively.
@@ -77,13 +77,13 @@ is composed as follows:
 8 bits : PS (PDU Specific)
 
 In J1939-21 distinction is made between PDU1 format (where PF < 240) and PDU2
-format (where PF >= 240). Furthermore, when using PDU2 format, the PS-field
+format (where PF >= 240). Furthermore, when using the PDU2 format, the PS-field
 contains a so-called Group Extension, which is part of the PGN. When using PDU2
 format, the Group Extension is set in the PS-field.
 
 On the other hand, when using PDU1 format, the PS-field contains a so-called
 Destination Address, which is _not_ part of the PGN. When communicating a PGN
-from user space to kernel (or visa versa) and PDU2 format is used, the PS-field
+from user space to kernel (or vice versa) and PDU2 format is used, the PS-field
 of the PGN shall be set to zero. The Destination Address shall be set
 elsewhere.
 
@@ -96,15 +96,15 @@ Addressing
 
 Both static and dynamic addressing methods can be used.
 
-For static addresses, no extra checks are made by the kernel, and provided
+For static addresses, no extra checks are made by the kernel and provided
 addresses are considered right. This responsibility is for the OEM or system
 integrator.
 
 For dynamic addressing, so-called Address Claiming, extra support is foreseen
-in the kernel. In J1939 any ECU is known by it's 64-bit NAME. At the moment of
+in the kernel. In J1939 any ECU is known by its 64-bit NAME. At the moment of
 a successful address claim, the kernel keeps track of both NAME and source
 address being claimed. This serves as a base for filter schemes. By default,
-packets with a destination that is not locally, will be rejected.
+packets with a destination that is not locally will be rejected.
 
 Mixed mode packets (from a static to a dynamic address or vice versa) are
 allowed. The BSD sockets define separate API calls for getting/setting the
@@ -131,31 +131,31 @@ API Calls
 ---------
 
 On CAN, you first need to open a socket for communicating over a CAN network.
-To use J1939, #include <linux/can/j1939.h>. From there, <linux/can.h> will be
+To use J1939, ``#include <linux/can/j1939.h>``. From there, ``<linux/can.h>`` will be
 included too. To open a socket, use:
 
 .. code-block:: C
 
     s = socket(PF_CAN, SOCK_DGRAM, CAN_J1939);
 
-J1939 does use SOCK_DGRAM sockets. In the J1939 specification, connections are
+J1939 does use ``SOCK_DGRAM`` sockets. In the J1939 specification, connections are
 mentioned in the context of transport protocol sessions. These still deliver
-packets to the other end (using several CAN packets). SOCK_STREAM is not
+packets to the other end (using several CAN packets). ``SOCK_STREAM`` is not
 supported.
 
-After the successful creation of the socket, you would normally use the bind(2)
-and/or connect(2) system call to bind the socket to a CAN interface.  After
-binding and/or connecting the socket, you can read(2) and write(2) from/to the
-socket or use send(2), sendto(2), sendmsg(2) and the recv*() counterpart
+After the successful creation of the socket, you would normally use the ``bind(2)``
+and/or ``connect(2)`` system call to bind the socket to a CAN interface. After
+binding and/or connecting the socket, you can ``read(2)`` and ``write(2)`` from/to the
+socket or use ``send(2)``, ``sendto(2)``, ``sendmsg(2)`` and the ``recv*()`` counterpart
 operations on the socket as usual. There are also J1939 specific socket options
 described below.
 
-In order to send data, a bind(2) must have been successful. bind(2) assigns a
+In order to send data, a ``bind(2)`` must have been successful. ``bind(2)`` assigns a
 local address to a socket.
 
-Different from CAN is that the payload data is just the data that get send,
-without it's header info. The header info is derived from the sockaddr supplied
-to bind(2), connect(2), sendto(2) and recvfrom(2). A write(2) with size 4 will
+Different from CAN is that the payload data is just the data that get sends,
+without its header info. The header info is derived from the sockaddr supplied
+to ``bind(2)``, ``connect(2)``, ``sendto(2)`` and ``recvfrom(2)``. A ``write(2)`` with size 4 will
 result in a packet with 4 bytes.
 
 The sockaddr structure has extensions for use with J1939 as specified below:
@@ -180,47 +180,47 @@ The sockaddr structure has extensions for use with J1939 as specified below:
          } can_addr;
       }
 
-can_family & can_ifindex serve the same purpose as for other SocketCAN sockets.
+``can_family`` & ``can_ifindex`` serve the same purpose as for other SocketCAN sockets.
 
-can_addr.j1939.pgn specifies the PGN (max 0x3ffff). Individual bits are
+``can_addr.j1939.pgn`` specifies the PGN (max 0x3ffff). Individual bits are
 specified above.
 
-can_addr.j1939.name contains the 64-bit J1939 NAME.
+``can_addr.j1939.name`` contains the 64-bit J1939 NAME.
 
-can_addr.j1939.addr contains the address.
+``can_addr.j1939.addr`` contains the address.
 
-The bind(2) system call assigns the local address, i.e. the source address when
-sending packages. If a PGN during bind(2) is set, it's used as a RX filter.
-I.e.  only packets with a matching PGN are received. If an ADDR or NAME is set
+The ``bind(2)`` system call assigns the local address, i.e. the source address when
+sending packages. If a PGN during ``bind(2)`` is set, it's used as a RX filter.
+I.e. only packets with a matching PGN are received. If an ADDR or NAME is set
 it is used as a receive filter, too. It will match the destination NAME or ADDR
 of the incoming packet. The NAME filter will work only if appropriate Address
 Claiming for this name was done on the CAN bus and registered/cached by the
 kernel.
 
-On the other hand connect(2) assigns the remote address, i.e. the destination
-address. The PGN from connect(2) is used as the default PGN when sending
+On the other hand ``connect(2)`` assigns the remote address, i.e. the destination
+address. The PGN from ``connect(2)`` is used as the default PGN when sending
 packets. If ADDR or NAME is set it will be used as the default destination ADDR
-or NAME. Further a set ADDR or NAME during connect(2) is used as a receive
+or NAME. Further a set ADDR or NAME during ``connect(2)`` is used as a receive
 filter. It will match the source NAME or ADDR of the incoming packet.
 
-Both write(2) and send(2) will send a packet with local address from bind(2) and
-the remote address from connect(2). Use sendto(2) to overwrite the destination
+Both ``write(2)`` and ``send(2)`` will send a packet with local address from ``bind(2)`` and the
+remote address from ``connect(2)``. Use ``sendto(2)`` to overwrite the destination
 address.
 
-If can_addr.j1939.name is set (!= 0) the NAME is looked up by the kernel and
-the corresponding ADDR is used. If can_addr.j1939.name is not set (== 0),
-can_addr.j1939.addr is used.
+If ``can_addr.j1939.name`` is set (!= 0) the NAME is looked up by the kernel and
+the corresponding ADDR is used. If ``can_addr.j1939.name`` is not set (== 0),
+``can_addr.j1939.addr`` is used.
 
 When creating a socket, reasonable defaults are set. Some options can be
-modified with setsockopt(2) & getsockopt(2).
+modified with ``setsockopt(2)`` & ``getsockopt(2)``.
 
 RX path related options:
 
-- SO_J1939_FILTER - configure array of filters
-- SO_J1939_PROMISC - disable filters set by bind(2) and connect(2)
+- ``SO_J1939_FILTER`` - configure array of filters
+- ``SO_J1939_PROMISC`` - disable filters set by ``bind(2)`` and ``connect(2)``
 
 By default no broadcast packets can be send or received. To enable sending or
-receiving broadcast packets use the socket option SO_BROADCAST:
+receiving broadcast packets use the socket option ``SO_BROADCAST``:
 
 .. code-block:: C
 
@@ -261,26 +261,26 @@ The following diagram illustrates the RX path:
      +---------------------------+
 
 TX path related options:
-SO_J1939_SEND_PRIO - change default send priority for the socket
+``SO_J1939_SEND_PRIO`` - change default send priority for the socket
 
 Message Flags during send() and Related System Calls
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-send(2), sendto(2) and sendmsg(2) take a 'flags' argument. Currently
+``send(2)``, ``sendto(2)`` and ``sendmsg(2)`` take a 'flags' argument. Currently
 supported flags are:
 
-* MSG_DONTWAIT, i.e. non-blocking operation.
+* ``MSG_DONTWAIT``, i.e. non-blocking operation.
 
 recvmsg(2)
 ^^^^^^^^^^
 
-In most cases recvmsg(2) is needed if you want to extract more information than
-recvfrom(2) can provide. For example package priority and timestamp. The
+In most cases ``recvmsg(2)`` is needed if you want to extract more information than
+``recvfrom(2)`` can provide. For example package priority and timestamp. The
 Destination Address, name and packet priority (if applicable) are attached to
-the msghdr in the recvmsg(2) call. They can be extracted using cmsg(3) macros,
-with cmsg_level == SOL_J1939 && cmsg_type == SCM_J1939_DEST_ADDR,
-SCM_J1939_DEST_NAME or SCM_J1939_PRIO. The returned data is a uint8_t for
-priority and dst_addr, and uint64_t for dst_name.
+the msghdr in the ``recvmsg(2)`` call. They can be extracted using ``cmsg(3)`` macros,
+with ``cmsg_level == SOL_J1939 && cmsg_type == SCM_J1939_DEST_ADDR``,
+``SCM_J1939_DEST_NAME`` or ``SCM_J1939_PRIO``. The returned data is a ``uint8_t`` for
+``priority`` and ``dst_addr``, and ``uint64_t`` for ``dst_name``.
 
 .. code-block:: C
 
@@ -305,12 +305,12 @@ Dynamic Addressing
 
 Distinction has to be made between using the claimed address and doing an
 address claim. To use an already claimed address, one has to fill in the
-j1939.name member and provide it to bind(2). If the name had claimed an address
+``j1939.name`` member and provide it to ``bind(2)``. If the name had claimed an address
 earlier, all further messages being sent will use that address. And the
-j1939.addr member will be ignored.
+``j1939.addr`` member will be ignored.
 
 An exception on this is PGN 0x0ee00. This is the "Address Claim/Cannot Claim
-Address" message and the kernel will use the j1939.addr member for that PGN if
+Address" message and the kernel will use the ``j1939.addr`` member for that PGN if
 necessary.
 
 To claim an address following code example can be used:
@@ -371,12 +371,12 @@ NAME can send packets.
 
 If another ECU claims the address, the kernel will mark the NAME-SA expired.
 No socket bound to the NAME can send packets (other than address claims). To
-claim another address, some socket bound to NAME, must bind(2) again, but with
-only j1939.addr changed to the new SA, and must then send a valid address claim
+claim another address, some socket bound to NAME, must ``bind(2)`` again, but with
+only ``j1939.addr`` changed to the new SA, and must then send a valid address claim
 packet. This restarts the state machine in the kernel (and any other
 participant on the bus) for this NAME.
 
-can-utils also include the jacd tool, so it can be used as code example or as
+``can-utils`` also include the ``j1939acd`` tool, so it can be used as code example or as
 default Address Claiming daemon.
 
 Send Examples
@@ -403,8 +403,8 @@ Bind:
 
        bind(sock, (struct sockaddr *)&baddr, sizeof(baddr));
 
-Now, the socket 'sock' is bound to the SA 0x20. Since no connect(2) was called,
-at this point we can use only sendto(2) or sendmsg(2).
+Now, the socket 'sock' is bound to the SA 0x20. Since no ``connect(2)`` was called,
+at this point we can use only ``sendto(2)`` or ``sendmsg(2)``.
 
 Send:
 
@@ -414,8 +414,8 @@ Send:
                .can_family = AF_CAN,
                .can_addr.j1939 = {
                        .name = J1939_NO_NAME;
-                       .pgn = 0x30,
-                       .addr = 0x12300,
+                       .addr = 0x30,
+                       .pgn = 0x12300,
                },
        };
 
index d198fa5..ea55f46 100644 (file)
@@ -83,27 +83,6 @@ SUN RPC subsystem
 .. kernel-doc:: net/sunrpc/clnt.c
    :export:
 
-WiMAX
------
-
-.. kernel-doc:: net/wimax/op-msg.c
-   :export:
-
-.. kernel-doc:: net/wimax/op-reset.c
-   :export:
-
-.. kernel-doc:: net/wimax/op-rfkill.c
-   :export:
-
-.. kernel-doc:: net/wimax/stack.c
-   :export:
-
-.. kernel-doc:: include/net/wimax.h
-   :internal:
-
-.. kernel-doc:: include/uapi/linux/wimax.h
-   :internal:
-
 Network device support
 ======================
 
diff --git a/Documentation/networking/mptcp-sysctl.rst b/Documentation/networking/mptcp-sysctl.rst
new file mode 100644 (file)
index 0000000..6af0196
--- /dev/null
@@ -0,0 +1,26 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+=====================
+MPTCP Sysfs variables
+=====================
+
+/proc/sys/net/mptcp/* Variables
+===============================
+
+enabled - INTEGER
+       Control whether MPTCP sockets can be created.
+
+       MPTCP sockets can be created if the value is nonzero. This is
+       a per-namespace sysctl.
+
+       Default: 1
+
+add_addr_timeout - INTEGER (seconds)
+       Set the timeout after which an ADD_ADDR control message will be
+       resent to an MPTCP peer that has not acknowledged a previous
+       ADD_ADDR message.
+
+       The default value matches TCP_RTO_MAX. This is a per-namespace
+       sysctl.
+
+       Default: 120
index d5c9320..2153776 100644 (file)
@@ -110,7 +110,7 @@ Q: I sent a patch and I'm wondering what happened to it?
 Q: How can I tell whether it got merged?
 A: Start by looking at the main patchworks queue for netdev:
 
-  http://patchwork.ozlabs.org/project/netdev/list/
+  https://patchwork.kernel.org/project/netdevbpf/list/
 
 The "State" field will tell you exactly where things are at with your
 patch.
@@ -152,7 +152,7 @@ networking subsystem, and then hands them off to Greg.
 
 There is a patchworks queue that you can see here:
 
-  http://patchwork.ozlabs.org/bundle/davem/stable/?state=*
+  https://patchwork.kernel.org/bundle/netdev/stable/?state=*
 
 It contains the patches which Dave has selected, but not yet handed off
 to Greg.  If Greg already has the patch, then it will be here:
index 2561060..b2f7ec7 100644 (file)
@@ -247,8 +247,8 @@ Some of the interface modes are described below:
     speeds (see below.)
 
 ``PHY_INTERFACE_MODE_2500BASEX``
-    This defines a variant of 1000BASE-X which is clocked 2.5 times faster,
-    than the 802.3 standard giving a fixed bit rate of 3.125Gbaud.
+    This defines a variant of 1000BASE-X which is clocked 2.5 times as fast
+    as the 802.3 standard, giving a fixed bit rate of 3.125Gbaud.
 
 ``PHY_INTERFACE_MODE_SGMII``
     This is used for Cisco SGMII, which is a modification of 1000BASE-X
index 8e15bc9..234abed 100644 (file)
@@ -175,5 +175,4 @@ The following structures are internal to the kernel, their members are
 translated to netlink attributes when dumped. Drivers must not overwrite
 the statistics they don't report with 0.
 
-.. kernel-doc:: include/linux/ethtool.h
-    :identifiers: ethtool_pause_stats
+- ethtool_pause_stats()
index ff71d80..9d83b8d 100644 (file)
@@ -106,23 +106,29 @@ NUL or newline terminated.
 
 strcpy()
 --------
-strcpy() performs no bounds checking on the destination
-buffer. This could result in linear overflows beyond the
-end of the buffer, leading to all kinds of misbehaviors. While
-`CONFIG_FORTIFY_SOURCE=y` and various compiler flags help reduce the
-risk of using this function, there is no good reason to add new uses of
-this function. The safe replacement is strscpy().
+strcpy() performs no bounds checking on the destination buffer. This
+could result in linear overflows beyond the end of the buffer, leading to
+all kinds of misbehaviors. While `CONFIG_FORTIFY_SOURCE=y` and various
+compiler flags help reduce the risk of using this function, there is
+no good reason to add new uses of this function. The safe replacement
+is strscpy(), though care must be given to any cases where the return
+value of strcpy() was used, since strscpy() does not return a pointer to
+the destination, but rather a count of non-NUL bytes copied (or negative
+errno when it truncates).
 
 strncpy() on NUL-terminated strings
 -----------------------------------
-Use of strncpy() does not guarantee that the destination buffer
-will be NUL terminated. This can lead to various linear read overflows
-and other misbehavior due to the missing termination. It also NUL-pads the
-destination buffer if the source contents are shorter than the destination
-buffer size, which may be a needless performance penalty for callers using
-only NUL-terminated strings. The safe replacement is strscpy().
-(Users of strscpy() still needing NUL-padding should instead
-use strscpy_pad().)
+Use of strncpy() does not guarantee that the destination buffer will
+be NUL terminated. This can lead to various linear read overflows and
+other misbehavior due to the missing termination. It also NUL-pads
+the destination buffer if the source contents are shorter than the
+destination buffer size, which may be a needless performance penalty
+for callers using only NUL-terminated strings. The safe replacement is
+strscpy(), though care must be given to any cases where the return value
+of strncpy() was used, since strscpy() does not return a pointer to the
+destination, but rather a count of non-NUL bytes copied (or negative
+errno when it truncates). Any cases still needing NUL-padding should
+instead use strscpy_pad().
 
 If a caller is using non-NUL-terminated strings, strncpy() can
 still be used, but destinations should be marked with the `__nonstring
@@ -131,10 +137,12 @@ attribute to avoid future compiler warnings.
 
 strlcpy()
 ---------
-strlcpy() reads the entire source buffer first, possibly exceeding
-the given limit of bytes to copy. This is inefficient and can lead to
-linear read overflows if a source string is not NUL-terminated. The
-safe replacement is strscpy().
+strlcpy() reads the entire source buffer first (since the return value
+is meant to match that of strlen()). This read may exceed the destination
+size limit. This is both inefficient and can lead to linear read overflows
+if a source string is not NUL-terminated. The safe replacement is strscpy(),
+though care must be given to any cases where the return value of strlcpy()
+is used, since strscpy() will return negative errno values when it truncates.
 
 %p format specifier
 -------------------
index eee9b44..e02ff5f 100644 (file)
@@ -84,7 +84,6 @@ PPP_MAGIC             0x5002           ppp                      ``include/linux/
 SSTATE_MAGIC          0x5302           serial_state             ``include/linux/serial.h``
 SLIP_MAGIC            0x5302           slip                     ``drivers/net/slip.h``
 STRIP_MAGIC           0x5303           strip                    ``drivers/net/strip.c``
-X25_ASY_MAGIC         0x5303           x25_asy                  ``drivers/net/x25_asy.h``
 SIXPACK_MAGIC         0x5304           sixpack                  ``drivers/net/hamradio/6pack.h``
 AX25_MAGIC            0x5316           ax_disp                  ``drivers/net/mkiss.h``
 TTY_MAGIC             0x5401           tty_struct               ``include/linux/tty.h``
index 06f743b..3973556 100644 (file)
@@ -39,7 +39,7 @@ Procedure for submitting patches to the -stable tree
    submission guidelines as described in
    :ref:`Documentation/networking/netdev-FAQ.rst <netdev-FAQ>`
    after first checking the stable networking queue at
-   https://patchwork.ozlabs.org/bundle/davem/stable/?series=&submitter=&state=*&q=&archive=
+   https://patchwork.kernel.org/bundle/netdev/stable/?state=*
    to ensure the requested patch is not already queued up.
  - Security patches should not be handled (solely) by the -stable review
    process but should follow the procedures in
index 58586ff..83d9a82 100644 (file)
@@ -527,6 +527,13 @@ done on the patch.  Reviewed-by: tags, when supplied by reviewers known to
 understand the subject area and to perform thorough reviews, will normally
 increase the likelihood of your patch getting into the kernel.
 
+Both Tested-by and Reviewed-by tags, once received on mailing list from tester
+or reviewer, should be added by author to the applicable patches when sending
+next versions.  However if the patch has changed substantially in following
+version, these tags might not be applicable anymore and thus should be removed.
+Usually removal of someone's Tested-by or Reviewed-by tags should be mentioned
+in the patch changelog (after the '---' separator).
+
 A Suggested-by: tag indicates that the patch idea is suggested by the person
 named and ensures credit to the person for the idea. Please note that this
 tag should not be added without the reporter's permission, especially if the
index 409dbc4..3e81eba 100644 (file)
@@ -16,28 +16,36 @@ import re
 from itertools import chain
 
 #
+# Python 2 lacks re.ASCII...
+#
+try:
+    ascii_p3 = re.ASCII
+except AttributeError:
+    ascii_p3 = 0
+
+#
 # Regex nastiness.  Of course.
 # Try to identify "function()" that's not already marked up some
 # other way.  Sphinx doesn't like a lot of stuff right after a
 # :c:func: block (i.e. ":c:func:`mmap()`s" flakes out), so the last
 # bit tries to restrict matches to things that won't create trouble.
 #
-RE_function = re.compile(r'\b(([a-zA-Z_]\w+)\(\))', flags=re.ASCII)
+RE_function = re.compile(r'\b(([a-zA-Z_]\w+)\(\))', flags=ascii_p3)
 
 #
 # Sphinx 2 uses the same :c:type role for struct, union, enum and typedef
 #
 RE_generic_type = re.compile(r'\b(struct|union|enum|typedef)\s+([a-zA-Z_]\w+)',
-                             flags=re.ASCII)
+                             flags=ascii_p3)
 
 #
 # Sphinx 3 uses a different C role for each one of struct, union, enum and
 # typedef
 #
-RE_struct = re.compile(r'\b(struct)\s+([a-zA-Z_]\w+)', flags=re.ASCII)
-RE_union = re.compile(r'\b(union)\s+([a-zA-Z_]\w+)', flags=re.ASCII)
-RE_enum = re.compile(r'\b(enum)\s+([a-zA-Z_]\w+)', flags=re.ASCII)
-RE_typedef = re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)', flags=re.ASCII)
+RE_struct = re.compile(r'\b(struct)\s+([a-zA-Z_]\w+)', flags=ascii_p3)
+RE_union = re.compile(r'\b(union)\s+([a-zA-Z_]\w+)', flags=ascii_p3)
+RE_enum = re.compile(r'\b(enum)\s+([a-zA-Z_]\w+)', flags=ascii_p3)
+RE_typedef = re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)', flags=ascii_p3)
 
 #
 # Detects a reference to a documentation page of the form Documentation/... with
diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kernel_abi.py
new file mode 100644 (file)
index 0000000..f3da859
--- /dev/null
@@ -0,0 +1,194 @@
+# -*- coding: utf-8; mode: python -*-
+# coding=utf-8
+# SPDX-License-Identifier: GPL-2.0
+#
+u"""
+    kernel-abi
+    ~~~~~~~~~~
+
+    Implementation of the ``kernel-abi`` reST-directive.
+
+    :copyright:  Copyright (C) 2016  Markus Heiser
+    :copyright:  Copyright (C) 2016-2020  Mauro Carvalho Chehab
+    :maintained-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+    :license:    GPL Version 2, June 1991 see Linux/COPYING for details.
+
+    The ``kernel-abi`` (:py:class:`KernelCmd`) directive calls the
+    scripts/get_abi.pl script to parse the Kernel ABI files.
+
+    Overview of directive's argument and options.
+
+    .. code-block:: rst
+
+        .. kernel-abi:: <ABI directory location>
+            :debug:
+
+    The argument ``<ABI directory location>`` is required. It contains the
+    location of the ABI files to be parsed.
+
+    ``debug``
+      Inserts a code-block with the *raw* reST. Sometimes it is helpful to see
+      what reST is generated.
+
+"""
+
+import codecs
+import os
+import subprocess
+import sys
+import re
+import kernellog
+
+from os import path
+
+from docutils import nodes, statemachine
+from docutils.statemachine import ViewList
+from docutils.parsers.rst import directives, Directive
+from docutils.utils.error_reporting import ErrorString
+
+#
+# AutodocReporter is only good up to Sphinx 1.7
+#
+import sphinx
+
+Use_SSI = sphinx.__version__[:3] >= '1.7'
+if Use_SSI:
+    from sphinx.util.docutils import switch_source_input
+else:
+    from sphinx.ext.autodoc import AutodocReporter
+
+__version__  = '1.0'
+
+def setup(app):
+
+    app.add_directive("kernel-abi", KernelCmd)
+    return dict(
+        version = __version__
+        , parallel_read_safe = True
+        , parallel_write_safe = True
+    )
+
+class KernelCmd(Directive):
+
+    u"""KernelABI (``kernel-abi``) directive"""
+
+    required_arguments = 1
+    optional_arguments = 2
+    has_content = False
+    final_argument_whitespace = True
+
+    option_spec = {
+        "debug"     : directives.flag,
+        "rst"       : directives.unchanged
+    }
+
+    def run(self):
+
+        doc = self.state.document
+        if not doc.settings.file_insertion_enabled:
+            raise self.warning("docutils: file insertion disabled")
+
+        env = doc.settings.env
+        cwd = path.dirname(doc.current_source)
+        cmd = "get_abi.pl rest --enable-lineno --dir "
+        cmd += self.arguments[0]
+
+        if 'rst' in self.options:
+            cmd += " --rst-source"
+
+        srctree = path.abspath(os.environ["srctree"])
+
+        fname = cmd
+
+        # extend PATH with $(srctree)/scripts
+        path_env = os.pathsep.join([
+            srctree + os.sep + "scripts",
+            os.environ["PATH"]
+        ])
+        shell_env = os.environ.copy()
+        shell_env["PATH"]    = path_env
+        shell_env["srctree"] = srctree
+
+        lines = self.runCmd(cmd, shell=True, cwd=cwd, env=shell_env)
+        nodeList = self.nestedParse(lines, self.arguments[0])
+        return nodeList
+
+    def runCmd(self, cmd, **kwargs):
+        u"""Run command ``cmd`` and return it's stdout as unicode."""
+
+        try:
+            proc = subprocess.Popen(
+                cmd
+                , stdout = subprocess.PIPE
+                , stderr = subprocess.PIPE
+                , **kwargs
+            )
+            out, err = proc.communicate()
+
+            out, err = codecs.decode(out, 'utf-8'), codecs.decode(err, 'utf-8')
+
+            if proc.returncode != 0:
+                raise self.severe(
+                    u"command '%s' failed with return code %d"
+                    % (cmd, proc.returncode)
+                )
+        except OSError as exc:
+            raise self.severe(u"problems with '%s' directive: %s."
+                              % (self.name, ErrorString(exc)))
+        return out
+
+    def nestedParse(self, lines, fname):
+        content = ViewList()
+        node = nodes.section()
+
+        if "debug" in self.options:
+            code_block = "\n\n.. code-block:: rst\n    :linenos:\n"
+            for l in lines.split("\n"):
+                code_block += "\n    " + l
+            lines = code_block + "\n\n"
+
+        line_regex = re.compile("^#define LINENO (\S+)\#([0-9]+)$")
+        ln = 0
+        n = 0
+        f = fname
+
+        for line in lines.split("\n"):
+            n = n + 1
+            match = line_regex.search(line)
+            if match:
+                new_f = match.group(1)
+
+                # Sphinx parser is lazy: it stops parsing contents in the
+                # middle, if it is too big. So, handle it per input file
+                if new_f != f and content:
+                    self.do_parse(content, node)
+                    content = ViewList()
+
+                f = new_f
+
+                # sphinx counts lines from 0
+                ln = int(match.group(2)) - 1
+            else:
+                content.append(line, f, ln)
+
+        kernellog.info(self.state.document.settings.env.app, "%s: parsed %i lines" % (fname, n))
+
+        if content:
+            self.do_parse(content, node)
+
+        return node.children
+
+    def do_parse(self, content, node):
+        if Use_SSI:
+            with switch_source_input(self.state, content):
+                self.state.nested_parse(content, 0, node, match_titles=1)
+        else:
+            buf  = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter
+
+            self.state.memo.title_styles  = []
+            self.state.memo.section_level = 0
+            self.state.memo.reporter      = AutodocReporter(content, self.state.memo.reporter)
+            try:
+                self.state.nested_parse(content, 0, node, match_titles=1)
+            finally:
+                self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = buf
index af924f5..8ac7d27 100644 (file)
@@ -25,4 +25,8 @@ def verbose(app, message):
     else:
         app.verbose(message)
 
-
+def info(app, message):
+    if UseLogging:
+        logger.info(message)
+    else:
+        app.info(message)
index 783e0de..0243d32 100644 (file)
@@ -90,7 +90,6 @@ PPP_MAGIC             0x5002           ppp                      ``include/linux/
 SSTATE_MAGIC          0x5302           serial_state             ``include/linux/serial.h``
 SLIP_MAGIC            0x5302           slip                     ``drivers/net/slip.h``
 STRIP_MAGIC           0x5303           strip                    ``drivers/net/strip.c``
-X25_ASY_MAGIC         0x5303           x25_asy                  ``drivers/net/x25_asy.h``
 SIXPACK_MAGIC         0x5304           sixpack                  ``drivers/net/hamradio/6pack.h``
 AX25_MAGIC            0x5316           ax_disp                  ``drivers/net/mkiss.h``
 TTY_MAGIC             0x5401           tty_struct               ``include/linux/tty.h``
index 4f206ce..283d625 100644 (file)
@@ -46,7 +46,7 @@ Procedura per sottomettere patch per i sorgenti -stable
    :ref:`Documentation/translations/it_IT/networking/netdev-FAQ.rst <it_netdev-FAQ>`;
    ma solo dopo aver verificato al seguente indirizzo che la patch non sia
    già in coda:
-   https://patchwork.ozlabs.org/bundle/davem/stable/?series=&submitter=&state=*&q=&archive=
+   https://patchwork.kernel.org/bundle/netdev/stable/?state=*
  - Una patch di sicurezza non dovrebbero essere gestite (solamente) dal processo
    di revisione -stable, ma dovrebbe seguire le procedure descritte in
    :ref:`Documentation/translations/it_IT/admin-guide/security-bugs.rst <it_securitybugs>`.
index ed5ab7e..48bbd3e 100644 (file)
@@ -114,7 +114,6 @@ Todolist:
    unicode
    vga-softcursor
    video-output
-   wimax/index
    xfs
 
 .. only::  subproject and html
diff --git a/Documentation/translations/zh_CN/arm64/hugetlbpage.rst b/Documentation/translations/zh_CN/arm64/hugetlbpage.rst
new file mode 100644 (file)
index 0000000..13304d2
--- /dev/null
@@ -0,0 +1,45 @@
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :ref:`Documentation/arm64/hugetlbpage.rst <hugetlbpage_index>`
+
+Translator: Bailu Lin <bailu.lin@vivo.com>
+
+=====================
+ARM64中的 HugeTLBpage
+=====================
+
+大页依靠有效利用 TLBs 来提高地址翻译的性能。这取决于以下
+两点 -
+
+  - 大页的大小
+  - TLBs 支持的条目大小
+
+ARM64 接口支持2种大页方式。
+
+1) pud/pmd 级别的块映射
+-----------------------
+
+这是常规大页,他们的 pmd 或 pud 页面表条目指向一个内存块。
+不管 TLB 中支持的条目大小如何,块映射可以减少翻译大页地址
+所需遍历的页表深度。
+
+2) 使用连续位
+-------------
+
+架构中转换页表条目(D4.5.3, ARM DDI 0487C.a)中提供一个连续
+位告诉 MMU 这个条目是一个连续条目集的一员,它可以被缓存在单
+个 TLB 条目中。
+
+在 Linux 中连续位用来增加 pmd 和 pte(最后一级)级别映射的大
+小。受支持的连续页表条目数量因页面大小和页表级别而异。
+
+
+支持以下大页尺寸配置 -
+
+  ====== ========   ====    ========    ===
+  -      CONT PTE    PMD    CONT PMD    PUD
+  ====== ========   ====    ========    ===
+  4K:         64K     2M         32M     1G
+  16K:         2M    32M          1G
+  64K:         2M   512M         16G
+  ====== ========   ====    ========    ===
index e4c2259..de182bf 100644 (file)
@@ -73,7 +73,6 @@ PPP_MAGIC             0x5002           ppp                      ``include/linux/
 SSTATE_MAGIC          0x5302           serial_state             ``include/linux/serial.h``
 SLIP_MAGIC            0x5302           slip                     ``drivers/net/slip.h``
 STRIP_MAGIC           0x5303           strip                    ``drivers/net/strip.c``
-X25_ASY_MAGIC         0x5303           x25_asy                  ``drivers/net/x25_asy.h``
 SIXPACK_MAGIC         0x5304           sixpack                  ``drivers/net/hamradio/6pack.h``
 AX25_MAGIC            0x5316           ax_disp                  ``drivers/net/mkiss.h``
 TTY_MAGIC             0x5401           tty_struct               ``include/linux/tty.h``
index 69fc516..acd2cc2 100644 (file)
@@ -22,6 +22,7 @@ place where this information is gathered.
    spec_ctrl
    accelerators/ocxl
    ioctl/index
+   iommu
    media/index
 
 .. only::  subproject and html
index 36d5f1f..e00a66d 100644 (file)
@@ -6367,7 +6367,7 @@ accesses that would usually trigger a #GP by KVM into the guest will
 instead get bounced to user space through the KVM_EXIT_X86_RDMSR and
 KVM_EXIT_X86_WRMSR exit notifications.
 
-8.25 KVM_X86_SET_MSR_FILTER
+8.27 KVM_X86_SET_MSR_FILTER
 ---------------------------
 
 :Architectures: x86
@@ -6381,8 +6381,7 @@ In combination with KVM_CAP_X86_USER_SPACE_MSR, this allows user space to
 trap and emulate MSRs that are outside of the scope of KVM as well as
 limit the attack surface on KVM's MSR emulation code.
 
-
-8.26 KVM_CAP_ENFORCE_PV_CPUID
+8.28 KVM_CAP_ENFORCE_PV_CPUID
 -----------------------------
 
 Architectures: x86
index 7d81c0a..cf62162 100644 (file)
@@ -92,6 +92,10 @@ KVM_FEATURE_ASYNC_PF_INT           14          guest checks this feature bit
                                                async pf acknowledgment msr
                                                0x4b564d07.
 
+KVM_FEATURE_MSI_EXT_DEST_ID        15          guest checks this feature bit
+                                               before using extended destination
+                                               ID bits in MSI address bits 11-5.
+
 KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24          host will warn if no guest-side
                                                per-cpu warps are expected in
                                                kvmclock
index 47baa1c..df5d777 100644 (file)
@@ -89,7 +89,7 @@ they are write protected for COW (other case of B apply too).
 
 So here because at time N+2 the clear page table entry was not pair with a
 notification to invalidate the secondary TLB, the device see the new value for
-addrB before seing the new value for addrA. This break total memory ordering
+addrB before seeing the new value for addrA. This break total memory ordering
 for the device.
 
 When changing a pte to write protect or to point to a new write protected page
index 91a98a6..db9d7e5 100644 (file)
@@ -99,7 +99,7 @@ Steps:
 2. Ensure that writeback is complete.
 
 3. Lock the new page that we want to move to. It is locked so that accesses to
-   this (not yet uptodate) page immediately block while the move is in progress.
+   this (not yet up-to-date) page immediately block while the move is in progress.
 
 4. All the page table references to the page are converted to migration
    entries. This decreases the mapcount of a page. If the resulting
index 079f3f8..02deac7 100644 (file)
@@ -18,7 +18,7 @@ Although we already have tracepoint for tracing page allocation/free,
 using it for analyzing who allocate each page is rather complex. We need
 to enlarge the trace buffer for preventing overlapping until userspace
 program launched. And, launched program continually dump out the trace
-buffer for later analysis and it would change system behviour with more
+buffer for later analysis and it would change system behaviour with more
 possibility rather than just keeping it in memory, so bad for debugging.
 
 page owner can also be used for various purposes. For example, accurate
index 289d231..03f294a 100644 (file)
@@ -378,7 +378,7 @@ c) Execute ``slabinfo-gnuplot.sh`` in '-t' mode, passing all of the
    can go unnoticed. To deal with that, ``slabinfo-gnuplot.sh`` has two
    options to 'zoom-in'/'zoom-out':
 
-   a) ``-s %d,%d`` -- overwrites the default image width and heigh
+   a) ``-s %d,%d`` -- overwrites the default image width and height
    b) ``-r %d,%d`` -- specifies a range of samples to use (for example,
       in ``slabinfo -X >> FOO_STATS; sleep 1;`` case, using a ``-r
       40,60`` range will plot only samples collected between 40th and
index e505340..ede1875 100644 (file)
@@ -19,7 +19,7 @@ Complete virtual memory map with 4-level page tables
    Note that as we get closer to the top of the address space, the notation changes
    from TB to GB and then MB/KB.
 
- - "16M TB" might look weird at first sight, but it's an easier to visualize size
+ - "16M TB" might look weird at first sight, but it's an easier way to visualize size
    notation than "16 EB", which few will recognize at first sight as 16 exabytes.
    It also shows it nicely how incredibly large 64-bit address space is.
 
index f281f80..af9f6a3 100644 (file)
@@ -934,7 +934,7 @@ M:  Evan Quan <evan.quan@amd.com>
 L:     amd-gfx@lists.freedesktop.org
 S:     Supported
 T:     git git://people.freedesktop.org/~agd5f/linux
-F:     drivers/gpu/drm/amd/powerplay/
+F:     drivers/gpu/drm/amd/pm/powerplay/
 
 AMD SEATTLE DEVICE TREE SUPPORT
 M:     Brijesh Singh <brijeshkumar.singh@amd.com>
@@ -978,7 +978,7 @@ M:  Michael Hennerich <Michael.Hennerich@analog.com>
 L:     linux-iio@vger.kernel.org
 S:     Supported
 W:     http://ez.analog.com/community/linux-device-drivers
-F:     Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.txt
+F:     Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
 F:     drivers/iio/adc/ad7768-1.c
 
 ANALOG DEVICES INC AD7780 DRIVER
@@ -1279,7 +1279,7 @@ M:        Igor Russkikh <irusskikh@marvell.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 W:     https://www.marvell.com/
-Q:     http://patchwork.ozlabs.org/project/netdev/list/
+Q:     https://patchwork.kernel.org/project/netdevbpf/list/
 F:     Documentation/networking/device_drivers/ethernet/aquantia/atlantic.rst
 F:     drivers/net/ethernet/aquantia/atlantic/
 
@@ -2115,6 +2115,7 @@ M:        Steen Hegelund <Steen.Hegelund@microchip.com>
 M:     Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Supported
+T:     git git://github.com/microchip-ung/linux-upstream.git
 F:     arch/arm64/boot/dts/microchip/
 N:     sparx5
 
@@ -2130,9 +2131,7 @@ L:        linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Maintained
 W:     http://linux-chenxing.org/
 F:     Documentation/devicetree/bindings/arm/mstar/*
-F:     arch/arm/boot/dts/infinity*.dtsi
-F:     arch/arm/boot/dts/mercury*.dtsi
-F:     arch/arm/boot/dts/mstar-v7.dtsi
+F:     arch/arm/boot/dts/mstar-*
 F:     arch/arm/mach-mstar/
 
 ARM/NEC MOBILEPRO 900/c MACHINE SUPPORT
@@ -2199,8 +2198,8 @@ ARM/OPENMOKO NEO FREERUNNER (GTA02) MACHINE SUPPORT
 L:     openmoko-kernel@lists.openmoko.org (subscribers-only)
 S:     Orphan
 W:     http://wiki.openmoko.org/wiki/Neo_FreeRunner
-F:     arch/arm/mach-s3c24xx/gta02.h
-F:     arch/arm/mach-s3c24xx/mach-gta02.c
+F:     arch/arm/mach-s3c/gta02.h
+F:     arch/arm/mach-s3c/mach-gta02.c
 
 ARM/Orion SoC/Technologic Systems TS-78xx platform support
 M:     Alexander Clouter <alex@digriz.org.uk>
@@ -2376,10 +2375,9 @@ F:       sound/soc/rockchip/
 N:     rockchip
 
 ARM/SAMSUNG EXYNOS ARM ARCHITECTURES
-M:     Kukjin Kim <kgene@kernel.org>
 M:     Krzysztof Kozlowski <krzk@kernel.org>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-L:     linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
+L:     linux-samsung-soc@vger.kernel.org
 S:     Maintained
 Q:     https://patchwork.kernel.org/project/linux-samsung-soc/list/
 F:     Documentation/arm/samsung/
@@ -2389,10 +2387,8 @@ F:       arch/arm/boot/dts/exynos*
 F:     arch/arm/boot/dts/s3c*
 F:     arch/arm/boot/dts/s5p*
 F:     arch/arm/mach-exynos*/
-F:     arch/arm/mach-s3c24*/
-F:     arch/arm/mach-s3c64xx/
+F:     arch/arm/mach-s3c/
 F:     arch/arm/mach-s5p*/
-F:     arch/arm/plat-samsung/
 F:     arch/arm64/boot/dts/exynos/
 F:     drivers/*/*/*s3c24*
 F:     drivers/*/*s3c24*
@@ -2403,6 +2399,9 @@ F:        drivers/soc/samsung/
 F:     drivers/tty/serial/samsung*
 F:     include/linux/soc/samsung/
 N:     exynos
+N:     s3c2410
+N:     s3c64xx
+N:     s5pv210
 
 ARM/SAMSUNG MOBILE MACHINE SUPPORT
 M:     Kyungmin Park <kyungmin.park@samsung.com>
@@ -2421,7 +2420,7 @@ F:        drivers/media/platform/s5p-g2d/
 
 ARM/SAMSUNG S5P SERIES HDMI CEC SUBSYSTEM SUPPORT
 M:     Marek Szyprowski <m.szyprowski@samsung.com>
-L:     linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
+L:     linux-samsung-soc@vger.kernel.org
 L:     linux-media@vger.kernel.org
 S:     Maintained
 F:     Documentation/devicetree/bindings/media/s5p-cec.txt
@@ -2615,7 +2614,7 @@ M:        Tero Kristo <t-kristo@ti.com>
 M:     Nishanth Menon <nm@ti.com>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Supported
-F:     Documentation/devicetree/bindings/arm/ti/k3.txt
+F:     Documentation/devicetree/bindings/arm/ti/k3.yaml
 F:     arch/arm64/boot/dts/ti/Makefile
 F:     arch/arm64/boot/dts/ti/k3-*
 F:     include/dt-bindings/pinctrl/k3.h
@@ -2630,11 +2629,20 @@ M:      Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
 M:     Dirk Opfer <dirk@opfer-online.de>
 S:     Maintained
 
+ARM/TOSHIBA VISCONTI ARCHITECTURE
+M:     Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
+L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
+S:     Supported
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/iwamatsu/linux-visconti.git
+F:     Documentation/devicetree/bindings/arm/toshiba.yaml
+F:     Documentation/devicetree/bindings/pinctrl/toshiba,tmpv7700-pinctrl.yaml
+F:     arch/arm64/boot/dts/toshiba/
+F:     drivers/pinctrl/visconti/
+N:     visconti
+
 ARM/UNIPHIER ARCHITECTURE
-M:     Masahiro Yamada <yamada.masahiro@socionext.com>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-S:     Maintained
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-uniphier.git
+S:     Orphan
 F:     Documentation/devicetree/bindings/arm/socionext/uniphier.yaml
 F:     Documentation/devicetree/bindings/gpio/socionext,uniphier-gpio.yaml
 F:     Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yaml
@@ -3415,7 +3423,7 @@ M:        bcm-kernel-feedback-list@broadcom.com
 L:     linux-arm-kernel@lists.infradead.org
 S:     Maintained
 F:     arch/arm/boot/dts/bcm470*
-F:     arch/arm/boot/dts/bcm5301x*.dtsi
+F:     arch/arm/boot/dts/bcm5301*
 F:     arch/arm/boot/dts/bcm953012*
 F:     arch/arm/mach-bcm/bcm_5301x.c
 
@@ -3481,6 +3489,7 @@ F:        arch/mips/bmips/*
 F:     arch/mips/boot/dts/brcm/bcm*.dts*
 F:     arch/mips/include/asm/mach-bmips/*
 F:     arch/mips/kernel/*bmips*
+F:     drivers/soc/bcm/bcm63xx
 F:     drivers/irqchip/irq-bcm63*
 F:     drivers/irqchip/irq-bcm7*
 F:     drivers/irqchip/irq-brcmstb*
@@ -3848,7 +3857,7 @@ M:        Roger Quadros <rogerq@ti.com>
 L:     linux-usb@vger.kernel.org
 S:     Maintained
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git
-F:     Documentation/devicetree/bindings/usb/cdns-usb3.txt
+F:     Documentation/devicetree/bindings/usb/cdns,usb3.yaml
 F:     drivers/usb/cdns3/
 
 CADET FM/AM RADIO RECEIVER DRIVER
@@ -4585,6 +4594,14 @@ L:       linux-arm-kernel@lists.infradead.org
 S:     Supported
 F:     drivers/cpuidle/cpuidle-psci.c
 
+CPUIDLE DRIVER - ARM PSCI PM DOMAIN
+M:     Ulf Hansson <ulf.hansson@linaro.org>
+L:     linux-pm@vger.kernel.org
+L:     linux-arm-kernel@lists.infradead.org
+S:     Supported
+F:     drivers/cpuidle/cpuidle-psci.h
+F:     drivers/cpuidle/cpuidle-psci-domain.c
+
 CRAMFS FILESYSTEM
 M:     Nicolas Pitre <nico@fluxnic.net>
 S:     Maintained
@@ -4986,9 +5003,8 @@ T:        git git://linuxtv.org/media_tree.git
 F:     drivers/media/platform/sti/delta
 
 DENALI NAND DRIVER
-M:     Masahiro Yamada <yamada.masahiro@socionext.com>
 L:     linux-mtd@lists.infradead.org
-S:     Supported
+S:     Orphan
 F:     drivers/mtd/nand/raw/denali*
 
 DESIGNWARE EDMA CORE IP DRIVER
@@ -5398,11 +5414,11 @@ F:      include/linux/debugfs.h
 F:     include/linux/kobj*
 F:     lib/kobj*
 
-DRIVERS FOR ADAPTIVE VOLTAGE SCALING (AVS)
+DRIVERS FOR OMAP ADAPTIVE VOLTAGE SCALING (AVS)
 M:     Nishanth Menon <nm@ti.com>
 L:     linux-pm@vger.kernel.org
 S:     Maintained
-F:     drivers/power/avs/
+F:     drivers/soc/ti/smartreflex.c
 F:     include/linux/power/smartreflex.h
 
 DRM DRIVER FOR ALLWINNER DE2 AND DE3 ENGINE
@@ -6598,6 +6614,7 @@ Q:        http://patchwork.ozlabs.org/project/linux-ext4/list/
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
 F:     Documentation/filesystems/ext4/
 F:     fs/ext4/
+F:     include/trace/events/ext4.h
 
 Extended Verification Module (EVM)
 M:     Mimi Zohar <zohar@linux.ibm.com>
@@ -7881,6 +7898,15 @@ F:       include/linux/hippidevice.h
 F:     include/uapi/linux/if_hippi.h
 F:     net/802/hippi.c
 
+HIRSCHMANN HELLCREEK ETHERNET SWITCH DRIVER
+M:     Kurt Kanzenbach <kurt@linutronix.de>
+L:     netdev@vger.kernel.org
+S:     Maintained
+F:     Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
+F:     drivers/net/dsa/hirschmann/*
+F:     include/linux/platform_data/hirschmann-hellcreek.h
+F:     net/dsa/tag_hellcreek.c
+
 HISILICON DMA DRIVER
 M:     Zhou Wang <wangzhou1@hisilicon.com>
 L:     dmaengine@vger.kernel.org
@@ -7900,7 +7926,7 @@ HISILICON LPC BUS DRIVER
 M:     john.garry@huawei.com
 S:     Maintained
 W:     http://www.hisilicon.com
-F:     Documentation/devicetree/bindings/arm/hisilicon/hisilicon-low-pin-count.txt
+F:     Documentation/devicetree/bindings/arm/hisilicon/low-pin-count.yaml
 F:     drivers/bus/hisi_lpc.c
 
 HISILICON NETWORK SUBSYSTEM 3 DRIVER (HNS3)
@@ -8813,8 +8839,8 @@ S:        Supported
 W:     http://www.intel.com/support/feedback.htm
 W:     http://e1000.sourceforge.net/
 Q:     http://patchwork.ozlabs.org/project/intel-wired-lan/list/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue.git
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git
 F:     Documentation/networking/device_drivers/ethernet/intel/
 F:     drivers/net/ethernet/intel/
 F:     drivers/net/ethernet/intel/*/
@@ -8956,22 +8982,6 @@ S:       Supported
 W:     https://01.org/linux-acpi
 F:     drivers/platform/x86/intel_menlow.c
 
-INTEL MIC DRIVERS (mic)
-M:     Sudeep Dutt <sudeep.dutt@intel.com>
-M:     Ashutosh Dixit <ashutosh.dixit@intel.com>
-S:     Supported
-W:     https://github.com/sudeepdutt/mic
-W:     http://software.intel.com/en-us/mic-developer
-F:     Documentation/misc-devices/mic/
-F:     drivers/dma/mic_x100_dma.c
-F:     drivers/dma/mic_x100_dma.h
-F:     drivers/misc/mic/
-F:     include/linux/mic_bus.h
-F:     include/linux/scif.h
-F:     include/uapi/linux/mic_common.h
-F:     include/uapi/linux/mic_ioctl.h
-F:     include/uapi/linux/scif_ioctl.h
-
 INTEL P-Unit IPC DRIVER
 M:     Zha Qipeng <qipeng.zha@intel.com>
 L:     platform-driver-x86@vger.kernel.org
@@ -9086,16 +9096,6 @@ W:       https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi.git
 F:     drivers/net/wireless/intel/iwlwifi/
 
-INTEL WIRELESS WIMAX CONNECTION 2400
-M:     Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
-M:     linux-wimax@intel.com
-L:     wimax@linuxwimax.org (subscribers-only)
-S:     Supported
-W:     http://linuxwimax.org
-F:     Documentation/admin-guide/wimax/i2400m.rst
-F:     drivers/net/wimax/i2400m/
-F:     include/uapi/linux/wimax/i2400m.h
-
 INTEL WMI SLIM BOOTLOADER (SBL) FIRMWARE UPDATE DRIVER
 M:     Jithu Joseph <jithu.joseph@intel.com>
 R:     Maurice Ma <maurice.ma@intel.com>
@@ -11163,7 +11163,7 @@ F:      Documentation/devicetree/bindings/input/touchscreen/melfas_mip4.txt
 F:     drivers/input/touchscreen/melfas_mip4.c
 
 MELLANOX BLUEFIELD I2C DRIVER
-M:     Khalil Blaiech <kblaiech@mellanox.com>
+M:     Khalil Blaiech <kblaiech@nvidia.com>
 L:     linux-i2c@vger.kernel.org
 S:     Supported
 F:     drivers/i2c/busses/i2c-mlxbf.c
@@ -11173,7 +11173,7 @@ M:      Tariq Toukan <tariqt@nvidia.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
-Q:     http://patchwork.ozlabs.org/project/netdev/list/
+Q:     https://patchwork.kernel.org/project/netdevbpf/list/
 F:     drivers/net/ethernet/mellanox/mlx4/en_*
 
 MELLANOX ETHERNET DRIVER (mlx5e)
@@ -11181,7 +11181,7 @@ M:      Saeed Mahameed <saeedm@nvidia.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
-Q:     http://patchwork.ozlabs.org/project/netdev/list/
+Q:     https://patchwork.kernel.org/project/netdevbpf/list/
 F:     drivers/net/ethernet/mellanox/mlx5/core/en_*
 
 MELLANOX ETHERNET INNOVA DRIVERS
@@ -11189,7 +11189,7 @@ R:      Boris Pismenny <borisp@nvidia.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
-Q:     http://patchwork.ozlabs.org/project/netdev/list/
+Q:     https://patchwork.kernel.org/project/netdevbpf/list/
 F:     drivers/net/ethernet/mellanox/mlx5/core/accel/*
 F:     drivers/net/ethernet/mellanox/mlx5/core/en_accel/*
 F:     drivers/net/ethernet/mellanox/mlx5/core/fpga/*
@@ -11201,7 +11201,7 @@ M:      Ido Schimmel <idosch@nvidia.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
-Q:     http://patchwork.ozlabs.org/project/netdev/list/
+Q:     https://patchwork.kernel.org/project/netdevbpf/list/
 F:     drivers/net/ethernet/mellanox/mlxsw/
 F:     tools/testing/selftests/drivers/net/mlxsw/
 
@@ -11210,7 +11210,7 @@ M:      mlxsw@nvidia.com
 L:     netdev@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
-Q:     http://patchwork.ozlabs.org/project/netdev/list/
+Q:     https://patchwork.kernel.org/project/netdevbpf/list/
 F:     drivers/net/ethernet/mellanox/mlxfw/
 
 MELLANOX HARDWARE PLATFORM SUPPORT
@@ -11229,7 +11229,7 @@ L:      netdev@vger.kernel.org
 L:     linux-rdma@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
-Q:     http://patchwork.ozlabs.org/project/netdev/list/
+Q:     https://patchwork.kernel.org/project/netdevbpf/list/
 F:     drivers/net/ethernet/mellanox/mlx4/
 F:     include/linux/mlx4/
 
@@ -11250,7 +11250,7 @@ L:      netdev@vger.kernel.org
 L:     linux-rdma@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
-Q:     http://patchwork.ozlabs.org/project/netdev/list/
+Q:     https://patchwork.kernel.org/project/netdevbpf/list/
 F:     Documentation/networking/device_drivers/ethernet/mellanox/
 F:     drivers/net/ethernet/mellanox/mlx5/core/
 F:     include/linux/mlx5/
@@ -12130,7 +12130,7 @@ M:      Jakub Kicinski <kuba@kernel.org>
 L:     netdev@vger.kernel.org
 S:     Maintained
 W:     http://www.linuxfoundation.org/en/Net
-Q:     http://patchwork.ozlabs.org/project/netdev/list/
+Q:     https://patchwork.kernel.org/project/netdevbpf/list/
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
 F:     Documentation/devicetree/bindings/net/
@@ -12175,7 +12175,7 @@ M:      Jakub Kicinski <kuba@kernel.org>
 L:     netdev@vger.kernel.org
 S:     Maintained
 W:     http://www.linuxfoundation.org/en/Net
-Q:     http://patchwork.ozlabs.org/project/netdev/list/
+Q:     https://patchwork.kernel.org/project/netdevbpf/list/
 B:     mailto:netdev@vger.kernel.org
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
@@ -12255,6 +12255,7 @@ L:      mptcp@lists.01.org
 S:     Maintained
 W:     https://github.com/multipath-tcp/mptcp_net-next/wiki
 B:     https://github.com/multipath-tcp/mptcp_net-next/issues
+F:     Documentation/networking/mptcp-sysctl.rst
 F:     include/net/mptcp.h
 F:     include/uapi/linux/mptcp.h
 F:     net/mptcp/
@@ -13439,7 +13440,7 @@ PCI DRIVER FOR SAMSUNG EXYNOS
 M:     Jingoo Han <jingoohan1@gmail.com>
 L:     linux-pci@vger.kernel.org
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-L:     linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
+L:     linux-samsung-soc@vger.kernel.org
 S:     Maintained
 F:     drivers/pci/controller/dwc/pci-exynos.c
 
@@ -13846,7 +13847,7 @@ M:      Tomasz Figa <tomasz.figa@gmail.com>
 M:     Krzysztof Kozlowski <krzk@kernel.org>
 M:     Sylwester Nawrocki <s.nawrocki@samsung.com>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-L:     linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
+L:     linux-samsung-soc@vger.kernel.org
 S:     Maintained
 Q:     https://patchwork.kernel.org/project/linux-samsung-soc/list/
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/samsung.git
@@ -14459,7 +14460,7 @@ L:      linux-pm@vger.kernel.org
 L:     linux-arm-msm@vger.kernel.org
 S:     Maintained
 F:     Documentation/devicetree/bindings/power/avs/qcom,cpr.txt
-F:     drivers/power/avs/qcom-cpr.c
+F:     drivers/soc/qcom/cpr.c
 
 QUALCOMM CPUFREQ DRIVER MSM8996/APQ8096
 M:     Ilia Lin <ilia.lin@kernel.org>
@@ -14527,6 +14528,14 @@ F:     Documentation/devicetree/bindings/mailbox/qcom-ipcc.yaml
 F:     drivers/mailbox/qcom-ipcc.c
 F:     include/dt-bindings/mailbox/qcom-ipcc.h
 
+QUALCOMM IPQ4019 VQMMC REGULATOR DRIVER
+M:     Robert Marko <robert.marko@sartura.hr>
+M:     Luka Perkov <luka.perkov@sartura.hr>
+L:     linux-arm-msm@vger.kernel.org
+S:     Maintained
+F:     Documentation/devicetree/bindings/regulator/vqmmc-ipq4019-regulator.yaml
+F:     drivers/regulator/vqmmc-ipq4019-regulator.c
+
 QUALCOMM RMNET DRIVER
 M:     Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
 M:     Sean Tranchetti <stranche@codeaurora.org>
@@ -14882,7 +14891,6 @@ RENESAS ETHERNET DRIVERS
 R:     Sergei Shtylyov <sergei.shtylyov@gmail.com>
 L:     netdev@vger.kernel.org
 L:     linux-renesas-soc@vger.kernel.org
-F:     Documentation/devicetree/bindings/net/renesas,*.txt
 F:     Documentation/devicetree/bindings/net/renesas,*.yaml
 F:     drivers/net/ethernet/renesas/
 F:     include/linux/sh_eth.h
@@ -15239,7 +15247,6 @@ F:      drivers/iommu/s390-iommu.c
 S390 IUCV NETWORK LAYER
 M:     Julian Wiedmann <jwi@linux.ibm.com>
 M:     Karsten Graul <kgraul@linux.ibm.com>
-M:     Ursula Braun <ubraun@linux.ibm.com>
 L:     linux-s390@vger.kernel.org
 S:     Supported
 W:     http://www.ibm.com/developerworks/linux/linux390/
@@ -15250,7 +15257,6 @@ F:      net/iucv/
 S390 NETWORK DRIVERS
 M:     Julian Wiedmann <jwi@linux.ibm.com>
 M:     Karsten Graul <kgraul@linux.ibm.com>
-M:     Ursula Braun <ubraun@linux.ibm.com>
 L:     linux-s390@vger.kernel.org
 S:     Supported
 W:     http://www.ibm.com/developerworks/linux/linux390/
@@ -15352,7 +15358,6 @@ F:      security/safesetid/
 
 SAMSUNG AUDIO (ASoC) DRIVERS
 M:     Krzysztof Kozlowski <krzk@kernel.org>
-M:     Sangbeom Kim <sbkim73@samsung.com>
 M:     Sylwester Nawrocki <s.nawrocki@samsung.com>
 L:     alsa-devel@alsa-project.org (moderated for non-subscribers)
 S:     Supported
@@ -15387,7 +15392,6 @@ S:      Maintained
 F:     drivers/platform/x86/samsung-laptop.c
 
 SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS
-M:     Sangbeom Kim <sbkim73@samsung.com>
 M:     Krzysztof Kozlowski <krzk@kernel.org>
 M:     Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
 L:     linux-kernel@vger.kernel.org
@@ -15407,7 +15411,7 @@ F:      include/linux/mfd/samsung/
 SAMSUNG S3C24XX/S3C64XX SOC SERIES CAMIF DRIVER
 M:     Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
 L:     linux-media@vger.kernel.org
-L:     linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
+L:     linux-samsung-soc@vger.kernel.org
 S:     Maintained
 F:     drivers/media/platform/s3c-camif/
 F:     include/media/drv-intf/s3c_camif.h
@@ -15457,7 +15461,7 @@ SAMSUNG SOC CLOCK DRIVERS
 M:     Sylwester Nawrocki <s.nawrocki@samsung.com>
 M:     Tomasz Figa <tomasz.figa@gmail.com>
 M:     Chanwoo Choi <cw00.choi@samsung.com>
-L:     linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
+L:     linux-samsung-soc@vger.kernel.org
 S:     Supported
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk.git
 F:     Documentation/devicetree/bindings/clock/exynos*.txt
@@ -15465,17 +15469,19 @@ F:    Documentation/devicetree/bindings/clock/samsung,s3c*
 F:     Documentation/devicetree/bindings/clock/samsung,s5p*
 F:     drivers/clk/samsung/
 F:     include/dt-bindings/clock/exynos*.h
+F:     include/linux/clk/samsung.h
+F:     include/linux/platform_data/clk-s3c2410.h
 
 SAMSUNG SPI DRIVERS
-M:     Kukjin Kim <kgene@kernel.org>
 M:     Krzysztof Kozlowski <krzk@kernel.org>
 M:     Andi Shyti <andi@etezian.org>
 L:     linux-spi@vger.kernel.org
-L:     linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
+L:     linux-samsung-soc@vger.kernel.org
 S:     Maintained
 F:     Documentation/devicetree/bindings/spi/spi-samsung.txt
 F:     drivers/spi/spi-s3c*
 F:     include/linux/platform_data/spi-s3c64xx.h
+F:     include/linux/spi/s3c24xx-fiq.h
 
 SAMSUNG SXGBE DRIVERS
 M:     Byungho An <bh74.an@samsung.com>
@@ -15821,7 +15827,6 @@ S:      Maintained
 F:     drivers/misc/sgi-xp/
 
 SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS
-M:     Ursula Braun <ubraun@linux.ibm.com>
 M:     Karsten Graul <kgraul@linux.ibm.com>
 L:     linux-s390@vger.kernel.org
 S:     Supported
@@ -15993,19 +15998,17 @@ F:    drivers/video/fbdev/simplefb.c
 F:     include/linux/platform_data/simplefb.h
 
 SIMTEC EB110ATX (Chalice CATS)
-M:     Vincent Sanders <vince@simtec.co.uk>
 M:     Simtec Linux Team <linux@simtec.co.uk>
 S:     Supported
 W:     http://www.simtec.co.uk/products/EB110ATX/
 
 SIMTEC EB2410ITX (BAST)
-M:     Vincent Sanders <vince@simtec.co.uk>
 M:     Simtec Linux Team <linux@simtec.co.uk>
 S:     Supported
 W:     http://www.simtec.co.uk/products/EB2410ITX/
-F:     arch/arm/mach-s3c24xx/bast-ide.c
-F:     arch/arm/mach-s3c24xx/bast-irq.c
-F:     arch/arm/mach-s3c24xx/mach-bast.c
+F:     arch/arm/mach-s3c/bast-ide.c
+F:     arch/arm/mach-s3c/bast-irq.c
+F:     arch/arm/mach-s3c/mach-bast.c
 
 SIOX
 M:     Thorsten Scherer <t.scherer@eckelmann.de>
@@ -16044,6 +16047,13 @@ F:     Documentation/fb/sisfb.rst
 F:     drivers/video/fbdev/sis/
 F:     include/video/sisfb.h
 
+SIS I2C TOUCHSCREEN DRIVER
+M:     Mika Penttilä <mika.penttila@nextfour.com>
+L:     linux-input@vger.kernel.org
+S:     Maintained
+F:     Documentation/devicetree/bindings/input/touchscreen/sis_i2c.txt
+F:     drivers/input/touchscreen/sis_i2c.c
+
 SIS USB2VGA DRIVER
 M:     Thomas Winischhofer <thomas@winischhofer.net>
 S:     Maintained
@@ -18078,7 +18088,7 @@ M:      Yu Chen <chenyu56@huawei.com>
 M:     Binghui Wang <wangbinghui@hisilicon.com>
 L:     linux-usb@vger.kernel.org
 S:     Maintained
-F:     Documentation/devicetree/bindings/phy/phy-hi3660-usb3.txt
+F:     Documentation/devicetree/bindings/phy/hisilicon,hi3660-usb3.yaml
 F:     drivers/phy/hisilicon/phy-hi3660-usb3.c
 
 USB ISP116X DRIVER
@@ -18879,18 +18889,6 @@ S:     Supported
 W:     https://wireless.wiki.kernel.org/en/users/Drivers/wil6210
 F:     drivers/net/wireless/ath/wil6210/
 
-WIMAX STACK
-M:     Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
-M:     linux-wimax@intel.com
-L:     wimax@linuxwimax.org (subscribers-only)
-S:     Supported
-W:     http://linuxwimax.org
-F:     Documentation/admin-guide/wimax/wimax.rst
-F:     include/linux/wimax/debug.h
-F:     include/net/wimax.h
-F:     include/uapi/linux/wimax.h
-F:     net/wimax/
-
 WINBOND CIR DRIVER
 M:     David Härdeman <david@hardeman.nu>
 S:     Maintained
@@ -18937,7 +18935,7 @@ F:      Documentation/devicetree/bindings/mfd/wm831x.txt
 F:     Documentation/devicetree/bindings/regulator/wlf,arizona.yaml
 F:     Documentation/devicetree/bindings/sound/wlf,arizona.yaml
 F:     Documentation/hwmon/wm83??.rst
-F:     arch/arm/mach-s3c64xx/mach-crag6410*
+F:     arch/arm/mach-s3c/mach-crag6410*
 F:     drivers/clk/clk-wm83*.c
 F:     drivers/extcon/extcon-arizona.c
 F:     drivers/gpio/gpio-*wm*.c
index e719798..008aba5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 5
-PATCHLEVEL = 9
+PATCHLEVEL = 10
 SUBLEVEL = 0
-EXTRAVERSION =
+EXTRAVERSION = -rc3
 NAME = Kleptomaniac Octopus
 
 # *DOCUMENTATION*
index fe19f1d..c9434ff 100644 (file)
 #else  /* !__ASSEMBLY__ */
 
 #ifdef CONFIG_ARC_HAS_ICCM
-#define __arcfp_code __section(.text.arcfp)
+#define __arcfp_code __section(".text.arcfp")
 #else
-#define __arcfp_code __section(.text)
+#define __arcfp_code __section(".text")
 #endif
 
 #ifdef CONFIG_ARC_HAS_DCCM
-#define __arcfp_data __section(.data.arcfp)
+#define __arcfp_data __section(".data.arcfp")
 #else
-#define __arcfp_data __section(.data)
+#define __arcfp_data __section(".data")
 #endif
 
 #endif /* __ASSEMBLY__ */
index 73746ed..c4e1970 100644 (file)
@@ -53,7 +53,7 @@ extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
  */
 #define MACHINE_START(_type, _name)                    \
 static const struct machine_desc __mach_desc_##_type   \
-__used __section(.arch.info.init) = {                  \
+__used __section(".arch.info.init") = {                        \
        .name           = _name,
 
 #define MACHINE_END                            \
index 17fd1ed..9152782 100644 (file)
        sr      r5, [ARC_REG_LPB_CTRL]
 1:
 #endif /* CONFIG_ARC_LPB_DISABLE */
-#endif
+
+       /* On HSDK, CCMs need to remapped super early */
+#ifdef CONFIG_ARC_SOC_HSDK
+       mov     r6, 0x60000000
+       lr      r5, [ARC_REG_ICCM_BUILD]
+       breq    r5, 0, 1f
+       sr      r6, [ARC_REG_AUX_ICCM]
+1:
+       lr      r5, [ARC_REG_DCCM_BUILD]
+       breq    r5, 0, 2f
+       sr      r6, [ARC_REG_AUX_DCCM]
+2:
+#endif /* CONFIG_ARC_SOC_HSDK */
+
+#endif /* CONFIG_ISA_ARCV2 */
+
        ; Config DSP_CTRL properly, so kernel may use integer multiply,
        ; multiply-accumulate, and divide operations
        DSP_EARLY_INIT
index feba91c..b23986f 100644 (file)
@@ -112,7 +112,7 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
                int (*consumer_fn) (unsigned int, void *), void *arg)
 {
 #ifdef CONFIG_ARC_DW2_UNWIND
-       int ret = 0;
+       int ret = 0, cnt = 0;
        unsigned int address;
        struct unwind_frame_info frame_info;
 
@@ -132,6 +132,11 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
                        break;
 
                frame_info.regs.r63 = frame_info.regs.r31;
+
+               if (cnt++ > 128) {
+                       printk("unwinder looping too long, aborting !\n");
+                       return 0;
+               }
        }
 
        return address;         /* return the last address it saw */
index 0b961a2..b3ea1fa 100644 (file)
 #include <asm/io.h>
 #include <asm/mach_desc.h>
 
-int arc_hsdk_axi_dmac_coherent __section(.data) = 0;
+int arc_hsdk_axi_dmac_coherent __section(".data") = 0;
 
 #define ARC_CCM_UNUSED_ADDR    0x60000000
 
-static void __init hsdk_init_per_cpu(unsigned int cpu)
-{
-       /*
-        * By default ICCM is mapped to 0x7z while this area is used for
-        * kernel virtual mappings, so move it to currently unused area.
-        */
-       if (cpuinfo_arc700[cpu].iccm.sz)
-               write_aux_reg(ARC_REG_AUX_ICCM, ARC_CCM_UNUSED_ADDR);
-
-       /*
-        * By default DCCM is mapped to 0x8z while this area is used by kernel,
-        * so move it to currently unused area.
-        */
-       if (cpuinfo_arc700[cpu].dccm.sz)
-               write_aux_reg(ARC_REG_AUX_DCCM, ARC_CCM_UNUSED_ADDR);
-}
 
 #define ARC_PERIPHERAL_BASE    0xf0000000
 #define CREG_BASE              (ARC_PERIPHERAL_BASE + 0x1000)
@@ -339,5 +323,4 @@ static const char *hsdk_compat[] __initconst = {
 MACHINE_START(SIMULATION, "hsdk")
        .dt_compat      = hsdk_compat,
        .init_early     = hsdk_init_early,
-       .init_per_cpu   = hsdk_init_per_cpu,
 MACHINE_END
index c18fa9d..fe2f17e 100644 (file)
@@ -268,9 +268,7 @@ config PHYS_OFFSET
        depends on !ARM_PATCH_PHYS_VIRT
        default DRAM_BASE if !MMU
        default 0x00000000 if ARCH_EBSA110 || \
-                       ARCH_FOOTBRIDGE || \
-                       ARCH_INTEGRATOR || \
-                       ARCH_REALVIEW
+                       ARCH_FOOTBRIDGE
        default 0x10000000 if ARCH_OMAP1 || ARCH_RPC
        default 0x20000000 if ARCH_S5PV210
        default 0xc0000000 if ARCH_SA1100
@@ -506,11 +504,12 @@ config ARCH_S3C24XX
        select GPIOLIB
        select GENERIC_IRQ_MULTI_HANDLER
        select HAVE_S3C2410_I2C if I2C
-       select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select HAVE_S3C_RTC if RTC_CLASS
        select NEED_MACH_IO_H
+       select S3C2410_WATCHDOG
        select SAMSUNG_ATAGS
        select USE_OF
+       select WATCHDOG
        help
          Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443
          and S3C2450 SoCs based systems, such as the Simtec Electronics BAST
@@ -639,7 +638,6 @@ source "arch/arm/mach-dove/Kconfig"
 source "arch/arm/mach-ep93xx/Kconfig"
 
 source "arch/arm/mach-exynos/Kconfig"
-source "arch/arm/plat-samsung/Kconfig"
 
 source "arch/arm/mach-footbridge/Kconfig"
 
@@ -712,9 +710,7 @@ source "arch/arm/mach-realview/Kconfig"
 
 source "arch/arm/mach-rockchip/Kconfig"
 
-source "arch/arm/mach-s3c24xx/Kconfig"
-
-source "arch/arm/mach-s3c64xx/Kconfig"
+source "arch/arm/mach-s3c/Kconfig"
 
 source "arch/arm/mach-s5pv210/Kconfig"
 
index 87912e5..8986a91 100644 (file)
@@ -1005,7 +1005,7 @@ choice
                  via SCIFA4 on Renesas SH-Mobile AG5 (SH73A0).
 
        config DEBUG_S3C_UART0
-               depends on PLAT_SAMSUNG
+               depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS
                select DEBUG_EXYNOS_UART if ARCH_EXYNOS
                select DEBUG_S3C24XX_UART if ARCH_S3C24XX
                select DEBUG_S3C64XX_UART if ARCH_S3C64XX
@@ -1017,7 +1017,7 @@ choice
                  by the boot-loader before use.
 
        config DEBUG_S3C_UART1
-               depends on PLAT_SAMSUNG
+               depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS
                select DEBUG_EXYNOS_UART if ARCH_EXYNOS
                select DEBUG_S3C24XX_UART if ARCH_S3C24XX
                select DEBUG_S3C64XX_UART if ARCH_S3C64XX
@@ -1029,7 +1029,7 @@ choice
                  by the boot-loader before use.
 
        config DEBUG_S3C_UART2
-               depends on PLAT_SAMSUNG
+               depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS
                select DEBUG_EXYNOS_UART if ARCH_EXYNOS
                select DEBUG_S3C24XX_UART if ARCH_S3C24XX
                select DEBUG_S3C64XX_UART if ARCH_S3C64XX
@@ -1041,7 +1041,7 @@ choice
                  by the boot-loader before use.
 
        config DEBUG_S3C_UART3
-               depends on PLAT_SAMSUNG && (ARCH_EXYNOS || ARCH_S5PV210)
+               depends on ARCH_EXYNOS || ARCH_S5PV210
                select DEBUG_EXYNOS_UART if ARCH_EXYNOS
                select DEBUG_S3C64XX_UART if ARCH_S3C64XX
                select DEBUG_S5PV210_UART if ARCH_S5PV210
@@ -1086,6 +1086,14 @@ choice
                  on SA-11x0 UART ports. The kernel will check for the first
                  enabled UART in a sequence 3-1-2.
 
+       config DEBUG_SD5203_UART
+               bool "Hisilicon SD5203 Debug UART"
+               depends on ARCH_SD5203
+               select DEBUG_UART_8250
+               help
+                 Say Y here if you want kernel low-level debugging support
+                 on SD5203 UART.
+
        config DEBUG_SOCFPGA_UART0
                depends on ARCH_SOCFPGA
                bool "Use SOCFPGA UART0 for low-level debug"
@@ -1497,6 +1505,16 @@ config DEBUG_S3C64XX_UART
 config DEBUG_S5PV210_UART
        bool
 
+config DEBUG_S3C_UART
+       depends on DEBUG_S3C2410_UART || DEBUG_S3C24XX_UART || \
+                  DEBUG_S3C64XX_UART ||  DEBUG_S5PV210_UART || \
+                  DEBUG_EXYNOS_UART
+       int
+       default "0" if DEBUG_S3C_UART0
+       default "1" if DEBUG_S3C_UART1
+       default "2" if DEBUG_S3C_UART2
+       default "3" if DEBUG_S3C_UART3
+
 config DEBUG_OMAP2PLUS_UART
        bool
        depends on ARCH_OMAP2PLUS
@@ -1650,6 +1668,7 @@ config DEBUG_UART_PHYS
        default 0x11006000 if DEBUG_MT6589_UART0
        default 0x11009000 if DEBUG_MT8135_UART3
        default 0x16000000 if DEBUG_INTEGRATOR
+       default 0x1600d000 if DEBUG_SD5203_UART
        default 0x18000300 if DEBUG_BCM_5301X
        default 0x18000400 if DEBUG_BCM_HR2
        default 0x18010000 if DEBUG_SIRFATLAS7_UART0
@@ -1852,7 +1871,7 @@ config DEBUG_UART_VIRT
        default 0xfec60000 if DEBUG_SIRFPRIMA2_UART1
        default 0xfec90000 if DEBUG_RK32_UART2
        default 0xfed0c000 if DEBUG_DAVINCI_DA8XX_UART1
-       default 0xfed0d000 if DEBUG_DAVINCI_DA8XX_UART2
+       default 0xfed0d000 if DEBUG_DAVINCI_DA8XX_UART2 || DEBUG_SD5203_UART
        default 0xfed60000 if DEBUG_RK29_UART0
        default 0xfed64000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2
        default 0xfed68000 if DEBUG_RK29_UART2 || DEBUG_RK3X_UART3
index 2874cd9..4d76eab 100644 (file)
@@ -212,8 +212,7 @@ machine-$(CONFIG_ARCH_REALTEK)              += realtek
 machine-$(CONFIG_ARCH_REALVIEW)                += realview
 machine-$(CONFIG_ARCH_ROCKCHIP)                += rockchip
 machine-$(CONFIG_ARCH_RPC)             += rpc
-machine-$(CONFIG_ARCH_S3C24XX)         += s3c24xx
-machine-$(CONFIG_ARCH_S3C64XX)         += s3c64xx
+machine-$(CONFIG_PLAT_SAMSUNG)         += s3c
 machine-$(CONFIG_ARCH_S5PV210)         += s5pv210
 machine-$(CONFIG_ARCH_SA1100)          += sa1100
 machine-$(CONFIG_ARCH_RENESAS)         += shmobile
@@ -235,13 +234,9 @@ machine-$(CONFIG_PLAT_SPEAR)               += spear
 
 # Platform directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
-plat-$(CONFIG_ARCH_EXYNOS)     += samsung
 plat-$(CONFIG_ARCH_OMAP)       += omap
-plat-$(CONFIG_ARCH_S3C64XX)    += samsung
-plat-$(CONFIG_ARCH_S5PV210)    += samsung
 plat-$(CONFIG_PLAT_ORION)      += orion
 plat-$(CONFIG_PLAT_PXA)                += pxa
-plat-$(CONFIG_PLAT_S3C24XX)    += samsung
 plat-$(CONFIG_PLAT_VERSATILE)  += versatile
 
 ifeq ($(CONFIG_ARCH_EBSA110),y)
index 4572db3..ce66ffd 100644 (file)
@@ -43,6 +43,7 @@ dtb-$(CONFIG_SOC_AT91SAM9) += \
        at91-smartkiz.dtb \
        at91-wb45n.dtb \
        at91sam9g15ek.dtb \
+       at91sam9g25-gardena-smart-gateway.dtb \
        at91sam9g25ek.dtb \
        at91sam9g35ek.dtb \
        at91sam9x25ek.dtb \
@@ -127,6 +128,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \
        bcm47094-luxul-xwr-3150-v1.dtb \
        bcm47094-netgear-r8500.dtb \
        bcm47094-phicomm-k3.dtb \
+       bcm53016-meraki-mr32.dtb \
        bcm94708.dtb \
        bcm94709.dtb \
        bcm953012er.dtb \
@@ -357,6 +359,8 @@ dtb-$(CONFIG_ARCH_MPS2) += \
        mps2-an399.dtb
 dtb-$(CONFIG_ARCH_MOXART) += \
        moxart-uc7112lx.dtb
+dtb-$(CONFIG_ARCH_SD5203) += \
+       sd5203.dtb
 dtb-$(CONFIG_SOC_IMX1) += \
        imx1-ads.dtb \
        imx1-apf9328.dtb
@@ -482,6 +486,7 @@ dtb-$(CONFIG_SOC_IMX6Q) += \
        imx6dl-wandboard-revd1.dtb \
        imx6dl-yapp4-draco.dtb \
        imx6dl-yapp4-hydra.dtb \
+       imx6dl-yapp4-orion.dtb \
        imx6dl-yapp4-ursa.dtb \
        imx6q-apalis-eval.dtb \
        imx6q-apalis-ixora.dtb \
@@ -531,6 +536,7 @@ dtb-$(CONFIG_SOC_IMX6Q) += \
        imx6q-icore-ofcap12.dtb \
        imx6q-icore-rqs.dtb \
        imx6q-kp-tpc.dtb \
+       imx6q-logicpd.dtb \
        imx6q-marsboard.dtb \
        imx6q-mccmon6.dtb \
        imx6q-nitrogen6x.dtb \
@@ -585,6 +591,7 @@ dtb-$(CONFIG_SOC_IMX6Q) += \
        imx6qp-zii-rdu2.dtb
 dtb-$(CONFIG_SOC_IMX6SL) += \
        imx6sl-evk.dtb \
+       imx6sl-tolino-shine2hd.dtb \
        imx6sl-tolino-shine3.dtb \
        imx6sl-warp.dtb
 dtb-$(CONFIG_SOC_IMX6SLL) += \
@@ -868,7 +875,12 @@ dtb-$(CONFIG_ARCH_ORION5X) += \
 dtb-$(CONFIG_ARCH_ACTIONS) += \
        owl-s500-cubieboard6.dtb \
        owl-s500-guitar-bb-rev-b.dtb \
+       owl-s500-labrador-base-m.dtb \
+       owl-s500-roseapplepi.dtb \
        owl-s500-sparky.dtb
+dtb-$(CONFIG_ARCH_PICOXCELL) += \
+       picoxcell-pc7302-pc3x2.dtb \
+       picoxcell-pc7302-pc3x3.dtb
 dtb-$(CONFIG_ARCH_PRIMA2) += \
        prima2-evb.dtb
 dtb-$(CONFIG_ARCH_PXA) += \
@@ -1047,6 +1059,7 @@ dtb-$(CONFIG_ARCH_STM32) += \
        stm32746g-eval.dtb \
        stm32h743i-eval.dtb \
        stm32h743i-disco.dtb \
+       stm32mp153c-dhcom-drc02.dtb \
        stm32mp157a-avenger96.dtb \
        stm32mp157a-dhcor-avenger96.dtb \
        stm32mp157a-dk1.dtb \
@@ -1056,7 +1069,8 @@ dtb-$(CONFIG_ARCH_STM32) += \
        stm32mp157c-dk2.dtb \
        stm32mp157c-ed1.dtb \
        stm32mp157c-ev1.dtb \
-       stm32mp157c-lxa-mc1.dtb
+       stm32mp157c-lxa-mc1.dtb \
+       stm32mp157c-odyssey.dtb
 dtb-$(CONFIG_MACH_SUN4I) += \
        sun4i-a10-a1000.dtb \
        sun4i-a10-ba10-tvbox.dtb \
@@ -1194,6 +1208,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
        sun8i-r16-parrot.dtb \
        sun8i-r40-bananapi-m2-ultra.dtb \
        sun8i-s3-lichee-zero-plus.dtb \
+       sun8i-s3-pinecube.dtb \
        sun8i-t3-cqa3t-bv3.dtb \
        sun8i-v3s-licheepi-zero.dtb \
        sun8i-v3s-licheepi-zero-dock.dtb \
@@ -1356,9 +1371,9 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
        mt8135-evbp1.dtb
 dtb-$(CONFIG_ARCH_MILBEAUT) += milbeaut-m10v-evb.dtb
 dtb-$(CONFIG_ARCH_MSTARV7) += \
-       infinity-msc313-breadbee_crust.dtb \
-       infinity3-msc313e-breadbee.dtb \
-       mercury5-ssc8336n-midrived08.dtb
+       mstar-infinity-msc313-breadbee_crust.dtb \
+       mstar-infinity3-msc313e-breadbee.dtb \
+       mstar-mercury5-ssc8336n-midrived08.dtb
 dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb
 dtb-$(CONFIG_ARCH_ASPEED) += \
        aspeed-ast2500-evb.dtb \
@@ -1371,6 +1386,7 @@ dtb-$(CONFIG_ARCH_ASPEED) += \
        aspeed-bmc-facebook-tiogapass.dtb \
        aspeed-bmc-facebook-wedge40.dtb \
        aspeed-bmc-facebook-wedge100.dtb \
+       aspeed-bmc-facebook-wedge400.dtb \
        aspeed-bmc-facebook-yamp.dtb \
        aspeed-bmc-facebook-yosemitev2.dtb \
        aspeed-bmc-ibm-rainier.dtb \
@@ -1381,6 +1397,7 @@ dtb-$(CONFIG_ARCH_ASPEED) += \
        aspeed-bmc-microsoft-olympus.dtb \
        aspeed-bmc-opp-lanyang.dtb \
        aspeed-bmc-opp-mihawk.dtb \
+       aspeed-bmc-opp-mowgli.dtb \
        aspeed-bmc-opp-nicole.dtb \
        aspeed-bmc-opp-palmetto.dtb \
        aspeed-bmc-opp-romulus.dtb \
index d3036ea..3b0675a 100644 (file)
@@ -91,7 +91,7 @@
                };
 
                /* Interrupt Controller */
-               gic: gic@fb001000 {
+               gic: interrupt-controller@fb001000 {
                        compatible = "arm,cortex-a15-gic";
                        #interrupt-cells = <3>;
                        #size-cells = <0>;
index cd55f11..0f07846 100644 (file)
        serial_config1: serial_config1@20 {
                compatible = "nxp,pca9539";
                reg = <0x20>;
+               gpio-controller;
+               #gpio-cells = <2>;
        };
 
        serial_config2: serial_config2@21 {
                compatible = "nxp,pca9539";
                reg = <0x21>;
+               gpio-controller;
+               #gpio-cells = <2>;
        };
 
        tps: tps@2d {
diff --git a/arch/arm/boot/dts/am335x-moxa-uc-8100-common.dtsi b/arch/arm/boot/dts/am335x-moxa-uc-8100-common.dtsi
new file mode 100644 (file)
index 0000000..98d8ed4
--- /dev/null
@@ -0,0 +1,427 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2020 MOXA Inc. - https://www.moxa.com/
+ *
+ * Author: Johnson Chen <johnsonch.chen@moxa.com>
+ */
+
+#include "am33xx.dtsi"
+
+/ {
+
+       cpus {
+               cpu@0 {
+                       cpu0-supply = <&vdd1_reg>;
+               };
+       };
+
+       vbat: vbat-regulator {
+               compatible = "regulator-fixed";
+       };
+
+       /* Power supply provides a fixed 3.3V @3A */
+       vmmcsd_fixed: vmmcsd-regulator {
+             compatible = "regulator-fixed";
+             regulator-name = "vmmcsd_fixed";
+             regulator-min-microvolt = <3300000>;
+             regulator-max-microvolt = <3300000>;
+             regulator-boot-on;
+       };
+
+       buttons: push_button {
+               compatible = "gpio-keys";
+       };
+
+};
+
+&am33xx_pinmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&minipcie_pins>;
+
+       minipcie_pins: pinmux_minipcie {
+               pinctrl-single,pins = <
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* lcd_pclk.gpio2_24 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)        /* lcd_ac_bias_en.gpio2_25 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* lcd_vsync.gpio2_22  Power off PIN*/
+               >;
+       };
+
+       push_button_pins: pinmux_push_button {
+               pinctrl-single,pins = <
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKX, PIN_INPUT_PULLDOWN, MUX_MODE7) /* mcasp0_ahcklx.gpio3_21 */
+               >;
+       };
+
+       i2c0_pins: pinmux_i2c0_pins {
+               pinctrl-single,pins = <
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0)
+               >;
+       };
+
+
+       i2c1_pins: pinmux_i2c1_pins {
+               pinctrl-single,pins = <
+                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* uart0_ctsn.i2c1_sda */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* uart0_rtsn.i2c1_scl */
+               >;
+       };
+
+       uart0_pins: pinmux_uart0_pins {
+               pinctrl-single,pins = <
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+               >;
+       };
+
+       uart1_pins: pinmux_uart1_pins {
+               pinctrl-single,pins = <
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_OUTPUT, MUX_MODE0)
+               >;
+       };
+
+       uart2_pins: pinmux_uart2_pins {
+               pinctrl-single,pins = <
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_INPUT, MUX_MODE6)             /* lcd_data14.uart5_ctsn */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT_PULLDOWN, MUX_MODE6)  /* lcd_data15.uart5_rtsn */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_INPUT_PULLUP, MUX_MODE4)     /* lcd_data9.uart5_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE4)             /* lcd_data8.uart5_txd */
+               >;
+       };
+
+       cpsw_default: cpsw_default {
+               pinctrl-single,pins = <
+                       /* Slave 1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLUP, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLUP, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLUP, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE0)
+
+                       /* Slave 2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLDOWN, MUX_MODE3)   /* rmii2_crs_dv */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_INPUT_PULLDOWN, MUX_MODE3)   /* rmii2_rxer */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_OUTPUT_PULLDOWN, MUX_MODE3)  /* rmii2_txen */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_OUTPUT_PULLDOWN, MUX_MODE3)  /* rmii2_td1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT_PULLDOWN, MUX_MODE3)  /* rmii2_td0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLDOWN, MUX_MODE3)   /* rmii2_rd1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLDOWN, MUX_MODE3)   /* rmii2_rd0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT_PULLDOWN, MUX_MODE1)  /* rmii2_refclk */
+
+               >;
+       };
+
+       davinci_mdio_default: davinci_mdio_default {
+               pinctrl-single,pins = <
+                       /* MDIO */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
+               >;
+       };
+
+       mmc0_pins_default: pinmux_mmc0_pins {
+               pinctrl-single,pins = <
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CMD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_INPUT_PULLUP, MUX_MODE7)    /* mcasp0_aclkx.gpio3_14 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_INPUT_PULLUP, MUX_MODE7)    /* mcasp0_aclkx.gpio3_18 */
+               >;
+       };
+
+       mmc2_pins_default: pinmux_mmc2_pins {
+               pinctrl-single,pins = <
+                       /* eMMC */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ad12.mmc2_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ad13.mmc2_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ad14.mmc2_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ad15.mmc2_dat3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_INPUT_PULLUP, MUX_MODE3)        /* gpmc_ad8.mmc2_dat4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_INPUT_PULLUP, MUX_MODE3)        /* gpmc_ad9.mmc2_dat5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ad10.mmc2_dat6 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ad11.mmc2_dat7 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN3, PIN_INPUT_PULLUP, MUX_MODE3)     /* gpmc_csn3.mmc2_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CLK, PIN_INPUT_PULLUP, MUX_MODE3)        /* gpmc_clk.mmc2_clk */
+               >;
+       };
+
+       spi0_pins: pinmux_spi0 {
+               pinctrl-single,pins = <
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT_PULLUP, MUX_MODE0)
+               >;
+       };
+
+};
+
+&uart0 {
+       /* Console */
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins>;
+};
+
+&uart1 {
+       /* UART 1 setting */
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart1_pins>;
+};
+
+&uart5 {
+       /* UART 2 setting */
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart2_pins>;
+};
+
+&i2c0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c0_pins>;
+
+       status = "okay";
+       clock-frequency = <400000>;
+
+       tps: tps@2d {
+               compatible = "ti,tps65910";
+               reg = <0x2d>;
+       };
+
+       eeprom: eeprom@50 {
+               compatible = "atmel,24c16";
+               pagesize = <16>;
+               reg = <0x50>;
+       };
+
+       rtc_wdt: rtc_wdt@68 {
+               compatible = "dallas,ds1374";
+               reg = <0x68>;
+       };
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c1_pins>;
+
+       status = "okay";
+       clock-frequency = <400000>;
+       gpio_xten: gpio_xten@27 {
+               compatible = "nxp,pca9535";
+               gpio-controller;
+               #gpio-cells = <2>;
+               reg = <0x27>;
+       };
+};
+
+&usb0 {
+       dr_mode = "host";
+};
+
+&usb1 {
+       dr_mode = "host";
+};
+
+
+#include "tps65910.dtsi"
+&tps {
+       vcc1-supply = <&vbat>;
+       vcc2-supply = <&vbat>;
+       vcc3-supply = <&vbat>;
+       vcc4-supply = <&vbat>;
+       vcc5-supply = <&vbat>;
+       vcc6-supply = <&vbat>;
+       vcc7-supply = <&vbat>;
+       vccio-supply = <&vbat>;
+
+       regulators {
+               vrtc_reg: regulator@0 {
+                       regulator-always-on;
+               };
+
+               vio_reg: regulator@1 {
+                       regulator-always-on;
+               };
+
+               vdd1_reg: regulator@2 {
+                       regulator-always-on;
+               };
+
+               vdd2_reg: regulator@3 {
+                       regulator-always-on;
+               };
+
+               vdd3_reg: regulator@4 {
+                       regulator-always-on;
+               };
+
+               vdig1_reg: regulator@5 {
+                       regulator-always-on;
+               };
+
+               vdig2_reg: regulator@6 {
+                       regulator-always-on;
+               };
+
+               vpll_reg: regulator@7 {
+                       regulator-always-on;
+               };
+
+               vdac_reg: regulator@8 {
+                       regulator-always-on;
+               };
+
+               vaux1_reg: regulator@9 {
+                       regulator-always-on;
+               };
+
+               vaux2_reg: regulator@10 {
+                       regulator-always-on;
+               };
+
+               vaux33_reg: regulator@11 {
+                       regulator-always-on;
+               };
+
+               vmmc_reg: regulator@12 {
+                       compatible = "regulator-fixed";
+                       regulator-name = "vmmc_reg";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+       };
+};
+
+/* Power */
+&vbat {
+       regulator-name = "vbat";
+       regulator-min-microvolt = <5000000>;
+       regulator-max-microvolt = <5000000>;
+};
+
+&mac {
+       pinctrl-names = "default";
+       pinctrl-0 = <&cpsw_default>;
+       dual_emac = <1>;
+       status = "okay";
+};
+
+&davinci_mdio {
+       pinctrl-names = "default";
+       pinctrl-0 = <&davinci_mdio_default>;
+       status = "okay";
+
+       ethphy0: ethernet-phy@4 {
+               reg = <4>;
+       };
+
+       ethphy1: ethernet-phy@5 {
+               reg = <5>;
+       };
+};
+
+&cpsw_emac0 {
+       status = "okay";
+       phy-handle = <&ethphy0>;
+       phy-mode = "rmii";
+       dual_emac_res_vlan = <1>;
+};
+
+&cpsw_emac1 {
+       status = "okay";
+       phy-handle = <&ethphy1>;
+       phy-mode = "rmii";
+       dual_emac_res_vlan = <2>;
+};
+
+&sham {
+       status = "okay";
+};
+
+&aes {
+       status = "okay";
+};
+
+&gpio0 {
+       ti,no-reset-on-init;
+};
+
+&mmc1 {
+       pinctrl-names = "default";
+       vmmc-supply = <&vmmcsd_fixed>;
+       bus-width = <4>;
+       pinctrl-0 = <&mmc0_pins_default>;
+       cd-gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
+       wp-gpios = <&gpio3 18 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&mmc3 {
+       dmas = <&edma_xbar 12 0 1
+                       &edma_xbar 13 0 2>;
+       dma-names = "tx", "rx";
+       pinctrl-names = "default";
+       vmmc-supply = <&vmmcsd_fixed>;
+       bus-width = <8>;
+       pinctrl-0 = <&mmc2_pins_default>;
+       ti,non-removable;
+       status = "okay";
+};
+
+&buttons {
+       pinctrl-names = "default";
+       pinctrl-0 = <&push_button_pins>;
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       button@0 {
+               label = "push_button";
+               linux,code = <0x100>;
+               gpios = <&gpio3 21 GPIO_ACTIVE_LOW>;
+       };
+};
+
+/* SPI Busses */
+&spi0 {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&spi0_pins>;
+
+       m25p80@0 {
+               compatible = "mx25l6405d";
+               spi-max-frequency = <40000000>;
+
+               reg = <0>;
+               spi-cpol;
+               spi-cpha;
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               /* reg : The partition's offset and size within the mtd bank. */
+               partitions@0 {
+                       label = "MLO";
+                       reg = <0x0 0x80000>;
+               };
+
+               partitions@1 {
+                       label = "U-Boot";
+                       reg = <0x80000 0x100000>;
+               };
+
+               partitions@2 {
+                       label = "U-Boot Env";
+                       reg = <0x180000 0x20000>;
+               };
+       };
+};
index f03e72c..0c7949d 100644 (file)
@@ -4,39 +4,19 @@
  *
  * Author: SZ Lin (林上智) <sz.lin@moxa.com>
  */
-
 /dts-v1/;
 
-#include "am33xx.dtsi"
+#include "am335x-moxa-uc-8100-common.dtsi"
 
 / {
        model = "Moxa UC-8100-ME-T";
        compatible = "moxa,uc-8100-me-t", "ti,am33xx";
 
-       cpus {
-               cpu@0 {
-                       cpu0-supply = <&vdd1_reg>;
-               };
-       };
-
        memory {
                device_type = "memory";
                reg = <0x80000000 0x20000000>; /* 512 MB */
        };
 
-       vbat: vbat-regulator {
-               compatible = "regulator-fixed";
-       };
-
-       /* Power supply provides a fixed 3.3V @3A */
-       vmmcsd_fixed: vmmcsd-regulator {
-             compatible = "regulator-fixed";
-             regulator-name = "vmmcsd_fixed";
-             regulator-min-microvolt = <3300000>;
-             regulator-max-microvolt = <3300000>;
-             regulator-boot-on;
-       };
-
        leds {
                compatible = "gpio-leds";
                led1 {
                        default-state = "off";
                };
        };
-
-       buttons: push_button {
-               compatible = "gpio-keys";
-       };
-
-};
-
-&am33xx_pinmux {
-       pinctrl-names = "default";
-       pinctrl-0 = <&minipcie_pins>;
-
-       minipcie_pins: pinmux_minipcie {
-               pinctrl-single,pins = <
-                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* lcd_pclk.gpio2_24 */
-                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)        /* lcd_ac_bias_en.gpio2_25 */
-                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* lcd_vsync.gpio2_22  Power off PIN*/
-               >;
-       };
-
-       push_button_pins: pinmux_push_button {
-               pinctrl-single,pins = <
-                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKX, PIN_INPUT_PULLDOWN, MUX_MODE7) /* mcasp0_ahcklx.gpio3_21 */
-               >;
-       };
-
-       i2c0_pins: pinmux_i2c0_pins {
-               pinctrl-single,pins = <
-                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLUP, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0)
-               >;
-       };
-
-
-       i2c1_pins: pinmux_i2c1_pins {
-               pinctrl-single,pins = <
-                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* uart0_ctsn.i2c1_sda */
-                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* uart0_rtsn.i2c1_scl */
-               >;
-       };
-
-       uart0_pins: pinmux_uart0_pins {
-               pinctrl-single,pins = <
-                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
-               >;
-       };
-
-       uart1_pins: pinmux_uart1_pins {
-               pinctrl-single,pins = <
-                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_OUTPUT, MUX_MODE0)
-               >;
-       };
-
-       uart2_pins: pinmux_uart2_pins {
-               pinctrl-single,pins = <
-                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_INPUT, MUX_MODE6)             /* lcd_data14.uart5_ctsn */
-                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT_PULLDOWN, MUX_MODE6)  /* lcd_data15.uart5_rtsn */
-                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_INPUT_PULLUP, MUX_MODE4)     /* lcd_data9.uart5_rxd */
-                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE4)             /* lcd_data8.uart5_txd */
-               >;
-       };
-
-       cpsw_default: cpsw_default {
-               pinctrl-single,pins = <
-                       /* Slave 1 */
-                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE1)
-                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLUP, MUX_MODE1)
-                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE1)
-                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE1)
-                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE1)
-                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLUP, MUX_MODE1)
-                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLUP, MUX_MODE1)
-                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE0)
-
-                       /* Slave 2 */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLDOWN, MUX_MODE3)   /* rmii2_crs_dv */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_INPUT_PULLDOWN, MUX_MODE3)   /* rmii2_rxer */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_OUTPUT_PULLDOWN, MUX_MODE3)  /* rmii2_txen */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_OUTPUT_PULLDOWN, MUX_MODE3)  /* rmii2_td1 */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT_PULLDOWN, MUX_MODE3)  /* rmii2_td0 */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLDOWN, MUX_MODE3)   /* rmii2_rd1 */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLDOWN, MUX_MODE3)   /* rmii2_rd0 */
-                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT_PULLDOWN, MUX_MODE1)  /* rmii2_refclk */
-
-               >;
-       };
-
-       davinci_mdio_default: davinci_mdio_default {
-               pinctrl-single,pins = <
-                       /* MDIO */
-                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
-               >;
-       };
-
-       mmc0_pins_default: pinmux_mmc0_pins {
-               pinctrl-single,pins = <
-                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT3, PIN_INPUT_PULLUP, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT2, PIN_INPUT_PULLUP, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT1, PIN_INPUT_PULLUP, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT0, PIN_INPUT_PULLUP, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_MMC0_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_MMC0_CMD, PIN_INPUT_PULLUP, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_INPUT_PULLUP, MUX_MODE7)    /* mcasp0_aclkx.gpio3_14 */
-                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_INPUT_PULLUP, MUX_MODE7)    /* mcasp0_aclkx.gpio3_18 */
-               >;
-       };
-
-       mmc2_pins_default: pinmux_mmc2_pins {
-               pinctrl-single,pins = <
-                       /* eMMC */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ad12.mmc2_dat0 */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ad13.mmc2_dat1 */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ad14.mmc2_dat2 */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ad15.mmc2_dat3 */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_INPUT_PULLUP, MUX_MODE3)        /* gpmc_ad8.mmc2_dat4 */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_INPUT_PULLUP, MUX_MODE3)        /* gpmc_ad9.mmc2_dat5 */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ad10.mmc2_dat6 */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ad11.mmc2_dat7 */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN3, PIN_INPUT_PULLUP, MUX_MODE3)     /* gpmc_csn3.mmc2_cmd */
-                       AM33XX_PADCONF(AM335X_PIN_GPMC_CLK, PIN_INPUT_PULLUP, MUX_MODE3)        /* gpmc_clk.mmc2_clk */
-               >;
-       };
-
-       spi0_pins: pinmux_spi0 {
-               pinctrl-single,pins = <
-                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT_PULLUP, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT_PULLUP, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT_PULLUP, MUX_MODE0)
-                       AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT_PULLUP, MUX_MODE0)
-               >;
-       };
-
-};
-
-&uart0 {
-       /* Console */
-       status = "okay";
-       pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins>;
-};
-
-&uart1 {
-       /* UART 1 setting */
-       status = "okay";
-       pinctrl-names = "default";
-       pinctrl-0 = <&uart1_pins>;
-};
-
-&uart5 {
-       /* UART 2 setting */
-       status = "okay";
-       pinctrl-names = "default";
-       pinctrl-0 = <&uart2_pins>;
 };
 
 &i2c0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&i2c0_pins>;
-
-       status = "okay";
-       clock-frequency = <400000>;
-
        tpm: tpm@20 {
                compatible = "infineon,slb9645tt";
                reg = <0x20>;
        };
-
-       tps: tps@2d {
-               compatible = "ti,tps65910";
-               reg = <0x2d>;
-       };
-
-       eeprom: eeprom@50 {
-               compatible = "atmel,24c16";
-               pagesize = <16>;
-               reg = <0x50>;
-       };
-
-       rtc_wdt: rtc_wdt@68 {
-               compatible = "dallas,ds1374";
-               reg = <0x68>;
-       };
 };
 
-&i2c1 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&i2c1_pins>;
-
-       status = "okay";
-       clock-frequency = <400000>;
-       gpio_xten: gpio_xten@27 {
-               compatible = "nxp,pca9535";
-               gpio-controller;
-               #gpio-cells = <2>;
-               reg = <0x27>;
-       };
-};
-
-&usb0 {
-       dr_mode = "host";
-};
-
-&usb1 {
-       dr_mode = "host";
-};
-
-#include "tps65910.dtsi"
-
 &tps {
-       vcc1-supply = <&vbat>;
-       vcc2-supply = <&vbat>;
-       vcc3-supply = <&vbat>;
-       vcc4-supply = <&vbat>;
-       vcc5-supply = <&vbat>;
-       vcc6-supply = <&vbat>;
-       vcc7-supply = <&vbat>;
-       vccio-supply = <&vbat>;
-
        regulators {
-               vrtc_reg: regulator@0 {
-                       regulator-always-on;
-               };
-
-               vio_reg: regulator@1 {
-                       regulator-always-on;
-               };
-
                vdd1_reg: regulator@2 {
                        /* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */
                        regulator-name = "vdd_mpu";
                        regulator-boot-on;
                        regulator-always-on;
                };
-
-               vdd3_reg: regulator@4 {
-                       regulator-always-on;
-               };
-
-               vdig1_reg: regulator@5 {
-                       regulator-always-on;
-               };
-
-               vdig2_reg: regulator@6 {
-                       regulator-always-on;
-               };
-
-               vpll_reg: regulator@7 {
-                       regulator-always-on;
-               };
-
-               vdac_reg: regulator@8 {
-                       regulator-always-on;
-               };
-
-               vaux1_reg: regulator@9 {
-                       regulator-always-on;
-               };
-
-               vaux2_reg: regulator@10 {
-                       regulator-always-on;
-               };
-
-               vaux33_reg: regulator@11 {
-                       regulator-always-on;
-               };
-
-               vmmc_reg: regulator@12 {
-                       compatible = "regulator-fixed";
-                       regulator-name = "vmmc_reg";
-                       regulator-min-microvolt = <3300000>;
-                       regulator-max-microvolt = <3300000>;
-                       regulator-always-on;
-               };
-       };
-};
-
-/* Power */
-&vbat {
-       regulator-name = "vbat";
-       regulator-min-microvolt = <5000000>;
-       regulator-max-microvolt = <5000000>;
-};
-
-&mac {
-       pinctrl-names = "default";
-       pinctrl-0 = <&cpsw_default>;
-       dual_emac = <1>;
-       status = "okay";
-};
-
-&davinci_mdio {
-       pinctrl-names = "default";
-       pinctrl-0 = <&davinci_mdio_default>;
-       status = "okay";
-
-       ethphy0: ethernet-phy@4 {
-               reg = <4>;
-       };
-
-       ethphy1: ethernet-phy@5 {
-               reg = <5>;
-       };
-};
-
-&cpsw_emac0 {
-       status = "okay";
-       phy-handle = <&ethphy0>;
-       phy-mode = "rmii";
-       dual_emac_res_vlan = <1>;
-};
-
-&cpsw_emac1 {
-       status = "okay";
-       phy-handle = <&ethphy1>;
-       phy-mode = "rmii";
-       dual_emac_res_vlan = <2>;
-};
-
-&sham {
-       status = "okay";
-};
-
-&aes {
-       status = "okay";
-};
-
-&gpio0 {
-       ti,no-reset-on-init;
-};
-
-&mmc1 {
-       pinctrl-names = "default";
-       vmmc-supply = <&vmmcsd_fixed>;
-       bus-width = <4>;
-       pinctrl-0 = <&mmc0_pins_default>;
-       cd-gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
-       wp-gpios = <&gpio3 18 GPIO_ACTIVE_HIGH>;
-       status = "okay";
-};
-
-&mmc3 {
-       dmas = <&edma_xbar 12 0 1
-                       &edma_xbar 13 0 2>;
-       dma-names = "tx", "rx";
-       pinctrl-names = "default";
-       vmmc-supply = <&vmmcsd_fixed>;
-       bus-width = <8>;
-       pinctrl-0 = <&mmc2_pins_default>;
-       non-removable;
-       status = "okay";
-};
-
-&buttons {
-       pinctrl-names = "default";
-       pinctrl-0 = <&push_button_pins>;
-       #address-cells = <1>;
-       #size-cells = <0>;
-
-       button@0 {
-               label = "push_button";
-               linux,code = <0x100>;
-               gpios = <&gpio3 21 GPIO_ACTIVE_LOW>;
        };
 };
 
-/* SPI Busses */
-&spi0 {
-       status = "okay";
-       pinctrl-names = "default";
-       pinctrl-0 = <&spi0_pins>;
-
-       m25p80@0 {
-               compatible = "mx25l6405d";
-               spi-max-frequency = <40000000>;
-
-               reg = <0>;
-               spi-cpol;
-               spi-cpha;
-               #address-cells = <1>;
-               #size-cells = <1>;
-
-               /* reg : The partition's offset and size within the mtd bank. */
-               partitions@0 {
-                       label = "MLO";
-                       reg = <0x0 0x80000>;
-               };
-
-               partitions@1 {
-                       label = "U-Boot";
-                       reg = <0x80000 0x100000>;
-               };
-
-               partitions@2 {
-                       label = "U-Boot Env";
-                       reg = <0x180000 0x20000>;
-               };
-       };
-};
index a3f6bc4..81e4453 100644 (file)
                gpio-controller;
                #gpio-cells = <2>;
                reg = <0x26>;
-               dvi_ena {
+               dvi-ena-hog {
                        gpio-hog;
                        gpios = <13 GPIO_ACTIVE_HIGH>;
                        output-high;
                        line-name = "dvi-enable";
                };
-               lcd_ena {
+               lcd-ena-hog {
                        gpio-hog;
                        gpios = <11 GPIO_ACTIVE_HIGH>;
                        output-high;
index b88d0ca..ea20e4b 100644 (file)
 
                target-module@3e000 {                   /* 0x44e3e000, ap 35 60.0 */
                        compatible = "ti,sysc-omap4-simple", "ti,sysc";
-                       ti,hwmods = "rtc";
                        reg = <0x3e074 0x4>,
                              <0x3e078 0x4>;
                        reg-names = "rev", "sysc";
index 5cb4cc3..4c22980 100644 (file)
         * for the moment, just use a fake OCP bus entry to represent
         * the whole bus hierarchy.
         */
-       ocp {
+       ocp: ocp {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <1>;
                                        <SYSC_IDLE_SMART>;
                        clocks = <&gfx_l3_clkctrl AM3_GFX_L3_GFX_CLKCTRL 0>;
                        clock-names = "fck";
+                       power-domains = <&prm_gfx>;
                        resets = <&prm_gfx 0>;
                        reset-names = "rstctrl";
                        #address-cells = <1>;
        prm_gfx: prm@1100 {
                compatible = "ti,am3-prm-inst", "ti,omap-prm-inst";
                reg = <0x1100 0x100>;
+               #power-domain-cells = <0>;
                #reset-cells = <1>;
        };
 };
index 250c40d..7d8f32b 100644 (file)
 };
 
 &mcbsp1 {
-       status = "ok";
+       status = "okay";
        #sound-dai-cells = <0>;
        pinctrl-names = "default";
        pinctrl-0 = <&mcbsp1_pins>;
 };
 
 &mcbsp2 {
-       status = "ok";
+       status = "okay";
        #sound-dai-cells = <0>;
        pinctrl-names = "default";
        pinctrl-0 = <&mcbsp2_pins>;
index 04f20e7..0d2fac9 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_dpi_pins>;
index 1bb5701..9423e9f 100644 (file)
                                        "FMCA_PG_C2M", "FMCA_PRSNT_M2C_L", "FMCA_CLK_DIR", "SFP_LOS",
                                        "FMCB_EN_12V0", "FMCB_EN_3V3", "FMCB_EN_VADJ", "FMCB_PG_M2C",
                                        "FMCB_PG_C2M", "FMCB_PRSNT_M2C_L", "FMCB_CLK_DIR", "SFP_ModPrsL";
-                               reset_gpios = <&gpio2 11 GPIO_ACTIVE_LOW>;
+                               reset-gpios = <&gpio2 11 GPIO_ACTIVE_LOW>;
                        };
 
                        u42: pca9575@21 {
                                        "QSFPA_LPMode", "QSFPB_ModPrsL", "QSFPB_IntL", "QSFPB_ResetL",
                                        "SFP_TxFault", "SFP_TxDisable", "SFP_RS0", "SFP_RS1",
                                        "QSFPB_ModSelL", "QSFPB_LPMode", "SEL_SFP", "ARM_MR";
-                               reset_gpios = <&gpio2 11 GPIO_ACTIVE_LOW>;
+                               reset-gpios = <&gpio2 11 GPIO_ACTIVE_LOW>;
                        };
 
                        u48: pca9575@22 {
                                        "GP_SW5", "GP_SW6", "GP_SW7", "GP_SW8",
                                        "GP_LED8", "GP_LED7", "GP_LED6", "GP_LED5",
                                        "GP_LED4", "GP_LED3", "GP_LED2", "GP_LED1";
-                               reset_gpios = <&gpio2 11 GPIO_ACTIVE_LOW>;
+                               reset-gpios = <&gpio2 11 GPIO_ACTIVE_LOW>;
                        };
 
                        u59: pca9575@23 {
                                        "GTX1V8PowerFault", "PHYAPowerFault", "PHYBPowerFault", "ArmPowerFault",
                                        "BP_SLOW_GPIO0", "BP_SLOW_GPIO1", "BP_SLOW_GPIO2", "BP_SLOW_GPIO3",
                                        "BP_SLOW_GPIO4", "BP_SLOW_GPIO5", "__unused_u59_p16", "__unused_u59_p17";
-                               reset_gpios = <&gpio2 11 GPIO_ACTIVE_LOW>;
+                               reset-gpios = <&gpio2 11 GPIO_ACTIVE_LOW>;
                        };
 
                        tmp100@48 { compatible = "ti,tmp100"; reg = <0x48>; };
index 1431404..878406b 100644 (file)
@@ -35,8 +35,8 @@
                serial3 = &uart3;
                serial4 = &uart4;
                serial5 = &uart5;
-               ethernet0 = &cpsw_emac0;
-               ethernet1 = &cpsw_emac1;
+               ethernet0 = &cpsw_port1;
+               ethernet1 = &cpsw_port2;
                spi0 = &qspi;
        };
 
                                        <SYSC_IDLE_SMART>;
                        clocks = <&gfx_l3_clkctrl AM4_GFX_L3_GFX_CLKCTRL 0>;
                        clock-names = "fck";
+                       power-domains = <&prm_gfx>;
                        resets = <&prm_gfx 0>;
                        reset-names = "rstctrl";
                        #address-cells = <1>;
        prm_gfx: prm@400 {
                compatible = "ti,am4-prm-inst", "ti,omap-prm-inst";
                reg = <0x400 0x100>;
+               #power-domain-cells = <0>;
                #reset-cells = <1>;
        };
 
index a6b4fca..a83f46e 100644 (file)
        };
 };
 
-&mac {
+&mac_sw {
        pinctrl-names = "default";
        pinctrl-0 = <&cpsw_default>;
-       dual_emac = <1>;
        status = "okay";
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        pinctrl-names = "default";
        pinctrl-0 = <&davinci_mdio_default>;
-       status = "okay";
 
        ethphy0: ethernet-phy@0 {
                reg = <0>;
        };
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&ethphy0>;
        phy-mode = "rgmii-txid";
-       dual_emac_res_vlan = <1>;
+       ti,dual-emac-pvid = <1>;
 };
 
-&cpsw_emac1 {
+&cpsw_port2 {
        phy-handle = <&ethphy1>;
        phy-mode = "rgmii-txid";
-       dual_emac_res_vlan = <2>;
+       ti,dual-emac-pvid = <2>;
 };
 
 &dwc3_1 {
index b28e5c8..6e4d05d 100644 (file)
        status = "okay";
 };
 
-&mac {
-       slaves = <1>;
+&mac_sw {
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&cpsw_default>;
        pinctrl-1 = <&cpsw_sleep>;
        status = "okay";
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&davinci_mdio_default>;
        pinctrl-1 = <&davinci_mdio_sleep>;
-       status = "okay";
 
        ethphy0: ethernet-phy@0 {
                reg = <0>;
        };
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&ethphy0>;
        phy-mode = "rgmii-rxid";
+       ti,dual-emac-pvid = <1>;
+};
+
+&cpsw_port2 {
+       status = "disabled";
 };
 
 &elm {
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_pins>;
index 8b986c4..2dc5255 100644 (file)
        };
 };
 
-&mac {
-       slaves = <1>;
+&mac_sw {
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&cpsw_default>;
        pinctrl-1 = <&cpsw_sleep>;
        status = "okay";
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&davinci_mdio_default>;
        pinctrl-1 = <&davinci_mdio_sleep>;
-       status = "okay";
 
        ethphy0: ethernet-phy@0 {
                reg = <0>;
        };
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&ethphy0>;
        phy-mode = "rgmii-rxid";
+       ti,dual-emac-pvid = <1>;
+};
+
+&cpsw_port2 {
+       status = "disabled";
 };
 
 &rtc {
index 3d393fe..c220dc3 100644 (file)
                        ranges = <0x0 0x39000 0x1000>;
                };
 
-               target-module@3e000 {                   /* 0x44e3e000, ap 34 60.0 */
+               rtc_target: target-module@3e000 {       /* 0x44e3e000, ap 34 60.0 */
                        compatible = "ti,sysc-omap4-simple", "ti,sysc";
-                       ti,hwmods = "rtc";
                        reg = <0x3e074 0x4>,
                              <0x3e078 0x4>;
                        reg-names = "rev", "sysc";
                        #size-cells = <1>;
                        ranges = <0x0 0x100000 0x8000>;
 
-                       mac: ethernet@0 {
-                               compatible = "ti,am4372-cpsw","ti,cpsw";
-                               reg = <0x0 0x800
-                                      0x1200 0x100>;
+                       mac_sw: switch@0 {
+                               compatible = "ti,am4372-cpsw","ti,cpsw-switch";
+                               reg = <0x0 0x4000>;
+                               ranges = <0 0 0x4000>;
+                               clocks = <&cpsw_125mhz_gclk>, <&dpll_clksel_mac_clk>;
+                               clock-names = "fck", "50mclk";
+                               assigned-clocks = <&dpll_clksel_mac_clk>;
+                               assigned-clock-rates = <50000000>;
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               syscon = <&scm_conf>;
+                               status = "disabled";
+
                                interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH
                                              GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH
                                              GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH
                                              GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
-                               #address-cells = <1>;
-                               #size-cells = <1>;
-                               clocks = <&cpsw_125mhz_gclk>, <&cpsw_cpts_rft_clk>,
-                                        <&dpll_clksel_mac_clk>;
-                               clock-names = "fck", "cpts", "50mclk";
-                               assigned-clocks = <&dpll_clksel_mac_clk>;
-                               assigned-clock-rates = <50000000>;
-                               status = "disabled";
-                               cpdma_channels = <8>;
-                               ale_entries = <1024>;
-                               bd_ram_size = <0x2000>;
-                               mac_control = <0x20>;
-                               slaves = <2>;
-                               active_slave = <0>;
-                               cpts_clock_mult = <0x80000000>;
-                               cpts_clock_shift = <29>;
-                               ranges = <0 0 0x8000>;
-                               syscon = <&scm_conf>;
+                               interrupt-names = "rx_thresh", "rx", "tx", "misc";
 
-                               davinci_mdio: mdio@1000 {
-                                       compatible = "ti,am4372-mdio","ti,cpsw-mdio","ti,davinci_mdio";
-                                       reg = <0x1000 0x100>;
-                                       clocks = <&cpsw_125mhz_clkctrl AM4_CPSW_125MHZ_CPGMAC0_CLKCTRL 0>;
-                                       clock-names = "fck";
+                               ethernet-ports {
                                        #address-cells = <1>;
                                        #size-cells = <0>;
-                                       bus_freq = <1000000>;
-                                       status = "disabled";
+
+                                       cpsw_port1: port@1 {
+                                               reg = <1>;
+                                               label = "port1";
+                                               mac-address = [ 00 00 00 00 00 00 ];
+                                               phys = <&phy_gmii_sel 1 0>;
+                                       };
+
+                                       cpsw_port2: port@2 {
+                                               reg = <2>;
+                                               label = "port2";
+                                               mac-address = [ 00 00 00 00 00 00 ];
+                                               phys = <&phy_gmii_sel 2 0>;
+                                       };
                                };
 
-                               cpsw_emac0: slave@200 {
-                                       /* Filled in by U-Boot */
-                                       mac-address = [ 00 00 00 00 00 00 ];
-                                       phys = <&phy_gmii_sel 1 0>;
+                               davinci_mdio_sw: mdio@1000 {
+                                       compatible = "ti,am4372-mdio", "ti,cpsw-mdio","ti,davinci_mdio";
+                                       clocks = <&cpsw_125mhz_gclk>;
+                                       clock-names = "fck";
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       bus_freq = <1000000>;
+                                       reg = <0x1000 0x100>;
                                };
 
-                               cpsw_emac1: slave@300 {
-                                       /* Filled in by U-Boot */
-                                       mac-address = [ 00 00 00 00 00 00 ];
-                                       phys = <&phy_gmii_sel 2 0>;
+                               cpts {
+                                       clocks = <&cpsw_cpts_rft_clk>;
+                                       clock-names = "cpts";
                                };
                        };
                };
index 94cf07e..8ea3780 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_pinctrl_default>;
index 5fffdce..496ed34 100644 (file)
        };
 };
 
-&mac {
+&mac_sw {
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&cpsw_default>;
        pinctrl-1 = <&cpsw_sleep>;
-       dual_emac = <1>;
        status = "okay";
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&davinci_mdio_default>;
        pinctrl-1 = <&davinci_mdio_sleep>;
-       status = "okay";
 
        ethphy0: ethernet-phy@4 {
                reg = <4>;
        };
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&ethphy0>;
        phy-mode = "rgmii-rxid";
-       dual_emac_res_vlan = <1>;
+       ti,dual-emac-pvid = <1>;
 };
 
-&cpsw_emac1 {
+&cpsw_port2 {
        phy-handle = <&ethphy1>;
        phy-mode = "rgmii-rxid";
-       dual_emac_res_vlan = <2>;
+       ti,dual-emac-pvid = <2>;
 };
 
 &elm {
index de4fc78..f517d1e 100644 (file)
        cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
 };
 
-&mac {
+&mac_sw {
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&cpsw_default>;
        pinctrl-1 = <&cpsw_sleep>;
        status = "okay";
-       slaves = <1>;
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&davinci_mdio_default>;
        pinctrl-1 = <&davinci_mdio_sleep>;
-       status = "okay";
 
        ethphy0: ethernet-phy@16 {
                reg = <16>;
        };
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&ethphy0>;
        phy-mode = "rmii";
        phys = <&phy_gmii_sel 1 1>;
+       ti,dual-emac-pvid = <1>;
+};
+
+&cpsw_port2 {
+       status = "disabled";
 };
 
 &i2c0 {
        status = "okay";
 };
 
+&rtc_target {
+       status = "disabled";
+};
+
 &tscadc {
        status = "okay";
 
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_pins>;
index 391a92e..e81078c 100644 (file)
        pinctrl-1 = <&mmc2_pins_hs>;
        pinctrl-2 = <&mmc2_pins_ddr_rev20 &mmc2_iodelay_ddr_conf>;
 };
-
-&mac_sw {
-       pinctrl-names = "default", "sleep";
-       status = "okay";
-};
-
-&cpsw_port1 {
-       phy-handle = <&ethphy0_sw>;
-       phy-mode = "rgmii-rxid";
-       ti,dual-emac-pvid = <1>;
-};
-
-&cpsw_port2 {
-       phy-handle = <&ethphy1_sw>;
-       phy-mode = "rgmii-rxid";
-       ti,dual-emac-pvid = <2>;
-};
-
-&davinci_mdio_sw {
-       ethphy0_sw: ethernet-phy@0 {
-               reg = <0>;
-       };
-
-       ethphy1_sw: ethernet-phy@1 {
-               reg = <1>;
-       };
-};
index e9c7f44..149cfaf 100644 (file)
        status = "okay";
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        reset-gpios = <&gpio2 23 GPIO_ACTIVE_LOW>;
        reset-delay-us = <2>;
 
-       phy0: ethernet-phy@1 {
+       phy0: ethernet-phy@4 {
                reg = <4>;
                eee-broken-100tx;
                eee-broken-1000t;
        };
 };
 
-&mac {
-       slaves = <1>;
+&mac_sw {
        status = "okay";
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&phy0>;
        phy-mode = "rgmii-rxid";
+       ti,dual-emac-pvid = <1>;
+};
+
+&cpsw_port2 {
+       status = "disabled";
 };
 
 &ocp {
index 1a3af4b..6504265 100644 (file)
@@ -27,8 +27,3 @@
        pinctrl-1 = <&mmc2_pins_hs>;
        pinctrl-2 = <&mmc2_pins_ddr_rev20>;
 };
-
-&mac {
-       status = "okay";
-       dual_emac;
-};
index c9275d0..3775876 100644 (file)
        pinctrl-2 = <&mmc2_pins_default>;
 };
 
-&mac {
-       status = "okay";
-       dual_emac;
-};
-
 &m_can0 {
        status = "disabled";
 };
index b3a0206..6b82ecf 100644 (file)
                              <&dra7_pmx_core 0x3f8>;
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        phy0: ethernet-phy@1 {
                reg = <1>;
        };
        };
 };
 
-&mac {
+&mac_sw {
        status = "okay";
-       dual_emac;
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&phy0>;
        phy-mode = "rgmii-rxid";
-       dual_emac_res_vlan = <1>;
+       ti,dual-emac-pvid = <1>;
 };
 
-&cpsw_emac1 {
+&cpsw_port2 {
        phy-handle = <&phy1>;
        phy-mode = "rgmii-rxid";
-       dual_emac_res_vlan = <2>;
+       ti,dual-emac-pvid = <2>;
 };
 
 &mmc1 {
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        vdda_video-supply = <&ldoln_reg>;
 };
 
 &hdmi {
-       status = "ok";
+       status = "okay";
        vdda-supply = <&ldo4_reg>;
 
        port {
 };
 
 &pcie1_rc {
-       status = "ok";
+       status = "okay";
        gpios = <&gpio2 8 GPIO_ACTIVE_LOW>;
 };
 
index 34ca761..0d5fe2b 100644 (file)
        };
 };
 
-&mac {
+&mac_sw {
        status = "okay";
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&cpsw_pins_default>;
        pinctrl-1 = <&cpsw_pins_sleep>;
-       dual_emac;
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&ethphy0>;
        phy-mode = "rgmii-txid";
-       dual_emac_res_vlan = <0>;
+       ti,dual-emac-pvid = <1>;
 };
 
-&cpsw_emac1 {
+&cpsw_port2 {
        phy-handle = <&ethphy1>;
        phy-mode = "rgmii-txid";
-       dual_emac_res_vlan = <1>;
+       ti,dual-emac-pvid = <2>;
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&davinci_mdio_pins_default>;
        pinctrl-1 = <&davinci_mdio_pins_sleep>;
index 1c77006..9fcb894 100644 (file)
        ext-clk-src;
 };
 
-&cpsw_emac0 {
+&mac_sw {
+       status = "okay";
+};
+
+&cpsw_port1 {
        phy-handle = <&ethphy0>;
        phy-mode = "rgmii-rxid";
-       dual_emac_res_vlan = <1>;
+       ti,dual-emac-pvid = <1>;
 };
 
-&cpsw_emac1 {
+&cpsw_port2 {
        phy-handle = <&ethphy1>;
        phy-mode = "rgmii-rxid";
-       dual_emac_res_vlan = <2>;
+       ti,dual-emac-pvid = <2>;
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        ethphy0: ethernet-phy@0 {
                reg = <0>;
        };
index ce5bf1d..beef63e 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        vdda_video-supply = <&ldoln_reg>;
 
 };
 
 &hdmi {
-       status = "ok";
+       status = "okay";
        vdda-supply = <&ldo4_reg>;
 
        pinctrl-names = "default";
index c36d28c..7da718a 100644 (file)
@@ -26,7 +26,7 @@
                stdout-path = &usart2;
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
@@ -81,6 +81,7 @@
                                pinctrl-0 = <&pinctrl_mmc0_clk
                                             &pinctrl_mmc0_slot1_cmd_dat0
                                             &pinctrl_mmc0_slot1_dat1_3>;
+                               pinctrl-names = "default";
                                status = "okay";
 
                                slot@1 {
index fe0207b..a534a8e 100644 (file)
                        compatible = "arm,sp805", "arm,primecell";
                        reg = <0x10010000 0x1000>;
                        clocks = <&wdogclk>, <&pclk>;
-                       clock-names = "wdogclk", "apb_pclk";
+                       clock-names = "wdog_clk", "apb_pclk";
                        status = "disabled";
                };
 
index 9748e0f..0c7dabe 100644 (file)
                        interrupt-parent = <&intc_pb11mp>;
                        interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&wdogclk>, <&pclk>;
-                       clock-names = "wdogclk", "apb_pclk";
+                       clock-names = "wdog_clk", "apb_pclk";
                        status = "disabled";
                };
 
                        interrupt-parent = <&intc_pb11mp>;
                        interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&wdogclk>, <&pclk>;
-                       clock-names = "wdogclk", "apb_pclk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                timer01: timer@10011000 {
                        clocks = <&sp810_syscon 0>,
                                 <&sp810_syscon 1>,
                                 <&pclk>;
-                       clock-names = "timerclk0",
-                                   "timerclk1",
+                       clock-names = "timer0clk",
+                                   "timer1clk",
                                    "apb_pclk";
                };
 
                        clocks = <&sp810_syscon 2>,
                                 <&sp810_syscon 3>,
                                 <&pclk>;
-                       clock-names = "timerclk2",
-                                   "timerclk3",
+                       clock-names = "timer0clk",
+                                   "timer1clk",
                                    "apb_pclk";
                };
 
                timer45: timer@10018000 {
                        compatible = "arm,sp804", "arm,primecell";
                        reg = <0x10018000 0x1000>;
-                       clocks = <&timclk>, <&pclk>;
-                       clock-names = "timer", "apb_pclk";
+                       clocks = <&timclk>, <&timclk>, <&pclk>;
+                       clock-names = "timer0clk", "timer1clk", "apb_pclk";
                        status = "disabled";
                };
 
                timer67: timer@10019000 {
                        compatible = "arm,sp804", "arm,primecell";
                        reg = <0x10019000 0x1000>;
-                       clocks = <&timclk>, <&pclk>;
-                       clock-names = "timer", "apb_pclk";
+                       clocks = <&timclk>, <&timclk>, <&pclk>;
+                       clock-names = "timer0clk", "timer1clk", "apb_pclk";
                        status = "disabled";
                };
 
index f61bd59..ac95667 100644 (file)
                        compatible = "arm,sp805", "arm,primecell";
                        reg = <0x1000f000 0x1000>;
                        clocks = <&wdogclk>, <&pclk>;
-                       clock-names = "wdogclk", "apb_pclk";
+                       clock-names = "wdog_clk", "apb_pclk";
                        status = "disabled";
                };
 
                        compatible = "arm,sp805", "arm,primecell";
                        reg = <0x10010000 0x1000>;
                        clocks = <&wdogclk>, <&pclk>;
-                       clock-names = "wdogclk", "apb_pclk";
+                       clock-names = "wdog_clk", "apb_pclk";
                        status = "disabled";
                };
 
index 7bc7df7..2fb8b14 100644 (file)
 &sdhci1 {
        status = "disabled";
 };
+
+&fmc_flash0 {
+#include "facebook-bmc-flash-layout.dtsi"
+};
+
+&fmc_flash1 {
+       partitions {
+               compatible = "fixed-partitions";
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               flash1@0 {
+                       reg = <0x0 0x2000000>;
+                       label = "flash1";
+               };
+       };
+};
index 88ce4ff..c34741d 100644 (file)
  */
 &fmc_flash0 {
        partitions {
-               data0@1c00000 {
-                       reg = <0x1c00000 0x2400000>;
+               compatible = "fixed-partitions";
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               /*
+                * u-boot partition: 384KB.
+                */
+               u-boot@0 {
+                       reg = <0x0 0x60000>;
+                       label = "u-boot";
                };
+
+               /*
+                * u-boot environment variables: 128KB.
+                */
+               u-boot-env@60000 {
+                       reg = <0x60000 0x20000>;
+                       label = "env";
+               };
+
+               /*
+                * FIT image: 59.5 MB.
+                */
+               fit@80000 {
+                       reg = <0x80000 0x3b80000>;
+                       label = "fit";
+               };
+
+               /*
+                * "data0" partition (4MB) is reserved for persistent
+                * data store.
+                */
+               data0@3800000 {
+                       reg = <0x3c00000 0x400000>;
+                       label = "data0";
+               };
+
+               /*
+                * "flash0" partition (covering the entire flash) is
+                * explicitly created to avoid breaking legacy applications.
+                */
                flash0@0 {
                        reg = <0x0 0x4000000>;
+                       label = "flash0";
                };
        };
 };
 
 &fmc_flash1 {
        partitions {
+               compatible = "fixed-partitions";
+               #address-cells = <1>;
+               #size-cells = <1>;
+
                flash1@0 {
                        reg = <0x0 0x4000000>;
                };
index 8ac23ff..8c426ba 100644 (file)
@@ -48,7 +48,7 @@
        flash@0 {
                status = "okay";
                m25p,fast-read;
-               label = "fmc0";
+               label = "spi0.0";
 #include "facebook-bmc-flash-layout.dtsi"
        };
 };
@@ -71,7 +71,8 @@
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_txd4_default
-                    &pinctrl_rxd4_default>;
+                    &pinctrl_rxd4_default
+                    &pinctrl_ndts4_default>;
 };
 
 &uart5 {
diff --git a/arch/arm/boot/dts/aspeed-bmc-facebook-wedge400.dts b/arch/arm/boot/dts/aspeed-bmc-facebook-wedge400.dts
new file mode 100644 (file)
index 0000000..ad1fcad
--- /dev/null
@@ -0,0 +1,420 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright (c) 2019 Facebook Inc.
+/dts-v1/;
+
+#include <dt-bindings/gpio/aspeed-gpio.h>
+#include "ast2500-facebook-netbmc-common.dtsi"
+
+/ {
+       model = "Facebook Wedge 400 BMC";
+       compatible = "facebook,wedge400-bmc", "aspeed,ast2500";
+
+       aliases {
+               /*
+                * PCA9548 (2-0070) provides 8 channels connecting to
+                * SCM (System Controller Module).
+                */
+               i2c16 = &imux16;
+               i2c17 = &imux17;
+               i2c18 = &imux18;
+               i2c19 = &imux19;
+               i2c20 = &imux20;
+               i2c21 = &imux21;
+               i2c22 = &imux22;
+               i2c23 = &imux23;
+
+               /*
+                * PCA9548 (8-0070) provides 8 channels connecting to
+                * SMB (Switch Main Board).
+                */
+               i2c24 = &imux24;
+               i2c25 = &imux25;
+               i2c26 = &imux26;
+               i2c27 = &imux27;
+               i2c28 = &imux28;
+               i2c29 = &imux29;
+               i2c30 = &imux30;
+               i2c31 = &imux31;
+
+               /*
+                * PCA9548 (11-0076) provides 8 channels connecting to
+                * FCM (Fan Controller Module).
+                */
+               i2c32 = &imux32;
+               i2c33 = &imux33;
+               i2c34 = &imux34;
+               i2c35 = &imux35;
+               i2c36 = &imux36;
+               i2c37 = &imux37;
+               i2c38 = &imux38;
+               i2c39 = &imux39;
+
+               spi2 = &spi_gpio;
+       };
+
+       chosen {
+               stdout-path = &uart1;
+               bootargs = "console=ttyS0,9600n8 root=/dev/ram rw";
+       };
+
+       ast-adc-hwmon {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>, <&adc 4>;
+       };
+
+       /*
+        * GPIO-based SPI Master is required to access SPI TPM, because
+        * full-duplex SPI transactions are not supported by ASPEED SPI
+        * Controllers.
+        */
+       spi_gpio: spi-gpio {
+               status = "okay";
+               compatible = "spi-gpio";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cs-gpios = <&gpio ASPEED_GPIO(R, 2) GPIO_ACTIVE_LOW>;
+               gpio-sck = <&gpio ASPEED_GPIO(R, 3) GPIO_ACTIVE_HIGH>;
+               gpio-mosi = <&gpio ASPEED_GPIO(R, 4) GPIO_ACTIVE_HIGH>;
+               gpio-miso = <&gpio ASPEED_GPIO(R, 5) GPIO_ACTIVE_HIGH>;
+               num-chipselects = <1>;
+
+               tpmdev@0 {
+                       compatible = "tcg,tpm_tis-spi";
+                       spi-max-frequency = <33000000>;
+                       reg = <0>;
+               };
+       };
+};
+
+/*
+ * Both firmware flashes are 128MB on Wedge400 BMC.
+ */
+&fmc_flash0 {
+       partitions {
+               compatible = "fixed-partitions";
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               /*
+                * u-boot partition: 384KB.
+                */
+               u-boot@0 {
+                       reg = <0x0 0x60000>;
+                       label = "u-boot";
+               };
+
+               /*
+                * u-boot environment variables: 128KB.
+                */
+               u-boot-env@60000 {
+                       reg = <0x60000 0x20000>;
+                       label = "env";
+               };
+
+               /*
+                * FIT image: 123.5 MB.
+                */
+               fit@80000 {
+                       reg = <0x80000 0x7b80000>;
+                       label = "fit";
+               };
+
+               /*
+                * "data0" partition (4MB) is reserved for persistent
+                * data store.
+                */
+               data0@3800000 {
+                       reg = <0x7c00000 0x800000>;
+                       label = "data0";
+               };
+
+               /*
+                * "flash0" partition (covering the entire flash) is
+                * explicitly created to avoid breaking legacy applications.
+                */
+               flash0@0 {
+                       reg = <0x0 0x8000000>;
+                       label = "flash0";
+               };
+       };
+};
+
+&fmc_flash1 {
+       partitions {
+               compatible = "fixed-partitions";
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               flash1@0 {
+                       reg = <0x0 0x8000000>;
+                       label = "flash1";
+               };
+       };
+};
+
+&uart2 {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_txd2_default
+                    &pinctrl_rxd2_default>;
+};
+
+&uart4 {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_txd4_default
+                    &pinctrl_rxd4_default>;
+};
+
+/*
+ * I2C bus #0 is multi-master environment dedicated for BMC and Bridge IC
+ * communication.
+ */
+&i2c0 {
+       status = "okay";
+       multi-master;
+       bus-frequency = <1000000>;
+};
+
+&i2c1 {
+       status = "okay";
+};
+
+&i2c2 {
+       status = "okay";
+
+       i2c-switch@70 {
+               compatible = "nxp,pca9548";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x70>;
+               i2c-mux-idle-disconnect;
+
+               imux16: i2c@0 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0>;
+               };
+
+               imux17: i2c@1 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <1>;
+               };
+
+               imux18: i2c@2 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <2>;
+               };
+
+               imux19: i2c@3 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <3>;
+               };
+
+               imux20: i2c@4 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <4>;
+               };
+
+               imux21: i2c@5 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <5>;
+               };
+
+               imux22: i2c@6 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <6>;
+               };
+
+               imux23: i2c@7 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <7>;
+               };
+       };
+};
+
+&i2c3 {
+       status = "okay";
+};
+
+&i2c4 {
+       status = "okay";
+};
+
+&i2c5 {
+       status = "okay";
+};
+
+&i2c6 {
+       status = "okay";
+};
+
+&i2c7 {
+       status = "okay";
+};
+
+&i2c8 {
+       status = "okay";
+
+       i2c-switch@70 {
+               compatible = "nxp,pca9548";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x70>;
+               i2c-mux-idle-disconnect;
+
+               imux24: i2c@0 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0>;
+               };
+
+               imux25: i2c@1 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <1>;
+               };
+
+               imux26: i2c@2 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <2>;
+               };
+
+               imux27: i2c@3 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <3>;
+               };
+
+               imux28: i2c@4 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <4>;
+               };
+
+               imux29: i2c@5 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <5>;
+               };
+
+               imux30: i2c@6 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <6>;
+               };
+
+               imux31: i2c@7 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <7>;
+               };
+
+       };
+};
+
+&i2c9 {
+       status = "okay";
+};
+
+&i2c10 {
+       status = "okay";
+};
+
+&i2c11 {
+       status = "okay";
+
+       i2c-switch@76 {
+               compatible = "nxp,pca9548";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x76>;
+               i2c-mux-idle-disconnect;
+
+               imux32: i2c@0 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0>;
+               };
+
+               imux33: i2c@1 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <1>;
+               };
+
+               imux34: i2c@2 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <2>;
+               };
+
+               imux35: i2c@3 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <3>;
+               };
+
+               imux36: i2c@4 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <4>;
+               };
+
+               imux37: i2c@5 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <5>;
+               };
+
+               imux38: i2c@6 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <6>;
+               };
+
+               imux39: i2c@7 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <7>;
+               };
+
+       };
+};
+
+&i2c12 {
+       status = "okay";
+};
+
+&i2c13 {
+       status = "okay";
+};
+
+&adc {
+       status = "okay";
+};
+
+&ehci1 {
+       status = "okay";
+};
+
+&uhci {
+       status = "okay";
+};
+
+&sdhci1 {
+       /*
+        * DMA mode needs to be disabled to avoid conflicts with UHCI
+        * Controller in AST2500 SoC.
+        */
+       sdhci-caps-mask = <0x0 0x580000>;
+};
index fe2e11c..5e61058 100644 (file)
 &i2c13 {
        status = "okay";
 };
+
+&fmc_flash0 {
+#include "facebook-bmc-flash-layout.dtsi"
+};
+
+&fmc_flash1 {
+       partitions {
+               compatible = "fixed-partitions";
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               flash1@0 {
+                       reg = <0x0 0x2000000>;
+                       label = "flash1";
+               };
+       };
+};
index b94421f..21ae880 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "aspeed-g6.dtsi"
 #include <dt-bindings/gpio/aspeed-gpio.h>
+#include <dt-bindings/i2c/i2c.h>
 #include <dt-bindings/leds/leds-pca955x.h>
 
 / {
                };
 
                vga_memory: region@bf000000 {
-                        no-map;
-                        reg = <0xbf000000 0x01000000>;  /* 16M */
-                };
+                       no-map;
+                       compatible = "shared-dma-pool";
+                       reg = <0xbf000000 0x01000000>;  /* 16M */
+               };
        };
 
        gpio-keys {
        status = "okay";
 };
 
+&pinctrl_emmc_default {
+       bias-disable;
+};
+
 &emmc {
        status = "okay";
 };
 };
 
 &i2c7 {
+       multi-master;
        status = "okay";
 
        si7021-a20@20 {
                };
        };
 
+       ibm-panel@62 {
+               compatible = "ibm,op-panel";
+               reg = <(0x62 | I2C_OWN_SLAVE_ADDRESS)>;
+       };
+
        dps: dps310@76 {
                compatible = "infineon,dps310";
                reg = <0x76>;
                spi-max-frequency = <100000000>;
        };
 };
+
+&xdma {
+       status = "okay";
+       memory-region = <&vga_memory>;
+};
diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-mowgli.dts b/arch/arm/boot/dts/aspeed-bmc-opp-mowgli.dts
new file mode 100644 (file)
index 0000000..b648e46
--- /dev/null
@@ -0,0 +1,662 @@
+// SPDX-License-Identifier: GPL-2.0+
+/dts-v1/;
+#include "aspeed-g5.dtsi"
+#include <dt-bindings/gpio/aspeed-gpio.h>
+#include <dt-bindings/leds/leds-pca955x.h>
+
+/ {
+       model = "Mowgli BMC";
+       compatible = "ibm,mowgli-bmc", "aspeed,ast2500";
+
+
+       chosen {
+               stdout-path = &uart5;
+               bootargs = "console=ttyS4,115200 earlyprintk";
+       };
+
+       memory@80000000 {
+               reg = <0x80000000 0x20000000>;
+       };
+
+       reserved-memory {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               flash_memory: region@98000000 {
+                       no-map;
+                       reg = <0x98000000 0x04000000>; /* 64M */
+               };
+
+               gfx_memory: framebuffer {
+                       size = <0x01000000>;
+                       alignment = <0x01000000>;
+                       compatible = "shared-dma-pool";
+                       reusable;
+               };
+
+               video_engine_memory: jpegbuffer {
+                       size = <0x02000000>;
+                       alignment = <0x01000000>;
+                       compatible = "shared-dma-pool";
+                       reusable;
+               };
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               air-water {
+                       label = "air-water";
+                       gpios = <&gpio ASPEED_GPIO(F, 6) GPIO_ACTIVE_LOW>;
+                       linux,code = <ASPEED_GPIO(F, 6)>;
+               };
+
+               checkstop {
+                       label = "checkstop";
+                       gpios = <&gpio ASPEED_GPIO(J, 2) GPIO_ACTIVE_LOW>;
+                       linux,code = <ASPEED_GPIO(J, 2)>;
+               };
+
+               ps0-presence {
+                       label = "ps0-presence";
+                       gpios = <&gpio ASPEED_GPIO(Z, 2) GPIO_ACTIVE_LOW>;
+                       linux,code = <ASPEED_GPIO(Z, 2)>;
+               };
+
+               ps1-presence {
+                       label = "ps1-presence";
+                       gpios = <&gpio ASPEED_GPIO(Z, 0) GPIO_ACTIVE_LOW>;
+                       linux,code = <ASPEED_GPIO(Z, 0)>;
+               };
+
+               id-button {
+                       label = "id-button";
+                       gpios = <&gpio ASPEED_GPIO(F, 1) GPIO_ACTIVE_LOW>;
+                       linux,code = <ASPEED_GPIO(F, 1)>;
+               };
+       };
+
+       gpio-keys-polled {
+               compatible = "gpio-keys-polled";
+               poll-interval = <1000>;
+
+               fan0-presence {
+                       label = "fan0-presence";
+                       gpios = <&pca9552 9 GPIO_ACTIVE_LOW>;
+                       linux,code = <9>;
+               };
+
+               fan1-presence {
+                       label = "fan1-presence";
+                       gpios = <&pca9552 10 GPIO_ACTIVE_LOW>;
+                       linux,code = <10>;
+               };
+
+               fan2-presence {
+                       label = "fan2-presence";
+                       gpios = <&pca9552 11 GPIO_ACTIVE_LOW>;
+                       linux,code = <11>;
+               };
+
+               fan3-presence {
+                       label = "fan3-presence";
+                       gpios = <&pca9552 12 GPIO_ACTIVE_LOW>;
+                       linux,code = <12>;
+               };
+
+               fan4-presence {
+                       label = "fan4-presence";
+                       gpios = <&pca9552 13 GPIO_ACTIVE_LOW>;
+                       linux,code = <13>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               front-fault {
+                       retain-state-shutdown;
+                       default-state = "keep";
+                       gpios = <&gpio ASPEED_GPIO(AA, 0) GPIO_ACTIVE_LOW>;
+               };
+
+               power-button {
+                       retain-state-shutdown;
+                       default-state = "keep";
+                       gpios = <&gpio ASPEED_GPIO(AA, 1) GPIO_ACTIVE_LOW>;
+               };
+
+               front-id {
+                       retain-state-shutdown;
+                       default-state = "keep";
+                       gpios = <&gpio ASPEED_GPIO(AA, 2) GPIO_ACTIVE_LOW>;
+               };
+
+               fan0 {
+                       retain-state-shutdown;
+                       default-state = "keep";
+                       gpios = <&pca9552 0 GPIO_ACTIVE_LOW>;
+               };
+
+               fan1 {
+                       retain-state-shutdown;
+                       default-state = "keep";
+                       gpios = <&pca9552 1 GPIO_ACTIVE_LOW>;
+               };
+
+               fan2 {
+                       retain-state-shutdown;
+                       default-state = "keep";
+                       gpios = <&pca9552 2 GPIO_ACTIVE_LOW>;
+               };
+
+               fan3 {
+                       retain-state-shutdown;
+                       default-state = "keep";
+                       gpios = <&pca9552 3 GPIO_ACTIVE_LOW>;
+               };
+
+               fan4 {
+                       retain-state-shutdown;
+                       default-state = "keep";
+                       gpios = <&pca9552 4 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       fsi: gpio-fsi {
+               compatible = "fsi-master-gpio", "fsi-master";
+               #address-cells = <2>;
+               #size-cells = <0>;
+               no-gpio-delays;
+
+               clock-gpios = <&gpio ASPEED_GPIO(E, 6) GPIO_ACTIVE_HIGH>;
+               data-gpios = <&gpio ASPEED_GPIO(E, 7) GPIO_ACTIVE_HIGH>;
+               mux-gpios = <&gpio ASPEED_GPIO(R, 2) GPIO_ACTIVE_HIGH>;
+               enable-gpios = <&gpio ASPEED_GPIO(D, 0) GPIO_ACTIVE_HIGH>;
+               trans-gpios = <&gpio ASPEED_GPIO(E, 5) GPIO_ACTIVE_HIGH>;
+       };
+
+       iio-hwmon-12v {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 0>;
+       };
+
+       iio-hwmon-5v {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 1>;
+       };
+
+       iio-hwmon-3v {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 2>;
+       };
+
+       iio-hwmon-vdd {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 3>;
+       };
+
+       iio-hwmon-vcs {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 5>;
+       };
+
+       iio-hwmon-vdn {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 7>;
+       };
+
+       iio-hwmon-vio {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 9>;
+       };
+
+       iio-hwmon-vddra {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 11>;
+       };
+
+       iio-hwmon-battery {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 12>;
+       };
+
+       iio-hwmon-vddrb {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 13>;
+       };
+};
+
+&pwm_tacho {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm0_default &pinctrl_pwm1_default
+               &pinctrl_pwm2_default &pinctrl_pwm3_default
+               &pinctrl_pwm4_default>;
+
+       fan@0 {
+               reg = <0x00>;
+               aspeed,fan-tach-ch = /bits/ 8 <0x00>;
+       };
+
+       fan@1 {
+               reg = <0x01>;
+               aspeed,fan-tach-ch = /bits/ 8 <0x01>;
+       };
+
+       fan@2 {
+               reg = <0x02>;
+               aspeed,fan-tach-ch = /bits/ 8 <0x02>;
+       };
+
+       fan@3 {
+               reg = <0x03>;
+               aspeed,fan-tach-ch = /bits/ 8 <0x03>;
+       };
+
+       fan@4 {
+               reg = <0x04>;
+               aspeed,fan-tach-ch = /bits/ 8 <0x04>;
+       };
+
+       fan@5 {
+               reg = <0x00>;
+               aspeed,fan-tach-ch = /bits/ 8 <0x05>;
+       };
+
+       fan@6 {
+               reg = <0x01>;
+               aspeed,fan-tach-ch = /bits/ 8 <0x06>;
+       };
+
+       fan@7 {
+               reg = <0x02>;
+               aspeed,fan-tach-ch = /bits/ 8 <0x07>;
+       };
+
+       fan@8 {
+               reg = <0x03>;
+               aspeed,fan-tach-ch = /bits/ 8 <0x08>;
+       };
+
+       fan@9 {
+               reg = <0x04>;
+               aspeed,fan-tach-ch = /bits/ 8 <0x09>;
+       };
+};
+
+&fmc {
+       status = "okay";
+       flash@0 {
+               status = "okay";
+               label = "bmc";
+               m25p,fast-read;
+               spi-max-frequency = <50000000>;
+               partitions {
+                       #address-cells = < 1 >;
+                       #size-cells = < 1 >;
+                       compatible = "fixed-partitions";
+                       u-boot@0 {
+                               reg = < 0 0x60000 >;
+                               label = "u-boot";
+                       };
+                       u-boot-env@60000 {
+                               reg = < 0x60000 0x20000 >;
+                               label = "u-boot-env";
+                       };
+                       obmc-ubi@80000 {
+                               reg = < 0x80000 0x1F80000 >;
+                               label = "obmc-ubi";
+                       };
+               };
+       };
+       flash@1 {
+               status = "okay";
+               label = "alt-bmc";
+               m25p,fast-read;
+               spi-max-frequency = <50000000>;
+               partitions {
+                       #address-cells = < 1 >;
+                       #size-cells = < 1 >;
+                       compatible = "fixed-partitions";
+                       u-boot@0 {
+                               reg = < 0 0x60000 >;
+                               label = "alt-u-boot";
+                       };
+                       u-boot-env@60000 {
+                               reg = < 0x60000 0x20000 >;
+                               label = "alt-u-boot-env";
+                       };
+                       obmc-ubi@80000 {
+                               reg = < 0x80000 0x1F80000 >;
+                               label = "alt-obmc-ubi";
+                       };
+               };
+       };
+};
+
+&spi1 {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_spi1_default>;
+
+       flash@0 {
+               status = "okay";
+               label = "pnor";
+               m25p,fast-read;
+               spi-max-frequency = <100000000>;
+       };
+};
+
+&lpc_ctrl {
+       status = "okay";
+       memory-region = <&flash_memory>;
+       flash = <&spi1>;
+};
+
+&uart1 {
+       /* Rear RS-232 connector */
+       status = "okay";
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_txd1_default
+                       &pinctrl_rxd1_default
+                       &pinctrl_nrts1_default
+                       &pinctrl_ndtr1_default
+                       &pinctrl_ndsr1_default
+                       &pinctrl_ncts1_default
+                       &pinctrl_ndcd1_default
+                       &pinctrl_nri1_default>;
+};
+
+&uart2 {
+       /* APSS */
+       status = "okay";
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_txd2_default &pinctrl_rxd2_default>;
+};
+
+&uart5 {
+       status = "okay";
+};
+
+&mac0 {
+       status = "okay";
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_rmii1_default>;
+       clocks = <&syscon ASPEED_CLK_GATE_MAC1CLK>,
+                <&syscon ASPEED_CLK_MAC1RCLK>;
+       clock-names = "MACCLK", "RCLK";
+       use-ncsi;
+};
+
+&mac1 {
+       status = "okay";
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_rgmii2_default &pinctrl_mdio2_default>;
+};
+
+&i2c0 {
+       status = "okay";
+
+       tmp275@48 {
+               compatible = "ti,tmp275";
+               reg = <0x48>;
+       };
+};
+
+&i2c1 {
+       status = "disabled";
+};
+
+&i2c2 {
+       status = "okay";
+
+       /* CPU MFG CONN */
+
+};
+
+&i2c3 {
+       status = "okay";
+
+       /* APSS */
+       /* CPLD */
+
+       /* PCA9516 (repeater) ->
+        *    CLK Buffer 9FGS9092
+        *    Power Supply 0
+        *    Power Supply 1
+        *    PCA 9552 LED
+        */
+
+       pca9552: pca9552@60 {
+               compatible = "nxp,pca9552";
+               reg = <0x60>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               gpio-controller;
+               #gpio-cells = <2>;
+
+               gpio@0 {
+                       reg = <0>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@1 {
+                       reg = <1>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@2 {
+                       reg = <2>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@3 {
+                       reg = <3>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@4 {
+                       reg = <4>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@5 {
+                       reg = <5>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@6 {
+                       reg = <6>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@7 {
+                       reg = <7>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@8 {
+                       reg = <8>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@9 {
+                       reg = <9>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@10 {
+                       reg = <10>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@11 {
+                       reg = <11>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@12 {
+                       reg = <12>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@13 {
+                       reg = <13>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@14 {
+                       reg = <14>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+               gpio@15 {
+                       reg = <15>;
+                       type = <PCA955X_TYPE_GPIO>;
+               };
+       };
+
+       power-supply@68 {
+               compatible = "ibm,cffps1";
+               reg = <0x68>;
+       };
+
+       power-supply@69 {
+               compatible = "ibm,cffps1";
+               reg = <0x69>;
+       };
+};
+
+&i2c4 {
+       status = "okay";
+
+       /* CP0 VDD & VCS : IR35221 */
+       /* CP0 VDN & VIO : IR35221 */
+       /* CP0 VDDR : IR35221 */
+
+       ir35221@28 {
+               compatible = "infineon,ir35221";
+               reg = <0x28>;
+       };
+
+       ir35221@29 {
+               compatible = "infineon,ir35221";
+               reg = <0x29>;
+       };
+
+       ir35221@2d {
+               compatible = "infineon,ir35221";
+               reg = <0x2d>;
+       };
+
+};
+
+&i2c5 {
+       status = "disabled";
+};
+
+&i2c6 {
+       status = "disabled";
+};
+
+&i2c7 {
+       status = "disabled";
+};
+
+&i2c8 {
+       status = "okay";
+
+       eeprom@50 {
+               compatible = "atmel,24c64";
+               reg = <0x50>;
+       };
+};
+
+&i2c9 {
+       status = "okay";
+
+       /* PCIe G3 x16 slot */
+};
+
+&i2c10 {
+       status = "disabled";
+};
+
+&i2c11 {
+       status = "okay";
+
+       /* CPLD */
+       /* TPM */
+       /* RTC RX8900CE */
+       /* TMP275A */
+       /* TMP275A */
+
+       tmp275@48 {
+               compatible = "ti,tmp275";
+               reg = <0x48>;
+       };
+
+       tmp275@49 {
+               compatible = "ti,tmp275";
+               reg = <0x49>;
+       };
+
+};
+
+&i2c12 {
+       status = "disabled";
+};
+
+&i2c13 {
+       status = "disabled";
+};
+
+&vuart {
+       status = "okay";
+};
+
+&gfx {
+       status = "okay";
+       memory-region = <&gfx_memory>;
+};
+
+&adc {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_adc0_default
+                       &pinctrl_adc1_default
+                       &pinctrl_adc2_default
+                       &pinctrl_adc3_default
+                       &pinctrl_adc4_default
+                       &pinctrl_adc5_default
+                       &pinctrl_adc6_default
+                       &pinctrl_adc7_default
+                       &pinctrl_adc8_default
+                       &pinctrl_adc9_default
+                       &pinctrl_adc10_default
+                       &pinctrl_adc11_default
+                       &pinctrl_adc12_default
+                       &pinctrl_adc13_default
+                       &pinctrl_adc14_default
+                       &pinctrl_adc15_default>;
+};
+
+&wdt1 {
+       aspeed,reset-type = "none";
+       aspeed,external-signal;
+       aspeed,ext-push-pull;
+       aspeed,ext-active-high;
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdtrst1_default>;
+};
+
+&wdt2 {
+       aspeed,alt-boot;
+};
+
+&ibt {
+       status = "okay";
+};
+
+&vhub {
+       status = "okay";
+};
+
+&video {
+       status = "okay";
+       memory-region = <&video_engine_memory>;
+};
+
+#include "ibm-power9-dual.dtsi"
index 5f4ee67..4d070d6 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "aspeed-g6.dtsi"
 #include <dt-bindings/gpio/aspeed-gpio.h>
+#include <dt-bindings/i2c/i2c.h>
 #include <dt-bindings/leds/leds-pca955x.h>
 
 / {
 };
 
 &i2c0 {
+       multi-master;
        status = "okay";
+
+       ibm-panel@62 {
+               compatible = "ibm,op-panel";
+               reg = <(0x62 | I2C_OWN_SLAVE_ADDRESS)>;
+       };
 };
 
 &i2c1 {
index 9c91afb..a93009a 100644 (file)
                                interrupts = <8>;
                                clocks = <&syscon ASPEED_CLK_APB>;
                                no-loopback-test;
-                               aspeed,sirq-polarity-sense = <&syscon 0x70 25>;
                                status = "disabled";
                        };
 
index 7468f10..c0c43b8 100644 (file)
                status = "okay";
                m25p,fast-read;
                label = "spi0.0";
-
-#include "facebook-bmc-flash-layout.dtsi"
        };
 
        fmc_flash1: flash@1 {
                status = "okay";
                m25p,fast-read;
                label = "spi0.1";
-
-               partitions {
-                       compatible = "fixed-partitions";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-
-                       flash1@0 {
-                               reg = <0x0 0x2000000>;
-                               label = "flash1";
-                       };
-               };
        };
 };
 
index dbfefef..713d18f 100644 (file)
@@ -22,7 +22,7 @@
                bootargs = "console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait";
        };
 
-       memory {
+       memory@20000000 {
                /* 128 MB, change this for 256 MB revision */
                reg = <0x20000000 0x8000000>;
        };
@@ -93,6 +93,7 @@
        pinctrl-0 = <
                &pinctrl_mmc0_slot0_clk_cmd_dat0
                &pinctrl_mmc0_slot0_dat1_3>;
+       pinctrl-names = "default";
        status = "okay";
 
        slot@0 {
index 0267e72..2c52a71 100644 (file)
@@ -15,7 +15,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x8000000>;
        };
 
@@ -48,6 +48,7 @@
        pinctrl-0 = <
                &pinctrl_mmc0_slot0_clk_cmd_dat0
                &pinctrl_mmc0_slot0_dat1_3>;
+       pinctrl-names = "default";
        status = "okay";
 
        slot@0 {
index feebd54..ee0f5da 100644 (file)
@@ -20,7 +20,7 @@
                bootargs = "console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x8000000>;
        };
 
                &pinctrl_board_mmc0
                &pinctrl_mmc0_slot0_clk_cmd_dat0
                &pinctrl_mmc0_slot0_dat1_3>;
+       pinctrl-names = "default";
        status = "okay";
 
        slot@0 {
index 73e88d1..04cb7be 100644 (file)
@@ -34,6 +34,7 @@
        pinctrl-0 = <
                &pinctrl_mmc1_slot0_clk_cmd_dat0
                &pinctrl_mmc1_slot0_dat1_3>;
+       pinctrl-names = "default";
        status = "okay";
 
        slot@0 {
index 683b9e3..7edf057 100644 (file)
@@ -17,7 +17,7 @@
                bootargs = "console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
@@ -55,6 +55,7 @@
                                        &pinctrl_mmc0_clk
                                        &pinctrl_mmc0_slot1_cmd_dat0
                                        &pinctrl_mmc0_slot1_dat1_3>;
+                               pinctrl-names = "default";
                                status = "okay";
 
                                slot@1 {
index 7d938cc..7add151 100644 (file)
@@ -18,7 +18,7 @@
                stdout-path = &dbgu;
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x2000000>;
        };
 
index af38253..25f7610 100644 (file)
@@ -17,7 +17,7 @@
                stdout-path = &dbgu;
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x10000000>;
        };
 
index fddf267..d37724c 100644 (file)
@@ -16,7 +16,7 @@
                stdout-path = &dbgu;
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x8000000>;
        };
 
index 41f1639..533a440 100644 (file)
@@ -13,7 +13,7 @@
        compatible = "axentia,linea",
                     "atmel,sama5d31", "atmel,sama5d3", "atmel,sama5";
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 };
index a50b7fd..969d990 100644 (file)
@@ -14,7 +14,7 @@
                bootargs = "console=ttyS0,115200";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
@@ -52,6 +52,7 @@
                                        &pinctrl_mmc0_clk
                                        &pinctrl_mmc0_slot0_cmd_dat0
                                        &pinctrl_mmc0_slot0_dat1_3>;
+                               pinctrl-names = "default";
                                status = "okay";
                                slot@0 {
                                        reg = <0>;
index 954404e..1e2a28c 100644 (file)
@@ -15,7 +15,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
@@ -49,6 +49,7 @@
                                        &pinctrl_mmc0_clk
                                        &pinctrl_mmc0_slot1_cmd_dat0
                                        &pinctrl_mmc0_slot1_dat1_3>;
+                               pinctrl-names = "default";
                                status = "okay";
 
                                slot@1 {
index 7abf555..cf13632 100644 (file)
@@ -16,7 +16,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x10000000>;
        };
 
index 0be184a..710cb72 100644 (file)
@@ -9,7 +9,7 @@
        model = "Aries/DENX MA5D4";
        compatible = "aries,ma5d4", "denx,ma5d4", "atmel,sama5d4", "atmel,sama5";
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x10000000>;
        };
 
index 924d949..e5974a1 100644 (file)
@@ -16,7 +16,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x20000000>;
        };
 
index 0cc1cff..fe432b6 100644 (file)
@@ -16,7 +16,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x20000000>;
        };
 
index 241682a..39474a1 100644 (file)
@@ -16,7 +16,7 @@
                stdout-path = &dbgu;
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x8000000>;
        };
 
index 15050fd..a51a337 100644 (file)
@@ -17,7 +17,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
index ebe61a2..430c753 100644 (file)
@@ -17,7 +17,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
 };
 
 &mmc0 {
+       pinctrl-names = "default";
        pinctrl-0 = <
                &pinctrl_mmc0_slot0_clk_cmd_dat0
                &pinctrl_mmc0_slot0_dat1_3>;
index 1487b89..74b249b 100644 (file)
@@ -17,7 +17,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 };
index a5040f5..d1181ea 100644 (file)
                ssc2 = &ssc2;
        };
        cpus {
-               #address-cells = <0>;
+               #address-cells = <1>;
                #size-cells = <0>;
 
-               cpu {
+               cpu@0 {
                        compatible = "arm,arm920t";
                        device_type = "cpu";
+                       reg = <0>;
                };
        };
 
-       memory {
+       memory@20000000 {
                device_type = "memory";
                reg = <0x20000000 0x04000000>;
        };
@@ -70,6 +71,9 @@
        sram: sram@200000 {
                compatible = "mmio-sram";
                reg = <0x00200000 0x4000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00200000 0x4000>;
        };
 
        ahb {
                                clock-names = "mci_clk";
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               pinctrl-names = "default";
                                status = "disabled";
                        };
 
index 1e0bf5a..e1ef4e4 100644 (file)
@@ -15,7 +15,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
index 6afbb48..82c5d7f 100644 (file)
                ssc0 = &ssc0;
        };
        cpus {
-               #address-cells = <0>;
+               #address-cells = <1>;
                #size-cells = <0>;
 
-               cpu {
+               cpu@0 {
                        compatible = "arm,arm926ej-s";
                        device_type = "cpu";
+                       reg = <0>;
                };
        };
 
-       memory {
+       memory@20000000 {
                device_type = "memory";
                reg = <0x20000000 0x04000000>;
        };
@@ -73,6 +74,9 @@
        sram0: sram@2ff000 {
                compatible = "mmio-sram";
                reg = <0x002ff000 0x2000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x002ff000 0x2000>;
        };
 
        ahb {
                                interrupts = <9 IRQ_TYPE_LEVEL_HIGH 0>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               pinctrl-names = "default";
                                clocks = <&pmc PMC_TYPE_PERIPHERAL 9>;
                                clock-names = "mci_clk";
                                status = "disabled";
index 81f808a..d3446e4 100644 (file)
@@ -16,7 +16,7 @@
                stdout-path = &dbgu;
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
@@ -55,6 +55,7 @@
                                        &pinctrl_mmc0_clk
                                        &pinctrl_mmc0_slot1_cmd_dat0
                                        &pinctrl_mmc0_slot1_dat1_3>;
+                               pinctrl-names = "default";
                                status = "okay";
                                slot@1 {
                                        reg = <1>;
index 5ed3d74..7adc36c 100644 (file)
        };
 
        cpus {
-               #address-cells = <0>;
+               #address-cells = <1>;
                #size-cells = <0>;
 
-               cpu {
+               cpu@0 {
                        compatible = "arm,arm926ej-s";
                        device_type = "cpu";
+                       reg = <0>;
                };
        };
 
-       memory {
+       memory@20000000 {
                device_type = "memory";
                reg = <0x20000000 0x08000000>;
        };
@@ -64,6 +65,9 @@
        sram: sram@300000 {
                compatible = "mmio-sram";
                reg = <0x00300000 0x28000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00300000 0x28000>;
        };
 
        ahb {
index c4ef74f..beed819 100644 (file)
@@ -16,7 +16,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
index 5c990cf..fe45d96 100644 (file)
        };
 
        cpus {
-               #address-cells = <0>;
+               #address-cells = <1>;
                #size-cells = <0>;
 
-               cpu {
+               cpu@0 {
                        compatible = "arm,arm926ej-s";
                        device_type = "cpu";
+                       reg = <0>;
                };
        };
 
-       memory {
+       memory@20000000 {
                device_type = "memory";
                reg = <0x20000000 0x08000000>;
        };
        sram0: sram@300000 {
                compatible = "mmio-sram";
                reg = <0x00300000 0x14000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00300000 0x14000>;
        };
 
        sram1: sram@500000 {
                compatible = "mmio-sram";
                reg = <0x00500000 0x4000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00500000 0x4000>;
        };
 
        ahb {
                                compatible = "atmel,hsmci";
                                reg = <0xfff80000 0x600>;
                                interrupts = <10 IRQ_TYPE_LEVEL_HIGH 0>;
-                               pinctrl-names = "default";
                                #address-cells = <1>;
                                #size-cells = <0>;
                                clocks = <&pmc PMC_TYPE_PERIPHERAL 10>;
                                compatible = "atmel,hsmci";
                                reg = <0xfff84000 0x600>;
                                interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>;
-                               pinctrl-names = "default";
                                #address-cells = <1>;
                                #size-cells = <0>;
                                clocks = <&pmc PMC_TYPE_PERIPHERAL 11>;
index 62d2185..71f6057 100644 (file)
@@ -16,7 +16,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
@@ -72,6 +72,7 @@
                                        &pinctrl_mmc0_clk
                                        &pinctrl_mmc0_slot0_cmd_dat0
                                        &pinctrl_mmc0_slot0_dat1_3>;
+                               pinctrl-names = "default";
                                status = "okay";
                                slot@0 {
                                        reg = <0>;
index 4117cf8..708e164 100644 (file)
@@ -11,7 +11,7 @@
        model = "Atmel AT91SAM9G20 family SoC";
        compatible = "atmel,at91sam9g20";
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x08000000>;
        };
 
@@ -22,6 +22,9 @@
        sram1: sram@2fc000 {
                compatible = "mmio-sram";
                reg = <0x002fc000 0x8000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x002fc000 0x8000>;
        };
 
        ahb {
index bda2270..6e6e672 100644 (file)
@@ -13,7 +13,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
@@ -93,6 +93,7 @@
                                        &pinctrl_mmc0_clk
                                        &pinctrl_mmc0_slot1_cmd_dat0
                                        &pinctrl_mmc0_slot1_dat1_3>;
+                               pinctrl-names = "default";
                                status = "okay";
                                slot@1 {
                                        reg = <1>;
diff --git a/arch/arm/boot/dts/at91sam9g25-gardena-smart-gateway.dts b/arch/arm/boot/dts/at91sam9g25-gardena-smart-gateway.dts
new file mode 100644 (file)
index 0000000..7da70ae
--- /dev/null
@@ -0,0 +1,158 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Device Tree file for the GARDENA smart Gateway (Article No. 19000)
+ *
+ *  Copyright (C) 2020 GARDENA GmbH
+ */
+
+/dts-v1/;
+
+#include "at91sam9g25.dtsi"
+#include "at91sam9x5ek.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "GARDENA smart Gateway (Article No. 19000)";
+       compatible = "gardena,smart-gateway-at91sam", "atmel,at91sam9g25", "atmel,at91sam9x5",
+               "atmel,at91sam9";
+
+       aliases {
+               serial1 = &usart3;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               user_btn1 {
+                       label = "USER_BTN1";
+                       gpios = <&pioA 24 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_PROG1>;
+               };
+       };
+
+       1wire_cm {
+               status = "disabled";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               power_blue {
+                       label = "smartgw:power:blue";
+                       gpios = <&pioC 21 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               power_green {
+                       label = "smartgw:power:green";
+                       gpios = <&pioC 20 GPIO_ACTIVE_HIGH>;
+                       default-state = "on";
+               };
+
+               power_red {
+                       label = "smartgw:power:red";
+                       gpios = <&pioC 19 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               radio_blue {
+                       label = "smartgw:radio:blue";
+                       gpios = <&pioC 18 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               radio_green {
+                       label = "smartgw:radio:green";
+                       gpios = <&pioC 17 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               radio_red {
+                       label = "smartgw:radio:red";
+                       gpios = <&pioC 16 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               internet_blue {
+                       label = "smartgw:internet:blue";
+                       gpios = <&pioC 15 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               internet_green {
+                       label = "smartgw:internet:green";
+                       gpios = <&pioC 14 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               internet_red {
+                       label = "smartgw:internet:red";
+                       gpios = <&pioC 13 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               heartbeat {
+                       label = "smartgw:heartbeat";
+                       gpios = <&pioB 8 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+               };
+
+               pb18 {
+                       status = "disabled";
+               };
+
+               pd21 {
+                       status = "disabled";
+               };
+       };
+};
+
+&macb0 {
+       phy-mode = "rmii";
+       status = "okay";
+};
+
+&usart0 {
+       status = "disabled";
+};
+
+&usart2 {
+       status = "disabled";
+};
+
+&usart3 {
+       status = "okay";
+
+       pinctrl-0 = <&pinctrl_usart3
+                    &pinctrl_usart3_rts
+                    &pinctrl_usart3_cts
+                   >;
+};
+
+&watchdog {
+       status = "okay";
+};
+
+&mmc0 {
+       status = "disabled";
+};
+
+&mmc1 {
+       status = "disabled";
+};
+
+&spi0 {
+       status = "disabled";
+};
+
+&i2c0 {
+       status = "disabled";
+};
+
+&adc0 {
+       status = "disabled";
+};
+
+&ssc0 {
+       status = "disabled";
+};
index 1fbee2a..19fc748 100644 (file)
                pwm0 = &pwm0;
        };
        cpus {
-               #address-cells = <0>;
+               #address-cells = <1>;
                #size-cells = <0>;
 
-               cpu {
+               cpu@0 {
                        compatible = "arm,arm926ej-s";
                        device_type = "cpu";
+                       reg = <0>;
                };
        };
 
-       memory {
+       memory@70000000 {
                device_type = "memory";
                reg = <0x70000000 0x10000000>;
        };
@@ -78,6 +79,9 @@
        sram: sram@300000 {
                compatible = "mmio-sram";
                reg = <0x00300000 0x10000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00300000 0x10000>;
        };
 
        ahb {
                                compatible = "atmel,hsmci";
                                reg = <0xfff80000 0x600>;
                                interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>;
-                               pinctrl-names = "default";
                                dmas = <&dma 1 AT91_DMA_CFG_PER_ID(0)>;
                                dma-names = "rxtx";
                                #address-cells = <1>;
                                compatible = "atmel,hsmci";
                                reg = <0xfffd0000 0x600>;
                                interrupts = <29 IRQ_TYPE_LEVEL_HIGH 0>;
-                               pinctrl-names = "default";
                                dmas = <&dma 1 AT91_DMA_CFG_PER_ID(13)>;
                                dma-names = "rxtx";
                                #address-cells = <1>;
index a3a5c82..9734667 100644 (file)
@@ -18,7 +18,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@70000000 {
                reg = <0x70000000 0x4000000>;
        };
 
@@ -99,6 +99,7 @@
                                        &pinctrl_board_mmc0
                                        &pinctrl_mmc0_slot0_clk_cmd_dat0
                                        &pinctrl_mmc0_slot0_dat1_3>;
+                               pinctrl-names = "default";
                                status = "okay";
                                slot@0 {
                                        reg = <0>;
                                        &pinctrl_board_mmc1
                                        &pinctrl_mmc1_slot0_clk_cmd_dat0
                                        &pinctrl_mmc1_slot0_dat1_3>;
+                               pinctrl-names = "default";
                                status = "okay";
                                slot@0 {
                                        reg = <0>;
index a994d07..0785389 100644 (file)
                pwm0 = &pwm0;
        };
        cpus {
-               #address-cells = <0>;
+               #address-cells = <1>;
                #size-cells = <0>;
 
-               cpu {
+               cpu@0 {
                        compatible = "arm,arm926ej-s";
                        device_type = "cpu";
+                       reg = <0>;
                };
        };
 
-       memory {
+       memory@20000000 {
                device_type = "memory";
                reg = <0x20000000 0x10000000>;
        };
@@ -68,6 +69,9 @@
        sram: sram@300000 {
                compatible = "mmio-sram";
                reg = <0x00300000 0x8000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00300000 0x8000>;
        };
 
        ahb {
index 870b83f..2bc4e6e 100644 (file)
@@ -17,7 +17,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x8000000>;
        };
 
index 4d70194..5653e70 100644 (file)
        };
 
        cpus {
-               #address-cells = <0>;
+               #address-cells = <1>;
                #size-cells = <0>;
 
-               cpu {
+               cpu@0 {
                        compatible = "arm,arm926ej-s";
                        device_type = "cpu";
+                       reg = <0>;
                };
        };
 
-       memory {
+       memory@20000000 {
                device_type = "memory";
                reg = <0x20000000 0x04000000>;
        };
@@ -75,6 +76,9 @@
        sram: sram@300000 {
                compatible = "mmio-sram";
                reg = <0x00300000 0x10000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00300000 0x10000>;
        };
 
        ahb {
index 0de75d3..1590862 100644 (file)
@@ -17,7 +17,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
index 948fe99..4cdb050 100644 (file)
                pwm0 = &pwm0;
        };
        cpus {
-               #address-cells = <0>;
+               #address-cells = <1>;
                #size-cells = <0>;
 
-               cpu {
+               cpu@0 {
                        compatible = "arm,arm926ej-s";
                        device_type = "cpu";
+                       reg = <0>;
                };
        };
 
-       memory {
+       memory@20000000 {
                device_type = "memory";
                reg = <0x20000000 0x10000000>;
        };
@@ -76,6 +77,9 @@
        sram: sram@300000 {
                compatible = "mmio-sram";
                reg = <0x00300000 0x8000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00300000 0x8000>;
        };
 
        ahb {
                                interrupts = <12 IRQ_TYPE_LEVEL_HIGH 0>;
                                dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(0)>;
                                dma-names = "rxtx";
-                               pinctrl-names = "default";
                                clocks = <&pmc PMC_TYPE_PERIPHERAL 12>;
                                clock-names = "mci_clk";
                                #address-cells = <1>;
                                interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>;
                                dmas = <&dma1 1 AT91_DMA_CFG_PER_ID(0)>;
                                dma-names = "rxtx";
-                               pinctrl-names = "default";
                                clocks = <&pmc PMC_TYPE_PERIPHERAL 26>;
                                clock-names = "mci_clk";
                                #address-cells = <1>;
index 75d2f7f..cdd37f6 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 / {
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x8000000>;
        };
 
index c934928..6d1264d 100644 (file)
@@ -56,6 +56,7 @@
                &pinctrl_board_mmc0
                &pinctrl_mmc0_slot0_clk_cmd_dat0
                &pinctrl_mmc0_slot0_dat1_3>;
+       pinctrl-names = "default";
        status = "okay";
 
        slot@0 {
@@ -70,6 +71,7 @@
                &pinctrl_board_mmc1
                &pinctrl_mmc1_slot0_clk_cmd_dat0
                &pinctrl_mmc1_slot0_dat1_3>;
+       pinctrl-names = "default";
        status = "okay";
 
        slot@0 {
index 3f9d8ca..f571f77 100644 (file)
@@ -19,5 +19,8 @@
        sram1: sram@300000 {
                compatible = "mmio-sram";
                reg = <0x00300000 0x4000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00300000 0x4000>;
        };
 };
index 35bdd09..dacaef2 100644 (file)
                        compatible = "arm,sp805" , "arm,primecell";
                        reg = <0x18009000 0x1000>;
                        interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&axi81_clk>;
-                       clock-names = "apb_pclk";
+                       clocks = <&axi81_clk>, <&axi81_clk>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                gpio_ccm: gpio@1800a000 {
index c846fa3..e895f7c 100644 (file)
                };
 
                ccbtimer0: timer@34000 {
-                       compatible = "arm,sp804";
+                       compatible = "arm,sp804", "arm,primecell";
                        reg = <0x34000 0x1000>;
                        interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
                };
 
                ccbtimer1: timer@35000 {
-                       compatible = "arm,sp804";
+                       compatible = "arm,sp804", "arm,primecell";
                        reg = <0x35000 0x1000>;
                        interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
                        reg = <0x39000 0x1000>;
                        interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&iprocslow>, <&iprocslow>;
-                       clock-names = "wdogclk", "apb_pclk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                lcpll0: lcpll0@3f100 {
index e94244a..09a1182 100644 (file)
        };
 };
 
+&ddc0 {
+       status = "okay";
+};
+
+&ddc1 {
+       status = "okay";
+};
+
 &firmware {
        firmware_clocks: clocks {
                compatible = "raspberrypi,firmware-clocks";
                          "RGMII_TXD3";
 };
 
+&hdmi0 {
+       clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 0>, <&clk_27MHz>;
+       clock-names = "hdmi", "bvb", "audio", "cec";
+       status = "okay";
+};
+
+&hdmi1 {
+       clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 1>, <&clk_27MHz>;
+       clock-names = "hdmi", "bvb", "audio", "cec";
+       status = "okay";
+};
+
+&hvs {
+       clocks = <&firmware_clocks 4>;
+};
+
+&pixelvalve0 {
+       status = "okay";
+};
+
+&pixelvalve1 {
+       status = "okay";
+};
+
+&pixelvalve2 {
+       status = "okay";
+};
+
+&pixelvalve4 {
+       status = "okay";
+};
+
 &pwm1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pwm1_0_gpio40 &pwm1_1_gpio41>;
 &vchiq {
        interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
 };
+
+&vc4 {
+       status = "okay";
+};
+
+&vec {
+       status = "disabled";
+};
index 00bcaed..4847dd3 100644 (file)
 
        interrupt-parent = <&gicv2>;
 
+       vc4: gpu {
+               compatible = "brcm,bcm2711-vc5";
+               status = "disabled";
+       };
+
+       clk_27MHz: clk-27M {
+               #clock-cells = <0>;
+               compatible = "fixed-clock";
+               clock-frequency = <27000000>;
+               clock-output-names = "27MHz-clock";
+       };
+
        clk_108MHz: clk-108M {
                #clock-cells = <0>;
                compatible = "fixed-clock";
                        status = "disabled";
                };
 
+               pixelvalve0: pixelvalve@7e206000 {
+                       compatible = "brcm,bcm2711-pixelvalve0";
+                       reg = <0x7e206000 0x100>;
+                       interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
+               pixelvalve1: pixelvalve@7e207000 {
+                       compatible = "brcm,bcm2711-pixelvalve1";
+                       reg = <0x7e207000 0x100>;
+                       interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
+               pixelvalve2: pixelvalve@7e20a000 {
+                       compatible = "brcm,bcm2711-pixelvalve2";
+                       reg = <0x7e20a000 0x100>;
+                       interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
                pwm1: pwm@7e20c800 {
                        compatible = "brcm,bcm2835-pwm";
                        reg = <0x7e20c800 0x28>;
                        status = "disabled";
                };
 
-               hvs@7e400000 {
+               pixelvalve4: pixelvalve@7e216000 {
+                       compatible = "brcm,bcm2711-pixelvalve4";
+                       reg = <0x7e216000 0x100>;
+                       interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
+               hvs: hvs@7e400000 {
+                       compatible = "brcm,bcm2711-hvs";
                        interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
                };
 
+               pixelvalve3: pixelvalve@7ec12000 {
+                       compatible = "brcm,bcm2711-pixelvalve3";
+                       reg = <0x7ec12000 0x100>;
+                       interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
                dvp: clock@7ef00000 {
                        compatible = "brcm,brcm2711-dvp";
                        reg = <0x7ef00000 0x10>;
                        #clock-cells = <1>;
                        #reset-cells = <1>;
                };
+
+               hdmi0: hdmi@7ef00700 {
+                       compatible = "brcm,bcm2711-hdmi0";
+                       reg = <0x7ef00700 0x300>,
+                             <0x7ef00300 0x200>,
+                             <0x7ef00f00 0x80>,
+                             <0x7ef00f80 0x80>,
+                             <0x7ef01b00 0x200>,
+                             <0x7ef01f00 0x400>,
+                             <0x7ef00200 0x80>,
+                             <0x7ef04300 0x100>,
+                             <0x7ef20000 0x100>;
+                       reg-names = "hdmi",
+                                   "dvp",
+                                   "phy",
+                                   "rm",
+                                   "packet",
+                                   "metadata",
+                                   "csc",
+                                   "cec",
+                                   "hd";
+                       clock-names = "hdmi", "bvb", "audio", "cec";
+                       resets = <&dvp 0>;
+                       ddc = <&ddc0>;
+                       dmas = <&dma 10>;
+                       dma-names = "audio-rx";
+                       status = "disabled";
+               };
+
+               ddc0: i2c@7ef04500 {
+                       compatible = "brcm,bcm2711-hdmi-i2c";
+                       reg = <0x7ef04500 0x100>, <0x7ef00b00 0x300>;
+                       reg-names = "bsc", "auto-i2c";
+                       clock-frequency = <97500>;
+                       status = "disabled";
+               };
+
+               hdmi1: hdmi@7ef05700 {
+                       compatible = "brcm,bcm2711-hdmi1";
+                       reg = <0x7ef05700 0x300>,
+                             <0x7ef05300 0x200>,
+                             <0x7ef05f00 0x80>,
+                             <0x7ef05f80 0x80>,
+                             <0x7ef06b00 0x200>,
+                             <0x7ef06f00 0x400>,
+                             <0x7ef00280 0x80>,
+                             <0x7ef09300 0x100>,
+                             <0x7ef20000 0x100>;
+                       reg-names = "hdmi",
+                                   "dvp",
+                                   "phy",
+                                   "rm",
+                                   "packet",
+                                   "metadata",
+                                   "csc",
+                                   "cec",
+                                   "hd";
+                       ddc = <&ddc1>;
+                       clock-names = "hdmi", "bvb", "audio", "cec";
+                       resets = <&dvp 1>;
+                       dmas = <&dma 17>;
+                       dma-names = "audio-rx";
+                       status = "disabled";
+               };
+
+               ddc1: i2c@7ef09500 {
+                       compatible = "brcm,bcm2711-hdmi-i2c";
+                       reg = <0x7ef09500 0x100>, <0x7ef05b00 0x300>;
+                       reg-names = "bsc", "auto-i2c";
+                       clock-frequency = <97500>;
+                       status = "disabled";
+               };
        };
 
        /*
diff --git a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
new file mode 100644 (file)
index 0000000..3b978dc
--- /dev/null
@@ -0,0 +1,197 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/*
+ * Broadcom BCM470X / BCM5301X ARM platform code.
+ * DTS for Meraki MR32 / Codename: Espresso
+ *
+ * Copyright (C) 2018-2020 Christian Lamparter <chunkeey@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "bcm4708.dtsi"
+#include "bcm5301x-nand-cs0-bch8.dtsi"
+#include <dt-bindings/leds/common.h>
+
+/ {
+       compatible = "meraki,mr32", "brcm,brcm53016", "brcm,bcm4708";
+       model = "Meraki MR32";
+
+       chosen {
+               bootargs = " console=ttyS0,115200n8 earlycon";
+       };
+
+       memory {
+               reg = <0x00000000 0x08000000>;
+               device_type = "memory";
+       };
+
+       aliases {
+               serial1 = &uart2;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               sysled3 {
+                       function = LED_FUNCTION_FAULT;
+                       color = <LED_COLOR_ID_AMBER>;
+                       gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>;
+                       panic-indicator;
+               };
+               sysled2 {
+                       function = LED_FUNCTION_INDICATOR;
+                       color = <LED_COLOR_ID_WHITE>;
+                       gpios = <&chipcommon 19 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               restart {
+                       label = "Reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&chipcommon 21 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       pwm-leds {
+               compatible = "pwm-leds";
+
+               red {
+                       /* SYS-LED 1 - Tricolor */
+                       function = LED_FUNCTION_INDICATOR;
+                       color = <LED_COLOR_ID_RED>;
+                       pwms = <&pwm 0 50000 0>;
+                       max-brightness = <255>;
+               };
+
+               green {
+                       /* SYS-LED 1 - Tricolor */
+                       function = LED_FUNCTION_POWER;
+                       color = <LED_COLOR_ID_GREEN>;
+                       pwms = <&pwm 1 50000 0>;
+                       max-brightness = <255>;
+               };
+
+               blue {
+                       /* SYS-LED 1 - Tricolor */
+                       function = LED_FUNCTION_INDICATOR;
+                       color = <LED_COLOR_ID_BLUE>;
+                       pwms = <&pwm 2 50000 0>;
+                       max-brightness = <255>;
+               };
+       };
+
+       i2c {
+               /*
+                * The platform provided I2C does not budge.
+                * This is a replacement until I can figure
+                * out what are the missing bits...
+                */
+
+               compatible = "i2c-gpio";
+               sda-gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
+               scl-gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
+               i2c-gpio,delay-us = <10>; /* close to 100 kHz */
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               current_sense: ina219@45 {
+                       compatible = "ti,ina219";
+                       reg = <0x45>;
+                       shunt-resistor = <60000>; /* = 60 mOhms */
+               };
+
+               eeprom: eeprom@50 {
+                       compatible = "atmel,24c64";
+                       reg = <0x50>;
+                       pagesize = <32>;
+                       read-only;
+               };
+       };
+};
+
+&uart0 {
+       clock-frequency = <62500000>;
+       /delete-property/ clocks;
+};
+
+&uart1 {
+       status = "disabled";
+};
+
+&uart2 {
+       status = "okay";
+       /*
+        * bluetooth-le {
+        *      compatible = "brcm,bcm20732";
+        *      enable-gpios = <&chipcommon 20 GPIO_ACTIVE_HIGH>;
+        *};
+        */
+};
+
+&gmac1 {
+       status = "disabled";
+};
+&gmac2 {
+       status = "disabled";
+};
+&gmac3 {
+       status = "disabled";
+};
+
+&pwm {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinmux_pwm>;
+};
+
+&nandcs {
+       nand-ecc-algo = "hw";
+
+       partitions {
+               /*
+                * The partition autodetection does not work for this device.
+                * It will only detect the "nvram" partition with an incorrect size.
+                *      [    1.721667] 1 bcm47xxpart partitions found on MTD device brcmnand.0
+                *      [    1.727962] Creating 1 MTD partitions on "brcmnand.0":
+                *      [    1.733117] 0x000000400000-0x000008000000 : "nvram"
+                */
+
+               compatible = "fixed-partitions";
+               #address-cells = <0x1>;
+               #size-cells = <0x1>;
+
+               partition0@0 {
+                       label = "u-boot";
+                       reg = <0x0 0x100000>;
+                       read-only;
+               };
+
+               partition1@100000 {
+                       label = "bootkernel1";
+                       reg = <0x100000 0x300000>;
+                       read-only;
+               };
+
+               partition2@400000 {
+                       label = "nvram";
+                       reg = <0x400000 0x100000>;
+                       read-only;
+               };
+
+               partition3@500000 {
+                       label = "bootkernel2";
+                       reg = <0x500000 0x300000>;
+                       read-only;
+               };
+
+               partition4@800000 {
+                       label = "ubi";
+                       reg = <0x800000 0x7780000>;
+               };
+       };
+};
index 0016720..ac3a99c 100644 (file)
                        reg = <0x00013000 0x1000>;
                };
 
+               pcie2: pcie@14000 {
+                       reg = <0x00014000 0x1000>;
+               };
+
                usb2: usb2@21000 {
                        reg = <0x00021000 0x1000>;
 
                };
        };
 
+       pwm: pwm@18002000 {
+               compatible = "brcm,iproc-pwm";
+               reg = <0x18002000 0x28>;
+               clocks = <&osc>;
+               #pwm-cells = <3>;
+               status = "disabled";
+       };
+
        mdio: mdio@18003000 {
                compatible = "brcm,iproc-mdio";
                reg = <0x18003000 0x8>;
                reg = <0x18105000 0x1000>;
        };
 
+       uart2: serial@18008000 {
+               compatible = "ns16550a";
+               reg = <0x18008000 0x20>;
+               clocks = <&iprocslow>;
+               interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+               reg-shift = <2>;
+               status = "disabled";
+       };
+
        i2c0: i2c@18009000 {
                compatible = "brcm,iproc-i2c";
                reg = <0x18009000 0x50>;
                                        function = "spi";
                                };
 
-                               i2c {
+                               pinmux_i2c: i2c {
                                        groups = "i2c_grp";
                                        function = "i2c";
                                };
 
-                               pwm {
+                               pinmux_pwm: pwm {
                                        groups = "pwm0_grp", "pwm1_grp",
                                                 "pwm2_grp", "pwm3_grp";
                                        function = "pwm";
index 716da62..21f922d 100644 (file)
 };
 
 &sdio {
-       status = "ok";
+       status = "okay";
 };
 
 &uart0 {
index 7b84b54..7782b61 100644 (file)
 &sdio {
        bus-width = <4>;
        no-1-8-v;
-       status = "ok";
+       status = "okay";
 };
 
 &srab {
index a952d93..38530db 100644 (file)
        ti,no-idle-on-init;
 };
 
-&mac {
+&mac_sw {
        status = "okay";
-       dual_emac;
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&ethphy0>;
        phy-mode = "rgmii";
-       dual_emac_res_vlan = <1>;
+       ti,dual-emac-pvid = <1>;
 };
 
-&cpsw_emac1 {
+&cpsw_port2 {
        phy-handle = <&ethphy1>;
        phy-mode = "rgmii";
-       dual_emac_res_vlan = <2>;
+       ti,dual-emac-pvid = <2>;
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        ethphy0: ethernet-phy@2 {
                reg = <2>;
        };
 };
 
 &dcan1 {
-       status = "ok";
+       status = "okay";
        pinctrl-names = "default", "sleep", "active";
        pinctrl-0 = <&dcan1_pins_sleep>;
        pinctrl-1 = <&dcan1_pins_sleep>;
index 27a6a83..3bf90d9 100644 (file)
                         */
                        ti,no-idle;
 
-                       mac: ethernet@0 {
-                               compatible = "ti,dra7-cpsw","ti,cpsw";
-                               clocks = <&gmac_main_clk>, <&gmac_clkctrl DRA7_GMAC_GMAC_CLKCTRL 25>;
-                               clock-names = "fck", "cpts";
-                               cpdma_channels = <8>;
-                               ale_entries = <1024>;
-                               bd_ram_size = <0x2000>;
-                               mac_control = <0x20>;
-                               slaves = <2>;
-                               active_slave = <0>;
-                               cpts_clock_mult = <0x784CFE14>;
-                               cpts_clock_shift = <29>;
-                               reg = <0x0 0x1000
-                                      0x1200 0x2e00>;
-                               #address-cells = <1>;
-                               #size-cells = <1>;
-
-                               /*
-                                * rx_thresh_pend
-                                * rx_pend
-                                * tx_pend
-                                * misc_pend
-                                */
-                               interrupts = <GIC_SPI 334 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 335 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 336 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 337 IRQ_TYPE_LEVEL_HIGH>;
-                               ranges = <0 0 0x4000>;
-                               syscon = <&scm_conf>;
-                               status = "disabled";
-
-                               davinci_mdio: mdio@1000 {
-                                       compatible = "ti,cpsw-mdio","ti,davinci_mdio";
-                                       clocks = <&gmac_main_clk>;
-                                       clock-names = "fck";
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
-                                       bus_freq = <1000000>;
-                                       reg = <0x1000 0x100>;
-                               };
-
-                               cpsw_emac0: slave@200 {
-                                       /* Filled in by U-Boot */
-                                       mac-address = [ 00 00 00 00 00 00 ];
-                                       phys = <&phy_gmii_sel 1>;
-                               };
-
-                               cpsw_emac1: slave@300 {
-                                       /* Filled in by U-Boot */
-                                       mac-address = [ 00 00 00 00 00 00 ];
-                                       phys = <&phy_gmii_sel 2>;
-                               };
-                       };
-
                        mac_sw: switch@0 {
                                compatible = "ti,dra7-cpsw-switch","ti,cpsw-switch";
                                reg = <0x0 0x4000>;
 
                rtctarget: target-module@38000 {                        /* 0x48838000, ap 29 12.0 */
                        compatible = "ti,sysc-omap4-simple", "ti,sysc";
-                       ti,hwmods = "rtcss";
                        reg = <0x38074 0x4>,
                              <0x38078 0x4>;
                        reg-names = "rev", "sysc";
index cca6b12..4e1bbc0 100644 (file)
@@ -37,8 +37,8 @@
                serial7 = &uart8;
                serial8 = &uart9;
                serial9 = &uart10;
-               ethernet0 = &cpsw_emac0;
-               ethernet1 = &cpsw_emac1;
+               ethernet0 = &cpsw_port1;
+               ethernet1 = &cpsw_port2;
                d_can0 = &dcan1;
                d_can1 = &dcan2;
                spi0 = &qspi;
index 10da51b..cad58f7 100644 (file)
        vqmmc-supply = <&evm_1v8_sw>;
 };
 
-&mac {
+&mac_sw {
        mode-gpios = <&pcf_gpio_21 4 GPIO_ACTIVE_LOW>,
                     <&pcf_hdmi 9 GPIO_ACTIVE_LOW>,     /* P11 */
                     <&pcf_hdmi 10 GPIO_ACTIVE_LOW>;    /* P12 */
-       dual_emac;
+       status = "okay";
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&dp83867_0>;
        phy-mode = "rgmii-id";
-       dual_emac_res_vlan = <1>;
+       ti,dual-emac-pvid = <1>;
 };
 
-&cpsw_emac1 {
+&cpsw_port2 {
        phy-handle = <&dp83867_1>;
        phy-mode = "rgmii-id";
-       dual_emac_res_vlan = <2>;
+       ti,dual-emac-pvid = <2>;
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        dp83867_0: ethernet-phy@2 {
                reg = <2>;
                ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>;
index 9273a7d..b65b2dd 100644 (file)
        };
 };
 
-&mac {
-       status = "okay";
-};
-
 &dcan1 {
-       status = "ok";
+       status = "okay";
        pinctrl-names = "default", "sleep", "active";
        pinctrl-0 = <&dcan1_pins_sleep>;
        pinctrl-1 = <&dcan1_pins_sleep>;
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 };
 
 &hdmi {
-       status = "ok";
+       status = "okay";
 
        port {
                hdmi_out: endpoint {
index 54dab0f..f242b93 100644 (file)
        interrupts = <30 IRQ_TYPE_EDGE_FALLING>;
 };
 
-&mac {
+&mac_sw {
        mode-gpios = <&pcf_gpio_21 4 GPIO_ACTIVE_LOW>,
                     <&pcf_hdmi 9 GPIO_ACTIVE_LOW>,     /* P11 */
                     <&pcf_hdmi 10 GPIO_ACTIVE_LOW>;    /* P12 */
-       dual_emac;
+       status = "okay";
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&dp83867_0>;
        phy-mode = "rgmii-id";
-       dual_emac_res_vlan = <1>;
+       ti,dual-emac-pvid = <1>;
 };
 
-&cpsw_emac1 {
+&cpsw_port2 {
        phy-handle = <&dp83867_1>;
        phy-mode = "rgmii-id";
-       dual_emac_res_vlan = <2>;
+       ti,dual-emac-pvid = <2>;
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        dp83867_0: ethernet-phy@2 {
                reg = <2>;
                ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>;
index 6ea9936..5f62f92 100644 (file)
        interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
 };
 
-&mac {
-       slaves = <1>;
+&mac_sw {
        mode-gpios = <&pcf_gpio_21 4 GPIO_ACTIVE_HIGH>;
+       status = "okay";
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&ethphy0>;
        phy-mode = "rgmii";
+       ti,dual-emac-pvid = <1>;
+};
+
+&cpsw_port2 {
+       status = "disabled";
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        ethphy0: ethernet-phy@3 {
                reg = <3>;
        };
index 803981c..9bd01ae 100644 (file)
        status = "disabled";
 };
 
-&mac {
+&mac_sw {
        status = "okay";
-
-       dual_emac;
 };
 
-&cpsw_emac0 {
+&cpsw_port1 {
        phy-handle = <&dp83867_0>;
        phy-mode = "rgmii-id";
-       dual_emac_res_vlan = <1>;
+       ti,dual-emac-pvid = <1>;
 };
 
-&cpsw_emac1 {
+&cpsw_port2 {
        phy-handle = <&dp83867_1>;
        phy-mode = "rgmii-id";
-       dual_emac_res_vlan = <2>;
+       ti,dual-emac-pvid = <2>;
 };
 
-&davinci_mdio {
+&davinci_mdio_sw {
        dp83867_0: ethernet-phy@2 {
                reg = <2>;
                ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>;
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
        vdda_video-supply = <&ldo5_reg>;
 };
 
 &hdmi {
-       status = "ok";
+       status = "okay";
 
        vdda-supply = <&ldo1_reg>;
 
index 96678dd..ecfaa0b 100644 (file)
                clock-names = "sclk";
        };
 
-       pfc: pin-controller@e0140200 {
+       pfc: pinctrl@e0140200 {
                compatible = "renesas,pfc-emev2";
                reg = <0xe0140200 0x100>;
        };
index 052a52f..ad7a085 100644 (file)
@@ -15,7 +15,7 @@
                bootargs = "console=ttyS0,115200 root=/dev/mtdblock0 rw rootfstype=jffs2";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x08000000>;
        };
 
index 6c2f320..12887b3 100644 (file)
        assigned-clock-rates = <6000000>;
 };
 
+&cmu {
+       clocks = <&xusbxti>;
+};
+
 &cpu0 {
        cpu0-supply = <&buck2_reg>;
 };
index ca29d7e..c1a68e6 100644 (file)
@@ -26,7 +26,7 @@
 
        memory@40000000 {
                device_type = "memory";
-               reg =  <0x40000000 0x1ff00000>;
+               reg = <0x40000000 0x1ff00000>;
        };
 
        firmware@205f000 {
        status = "okay";
 };
 
+&cmu {
+       clocks = <&xusbxti>;
+};
+
 &cpu0 {
        cpu0-supply = <&buck2_reg>;
 };
index aba8350..b55afaa 100644 (file)
@@ -30,7 +30,7 @@
 
        memory@40000000 {
                device_type = "memory";
-               reg =  <0x40000000 0x1ff00000>;
+               reg = <0x40000000 0x1ff00000>;
        };
 
        firmware@205f000 {
        status = "okay";
 };
 
+&cmu {
+       clocks = <&xusbxti>;
+};
+
 &cpu0 {
        cpu0-supply = <&buck2_reg>;
 };
index d3fb45a..a1e93fb 100644 (file)
                };
        };
 
-       fixed-rate-clocks {
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               xusbxti: clock@0 {
-                       compatible = "fixed-clock";
-                       reg = <0>;
-                       clock-frequency = <0>;
-                       #clock-cells = <0>;
-                       clock-output-names = "xusbxti";
-               };
+       xusbxti: clock-0 {
+               compatible = "fixed-clock";
+               clock-frequency = <0>;
+               #clock-cells = <0>;
+               clock-output-names = "xusbxti";
+       };
 
-               xxti: clock@1 {
-                       compatible = "fixed-clock";
-                       reg = <1>;
-                       clock-frequency = <0>;
-                       #clock-cells = <0>;
-                       clock-output-names = "xxti";
-               };
+       xxti: clock-1 {
+               compatible = "fixed-clock";
+               clock-frequency = <0>;
+               #clock-cells = <0>;
+               clock-output-names = "xxti";
+       };
 
-               xtcxo: clock@2 {
-                       compatible = "fixed-clock";
-                       reg = <2>;
-                       clock-frequency = <0>;
-                       #clock-cells = <0>;
-                       clock-output-names = "xtcxo";
-               };
+       xtcxo: clock-2 {
+               compatible = "fixed-clock";
+               clock-frequency = <0>;
+               #clock-cells = <0>;
+               clock-output-names = "xtcxo";
        };
 
        pmu {
                };
 
                hsotg: hsotg@12480000 {
-                       compatible = "samsung,s3c6400-hsotg", "snps,dwc2";
+                       compatible = "samsung,s3c6400-hsotg";
                        reg = <0x12480000 0x20000>;
                        interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&cmu CLK_USBOTG>;
index 6d0c04d..5370ee4 100644 (file)
                reset-gpios = <&gpl1 2 GPIO_ACTIVE_LOW>;
        };
 
-       i2c_max17042_fuel: i2c-gpio {
+       i2c_max17042_fuel: i2c-gpio-0 {
                compatible = "i2c-gpio";
                #address-cells = <1>;
                #size-cells = <0>;
                };
        };
 
-       spi-lcd {
+       spi-3 {
                compatible = "spi-gpio";
                #address-cells = <1>;
                #size-cells = <0>;
                        compatible = "samsung,clock-xusbxti";
                        clock-frequency = <24000000>;
                };
-       };
 
-       thermal-zones {
-               cpu_thermal: cpu-thermal {
-                       cooling-maps {
-                               map0 {
-                                       /* Corresponds to 800MHz */
-                                       cooling-device = <&cpu0 2 2>;
-                               };
-                               map1 {
-                                       /* Corresponds to 200MHz */
-                                       cooling-device = <&cpu0 4 4>;
-                               };
-                       };
+               pmic_ap_clk: pmic-ap-clk {
+                       /* Workaround for missing clock on max8997 PMIC */
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <32768>;
                };
        };
 };
        cpu0-supply = <&varm_breg>;
 };
 
+&cpu_thermal {
+       cooling-maps {
+               map0 {
+                       /* Corresponds to 800MHz */
+                       cooling-device = <&cpu0 2 2>;
+               };
+               map1 {
+                       /* Corresponds to 200MHz */
+                       cooling-device = <&cpu0 4 4>;
+               };
+       };
+};
+
 &ehci {
        status = "okay";
 
        status = "okay";
 
        mali-supply = <&vg3d_breg>;
-       regulator-microvolt-offset = <50000>;
-       regulator-microsecs-delay = <50>;
 };
 
 &hsotg {
                                regulator-name = "G3D_1.1V";
                                regulator-min-microvolt = <900000>;
                                regulator-max-microvolt = <1200000>;
+                               regulator-microvolt-offset = <50000>;
                                regulator-always-on;
                        };
 
                                regulator-max-microvolt = <4100000>;
                                regulator-always-on;
                        };
+
+                       EN32KHZ_AP {
+                               regulator-name = "EN32KHZ_AP";
+                               regulator-always-on;
+                       };
+
+                       EN32KHZ_CP {
+                               regulator-name = "EN32KHZ_CP";
+                               regulator-always-on;
+                       };
                };
        };
 };
                samsung,pin-val = <0>;
        };
 
-       mag_mhl_gpio: mag-mhl-gpio {
+       mag_mhl_gpio: mag-mhl {
                samsung,pins = "gpd0-2";
                samsung,pin-function = <EXYNOS_PIN_FUNC_3>;
                samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
        };
 };
 
+&rtc {
+       status = "okay";
+       clocks = <&clock CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
+};
+
 &sdhci_0 {
        status = "okay";
 
index 890525b..7d2cfba 100644 (file)
                        compatible = "samsung,clock-xusbxti";
                        clock-frequency = <24000000>;
                };
+
+               pmic_ap_clk: pmic-ap-clk {
+                       /* Workaround for missing clock on max8997 PMIC */
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <32768>;
+               };
        };
 
        display-timings {
        cpu0-supply = <&buck1_reg>;
 };
 
+&cpu_thermal {
+       cooling-maps {
+               map0 {
+                       /* Corresponds to 800MHz */
+                       cooling-device = <&cpu0 2 2>;
+               };
+               map1 {
+                       /* Corresponds to 200MHz */
+                       cooling-device = <&cpu0 4 4>;
+               };
+       };
+};
+
 &exynos_usbphy {
        status = "okay";
 };
                                regulator-boot-on;
                                regulator-always-on;
                        };
+
+                       EN32KHZ_AP {
+                               regulator-name = "EN32KHZ_AP";
+                               regulator-always-on;
+                       };
                };
        };
 };
 
 &rtc {
        status = "okay";
+       clocks = <&clock CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
 };
 
 &tmu {
index 77fc11e..c5609af 100644 (file)
                        compatible = "samsung,clock-xusbxti";
                        clock-frequency = <24000000>;
                };
+
+               pmic_ap_clk: pmic-ap-clk {
+                       /* Workaround for missing clock on PMIC */
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <32768>;
+               };
+       };
+};
+
+&cpu_thermal {
+       cooling-maps {
+               map0 {
+                       /* Corresponds to 800MHz */
+                       cooling-device = <&cpu0 2 2>;
+               };
+               map1 {
+                       /* Corresponds to 200MHz */
+                       cooling-device = <&cpu0 4 4>;
+               };
        };
 };
 
        };
 };
 
+&rtc {
+       clocks = <&clock CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
+};
+
 &sdhci_2 {
        bus-width = <4>;
        pinctrl-names = "default";
index 5cc96f0..a226bec 100644 (file)
                        compatible = "samsung,clock-xusbxti";
                        clock-frequency = <24000000>;
                };
-       };
 
-       thermal-zones {
-               cpu_thermal: cpu-thermal {
-                       cooling-maps {
-                               map0 {
-                                    /* Corresponds to 800MHz at freq_table */
-                                    cooling-device = <&cpu0 2 2>, <&cpu1 2 2>;
-                               };
-                               map1 {
-                                    /* Corresponds to 200MHz at freq_table */
-                                    cooling-device = <&cpu0 4 4>, <&cpu1 4 4>;
-                              };
-                      };
+               pmic_ap_clk: pmic-ap-clk {
+                       /* Workaround for missing clock on max8997 PMIC */
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <32768>;
                };
        };
-
 };
 
 &camera {
        cpu0-supply = <&varm_breg>;
 };
 
+&cpu_thermal {
+       cooling-maps {
+               map0 {
+                       /* Corresponds to 800MHz at freq_table */
+                       cooling-device = <&cpu0 2 2>, <&cpu1 2 2>;
+               };
+               map1 {
+                       /* Corresponds to 200MHz at freq_table */
+                       cooling-device = <&cpu0 4 4>, <&cpu1 4 4>;
+               };
+       };
+};
+
 &dsi_0 {
        vddcore-supply = <&vusb_reg>;
        vddio-supply = <&vmipi_reg>;
 
                regulators {
                        valive_reg: LDO2 {
-                            regulator-name = "VALIVE_1.1V_C210";
-                            regulator-min-microvolt = <1100000>;
-                            regulator-max-microvolt = <1100000>;
-                            regulator-always-on;
+                               regulator-name = "VALIVE_1.1V_C210";
+                               regulator-min-microvolt = <1100000>;
+                               regulator-max-microvolt = <1100000>;
+                               regulator-always-on;
                        };
 
                        vusb_reg: LDO3 {
-                            regulator-name = "VUSB_1.1V_C210";
-                            regulator-min-microvolt = <1100000>;
-                            regulator-max-microvolt = <1100000>;
+                               regulator-name = "VUSB_1.1V_C210";
+                               regulator-min-microvolt = <1100000>;
+                               regulator-max-microvolt = <1100000>;
                        };
 
                        vmipi_reg: LDO4 {
-                            regulator-name = "VMIPI_1.8V";
-                            regulator-min-microvolt = <1800000>;
-                            regulator-max-microvolt = <1800000>;
+                               regulator-name = "VMIPI_1.8V";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
                        };
 
                        vpda_reg: LDO6 {
-                            regulator-name = "VCC_1.8V_PDA";
-                            regulator-min-microvolt = <1800000>;
-                            regulator-max-microvolt = <1800000>;
-                            regulator-always-on;
+                               regulator-name = "VCC_1.8V_PDA";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
                        };
 
                        vcam_reg: LDO7 {
-                            regulator-name = "CAM_ISP_1.8V";
-                            regulator-min-microvolt = <1800000>;
-                            regulator-max-microvolt = <1800000>;
+                               regulator-name = "CAM_ISP_1.8V";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
                        };
 
                        vusbdac_reg: LDO8 {
-                            regulator-name = "VUSB+VDAC_3.3V_C210";
-                            regulator-min-microvolt = <3300000>;
-                            regulator-max-microvolt = <3300000>;
+                               regulator-name = "VUSB+VDAC_3.3V_C210";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
                        };
 
                        vccpda_reg: LDO9 {
-                            regulator-name = "VCC_2.8V_PDA";
-                            regulator-min-microvolt = <2800000>;
-                            regulator-max-microvolt = <2800000>;
-                            regulator-always-on;
+                               regulator-name = "VCC_2.8V_PDA";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-always-on;
                        };
 
                        vpll_reg: LDO10 {
-                            regulator-name = "VPLL_1.1V_C210";
-                            regulator-min-microvolt = <1100000>;
-                            regulator-max-microvolt = <1100000>;
-                            regulator-always-on;
+                               regulator-name = "VPLL_1.1V_C210";
+                               regulator-min-microvolt = <1100000>;
+                               regulator-max-microvolt = <1100000>;
+                               regulator-always-on;
                        };
 
                        vtcam_reg: LDO12 {
-                            regulator-name = "VT_CAM_1.8V";
-                            regulator-min-microvolt = <1800000>;
-                            regulator-max-microvolt = <1800000>;
+                               regulator-name = "VT_CAM_1.8V";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
                        };
 
                        vcclcd_reg: LDO13 {
-                            regulator-name = "VCC_3.3V_LCD";
-                            regulator-min-microvolt = <3300000>;
-                            regulator-max-microvolt = <3300000>;
+                               regulator-name = "VCC_3.3V_LCD";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
                        };
 
                        vlcd_reg: LDO15 {
-                            regulator-name = "VLCD_2.2V";
-                            regulator-min-microvolt = <2200000>;
-                            regulator-max-microvolt = <2200000>;
+                               regulator-name = "VLCD_2.2V";
+                               regulator-min-microvolt = <2200000>;
+                               regulator-max-microvolt = <2200000>;
                        };
 
                        camsensor_reg: LDO16 {
-                            regulator-name = "CAM_SENSOR_IO_1.8V";
-                            regulator-min-microvolt = <1800000>;
-                            regulator-max-microvolt = <1800000>;
+                               regulator-name = "CAM_SENSOR_IO_1.8V";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
                        };
 
                        tflash_reg: LDO17 {
-                            regulator-name = "VTF_2.8V";
-                            regulator-min-microvolt = <2800000>;
-                            regulator-max-microvolt = <2800000>;
+                               regulator-name = "VTF_2.8V";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
                        };
 
                        vddq_reg: LDO21 {
-                            regulator-name = "VDDQ_M1M2_1.2V";
-                            regulator-min-microvolt = <1200000>;
-                            regulator-max-microvolt = <1200000>;
-                            regulator-always-on;
+                               regulator-name = "VDDQ_M1M2_1.2V";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1200000>;
+                               regulator-always-on;
                        };
 
                        varm_breg: BUCK1 {
-                            regulator-name = "VARM_1.2V_C210";
-                            regulator-min-microvolt = <900000>;
-                            regulator-max-microvolt = <1350000>;
-                            regulator-always-on;
+                               regulator-name = "VARM_1.2V_C210";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-always-on;
                        };
 
                        vint_breg: BUCK2 {
-                            regulator-name = "VINT_1.1V_C210";
-                            regulator-min-microvolt = <900000>;
-                            regulator-max-microvolt = <1100000>;
-                            regulator-always-on;
+                               regulator-name = "VINT_1.1V_C210";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1100000>;
+                               regulator-always-on;
                        };
 
                        camisp_breg: BUCK4 {
-                            regulator-name = "CAM_ISP_CORE_1.2V";
-                            regulator-min-microvolt = <1200000>;
-                            regulator-max-microvolt = <1200000>;
+                               regulator-name = "CAM_ISP_CORE_1.2V";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1200000>;
                        };
 
                        vmem_breg: BUCK5 {
-                            regulator-name = "VMEM_1.2V_C210";
-                            regulator-min-microvolt = <1200000>;
-                            regulator-max-microvolt = <1200000>;
-                            regulator-always-on;
+                               regulator-name = "VMEM_1.2V_C210";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1200000>;
+                               regulator-always-on;
                        };
 
                        vccsub_breg: BUCK7 {
-                            regulator-name = "VCC_SUB_2.0V";
-                            regulator-min-microvolt = <2000000>;
-                            regulator-max-microvolt = <2000000>;
-                            regulator-always-on;
+                               regulator-name = "VCC_SUB_2.0V";
+                               regulator-min-microvolt = <2000000>;
+                               regulator-max-microvolt = <2000000>;
+                               regulator-always-on;
                        };
 
                        safe1_sreg: ESAFEOUT1 {
-                            regulator-name = "SAFEOUT1";
+                               regulator-name = "SAFEOUT1";
                        };
 
                        safe2_sreg: ESAFEOUT2 {
-                            regulator-name = "SAFEOUT2";
-                            regulator-boot-on;
+                               regulator-name = "SAFEOUT2";
+                               regulator-boot-on;
+                       };
+
+                       EN32KHZ_AP {
+                               regulator-name = "EN32KHZ_AP";
+                               regulator-always-on;
+                       };
+
+                       EN32KHZ_CP {
+                               regulator-name = "EN32KHZ_CP";
+                               regulator-always-on;
                        };
                };
        };
 };
 
+&rtc {
+       status = "okay";
+       clocks = <&clock CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
+};
+
 &sdhci_0 {
        bus-width = <8>;
        non-removable;
index 99ce53b..08284e8 100644 (file)
                        compatible = "samsung,clock-xusbxti";
                        clock-frequency = <24000000>;
                };
+
+               pmic_ap_clk: pmic-ap-clk {
+                       /* Workaround for missing clock on PMIC */
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <32768>;
+               };
        };
 
        vemmc_reg: voltage-regulator {
-               compatible = "regulator-fixed";
+               compatible = "regulator-fixed";
                regulator-name = "VMEM_VDD_2_8V";
                regulator-min-microvolt = <2800000>;
                regulator-max-microvolt = <2800000>;
        };
 
        tsp_reg: voltage-regulator {
-               compatible = "regulator-fixed";
+               compatible = "regulator-fixed";
                regulator-name = "TSP_2_8V";
                regulator-min-microvolt = <2800000>;
                regulator-max-microvolt = <2800000>;
                enable-active-high;
        };
 
-       spi-lcd {
+       spi-3 {
                compatible = "spi-gpio";
                #address-cells = <1>;
                #size-cells = <0>;
 
-               gpio-sck = <&gpy3 1 GPIO_ACTIVE_HIGH>;
-               gpio-mosi = <&gpy3 3 GPIO_ACTIVE_HIGH>;
+               sck-gpios = <&gpy3 1 GPIO_ACTIVE_HIGH>;
+               mosi-gpios = <&gpy3 3 GPIO_ACTIVE_HIGH>;
                num-chipselects = <1>;
                cs-gpios = <&gpy4 3 GPIO_ACTIVE_LOW>;
 
        cpu0-supply = <&vdd_arm_reg>;
 };
 
+&cpu_thermal {
+       cooling-maps {
+               map0 {
+                       /* Corresponds to 800MHz */
+                       cooling-device = <&cpu0 2 2>;
+               };
+               map1 {
+                       /* Corresponds to 200MHz */
+                       cooling-device = <&cpu0 4 4>;
+               };
+       };
+};
+
 &ehci {
        status = "okay";
        phys = <&exynos_usbphy 1>;
        status = "okay";
 };
 
+&rtc {
+       status = "okay";
+       clocks = <&clock CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
+};
+
 &sdhci_0 {
        bus-width = <8>;
        non-removable;
index 33435ce..fddc661 100644 (file)
                        reg = <0x10502000 0x1000>;
                        cache-unified;
                        cache-level = <2>;
+                       prefetch-data = <1>;
+                       prefetch-instr = <1>;
                        arm,tag-latency = <2 2 1>;
                        arm,data-latency = <2 2 1>;
                };
                        };
                };
        };
+};
 
-       thermal-zones {
-               cpu_thermal: cpu-thermal {
-                       polling-delay-passive = <0>;
-                       polling-delay = <0>;
-                       thermal-sensors = <&tmu 0>;
-
-                       trips {
-                               cpu_alert0: cpu-alert-0 {
-                                       temperature = <85000>; /* millicelsius */
-                               };
-                               cpu_alert1: cpu-alert-1 {
-                                       temperature = <100000>; /* millicelsius */
-                               };
-                               cpu_alert2: cpu-alert-2 {
-                                       temperature = <110000>; /* millicelsius */
-                               };
-                       };
-               };
-       };
+&cpu_alert0 {
+       temperature = <85000>; /* millicelsius */
+};
+
+&cpu_alert1 {
+       temperature = <100000>; /* millicelsius */
+};
+
+&cpu_alert2 {
+       temperature = <110000>; /* millicelsius */
+};
+
+&cpu_thermal {
+       polling-delay-passive = <0>;
+       polling-delay = <0>;
+       thermal-sensors = <&tmu 0>;
 };
 
 &gic {
index 53b3ca3..89ed81f 100644 (file)
@@ -33,7 +33,7 @@
                };
        };
 
-       lcd_vdd3_reg: voltage-regulator-7 {
+       lcd_vdd3_reg: voltage-regulator-10 {
                compatible = "regulator-fixed";
                regulator-name = "LCD_VDD_2.2V";
                regulator-min-microvolt = <2200000>;
@@ -42,7 +42,7 @@
                enable-active-high;
        };
 
-       ps_als_reg: voltage-regulator-8 {
+       ps_als_reg: voltage-regulator-11 {
                compatible = "regulator-fixed";
                regulator-name = "LED_A_3.0V";
                regulator-min-microvolt = <3000000>;
        status = "okay";
 };
 
+&sound {
+       samsung,audio-routing =
+               "HP", "HPOUT1L",
+               "HP", "HPOUT1R",
+
+               "SPK", "SPKOUTLN",
+               "SPK", "SPKOUTLP",
+               "SPK", "SPKOUTRN",
+               "SPK", "SPKOUTRP",
+
+               "RCV", "HPOUT2N",
+               "RCV", "HPOUT2P",
+
+               "HDMI", "LINEOUT1N",
+               "HDMI", "LINEOUT1P",
+
+               "LINE", "LINEOUT2N",
+               "LINE", "LINEOUT2P",
+
+               "IN1LP", "MICBIAS1",
+               "IN1LN", "MICBIAS1",
+               "Main Mic", "MICBIAS1",
+
+               "IN1RP", "Sub Mic",
+               "IN1RN", "Sub Mic",
+
+               "IN2LP:VXRN", "MICBIAS2",
+               "Headset Mic", "MICBIAS2",
+
+               "IN2RN", "FM In",
+               "IN2RP:VXRP", "FM In";
+};
+
+&submic_bias_reg {
+       gpio = <&gpf2 0 GPIO_ACTIVE_HIGH>;
+       enable-active-high;
+};
+
 &touchkey_reg {
        gpio = <&gpm0 0 GPIO_ACTIVE_HIGH>;
        status = "okay";
index f8125a9..07fbcf8 100644 (file)
 
        memory@40000000 {
                device_type = "memory";
-               reg =  <0x40000000 0x40000000>;
+               reg = <0x40000000 0x40000000>;
        };
 };
+
+&sound {
+       fm-sel-gpios = <&gpl0 3 GPIO_ACTIVE_HIGH>;
+};
index 54a2a55..6bc3d89 100644 (file)
@@ -10,7 +10,7 @@
 
        memory@40000000 {
                device_type = "memory";
-               reg =  <0x40000000 0x80000000>;
+               reg = <0x40000000 0x80000000>;
        };
 };
 
index 2c8111c..7e7c243 100644 (file)
 
        fixed-rate-clocks {
                xxti {
-                       compatible = "samsung,clock-xxti", "fixed-clock";
+                       compatible = "samsung,clock-xxti";
                        clock-frequency = <0>;
                };
 
                xusbxti {
-                       compatible = "samsung,clock-xusbxti", "fixed-clock";
+                       compatible = "samsung,clock-xusbxti";
                        clock-frequency = <24000000>;
                };
        };
                status = "disabled";
        };
 
+       vbatt_reg: voltage-regulator-7 {
+               compatible = "regulator-fixed";
+               regulator-name = "VBATT";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       mic_bias_reg: voltage-regulator-8 {
+               compatible = "regulator-fixed";
+               regulator-name = "MICBIAS_LDO_2.8V";
+               regulator-min-microvolt = <2800000>;
+               regulator-max-microvolt = <2800000>;
+               gpio = <&gpf1 7 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       submic_bias_reg: voltage-regulator-9 {
+               compatible = "regulator-fixed";
+               regulator-name = "SUB_MICBIAS_LDO_2.8V";
+               regulator-min-microvolt = <2800000>;
+               regulator-max-microvolt = <2800000>;
+       };
+
        gpio-keys {
                compatible = "gpio-keys";
                pinctrl-names = "default";
                clock-names = "ext_clock";
        };
 
-       sound {
-               compatible = "samsung,trats2-audio";
-               samsung,i2s-controller = <&i2s0>;
-               samsung,model = "Trats2";
-               samsung,audio-codec = <&wm1811>;
-               samsung,audio-routing =
-                       "SPK", "SPKOUTLN",
-                       "SPK", "SPKOUTLP",
-                       "SPK", "SPKOUTRN",
-                       "SPK", "SPKOUTRP";
+       sound: sound {
+               compatible = "samsung,midas-audio";
+               model = "Midas";
+               mic-bias-supply = <&mic_bias_reg>;
+               submic-bias-supply = <&submic_bias_reg>;
+
+               cpu {
+                       sound-dai = <&i2s0 0>;
+               };
+               codec {
+                       sound-dai = <&wm1811>;
+               };
        };
 
        thermistor-ap {
                pulldown-ohm = <100000>; /* 100K */
                io-channels = <&adc 2>;  /* Battery temperature */
        };
-
-       thermal-zones {
-               cpu_thermal: cpu-thermal {
-                       cooling-maps {
-                               map0 {
-                                    /* Corresponds to 800MHz at freq_table */
-                                    cooling-device = <&cpu0 7 7>, <&cpu1 7 7>,
-                                                     <&cpu2 7 7>, <&cpu3 7 7>;
-                               };
-                               map1 {
-                                    /* Corresponds to 200MHz at freq_table */
-                                    cooling-device = <&cpu0 13 13>,
-                                                     <&cpu1 13 13>,
-                                                     <&cpu2 13 13>,
-                                                     <&cpu3 13 13>;
-                              };
-                      };
-               };
-       };
 };
 
 &adc {
        cpu0-supply = <&buck2_reg>;
 };
 
+&cpu_thermal {
+       cooling-maps {
+               map0 {
+                       /* Corresponds to 800MHz at freq_table */
+                       cooling-device = <&cpu0 7 7>, <&cpu1 7 7>,
+                                        <&cpu2 7 7>, <&cpu3 7 7>;
+               };
+               map1 {
+                       /* Corresponds to 200MHz at freq_table */
+                       cooling-device = <&cpu0 13 13>, <&cpu1 13 13>,
+                                        <&cpu2 13 13>, <&cpu3 13 13>;
+               };
+       };
+};
+
 &csis_0 {
        status = "okay";
        vddcore-supply = <&ldo8_reg>;
        wm1811: wm1811@1a {
                compatible = "wlf,wm1811";
                reg = <0x1a>;
-               clocks = <&pmu_system_controller 0>;
-               clock-names = "MCLK1";
-               DCVDD-supply = <&ldo3_reg>;
+               clocks = <&pmu_system_controller 0>,
+                       <&max77686 MAX77686_CLK_PMIC>;
+               clock-names = "MCLK1", "MCLK2";
+               interrupt-controller;
+               #interrupt-cells = <2>;
+               interrupt-parent = <&gpx3>;
+               interrupts = <6 IRQ_TYPE_LEVEL_HIGH>;
+
+               gpio-controller;
+               #gpio-cells = <2>;
+               #sound-dai-cells = <0>;
+
+               wlf,gpio-cfg = <0x3 0x0 0x0 0x0 0x0 0x0
+                       0x0 0x8000 0x0 0x0 0x0>;
+               wlf,micbias-cfg = <0x2f 0x2b>;
+
+               wlf,lineout1-feedback;
+               wlf,lineout1-se;
+               wlf,lineout2-se;
+               wlf,ldoena-always-driven;
+
+               AVDD2-supply = <&vbatt_reg>;
                DBVDD1-supply = <&ldo3_reg>;
+               DBVDD2-supply = <&vbatt_reg>;
+               DBVDD3-supply = <&vbatt_reg>;
+               DCVDD-supply = <&ldo3_reg>;
+               CPVDD-supply = <&vbatt_reg>;
+               SPKVDD1-supply = <&vbatt_reg>;
+               SPKVDD2-supply = <&vbatt_reg>;
                wlf,ldo1ena = <&gpj0 4 0>;
+               wlf,ldo2ena = <&gpj0 4 0>;
        };
 };
 
index 4189e1f..a47b7f3 100644 (file)
@@ -8,12 +8,12 @@
 
        memory@40000000 {
                device_type = "memory";
-               reg =  <0x40000000 0x80000000>;
+               reg = <0x40000000 0x80000000>;
        };
 
        /* bootargs are passed in by bootloader */
 
-       cam_vdda_reg: voltage-regulator-7 {
+       cam_vdda_reg: voltage-regulator-10 {
                compatible = "regulator-fixed";
                regulator-name = "CAM_SENSOR_CORE_1.2V";
                regulator-min-microvolt = <1200000>;
        status = "okay";
 };
 
+&sound {
+       samsung,audio-routing =
+               "HP", "HPOUT1L",
+               "HP", "HPOUT1R",
+
+               "SPK", "SPKOUTLN",
+               "SPK", "SPKOUTLP",
+
+               "RCV", "HPOUT2N",
+               "RCV", "HPOUT2P",
+
+               "HDMI", "LINEOUT1N",
+               "HDMI", "LINEOUT1P",
+
+               "LINE", "LINEOUT2N",
+               "LINE", "LINEOUT2P",
+
+               "IN1LP", "MICBIAS2",
+               "IN1LN", "MICBIAS2",
+               "Headset Mic", "MICBIAS2",
+
+               "IN1RP", "Sub Mic",
+               "IN1RN", "Sub Mic",
+
+               "IN2LP:VXRN", "Main Mic",
+               "IN2LN", "Main Mic",
+
+               "IN2RN", "FM In",
+               "IN2RP:VXRP", "FM In";
+};
+
+&submic_bias_reg {
+       regulator-always-on;
+};
+
 &touchkey_reg {
        gpio = <&gpm0 5 GPIO_ACTIVE_HIGH>;
        status = "okay";
index a5c1ce1..ab291ce 100644 (file)
                        clock-frequency = <24000000>;
                };
        };
-
-       thermal-zones {
-               cpu_thermal: cpu-thermal {
-                       cooling-maps {
-                               cooling_map0: map0 {
-                                    /* Corresponds to 800MHz at freq_table */
-                                    cooling-device = <&cpu0 7 7>, <&cpu1 7 7>,
-                                                     <&cpu2 7 7>, <&cpu3 7 7>;
-                               };
-                               cooling_map1: map1 {
-                                    /* Corresponds to 200MHz at freq_table */
-                                    cooling-device = <&cpu0 13 13>,
-                                                     <&cpu1 13 13>,
-                                                     <&cpu2 13 13>,
-                                                     <&cpu3 13 13>;
-                              };
-                      };
-               };
-       };
 };
 
 &bus_dmc {
 };
 
 &clock {
+       clocks = <&clock CLK_XUSBXTI>;
        assigned-clocks = <&clock CLK_FOUT_EPLL>;
        assigned-clock-rates = <45158401>;
 };
        };
 };
 
+&cpu_thermal {
+       cooling-maps {
+               cooling_map0: map0 {
+                       /* Corresponds to 800MHz at freq_table */
+                       cooling-device = <&cpu0 7 7>, <&cpu1 7 7>,
+                                        <&cpu2 7 7>, <&cpu3 7 7>;
+               };
+               cooling_map1: map1 {
+                       /* Corresponds to 200MHz at freq_table */
+                       cooling-device = <&cpu0 13 13>, <&cpu1 13 13>,
+                                        <&cpu2 13 13>, <&cpu3 13 13>;
+               };
+       };
+};
+
 &pinctrl_1 {
        gpio_power_key: power_key {
                samsung,pins = "gpx1-3";
index 8ff243b..b8549d8 100644 (file)
                #cooling-cells = <2>;
                cooling-levels = <0 102 170 230>;
        };
-
-       thermal-zones {
-               cpu_thermal: cpu-thermal {
-                       cooling-maps {
-                               map0 {
-                                    trip = <&cpu_alert1>;
-                                    cooling-device = <&cpu0 9 9>, <&cpu1 9 9>,
-                                                     <&cpu2 9 9>, <&cpu3 9 9>,
-                                                     <&fan0 1 2>;
-                               };
-                               map1 {
-                                    trip = <&cpu_alert2>;
-                                    cooling-device = <&cpu0 15 15>,
-                                                     <&cpu1 15 15>,
-                                                     <&cpu2 15 15>,
-                                                     <&cpu3 15 15>,
-                                                     <&fan0 2 3>;
-                               };
-                               map2 {
-                                    trip = <&cpu_alert0>;
-                                    cooling-device = <&fan0 0 1>;
-                               };
-                       };
-               };
-       };
 };
 
 &adc {
        regulator-max-microvolt = <3300000>;
 };
 
+&cpu_thermal {
+       cooling-maps {
+               map0 {
+                       trip = <&cpu_alert1>;
+                       cooling-device = <&cpu0 9 9>, <&cpu1 9 9>,
+                                        <&cpu2 9 9>, <&cpu3 9 9>,
+                                        <&fan0 1 2>;
+               };
+               map1 {
+                       trip = <&cpu_alert2>;
+                       cooling-device = <&cpu0 15 15>, <&cpu1 15 15>,
+                                        <&cpu2 15 15>, <&cpu3 15 15>,
+                                        <&fan0 2 3>;
+               };
+               map2 {
+                       trip = <&cpu_alert0>;
+                       cooling-device = <&fan0 0 1>;
+               };
+       };
+};
+
 &hdmicec {
        needs-hpd;
 };
index 8b11ad3..c2e793b 100644 (file)
@@ -11,6 +11,7 @@
 
 /dts-v1/;
 #include "exynos4412.dtsi"
+#include <dt-bindings/clock/samsung,s2mps11.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include "exynos-mfc-reserved-memory.dtsi"
        cpu0-supply = <&buck2_reg>;
 };
 
+&cpu_thermal {
+       cooling-maps {
+               cooling_map0: map0 {
+                       /* Corresponds to 800MHz at freq_table */
+                       cooling-device = <&cpu0 7 7>, <&cpu1 7 7>,
+                                        <&cpu2 7 7>, <&cpu3 7 7>;
+               };
+               cooling_map1: map1 {
+                       /* Corresponds to 200MHz at freq_table */
+                       cooling-device = <&cpu0 13 13>, <&cpu1 13 13>,
+                                        <&cpu2 13 13>, <&cpu3 13 13>;
+               };
+       };
+};
+
 &exynos_usbphy {
        status = "okay";
 };
                                                 <1200000>, <1200000>,
                                                 <1200000>, <1200000>;
 
+               s5m8767_osc: clocks {
+                       compatible = "samsung,s5m8767-clk";
+                       #clock-cells = <1>;
+                       clock-output-names = "s5m8767_ap", "s5m8767_cp",
+                                            "s5m8767_bt";
+               };
+
                regulators {
                        ldo1_reg: LDO1 {
                                regulator-name = "VDD_ALIVE";
 
 &rtc {
        status = "okay";
+       clocks = <&clock CLK_RTC>, <&s5m8767_osc S2MPS11_CLK_AP>;
+       clock-names = "rtc", "rtc_src";
 };
 
 &sdhci_2 {
index e70fb6e..4997120 100644 (file)
                        compatible = "samsung,clock-xusbxti";
                        clock-frequency = <24000000>;
                };
+
+               pmic_ap_clk: pmic-ap-clk {
+                       /* Workaround for missing clock on PMIC */
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <32768>;
+               };
+       };
+};
+
+&cpu_thermal {
+       cooling-maps {
+               cooling_map0: map0 {
+                       /* Corresponds to 800MHz at freq_table */
+                       cooling-device = <&cpu0 7 7>, <&cpu1 7 7>,
+                                        <&cpu2 7 7>, <&cpu3 7 7>;
+               };
+               cooling_map1: map1 {
+                       /* Corresponds to 200MHz at freq_table */
+                       cooling-device = <&cpu0 13 13>, <&cpu1 13 13>,
+                                        <&cpu2 13 13>, <&cpu3 13 13>;
+               };
        };
 };
 
        };
 };
 
+&rtc {
+       clocks = <&clock CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
+};
+
 &sdhci_2 {
        bus-width = <4>;
        pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &sd2_cd>;
index 3a91de8..017b261 100644 (file)
                        compatible = "samsung,clock-xusbxti";
                        clock-frequency = <24000000>;
                };
+
+               pmic_ap_clk: pmic-ap-clk {
+                       /* Workaround for missing clock on PMIC */
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <32768>;
+               };
        };
 
        panel {
        };
 };
 
+&cpu_thermal {
+       cooling-maps {
+               cooling_map0: map0 {
+                       /* Corresponds to 800MHz at freq_table */
+                       cooling-device = <&cpu0 7 7>, <&cpu1 7 7>,
+                                        <&cpu2 7 7>, <&cpu3 7 7>;
+               };
+               cooling_map1: map1 {
+                       /* Corresponds to 200MHz at freq_table */
+                       cooling-device = <&cpu0 13 13>, <&cpu1 13 13>,
+                                        <&cpu2 13 13>, <&cpu3 13 13>;
+               };
+       };
+};
+
 &fimd {
        pinctrl-0 = <&lcd_clk>, <&lcd_data24>;
        pinctrl-names = "default";
 
 &rtc {
        status = "okay";
+       clocks = <&clock CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
 };
 
 &sdhci_2 {
index aac5339..7b447b6 100644 (file)
@@ -18,7 +18,7 @@
 
        memory@40000000 {
                device_type = "memory";
-               reg =  <0x40000000 0x40000000>;
+               reg = <0x40000000 0x40000000>;
        };
 
        chosen {
index 7002832..e76881d 100644 (file)
@@ -76,7 +76,7 @@
                };
        };
 
-       cpu0_opp_table: opp_table0 {
+       cpu0_opp_table: opp-table0 {
                compatible = "operating-points-v2";
                opp-shared;
 
                        reg = <0x10502000 0x1000>;
                        cache-unified;
                        cache-level = <2>;
+                       prefetch-data = <1>;
+                       prefetch-instr = <1>;
                        arm,tag-latency = <2 2 1>;
                        arm,data-latency = <3 2 1>;
                        arm,double-linefill = <1>;
                        status = "disabled";
                };
 
-               bus_dmc_opp_table: opp_table1 {
+               bus_dmc_opp_table: opp-table1 {
                        compatible = "operating-points-v2";
                        opp-shared;
 
                        };
                };
 
-               bus_acp_opp_table: opp_table2 {
+               bus_acp_opp_table: opp-table2 {
                        compatible = "operating-points-v2";
                        opp-shared;
 
                        status = "disabled";
                };
 
-               bus_leftbus_opp_table: opp_table3 {
+               bus_leftbus_opp_table: opp-table3 {
                        compatible = "operating-points-v2";
                        opp-shared;
 
                        };
                };
 
-               bus_display_opp_table: opp_table4 {
+               bus_display_opp_table: opp-table4 {
                        compatible = "operating-points-v2";
                        opp-shared;
 
                        };
                };
 
-               bus_fsys_opp_table: opp_table5 {
+               bus_fsys_opp_table: opp-table5 {
                        compatible = "operating-points-v2";
                        opp-shared;
 
                        };
                };
 
-               bus_peri_opp_table: opp_table6 {
+               bus_peri_opp_table: opp-table6 {
                        compatible = "operating-points-v2";
                        opp-shared;
 
                          "pmu";
        operating-points-v2 = <&gpu_opp_table>;
 
-       gpu_opp_table: opp_table {
+       gpu_opp_table: opp-table {
                compatible = "operating-points-v2";
 
                opp-160000000 {
index 22eb951..9ce9fb3 100644 (file)
@@ -86,7 +86,7 @@
                };
 
                gic: interrupt-controller@10481000 {
-                       compatible = "arm,gic-400", "arm,cortex-a15-gic", "arm,cortex-a9-gic";
+                       compatible = "arm,gic-400", "arm,cortex-a15-gic";
                        #interrupt-cells = <3>;
                        interrupt-controller;
                        reg =   <0x10481000 0x1000>,
                };
 
                prng: rng@10830400 {
-                     compatible = "samsung,exynos5250-prng";
-                     reg = <0x10830400 0x200>;
+                       compatible = "samsung,exynos5250-prng";
+                       reg = <0x10830400 0x200>;
                };
 
                trng: rng@10830600 {
-                     compatible = "samsung,exynos5250-trng";
-                     reg = <0x10830600 0x100>;
+                       compatible = "samsung,exynos5250-trng";
+                       reg = <0x10830600 0x100>;
                };
 
                g2d: g2d@10850000 {
index 59872d8..79546f1 100644 (file)
                s5m8767,pmic-buck3-dvs-voltage = <1100000>;
                s5m8767,pmic-buck4-dvs-voltage = <1200000>;
                s5m8767,pmic-buck-dvs-gpios = <&gpd1 0 GPIO_ACTIVE_HIGH>,
-                                             <&gpd1 1 GPIO_ACTIVE_HIGH>,
-                                             <&gpd1 2 GPIO_ACTIVE_HIGH>;
+                                             <&gpd1 1 GPIO_ACTIVE_HIGH>,
+                                             <&gpd1 2 GPIO_ACTIVE_HIGH>;
                s5m8767,pmic-buck-ds-gpios = <&gpx2 3 GPIO_ACTIVE_HIGH>,
-                                            <&gpx2 4 GPIO_ACTIVE_HIGH>,
-                                            <&gpx2 5 GPIO_ACTIVE_HIGH>;
+                                            <&gpx2 4 GPIO_ACTIVE_HIGH>,
+                                            <&gpx2 5 GPIO_ACTIVE_HIGH>;
 
                s5m8767_osc: clocks {
                        compatible = "samsung,s5m8767-clk";
        status = "okay";
        samsung,i2c-sda-delay = <100>;
        samsung,i2c-max-bus-freq = <40000>;
-       samsung,i2c-slave-addr = <0x38>;
-
-       sata_phy_i2c:sata-phy@38 {
-               compatible = "samsung,exynos-sataphy-i2c";
-               reg = <0x38>;
-       };
 };
 
 &i2s0 {
        samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>;
 };
 
+&sata_phy_i2c {
+       status = "okay";
+};
+
 &soc {
        /*
         * For unknown reasons HDMI-DDC does not work with Exynos I2C
         * controllers. Lets use software I2C over GPIO pins as a workaround.
         */
-       i2c_ddc: i2c-gpio {
+       i2c_ddc: i2c-10 {
                pinctrl-names = "default";
                pinctrl-0 = <&i2c2_gpio_bus>;
                status = "okay";
index 5c42df0..186790f 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/clock/maxim,max77686.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include "exynos5250.dtsi"
                reg = <0x50>;
        };
 
-       max77686@9 {
+       max77686: pmic@9 {
                compatible = "maxim,max77686";
                reg = <0x09>;
                interrupt-parent = <&gpx3>;
                interrupts = <2 IRQ_TYPE_NONE>;
                pinctrl-names = "default";
                pinctrl-0 = <&max77686_irq>;
+               #clock-cells = <1>;
                wakeup-source;
 
                voltage-regulators {
        status = "okay";
        samsung,i2c-sda-delay = <100>;
        samsung,i2c-max-bus-freq = <40000>;
-       samsung,i2c-slave-addr = <0x38>;
-
-       sata_phy_i2c: sata-phy@38 {
-               compatible = "samsung,exynos-sataphy-i2c";
-               reg = <0x38>;
-       };
 };
 
 &i2s0 {
 
 &rtc {
        status = "okay";
+       clocks = <&clock CLK_RTC>, <&max77686 MAX77686_CLK_AP>;
+       clock-names = "rtc", "rtc_src";
 };
 
 &sata {
        samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>;
 };
 
+&sata_phy_i2c {
+       status = "okay";
+};
+
 &spi_1 {
        status = "okay";
        cs-gpios = <&gpa2 5 GPIO_ACTIVE_HIGH>;
index 3d50192..a92ade3 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/clock/samsung,s2mps11.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/input/input.h>
                wakeup-source;
 
                s5m8767,pmic-buck-dvs-gpios = <&gpd1 0 GPIO_ACTIVE_LOW>, /* DVS1 */
-                                             <&gpd1 1 GPIO_ACTIVE_LOW>, /* DVS2 */
-                                             <&gpd1 2 GPIO_ACTIVE_LOW>; /* DVS3 */
+                                             <&gpd1 1 GPIO_ACTIVE_LOW>, /* DVS2 */
+                                             <&gpd1 2 GPIO_ACTIVE_LOW>; /* DVS3 */
 
                s5m8767,pmic-buck-ds-gpios = <&gpx2 3 GPIO_ACTIVE_LOW>, /* SET1 */
-                                            <&gpx2 4 GPIO_ACTIVE_LOW>, /* SET2 */
-                                            <&gpx2 5 GPIO_ACTIVE_LOW>; /* SET3 */
+                                            <&gpx2 4 GPIO_ACTIVE_LOW>, /* SET2 */
+                                            <&gpx2 5 GPIO_ACTIVE_LOW>; /* SET3 */
 
                /*
                 * The following arrays of DVS voltages are not used, since we are
                 * to please the driver.
                 */
                s5m8767,pmic-buck2-dvs-voltage = <1350000>, <1300000>,
-                                                <1250000>, <1200000>,
-                                                <1150000>, <1100000>,
-                                                <1000000>, <950000>;
+                                                <1250000>, <1200000>,
+                                                <1150000>, <1100000>,
+                                                <1000000>, <950000>;
 
                s5m8767,pmic-buck3-dvs-voltage = <1100000>, <1100000>,
-                                                <1100000>, <1100000>,
-                                                <1000000>, <1000000>,
-                                                <1000000>, <1000000>;
+                                                <1100000>, <1100000>,
+                                                <1000000>, <1000000>,
+                                                <1000000>, <1000000>;
 
                s5m8767,pmic-buck4-dvs-voltage = <1200000>, <1200000>,
-                                                <1200000>, <1200000>,
-                                                <1200000>, <1200000>,
-                                                <1200000>, <1200000>;
+                                                <1200000>, <1200000>,
+                                                <1200000>, <1200000>,
+                                                <1200000>, <1200000>;
 
-               clocks {
+               s5m8767_osc: clocks {
                        compatible = "samsung,s5m8767-clk";
                        #clock-cells = <1>;
                        clock-output-names = "en32khz_ap",
-                                            "en32khz_cp",
-                                            "en32khz_bt";
+                                            "en32khz_cp",
+                                            "en32khz_bt";
                };
 
                regulators {
                samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
        };
 
-       dp_hpd_gpio: dp-hpd-gpio {
+       dp_hpd_gpio: dp-hpd {
                samsung,pins = "gpc3-0";
                samsung,pin-function = <EXYNOS_PIN_FUNC_INPUT>;
                samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
        };
 };
 
+&rtc {
+       status = "okay";
+       clocks = <&clock CLK_RTC>, <&s5m8767_osc S2MPS11_CLK_AP>;
+       clock-names = "rtc", "rtc_src";
+};
+
 &sd1_bus4 {
        samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
 };
index e3dbe41..bd2d883 100644 (file)
                        power-domains = <&pd_g3d>;
                        status = "disabled";
 
-                       gpu_opp_table: gpu-opp-table {
+                       gpu_opp_table: opp-table {
                                compatible = "operating-points-v2";
 
                                opp-100000000 {
                        clocks = <&clock CLK_SATA_PHYI2C>;
                        clock-names = "i2c";
                        status = "disabled";
+
+                       sata_phy_i2c: sata-phy-i2c@38 {
+                               compatible = "samsung,exynos-sataphy-i2c";
+                               reg = <0x38>;
+                               status = "disabled";
+                       };
                };
 
                spi_0: spi@12d20000 {
                        #dma-requests = <1>;
                };
 
-               gsc_0:  gsc@13e00000 {
+               gsc_0: gsc@13e00000 {
                        compatible = "samsung,exynos5250-gsc", "samsung,exynos5-gsc";
                        reg = <0x13e00000 0x1000>;
                        interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
                        iommus = <&sysmmu_gsc0>;
                };
 
-               gsc_1:  gsc@13e10000 {
+               gsc_1: gsc@13e10000 {
                        compatible = "samsung,exynos5250-gsc", "samsung,exynos5-gsc";
                        reg = <0x13e10000 0x1000>;
                        interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
                        iommus = <&sysmmu_gsc1>;
                };
 
-               gsc_2:  gsc@13e20000 {
+               gsc_2: gsc@13e20000 {
                        compatible = "samsung,exynos5250-gsc", "samsung,exynos5-gsc";
                        reg = <0x13e20000 0x1000>;
                        interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
                        iommus = <&sysmmu_gsc2>;
                };
 
-               gsc_3:  gsc@13e30000 {
+               gsc_3: gsc@13e30000 {
                        compatible = "samsung,exynos5250-gsc", "samsung,exynos5-gsc";
                        reg = <0x13e30000 0x1000>;
                        interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
                };
        };
 
-       thermal-zones {
-               cpu_thermal: cpu-thermal {
-                       polling-delay-passive = <0>;
-                       polling-delay = <0>;
-                       thermal-sensors = <&tmu 0>;
-
-                       cooling-maps {
-                               map0 {
-                                    /* Corresponds to 800MHz at freq_table */
-                                    cooling-device = <&cpu0 9 9>, <&cpu1 9 9>;
-                               };
-                               map1 {
-                                    /* Corresponds to 200MHz at freq_table */
-                                    cooling-device = <&cpu0 15 15>,
-                                                     <&cpu1 15 15>;
-                              };
-                      };
-               };
-       };
-
        timer {
                compatible = "arm,armv7-timer";
                interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
        };
 };
 
+&cpu_thermal {
+       polling-delay-passive = <0>;
+       polling-delay = <0>;
+       thermal-sensors = <&tmu 0>;
+
+       cooling-maps {
+               map0 {
+                       /* Corresponds to 800MHz at freq_table */
+                       cooling-device = <&cpu0 9 9>, <&cpu1 9 9>;
+               };
+               map1 {
+                       /* Corresponds to 200MHz at freq_table */
+                       cooling-device = <&cpu0 15 15>,
+                                        <&cpu1 15 15>;
+               };
+       };
+};
+
 &dp {
        power-domains = <&pd_disp1>;
        clocks = <&clock CLK_DP>;
index 154df70..973448c 100644 (file)
                };
 
                gic: interrupt-controller@10481000 {
-                       compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
+                       compatible = "arm,gic-400", "arm,cortex-a15-gic";
                        #interrupt-cells = <3>;
-                       #address-cells = <0>;
-                       #size-cells = <0>;
                        interrupt-controller;
                        reg = <0x10481000 0x1000>,
                                <0x10482000 0x2000>,
index 4f9297a..75b4150 100644 (file)
        assigned-clock-parents = <&clock CLK_FOUT_EPLL>,
                        <&clock_audss EXYNOS_MOUT_AUDSS>;
 
-       assigned-clock-rates =  <0>,
-                               <0>,
-                               <96000000>,
-                               <19200000>;
+       assigned-clock-rates = <0>,
+                              <0>,
+                              <96000000>,
+                              <19200000>;
 };
 
 &cpu0_thermal {
index 5282b5d..2a3ade7 100644 (file)
                #clock-cells = <0>;
        };
 
+       pmic_ap_clk: pmic-ap-clk {
+               /* Workaround for missing PMIC and its clock */
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+       };
+
        firmware@2037000 {
                compatible = "samsung,secure-firmware";
                reg = <0x02037000 0x1000>;
        };
 };
 
+&rtc {
+       clocks = <&clock CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
+};
+
 &sromc {
        pinctrl-names = "default";
        pinctrl-0 = <&srom_ctl>, <&srom_ebi>;
index abe75b9..60a8768 100644 (file)
                        #include "exynos5420-trip-points.dtsi"
                };
                cpu1_thermal: cpu1-thermal {
-                      thermal-sensors = <&tmu_cpu1>;
-                      #include "exynos5420-trip-points.dtsi"
+                       thermal-sensors = <&tmu_cpu1>;
+                       #include "exynos5420-trip-points.dtsi"
                };
                cpu2_thermal: cpu2-thermal {
-                      thermal-sensors = <&tmu_cpu2>;
-                      #include "exynos5420-trip-points.dtsi"
+                       thermal-sensors = <&tmu_cpu2>;
+                       #include "exynos5420-trip-points.dtsi"
                };
                cpu3_thermal: cpu3-thermal {
-                      thermal-sensors = <&tmu_cpu3>;
-                      #include "exynos5420-trip-points.dtsi"
+                       thermal-sensors = <&tmu_cpu3>;
+                       #include "exynos5420-trip-points.dtsi"
                };
        };
 };
index 83fa800..4e49d80 100644 (file)
@@ -9,6 +9,7 @@
 /dts-v1/;
 #include "exynos5420.dtsi"
 #include "exynos5420-cpus.dtsi"
+#include <dt-bindings/clock/samsung,s2mps11.h>
 #include <dt-bindings/gpio/gpio.h>
 
 / {
 
 &rtc {
        status = "okay";
+       clocks = <&clock CLK_RTC>, <&s2mps11_osc S2MPS11_CLK_AP>;
+       clock-names = "rtc", "rtc_src";
 };
 
 &usbdrd_phy0 {
index c76460b..83580f0 100644 (file)
                        #include "exynos5420-trip-points.dtsi"
                };
                cpu1_thermal: cpu1-thermal {
-                      thermal-sensors = <&tmu_cpu1>;
-                      #include "exynos5420-trip-points.dtsi"
+                       thermal-sensors = <&tmu_cpu1>;
+                       #include "exynos5420-trip-points.dtsi"
                };
                cpu2_thermal: cpu2-thermal {
-                      thermal-sensors = <&tmu_cpu2>;
-                      #include "exynos5420-trip-points.dtsi"
+                       thermal-sensors = <&tmu_cpu2>;
+                       #include "exynos5420-trip-points.dtsi"
                };
                cpu3_thermal: cpu3-thermal {
-                      thermal-sensors = <&tmu_cpu3>;
-                      #include "exynos5420-trip-points.dtsi"
+                       thermal-sensors = <&tmu_cpu3>;
+                       #include "exynos5420-trip-points.dtsi"
                };
                gpu_thermal: gpu-thermal {
-                      thermal-sensors = <&tmu_gpu>;
-                      #include "exynos5420-trip-points.dtsi"
+                       thermal-sensors = <&tmu_gpu>;
+                       #include "exynos5420-trip-points.dtsi"
                };
        };
 };
index afe0905..b1cf941 100644 (file)
                compatible      = "samsung,K3QF2F20DB", "jedec,lpddr3";
                density         = <16384>;
                io-width        = <32>;
-               #address-cells  = <1>;
-               #size-cells     = <0>;
+               #address-cells  = <1>;
+               #size-cells     = <0>;
 
                tRFC-min-tck            = <17>;
                tRRD-min-tck            = <2>;
index c3c2d85..b5ec4f4 100644 (file)
                        "HiFi Playback", "Mixer DAI TX",
                        "Mixer DAI RX", "HiFi Capture";
 
-               assigned-clocks = <&clock CLK_MOUT_EPLL>,
-                               <&clock CLK_MOUT_MAU_EPLL>,
-                               <&clock CLK_MOUT_USER_MAU_EPLL>,
-                               <&clock_audss EXYNOS_MOUT_AUDSS>,
-                               <&clock_audss EXYNOS_MOUT_I2S>,
-                               <&clock_audss EXYNOS_DOUT_SRP>,
-                               <&clock_audss EXYNOS_DOUT_AUD_BUS>,
-                               <&clock_audss EXYNOS_DOUT_I2S>;
-
-               assigned-clock-parents = <&clock CLK_FOUT_EPLL>,
-                               <&clock CLK_MOUT_EPLL>,
-                               <&clock CLK_MOUT_MAU_EPLL>,
-                               <&clock CLK_MAU_EPLL>,
-                               <&clock_audss EXYNOS_MOUT_AUDSS>;
-
-               assigned-clock-rates = <0>,
-                               <0>,
-                               <0>,
-                               <0>,
-                               <0>,
-                               <196608001>,
-                               <(196608002 / 2)>,
-                               <196608000>;
-
                cpu {
                        sound-dai = <&i2s0 0>, <&i2s0 1>;
                };
        };
 };
 
-&clock_audss {
-       assigned-clocks = <&clock_audss EXYNOS_DOUT_SRP>,
-                         <&clock CLK_FOUT_EPLL>;
-       assigned-clock-rates = <(196608000 / 256)>,
-                              <196608000>;
-};
-
 &hsi2c_5 {
        status = "okay";
        max98090: max98090@10 {
 
 &i2s0 {
        status = "okay";
-       assigned-clocks = <&i2s0 CLK_I2S_RCLK_SRC>;
-       assigned-clock-parents = <&clock_audss EXYNOS_SCLK_I2S>;
+       assigned-clocks = <&clock CLK_MOUT_EPLL>,
+                       <&clock CLK_MOUT_MAU_EPLL>,
+                       <&clock CLK_MOUT_USER_MAU_EPLL>,
+                       <&clock_audss EXYNOS_MOUT_AUDSS>,
+                       <&clock_audss EXYNOS_MOUT_I2S>,
+                       <&i2s0 CLK_I2S_RCLK_SRC>,
+                       <&clock_audss EXYNOS_DOUT_SRP>,
+                       <&clock_audss EXYNOS_DOUT_AUD_BUS>,
+                       <&clock_audss EXYNOS_DOUT_I2S>;
+
+       assigned-clock-parents = <&clock CLK_FOUT_EPLL>,
+                       <&clock CLK_MOUT_EPLL>,
+                       <&clock CLK_MOUT_MAU_EPLL>,
+                       <&clock CLK_MAU_EPLL>,
+                       <&clock_audss EXYNOS_MOUT_AUDSS>,
+                       <&clock_audss EXYNOS_SCLK_I2S>;
+
+       assigned-clock-rates = <0>,
+                       <0>,
+                       <0>,
+                       <0>,
+                       <0>,
+                       <0>,
+                       <196608001>,
+                       <(196608002 / 2)>,
+                       <196608000>;
+
 };
index 892d389..ddd55d3 100644 (file)
 
                samsung,audio-routing = "I2S Playback", "Mixer DAI TX";
 
-               assigned-clocks = <&clock CLK_MOUT_EPLL>,
-                               <&clock CLK_MOUT_MAU_EPLL>,
-                               <&clock CLK_MOUT_USER_MAU_EPLL>,
-                               <&clock_audss EXYNOS_MOUT_AUDSS>,
-                               <&clock_audss EXYNOS_MOUT_I2S>,
-                               <&clock_audss EXYNOS_DOUT_SRP>,
-                               <&clock_audss EXYNOS_DOUT_AUD_BUS>,
-                               <&clock_audss EXYNOS_DOUT_I2S>;
-
-               assigned-clock-parents = <&clock CLK_FOUT_EPLL>,
-                               <&clock CLK_MOUT_EPLL>,
-                               <&clock CLK_MOUT_MAU_EPLL>,
-                               <&clock CLK_MAU_EPLL>,
-                               <&clock_audss EXYNOS_MOUT_AUDSS>;
-
-               assigned-clock-rates = <0>,
-                               <0>,
-                               <0>,
-                               <0>,
-                               <0>,
-                               <196608001>,
-                               <(196608002 / 2)>,
-                               <196608000>;
-
                cpu {
                        sound-dai = <&i2s0 0>, <&i2s0 1>;
                };
        };
 };
 
-&clock_audss {
-       assigned-clocks = <&clock_audss EXYNOS_DOUT_SRP>,
-                         <&clock CLK_FOUT_EPLL>;
-       assigned-clock-rates = <(196608000 / 256)>,
-                              <196608000>;
-};
-
 &i2s0 {
        status = "okay";
-       assigned-clocks = <&i2s0 CLK_I2S_RCLK_SRC>;
-       assigned-clock-parents = <&clock_audss EXYNOS_SCLK_I2S>;
+
+       assigned-clocks = <&clock CLK_MOUT_EPLL>,
+                         <&clock CLK_MOUT_MAU_EPLL>,
+                         <&clock CLK_MOUT_USER_MAU_EPLL>,
+                         <&clock_audss EXYNOS_MOUT_AUDSS>,
+                         <&clock_audss EXYNOS_MOUT_I2S>,
+                         <&i2s0 CLK_I2S_RCLK_SRC>,
+                         <&clock_audss EXYNOS_DOUT_SRP>,
+                         <&clock_audss EXYNOS_DOUT_AUD_BUS>,
+                         <&clock_audss EXYNOS_DOUT_I2S>;
+
+       assigned-clock-parents = <&clock CLK_FOUT_EPLL>,
+                                <&clock CLK_MOUT_EPLL>,
+                                <&clock CLK_MOUT_MAU_EPLL>,
+                                <&clock CLK_MAU_EPLL>,
+                                <&clock_audss EXYNOS_MOUT_AUDSS>,
+                                <&clock_audss EXYNOS_SCLK_I2S>;
+
+       assigned-clock-rates = <0>,
+                              <0>,
+                              <0>,
+                              <0>,
+                              <0>,
+                              <0>,
+                              <196608001>,
+                              <(196608002 / 2)>,
+                              <196608000>;
 };
 
 &pwm {
index f0af1bf..f683440 100644 (file)
@@ -89,7 +89,7 @@
                };
 
                sysctrl: system-controller@802000 {
-                       compatible = "hisilicon,sysctrl";
+                       compatible = "hisilicon,sysctrl", "syscon";
                        #address-cells = <1>;
                        #size-cells = <1>;
                        ranges = <0 0x802000 0x1000>;
                        reg = <0x800000 0x1000>;
                        /* timer00 & timer01 */
                        interrupts = <0 0 4>, <0 1 4>;
-                       clocks = <&clock HI3620_TIMER0_MUX>, <&clock HI3620_TIMER1_MUX>;
-                       clock-names = "apb_pclk";
+                       clocks = <&clock HI3620_TIMER0_MUX>,
+                                <&clock HI3620_TIMER1_MUX>,
+                                <&clock HI3620_TIMER0_MUX>;
+                       clock-names = "timer0clk", "timer1clk", "apb_pclk";
                        status = "disabled";
                };
 
                        reg = <0x801000 0x1000>;
                        /* timer10 & timer11 */
                        interrupts = <0 2 4>, <0 3 4>;
-                       clocks = <&clock HI3620_TIMER2_MUX>, <&clock HI3620_TIMER3_MUX>;
-                       clock-names = "apb_pclk";
+                       clocks = <&clock HI3620_TIMER2_MUX>,
+                                <&clock HI3620_TIMER3_MUX>,
+                                <&clock HI3620_TIMER2_MUX>;
+                       clock-names = "timer0clk", "timer1clk", "apb_pclk";
                        status = "disabled";
                };
 
                        reg = <0xa01000 0x1000>;
                        /* timer20 & timer21 */
                        interrupts = <0 4 4>, <0 5 4>;
-                       clocks = <&clock HI3620_TIMER4_MUX>, <&clock HI3620_TIMER5_MUX>;
-                       clock-names = "apb_pclk";
+                       clocks = <&clock HI3620_TIMER4_MUX>,
+                                <&clock HI3620_TIMER5_MUX>,
+                                <&clock HI3620_TIMER4_MUX>;
+                       clock-names = "timer0lck", "timer1clk", "apb_pclk";
                        status = "disabled";
                };
 
                        reg = <0xa02000 0x1000>;
                        /* timer30 & timer31 */
                        interrupts = <0 6 4>, <0 7 4>;
-                       clocks = <&clock HI3620_TIMER6_MUX>, <&clock HI3620_TIMER7_MUX>;
-                       clock-names = "apb_pclk";
+                       clocks = <&clock HI3620_TIMER6_MUX>,
+                                <&clock HI3620_TIMER7_MUX>,
+                                <&clock HI3620_TIMER6_MUX>;
+                       clock-names = "timer0clk", "timer1clk", "apb_pclk";
                        status = "disabled";
                };
 
                        reg = <0xa03000 0x1000>;
                        /* timer40 & timer41 */
                        interrupts = <0 96 4>, <0 97 4>;
-                       clocks = <&clock HI3620_TIMER8_MUX>, <&clock HI3620_TIMER9_MUX>;
-                       clock-names = "apb_pclk";
+                       clocks = <&clock HI3620_TIMER8_MUX>,
+                                <&clock HI3620_TIMER9_MUX>,
+                                <&clock HI3620_TIMER8_MUX>;
+                       clock-names = "timer0clk", "timer1clk", "apb_pclk";
                        status = "disabled";
                };
 
index 4263a93..555bc6b 100644 (file)
                };
 
                sysctrl: sysctrl {
-                       compatible = "hisilicon,sysctrl";
+                       compatible = "hisilicon,sysctrl", "syscon";
                        reg = <0x3e00000 0x00100000>;
                };
 
                        compatible = "arm,sp804", "arm,primecell";
                        reg = <0x3000000 0x1000>;
                        interrupts = <0 224 4>;
-                       clocks = <&clk_50m>, <&clk_50m>;
-                       clock-names = "apb_pclk";
+                       clocks = <&clk_50m>, <&clk_50m>, <&clk_50m>;
+                       clock-names = "timer0clk", "timer1clk", "apb_pclk";
                };
 
                arm-pmu {
index 3ee7967..e2dbf1d 100644 (file)
                                arm,primecell-periphid = <0x00141805>;
                                reg = <0xa2c000 0x1000>;
                                interrupts = <0 29 4>;
-                               clocks = <&clock HIX5HD2_WDG0_RST>;
-                               clock-names = "apb_pclk";
+                               clocks = <&clock HIX5HD2_WDG0_RST>,
+                                        <&clock HIX5HD2_WDG0_RST>;
+                               clock-names = "wdog_clk", "apb_pclk";
                        };
                };
 
index 0b2701c..8cbaf1c 100644 (file)
@@ -53,7 +53,7 @@
 
        apb@80000000 {
                apbh@80000000 {
-                       gpmi-nand@8000c000 {
+                       nand-controller@8000c000 {
                                pinctrl-names = "default";
                                pinctrl-0 = <&gpmi_pins_a &gpmi_pins_fixup>;
                                status = "okay";
index 18289f6..7f4c602 100644 (file)
@@ -76,7 +76,7 @@
                                status = "disabled";
                        };
 
-                       gpmi-nand@8000c000 {
+                       nand-controller@8000c000 {
                                compatible = "fsl,imx23-gpmi-nand";
                                #address-cells = <1>;
                                #size-cells = <1>;
index 111bfdc..f984b70 100644 (file)
@@ -87,6 +87,7 @@
 #define MX25_PAD_EB1__EB1                      0x044 0x25c 0x000 0x00 0x000
 #define MX25_PAD_EB1__AUD4_RXD                 0x044 0x25c 0x460 0x04 0x000
 #define MX25_PAD_EB1__GPIO_2_13                        0x044 0x25c 0x000 0x05 0x000
+#define MX25_PAD_EB1__CSPI3_SS1                        0x044 0x25c 0x4c0 0x06 0x000
 
 #define MX25_PAD_OE__OE                                0x048 0x260 0x000 0x00 0x000
 #define MX25_PAD_OE__AUD4_TXC                  0x048 0x260 0x000 0x04 0x000
 #define MX25_PAD_CS5__CSPI3_MISO               0x058 0x268 0x4b4 0x06 0x000
 
 #define MX25_PAD_NF_CE0__NF_CE0                        0x05c 0x26c 0x000 0x00 0x000
+#define MX25_PAD_NF_CE0__CSPI1_SS3             0x05c 0x26c 0x490 0x01 0x000
 #define MX25_PAD_NF_CE0__GPIO_3_22             0x05c 0x26c 0x000 0x05 0x000
 
 #define MX25_PAD_ECB__ECB                      0x060 0x270 0x000 0x00 0x000
 #define MX25_PAD_LBA__LBA                      0x064 0x274 0x000 0x00 0x000
 #define MX25_PAD_LBA__UART5_RXD                        0x064 0x274 0x578 0x03 0x000
 #define MX25_PAD_LBA__GPIO_3_24                        0x064 0x274 0x000 0x05 0x000
+#define MX25_PAD_LBA__CSPI3_RDY                        0x064 0x274 0x4b0 0x06 0x000
 
 #define MX25_PAD_BCLK__BCLK                    0x068 0x000 0x000 0x00 0x000
 #define MX25_PAD_BCLK__GPIO_4_4                        0x068 0x000 0x000 0x05 0x000
 #define MX25_PAD_OE_ACD__GPIO_1_25             0x114 0x30c 0x000 0x05 0x000
 
 #define MX25_PAD_CONTRAST__CONTRAST            0x118 0x310 0x000 0x00 0x000
-#define MX25_PAD_CONTRAST__CC4                 0x118 0x310 0x000 0x01 0x000
+#define MX25_PAD_CONTRAST__GPT4_CAPIN1         0x118 0x310 0x000 0x01 0x000
+#define MX25_PAD_CONTRAST__CSPI2_SS1           0x118 0x310 0x4a8 0x02 0x000
 #define MX25_PAD_CONTRAST__PWM4_PWMO           0x118 0x310 0x000 0x04 0x000
 #define MX25_PAD_CONTRAST__FEC_CRS             0x118 0x310 0x508 0x05 0x001
 #define MX25_PAD_CONTRAST__USBH2_PWR           0x118 0x310 0x000 0x06 0x000
 #define MX25_PAD_CSI_D2__UART5_RXD             0x120 0x318 0x578 0x01 0x001
 #define MX25_PAD_CSI_D2__SIM1_CLK0             0x120 0x318 0x000 0x04 0x000
 #define MX25_PAD_CSI_D2__GPIO_1_27             0x120 0x318 0x000 0x05 0x000
-#define MX25_PAD_CSI_D2__CSPI3_MOSI            0x120 0x318 0x000 0x07 0x000
+#define MX25_PAD_CSI_D2__CSPI3_MOSI            0x120 0x318 0x4b8 0x07 0x001
 
 #define MX25_PAD_CSI_D3__CSI_D3                        0x124 0x31c 0x000 0x00 0x000
 #define MX25_PAD_CSI_D3__UART5_TXD             0x124 0x31c 0x000 0x01 0x000
 #define MX25_PAD_CSI_D4__UART5_RTS             0x128 0x320 0x574 0x01 0x001
 #define MX25_PAD_CSI_D4__SIM1_VEN0             0x128 0x320 0x000 0x04 0x000
 #define MX25_PAD_CSI_D4__GPIO_1_29             0x128 0x320 0x000 0x05 0x000
-#define MX25_PAD_CSI_D4__CSPI3_SCLK            0x128 0x320 0x000 0x07 0x000
+#define MX25_PAD_CSI_D4__CSPI3_SCLK            0x128 0x320 0x4ac 0x07 0x001
 
 #define MX25_PAD_CSI_D5__CSI_D5                        0x12c 0x324 0x000 0x00 0x000
 #define MX25_PAD_CSI_D5__UART5_CTS             0x12c 0x324 0x000 0x01 0x000
 #define MX25_PAD_CSI_D5__SIM1_TX0              0x12c 0x324 0x000 0x04 0x000
 #define MX25_PAD_CSI_D5__GPIO_1_30             0x12c 0x324 0x000 0x05 0x000
-#define MX25_PAD_CSI_D5__CSPI3_RDY             0x12c 0x324 0x000 0x07 0x000
+#define MX25_PAD_CSI_D5__CSPI3_RDY             0x12c 0x324 0x4b0 0x07 0x001
 
 #define MX25_PAD_CSI_D6__CSI_D6                        0x130 0x328 0x000 0x00 0x000
 /* SION must be set; see the comment for MX25_PAD_SD1_CMD__ESDHC1_CMD. */
 #define MX25_PAD_CSI_D6__ESDHC2_CMD            0x130 0x328 0x4e0 0x12 0x001
 #define MX25_PAD_CSI_D6__SIM1_PD0              0x130 0x328 0x000 0x04 0x000
 #define MX25_PAD_CSI_D6__GPIO_1_31             0x130 0x328 0x000 0x05 0x000
+#define MX25_PAD_CSI_D6__CSPI3_SS0             0x130 0x328 0x4bc 0x07 0x001
 
 #define MX25_PAD_CSI_D7__CSI_D7                        0x134 0x32c 0x000 0x00 0x000
 #define MX25_PAD_CSI_D7__ESDHC2_CLK            0x134 0x32C 0x4dc 0x02 0x001
 #define MX25_PAD_CSI_D7__GPIO_1_6              0x134 0x32c 0x000 0x05 0x000
+#define MX25_PAD_CSI_D7__CSPI3_SS1             0x134 0x32c 0x4c0 0x07 0x001
 
 #define MX25_PAD_CSI_D8__CSI_D8                        0x138 0x330 0x000 0x00 0x000
 #define MX25_PAD_CSI_D8__AUD6_RXC              0x138 0x330 0x000 0x02 0x000
 
 #define MX25_PAD_UART1_RTS__UART1_RTS          0x178 0x370 0x000 0x00 0x000
 #define MX25_PAD_UART1_RTS__CSI_D0             0x178 0x370 0x488 0x01 0x001
-#define MX25_PAD_UART1_RTS__CC3                        0x178 0x370 0x000 0x02 0x000
+#define MX25_PAD_UART1_RTS__GPT3_CAPIN1                0x178 0x370 0x000 0x02 0x000
 #define MX25_PAD_UART1_RTS__UART2_DCD          0x178 0x370 0x000 0x03 0x000
 #define MX25_PAD_UART1_RTS__GPIO_4_24          0x178 0x370 0x000 0x05 0x000
 
 
 #define MX25_PAD_UART2_RTS__UART2_RTS          0x188 0x380 0x000 0x00 0x000
 #define MX25_PAD_UART2_RTS__FEC_COL            0x188 0x380 0x504 0x02 0x002
-#define MX25_PAD_UART2_RTS__CC1                        0x188 0x380 0x000 0x03 0x000
+#define MX25_PAD_UART2_RTS__GPT1_CAPIN1                0x188 0x380 0x000 0x03 0x000
 #define MX25_PAD_UART2_RTS__GPIO_4_28          0x188 0x380 0x000 0x05 0x000
+#define MX25_PAD_UART2_RTS__CSPI2_SS3          0x188 0x380 0x000 0x06 0x000
 
 #define MX25_PAD_UART2_CTS__UART2_CTS          0x18c 0x384 0x000 0x00 0x000
 #define MX25_PAD_UART2_CTS__FEC_RX_ERR         0x18c 0x384 0x518 0x02 0x002
 #define MX25_PAD_UART2_CTS__GPIO_4_29          0x18c 0x384 0x000 0x05 0x000
+#define MX25_PAD_UART2_CTS__CSPI3_SS3          0x18c 0x384 0x4c8 0x06 0x001
 
 /*
  * Removing the SION bit from MX25_PAD_*__ESDHCn_CMD breaks detecting an SD
 #define MX25_PAD_SD1_DATA0__GPIO_2_25          0x198 0x390 0x000 0x05 0x000
 
 #define MX25_PAD_SD1_DATA1__ESDHC1_DAT1                0x19c 0x394 0x000 0x00 0x000
+#define MX25_PAD_SD1_DATA1__CSPI2_RDY          0x19c 0x394 0x498 0x01 0x001
 #define MX25_PAD_SD1_DATA1__AUD7_RXD           0x19c 0x394 0x478 0x03 0x000
 #define MX25_PAD_SD1_DATA1__GPIO_2_26          0x19c 0x394 0x000 0x05 0x000
 
 #define MX25_PAD_SD1_DATA2__ESDHC1_DAT2                0x1a0 0x398 0x000 0x00 0x000
+#define MX25_PAD_SD1_DATA2__CSPI2_SS0          0x1a0 0x398 0x4a4 0x01 0x001
 #define MX25_PAD_SD1_DATA2__FEC_RX_CLK         0x1a0 0x398 0x514 0x02 0x002
 #define MX25_PAD_SD1_DATA2__GPIO_2_27          0x1a0 0x398 0x000 0x05 0x000
 
 #define MX25_PAD_SD1_DATA3__ESDHC1_DAT3                0x1a4 0x39c 0x000 0x00 0x000
+#define MX25_PAD_SD1_DATA3__CSPI2_SS1          0x1a4 0x39c 0x4a8 0x01 0x001
 #define MX25_PAD_SD1_DATA3__FEC_CRS            0x1a4 0x39c 0x508 0x02 0x002
 #define MX25_PAD_SD1_DATA3__GPIO_2_28          0x1a4 0x39c 0x000 0x05 0x000
 
 #define MX25_PAD_GPIO_C__PWM4_PWMO             0x1fc 0x3f8 0x000 0x01 0x000
 #define MX25_PAD_GPIO_C__I2C2_SCL              0x1fc 0x3f8 0x51c 0x02 0x001
 #define MX25_PAD_GPIO_C__KPP_COL4              0x1fc 0x3f8 0x52c 0x03 0x001
+#define MX25_PAD_GPIO_C__GPT2_CAPIN1           0x1fc 0x3f8 0x000 0x04 0x000
+#define MX25_PAD_GPIO_C__CSPI1_SS2             0x1fc 0x3f8 0x000 0x05 0x000
 #define MX25_PAD_GPIO_C__CAN2_TX               0x1fc 0x3f8 0x000 0x06 0x000
+#define MX25_PAD_GPIO_C__CSPI2_SS2             0x1fc 0x3f8 0x000 0x07 0x000
 
 #define MX25_PAD_GPIO_D__GPIO_D                        0x200 0x3fc 0x000 0x00 0x000
 #define MX25_PAD_GPIO_D__I2C2_SDA              0x200 0x3fc 0x520 0x02 0x001
 #define MX25_PAD_GPIO_D__CAN2_RX               0x200 0x3fc 0x484 0x06 0x001
+#define MX25_PAD_GPIO_D__CSPI3_SS2             0x200 0x3fc 0x4c4 0x07 0x001
 
 #define MX25_PAD_GPIO_E__GPIO_E                        0x204 0x400 0x000 0x00 0x000
 #define MX25_PAD_GPIO_E__I2C3_CLK              0x204 0x400 0x524 0x01 0x002
 #define MX25_PAD_VSTBY_REQ__UART4_RTS          0x214 0x408 0x56c 0x06 0x002
 
 #define MX25_PAD_VSTBY_ACK__VSTBY_ACK          0x218 0x40c 0x000 0x00 0x000
+#define MX25_PAD_VSTBY_ACK__CSPI1_SS3          0x218 0x40c 0x490 0x02 0x001
 #define MX25_PAD_VSTBY_ACK__GPIO_3_18          0x218 0x40c 0x000 0x05 0x000
 
 #define MX25_PAD_POWER_FAIL__POWER_FAIL                0x21c 0x410 0x000 0x00 0x000
index 52c9524..303f920 100644 (file)
@@ -18,8 +18,8 @@
 };
 
 &cspi1 {
-       cs-gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>,
-                  <&gpio4 27 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 28 GPIO_ACTIVE_LOW>,
+                  <&gpio4 27 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
 
index bf883e4..344e777 100644 (file)
@@ -65,7 +65,7 @@
 
 &cspi1 {
        pinctrl-0 = <&pinctrl_cspi1>, <&pinctrl_cspi1cs1>;
-       cs-gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>,
+       cs-gpios = <&gpio4 28 GPIO_ACTIVE_LOW>,
                   <&gpio4 27 GPIO_ACTIVE_LOW>;
 };
 
index fc0b318..7bc1327 100644 (file)
                        };
                };
 
-               nfc: nand@d8000000 {
+               nfc: nand-controller@d8000000 {
                        #address-cells = <1>;
                        #size-cells = <1>;
                        compatible = "fsl,imx27-nand";
index 3ed2b32..14a92fe 100644 (file)
@@ -17,7 +17,7 @@
 
        apb@80000000 {
                apbh@80000000 {
-                       gpmi-nand@8000c000 {
+                       nand-controller@8000c000 {
                                pinctrl-names = "default";
                                pinctrl-0 = <&gpmi_pins_a &gpmi_status_cfg>;
                                status = "okay";
index c5acc19..b86be32 100644 (file)
@@ -13,7 +13,7 @@
 
        apb@80000000 {
                apbh@80000000 {
-                       gpmi-nand@8000c000 {
+                       nand-controller@8000c000 {
                                pinctrl-names = "default";
                                pinctrl-0 = <&gpmi_pins_a &gpmi_status_cfg>;
                                status = "okay";
index 96c1d10..7e2b0f1 100644 (file)
@@ -97,7 +97,7 @@
 
        apb@80000000 {
                apbh@80000000 {
-                       gpmi-nand@8000c000 {
+                       nand-controller@8000c000 {
                                pinctrl-names = "default";
                                pinctrl-0 = <&gpmi_pins_a &gpmi_status_cfg
                                             &gpmi_pins_evk>;
index 0bac72d..2bdb4c0 100644 (file)
@@ -16,7 +16,7 @@
 
        apb@80000000 {
                apbh@80000000 {
-                       gpmi-nand@8000c000 {
+                       nand-controller@8000c000 {
                                #address-cells = <1>;
                                #size-cells = <1>;
                                pinctrl-names = "default";
index 91bd6de..865ac3d 100644 (file)
@@ -17,7 +17,7 @@
 
        apb@80000000 {
                apbh@80000000 {
-                       gpmi-nand@8000c000 {
+                       nand-controller@8000c000 {
                                #address-cells = <1>;
                                #size-cells = <1>;
                                pinctrl-names = "default";
index a2b799c..94dfbf5 100644 (file)
                                status = "disabled";
                        };
 
-                       gpmi: gpmi-nand@8000c000 {
+                       gpmi: nand-controller@8000c000 {
                                compatible = "fsl,imx28-gpmi-nand";
                                #address-cells = <1>;
                                #size-cells = <1>;
index a25da41..878e89c 100644 (file)
@@ -20,7 +20,7 @@
 &cspi {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_cspi>;
-       cs-gpios = <&gpio4 11 0>, <&gpio4 13 0>;
+       cs-gpios = <&gpio4 11 GPIO_ACTIVE_LOW>, <&gpio4 13 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        flash: m25p32@1 {
index 563c1aa..c66f274 100644 (file)
@@ -74,8 +74,8 @@
 &ecspi1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
-       cs-gpios = <&gpio4 24 GPIO_ACTIVE_HIGH>,
-                  <&gpio4 25 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>,
+                  <&gpio4 25 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
 
index 719ed5c..f98691a 100644 (file)
 &ecspi2 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
-       cs-gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>, <&gpio2 27 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>, <&gpio2 27 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        spidev@0 {
index ec9fb89..9be44e8 100644 (file)
@@ -58,7 +58,7 @@
 &ecspi1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
-       cs-gpios = <&gpio2 30 0>, <&gpio3 19 0>;
+       cs-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>, <&gpio3 19 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        zigbee: mc1323@0 {
index 9a6cb13..7e7f9f3 100644 (file)
@@ -50,8 +50,8 @@
 &ecspi1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
-       cs-gpios = <&gpio2 30 0>, <&gpio3 19 0>,
-                  <&gpio3 24 0>, <&gpio3 25 0>;
+       cs-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>, <&gpio3 19 GPIO_ACTIVE_LOW>,
+                  <&gpio3 24 GPIO_ACTIVE_LOW>, <&gpio3 25 GPIO_ACTIVE_LOW>;
        status = "disabled";
 };
 
 &cspi {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_cspi>;
-       cs-gpios = <&gpio1 18 0>, <&gpio1 19 0>,
-                  <&gpio1 21 0>;
+       cs-gpios = <&gpio1 18 GPIO_ACTIVE_LOW>, <&gpio1 19 GPIO_ACTIVE_LOW>,
+                  <&gpio1 21 GPIO_ACTIVE_LOW>;
        status = "disabled";
 };
 
index 289feab..24859d0 100644 (file)
 &ecspi1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
-       cs-gpios = <&gpio2 30 0>, <&gpio3 19 0>, <&gpio2 16 0>, <&gpio2 17 0>;
+       cs-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>, <&gpio3 19 GPIO_ACTIVE_LOW>,
+                  <&gpio2 16 GPIO_ACTIVE_LOW>, <&gpio2 17 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
 
index 9e027b9..665d637 100644 (file)
 &ecspi1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
+       cs-gpios = <&gpio4 9 GPIO_ACTIVE_LOW>;
        status = "disabled";
 };
 
                        MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK        0x100b1
                        MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI        0x100b1
                        MX6QDL_PAD_KEY_COL1__ECSPI1_MISO        0x100b1
-                       MX6QDL_PAD_KEY_ROW1__ECSPI1_SS0         0x100b1
+                       MX6QDL_PAD_KEY_ROW1__GPIO4_IO09         0x1b0b0
                >;
        };
 
index 809ca56..5c7e853 100644 (file)
@@ -61,7 +61,7 @@
 };
 
 &ecspi2 {
-       cs-gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio3 24 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
        status = "okay";
index 9eb2b73..b4a9523 100644 (file)
@@ -67,7 +67,7 @@
 &ecspi2 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
-       cs-gpios = <&gpio5 12 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio5 12 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        flash@0 {
@@ -80,7 +80,7 @@
 &ecspi1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
-       cs-gpios = <&gpio5 25 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio5 25 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        tpm@0 {
index fa88245..5ac8444 100644 (file)
@@ -37,7 +37,7 @@
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
@@ -52,7 +52,7 @@
 };
 
 &ecspi3 {
-       cs-gpios = <&gpio4 24 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi3>;
        status = "okay";
index 306b4f7..ae6da24 100644 (file)
 };
 
 &ecspi2 {
-       cs-gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
        status = "okay";
diff --git a/arch/arm/boot/dts/imx6dl-tqma6a.dtsi b/arch/arm/boot/dts/imx6dl-tqma6a.dtsi
new file mode 100644 (file)
index 0000000..e891ef9
--- /dev/null
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Sascha Hauer, Pengutronix
+ * Copyright 2013-2017 Markus Niebel <Markus.Niebel@tq-group.com>
+ */
+
+#include "imx6dl.dtsi"
+#include "imx6qdl-tqma6a.dtsi"
+#include "imx6qdl-tqma6.dtsi"
+
+/ {
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x20000000>;
+       };
+};
diff --git a/arch/arm/boot/dts/imx6dl-tqma6b.dtsi b/arch/arm/boot/dts/imx6dl-tqma6b.dtsi
new file mode 100644 (file)
index 0000000..38cd850
--- /dev/null
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Sascha Hauer, Pengutronix
+ * Copyright 2013-2017 Markus Niebel <Markus.Niebel@tq-group.com>
+ */
+
+#include "imx6dl.dtsi"
+#include "imx6qdl-tqma6b.dtsi"
+#include "imx6qdl-tqma6.dtsi"
+
+/ {
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x20000000>;
+       };
+};
index c4a235d..7d2c725 100644 (file)
@@ -8,6 +8,11 @@
 #include <dt-bindings/pwm/pwm.h>
 
 / {
+       aliases: aliases {
+               ethernet1 = &eth1;
+               ethernet2 = &eth2;
+       };
+
        backlight: backlight {
                compatible = "pwm-backlight";
                pwms = <&pwm1 0 500000 PWM_POLARITY_INVERTED>;
                                        };
                                };
 
-                               port@2 {
+                               eth2: port@2 {
                                        reg = <2>;
                                        label = "eth2";
                                        phy-handle = <&phy_port2>;
                                };
 
-                               port@3 {
+                               eth1: port@3 {
                                        reg = <3>;
                                        label = "eth1";
                                        phy-handle = <&phy_port3>;
                reg = <0x30>;
                clock-mode = /bits/ 8 <1>;
                status = "disabled";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               chan0 {
+               chan@0 {
                        chan-name = "R";
                        led-cur = /bits/ 8 <0x20>;
                        max-cur = /bits/ 8 <0x60>;
+                       reg = <0>;
                };
 
-               chan1 {
+               chan@1 {
                        chan-name = "G";
                        led-cur = /bits/ 8 <0x20>;
                        max-cur = /bits/ 8 <0x60>;
+                       reg = <1>;
                };
 
-               chan2 {
+               chan@2 {
                        chan-name = "B";
                        led-cur = /bits/ 8 <0x20>;
                        max-cur = /bits/ 8 <0x60>;
+                       reg = <2>;
                };
 
-               chan3 {
+               chan@3 {
                        chan-name = "W";
                        led-cur = /bits/ 8 <0x0>;
                        max-cur = /bits/ 8 <0x0>;
+                       reg = <3>;
                };
        };
 
        pinctrl-0 = <&pinctrl_i2c3>;
        status = "okay";
 
-       oled: oled@3d {
+       oled_1309: oled@3c {
+               compatible = "solomon,ssd1309fb-i2c";
+               reg = <0x3c>;
+               solomon,height = <64>;
+               solomon,width = <128>;
+               solomon,page-offset = <0>;
+               solomon,segment-no-remap;
+               solomon,prechargep2 = <15>;
+               reset-gpios = <&gpio_oled 1 GPIO_ACTIVE_LOW>;
+               vbat-supply = <&sw2_reg>;
+               status = "disabled";
+       };
+
+       oled_1305: oled@3d {
                compatible = "solomon,ssd1305fb-i2c";
                reg = <0x3d>;
                solomon,height = <64>;
index 6010d3d..a19609c 100644 (file)
        status = "okay";
 };
 
-&oled {
+&oled_1305 {
+       status = "okay";
+};
+
+&oled_1309 {
        status = "okay";
 };
 
diff --git a/arch/arm/boot/dts/imx6dl-yapp4-orion.dts b/arch/arm/boot/dts/imx6dl-yapp4-orion.dts
new file mode 100644 (file)
index 0000000..884b236
--- /dev/null
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2020 Y Soft Corporation, a.s.
+
+/dts-v1/;
+
+#include "imx6dl.dtsi"
+#include "imx6dl-yapp4-common.dtsi"
+
+/ {
+       model = "Y Soft IOTA Orion i.MX6DualLite board";
+       compatible = "ysoft,imx6dl-yapp4-orion", "fsl,imx6dl";
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0xf0000000>;
+       };
+};
+
+&gpio_oled {
+       status = "okay";
+};
+
+&leds {
+       status = "okay";
+};
+
+&oled_1305 {
+       status = "okay";
+};
+
+&oled_1309 {
+       status = "okay";
+};
+
+&reg_usb_h1_vbus {
+       status = "okay";
+};
+
+&touchkeys {
+       status = "okay";
+};
+
+&uart2 {
+       status = "disabled";
+};
+
+&usbh1 {
+       status = "okay";
+};
+
+&usbphy2 {
+       status = "okay";
+};
index a1173bf..f6ae24e 100644 (file)
        };
 };
 
+&aliases {
+       /delete-property/ ethernet1;
+};
+
 &backlight {
        status = "okay";
 };
index 77b65a4..fdd81fd 100644 (file)
                };
 
                aips1: bus@2000000 {
-                       iomuxc: pinctrl@20e0000 {
-                               compatible = "fsl,imx6dl-iomuxc";
-                       };
-
                        pxp: pxp@20f0000 {
                                reg = <0x020f0000 0x4000>;
                                interrupts = <0 98 IRQ_TYPE_LEVEL_HIGH>;
        compatible = "fsl,imx6dl-hdmi";
 };
 
+&iomuxc {
+       compatible = "fsl,imx6dl-iomuxc";
+};
+
 &ipu1_csi1 {
        ipu1_csi1_from_ipu1_csi1_mux: endpoint {
                remote-endpoint = <&ipu1_csi1_mux_to_ipu1_csi1>;
index fb09801..604f242 100644 (file)
 };
 
 &pca9539 {
-       P04 {
+       P04-hog {
                gpio-hog;
                gpios = <4 0>;
                output-low;
                line-name = "PCA9539-P04";
        };
 
-        P07 {
-                gpio-hog;
-                gpios = <7 0>;
-                output-low;
-                line-name = "PCA9539-P07";
-        };
+       P07-hog {
+               gpio-hog;
+               gpios = <7 0>;
+               output-low;
+               line-name = "PCA9539-P07";
+       };
 };
 
 &pci_root {
index 8f762d9..56d2aeb 100644 (file)
 };
 
 &pca9539 {
-        P07 {
-                gpio-hog;
-                gpios = <7 0>;
-                output-low;
-                line-name = "PCA9539-P07";
-        };
+       P07-hog {
+               gpio-hog;
+               gpios = <7 0>;
+               output-low;
+               line-name = "PCA9539-P07";
+       };
 };
 
 &usbphy1 {
index 1ea64ec..3d6b757 100644 (file)
 };
 
 &pca9539 {
-       P10 {
+       P10-hog {
                gpio-hog;
                gpios = <8 0>;
                output-low;
                line-name = "PCA9539-P10";
        };
 
-       P11 {
+       P11-hog {
                gpio-hog;
                gpios = <9 0>;
                output-low;
index fc81f2f..e4578ed 100644 (file)
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
index 1938b04..2a98cc6 100644 (file)
                #address-cells = <1>;
                #size-cells = <0>;
 
-               switch@0 {
+               switch: switch@0 {
                        compatible = "marvell,mv88e6085"; /* 88e6240*/
                        reg = <0>;
 
+                       interrupt-parent = <&gpio2>;
+                       interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+
                        switch_ports: ports {
                                #address-cells = <1>;
                                #size-cells = <0>;
 
                                switchphy0: switchphy@0 {
                                        reg = <0>;
+                                       interrupt-parent = <&switch>;
+                                       interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
                                };
 
                                switchphy1: switchphy@1 {
                                        reg = <1>;
+                                       interrupt-parent = <&switch>;
+                                       interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
                                };
 
                                switchphy2: switchphy@2 {
                                        reg = <2>;
+                                       interrupt-parent = <&switch>;
+                                       interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;
                                };
 
                                switchphy3: switchphy@3 {
                                        reg = <3>;
+                                       interrupt-parent = <&switch>;
+                                       interrupts = <3 IRQ_TYPE_LEVEL_HIGH>;
                                };
 
                                switchphy4: switchphy@4 {
                                        reg = <4>;
+                                       interrupt-parent = <&switch>;
+                                       interrupts = <4 IRQ_TYPE_LEVEL_HIGH>;
                                };
                        };
                };
 };
 
 &ecspi5 {
-       cs-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi5>;
        status = "okay";
                                interrupt-parent = <&gpio2>;
                                interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
 
-                               P12 {
+                               P12-hog {
                                        gpio-hog;
                                        gpios = <10 0>;
                                        output-low;
                                        line-name = "PCA9539-P12";
                                };
 
-                               P13 {
+                               P13-hog {
                                        gpio-hog;
                                        gpios = <11 0>;
                                        output-low;
                                        line-name = "PCA9539-P13";
                                };
 
-                               P14 {
+                               P14-hog {
                                        gpio-hog;
                                        gpios = <12 0>;
                                        output-low;
                                        line-name = "PCA9539-P14";
                                };
 
-                               P15 {
+                               P15-hog {
                                        gpio-hog;
                                        gpios = <13 0>;
                                        output-low;
                                        line-name = "PCA9539-P15";
                                };
 
-                               P16 {
+                               P16-hog {
                                        gpio-hog;
                                        gpios = <14 0>;
                                        output-low;
                                        line-name = "PCA9539-P16";
                                };
 
-                               P17 {
+                               P17-hog {
                                        gpio-hog;
                                        gpios = <15 0>;
                                        output-low;
index cab9e92..bfb530f 100644 (file)
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>, <&gpio3 19 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>, <&gpio3 19 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
index 87f0aa8..236fc20 100644 (file)
@@ -59,7 +59,7 @@
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>, <&gpio4 11 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>, <&gpio4 11 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
index f9df207..fa2307d 100644 (file)
@@ -99,7 +99,7 @@
 &ecspi5 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi5>;
-       cs-gpios = <&gpio1 12 0>;
+       cs-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        flash: m25p80@0 {
index 57761f3..48fb47e 100644 (file)
@@ -42,7 +42,7 @@
 };
 
 &ecspi5 {
-       cs-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi5>;
        status = "okay";
index b6e2b58..4cde45d 100644 (file)
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
index 2618ecc..4d6a0c3 100644 (file)
 
 /* Quad/Dual SoMs have 3 chip-select signals */
 &ecspi4 {
-       fsl,spi-num-chipselects = <3>;
-       cs-gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>,
-                  <&gpio3 29 GPIO_ACTIVE_HIGH>,
-                  <&gpio3 25 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio3 24 GPIO_ACTIVE_LOW>,
+                  <&gpio3 29 GPIO_ACTIVE_LOW>,
+                  <&gpio3 25 GPIO_ACTIVE_LOW>;
 };
 
 &pinctrl_ecspi4 {
index 8f94364..46a4dde 100644 (file)
@@ -9,7 +9,7 @@
 
 / {
        model = "Logic PD i.MX6QD SOM-M3";
-       compatible = "fsl,imx6q";
+       compatible = "logicpd,imx6q-logicpd", "fsl,imx6q";
 
        backlight: backlight-lvds {
                compatible = "pwm-backlight";
index de6cbaa..d112b50 100644 (file)
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
 };
 
 &ecspi2 {
-       cs-gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>, <&gpio4 25 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>, <&gpio4 25 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2 &pinctrl_ecspi2_cs>;
        status = "okay";
 };
 
 &ecspi3 {
-       cs-gpios = <&gpio4 24 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi3>;
        status = "okay";
diff --git a/arch/arm/boot/dts/imx6q-tqma6a.dtsi b/arch/arm/boot/dts/imx6q-tqma6a.dtsi
new file mode 100644 (file)
index 0000000..ab4c07c
--- /dev/null
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Sascha Hauer, Pengutronix
+ * Copyright 2013-2017 Markus Niebel <Markus.Niebel@tq-group.com>
+ */
+
+#include "imx6q.dtsi"
+#include "imx6qdl-tqma6a.dtsi"
+#include "imx6qdl-tqma6.dtsi"
+
+/ {
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+};
diff --git a/arch/arm/boot/dts/imx6q-tqma6b.dtsi b/arch/arm/boot/dts/imx6q-tqma6b.dtsi
new file mode 100644 (file)
index 0000000..7224c37
--- /dev/null
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Sascha Hauer, Pengutronix
+ */
+
+#include "imx6q.dtsi"
+#include "imx6qdl-tqma6b.dtsi"
+#include "imx6qdl-tqma6.dtsi"
+
+/ {
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+};
index a57c2e3..6355035 100644 (file)
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio4 9 GPIO_ACTIVE_HIGH>,
-                  <&gpio4 10 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 9 GPIO_ACTIVE_LOW>,
+                  <&gpio4 10 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
 
index 78a4d64..5277e39 100644 (file)
                                        status = "disabled";
                                };
                        };
-
-                       iomuxc: pinctrl@20e0000 {
-                               compatible = "fsl,imx6q-iomuxc";
-                       };
                };
 
                sata: sata@2200000 {
        };
 };
 
+&iomuxc {
+       compatible = "fsl,imx6q-iomuxc";
+};
+
 &ipu1_csi1 {
        ipu1_csi1_from_mipi_vc1: endpoint {
                remote-endpoint = <&mipi_vc1_to_ipu1_csi1>;
index dbdd7db..30fa349 100644 (file)
 
 /* Apalis SPI1 */
 &ecspi1 {
-       cs-gpios = <&gpio5 25 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio5 25 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "disabled";
 
 /* Apalis SPI2 */
 &ecspi2 {
-       cs-gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
        status = "disabled";
index d954661..e21f6ac 100644 (file)
@@ -91,7 +91,7 @@
 };
 
 &ecspi4 {
-       cs-gpios = <&gpio3 20 0>;
+       cs-gpios = <&gpio3 20 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi4>;
        status = "okay";
index d38630d..ead7ba2 100644 (file)
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio4 9 GPIO_ACTIVE_HIGH
-                   &gpio4 10 GPIO_ACTIVE_HIGH
-                   &gpio4 11 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 9 GPIO_ACTIVE_LOW
+                   &gpio4 10 GPIO_ACTIVE_LOW
+                   &gpio4 11 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
 };
 
 &ecspi2 {
-       cs-gpios = <&gpio2 26 GPIO_ACTIVE_HIGH &gpio2 27 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW &gpio2 27 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
        status = "okay";
 };
 
 &ecspi4 {
-       cs-gpios = <&gpio3 29 GPIO_ACTIVE_HIGH &gpio5 2 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio3 29 GPIO_ACTIVE_LOW &gpio5 2 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi4>;
        status = "okay";
index 0930194..4e2a309 100644 (file)
@@ -94,7 +94,7 @@
 
 /* Colibri SSP */
 &ecspi4 {
-       cs-gpios = <&gpio5 2 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio5 2 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi4>;
        status = "disabled";
index ebe7a8b..648f5fc 100644 (file)
@@ -30,7 +30,7 @@
 };
 
 &ecspi3 {
-       cs-gpios = <&gpio4 24 0>;
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi3>;
        status = "okay";
index 35e230f..7228b89 100644 (file)
 &ecspi2 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
-       cs-gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>,
-               <&gpio2 27 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>,
+               <&gpio2 27 GPIO_ACTIVE_LOW>;
 };
 
 &ecspi4 {
index 4d01c33..3c04b5a 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #size-cells = <0>;
index a46ea98..736074f 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
 };
 
 &ecspi3 {
-       cs-gpios = <&gpio4 24 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi3>;
        status = "okay";
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #size-cells = <0>;
index a28e794..8072ed4 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #size-cells = <0>;
index b5f934b..8c9bcdd 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/sound/fsl-imx-audmux.h>
 
 / {
 };
 
 &ecspi2 {
-       cs-gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
        status = "okay";
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #address-cells = <1>;
index 1516e2b..e5d803d 100644 (file)
@@ -48,6 +48,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/media/tda1997x.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/sound/fsl-imx-audmux.h>
 
 / {
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #size-cells = <0>;
index 0da6e6f..290a607 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #size-cells = <0>;
index db30de5..c15b9cc 100644 (file)
@@ -47,6 +47,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
@@ -64,8 +65,6 @@
 
        gpio-keys {
                compatible = "gpio-keys";
-               #address-cells = <1>;
-               #size-cells = <0>;
 
                user-pb {
                        label = "user_pb";
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #size-cells = <0>;
index d6b0745..093a219 100644 (file)
@@ -47,6 +47,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
 };
 
 &ecspi3 {
-       cs-gpios = <&gpio4 24 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi3>;
        status = "okay";
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #size-cells = <0>;
index fbe6c32..e1c8dd2 100644 (file)
@@ -47,6 +47,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        chosen {
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #size-cells = <0>;
index 23c6e40..3cd2e71 100644 (file)
@@ -47,6 +47,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #size-cells = <0>;
index b1ff7c8..21c68a5 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #size-cells = <0>;
index 11f84ee..ed4e222 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
 
 
 &ecspi3 {
-       cs-gpios = <&gpio4 24 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi3>;
        status = "okay";
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #size-cells = <0>;
index 0a1ffff..797f160 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
 };
 
 &ecspi2 {
-       cs-gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
        status = "okay";
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #address-cells = <1>;
index d62a8da..4cd7d29 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
                compatible = "gw,gsc";
                reg = <0x20>;
                interrupt-parent = <&gpio1>;
-               interrupts = <4 GPIO_ACTIVE_LOW>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
                interrupt-controller;
                #interrupt-cells = <1>;
                #size-cells = <0>;
index e423133..eb1ad28 100644 (file)
 &ecspi2 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hummingboard2_ecspi2>;
-       cs-gpios = <&gpio2 26 0>;
+       cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
 
index 81c7ebb..265f5f3 100644 (file)
 &ecspi2 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
-       cs-gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>,
-                  <&gpio2 27 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>,
+                  <&gpio2 27 GPIO_ACTIVE_LOW>;
 };
 
 /* SPI0 */
 &ecspi4 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi4>;
-       cs-gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>,
-                  <&gpio3 29 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio3 24 GPIO_ACTIVE_LOW>,
+                  <&gpio3 29 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        /* default boot source: workaround #1 for errata ERR006282 */
index 185a1a3..a091782 100644 (file)
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
index 4bbe54e..92d09a3 100644 (file)
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
index c63e1bc..1243677 100644 (file)
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio3 19 0>;
+       cs-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
index bc43c75..e361df2 100644 (file)
@@ -71,7 +71,7 @@
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi3>;
        status = "okay";
-       cs-gpios = <&gpio4 24 0>;
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
 
        som_flash: flash@0 {
                compatible = "m25p80", "jedec,spi-nor";
index 39dfd90..5de4ccb 100644 (file)
 &ecspi2 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
-       cs-gpios = <&gpio2 27 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 27 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
 
index 55f736d..afe477f 100644 (file)
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio3 19 0>;
+       cs-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1 &pinctrl_ecspi1_cs>;
        status = "disabled"; /* pin conflict with WEIM NOR */
index 95f9dda..fdc3aa9 100644 (file)
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio3 19 0>;
+       cs-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
index 68b3e68..f824c9a 100644 (file)
                        "Ext Spk", "SPKOUTL",
                        "Ext Spk", "SPKOUTR",
                        "AMIC", "MICBIAS",
-                       "IN3R", "AMIC";
+                       "IN3R", "AMIC",
+                       "DMIC", "MICBIAS",
+                       "DMICDAT", "DMIC";
                mux-int-port = <2>;
                mux-ext-port = <3>;
+               hp-det-gpio = <&gpio7 8 GPIO_ACTIVE_LOW>;
+               mic-det-gpio = <&gpio1 9 GPIO_ACTIVE_LOW>;
        };
 
        backlight_lvds: backlight-lvds {
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio4 9 0>;
+       cs-gpios = <&gpio4 9 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
diff --git a/arch/arm/boot/dts/imx6qdl-tqma6.dtsi b/arch/arm/boot/dts/imx6qdl-tqma6.dtsi
new file mode 100644 (file)
index 0000000..b18b83a
--- /dev/null
@@ -0,0 +1,201 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Sascha Hauer, Pengutronix
+ * Copyright 2013-2017 Markus Niebel <Markus.Niebel@tq-group.com>
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "supply-3p3v";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+};
+
+&ecspi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi1>;
+       cs-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+
+       m25p80: flash@0 {
+               compatible = "jedec,spi-nor";
+               spi-max-frequency = <50000000>;
+               reg = <0>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               m25p,fast-read;
+       };
+};
+
+&iomuxc {
+       pinctrl_ecspi1: ecspi1grp {
+               fsl,pins = <
+                       /* HYS, SPEED = MED, 100k up, DSE = 011, SRE_FAST */
+                       MX6QDL_PAD_EIM_D17__ECSPI1_MISO 0x1b099
+                       MX6QDL_PAD_EIM_D18__ECSPI1_MOSI 0xb099
+                       MX6QDL_PAD_EIM_D16__ECSPI1_SCLK 0xb099
+                        /* eCSPI1 SS1 */
+                       MX6QDL_PAD_EIM_D19__GPIO3_IO19 0xb099
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT8__I2C1_SDA 0x4001b899
+                       MX6QDL_PAD_CSI0_DAT9__I2C1_SCL 0x4001b899
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_5__I2C3_SCL 0x4001b899
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b899
+               >;
+       };
+
+       pinctrl_pmic: pmicgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_RB0__GPIO6_IO10 0x1b099 /* PMIC irq */
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD    0x17059
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK    0x10059
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059
+                       MX6QDL_PAD_SD3_DAT4__SD3_DATA4 0x17059
+                       MX6QDL_PAD_SD3_DAT5__SD3_DATA5 0x17059
+                       MX6QDL_PAD_SD3_DAT6__SD3_DATA6 0x17059
+                       MX6QDL_PAD_SD3_DAT7__SD3_DATA7 0x17059
+               >;
+       };
+};
+
+&pmic {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pmic>;
+       interrupt-parent = <&gpio6>;
+       interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
+
+       regulators {
+               reg_vddcore: sw1ab {
+                       regulator-min-microvolt = <300000>;
+                       regulator-max-microvolt = <1875000>;
+                       regulator-always-on;
+               };
+
+               reg_vddsoc: sw1c {
+                       regulator-min-microvolt = <300000>;
+                       regulator-max-microvolt = <1875000>;
+                       regulator-always-on;
+               };
+
+               reg_gen_3v3: sw2 {
+                       regulator-min-microvolt = <800000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_ddr_1v5a: sw3a {
+                       regulator-min-microvolt = <400000>;
+                       regulator-max-microvolt = <1975000>;
+                       regulator-always-on;
+               };
+
+               reg_ddr_1v5b: sw3b {
+                       regulator-min-microvolt = <400000>;
+                       regulator-max-microvolt = <1975000>;
+                       regulator-always-on;
+               };
+
+               sw4_reg: sw4 {
+                       regulator-min-microvolt = <800000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_5v_600mA: swbst {
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5150000>;
+                       regulator-always-on;
+               };
+
+               reg_snvs_3v: vsnvs {
+                       regulator-min-microvolt = <1500000>;
+                       regulator-max-microvolt = <3000000>;
+                       regulator-always-on;
+               };
+
+               reg_vrefddr: vrefddr {
+                       regulator-boot-on;
+                       regulator-always-on;
+               };
+
+               reg_vgen1_1v5: vgen1 {
+                       regulator-min-microvolt = <800000>;
+                       regulator-max-microvolt = <1550000>;
+                       /* not used */
+               };
+
+               reg_vgen2_1v2_eth: vgen2 {
+                       regulator-min-microvolt = <800000>;
+                       regulator-max-microvolt = <1550000>;
+                       regulator-always-on;
+               };
+
+               reg_vgen3_2v8: vgen3 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_vgen4_1v8: vgen4 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_vgen5_1v8_eth: vgen5 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_vgen6_3v3: vgen6 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+       };
+};
+
+/* eMMC */
+&usdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       vmmc-supply = <&reg_3p3v>;
+       non-removable;
+       disable-wp;
+       no-sd;
+       no-sdio;
+       bus-width = <8>;
+       #address-cells = <1>;
+       #size-cells = <0>;
+       status = "okay";
+
+       mmccard: mmccard@0 {
+               reg = <0>;
+               compatible = "mmc-card";
+               broken-hpi;
+       };
+};
diff --git a/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi b/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi
new file mode 100644 (file)
index 0000000..b679bec
--- /dev/null
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Sascha Hauer, Pengutronix
+ * Copyright 2013-2017 Markus Niebel <Markus.Niebel@tq-group.com>
+ */
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       clock-frequency = <100000>;
+       status = "okay";
+
+       pmic: pmic@8 {
+               compatible = "fsl,pfuze100";
+               reg = <0x08>;
+       };
+
+       sensor@48 {
+               compatible = "national,lm75";
+               reg = <0x48>;
+       };
+
+       eeprom@50 {
+               compatible = "st,24c64", "atmel,24c64";
+               reg = <0x50>;
+               pagesize = <32>;
+       };
+};
diff --git a/arch/arm/boot/dts/imx6qdl-tqma6b.dtsi b/arch/arm/boot/dts/imx6qdl-tqma6b.dtsi
new file mode 100644 (file)
index 0000000..49c4722
--- /dev/null
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Sascha Hauer, Pengutronix
+ * Copyright 2013-2017 Markus Niebel <Markus.Niebel@tq-group.com>
+ */
+
+&i2c3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       clock-frequency = <100000>;
+       status = "okay";
+
+       pmic: pmic@8 {
+               compatible = "fsl,pfuze100";
+               reg = <0x08>;
+       };
+
+       sensor@48 {
+               compatible = "national,lm75";
+               reg = <0x48>;
+       };
+
+       eeprom@50 {
+               compatible = "st,24c64", "atmel,24c64";
+               reg = <0x50>;
+               pagesize = <32>;
+       };
+};
index 267c956..f88da75 100644 (file)
@@ -95,7 +95,7 @@
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
 };
 
 &ecspi2 {
-       cs-gpios = <&gpio6 2 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio6 2 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
        status = "okay";
index f0be516..e6aa0c3 100644 (file)
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
 
 &ecspi2 {
        cs-gpios = <
-               &gpio5 31 GPIO_ACTIVE_HIGH
-               &gpio7 12 GPIO_ACTIVE_HIGH
-               &gpio5 18 GPIO_ACTIVE_HIGH
+               &gpio5 31 GPIO_ACTIVE_LOW
+               &gpio7 12 GPIO_ACTIVE_LOW
+               &gpio5 18 GPIO_ACTIVE_LOW
        >;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
index 5af9ce9..66b1574 100644 (file)
 &ecspi1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
-       cs-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        flash@0 {
index 43edbf1..7a8837c 100644 (file)
                        clocks = <&clks IMX6QDL_CLK_APBH_DMA>;
                };
 
-               gpmi: gpmi-nand@112000 {
+               gpmi: nand-controller@112000 {
                        compatible = "fsl,imx6q-gpmi-nand";
                        reg = <0x00112000 0x2000>, <0x00114000 0x2000>;
                        reg-names = "gpmi-nand", "bch";
                                             <0 119 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6QDL_CLK_ENET>,
                                         <&clks IMX6QDL_CLK_ENET>,
+                                        <&clks IMX6QDL_CLK_ENET_REF>,
                                         <&clks IMX6QDL_CLK_ENET_REF>;
-                               clock-names = "ipg", "ahb", "ptp";
+                               clock-names = "ipg", "ahb", "ptp", "enet_out";
                                fsl,stop-mode = <&gpr 0x34 27>;
                                status = "disabled";
                        };
index 639d9dd..2bb3bfb 100644 (file)
@@ -47,7 +47,8 @@
 };
 
 &pcie {
-       status = "disabled";
+       reset-gpio = <&max7310_c 5 GPIO_ACTIVE_LOW>;
+       status = "okay";
 };
 
 &sata {
diff --git a/arch/arm/boot/dts/imx6qp-tqma6b.dtsi b/arch/arm/boot/dts/imx6qp-tqma6b.dtsi
new file mode 100644 (file)
index 0000000..bb6ff7c
--- /dev/null
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Sascha Hauer, Pengutronix
+ */
+
+#include "imx6q.dtsi"
+#include "imx6qp.dtsi"
+#include "imx6qdl-tqma6b.dtsi"
+#include "imx6qdl-tqma6.dtsi"
+
+/ {
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+};
index b1b069e..25f6f2f 100644 (file)
@@ -94,6 +94,8 @@
 
        sound {
                compatible = "fsl,imx6sl-evk-wm8962", "fsl,imx-audio-wm8962";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_hp>;
                model = "wm8962-audio";
                ssi-controller = <&ssi2>;
                audio-codec = <&codec>;
                        "IN3R", "AMIC";
                mux-int-port = <2>;
                mux-ext-port = <3>;
+               hp-det-gpio = <&gpio4 19 GPIO_ACTIVE_LOW>;
        };
 
        panel {
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio4 11 0>;
+       cs-gpios = <&gpio4 11 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
                        >;
                };
 
+               pinctrl_hp: hpgrp {
+                       fsl,pins = <
+                               MX6SL_PAD_FEC_RX_ER__GPIO4_IO19   0x1b0b0
+                       >;
+               };
+
                pinctrl_i2c1: i2c1grp {
                        fsl,pins = <
                                MX6SL_PAD_I2C1_SCL__I2C1_SCL    0x4001b8b1
diff --git a/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts b/arch/arm/boot/dts/imx6sl-tolino-shine2hd.dts
new file mode 100644 (file)
index 0000000..caa2796
--- /dev/null
@@ -0,0 +1,588 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device tree for the Tolino Shine 2 HD ebook reader
+ *
+ * Name on mainboard is: 37NB-E60QF0+4A2 or 37NB-E60QF0+4A3
+ * Serials start with: E60QF2
+ *
+ * Copyright 2020 Andreas Kemnade
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+#include "imx6sl.dtsi"
+
+/ {
+       model = "Tolino Shine 2 HD";
+       compatible = "kobo,tolino-shine2hd", "fsl,imx6sl";
+
+       chosen {
+               stdout-path = &uart1;
+       };
+
+       gpio_keys: gpio-keys {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_keys>;
+
+               cover {
+                       label = "Cover";
+                       gpios = <&gpio5 12 GPIO_ACTIVE_LOW>;
+                       linux,code = <SW_LID>;
+                       linux,input-type = <EV_SW>;
+                       wakeup-source;
+               };
+
+               fl {
+                       label = "Frontlight";
+                       gpios = <&gpio3 26 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_BRIGHTNESS_CYCLE>;
+               };
+
+               home {
+                       label = "Home";
+                       gpios = <&gpio3 25 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_HOME>;
+               };
+
+               power {
+                       label = "Power";
+                       gpios = <&gpio5 8 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_POWER>;
+                       wakeup-source;
+               };
+       };
+
+       leds: leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_led>;
+
+               on {
+                       label = "tolinoshine2hd:white:on";
+                       gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "timer";
+               };
+       };
+
+       memory@80000000 {
+               device_type = "memory";
+               reg = <0x80000000 0x20000000>;
+       };
+
+       reg_wifi: regulator-wifi {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_wifi_power>;
+               regulator-name = "SD3_SPWR";
+               regulator-min-microvolt = <3000000>;
+               regulator-max-microvolt = <3000000>;
+               gpio = <&gpio4 29 GPIO_ACTIVE_LOW>;
+       };
+
+       wifi_pwrseq: wifi_pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_wifi_reset>;
+               post-power-on-delay-ms = <20>;
+               reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&i2c1 {
+       pinctrl-names = "default","sleep";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       pinctrl-1 = <&pinctrl_i2c1_sleep>;
+       status = "okay";
+
+       /* TODO: embedded controller at 0x43 (driver missing) */
+
+};
+
+&i2c2 {
+       pinctrl-names = "default","sleep";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       pinctrl-1 = <&pinctrl_i2c2_sleep>;
+       clock-frequency = <100000>;
+       status = "okay";
+
+       zforce: touchscreen@50 {
+               compatible = "neonode,zforce";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_zforce>;
+               reg = <0x50>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
+               vdd-supply = <&ldo1_reg>;
+               reset-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
+               x-size = <1072>;
+               y-size = <1448>;
+       };
+
+       /* TODO: TPS65185 PMIC for E Ink at 0x68 */
+
+};
+
+&i2c3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       clock-frequency = <400000>;
+       status = "okay";
+
+       ricoh619: pmic@32 {
+               compatible = "ricoh,rc5t619";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_ricoh_gpio>;
+               reg = <0x32>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
+               system-power-controller;
+
+               regulators {
+                       dcdc1_reg: DCDC1 {
+                               regulator-name = "DCDC1";
+                               regulator-min-microvolt = <300000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-max-microvolt = <900000>;
+                                       regulator-suspend-min-microvolt = <900000>;
+                               };
+                       };
+
+                       /* Core3_3V3 */
+                       dcdc2_reg: DCDC2 {
+                               regulator-name = "DCDC2";
+                               regulator-always-on;
+                               regulator-boot-on;
+
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-max-microvolt = <3100000>;
+                                       regulator-suspend-min-microvolt = <3100000>;
+                               };
+                       };
+
+                       dcdc3_reg: DCDC3 {
+                               regulator-name = "DCDC3";
+                               regulator-min-microvolt = <300000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-max-microvolt = <1140000>;
+                                       regulator-suspend-min-microvolt = <1140000>;
+                               };
+                       };
+
+                       /* Core4_1V2 */
+                       dcdc4_reg: DCDC4 {
+                               regulator-name = "DCDC4";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1200000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-max-microvolt = <1140000>;
+                                       regulator-suspend-min-microvolt = <1140000>;
+                               };
+                       };
+
+                       /* Core4_1V8 */
+                       dcdc5_reg: DCDC5 {
+                               regulator-name = "DCDC5";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-max-microvolt = <1700000>;
+                                       regulator-suspend-min-microvolt = <1700000>;
+                               };
+                       };
+
+                       /* IR_3V3 */
+                       ldo1_reg: LDO1  {
+                               regulator-name = "LDO1";
+                               regulator-boot-on;
+                       };
+
+                       /* Core1_3V3 */
+                       ldo2_reg: LDO2  {
+                               regulator-name = "LDO2";
+                               regulator-always-on;
+                               regulator-boot-on;
+
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-max-microvolt = <3000000>;
+                                       regulator-suspend-min-microvolt = <3000000>;
+                               };
+                       };
+
+                       /* Core5_1V2 */
+                       ldo3_reg: LDO3  {
+                               regulator-name = "LDO3";
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       ldo4_reg: LDO4 {
+                               regulator-name = "LDO4";
+                               regulator-boot-on;
+                       };
+
+                       /* SPD_3V3 */
+                       ldo5_reg: LDO5 {
+                               regulator-name = "LDO5";
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       /* DDR_0V6 */
+                       ldo6_reg: LDO6 {
+                               regulator-name = "LDO6";
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       /* VDD_PWM */
+                       ldo7_reg: LDO7 {
+                               regulator-name = "LDO7";
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       /* ldo_1v8 */
+                       ldo8_reg: LDO8 {
+                               regulator-name = "LDO8";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       ldo9_reg: LDO9 {
+                               regulator-name = "LDO9";
+                               regulator-boot-on;
+                       };
+
+                       ldo10_reg: LDO10 {
+                               regulator-name = "LDO10";
+                               regulator-boot-on;
+                       };
+
+                       ldortc1_reg: LDORTC1  {
+                               regulator-name = "LDORTC1";
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+               };
+       };
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog>;
+
+       pinctrl_gpio_keys: gpio-keysgrp {
+               fsl,pins = <
+                       MX6SL_PAD_SD1_DAT1__GPIO5_IO08  0x17059
+                       MX6SL_PAD_SD1_DAT4__GPIO5_IO12  0x17059
+                       MX6SL_PAD_KEY_COL1__GPIO3_IO26  0x17059
+                       MX6SL_PAD_KEY_ROW0__GPIO3_IO25  0x17059
+               >;
+       };
+
+       pinctrl_hog: hoggrp {
+               fsl,pins = <
+                       MX6SL_PAD_LCD_DAT0__GPIO2_IO20  0x79
+                       MX6SL_PAD_LCD_DAT1__GPIO2_IO21  0x79
+                       MX6SL_PAD_LCD_DAT2__GPIO2_IO22  0x79
+                       MX6SL_PAD_LCD_DAT3__GPIO2_IO23  0x79
+                       MX6SL_PAD_LCD_DAT4__GPIO2_IO24  0x79
+                       MX6SL_PAD_LCD_DAT5__GPIO2_IO25  0x79
+                       MX6SL_PAD_LCD_DAT6__GPIO2_IO26  0x79
+                       MX6SL_PAD_LCD_DAT7__GPIO2_IO27  0x79
+                       MX6SL_PAD_LCD_DAT8__GPIO2_IO28  0x79
+                       MX6SL_PAD_LCD_DAT9__GPIO2_IO29  0x79
+                       MX6SL_PAD_LCD_DAT10__GPIO2_IO30 0x79
+                       MX6SL_PAD_LCD_DAT11__GPIO2_IO31 0x79
+                       MX6SL_PAD_LCD_DAT12__GPIO3_IO00 0x79
+                       MX6SL_PAD_LCD_DAT13__GPIO3_IO01 0x79
+                       MX6SL_PAD_LCD_DAT14__GPIO3_IO02 0x79
+                       MX6SL_PAD_LCD_DAT15__GPIO3_IO03 0x79
+                       MX6SL_PAD_LCD_DAT16__GPIO3_IO04 0x79
+                       MX6SL_PAD_LCD_DAT17__GPIO3_IO05 0x79
+                       MX6SL_PAD_LCD_DAT18__GPIO3_IO06 0x79
+                       MX6SL_PAD_LCD_DAT19__GPIO3_IO07 0x79
+                       MX6SL_PAD_LCD_DAT20__GPIO3_IO08 0x79
+                       MX6SL_PAD_LCD_DAT21__GPIO3_IO09 0x79
+                       MX6SL_PAD_LCD_DAT22__GPIO3_IO10 0x79
+                       MX6SL_PAD_LCD_DAT23__GPIO3_IO11 0x79
+                       MX6SL_PAD_LCD_CLK__GPIO2_IO15           0x79
+                       MX6SL_PAD_LCD_ENABLE__GPIO2_IO16        0x79
+                       MX6SL_PAD_LCD_HSYNC__GPIO2_IO17 0x79
+                       MX6SL_PAD_LCD_VSYNC__GPIO2_IO18 0x79
+                       MX6SL_PAD_LCD_RESET__GPIO2_IO19 0x79
+                       MX6SL_PAD_KEY_COL3__GPIO3_IO30          0x79
+                       MX6SL_PAD_KEY_ROW7__GPIO4_IO07          0x79
+                       MX6SL_PAD_ECSPI2_MOSI__GPIO4_IO13       0x79
+                       MX6SL_PAD_KEY_COL5__GPIO4_IO02          0x79
+                       MX6SL_PAD_KEY_ROW6__GPIO4_IO05          0x79
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6SL_PAD_I2C1_SCL__I2C1_SCL     0x4001f8b1
+                       MX6SL_PAD_I2C1_SDA__I2C1_SDA     0x4001f8b1
+               >;
+       };
+
+       pinctrl_i2c1_sleep: i2c1grp-sleep {
+               fsl,pins = <
+                       MX6SL_PAD_I2C1_SCL__I2C1_SCL     0x400108b1
+                       MX6SL_PAD_I2C1_SDA__I2C1_SDA     0x400108b1
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6SL_PAD_I2C2_SCL__I2C2_SCL     0x4001f8b1
+                       MX6SL_PAD_I2C2_SDA__I2C2_SDA     0x4001f8b1
+               >;
+       };
+
+       pinctrl_i2c2_sleep: i2c2grp-sleep {
+               fsl,pins = <
+                       MX6SL_PAD_I2C2_SCL__I2C2_SCL     0x400108b1
+                       MX6SL_PAD_I2C2_SDA__I2C2_SDA     0x400108b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6SL_PAD_REF_CLK_24M__I2C3_SCL  0x4001f8b1
+                       MX6SL_PAD_REF_CLK_32K__I2C3_SDA  0x4001f8b1
+               >;
+       };
+
+       pinctrl_led: ledgrp {
+               fsl,pins = <
+                       MX6SL_PAD_SD1_DAT2__GPIO5_IO13 0x17059
+               >;
+       };
+
+       pinctrl_ricoh_gpio: ricoh_gpiogrp {
+               fsl,pins = <
+                       MX6SL_PAD_SD1_CLK__GPIO5_IO15   0x1b8b1 /* ricoh619 chg */
+                       MX6SL_PAD_SD1_DAT0__GPIO5_IO11  0x1b8b1 /* ricoh619 irq */
+                       MX6SL_PAD_KEY_COL2__GPIO3_IO28  0x1b8b1 /* ricoh619 bat_low_int */
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6SL_PAD_UART1_TXD__UART1_TX_DATA 0x1b0b1
+                       MX6SL_PAD_UART1_RXD__UART1_TX_DATA 0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg1: usbotg1grp {
+               fsl,pins = <
+                       MX6SL_PAD_EPDC_PWRCOM__USB_OTG1_ID 0x17059
+               >;
+       };
+
+       pinctrl_usdhc2: usdhc2grp {
+               fsl,pins = <
+                       MX6SL_PAD_SD2_CMD__SD2_CMD              0x17059
+                       MX6SL_PAD_SD2_CLK__SD2_CLK              0x13059
+                       MX6SL_PAD_SD2_DAT0__SD2_DATA0           0x17059
+                       MX6SL_PAD_SD2_DAT1__SD2_DATA1           0x17059
+                       MX6SL_PAD_SD2_DAT2__SD2_DATA2           0x17059
+                       MX6SL_PAD_SD2_DAT3__SD2_DATA3           0x17059
+               >;
+       };
+
+       pinctrl_usdhc2_100mhz: usdhc2grp-100mhz {
+               fsl,pins = <
+                       MX6SL_PAD_SD2_CMD__SD2_CMD              0x170b9
+                       MX6SL_PAD_SD2_CLK__SD2_CLK              0x130b9
+                       MX6SL_PAD_SD2_DAT0__SD2_DATA0           0x170b9
+                       MX6SL_PAD_SD2_DAT1__SD2_DATA1           0x170b9
+                       MX6SL_PAD_SD2_DAT2__SD2_DATA2           0x170b9
+                       MX6SL_PAD_SD2_DAT3__SD2_DATA3           0x170b9
+               >;
+       };
+
+       pinctrl_usdhc2_200mhz: usdhc2grp-200mhz {
+               fsl,pins = <
+                       MX6SL_PAD_SD2_CMD__SD2_CMD              0x170f9
+                       MX6SL_PAD_SD2_CLK__SD2_CLK              0x130f9
+                       MX6SL_PAD_SD2_DAT0__SD2_DATA0           0x170f9
+                       MX6SL_PAD_SD2_DAT1__SD2_DATA1           0x170f9
+                       MX6SL_PAD_SD2_DAT2__SD2_DATA2           0x170f9
+                       MX6SL_PAD_SD2_DAT3__SD2_DATA3           0x170f9
+               >;
+       };
+
+       pinctrl_usdhc2_sleep: usdhc2grp-sleep {
+               fsl,pins = <
+                       MX6SL_PAD_SD2_CMD__GPIO5_IO04           0x100f9
+                       MX6SL_PAD_SD2_CLK__GPIO5_IO05           0x100f9
+                       MX6SL_PAD_SD2_DAT0__GPIO5_IO01          0x100f9
+                       MX6SL_PAD_SD2_DAT1__GPIO4_IO30          0x100f9
+                       MX6SL_PAD_SD2_DAT2__GPIO5_IO03          0x100f9
+                       MX6SL_PAD_SD2_DAT3__GPIO4_IO28          0x100f9
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6SL_PAD_SD3_CMD__SD3_CMD      0x11059
+                       MX6SL_PAD_SD3_CLK__SD3_CLK      0x11059
+                       MX6SL_PAD_SD3_DAT0__SD3_DATA0   0x11059
+                       MX6SL_PAD_SD3_DAT1__SD3_DATA1   0x11059
+                       MX6SL_PAD_SD3_DAT2__SD3_DATA2   0x11059
+                       MX6SL_PAD_SD3_DAT3__SD3_DATA3   0x11059
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3grp-100mhz {
+               fsl,pins = <
+                       MX6SL_PAD_SD3_CMD__SD3_CMD      0x170b9
+                       MX6SL_PAD_SD3_CLK__SD3_CLK      0x170b9
+                       MX6SL_PAD_SD3_DAT0__SD3_DATA0   0x170b9
+                       MX6SL_PAD_SD3_DAT1__SD3_DATA1   0x170b9
+                       MX6SL_PAD_SD3_DAT2__SD3_DATA2   0x170b9
+                       MX6SL_PAD_SD3_DAT3__SD3_DATA3   0x170b9
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3grp-200mhz {
+               fsl,pins = <
+                       MX6SL_PAD_SD3_CMD__SD3_CMD      0x170f9
+                       MX6SL_PAD_SD3_CLK__SD3_CLK      0x170f9
+                       MX6SL_PAD_SD3_DAT0__SD3_DATA0   0x170f9
+                       MX6SL_PAD_SD3_DAT1__SD3_DATA1   0x170f9
+                       MX6SL_PAD_SD3_DAT2__SD3_DATA2   0x170f9
+                       MX6SL_PAD_SD3_DAT3__SD3_DATA3   0x170f9
+               >;
+       };
+
+       pinctrl_usdhc3_sleep: usdhc3grp-sleep {
+               fsl,pins = <
+                       MX6SL_PAD_SD3_CMD__GPIO5_IO21   0x100c1
+                       MX6SL_PAD_SD3_CLK__GPIO5_IO18   0x100c1
+                       MX6SL_PAD_SD3_DAT0__GPIO5_IO19  0x100c1
+                       MX6SL_PAD_SD3_DAT1__GPIO5_IO20  0x100c1
+                       MX6SL_PAD_SD3_DAT2__GPIO5_IO16  0x100c1
+                       MX6SL_PAD_SD3_DAT3__GPIO5_IO17  0x100c1
+               >;
+       };
+
+       pinctrl_wifi_power: wifi-powergrp {
+               fsl,pins = <
+                       MX6SL_PAD_SD2_DAT6__GPIO4_IO29  0x10059 /* WIFI_3V3_ON */
+               >;
+       };
+
+       pinctrl_wifi_reset: wifi-resetgrp {
+               fsl,pins = <
+                       MX6SL_PAD_SD2_DAT7__GPIO5_IO00  0x10059 /* WIFI_RST */
+               >;
+       };
+
+       pinctrl_zforce: zforcegrp {
+               fsl,pins = <
+                       MX6SL_PAD_SD1_DAT3__GPIO5_IO06          0x17059 /* TP_INT */
+                       MX6SL_PAD_SD1_DAT5__GPIO5_IO09          0x10059 /* TP_RST */
+               >;
+       };
+};
+
+&reg_vdd1p1 {
+       vin-supply = <&dcdc2_reg>;
+};
+
+&reg_vdd2p5 {
+       vin-supply = <&dcdc2_reg>;
+};
+
+&reg_arm {
+       vin-supply = <&dcdc3_reg>;
+};
+
+&reg_soc {
+       vin-supply = <&dcdc1_reg>;
+};
+
+&reg_pu {
+       vin-supply = <&dcdc1_reg>;
+};
+
+&snvs_rtc {
+       /*
+        * We are using the RTC in the PMIC, but this one is not disabled
+        * in imx6sl.dtsi.
+        */
+       status = "disabled";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&usdhc2 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz", "sleep";
+       pinctrl-0 = <&pinctrl_usdhc2>;
+       pinctrl-1 = <&pinctrl_usdhc2_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc2_200mhz>;
+       pinctrl-3 = <&pinctrl_usdhc2_sleep>;
+       non-removable;
+       status = "okay";
+
+       /* internal uSD card */
+};
+
+&usdhc3 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz", "sleep";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       pinctrl-3 = <&pinctrl_usdhc3_sleep>;
+       vmmc-supply = <&reg_wifi>;
+       mmc-pwrseq = <&wifi_pwrseq>;
+       cap-power-off-card;
+       non-removable;
+       status = "okay";
+
+       /*
+        * 37NB-E60QF0+4A2: CyberTan WC121 (BCM43362) SDIO WiFi
+        * 37NB-E60QF0+4A3: RTL8189F SDIO WiFi
+        */
+};
+
+&usbotg1 {
+       pinctrl-names = "default";
+       disable-over-current;
+       srp-disable;
+       hnp-disable;
+       adp-disable;
+       status = "okay";
+};
index 1c7180f..91a8c54 100644 (file)
                        };
 
                        rngb: rngb@21b4000 {
+                               compatible = "fsl,imx6sl-rngb", "fsl,imx25-rngb";
                                reg = <0x021b4000 0x4000>;
                                interrupts = <0 5 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clks IMX6SL_CLK_DUMMY>;
                        };
 
                        weim: weim@21b8000 {
index c755cbd..32b3d82 100644 (file)
                        };
                };
        };
+
+       sound {
+               compatible = "fsl,imx6sl-evk-wm8962", "fsl,imx-audio-wm8962";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_hp>;
+               model = "wm8962-audio";
+               audio-cpu = <&ssi2>;
+               audio-codec = <&wm8962>;
+               audio-routing =
+                       "Headphone Jack", "HPOUTL",
+                       "Headphone Jack", "HPOUTR",
+                       "Ext Spk", "SPKOUTL",
+                       "Ext Spk", "SPKOUTR",
+                       "AMIC", "MICBIAS",
+                       "IN3R", "AMIC";
+               mux-int-port = <2>;
+               mux-ext-port = <3>;
+               hp-det-gpio = <&gpio4 24 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux3>;
+       status = "okay";
 };
 
 &cpu0 {
        };
 };
 
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       wm8962: audio-codec@1a {
+               compatible = "wlf,wm8962";
+               reg = <0x1a>;
+               clocks = <&clks IMX6SLL_CLK_EXTERN_AUDIO>;
+               DCVDD-supply = <&vgen3_reg>;
+               DBVDD-supply = <&reg_aud3v>;
+               AVDD-supply = <&vgen3_reg>;
+               CPVDD-supply = <&vgen3_reg>;
+               MICVDD-supply = <&reg_aud3v>;
+               PLLVDD-supply = <&vgen3_reg>;
+               SPKVDD1-supply = <&reg_aud4v>;
+               SPKVDD2-supply = <&reg_aud4v>;
+       };
+};
+
 &lcdif {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_lcd>;
        status = "okay";
 };
 
+&ssi2 {
+       status = "okay";
+};
+
 &uart1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart1>;
 };
 
 &iomuxc {
+       pinctrl_audmux3: audmux3grp {
+               fsl,pins = <
+                       MX6SLL_PAD_AUD_TXC__AUD3_TXC            0x4130b0
+                       MX6SLL_PAD_AUD_TXFS__AUD3_TXFS          0x4130b0
+                       MX6SLL_PAD_AUD_TXD__AUD3_TXD            0x4110b0
+                       MX6SLL_PAD_AUD_RXD__AUD3_RXD            0x4130b0
+                       MX6SLL_PAD_AUD_MCLK__AUDIO_CLK_OUT      0x4130b0
+               >;
+       };
+
+       pinctrl_hp: hpgrp {
+               fsl,pins = <
+                       MX6SLL_PAD_GPIO4_IO24__GPIO4_IO24 0x17059 /* HP DETECT */
+               >;
+       };
+
        pinctrl_reg_sd3_vmmc: sd3vmmcgrp {
                fsl,pins = <
                        MX6SLL_PAD_KEY_COL6__GPIO4_IO04 0x17059
                >;
        };
 
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6SLL_PAD_AUD_RXFS__I2C3_SCL  0x4041b8b1
+                       MX6SLL_PAD_AUD_RXC__I2C3_SDA   0x4041b8b1
+               >;
+       };
+
        pinctrl_lcd: lcdgrp {
                fsl,pins = <
                        MX6SLL_PAD_LCD_DATA00__LCD_DATA00       0x79
index fb5d3bc..0b62220 100644 (file)
                                clocks = <&clks IMX6SLL_CLK_MMDC_P0_IPG>;
                        };
 
+                       rngb: rng@21b4000 {
+                               compatible = "fsl,imx6sll-rngb", "fsl,imx25-rngb";
+                               reg = <0x021b4000 0x4000>;
+                               interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clks IMX6SLL_CLK_DUMMY>;
+                       };
+
                        ocotp: efuse@21bc000 {
                                #address-cells = <1>;
                                #size-cells = <1>;
index b8c23eb..1351d7f 100644 (file)
 
        sound {
                compatible = "fsl,imx6sx-sdb-wm8962", "fsl,imx-audio-wm8962";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_hp>;
                model = "wm8962-audio";
                ssi-controller = <&ssi2>;
                audio-codec = <&codec>;
                        "IN3R", "AMIC";
                mux-int-port = <2>;
                mux-ext-port = <6>;
+               hp-det-gpio = <&gpio1 17 GPIO_ACTIVE_LOW>;
        };
 
        panel {
                        >;
                };
 
+               pinctrl_hp: hpgrp {
+                       fsl,pins = <
+                               MX6SX_PAD_CSI_DATA03__GPIO1_IO_17 0x17059
+                       >;
+               };
+
                pinctrl_i2c1: i2c1grp {
                        fsl,pins = <
                                MX6SX_PAD_GPIO1_IO01__I2C1_SDA          0x4001b8b1
index d25e27d..5547916 100644 (file)
@@ -93,7 +93,7 @@
 &ecspi4 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi4>;
-       cs-gpios = <&gpio7 4 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio7 4 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
 
index b480dfa..dfdca18 100644 (file)
                        clocks = <&clks IMX6SX_CLK_APBH_DMA>;
                };
 
-               gpmi: gpmi-nand@1806000{
+               gpmi: nand-controller@1806000{
                        compatible = "fsl,imx6sx-gpmi-nand";
                        #address-cells = <1>;
                        #size-cells = <1>;
index a35be2a..770f59b 100644 (file)
@@ -84,7 +84,7 @@
 };
 
 &ecspi1 {
-       cs-gpios = <&gpio4 26 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 26 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
index 61ba21a..2a449a3 100644 (file)
@@ -14,7 +14,7 @@
 };
 
 &ecspi2 {
-       cs-gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
        status = "okay";
index 8d5f8dc..f1513e6 100644 (file)
 &ecspi3 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi3>;
-       cs-gpios = <&gpio1 20 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio1 20 GPIO_ACTIVE_LOW>;
        status = "disabled";
 };
 
index 2b088f2..d7d9f3e 100644 (file)
                        clocks = <&clks IMX6UL_CLK_APBHDMA>;
                };
 
-               gpmi: gpmi-nand@1806000 {
+               gpmi: nand-controller@1806000 {
                        compatible = "fsl,imx6q-gpmi-nand";
                        #address-cells = <1>;
                        #size-cells = <1>;
index 6cf9593..4436556 100644 (file)
@@ -68,7 +68,7 @@
 
 /* Colibri SPI */
 &ecspi1 {
-       cs-gpios = <&gpio3 26 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio3 26 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1 &pinctrl_ecspi1_cs>;
 };
index fcde7f7..9bf6749 100644 (file)
                                clock-names = "dcp";
                        };
 
+                       rngb: rng@2284000 {
+                               compatible = "fsl,imx6ull-rngb", "fsl,imx25-rngb";
+                               reg = <0x02284000 0x4000>;
+                               interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clks IMX6UL_CLK_DUMMY>;
+                       };
+
                        iomuxc_snvs: iomuxc-snvs@2290000 {
                                compatible = "fsl,imx6ull-iomuxc-snvs";
                                reg = <0x02290000 0x4000>;
index e18e89d..62b771c 100644 (file)
@@ -60,7 +60,7 @@
 &ecspi3 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi3 &pinctrl_ecspi3_cs>;
-       cs-gpios = <&gpio4 11 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 11 GPIO_ACTIVE_LOW>;
 };
 
 &fec1 {
index 17cca8a..ac0751b 100644 (file)
                        };
                };
        };
+
+       sound {
+               compatible = "fsl,imx7d-evk-wm8960",
+                            "fsl,imx-audio-wm8960";
+               model = "wm8960-audio";
+               audio-cpu = <&sai1>;
+               audio-codec = <&codec>;
+               hp-det-gpio = <&gpio2 28 GPIO_ACTIVE_HIGH>;
+               audio-routing =
+                       "Headphone Jack", "HP_L",
+                       "Headphone Jack", "HP_R",
+                       "Ext Spk", "SPK_LP",
+                       "Ext Spk", "SPK_LN",
+                       "Ext Spk", "SPK_RP",
+                       "Ext Spk", "SPK_RN",
+                       "LINPUT1", "AMIC",
+                       "AMIC", "MICB";
+       };
 };
 
 &adc1 {
 &ecspi3 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi3>;
-       cs-gpios = <&gpio5 9 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        tsc2046@0 {
                clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
                clock-names = "mclk";
                wlf,shared-lrclk;
+               wlf,hp-cfg = <2 2 3>;
+               wlf,gpio-cfg = <1 3>;
+               assigned-clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_SRC>,
+                                 <&clks IMX7D_PLL_AUDIO_POST_DIV>,
+                                 <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
+               assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
+               assigned-clock-rates = <0>, <884736000>, <12288000>;
        };
 };
 
        vin-supply = <&sw2_reg>;
 };
 
+&sai1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sai1>;
+       assigned-clocks = <&clks IMX7D_SAI1_ROOT_SRC>,
+                         <&clks IMX7D_PLL_AUDIO_POST_DIV>,
+                         <&clks IMX7D_SAI1_ROOT_CLK>;
+       assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
+       assigned-clock-rates = <0>, <884736000>, <36864000>;
+       status = "okay";
+};
+
+&sai3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sai3 &pinctrl_sai3_mclk>;
+       assigned-clocks = <&clks IMX7D_SAI3_ROOT_SRC>,
+                         <&clks IMX7D_PLL_AUDIO_POST_DIV>,
+                         <&clks IMX7D_SAI3_ROOT_CLK>;
+       assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
+       assigned-clock-rates = <0>, <884736000>, <36864000>;
+       status = "okay";
+};
+
 &snvs_pwrkey {
        status = "okay";
 };
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX7D_PAD_ECSPI2_SS0__GPIO4_IO23         0x34  /* bt reg on */
+                               MX7D_PAD_EPDC_BDR0__GPIO2_IO28          0x59  /* headphone detect */
                        >;
                };
 
                        >;
                };
 
+               pinctrl_sai1: sai1grp {
+                       fsl,pins = <
+                               MX7D_PAD_SAI1_MCLK__SAI1_MCLK           0x1f
+                               MX7D_PAD_ENET1_RX_CLK__SAI1_TX_BCLK     0x1f
+                               MX7D_PAD_ENET1_CRS__SAI1_TX_SYNC        0x1f
+                               MX7D_PAD_ENET1_COL__SAI1_TX_DATA0       0x30
+                               MX7D_PAD_ENET1_TX_CLK__SAI1_RX_DATA0    0x1f
+                       >;
+               };
+
+               pinctrl_sai2: sai2grp {
+                       fsl,pins = <
+                               MX7D_PAD_SAI2_TX_BCLK__SAI2_TX_BCLK     0x1f
+                               MX7D_PAD_SAI2_TX_SYNC__SAI2_TX_SYNC     0x1f
+                               MX7D_PAD_SAI2_TX_DATA__SAI2_TX_DATA0    0x30
+                               MX7D_PAD_SAI2_RX_DATA__SAI2_RX_DATA0    0x1f
+                       >;
+               };
+
+               pinctrl_sai3: sai3grp {
+                       fsl,pins = <
+                               MX7D_PAD_UART3_TX_DATA__SAI3_TX_BCLK   0x1f
+                               MX7D_PAD_UART3_CTS_B__SAI3_TX_SYNC     0x1f
+                               MX7D_PAD_UART3_RTS_B__SAI3_TX_DATA0    0x30
+                       >;
+               };
+
                pinctrl_spi4: spi4grp {
                        fsl,pins = <
                                MX7D_PAD_GPIO1_IO09__GPIO1_IO9  0x59
                        MX7D_PAD_LPSR_GPIO1_IO07__GPIO1_IO7       0x14
                >;
        };
+
+       pinctrl_sai3_mclk: sai3grp_mclk {
+               fsl,pins = <
+                       MX7D_PAD_LPSR_GPIO1_IO03__SAI3_MCLK     0x1f
+               >;
+       };
 };
index 7cb6153..1065941 100644 (file)
@@ -39,7 +39,7 @@
 &ecspi1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
-       cs-gpios = <&gpio4 19 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 19 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        flash@0 {
index cbf0dbb..893bd30 100644 (file)
 &ecspi1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
-       cs-gpios = <&gpio4 19 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio4 19 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        flash@0 {
index 1cfaf41..84d9cc1 100644 (file)
                                status = "disabled";
                        };
 
+                       qspi: spi@30bb0000 {
+                               compatible = "fsl,imx7d-qspi";
+                               reg = <0x30bb0000 0x10000>, <0x60000000 0x10000000>;
+                               reg-names = "QuadSPI", "QuadSPI-memory";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clks IMX7D_QSPI_ROOT_CLK>,
+                                       <&clks IMX7D_QSPI_ROOT_CLK>;
+                               clock-names = "qspi_en", "qspi";
+                               status = "disabled";
+                       };
+
                        sdma: sdma@30bd0000 {
                                compatible = "fsl,imx7d-sdma", "fsl,imx35-sdma";
                                reg = <0x30bd0000 0x10000>;
                        clocks = <&clks IMX7D_NAND_USDHC_BUS_RAWNAND_CLK>;
                };
 
-               gpmi: gpmi-nand@33002000{
+               gpmi: nand-controller@33002000{
                        compatible = "fsl,imx7d-gpmi-nand";
                        #address-cells = <1>;
                        #size-cells = <1>;
index ebbe151..63cafd2 100644 (file)
@@ -57,7 +57,7 @@
 
        lvds-receiver {
                compatible = "ti,ds90cf384a", "lvds-decoder";
-               powerdown-gpios = <&gpio7 25 GPIO_ACTIVE_LOW>;
+               power-supply = <&vcc_3v3_tft1>;
 
                ports {
                        #address-cells = <1>;
@@ -81,6 +81,7 @@
        panel {
                compatible = "edt,etm0700g0dh6";
                backlight = <&lcd_backlight>;
+               power-supply = <&vcc_3v3_tft1>;
 
                port {
                        panel_in: endpoint {
                };
        };
 
+       vcc_3v3_tft1: regulator-panel {
+               compatible = "regulator-fixed";
+
+               regulator-name = "vcc-3v3-tft1";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               enable-active-high;
+               startup-delay-us = <500>;
+               gpio = <&gpio7 25 GPIO_ACTIVE_HIGH>;
+       };
+
        vcc_sdhi1: regulator-vcc-sdhi1 {
                compatible = "regulator-fixed";
 
                reg = <0x38>;
                interrupt-parent = <&gpio2>;
                interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
+               vcc-supply = <&vcc_3v3_tft1>;
        };
 };
 
index 395e05f..7d0468a 100644 (file)
@@ -79,7 +79,7 @@
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
        vdds_dsi-supply = <&vpll2>;
        vdda_video-supply = <&video_reg>;
        pinctrl-names = "default";
index b0f6613..533a47b 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
        vdds_dsi-supply = <&vpll2>;
        vdda_video-supply = <&vpll2>;
        pinctrl-names = "default";
index eadb083..7649dd1 100644 (file)
        #size-cells = <1>;
        interrupt-parent = <&gic>;
 
-       L2: cache-controller@c4200000 {
-               compatible = "arm,pl310-cache";
-               reg = <0xc4200000 0x1000>;
-               cache-unified;
-               cache-level = <2>;
-       };
-
        soc {
                compatible = "simple-bus";
                #address-cells = <1>;
                        };
                };
 
+               L2: cache-controller@c4200000 {
+                       compatible = "arm,pl310-cache";
+                       reg = <0xc4200000 0x1000>;
+                       cache-unified;
+                       cache-level = <2>;
+               };
+
                periph: bus@c4300000 {
                        compatible = "simple-bus";
                        reg = <0xc4300000 0x10000>;
index 277c0bb..04688e8 100644 (file)
                                     <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 171 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>,
index f1a4115..adde62d 100644 (file)
        /delete-property/ #size-cells;
        spi-slave;
        status = "okay";
-       ready-gpio = <&gpio 125 GPIO_ACTIVE_HIGH>;
+       ready-gpios = <&gpio 125 GPIO_ACTIVE_HIGH>;
 
        slave {
                compatible = "olpc,xo1.75-ec";
                spi-cpha;
-               cmd-gpio = <&gpio 155 GPIO_ACTIVE_HIGH>;
+               cmd-gpios = <&gpio 155 GPIO_ACTIVE_HIGH>;
        };
 };
 
index cc4efd0..4ae630d 100644 (file)
                                interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&soc_clocks MMP2_CLK_CCIC0>;
                                clock-names = "axi";
+                               power-domains = <&soc_clocks MMP3_POWER_DOMAIN_CAMERA>;
                                #clock-cells = <0>;
                                clock-output-names = "mclk";
                                status = "disabled";
                                interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&soc_clocks MMP2_CLK_CCIC1>;
                                clock-names = "axi";
+                               power-domains = <&soc_clocks MMP3_POWER_DOMAIN_CAMERA>;
                                #clock-cells = <0>;
                                clock-output-names = "mclk";
                                status = "disabled";
index 1990239..d5ded4f 100644 (file)
                };
        };
 
-       lcd0: display {
-               compatible = "panel-dsi-cm";
+       lcd0: panel@0 {
+               compatible = "motorola,droid4-panel", "panel-dsi-cm";
+               reg = <0>;
                label = "lcd0";
                vddi-supply = <&lcd_regulator>;
                reset-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>;      /* gpio101 */
 
                width-mm = <50>;
                height-mm = <89>;
+               rotation = <90>;
 
                panel-timing {
                        clock-frequency = <0>;          /* Calculated by dsi */
index a5c91c2..005c275 100644 (file)
@@ -11,7 +11,7 @@
        model = "Phontech MPA 1600";
        compatible = "phontech,mpa1600", "atmel,at91rm9200";
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
index 96fb5a5..37f5023 100644 (file)
                        };
 
                        timer2: dual-timer@2000 {
-                               compatible = "arm,sp804";
+                               compatible = "arm,sp804", "arm,primecell";
                                reg = <0x2000 0x1000>;
-                               clocks = <&sysclk>;
+                               clocks = <&sysclk>, <&sysclk>, <&sysclk>;
+                               clock-names = "timer0clk", "timer1clk",
+                                              "apb_pclk";
                                interrupts = <10>;
                                status = "disabled";
                        };
                                arm,primecell-periphid = <0x00141805>;
                                reg = <0x8000 0x1000>;
                                interrupts = <0>;
-                               clocks = <&sysclk>;
-                               clock-names = "apb_pclk";
+                               clocks = <&sysclk>, <&sysclk>;
+                               clock-names = "wdog_clk", "apb_pclk";
                                status = "disabled";
                        };
                };
@@ -5,7 +5,7 @@
  */
 
 /dts-v1/;
-#include "infinity-msc313.dtsi"
+#include "mstar-infinity-msc313.dtsi"
 
 / {
        model = "BreadBee Crust";
similarity index 87%
rename from arch/arm/boot/dts/mercury5-ssc8336n.dtsi
rename to arch/arm/boot/dts/mstar-infinity-msc313.dtsi
index 7d4a463..3499fde 100644 (file)
@@ -4,7 +4,7 @@
  * Author: Daniel Palmer <daniel@thingy.jp>
  */
 
-#include "mercury5.dtsi"
+#include "mstar-infinity.dtsi"
 
 / {
        memory@20000000 {
@@ -5,7 +5,7 @@
  */
 
 /dts-v1/;
-#include "infinity3-msc313e.dtsi"
+#include "mstar-infinity3-msc313e.dtsi"
 
 / {
        model = "BreadBee";
similarity index 87%
rename from arch/arm/boot/dts/infinity-msc313.dtsi
rename to arch/arm/boot/dts/mstar-infinity3-msc313e.dtsi
index 42f2b55..f581b6f 100644 (file)
@@ -4,7 +4,7 @@
  * Author: Daniel Palmer <daniel@thingy.jp>
  */
 
-#include "infinity.dtsi"
+#include "mstar-infinity3.dtsi"
 
 / {
        memory@20000000 {
similarity index 84%
rename from arch/arm/boot/dts/infinity3.dtsi
rename to arch/arm/boot/dts/mstar-infinity3.dtsi
index 9b918c8..9857e2a 100644 (file)
@@ -4,7 +4,7 @@
  * Author: Daniel Palmer <daniel@thingy.jp>
  */
 
-#include "infinity.dtsi"
+#include "mstar-infinity.dtsi"
 
 &imi {
        reg = <0xa0000000 0x20000>;
@@ -5,7 +5,7 @@
  */
 
 /dts-v1/;
-#include "mercury5-ssc8336n.dtsi"
+#include "mstar-mercury5-ssc8336n.dtsi"
 
 / {
        model = "70mai Midrive D08";
similarity index 87%
rename from arch/arm/boot/dts/infinity3-msc313e.dtsi
rename to arch/arm/boot/dts/mstar-mercury5-ssc8336n.dtsi
index 4e7239a..3f5a4c0 100644 (file)
@@ -4,7 +4,7 @@
  * Author: Daniel Palmer <daniel@thingy.jp>
  */
 
-#include "infinity3.dtsi"
+#include "mstar-mercury5.dtsi"
 
 / {
        memory@20000000 {
index 3b7b9b7..f078805 100644 (file)
                                mask = <0x79>;
                        };
 
+                       intc_fiq: interrupt-controller@201310 {
+                               compatible = "mstar,mst-intc";
+                               reg = <0x201310 0x40>;
+                               #interrupt-cells = <3>;
+                               interrupt-controller;
+                               interrupt-parent = <&gic>;
+                               mstar,irqs-map-range = <96 127>;
+                       };
+
+                       intc_irq: interrupt-controller@201350 {
+                               compatible = "mstar,mst-intc";
+                               reg = <0x201350 0x40>;
+                               #interrupt-cells = <3>;
+                               interrupt-controller;
+                               interrupt-parent = <&gic>;
+                               mstar,irqs-map-range = <32 95>;
+                               mstar,intc-no-eoi;
+                       };
+
                        l3bridge: l3bridge@204400 {
                                compatible = "mstar,l3bridge";
                                reg = <0x204400 0x200>;
                                compatible = "ns16550a";
                                reg = <0x221000 0x100>;
                                reg-shift = <3>;
+                               interrupts-extended = <&intc_irq GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
                                clock-frequency = <172000000>;
                                status = "disabled";
                        };
index 39b3a2f..fade142 100644 (file)
                         <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
        };
 
+       jpegenc: jpegenc@1500a000 {
+               compatible = "mediatek,mt2701-jpgenc",
+                            "mediatek,mtk-jpgenc";
+               reg = <0 0x1500a000 0 0x1000>;
+               interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_LOW>;
+               clocks =  <&imgsys CLK_IMG_VENC>;
+               clock-names = "jpgenc";
+               power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
+               mediatek,larb = <&larb2>;
+               iommus = <&iommu MT2701_M4U_PORT_JPGENC_RDMA>,
+                        <&iommu MT2701_M4U_PORT_JPGENC_BSDMA>;
+       };
+
        vdecsys: syscon@16000000 {
                compatible = "mediatek,mt2701-vdecsys", "syscon";
                reg = <0 0x16000000 0 0x1000>;
index 3a6b856..aea6809 100644 (file)
@@ -14,7 +14,6 @@
 #include <dt-bindings/power/mt2701-power.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/phy/phy.h>
-#include <dt-bindings/memory/mt2701-larb-port.h>
 #include <dt-bindings/reset/mt2701-resets.h>
 #include <dt-bindings/thermal/thermal.h>
 
                clock-names = "system-clk", "rtc-clk";
        };
 
-       smi_common: smi@1000c000 {
-               compatible = "mediatek,mt7623-smi-common",
-                            "mediatek,mt2701-smi-common";
-               reg = <0 0x1000c000 0 0x1000>;
-               clocks = <&infracfg CLK_INFRA_SMI>,
-                        <&mmsys CLK_MM_SMI_COMMON>,
-                        <&infracfg CLK_INFRA_SMI>;
-               clock-names = "apb", "smi", "async";
-               power-domains = <&scpsys MT2701_POWER_DOMAIN_DISP>;
-       };
-
        pwrap: pwrap@1000d000 {
                compatible = "mediatek,mt7623-pwrap",
                             "mediatek,mt2701-pwrap";
                reg = <0 0x10200100 0 0x1c>;
        };
 
-       iommu: mmsys_iommu@10205000 {
-               compatible = "mediatek,mt7623-m4u",
-                            "mediatek,mt2701-m4u";
-               reg = <0 0x10205000 0 0x1000>;
-               interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_LOW>;
-               clocks = <&infracfg CLK_INFRA_M4U>;
-               clock-names = "bclk";
-               mediatek,larbs = <&larb0 &larb1 &larb2>;
-               #iommu-cells = <1>;
-       };
-
        efuse: efuse@10206000 {
                compatible = "mediatek,mt7623-efuse",
                             "mediatek,mt8173-efuse";
                status = "disabled";
        };
 
-       g3dsys: syscon@13000000 {
-               compatible = "mediatek,mt7623-g3dsys",
-                            "mediatek,mt2701-g3dsys",
-                            "syscon";
-               reg = <0 0x13000000 0 0x200>;
-               #clock-cells = <1>;
-               #reset-cells = <1>;
-       };
-
-       mali: gpu@13040000 {
-               compatible = "mediatek,mt7623-mali", "arm,mali-450";
-               reg = <0 0x13040000 0 0x30000>;
-               interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_SPI 171 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_SPI 172 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_SPI 173 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_SPI 174 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_SPI 175 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_SPI 176 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_SPI 177 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_SPI 178 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_SPI 179 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_SPI 180 IRQ_TYPE_LEVEL_LOW>;
-               interrupt-names = "gp", "gpmmu", "pp0", "ppmmu0", "pp1",
-                                 "ppmmu1", "pp2", "ppmmu2", "pp3", "ppmmu3",
-                                 "pp";
-               clocks = <&topckgen CLK_TOP_MMPLL>,
-                        <&g3dsys CLK_G3DSYS_CORE>;
-               clock-names = "bus", "core";
-               power-domains = <&scpsys MT2701_POWER_DOMAIN_MFG>;
-               resets = <&g3dsys MT2701_G3DSYS_CORE_RST>;
-       };
-
-       mmsys: syscon@14000000 {
-               compatible = "mediatek,mt7623-mmsys",
-                            "mediatek,mt2701-mmsys",
-                            "syscon";
-               reg = <0 0x14000000 0 0x1000>;
-               #clock-cells = <1>;
-       };
-
-       larb0: larb@14010000 {
-               compatible = "mediatek,mt7623-smi-larb",
-                            "mediatek,mt2701-smi-larb";
-               reg = <0 0x14010000 0 0x1000>;
-               mediatek,smi = <&smi_common>;
-               mediatek,larb-id = <0>;
-               clocks = <&mmsys CLK_MM_SMI_LARB0>,
-                        <&mmsys CLK_MM_SMI_LARB0>;
-               clock-names = "apb", "smi";
-               power-domains = <&scpsys MT2701_POWER_DOMAIN_DISP>;
-       };
-
-       imgsys: syscon@15000000 {
-               compatible = "mediatek,mt7623-imgsys",
-                            "mediatek,mt2701-imgsys",
-                            "syscon";
-               reg = <0 0x15000000 0 0x1000>;
-               #clock-cells = <1>;
-       };
-
-       larb2: larb@15001000 {
-               compatible = "mediatek,mt7623-smi-larb",
-                            "mediatek,mt2701-smi-larb";
-               reg = <0 0x15001000 0 0x1000>;
-               mediatek,smi = <&smi_common>;
-               mediatek,larb-id = <2>;
-               clocks = <&imgsys CLK_IMG_SMI_COMM>,
-                        <&imgsys CLK_IMG_SMI_COMM>;
-               clock-names = "apb", "smi";
-               power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-       };
-
-       jpegdec: jpegdec@15004000 {
-               compatible = "mediatek,mt7623-jpgdec",
-                            "mediatek,mt2701-jpgdec";
-               reg = <0 0x15004000 0 0x1000>;
-               interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_LOW>;
-               clocks =  <&imgsys CLK_IMG_JPGDEC_SMI>,
-                         <&imgsys CLK_IMG_JPGDEC>;
-               clock-names = "jpgdec-smi",
-                             "jpgdec";
-               power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-               mediatek,larb = <&larb2>;
-               iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
-                        <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
-       };
-
        vdecsys: syscon@16000000 {
                compatible = "mediatek,mt7623-vdecsys",
                             "mediatek,mt2701-vdecsys",
                #clock-cells = <1>;
        };
 
-       larb1: larb@16010000 {
-               compatible = "mediatek,mt7623-smi-larb",
-                            "mediatek,mt2701-smi-larb";
-               reg = <0 0x16010000 0 0x1000>;
-               mediatek,smi = <&smi_common>;
-               mediatek,larb-id = <1>;
-               clocks = <&vdecsys CLK_VDEC_CKGEN>,
-                        <&vdecsys CLK_VDEC_LARB>;
-               clock-names = "apb", "smi";
-               power-domains = <&scpsys MT2701_POWER_DOMAIN_VDEC>;
-       };
-
        hifsys: syscon@1a000000 {
                compatible = "mediatek,mt7623-hifsys",
                             "mediatek,mt2701-hifsys",
index 2b760f9..e96aa0e 100644 (file)
@@ -6,7 +6,7 @@
 
 /dts-v1/;
 #include <dt-bindings/input/input.h>
-#include "mt7623.dtsi"
+#include "mt7623n.dtsi"
 #include "mt6323.dtsi"
 
 / {
                stdout-path = "serial2:115200n8";
        };
 
+       connector {
+               compatible = "hdmi-connector";
+               label = "hdmi";
+               type = "d";
+               ddc-i2c-bus = <&hdmiddc0>;
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi0_out>;
+                       };
+               };
+       };
+
        cpus {
                cpu@0 {
                        proc-supply = <&mt6323_vproc_reg>;
                regulator-always-on;
        };
 
+       reg_vgpu: fixedregulator@0 {
+               compatible = "regulator-fixed";
+               regulator-name = "vdd_fixed_vgpu";
+               regulator-min-microvolt = <1150000>;
+               regulator-max-microvolt = <1150000>;
+       };
+
        gpio-keys {
                compatible = "gpio-keys";
                pinctrl-names = "default";
        };
 };
 
+&bls {
+       status = "okay";
+};
+
 &btif {
        status = "okay";
 };
 
+&cec {
+       status = "okay";
+};
+
 &cir {
        pinctrl-names = "default";
        pinctrl-0 = <&cir_pins_a>;
        status = "okay";
 };
 
+&dpi0 {
+       status = "okay";
+
+       ports {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               port@0 {
+                       reg = <0>;
+                       dpi0_out: endpoint {
+                               remote-endpoint = <&hdmi0_in>;
+                       };
+               };
+       };
+};
+
 &eth {
        status = "okay";
 
                                        fixed-link {
                                                speed = <1000>;
                                                full-duplex;
+                                               pause;
                                        };
                                };
                        };
        };
 };
 
+&hdmi0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&hdmi_pins_a>;
+       status = "okay";
+
+       ports {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               port@0 {
+                       reg = <0>;
+                       hdmi0_in: endpoint {
+                               remote-endpoint = <&dpi0_out>;
+                       };
+               };
+
+               port@1 {
+                       reg = <1>;
+                       hdmi0_out: endpoint {
+                               remote-endpoint = <&hdmi_connector_in>;
+                       };
+               };
+       };
+};
+
+&hdmiddc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&hdmi_ddc_pins_a>;
+       status = "okay";
+};
+
+&hdmi_phy {
+       mediatek,ibias = <0xa>;
+       mediatek,ibias_up = <0x1c>;
+       status = "okay";
+};
+
 &i2c0 {
        pinctrl-names = "default";
        pinctrl-0 = <&i2c0_pins_a>;
        status = "okay";
 };
 
+&mali {
+       mali-supply = <&reg_vgpu>;
+       status = "okay";
+};
+
 &mmc0 {
        pinctrl-names = "default", "state_uhs";
        pinctrl-0 = <&mmc0_pins_default>;
 &u3phy2 {
        status = "okay";
 };
-
index 0447748..1b9b9a8 100644 (file)
@@ -7,7 +7,7 @@
 
 /dts-v1/;
 #include <dt-bindings/input/input.h>
-#include "mt7623.dtsi"
+#include "mt7623n.dtsi"
 #include "mt6323.dtsi"
 
 / {
                stdout-path = "serial2:115200n8";
        };
 
+       connector {
+               compatible = "hdmi-connector";
+               label = "hdmi";
+               type = "d";
+               ddc-i2c-bus = <&hdmiddc0>;
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi0_out>;
+                       };
+               };
+       };
+
        cpus {
                cpu@0 {
                        proc-supply = <&mt6323_vproc_reg>;
        };
 };
 
+&bls {
+       status = "okay";
+};
+
 &btif {
        status = "okay";
 };
 
+&cec {
+       status = "okay";
+};
+
 &cir {
        pinctrl-names = "default";
        pinctrl-0 = <&cir_pins_a>;
        status = "okay";
 };
 
+&dpi0 {
+       status = "okay";
+
+       ports {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               port@0 {
+                       reg = <0>;
+                       dpi0_out: endpoint {
+                               remote-endpoint = <&hdmi0_in>;
+                       };
+               };
+       };
+};
+
 &eth {
        status = "okay";
 
        };
 };
 
+&hdmi0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&hdmi_pins_a>;
+       status = "okay";
+
+       ports {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               port@0 {
+                       reg = <0>;
+                       hdmi0_in: endpoint {
+                               remote-endpoint = <&dpi0_out>;
+                       };
+               };
+
+               port@1 {
+                       reg = <1>;
+                       hdmi0_out: endpoint {
+                               remote-endpoint = <&hdmi_connector_in>;
+                       };
+               };
+       };
+};
+
+&hdmiddc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&hdmi_ddc_pins_a>;
+       status = "okay";
+};
+
+&hdmi_phy {
+       mediatek,ibias = <0xa>;
+       mediatek,ibias_up = <0x1c>;
+       status = "okay";
+};
+
 &i2c0 {
        pinctrl-names = "default";
        pinctrl-0 = <&i2c0_pins_a>;
diff --git a/arch/arm/boot/dts/mt7623n.dtsi b/arch/arm/boot/dts/mt7623n.dtsi
new file mode 100644 (file)
index 0000000..1880ac9
--- /dev/null
@@ -0,0 +1,306 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright © 2017-2020 MediaTek Inc.
+ * Author: Sean Wang <sean.wang@mediatek.com>
+ *        Ryder Lee <ryder.lee@mediatek.com>
+ *
+ */
+
+#include "mt7623.dtsi"
+#include <dt-bindings/memory/mt2701-larb-port.h>
+
+/ {
+       aliases {
+               rdma0 = &rdma0;
+               rdma1 = &rdma1;
+       };
+
+       g3dsys: syscon@13000000 {
+               compatible = "mediatek,mt7623-g3dsys",
+                            "mediatek,mt2701-g3dsys",
+                            "syscon";
+               reg = <0 0x13000000 0 0x200>;
+               #clock-cells = <1>;
+               #reset-cells = <1>;
+       };
+
+       mali: gpu@13040000 {
+               compatible = "mediatek,mt7623-mali", "arm,mali-450";
+               reg = <0 0x13040000 0 0x30000>;
+               interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_SPI 171 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_SPI 172 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_SPI 173 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_SPI 174 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_SPI 175 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_SPI 176 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_SPI 177 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_SPI 178 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_SPI 179 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_SPI 180 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-names = "gp", "gpmmu", "pp0", "ppmmu0", "pp1",
+                                 "ppmmu1", "pp2", "ppmmu2", "pp3", "ppmmu3",
+                                 "pp";
+               clocks = <&topckgen CLK_TOP_MMPLL>,
+                        <&g3dsys CLK_G3DSYS_CORE>;
+               clock-names = "bus", "core";
+               power-domains = <&scpsys MT2701_POWER_DOMAIN_MFG>;
+               resets = <&g3dsys MT2701_G3DSYS_CORE_RST>;
+       };
+
+       mmsys: syscon@14000000 {
+               compatible = "mediatek,mt7623-mmsys",
+                            "mediatek,mt2701-mmsys",
+                            "syscon";
+               reg = <0 0x14000000 0 0x1000>;
+               #clock-cells = <1>;
+       };
+
+       larb0: larb@14010000 {
+               compatible = "mediatek,mt7623-smi-larb",
+                            "mediatek,mt2701-smi-larb";
+               reg = <0 0x14010000 0 0x1000>;
+               mediatek,smi = <&smi_common>;
+               mediatek,larb-id = <0>;
+               clocks = <&mmsys CLK_MM_SMI_LARB0>,
+                        <&mmsys CLK_MM_SMI_LARB0>;
+               clock-names = "apb", "smi";
+               power-domains = <&scpsys MT2701_POWER_DOMAIN_DISP>;
+       };
+
+       larb1: larb@16010000 {
+               compatible = "mediatek,mt7623-smi-larb",
+                            "mediatek,mt2701-smi-larb";
+               reg = <0 0x16010000 0 0x1000>;
+               mediatek,smi = <&smi_common>;
+               mediatek,larb-id = <1>;
+               clocks = <&vdecsys CLK_VDEC_CKGEN>,
+                        <&vdecsys CLK_VDEC_LARB>;
+               clock-names = "apb", "smi";
+               power-domains = <&scpsys MT2701_POWER_DOMAIN_VDEC>;
+       };
+
+       larb2: larb@15001000 {
+               compatible = "mediatek,mt7623-smi-larb",
+                            "mediatek,mt2701-smi-larb";
+               reg = <0 0x15001000 0 0x1000>;
+               mediatek,smi = <&smi_common>;
+               mediatek,larb-id = <2>;
+               clocks = <&imgsys CLK_IMG_SMI_COMM>,
+                        <&imgsys CLK_IMG_SMI_COMM>;
+               clock-names = "apb", "smi";
+               power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
+       };
+
+       imgsys: syscon@15000000 {
+               compatible = "mediatek,mt7623-imgsys",
+                            "mediatek,mt2701-imgsys",
+                            "syscon";
+               reg = <0 0x15000000 0 0x1000>;
+               #clock-cells = <1>;
+       };
+
+       iommu: mmsys_iommu@10205000 {
+               compatible = "mediatek,mt7623-m4u",
+                            "mediatek,mt2701-m4u";
+               reg = <0 0x10205000 0 0x1000>;
+               interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&infracfg CLK_INFRA_M4U>;
+               clock-names = "bclk";
+               mediatek,larbs = <&larb0 &larb1 &larb2>;
+               #iommu-cells = <1>;
+       };
+
+       jpegdec: jpegdec@15004000 {
+               compatible = "mediatek,mt7623-jpgdec",
+                            "mediatek,mt2701-jpgdec";
+               reg = <0 0x15004000 0 0x1000>;
+               interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_LOW>;
+               clocks =  <&imgsys CLK_IMG_JPGDEC_SMI>,
+                         <&imgsys CLK_IMG_JPGDEC>;
+               clock-names = "jpgdec-smi",
+                             "jpgdec";
+               power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
+               mediatek,larb = <&larb2>;
+               iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
+                        <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
+       };
+
+       smi_common: smi@1000c000 {
+               compatible = "mediatek,mt7623-smi-common",
+                            "mediatek,mt2701-smi-common";
+               reg = <0 0x1000c000 0 0x1000>;
+               clocks = <&infracfg CLK_INFRA_SMI>,
+                        <&mmsys CLK_MM_SMI_COMMON>,
+                        <&infracfg CLK_INFRA_SMI>;
+               clock-names = "apb", "smi", "async";
+               power-domains = <&scpsys MT2701_POWER_DOMAIN_DISP>;
+       };
+
+       ovl: ovl@14007000 {
+               compatible = "mediatek,mt7623-disp-ovl",
+                            "mediatek,mt2701-disp-ovl";
+               reg = <0 0x14007000 0 0x1000>;
+               interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&mmsys CLK_MM_DISP_OVL>;
+               iommus = <&iommu MT2701_M4U_PORT_DISP_OVL_0>;
+               mediatek,larb = <&larb0>;
+       };
+
+       rdma0: rdma@14008000 {
+               compatible = "mediatek,mt7623-disp-rdma",
+                            "mediatek,mt2701-disp-rdma";
+               reg = <0 0x14008000 0 0x1000>;
+               interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&mmsys CLK_MM_DISP_RDMA>;
+               iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA>;
+               mediatek,larb = <&larb0>;
+       };
+
+       wdma@14009000 {
+               compatible = "mediatek,mt7623-disp-wdma",
+                            "mediatek,mt2701-disp-wdma";
+               reg = <0 0x14009000 0 0x1000>;
+               interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&mmsys CLK_MM_DISP_WDMA>;
+               iommus = <&iommu MT2701_M4U_PORT_DISP_WDMA>;
+               mediatek,larb = <&larb0>;
+       };
+
+       bls: pwm@1400a000 {
+               compatible = "mediatek,mt7623-disp-pwm",
+                            "mediatek,mt2701-disp-pwm";
+               reg = <0 0x1400a000 0 0x1000>;
+               #pwm-cells = <2>;
+               clocks = <&mmsys CLK_MM_MDP_BLS_26M>,
+                        <&mmsys CLK_MM_DISP_BLS>;
+               clock-names = "main", "mm";
+               status = "disabled";
+       };
+
+       color: color@1400b000 {
+               compatible = "mediatek,mt7623-disp-color",
+                            "mediatek,mt2701-disp-color";
+               reg = <0 0x1400b000 0 0x1000>;
+               interrupts = <GIC_SPI 156 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&mmsys CLK_MM_DISP_COLOR>;
+       };
+
+       dsi: dsi@1400c000 {
+               compatible = "mediatek,mt7623-dsi",
+                            "mediatek,mt2701-dsi";
+               reg = <0 0x1400c000 0 0x1000>;
+               interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&mmsys CLK_MM_DSI_ENGINE>,
+                        <&mmsys CLK_MM_DSI_DIG>,
+                        <&mipi_tx0>;
+               clock-names = "engine", "digital", "hs";
+               phys = <&mipi_tx0>;
+               phy-names = "dphy";
+               status = "disabled";
+       };
+
+       mutex: mutex@1400e000 {
+               compatible = "mediatek,mt7623-disp-mutex",
+                            "mediatek,mt2701-disp-mutex";
+               reg = <0 0x1400e000 0 0x1000>;
+               interrupts = <GIC_SPI 161 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&mmsys CLK_MM_MUTEX_32K>;
+       };
+
+       rdma1: rdma@14012000 {
+               compatible = "mediatek,mt7623-disp-rdma",
+                            "mediatek,mt2701-disp-rdma";
+               reg = <0 0x14012000 0 0x1000>;
+               interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&mmsys CLK_MM_DISP_RDMA1>;
+               iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA1>;
+               mediatek,larb = <&larb0>;
+       };
+
+       dpi0: dpi@14014000 {
+               compatible = "mediatek,mt7623-dpi",
+                            "mediatek,mt2701-dpi";
+               reg = <0 0x14014000 0 0x1000>;
+               interrupts = <GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&mmsys CLK_MM_DPI1_DIGL>,
+                        <&mmsys CLK_MM_DPI1_ENGINE>,
+                        <&apmixedsys CLK_APMIXED_TVDPLL>;
+               clock-names = "pixel", "engine", "pll";
+               status = "disabled";
+       };
+
+       hdmi0: hdmi@14015000 {
+               compatible = "mediatek,mt7623-hdmi",
+                            "mediatek,mt2701-hdmi";
+               reg = <0 0x14015000 0 0x400>;
+               clocks = <&mmsys CLK_MM_HDMI_PIXEL>,
+                        <&mmsys CLK_MM_HDMI_PLL>,
+                        <&mmsys CLK_MM_HDMI_AUDIO>,
+                        <&mmsys CLK_MM_HDMI_SPDIF>;
+               clock-names = "pixel", "pll", "bclk", "spdif";
+               phys = <&hdmi_phy>;
+               phy-names = "hdmi";
+               mediatek,syscon-hdmi = <&mmsys 0x900>;
+               cec = <&cec>;
+               status = "disabled";
+       };
+
+       mipi_tx0: mipi-dphy@10010000 {
+               compatible = "mediatek,mt7623-mipi-tx",
+                            "mediatek,mt2701-mipi-tx";
+               reg = <0 0x10010000 0 0x90>;
+               clocks = <&clk26m>;
+               clock-output-names = "mipi_tx0_pll";
+               #clock-cells = <0>;
+               #phy-cells = <0>;
+       };
+
+       cec: cec@10012000 {
+               compatible = "mediatek,mt7623-cec",
+                            "mediatek,mt8173-cec";
+               reg = <0 0x10012000 0 0xbc>;
+               interrupts = <GIC_SPI 182 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&infracfg CLK_INFRA_CEC>;
+               status = "disabled";
+       };
+
+       hdmi_phy: phy@10209100 {
+               compatible = "mediatek,mt7623-hdmi-phy",
+                            "mediatek,mt2701-hdmi-phy";
+               reg = <0 0x10209100 0 0x24>;
+               clocks = <&apmixedsys CLK_APMIXED_HDMI_REF>;
+               clock-names = "pll_ref";
+               clock-output-names = "hdmitx_dig_cts";
+               #clock-cells = <0>;
+               #phy-cells = <0>;
+               status = "disabled";
+       };
+
+       hdmiddc0: i2c@11013000 {
+               compatible = "mediatek,mt7623-hdmi-ddc",
+                            "mediatek,mt8173-hdmi-ddc";
+               interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_LOW>;
+               reg = <0 0x11013000 0 0x1C>;
+               clocks = <&pericfg CLK_PERI_I2C3>;
+               clock-names = "ddc-i2c";
+               status = "disabled";
+       };
+};
+
+&pio {
+       hdmi_pins_a: hdmi-default {
+               pins-hdmi {
+                       pinmux = <MT7623_PIN_123_HTPLG_FUNC_HTPLG>;
+                       input-enable;
+                       bias-pull-down;
+               };
+       };
+
+       hdmi_ddc_pins_a: hdmi_ddc-default {
+               pins-hdmi-ddc {
+                       pinmux = <MT7623_PIN_124_GPIO124_FUNC_HDMISCK>,
+                                <MT7623_PIN_125_GPIO125_FUNC_HDMISD>;
+               };
+       };
+};
index d9a0fd7..90e033d 100644 (file)
 
                        timer0: timer@900C0000 {
                                reg = <0x900C0000 0x1000>;
-
-                               clocks = <&timer_clk>;
+                               clocks = <&timer_clk>, <&timer_clk>,
+                                        <&timer_clk>;
+                               clock-names = "timer0clk", "timer1clk",
+                                             "apb_pclk";
                        };
 
                        timer1: timer@900D0000 {
                                reg = <0x900D0000 0x1000>;
                                interrupts = <19>;
-
-                               clocks = <&timer_clk>;
+                               clocks = <&timer_clk>, <&timer_clk>,
+                                        <&timer_clk>;
+                               clock-names = "timer0clk", "timer1clk",
+                                             "apb_pclk";
                        };
 
                        watchdog: watchdog@90060000 {
index 05077f3..252507c 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <
 };
 
 &venc {
-       status = "ok";
+       status = "okay";
 
        vdda-supply = <&vdac>;
 
index 79bc710..f9f34b8 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_dpi_pins>;
 };
 
 &venc {
-       status = "ok";
+       status = "okay";
 
        vdda-supply = <&vdac>;
 
 };
 
 &gpmc {
-       status = "ok";
+       status = "okay";
        ranges = <0 0 0x30000000 0x1000000>;    /* CS0 space, 16MB */
 
        /* Chip select 0 */
index 632f52e..3b83490 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <
index 32dbaea..bc545ee 100644 (file)
@@ -49,7 +49,7 @@
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <
index 683819b..48e48b0 100644 (file)
@@ -87,7 +87,7 @@
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <
index cdb632d..e61b8a2 100644 (file)
 };
 
 &venc {
-       status = "ok";
+       status = "okay";
 
        port {
                venc_out: endpoint {
 };
 
 &mcbsp2 {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&mcbsp2_pins>;
index aee46fa..1ed8378 100644 (file)
@@ -17,4 +17,25 @@ cpu_thermal: cpu_thermal {
 
                        /* sensor       ID */
        thermal-sensors = <&bandgap     0>;
+
+       cpu_trips: trips {
+               cpu_alert0: cpu_alert {
+                       temperature = <80000>; /* millicelsius */
+                       hysteresis = <2000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu_crit: cpu_crit {
+                       temperature = <90000>; /* millicelsius */
+                       hysteresis = <2000>; /* millicelsius */
+                       type = "critical";
+               };
+       };
+
+       cpu_cooling_maps: cooling-maps {
+               map0 {
+                       trip = <&cpu_alert0>;
+                       cooling-device =
+                               <&cpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+               };
+       };
 };
index ac3d996..2c19d6e 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_dpi_pins>;
 };
 
 &venc {
-       status = "ok";
+       status = "okay";
 
        vdda-supply = <&vdac>;
 
index ecc4586..c8745bc 100644 (file)
 };
 
 &mcbsp1 { /* FM Transceiver PCM */
-       status = "ok";
+       status = "okay";
        #sound-dai-cells = <0>;
        pinctrl-names = "default";
        pinctrl-0 = <&mcbsp1_pins>;
 };
 
 &mcbsp2 { /* TPS65950 I2S */
-       status = "ok";
+       status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&mcbsp2_pins>;
 };
 
 &mcbsp3 { /* Bluetooth PCM */
-       status = "ok";
+       status = "okay";
        #sound-dai-cells = <0>;
        pinctrl-names = "default";
        pinctrl-0 = <&mcbsp3_pins>;
 };
 
 &mcbsp4 { /* GSM voice PCM */
-       status = "ok";
+       status = "okay";
        #sound-dai-cells = <0>;
        pinctrl-names = "default";
        pinctrl-0 = <&mcbsp4_pins>;
index b3f7f99..643283f 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_dpi_pins>;
index 91caa50..af8aa5f 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        port {
                dpi_out: endpoint {
index 2495a69..d211bcc 100644 (file)
@@ -23,7 +23,6 @@
                vana-supply = <&vaux3>;
                clocks = <&isp 0>;
                clock-frequency = <9600000>;
-               nokia,nvm-size = <(16 * 64)>;
                flash-leds = <&as3645a_flash &as3645a_indicator>;
                port {
                        smia_1_1: endpoint {
index bc24e3d..32335d4 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_sdi_pins>;
 };
 
 &venc {
-       status = "ok";
+       status = "okay";
 
        vdda-supply = <&vdac>;
 
 };
 
 &mcbsp2 {
-       status = "ok";
+       status = "okay";
 };
 
 &ssi_port1 {
index 31d47a1..b2f4800 100644 (file)
@@ -76,7 +76,6 @@
                vana-supply = <&vaux3>;
                clocks = <&isp 0>;
                clock-frequency = <9600000>;
-               nokia,nvm-size = <(16 * 64)>;
                flash-leds = <&as3645a_flash &as3645a_indicator>;
                port {
                        smia_1_1: endpoint {
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        vdda_video-supply = <&vdac>;
 };
 
 &dsi {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dsi_pins>;
                };
        };
 
-       lcd0: display {
+       lcd0: panel@0 {
                compatible = "nokia,himalaya", "panel-dsi-cm";
+               reg = <0>;
                label = "lcd0";
 
                pinctrl-names = "default";
index c9e62e4..339a51f 100644 (file)
@@ -48,7 +48,7 @@
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_dpi_pins>;
index 185ce53..1d6e88f 100644 (file)
@@ -76,7 +76,7 @@
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_dpi_pins>;
index 7fe0f91..7e30f9d 100644 (file)
@@ -75,7 +75,7 @@
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_dpi_pins>;
index 150d5be..37608af 100644 (file)
 };
 
 &venc {
-       status = "ok";
+       status = "okay";
 
        vdda-supply = <&vdac>;
 
        pinctrl-names = "default";
        pinctrl-0 = < &dss_dpi_pins >;
 
-       status = "ok";
+       status = "okay";
        vdds_dsi-supply = <&vpll2>;
 
        port {
index b8b9fcc..2dbb687 100644 (file)
@@ -46,7 +46,7 @@
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
        port {
                dpi_out: endpoint {
                        remote-endpoint = <&lcd_in>;
index f7930f1..d82cab8 100644 (file)
@@ -64,7 +64,7 @@
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_dpi_pins>;
index cf22a7e..9dcae1f 100644 (file)
                                ti,hwmods = "dss_dsi1";
                                clocks = <&dss1_alwon_fck>, <&dss2_alwon_fck>;
                                clock-names = "fck", "sys_clk";
+
+                               #address-cells = <1>;
+                               #size-cells = <0>;
                        };
 
                        rfbi: encoder@48050800 {
index 9c3ee4a..feaa43b 100644 (file)
@@ -20,6 +20,7 @@
                        operating-points-v2 = <&cpu0_opp_table>;
 
                        clock-latency = <300000>; /* From legacy driver */
+                       #cooling-cells = <2>;
                };
        };
 
 };
 
 &ssi {
-       status = "ok";
+       status = "okay";
 
        clocks = <&ssi_ssr_fck>,
                 <&ssi_sst_fck>,
index 9c3beef..05fe5ed 100644 (file)
@@ -25,6 +25,7 @@
 
                        vbb-supply = <&abb_mpu_iva>;
                        clock-latency = <300000>; /* From omap-cpufreq driver */
+                       #cooling-cells = <2>;
                };
        };
 
 };
 
 &ssi {
-       status = "ok";
+       status = "okay";
 
        clocks = <&ssi_ssr_fck>,
                 <&ssi_sst_fck>,
index 4548d87..b294c22 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 };
 
 &hdmi {
-       status = "ok";
+       status = "okay";
        vdda-supply = <&vdac>;
 
        pinctrl-names = "default";
index b2cf5f4..a9573d4 100644 (file)
@@ -1,14 +1,16 @@
 &l4_abe {                                              /* 0x40100000 */
-       compatible = "ti,omap4-l4-abe", "simple-bus";
+       compatible = "ti,omap4-l4-abe", "simple-pm-bus";
        reg = <0x40100000 0x400>,
              <0x40100400 0x400>;
        reg-names = "la", "ap";
+       power-domains = <&prm_abe>;
+       /* OMAP4_L4_ABE_CLKCTRL is read-only */
        #address-cells = <1>;
        #size-cells = <1>;
        ranges = <0x00000000 0x40100000 0x100000>,      /* segment 0 */
                 <0x49000000 0x49000000 0x100000>;
        segment@0 {                                     /* 0x40100000 */
-               compatible = "simple-bus";
+               compatible = "simple-pm-bus";
                #address-cells = <1>;
                #size-cells = <1>;
                ranges =
index 3e78cae..609a8de 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        port {
                dpi_out: endpoint {
 };
 
 &dsi2 {
-       status = "ok";
+       status = "okay";
        vdd-supply = <&vcxio>;
 };
 
 &hdmi {
-       status = "ok";
+       status = "okay";
        vdda-supply = <&vdac>;
 
        port {
index 79e7a41..afb49a2 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 };
 
 &dsi1 {
-       status = "ok";
+       status = "okay";
        vdd-supply = <&vcxio>;
 
        port {
                };
        };
 
-       lcd0: display {
+       lcd0: panel@0 {
                compatible = "tpo,taal", "panel-dsi-cm";
+               reg = <0>;
                label = "lcd0";
 
                reset-gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>;      /* 102 */
 };
 
 &dsi2 {
-       status = "ok";
+       status = "okay";
        vdd-supply = <&vcxio>;
 
        port {
                };
        };
 
-       lcd1: display {
+       lcd1: panel@0 {
                compatible = "tpo,taal", "panel-dsi-cm";
+               reg = <0>;
                label = "lcd1";
 
                reset-gpios = <&gpio4 8 GPIO_ACTIVE_HIGH>;      /* 104 */
 };
 
 &hdmi {
-       status = "ok";
+       status = "okay";
        vdda-supply = <&vdac>;
 
        port {
index 0282b9d..d6475cc 100644 (file)
                        status = "disabled";
                };
 
-               target-module@56000000 {
+               sgx_module: target-module@56000000 {
                        compatible = "ti,sysc-omap4", "ti,sysc";
                        reg = <0x5600fe00 0x4>,
                              <0x5600fe10 0x4>;
                                                clocks = <&l3_dss_clkctrl OMAP4_DSS_CORE_CLKCTRL 8>,
                                                         <&l3_dss_clkctrl OMAP4_DSS_CORE_CLKCTRL 10>;
                                                clock-names = "fck", "sys_clk";
+
+                                               #address-cells = <1>;
+                                               #size-cells = <0>;
                                        };
                                };
 
                                                clocks = <&l3_dss_clkctrl OMAP4_DSS_CORE_CLKCTRL 8>,
                                                         <&l3_dss_clkctrl OMAP4_DSS_CORE_CLKCTRL 10>;
                                                clock-names = "fck", "sys_clk";
+
+                                               #address-cells = <1>;
+                                               #size-cells = <0>;
                                        };
                                };
 
                #reset-cells = <1>;
        };
 
+       prm_abe: prm@500 {
+               compatible = "ti,omap4-prm-inst", "ti,omap-prm-inst";
+               reg = <0x500 0x100>;
+               #power-domain-cells = <0>;
+       };
+
        prm_core: prm@700 {
                compatible = "ti,omap4-prm-inst", "ti,omap-prm-inst";
                reg = <0x700 0x100>;
index 8ed510a..cb30974 100644 (file)
 };
 
 /include/ "omap443x-clocks.dtsi"
+
+/*
+ * Use dpll_per for sgx at 153.6MHz like droid4 stock v3.0.8 Android kernel
+ */
+&sgx_module {
+       assigned-clocks = <&l3_gfx_clkctrl OMAP4_GPU_CLKCTRL 24>,
+                         <&dpll_per_m7x2_ck>;
+       assigned-clock-rates = <0>, <153600000>;
+       assigned-clock-parents = <&dpll_per_m7x2_ck>;
+};
index edf1906..d8f1362 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 };
 
 &hdmi {
-       status = "ok";
+       status = "okay";
 
        /* vdda-supply populated in board specific dts file */
 
index e78d371..ca759b7 100644 (file)
 };
 
 &dss {
-       status = "ok";
+       status = "okay";
 
        pinctrl-names = "default";
        pinctrl-0 = <&dss_dpi_pins>;
 };
 
 &dsi2 {
-       status = "ok";
+       status = "okay";
        vdd-supply = <&ldo4_reg>;
 };
 
 &hdmi {
-       status = "ok";
+       status = "okay";
        vdda-supply = <&ldo4_reg>;
 
        pinctrl-names = "default";
index 25b7fce..a03bca5 100644 (file)
@@ -1,14 +1,16 @@
 &l4_abe {                                              /* 0x40100000 */
-       compatible = "ti,omap5-l4-abe", "simple-bus";
+       compatible = "ti,omap5-l4-abe", "simple-pm-bus";
        reg = <0x40100000 0x400>,
              <0x40100400 0x400>;
        reg-names = "la", "ap";
+       power-domains = <&prm_abe>;
+       /* OMAP5_L4_ABE_CLKCTRL is read-only */
        #address-cells = <1>;
        #size-cells = <1>;
        ranges = <0x00000000 0x40100000 0x100000>,      /* segment 0 */
                 <0x49000000 0x49000000 0x100000>;
        segment@0 {                                     /* 0x40100000 */
-               compatible = "simple-bus";
+               compatible = "simple-pm-bus";
                #address-cells = <1>;
                #size-cells = <1>;
                ranges =
index a82c962..2bf2e58 100644 (file)
                #reset-cells = <1>;
        };
 
+       prm_abe: prm@500 {
+               compatible = "ti,omap5-prm-inst", "ti,omap-prm-inst";
+               reg = <0x500 0x100>;
+               #power-domain-cells = <0>;
+       };
+
        prm_core: prm@700 {
                compatible = "ti,omap5-prm-inst", "ti,omap-prm-inst";
                reg = <0x700 0x100>;
diff --git a/arch/arm/boot/dts/owl-s500-labrador-base-m.dts b/arch/arm/boot/dts/owl-s500-labrador-base-m.dts
new file mode 100644 (file)
index 0000000..c92f8bd
--- /dev/null
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Caninos Labrador Base Board
+ *
+ * Copyright (c) 2019-2020 Matheus Castello
+ */
+
+/dts-v1/;
+
+#include "owl-s500-labrador-v2.dtsi"
+
+/ {
+       model = "Caninos Labrador Core v2 on Labrador Base-M v1";
+       compatible = "caninos,labrador-base-m",
+                    "caninos,labrador-v2", "actions,s500";
+
+       aliases {
+               serial3 = &uart3;
+       };
+
+       chosen {
+               stdout-path = "serial3:115200n8";
+       };
+
+       uart3_clk: uart3-clk {
+               compatible = "fixed-clock";
+               clock-frequency = <921600>;
+               #clock-cells = <0>;
+       };
+};
+
+&uart3 {
+       status = "okay";
+       clocks = <&uart3_clk>;
+};
diff --git a/arch/arm/boot/dts/owl-s500-labrador-v2.dtsi b/arch/arm/boot/dts/owl-s500-labrador-v2.dtsi
new file mode 100644 (file)
index 0000000..883ff2f
--- /dev/null
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Caninos Labrador SoM V2
+ *
+ * Copyright (c) 2019-2020 Matheus Castello
+ */
+
+#include "owl-s500.dtsi"
+
+/ {
+       model = "Caninos Labrador Core V2.1";
+       compatible = "caninos,labrador-v2", "actions,s500";
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x80000000>;
+       };
+};
+
+&timer {
+       clocks = <&hosc>;
+};
diff --git a/arch/arm/boot/dts/owl-s500-roseapplepi.dts b/arch/arm/boot/dts/owl-s500-roseapplepi.dts
new file mode 100644 (file)
index 0000000..a2087e6
--- /dev/null
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Roseapple Pi
+ *
+ * Copyright (C) 2020 Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "owl-s500.dtsi"
+
+/ {
+       compatible = "roseapplepi,roseapplepi", "actions,s500";
+       model = "Roseapple Pi";
+
+       aliases {
+               serial2 = &uart2;
+       };
+
+       chosen {
+               stdout-path = "serial2:115200n8";
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x80000000>; /* 2GB */
+       };
+
+       uart2_clk: uart2-clk {
+               compatible = "fixed-clock";
+               clock-frequency = <921600>;
+               #clock-cells = <0>;
+       };
+};
+
+&twd_timer {
+       status = "okay";
+};
+
+&timer {
+       clocks = <&hosc>;
+};
+
+&uart2 {
+       status = "okay";
+       clocks = <&uart2_clk>;
+};
index 5ceb6cc..1dbe4e8 100644 (file)
                global_timer: timer@b0020200 {
                        compatible = "arm,cortex-a9-global-timer";
                        reg = <0xb0020200 0x100>;
-                       interrupts = <GIC_PPI 0 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>;
+                       interrupts = <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>;
                        status = "disabled";
                };
 
                twd_timer: timer@b0020600 {
                        compatible = "arm,cortex-a9-twd-timer";
                        reg = <0xb0020600 0x20>;
-                       interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>;
+                       interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>;
                        status = "disabled";
                };
 
                twd_wdt: wdt@b0020620 {
                        compatible = "arm,cortex-a9-twd-wdt";
                        reg = <0xb0020620 0xe0>;
-                       interrupts = <GIC_PPI 3 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>;
+                       interrupts = <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>;
                        status = "disabled";
                };
 
index 5ae8607..c4c6c7e 100644 (file)
                                reg = <0x20000 0x1000>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               reg-io-width = <4>;
 
                                banka: gpio-controller@0 {
                                        compatible = "snps,dw-apb-gpio-bank";
index fa93155..0e85bb6 100644 (file)
                                reg = <0x20000 0x1000>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               reg-io-width = <4>;
 
                                banka: gpio-controller@0 {
                                        compatible = "snps,dw-apb-gpio-bank";
index 4dfe0f1..c349fd3 100644 (file)
@@ -15,7 +15,7 @@
                bootargs = "console=ttyS0,115200";
        };
 
-       memory {
+       memory@70000000 {
                reg = <0x70000000 0x8000000>;
        };
 
@@ -68,6 +68,7 @@
                                        &pinctrl_board_mmc
                                        &pinctrl_mmc0_slot0_clk_cmd_dat0
                                        &pinctrl_mmc0_slot0_dat1_3>;
+                               pinctrl-names = "default";
                                status = "okay";
                                slot@0 {
                                        reg = <0>;
index 9c7b46b..7d3d93c 100644 (file)
@@ -50,7 +50,7 @@
                #size-cells = <1>;
                ranges = <0x40000000 0x40000000 0x80000000>;
 
-               l2-cache-controller@80040000 {
+               cache-controller@80040000 {
                        compatible = "arm,pl310-cache";
                        reg = <0x80040000 0x1000>;
                        interrupts = <59>;
index 347b4f7..dda2cee 100644 (file)
@@ -98,7 +98,7 @@
                ranges;
                compatible = "simple-bus";
 
-               L2: l2-cache@2040000 {
+               L2: cache-controller@2040000 {
                        compatible = "arm,pl310-cache";
                        reg = <0x02040000 0x1000>;
                        arm,data-latency = <2 2 0>;
index b9b1388..45cf75b 100644 (file)
                        clock-output-names = "sdhi00", "sdhi01", "sdhi10", "sdhi11";
                };
 
-               pinctrl: pin-controller@fcfe3000 {
+               pinctrl: pinctrl@fcfe3000 {
                        compatible = "renesas,r7s72100-ports";
 
                        reg = <0xfcfe3000 0x4230>;
index 838920a..85c0399 100644 (file)
                        interrupt-map-mask = <7 0>;
                };
 
-               pinctrl: pin-controller@fcffe000 {
+               pinctrl: pinctrl@fcffe000 {
                        compatible = "renesas,r7s9210-pinctrl";
                        reg = <0xfcffe000 0x1000>;
 
index b92e725..e5fb1ce 100644 (file)
                power-domains = <&pd_c4>;
        };
 
-       pfc: pin-controller@e6050000 {
+       pfc: pinctrl@e6050000 {
                compatible = "renesas,pfc-r8a73a4";
                reg = <0 0xe6050000 0 0x9000>;
                gpio-controller;
index 8048303..1b2cf5f 100644 (file)
                status = "disabled";
        };
 
-       pfc: pin-controller@e6050000 {
+       pfc: pinctrl@e6050000 {
                compatible = "renesas,pfc-r8a7740";
                reg = <0xe6050000 0x8000>,
                      <0xe605800c 0x20>;
index 1479ced..961c0f2 100644 (file)
        status = "disabled";
 };
 
+&can0 {
+       pinctrl-0 = <&can0_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+};
+
 &ether {
        pinctrl-0 = <&ether_pins>;
        pinctrl-names = "default";
 };
 
 &pfc {
+       can0_pins: can0 {
+               groups = "can0_data_d";
+               function = "can0";
+       };
+
        ether_pins: ether {
                groups = "eth_mdio", "eth_rmii";
                function = "eth";
index e90aaf1..c2c05c9 100644 (file)
                clock-frequency = <26000000>;
        };
 
+       leds {
+               compatible = "gpio-leds";
+
+               sdhi2_led {
+                       label = "sdio-led";
+                       gpios = <&gpio5 22 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "mmc1";
+               };
+       };
+
        reg_1p5v: 1p5v {
                compatible = "regulator-fixed";
                regulator-name = "1P5V";
        };
 };
 
+&can1 {
+       pinctrl-0 = <&can1_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+};
+
+&cmt0 {
+       status = "okay";
+};
+
+&gpio1 {
+       can-trx-en-gpio{
+               gpio-hog;
+               gpios = <28 GPIO_ACTIVE_HIGH>;
+               output-low;
+               line-name = "can-trx-en-gpio";
+       };
+};
+
+&hsusb {
+       pinctrl-0 = <&usb0_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+};
+
+&msiof0 {
+       pinctrl-0 = <&msiof0_pins>;
+       pinctrl-names = "default";
+       cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
+
+       status = "okay";
+
+       flash1: flash@0 {
+               compatible = "sst,sst25vf016b", "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <50000000>;
+               m25p,fast-read;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "user";
+                               reg = <0x00000000 0x00200000>;
+                       };
+               };
+       };
+};
+
+&pci0 {
+       pinctrl-0 = <&usb0_pins>;
+       pinctrl-names = "default";
+       /* Disable hsusb to enable USB2.0 host mode support on J2 */
+       /* status = "okay"; */
+};
+
+&pci1 {
+       pinctrl-0 = <&usb1_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+};
+
+&pci2 {
+       /* Disable xhci to enable USB2.0 host mode support on J23 bottom port */
+       /* status = "okay"; */
+};
+
+&pcie_bus_clk {
+       clock-frequency = <100000000>;
+};
+
+&pciec {
+       /* SW2[6] determines which connector is activated
+        * ON = PCIe X4 (connector-J7)
+        * OFF = mini-PCIe (connector-J26)
+        */
+       status = "okay";
+};
+
 &pfc {
        avb_pins: avb {
                groups = "avb_mdio", "avb_gmii";
                function = "avb";
        };
 
+       can1_pins: can1 {
+               groups = "can1_data_b";
+               function = "can1";
+       };
+
        i2c2_pins: i2c2 {
                groups = "i2c2_b";
                function = "i2c2";
        };
 
+       msiof0_pins: msiof0 {
+               groups = "msiof0_clk", "msiof0_sync", "msiof0_tx", "msiof0_rx";
+               function = "msiof0";
+       };
+
        scifa2_pins: scifa2 {
                groups = "scifa2_data_c";
                function = "scifa2";
                groups = "ssi34_ctrl", "ssi3_data", "ssi4_data";
                function = "ssi";
        };
+
+       usb0_pins: usb0 {
+               groups = "usb0";
+               function = "usb0";
+       };
+
+       usb1_pins: usb1 {
+               groups = "usb1_pwen";
+               function = "usb1";
+       };
 };
 
 &rcar_sound {
 &ssi4 {
        shared-pin;
 };
+
+&usbphy {
+       status = "okay";
+};
+
+&xhci {
+       status = "okay";
+};
index 85aff42..5621c9e 100644 (file)
        clock-frequency = <20000000>;
 };
 
-&pfc {
-       mmc1_pins: mmc1 {
-               groups = "mmc1_data4", "mmc1_ctrl";
-               function = "mmc1";
+&gpio0 {
+       /* GP0_18 set low to select QSPI. Doing so will disable VIN2 */
+       qspi_en {
+               gpio-hog;
+               gpios = <18 GPIO_ACTIVE_HIGH>;
+               output-low;
+               line-name = "QSPI_EN";
+       };
+};
+
+&i2c0 {
+       pinctrl-0 = <&i2c0_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+       clock-frequency = <400000>;
+
+       rtc@68 {
+               compatible = "ti,bq32000";
+               reg = <0x68>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
        };
 };
 
        non-removable;
        status = "okay";
 };
+
+&pfc {
+       i2c0_pins: i2c0 {
+               groups = "i2c0";
+               function = "i2c0";
+       };
+
+       mmc1_pins: mmc1 {
+               groups = "mmc1_data4", "mmc1_ctrl";
+               function = "mmc1";
+       };
+
+       qspi_pins: qspi {
+               groups = "qspi_ctrl", "qspi_data2";
+               function = "qspi";
+       };
+};
+
+&qspi {
+       pinctrl-0 = <&qspi_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+
+       flash: flash@0 {
+               compatible = "sst,sst25vf016b", "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <50000000>;
+               m25p,fast-read;
+               spi-cpol;
+               spi-cpha;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "bootloader";
+                               reg = <0x00000000 0x000c0000>;
+                               read-only;
+                       };
+                       partition@c0000 {
+                               label = "env";
+                               reg = <0x000c0000 0x00002000>;
+                       };
+                       partition@c2000 {
+                               label = "user";
+                               reg = <0x000c2000 0x0013e000>;
+                       };
+               };
+       };
+};
index 0240d01..6a78c81 100644 (file)
                clock-frequency = <0>;
        };
 
+       /* External CAN clock */
+       can_clk: can {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               /* This value must be overridden by the board. */
+               clock-frequency = <0>;
+       };
+
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                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>;
+       };
+
        pmu-0 {
                compatible = "arm,cortex-a15-pmu";
                interrupts-extended = <&gic GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>,
                        resets = <&cpg 907>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a7742";
                        reg = <0 0xe6060000 0 0x250>;
                };
 
+               tpu: pwm@e60f0000 {
+                       compatible = "renesas,tpu-r8a7742", "renesas,tpu";
+                       reg = <0 0xe60f0000 0 0x148>;
+                       interrupts = <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 304>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 304>;
+                       #pwm-cells = <3>;
+                       status = "disabled";
+               };
+
                cpg: clock-controller@e6150000 {
                        compatible = "renesas,r8a7742-cpg-mssr";
                        reg = <0 0xe6150000 0 0x1000>;
                        status = "disabled";
                };
 
+               qspi: spi@e6b10000 {
+                       compatible = "renesas,qspi-r8a7742", "renesas,qspi";
+                       reg = <0 0xe6b10000 0 0x2c>;
+                       interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 917>;
+                       dmas = <&dmac0 0x17>, <&dmac0 0x18>,
+                              <&dmac1 0x17>, <&dmac1 0x18>;
+                       dma-names = "tx", "rx", "tx", "rx";
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 917>;
+                       num-cs = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
                scifa0: serial@e6c40000 {
                        compatible = "renesas,scifa-r8a7742",
                                     "renesas,rcar-gen2-scifa", "renesas,scifa";
                        status = "disabled";
                };
 
+               can0: can@e6e80000 {
+                       compatible = "renesas,can-r8a7742",
+                                    "renesas,rcar-gen2-can";
+                       reg = <0 0xe6e80000 0 0x1000>;
+                       interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 916>,
+                                <&cpg CPG_CORE R8A7742_CLK_RCAN>, <&can_clk>;
+                       clock-names = "clkp1", "clkp2", "can_clk";
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 916>;
+                       status = "disabled";
+               };
+
+               can1: can@e6e88000 {
+                       compatible = "renesas,can-r8a7742",
+                                    "renesas,rcar-gen2-can";
+                       reg = <0 0xe6e88000 0 0x1000>;
+                       interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 915>,
+                                <&cpg CPG_CORE R8A7742_CLK_RCAN>, <&can_clk>;
+                       clock-names = "clkp1", "clkp2", "can_clk";
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 915>;
+                       status = "disabled";
+               };
+
+               pwm0: pwm@e6e30000 {
+                       compatible = "renesas,pwm-r8a7742", "renesas,pwm-rcar";
+                       reg = <0 0xe6e30000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm1: pwm@e6e31000 {
+                       compatible = "renesas,pwm-r8a7742", "renesas,pwm-rcar";
+                       reg = <0 0xe6e31000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm2: pwm@e6e32000 {
+                       compatible = "renesas,pwm-r8a7742", "renesas,pwm-rcar";
+                       reg = <0 0xe6e32000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm3: pwm@e6e33000 {
+                       compatible = "renesas,pwm-r8a7742", "renesas,pwm-rcar";
+                       reg = <0 0xe6e33000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm4: pwm@e6e34000 {
+                       compatible = "renesas,pwm-r8a7742", "renesas,pwm-rcar";
+                       reg = <0 0xe6e34000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm5: pwm@e6e35000 {
+                       compatible = "renesas,pwm-r8a7742", "renesas,pwm-rcar";
+                       reg = <0 0xe6e35000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm6: pwm@e6e36000 {
+                       compatible = "renesas,pwm-r8a7742", "renesas,pwm-rcar";
+                       reg = <0 0xe6e36000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               vin0: video@e6ef0000 {
+                       compatible = "renesas,vin-r8a7742",
+                                    "renesas,rcar-gen2-vin";
+                       reg = <0 0xe6ef0000 0 0x1000>;
+                       interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 811>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 811>;
+                       status = "disabled";
+               };
+
+               vin1: video@e6ef1000 {
+                       compatible = "renesas,vin-r8a7742",
+                                    "renesas,rcar-gen2-vin";
+                       reg = <0 0xe6ef1000 0 0x1000>;
+                       interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 810>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 810>;
+                       status = "disabled";
+               };
+
+               vin2: video@e6ef2000 {
+                       compatible = "renesas,vin-r8a7742",
+                                    "renesas,rcar-gen2-vin";
+                       reg = <0 0xe6ef2000 0 0x1000>;
+                       interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 809>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 809>;
+                       status = "disabled";
+               };
+
+               vin3: video@e6ef3000 {
+                       compatible = "renesas,vin-r8a7742",
+                                    "renesas,rcar-gen2-vin";
+                       reg = <0 0xe6ef3000 0 0x1000>;
+                       interrupts = <GIC_SPI 191 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 808>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 808>;
+                       status = "disabled";
+               };
+
                rcar_sound: sound@ec500000 {
                        /*
                         * #sound-dai-cells is required
                        resets = <&cpg 408>;
                };
 
+               pciec: pcie@fe000000 {
+                       compatible = "renesas,pcie-r8a7742",
+                                    "renesas,pcie-rcar-gen2";
+                       reg = <0 0xfe000000 0 0x80000>;
+                       #address-cells = <3>;
+                       #size-cells = <2>;
+                       bus-range = <0x00 0xff>;
+                       device_type = "pci";
+                       ranges = <0x01000000 0 0x00000000 0 0xfe100000 0 0x00100000>,
+                                <0x02000000 0 0xfe200000 0 0xfe200000 0 0x00200000>,
+                                <0x02000000 0 0x30000000 0 0x30000000 0 0x08000000>,
+                                <0x42000000 0 0x38000000 0 0x38000000 0 0x08000000>;
+                       /* Map all possible DDR as inbound ranges */
+                       dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0 0x80000000>,
+                                    <0x43000000 1 0x80000000 1 0x80000000 0 0x80000000>;
+                       interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
+                       #interrupt-cells = <1>;
+                       interrupt-map-mask = <0 0 0 0>;
+                       interrupt-map = <0 0 0 0 &gic GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 319>, <&pcie_bus_clk>;
+                       clock-names = "pcie", "pcie_bus";
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 319>;
+                       status = "disabled";
+               };
+
+               vsp@fe920000 {
+                       compatible = "renesas,vsp1";
+                       reg = <0 0xfe920000 0 0x8000>;
+                       interrupts = <GIC_SPI 266 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 130>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 130>;
+               };
+
+               vsp@fe928000 {
+                       compatible = "renesas,vsp1";
+                       reg = <0 0xfe928000 0 0x8000>;
+                       interrupts = <GIC_SPI 267 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 131>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 131>;
+               };
+
+               vsp@fe930000 {
+                       compatible = "renesas,vsp1";
+                       reg = <0 0xfe930000 0 0x8000>;
+                       interrupts = <GIC_SPI 246 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 128>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 128>;
+               };
+
+               vsp@fe938000 {
+                       compatible = "renesas,vsp1";
+                       reg = <0 0xfe938000 0 0x8000>;
+                       interrupts = <GIC_SPI 247 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 127>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 127>;
+               };
+
+               du: display@feb00000 {
+                       compatible = "renesas,du-r8a7742";
+                       reg = <0 0xfeb00000 0 0x70000>;
+                       interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 269 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 724>, <&cpg CPG_MOD 723>,
+                                <&cpg CPG_MOD 722>;
+                       clock-names = "du.0", "du.1", "du.2";
+                       resets = <&cpg 724>;
+                       reset-names = "du.0";
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       du_out_rgb: endpoint {
+                                       };
+                               };
+                               port@1 {
+                                       reg = <1>;
+                                       du_out_lvds0: endpoint {
+                                               remote-endpoint = <&lvds0_in>;
+                                       };
+                               };
+                               port@2 {
+                                       reg = <2>;
+                                       du_out_lvds1: endpoint {
+                                               remote-endpoint = <&lvds1_in>;
+                                       };
+                               };
+                       };
+               };
+
+               lvds0: lvds@feb90000 {
+                       compatible = "renesas,r8a7742-lvds";
+                       reg = <0 0xfeb90000 0 0x14>;
+                       clocks = <&cpg CPG_MOD 726>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 726>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       lvds0_in: endpoint {
+                                               remote-endpoint = <&du_out_lvds0>;
+                                       };
+                               };
+                               port@1 {
+                                       reg = <1>;
+                                       lvds0_out: endpoint {
+                                       };
+                               };
+                       };
+               };
+
+               lvds1: lvds@feb94000 {
+                       compatible = "renesas,r8a7742-lvds";
+                       reg = <0 0xfeb94000 0 0x14>;
+                       clocks = <&cpg CPG_MOD 725>;
+                       power-domains = <&sysc R8A7742_PD_ALWAYS_ON>;
+                       resets = <&cpg 725>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       lvds1_in: endpoint {
+                                               remote-endpoint = <&du_out_lvds1>;
+                                       };
+                               };
+                               port@1 {
+                                       reg = <1>;
+                                       lvds1_out: endpoint {
+                                       };
+                               };
+                       };
+               };
+
                prr: chipid@ff000044 {
                        compatible = "renesas,prr";
                        reg = <0 0xff000044 0 4>;
index 896916a..f444e41 100644 (file)
                        resets = <&cpg 904>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a7743";
                        reg = <0 0xe6060000 0 0x250>;
                };
index 6b56aa2..0442aad 100644 (file)
                        resets = <&cpg 904>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a7744";
                        reg = <0 0xe6060000 0 0x250>;
                };
index b15b1b0..1c7b37a 100644 (file)
                clock-frequency = <26000000>;
        };
 
-       rsnd_sgtl5000: sound {
-               compatible = "simple-audio-card";
-               simple-audio-card,format = "i2s";
-               simple-audio-card,bitclock-master = <&sndcodec>;
-               simple-audio-card,frame-master = <&sndcodec>;
-
-               sndcpu: simple-audio-card,cpu {
-                       sound-dai = <&rcar_sound>;
-               };
-
-               sndcodec: simple-audio-card,codec {
-                       sound-dai = <&sgtl5000>;
-               };
-       };
-
-       vccq_sdhi0: regulator-vccq-sdhi0 {
-               compatible = "regulator-gpio";
-
-               regulator-name = "SDHI0 VccQ";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
-               gpios-states = <1>;
-               states = <3300000 1>, <1800000 0>;
-       };
-
-       vccq_panel: regulator-vccq-panel {
-               compatible = "regulator-fixed";
-               regulator-name = "Panel VccQ";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               gpio = <&gpio1 13 GPIO_ACTIVE_LOW>;
-               enable-active-high;
-       };
-
        backlight_lcd: backlight {
                compatible = "pwm-backlight";
                pwms = <&tpu 3 5000000 PWM_POLARITY_INVERTED>;
                        };
                };
        };
-};
 
-&du {
-       pinctrl-0 = <&du0_pins>;
-       pinctrl-names = "default";
+       vccq_panel: regulator-vccq-panel {
+               compatible = "regulator-fixed";
+               regulator-name = "Panel VccQ";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpio1 13 GPIO_ACTIVE_LOW>;
+               enable-active-high;
+       };
 
-       status = "okay";
+       vccq_sdhi0: regulator-vccq-sdhi0 {
+               compatible = "regulator-gpio";
 
-       ports {
-               port@0 {
-                       endpoint {
-                               remote-endpoint = <&lcd_in>;
-                       };
+               regulator-name = "SDHI0 VccQ";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
+               gpios-states = <1>;
+               states = <3300000 1>, <1800000 0>;
+       };
+
+       rsnd_sgtl5000: sound {
+               compatible = "simple-audio-card";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,bitclock-master = <&sndcodec>;
+               simple-audio-card,frame-master = <&sndcodec>;
+
+               sndcpu: simple-audio-card,cpu {
+                       sound-dai = <&rcar_sound>;
+               };
+
+               sndcodec: simple-audio-card,codec {
+                       sound-dai = <&sgtl5000>;
                };
        };
 };
        status = "okay";
 };
 
+&du {
+       pinctrl-0 = <&du0_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+
+       ports {
+               port@0 {
+                       endpoint {
+                               remote-endpoint = <&lcd_in>;
+                       };
+               };
+       };
+};
+
 &hscif1 {
        pinctrl-0 = <&hscif1_pins>;
        pinctrl-names = "default";
        status = "okay";
        clock-frequency = <400000>;
 
+       sgtl5000: codec@a {
+               compatible = "fsl,sgtl5000";
+               #sound-dai-cells = <0>;
+               reg = <0x0a>;
+               clocks = <&audio_clock>;
+               VDDA-supply = <&reg_3p3v>;
+               VDDIO-supply = <&reg_3p3v>;
+       };
+
        stmpe811@44 {
                compatible = "st,stmpe811";
                reg = <0x44>;
 
                /* 3.25 MHz ADC clock speed */
                st,adc-freq = <1>;
-               /* ADC converstion time: 80 clocks */
+               /* ADC conversion time: 80 clocks */
                st,sample-time = <4>;
                /* 12-bit ADC */
                st,mod-12b = <1>;
                        st,touch-det-delay = <5>;
                };
        };
-
-       sgtl5000: codec@a {
-               compatible = "fsl,sgtl5000";
-               #sound-dai-cells = <0>;
-               reg = <0x0a>;
-               clocks = <&audio_clock>;
-               VDDA-supply = <&reg_3p3v>;
-               VDDIO-supply = <&reg_3p3v>;
-       };
 };
 
 &pci1 {
index 636248f..0f14ac2 100644 (file)
                        resets = <&cpg 905>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a7745";
                        reg = <0 0xe6060000 0 0x11c>;
                };
index 6baa126..691b1a1 100644 (file)
                        resets = <&cpg 907>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a77470";
                        reg = <0 0xe6060000 0 0x118>;
                };
index 1612b00..c9f8735 100644 (file)
                interrupt-controller;
        };
 
-       pfc: pin-controller@fffc0000 {
+       pfc: pinctrl@fffc0000 {
                compatible = "renesas,pfc-r8a7778";
                reg = <0xfffc0000 0x118>;
        };
index c5634da..74d7e90 100644 (file)
                status = "disabled";
        };
 
-       pfc: pin-controller@fffc0000 {
+       pfc: pinctrl@fffc0000 {
                compatible = "renesas,pfc-r8a7779";
                reg = <0xfffc0000 0x23c>;
        };
index 769ba2a..b0569b4 100644 (file)
                        resets = <&cpg 907>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a7790";
                        reg = <0 0xe6060000 0 0x250>;
                };
index 499cf38..87f0d6d 100644 (file)
                        resets = <&cpg 904>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a7791";
                        reg = <0 0xe6060000 0 0x250>;
                };
index 597848a..f5b299b 100644 (file)
                        resets = <&cpg 913>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a7792";
                        reg = <0 0xe6060000 0 0x144>;
                };
index 6d50709..f930f69 100644 (file)
                        resets = <&cpg 904>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a7793";
                        reg = <0 0xe6060000 0 0x250>;
                };
index 5f34039..cd5e290 100644 (file)
                        resets = <&cpg 905>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a7794";
                        reg = <0 0xe6060000 0 0x11c>;
                };
index ee59cc8..c47896e 100644 (file)
                        status = "disabled";
                };
 
-               pinctrl: pin-controller@40067000 {
+               pinctrl: pinctrl@40067000 {
                        compatible = "renesas,r9a06g032-pinctrl", "renesas,rzn1-pinctrl";
                        reg = <0x40067000 0x1000>, <0x51000000 0x480>;
                        clocks = <&sysctrl R9A06G032_HCLK_PINCONFIG>;
index 0a56a2f..eba7a13 100644 (file)
 };
 
 &cpu0 {
-       cpu0-supply = <&vdd_arm>;
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu1 {
+       cpu-supply = <&vdd_arm>;
 };
 
 &i2c1 {
index 7e01f64..6b12165 100644 (file)
 };
 
 &cpu0 {
-       cpu0-supply = <&vdd_arm>;
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu1 {
+       cpu-supply = <&vdd_arm>;
 };
 
 &i2c1 {
index f9db6bb..3095184 100644 (file)
 };
 
 &cpu0 {
-       cpu0-supply = <&vdd_arm>;
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu1 {
+       cpu-supply = <&vdd_arm>;
 };
 
 &emac {
index b599394..252750c 100644 (file)
@@ -36,7 +36,7 @@
                        clock-latency = <40000>;
                        clocks = <&cru ARMCLK>;
                };
-               cpu@1 {
+               cpu1: cpu@1 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a9";
                        next-level-cache = <&L2>;
index 018802d..c4ca73b 100644 (file)
        pinctrl-0 = <&rgmii_pins>;
        tx_delay = <0x30>;
        rx_delay = <0x10>;
-       status = "ok";
+       status = "okay";
 };
 
 &gpu {
index 61435d8..36efa36 100644 (file)
@@ -61,7 +61,7 @@
        snps,reset-gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_LOW>;
        tx_delay = <0x30>;
        rx_delay = <0x10>;
-       status = "ok";
+       status = "okay";
 };
 
 &i2c0 {
index e5c4fd4..7fb5823 100644 (file)
        snps,reset-gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_LOW>;
        tx_delay = <0x30>;
        rx_delay = <0x10>;
-       status = "ok";
+       status = "okay";
 };
 
 &gpu {
index 213c9eb..cf54d5f 100644 (file)
 };
 
 &cpu0 {
-       cpu0-supply = <&vdd_cpu>;
+       cpu-supply = <&vdd_cpu>;
+};
+
+&cpu1 {
+       cpu-supply = <&vdd_cpu>;
+};
+
+&cpu2 {
+       cpu-supply = <&vdd_cpu>;
+};
+
+&cpu3 {
+       cpu-supply = <&vdd_cpu>;
 };
 
 &emmc {
        snps,reset-gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_LOW>;
        tx_delay = <0x30>;
        rx_delay = <0x10>;
-       status = "ok";
+       status = "okay";
 };
 
 &hdmi {
index 6a51940..8c7376d 100644 (file)
 };
 
 &cpu0 {
-       cpu0-supply = <&vdd_cpu>;
+       cpu-supply = <&vdd_cpu>;
+};
+
+&cpu1 {
+       cpu-supply = <&vdd_cpu>;
+};
+
+&cpu2 {
+       cpu-supply = <&vdd_cpu>;
+};
+
+&cpu3 {
+       cpu-supply = <&vdd_cpu>;
 };
 
 &emmc {
        pinctrl-0 = <&rgmii_pins>;
        tx_delay = <0x30>;
        rx_delay = <0x10>;
-       status = "ok";
+       status = "okay";
 };
 
 &hdmi {
index a258c7a..55467bc 100644 (file)
 };
 
 &cpu0 {
-       cpu0-supply = <&vdd_cpu>;
+       cpu-supply = <&vdd_cpu>;
+};
+
+&cpu1 {
+       cpu-supply = <&vdd_cpu>;
+};
+
+&cpu2 {
+       cpu-supply = <&vdd_cpu>;
+};
+
+&cpu3 {
+       cpu-supply = <&vdd_cpu>;
 };
 
 &gmac {
        pinctrl-0 = <&rgmii_pins>;
        tx_delay = <0x30>;
        rx_delay = <0x10>;
-       status = "ok";
+       status = "okay";
 };
 
 &hdmi {
index 3cca4d0..c4d1d14 100644 (file)
 };
 
 &gmac {
-       status = "ok";
+       status = "okay";
 };
 
 &hdmi {
index 90e9be4..9c1e38c 100644 (file)
        snps,reset-delays-us = <0 10000 1000000>;
        tx_delay = <0x30>;
        rx_delay = <0x10>;
-       status = "ok";
+       status = "okay";
 };
 
 &gpu {
index 1a20854..aa50f8e 100644 (file)
 };
 
 &cpu0 {
-       cpu0-supply = <&vdd_cpu>;
+       cpu-supply = <&vdd_cpu>;
+};
+
+&cpu1 {
+       cpu-supply = <&vdd_cpu>;
+};
+
+&cpu2 {
+       cpu-supply = <&vdd_cpu>;
+};
+
+&cpu3 {
+       cpu-supply = <&vdd_cpu>;
 };
 
 &emmc {
index 811bfde..47626ed 100644 (file)
                reg =  <0x30000000 0x4000000>;
        };
 
-       clocks {
-               compatible = "simple-bus";
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               xti: xti@0 {
-                       compatible = "fixed-clock";
-                       reg = <0>;
-                       clock-frequency = <12000000>;
-                       clock-output-names = "xti";
-                       #clock-cells = <0>;
-               };
+       xti: clock-0 {
+               compatible = "fixed-clock";
+               clock-frequency = <12000000>;
+               clock-output-names = "xti";
+               #clock-cells = <0>;
        };
 };
 
index 6adf64e..4f084f4 100644 (file)
        };
 
        cpus {
-               cpu {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       device_type = "cpu";
                        compatible = "arm,arm926ej-s";
+                       reg = <0x0>;
                };
        };
 
-       interrupt-controller@4a000000 {
-               compatible = "samsung,s3c2416-irq";
-       };
-
        clocks: clock-controller@4c000000 {
                compatible = "samsung,s3c2416-clock";
                reg = <0x4c000000 0x40>;
                #clock-cells = <1>;
        };
 
-       pinctrl@56000000 {
-               compatible = "samsung,s3c2416-pinctrl";
-       };
-
-       timer@51000000 {
-               clocks = <&clocks PCLK_PWM>;
-               clock-names = "timers";
-       };
-
-       uart_0: serial@50000000 {
-               compatible = "samsung,s3c2440-uart";
-               clock-names = "uart", "clk_uart_baud2",
-                               "clk_uart_baud3";
-               clocks = <&clocks PCLK_UART0>, <&clocks PCLK_UART0>,
-                               <&clocks SCLK_UART>;
-       };
-
-       uart_1: serial@50004000 {
-               compatible = "samsung,s3c2440-uart";
-               clock-names = "uart", "clk_uart_baud2",
-                               "clk_uart_baud3";
-               clocks = <&clocks PCLK_UART1>, <&clocks PCLK_UART1>,
-                               <&clocks SCLK_UART>;
-       };
-
-       uart_2: serial@50008000 {
-               compatible = "samsung,s3c2440-uart";
-               clock-names = "uart", "clk_uart_baud2",
-                               "clk_uart_baud3";
-               clocks = <&clocks PCLK_UART2>, <&clocks PCLK_UART2>,
-                               <&clocks SCLK_UART>;
-       };
-
        uart_3: serial@5000c000 {
                compatible = "samsung,s3c2440-uart";
                reg = <0x5000C000 0x4000>;
                                <&clocks MUX_HSMMC1>;
                status = "disabled";
        };
+};
 
-       watchdog: watchdog@53000000 {
-               interrupts = <1 9 27 3>;
-               clocks = <&clocks PCLK_WDT>;
-               clock-names = "watchdog";
-       };
+&i2c {
+       compatible = "samsung,s3c2440-i2c";
+       clocks = <&clocks PCLK_I2C0>;
+       clock-names = "i2c";
+};
 
-       rtc: rtc@57000000 {
-               compatible = "samsung,s3c2416-rtc";
-               clocks = <&clocks PCLK_RTC>;
-               clock-names = "rtc";
-       };
+&intc {
+       compatible = "samsung,s3c2416-irq";
+};
 
-       i2c@54000000 {
-               compatible = "samsung,s3c2440-i2c";
-               clocks = <&clocks PCLK_I2C0>;
-               clock-names = "i2c";
-       };
+&pinctrl_0 {
+       compatible = "samsung,s3c2416-pinctrl";
+};
+
+&rtc {
+       compatible = "samsung,s3c2416-rtc";
+       clocks = <&clocks PCLK_RTC>;
+       clock-names = "rtc";
+};
+
+&timer {
+       clocks = <&clocks PCLK_PWM>;
+       clock-names = "timers";
+};
+
+&uart_0 {
+       compatible = "samsung,s3c2440-uart";
+       clock-names = "uart", "clk_uart_baud2",
+                       "clk_uart_baud3";
+       clocks = <&clocks PCLK_UART0>, <&clocks PCLK_UART0>,
+                       <&clocks SCLK_UART>;
+};
+
+&uart_1 {
+       compatible = "samsung,s3c2440-uart";
+       clock-names = "uart", "clk_uart_baud2",
+                       "clk_uart_baud3";
+       clocks = <&clocks PCLK_UART1>, <&clocks PCLK_UART1>,
+                       <&clocks SCLK_UART>;
+};
+
+&uart_2 {
+       compatible = "samsung,s3c2440-uart";
+       clock-names = "uart", "clk_uart_baud2",
+                       "clk_uart_baud3";
+       clocks = <&clocks PCLK_UART2>, <&clocks PCLK_UART2>,
+                       <&clocks SCLK_UART>;
+};
+
+&watchdog {
+       interrupts = <1 9 27 3>;
+       clocks = <&clocks PCLK_WDT>;
+       clock-names = "watchdog";
 };
index 6d8dd3c..06f82c7 100644 (file)
 
        aliases {
                pinctrl0 = &pinctrl_0;
-               serial0 = &uart0;
-               serial1 = &uart1;
-               serial2 = &uart2;
+               serial0 = &uart_0;
+               serial1 = &uart_1;
+               serial2 = &uart_2;
        };
 
-       intc:interrupt-controller@4a000000 {
+       intc: interrupt-controller@4a000000 {
                compatible = "samsung,s3c2410-irq";
                reg = <0x4a000000 0x100>;
                interrupt-controller;
                };
        };
 
-       timer@51000000 {
+       timer: pwm@51000000 {
                compatible = "samsung,s3c2410-pwm";
                reg = <0x51000000 0x1000>;
                interrupts = <0 0 10 3>, <0 0 11 3>, <0 0 12 3>, <0 0 13 3>, <0 0 14 3>;
-               #pwm-cells = <4>;
+               #pwm-cells = <3>;
        };
 
-       uart0: serial@50000000 {
+       uart_0: serial@50000000 {
                compatible = "samsung,s3c2410-uart";
                reg = <0x50000000 0x4000>;
                interrupts = <1 28 0 4>, <1 28 1 4>;
                status = "disabled";
        };
 
-       uart1: serial@50004000 {
+       uart_1: serial@50004000 {
                compatible = "samsung,s3c2410-uart";
                reg = <0x50004000 0x4000>;
                interrupts = <1 23 3 4>, <1 23 4 4>;
                status = "disabled";
        };
 
-       uart2: serial@50008000 {
+       uart_2: serial@50008000 {
                compatible = "samsung,s3c2410-uart";
                reg = <0x50008000 0x4000>;
                interrupts = <1 15 6 4>, <1 15 7 4>;
                status = "disabled";
        };
 
-       watchdog@53000000 {
+       watchdog: watchdog@53000000 {
                compatible = "samsung,s3c2410-wdt";
                reg = <0x53000000 0x100>;
                interrupts = <0 0 9 3>;
                status = "disabled";
        };
 
-       rtc@57000000 {
+       rtc: rtc@57000000 {
                compatible = "samsung,s3c2410-rtc";
                reg = <0x57000000 0x100>;
                interrupts = <0 0 30 3>, <0 0 8 3>;
                status = "disabled";
        };
 
-       i2c@54000000 {
+       i2c: i2c@54000000 {
                compatible = "samsung,s3c2410-i2c";
                reg = <0x54000000 0x100>;
                interrupts = <0 0 27 3>;
index 1aeac33..285555b 100644 (file)
                bootargs = "console=ttySAC0,115200n8 earlyprintk rootwait root=/dev/mmcblk0p1";
        };
 
-       clocks {
-               compatible = "simple-bus";
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               fin_pll: oscillator@0 {
-                       compatible = "fixed-clock";
-                       reg = <0>;
-                       clock-frequency = <12000000>;
-                       clock-output-names = "fin_pll";
-                       #clock-cells = <0>;
-               };
+       fin_pll: oscillator-0 {
+               compatible = "fixed-clock";
+               clock-frequency = <12000000>;
+               clock-output-names = "fin_pll";
+               #clock-cells = <0>;
+       };
 
-               xusbxti: oscillator@1 {
-                       compatible = "fixed-clock";
-                       reg = <1>;
-                       clock-output-names = "xusbxti";
-                       clock-frequency = <48000000>;
-                       #clock-cells = <0>;
-               };
+       xusbxti: oscillator-1 {
+               compatible = "fixed-clock";
+               clock-output-names = "xusbxti";
+               clock-frequency = <48000000>;
+               #clock-cells = <0>;
        };
 
-       srom-cs1@18000000 {
+       srom-cs1-bus@18000000 {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <1>;
index 96267f5..69c9ec4 100644 (file)
                bootargs = "console=ttySAC0,115200n8 earlyprintk rootwait root=/dev/mmcblk0p1";
        };
 
-       clocks {
-               compatible = "simple-bus";
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               fin_pll: oscillator@0 {
-                       compatible = "fixed-clock";
-                       reg = <0>;
-                       clock-frequency = <12000000>;
-                       clock-output-names = "fin_pll";
-                       #clock-cells = <0>;
-               };
+       fin_pll: oscillator-0 {
+               compatible = "fixed-clock";
+               clock-frequency = <12000000>;
+               clock-output-names = "fin_pll";
+               #clock-cells = <0>;
+       };
 
-               xusbxti: oscillator@1 {
-                       compatible = "fixed-clock";
-                       reg = <1>;
-                       clock-output-names = "xusbxti";
-                       clock-frequency = <48000000>;
-                       #clock-cells = <0>;
-               };
+       xusbxti: oscillator-1 {
+               compatible = "fixed-clock";
+               clock-output-names = "xusbxti";
+               clock-frequency = <48000000>;
+               #clock-cells = <0>;
        };
 
-       srom-cs1@18000000 {
+       srom-cs1-bus@18000000 {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <1>;
index 2e611df..cb11a87 100644 (file)
@@ -34,7 +34,7 @@
 
                cpu@0 {
                        device_type = "cpu";
-                       compatible = "arm,arm1176jzf-s", "arm,arm1176";
+                       compatible = "arm,arm1176jzf-s";
                        reg = <0x0>;
                };
        };
index 14969b6..8e57e5a 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include "s5pv210.dtsi"
 
                        0x40000000 0x18000000>;
        };
 
-       regulators {
-               compatible = "simple-bus";
-               #address-cells = <1>;
-               #size-cells = <0>;
+       pmic_ap_clk: clock-0 {
+               /* Workaround for missing clock on PMIC */
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+       };
 
-               vtf_reg: fixed-regulator@0 {
-                       compatible = "regulator-fixed";
-                       reg = <0>;
-                       regulator-name = "V_TF_2.8V";
-                       regulator-min-microvolt = <2800000>;
-                       regulator-max-microvolt = <2800000>;
-                       gpio = <&mp05 4 0>;
-                       enable-active-high;
-               };
+       vtf_reg: regulator-0 {
+               compatible = "regulator-fixed";
+               regulator-name = "V_TF_2.8V";
+               regulator-min-microvolt = <2800000>;
+               regulator-max-microvolt = <2800000>;
+               gpio = <&mp05 4 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
 
-               pda_reg: fixed-regulator@1 {
-                       compatible = "regulator-fixed";
-                       regulator-name = "VCC_1.8V_PDA";
-                       regulator-min-microvolt = <1800000>;
-                       regulator-max-microvolt = <1800000>;
-                       reg = <1>;
-               };
+       pda_reg: regulator-1 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_1.8V_PDA";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+       };
 
-               bat_reg: fixed-regulator@2 {
-                       compatible = "regulator-fixed";
-                       regulator-name = "V_BAT";
-                       regulator-min-microvolt = <3700000>;
-                       regulator-max-microvolt = <3700000>;
-                       reg = <2>;
-               };
+       bat_reg: regulator-2 {
+               compatible = "regulator-fixed";
+               regulator-name = "V_BAT";
+               regulator-min-microvolt = <3700000>;
+               regulator-max-microvolt = <3700000>;
        };
 
        i2c_pmic: i2c-pmic {
                compatible = "i2c-gpio";
-               gpios = <&gpj4 0 0>, /* sda */
-                       <&gpj4 3 0>; /* scl */
+               sda-gpios = <&gpj4 0 GPIO_ACTIVE_HIGH>;
+               scl-gpios = <&gpj4 3 GPIO_ACTIVE_HIGH>;
                i2c-gpio,delay-us = <2>;        /* ~100 kHz */
                #address-cells = <1>;
                #size-cells = <0>;
                        reg = <0x66>;
 
                        max8998,pmic-buck1-default-dvs-idx = <0>;
-                       max8998,pmic-buck1-dvs-gpios = <&gph0 3 0>,
-                                                       <&gph0 4 0>;
+                       max8998,pmic-buck1-dvs-gpios = <&gph0 3 GPIO_ACTIVE_HIGH>,
+                                                       <&gph0 4 GPIO_ACTIVE_HIGH>;
                        max8998,pmic-buck1-dvs-voltage = <1200000>, <1200000>,
                                                        <1200000>, <1200000>;
 
                        max8998,pmic-buck2-default-dvs-idx = <0>;
-                       max8998,pmic-buck2-dvs-gpio = <&gph0 5 0>;
+                       max8998,pmic-buck2-dvs-gpio = <&gph0 5 GPIO_ACTIVE_HIGH>;
                        max8998,pmic-buck2-dvs-voltage = <1200000>, <1200000>;
 
                        regulators {
                                        regulator-always-on;
                                };
 
+                               ap32khz_reg: EN32KHz-AP {
+                                       regulator-name = "32KHz AP";
+                                       regulator-always-on;
+                               };
+
                                vichg_reg: ENVICHG {
                                        regulator-name = "VICHG";
                                };
        status = "okay";
 };
 
+&rtc {
+       clocks = <&clocks CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
+};
+
 &sdhci0 {
        bus-width = <4>;
        non-removable;
index 822207f..bd4450d 100644 (file)
                };
        };
 
+       pmic_ap_clk: clock-0 {
+               /* Workaround for missing clock on PMIC */
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+       };
+
+       bt_codec: bt_sco {
+               compatible = "linux,bt-sco";
+               #sound-dai-cells = <0>;
+       };
+
        vibrator_pwr: regulator-fixed-0 {
                compatible = "regulator-fixed";
                regulator-name = "vibrator-en";
@@ -54,7 +66,7 @@
                gpio = <&gpj1 1 GPIO_ACTIVE_HIGH>;
 
                pinctrl-names = "default";
-               pinctr-0 = <&vibrator_ena>;
+               pinctrl-0 = <&vibrator_ena>;
        };
 
        touchkey_vdd: regulator-fixed-1 {
                value = <0x5200>;
        };
 
-       spi_lcd: spi-gpio-0 {
+       spi_lcd: spi-2 {
                compatible = "spi-gpio";
                #address-cells = <1>;
                #size-cells = <0>;
        };
 };
 
+&i2s0 {
+       dmas = <&pdma0 9>, <&pdma0 10>, <&pdma0 11>;
+       status = "okay";
+};
+
 &mfc {
        memory-region = <&mfc_left>, <&mfc_right>;
 };
        samsung,pwm-outputs = <1>;
 };
 
+&rtc {
+       clocks = <&clocks CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
+};
+
 &sdhci1 {
        #address-cells = <1>;
        #size-cells = <0>;
index 65eed01..ca06435 100644 (file)
                        linux,code = <KEY_VOLUMEUP>;
                };
        };
+
+       headset_micbias_reg: regulator-fixed-3 {
+               compatible = "regulator-fixed";
+               regulator-name = "Headset_Micbias";
+               gpio = <&gpj2 5 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&headset_micbias_ena>;
+       };
+
+       main_micbias_reg: regulator-fixed-4 {
+               compatible = "regulator-fixed";
+               regulator-name = "Main_Micbias";
+               gpio = <&gpj4 2 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&main_micbias_ena>;
+       };
+
+       sound {
+               compatible = "samsung,fascinate4g-wm8994";
+
+               model = "Fascinate4G";
+
+               extcon = <&fsa9480>;
+
+               main-micbias-supply = <&main_micbias_reg>;
+               headset-micbias-supply = <&headset_micbias_reg>;
+
+               earpath-sel-gpios = <&gpj2 6 GPIO_ACTIVE_HIGH>;
+
+               io-channels = <&adc 3>;
+               io-channel-names = "headset-detect";
+               headset-detect-gpios = <&gph0 6 GPIO_ACTIVE_HIGH>;
+               headset-key-gpios = <&gph3 6 GPIO_ACTIVE_HIGH>;
+
+               samsung,audio-routing =
+                       "HP", "HPOUT1L",
+                       "HP", "HPOUT1R",
+
+                       "SPK", "SPKOUTLN",
+                       "SPK", "SPKOUTLP",
+
+                       "RCV", "HPOUT2N",
+                       "RCV", "HPOUT2P",
+
+                       "LINE", "LINEOUT2N",
+                       "LINE", "LINEOUT2P",
+
+                       "IN1LP", "Main Mic",
+                       "IN1LN", "Main Mic",
+
+                       "IN1RP", "Headset Mic",
+                       "IN1RN", "Headset Mic",
+
+                       "Modem Out", "Modem TX",
+                       "Modem RX", "Modem In",
+
+                       "Bluetooth SPK", "TX",
+                       "RX", "Bluetooth Mic";
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&headset_det &earpath_sel>;
+
+               cpu {
+                       sound-dai = <&i2s0>, <&bt_codec>;
+               };
+
+               codec {
+                       sound-dai = <&wm8994>;
+               };
+       };
 };
 
 &fg {
        pinctrl-names = "default";
        pinctrl-0 = <&sleep_cfg>;
 
+       headset_det: headset-det {
+               samsung,pins = "gph0-6", "gph3-6";
+               samsung,pin-function = <EXYNOS_PIN_FUNC_F>;
+               samsung,pin-pud = <S3C64XX_PIN_PULL_NONE>;
+       };
+
        fg_irq: fg-irq {
                samsung,pins = "gph3-3";
                samsung,pin-function = <EXYNOS_PIN_FUNC_F>;
                samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
        };
 
+       headset_micbias_ena: headset-micbias-ena {
+               samsung,pins = "gpj2-5";
+               samsung,pin-pud = <S3C64XX_PIN_PULL_NONE>;
+               samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
+       };
+
+       earpath_sel: earpath-sel {
+               samsung,pins = "gpj2-6";
+               samsung,pin-pud = <S3C64XX_PIN_PULL_NONE>;
+               samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
+       };
+
+       main_micbias_ena: main-micbias-ena {
+               samsung,pins = "gpj4-2";
+               samsung,pin-pud = <S3C64XX_PIN_PULL_NONE>;
+               samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
+       };
+
        /* Based on vendor kernel v2.6.35.7 */
        sleep_cfg: sleep-cfg {
                PIN_SLP(gpa0-0, PREV, NONE);
index 5d10dd6..560f830 100644 (file)
                        pinctrl-0 = <&fm_irq &fm_rst>;
                };
        };
+
+       micbias_reg: regulator-fixed-3 {
+               compatible = "regulator-fixed";
+               regulator-name = "MICBIAS";
+               gpio = <&gpj4 2 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&micbias_reg_ena>;
+       };
+
+       sound {
+               compatible = "samsung,aries-wm8994";
+
+               model = "Aries";
+
+               extcon = <&fsa9480>;
+
+               main-micbias-supply = <&micbias_reg>;
+               headset-micbias-supply = <&micbias_reg>;
+
+               earpath-sel-gpios = <&gpj2 6 GPIO_ACTIVE_HIGH>;
+
+               io-channels = <&adc 3>;
+               io-channel-names = "headset-detect";
+               headset-detect-gpios = <&gph0 6 GPIO_ACTIVE_LOW>;
+               headset-key-gpios = <&gph3 6 GPIO_ACTIVE_HIGH>;
+
+               samsung,audio-routing =
+                       "HP", "HPOUT1L",
+                       "HP", "HPOUT1R",
+
+                       "SPK", "SPKOUTLN",
+                       "SPK", "SPKOUTLP",
+
+                       "RCV", "HPOUT2N",
+                       "RCV", "HPOUT2P",
+
+                       "LINE", "LINEOUT2N",
+                       "LINE", "LINEOUT2P",
+
+                       "IN1LP", "Main Mic",
+                       "IN1LN", "Main Mic",
+
+                       "IN1RP", "Headset Mic",
+                       "IN1RN", "Headset Mic",
+
+                       "IN2LN", "FM In",
+                       "IN2RN", "FM In",
+
+                       "Modem Out", "Modem TX",
+                       "Modem RX", "Modem In",
+
+                       "Bluetooth SPK", "TX",
+                       "RX", "Bluetooth Mic";
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&headset_det &earpath_sel>;
+
+               cpu {
+                       sound-dai = <&i2s0>, <&bt_codec>;
+               };
+
+               codec {
+                       sound-dai = <&wm8994>;
+               };
+       };
 };
 
 &aliases {
                samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
        };
 
+       headset_det: headset-det {
+               samsung,pins = "gph0-6", "gph3-6";
+               samsung,pin-function = <EXYNOS_PIN_FUNC_F>;
+               samsung,pin-pud = <S3C64XX_PIN_PULL_NONE>;
+       };
+
        fm_irq: fm-irq {
                samsung,pins = "gpj2-4";
                samsung,pin-function = <EXYNOS_PIN_FUNC_INPUT>;
                samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
        };
 
+       earpath_sel: earpath-sel {
+               samsung,pins = "gpj2-6";
+               samsung,pin-pud = <S3C64XX_PIN_PULL_NONE>;
+               samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
+       };
+
        massmemory_en: massmemory-en {
                samsung,pins = "gpj2-7";
                samsung,pin-function = <EXYNOS_PIN_FUNC_OUTPUT>;
                samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
        };
 
+       micbias_reg_ena: micbias-reg-ena {
+               samsung,pins = "gpj4-2";
+               samsung,pin-pud = <S3C64XX_PIN_PULL_NONE>;
+               samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
+       };
+
        /* Based on CyanogenMod 3.0.101 kernel */
        sleep_cfg: sleep-cfg {
                PIN_SLP(gpa0-0, PREV, NONE);
index fbbd937..ad8d5d2 100644 (file)
@@ -11,6 +11,8 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/input/input.h>
 #include "s5pv210.dtsi"
 
                        0x50000000 0x08000000>;
        };
 
-       regulators {
-               compatible = "simple-bus";
-               #address-cells = <1>;
-               #size-cells = <0>;
+       pmic_ap_clk: clock-0 {
+               /* Workaround for missing clock on PMIC */
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+       };
 
-               vtf_reg: fixed-regulator@0 {
-                       compatible = "regulator-fixed";
-                       regulator-name = "V_TF_2.8V";
-                       regulator-min-microvolt = <2800000>;
-                       regulator-max-microvolt = <2800000>;
-                       reg = <0>;
-                       gpio = <&mp05 4 0>;
-                       enable-active-high;
-               };
+       vtf_reg: regulator-0 {
+               compatible = "regulator-fixed";
+               regulator-name = "V_TF_2.8V";
+               regulator-min-microvolt = <2800000>;
+               regulator-max-microvolt = <2800000>;
+               gpio = <&mp05 4 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
 
-               pda_reg: fixed-regulator@1 {
-                       compatible = "regulator-fixed";
-                       regulator-name = "VCC_1.8V_PDA";
-                       regulator-min-microvolt = <1800000>;
-                       regulator-max-microvolt = <1800000>;
-                       reg = <1>;
-               };
+       pda_reg: regulator-1 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_1.8V_PDA";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+       };
 
-               bat_reg: fixed-regulator@2 {
-                       compatible = "regulator-fixed";
-                       regulator-name = "V_BAT";
-                       regulator-min-microvolt = <3700000>;
-                       regulator-max-microvolt = <3700000>;
-                       reg = <2>;
-               };
+       bat_reg: regulator-2 {
+               compatible = "regulator-fixed";
+               regulator-name = "V_BAT";
+               regulator-min-microvolt = <3700000>;
+               regulator-max-microvolt = <3700000>;
+       };
 
-               tsp_reg: fixed-regulator@3 {
-                       compatible = "regulator-fixed";
-                       regulator-name = "TSP_VDD";
-                       regulator-min-microvolt = <2800000>;
-                       regulator-max-microvolt = <2800000>;
-                       reg = <3>;
-                       gpio = <&gpj1 3 0>;
-                       enable-active-high;
-               };
+       tsp_reg: regulator-3 {
+               compatible = "regulator-fixed";
+               regulator-name = "TSP_VDD";
+               regulator-min-microvolt = <2800000>;
+               regulator-max-microvolt = <2800000>;
+               gpio = <&gpj1 3 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
        };
 
        i2c_pmic: i2c-pmic {
                compatible = "i2c-gpio";
-               gpios = <&gpj4 0 0>, /* sda */
-                       <&gpj4 3 0>; /* scl */
+               sda-gpios = <&gpj4 0 GPIO_ACTIVE_HIGH>;
+               scl-gpios = <&gpj4 3 GPIO_ACTIVE_HIGH>;
                i2c-gpio,delay-us = <2>;        /* ~100 kHz */
                #address-cells = <1>;
                #size-cells = <0>;
                        reg = <0x66>;
 
                        max8998,pmic-buck1-default-dvs-idx = <0>;
-                       max8998,pmic-buck1-dvs-gpios = <&gph0 3 0>,
-                                                       <&gph0 4 0>;
+                       max8998,pmic-buck1-dvs-gpios = <&gph0 3 GPIO_ACTIVE_HIGH>,
+                                                       <&gph0 4 GPIO_ACTIVE_HIGH>;
                        max8998,pmic-buck1-dvs-voltage = <1200000>, <1200000>,
                                                        <1200000>, <1200000>;
 
                        max8998,pmic-buck2-default-dvs-idx = <0>;
-                       max8998,pmic-buck2-dvs-gpio = <&gph0 5 0>;
+                       max8998,pmic-buck2-dvs-gpio = <&gph0 5 GPIO_ACTIVE_HIGH>;
                        max8998,pmic-buck2-dvs-voltage = <1200000>, <1200000>;
 
                        regulators {
                                        regulator-max-microvolt = <1200000>;
                                        regulator-always-on;
                                };
+
+                               ap32khz_reg: EN32KHz-AP {
+                                       regulator-name = "32KHz AP";
+                                       regulator-always-on;
+                               };
                        };
                };
        };
        status = "okay";
 };
 
+&rtc {
+       clocks = <&clocks CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
+};
+
 &sdhci0 {
        bus-width = <4>;
        non-removable;
                compatible = "atmel,maxtouch";
                reg = <0x4a>;
                interrupt-parent = <&gpj0>;
-               interrupts = <5 2>;
+               interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
 
                atmel,x-line = <17>;
                atmel,y-line = <11>;
                clock-frequency = <16000000>;
                clocks = <&camera 0>;
                clock-names = "mclk";
-               nreset-gpios = <&gpb 2 0>;
-               nstby-gpios = <&gpb 0 0>;
+               nreset-gpios = <&gpb 2 GPIO_ACTIVE_HIGH>;
+               nstby-gpios = <&gpb 0 GPIO_ACTIVE_HIGH>;
 
                port {
                        noon010pc30_ep: endpoint {
index e5aec6c..0c623b7 100644 (file)
                device_type = "memory";
                reg = <0x20000000 0x20000000>;
        };
+
+       pmic_ap_clk: clock-0 {
+               /* Workaround for missing PMIC and its clock */
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+       };
 };
 
 &xusbxti {
@@ -54,6 +61,8 @@
 
 &rtc {
        status = "okay";
+       clocks = <&clocks CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
 };
 
 &i2c0 {
index 84b38f1..7459e41 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/input/input.h>
 #include "s5pv210.dtsi"
 
                reg = <0x20000000 0x40000000>;
        };
 
-       ethernet@18000000 {
+       pmic_ap_clk: clock-0 {
+               /* Workaround for missing PMIC and its clock */
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+       };
+
+       ethernet@a8000000 {
                compatible = "davicom,dm9000";
                reg = <0xA8000000 0x2 0xA8000002 0x2>;
                interrupt-parent = <&gph1>;
-               interrupts = <1 4>;
+               interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
                local-mac-address = [00 00 de ad be ef];
                davicom,no-eeprom;
        };
 
 &rtc {
        status = "okay";
+       clocks = <&clocks CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
 };
 
 &sdhci0 {
index cd25e72..e182597 100644 (file)
                device_type = "memory";
                reg = <0x20000000 0x20000000>;
        };
+
+       pmic_ap_clk: clock-0 {
+               /* Workaround for missing PMIC and its clock */
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+       };
 };
 
 &xusbxti {
@@ -54,6 +61,8 @@
 
 &rtc {
        status = "okay";
+       clocks = <&clocks CLK_RTC>, <&pmic_ap_clk>;
+       clock-names = "rtc", "rtc_src";
 };
 
 &sdhci0 {
index 1b0ee88..2871351 100644 (file)
                };
        };
 
+       xxti: oscillator-0 {
+               compatible = "fixed-clock";
+               clock-frequency = <0>;
+               clock-output-names = "xxti";
+               #clock-cells = <0>;
+       };
+
+       xusbxti: oscillator-1 {
+               compatible = "fixed-clock";
+               clock-frequency = <0>;
+               clock-output-names = "xusbxti";
+               #clock-cells = <0>;
+       };
+
        soc {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <1>;
                ranges;
 
-               external-clocks {
-                       compatible = "simple-bus";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-
-                       xxti: oscillator@0 {
-                               compatible = "fixed-clock";
-                               reg = <0>;
-                               clock-frequency = <0>;
-                               clock-output-names = "xxti";
-                               #clock-cells = <0>;
-                       };
-
-                       xusbxti: oscillator@1 {
-                               compatible = "fixed-clock";
-                               reg = <1>;
-                               clock-frequency = <0>;
-                               clock-output-names = "xusbxti";
-                               #clock-cells = <0>;
-                       };
-               };
-
                onenand: onenand@b0600000 {
                        compatible = "samsung,s5pv210-onenand";
                        reg = <0xb0600000 0x2000>,
                };
 
                clocks: clock-controller@e0100000 {
-                       compatible = "samsung,s5pv210-clock", "simple-bus";
+                       compatible = "samsung,s5pv210-clock";
                        reg = <0xe0100000 0x10000>;
                        clock-names = "xxti", "xusbxti";
                        clocks = <&xxti>, <&xusbxti>;
                        #clock-cells = <1>;
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       ranges;
+               };
 
-                       pmu_syscon: syscon@e0108000 {
-                               compatible = "samsung-s5pv210-pmu", "syscon";
-                               reg = <0xe0108000 0x8000>;
-                       };
+               pmu_syscon: syscon@e0108000 {
+                       compatible = "samsung-s5pv210-pmu", "syscon";
+                       reg = <0xe0108000 0x8000>;
                };
 
                pinctrl0: pinctrl@e0200000 {
                        };
                };
 
-               amba {
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       compatible = "simple-bus";
-                       ranges;
-
-                       pdma0: dma@e0900000 {
-                               compatible = "arm,pl330", "arm,primecell";
-                               reg = <0xe0900000 0x1000>;
-                               interrupt-parent = <&vic0>;
-                               interrupts = <19>;
-                               clocks = <&clocks CLK_PDMA0>;
-                               clock-names = "apb_pclk";
-                               #dma-cells = <1>;
-                               #dma-channels = <8>;
-                               #dma-requests = <32>;
-                       };
+               pdma0: dma@e0900000 {
+                       compatible = "arm,pl330", "arm,primecell";
+                       reg = <0xe0900000 0x1000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <19>;
+                       clocks = <&clocks CLK_PDMA0>;
+                       clock-names = "apb_pclk";
+                       #dma-cells = <1>;
+                       #dma-channels = <8>;
+                       #dma-requests = <32>;
+               };
 
-                       pdma1: dma@e0a00000 {
-                               compatible = "arm,pl330", "arm,primecell";
-                               reg = <0xe0a00000 0x1000>;
-                               interrupt-parent = <&vic0>;
-                               interrupts = <20>;
-                               clocks = <&clocks CLK_PDMA1>;
-                               clock-names = "apb_pclk";
-                               #dma-cells = <1>;
-                               #dma-channels = <8>;
-                               #dma-requests = <32>;
-                       };
+               pdma1: dma@e0a00000 {
+                       compatible = "arm,pl330", "arm,primecell";
+                       reg = <0xe0a00000 0x1000>;
+                       interrupt-parent = <&vic0>;
+                       interrupts = <20>;
+                       clocks = <&clocks CLK_PDMA1>;
+                       clock-names = "apb_pclk";
+                       #dma-cells = <1>;
+                       #dma-channels = <8>;
+                       #dma-requests = <32>;
                };
 
                adc: adc@e1700000 {
                        status = "disabled";
                };
 
-               audio-subsystem {
-                       compatible = "samsung,s5pv210-audss", "simple-bus";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       ranges;
-
-                       clk_audss: clock-controller@eee10000 {
-                               compatible = "samsung,s5pv210-audss-clock";
-                               reg = <0xeee10000 0x1000>;
-                               clock-names = "hclk", "xxti",
-                                               "fout_epll",
-                                               "sclk_audio0";
-                               clocks = <&clocks DOUT_HCLKP>, <&xxti>,
-                                               <&clocks FOUT_EPLL>,
-                                               <&clocks SCLK_AUDIO0>;
-                               #clock-cells = <1>;
-                       };
+               clk_audss: clock-controller@eee10000 {
+                       compatible = "samsung,s5pv210-audss-clock";
+                       reg = <0xeee10000 0x1000>;
+                       clock-names = "hclk", "xxti",
+                                     "fout_epll",
+                                     "sclk_audio0";
+                       clocks = <&clocks DOUT_HCLKP>, <&xxti>,
+                                <&clocks FOUT_EPLL>,
+                                <&clocks SCLK_AUDIO0>;
+                       #clock-cells = <1>;
+               };
 
-                       i2s0: i2s@eee30000 {
-                               compatible = "samsung,s5pv210-i2s";
-                               reg = <0xeee30000 0x1000>;
-                               interrupt-parent = <&vic2>;
-                               interrupts = <16>;
-                               dma-names = "rx", "tx", "tx-sec";
-                               dmas = <&pdma1 9>, <&pdma1 10>, <&pdma1 11>;
-                               clock-names = "iis",
-                                               "i2s_opclk0",
-                                               "i2s_opclk1";
-                               clocks = <&clk_audss CLK_I2S>,
-                                               <&clk_audss CLK_I2S>,
-                                               <&clk_audss CLK_DOUT_AUD_BUS>;
-                               samsung,idma-addr = <0xc0010000>;
-                               pinctrl-names = "default";
-                               pinctrl-0 = <&i2s0_bus>;
-                               #sound-dai-cells = <0>;
-                               status = "disabled";
-                       };
+               i2s0: i2s@eee30000 {
+                       compatible = "samsung,s5pv210-i2s";
+                       reg = <0xeee30000 0x1000>;
+                       interrupt-parent = <&vic2>;
+                       interrupts = <16>;
+                       dma-names = "rx", "tx", "tx-sec";
+                       dmas = <&pdma1 9>, <&pdma1 10>, <&pdma1 11>;
+                       clock-names = "iis",
+                                     "i2s_opclk0",
+                                     "i2s_opclk1";
+                       clocks = <&clk_audss CLK_I2S>,
+                                <&clk_audss CLK_I2S>,
+                                <&clk_audss CLK_DOUT_AUD_BUS>;
+                       samsung,idma-addr = <0xc0010000>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2s0_bus>;
+                       #sound-dai-cells = <0>;
+                       status = "disabled";
                };
 
                i2s1: i2s@e2100000 {
index 42f7621..84066c1 100644 (file)
        };
 
        cpus {
-               #address-cells = <0>;
+               #address-cells = <1>;
                #size-cells = <0>;
 
-               cpu {
+               cpu@0 {
                        compatible = "arm,arm926ej-s";
                        device_type = "cpu";
+                       reg = <0>;
                };
        };
 
-       memory {
+       memory@20000000 {
                device_type = "memory";
                reg = <0x20000000 0x10000000>;
        };
@@ -61,6 +62,9 @@
        sram: sram@300000 {
                compatible = "mmio-sram";
                reg = <0x00300000 0x100000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00300000 0x100000>;
        };
 
        ahb {
index d7f2570..2ddc85d 100644 (file)
@@ -72,7 +72,7 @@
                };
        };
 
-       memory {
+       memory@20000000 {
                device_type = "memory";
                reg = <0x20000000 0x20000000>;
        };
@@ -94,6 +94,9 @@
        ns_sram: sram@200000 {
                compatible = "mmio-sram";
                reg = <0x00200000 0x20000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00200000 0x20000>;
        };
 
        ahb {
                        compatible = "mmio-sram";
                        no-memory-wc;
                        reg = <0x00100000 0x2400>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0 0x00100000 0x2400>;
+
                };
 
                usb0: gadget@300000 {
                                        compatible = "atmel,at91rm9200-spi";
                                        reg = <0x400 0x200>;
                                        interrupts = <19 IRQ_TYPE_LEVEL_HIGH 7>;
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
                                        clocks = <&pmc PMC_TYPE_PERIPHERAL 19>;
                                        clock-names = "spi_clk";
                                        dmas = <&dma0
                                        compatible = "atmel,at91rm9200-spi";
                                        reg = <0x400 0x200>;
                                        interrupts = <20 IRQ_TYPE_LEVEL_HIGH 7>;
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
                                        clocks = <&pmc PMC_TYPE_PERIPHERAL 20>;
                                        clock-names = "spi_clk";
                                        dmas = <&dma0
                                        compatible = "atmel,at91rm9200-spi";
                                        reg = <0x400 0x200>;
                                        interrupts = <21 IRQ_TYPE_LEVEL_HIGH 7>;
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
                                        clocks = <&pmc PMC_TYPE_PERIPHERAL 21>;
                                        clock-names = "spi_clk";
                                        dmas = <&dma0
                                        compatible = "atmel,at91rm9200-spi";
                                        reg = <0x400 0x200>;
                                        interrupts = <22 IRQ_TYPE_LEVEL_HIGH 7>;
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
                                        clocks = <&pmc PMC_TYPE_PERIPHERAL 22>;
                                        clock-names = "spi_clk";
                                        dmas = <&dma0
                                        compatible = "atmel,at91rm9200-spi";
                                        reg = <0x400 0x200>;
                                        interrupts = <23 IRQ_TYPE_LEVEL_HIGH 7>;
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
                                        clocks = <&pmc PMC_TYPE_PERIPHERAL 23>;
                                        clock-names = "spi_clk";
                                        dmas = <&dma0
index 0bb5b6f..86137f8 100644 (file)
@@ -55,7 +55,7 @@
                interrupts = <46 IRQ_TYPE_LEVEL_HIGH 0>;
        };
 
-       memory {
+       memory@20000000 {
                device_type = "memory";
                reg = <0x20000000 0x8000000>;
        };
@@ -83,6 +83,9 @@
        sram: sram@300000 {
                compatible = "mmio-sram";
                reg = <0x00300000 0x20000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00300000 0x20000>;
        };
 
        ahb {
                        compatible = "mmio-sram";
                        no-memory-wc;
                        reg = <0x200000 0x2400>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0 0x200000 0x2400>;
                };
 
                usb0: gadget@500000 {
index 65566e4..3843356 100644 (file)
@@ -14,7 +14,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x20000000>;
        };
 
index 9d25636..5579c95 100644 (file)
@@ -12,7 +12,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x20000000>;
        };
 
index 2d9f853..04f24cf 100644 (file)
@@ -53,7 +53,7 @@
                };
        };
 
-       memory {
+       memory@20000000 {
                device_type = "memory";
                reg = <0x20000000 0x20000000>;
        };
@@ -81,6 +81,9 @@
        ns_sram: sram@210000 {
                compatible = "mmio-sram";
                reg = <0x00210000 0x10000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0x00210000 0x10000>;
        };
 
        ahb {
@@ -93,6 +96,9 @@
                        compatible = "mmio-sram";
                        no-memory-wc;
                        reg = <0x100000 0x2400>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0 0x100000 0x2400>;
                };
 
                usb0: gadget@400000 {
diff --git a/arch/arm/boot/dts/sd5203.dts b/arch/arm/boot/dts/sd5203.dts
new file mode 100644 (file)
index 0000000..3cc9a23
--- /dev/null
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2020 Hisilicon Limited.
+ *
+ * DTS file for Hisilicon SD5203 Board
+ */
+
+/dts-v1/;
+
+/ {
+       model = "Hisilicon SD5203";
+       compatible = "H836ASDJ", "hisilicon,sd5203";
+       interrupt-parent = <&vic>;
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       chosen {
+               bootargs="console=ttyS0,9600 earlycon=uart8250,mmio32,0x1600d000";
+       };
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu0 {
+                       device_type = "cpu";
+                       compatible = "arm,arm926ej-s";
+                       reg = <0x0>;
+               };
+       };
+
+       memory@30000000 {
+               device_type = "memory";
+               reg = <0x30000000 0x8000000>;
+       };
+
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               ranges;
+
+               vic: interrupt-controller@10130000 {
+                       compatible = "snps,dw-apb-ictl";
+                       reg = <0x10130000 0x1000>;
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+               };
+
+               refclk125mhz: refclk125mhz {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <125000000>;
+               };
+
+               timer0: timer@16002000 {
+                       compatible = "arm,sp804", "arm,primecell";
+                       reg = <0x16002000 0x1000>;
+                       interrupts = <4>;
+                       clocks = <&refclk125mhz>;
+                       clock-names = "apb_pclk";
+               };
+
+               timer1: timer@16003000 {
+                       compatible = "arm,sp804", "arm,primecell";
+                       reg = <0x16003000 0x1000>;
+                       interrupts = <5>;
+                       clocks = <&refclk125mhz>;
+                       clock-names = "apb_pclk";
+               };
+
+               uart0: serial@1600d000 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x1600d000 0x1000>;
+                       bus_id = "uart0";
+                       clocks = <&refclk125mhz>;
+                       clock-names = "baudclk", "apb_pclk";
+                       reg-shift = <2>;
+                       interrupts = <17>;
+               };
+
+               uart1: serial@1600c000 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x1600c000 0x1000>;
+                       clocks = <&refclk125mhz>;
+                       clock-names = "baudclk", "apb_pclk";
+                       reg-shift = <2>;
+                       interrupts = <16>;
+                       status = "disabled";
+               };
+       };
+};
index a4d6312..30c67ac 100644 (file)
                status = "disabled";
        };
 
-       pfc: pin-controller@e6050000 {
+       pfc: pinctrl@e6050000 {
                compatible = "renesas,pfc-sh73a0";
                reg = <0xe6050000 0x8000>,
                      <0xe605801c 0x1c>;
index f187da4..c87b881 100644 (file)
@@ -43,7 +43,7 @@
                              0 7 0x04>;
        };
 
-       L2: l2-cache {
+       L2: cache-controller {
                    compatible = "arm,pl310-cache";
                    reg = <0xed000000 0x1000>;
                    cache-unified;
index 33e3b0b..ff47cbf 100644 (file)
                                reg = <0x33>;
                                label = "lp5521_pri";
                                clock-mode = /bits/ 8 <2>;
-                               chan0 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               chan@0 {
+                                       reg = <0>;
                                        led-cur = /bits/ 8 <0x2f>;
                                        max-cur = /bits/ 8 <0x5f>;
                                        linux,default-trigger = "heartbeat";
                                };
-                               chan1 {
+                               chan@1 {
+                                       reg = <1>;
                                        led-cur = /bits/ 8 <0x2f>;
                                        max-cur = /bits/ 8 <0x5f>;
                                };
-                               chan2 {
+                               chan@2 {
+                                       reg = <2>;
                                        led-cur = /bits/ 8 <0x2f>;
                                        max-cur = /bits/ 8 <0x5f>;
                                };
                                reg = <0x34>;
                                label = "lp5521_sec";
                                clock-mode = /bits/ 8 <2>;
-                               chan0 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               chan@0 {
+                                       reg = <0>;
                                        led-cur = /bits/ 8 <0x2f>;
                                        max-cur = /bits/ 8 <0x5f>;
                                };
-                               chan1 {
+                               chan@1 {
+                                       reg = <1>;
                                        led-cur = /bits/ 8 <0x2f>;
                                        max-cur = /bits/ 8 <0x5f>;
                                };
-                               chan2 {
+                               chan@2 {
+                                       reg = <2>;
                                        led-cur = /bits/ 8 <0x2f>;
                                        max-cur = /bits/ 8 <0x5f>;
                                };
index 1e26b71..a1093cb 100644 (file)
                                };
                        };
                };
+
+               mcde@a0350000 {
+                       status = "okay";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&dsi_default_mode>;
+
+                       dsi-controller@a0351000 {
+                               panel@0 {
+                                       compatible = "samsung,s6e63m0";
+                                       reg = <0>;
+                                       vdd3-supply = <&panel_reg_3v0>;
+                                       vci-supply = <&panel_reg_1v8>;
+                                       reset-gpios = <&gpio4 11 GPIO_ACTIVE_LOW>;
+                                       /* ESD (electrostatic discharge) detection interrupt */
+                                       interrupt-parent = <&gpio2>;
+                                       interrupts = <18 IRQ_TYPE_EDGE_RISING>;
+                                       interrupt-names = "esd";
+                                       pinctrl-names = "default";
+                                       pinctrl-0 = <&display_default_mode>;
+                               };
+                       };
+               };
        };
 
        gpio-keys {
                pinctrl-names = "default";
                pinctrl-0 = <&wlan_en_default>;
        };
+
+       /* MIC5366 GPIO-controlled regulator */
+       panel_reg_1v8: regulator-panel-1v8 {
+               compatible = "regulator-fixed";
+
+               regulator-name = "panel-fixed-supply";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               /* GPIO219 */
+               gpio = <&gpio6 27 GPIO_ACTIVE_HIGH>;
+
+               startup-delay-us = <200>;
+               enable-active-high;
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&panel_reg_default_mode>;
+       };
+
+       /* MIC5366 GPIO-controlled regulator */
+       panel_reg_3v0: regulator-panel-3v0 {
+               compatible = "regulator-fixed";
+
+               regulator-name = "panel-fixed-supply";
+               regulator-min-microvolt = <3000000>;
+               regulator-max-microvolt = <3000000>;
+               /* GPIO219 */
+               gpio = <&gpio6 27 GPIO_ACTIVE_HIGH>;
+
+               startup-delay-us = <200>;
+               enable-active-high;
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&panel_reg_default_mode>;
+       };
 };
 
 &pinctrl {
                };
        };
 
+       mcde {
+               dsi_default_mode: dsi_default {
+                       default_mux1 {
+                               /* Mux in VSI0 used for DSI TE */
+                               function = "lcd";
+                               groups =
+                               "lcdvsi0_a_1"; /* VSI0 for LCD */
+                       };
+                       default_cfg1 {
+                               pins =
+                               "GPIO68_E1"; /* VSI0 */
+                               ste,config = <&in_nopull>;
+                       };
+               };
+       };
+
+       display {
+               display_default_mode: display_default {
+                       golden_cfg1 {
+                               pins = "GPIO139_C9"; /* MIPI_DSI0_RESET_N */
+                               ste,config = <&gpio_out_lo>;
+                       };
+                       golden_cfg2 {
+                               pins = "GPIO82_C1"; /* LDI_ESD_DET */
+                               ste,config = <&gpio_in_pu>;
+                       };
+               };
+               panel_reg_default_mode: panel_reg_default {
+                       golden_cfg1 {
+                               pins = "GPIO219_AG10"; /* LCD_PWR_EN */
+                               ste,config = <&gpio_out_lo>;
+                       };
+               };
+       };
+
        proximity {
                proximity_default: proximity_default {
                        golden_cfg1 {
index d6f6ac0..27722c4 100644 (file)
                };
        };
 
-       /*
-        * FIXME: this is not quite GPIO backlight. This is a
-        * KTD253 one-wire GPIO-controlled backlight. It can
-        * work as a GPIO backlight.
-        */
-       gpio_bl: backlight {
-               compatible = "gpio-backlight";
+       ktd253: backlight {
+               compatible = "kinetic,ktd253";
                /* GPIO 69 */
-               gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>;
+               enable-gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>;
+               /* Default to 13/32 brightness */
+               default-brightness = <13>;
                pinctrl-names = "default";
                pinctrl-0 = <&gpio_backlight_default_mode>;
        };
                                        reset-gpios = <&gpio4 11 GPIO_ACTIVE_LOW>;
                                        pinctrl-names = "default";
                                        pinctrl-0 = <&display_default_mode>;
-                                       backlight = <&gpio_bl>;
+                                       backlight = <&ktd253>;
                                };
                        };
                };
index 69e2f1e..7febe19 100644 (file)
                        compatible = "st,stm32h7-spi";
                        reg = <0x40003800 0x400>;
                        interrupts = <36>;
+                       resets = <&rcc STM32H7_APB1L_RESET(SPI2)>;
                        clocks = <&rcc SPI2_CK>;
                        status = "disabled";
 
                        compatible = "st,stm32h7-spi";
                        reg = <0x40003c00 0x400>;
                        interrupts = <51>;
+                       resets = <&rcc STM32H7_APB1L_RESET(SPI3)>;
                        clocks = <&rcc SPI3_CK>;
                        status = "disabled";
                };
 
                usart2: serial@40004400 {
-                       compatible = "st,stm32f7-uart";
+                       compatible = "st,stm32h7-uart";
                        reg = <0x40004400 0x400>;
                        interrupts = <38>;
                        status = "disabled";
                };
 
                usart1: serial@40011000 {
-                       compatible = "st,stm32f7-uart";
+                       compatible = "st,stm32h7-uart";
                        reg = <0x40011000 0x400>;
                        interrupts = <37>;
                        status = "disabled";
                        compatible = "st,stm32h7-spi";
                        reg = <0x40013000 0x400>;
                        interrupts = <35>;
+                       resets = <&rcc STM32H7_APB2_RESET(SPI1)>;
                        clocks = <&rcc SPI1_CK>;
                        status = "disabled";
                };
                        compatible = "st,stm32h7-spi";
                        reg = <0x40013400 0x400>;
                        interrupts = <84>;
+                       resets = <&rcc STM32H7_APB2_RESET(SPI4)>;
                        clocks = <&rcc SPI4_CK>;
                        status = "disabled";
                };
                        compatible = "st,stm32h7-spi";
                        reg = <0x40015000 0x400>;
                        interrupts = <85>;
+                       resets = <&rcc STM32H7_APB2_RESET(SPI5)>;
                        clocks = <&rcc SPI5_CK>;
                        status = "disabled";
                };
                        status = "disabled";
                };
 
+               ltdc: display-controller@50001000 {
+                       compatible = "st,stm32-ltdc";
+                       reg = <0x50001000 0x200>;
+                       interrupts = <88>, <89>;
+                       resets = <&rcc STM32H7_APB3_RESET(LTDC)>;
+                       clocks = <&rcc LTDC_CK>;
+                       clock-names = "lcd";
+                       status = "disabled";
+               };
+
                mdma1: dma-controller@52000000 {
                        compatible = "st,stm32h7-mdma";
                        reg = <0x52000000 0x1000>;
                        compatible = "st,stm32h7-spi";
                        reg = <0x58001400 0x400>;
                        interrupts = <86>;
+                       resets = <&rcc STM32H7_APB4_RESET(SPI6)>;
                        clocks = <&rcc SPI6_CK>;
                        status = "disabled";
                };
index b5a6642..d84686e 100644 (file)
                };
        };
 
+       sdmmc2_d47_pins_d: sdmmc2-d47-3 {
+               pins {
+                       pinmux = <STM32_PINMUX('A', 8, AF9)>, /* SDMMC2_D4 */
+                                <STM32_PINMUX('A', 9, AF10)>, /* SDMMC2_D5 */
+                                <STM32_PINMUX('E', 5, AF9)>, /* SDMMC2_D6 */
+                                <STM32_PINMUX('C', 7, AF10)>; /* SDMMC2_D7 */
+               };
+       };
+
+       sdmmc2_d47_sleep_pins_d: sdmmc2-d47-sleep-3 {
+               pins {
+                       pinmux = <STM32_PINMUX('A', 8, ANALOG)>, /* SDMMC2_D4 */
+                                <STM32_PINMUX('A', 9, ANALOG)>, /* SDMMC2_D5 */
+                                <STM32_PINMUX('E', 5, ANALOG)>, /* SDMMC2_D6 */
+                                <STM32_PINMUX('C', 7, ANALOG)>; /* SDMMC2_D7 */
+               };
+       };
+
        sdmmc3_b4_pins_a: sdmmc3-b4-0 {
                pins1 {
                        pinmux = <STM32_PINMUX('F', 0, AF9)>, /* SDMMC3_D0 */
                };
        };
 
+       uart8_rtscts_pins_a: uart8rtscts-0 {
+               pins {
+                       pinmux = <STM32_PINMUX('G', 7, AF8)>, /* UART8_RTS */
+                                <STM32_PINMUX('G', 10, AF8)>; /* UART8_CTS */
+                       bias-disable;
+               };
+       };
+
        spi4_pins_a: spi4-0 {
                pins {
                        pinmux = <STM32_PINMUX('E', 12, AF5)>, /* SPI4_SCK */
index bfe2902..8475790 100644 (file)
                };
        };
 
+       arm-pmu {
+               compatible = "arm,cortex-a7-pmu";
+               interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-affinity = <&cpu0>;
+               interrupt-parent = <&intc>;
+       };
+
        psci {
                compatible = "arm,psci-1.0";
                method = "smc";
                        dma-requests = <48>;
                };
 
-               fmc: nand-controller@58002000 {
-                       compatible = "st,stm32mp15-fmc2";
-                       reg = <0x58002000 0x1000>,
-                             <0x80000000 0x1000>,
-                             <0x88010000 0x1000>,
-                             <0x88020000 0x1000>,
-                             <0x81000000 0x1000>,
-                             <0x89010000 0x1000>,
-                             <0x89020000 0x1000>;
-                       interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
-                       dmas = <&mdma1 20 0x10 0x12000a02 0x0 0x0>,
-                              <&mdma1 20 0x10 0x12000a08 0x0 0x0>,
-                              <&mdma1 21 0x10 0x12000a0a 0x0 0x0>;
-                       dma-names = "tx", "rx", "ecc";
+               fmc: memory-controller@58002000 {
+                       #address-cells = <2>;
+                       #size-cells = <1>;
+                       compatible = "st,stm32mp1-fmc2-ebi";
+                       reg = <0x58002000 0x1000>;
                        clocks = <&rcc FMC_K>;
                        resets = <&rcc FMC_R>;
                        status = "disabled";
+
+                       ranges = <0 0 0x60000000 0x04000000>, /* EBI CS 1 */
+                                <1 0 0x64000000 0x04000000>, /* EBI CS 2 */
+                                <2 0 0x68000000 0x04000000>, /* EBI CS 3 */
+                                <3 0 0x6c000000 0x04000000>, /* EBI CS 4 */
+                                <4 0 0x80000000 0x10000000>; /* NAND */
+
+                       nand-controller@4,0 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "st,stm32mp1-fmc2-nfc";
+                               reg = <4 0x00000000 0x1000>,
+                                     <4 0x08010000 0x1000>,
+                                     <4 0x08020000 0x1000>,
+                                     <4 0x01000000 0x1000>,
+                                     <4 0x09010000 0x1000>,
+                                     <4 0x09020000 0x1000>;
+                               interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
+                               dmas = <&mdma1 20 0x2 0x12000a02 0x0 0x0>,
+                                      <&mdma1 20 0x2 0x12000a08 0x0 0x0>,
+                                      <&mdma1 21 0x2 0x12000a0a 0x0 0x0>;
+                               dma-names = "tx", "rx", "ecc";
+                               status = "disabled";
+                       };
                };
 
                qspi: spi@58003000 {
index 6d9ab08..1c1889b 100644 (file)
                };
        };
 
+       arm-pmu {
+               interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 201 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-affinity = <&cpu0>, <&cpu1>;
+       };
+
        soc {
                m_can1: can@4400e000 {
                        compatible = "bosch,m_can";
diff --git a/arch/arm/boot/dts/stm32mp153c-dhcom-drc02.dts b/arch/arm/boot/dts/stm32mp153c-dhcom-drc02.dts
new file mode 100644 (file)
index 0000000..02a3913
--- /dev/null
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright (C) 2020 Marek Vasut <marex@denx.de>
+ *
+ * DHCOM STM32MP1 variant:
+ * DHCM-STM32MP153C-C065-R102-F0819-SPI-E2-CAN2-RTC-I-01D2
+ * DHCOM PCB number: 587-200 or newer
+ * DRC02 PCB number: 568-100 or newer
+ */
+/dts-v1/;
+
+#include "stm32mp153.dtsi"
+#include "stm32mp15xc.dtsi"
+#include "stm32mp15xx-dhcom-som.dtsi"
+#include "stm32mp15xx-dhcom-drc02.dtsi"
+
+/ {
+       model = "DH electronics STM32MP153C DHCOM DRC02";
+       compatible = "dh,stm32mp153c-dhcom-drc02", "dh,stm32mp153c-dhcom-som",
+                    "st,stm32mp153";
+};
+
+&m_can1 {
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&m_can1_pins_a>;
+       pinctrl-1 = <&m_can1_sleep_pins_a>;
+       status = "okay";
+};
+
+&m_can2 {
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&m_can2_pins_a>;
+       pinctrl-1 = <&m_can2_sleep_pins_a>;
+       status = "okay";
+};
index 197aa98..d3b8138 100644 (file)
@@ -4,7 +4,7 @@
  *
  * DHCOM STM32MP1 variant:
  * DHCM-STM32MP157C-C065-R102-F0819-SPI-E2-CAN2-SDR104-RTC-WBT-T-DSI-I-01D2
- * DHCOR PCB number: 587-200 or newer
+ * DHCOM PCB number: 587-200 or newer
  * PDK2 PCB number: 516-400 or newer
  */
 /dts-v1/;
@@ -15,7 +15,7 @@
 #include "stm32mp15xx-dhcom-pdk2.dtsi"
 
 / {
-       model = "DH Electronics STM32MP157C DHCOM Premium Developer Kit (2)";
+       model = "DH electronics STM32MP157C DHCOM Premium Developer Kit (2)";
        compatible = "dh,stm32mp157c-dhcom-pdk2", "dh,stm32mp157c-dhcom-som",
                     "st,stm32mp157";
 };
index ca109dc..2e77cce 100644 (file)
                states = <1800000 0x1>,
                         <2900000 0x0>;
        };
+
+       vin: vin {
+               compatible = "regulator-fixed";
+               regulator-name = "vin";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
 };
 
 &adc {
 
                regulators {
                        compatible = "st,stpmic1-regulators";
+                       buck1-supply = <&vin>;
+                       buck2-supply = <&vin>;
+                       buck3-supply = <&vin>;
+                       buck4-supply = <&vin>;
                        ldo1-supply = <&v3v3>;
                        ldo2-supply = <&v3v3>;
                        ldo3-supply = <&vdd_ddr>;
+                       ldo4-supply = <&vin>;
                        ldo5-supply = <&v3v3>;
                        ldo6-supply = <&v3v3>;
+                       vref_ddr-supply = <&vin>;
+                       boost-supply = <&vin>;
                        pwr_sw1-supply = <&bst_out>;
                        pwr_sw2-supply = <&bst_out>;
 
index 85628e1..a55e80c 100644 (file)
        pinctrl-0 = <&fmc_pins_a>;
        pinctrl-1 = <&fmc_sleep_pins_a>;
        status = "okay";
-       #address-cells = <1>;
-       #size-cells = <0>;
 
-       nand@0 {
-               reg = <0>;
-               nand-on-flash-bbt;
-               #address-cells = <1>;
-               #size-cells = <1>;
+       nand-controller@4,0 {
+               status = "okay";
+
+               nand@0 {
+                       reg = <0>;
+                       nand-on-flash-bbt;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+               };
        };
 };
 
index 5700e6b..1e5333f 100644 (file)
                        reset-gpios = <&gpiog 0 GPIO_ACTIVE_LOW>; /* ETH_RST# */
                        interrupt-parent = <&gpioa>;
                        interrupts = <6 IRQ_TYPE_EDGE_FALLING>; /* ETH_MDINT# */
-                       rxc-skew-ps = <1860>;
-                       txc-skew-ps = <1860>;
                        reset-assert-us = <10000>;
                        reset-deassert-us = <300>;
                        micrel,force-master;
        pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_b>;
        pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_b>;
        bus-width = <8>;
+       mmc-ddr-3_3v;
        no-1-8-v;
        no-sd;
        no-sdio;
diff --git a/arch/arm/boot/dts/stm32mp157c-odyssey-som.dtsi b/arch/arm/boot/dts/stm32mp157c-odyssey-som.dtsi
new file mode 100644 (file)
index 0000000..6cf49a0
--- /dev/null
@@ -0,0 +1,276 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) 2020 Marcin Sloniewski <marcin.sloniewski@gmail.com>.
+ */
+
+/dts-v1/;
+
+#include "stm32mp157.dtsi"
+#include "stm32mp15xc.dtsi"
+#include "stm32mp15-pinctrl.dtsi"
+#include "stm32mp15xxac-pinctrl.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/mfd/st,stpmic1.h>
+
+/ {
+       model = "Seeed Studio Odyssey-STM32MP157C SOM";
+       compatible = "seeed,stm32mp157c-odyssey-som", "st,stm32mp157";
+
+       memory@c0000000 {
+               device_type = "memory";
+               reg = <0xc0000000 0x20000000>;
+       };
+
+       reserved-memory {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               mcuram2: mcuram2@10000000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x10000000 0x40000>;
+                       no-map;
+               };
+
+               vdev0vring0: vdev0vring0@10040000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x10040000 0x1000>;
+                       no-map;
+               };
+
+               vdev0vring1: vdev0vring1@10041000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x10041000 0x1000>;
+                       no-map;
+               };
+
+               vdev0buffer: vdev0buffer@10042000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x10042000 0x4000>;
+                       no-map;
+               };
+
+               mcuram: mcuram@30000000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x30000000 0x40000>;
+                       no-map;
+               };
+
+               retram: retram@38000000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x38000000 0x10000>;
+                       no-map;
+               };
+
+               gpu_reserved: gpu@d4000000 {
+                       reg = <0xd4000000 0x4000000>;
+                       no-map;
+               };
+       };
+
+       led {
+               compatible = "gpio-leds";
+               led-blue {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_HEARTBEAT;
+                       gpios = <&gpiog 3 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+};
+
+&gpu {
+       contiguous-area = <&gpu_reserved>;
+       status = "okay";
+};
+
+&i2c2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c2_pins_a>;
+       i2c-scl-rising-time-ns = <185>;
+       i2c-scl-falling-time-ns = <20>;
+       status = "okay";
+       /* spare dmas for other usage */
+       /delete-property/dmas;
+       /delete-property/dma-names;
+
+       pmic: stpmic@33 {
+               compatible = "st,stpmic1";
+               reg = <0x33>;
+               interrupts-extended = <&gpioa 0 IRQ_TYPE_EDGE_FALLING>;
+               interrupt-controller;
+               #interrupt-cells = <2>;
+
+               regulators {
+                       compatible = "st,stpmic1-regulators";
+                       ldo1-supply = <&v3v3>;
+                       ldo3-supply = <&vdd_ddr>;
+                       ldo6-supply = <&v3v3>;
+                       pwr_sw1-supply = <&bst_out>;
+                       pwr_sw2-supply = <&bst_out>;
+
+                       vddcore: buck1 {
+                               regulator-name = "vddcore";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-always-on;
+                               regulator-initial-mode = <0>;
+                               regulator-over-current-protection;
+                       };
+
+                       vdd_ddr: buck2 {
+                               regulator-name = "vdd_ddr";
+                               regulator-min-microvolt = <1350000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-always-on;
+                               regulator-initial-mode = <0>;
+                               regulator-over-current-protection;
+                       };
+
+                       vdd: buck3 {
+                               regulator-name = "vdd";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                               st,mask-reset;
+                               regulator-initial-mode = <0>;
+                               regulator-over-current-protection;
+                       };
+
+                       v3v3: buck4 {
+                               regulator-name = "v3v3";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                               regulator-over-current-protection;
+                               regulator-initial-mode = <0>;
+                       };
+
+                       v1v8_audio: ldo1 {
+                               regulator-name = "v1v8_audio";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                               interrupts = <IT_CURLIM_LDO1 0>;
+                       };
+
+                       v3v3_hdmi: ldo2 {
+                               regulator-name = "v3v3_hdmi";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                               interrupts = <IT_CURLIM_LDO2 0>;
+                       };
+
+                       vtt_ddr: ldo3 {
+                               regulator-name = "vtt_ddr";
+                               regulator-min-microvolt = <500000>;
+                               regulator-max-microvolt = <750000>;
+                               regulator-always-on;
+                               regulator-over-current-protection;
+                       };
+
+                       vdd_usb: ldo4 {
+                               regulator-name = "vdd_usb";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               interrupts = <IT_CURLIM_LDO4 0>;
+                       };
+
+                       vdda: ldo5 {
+                               regulator-name = "vdda";
+                               regulator-min-microvolt = <2900000>;
+                               regulator-max-microvolt = <2900000>;
+                               interrupts = <IT_CURLIM_LDO5 0>;
+                               regulator-boot-on;
+                       };
+
+                       v1v2_hdmi: ldo6 {
+                               regulator-name = "v1v2_hdmi";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1200000>;
+                               regulator-always-on;
+                               interrupts = <IT_CURLIM_LDO6 0>;
+                       };
+
+                       vref_ddr: vref_ddr {
+                               regulator-name = "vref_ddr";
+                               regulator-always-on;
+                               regulator-over-current-protection;
+                       };
+
+                        bst_out: boost {
+                               regulator-name = "bst_out";
+                               interrupts = <IT_OCP_BOOST 0>;
+                        };
+
+                       vbus_otg: pwr_sw1 {
+                               regulator-name = "vbus_otg";
+                               interrupts = <IT_OCP_OTG 0>;
+                        };
+
+                        vbus_sw: pwr_sw2 {
+                               regulator-name = "vbus_sw";
+                               interrupts = <IT_OCP_SWOUT 0>;
+                               regulator-active-discharge;
+                        };
+               };
+
+               onkey {
+                       compatible = "st,stpmic1-onkey";
+                       interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 0>;
+                       interrupt-names = "onkey-falling", "onkey-rising";
+                       power-off-time-sec = <10>;
+               };
+
+               watchdog {
+                       compatible = "st,stpmic1-wdt";
+                       status = "disabled";
+               };
+       };
+};
+
+&ipcc {
+       status = "okay";
+};
+
+&iwdg2 {
+       timeout-sec = <32>;
+       status = "okay";
+};
+
+&m4_rproc {
+       memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
+                       <&vdev0vring1>, <&vdev0buffer>;
+       mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
+       mbox-names = "vq0", "vq1", "shutdown";
+       interrupt-parent = <&exti>;
+       interrupts = <68 1>;
+       status = "okay";
+};
+
+&rng1 {
+       status = "okay";
+};
+
+&rtc {
+       status = "okay";
+};
+
+&sdmmc2 {
+       pinctrl-names = "default", "opendrain", "sleep";
+       pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_d>;
+       pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_d>;
+       pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_d>;
+       non-removable;
+       no-sd;
+       no-sdio;
+       st,neg-edge;
+       bus-width = <8>;
+       vmmc-supply = <&v3v3>;
+       vqmmc-supply = <&v3v3>;
+       mmc-ddr-3_3v;
+       status = "okay";
+};
+
diff --git a/arch/arm/boot/dts/stm32mp157c-odyssey.dts b/arch/arm/boot/dts/stm32mp157c-odyssey.dts
new file mode 100644 (file)
index 0000000..a7ffec8
--- /dev/null
@@ -0,0 +1,80 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) 2020 Marcin Sloniewski <marcin.sloniewski@gmail.com>.
+ */
+
+/dts-v1/;
+
+#include "stm32mp157c-odyssey-som.dtsi"
+
+/ {
+       model = "Seeed Studio Odyssey-STM32MP157C Board";
+       compatible = "seeed,stm32mp157c-odyssey",
+                    "seeed,stm32mp157c-odyssey-som", "st,stm32mp157";
+
+       aliases {
+               ethernet0 = &ethernet0;
+               serial0 = &uart4;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+};
+
+&ethernet0 {
+       status = "okay";
+       pinctrl-0 = <&ethernet0_rgmii_pins_a>;
+       pinctrl-1 = <&ethernet0_rgmii_sleep_pins_a>;
+       pinctrl-names = "default", "sleep";
+       phy-mode = "rgmii-id";
+       max-speed = <1000>;
+       phy-handle = <&phy0>;
+       assigned-clocks = <&rcc ETHCK_K>, <&rcc PLL4_P>;
+       assigned-clock-parents = <&rcc PLL4_P>;
+       assigned-clock-rates = <125000000>; /* Clock PLL4 to 750Mhz in ATF/U-Boot */
+       st,eth-clk-sel;
+
+       mdio0 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "snps,dwmac-mdio";
+               phy0: ethernet-phy@7 { /* KSZ9031RN */
+                       reg = <7>;
+                       reset-gpios = <&gpiog 0 GPIO_ACTIVE_LOW>; /* ETH_RST# */
+                       reset-assert-us = <10000>;
+                       reset-deassert-us = <300>;
+               };
+       };
+};
+
+&i2c1 {
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&i2c1_pins_a>;
+       pinctrl-1 = <&i2c1_sleep_pins_a>;
+       i2c-scl-rising-time-ns = <100>;
+       i2c-scl-falling-time-ns = <7>;
+       status = "okay";
+       /delete-property/dmas;
+       /delete-property/dma-names;
+};
+
+&sdmmc1 {
+       pinctrl-names = "default", "opendrain", "sleep";
+       pinctrl-0 = <&sdmmc1_b4_pins_a>;
+       pinctrl-1 = <&sdmmc1_b4_od_pins_a>;
+       pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
+       cd-gpios = <&gpiob 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+       disable-wp;
+       st,neg-edge;
+       bus-width = <4>;
+       vmmc-supply = <&v3v3>;
+       status = "okay";
+};
+
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart4_pins_a>;
+       status = "okay";
+};
+
diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
new file mode 100644 (file)
index 0000000..62ab238
--- /dev/null
@@ -0,0 +1,157 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright (C) 2020 Marek Vasut <marex@denx.de>
+ */
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/pwm/pwm.h>
+
+/ {
+       aliases {
+               serial0 = &uart4;
+               serial1 = &usart3;
+               serial2 = &uart8;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+};
+
+&adc {
+       status = "disabled";
+};
+
+&dac {
+       status = "disabled";
+};
+
+&gpiob {
+       /*
+        * NOTE: On DRC02, the RS485_RX_En is controlled by a separate
+        * GPIO line, however the STM32 UART driver assumes RX happens
+        * during TX anyway and that it only controls drive enable DE
+        * line. Hence, the RX is always enabled here.
+        */
+       rs485-rx-en {
+               gpio-hog;
+               gpios = <8 GPIO_ACTIVE_HIGH>;
+               output-low;
+               line-name = "rs485-rx-en";
+       };
+};
+
+&gpiod {
+       gpio-line-names = "", "", "", "",
+                         "", "", "", "",
+                         "", "", "", "Out1",
+                         "Out2", "", "", "";
+};
+
+&gpioi {
+       gpio-line-names = "In1", "", "", "",
+                         "", "", "", "",
+                         "In2", "", "", "",
+                         "", "", "", "";
+
+       /*
+        * NOTE: The USB Hub on the DRC02 needs a reset signal to be
+        * pulled high in order to be detected by the USB Controller.
+        * This signal should be handled by USB power sequencing in
+        * order to reset the Hub when USB bus is powered down, but
+        * so far there is no such functionality.
+        */
+       usb-hub {
+               gpio-hog;
+               gpios = <2 GPIO_ACTIVE_HIGH>;
+               output-high;
+               line-name = "usb-hub-reset";
+       };
+};
+
+&i2c2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c2_pins_a>;
+       i2c-scl-rising-time-ns = <185>;
+       i2c-scl-falling-time-ns = <20>;
+       status = "okay";
+       /* spare dmas for other usage */
+       /delete-property/dmas;
+       /delete-property/dma-names;
+       status = "okay";
+
+       eeprom@50 {
+               compatible = "atmel,24c04";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+};
+
+&i2c5 {        /* TP7/TP8 */
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c5_pins_a>;
+       i2c-scl-rising-time-ns = <185>;
+       i2c-scl-falling-time-ns = <20>;
+       status = "okay";
+       /* spare dmas for other usage */
+       /delete-property/dmas;
+       /delete-property/dma-names;
+};
+
+&sdmmc3 {
+       /*
+        * On DRC02, the SoM does not have SDIO WiFi. The pins
+        * are used for on-board microSD slot instead.
+        */
+       /delete-property/broken-cd;
+       cd-gpios = <&gpioi 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+       disable-wp;
+};
+
+&spi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&spi1_pins_a>;
+       cs-gpios = <&gpioz 3 0>;
+       /* Use PIO for the display */
+       /delete-property/dmas;
+       /delete-property/dma-names;
+       status = "disabled";    /* Enable once there is display driver */
+       /*
+        * Note: PF3/GPIO_A , PD6/GPIO_B , PG0/GPIO_C , PC6/GPIO_E are
+        * also connected to the display board connector.
+        */
+};
+
+&usart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&usart3_pins_a>;
+       status = "okay";
+};
+
+/*
+ * Note: PI3 is UART1_RTS and PI5 is UART1_CTS on DRC02 (uart4 of STM32MP1),
+ *       however the STM32MP1 pinmux cannot map them to UART4 .
+ */
+
+&uart8 {       /* RS485 */
+       linux,rs485-enabled-at-boot-time;
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart8_pins_a>;
+       rts-gpios = <&gpioe 6 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&usbh_ehci {
+       phys = <&usbphyc_port0>;
+       status = "okay";
+};
+
+&usbphyc {
+       status = "okay";
+};
+
+&usbphyc_port0 {
+       phy-supply = <&vdd_usb>;
+       vdda1v1-supply = <&reg11>;
+       vdda1v8-supply = <&reg18>;
+};
index 7c4bd61..5dff24e 100644 (file)
@@ -11,7 +11,6 @@
                serial0 = &uart4;
                serial1 = &usart3;
                serial2 = &uart8;
-               ethernet0 = &ethernet0;
        };
 
        chosen {
 
        display_bl: display-bl {
                compatible = "pwm-backlight";
-               pwms = <&pwm2 0 500000 PWM_POLARITY_INVERTED>;
+               pwms = <&pwm2 3 500000 PWM_POLARITY_INVERTED>;
                brightness-levels = <0 16 22 30 40 55 75 102 138 188 255>;
                default-brightness-level = <8>;
                enable-gpios = <&gpioi 0 GPIO_ACTIVE_HIGH>;
                status = "okay";
        };
 
-       ethernet_vio: vioregulator {
-               compatible = "regulator-fixed";
-               regulator-name = "vio";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               gpio = <&gpiog 3 GPIO_ACTIVE_LOW>;
-               regulator-always-on;
-               regulator-boot-on;
-       };
-
        gpio-keys-polled {
                compatible = "gpio-keys-polled";
                #size-cells = <0>;
        status = "okay";
 };
 
-&ethernet0 {
-       status = "okay";
-       pinctrl-0 = <&ethernet0_rmii_pins_a>;
-       pinctrl-1 = <&ethernet0_rmii_sleep_pins_a>;
-       pinctrl-names = "default", "sleep";
-       phy-mode = "rmii";
-       max-speed = <100>;
-       phy-handle = <&phy0>;
-       st,eth-ref-clk-sel;
-       phy-reset-gpios = <&gpioh 15 GPIO_ACTIVE_LOW>;
-
-       mdio0 {
-               #address-cells = <1>;
-               #size-cells = <0>;
-               compatible = "snps,dwmac-mdio";
-
-               phy0: ethernet-phy@1 {
-                       reg = <1>;
-               };
-       };
-};
-
 &i2c2 {        /* Header X22 */
        pinctrl-names = "default";
        pinctrl-0 = <&i2c2_pins_a>;
 
 &uart8 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart8_pins_a>;
+       pinctrl-0 = <&uart8_pins_a &uart8_rtscts_pins_a>;
+       uart-has-rtscts;
        status = "okay";
 };
 
 };
 
 &usbotg_hs {
-       dr_mode = "peripheral";
-       phys = <&usbphyc_port1 0>;
+       dr_mode = "otg";
+       pinctrl-0 = <&usbotg_hs_pins_a>;
+       pinctrl-names = "default";
        phy-names = "usb2-phy";
+       phys = <&usbphyc_port1 0>;
+       vbus-supply = <&vbus_otg>;
        status = "okay";
 };
 
index ba90519..b4b52cf 100644 (file)
@@ -9,6 +9,10 @@
 #include <dt-bindings/mfd/st,stpmic1.h>
 
 / {
+       aliases {
+               ethernet0 = &ethernet0;
+       };
+
        memory@c0000000 {
                device_type = "memory";
                reg = <0xC0000000 0x40000000>;
                        no-map;
                };
        };
+
+       ethernet_vio: vioregulator {
+               compatible = "regulator-fixed";
+               regulator-name = "vio";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpiog 3 GPIO_ACTIVE_LOW>;
+               regulator-always-on;
+               regulator-boot-on;
+       };
 };
 
 &adc {
        status = "okay";
 };
 
+&ethernet0 {
+       status = "okay";
+       pinctrl-0 = <&ethernet0_rmii_pins_a>;
+       pinctrl-1 = <&ethernet0_rmii_sleep_pins_a>;
+       pinctrl-names = "default", "sleep";
+       phy-mode = "rmii";
+       max-speed = <100>;
+       phy-handle = <&phy0>;
+       st,eth-ref-clk-sel;
+       phy-reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
+
+       mdio0 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "snps,dwmac-mdio";
+
+               phy0: ethernet-phy@1 {
+                       reg = <1>;
+               };
+       };
+};
+
 &i2c4 {
        pinctrl-names = "default";
        pinctrl-0 = <&i2c4_pins_a>;
                compatible = "ti,tsc2004";
                reg = <0x49>;
                vio-supply = <&v3v3>;
-               interrupts-extended = <&gpioh 3 IRQ_TYPE_EDGE_FALLING>;
+               interrupts-extended = <&gpioh 15 IRQ_TYPE_EDGE_FALLING>;
        };
 
        eeprom@50 {
 
 &qspi {
        pinctrl-names = "default", "sleep";
-       pinctrl-0 = <&qspi_clk_pins_a &qspi_bk1_pins_a &qspi_bk2_pins_a>;
-       pinctrl-1 = <&qspi_clk_sleep_pins_a &qspi_bk1_sleep_pins_a &qspi_bk2_sleep_pins_a>;
+       pinctrl-0 = <&qspi_clk_pins_a &qspi_bk1_pins_a>;
+       pinctrl-1 = <&qspi_clk_sleep_pins_a &qspi_bk1_sleep_pins_a>;
        reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
        #address-cells = <1>;
        #size-cells = <0>;
index 9302027..ec02cee 100644 (file)
 
 &sdmmc2 {
        pinctrl-names = "default", "opendrain", "sleep";
-       pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_b>;
-       pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_b>;
-       pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_b>;
+       pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_c>;
+       pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_c>;
+       pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_c>;
        bus-width = <8>;
        mmc-ddr-1_8v;
        no-sd;
        label = "LS-UART0";
        pinctrl-names = "default";
        pinctrl-0 = <&uart7_pins_a>;
+       uart-has-rtscts;
        status = "okay";
 };
 
index a530774..93398cf 100644 (file)
                dais = <&sai2a_port &sai2b_port &i2s2_port>;
                status = "okay";
        };
+
+       vin: vin {
+               compatible = "regulator-fixed";
+               regulator-name = "vin";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
 };
 
 &adc {
 
                regulators {
                        compatible = "st,stpmic1-regulators";
+                       buck1-supply = <&vin>;
+                       buck2-supply = <&vin>;
+                       buck3-supply = <&vin>;
+                       buck4-supply = <&vin>;
                        ldo1-supply = <&v3v3>;
+                       ldo2-supply = <&vin>;
                        ldo3-supply = <&vdd_ddr>;
+                       ldo4-supply = <&vin>;
+                       ldo5-supply = <&vin>;
                        ldo6-supply = <&v3v3>;
+                       vref_ddr-supply = <&vin>;
+                       boost-supply = <&vin>;
                        pwr_sw1-supply = <&bst_out>;
                        pwr_sw2-supply = <&bst_out>;
 
index 8692b11..af8ab73 100644 (file)
                stdout-path = "serial0:115200n8";
        };
 
+       hdmi-connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_con_in: endpoint {
+                               remote-endpoint = <&hdmi_out_con>;
+                       };
+               };
+       };
+
        leds {
                compatible = "gpio-leds";
 
        status = "okay";
 };
 
+&de {
+       status = "okay";
+};
+
+&hdmi {
+       status = "okay";
+};
+
+&hdmi_out {
+       hdmi_out_con: endpoint {
+               remote-endpoint = <&hdmi_con_in>;
+       };
+};
+
 &i2c0 {
        status = "okay";
 
index 0f95a6e..1c5a666 100644 (file)
                        trips {
                                cpu_alert0: cpu-alert0 {
                                        /* milliCelsius */
-                                       temperature = <850000>;
+                                       temperature = <85000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
index 3d78169..a1953b2 100644 (file)
                                    "Headphone", "Headphone Jack";
        /* Board level routing. First 2 routes copied from SoC level */
        simple-audio-card,routing =
-               "Left DAC", "AIF1 Slot 0 Left",
-               "Right DAC", "AIF1 Slot 0 Right",
+               "Left DAC", "DACL",
+               "Right DAC", "DACR",
                "HP", "HPCOM",
                "Headphone Jack", "HP",
                "MIC1", "Microphone Jack",
index cfd3858..c458f5f 100644 (file)
                simple-audio-card,mclk-fs = <128>;
                simple-audio-card,aux-devs = <&codec_analog>;
                simple-audio-card,routing =
-                       "Left DAC", "AIF1 Slot 0 Left",
-                       "Right DAC", "AIF1 Slot 0 Right";
+                       "Left DAC", "DACL",
+                       "Right DAC", "DACR";
                status = "disabled";
 
                simple-audio-card,cpu {
index 42d62d1..2fc62ef 100644 (file)
 
 #include "axp22x.dtsi"
 
+&ir0 {
+       status = "okay";
+};
+
 &mmc0 {
        vmmc-supply = <&reg_dcdc1>;
        bus-width = <4>;
 };
 
 &reg_dc1sw {
-       regulator-min-microvolt = <3000000>;
-       regulator-max-microvolt = <3000000>;
+       regulator-min-microvolt = <3300000>;
+       regulator-max-microvolt = <3300000>;
        regulator-name = "vcc-gmac-phy";
 };
 
 &reg_dcdc1 {
        regulator-always-on;
-       regulator-min-microvolt = <3000000>;
-       regulator-max-microvolt = <3000000>;
-       regulator-name = "vcc-3v0";
+       regulator-min-microvolt = <3300000>;
+       regulator-max-microvolt = <3300000>;
+       regulator-name = "vcc-3v3";
 };
 
 &reg_dcdc2 {
index b782041..7907569 100644 (file)
                        };
                };
 
+               syscon: system-control@1c00000 {
+                       compatible = "allwinner,sun8i-r40-system-control",
+                                    "allwinner,sun4i-a10-system-control";
+                       reg = <0x01c00000 0x30>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+
+                       sram_c: sram@1d00000 {
+                               compatible = "mmio-sram";
+                               reg = <0x01d00000 0xd0000>;
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               ranges = <0 0x01d00000 0xd0000>;
+
+                               ve_sram: sram-section@0 {
+                                       compatible = "allwinner,sun8i-r40-sram-c1",
+                                                    "allwinner,sun4i-a10-sram-c1";
+                                       reg = <0x000000 0x80000>;
+                               };
+                       };
+               };
+
                nmi_intc: interrupt-controller@1c00030 {
                        compatible = "allwinner,sun7i-a20-sc-nmi";
                        interrupt-controller;
                        interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
                };
 
+               dma: dma-controller@1c02000 {
+                       compatible = "allwinner,sun8i-r40-dma",
+                                    "allwinner,sun50i-a64-dma";
+                       reg = <0x01c02000 0x1000>;
+                       interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_DMA>;
+                       dma-channels = <16>;
+                       dma-requests = <31>;
+                       resets = <&ccu RST_BUS_DMA>;
+                       #dma-cells = <1>;
+               };
+
                spi0: spi@1c05000 {
                        compatible = "allwinner,sun8i-r40-spi",
                                     "allwinner,sun8i-h3-spi";
                        status = "disabled";
                };
 
+               video-codec@1c0e000 {
+                       compatible = "allwinner,sun8i-r40-video-engine";
+                       reg = <0x01c0e000 0x1000>;
+                       clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>,
+                       <&ccu CLK_DRAM_VE>;
+                       clock-names = "ahb", "mod", "ram";
+                       resets = <&ccu RST_BUS_VE>;
+                       interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
+                       allwinner,sram = <&ve_sram 1>;
+               };
+
                mmc0: mmc@1c0f000 {
                        compatible = "allwinner,sun8i-r40-mmc",
                                     "allwinner,sun50i-a64-mmc";
                                function = "i2c4";
                        };
 
+                       ir0_pins: ir0-pins {
+                               pins = "PB4";
+                               function = "ir0";
+                       };
+
+                       ir1_pins: ir1-pins {
+                               pins = "PB23";
+                               function = "ir1";
+                       };
+
                        mmc0_pins: mmc0-pins {
                                pins = "PF0", "PF1", "PF2",
                                       "PF3", "PF4", "PF5";
                        clocks = <&osc24M>;
                };
 
+               ir0: ir@1c21800 {
+                       compatible = "allwinner,sun8i-r40-ir",
+                                    "allwinner,sun6i-a31-ir";
+                       reg = <0x01c21800 0x400>;
+                       pinctrl-0 = <&ir0_pins>;
+                       pinctrl-names = "default";
+                       clocks = <&ccu CLK_BUS_IR0>, <&ccu CLK_IR0>;
+                       clock-names = "apb", "ir";
+                       interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
+                       resets = <&ccu RST_BUS_IR0>;
+                       status = "disabled";
+               };
+
+               ir1: ir@1c21c00 {
+                       compatible = "allwinner,sun8i-r40-ir",
+                                    "allwinner,sun6i-a31-ir";
+                       reg = <0x01c21c00 0x400>;
+                       pinctrl-0 = <&ir1_pins>;
+                       pinctrl-names = "default";
+                       clocks = <&ccu CLK_BUS_IR1>, <&ccu CLK_IR1>;
+                       clock-names = "apb", "ir";
+                       interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
+                       resets = <&ccu RST_BUS_IR1>;
+                       status = "disabled";
+               };
+
                ths: thermal-sensor@1c24c00 {
                        compatible = "allwinner,sun8i-r40-ths";
                        reg = <0x01c24c00 0x100>;
                        #size-cells = <0>;
                };
 
+               mali: gpu@1c40000 {
+                       compatible = "allwinner,sun8i-r40-mali", "arm,mali-400";
+                       reg = <0x01c40000 0x10000>;
+                       interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "gp",
+                                         "gpmmu",
+                                         "pp0",
+                                         "ppmmu0",
+                                         "pp1",
+                                         "ppmmu1",
+                                         "pmu";
+                       clocks = <&ccu CLK_BUS_GPU>, <&ccu CLK_GPU>;
+                       clock-names = "bus", "core";
+                       resets = <&ccu RST_BUS_GPU>;
+               };
+
                gmac: ethernet@1c50000 {
                        compatible = "allwinner,sun8i-r40-gmac";
                        syscon = <&ccu>;
diff --git a/arch/arm/boot/dts/sun8i-s3-pinecube.dts b/arch/arm/boot/dts/sun8i-s3-pinecube.dts
new file mode 100644 (file)
index 0000000..9bab6b7
--- /dev/null
@@ -0,0 +1,235 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR X11)
+/*
+ * Copyright 2019 Icenowy Zheng <icenowy@aosc.io>
+ */
+
+/dts-v1/;
+#include "sun8i-v3.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "PineCube IP Camera";
+       compatible = "pine64,pinecube", "allwinner,sun8i-s3";
+
+       aliases {
+               serial0 = &uart2;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led1 {
+                       label = "pine64:ir:led1";
+                       gpios = <&pio 1 10 GPIO_ACTIVE_LOW>; /* PB10 */
+               };
+
+               led2 {
+                       label = "pine64:ir:led2";
+                       gpios = <&pio 1 12 GPIO_ACTIVE_LOW>; /* PB12 */
+               };
+       };
+
+       reg_vcc5v0: vcc5v0 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc5v0";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+       };
+
+       reg_vcc_wifi: vcc-wifi {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc-wifi";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&pio 1 2 GPIO_ACTIVE_LOW>; /* PB2 WIFI-EN */
+               vin-supply = <&reg_dcdc3>;
+               startup-delay-us = <200000>;
+       };
+
+       wifi_pwrseq: wifi_pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               reset-gpios = <&pio 1 3 GPIO_ACTIVE_LOW>; /* PB3 WIFI-RST */
+               post-power-on-delay-ms = <200>;
+       };
+};
+
+&csi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&csi1_8bit_pins>;
+       status = "okay";
+
+       port {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               csi1_ep: endpoint {
+                       remote-endpoint = <&ov5640_ep>;
+                       bus-width = <8>;
+                       hsync-active = <1>; /* Active high */
+                       vsync-active = <0>; /* Active low */
+                       data-active = <1>;  /* Active high */
+                       pclk-sample = <1>;  /* Rising */
+               };
+       };
+};
+
+&emac {
+       phy-handle = <&int_mii_phy>;
+       phy-mode = "mii";
+       status = "okay";
+};
+
+&i2c0 {
+       status = "okay";
+
+       axp209: pmic@34 {
+               compatible = "x-powers,axp203",
+                            "x-powers,axp209";
+               reg = <0x34>;
+               interrupt-parent = <&gic>;
+               interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+       };
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c1_pe_pins>;
+       status = "okay";
+
+       ov5640: camera@3c {
+               compatible = "ovti,ov5640";
+               reg = <0x3c>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&csi1_mclk_pin>;
+               clocks = <&ccu CLK_CSI1_MCLK>;
+               clock-names = "xclk";
+
+               AVDD-supply = <&reg_ldo3>;
+               DOVDD-supply = <&reg_ldo3>;
+               DVDD-supply = <&reg_ldo4>;
+               reset-gpios = <&pio 4 23 GPIO_ACTIVE_LOW>; /* PE23 */
+               powerdown-gpios = <&pio 4 24 GPIO_ACTIVE_HIGH>; /* PE24 */
+
+               port {
+                       ov5640_ep: endpoint {
+                               remote-endpoint = <&csi1_ep>;
+                               bus-width = <8>;
+                               hsync-active = <1>; /* Active high */
+                               vsync-active = <0>; /* Active low */
+                               data-active = <1>;  /* Active high */
+                               pclk-sample = <1>;  /* Rising */
+                       };
+               };
+       };
+};
+
+&lradc {
+       vref-supply = <&reg_ldo2>;
+       status = "okay";
+
+       button-200 {
+               label = "Setup";
+               linux,code = <KEY_SETUP>;
+               channel = <0>;
+               voltage = <190000>;
+       };
+};
+
+&mmc0 {
+       vmmc-supply = <&reg_dcdc3>;
+       bus-width = <4>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&mmc1 {
+       vmmc-supply = <&reg_vcc_wifi>;
+       vqmmc-supply = <&reg_dcdc3>;
+       mmc-pwrseq = <&wifi_pwrseq>;
+       bus-width = <4>;
+       non-removable;
+       status = "okay";
+};
+
+&pio {
+       vcc-pd-supply = <&reg_dcdc3>;
+       vcc-pe-supply = <&reg_ldo3>;
+};
+
+#include "axp209.dtsi"
+
+&ac_power_supply {
+       status = "okay";
+};
+
+&reg_dcdc2 {
+       regulator-always-on;
+       regulator-min-microvolt = <1250000>;
+       regulator-max-microvolt = <1250000>;
+       regulator-name = "vdd-sys-cpu-ephy";
+};
+
+&reg_dcdc3 {
+       regulator-always-on;
+       regulator-min-microvolt = <3300000>;
+       regulator-max-microvolt = <3300000>;
+       regulator-name = "vcc-3v3";
+};
+
+&reg_ldo1 {
+       regulator-name = "vdd-rtc";
+};
+
+&reg_ldo2 {
+       regulator-always-on;
+       regulator-min-microvolt = <3000000>;
+       regulator-max-microvolt = <3000000>;
+       regulator-name = "avcc";
+};
+
+&reg_ldo3 {
+       regulator-min-microvolt = <2800000>;
+       regulator-max-microvolt = <2800000>;
+       regulator-name = "avdd-dovdd-2v8-csi";
+       regulator-soft-start;
+       regulator-ramp-delay = <1600>;
+};
+
+&reg_ldo4 {
+       regulator-min-microvolt = <1800000>;
+       regulator-max-microvolt = <1800000>;
+       regulator-name = "dvdd-1v8-csi";
+};
+
+&spi0 {
+       status = "okay";
+
+       flash@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "winbond,w25q128", "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <40000000>;
+       };
+};
+
+&uart2 {
+       status = "okay";
+};
+
+&usb_otg {
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usbphy {
+       usb0_vbus-supply = <&reg_vcc5v0>;
+       status = "okay";
+};
index 6ae8645..ca4672e 100644 (file)
@@ -9,6 +9,19 @@
        compatible = "allwinner,sun8i-v3-ccu";
 };
 
+&emac {
+       /delete-property/ phy-handle;
+       /delete-property/ phy-mode;
+};
+
+&mdio_mux {
+       external_mdio: mdio@2 {
+               reg = <2>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+};
+
 &pio {
        compatible = "allwinner,sun8i-v3-pinctrl";
 };
index e531286..0c73416 100644 (file)
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/clock/sun8i-v3s-ccu.h>
 #include <dt-bindings/reset/sun8i-v3s-ccu.h>
+#include <dt-bindings/clock/sun8i-de2.h>
 
 / {
        #address-cells = <1>;
        #size-cells = <1>;
        interrupt-parent = <&gic>;
 
+       chosen {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               framebuffer-lcd {
+                       compatible = "allwinner,simple-framebuffer",
+                                    "simple-framebuffer";
+                       allwinner,pipeline = "mixer0-lcd0";
+                       clocks = <&display_clocks CLK_MIXER0>,
+                                <&ccu CLK_TCON0>;
+                       status = "disabled";
+               };
+       };
+
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                        };
                };
 
+               syscon: system-control@1c00000 {
+                       compatible = "allwinner,sun8i-v3s-system-control",
+                                    "allwinner,sun8i-h3-system-control";
+                       reg = <0x01c00000 0x1000>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+               };
+
                tcon0: lcd-controller@1c0c000 {
                        compatible = "allwinner,sun8i-v3s-tcon";
                        reg = <0x01c0c000 0x1000>;
                        #size-cells = <0>;
                };
 
+               crypto@1c15000 {
+                       compatible = "allwinner,sun8i-v3s-crypto",
+                                    "allwinner,sun8i-a33-crypto";
+                       reg = <0x01c15000 0x1000>;
+                       interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_CE>, <&ccu CLK_CE>;
+                       clock-names = "ahb", "mod";
+                       resets = <&ccu RST_BUS_CE>;
+                       reset-names = "ahb";
+               };
+
                usb_otg: usb@1c19000 {
                        compatible = "allwinner,sun8i-h3-musb";
                        reg = <0x01c19000 0x0400>;
                        interrupt-controller;
                        #interrupt-cells = <3>;
 
+                       /omit-if-no-ref/
+                       csi1_8bit_pins: csi1-8bit-pins {
+                               pins = "PE0", "PE2", "PE3", "PE8", "PE9",
+                                      "PE10", "PE11", "PE12", "PE13", "PE14",
+                                      "PE15";
+                               function = "csi";
+                       };
+
+                       /omit-if-no-ref/
+                       csi1_mclk_pin: csi1-mclk-pin {
+                               pins = "PE1";
+                               function = "csi";
+                       };
+
                        i2c0_pins: i2c0-pins {
                                pins = "PB6", "PB7";
                                function = "i2c0";
                        };
 
+                       /omit-if-no-ref/
+                       i2c1_pe_pins: i2c1-pe-pins {
+                               pins = "PE21", "PE22";
+                               function = "i2c1";
+                       };
+
                        uart0_pb_pins: uart0-pb-pins {
                                pins = "PB8", "PB9";
                                function = "uart0";
                        };
 
+                       uart2_pins: uart2-pins {
+                               pins = "PB0", "PB1";
+                               function = "uart2";
+                       };
+
                        mmc0_pins: mmc0-pins {
                                pins = "PF0", "PF1", "PF2", "PF3",
                                       "PF4", "PF5";
                        reg-io-width = <4>;
                        clocks = <&ccu CLK_BUS_UART2>;
                        resets = <&ccu RST_BUS_UART2>;
+                       pinctrl-0 = <&uart2_pins>;
+                       pinctrl-names = "default";
                        status = "disabled";
                };
 
                        #size-cells = <0>;
                };
 
+               emac: ethernet@1c30000 {
+                       compatible = "allwinner,sun8i-v3s-emac";
+                       syscon = <&syscon>;
+                       reg = <0x01c30000 0x10000>;
+                       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";
+                       phy-handle = <&int_mii_phy>;
+                       phy-mode = "mii";
+                       status = "disabled";
+
+                       mdio: mdio {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "snps,dwmac-mdio";
+                       };
+
+                       mdio_mux: mdio-mux {
+                               compatible = "allwinner,sun8i-h3-mdio-mux";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               mdio-parent-bus = <&mdio>;
+                               /* Only one MDIO is usable at the time */
+                               internal_mdio: mdio@1 {
+                                       compatible = "allwinner,sun8i-h3-mdio-internal";
+                                       reg = <1>;
+                                       #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@1c68000 {
                        compatible = "allwinner,sun8i-h3-spi";
                        reg = <0x01c68000 0x1000>;
                        #size-cells = <0>;
                };
 
+               csi1: camera@1cb4000 {
+                       compatible = "allwinner,sun8i-v3s-csi";
+                       reg = <0x01cb4000 0x3000>;
+                       interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_CSI>,
+                                <&ccu CLK_CSI1_SCLK>,
+                                <&ccu CLK_DRAM_CSI>;
+                       clock-names = "bus", "mod", "ram";
+                       resets = <&ccu RST_BUS_CSI>;
+                       status = "disabled";
+               };
+
                gic: interrupt-controller@1c81000 {
                        compatible = "arm,gic-400";
                        reg = <0x01c81000 0x1000>,
index 54fd522..d584da3 100644 (file)
@@ -51,7 +51,7 @@
                };
        };
 
-       l2cc: l2-cache-controller@20100000 {
+       l2cc: cache-controller@20100000 {
                compatible = "arm,pl310-cache";
                reg = <0x20100000 0x1000>;
                cache-level = <2>;
index 2d683c9..a0b8297 100644 (file)
        compatible = "acer,picasso", "nvidia,tegra20";
 
        aliases {
+               mmc0 = &sdmmc4; /* eMMC */
+               mmc1 = &sdmmc3; /* MicroSD */
+               mmc2 = &sdmmc1; /* WiFi */
+
                rtc0 = &pmic;
                rtc1 = "/rtc@7000e000";
 
                                nvidia,pins = "drive_ddc",
                                                "drive_vi1",
                                                "drive_sdio1";
+                               nvidia,pull-up-strength = <31>;
+                               nvidia,pull-down-strength = <31>;
                                nvidia,schmitt = <TEGRA_PIN_ENABLE>;
-                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_4>;
+                               nvidia,high-speed-mode = <TEGRA_PIN_DISABLE>;
+                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
+                               nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_SLOWEST>;
+                               nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_SLOWEST>;
                        };
                        drive_dbg {
                                nvidia,pins = "drive_dbg",
                                                "drive_vi2",
                                                "drive_at1",
                                                "drive_ao1";
+                               nvidia,pull-up-strength = <31>;
+                               nvidia,pull-down-strength = <31>;
                                nvidia,schmitt = <TEGRA_PIN_ENABLE>;
-                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_4>;
+                               nvidia,high-speed-mode = <TEGRA_PIN_DISABLE>;
+                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
                                nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
                                nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
                        };
                        compatible = "atmel,maxtouch";
                        reg = <0x4c>;
 
-                       atmel,cfg_name = "maxtouch-acer-iconia-tab-a500.cfg";
-
                        interrupt-parent = <&gpio>;
                        interrupts = <TEGRA_GPIO(V, 6) IRQ_TYPE_LEVEL_LOW>;
 
                power-off-delay-us = <300>;
        };
 
-       mmc@c8000000 {
+       sdmmc1: mmc@c8000000 {
                status = "okay";
 
                #address-cells = <1>;
                #size-cells = <0>;
 
-               max-frequency = <25000000>;
+               assigned-clocks = <&tegra_car TEGRA20_CLK_SDMMC1>;
+               assigned-clock-parents = <&tegra_car TEGRA20_CLK_PLL_C>;
+               assigned-clock-rates = <50000000>;
+
+               max-frequency = <50000000>;
                keep-power-in-suspend;
                bus-width = <4>;
                non-removable;
                };
        };
 
-       mmc@c8000400 {
+       sdmmc3: mmc@c8000400 {
                status = "okay";
                bus-width = <4>;
                cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
                vqmmc-supply = <&vdd_3v3_sys>;
        };
 
-       mmc@c8000600 {
+       sdmmc4: mmc@c8000600 {
                status = "okay";
                bus-width = <8>;
                vmmc-supply = <&vcore_emmc>;
index 3922517..88ca03f 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <dt-bindings/input/gpio-keys.h>
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/power/summit,smb347-charger.h>
 #include <dt-bindings/thermal/thermal.h>
 
 #include "tegra30.dtsi"
@@ -10,6 +11,9 @@
 
 / {
        aliases {
+               mmc0 = &sdmmc4; /* eMMC */
+               mmc1 = &sdmmc3; /* WiFi */
+
                rtc0 = &pmic;
                rtc1 = "/rtc@7000e000";
 
        i2c@7000c400 {
                clock-frequency = <400000>;
                status = "okay";
+
+               touchscreen@10 {
+                       compatible ="elan,ektf3624";
+                       reg = <0x10>;
+
+                       interrupt-parent = <&gpio>;
+                       interrupts = <TEGRA_GPIO(H, 4) IRQ_TYPE_LEVEL_LOW>;
+
+                       reset-gpios = <&gpio TEGRA_GPIO(H, 6) GPIO_ACTIVE_LOW>;
+
+                       vcc33-supply = <&vcc_3v3_ts>;
+                       vccio-supply = <&vcc_3v3_ts>;
+
+                       touchscreen-size-x = <2112>;
+                       touchscreen-size-y = <1280>;
+                       touchscreen-swapped-x-y;
+                       touchscreen-inverted-x;
+               };
        };
 
        i2c@7000c500 {
                        #thermal-sensor-cells = <1>;
                };
 
-               battery@55 {
+               fuel-gauge@55 {
                        compatible = "ti,bq27541";
                        reg = <0x55>;
+                       power-supplies = <&power_supply>;
+                       monitored-battery = <&battery_cell>;
+               };
+
+               power_supply: charger@6a {
+                       compatible = "summit,smb347";
+                       reg = <0x6a>;
+
+                       interrupt-parent = <&gpio>;
+                       interrupts = <TEGRA_GPIO(V, 1) IRQ_TYPE_EDGE_BOTH>;
+
+                       summit,enable-charge-control = <SMB3XX_CHG_ENABLE_PIN_ACTIVE_LOW>;
+                       summit,enable-usb-charging;
+
+                       monitored-battery = <&battery_cell>;
                };
        };
 
                power-off-delay-us = <300>;
        };
 
-       mmc@78000400 {
+       sdmmc3: mmc@78000400 {
                status = "okay";
 
                #address-cells = <1>;
                #size-cells = <0>;
 
+               assigned-clocks = <&tegra_car TEGRA30_CLK_SDMMC3>;
+               assigned-clock-parents = <&tegra_car TEGRA30_CLK_PLL_C>;
+               assigned-clock-rates = <50000000>;
+
+               max-frequency = <50000000>;
                keep-power-in-suspend;
                bus-width = <4>;
                non-removable;
                };
        };
 
-       mmc@78000600 {
+       sdmmc4: mmc@78000600 {
                status = "okay";
                bus-width = <8>;
                vmmc-supply = <&vcore_emmc>;
                default-brightness-level = <15>;
        };
 
+       battery_cell: battery-cell {
+               compatible = "simple-battery";
+               constant-charge-current-max-microamp = <1800000>;
+               operating-range-celsius = <0 45>;
+       };
+
        /* PMIC has a built-in 32KHz oscillator which is used by PMC */
        clk32k_in: clock@0 {
                compatible = "fixed-clock";
index dd6957b..70e5635 100644 (file)
@@ -10,7 +10,7 @@
                bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock6 rw rootfstype=ubifs";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
index 2820635..62b7d9f 100644 (file)
@@ -15,7 +15,7 @@
                bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
index ec8cd86..6cfa839 100644 (file)
@@ -16,7 +16,7 @@
                bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
index e7a705f..8a0cfbf 100644 (file)
@@ -15,7 +15,7 @@
                bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
index adbe750..7d10b36 100644 (file)
@@ -14,7 +14,7 @@
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
+       memory@20000000 {
                reg = <0x20000000 0x4000000>;
        };
 
index a88ee52..4f7220b 100644 (file)
                                        reg = <0x0f0000 0x1000>;
                                        interrupts = <0>;
                                        clocks = <&v2m_refclk32khz>, <&smbclk>;
-                                       clock-names = "wdogclk", "apb_pclk";
+                                       clock-names = "wdog_clk", "apb_pclk";
                                };
 
                                v2m_timer01: timer@110000 {
index 5e48b64..2ac41ed 100644 (file)
                                        reg = <0x0f000 0x1000>;
                                        interrupts = <0>;
                                        clocks = <&v2m_refclk32khz>, <&smbclk>;
-                                       clock-names = "wdogclk", "apb_pclk";
+                                       clock-names = "wdog_clk", "apb_pclk";
                                };
 
                                v2m_timer01: timer@11000 {
index f82fa34..e63c5c0 100644 (file)
@@ -87,8 +87,8 @@
                status = "disabled";
                reg = <0 0x2b060000 0 0x1000>;
                interrupts = <0 98 4>;
-               clocks = <&sys_pll>;
-               clock-names = "apb_pclk";
+               clocks = <&sys_pll>, <&sys_pll>;
+               clock-names = "wdog_clk", "apb_pclk";
        };
 
        gic: interrupt-controller@2c001000 {
index 3ac95a1..012d40a 100644 (file)
                reg = <0 0x2a490000 0 0x1000>;
                interrupts = <0 98 4>;
                clocks = <&oscclk6a>, <&oscclk6a>;
-               clock-names = "wdogclk", "apb_pclk";
+               clock-names = "wdog_clk", "apb_pclk";
        };
 
        hdlcd@2b000000 {
index 623246f..4c58479 100644 (file)
                reg = <0x100e4000 0x1000>;
                interrupts = <0 48 4>,
                             <0 49 4>;
-               clocks = <&oscclk2>, <&oscclk2>;
-               clock-names = "timclk", "apb_pclk";
+               clocks = <&oscclk2>, <&oscclk2>, <&oscclk2>;
+               clock-names = "timer0clk", "timer1clk", "apb_pclk";
                status = "disabled";
        };
 
                reg = <0x100e5000 0x1000>;
                interrupts = <0 51 4>;
                clocks = <&oscclk2>, <&oscclk2>;
-               clock-names = "wdogclk", "apb_pclk";
+               clock-names = "wdog_clk", "apb_pclk";
        };
 
        scu@1e000000 {
index 64e0e95..96495d9 100644 (file)
                        interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
                        interrupt-controller;
                        #interrupt-cells = <2>;
-                       reset-gpios = <&gpio3 11 GPIO_ACTIVE_LOW>;
 
                        ports {
                                #address-cells = <1>;
                compatible = "nxp,pca9554";
                reg = <0x22>;
                gpio-controller;
+               #gpio-cells = <2>;
        };
 
        lm75@48 {
        pinctrl_switch: switch-grp {
                fsl,pins = <
                        VF610_PAD_PTB28__GPIO_98                0x3061
-                       VF610_PAD_PTE2__GPIO_107                0x1042
                >;
        };
 
index 9e5187b..6c6ec46 100644 (file)
                        pinctrl-names = "default";
                        reg = <0>;
                        eeprom-length = <65536>;
-                       reset-gpios = <&gpio3 11 GPIO_ACTIVE_LOW>;
                        interrupt-parent = <&gpio3>;
                        interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
                        interrupt-controller;
 
        pinctrl_gpio_switch0: pinctrl-gpio-switch0 {
                fsl,pins = <
-                       VF610_PAD_PTE2__GPIO_107                0x31c2
                        VF610_PAD_PTB28__GPIO_98                0x219d
                >;
        };
index 569614b..73fdace 100644 (file)
                        pinctrl-names = "default";
                        reg = <0>;
                        eeprom-length = <65536>;
-                       reset-gpios = <&gpio3 11 GPIO_ACTIVE_LOW>;
                        interrupt-parent = <&gpio3>;
                        interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
                        interrupt-controller;
 
        pinctrl_gpio_switch0: pinctrl-gpio-switch0 {
                fsl,pins = <
-                       VF610_PAD_PTE2__GPIO_107                0x31c2
                        VF610_PAD_PTB28__GPIO_98                0x219d
                >;
        };
index b6b0f30..fe600ab 100644 (file)
                        pinctrl-names = "default";
                        reg = <0>;
                        eeprom-length = <65536>;
-                       reset-gpios = <&gpio3 11 GPIO_ACTIVE_LOW>;
                        interrupt-parent = <&gpio3>;
                        interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
                        interrupt-controller;
 
        pinctrl_gpio_switch0: pinctrl-gpio-switch0 {
                fsl,pins = <
-                       VF610_PAD_PTE2__GPIO_107                0x31c2
                        VF610_PAD_PTB28__GPIO_98                0x219d
                >;
        };
index afd98de..f378c66 100644 (file)
@@ -58,7 +58,7 @@
                        clocks = <&topclk ZX296702_A9_PERIPHCLK>;
                };
 
-               l2cc: l2-cache-controller@c00000 {
+               l2cc: cache-controller@c00000 {
                        compatible = "arm,pl310-cache";
                        reg = <0x00c00000 0x1000>;
                        cache-unified;
index c98ebae..f89c1ea 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/clk.h>
 #include <linux/io.h>
 
index 303f75a..58d293b 100644 (file)
@@ -160,7 +160,8 @@ CONFIG_SENSORS_TMP421=y
 CONFIG_SENSORS_W83773G=y
 CONFIG_WATCHDOG_SYSFS=y
 CONFIG_MEDIA_SUPPORT=y
-CONFIG_MEDIA_CAMERA_SUPPORT=y
+CONFIG_MEDIA_SUPPORT_FILTER=y
+CONFIG_MEDIA_PLATFORM_SUPPORT=y
 CONFIG_V4L_PLATFORM_DRIVERS=y
 CONFIG_VIDEO_ASPEED=y
 CONFIG_DRM=y
index b0d056d..047975e 100644 (file)
@@ -128,6 +128,8 @@ CONFIG_INPUT_EVDEV=y
 CONFIG_KEYBOARD_GPIO=y
 CONFIG_KEYBOARD_GPIO_POLLED=y
 # CONFIG_INPUT_MOUSE is not set
+CONFIG_INPUT_MISC=y
+CONFIG_INPUT_IBM_PANEL=y
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -147,10 +149,12 @@ CONFIG_HW_RANDOM_TIMERIOMEM=y
 # CONFIG_I2C_COMPAT is not set
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_MUX=y
+CONFIG_I2C_MUX_GPIO=y
 CONFIG_I2C_MUX_PCA9541=y
 CONFIG_I2C_MUX_PCA954x=y
 CONFIG_I2C_ASPEED=y
 CONFIG_I2C_FSI=y
+CONFIG_I2C_SLAVE=y
 CONFIG_SPI=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_SYSFS=y
@@ -175,7 +179,8 @@ CONFIG_SENSORS_TMP421=y
 CONFIG_SENSORS_W83773G=y
 CONFIG_WATCHDOG_SYSFS=y
 CONFIG_MEDIA_SUPPORT=y
-CONFIG_MEDIA_CAMERA_SUPPORT=y
+CONFIG_MEDIA_SUPPORT_FILTER=y
+CONFIG_MEDIA_PLATFORM_SUPPORT=y
 CONFIG_V4L_PLATFORM_DRIVERS=y
 CONFIG_VIDEO_ASPEED=y
 CONFIG_DRM=y
index 6e8b5ff..cf82c9d 100644 (file)
@@ -191,11 +191,14 @@ CONFIG_REGULATOR_S2MPS11=y
 CONFIG_REGULATOR_S5M8767=y
 CONFIG_REGULATOR_TPS65090=y
 CONFIG_REGULATOR_WM8994=y
+CONFIG_MEDIA_CEC_SUPPORT=y
+CONFIG_CEC_SAMSUNG_S5P=m
 CONFIG_MEDIA_SUPPORT=m
+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
 CONFIG_MEDIA_CAMERA_SUPPORT=y
-CONFIG_MEDIA_CEC_SUPPORT=y
 CONFIG_MEDIA_CONTROLLER=y
 CONFIG_VIDEO_V4L2_SUBDEV_API=y
+CONFIG_MEDIA_PLATFORM_SUPPORT=y
 CONFIG_MEDIA_USB_SUPPORT=y
 CONFIG_USB_VIDEO_CLASS=m
 CONFIG_V4L_PLATFORM_DRIVERS=y
@@ -210,9 +213,6 @@ CONFIG_VIDEO_SAMSUNG_S5P_MFC=m
 CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC=m
 CONFIG_V4L_TEST_DRIVERS=y
 CONFIG_VIDEO_VIVID=m
-CONFIG_CEC_PLATFORM_DRIVERS=y
-CONFIG_CEC_SAMSUNG_S5P=m
-# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
 CONFIG_VIDEO_S5K6A3=m
 CONFIG_VIDEO_S5C73M3=m
 CONFIG_DRM=y
index f5f1111..bb70acc 100644 (file)
@@ -20,9 +20,9 @@ CONFIG_MACH_MX27ADS=y
 CONFIG_MACH_MX27_3DS=y
 CONFIG_MACH_IMX27_VISSTRIM_M10=y
 CONFIG_MACH_PCA100=y
-CONFIG_MACH_IMX27_DT=y
 CONFIG_SOC_IMX1=y
 CONFIG_SOC_IMX25=y
+CONFIG_SOC_IMX27=y
 CONFIG_AEABI=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
@@ -93,6 +93,7 @@ CONFIG_SPI=y
 CONFIG_SPI_IMX=y
 CONFIG_SPI_SPIDEV=y
 CONFIG_GPIO_SYSFS=y
+CONFIG_GPIO_MXC=y
 CONFIG_W1=y
 CONFIG_W1_MASTER_MXC=y
 CONFIG_W1_SLAVE_THERM=y
index 82d3ffb..221f5c3 100644 (file)
@@ -15,20 +15,8 @@ CONFIG_PERF_EVENTS=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_ARCH_MULTI_V6=y
 CONFIG_ARCH_MXC=y
-CONFIG_MACH_MX31LILLY=y
-CONFIG_MACH_MX31LITE=y
-CONFIG_MACH_PCM037=y
-CONFIG_MACH_PCM037_EET=y
-CONFIG_MACH_MX31_3DS=y
-CONFIG_MACH_MX31MOBOARD=y
-CONFIG_MACH_QONG=y
-CONFIG_MACH_ARMADILLO5X0=y
-CONFIG_MACH_KZM_ARM11_01=y
-CONFIG_MACH_IMX31_DT=y
-CONFIG_MACH_IMX35_DT=y
-CONFIG_MACH_PCM043=y
-CONFIG_MACH_MX35_3DS=y
-CONFIG_MACH_VPR200=y
+CONFIG_SOC_IMX31=y
+CONFIG_SOC_IMX35=y
 CONFIG_SOC_IMX50=y
 CONFIG_SOC_IMX51=y
 CONFIG_SOC_IMX53=y
@@ -218,6 +206,9 @@ CONFIG_SPI_GPIO=y
 CONFIG_SPI_IMX=y
 CONFIG_SPI_FSL_DSPI=y
 CONFIG_PINCTRL_IMX8MM=y
+CONFIG_PINCTRL_IMX8MN=y
+CONFIG_PINCTRL_IMX8MP=y
+CONFIG_PINCTRL_IMX8MQ=y
 CONFIG_GPIO_SYSFS=y
 CONFIG_GPIO_SIOX=m
 CONFIG_GPIO_MAX732X=y
@@ -226,6 +217,7 @@ CONFIG_GPIO_PCA953X=y
 CONFIG_GPIO_PCF857X=y
 CONFIG_GPIO_STMPE=y
 CONFIG_GPIO_74X164=y
+CONFIG_GPIO_MXC=y
 CONFIG_POWER_RESET=y
 CONFIG_POWER_RESET_SYSCON=y
 CONFIG_POWER_RESET_SYSCON_POWEROFF=y
@@ -407,6 +399,9 @@ CONFIG_STAGING_MEDIA=y
 CONFIG_VIDEO_IMX_MEDIA=y
 CONFIG_COMMON_CLK_PWM=y
 CONFIG_CLK_IMX8MM=y
+CONFIG_CLK_IMX8MN=y
+CONFIG_CLK_IMX8MP=y
+CONFIG_CLK_IMX8MQ=y
 CONFIG_SOC_IMX8M=y
 CONFIG_IIO=y
 CONFIG_MMA8452=y
index 2724fb3..e00be9f 100644 (file)
@@ -29,8 +29,8 @@ CONFIG_MACH_MX27ADS=y
 CONFIG_MACH_MX27_3DS=y
 CONFIG_MACH_IMX27_VISSTRIM_M10=y
 CONFIG_MACH_PCA100=y
-CONFIG_MACH_IMX27_DT=y
 CONFIG_SOC_IMX25=y
+CONFIG_SOC_IMX27=y
 CONFIG_ARCH_MVEBU=y
 CONFIG_MACH_KIRKWOOD=y
 CONFIG_ARCH_ORION5X=y
@@ -166,6 +166,7 @@ CONFIG_SPI_IMX=y
 CONFIG_SPI_ORION=y
 CONFIG_GPIO_ASPEED=m
 CONFIG_GPIO_ASPEED_SGPIO=y
+CONFIG_GPIO_MXC=y
 CONFIG_POWER_RESET=y
 CONFIG_POWER_RESET_GPIO=y
 CONFIG_POWER_RESET_QNAP=y
index e9e76e3..a611b0c 100644 (file)
@@ -43,10 +43,12 @@ CONFIG_SOC_IMX51=y
 CONFIG_SOC_IMX53=y
 CONFIG_SOC_IMX6Q=y
 CONFIG_SOC_IMX6SL=y
+CONFIG_SOC_IMX6SLL=y
 CONFIG_SOC_IMX6SX=y
 CONFIG_SOC_IMX6UL=y
 CONFIG_SOC_LS1021A=y
 CONFIG_SOC_IMX7D=y
+CONFIG_SOC_IMX7ULP=y
 CONFIG_SOC_VF610=y
 CONFIG_ARCH_KEYSTONE=y
 CONFIG_ARCH_MEDIATEK=y
@@ -182,7 +184,7 @@ CONFIG_PCIEPORTBUS=y
 CONFIG_PCI_MVEBU=y
 CONFIG_PCI_TEGRA=y
 CONFIG_PCI_RCAR_GEN2=y
-CONFIG_PCIE_RCAR=y
+CONFIG_PCIE_RCAR_HOST=y
 CONFIG_PCI_DRA7XX_EP=y
 CONFIG_PCI_ENDPOINT=y
 CONFIG_PCI_ENDPOINT_CONFIGFS=y
@@ -463,6 +465,7 @@ CONFIG_GPIO_PALMAS=y
 CONFIG_GPIO_TPS6586X=y
 CONFIG_GPIO_TPS65910=y
 CONFIG_GPIO_TWL4030=y
+CONFIG_GPIO_MXC=y
 CONFIG_POWER_AVS=y
 CONFIG_ROCKCHIP_IODOMAIN=y
 CONFIG_POWER_RESET_AS3722=y
@@ -1011,6 +1014,7 @@ CONFIG_EXTCON_MAX14577=m
 CONFIG_EXTCON_MAX77693=m
 CONFIG_EXTCON_MAX8997=m
 CONFIG_TI_AEMIF=y
+CONFIG_STM32_FMC2_EBI=y
 CONFIG_EXYNOS5422_DMC=m
 CONFIG_IIO=y
 CONFIG_IIO_SW_TRIGGER=y
@@ -1121,6 +1125,7 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m
 CONFIG_CRYPTO_USER_API_RNG=m
 CONFIG_CRYPTO_USER_API_AEAD=m
 CONFIG_CRYPTO_DEV_SUN4I_SS=m
+CONFIG_CRYPTO_DEV_FSL_CAAM=m
 CONFIG_CRYPTO_DEV_MARVELL_CESA=m
 CONFIG_CRYPTO_DEV_EXYNOS_RNG=m
 CONFIG_CRYPTO_DEV_S5P=m
index fe383f5..34793aa 100644 (file)
@@ -95,7 +95,18 @@ CONFIG_IP_PNP_DHCP=y
 CONFIG_IP_PNP_BOOTP=y
 CONFIG_IP_PNP_RARP=y
 CONFIG_NETFILTER=y
+CONFIG_BRIDGE=m
+CONFIG_BRIDGE_VLAN_FILTERING=y
+CONFIG_VLAN_8021Q=m
 CONFIG_PHONET=m
+CONFIG_NET_SCHED=y
+CONFIG_NET_SCH_INGRESS=m
+CONFIG_NET_CLS_U32=m
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_CLS_MATCHALL=m
+CONFIG_NET_CLS_ACT=y
+CONFIG_NET_ACT_POLICE=m
+CONFIG_NET_ACT_GACT=m
 CONFIG_NET_SWITCHDEV=y
 CONFIG_CAN=m
 CONFIG_CAN_C_CAN=m
@@ -510,6 +521,7 @@ CONFIG_IIO_ST_ACCEL_3AXIS=m
 CONFIG_CPCAP_ADC=m
 CONFIG_INA2XX_ADC=m
 CONFIG_TI_AM335X_ADC=m
+CONFIG_TWL4030_MADC=m
 CONFIG_SENSORS_ISL29028=m
 CONFIG_BMP280=m
 CONFIG_PWM=y
index 70e2c74..483c400 100644 (file)
@@ -5,9 +5,6 @@ CONFIG_HIGH_RES_TIMERS=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-# CONFIG_BLK_DEV_BSG is not set
 CONFIG_ARCH_MULTI_V6=y
 CONFIG_ARCH_REALVIEW=y
 CONFIG_MACH_REALVIEW_EB=y
@@ -20,11 +17,12 @@ CONFIG_MACH_REALVIEW_PB1176=y
 CONFIG_MACH_REALVIEW_PBA8=y
 CONFIG_MACH_REALVIEW_PBX=y
 CONFIG_SMP=y
-CONFIG_CMA=y
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_CMDLINE="root=/dev/nfs nfsroot=10.1.69.3:/work/nfsroot ip=dhcp console=ttyAMA0 mem=128M"
 CONFIG_VFP=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_BLK_DEV_BSG is not set
+CONFIG_CMA=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
@@ -59,8 +57,12 @@ CONFIG_I2C_VERSATILE=y
 CONFIG_SPI=y
 CONFIG_GPIOLIB=y
 # CONFIG_HWMON is not set
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_DRM=y
 CONFIG_DRM_PANEL_SIMPLE=y
+CONFIG_DRM_DISPLAY_CONNECTOR=y
+CONFIG_DRM_SIMPLE_BRIDGE=y
 CONFIG_DRM_PL111=y
 CONFIG_FB_MODE_HELPERS=y
 CONFIG_BACKLIGHT_CLASS_DEVICE=y
@@ -78,6 +80,7 @@ CONFIG_MMC=y
 CONFIG_MMC_ARMMMCI=y
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_SYSCON=y
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_HEARTBEAT=y
 CONFIG_LEDS_TRIGGER_CPU=y
@@ -93,10 +96,9 @@ CONFIG_NFS_FS=y
 CONFIG_ROOT_NFS=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
-CONFIG_DEBUG_FS=y
 CONFIG_MAGIC_SYSRQ=y
+CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_SCHED_DEBUG is not set
 # CONFIG_FTRACE is not set
 CONFIG_DEBUG_USER=y
-# CONFIG_CRYPTO_HW is not set
index bbedc42..4a161b3 100644 (file)
@@ -37,7 +37,7 @@ CONFIG_CAN_RCAR=y
 CONFIG_PCI=y
 CONFIG_PCI_MSI=y
 CONFIG_PCI_RCAR_GEN2=y
-CONFIG_PCIE_RCAR=y
+CONFIG_PCIE_RCAR_HOST=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_SIMPLE_PM_BUS=y
@@ -64,6 +64,7 @@ CONFIG_KEYBOARD_GPIO=y
 CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_TOUCHSCREEN_EDT_FT5X06=y
 CONFIG_TOUCHSCREEN_ST1232=y
+CONFIG_TOUCHSCREEN_STMPE=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_DA9063_ONKEY=y
 CONFIG_INPUT_ADXL34X=y
@@ -104,6 +105,7 @@ CONFIG_RENESAS_WDT=y
 CONFIG_RENESAS_RZAWDT=y
 CONFIG_MFD_AS3711=y
 CONFIG_MFD_DA9063=y
+CONFIG_MFD_STMPE=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_REGULATOR_AS3711=y
 CONFIG_REGULATOR_DA9210=y
@@ -134,7 +136,6 @@ CONFIG_DRM_SIMPLE_BRIDGE=y
 CONFIG_DRM_I2C_ADV7511=y
 CONFIG_DRM_I2C_ADV7511_AUDIO=y
 CONFIG_FB_SH_MOBILE_LCDC=y
-# CONFIG_BACKLIGHT_GENERIC is not set
 CONFIG_BACKLIGHT_PWM=y
 CONFIG_BACKLIGHT_AS3711=y
 CONFIG_SOUND=y
index 7679353..e7ecfb3 100644 (file)
@@ -9,8 +9,6 @@ CONFIG_SLAB=y
 CONFIG_ARCH_VERSATILE=y
 CONFIG_AEABI=y
 CONFIG_OABI_COMPAT=y
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_CMDLINE="root=1f03 mem=32M"
 CONFIG_FPE_NWFPE=y
 CONFIG_VFP=y
@@ -59,6 +57,7 @@ CONFIG_GPIO_PL061=y
 CONFIG_DRM=y
 CONFIG_DRM_PANEL_ARM_VERSATILE=y
 CONFIG_DRM_PANEL_SIMPLE=y
+CONFIG_DRM_DISPLAY_CONNECTOR=y
 CONFIG_DRM_SIMPLE_BRIDGE=y
 CONFIG_DRM_PL111=y
 CONFIG_FB_MODE_HELPERS=y
@@ -91,8 +90,8 @@ CONFIG_NLS_CODEPAGE_850=m
 CONFIG_NLS_ISO8859_1=m
 CONFIG_FONTS=y
 CONFIG_FONT_ACORN_8x8=y
-CONFIG_DEBUG_FS=y
 CONFIG_MAGIC_SYSRQ=y
+CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_KERNEL=y
 CONFIG_DEBUG_USER=y
 CONFIG_DEBUG_LL=y
index 1d65ed3..e3ea345 100644 (file)
@@ -24,6 +24,6 @@
 #define ARCH_SLAB_MINALIGN 8
 #endif
 
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(".data..read_mostly")
 
 #endif
index 6b2ff72..0d67ed6 100644 (file)
@@ -42,7 +42,7 @@ struct of_cpuidle_method {
 
 #define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops)                 \
        static const struct of_cpuidle_method __cpuidle_method_of_table_##name \
-       __used __section(__cpuidle_method_of_table)                     \
+       __used __section("__cpuidle_method_of_table")                   \
        = { .method = _method, .ops = _ops }
 
 extern int arm_cpuidle_suspend(int index);
index aab7e83..baebb67 100644 (file)
@@ -6,7 +6,7 @@
 #include <linux/pgtable.h>
 
 /* Tag a function as requiring to be executed via an identity mapping. */
-#define __idmap __section(.idmap.text) noinline notrace
+#define __idmap __section(".idmap.text") noinline notrace
 
 extern pgd_t *idmap_pgd;
 
index e7df5a8..eec0c0b 100644 (file)
@@ -81,7 +81,7 @@ extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
 #define MACHINE_START(_type,_name)                     \
 static const struct machine_desc __mach_desc_##_type   \
  __used                                                        \
- __attribute__((__section__(".arch.info.init"))) = {   \
+ __section(".arch.info.init") = {                      \
        .nr             = MACH_TYPE_##_type,            \
        .name           = _name,
 
@@ -91,7 +91,7 @@ static const struct machine_desc __mach_desc_##_type  \
 #define DT_MACHINE_START(_name, _namestr)              \
 static const struct machine_desc __mach_desc_##_name   \
  __used                                                        \
- __attribute__((__section__(".arch.info.init"))) = {   \
+ __section(".arch.info.init") = {                      \
        .nr             = ~0,                           \
        .name           = _namestr,
 
index 67d2071..3ae68a1 100644 (file)
@@ -14,7 +14,7 @@
 #include <uapi/asm/setup.h>
 
 
-#define __tag __used __attribute__((__section__(".taglist.init")))
+#define __tag __used __section(".taglist.init")
 #define __tagtable(tag, fn) \
 static const struct tagtable __tagtable_##fn __tag = { tag, fn }
 
index 0ca55a6..5d508f5 100644 (file)
@@ -112,7 +112,7 @@ struct of_cpu_method {
 
 #define CPU_METHOD_OF_DECLARE(name, _method, _ops)                     \
        static const struct of_cpu_method __cpu_method_of_table_##name  \
-               __used __section(__cpu_method_of_table)                 \
+               __used __section("__cpu_method_of_table")               \
                = { .method = _method, .ops = _ops }
 /*
  * set platform specific SMP operations
index b845b10..d8bd8a4 100644 (file)
 #include <linux/compiler.h>
 
 /* Tag variables with this */
-#define __tcmdata __section(.tcm.data)
+#define __tcmdata __section(".tcm.data")
 /* Tag constants with this */
-#define __tcmconst __section(.tcm.rodata)
+#define __tcmconst __section(".tcm.rodata")
 /* Tag functions inside TCM called from outside TCM with this */
-#define __tcmfunc __attribute__((long_call)) __section(.tcm.text) noinline
+#define __tcmfunc __attribute__((long_call)) __section(".tcm.text") noinline
 /* Tag function inside TCM called from inside TCM  with this */
-#define __tcmlocalfunc __section(.tcm.text)
+#define __tcmlocalfunc __section(".tcm.text")
 
 void *tcm_alloc(size_t len);
 void tcm_free(void *addr, size_t len);
index 7ffe669..0ff32ff 100644 (file)
@@ -32,6 +32,8 @@
 #define UARTA_7271             UARTA_7268
 #define UARTA_7278             REG_PHYS_ADDR_V7(0x40c000)
 #define UARTA_7216             UARTA_7278
+#define UARTA_72164            UARTA_7278
+#define UARTA_72165            UARTA_7278
 #define UARTA_7364             REG_PHYS_ADDR(0x40b000)
 #define UARTA_7366             UARTA_7364
 #define UARTA_74371            REG_PHYS_ADDR(0x406b00)
@@ -84,17 +86,19 @@ ARM_BE8(    rev     \rv, \rv )
                /* Chip specific detection starts here */
 20:            checkuart(\rp, \rv, 0x33900000, 3390)
 21:            checkuart(\rp, \rv, 0x72160000, 7216)
-22:            checkuart(\rp, \rv, 0x72500000, 7250)
-23:            checkuart(\rp, \rv, 0x72550000, 7255)
-24:            checkuart(\rp, \rv, 0x72600000, 7260)
-25:            checkuart(\rp, \rv, 0x72680000, 7268)
-26:            checkuart(\rp, \rv, 0x72710000, 7271)
-27:            checkuart(\rp, \rv, 0x72780000, 7278)
-28:            checkuart(\rp, \rv, 0x73640000, 7364)
-29:            checkuart(\rp, \rv, 0x73660000, 7366)
-30:            checkuart(\rp, \rv, 0x07437100, 74371)
-31:            checkuart(\rp, \rv, 0x74390000, 7439)
-32:            checkuart(\rp, \rv, 0x74450000, 7445)
+22:            checkuart(\rp, \rv, 0x07216400, 72164)
+23:            checkuart(\rp, \rv, 0x07216500, 72165)
+24:            checkuart(\rp, \rv, 0x72500000, 7250)
+25:            checkuart(\rp, \rv, 0x72550000, 7255)
+26:            checkuart(\rp, \rv, 0x72600000, 7260)
+27:            checkuart(\rp, \rv, 0x72680000, 7268)
+28:            checkuart(\rp, \rv, 0x72710000, 7271)
+29:            checkuart(\rp, \rv, 0x72780000, 7278)
+30:            checkuart(\rp, \rv, 0x73640000, 7364)
+31:            checkuart(\rp, \rv, 0x73660000, 7366)
+32:            checkuart(\rp, \rv, 0x07437100, 74371)
+33:            checkuart(\rp, \rv, 0x74390000, 7439)
+34:            checkuart(\rp, \rv, 0x74450000, 7445)
 
                /* No valid UART found */
 90:            mov     \rp, #0
index 093368e..e168462 100644 (file)
@@ -11,7 +11,7 @@
 extern struct of_cpuidle_method __cpuidle_method_of_table[];
 
 static const struct of_cpuidle_method __cpuidle_method_of_table_sentinel
-       __used __section(__cpuidle_method_of_table_end);
+       __used __section("__cpuidle_method_of_table_end");
 
 static struct cpuidle_ops cpuidle_ops[NR_CPUS] __ro_after_init;
 
index 39c9786..7f0745a 100644 (file)
@@ -29,7 +29,7 @@
 extern struct of_cpu_method __cpu_method_of_table[];
 
 static const struct of_cpu_method __cpu_method_of_table_sentinel
-       __used __section(__cpu_method_of_table_end);
+       __used __section("__cpu_method_of_table_end");
 
 
 static int __init set_smp_ops_by_method(struct device_node *node)
index 5f4922e..f7f4620 100644 (file)
@@ -41,6 +41,10 @@ SECTIONS
 #ifndef CONFIG_SMP_ON_UP
                *(.alt.smp.init)
 #endif
+#ifndef CONFIG_ARM_UNWIND
+               *(.ARM.exidx) *(.ARM.exidx.*)
+               *(.ARM.extab) *(.ARM.extab.*)
+#endif
        }
 
        . = PAGE_OFFSET + TEXT_OFFSET;
index 2aab043..120f9aa 100644 (file)
@@ -51,10 +51,11 @@ static struct at91_soc_pm soc_pm = {
 };
 
 static const match_table_t pm_modes __initconst = {
-       { AT91_PM_STANDBY, "standby" },
-       { AT91_PM_ULP0, "ulp0" },
-       { AT91_PM_ULP1, "ulp1" },
-       { AT91_PM_BACKUP, "backup" },
+       { AT91_PM_STANDBY,      "standby" },
+       { AT91_PM_ULP0,         "ulp0" },
+       { AT91_PM_ULP0_FAST,    "ulp0-fast" },
+       { AT91_PM_ULP1,         "ulp1" },
+       { AT91_PM_BACKUP,       "backup" },
        { -1, NULL },
 };
 
@@ -557,11 +558,6 @@ static void at91rm9200_idle(void)
        writel(AT91_PMC_PCK, soc_pm.data.pmc + AT91_PMC_SCDR);
 }
 
-static void at91sam9x60_idle(void)
-{
-       cpu_do_idle();
-}
-
 static void at91sam9_idle(void)
 {
        writel(AT91_PMC_PCK, soc_pm.data.pmc + AT91_PMC_SCDR);
@@ -789,6 +785,51 @@ static const struct of_device_id atmel_pmc_ids[] __initconst = {
        { /* sentinel */ },
 };
 
+static void __init at91_pm_modes_validate(const int *modes, int len)
+{
+       u8 i, standby = 0, suspend = 0;
+       int mode;
+
+       for (i = 0; i < len; i++) {
+               if (standby && suspend)
+                       break;
+
+               if (modes[i] == soc_pm.data.standby_mode && !standby) {
+                       standby = 1;
+                       continue;
+               }
+
+               if (modes[i] == soc_pm.data.suspend_mode && !suspend) {
+                       suspend = 1;
+                       continue;
+               }
+       }
+
+       if (!standby) {
+               if (soc_pm.data.suspend_mode == AT91_PM_STANDBY)
+                       mode = AT91_PM_ULP0;
+               else
+                       mode = AT91_PM_STANDBY;
+
+               pr_warn("AT91: PM: %s mode not supported! Using %s.\n",
+                       pm_modes[soc_pm.data.standby_mode].pattern,
+                       pm_modes[mode].pattern);
+               soc_pm.data.standby_mode = mode;
+       }
+
+       if (!suspend) {
+               if (soc_pm.data.standby_mode == AT91_PM_ULP0)
+                       mode = AT91_PM_STANDBY;
+               else
+                       mode = AT91_PM_ULP0;
+
+               pr_warn("AT91: PM: %s mode not supported! Using %s.\n",
+                       pm_modes[soc_pm.data.suspend_mode].pattern,
+                       pm_modes[mode].pattern);
+               soc_pm.data.suspend_mode = mode;
+       }
+}
+
 static void __init at91_pm_init(void (*pm_idle)(void))
 {
        struct device_node *pmc_np;
@@ -800,6 +841,7 @@ static void __init at91_pm_init(void (*pm_idle)(void))
 
        pmc_np = of_find_matching_node_and_match(NULL, atmel_pmc_ids, &of_id);
        soc_pm.data.pmc = of_iomap(pmc_np, 0);
+       of_node_put(pmc_np);
        if (!soc_pm.data.pmc) {
                pr_err("AT91: PM not supported, PMC not found\n");
                return;
@@ -830,6 +872,14 @@ void __init at91rm9200_pm_init(void)
        if (!IS_ENABLED(CONFIG_SOC_AT91RM9200))
                return;
 
+       /*
+        * Force STANDBY and ULP0 mode to avoid calling
+        * at91_pm_modes_validate() which may increase booting time.
+        * Platform supports anyway only STANDBY and ULP0 modes.
+        */
+       soc_pm.data.standby_mode = AT91_PM_STANDBY;
+       soc_pm.data.suspend_mode = AT91_PM_ULP0;
+
        at91_dt_ramc();
 
        /*
@@ -842,12 +892,17 @@ void __init at91rm9200_pm_init(void)
 
 void __init sam9x60_pm_init(void)
 {
+       static const int modes[] __initconst = {
+               AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP0_FAST, AT91_PM_ULP1,
+       };
+
        if (!IS_ENABLED(CONFIG_SOC_SAM9X60))
                return;
 
+       at91_pm_modes_validate(modes, ARRAY_SIZE(modes));
        at91_pm_modes_init();
        at91_dt_ramc();
-       at91_pm_init(at91sam9x60_idle);
+       at91_pm_init(NULL);
 
        soc_pm.ws_ids = sam9x60_ws_ids;
        soc_pm.config_pmc_ws = at91_sam9x60_config_pmc_ws;
@@ -858,26 +913,46 @@ void __init at91sam9_pm_init(void)
        if (!IS_ENABLED(CONFIG_SOC_AT91SAM9))
                return;
 
+       /*
+        * Force STANDBY and ULP0 mode to avoid calling
+        * at91_pm_modes_validate() which may increase booting time.
+        * Platform supports anyway only STANDBY and ULP0 modes.
+        */
+       soc_pm.data.standby_mode = AT91_PM_STANDBY;
+       soc_pm.data.suspend_mode = AT91_PM_ULP0;
+
        at91_dt_ramc();
        at91_pm_init(at91sam9_idle);
 }
 
 void __init sama5_pm_init(void)
 {
+       static const int modes[] __initconst = {
+               AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP0_FAST,
+       };
+
        if (!IS_ENABLED(CONFIG_SOC_SAMA5))
                return;
 
+       at91_pm_modes_validate(modes, ARRAY_SIZE(modes));
        at91_dt_ramc();
        at91_pm_init(NULL);
 }
 
 void __init sama5d2_pm_init(void)
 {
+       static const int modes[] __initconst = {
+               AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP0_FAST, AT91_PM_ULP1,
+               AT91_PM_BACKUP,
+       };
+
        if (!IS_ENABLED(CONFIG_SOC_SAMA5D2))
                return;
 
+       at91_pm_modes_validate(modes, ARRAY_SIZE(modes));
        at91_pm_modes_init();
-       sama5_pm_init();
+       at91_dt_ramc();
+       at91_pm_init(NULL);
 
        soc_pm.ws_ids = sama5d2_ws_ids;
        soc_pm.config_shdwc_ws = at91_sama5d2_config_shdwc_ws;
index 218e8d1..bfb260b 100644 (file)
@@ -19,8 +19,9 @@
 
 #define        AT91_PM_STANDBY         0x00
 #define AT91_PM_ULP0           0x01
-#define AT91_PM_ULP1           0x02
-#define        AT91_PM_BACKUP          0x03
+#define AT91_PM_ULP0_FAST      0x02
+#define AT91_PM_ULP1           0x03
+#define        AT91_PM_BACKUP          0x04
 
 #ifndef __ASSEMBLY__
 struct at91_pm_data {
index be9764e..0184de0 100644 (file)
@@ -164,7 +164,22 @@ ENDPROC(at91_backup_mode)
 
 .macro at91_pm_ulp0_mode
        ldr     pmc, .pmc_base
+       ldr     tmp2, .pm_mode
+       ldr     tmp3, .mckr_offset
+
+       /* Check if ULP0 fast variant has been requested. */
+       cmp     tmp2, #AT91_PM_ULP0_FAST
+       bne     0f
+
+       /* Set highest prescaler for power saving */
+       ldr     tmp1, [pmc, tmp3]
+       bic     tmp1, tmp1, #AT91_PMC_PRES
+       orr     tmp1, tmp1, #AT91_PMC_PRES_64
+       str     tmp1, [pmc, tmp3]
+       wait_mckrdy
+       b       1f
 
+0:
        /* Turn off the crystal oscillator */
        ldr     tmp1, [pmc, #AT91_CKGR_MOR]
        bic     tmp1, tmp1, #AT91_PMC_MOSCEN
@@ -192,7 +207,18 @@ ENDPROC(at91_backup_mode)
        /* Wait for interrupt */
 1:     at91_cpu_idle
 
-       /* Restore RC oscillator state */
+       /* Check if ULP0 fast variant has been requested. */
+       cmp     tmp2, #AT91_PM_ULP0_FAST
+       bne     5f
+
+       /* Set lowest prescaler for fast resume. */
+       ldr     tmp1, [pmc, tmp3]
+       bic     tmp1, tmp1, #AT91_PMC_PRES
+       str     tmp1, [pmc, tmp3]
+       wait_mckrdy
+       b       6f
+
+5:     /* Restore RC oscillator state */
        ldr     tmp1, .saved_osc_status
        tst     tmp1, #AT91_PMC_MOSCRCS
        beq     4f
@@ -216,6 +242,7 @@ ENDPROC(at91_backup_mode)
        str     tmp1, [pmc, #AT91_CKGR_MOR]
 
        wait_moscrdy
+6:
 .endm
 
 /**
@@ -473,23 +500,29 @@ ENDPROC(at91_backup_mode)
 ENTRY(at91_ulp_mode)
        ldr     pmc, .pmc_base
        ldr     tmp2, .mckr_offset
+       ldr     tmp3, .pm_mode
 
        /* Save Master clock setting */
        ldr     tmp1, [pmc, tmp2]
        str     tmp1, .saved_mckr
 
        /*
-        * Set the Master clock source to slow clock
+        * Set master clock source to:
+        * - MAINCK if using ULP0 fast variant
+        * - slow clock, otherwise
         */
        bic     tmp1, tmp1, #AT91_PMC_CSS
+       cmp     tmp3, #AT91_PM_ULP0_FAST
+       bne     save_mck
+       orr     tmp1, tmp1, #AT91_PMC_CSS_MAIN
+save_mck:
        str     tmp1, [pmc, tmp2]
 
        wait_mckrdy
 
        at91_plla_disable
 
-       ldr     r0, .pm_mode
-       cmp     r0, #AT91_PM_ULP1
+       cmp     tmp3, #AT91_PM_ULP1
        beq     ulp1_mode
 
        at91_pm_ulp0_mode
index 1df0ee0..ae79090 100644 (file)
@@ -208,6 +208,7 @@ config ARCH_BRCMSTB
        select ARM_GIC
        select ARM_ERRATA_798181 if SMP
        select HAVE_ARM_ARCH_TIMER
+       select BCM7038_L1_IRQ
        select BRCMSTB_L2_IRQ
        select BCM7120_L2_IRQ
        select ARCH_HAS_HOLES_MEMORYMODEL
index bcb3c40..7755ccc 100644 (file)
@@ -548,8 +548,7 @@ static const struct property_entry eeprom_properties[] = {
  */
 static struct i2c_client *dm6446evm_msp;
 
-static int dm6446evm_msp_probe(struct i2c_client *client,
-               const struct i2c_device_id *id)
+static int dm6446evm_msp_probe(struct i2c_client *client)
 {
        dm6446evm_msp = client;
        return 0;
@@ -569,7 +568,7 @@ static const struct i2c_device_id dm6446evm_msp_ids[] = {
 static struct i2c_driver dm6446evm_msp_driver = {
        .driver.name    = "dm6446evm_msp",
        .id_table       = dm6446evm_msp_ids,
-       .probe          = dm6446evm_msp_probe,
+       .probe_new      = dm6446evm_msp_probe,
        .remove         = dm6446evm_msp_remove,
 };
 
index 8319a60..952ddab 100644 (file)
@@ -160,8 +160,7 @@ static struct platform_device davinci_aemif_device = {
 #define DM646X_EVM_ATA_PWD             BIT(1)
 
 /* CPLD Register 0 Client: used for I/O Control */
-static int cpld_reg0_probe(struct i2c_client *client,
-                          const struct i2c_device_id *id)
+static int cpld_reg0_probe(struct i2c_client *client)
 {
        if (HAS_ATA) {
                u8 data;
@@ -197,7 +196,7 @@ static const struct i2c_device_id cpld_reg_ids[] = {
 static struct i2c_driver dm6467evm_cpld_driver = {
        .driver.name    = "cpld_reg0",
        .id_table       = cpld_reg_ids,
-       .probe          = cpld_reg0_probe,
+       .probe_new      = cpld_reg0_probe,
 };
 
 /* LEDS */
@@ -397,8 +396,7 @@ static struct snd_platform_data dm646x_evm_snd_data[] = {
 #ifdef CONFIG_I2C
 static struct i2c_client *cpld_client;
 
-static int cpld_video_probe(struct i2c_client *client,
-                       const struct i2c_device_id *id)
+static int cpld_video_probe(struct i2c_client *client)
 {
        cpld_client = client;
        return 0;
@@ -419,7 +417,7 @@ static struct i2c_driver cpld_video_driver = {
        .driver = {
                .name   = "cpld_video",
        },
-       .probe          = cpld_video_probe,
+       .probe_new      = cpld_video_probe,
        .remove         = cpld_video_remove,
        .id_table       = cpld_video_id,
 };
index f185cd3..d2d2497 100644 (file)
@@ -24,7 +24,6 @@ menuconfig ARCH_EXYNOS
        select HAVE_ARM_ARCH_TIMER if ARCH_EXYNOS5
        select HAVE_ARM_SCU if SMP
        select HAVE_S3C2410_I2C if I2C
-       select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select HAVE_S3C_RTC if RTC_CLASS
        select PINCTRL
        select PINCTRL_EXYNOS
index 0fd3fcf..53fa363 100644 (file)
@@ -3,10 +3,6 @@
 # Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
 #              http://www.samsung.com/
 
-ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
-
-# Core
-
 obj-$(CONFIG_ARCH_EXYNOS)      += exynos.o exynos-smc.o firmware.o
 
 obj-$(CONFIG_EXYNOS_CPU_SUSPEND) += pm.o sleep.o
index afd988a..29eb075 100644 (file)
 #define EXYNOS5800_SOC_ID      0xE5422000
 #define EXYNOS5_SOC_MASK       0xFFFFF000
 
-extern unsigned long samsung_cpu_id;
+extern unsigned long exynos_cpu_id;
 
 #define IS_SAMSUNG_CPU(name, id, mask)         \
 static inline int is_samsung_##name(void)      \
 {                                              \
-       return ((samsung_cpu_id & mask) == (id & mask));        \
+       return ((exynos_cpu_id & mask) == (id & mask)); \
 }
 
 IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
@@ -147,7 +147,7 @@ extern struct cpuidle_exynos_data cpuidle_coupled_exynos_data;
 
 extern void exynos_set_delayed_reset_assertion(bool enable);
 
-extern unsigned int samsung_rev(void);
+extern unsigned int exynos_rev(void);
 extern void exynos_core_restart(u32 core_id);
 extern int exynos_set_boot_addr(u32 core_id, unsigned long boot_addr);
 extern int exynos_get_boot_addr(u32 core_id, unsigned long *boot_addr);
index 36c3744..700763e 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/map.h>
-#include <plat/cpu.h>
-
 #include "common.h"
 
+#define S3C_ADDR_BASE  0xF6000000
+#define S3C_ADDR(x)    ((void __iomem __force *)S3C_ADDR_BASE + (x))
+#define S5P_VA_CHIPID  S3C_ADDR(0x02000000)
+
 static struct platform_device exynos_cpuidle = {
        .name              = "exynos_cpuidle",
 #ifdef CONFIG_ARM_EXYNOS_CPUIDLE
@@ -36,6 +37,14 @@ void __iomem *sysram_base_addr __ro_after_init;
 phys_addr_t sysram_base_phys __ro_after_init;
 void __iomem *sysram_ns_base_addr __ro_after_init;
 
+unsigned long exynos_cpu_id;
+static unsigned int exynos_cpu_rev;
+
+unsigned int exynos_rev(void)
+{
+       return exynos_cpu_rev;
+}
+
 void __init exynos_sysram_init(void)
 {
        struct device_node *node;
@@ -86,7 +95,11 @@ static void __init exynos_init_io(void)
        of_scan_flat_dt(exynos_fdt_map_chipid, NULL);
 
        /* detect cpu id and rev. */
-       s5p_init_cpu(S5P_VA_CHIPID);
+       exynos_cpu_id = readl_relaxed(S5P_VA_CHIPID);
+       exynos_cpu_rev = exynos_cpu_id & 0xFF;
+
+       pr_info("Samsung CPU ID: 0x%08lx\n", exynos_cpu_id);
+
 }
 
 /*
@@ -193,8 +206,8 @@ static void __init exynos_dt_fixup(void)
 }
 
 DT_MACHINE_START(EXYNOS_DT, "Samsung Exynos (Flattened Device Tree)")
-       .l2c_aux_val    = 0x3c400000,
-       .l2c_aux_mask   = 0xc20fffff,
+       .l2c_aux_val    = 0x38400000,
+       .l2c_aux_mask   = 0xc60fffff,
        .smp            = smp_ops(exynos_smp_ops),
        .map_io         = exynos_init_io,
        .init_early     = exynos_firmware_init,
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
deleted file mode 100644 (file)
index 8d58faa..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com/
- *
- * Exynos - Memory map definitions
- */
-
-#ifndef __ASM_ARCH_MAP_H
-#define __ASM_ARCH_MAP_H __FILE__
-
-#include <plat/map-base.h>
-
-#include <plat/map-s5p.h>
-
-#define EXYNOS_PA_CHIPID               0x10000000
-
-#endif /* __ASM_ARCH_MAP_H */
index 0cbbae8..d7fedbb 100644 (file)
@@ -22,8 +22,6 @@
 #include <asm/smp_scu.h>
 #include <asm/firmware.h>
 
-#include <mach/map.h>
-
 #include "common.h"
 
 extern void exynos4_secondary_startup(void);
@@ -188,7 +186,7 @@ void exynos_scu_enable(void)
 
 static void __iomem *cpu_boot_reg_base(void)
 {
-       if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1)
+       if (soc_is_exynos4210() && exynos_rev() == EXYNOS4210_REV_1_1)
                return pmu_base_addr + S5P_INFORM5;
        return sysram_base_addr;
 }
index 78af34c..30f4e55 100644 (file)
 
 static inline void __iomem *exynos_boot_vector_addr(void)
 {
-       if (samsung_rev() == EXYNOS4210_REV_1_1)
+       if (exynos_rev() == EXYNOS4210_REV_1_1)
                return pmu_base_addr + S5P_INFORM7;
-       else if (samsung_rev() == EXYNOS4210_REV_1_0)
+       else if (exynos_rev() == EXYNOS4210_REV_1_0)
                return sysram_base_addr + 0x24;
        return pmu_base_addr + S5P_INFORM0;
 }
 
 static inline void __iomem *exynos_boot_vector_flag(void)
 {
-       if (samsung_rev() == EXYNOS4210_REV_1_1)
+       if (exynos_rev() == EXYNOS4210_REV_1_1)
                return pmu_base_addr + S5P_INFORM6;
-       else if (samsung_rev() == EXYNOS4210_REV_1_0)
+       else if (exynos_rev() == EXYNOS4210_REV_1_0)
                return sysram_base_addr + 0x20;
        return pmu_base_addr + S5P_INFORM1;
 }
index 3b010fe..2e980f8 100644 (file)
@@ -1,9 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config ARCH_HISI
        bool "Hisilicon SoC Support"
-       depends on ARCH_MULTI_V7
+       depends on ARCH_MULTI_V7 || ARCH_MULTI_V5
        select ARM_AMBA
-       select ARM_GIC
+       select ARM_GIC if ARCH_MULTI_V7
        select ARM_TIMER_SP804
        select POWER_RESET
        select POWER_RESET_HISI
@@ -15,6 +15,7 @@ menu "Hisilicon platform type"
 
 config ARCH_HI3xxx
        bool "Hisilicon Hi36xx family"
+       depends on ARCH_MULTI_V7
        select CACHE_L2X0
        select HAVE_ARM_SCU if SMP
        select HAVE_ARM_TWD if SMP
@@ -25,6 +26,7 @@ config ARCH_HI3xxx
 
 config ARCH_HIP01
        bool "Hisilicon HIP01 family"
+       depends on ARCH_MULTI_V7
        select HAVE_ARM_SCU if SMP
        select HAVE_ARM_TWD if SMP
        select ARM_GLOBAL_TIMER
@@ -33,6 +35,7 @@ config ARCH_HIP01
 
 config ARCH_HIP04
        bool "Hisilicon HiP04 Cortex A15 family"
+       depends on ARCH_MULTI_V7
        select ARM_ERRATA_798181 if SMP
        select HAVE_ARM_ARCH_TIMER
        select MCPM if SMP
@@ -43,6 +46,7 @@ config ARCH_HIP04
 
 config ARCH_HIX5HD2
        bool "Hisilicon X5HD2 family"
+       depends on ARCH_MULTI_V7
        select CACHE_L2X0
        select HAVE_ARM_SCU if SMP
        select HAVE_ARM_TWD if SMP
@@ -50,6 +54,14 @@ config ARCH_HIX5HD2
        select PINCTRL_SINGLE
        help
          Support for Hisilicon HIX5HD2 SoC family
+
+config ARCH_SD5203
+       bool "Hisilicon SD5203 family"
+       depends on ARCH_MULTI_V5
+       select DW_APB_ICTL
+       help
+         Support for Hisilicon SD5203 SoC family
+
 endmenu
 
 endif
diff --git a/arch/arm/mach-imx/3ds_debugboard.c b/arch/arm/mach-imx/3ds_debugboard.c
deleted file mode 100644 (file)
index 0e01800..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright (C) 2010 Jason Wang <jason77.wang@gmail.com>
- */
-
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/irqdomain.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
-#include <linux/gpio.h>
-#include <linux/module.h>
-#include <linux/smsc911x.h>
-#include <linux/regulator/machine.h>
-#include <linux/regulator/fixed.h>
-#include "3ds_debugboard.h"
-#include "hardware.h"
-
-/* LAN9217 ethernet base address */
-#define LAN9217_BASE_ADDR(n)   (n + 0x0)
-/* External UART */
-#define UARTA_BASE_ADDR(n)     (n + 0x8000)
-#define UARTB_BASE_ADDR(n)     (n + 0x10000)
-
-#define BOARD_IO_ADDR(n)       (n + 0x20000)
-/* LED switchs */
-#define LED_SWITCH_REG         0x00
-/* buttons */
-#define SWITCH_BUTTONS_REG     0x08
-/* status, interrupt */
-#define INTR_STATUS_REG        0x10
-#define INTR_MASK_REG          0x38
-#define INTR_RESET_REG         0x20
-/* magic word for debug CPLD */
-#define MAGIC_NUMBER1_REG      0x40
-#define MAGIC_NUMBER2_REG      0x48
-/* CPLD code version */
-#define CPLD_CODE_VER_REG      0x50
-/* magic word for debug CPLD */
-#define MAGIC_NUMBER3_REG      0x58
-/* module reset register*/
-#define MODULE_RESET_REG       0x60
-/* CPU ID and Personality ID */
-#define MCU_BOARD_ID_REG       0x68
-
-#define MXC_MAX_EXP_IO_LINES   16
-
-/* interrupts like external uart , external ethernet etc*/
-#define EXPIO_INT_ENET         0
-#define EXPIO_INT_XUART_A      1
-#define EXPIO_INT_XUART_B      2
-#define EXPIO_INT_BUTTON_A     3
-#define EXPIO_INT_BUTTON_B     4
-
-static void __iomem *brd_io;
-static struct irq_domain *domain;
-
-static struct resource smsc911x_resources[] = {
-       {
-               .flags = IORESOURCE_MEM,
-       } , {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct smsc911x_platform_config smsc911x_config = {
-       .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
-       .flags = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY,
-};
-
-static struct platform_device smsc_lan9217_device = {
-       .name = "smsc911x",
-       .id = -1,
-       .dev = {
-               .platform_data = &smsc911x_config,
-       },
-       .num_resources = ARRAY_SIZE(smsc911x_resources),
-       .resource = smsc911x_resources,
-};
-
-static void mxc_expio_irq_handler(struct irq_desc *desc)
-{
-       u32 imr_val;
-       u32 int_valid;
-       u32 expio_irq;
-
-       /* irq = gpio irq number */
-       desc->irq_data.chip->irq_mask(&desc->irq_data);
-
-       imr_val = imx_readw(brd_io + INTR_MASK_REG);
-       int_valid = imx_readw(brd_io + INTR_STATUS_REG) & ~imr_val;
-
-       expio_irq = 0;
-       for (; int_valid != 0; int_valid >>= 1, expio_irq++) {
-               if ((int_valid & 1) == 0)
-                       continue;
-               generic_handle_irq(irq_find_mapping(domain, expio_irq));
-       }
-
-       desc->irq_data.chip->irq_ack(&desc->irq_data);
-       desc->irq_data.chip->irq_unmask(&desc->irq_data);
-}
-
-/*
- * Disable an expio pin's interrupt by setting the bit in the imr.
- * Irq is an expio virtual irq number
- */
-static void expio_mask_irq(struct irq_data *d)
-{
-       u16 reg;
-       u32 expio = d->hwirq;
-
-       reg = imx_readw(brd_io + INTR_MASK_REG);
-       reg |= (1 << expio);
-       imx_writew(reg, brd_io + INTR_MASK_REG);
-}
-
-static void expio_ack_irq(struct irq_data *d)
-{
-       u32 expio = d->hwirq;
-
-       imx_writew(1 << expio, brd_io + INTR_RESET_REG);
-       imx_writew(0, brd_io + INTR_RESET_REG);
-       expio_mask_irq(d);
-}
-
-static void expio_unmask_irq(struct irq_data *d)
-{
-       u16 reg;
-       u32 expio = d->hwirq;
-
-       reg = imx_readw(brd_io + INTR_MASK_REG);
-       reg &= ~(1 << expio);
-       imx_writew(reg, brd_io + INTR_MASK_REG);
-}
-
-static struct irq_chip expio_irq_chip = {
-       .irq_ack = expio_ack_irq,
-       .irq_mask = expio_mask_irq,
-       .irq_unmask = expio_unmask_irq,
-};
-
-static struct regulator_consumer_supply dummy_supplies[] = {
-       REGULATOR_SUPPLY("vdd33a", "smsc911x"),
-       REGULATOR_SUPPLY("vddvario", "smsc911x"),
-};
-
-int __init mxc_expio_init(u32 base, u32 intr_gpio)
-{
-       u32 p_irq = gpio_to_irq(intr_gpio);
-       int irq_base;
-       int i;
-
-       brd_io = ioremap(BOARD_IO_ADDR(base), SZ_4K);
-       if (brd_io == NULL)
-               return -ENOMEM;
-
-       if ((imx_readw(brd_io + MAGIC_NUMBER1_REG) != 0xAAAA) ||
-           (imx_readw(brd_io + MAGIC_NUMBER2_REG) != 0x5555) ||
-           (imx_readw(brd_io + MAGIC_NUMBER3_REG) != 0xCAFE)) {
-               pr_info("3-Stack Debug board not detected\n");
-               iounmap(brd_io);
-               brd_io = NULL;
-               return -ENODEV;
-       }
-
-       pr_info("3-Stack Debug board detected, rev = 0x%04X\n",
-               readw(brd_io + CPLD_CODE_VER_REG));
-
-       /*
-        * Configure INT line as GPIO input
-        */
-       gpio_request(intr_gpio, "expio_pirq");
-       gpio_direction_input(intr_gpio);
-
-       /* disable the interrupt and clear the status */
-       imx_writew(0, brd_io + INTR_MASK_REG);
-       imx_writew(0xFFFF, brd_io + INTR_RESET_REG);
-       imx_writew(0, brd_io + INTR_RESET_REG);
-       imx_writew(0x1F, brd_io + INTR_MASK_REG);
-
-       irq_base = irq_alloc_descs(-1, 0, MXC_MAX_EXP_IO_LINES, numa_node_id());
-       WARN_ON(irq_base < 0);
-
-       domain = irq_domain_add_legacy(NULL, MXC_MAX_EXP_IO_LINES, irq_base, 0,
-                                      &irq_domain_simple_ops, NULL);
-       WARN_ON(!domain);
-
-       for (i = irq_base; i < irq_base + MXC_MAX_EXP_IO_LINES; i++) {
-               irq_set_chip_and_handler(i, &expio_irq_chip, handle_level_irq);
-               irq_clear_status_flags(i, IRQ_NOREQUEST);
-       }
-       irq_set_irq_type(p_irq, IRQF_TRIGGER_LOW);
-       irq_set_chained_handler(p_irq, mxc_expio_irq_handler);
-
-       /* Register Lan device on the debugboard */
-       regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
-
-       smsc911x_resources[0].start = LAN9217_BASE_ADDR(base);
-       smsc911x_resources[0].end = LAN9217_BASE_ADDR(base) + 0x100 - 1;
-       smsc911x_resources[1].start = irq_find_mapping(domain, EXPIO_INT_ENET);
-       smsc911x_resources[1].end = irq_find_mapping(domain, EXPIO_INT_ENET);
-       platform_device_register(&smsc_lan9217_device);
-
-       return 0;
-}
diff --git a/arch/arm/mach-imx/3ds_debugboard.h b/arch/arm/mach-imx/3ds_debugboard.h
deleted file mode 100644 (file)
index a4d04d0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
- */
-
-#ifndef __ASM_ARCH_MXC_3DS_DB_H__
-#define __ASM_ARCH_MXC_3DS_DB_H__
-
-extern int __init mxc_expio_init(u32 base, u32 intr_gpio);
-
-#endif /* __ASM_ARCH_MXC_3DS_DB_H__ */
index e7d7b90..5290278 100644 (file)
@@ -47,371 +47,26 @@ config HAVE_IMX_SRC
        def_bool y if SMP
        select ARCH_HAS_RESET_CONTROLLER
 
-config IMX_HAVE_IOMUX_V1
-       bool
+if ARCH_MULTI_V6
 
-config ARCH_MXC_IOMUX_V3
-       bool
-
-config SOC_IMX21
-       bool
-       select CPU_ARM926T
-       select IMX_HAVE_IOMUX_V1
-       select MXC_AVIC
-
-config SOC_IMX27
-       bool
-       select CPU_ARM926T
-       select IMX_HAVE_IOMUX_V1
-       select MXC_AVIC
-       select PINCTRL_IMX27
+comment "ARM1136 platforms"
 
 config SOC_IMX31
-       bool
+       bool "i.MX31 support"
        select CPU_V6
        select MXC_AVIC
+       help
+         This enables support for Freescale i.MX31 processor
 
 config SOC_IMX35
-       bool
-       select ARCH_MXC_IOMUX_V3
+       bool "i.MX35 support"
        select MXC_AVIC
        select PINCTRL_IMX35
-
-if ARCH_MULTI_V5
-
-comment "MX21 platforms:"
-
-config MACH_MX21ADS
-       bool "MX21ADS platform"
-       select IMX_HAVE_PLATFORM_IMX_FB
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_MXC_MMC
-       select IMX_HAVE_PLATFORM_MXC_NAND
-       select SOC_IMX21
-       help
-         Include support for MX21ADS platform. This includes specific
-         configurations for the board and its peripherals.
-
-comment "MX27 platforms:"
-
-config MACH_MX27ADS
-       bool "MX27ADS platform"
-       select IMX_HAVE_PLATFORM_IMX_FB
-       select IMX_HAVE_PLATFORM_IMX_I2C
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_MXC_MMC
-       select IMX_HAVE_PLATFORM_MXC_NAND
-       select IMX_HAVE_PLATFORM_MXC_W1
-       select SOC_IMX27
-       help
-         Include support for MX27ADS platform. This includes specific
-         configurations for the board and its peripherals.
-
-config MACH_MX27_3DS
-       bool "MX27PDK platform"
-       select IMX_HAVE_PLATFORM_FSL_USB2_UDC
-       select IMX_HAVE_PLATFORM_IMX2_WDT
-       select IMX_HAVE_PLATFORM_IMX_FB
-       select IMX_HAVE_PLATFORM_IMX_I2C
-       select IMX_HAVE_PLATFORM_IMX_KEYPAD
-       select IMX_HAVE_PLATFORM_IMX_SSI
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_MX2_CAMERA
-       select IMX_HAVE_PLATFORM_MXC_EHCI
-       select IMX_HAVE_PLATFORM_MXC_MMC
-       select IMX_HAVE_PLATFORM_SPI_IMX
-       select MXC_DEBUG_BOARD
-       select USB_ULPI_VIEWPORT if USB_ULPI
-       select SOC_IMX27
-       help
-         Include support for MX27PDK platform. This includes specific
-         configurations for the board and its peripherals.
-
-config MACH_IMX27_VISSTRIM_M10
-       bool "Vista Silicon i.MX27 Visstrim_m10"
-       select IMX_HAVE_PLATFORM_GPIO_KEYS
-       select IMX_HAVE_PLATFORM_IMX_I2C
-       select IMX_HAVE_PLATFORM_IMX_SSI
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_MX2_CAMERA
-       select IMX_HAVE_PLATFORM_MX2_EMMA
-       select IMX_HAVE_PLATFORM_MXC_EHCI
-       select IMX_HAVE_PLATFORM_MXC_MMC
-       select LEDS_GPIO_REGISTER
-       select SOC_IMX27
-       help
-         Include support for Visstrim_m10 platform and its different variants.
-         This includes specific configurations for the board and its
-         peripherals.
-
-config MACH_PCA100
-       bool "Phytec phyCARD-s (pca100)"
-       select IMX_HAVE_PLATFORM_FSL_USB2_UDC
-       select IMX_HAVE_PLATFORM_IMX2_WDT
-       select IMX_HAVE_PLATFORM_IMX_FB
-       select IMX_HAVE_PLATFORM_IMX_I2C
-       select IMX_HAVE_PLATFORM_IMX_SSI
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_MXC_EHCI
-       select IMX_HAVE_PLATFORM_MXC_MMC
-       select IMX_HAVE_PLATFORM_MXC_NAND
-       select IMX_HAVE_PLATFORM_MXC_W1
-       select IMX_HAVE_PLATFORM_SPI_IMX
-       select USB_ULPI_VIEWPORT if USB_ULPI
-       select SOC_IMX27
-       help
-         Include support for phyCARD-s (aka pca100) platform. This
-         includes specific configurations for the module and its peripherals.
-
-config MACH_IMX27_DT
-       bool "Support i.MX27 platforms from device tree"
-       select SOC_IMX27
-       help
-         Include support for Freescale i.MX27 based platforms
-         using the device tree for discovery
-
-endif
-
-if ARCH_MULTI_V6
-
-comment "MX31 platforms:"
-
-config MACH_MX31ADS
-       bool "Support MX31ADS platforms"
-       default y
-       select IMX_HAVE_PLATFORM_IMX_I2C
-       select IMX_HAVE_PLATFORM_IMX_SSI
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select SOC_IMX31
-       help
-         Include support for MX31ADS platform. This includes specific
-         configurations for the board and its peripherals.
-
-config MACH_MX31ADS_WM1133_EV1
-       bool "Support Wolfson Microelectronics 1133-EV1 module"
-       depends on MACH_MX31ADS
-       depends on MFD_WM8350_I2C
-       depends on REGULATOR_WM8350 = y
        help
-         Include support for the Wolfson Microelectronics 1133-EV1 PMU
-         and audio module for the MX31ADS platform.
-
-config MACH_MX31LILLY
-       bool "Support MX31 LILLY-1131 platforms (INCO startec)"
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_IPU_CORE
-       select IMX_HAVE_PLATFORM_MXC_EHCI
-       select IMX_HAVE_PLATFORM_MXC_MMC
-       select IMX_HAVE_PLATFORM_SPI_IMX
-       select USB_ULPI_VIEWPORT if USB_ULPI
-       select SOC_IMX31
-       help
-         Include support for mx31 based LILLY1131 modules. This includes
-         specific configurations for the board and its peripherals.
-
-config MACH_MX31LITE
-       bool "Support MX31 LITEKIT (LogicPD)"
-       select IMX_HAVE_PLATFORM_IMX2_WDT
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_MXC_EHCI
-       select IMX_HAVE_PLATFORM_MXC_MMC
-       select IMX_HAVE_PLATFORM_MXC_NAND
-       select IMX_HAVE_PLATFORM_MXC_RTC
-       select IMX_HAVE_PLATFORM_SPI_IMX
-       select LEDS_GPIO_REGISTER
-       select USB_ULPI_VIEWPORT if USB_ULPI
-       select SOC_IMX31
-       help
-         Include support for MX31 LITEKIT platform. This includes specific
-         configurations for the board and its peripherals.
-
-config MACH_PCM037
-       bool "Support Phytec pcm037 (i.MX31) platforms"
-       select IMX_HAVE_PLATFORM_FSL_USB2_UDC
-       select IMX_HAVE_PLATFORM_IMX2_WDT
-       select IMX_HAVE_PLATFORM_IMX_I2C
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_IPU_CORE
-       select IMX_HAVE_PLATFORM_MXC_EHCI
-       select IMX_HAVE_PLATFORM_MXC_MMC
-       select IMX_HAVE_PLATFORM_MXC_NAND
-       select IMX_HAVE_PLATFORM_MXC_W1
-       select USB_ULPI_VIEWPORT if USB_ULPI
-       select SOC_IMX31
-       help
-         Include support for Phytec pcm037 platform. This includes
-         specific configurations for the board and its peripherals.
-
-config MACH_PCM037_EET
-       bool "Support pcm037 EET board extensions"
-       depends on MACH_PCM037
-       select IMX_HAVE_PLATFORM_GPIO_KEYS
-       select IMX_HAVE_PLATFORM_SPI_IMX
-       help
-         Add support for PCM037 EET baseboard extensions. If you are using the
-         OLED display with EET, use "video=mx3fb:CMEL-OLED" kernel
-         command-line parameter.
-
-config MACH_MX31_3DS
-       bool "Support MX31PDK (3DS)"
-       select IMX_HAVE_PLATFORM_FSL_USB2_UDC
-       select IMX_HAVE_PLATFORM_IMX2_WDT
-       select IMX_HAVE_PLATFORM_IMX_I2C
-       select IMX_HAVE_PLATFORM_IMX_KEYPAD
-       select IMX_HAVE_PLATFORM_IMX_SSI
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_IPU_CORE
-       select IMX_HAVE_PLATFORM_MXC_EHCI
-       select IMX_HAVE_PLATFORM_MXC_MMC
-       select IMX_HAVE_PLATFORM_MXC_NAND
-       select IMX_HAVE_PLATFORM_SPI_IMX
-       select MXC_DEBUG_BOARD
-       select USB_ULPI_VIEWPORT if USB_ULPI
-       select SOC_IMX31
-       help
-         Include support for MX31PDK (3DS) platform. This includes specific
-         configurations for the board and its peripherals.
-
-config MACH_MX31_3DS_MXC_NAND_USE_BBT
-       bool "Make the MXC NAND driver use the in flash Bad Block Table"
-       depends on MACH_MX31_3DS
-       depends on MTD_NAND_MXC
-       help
-         Enable this if you want that the MXC NAND driver uses the in flash
-         Bad Block Table to know what blocks are bad instead of scanning the
-         entire flash looking for bad block markers.
-
-config MACH_MX31MOBOARD
-       bool "Support mx31moboard platforms (EPFL Mobots group)"
-       select IMX_HAVE_PLATFORM_FSL_USB2_UDC
-       select IMX_HAVE_PLATFORM_IMX2_WDT
-       select IMX_HAVE_PLATFORM_IMX_I2C
-       select IMX_HAVE_PLATFORM_IMX_SSI
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_IPU_CORE
-       select IMX_HAVE_PLATFORM_MXC_EHCI
-       select IMX_HAVE_PLATFORM_MXC_MMC
-       select IMX_HAVE_PLATFORM_SPI_IMX
-       select LEDS_GPIO_REGISTER
-       select USB_ULPI_VIEWPORT if USB_ULPI
-       select SOC_IMX31
-       help
-         Include support for mx31moboard platform. This includes specific
-         configurations for the board and its peripherals.
-
-config MACH_QONG
-       bool "Support Dave/DENX QongEVB-LITE platform"
-       select IMX_HAVE_PLATFORM_IMX2_WDT
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select SOC_IMX31
-       help
-         Include support for Dave/DENX QongEVB-LITE platform. This includes
-         specific configurations for the board and its peripherals.
-
-config MACH_ARMADILLO5X0
-       bool "Support Atmark Armadillo-500 Development Base Board"
-       select IMX_HAVE_PLATFORM_GPIO_KEYS
-       select IMX_HAVE_PLATFORM_IMX_I2C
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_IPU_CORE
-       select IMX_HAVE_PLATFORM_MXC_EHCI
-       select IMX_HAVE_PLATFORM_MXC_MMC
-       select IMX_HAVE_PLATFORM_MXC_NAND
-       select USB_ULPI_VIEWPORT if USB_ULPI
-       select SOC_IMX31
-       help
-         Include support for Atmark Armadillo-500 platform. This includes
-         specific configurations for the board and its peripherals.
-
-config MACH_KZM_ARM11_01
-       bool "Support KZM-ARM11-01(Kyoto Microcomputer)"
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select SOC_IMX31
-       help
-         Include support for KZM-ARM11-01. This includes specific
-         configurations for the board and its peripherals.
-
-config MACH_BUG
-       bool "Support Buglabs BUGBase platform"
-       default y
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select SOC_IMX31
-       help
-         Include support for BUGBase 1.3 platform. This includes specific
-         configurations for the board and its peripherals.
-
-config MACH_IMX31_DT
-       bool "Support i.MX31 platforms from device tree"
-       select SOC_IMX31
-       help
-         Include support for Freescale i.MX31 based platforms
-         using the device tree for discovery.
-
-comment "MX35 platforms:"
-
-config MACH_IMX35_DT
-       bool "Support i.MX35 platforms from device tree"
-       select SOC_IMX35
-       help
-         Include support for Freescale i.MX35 based platforms
-         using the device tree for discovery.
-
-config MACH_PCM043
-       bool "Support Phytec pcm043 (i.MX35) platforms"
-       select IMX_HAVE_PLATFORM_FLEXCAN
-       select IMX_HAVE_PLATFORM_FSL_USB2_UDC
-       select IMX_HAVE_PLATFORM_IMX2_WDT
-       select IMX_HAVE_PLATFORM_IMX_I2C
-       select IMX_HAVE_PLATFORM_IMX_SSI
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_IPU_CORE
-       select IMX_HAVE_PLATFORM_MXC_EHCI
-       select IMX_HAVE_PLATFORM_MXC_NAND
-       select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
-       select USB_ULPI_VIEWPORT if USB_ULPI
-       select SOC_IMX35
-       help
-         Include support for Phytec pcm043 platform. This includes
-         specific configurations for the board and its peripherals.
-
-config MACH_MX35_3DS
-       bool "Support MX35PDK platform"
-       select IMX_HAVE_PLATFORM_FSL_USB2_UDC
-       select IMX_HAVE_PLATFORM_IMX2_WDT
-       select IMX_HAVE_PLATFORM_IMX_FB
-       select IMX_HAVE_PLATFORM_IMX_I2C
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_IPU_CORE
-       select IMX_HAVE_PLATFORM_MXC_EHCI
-       select IMX_HAVE_PLATFORM_MXC_NAND
-       select IMX_HAVE_PLATFORM_MXC_RTC
-       select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
-       select MXC_DEBUG_BOARD
-       select SOC_IMX35
-       help
-         Include support for MX35PDK platform. This includes specific
-         configurations for the board and its peripherals.
-
-config MACH_VPR200
-       bool "Support VPR200 platform"
-       select IMX_HAVE_PLATFORM_FSL_USB2_UDC
-       select IMX_HAVE_PLATFORM_GPIO_KEYS
-       select IMX_HAVE_PLATFORM_IMX2_WDT
-       select IMX_HAVE_PLATFORM_IMX_I2C
-       select IMX_HAVE_PLATFORM_IMX_UART
-       select IMX_HAVE_PLATFORM_IPU_CORE
-       select IMX_HAVE_PLATFORM_MXC_EHCI
-       select IMX_HAVE_PLATFORM_MXC_NAND
-       select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
-       select SOC_IMX35
-       help
-         Include support for VPR200 platform. This includes specific
-         configurations for the board and its peripherals.
+         This enables support for Freescale i.MX31 processor
 
 endif
 
-comment "Device tree only"
-
 if ARCH_MULTI_V4T
 
 config SOC_IMX1
@@ -428,12 +83,20 @@ if ARCH_MULTI_V5
 
 config SOC_IMX25
        bool "i.MX25 support"
-       select ARCH_MXC_IOMUX_V3
        select CPU_ARM926T
        select MXC_AVIC
        select PINCTRL_IMX25
        help
          This enables support for Freescale i.MX25 processor
+
+config SOC_IMX27
+       bool "i.MX27 support"
+       select CPU_ARM926T
+       select MXC_AVIC
+       select PINCTRL_IMX27
+       help
+         This enables support for Freescale i.MX27 processor
+
 endif
 
 if ARCH_MULTI_V7
@@ -541,10 +204,10 @@ config SOC_LS1021A
 
 endif
 
-comment "Cortex-A/Cortex-M asymmetric multiprocessing platforms"
-
 if ARCH_MULTI_V7 || ARM_SINGLE_ARMV7M
 
+comment "Cortex-A/Cortex-M asymmetric multiprocessing platforms"
+
 config SOC_IMX7D_CA7
        bool
        select ARM_GIC
@@ -607,6 +270,4 @@ endchoice
 
 endif
 
-source "arch/arm/mach-imx/devices/Kconfig"
-
 endif
index e7364e6..9cebd36 100644 (file)
@@ -1,22 +1,16 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-y := cpu.o system.o irq-common.o
 
-obj-$(CONFIG_SOC_IMX21) += mm-imx21.o
-
 obj-$(CONFIG_SOC_IMX25) += cpu-imx25.o mach-imx25.o pm-imx25.o
 
-obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o
-obj-$(CONFIG_SOC_IMX27) += mm-imx27.o ehci-imx27.o
+obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o mach-imx27.o
 
-obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o iomux-imx31.o ehci-imx31.o
-obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o ehci-imx35.o
+obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o mach-imx31.o
+obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o mach-imx35.o
 
 imx5-pm-$(CONFIG_PM) += pm-imx5.o
 obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o $(imx5-pm-y)
 
-obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o
-obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
-
 obj-$(CONFIG_MXC_TZIC) += tzic.o
 obj-$(CONFIG_MXC_AVIC) += avic.o
 
@@ -37,37 +31,6 @@ obj-y += ssi-fiq.o
 obj-y += ssi-fiq-ksym.o
 endif
 
-# i.MX21 based machines
-obj-$(CONFIG_MACH_MX21ADS) += mach-mx21ads.o
-
-# i.MX27 based machines
-obj-$(CONFIG_MACH_MX27ADS) += mach-mx27ads.o
-obj-$(CONFIG_MACH_MX27_3DS) += mach-mx27_3ds.o
-obj-$(CONFIG_MACH_IMX27_VISSTRIM_M10) += mach-imx27_visstrim_m10.o
-obj-$(CONFIG_MACH_PCA100) += mach-pca100.o
-obj-$(CONFIG_MACH_IMX27_DT) += imx27-dt.o
-
-# i.MX31 based machines
-obj-$(CONFIG_MACH_MX31ADS) += mach-mx31ads.o
-obj-$(CONFIG_MACH_MX31LILLY) += mach-mx31lilly.o mx31lilly-db.o
-obj-$(CONFIG_MACH_MX31LITE) += mach-mx31lite.o mx31lite-db.o
-obj-$(CONFIG_MACH_PCM037) += mach-pcm037.o
-obj-$(CONFIG_MACH_PCM037_EET) += mach-pcm037_eet.o
-obj-$(CONFIG_MACH_MX31_3DS) += mach-mx31_3ds.o
-obj-$(CONFIG_MACH_MX31MOBOARD) += mach-mx31moboard.o mx31moboard-devboard.o \
-               mx31moboard-marxbot.o mx31moboard-smartbot.o
-obj-$(CONFIG_MACH_QONG) += mach-qong.o
-obj-$(CONFIG_MACH_ARMADILLO5X0) += mach-armadillo5x0.o
-obj-$(CONFIG_MACH_KZM_ARM11_01) += mach-kzm_arm11_01.o
-obj-$(CONFIG_MACH_BUG) += mach-bug.o
-obj-$(CONFIG_MACH_IMX31_DT) += imx31-dt.o
-
-# i.MX35 based machines
-obj-$(CONFIG_MACH_PCM043) += mach-pcm043.o
-obj-$(CONFIG_MACH_MX35_3DS) += mach-mx35_3ds.o
-obj-$(CONFIG_MACH_VPR200) += mach-vpr200.o
-obj-$(CONFIG_MACH_IMX35_DT) += imx35-dt.o
-
 obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o
 obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
 obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o
@@ -105,5 +68,3 @@ obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
 obj-$(CONFIG_SOC_VF610) += mach-vf610.o
 
 obj-$(CONFIG_SOC_LS1021A) += mach-ls1021a.o
-
-obj-y += devices/
diff --git a/arch/arm/mach-imx/board-mx31lilly.h b/arch/arm/mach-imx/board-mx31lilly.h
deleted file mode 100644 (file)
index 3508c59..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (C) 2009 Daniel Mack <daniel@caiaq.de>
- *
- * Based on code for mobots boards,
- *   Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
- */
-
-#ifndef __ASM_ARCH_MXC_BOARD_MX31LILLY_H__
-#define __ASM_ARCH_MXC_BOARD_MX31LILLY_H__
-
-#ifndef __ASSEMBLY__
-
-enum mx31lilly_boards {
-       MX31LILLY_NOBOARD       = 0,
-       MX31LILLY_DB            = 1,
-};
-
-/*
- * This CPU module needs a baseboard to work. After basic initializing
- * its own devices, it calls the baseboard's init function.
- */
-
-extern void mx31lilly_db_init(void);
-
-#endif
-
-#endif /* __ASM_ARCH_MXC_BOARD_MX31LILLY_H__ */
diff --git a/arch/arm/mach-imx/board-mx31lite.h b/arch/arm/mach-imx/board-mx31lite.h
deleted file mode 100644 (file)
index 7d7c621..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright (C) 2009 Daniel Mack <daniel@caiaq.de>
- *
- * Based on code for mobots boards,
- *   Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
- */
-
-#ifndef __ASM_ARCH_MXC_BOARD_MX31LITE_H__
-#define __ASM_ARCH_MXC_BOARD_MX31LITE_H__
-
-#ifndef __ASSEMBLY__
-
-enum mx31lite_boards {
-       MX31LITE_NOBOARD        = 0,
-       MX31LITE_DB             = 1,
-};
-
-/*
- * This CPU module needs a baseboard to work. After basic initializing
- * its own devices, it calls the baseboard's init function.
- */
-
-extern void mx31lite_db_init(void);
-
-#endif
-
-#endif /* __ASM_ARCH_MXC_BOARD_MX31LITE_H__ */
diff --git a/arch/arm/mach-imx/board-mx31moboard.h b/arch/arm/mach-imx/board-mx31moboard.h
deleted file mode 100644 (file)
index 6f3ff4d..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
- */
-
-#ifndef __ASM_ARCH_MXC_BOARD_MX31MOBOARD_H__
-#define __ASM_ARCH_MXC_BOARD_MX31MOBOARD_H__
-
-#ifndef __ASSEMBLY__
-
-enum mx31moboard_boards {
-       MX31NOBOARD     = 0,
-       MX31DEVBOARD    = 1,
-       MX31MARXBOT     = 2,
-       MX31SMARTBOT    = 3,
-       MX31EYEBOT      = 4,
-};
-
-/*
- * This CPU module needs a baseboard to work. After basic initializing
- * its own devices, it calls the baseboard's init function.
- */
-
-extern void mx31moboard_devboard_init(void);
-extern void mx31moboard_marxbot_init(void);
-extern void mx31moboard_smartbot_init(int board);
-
-#endif
-
-#endif /* __ASM_ARCH_MXC_BOARD_MX31MOBOARD_H__ */
index 72c3fcc..2d76e2c 100644 (file)
@@ -17,29 +17,14 @@ struct device_node;
 enum mxc_cpu_pwr_mode;
 struct of_device_id;
 
-void mx21_map_io(void);
-void mx27_map_io(void);
 void mx31_map_io(void);
 void mx35_map_io(void);
 void imx21_init_early(void);
-void imx27_init_early(void);
 void imx31_init_early(void);
 void imx35_init_early(void);
 void mxc_init_irq(void __iomem *);
-void mx21_init_irq(void);
-void mx27_init_irq(void);
 void mx31_init_irq(void);
 void mx35_init_irq(void);
-void imx21_soc_init(void);
-void imx27_soc_init(void);
-void imx31_soc_init(void);
-void imx35_soc_init(void);
-int mx21_clocks_init(unsigned long lref, unsigned long fref);
-int mx27_clocks_init(unsigned long fref);
-int mx31_clocks_init(unsigned long fref);
-int mx35_clocks_init(void);
-struct platform_device *mxc_register_gpio(char *name, int id,
-       resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
 void mxc_set_cpu_type(unsigned int type);
 void mxc_restart(enum reboot_mode, const char *);
 void mxc_arch_reset_init(void __iomem *);
index a969aa7..bf70e13 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/io.h>
+#include <linux/of_address.h>
 #include <linux/module.h>
 
 #include "hardware.h"
@@ -17,16 +18,23 @@ static int mx27_cpu_rev = -1;
 static int mx27_cpu_partnumber;
 
 #define SYS_CHIP_ID             0x00    /* The offset of CHIP ID register */
+#define SYSCTRL_OFFSET         0x800   /* Offset from CCM base address */
 
 static int mx27_read_cpu_rev(void)
 {
+       void __iomem *ccm_base;
+       struct device_node *np;
        u32 val;
+
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm");
+       ccm_base = of_iomap(np, 0);
+       BUG_ON(!ccm_base);
        /*
         * now we have access to the IO registers. As we need
         * the silicon revision very early we read it here to
         * avoid any further hooks
        */
-       val = imx_readl(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR + SYS_CHIP_ID));
+       val = imx_readl(ccm_base + SYSCTRL_OFFSET + SYS_CHIP_ID);
 
        mx27_cpu_partnumber = (int)((val >> 12) & 0xFFFF);
 
index 3ee684b..b9c24b8 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/of_address.h>
 #include <linux/io.h>
 
 #include "common.h"
@@ -32,10 +33,16 @@ static struct {
 
 static int mx31_read_cpu_rev(void)
 {
+       void __iomem *iim_base;
+       struct device_node *np;
        u32 i, srev;
 
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx31-iim");
+       iim_base = of_iomap(np, 0);
+       BUG_ON(!iim_base);
+
        /* read SREV register from IIM module */
-       srev = imx_readl(MX31_IO_ADDRESS(MX31_IIM_BASE_ADDR + MXC_IIMSREV));
+       srev = imx_readl(iim_base + MXC_IIMSREV);
        srev &= 0xff;
 
        for (i = 0; i < ARRAY_SIZE(mx31_cpu_type); i++)
index ebb3cda..80e7d8a 100644 (file)
@@ -5,6 +5,7 @@
  * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
  */
 #include <linux/module.h>
+#include <linux/of_address.h>
 #include <linux/io.h>
 
 #include "hardware.h"
@@ -14,9 +15,15 @@ static int mx35_cpu_rev = -1;
 
 static int mx35_read_cpu_rev(void)
 {
+       void __iomem *iim_base;
+       struct device_node *np;
        u32 rev;
 
-       rev = imx_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV));
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx35-iim");
+       iim_base = of_iomap(np, 0);
+       BUG_ON(!iim_base);
+
+       rev = imx_readl(iim_base + MXC_IIMSREV);
        switch (rev) {
        case 0x00:
                return IMX_CHIP_REVISION_1_0;
diff --git a/arch/arm/mach-imx/devices-imx21.h b/arch/arm/mach-imx/devices-imx21.h
deleted file mode 100644 (file)
index 3679d1d..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "devices/devices-common.h"
-
-extern const struct imx_imx21_hcd_data imx21_imx21_hcd_data;
-#define imx21_add_imx21_hcd(pdata)     \
-       imx_add_imx21_hcd(&imx21_imx21_hcd_data, pdata)
-
-extern const struct imx_imx2_wdt_data imx21_imx2_wdt_data;
-#define imx21_add_imx2_wdt()   \
-       imx_add_imx2_wdt(&imx21_imx2_wdt_data)
-
-extern const struct imx_imx_fb_data imx21_imx_fb_data;
-#define imx21_add_imx_fb(pdata)        \
-       imx_add_imx_fb(&imx21_imx_fb_data, pdata)
-
-extern const struct imx_imx_i2c_data imx21_imx_i2c_data;
-#define imx21_add_imx_i2c(pdata)       \
-       imx_add_imx_i2c(&imx21_imx_i2c_data, pdata)
-
-extern const struct imx_imx_keypad_data imx21_imx_keypad_data;
-#define imx21_add_imx_keypad(pdata)    \
-       imx_add_imx_keypad(&imx21_imx_keypad_data, pdata)
-
-extern const struct imx_imx_ssi_data imx21_imx_ssi_data[];
-#define imx21_add_imx_ssi(id, pdata)   \
-       imx_add_imx_ssi(&imx21_imx_ssi_data[id], pdata)
-
-extern const struct imx_imx_uart_1irq_data imx21_imx_uart_data[];
-#define imx21_add_imx_uart(id, pdata)  \
-       imx_add_imx_uart_1irq(&imx21_imx_uart_data[id], pdata)
-#define imx21_add_imx_uart0(pdata)     imx21_add_imx_uart(0, pdata)
-#define imx21_add_imx_uart1(pdata)     imx21_add_imx_uart(1, pdata)
-#define imx21_add_imx_uart2(pdata)     imx21_add_imx_uart(2, pdata)
-#define imx21_add_imx_uart3(pdata)     imx21_add_imx_uart(3, pdata)
-
-extern const struct imx_mxc_mmc_data imx21_mxc_mmc_data[];
-#define imx21_add_mxc_mmc(id, pdata)   \
-       imx_add_mxc_mmc(&imx21_mxc_mmc_data[id], pdata)
-
-extern const struct imx_mxc_nand_data imx21_mxc_nand_data;
-#define imx21_add_mxc_nand(pdata)      \
-       imx_add_mxc_nand(&imx21_mxc_nand_data, pdata)
-
-extern const struct imx_mxc_w1_data imx21_mxc_w1_data;
-#define imx21_add_mxc_w1()     \
-       imx_add_mxc_w1(&imx21_mxc_w1_data)
-
-extern const struct imx_spi_imx_data imx21_cspi_data[];
-#define imx21_add_cspi(id, pdata)      \
-       imx_add_spi_imx(&imx21_cspi_data[id], pdata)
-#define imx21_add_spi_imx0(pdata)      imx21_add_cspi(0, pdata)
-#define imx21_add_spi_imx1(pdata)      imx21_add_cspi(1, pdata)
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h
deleted file mode 100644 (file)
index 583a1d7..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "devices/devices-common.h"
-
-extern const struct imx_fec_data imx27_fec_data;
-#define imx27_add_fec(pdata)   \
-       imx_add_fec(&imx27_fec_data, pdata)
-
-extern const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data;
-#define imx27_add_fsl_usb2_udc(pdata)  \
-       imx_add_fsl_usb2_udc(&imx27_fsl_usb2_udc_data, pdata)
-
-extern const struct imx_imx27_coda_data imx27_coda_data;
-#define imx27_add_coda()       \
-       imx_add_imx27_coda(&imx27_coda_data)
-
-extern const struct imx_imx2_wdt_data imx27_imx2_wdt_data;
-#define imx27_add_imx2_wdt()   \
-       imx_add_imx2_wdt(&imx27_imx2_wdt_data)
-
-extern const struct imx_imx_fb_data imx27_imx_fb_data;
-#define imx27_add_imx_fb(pdata)        \
-       imx_add_imx_fb(&imx27_imx_fb_data, pdata)
-
-extern const struct imx_imx_i2c_data imx27_imx_i2c_data[];
-#define imx27_add_imx_i2c(id, pdata)   \
-       imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata)
-
-extern const struct imx_imx_keypad_data imx27_imx_keypad_data;
-#define imx27_add_imx_keypad(pdata)    \
-       imx_add_imx_keypad(&imx27_imx_keypad_data, pdata)
-
-extern const struct imx_imx_ssi_data imx27_imx_ssi_data[];
-#define imx27_add_imx_ssi(id, pdata)    \
-       imx_add_imx_ssi(&imx27_imx_ssi_data[id], pdata)
-
-extern const struct imx_imx_uart_1irq_data imx27_imx_uart_data[];
-#define imx27_add_imx_uart(id, pdata)  \
-       imx_add_imx_uart_1irq(&imx27_imx_uart_data[id], pdata)
-#define imx27_add_imx_uart0(pdata)     imx27_add_imx_uart(0, pdata)
-#define imx27_add_imx_uart1(pdata)     imx27_add_imx_uart(1, pdata)
-#define imx27_add_imx_uart2(pdata)     imx27_add_imx_uart(2, pdata)
-#define imx27_add_imx_uart3(pdata)     imx27_add_imx_uart(3, pdata)
-#define imx27_add_imx_uart4(pdata)     imx27_add_imx_uart(4, pdata)
-#define imx27_add_imx_uart5(pdata)     imx27_add_imx_uart(5, pdata)
-
-extern const struct imx_mx2_camera_data imx27_mx2_camera_data;
-#define imx27_add_mx2_camera(pdata)    \
-       imx_add_mx2_camera(&imx27_mx2_camera_data, pdata)
-
-extern const struct imx_mx2_emma_data imx27_mx2_emmaprp_data;
-#define imx27_add_mx2_emmaprp()        \
-       imx_add_mx2_emmaprp(&imx27_mx2_emmaprp_data)
-
-extern const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data;
-#define imx27_add_mxc_ehci_otg(pdata)  \
-       imx_add_mxc_ehci(&imx27_mxc_ehci_otg_data, pdata)
-extern const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[];
-#define imx27_add_mxc_ehci_hs(id, pdata)       \
-       imx_add_mxc_ehci(&imx27_mxc_ehci_hs_data[id - 1], pdata)
-
-extern const struct imx_mxc_mmc_data imx27_mxc_mmc_data[];
-#define imx27_add_mxc_mmc(id, pdata)   \
-       imx_add_mxc_mmc(&imx27_mxc_mmc_data[id], pdata)
-
-extern const struct imx_mxc_nand_data imx27_mxc_nand_data;
-#define imx27_add_mxc_nand(pdata)      \
-       imx_add_mxc_nand(&imx27_mxc_nand_data, pdata)
-
-extern const struct imx_mxc_w1_data imx27_mxc_w1_data;
-#define imx27_add_mxc_w1()     \
-       imx_add_mxc_w1(&imx27_mxc_w1_data)
-
-extern const struct imx_spi_imx_data imx27_cspi_data[];
-#define imx27_add_cspi(id, gtable) \
-       imx_add_spi_imx(&imx27_cspi_data[id], gtable)
-#define imx27_add_spi_imx0(gtable)     imx27_add_cspi(0, gtable)
-#define imx27_add_spi_imx1(gtable)     imx27_add_cspi(1, gtable)
-#define imx27_add_spi_imx2(gtable)     imx27_add_cspi(2, gtable)
-
-extern const struct imx_pata_imx_data imx27_pata_imx_data;
-#define imx27_add_pata_imx() \
-       imx_add_pata_imx(&imx27_pata_imx_data)
diff --git a/arch/arm/mach-imx/devices-imx31.h b/arch/arm/mach-imx/devices-imx31.h
deleted file mode 100644 (file)
index f7cc623..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "devices/devices-common.h"
-
-extern const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data;
-#define imx31_add_fsl_usb2_udc(pdata)  \
-       imx_add_fsl_usb2_udc(&imx31_fsl_usb2_udc_data, pdata)
-
-extern const struct imx_imx2_wdt_data imx31_imx2_wdt_data;
-#define imx31_add_imx2_wdt()       \
-       imx_add_imx2_wdt(&imx31_imx2_wdt_data)
-
-extern const struct imx_imx_i2c_data imx31_imx_i2c_data[];
-#define imx31_add_imx_i2c(id, pdata)   \
-       imx_add_imx_i2c(&imx31_imx_i2c_data[id], pdata)
-#define imx31_add_imx_i2c0(pdata)      imx31_add_imx_i2c(0, pdata)
-#define imx31_add_imx_i2c1(pdata)      imx31_add_imx_i2c(1, pdata)
-#define imx31_add_imx_i2c2(pdata)      imx31_add_imx_i2c(2, pdata)
-
-extern const struct imx_imx_keypad_data imx31_imx_keypad_data;
-#define imx31_add_imx_keypad(pdata)    \
-       imx_add_imx_keypad(&imx31_imx_keypad_data, pdata)
-
-extern const struct imx_imx_ssi_data imx31_imx_ssi_data[];
-#define imx31_add_imx_ssi(id, pdata)    \
-       imx_add_imx_ssi(&imx31_imx_ssi_data[id], pdata)
-
-extern const struct imx_imx_uart_1irq_data imx31_imx_uart_data[];
-#define imx31_add_imx_uart(id, pdata)  \
-       imx_add_imx_uart_1irq(&imx31_imx_uart_data[id], pdata)
-#define imx31_add_imx_uart0(pdata)     imx31_add_imx_uart(0, pdata)
-#define imx31_add_imx_uart1(pdata)     imx31_add_imx_uart(1, pdata)
-#define imx31_add_imx_uart2(pdata)     imx31_add_imx_uart(2, pdata)
-#define imx31_add_imx_uart3(pdata)     imx31_add_imx_uart(3, pdata)
-#define imx31_add_imx_uart4(pdata)     imx31_add_imx_uart(4, pdata)
-
-extern const struct imx_ipu_core_data imx31_ipu_core_data;
-#define imx31_add_ipu_core()           \
-       imx_add_ipu_core(&imx31_ipu_core_data)
-#define imx31_alloc_mx3_camera(pdata)  \
-       imx_alloc_mx3_camera(&imx31_ipu_core_data, pdata)
-#define imx31_add_mx3_sdc_fb(pdata)    \
-       imx_add_mx3_sdc_fb(&imx31_ipu_core_data, pdata)
-
-extern const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data;
-#define imx31_add_mxc_ehci_otg(pdata)  \
-       imx_add_mxc_ehci(&imx31_mxc_ehci_otg_data, pdata)
-extern const struct imx_mxc_ehci_data imx31_mxc_ehci_hs_data[];
-#define imx31_add_mxc_ehci_hs(id, pdata)       \
-       imx_add_mxc_ehci(&imx31_mxc_ehci_hs_data[id - 1], pdata)
-
-extern const struct imx_mxc_mmc_data imx31_mxc_mmc_data[];
-#define imx31_add_mxc_mmc(id, pdata)   \
-       imx_add_mxc_mmc(&imx31_mxc_mmc_data[id], pdata)
-
-extern const struct imx_mxc_nand_data imx31_mxc_nand_data;
-#define imx31_add_mxc_nand(pdata)      \
-       imx_add_mxc_nand(&imx31_mxc_nand_data, pdata)
-
-extern const struct imx_mxc_rtc_data imx31_mxc_rtc_data;
-#define imx31_add_mxc_rtc()    \
-       imx_add_mxc_rtc(&imx31_mxc_rtc_data)
-
-extern const struct imx_mxc_w1_data imx31_mxc_w1_data;
-#define imx31_add_mxc_w1()     \
-       imx_add_mxc_w1(&imx31_mxc_w1_data)
-
-extern const struct imx_spi_imx_data imx31_cspi_data[];
-#define imx31_add_cspi(id, gtable) \
-       imx_add_spi_imx(&imx31_cspi_data[id], gtable)
-#define imx31_add_spi_imx0(gtable)     imx31_add_cspi(0, gtable)
-#define imx31_add_spi_imx1(gtable)     imx31_add_cspi(1, gtable)
-#define imx31_add_spi_imx2(gtable)     imx31_add_cspi(2, gtable)
-
-extern const struct imx_pata_imx_data imx31_pata_imx_data;
-#define imx31_add_pata_imx() \
-       imx_add_pata_imx(&imx31_pata_imx_data)
diff --git a/arch/arm/mach-imx/devices-imx35.h b/arch/arm/mach-imx/devices-imx35.h
deleted file mode 100644 (file)
index 1b1bdad..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "devices/devices-common.h"
-
-extern const struct imx_fec_data imx35_fec_data;
-#define imx35_add_fec(pdata)   \
-       imx_add_fec(&imx35_fec_data, pdata)
-
-extern const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data;
-#define imx35_add_fsl_usb2_udc(pdata)  \
-       imx_add_fsl_usb2_udc(&imx35_fsl_usb2_udc_data, pdata)
-
-extern const struct imx_flexcan_data imx35_flexcan_data[];
-#define imx35_add_flexcan(id)  \
-       imx_add_flexcan(&imx35_flexcan_data[id])
-#define imx35_add_flexcan0()           imx35_add_flexcan(0)
-#define imx35_add_flexcan1()           imx35_add_flexcan(1)
-
-extern const struct imx_imx2_wdt_data imx35_imx2_wdt_data;
-#define imx35_add_imx2_wdt()       \
-       imx_add_imx2_wdt(&imx35_imx2_wdt_data)
-
-extern const struct imx_imx_i2c_data imx35_imx_i2c_data[];
-#define imx35_add_imx_i2c(id, pdata)   \
-       imx_add_imx_i2c(&imx35_imx_i2c_data[id], pdata)
-#define imx35_add_imx_i2c0(pdata)      imx35_add_imx_i2c(0, pdata)
-#define imx35_add_imx_i2c1(pdata)      imx35_add_imx_i2c(1, pdata)
-#define imx35_add_imx_i2c2(pdata)      imx35_add_imx_i2c(2, pdata)
-
-extern const struct imx_imx_keypad_data imx35_imx_keypad_data;
-#define imx35_add_imx_keypad(pdata)    \
-       imx_add_imx_keypad(&imx35_imx_keypad_data, pdata)
-
-extern const struct imx_imx_ssi_data imx35_imx_ssi_data[];
-#define imx35_add_imx_ssi(id, pdata)    \
-       imx_add_imx_ssi(&imx35_imx_ssi_data[id], pdata)
-
-extern const struct imx_imx_uart_1irq_data imx35_imx_uart_data[];
-#define imx35_add_imx_uart(id, pdata)  \
-       imx_add_imx_uart_1irq(&imx35_imx_uart_data[id], pdata)
-#define imx35_add_imx_uart0(pdata)     imx35_add_imx_uart(0, pdata)
-#define imx35_add_imx_uart1(pdata)     imx35_add_imx_uart(1, pdata)
-#define imx35_add_imx_uart2(pdata)     imx35_add_imx_uart(2, pdata)
-
-extern const struct imx_ipu_core_data imx35_ipu_core_data;
-#define imx35_add_ipu_core()           \
-       imx_add_ipu_core(&imx35_ipu_core_data)
-#define imx35_alloc_mx3_camera(pdata)  \
-       imx_alloc_mx3_camera(&imx35_ipu_core_data, pdata)
-#define imx35_add_mx3_sdc_fb(pdata)    \
-       imx_add_mx3_sdc_fb(&imx35_ipu_core_data, pdata)
-
-extern const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data;
-#define imx35_add_mxc_ehci_otg(pdata)  \
-       imx_add_mxc_ehci(&imx35_mxc_ehci_otg_data, pdata)
-extern const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data;
-#define imx35_add_mxc_ehci_hs(pdata)   \
-       imx_add_mxc_ehci(&imx35_mxc_ehci_hs_data, pdata)
-
-extern const struct imx_mxc_nand_data imx35_mxc_nand_data;
-#define imx35_add_mxc_nand(pdata)      \
-       imx_add_mxc_nand(&imx35_mxc_nand_data, pdata)
-
-extern const struct imx_mxc_rtc_data imx35_mxc_rtc_data;
-#define imx35_add_mxc_rtc()    \
-       imx_add_mxc_rtc(&imx35_mxc_rtc_data)
-
-extern const struct imx_mxc_w1_data imx35_mxc_w1_data;
-#define imx35_add_mxc_w1()     \
-       imx_add_mxc_w1(&imx35_mxc_w1_data)
-
-extern const struct imx_sdhci_esdhc_imx_data imx35_sdhci_esdhc_imx_data[];
-#define imx35_add_sdhci_esdhc_imx(id, pdata)   \
-       imx_add_sdhci_esdhc_imx(&imx35_sdhci_esdhc_imx_data[id], pdata)
-
-extern const struct imx_spi_imx_data imx35_cspi_data[];
-#define imx35_add_cspi(id, pdata)      \
-       imx_add_spi_imx(&imx35_cspi_data[id], pdata)
-#define imx35_add_spi_imx0(pdata)      imx35_add_cspi(0, pdata)
-#define imx35_add_spi_imx1(pdata)      imx35_add_cspi(1, pdata)
-
-extern const struct imx_pata_imx_data imx35_pata_imx_data;
-#define imx35_add_pata_imx() \
-       imx_add_pata_imx(&imx35_pata_imx_data)
diff --git a/arch/arm/mach-imx/devices/Kconfig b/arch/arm/mach-imx/devices/Kconfig
deleted file mode 100644 (file)
index fdca73d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-config IMX_HAVE_PLATFORM_FEC
-       bool
-       default y if SOC_IMX25 || SOC_IMX27 || SOC_IMX35
-
-config IMX_HAVE_PLATFORM_FLEXCAN
-       bool
-
-config IMX_HAVE_PLATFORM_FSL_USB2_UDC
-       bool
-
-config IMX_HAVE_PLATFORM_GPIO_KEYS
-       bool
-
-config IMX_HAVE_PLATFORM_IMX21_HCD
-       bool
-
-config IMX_HAVE_PLATFORM_IMX27_CODA
-       bool
-       default y if SOC_IMX27
-
-config IMX_HAVE_PLATFORM_IMX2_WDT
-       bool
-
-config IMX_HAVE_PLATFORM_IMX_FB
-       bool
-
-config IMX_HAVE_PLATFORM_IMX_I2C
-       bool
-
-config IMX_HAVE_PLATFORM_IMX_KEYPAD
-       bool
-
-config IMX_HAVE_PLATFORM_PATA_IMX
-       bool
-
-config IMX_HAVE_PLATFORM_IMX_SSI
-       bool
-
-config IMX_HAVE_PLATFORM_IMX_UART
-       bool
-
-config IMX_HAVE_PLATFORM_IPU_CORE
-       bool
-
-config IMX_HAVE_PLATFORM_MX2_CAMERA
-       bool
-
-config IMX_HAVE_PLATFORM_MX2_EMMA
-       bool
-
-config IMX_HAVE_PLATFORM_MXC_EHCI
-       bool
-
-config IMX_HAVE_PLATFORM_MXC_MMC
-       bool
-
-config IMX_HAVE_PLATFORM_MXC_NAND
-       bool
-
-config IMX_HAVE_PLATFORM_MXC_RTC
-       bool
-
-config IMX_HAVE_PLATFORM_MXC_W1
-       bool
-
-config IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
-       bool
-
-config IMX_HAVE_PLATFORM_SPI_IMX
-       bool
diff --git a/arch/arm/mach-imx/devices/Makefile b/arch/arm/mach-imx/devices/Makefile
deleted file mode 100644 (file)
index e44758a..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-y := devices.o
-
-obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
-obj-y += platform-gpio-mxc.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX27_CODA) += platform-imx27-coda.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
-obj-y += platform-imx-dma.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_KEYPAD) += platform-imx-keypad.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_PATA_IMX) += platform-pata_imx.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_IPU_CORE) += platform-ipu-core.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RTC) += platform-mxc_rtc.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) +=  platform-spi_imx.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_EMMA) += platform-mx2-emma.o
diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h
deleted file mode 100644 (file)
index 327a1de..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (C) 2009-2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/init.h>
-#include <linux/gpio/machine.h>
-#include <linux/platform_data/dma-imx-sdma.h>
-
-extern struct device mxc_aips_bus;
-extern struct device mxc_ahb_bus;
-
-static inline struct platform_device *imx_add_platform_device_dmamask(
-               const char *name, int id,
-               const struct resource *res, unsigned int num_resources,
-               const void *data, size_t size_data, u64 dmamask)
-{
-       struct platform_device_info pdevinfo = {
-               .name = name,
-               .id = id,
-               .res = res,
-               .num_res = num_resources,
-               .data = data,
-               .size_data = size_data,
-               .dma_mask = dmamask,
-       };
-       return platform_device_register_full(&pdevinfo);
-}
-
-static inline struct platform_device *imx_add_platform_device(
-               const char *name, int id,
-               const struct resource *res, unsigned int num_resources,
-               const void *data, size_t size_data)
-{
-       return imx_add_platform_device_dmamask(
-                       name, id, res, num_resources, data, size_data, 0);
-}
-
-#include <linux/fec.h>
-struct imx_fec_data {
-       const char *devid;
-       resource_size_t iobase;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_fec(
-               const struct imx_fec_data *data,
-               const struct fec_platform_data *pdata);
-
-struct imx_flexcan_data {
-       int id;
-       resource_size_t iobase;
-       resource_size_t iosize;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_flexcan(
-               const struct imx_flexcan_data *data);
-
-#include <linux/fsl_devices.h>
-struct imx_fsl_usb2_udc_data {
-       const char *devid;
-       resource_size_t iobase;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_fsl_usb2_udc(
-               const struct imx_fsl_usb2_udc_data *data,
-               const struct fsl_usb2_platform_data *pdata);
-
-#include <linux/gpio_keys.h>
-struct platform_device *__init imx_add_gpio_keys(
-               const struct gpio_keys_platform_data *pdata);
-
-#include <linux/platform_data/usb-mx2.h>
-struct imx_imx21_hcd_data {
-       resource_size_t iobase;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_imx21_hcd(
-               const struct imx_imx21_hcd_data *data,
-               const struct mx21_usbh_platform_data *pdata);
-
-struct imx_imx27_coda_data {
-       resource_size_t iobase;
-       resource_size_t iosize;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_imx27_coda(
-               const struct imx_imx27_coda_data *data);
-
-struct imx_imx2_wdt_data {
-       int id;
-       resource_size_t iobase;
-       resource_size_t iosize;
-};
-struct platform_device *__init imx_add_imx2_wdt(
-               const struct imx_imx2_wdt_data *data);
-
-struct imx_imxdi_rtc_data {
-       resource_size_t iobase;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_imxdi_rtc(
-               const struct imx_imxdi_rtc_data *data);
-
-#include <linux/platform_data/video-imxfb.h>
-struct imx_imx_fb_data {
-       const char *devid;
-       resource_size_t iobase;
-       resource_size_t iosize;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_imx_fb(
-               const struct imx_imx_fb_data *data,
-               const struct imx_fb_platform_data *pdata);
-
-#include <linux/platform_data/i2c-imx.h>
-struct imx_imx_i2c_data {
-       const char *devid;
-       int id;
-       resource_size_t iobase;
-       resource_size_t iosize;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_imx_i2c(
-               const struct imx_imx_i2c_data *data,
-               const struct imxi2c_platform_data *pdata);
-
-#include <linux/input/matrix_keypad.h>
-struct imx_imx_keypad_data {
-       resource_size_t iobase;
-       resource_size_t iosize;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_imx_keypad(
-               const struct imx_imx_keypad_data *data,
-               const struct matrix_keymap_data *pdata);
-
-#include <linux/platform_data/asoc-imx-ssi.h>
-struct imx_imx_ssi_data {
-       int id;
-       resource_size_t iobase;
-       resource_size_t iosize;
-       resource_size_t irq;
-       resource_size_t dmatx0;
-       resource_size_t dmarx0;
-       resource_size_t dmatx1;
-       resource_size_t dmarx1;
-};
-struct platform_device *__init imx_add_imx_ssi(
-               const struct imx_imx_ssi_data *data,
-               const struct imx_ssi_platform_data *pdata);
-
-#include <linux/platform_data/serial-imx.h>
-struct imx_imx_uart_1irq_data {
-       int id;
-       resource_size_t iobase;
-       resource_size_t iosize;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_imx_uart_1irq(
-               const struct imx_imx_uart_1irq_data *data,
-               const struct imxuart_platform_data *pdata);
-
-#include <linux/platform_data/video-mx3fb.h>
-#include <linux/platform_data/media/camera-mx3.h>
-struct imx_ipu_core_data {
-       resource_size_t iobase;
-       resource_size_t synirq;
-       resource_size_t errirq;
-};
-struct platform_device *__init imx_add_ipu_core(
-               const struct imx_ipu_core_data *data);
-struct platform_device *__init imx_alloc_mx3_camera(
-               const struct imx_ipu_core_data *data,
-               const struct mx3_camera_pdata *pdata);
-struct platform_device *__init imx_add_mx3_sdc_fb(
-               const struct imx_ipu_core_data *data,
-               struct mx3fb_platform_data *pdata);
-
-#include <linux/platform_data/media/camera-mx2.h>
-struct imx_mx2_camera_data {
-       const char *devid;
-       resource_size_t iobasecsi;
-       resource_size_t iosizecsi;
-       resource_size_t irqcsi;
-       resource_size_t iobaseemmaprp;
-       resource_size_t iosizeemmaprp;
-       resource_size_t irqemmaprp;
-};
-struct platform_device *__init imx_add_mx2_camera(
-               const struct imx_mx2_camera_data *data,
-               const struct mx2_camera_platform_data *pdata);
-
-
-struct imx_mx2_emma_data {
-       resource_size_t iobase;
-       resource_size_t iosize;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_mx2_emmaprp(
-               const struct imx_mx2_emma_data *data);
-
-#include <linux/platform_data/usb-ehci-mxc.h>
-struct imx_mxc_ehci_data {
-       int id;
-       resource_size_t iobase;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_mxc_ehci(
-               const struct imx_mxc_ehci_data *data,
-               const struct mxc_usbh_platform_data *pdata);
-
-#include <linux/platform_data/mmc-mxcmmc.h>
-struct imx_mxc_mmc_data {
-       const char *devid;
-       int id;
-       resource_size_t iobase;
-       resource_size_t iosize;
-       resource_size_t irq;
-       resource_size_t dmareq;
-};
-struct platform_device *__init imx_add_mxc_mmc(
-               const struct imx_mxc_mmc_data *data,
-               const struct imxmmc_platform_data *pdata);
-
-#include <linux/platform_data/mtd-mxc_nand.h>
-struct imx_mxc_nand_data {
-       const char *devid;
-       /*
-        * id is traditionally 0, but -1 is more appropriate.  We use -1 for new
-        * machines but don't change existing devices as the nand device usually
-        * appears in the kernel command line to pass its partitioning.
-        */
-       int id;
-       resource_size_t iobase;
-       resource_size_t iosize;
-       resource_size_t axibase;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_mxc_nand(
-               const struct imx_mxc_nand_data *data,
-               const struct mxc_nand_platform_data *pdata);
-
-struct imx_pata_imx_data {
-       resource_size_t iobase;
-       resource_size_t iosize;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_pata_imx(
-               const struct imx_pata_imx_data *data);
-
-/* mxc_rtc */
-struct imx_mxc_rtc_data {
-       const char *devid;
-       resource_size_t iobase;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_mxc_rtc(
-               const struct imx_mxc_rtc_data *data);
-
-/* mxc_w1 */
-struct imx_mxc_w1_data {
-       resource_size_t iobase;
-};
-struct platform_device *__init imx_add_mxc_w1(
-               const struct imx_mxc_w1_data *data);
-
-#include <linux/platform_data/mmc-esdhc-imx.h>
-struct imx_sdhci_esdhc_imx_data {
-       const char *devid;
-       int id;
-       resource_size_t iobase;
-       resource_size_t irq;
-};
-struct platform_device *__init imx_add_sdhci_esdhc_imx(
-               const struct imx_sdhci_esdhc_imx_data *data,
-               const struct esdhc_platform_data *pdata);
-
-struct imx_spi_imx_data {
-       const char *devid;
-       int id;
-       resource_size_t iobase;
-       resource_size_t iosize;
-       int irq;
-};
-struct platform_device *__init imx_add_spi_imx(
-       const struct imx_spi_imx_data *data, struct gpiod_lookup_table *gtable);
-
-struct platform_device *imx_add_imx_dma(char *name, resource_size_t iobase,
-                                       int irq);
-struct platform_device *imx_add_imx_sdma(char *name,
-       resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
diff --git a/arch/arm/mach-imx/devices/devices.c b/arch/arm/mach-imx/devices/devices.c
deleted file mode 100644 (file)
index cd72f08..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
- */
-
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/err.h>
-#include <linux/platform_device.h>
-
-#include "../common.h"
-#include "devices-common.h"
-
-struct device mxc_aips_bus = {
-       .init_name      = "mxc_aips",
-};
-
-struct device mxc_ahb_bus = {
-       .init_name      = "mxc_ahb",
-};
-
-int __init mxc_device_init(void)
-{
-       int ret;
-
-       ret = device_register(&mxc_aips_bus);
-       if (ret < 0)
-               goto done;
-
-       ret = device_register(&mxc_ahb_bus);
-
-done:
-       return ret;
-}
diff --git a/arch/arm/mach-imx/devices/platform-fec.c b/arch/arm/mach-imx/devices/platform-fec.c
deleted file mode 100644 (file)
index 88e853d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include <linux/dma-mapping.h>
-#include <linux/sizes.h>
-
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_fec_data_entry_single(soc, _devid)                         \
-       {                                                               \
-               .devid = _devid,                                        \
-               .iobase = soc ## _FEC_BASE_ADDR,                        \
-               .irq = soc ## _INT_FEC,                                 \
-       }
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_fec_data imx27_fec_data __initconst =
-       imx_fec_data_entry_single(MX27, "imx27-fec");
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX35
-/* i.mx35 has the i.mx27 type fec */
-const struct imx_fec_data imx35_fec_data __initconst =
-       imx_fec_data_entry_single(MX35, "imx27-fec");
-#endif
-
-struct platform_device *__init imx_add_fec(
-               const struct imx_fec_data *data,
-               const struct fec_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + SZ_4K - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-
-       return imx_add_platform_device_dmamask(data->devid, 0,
-                       res, ARRAY_SIZE(res),
-                       pdata, sizeof(*pdata), DMA_BIT_MASK(32));
-}
diff --git a/arch/arm/mach-imx/devices/platform-flexcan.c b/arch/arm/mach-imx/devices/platform-flexcan.c
deleted file mode 100644 (file)
index e4eed35..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix, Marc Kleine-Budde <kernel@pengutronix.de>
- */
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_flexcan_data_entry_single(soc, _id, _hwid, _size)          \
-       {                                                               \
-               .id = _id,                                              \
-               .iobase = soc ## _CAN ## _hwid ## _BASE_ADDR,           \
-               .iosize = _size,                                        \
-               .irq = soc ## _INT_CAN ## _hwid,                        \
-       }
-
-#define imx_flexcan_data_entry(soc, _id, _hwid, _size)                 \
-       [_id] = imx_flexcan_data_entry_single(soc, _id, _hwid, _size)
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_flexcan_data imx35_flexcan_data[] __initconst = {
-#define imx35_flexcan_data_entry(_id, _hwid)                           \
-       imx_flexcan_data_entry(MX35, _id, _hwid, SZ_16K)
-       imx35_flexcan_data_entry(0, 1),
-       imx35_flexcan_data_entry(1, 2),
-};
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-struct platform_device *__init imx_add_flexcan(
-               const struct imx_flexcan_data *data)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-
-       return imx_add_platform_device("flexcan", data->id,
-                       res, ARRAY_SIZE(res), NULL, 0);
-}
diff --git a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
deleted file mode 100644 (file)
index cc86de4..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include <linux/dma-mapping.h>
-
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_fsl_usb2_udc_data_entry_single(soc, _devid)                        \
-       {                                                               \
-               .devid = _devid,                                        \
-               .iobase = soc ## _USB_OTG_BASE_ADDR,                    \
-               .irq = soc ## _INT_USB_OTG,                             \
-       }
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst =
-       imx_fsl_usb2_udc_data_entry_single(MX27, "imx-udc-mx27");
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst =
-       imx_fsl_usb2_udc_data_entry_single(MX31, "imx-udc-mx27");
-#endif /* ifdef CONFIG_SOC_IMX31 */
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst =
-       imx_fsl_usb2_udc_data_entry_single(MX35, "imx-udc-mx27");
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-struct platform_device *__init imx_add_fsl_usb2_udc(
-               const struct imx_fsl_usb2_udc_data *data,
-               const struct fsl_usb2_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + SZ_512 - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-       return imx_add_platform_device_dmamask(data->devid, -1,
-                       res, ARRAY_SIZE(res),
-                       pdata, sizeof(*pdata), DMA_BIT_MASK(32));
-}
diff --git a/arch/arm/mach-imx/devices/platform-gpio-mxc.c b/arch/arm/mach-imx/devices/platform-gpio-mxc.c
deleted file mode 100644 (file)
index 355de84..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright 2011 Linaro Limited
- */
-#include "devices-common.h"
-#include "../common.h"
-
-struct platform_device *__init mxc_register_gpio(char *name, int id,
-       resource_size_t iobase, resource_size_t iosize, int irq, int irq_high)
-{
-       struct resource res[] = {
-               {
-                       .start = iobase,
-                       .end = iobase + iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = irq,
-                       .end = irq,
-                       .flags = IORESOURCE_IRQ,
-               }, {
-                       .start = irq_high,
-                       .end = irq_high,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-       unsigned int nres;
-
-       nres = irq_high ? ARRAY_SIZE(res) : ARRAY_SIZE(res) - 1;
-       return platform_device_register_resndata(&mxc_aips_bus, name, id, res, nres, NULL, 0);
-}
diff --git a/arch/arm/mach-imx/devices/platform-gpio_keys.c b/arch/arm/mach-imx/devices/platform-gpio_keys.c
deleted file mode 100644 (file)
index 4886784..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
- */
-#include <linux/sizes.h>
-
-#include "../hardware.h"
-#include "devices-common.h"
-
-struct platform_device *__init imx_add_gpio_keys(
-               const struct gpio_keys_platform_data *pdata)
-{
-       return imx_add_platform_device("gpio-keys", -1, NULL,
-                0, pdata, sizeof(*pdata));
-}
diff --git a/arch/arm/mach-imx/devices/platform-imx-dma.c b/arch/arm/mach-imx/devices/platform-imx-dma.c
deleted file mode 100644 (file)
index 12656f2..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "devices-common.h"
-
-struct platform_device __init __maybe_unused *imx_add_imx_dma(char *name,
-       resource_size_t iobase, int irq)
-{
-       struct resource res[] = {
-               {
-                       .start = iobase,
-                       .end = iobase + SZ_4K - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = irq,
-                       .end = irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-
-       return platform_device_register_resndata(&mxc_ahb_bus,
-                       name, -1, res, ARRAY_SIZE(res), NULL, 0);
-}
-
-struct platform_device __init __maybe_unused *imx_add_imx_sdma(char *name,
-       resource_size_t iobase, int irq, struct sdma_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = iobase,
-                       .end = iobase + SZ_16K - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = irq,
-                       .end = irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-
-       return platform_device_register_resndata(&mxc_ahb_bus, name,
-                       -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
-}
diff --git a/arch/arm/mach-imx/devices/platform-imx-fb.c b/arch/arm/mach-imx/devices/platform-imx-fb.c
deleted file mode 100644 (file)
index e553d01..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include <linux/dma-mapping.h>
-
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_imx_fb_data_entry_single(soc, _devid, _size)               \
-       {                                                               \
-               .devid = _devid,                                        \
-               .iobase = soc ## _LCDC_BASE_ADDR,                       \
-               .iosize = _size,                                        \
-               .irq = soc ## _INT_LCDC,                                \
-       }
-
-#ifdef CONFIG_SOC_IMX21
-const struct imx_imx_fb_data imx21_imx_fb_data __initconst =
-       imx_imx_fb_data_entry_single(MX21, "imx21-fb", SZ_4K);
-#endif /* ifdef CONFIG_SOC_IMX21 */
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_imx_fb_data imx27_imx_fb_data __initconst =
-       imx_imx_fb_data_entry_single(MX27, "imx21-fb", SZ_4K);
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-struct platform_device *__init imx_add_imx_fb(
-               const struct imx_imx_fb_data *data,
-               const struct imx_fb_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-       return imx_add_platform_device_dmamask(data->devid, 0,
-                       res, ARRAY_SIZE(res),
-                       pdata, sizeof(*pdata), DMA_BIT_MASK(32));
-}
diff --git a/arch/arm/mach-imx/devices/platform-imx-i2c.c b/arch/arm/mach-imx/devices/platform-imx-i2c.c
deleted file mode 100644 (file)
index 81d317b..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2009-2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_imx_i2c_data_entry_single(soc, _devid, _id, _hwid, _size)  \
-       {                                                               \
-               .devid = _devid,                                        \
-               .id = _id,                                              \
-               .iobase = soc ## _I2C ## _hwid ## _BASE_ADDR,           \
-               .iosize = _size,                                        \
-               .irq = soc ## _INT_I2C ## _hwid,                        \
-       }
-
-#define imx_imx_i2c_data_entry(soc, _devid, _id, _hwid, _size)         \
-       [_id] = imx_imx_i2c_data_entry_single(soc, _devid, _id, _hwid, _size)
-
-#ifdef CONFIG_SOC_IMX21
-const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst =
-       imx_imx_i2c_data_entry_single(MX21, "imx21-i2c", 0, , SZ_4K);
-#endif /* ifdef CONFIG_SOC_IMX21 */
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = {
-#define imx27_imx_i2c_data_entry(_id, _hwid)                           \
-       imx_imx_i2c_data_entry(MX27, "imx21-i2c", _id, _hwid, SZ_4K)
-       imx27_imx_i2c_data_entry(0, 1),
-       imx27_imx_i2c_data_entry(1, 2),
-};
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = {
-#define imx31_imx_i2c_data_entry(_id, _hwid)                           \
-       imx_imx_i2c_data_entry(MX31, "imx21-i2c", _id, _hwid, SZ_4K)
-       imx31_imx_i2c_data_entry(0, 1),
-       imx31_imx_i2c_data_entry(1, 2),
-       imx31_imx_i2c_data_entry(2, 3),
-};
-#endif /* ifdef CONFIG_SOC_IMX31 */
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
-#define imx35_imx_i2c_data_entry(_id, _hwid)                           \
-       imx_imx_i2c_data_entry(MX35, "imx21-i2c", _id, _hwid, SZ_4K)
-       imx35_imx_i2c_data_entry(0, 1),
-       imx35_imx_i2c_data_entry(1, 2),
-       imx35_imx_i2c_data_entry(2, 3),
-};
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-struct platform_device *__init imx_add_imx_i2c(
-               const struct imx_imx_i2c_data *data,
-               const struct imxi2c_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-
-       return imx_add_platform_device(data->devid, data->id,
-                       res, ARRAY_SIZE(res),
-                       pdata, sizeof(*pdata));
-}
diff --git a/arch/arm/mach-imx/devices/platform-imx-keypad.c b/arch/arm/mach-imx/devices/platform-imx-keypad.c
deleted file mode 100644 (file)
index de2e03e..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_imx_keypad_data_entry_single(soc, _size)                   \
-       {                                                               \
-               .iobase = soc ## _KPP_BASE_ADDR,                        \
-               .iosize = _size,                                        \
-               .irq = soc ## _INT_KPP,                                 \
-       }
-
-#ifdef CONFIG_SOC_IMX21
-const struct imx_imx_keypad_data imx21_imx_keypad_data __initconst =
-       imx_imx_keypad_data_entry_single(MX21, SZ_16);
-#endif /* ifdef CONFIG_SOC_IMX21 */
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst =
-       imx_imx_keypad_data_entry_single(MX27, SZ_16);
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_imx_keypad_data imx31_imx_keypad_data __initconst =
-       imx_imx_keypad_data_entry_single(MX31, SZ_16);
-#endif /* ifdef CONFIG_SOC_IMX31 */
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_imx_keypad_data imx35_imx_keypad_data __initconst =
-       imx_imx_keypad_data_entry_single(MX35, SZ_16);
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-struct platform_device *__init imx_add_imx_keypad(
-               const struct imx_imx_keypad_data *data,
-               const struct matrix_keymap_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-
-       return imx_add_platform_device("imx-keypad", -1,
-                       res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
-}
diff --git a/arch/arm/mach-imx/devices/platform-imx-ssi.c b/arch/arm/mach-imx/devices/platform-imx-ssi.c
deleted file mode 100644 (file)
index ed8c664..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_imx_ssi_data_entry(soc, _id, _hwid, _size)                 \
-       [_id] = {                                                       \
-               .id = _id,                                              \
-               .iobase = soc ## _SSI ## _hwid ## _BASE_ADDR,           \
-               .iosize = _size,                                        \
-               .irq = soc ## _INT_SSI ## _hwid,                        \
-               .dmatx0 = soc ## _DMA_REQ_SSI ## _hwid ## _TX0,         \
-               .dmarx0 = soc ## _DMA_REQ_SSI ## _hwid ## _RX0,         \
-               .dmatx1 = soc ## _DMA_REQ_SSI ## _hwid ## _TX1,         \
-               .dmarx1 = soc ## _DMA_REQ_SSI ## _hwid ## _RX1,         \
-       }
-
-#ifdef CONFIG_SOC_IMX21
-const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst = {
-#define imx21_imx_ssi_data_entry(_id, _hwid)                           \
-       imx_imx_ssi_data_entry(MX21, _id, _hwid, SZ_4K)
-       imx21_imx_ssi_data_entry(0, 1),
-       imx21_imx_ssi_data_entry(1, 2),
-};
-#endif /* ifdef CONFIG_SOC_IMX21 */
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst = {
-#define imx27_imx_ssi_data_entry(_id, _hwid)                           \
-       imx_imx_ssi_data_entry(MX27, _id, _hwid, SZ_4K)
-       imx27_imx_ssi_data_entry(0, 1),
-       imx27_imx_ssi_data_entry(1, 2),
-};
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst = {
-#define imx31_imx_ssi_data_entry(_id, _hwid)                           \
-       imx_imx_ssi_data_entry(MX31, _id, _hwid, SZ_4K)
-       imx31_imx_ssi_data_entry(0, 1),
-       imx31_imx_ssi_data_entry(1, 2),
-};
-#endif /* ifdef CONFIG_SOC_IMX31 */
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst = {
-#define imx35_imx_ssi_data_entry(_id, _hwid)                           \
-       imx_imx_ssi_data_entry(MX35, _id, _hwid, SZ_4K)
-       imx35_imx_ssi_data_entry(0, 1),
-       imx35_imx_ssi_data_entry(1, 2),
-};
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-struct platform_device *__init imx_add_imx_ssi(
-               const struct imx_imx_ssi_data *data,
-               const struct imx_ssi_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-#define DMARES(_name) {                                                        \
-       .name = #_name,                                                 \
-       .start = data->dma ## _name,                                    \
-       .end = data->dma ## _name,                                      \
-       .flags = IORESOURCE_DMA,                                        \
-}
-               DMARES(tx0),
-               DMARES(rx0),
-               DMARES(tx1),
-               DMARES(rx1),
-       };
-
-       return imx_add_platform_device("imx-ssi", data->id,
-                       res, ARRAY_SIZE(res),
-                       pdata, sizeof(*pdata));
-}
diff --git a/arch/arm/mach-imx/devices/platform-imx-uart.c b/arch/arm/mach-imx/devices/platform-imx-uart.c
deleted file mode 100644 (file)
index c8f01de..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2009-2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_imx_uart_3irq_data_entry(soc, _id, _hwid, _size)           \
-       [_id] = {                                                       \
-               .id = _id,                                              \
-               .iobase = soc ## _UART ## _hwid ## _BASE_ADDR,          \
-               .iosize = _size,                                        \
-               .irqrx = soc ## _INT_UART ## _hwid ## RX,               \
-               .irqtx = soc ## _INT_UART ## _hwid ## TX,               \
-               .irqrts = soc ## _INT_UART ## _hwid ## RTS,             \
-       }
-
-#define imx_imx_uart_1irq_data_entry(soc, _id, _hwid, _size)           \
-       [_id] = {                                                       \
-               .id = _id,                                              \
-               .iobase = soc ## _UART ## _hwid ## _BASE_ADDR,          \
-               .iosize = _size,                                        \
-               .irq = soc ## _INT_UART ## _hwid,                       \
-       }
-
-#ifdef CONFIG_SOC_IMX21
-const struct imx_imx_uart_1irq_data imx21_imx_uart_data[] __initconst = {
-#define imx21_imx_uart_data_entry(_id, _hwid)                          \
-       imx_imx_uart_1irq_data_entry(MX21, _id, _hwid, SZ_4K)
-       imx21_imx_uart_data_entry(0, 1),
-       imx21_imx_uart_data_entry(1, 2),
-       imx21_imx_uart_data_entry(2, 3),
-       imx21_imx_uart_data_entry(3, 4),
-};
-#endif
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst = {
-#define imx27_imx_uart_data_entry(_id, _hwid)                          \
-       imx_imx_uart_1irq_data_entry(MX27, _id, _hwid, SZ_4K)
-       imx27_imx_uart_data_entry(0, 1),
-       imx27_imx_uart_data_entry(1, 2),
-       imx27_imx_uart_data_entry(2, 3),
-       imx27_imx_uart_data_entry(3, 4),
-       imx27_imx_uart_data_entry(4, 5),
-       imx27_imx_uart_data_entry(5, 6),
-};
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst = {
-#define imx31_imx_uart_data_entry(_id, _hwid)                          \
-       imx_imx_uart_1irq_data_entry(MX31, _id, _hwid, SZ_4K)
-       imx31_imx_uart_data_entry(0, 1),
-       imx31_imx_uart_data_entry(1, 2),
-       imx31_imx_uart_data_entry(2, 3),
-       imx31_imx_uart_data_entry(3, 4),
-       imx31_imx_uart_data_entry(4, 5),
-};
-#endif /* ifdef CONFIG_SOC_IMX31 */
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst = {
-#define imx35_imx_uart_data_entry(_id, _hwid)                          \
-       imx_imx_uart_1irq_data_entry(MX35, _id, _hwid, SZ_16K)
-       imx35_imx_uart_data_entry(0, 1),
-       imx35_imx_uart_data_entry(1, 2),
-       imx35_imx_uart_data_entry(2, 3),
-};
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-struct platform_device *__init imx_add_imx_uart_1irq(
-               const struct imx_imx_uart_1irq_data *data,
-               const struct imxuart_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-
-       /* i.mx21 type uart runs on all i.mx except i.mx1 */
-       return imx_add_platform_device("imx21-uart", data->id,
-                       res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
-}
diff --git a/arch/arm/mach-imx/devices/platform-imx2-wdt.c b/arch/arm/mach-imx/devices/platform-imx2-wdt.c
deleted file mode 100644 (file)
index fdd355a..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include <linux/sizes.h>
-
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size)         \
-       {                                                               \
-               .id = _id,                                              \
-               .iobase = soc ## _WDOG ## _hwid ## _BASE_ADDR,          \
-               .iosize = _size,                                        \
-       }
-#define imx_imx2_wdt_data_entry(soc, _id, _hwid, _size)                        \
-       [_id] = imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size)
-
-#ifdef CONFIG_SOC_IMX21
-const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst =
-       imx_imx2_wdt_data_entry_single(MX21, 0, , SZ_4K);
-#endif /* ifdef CONFIG_SOC_IMX21 */
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst =
-       imx_imx2_wdt_data_entry_single(MX27, 0, , SZ_4K);
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_imx2_wdt_data imx31_imx2_wdt_data __initconst =
-       imx_imx2_wdt_data_entry_single(MX31, 0, , SZ_16K);
-#endif /* ifdef CONFIG_SOC_IMX31 */
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_imx2_wdt_data imx35_imx2_wdt_data __initconst =
-       imx_imx2_wdt_data_entry_single(MX35, 0, , SZ_16K);
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-struct platform_device *__init imx_add_imx2_wdt(
-               const struct imx_imx2_wdt_data *data)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               },
-       };
-       return imx_add_platform_device("imx2-wdt", data->id,
-                       res, ARRAY_SIZE(res), NULL, 0);
-}
diff --git a/arch/arm/mach-imx/devices/platform-imx21-hcd.c b/arch/arm/mach-imx/devices/platform-imx21-hcd.c
deleted file mode 100644 (file)
index f55763c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_imx21_hcd_data_entry_single(soc)                           \
-       {                                                               \
-               .iobase = soc ## _USBOTG_BASE_ADDR,                     \
-               .irq = soc ## _INT_USBHOST,                             \
-       }
-
-#ifdef CONFIG_SOC_IMX21
-const struct imx_imx21_hcd_data imx21_imx21_hcd_data __initconst =
-       imx_imx21_hcd_data_entry_single(MX21);
-#endif /* ifdef CONFIG_SOC_IMX21 */
-
-struct platform_device *__init imx_add_imx21_hcd(
-               const struct imx_imx21_hcd_data *data,
-               const struct mx21_usbh_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + SZ_8K - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-       return imx_add_platform_device_dmamask("imx21-hcd", 0,
-                       res, ARRAY_SIZE(res),
-                       pdata, sizeof(*pdata), DMA_BIT_MASK(32));
-}
diff --git a/arch/arm/mach-imx/devices/platform-imx27-coda.c b/arch/arm/mach-imx/devices/platform-imx27-coda.c
deleted file mode 100644 (file)
index 66a116e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2012 Vista Silicon
- * Javier Martin <javier.martin@vista-silicon.com>
- */
-
-#include "../hardware.h"
-#include "devices-common.h"
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_imx27_coda_data imx27_coda_data __initconst = {
-       .iobase = MX27_VPU_BASE_ADDR,
-       .iosize = SZ_512,
-       .irq = MX27_INT_VPU,
-};
-#endif
-
-struct platform_device *__init imx_add_imx27_coda(
-               const struct imx_imx27_coda_data *data)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-       return imx_add_platform_device_dmamask("coda-imx27", 0, res, 2, NULL,
-                                       0, DMA_BIT_MASK(32));
-}
diff --git a/arch/arm/mach-imx/devices/platform-ipu-core.c b/arch/arm/mach-imx/devices/platform-ipu-core.c
deleted file mode 100644 (file)
index b429076..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2011 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include <linux/dma-mapping.h>
-
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_ipu_core_entry_single(soc)                                 \
-{                                                                      \
-       .iobase = soc ## _IPU_CTRL_BASE_ADDR,                           \
-       .synirq = soc ## _INT_IPU_SYN,                                  \
-       .errirq = soc ## _INT_IPU_ERR,                                  \
-}
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_ipu_core_data imx31_ipu_core_data __initconst =
-       imx_ipu_core_entry_single(MX31);
-#endif
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_ipu_core_data imx35_ipu_core_data __initconst =
-       imx_ipu_core_entry_single(MX35);
-#endif
-
-static struct platform_device *imx_ipu_coredev __initdata;
-
-struct platform_device *__init imx_add_ipu_core(
-               const struct imx_ipu_core_data *data)
-{
-       /* The resource order is important! */
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + 0x5f,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->iobase + 0x88,
-                       .end = data->iobase + 0xb3,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->synirq,
-                       .end = data->synirq,
-                       .flags = IORESOURCE_IRQ,
-               }, {
-                       .start = data->errirq,
-                       .end = data->errirq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-
-       return imx_ipu_coredev = imx_add_platform_device("ipu-core", -1,
-                       res, ARRAY_SIZE(res), NULL, 0);
-}
-
-struct platform_device *__init imx_alloc_mx3_camera(
-               const struct imx_ipu_core_data *data,
-               const struct mx3_camera_pdata *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase + 0x60,
-                       .end = data->iobase + 0x87,
-                       .flags = IORESOURCE_MEM,
-               },
-       };
-       int ret = -ENOMEM;
-       struct platform_device *pdev;
-
-       if (IS_ERR_OR_NULL(imx_ipu_coredev))
-               return ERR_PTR(-ENODEV);
-
-       pdev = platform_device_alloc("mx3-camera", 0);
-       if (!pdev)
-               return ERR_PTR(-ENOMEM);
-
-       pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
-       if (!pdev->dev.dma_mask)
-               goto err;
-
-       *pdev->dev.dma_mask = DMA_BIT_MASK(32);
-       pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
-
-       ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
-       if (ret)
-               goto err;
-
-       if (pdata) {
-               struct mx3_camera_pdata *copied_pdata;
-
-               ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
-               if (ret) {
-err:
-                       kfree(pdev->dev.dma_mask);
-                       platform_device_put(pdev);
-                       return ERR_PTR(-ENODEV);
-               }
-               copied_pdata = dev_get_platdata(&pdev->dev);
-               copied_pdata->dma_dev = &imx_ipu_coredev->dev;
-       }
-
-       return pdev;
-}
-
-struct platform_device *__init imx_add_mx3_sdc_fb(
-               const struct imx_ipu_core_data *data,
-               struct mx3fb_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase + 0xb4,
-                       .end = data->iobase + 0x1bf,
-                       .flags = IORESOURCE_MEM,
-               },
-       };
-
-       if (IS_ERR_OR_NULL(imx_ipu_coredev))
-               return ERR_PTR(-ENODEV);
-
-       pdata->dma_dev = &imx_ipu_coredev->dev;
-
-       return imx_add_platform_device_dmamask("mx3_sdc_fb", -1,
-                       res, ARRAY_SIZE(res), pdata, sizeof(*pdata),
-                       DMA_BIT_MASK(32));
-}
diff --git a/arch/arm/mach-imx/devices/platform-mx2-camera.c b/arch/arm/mach-imx/devices/platform-mx2-camera.c
deleted file mode 100644 (file)
index 5375f8b..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_mx2_camera_data_entry_single(soc, _devid)                  \
-       {                                                               \
-               .devid = _devid,                                        \
-               .iobasecsi = soc ## _CSI_BASE_ADDR,                     \
-               .iosizecsi = SZ_4K,                                     \
-               .irqcsi = soc ## _INT_CSI,                              \
-       }
-#define imx_mx2_camera_data_entry_single_emma(soc, _devid)             \
-       {                                                               \
-               .devid = _devid,                                        \
-               .iobasecsi = soc ## _CSI_BASE_ADDR,                     \
-               .iosizecsi = SZ_32,                                     \
-               .irqcsi = soc ## _INT_CSI,                              \
-               .iobaseemmaprp = soc ## _EMMAPRP_BASE_ADDR,             \
-               .iosizeemmaprp = SZ_32,                                 \
-               .irqemmaprp = soc ## _INT_EMMAPRP,                      \
-       }
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst =
-       imx_mx2_camera_data_entry_single_emma(MX27, "imx27-camera");
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-struct platform_device *__init imx_add_mx2_camera(
-               const struct imx_mx2_camera_data *data,
-               const struct mx2_camera_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobasecsi,
-                       .end = data->iobasecsi + data->iosizecsi - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irqcsi,
-                       .end = data->irqcsi,
-                       .flags = IORESOURCE_IRQ,
-               }, {
-                       .start = data->iobaseemmaprp,
-                       .end = data->iobaseemmaprp + data->iosizeemmaprp - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irqemmaprp,
-                       .end = data->irqemmaprp,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-       return imx_add_platform_device_dmamask(data->devid, 0,
-                       res, data->iobaseemmaprp ? 4 : 2,
-                       pdata, sizeof(*pdata), DMA_BIT_MASK(32));
-}
-
diff --git a/arch/arm/mach-imx/devices/platform-mx2-emma.c b/arch/arm/mach-imx/devices/platform-mx2-emma.c
deleted file mode 100644 (file)
index 20f28ba..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_mx2_emmaprp_data_entry_single(soc)                         \
-       {                                                               \
-               .iobase = soc ## _EMMAPRP_BASE_ADDR,                    \
-               .iosize = SZ_256,                                       \
-               .irq = soc ## _INT_EMMAPRP,                             \
-       }
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_mx2_emma_data imx27_mx2_emmaprp_data __initconst =
-       imx_mx2_emmaprp_data_entry_single(MX27);
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-struct platform_device *__init imx_add_mx2_emmaprp(
-               const struct imx_mx2_emma_data *data)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-       return imx_add_platform_device_dmamask("m2m-emmaprp", 0,
-                       res, 2, NULL, 0, DMA_BIT_MASK(32));
-}
diff --git a/arch/arm/mach-imx/devices/platform-mxc-ehci.c b/arch/arm/mach-imx/devices/platform-mxc-ehci.c
deleted file mode 100644 (file)
index d9d7cc7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include <linux/dma-mapping.h>
-
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_mxc_ehci_data_entry_single(soc, _id, hs)                   \
-       {                                                               \
-               .id = _id,                                              \
-               .iobase = soc ## _USB_ ## hs ## _BASE_ADDR,             \
-               .irq = soc ## _INT_USB_ ## hs,                          \
-       }
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
-       imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
-const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[] __initconst = {
-       imx_mxc_ehci_data_entry_single(MX27, 1, HS1),
-       imx_mxc_ehci_data_entry_single(MX27, 2, HS2),
-};
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data __initconst =
-       imx_mxc_ehci_data_entry_single(MX31, 0, OTG);
-const struct imx_mxc_ehci_data imx31_mxc_ehci_hs_data[] __initconst = {
-       imx_mxc_ehci_data_entry_single(MX31, 1, HS1),
-       imx_mxc_ehci_data_entry_single(MX31, 2, HS2),
-};
-#endif /* ifdef CONFIG_SOC_IMX31 */
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data __initconst =
-       imx_mxc_ehci_data_entry_single(MX35, 0, OTG);
-const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data __initconst =
-       imx_mxc_ehci_data_entry_single(MX35, 1, HS);
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-struct platform_device *__init imx_add_mxc_ehci(
-               const struct imx_mxc_ehci_data *data,
-               const struct mxc_usbh_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + SZ_512 - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-       return imx_add_platform_device_dmamask("mxc-ehci", data->id,
-                       res, ARRAY_SIZE(res),
-                       pdata, sizeof(*pdata), DMA_BIT_MASK(32));
-}
diff --git a/arch/arm/mach-imx/devices/platform-mxc-mmc.c b/arch/arm/mach-imx/devices/platform-mxc-mmc.c
deleted file mode 100644 (file)
index cd4c502..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include <linux/dma-mapping.h>
-
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size)  \
-       {                                                               \
-               .devid = _devid,                                        \
-               .id = _id,                                              \
-               .iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR,          \
-               .iosize = _size,                                        \
-               .irq = soc ## _INT_SDHC ## _hwid,                       \
-               .dmareq = soc ## _DMA_REQ_SDHC ## _hwid,                \
-       }
-#define imx_mxc_mmc_data_entry(soc, _devid, _id, _hwid, _size)         \
-       [_id] = imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size)
-
-#ifdef CONFIG_SOC_IMX21
-const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
-#define imx21_mxc_mmc_data_entry(_id, _hwid)                           \
-       imx_mxc_mmc_data_entry(MX21, "imx21-mmc", _id, _hwid, SZ_4K)
-       imx21_mxc_mmc_data_entry(0, 1),
-       imx21_mxc_mmc_data_entry(1, 2),
-};
-#endif /* ifdef CONFIG_SOC_IMX21 */
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = {
-#define imx27_mxc_mmc_data_entry(_id, _hwid)                           \
-       imx_mxc_mmc_data_entry(MX27, "imx21-mmc", _id, _hwid, SZ_4K)
-       imx27_mxc_mmc_data_entry(0, 1),
-       imx27_mxc_mmc_data_entry(1, 2),
-};
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_mxc_mmc_data imx31_mxc_mmc_data[] __initconst = {
-#define imx31_mxc_mmc_data_entry(_id, _hwid)                           \
-       imx_mxc_mmc_data_entry(MX31, "imx31-mmc", _id, _hwid, SZ_16K)
-       imx31_mxc_mmc_data_entry(0, 1),
-       imx31_mxc_mmc_data_entry(1, 2),
-};
-#endif /* ifdef CONFIG_SOC_IMX31 */
-
-struct platform_device *__init imx_add_mxc_mmc(
-               const struct imx_mxc_mmc_data *data,
-               const struct imxmmc_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               }, {
-                       .start = data->dmareq,
-                       .end = data->dmareq,
-                       .flags = IORESOURCE_DMA,
-               },
-       };
-       return imx_add_platform_device_dmamask(data->devid, data->id,
-                       res, ARRAY_SIZE(res),
-                       pdata, sizeof(*pdata), DMA_BIT_MASK(32));
-}
diff --git a/arch/arm/mach-imx/devices/platform-mxc_nand.c b/arch/arm/mach-imx/devices/platform-mxc_nand.c
deleted file mode 100644 (file)
index 0f5f741..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2009-2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include <linux/sizes.h>
-
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_mxc_nand_data_entry_single(soc, _devid, _size)             \
-       {                                                               \
-               .devid = _devid,                                        \
-               .iobase = soc ## _NFC_BASE_ADDR,                        \
-               .iosize = _size,                                        \
-               .irq = soc ## _INT_NFC                                  \
-       }
-
-#define imx_mxc_nandv3_data_entry_single(soc, _devid, _size)           \
-       {                                                               \
-               .devid = _devid,                                        \
-               .id = -1,                                               \
-               .iobase = soc ## _NFC_BASE_ADDR,                        \
-               .iosize = _size,                                        \
-               .axibase = soc ## _NFC_AXI_BASE_ADDR,                   \
-               .irq = soc ## _INT_NFC                                  \
-       }
-
-#ifdef CONFIG_SOC_IMX21
-const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
-       imx_mxc_nand_data_entry_single(MX21, "imx21-nand", SZ_4K);
-#endif /* ifdef CONFIG_SOC_IMX21 */
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
-       imx_mxc_nand_data_entry_single(MX27, "imx27-nand", SZ_4K);
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
-       imx_mxc_nand_data_entry_single(MX31, "imx27-nand", SZ_4K);
-#endif
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
-       imx_mxc_nand_data_entry_single(MX35, "imx25-nand", SZ_8K);
-#endif
-
-struct platform_device *__init imx_add_mxc_nand(
-               const struct imx_mxc_nand_data *data,
-               const struct mxc_nand_platform_data *pdata)
-{
-       /* AXI has to come first, that's how the mxc_nand driver expect it */
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               }, {
-                       .start = data->axibase,
-                       .end = data->axibase + SZ_16K - 1,
-                       .flags = IORESOURCE_MEM,
-               },
-       };
-       return imx_add_platform_device(data->devid, data->id,
-                       res, ARRAY_SIZE(res) - !data->axibase,
-                       pdata, sizeof(*pdata));
-}
diff --git a/arch/arm/mach-imx/devices/platform-mxc_rtc.c b/arch/arm/mach-imx/devices/platform-mxc_rtc.c
deleted file mode 100644 (file)
index 0c746de..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010-2011 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_mxc_rtc_data_entry_single(soc, _devid)                     \
-       {                                                               \
-               .devid = _devid,                                        \
-               .iobase = soc ## _RTC_BASE_ADDR,                        \
-               .irq = soc ## _INT_RTC,                                 \
-       }
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_mxc_rtc_data imx31_mxc_rtc_data __initconst =
-       imx_mxc_rtc_data_entry_single(MX31, "imx21-rtc");
-#endif /* ifdef CONFIG_SOC_IMX31 */
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_mxc_rtc_data imx35_mxc_rtc_data __initconst =
-       imx_mxc_rtc_data_entry_single(MX35, "imx21-rtc");
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-struct platform_device *__init imx_add_mxc_rtc(
-               const struct imx_mxc_rtc_data *data)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + SZ_16K - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-
-       return imx_add_platform_device(data->devid, -1,
-                       res, ARRAY_SIZE(res), NULL, 0);
-}
diff --git a/arch/arm/mach-imx/devices/platform-mxc_w1.c b/arch/arm/mach-imx/devices/platform-mxc_w1.c
deleted file mode 100644 (file)
index ab42c6b..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_mxc_w1_data_entry_single(soc)                              \
-       {                                                               \
-               .iobase = soc ## _OWIRE_BASE_ADDR,                      \
-       }
-
-#ifdef CONFIG_SOC_IMX21
-const struct imx_mxc_w1_data imx21_mxc_w1_data __initconst =
-       imx_mxc_w1_data_entry_single(MX21);
-#endif /* ifdef CONFIG_SOC_IMX21 */
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_mxc_w1_data imx27_mxc_w1_data __initconst =
-       imx_mxc_w1_data_entry_single(MX27);
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_mxc_w1_data imx31_mxc_w1_data __initconst =
-       imx_mxc_w1_data_entry_single(MX31);
-#endif /* ifdef CONFIG_SOC_IMX31 */
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_mxc_w1_data imx35_mxc_w1_data __initconst =
-       imx_mxc_w1_data_entry_single(MX35);
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-struct platform_device *__init imx_add_mxc_w1(
-               const struct imx_mxc_w1_data *data)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + SZ_4K - 1,
-                       .flags = IORESOURCE_MEM,
-               },
-       };
-
-       return imx_add_platform_device("mxc_w1", 0,
-                       res, ARRAY_SIZE(res), NULL, 0);
-}
diff --git a/arch/arm/mach-imx/devices/platform-pata_imx.c b/arch/arm/mach-imx/devices/platform-pata_imx.c
deleted file mode 100644 (file)
index 0e985ff..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_pata_imx_data_entry_single(soc, _size)                     \
-       {                                                               \
-               .iobase = soc ## _ATA_BASE_ADDR,                        \
-               .iosize = _size,                                        \
-               .irq = soc ## _INT_ATA,                                 \
-       }
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_pata_imx_data imx27_pata_imx_data __initconst =
-       imx_pata_imx_data_entry_single(MX27, SZ_4K);
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_pata_imx_data imx31_pata_imx_data __initconst =
-       imx_pata_imx_data_entry_single(MX31, SZ_16K);
-#endif /* ifdef CONFIG_SOC_IMX31 */
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_pata_imx_data imx35_pata_imx_data __initconst =
-       imx_pata_imx_data_entry_single(MX35, SZ_16K);
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-struct platform_device *__init imx_add_pata_imx(
-               const struct imx_pata_imx_data *data)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               },
-               {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-       return imx_add_platform_device("pata_imx", -1,
-                       res, ARRAY_SIZE(res), NULL, 0);
-}
-
diff --git a/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c b/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c
deleted file mode 100644 (file)
index 40c2610..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2010 Pengutronix, Wolfram Sang <kernel@pengutronix.de>
- */
-
-#include <linux/platform_data/mmc-esdhc-imx.h>
-
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_sdhci_esdhc_imx_data_entry_single(soc, _devid, _id, hwid) \
-       {                                                               \
-               .devid = _devid,                                        \
-               .id = _id,                                              \
-               .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR,  \
-               .irq = soc ## _INT_ESDHC ## hwid,                       \
-       }
-
-#define imx_sdhci_esdhc_imx_data_entry(soc, devid, id, hwid)   \
-       [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, devid, id, hwid)
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_sdhci_esdhc_imx_data
-imx35_sdhci_esdhc_imx_data[] __initconst = {
-#define imx35_sdhci_esdhc_imx_data_entry(_id, _hwid)                   \
-       imx_sdhci_esdhc_imx_data_entry(MX35, "sdhci-esdhc-imx35", _id, _hwid)
-       imx35_sdhci_esdhc_imx_data_entry(0, 1),
-       imx35_sdhci_esdhc_imx_data_entry(1, 2),
-       imx35_sdhci_esdhc_imx_data_entry(2, 3),
-};
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-static const struct esdhc_platform_data default_esdhc_pdata __initconst = {
-       .wp_type = ESDHC_WP_NONE,
-       .cd_type = ESDHC_CD_NONE,
-};
-
-struct platform_device *__init imx_add_sdhci_esdhc_imx(
-               const struct imx_sdhci_esdhc_imx_data *data,
-               const struct esdhc_platform_data *pdata)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + SZ_16K - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-
-       /*
-        * If machine does not provide pdata, use the default one
-        * which means no WP/CD support
-        */
-       if (!pdata)
-               pdata = &default_esdhc_pdata;
-
-       return imx_add_platform_device_dmamask(data->devid, data->id, res,
-                       ARRAY_SIZE(res), pdata, sizeof(*pdata),
-                       DMA_BIT_MASK(32));
-}
diff --git a/arch/arm/mach-imx/devices/platform-spi_imx.c b/arch/arm/mach-imx/devices/platform-spi_imx.c
deleted file mode 100644 (file)
index 27747bf..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2009-2010 Pengutronix
- * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
- */
-#include <linux/gpio/machine.h>
-#include "../hardware.h"
-#include "devices-common.h"
-
-#define imx_spi_imx_data_entry_single(soc, type, _devid, _id, hwid, _size) \
-       {                                                               \
-               .devid = _devid,                                        \
-               .id = _id,                                              \
-               .iobase = soc ## _ ## type ## hwid ## _BASE_ADDR,       \
-               .iosize = _size,                                        \
-               .irq = soc ## _INT_ ## type ## hwid,                    \
-       }
-
-#define imx_spi_imx_data_entry(soc, type, devid, id, hwid, size)       \
-       [id] = imx_spi_imx_data_entry_single(soc, type, devid, id, hwid, size)
-
-#ifdef CONFIG_SOC_IMX21
-const struct imx_spi_imx_data imx21_cspi_data[] __initconst = {
-#define imx21_cspi_data_entry(_id, _hwid)                            \
-       imx_spi_imx_data_entry(MX21, CSPI, "imx21-cspi", _id, _hwid, SZ_4K)
-       imx21_cspi_data_entry(0, 1),
-       imx21_cspi_data_entry(1, 2),
-};
-#endif
-
-#ifdef CONFIG_SOC_IMX27
-const struct imx_spi_imx_data imx27_cspi_data[] __initconst = {
-#define imx27_cspi_data_entry(_id, _hwid)                              \
-       imx_spi_imx_data_entry(MX27, CSPI, "imx27-cspi", _id, _hwid, SZ_4K)
-       imx27_cspi_data_entry(0, 1),
-       imx27_cspi_data_entry(1, 2),
-       imx27_cspi_data_entry(2, 3),
-};
-#endif /* ifdef CONFIG_SOC_IMX27 */
-
-#ifdef CONFIG_SOC_IMX31
-const struct imx_spi_imx_data imx31_cspi_data[] __initconst = {
-#define imx31_cspi_data_entry(_id, _hwid)                              \
-       imx_spi_imx_data_entry(MX31, CSPI, "imx31-cspi", _id, _hwid, SZ_4K)
-       imx31_cspi_data_entry(0, 1),
-       imx31_cspi_data_entry(1, 2),
-       imx31_cspi_data_entry(2, 3),
-};
-#endif /* ifdef CONFIG_SOC_IMX31 */
-
-#ifdef CONFIG_SOC_IMX35
-const struct imx_spi_imx_data imx35_cspi_data[] __initconst = {
-#define imx35_cspi_data_entry(_id, _hwid)                           \
-       imx_spi_imx_data_entry(MX35, CSPI, "imx35-cspi", _id, _hwid, SZ_4K)
-       imx35_cspi_data_entry(0, 1),
-       imx35_cspi_data_entry(1, 2),
-};
-#endif /* ifdef CONFIG_SOC_IMX35 */
-
-struct platform_device *__init imx_add_spi_imx(
-       const struct imx_spi_imx_data *data, struct gpiod_lookup_table *gtable)
-{
-       struct resource res[] = {
-               {
-                       .start = data->iobase,
-                       .end = data->iobase + data->iosize - 1,
-                       .flags = IORESOURCE_MEM,
-               }, {
-                       .start = data->irq,
-                       .end = data->irq,
-                       .flags = IORESOURCE_IRQ,
-               },
-       };
-       if (gtable)
-               gpiod_add_lookup_table(gtable);
-       return imx_add_platform_device(data->devid, data->id,
-                       res, ARRAY_SIZE(res), NULL, 0);
-}
diff --git a/arch/arm/mach-imx/ehci-imx27.c b/arch/arm/mach-imx/ehci-imx27.c
deleted file mode 100644 (file)
index 83962ce..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
- * Copyright (C) 2010 Freescale Semiconductor, Inc.
- */
-
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/platform_data/usb-ehci-mxc.h>
-
-#include "ehci.h"
-#include "hardware.h"
-
-#define USBCTRL_OTGBASE_OFFSET 0x600
-
-#define MX27_OTG_SIC_SHIFT     29
-#define MX27_OTG_SIC_MASK      (0x3 << MX27_OTG_SIC_SHIFT)
-#define MX27_OTG_PM_BIT                (1 << 24)
-
-#define MX27_H2_SIC_SHIFT      21
-#define MX27_H2_SIC_MASK       (0x3 << MX27_H2_SIC_SHIFT)
-#define MX27_H2_PM_BIT         (1 << 16)
-#define MX27_H2_DT_BIT         (1 << 5)
-
-#define MX27_H1_SIC_SHIFT      13
-#define MX27_H1_SIC_MASK       (0x3 << MX27_H1_SIC_SHIFT)
-#define MX27_H1_PM_BIT         (1 << 8)
-#define MX27_H1_DT_BIT         (1 << 4)
-
-int mx27_initialize_usb_hw(int port, unsigned int flags)
-{
-       unsigned int v;
-
-       v = readl(MX27_IO_ADDRESS(MX27_USB_BASE_ADDR + USBCTRL_OTGBASE_OFFSET));
-
-       switch (port) {
-       case 0: /* OTG port */
-               v &= ~(MX27_OTG_SIC_MASK | MX27_OTG_PM_BIT);
-               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX27_OTG_SIC_SHIFT;
-
-               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-                       v |= MX27_OTG_PM_BIT;
-               break;
-       case 1: /* H1 port */
-               v &= ~(MX27_H1_SIC_MASK | MX27_H1_PM_BIT | MX27_H1_DT_BIT);
-               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX27_H1_SIC_SHIFT;
-
-               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-                       v |= MX27_H1_PM_BIT;
-
-               if (!(flags & MXC_EHCI_TTL_ENABLED))
-                       v |= MX27_H1_DT_BIT;
-
-               break;
-       case 2: /* H2 port */
-               v &= ~(MX27_H2_SIC_MASK | MX27_H2_PM_BIT | MX27_H2_DT_BIT);
-               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX27_H2_SIC_SHIFT;
-
-               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-                       v |= MX27_H2_PM_BIT;
-
-               if (!(flags & MXC_EHCI_TTL_ENABLED))
-                       v |= MX27_H2_DT_BIT;
-
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       writel(v, MX27_IO_ADDRESS(MX27_USB_BASE_ADDR + USBCTRL_OTGBASE_OFFSET));
-
-       return 0;
-}
-
diff --git a/arch/arm/mach-imx/ehci-imx31.c b/arch/arm/mach-imx/ehci-imx31.c
deleted file mode 100644 (file)
index d6d794d..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
- * Copyright (C) 2010 Freescale Semiconductor, Inc.
- */
-
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/platform_data/usb-ehci-mxc.h>
-
-#include "ehci.h"
-#include "hardware.h"
-
-#define USBCTRL_OTGBASE_OFFSET 0x600
-
-#define MX31_OTG_SIC_SHIFT     29
-#define MX31_OTG_SIC_MASK      (0x3 << MX31_OTG_SIC_SHIFT)
-#define MX31_OTG_PM_BIT                (1 << 24)
-
-#define MX31_H2_SIC_SHIFT      21
-#define MX31_H2_SIC_MASK       (0x3 << MX31_H2_SIC_SHIFT)
-#define MX31_H2_PM_BIT         (1 << 16)
-#define MX31_H2_DT_BIT         (1 << 5)
-
-#define MX31_H1_SIC_SHIFT      13
-#define MX31_H1_SIC_MASK       (0x3 << MX31_H1_SIC_SHIFT)
-#define MX31_H1_PM_BIT         (1 << 8)
-#define MX31_H1_DT_BIT         (1 << 4)
-
-int mx31_initialize_usb_hw(int port, unsigned int flags)
-{
-       unsigned int v;
-
-       v = readl(MX31_IO_ADDRESS(MX31_USB_BASE_ADDR + USBCTRL_OTGBASE_OFFSET));
-
-       switch (port) {
-       case 0: /* OTG port */
-               v &= ~(MX31_OTG_SIC_MASK | MX31_OTG_PM_BIT);
-               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX31_OTG_SIC_SHIFT;
-
-               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-                       v |= MX31_OTG_PM_BIT;
-
-               break;
-       case 1: /* H1 port */
-               v &= ~(MX31_H1_SIC_MASK | MX31_H1_PM_BIT | MX31_H1_DT_BIT);
-               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX31_H1_SIC_SHIFT;
-
-               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-                       v |= MX31_H1_PM_BIT;
-
-               if (!(flags & MXC_EHCI_TTL_ENABLED))
-                       v |= MX31_H1_DT_BIT;
-
-               break;
-       case 2: /* H2 port */
-               v &= ~(MX31_H2_SIC_MASK | MX31_H2_PM_BIT | MX31_H2_DT_BIT);
-               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX31_H2_SIC_SHIFT;
-
-               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-                       v |= MX31_H2_PM_BIT;
-
-               if (!(flags & MXC_EHCI_TTL_ENABLED))
-                       v |= MX31_H2_DT_BIT;
-
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       writel(v, MX31_IO_ADDRESS(MX31_USB_BASE_ADDR + USBCTRL_OTGBASE_OFFSET));
-
-       return 0;
-}
diff --git a/arch/arm/mach-imx/ehci-imx35.c b/arch/arm/mach-imx/ehci-imx35.c
deleted file mode 100644 (file)
index e6ba965..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
- * Copyright (C) 2010 Freescale Semiconductor, Inc.
- */
-
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/platform_data/usb-ehci-mxc.h>
-
-#include "ehci.h"
-#include "hardware.h"
-
-#define USBCTRL_OTGBASE_OFFSET 0x600
-
-#define MX35_OTG_SIC_SHIFT     29
-#define MX35_OTG_SIC_MASK      (0x3 << MX35_OTG_SIC_SHIFT)
-#define MX35_OTG_PM_BIT                (1 << 24)
-#define MX35_OTG_PP_BIT                (1 << 11)
-#define MX35_OTG_OCPOL_BIT     (1 << 3)
-
-#define MX35_H1_SIC_SHIFT      21
-#define MX35_H1_SIC_MASK       (0x3 << MX35_H1_SIC_SHIFT)
-#define MX35_H1_PP_BIT         (1 << 18)
-#define MX35_H1_PM_BIT         (1 << 16)
-#define MX35_H1_IPPUE_UP_BIT   (1 << 7)
-#define MX35_H1_IPPUE_DOWN_BIT (1 << 6)
-#define MX35_H1_TLL_BIT                (1 << 5)
-#define MX35_H1_USBTE_BIT      (1 << 4)
-#define MX35_H1_OCPOL_BIT      (1 << 2)
-
-int mx35_initialize_usb_hw(int port, unsigned int flags)
-{
-       unsigned int v;
-
-       v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + USBCTRL_OTGBASE_OFFSET));
-
-       switch (port) {
-       case 0: /* OTG port */
-               v &= ~(MX35_OTG_SIC_MASK | MX35_OTG_PM_BIT | MX35_OTG_PP_BIT |
-                       MX35_OTG_OCPOL_BIT);
-               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX35_OTG_SIC_SHIFT;
-
-               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-                       v |= MX35_OTG_PM_BIT;
-
-               if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
-                       v |= MX35_OTG_PP_BIT;
-
-               if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW))
-                       v |= MX35_OTG_OCPOL_BIT;
-
-               break;
-       case 1: /* H1 port */
-               v &= ~(MX35_H1_SIC_MASK | MX35_H1_PM_BIT | MX35_H1_PP_BIT |
-                       MX35_H1_OCPOL_BIT | MX35_H1_TLL_BIT | MX35_H1_USBTE_BIT |
-                       MX35_H1_IPPUE_DOWN_BIT | MX35_H1_IPPUE_UP_BIT);
-               v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX35_H1_SIC_SHIFT;
-
-               if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-                       v |= MX35_H1_PM_BIT;
-
-               if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
-                       v |= MX35_H1_PP_BIT;
-
-               if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW))
-                       v |= MX35_H1_OCPOL_BIT;
-
-               if (!(flags & MXC_EHCI_TTL_ENABLED))
-                       v |= MX35_H1_TLL_BIT;
-
-               if (flags & MXC_EHCI_INTERNAL_PHY)
-                       v |= MX35_H1_USBTE_BIT;
-
-               if (flags & MXC_EHCI_IPPUE_DOWN)
-                       v |= MX35_H1_IPPUE_DOWN_BIT;
-
-               if (flags & MXC_EHCI_IPPUE_UP)
-                       v |= MX35_H1_IPPUE_UP_BIT;
-
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       writel(v, MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + USBCTRL_OTGBASE_OFFSET));
-
-       return 0;
-}
diff --git a/arch/arm/mach-imx/ehci.h b/arch/arm/mach-imx/ehci.h
deleted file mode 100644 (file)
index b7ad617..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __MACH_IMX_EHCI_H
-#define __MACH_IMX_EHCI_H
-
-/* values for portsc field */
-#define MXC_EHCI_PHY_LOW_POWER_SUSPEND (1 << 23)
-#define MXC_EHCI_FORCE_FS              (1 << 24)
-#define MXC_EHCI_UTMI_8BIT             (0 << 28)
-#define MXC_EHCI_UTMI_16BIT            (1 << 28)
-#define MXC_EHCI_SERIAL                        (1 << 29)
-#define MXC_EHCI_MODE_UTMI             (0 << 30)
-#define MXC_EHCI_MODE_PHILIPS          (1 << 30)
-#define MXC_EHCI_MODE_ULPI             (2 << 30)
-#define MXC_EHCI_MODE_SERIAL           (3 << 30)
-
-/* values for flags field */
-#define MXC_EHCI_INTERFACE_DIFF_UNI    (0 << 0)
-#define MXC_EHCI_INTERFACE_DIFF_BI     (1 << 0)
-#define MXC_EHCI_INTERFACE_SINGLE_UNI  (2 << 0)
-#define MXC_EHCI_INTERFACE_SINGLE_BI   (3 << 0)
-#define MXC_EHCI_INTERFACE_MASK                (0xf)
-
-#define MXC_EHCI_POWER_PINS_ENABLED    (1 << 5)
-#define MXC_EHCI_PWR_PIN_ACTIVE_HIGH   (1 << 6)
-#define MXC_EHCI_OC_PIN_ACTIVE_LOW     (1 << 7)
-#define MXC_EHCI_TTL_ENABLED           (1 << 8)
-
-#define MXC_EHCI_INTERNAL_PHY          (1 << 9)
-#define MXC_EHCI_IPPUE_DOWN            (1 << 10)
-#define MXC_EHCI_IPPUE_UP              (1 << 11)
-#define MXC_EHCI_WAKEUP_ENABLED                (1 << 12)
-#define MXC_EHCI_ITC_NO_THRESHOLD      (1 << 13)
-
-#define MXC_USBCTRL_OFFSET             0
-#define MXC_USB_PHY_CTR_FUNC_OFFSET    0x8
-#define MXC_USB_PHY_CTR_FUNC2_OFFSET   0xc
-#define MXC_USBH2CTRL_OFFSET           0x14
-
-int mx25_initialize_usb_hw(int port, unsigned int flags);
-int mx31_initialize_usb_hw(int port, unsigned int flags);
-int mx35_initialize_usb_hw(int port, unsigned int flags);
-int mx27_initialize_usb_hw(int port, unsigned int flags);
-
-#endif /* __MACH_IMX_EHCI_H */
index 92c5a9c..7acf7ce 100644 (file)
@@ -97,7 +97,6 @@
 #include "mx31.h"
 #include "mx35.h"
 #include "mx2x.h"
-#include "mx21.h"
 #include "mx27.h"
 
 #define imx_map_entry(soc, name, _type)        {                               \
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
deleted file mode 100644 (file)
index 29d97bd..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright 2012 Sascha Hauer, Pengutronix
- */
-
-#include <linux/irq.h>
-#include <linux/of_irq.h>
-#include <linux/of_platform.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-
-#include "common.h"
-#include "mx27.h"
-
-static const char * const imx27_dt_board_compat[] __initconst = {
-       "fsl,imx27",
-       NULL
-};
-
-DT_MACHINE_START(IMX27_DT, "Freescale i.MX27 (Device Tree Support)")
-       .map_io         = mx27_map_io,
-       .init_early     = imx27_init_early,
-       .init_irq       = mx27_init_irq,
-       .init_late      = imx27_pm_init,
-       .dt_compat      = imx27_dt_board_compat,
-MACHINE_END
diff --git a/arch/arm/mach-imx/iomux-imx31.c b/arch/arm/mach-imx/iomux-imx31.c
deleted file mode 100644 (file)
index abfc306..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
- * Copyright (C) 2009 by Valentin Longchamp <valentin.longchamp@epfl.ch>
- */
-#include <linux/gpio.h>
-#include <linux/module.h>
-#include <linux/spinlock.h>
-#include <linux/io.h>
-#include <linux/kernel.h>
-
-#include "hardware.h"
-#include "iomux-mx3.h"
-
-/*
- * IOMUX register (base) addresses
- */
-#define IOMUX_BASE     MX31_IO_ADDRESS(MX31_IOMUXC_BASE_ADDR)
-#define IOMUXINT_OBS1  (IOMUX_BASE + 0x000)
-#define IOMUXINT_OBS2  (IOMUX_BASE + 0x004)
-#define IOMUXGPR       (IOMUX_BASE + 0x008)
-#define IOMUXSW_MUX_CTL        (IOMUX_BASE + 0x00C)
-#define IOMUXSW_PAD_CTL        (IOMUX_BASE + 0x154)
-
-static DEFINE_SPINLOCK(gpio_mux_lock);
-
-#define IOMUX_REG_MASK (IOMUX_PADNUM_MASK & ~0x3)
-
-static DECLARE_BITMAP(mxc_pin_alloc_map, NB_PORTS * 32);
-/*
- * set the mode for a IOMUX pin.
- */
-void mxc_iomux_mode(unsigned int pin_mode)
-{
-       u32 field;
-       u32 l;
-       u32 mode;
-       void __iomem *reg;
-
-       reg = IOMUXSW_MUX_CTL + (pin_mode & IOMUX_REG_MASK);
-       field = pin_mode & 0x3;
-       mode = (pin_mode & IOMUX_MODE_MASK) >> IOMUX_MODE_SHIFT;
-
-       spin_lock(&gpio_mux_lock);
-
-       l = imx_readl(reg);
-       l &= ~(0xff << (field * 8));
-       l |= mode << (field * 8);
-       imx_writel(l, reg);
-
-       spin_unlock(&gpio_mux_lock);
-}
-
-/*
- * This function configures the pad value for a IOMUX pin.
- */
-void mxc_iomux_set_pad(enum iomux_pins pin, u32 config)
-{
-       u32 field, l;
-       void __iomem *reg;
-
-       pin &= IOMUX_PADNUM_MASK;
-       reg = IOMUXSW_PAD_CTL + (pin + 2) / 3 * 4;
-       field = (pin + 2) % 3;
-
-       pr_debug("%s: reg offset = 0x%x, field = %d\n",
-                       __func__, (pin + 2) / 3, field);
-
-       spin_lock(&gpio_mux_lock);
-
-       l = imx_readl(reg);
-       l &= ~(0x1ff << (field * 10));
-       l |= config << (field * 10);
-       imx_writel(l, reg);
-
-       spin_unlock(&gpio_mux_lock);
-}
-
-/*
- * allocs a single pin:
- *     - reserves the pin so that it is not claimed by another driver
- *     - setups the iomux according to the configuration
- */
-int mxc_iomux_alloc_pin(unsigned int pin, const char *label)
-{
-       unsigned pad = pin & IOMUX_PADNUM_MASK;
-
-       if (pad >= (PIN_MAX + 1)) {
-               printk(KERN_ERR "mxc_iomux: Attempt to request nonexistent pin %u for \"%s\"\n",
-                       pad, label ? label : "?");
-               return -EINVAL;
-       }
-
-       if (test_and_set_bit(pad, mxc_pin_alloc_map)) {
-               printk(KERN_ERR "mxc_iomux: pin %u already used. Allocation for \"%s\" failed\n",
-                       pad, label ? label : "?");
-               return -EBUSY;
-       }
-       mxc_iomux_mode(pin);
-
-       return 0;
-}
-
-int mxc_iomux_setup_multiple_pins(const unsigned int *pin_list, unsigned count,
-               const char *label)
-{
-       const unsigned int *p = pin_list;
-       int i;
-       int ret = -EINVAL;
-
-       for (i = 0; i < count; i++) {
-               ret = mxc_iomux_alloc_pin(*p, label);
-               if (ret)
-                       goto setup_error;
-               p++;
-       }
-       return 0;
-
-setup_error:
-       mxc_iomux_release_multiple_pins(pin_list, i);
-       return ret;
-}
-
-void mxc_iomux_release_pin(unsigned int pin)
-{
-       unsigned pad = pin & IOMUX_PADNUM_MASK;
-
-       if (pad < (PIN_MAX + 1))
-               clear_bit(pad, mxc_pin_alloc_map);
-}
-
-void mxc_iomux_release_multiple_pins(const unsigned int *pin_list, int count)
-{
-       const unsigned int *p = pin_list;
-       int i;
-
-       for (i = 0; i < count; i++) {
-               mxc_iomux_release_pin(*p);
-               p++;
-       }
-}
-
-/*
- * This function enables/disables the general purpose function for a particular
- * signal.
- */
-void mxc_iomux_set_gpr(enum iomux_gp_func gp, bool en)
-{
-       u32 l;
-
-       spin_lock(&gpio_mux_lock);
-       l = imx_readl(IOMUXGPR);
-       if (en)
-               l |= gp;
-       else
-               l &= ~gp;
-
-       imx_writel(l, IOMUXGPR);
-       spin_unlock(&gpio_mux_lock);
-}
diff --git a/arch/arm/mach-imx/iomux-mx21.h b/arch/arm/mach-imx/iomux-mx21.h
deleted file mode 100644 (file)
index 6eab347..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (C) 2009 by Holger Schurig <hs4233@mail.mn-solutions.de>
- */
-#ifndef __MACH_IOMUX_MX21_H__
-#define __MACH_IOMUX_MX21_H__
-
-#include "iomux-mx2x.h"
-#include "iomux-v1.h"
-
-/* Primary GPIO pin functions */
-
-#define PB22_PF_USBH1_BYP      (GPIO_PORTB | GPIO_PF | 22)
-#define PB25_PF_USBH1_ON       (GPIO_PORTB | GPIO_PF | 25)
-#define PC5_PF_USBOTG_SDA      (GPIO_PORTC | GPIO_PF | 5)
-#define PC6_PF_USBOTG_SCL      (GPIO_PORTC | GPIO_PF | 6)
-#define PC7_PF_USBOTG_ON       (GPIO_PORTC | GPIO_PF | 7)
-#define PC8_PF_USBOTG_FS       (GPIO_PORTC | GPIO_PF | 8)
-#define PC9_PF_USBOTG_OE       (GPIO_PORTC | GPIO_PF | 9)
-#define PC10_PF_USBOTG_TXDM    (GPIO_PORTC | GPIO_PF | 10)
-#define PC11_PF_USBOTG_TXDP    (GPIO_PORTC | GPIO_PF | 11)
-#define PC12_PF_USBOTG_RXDM    (GPIO_PORTC | GPIO_PF | 12)
-#define PC13_PF_USBOTG_RXDP    (GPIO_PORTC | GPIO_PF | 13)
-#define PC16_PF_SAP_FS         (GPIO_PORTC | GPIO_PF | 16)
-#define PC17_PF_SAP_RXD                (GPIO_PORTC | GPIO_PF | 17)
-#define PC18_PF_SAP_TXD                (GPIO_PORTC | GPIO_PF | 18)
-#define PC19_PF_SAP_CLK                (GPIO_PORTC | GPIO_PF | 19)
-#define PE0_PF_TEST_WB2                (GPIO_PORTE | GPIO_PF | 0)
-#define PE1_PF_TEST_WB1                (GPIO_PORTE | GPIO_PF | 1)
-#define PE2_PF_TEST_WB0                (GPIO_PORTE | GPIO_PF | 2)
-#define PF1_PF_NFCE            (GPIO_PORTF | GPIO_PF | 1)
-#define PF3_PF_NFCLE           (GPIO_PORTF | GPIO_PF | 3)
-#define PF7_PF_NFIO0           (GPIO_PORTF | GPIO_PF | 7)
-#define PF8_PF_NFIO1           (GPIO_PORTF | GPIO_PF | 8)
-#define PF9_PF_NFIO2           (GPIO_PORTF | GPIO_PF | 9)
-#define PF10_PF_NFIO3          (GPIO_PORTF | GPIO_PF | 10)
-#define PF11_PF_NFIO4          (GPIO_PORTF | GPIO_PF | 11)
-#define PF12_PF_NFIO5          (GPIO_PORTF | GPIO_PF | 12)
-#define PF13_PF_NFIO6          (GPIO_PORTF | GPIO_PF | 13)
-#define PF14_PF_NFIO7          (GPIO_PORTF | GPIO_PF | 14)
-#define PF16_PF_RES            (GPIO_PORTF | GPIO_PF | 16)
-
-/* Alternate GPIO pin functions */
-
-#define PA5_AF_BMI_CLK_CS      (GPIO_PORTA | GPIO_AF | 5)
-#define PA6_AF_BMI_D0          (GPIO_PORTA | GPIO_AF | 6)
-#define PA7_AF_BMI_D1          (GPIO_PORTA | GPIO_AF | 7)
-#define PA8_AF_BMI_D2          (GPIO_PORTA | GPIO_AF | 8)
-#define PA9_AF_BMI_D3          (GPIO_PORTA | GPIO_AF | 9)
-#define PA10_AF_BMI_D4         (GPIO_PORTA | GPIO_AF | 10)
-#define PA11_AF_BMI_D5         (GPIO_PORTA | GPIO_AF | 11)
-#define PA12_AF_BMI_D6         (GPIO_PORTA | GPIO_AF | 12)
-#define PA13_AF_BMI_D7         (GPIO_PORTA | GPIO_AF | 13)
-#define PA14_AF_BMI_D8         (GPIO_PORTA | GPIO_AF | 14)
-#define PA15_AF_BMI_D9         (GPIO_PORTA | GPIO_AF | 15)
-#define PA16_AF_BMI_D10                (GPIO_PORTA | GPIO_AF | 16)
-#define PA17_AF_BMI_D11                (GPIO_PORTA | GPIO_AF | 17)
-#define PA18_AF_BMI_D12                (GPIO_PORTA | GPIO_AF | 18)
-#define PA19_AF_BMI_D13                (GPIO_PORTA | GPIO_AF | 19)
-#define PA20_AF_BMI_D14                (GPIO_PORTA | GPIO_AF | 20)
-#define PA21_AF_BMI_D15                (GPIO_PORTA | GPIO_AF | 21)
-#define PA22_AF_BMI_READ_REQ   (GPIO_PORTA | GPIO_AF | 22)
-#define PA23_AF_BMI_WRITE      (GPIO_PORTA | GPIO_AF | 23)
-#define PA29_AF_BMI_RX_FULL    (GPIO_PORTA | GPIO_AF | 29)
-#define PA30_AF_BMI_READ       (GPIO_PORTA | GPIO_AF | 30)
-
-/* AIN GPIO pin functions */
-
-#define PC14_AIN_SYS_CLK       (GPIO_PORTC | GPIO_AIN | GPIO_OUT | 14)
-#define PD21_AIN_USBH2_FS      (GPIO_PORTD | GPIO_AIN | GPIO_OUT | 21)
-#define PD22_AIN_USBH2_OE      (GPIO_PORTD | GPIO_AIN | GPIO_OUT | 22)
-#define PD23_AIN_USBH2_TXDM    (GPIO_PORTD | GPIO_AIN | GPIO_OUT | 23)
-#define PD24_AIN_USBH2_TXDP    (GPIO_PORTD | GPIO_AIN | GPIO_OUT | 24)
-#define PE8_AIN_IR_TXD         (GPIO_PORTE | GPIO_AIN | GPIO_OUT | 8)
-#define PF0_AIN_PC_RST         (GPIO_PORTF | GPIO_AIN | GPIO_OUT | 0)
-#define PF1_AIN_PC_CE1         (GPIO_PORTF | GPIO_AIN | GPIO_OUT | 1)
-#define PF2_AIN_PC_CE2         (GPIO_PORTF | GPIO_AIN | GPIO_OUT | 2)
-#define PF3_AIN_PC_POE         (GPIO_PORTF | GPIO_AIN | GPIO_OUT | 3)
-#define PF4_AIN_PC_OE          (GPIO_PORTF | GPIO_AIN | GPIO_OUT | 4)
-#define PF5_AIN_PC_RW          (GPIO_PORTF | GPIO_AIN | GPIO_OUT | 5)
-
-/* BIN GPIO pin functions */
-
-#define PC14_BIN_SYS_CLK       (GPIO_PORTC | GPIO_BIN | GPIO_OUT | 14)
-#define PD27_BIN_EXT_DMA_GRANT (GPIO_PORTD | GPIO_BIN | GPIO_OUT | 27)
-
-/* CIN GPIO pin functions */
-
-#define PB26_CIN_USBH1_RXDAT   (GPIO_PORTB | GPIO_CIN | GPIO_OUT | 26)
-
-/* AOUT GPIO pin functions */
-
-#define PA29_AOUT_BMI_WAIT     (GPIO_PORTA | GPIO_AOUT | GPIO_IN | 29)
-#define PD19_AOUT_USBH2_RXDM   (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 19)
-#define PD20_AOUT_USBH2_RXDP   (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 20)
-#define PD25_AOUT_EXT_DMAREQ   (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 25)
-#define PD26_AOUT_USBOTG_RXDAT (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 26)
-#define PE9_AOUT_IR_RXD                (GPIO_PORTE | GPIO_AOUT | GPIO_IN | 9)
-#define PF6_AOUT_PC_BVD2       (GPIO_PORTF | GPIO_AOUT | GPIO_IN | 6)
-#define PF7_AOUT_PC_BVD1       (GPIO_PORTF | GPIO_AOUT | GPIO_IN | 7)
-#define PF8_AOUT_PC_VS2                (GPIO_PORTF | GPIO_AOUT | GPIO_IN | 8)
-#define PF9_AOUT_PC_VS1                (GPIO_PORTF | GPIO_AOUT | GPIO_IN | 9)
-#define PF10_AOUT_PC_WP                (GPIO_PORTF | GPIO_AOUT | GPIO_IN | 10)
-#define PF11_AOUT_PC_READY     (GPIO_PORTF | GPIO_AOUT | GPIO_IN | 11)
-#define PF12_AOUT_PC_WAIT      (GPIO_PORTF | GPIO_AOUT | GPIO_IN | 12)
-#define PF13_AOUT_PC_CD2       (GPIO_PORTF | GPIO_AOUT | GPIO_IN | 13)
-#define PF14_AOUT_PC_CD1       (GPIO_PORTF | GPIO_AOUT | GPIO_IN | 14)
-
-#endif /* ifndef __MACH_IOMUX_MX21_H__ */
diff --git a/arch/arm/mach-imx/iomux-mx27.h b/arch/arm/mach-imx/iomux-mx27.h
deleted file mode 100644 (file)
index 4d848d1..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
- * Copyright (C) 2009 by Holger Schurig <hs4233@mail.mn-solutions.de>
- */
-#ifndef __MACH_IOMUX_MX27_H__
-#define __MACH_IOMUX_MX27_H__
-
-#include "iomux-mx2x.h"
-#include "iomux-v1.h"
-
-/* Primary GPIO pin functions */
-
-#define PA0_PF_USBH2_CLK       (GPIO_PORTA | GPIO_PF | 0)
-#define PA1_PF_USBH2_DIR       (GPIO_PORTA | GPIO_PF | 1)
-#define PA2_PF_USBH2_DATA7     (GPIO_PORTA | GPIO_PF | 2)
-#define PA3_PF_USBH2_NXT       (GPIO_PORTA | GPIO_PF | 3)
-#define PA4_PF_USBH2_STP       (GPIO_PORTA | GPIO_PF | 4)
-#define PB22_PF_USBH1_SUSP     (GPIO_PORTB | GPIO_PF | 22)
-#define PB25_PF_USBH1_RCV      (GPIO_PORTB | GPIO_PF | 25)
-#define PC5_PF_I2C2_SDA                (GPIO_PORTC | GPIO_PF | GPIO_IN | 5)
-#define PC6_PF_I2C2_SCL                (GPIO_PORTC | GPIO_PF | GPIO_IN | 6)
-#define PC7_PF_USBOTG_DATA5    (GPIO_PORTC | GPIO_PF | GPIO_OUT | 7)
-#define PC8_PF_USBOTG_DATA6    (GPIO_PORTC | GPIO_PF | GPIO_OUT | 8)
-#define PC9_PF_USBOTG_DATA0    (GPIO_PORTC | GPIO_PF | GPIO_OUT | 9)
-#define PC10_PF_USBOTG_DATA2   (GPIO_PORTC | GPIO_PF | GPIO_OUT | 10)
-#define PC11_PF_USBOTG_DATA1   (GPIO_PORTC | GPIO_PF | GPIO_OUT | 11)
-#define PC12_PF_USBOTG_DATA4   (GPIO_PORTC | GPIO_PF | GPIO_OUT | 12)
-#define PC13_PF_USBOTG_DATA3   (GPIO_PORTC | GPIO_PF | GPIO_OUT | 13)
-#define PC16_PF_SSI4_FS                (GPIO_PORTC | GPIO_PF | GPIO_IN | 16)
-#define PC17_PF_SSI4_RXD       (GPIO_PORTC | GPIO_PF | GPIO_IN | 17)
-#define PC18_PF_SSI4_TXD       (GPIO_PORTC | GPIO_PF | GPIO_IN | 18)
-#define PC19_PF_SSI4_CLK       (GPIO_PORTC | GPIO_PF | GPIO_IN | 19)
-#define PD0_PF_SD3_CMD         (GPIO_PORTD | GPIO_PF | 0)
-#define PD1_PF_SD3_CLK         (GPIO_PORTD | GPIO_PF | 1)
-#define PD2_PF_ATA_DATA0       (GPIO_PORTD | GPIO_PF | 2)
-#define PD3_PF_ATA_DATA1       (GPIO_PORTD | GPIO_PF | 3)
-#define PD4_PF_ATA_DATA2       (GPIO_PORTD | GPIO_PF | 4)
-#define PD5_PF_ATA_DATA3       (GPIO_PORTD | GPIO_PF | 5)
-#define PD6_PF_ATA_DATA4       (GPIO_PORTD | GPIO_PF | 6)
-#define PD7_PF_ATA_DATA5       (GPIO_PORTD | GPIO_PF | 7)
-#define PD8_PF_ATA_DATA6       (GPIO_PORTD | GPIO_PF | 8)
-#define PD9_PF_ATA_DATA7       (GPIO_PORTD | GPIO_PF | 9)
-#define PD10_PF_ATA_DATA8      (GPIO_PORTD | GPIO_PF | 10)
-#define PD11_PF_ATA_DATA9      (GPIO_PORTD | GPIO_PF | 11)
-#define PD12_PF_ATA_DATA10     (GPIO_PORTD | GPIO_PF | 12)
-#define PD13_PF_ATA_DATA11     (GPIO_PORTD | GPIO_PF | 13)
-#define PD14_PF_ATA_DATA12     (GPIO_PORTD | GPIO_PF | 14)
-#define PD15_PF_ATA_DATA13     (GPIO_PORTD | GPIO_PF | 15)
-#define PD16_PF_ATA_DATA14     (GPIO_PORTD | GPIO_PF | 16)
-#define PE0_PF_USBOTG_NXT      (GPIO_PORTE | GPIO_PF | GPIO_OUT | 0)
-#define PE1_PF_USBOTG_STP      (GPIO_PORTE | GPIO_PF | GPIO_OUT | 1)
-#define PE2_PF_USBOTG_DIR      (GPIO_PORTE | GPIO_PF | GPIO_OUT | 2)
-#define PE24_PF_USBOTG_CLK     (GPIO_PORTE | GPIO_PF | GPIO_OUT | 24)
-#define PE25_PF_USBOTG_DATA7   (GPIO_PORTE | GPIO_PF | GPIO_OUT | 25)
-#define PF1_PF_NFCLE           (GPIO_PORTF | GPIO_PF | 1)
-#define PF3_PF_NFCE            (GPIO_PORTF | GPIO_PF | 3)
-#define PF7_PF_PC_POE          (GPIO_PORTF | GPIO_PF | 7)
-#define PF8_PF_PC_RW           (GPIO_PORTF | GPIO_PF | 8)
-#define PF9_PF_PC_IOIS16       (GPIO_PORTF | GPIO_PF | 9)
-#define PF10_PF_PC_RST         (GPIO_PORTF | GPIO_PF | 10)
-#define PF11_PF_PC_BVD2                (GPIO_PORTF | GPIO_PF | 11)
-#define PF12_PF_PC_BVD1                (GPIO_PORTF | GPIO_PF | 12)
-#define PF13_PF_PC_VS2         (GPIO_PORTF | GPIO_PF | 13)
-#define PF14_PF_PC_VS1         (GPIO_PORTF | GPIO_PF | 14)
-#define PF16_PF_PC_PWRON       (GPIO_PORTF | GPIO_PF | 16)
-#define PF17_PF_PC_READY       (GPIO_PORTF | GPIO_PF | 17)
-#define PF18_PF_PC_WAIT                (GPIO_PORTF | GPIO_PF | 18)
-#define PF19_PF_PC_CD2         (GPIO_PORTF | GPIO_PF | 19)
-#define PF20_PF_PC_CD1         (GPIO_PORTF | GPIO_PF | 20)
-#define PF23_PF_ATA_DATA15     (GPIO_PORTF | GPIO_PF | 23)
-
-/* Alternate GPIO pin functions */
-
-#define PB4_AF_MSHC_DATA0      (GPIO_PORTB | GPIO_AF | GPIO_OUT | 4)
-#define PB5_AF_MSHC_DATA1      (GPIO_PORTB | GPIO_AF | GPIO_OUT | 5)
-#define PB6_AF_MSHC_DATA2      (GPIO_PORTB | GPIO_AF | GPIO_OUT | 6)
-#define PB7_AF_MSHC_DATA4      (GPIO_PORTB | GPIO_AF | GPIO_OUT | 7)
-#define PB8_AF_MSHC_BS         (GPIO_PORTB | GPIO_AF | GPIO_OUT | 8)
-#define PB9_AF_MSHC_SCLK       (GPIO_PORTB | GPIO_AF | GPIO_OUT | 9)
-#define PB10_AF_UART6_TXD      (GPIO_PORTB | GPIO_AF | GPIO_OUT | 10)
-#define PB11_AF_UART6_RXD      (GPIO_PORTB | GPIO_AF | GPIO_IN | 11)
-#define PB12_AF_UART6_CTS      (GPIO_PORTB | GPIO_AF | GPIO_OUT | 12)
-#define PB13_AF_UART6_RTS      (GPIO_PORTB | GPIO_AF | GPIO_IN | 13)
-#define PB18_AF_UART5_TXD      (GPIO_PORTB | GPIO_AF | GPIO_OUT | 18)
-#define PB19_AF_UART5_RXD      (GPIO_PORTB | GPIO_AF | GPIO_IN | 19)
-#define PB20_AF_UART5_CTS      (GPIO_PORTB | GPIO_AF | GPIO_OUT | 20)
-#define PB21_AF_UART5_RTS      (GPIO_PORTB | GPIO_AF | GPIO_IN | 21)
-#define PC8_AF_FEC_MDIO                (GPIO_PORTC | GPIO_AF | GPIO_IN | 8)
-#define PC24_AF_GPT5_TOUT      (GPIO_PORTC | GPIO_AF | 24)
-#define PC25_AF_GPT5_TIN       (GPIO_PORTC | GPIO_AF | 25)
-#define PC26_AF_GPT4_TOUT      (GPIO_PORTC | GPIO_AF | 26)
-#define PC27_AF_GPT4_TIN       (GPIO_PORTC | GPIO_AF | 27)
-#define PD1_AF_ETMTRACE_PKT15  (GPIO_PORTD | GPIO_AF | 1)
-#define PD6_AF_ETMTRACE_PKT14  (GPIO_PORTD | GPIO_AF | 6)
-#define PD7_AF_ETMTRACE_PKT13  (GPIO_PORTD | GPIO_AF | 7)
-#define PD9_AF_ETMTRACE_PKT12  (GPIO_PORTD | GPIO_AF | 9)
-#define PD2_AF_SD3_D0          (GPIO_PORTD | GPIO_AF | 2)
-#define PD3_AF_SD3_D1          (GPIO_PORTD | GPIO_AF | 3)
-#define PD4_AF_SD3_D2          (GPIO_PORTD | GPIO_AF | 4)
-#define PD5_AF_SD3_D3          (GPIO_PORTD | GPIO_AF | 5)
-#define PD8_AF_FEC_MDIO                (GPIO_PORTD | GPIO_AF | GPIO_IN | 8)
-#define PD10_AF_ETMTRACE_PKT11 (GPIO_PORTD | GPIO_AF | 10)
-#define PD11_AF_ETMTRACE_PKT10 (GPIO_PORTD | GPIO_AF | 11)
-#define PD12_AF_ETMTRACE_PKT9  (GPIO_PORTD | GPIO_AF | 12)
-#define PD13_AF_ETMTRACE_PKT8  (GPIO_PORTD | GPIO_AF | 13)
-#define PD14_AF_ETMTRACE_PKT7  (GPIO_PORTD | GPIO_AF | 14)
-#define PD15_AF_ETMTRACE_PKT6  (GPIO_PORTD | GPIO_AF | 15)
-#define PD16_AF_ETMTRACE_PKT5  (GPIO_PORTD | GPIO_AF | 16)
-#define PF1_AF_ETMTRACE_PKT0   (GPIO_PORTF | GPIO_AF | 1)
-#define PF3_AF_ETMTRACE_PKT2   (GPIO_PORTF | GPIO_AF | 3)
-#define PF5_AF_ETMPIPESTAT11   (GPIO_PORTF | GPIO_AF | 5)
-#define PF7_AF_ATA_BUFFER_EN   (GPIO_PORTF | GPIO_AF | 7)
-#define PF8_AF_ATA_IORDY       (GPIO_PORTF | GPIO_AF | 8)
-#define PF9_AF_ATA_INTRQ       (GPIO_PORTF | GPIO_AF | 9)
-#define PF10_AF_ATA_RESET      (GPIO_PORTF | GPIO_AF | 10)
-#define PF11_AF_ATA_DMACK      (GPIO_PORTF | GPIO_AF | 11)
-#define PF12_AF_ATA_DMAREQ     (GPIO_PORTF | GPIO_AF | 12)
-#define PF13_AF_ATA_DA0                (GPIO_PORTF | GPIO_AF | 13)
-#define PF14_AF_ATA_DA1                (GPIO_PORTF | GPIO_AF | 14)
-#define PF15_AF_ETMTRACE_SYNC  (GPIO_PORTF | GPIO_AF | 15)
-#define PF16_AF_ATA_DA2                (GPIO_PORTF | GPIO_AF | 16)
-#define PF17_AF_ATA_CS0                (GPIO_PORTF | GPIO_AF | 17)
-#define PF18_AF_ATA_CS1                (GPIO_PORTF | GPIO_AF | 18)
-#define PF19_AF_ATA_DIOW       (GPIO_PORTF | GPIO_AF | 19)
-#define PF20_AF_ATA_DIOR       (GPIO_PORTF | GPIO_AF | 20)
-#define PF22_AF_ETMTRACE_CLK   (GPIO_PORTF | GPIO_AF | 22)
-#define PF23_AF_ETMTRACE_PKT4  (GPIO_PORTF | GPIO_AF | 23)
-
-/* AIN GPIO pin functions */
-
-#define PC14_AIN_SSI1_MCLK     (GPIO_PORTC | GPIO_AIN | GPIO_OUT | 14)
-#define PC15_AIN_GPT6_TOUT     (GPIO_PORTC | GPIO_AIN | GPIO_OUT | 15)
-#define PD0_AIN_FEC_TXD0       (GPIO_PORTD | GPIO_AIN | GPIO_OUT | 0)
-#define PD1_AIN_FEC_TXD1       (GPIO_PORTD | GPIO_AIN | GPIO_OUT | 1)
-#define PD2_AIN_FEC_TXD2       (GPIO_PORTD | GPIO_AIN | GPIO_OUT | 2)
-#define PD3_AIN_FEC_TXD3       (GPIO_PORTD | GPIO_AIN | GPIO_OUT | 3)
-#define PD9_AIN_FEC_MDC                (GPIO_PORTD | GPIO_AIN | GPIO_OUT | 9)
-#define PD16_AIN_FEC_TX_ER     (GPIO_PORTD | GPIO_AIN | GPIO_OUT | 16)
-#define PD27_AIN_EXT_DMA_GRANT (GPIO_PORTD | GPIO_AIN | GPIO_OUT | 27)
-#define PF23_AIN_FEC_TX_EN     (GPIO_PORTF | GPIO_AIN | GPIO_OUT | 23)
-
-/* BIN GPIO pin functions */
-
-#define PC14_BIN_SSI2_MCLK     (GPIO_PORTC | GPIO_BIN | GPIO_OUT | 14)
-
-/* CIN GPIO pin functions */
-
-#define PD2_CIN_SLCDC1_DAT0    (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 2)
-#define PD3_CIN_SLCDC1_DAT1    (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 3)
-#define PD4_CIN_SLCDC1_DAT2    (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 4)
-#define PD5_CIN_SLCDC1_DAT3    (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 5)
-#define PD6_CIN_SLCDC1_DAT4    (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 6)
-#define PD7_CIN_SLCDC1_DAT5    (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 7)
-#define PD8_CIN_SLCDC1_DAT6    (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 8)
-#define PD9_CIN_SLCDC1_DAT7    (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 9)
-#define PD10_CIN_SLCDC1_DAT8   (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 10)
-#define PD11_CIN_SLCDC1_DAT9   (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 11)
-#define PD12_CIN_SLCDC1_DAT10  (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 12)
-#define PD13_CIN_SLCDC1_DAT11  (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 13)
-#define PD14_CIN_SLCDC1_DAT12  (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 14)
-#define PD15_CIN_SLCDC1_DAT13  (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 15)
-#define PD16_CIN_SLCDC1_DAT14  (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 16)
-#define PD23_CIN_SLCDC1_DAT15  (GPIO_PORTD | GPIO_CIN | GPIO_OUT | 23)
-#define PF27_CIN_EXT_DMA_GRANT (GPIO_PORTF | GPIO_CIN | GPIO_OUT | 27)
-/* LCDC_TESTx on PBxx omitted, because it's not clear what they do */
-
-/* AOUT GPIO pin functions */
-
-#define PC14_AOUT_GPT6_TIN     (GPIO_PORTC | GPIO_AOUT | GPIO_IN | 14)
-#define PD4_AOUT_FEC_RX_ER     (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 4)
-#define PD5_AOUT_FEC_RXD1      (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 5)
-#define PD6_AOUT_FEC_RXD2      (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 6)
-#define PD7_AOUT_FEC_RXD3      (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 7)
-#define PD10_AOUT_FEC_CRS      (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 10)
-#define PD11_AOUT_FEC_TX_CLK   (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 11)
-#define PD12_AOUT_FEC_RXD0     (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 12)
-#define PD13_AOUT_FEC_RX_DV    (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 13)
-#define PD14_AOUT_FEC_RX_CLK   (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 14)
-#define PD15_AOUT_FEC_COL      (GPIO_PORTD | GPIO_AOUT | GPIO_IN | 15)
-
-/* BOUT GPIO pin functions */
-
-#define PC17_BOUT_PC_IOIS16    (GPIO_PORTC | GPIO_BOUT | GPIO_IN | 17)
-#define PC18_BOUT_PC_BVD2      (GPIO_PORTC | GPIO_BOUT | GPIO_IN | 18)
-#define PC19_BOUT_PC_BVD1      (GPIO_PORTC | GPIO_BOUT | GPIO_IN | 19)
-#define PC28_BOUT_PC_BVD2      (GPIO_PORTC | GPIO_BOUT | GPIO_IN | 28)
-#define PC29_BOUT_PC_VS1       (GPIO_PORTC | GPIO_BOUT | GPIO_IN | 29)
-#define PC30_BOUT_PC_READY     (GPIO_PORTC | GPIO_BOUT | GPIO_IN | 30)
-#define PC31_BOUT_PC_WAIT      (GPIO_PORTC | GPIO_BOUT | GPIO_IN | 31)
-
-#endif /* __MACH_IOMUX_MX27_H__ */
diff --git a/arch/arm/mach-imx/iomux-mx2x.h b/arch/arm/mach-imx/iomux-mx2x.h
deleted file mode 100644 (file)
index ce6b6d2..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
- * Copyright (C) 2009 by Holger Schurig <hs4233@mail.mn-solutions.de>
- */
-#ifndef __MACH_IOMUX_MX2x_H__
-#define __MACH_IOMUX_MX2x_H__
-
-/* Primary GPIO pin functions */
-
-#define PA5_PF_LSCLK           (GPIO_PORTA | GPIO_PF | GPIO_OUT | 5)
-#define PA6_PF_LD0             (GPIO_PORTA | GPIO_PF | GPIO_OUT | 6)
-#define PA7_PF_LD1             (GPIO_PORTA | GPIO_PF | GPIO_OUT | 7)
-#define PA8_PF_LD2             (GPIO_PORTA | GPIO_PF | GPIO_OUT | 8)
-#define PA9_PF_LD3             (GPIO_PORTA | GPIO_PF | GPIO_OUT | 9)
-#define PA10_PF_LD4            (GPIO_PORTA | GPIO_PF | GPIO_OUT | 10)
-#define PA11_PF_LD5            (GPIO_PORTA | GPIO_PF | GPIO_OUT | 11)
-#define PA12_PF_LD6            (GPIO_PORTA | GPIO_PF | GPIO_OUT | 12)
-#define PA13_PF_LD7            (GPIO_PORTA | GPIO_PF | GPIO_OUT | 13)
-#define PA14_PF_LD8            (GPIO_PORTA | GPIO_PF | GPIO_OUT | 14)
-#define PA15_PF_LD9            (GPIO_PORTA | GPIO_PF | GPIO_OUT | 15)
-#define PA16_PF_LD10           (GPIO_PORTA | GPIO_PF | GPIO_OUT | 16)
-#define PA17_PF_LD11           (GPIO_PORTA | GPIO_PF | GPIO_OUT | 17)
-#define PA18_PF_LD12           (GPIO_PORTA | GPIO_PF | GPIO_OUT | 18)
-#define PA19_PF_LD13           (GPIO_PORTA | GPIO_PF | GPIO_OUT | 19)
-#define PA20_PF_LD14           (GPIO_PORTA | GPIO_PF | GPIO_OUT | 20)
-#define PA21_PF_LD15           (GPIO_PORTA | GPIO_PF | GPIO_OUT | 21)
-#define PA22_PF_LD16           (GPIO_PORTA | GPIO_PF | GPIO_OUT | 22)
-#define PA23_PF_LD17           (GPIO_PORTA | GPIO_PF | GPIO_OUT | 23)
-#define PA24_PF_REV            (GPIO_PORTA | GPIO_PF | GPIO_OUT | 24)
-#define PA25_PF_CLS            (GPIO_PORTA | GPIO_PF | GPIO_OUT | 25)
-#define PA26_PF_PS             (GPIO_PORTA | GPIO_PF | GPIO_OUT | 26)
-#define PA27_PF_SPL_SPR                (GPIO_PORTA | GPIO_PF | GPIO_OUT | 27)
-#define PA28_PF_HSYNC          (GPIO_PORTA | GPIO_PF | GPIO_OUT | 28)
-#define PA29_PF_VSYNC          (GPIO_PORTA | GPIO_PF | GPIO_OUT | 29)
-#define PA30_PF_CONTRAST       (GPIO_PORTA | GPIO_PF | GPIO_OUT | 30)
-#define PA31_PF_OE_ACD         (GPIO_PORTA | GPIO_PF | GPIO_OUT | 31)
-#define PB4_PF_SD2_D0          (GPIO_PORTB | GPIO_PF | 4)
-#define PB5_PF_SD2_D1          (GPIO_PORTB | GPIO_PF | 5)
-#define PB6_PF_SD2_D2          (GPIO_PORTB | GPIO_PF | 6)
-#define PB7_PF_SD2_D3          (GPIO_PORTB | GPIO_PF | 7)
-#define PB8_PF_SD2_CMD         (GPIO_PORTB | GPIO_PF | 8)
-#define PB9_PF_SD2_CLK         (GPIO_PORTB | GPIO_PF | 9)
-#define PB10_PF_CSI_D0         (GPIO_PORTB | GPIO_PF | GPIO_OUT | 10)
-#define PB11_PF_CSI_D1         (GPIO_PORTB | GPIO_PF | GPIO_OUT | 11)
-#define PB12_PF_CSI_D2         (GPIO_PORTB | GPIO_PF | GPIO_OUT | 12)
-#define PB13_PF_CSI_D3         (GPIO_PORTB | GPIO_PF | GPIO_OUT | 13)
-#define PB14_PF_CSI_D4         (GPIO_PORTB | GPIO_PF | GPIO_OUT | 14)
-#define PB15_PF_CSI_MCLK       (GPIO_PORTB | GPIO_PF | GPIO_OUT | 15)
-#define PB16_PF_CSI_PIXCLK     (GPIO_PORTB | GPIO_PF | GPIO_OUT | 16)
-#define PB17_PF_CSI_D5         (GPIO_PORTB | GPIO_PF | GPIO_OUT | 17)
-#define PB18_PF_CSI_D6         (GPIO_PORTB | GPIO_PF | GPIO_OUT | 18)
-#define PB19_PF_CSI_D7         (GPIO_PORTB | GPIO_PF | GPIO_OUT | 19)
-#define PB20_PF_CSI_VSYNC      (GPIO_PORTB | GPIO_PF | GPIO_OUT | 20)
-#define PB21_PF_CSI_HSYNC      (GPIO_PORTB | GPIO_PF | GPIO_OUT | 21)
-#define PB23_PF_USB_PWR                (GPIO_PORTB | GPIO_PF | 23)
-#define PB24_PF_USB_OC         (GPIO_PORTB | GPIO_PF | 24)
-#define PB26_PF_USBH1_FS       (GPIO_PORTB | GPIO_PF | 26)
-#define PB27_PF_USBH1_OE       (GPIO_PORTB | GPIO_PF | 27)
-#define PB28_PF_USBH1_TXDM     (GPIO_PORTB | GPIO_PF | 28)
-#define PB29_PF_USBH1_TXDP     (GPIO_PORTB | GPIO_PF | 29)
-#define PB30_PF_USBH1_RXDM     (GPIO_PORTB | GPIO_PF | 30)
-#define PB31_PF_USBH1_RXDP     (GPIO_PORTB | GPIO_PF | 31)
-#define PC14_PF_TOUT           (GPIO_PORTC | GPIO_PF | 14)
-#define PC15_PF_TIN            (GPIO_PORTC | GPIO_PF | 15)
-#define PC20_PF_SSI1_FS                (GPIO_PORTC | GPIO_PF | GPIO_IN | 20)
-#define PC21_PF_SSI1_RXD       (GPIO_PORTC | GPIO_PF | GPIO_IN | 21)
-#define PC22_PF_SSI1_TXD       (GPIO_PORTC | GPIO_PF | GPIO_IN | 22)
-#define PC23_PF_SSI1_CLK       (GPIO_PORTC | GPIO_PF | GPIO_IN | 23)
-#define PC24_PF_SSI2_FS                (GPIO_PORTC | GPIO_PF | GPIO_IN | 24)
-#define PC25_PF_SSI2_RXD       (GPIO_PORTC | GPIO_PF | GPIO_IN | 25)
-#define PC26_PF_SSI2_TXD       (GPIO_PORTC | GPIO_PF | GPIO_IN | 26)
-#define PC27_PF_SSI2_CLK       (GPIO_PORTC | GPIO_PF | GPIO_IN | 27)
-#define PC28_PF_SSI3_FS                (GPIO_PORTC | GPIO_PF | GPIO_IN | 28)
-#define PC29_PF_SSI3_RXD       (GPIO_PORTC | GPIO_PF | GPIO_IN | 29)
-#define PC30_PF_SSI3_TXD       (GPIO_PORTC | GPIO_PF | GPIO_IN | 30)
-#define PC31_PF_SSI3_CLK       (GPIO_PORTC | GPIO_PF | GPIO_IN | 31)
-#define PD17_PF_I2C_DATA       (GPIO_PORTD | GPIO_PF | GPIO_OUT | 17)
-#define PD18_PF_I2C_CLK                (GPIO_PORTD | GPIO_PF | GPIO_OUT | 18)
-#define PD19_PF_CSPI2_SS2      (GPIO_PORTD | GPIO_PF | GPIO_OUT | 19)
-#define PD20_PF_CSPI2_SS1      (GPIO_PORTD | GPIO_PF | GPIO_OUT | 20)
-#define PD21_PF_CSPI2_SS0      (GPIO_PORTD | GPIO_PF | GPIO_OUT | 21)
-#define PD22_PF_CSPI2_SCLK     (GPIO_PORTD | GPIO_PF | GPIO_OUT | 22)
-#define PD23_PF_CSPI2_MISO     (GPIO_PORTD | GPIO_PF | GPIO_IN | 23)
-#define PD24_PF_CSPI2_MOSI     (GPIO_PORTD | GPIO_PF | GPIO_OUT | 24)
-#define PD25_PF_CSPI1_RDY      (GPIO_PORTD | GPIO_PF | GPIO_OUT | 25)
-#define PD26_PF_CSPI1_SS2      (GPIO_PORTD | GPIO_PF | GPIO_OUT | 26)
-#define PD27_PF_CSPI1_SS1      (GPIO_PORTD | GPIO_PF | GPIO_OUT | 27)
-#define PD28_PF_CSPI1_SS0      (GPIO_PORTD | GPIO_PF | GPIO_OUT | 28)
-#define PD29_PF_CSPI1_SCLK     (GPIO_PORTD | GPIO_PF | GPIO_OUT | 29)
-#define PD30_PF_CSPI1_MISO     (GPIO_PORTD | GPIO_PF | GPIO_IN | 30)
-#define PD31_PF_CSPI1_MOSI     (GPIO_PORTD | GPIO_PF | GPIO_OUT | 31)
-#define PE3_PF_UART2_CTS       (GPIO_PORTE | GPIO_PF | GPIO_OUT | 3)
-#define PE4_PF_UART2_RTS       (GPIO_PORTE | GPIO_PF | GPIO_IN | 4)
-#define PE5_PF_PWMO            (GPIO_PORTE | GPIO_PF | 5)
-#define PE6_PF_UART2_TXD       (GPIO_PORTE | GPIO_PF | GPIO_OUT | 6)
-#define PE7_PF_UART2_RXD       (GPIO_PORTE | GPIO_PF | GPIO_IN | 7)
-#define PE8_PF_UART3_TXD       (GPIO_PORTE | GPIO_PF | GPIO_OUT | 8)
-#define PE9_PF_UART3_RXD       (GPIO_PORTE | GPIO_PF | GPIO_IN | 9)
-#define PE10_PF_UART3_CTS      (GPIO_PORTE | GPIO_PF | GPIO_OUT | 10)
-#define PE11_PF_UART3_RTS      (GPIO_PORTE | GPIO_PF | GPIO_IN | 11)
-#define PE12_PF_UART1_TXD      (GPIO_PORTE | GPIO_PF | GPIO_OUT | 12)
-#define PE13_PF_UART1_RXD      (GPIO_PORTE | GPIO_PF | GPIO_IN | 13)
-#define PE14_PF_UART1_CTS      (GPIO_PORTE | GPIO_PF | GPIO_OUT | 14)
-#define PE15_PF_UART1_RTS      (GPIO_PORTE | GPIO_PF | GPIO_IN | 15)
-#define PE16_PF_RTCK           (GPIO_PORTE | GPIO_PF | GPIO_OUT | 16)
-#define PE17_PF_RESET_OUT      (GPIO_PORTE | GPIO_PF | 17)
-#define PE18_PF_SD1_D0         (GPIO_PORTE | GPIO_PF | 18)
-#define PE19_PF_SD1_D1         (GPIO_PORTE | GPIO_PF | 19)
-#define PE20_PF_SD1_D2         (GPIO_PORTE | GPIO_PF | 20)
-#define PE21_PF_SD1_D3         (GPIO_PORTE | GPIO_PF | 21)
-#define PE22_PF_SD1_CMD                (GPIO_PORTE | GPIO_PF | 22)
-#define PE23_PF_SD1_CLK                (GPIO_PORTE | GPIO_PF | 23)
-#define PF0_PF_NRFB            (GPIO_PORTF | GPIO_PF | 0)
-#define PF2_PF_NFWP            (GPIO_PORTF | GPIO_PF | 2)
-#define PF4_PF_NFALE           (GPIO_PORTF | GPIO_PF | 4)
-#define PF5_PF_NFRE            (GPIO_PORTF | GPIO_PF | 5)
-#define PF6_PF_NFWE            (GPIO_PORTF | GPIO_PF | 6)
-#define PF15_PF_CLKO           (GPIO_PORTF | GPIO_PF | 15)
-#define PF21_PF_CS4            (GPIO_PORTF | GPIO_PF | 21)
-#define PF22_PF_CS5            (GPIO_PORTF | GPIO_PF | 22)
-
-/* Alternate GPIO pin functions */
-
-#define PB26_AF_UART4_RTS      (GPIO_PORTB | GPIO_AF | GPIO_IN | 26)
-#define PB28_AF_UART4_TXD      (GPIO_PORTB | GPIO_AF | GPIO_OUT | 28)
-#define PB29_AF_UART4_CTS      (GPIO_PORTB | GPIO_AF | GPIO_OUT | 29)
-#define PB31_AF_UART4_RXD      (GPIO_PORTB | GPIO_AF | GPIO_IN | 31)
-#define PC28_AF_SLCDC2_D0      (GPIO_PORTC | GPIO_AF | 28)
-#define PC29_AF_SLCDC2_RS      (GPIO_PORTC | GPIO_AF | 29)
-#define PC30_AF_SLCDC2_CS      (GPIO_PORTC | GPIO_AF | 30)
-#define PC31_AF_SLCDC2_CLK     (GPIO_PORTC | GPIO_AF | 31)
-#define PD19_AF_USBH2_DATA4    (GPIO_PORTD | GPIO_AF | 19)
-#define PD20_AF_USBH2_DATA3    (GPIO_PORTD | GPIO_AF | 20)
-#define PD21_AF_USBH2_DATA6    (GPIO_PORTD | GPIO_AF | 21)
-#define PD22_AF_USBH2_DATA0    (GPIO_PORTD | GPIO_AF | 22)
-#define PD23_AF_USBH2_DATA2    (GPIO_PORTD | GPIO_AF | 23)
-#define PD24_AF_USBH2_DATA1    (GPIO_PORTD | GPIO_AF | 24)
-#define PD26_AF_USBH2_DATA5    (GPIO_PORTD | GPIO_AF | 26)
-#define PE0_AF_KP_COL6         (GPIO_PORTE | GPIO_AF | 0)
-#define PE1_AF_KP_ROW6         (GPIO_PORTE | GPIO_AF | 1)
-#define PE2_AF_KP_ROW7         (GPIO_PORTE | GPIO_AF | 2)
-#define PE3_AF_KP_COL7         (GPIO_PORTE | GPIO_AF | 3)
-#define PE4_AF_KP_ROW7         (GPIO_PORTE | GPIO_AF | 4)
-#define PE6_AF_KP_COL6         (GPIO_PORTE | GPIO_AF | 6)
-#define PE7_AF_KP_ROW6         (GPIO_PORTE | GPIO_AF | 7)
-#define PE16_AF_OWIRE          (GPIO_PORTE | GPIO_AF | 16)
-#define PE18_AF_CSPI3_MISO     (GPIO_PORTE | GPIO_AF | GPIO_IN | 18)
-#define PE21_AF_CSPI3_SS       (GPIO_PORTE | GPIO_AF | GPIO_OUT | 21)
-#define PE22_AF_CSPI3_MOSI     (GPIO_PORTE | GPIO_AF | GPIO_OUT | 22)
-#define PE23_AF_CSPI3_SCLK     (GPIO_PORTE | GPIO_AF | GPIO_OUT | 23)
-
-/* AIN GPIO pin functions */
-
-#define PA6_AIN_SLCDC1_DAT0    (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 6)
-#define PA7_AIN_SLCDC1_DAT1    (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 7)
-#define PA8_AIN_SLCDC1_DAT2    (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 8)
-#define PA0_AIN_SLCDC1_DAT3    (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 0)
-#define PA11_AIN_SLCDC1_DAT5   (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 11)
-#define PA13_AIN_SLCDC1_DAT7   (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 13)
-#define PA15_AIN_SLCDC1_DAT9   (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 15)
-#define PA17_AIN_SLCDC1_DAT11  (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 17)
-#define PA19_AIN_SLCDC1_DAT13  (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 19)
-#define PA21_AIN_SLCDC1_DAT15  (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 21)
-#define PA22_AIN_EXT_DMAGRANT  (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 22)
-#define PA24_AIN_SLCDC1_D0     (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 24)
-#define PA25_AIN_SLCDC1_RS     (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 25)
-#define PA26_AIN_SLCDC1_CS     (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 26)
-#define PA27_AIN_SLCDC1_CLK    (GPIO_PORTA | GPIO_AIN | GPIO_OUT | 27)
-#define PB6_AIN_SLCDC1_D0      (GPIO_PORTB | GPIO_AIN | GPIO_OUT | 6)
-#define PB7_AIN_SLCDC1_RS      (GPIO_PORTB | GPIO_AIN | GPIO_OUT | 7)
-#define PB8_AIN_SLCDC1_CS      (GPIO_PORTB | GPIO_AIN | GPIO_OUT | 8)
-#define PB9_AIN_SLCDC1_CLK     (GPIO_PORTB | GPIO_AIN | GPIO_OUT | 9)
-#define PB25_AIN_SLCDC1_DAT0   (GPIO_PORTB | GPIO_AIN | GPIO_OUT | 25)
-#define PB26_AIN_SLCDC1_DAT1   (GPIO_PORTB | GPIO_AIN | GPIO_OUT | 26)
-#define PB27_AIN_SLCDC1_DAT2   (GPIO_PORTB | GPIO_AIN | GPIO_OUT | 27)
-#define PB28_AIN_SLCDC1_DAT3   (GPIO_PORTB | GPIO_AIN | GPIO_OUT | 28)
-#define PB29_AIN_SLCDC1_DAT4   (GPIO_PORTB | GPIO_AIN | GPIO_OUT | 29)
-#define PB30_AIN_SLCDC1_DAT5   (GPIO_PORTB | GPIO_AIN | GPIO_OUT | 30)
-#define PB31_AIN_SLCDC1_DAT6   (GPIO_PORTB | GPIO_AIN | GPIO_OUT | 31)
-#define PC5_AIN_SLCDC1_DAT7    (GPIO_PORTC | GPIO_AIN | GPIO_OUT | 5)
-#define PC6_AIN_SLCDC1_DAT8    (GPIO_PORTC | GPIO_AIN | GPIO_OUT | 6)
-#define PC7_AIN_SLCDC1_DAT9    (GPIO_PORTC | GPIO_AIN | GPIO_OUT | 7)
-#define PC8_AIN_SLCDC1_DAT10   (GPIO_PORTC | GPIO_AIN | GPIO_OUT | 8)
-#define PC9_AIN_SLCDC1_DAT11   (GPIO_PORTC | GPIO_AIN | GPIO_OUT | 9)
-#define PC10_AIN_SLCDC1_DAT12  (GPIO_PORTC | GPIO_AIN | GPIO_OUT | 10)
-#define PC11_AIN_SLCDC1_DAT13  (GPIO_PORTC | GPIO_AIN | GPIO_OUT | 11)
-#define PC12_AIN_SLCDC1_DAT14  (GPIO_PORTC | GPIO_AIN | GPIO_OUT | 12)
-#define PC13_AIN_SLCDC1_DAT15  (GPIO_PORTC | GPIO_AIN | GPIO_OUT | 13)
-#define PE5_AIN_PC_SPKOUT      (GPIO_PORTE | GPIO_AIN | GPIO_OUT | 5)
-
-/* BIN GPIO pin functions */
-
-#define PE5_BIN_TOUT2          (GPIO_PORTE | GPIO_BIN | GPIO_OUT | 5)
-
-/* CIN GPIO pin functions */
-
-#define PA14_CIN_SLCDC1_DAT0   (GPIO_PORTA | GPIO_CIN | GPIO_OUT | 14)
-#define PA15_CIN_SLCDC1_DAT1   (GPIO_PORTA | GPIO_CIN | GPIO_OUT | 15)
-#define PA16_CIN_SLCDC1_DAT2   (GPIO_PORTA | GPIO_CIN | GPIO_OUT | 16)
-#define PA17_CIN_SLCDC1_DAT3   (GPIO_PORTA | GPIO_CIN | GPIO_OUT | 17)
-#define PA18_CIN_SLCDC1_DAT4   (GPIO_PORTA | GPIO_CIN | GPIO_OUT | 18)
-#define PA19_CIN_SLCDC1_DAT5   (GPIO_PORTA | GPIO_CIN | GPIO_OUT | 19)
-#define PA20_CIN_SLCDC1_DAT6   (GPIO_PORTA | GPIO_CIN | GPIO_OUT | 20)
-#define PA21_CIN_SLCDC1_DAT7   (GPIO_PORTA | GPIO_CIN | GPIO_OUT | 21)
-#define PB30_CIN_UART4_CTS     (GPIO_PORTB | GPIO_CIN | GPIO_OUT | 30)
-#define PE5_CIN_TOUT3          (GPIO_PORTE | GPIO_CIN | GPIO_OUT | 5)
-
-/* AOUT GPIO pin functions */
-
-#define PB29_AOUT_UART4_RXD    (GPIO_PORTB | GPIO_AOUT | GPIO_IN | 29)
-#define PB31_AOUT_UART4_RTS    (GPIO_PORTB | GPIO_AOUT | GPIO_IN | 31)
-#define PC8_AOUT_USBOTG_TXR_INT (GPIO_PORTC | GPIO_AOUT | GPIO_IN | 8)
-#define PC15_AOUT_WKGD         (GPIO_PORTC | GPIO_AOUT | GPIO_IN | 15)
-#define PF21_AOUT_DTACK                (GPIO_PORTF | GPIO_AOUT | GPIO_IN | 21)
-
-#endif /* ifndef __MACH_IOMUX_MX2x_H__ */
diff --git a/arch/arm/mach-imx/iomux-mx3.h b/arch/arm/mach-imx/iomux-mx3.h
deleted file mode 100644 (file)
index 99270a1..0000000
+++ /dev/null
@@ -1,706 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
- */
-#ifndef __MACH_IOMUX_MX3_H__
-#define __MACH_IOMUX_MX3_H__
-
-#include <linux/types.h>
-/*
- * various IOMUX output functions
- */
-
-#define        IOMUX_OCONFIG_GPIO (0 << 4)     /* used as GPIO */
-#define        IOMUX_OCONFIG_FUNC (1 << 4)     /* used as function */
-#define        IOMUX_OCONFIG_ALT1 (2 << 4)     /* used as alternate function 1 */
-#define        IOMUX_OCONFIG_ALT2 (3 << 4)     /* used as alternate function 2 */
-#define        IOMUX_OCONFIG_ALT3 (4 << 4)     /* used as alternate function 3 */
-#define        IOMUX_OCONFIG_ALT4 (5 << 4)     /* used as alternate function 4 */
-#define        IOMUX_OCONFIG_ALT5 (6 << 4)     /* used as alternate function 5 */
-#define        IOMUX_OCONFIG_ALT6 (7 << 4)     /* used as alternate function 6 */
-#define        IOMUX_ICONFIG_NONE  0           /* not configured for input */
-#define        IOMUX_ICONFIG_GPIO  1           /* used as GPIO */
-#define        IOMUX_ICONFIG_FUNC  2           /* used as function */
-#define        IOMUX_ICONFIG_ALT1  4           /* used as alternate function 1 */
-#define        IOMUX_ICONFIG_ALT2  8           /* used as alternate function 2 */
-
-#define IOMUX_CONFIG_GPIO (IOMUX_OCONFIG_GPIO | IOMUX_ICONFIG_GPIO)
-#define IOMUX_CONFIG_FUNC (IOMUX_OCONFIG_FUNC | IOMUX_ICONFIG_FUNC)
-#define IOMUX_CONFIG_ALT1 (IOMUX_OCONFIG_ALT1 | IOMUX_ICONFIG_ALT1)
-#define IOMUX_CONFIG_ALT2 (IOMUX_OCONFIG_ALT2 | IOMUX_ICONFIG_ALT2)
-
-/*
- * various IOMUX pad functions
- */
-enum iomux_pad_config {
-       PAD_CTL_NOLOOPBACK      = 0x0 << 9,
-       PAD_CTL_LOOPBACK        = 0x1 << 9,
-       PAD_CTL_PKE_NONE        = 0x0 << 8,
-       PAD_CTL_PKE_ENABLE      = 0x1 << 8,
-       PAD_CTL_PUE_KEEPER      = 0x0 << 7,
-       PAD_CTL_PUE_PUD         = 0x1 << 7,
-       PAD_CTL_100K_PD         = 0x0 << 5,
-       PAD_CTL_100K_PU         = 0x1 << 5,
-       PAD_CTL_47K_PU          = 0x2 << 5,
-       PAD_CTL_22K_PU          = 0x3 << 5,
-       PAD_CTL_HYS_CMOS        = 0x0 << 4,
-       PAD_CTL_HYS_SCHMITZ     = 0x1 << 4,
-       PAD_CTL_ODE_CMOS        = 0x0 << 3,
-       PAD_CTL_ODE_OpenDrain   = 0x1 << 3,
-       PAD_CTL_DRV_NORMAL      = 0x0 << 1,
-       PAD_CTL_DRV_HIGH        = 0x1 << 1,
-       PAD_CTL_DRV_MAX         = 0x2 << 1,
-       PAD_CTL_SRE_SLOW        = 0x0 << 0,
-       PAD_CTL_SRE_FAST        = 0x1 << 0
-};
-
-/*
- * various IOMUX general purpose functions
- */
-enum iomux_gp_func {
-       MUX_PGP_FIRI                    = 1 << 0,
-       MUX_DDR_MODE                    = 1 << 1,
-       MUX_PGP_CSPI_BB                 = 1 << 2,
-       MUX_PGP_ATA_1                   = 1 << 3,
-       MUX_PGP_ATA_2                   = 1 << 4,
-       MUX_PGP_ATA_3                   = 1 << 5,
-       MUX_PGP_ATA_4                   = 1 << 6,
-       MUX_PGP_ATA_5                   = 1 << 7,
-       MUX_PGP_ATA_6                   = 1 << 8,
-       MUX_PGP_ATA_7                   = 1 << 9,
-       MUX_PGP_ATA_8                   = 1 << 10,
-       MUX_PGP_UH2                     = 1 << 11,
-       MUX_SDCTL_CSD0_SEL              = 1 << 12,
-       MUX_SDCTL_CSD1_SEL              = 1 << 13,
-       MUX_CSPI1_UART3                 = 1 << 14,
-       MUX_EXTDMAREQ2_MBX_SEL          = 1 << 15,
-       MUX_TAMPER_DETECT_EN            = 1 << 16,
-       MUX_PGP_USB_4WIRE               = 1 << 17,
-       MUX_PGP_USB_COMMON              = 1 << 18,
-       MUX_SDHC_MEMSTICK1              = 1 << 19,
-       MUX_SDHC_MEMSTICK2              = 1 << 20,
-       MUX_PGP_SPLL_BYP                = 1 << 21,
-       MUX_PGP_UPLL_BYP                = 1 << 22,
-       MUX_PGP_MSHC1_CLK_SEL           = 1 << 23,
-       MUX_PGP_MSHC2_CLK_SEL           = 1 << 24,
-       MUX_CSPI3_UART5_SEL             = 1 << 25,
-       MUX_PGP_ATA_9                   = 1 << 26,
-       MUX_PGP_USB_SUSPEND             = 1 << 27,
-       MUX_PGP_USB_OTG_LOOPBACK        = 1 << 28,
-       MUX_PGP_USB_HS1_LOOPBACK        = 1 << 29,
-       MUX_PGP_USB_HS2_LOOPBACK        = 1 << 30,
-       MUX_CLKO_DDR_MODE               = 1 << 31,
-};
-
-/*
- * setups a single pin:
- *     - reserves the pin so that it is not claimed by another driver
- *     - setups the iomux according to the configuration
- *     - if the pin is configured as a GPIO, we claim it through kernel gpiolib
- */
-int mxc_iomux_alloc_pin(unsigned int pin, const char *label);
-/*
- * setups multiple pins
- * convenient way to call the above function with tables
- */
-int mxc_iomux_setup_multiple_pins(const unsigned int *pin_list, unsigned count,
-               const char *label);
-
-/*
- * releases a single pin:
- *     - make it available for a future use by another driver
- *     - frees the GPIO if the pin was configured as GPIO
- *     - DOES NOT reconfigure the IOMUX in its reset state
- */
-void mxc_iomux_release_pin(unsigned int pin);
-/*
- * releases multiple pins
- * convenvient way to call the above function with tables
- */
-void mxc_iomux_release_multiple_pins(const unsigned int *pin_list, int count);
-
-/*
- * This function enables/disables the general purpose function for a particular
- * signal.
- */
-void mxc_iomux_set_gpr(enum iomux_gp_func, bool en);
-
-/*
- * This function only configures the iomux hardware.
- * It is called by the setup functions and should not be called directly anymore.
- * It is here visible for backward compatibility
- */
-void mxc_iomux_mode(unsigned int pin_mode);
-
-#define IOMUX_PADNUM_MASK      0x1ff
-#define IOMUX_GPIONUM_SHIFT    9
-#define IOMUX_GPIONUM_MASK     (0xff << IOMUX_GPIONUM_SHIFT)
-#define IOMUX_MODE_SHIFT       17
-#define IOMUX_MODE_MASK        (0xff << IOMUX_MODE_SHIFT)
-
-#define IOMUX_PIN(gpionum, padnum) \
-       (((gpionum << IOMUX_GPIONUM_SHIFT) & IOMUX_GPIONUM_MASK) | \
-        (padnum & IOMUX_PADNUM_MASK))
-
-#define IOMUX_MODE(pin, mode) (pin | mode << IOMUX_MODE_SHIFT)
-
-#define IOMUX_TO_GPIO(iomux_pin) \
-       ((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT)
-
-/*
- * This enumeration is constructed based on the Section
- * "sw_pad_ctl & sw_mux_ctl details" of the MX31 IC Spec. Each enumerated
- * value is constructed based on the rules described above.
- */
-
-enum iomux_pins {
-       MX31_PIN_TTM_PAD        = IOMUX_PIN(0xff,   0),
-       MX31_PIN_CSPI3_SPI_RDY  = IOMUX_PIN(0xff,   1),
-       MX31_PIN_CSPI3_SCLK     = IOMUX_PIN(0xff,   2),
-       MX31_PIN_CSPI3_MISO     = IOMUX_PIN(0xff,   3),
-       MX31_PIN_CSPI3_MOSI     = IOMUX_PIN(0xff,   4),
-       MX31_PIN_CLKSS          = IOMUX_PIN(0xff,   5),
-       MX31_PIN_CE_CONTROL     = IOMUX_PIN(0xff,   6),
-       MX31_PIN_ATA_RESET_B    = IOMUX_PIN(95,     7),
-       MX31_PIN_ATA_DMACK      = IOMUX_PIN(94,     8),
-       MX31_PIN_ATA_DIOW       = IOMUX_PIN(93,     9),
-       MX31_PIN_ATA_DIOR       = IOMUX_PIN(92,    10),
-       MX31_PIN_ATA_CS1        = IOMUX_PIN(91,    11),
-       MX31_PIN_ATA_CS0        = IOMUX_PIN(90,    12),
-       MX31_PIN_SD1_DATA3      = IOMUX_PIN(63,    13),
-       MX31_PIN_SD1_DATA2      = IOMUX_PIN(62,    14),
-       MX31_PIN_SD1_DATA1      = IOMUX_PIN(61,    15),
-       MX31_PIN_SD1_DATA0      = IOMUX_PIN(60,    16),
-       MX31_PIN_SD1_CLK        = IOMUX_PIN(59,    17),
-       MX31_PIN_SD1_CMD        = IOMUX_PIN(58,    18),
-       MX31_PIN_D3_SPL         = IOMUX_PIN(0xff,  19),
-       MX31_PIN_D3_CLS         = IOMUX_PIN(0xff,  20),
-       MX31_PIN_D3_REV         = IOMUX_PIN(0xff,  21),
-       MX31_PIN_CONTRAST       = IOMUX_PIN(0xff,  22),
-       MX31_PIN_VSYNC3         = IOMUX_PIN(0xff,  23),
-       MX31_PIN_READ           = IOMUX_PIN(0xff,  24),
-       MX31_PIN_WRITE          = IOMUX_PIN(0xff,  25),
-       MX31_PIN_PAR_RS         = IOMUX_PIN(0xff,  26),
-       MX31_PIN_SER_RS         = IOMUX_PIN(89,    27),
-       MX31_PIN_LCS1           = IOMUX_PIN(88,    28),
-       MX31_PIN_LCS0           = IOMUX_PIN(87,    29),
-       MX31_PIN_SD_D_CLK       = IOMUX_PIN(86,    30),
-       MX31_PIN_SD_D_IO        = IOMUX_PIN(85,    31),
-       MX31_PIN_SD_D_I         = IOMUX_PIN(84,    32),
-       MX31_PIN_DRDY0          = IOMUX_PIN(0xff,  33),
-       MX31_PIN_FPSHIFT        = IOMUX_PIN(0xff,  34),
-       MX31_PIN_HSYNC          = IOMUX_PIN(0xff,  35),
-       MX31_PIN_VSYNC0         = IOMUX_PIN(0xff,  36),
-       MX31_PIN_LD17           = IOMUX_PIN(0xff,  37),
-       MX31_PIN_LD16           = IOMUX_PIN(0xff,  38),
-       MX31_PIN_LD15           = IOMUX_PIN(0xff,  39),
-       MX31_PIN_LD14           = IOMUX_PIN(0xff,  40),
-       MX31_PIN_LD13           = IOMUX_PIN(0xff,  41),
-       MX31_PIN_LD12           = IOMUX_PIN(0xff,  42),
-       MX31_PIN_LD11           = IOMUX_PIN(0xff,  43),
-       MX31_PIN_LD10           = IOMUX_PIN(0xff,  44),
-       MX31_PIN_LD9            = IOMUX_PIN(0xff,  45),
-       MX31_PIN_LD8            = IOMUX_PIN(0xff,  46),
-       MX31_PIN_LD7            = IOMUX_PIN(0xff,  47),
-       MX31_PIN_LD6            = IOMUX_PIN(0xff,  48),
-       MX31_PIN_LD5            = IOMUX_PIN(0xff,  49),
-       MX31_PIN_LD4            = IOMUX_PIN(0xff,  50),
-       MX31_PIN_LD3            = IOMUX_PIN(0xff,  51),
-       MX31_PIN_LD2            = IOMUX_PIN(0xff,  52),
-       MX31_PIN_LD1            = IOMUX_PIN(0xff,  53),
-       MX31_PIN_LD0            = IOMUX_PIN(0xff,  54),
-       MX31_PIN_USBH2_DATA1    = IOMUX_PIN(0xff,  55),
-       MX31_PIN_USBH2_DATA0    = IOMUX_PIN(0xff,  56),
-       MX31_PIN_USBH2_NXT      = IOMUX_PIN(0xff,  57),
-       MX31_PIN_USBH2_STP      = IOMUX_PIN(0xff,  58),
-       MX31_PIN_USBH2_DIR      = IOMUX_PIN(0xff,  59),
-       MX31_PIN_USBH2_CLK      = IOMUX_PIN(0xff,  60),
-       MX31_PIN_USBOTG_DATA7   = IOMUX_PIN(0xff,  61),
-       MX31_PIN_USBOTG_DATA6   = IOMUX_PIN(0xff,  62),
-       MX31_PIN_USBOTG_DATA5   = IOMUX_PIN(0xff,  63),
-       MX31_PIN_USBOTG_DATA4   = IOMUX_PIN(0xff,  64),
-       MX31_PIN_USBOTG_DATA3   = IOMUX_PIN(0xff,  65),
-       MX31_PIN_USBOTG_DATA2   = IOMUX_PIN(0xff,  66),
-       MX31_PIN_USBOTG_DATA1   = IOMUX_PIN(0xff,  67),
-       MX31_PIN_USBOTG_DATA0   = IOMUX_PIN(0xff,  68),
-       MX31_PIN_USBOTG_NXT     = IOMUX_PIN(0xff,  69),
-       MX31_PIN_USBOTG_STP     = IOMUX_PIN(0xff,  70),
-       MX31_PIN_USBOTG_DIR     = IOMUX_PIN(0xff,  71),
-       MX31_PIN_USBOTG_CLK     = IOMUX_PIN(0xff,  72),
-       MX31_PIN_USB_BYP        = IOMUX_PIN(31,    73),
-       MX31_PIN_USB_OC         = IOMUX_PIN(30,    74),
-       MX31_PIN_USB_PWR        = IOMUX_PIN(29,    75),
-       MX31_PIN_SJC_MOD        = IOMUX_PIN(0xff,  76),
-       MX31_PIN_DE_B           = IOMUX_PIN(0xff,  77),
-       MX31_PIN_TRSTB          = IOMUX_PIN(0xff,  78),
-       MX31_PIN_TDO            = IOMUX_PIN(0xff,  79),
-       MX31_PIN_TDI            = IOMUX_PIN(0xff,  80),
-       MX31_PIN_TMS            = IOMUX_PIN(0xff,  81),
-       MX31_PIN_TCK            = IOMUX_PIN(0xff,  82),
-       MX31_PIN_RTCK           = IOMUX_PIN(0xff,  83),
-       MX31_PIN_KEY_COL7       = IOMUX_PIN(57,    84),
-       MX31_PIN_KEY_COL6       = IOMUX_PIN(56,    85),
-       MX31_PIN_KEY_COL5       = IOMUX_PIN(55,    86),
-       MX31_PIN_KEY_COL4       = IOMUX_PIN(54,    87),
-       MX31_PIN_KEY_COL3       = IOMUX_PIN(0xff,  88),
-       MX31_PIN_KEY_COL2       = IOMUX_PIN(0xff,  89),
-       MX31_PIN_KEY_COL1       = IOMUX_PIN(0xff,  90),
-       MX31_PIN_KEY_COL0       = IOMUX_PIN(0xff,  91),
-       MX31_PIN_KEY_ROW7       = IOMUX_PIN(53,    92),
-       MX31_PIN_KEY_ROW6       = IOMUX_PIN(52,    93),
-       MX31_PIN_KEY_ROW5       = IOMUX_PIN(51,    94),
-       MX31_PIN_KEY_ROW4       = IOMUX_PIN(50,    95),
-       MX31_PIN_KEY_ROW3       = IOMUX_PIN(0xff,  96),
-       MX31_PIN_KEY_ROW2       = IOMUX_PIN(0xff,  97),
-       MX31_PIN_KEY_ROW1       = IOMUX_PIN(0xff,  98),
-       MX31_PIN_KEY_ROW0       = IOMUX_PIN(0xff,  99),
-       MX31_PIN_BATT_LINE      = IOMUX_PIN(49,   100),
-       MX31_PIN_CTS2           = IOMUX_PIN(0xff, 101),
-       MX31_PIN_RTS2           = IOMUX_PIN(0xff, 102),
-       MX31_PIN_TXD2           = IOMUX_PIN(28,   103),
-       MX31_PIN_RXD2           = IOMUX_PIN(27,   104),
-       MX31_PIN_DTR_DCE2       = IOMUX_PIN(48,   105),
-       MX31_PIN_DCD_DTE1       = IOMUX_PIN(47,   106),
-       MX31_PIN_RI_DTE1        = IOMUX_PIN(46,   107),
-       MX31_PIN_DSR_DTE1       = IOMUX_PIN(45,   108),
-       MX31_PIN_DTR_DTE1       = IOMUX_PIN(44,   109),
-       MX31_PIN_DCD_DCE1       = IOMUX_PIN(43,   110),
-       MX31_PIN_RI_DCE1        = IOMUX_PIN(42,   111),
-       MX31_PIN_DSR_DCE1       = IOMUX_PIN(41,   112),
-       MX31_PIN_DTR_DCE1       = IOMUX_PIN(40,   113),
-       MX31_PIN_CTS1           = IOMUX_PIN(39,   114),
-       MX31_PIN_RTS1           = IOMUX_PIN(38,   115),
-       MX31_PIN_TXD1           = IOMUX_PIN(37,   116),
-       MX31_PIN_RXD1           = IOMUX_PIN(36,   117),
-       MX31_PIN_CSPI2_SPI_RDY  = IOMUX_PIN(0xff, 118),
-       MX31_PIN_CSPI2_SCLK     = IOMUX_PIN(0xff, 119),
-       MX31_PIN_CSPI2_SS2      = IOMUX_PIN(0xff, 120),
-       MX31_PIN_CSPI2_SS1      = IOMUX_PIN(0xff, 121),
-       MX31_PIN_CSPI2_SS0      = IOMUX_PIN(0xff, 122),
-       MX31_PIN_CSPI2_MISO     = IOMUX_PIN(0xff, 123),
-       MX31_PIN_CSPI2_MOSI     = IOMUX_PIN(0xff, 124),
-       MX31_PIN_CSPI1_SPI_RDY  = IOMUX_PIN(0xff, 125),
-       MX31_PIN_CSPI1_SCLK     = IOMUX_PIN(0xff, 126),
-       MX31_PIN_CSPI1_SS2      = IOMUX_PIN(0xff, 127),
-       MX31_PIN_CSPI1_SS1      = IOMUX_PIN(0xff, 128),
-       MX31_PIN_CSPI1_SS0      = IOMUX_PIN(0xff, 129),
-       MX31_PIN_CSPI1_MISO     = IOMUX_PIN(0xff, 130),
-       MX31_PIN_CSPI1_MOSI     = IOMUX_PIN(0xff, 131),
-       MX31_PIN_SFS6           = IOMUX_PIN(26,   132),
-       MX31_PIN_SCK6           = IOMUX_PIN(25,   133),
-       MX31_PIN_SRXD6          = IOMUX_PIN(24,   134),
-       MX31_PIN_STXD6          = IOMUX_PIN(23,   135),
-       MX31_PIN_SFS5           = IOMUX_PIN(0xff, 136),
-       MX31_PIN_SCK5           = IOMUX_PIN(0xff, 137),
-       MX31_PIN_SRXD5          = IOMUX_PIN(22,   138),
-       MX31_PIN_STXD5          = IOMUX_PIN(21,   139),
-       MX31_PIN_SFS4           = IOMUX_PIN(0xff, 140),
-       MX31_PIN_SCK4           = IOMUX_PIN(0xff, 141),
-       MX31_PIN_SRXD4          = IOMUX_PIN(20,   142),
-       MX31_PIN_STXD4          = IOMUX_PIN(19,   143),
-       MX31_PIN_SFS3           = IOMUX_PIN(0xff, 144),
-       MX31_PIN_SCK3           = IOMUX_PIN(0xff, 145),
-       MX31_PIN_SRXD3          = IOMUX_PIN(18,   146),
-       MX31_PIN_STXD3          = IOMUX_PIN(17,   147),
-       MX31_PIN_I2C_DAT        = IOMUX_PIN(0xff, 148),
-       MX31_PIN_I2C_CLK        = IOMUX_PIN(0xff, 149),
-       MX31_PIN_CSI_PIXCLK     = IOMUX_PIN(83,   150),
-       MX31_PIN_CSI_HSYNC      = IOMUX_PIN(82,   151),
-       MX31_PIN_CSI_VSYNC      = IOMUX_PIN(81,   152),
-       MX31_PIN_CSI_MCLK       = IOMUX_PIN(80,   153),
-       MX31_PIN_CSI_D15        = IOMUX_PIN(79,   154),
-       MX31_PIN_CSI_D14        = IOMUX_PIN(78,   155),
-       MX31_PIN_CSI_D13        = IOMUX_PIN(77,   156),
-       MX31_PIN_CSI_D12        = IOMUX_PIN(76,   157),
-       MX31_PIN_CSI_D11        = IOMUX_PIN(75,   158),
-       MX31_PIN_CSI_D10        = IOMUX_PIN(74,   159),
-       MX31_PIN_CSI_D9         = IOMUX_PIN(73,   160),
-       MX31_PIN_CSI_D8         = IOMUX_PIN(72,   161),
-       MX31_PIN_CSI_D7         = IOMUX_PIN(71,   162),
-       MX31_PIN_CSI_D6         = IOMUX_PIN(70,   163),
-       MX31_PIN_CSI_D5         = IOMUX_PIN(69,   164),
-       MX31_PIN_CSI_D4         = IOMUX_PIN(68,   165),
-       MX31_PIN_M_GRANT        = IOMUX_PIN(0xff, 166),
-       MX31_PIN_M_REQUEST      = IOMUX_PIN(0xff, 167),
-       MX31_PIN_PC_POE         = IOMUX_PIN(0xff, 168),
-       MX31_PIN_PC_RW_B        = IOMUX_PIN(0xff, 169),
-       MX31_PIN_IOIS16         = IOMUX_PIN(0xff, 170),
-       MX31_PIN_PC_RST         = IOMUX_PIN(0xff, 171),
-       MX31_PIN_PC_BVD2        = IOMUX_PIN(0xff, 172),
-       MX31_PIN_PC_BVD1        = IOMUX_PIN(0xff, 173),
-       MX31_PIN_PC_VS2         = IOMUX_PIN(0xff, 174),
-       MX31_PIN_PC_VS1         = IOMUX_PIN(0xff, 175),
-       MX31_PIN_PC_PWRON       = IOMUX_PIN(0xff, 176),
-       MX31_PIN_PC_READY       = IOMUX_PIN(0xff, 177),
-       MX31_PIN_PC_WAIT_B      = IOMUX_PIN(0xff, 178),
-       MX31_PIN_PC_CD2_B       = IOMUX_PIN(0xff, 179),
-       MX31_PIN_PC_CD1_B       = IOMUX_PIN(0xff, 180),
-       MX31_PIN_D0             = IOMUX_PIN(0xff, 181),
-       MX31_PIN_D1             = IOMUX_PIN(0xff, 182),
-       MX31_PIN_D2             = IOMUX_PIN(0xff, 183),
-       MX31_PIN_D3             = IOMUX_PIN(0xff, 184),
-       MX31_PIN_D4             = IOMUX_PIN(0xff, 185),
-       MX31_PIN_D5             = IOMUX_PIN(0xff, 186),
-       MX31_PIN_D6             = IOMUX_PIN(0xff, 187),
-       MX31_PIN_D7             = IOMUX_PIN(0xff, 188),
-       MX31_PIN_D8             = IOMUX_PIN(0xff, 189),
-       MX31_PIN_D9             = IOMUX_PIN(0xff, 190),
-       MX31_PIN_D10            = IOMUX_PIN(0xff, 191),
-       MX31_PIN_D11            = IOMUX_PIN(0xff, 192),
-       MX31_PIN_D12            = IOMUX_PIN(0xff, 193),
-       MX31_PIN_D13            = IOMUX_PIN(0xff, 194),
-       MX31_PIN_D14            = IOMUX_PIN(0xff, 195),
-       MX31_PIN_D15            = IOMUX_PIN(0xff, 196),
-       MX31_PIN_NFRB           = IOMUX_PIN(16,   197),
-       MX31_PIN_NFCE_B         = IOMUX_PIN(15,   198),
-       MX31_PIN_NFWP_B         = IOMUX_PIN(14,   199),
-       MX31_PIN_NFCLE          = IOMUX_PIN(13,   200),
-       MX31_PIN_NFALE          = IOMUX_PIN(12,   201),
-       MX31_PIN_NFRE_B         = IOMUX_PIN(11,   202),
-       MX31_PIN_NFWE_B         = IOMUX_PIN(10,   203),
-       MX31_PIN_SDQS3          = IOMUX_PIN(0xff, 204),
-       MX31_PIN_SDQS2          = IOMUX_PIN(0xff, 205),
-       MX31_PIN_SDQS1          = IOMUX_PIN(0xff, 206),
-       MX31_PIN_SDQS0          = IOMUX_PIN(0xff, 207),
-       MX31_PIN_SDCLK_B        = IOMUX_PIN(0xff, 208),
-       MX31_PIN_SDCLK          = IOMUX_PIN(0xff, 209),
-       MX31_PIN_SDCKE1         = IOMUX_PIN(0xff, 210),
-       MX31_PIN_SDCKE0         = IOMUX_PIN(0xff, 211),
-       MX31_PIN_SDWE           = IOMUX_PIN(0xff, 212),
-       MX31_PIN_CAS            = IOMUX_PIN(0xff, 213),
-       MX31_PIN_RAS            = IOMUX_PIN(0xff, 214),
-       MX31_PIN_RW             = IOMUX_PIN(0xff, 215),
-       MX31_PIN_BCLK           = IOMUX_PIN(0xff, 216),
-       MX31_PIN_LBA            = IOMUX_PIN(0xff, 217),
-       MX31_PIN_ECB            = IOMUX_PIN(0xff, 218),
-       MX31_PIN_CS5            = IOMUX_PIN(0xff, 219),
-       MX31_PIN_CS4            = IOMUX_PIN(0xff, 220),
-       MX31_PIN_CS3            = IOMUX_PIN(0xff, 221),
-       MX31_PIN_CS2            = IOMUX_PIN(0xff, 222),
-       MX31_PIN_CS1            = IOMUX_PIN(0xff, 223),
-       MX31_PIN_CS0            = IOMUX_PIN(0xff, 224),
-       MX31_PIN_OE             = IOMUX_PIN(0xff, 225),
-       MX31_PIN_EB1            = IOMUX_PIN(0xff, 226),
-       MX31_PIN_EB0            = IOMUX_PIN(0xff, 227),
-       MX31_PIN_DQM3           = IOMUX_PIN(0xff, 228),
-       MX31_PIN_DQM2           = IOMUX_PIN(0xff, 229),
-       MX31_PIN_DQM1           = IOMUX_PIN(0xff, 230),
-       MX31_PIN_DQM0           = IOMUX_PIN(0xff, 231),
-       MX31_PIN_SD31           = IOMUX_PIN(0xff, 232),
-       MX31_PIN_SD30           = IOMUX_PIN(0xff, 233),
-       MX31_PIN_SD29           = IOMUX_PIN(0xff, 234),
-       MX31_PIN_SD28           = IOMUX_PIN(0xff, 235),
-       MX31_PIN_SD27           = IOMUX_PIN(0xff, 236),
-       MX31_PIN_SD26           = IOMUX_PIN(0xff, 237),
-       MX31_PIN_SD25           = IOMUX_PIN(0xff, 238),
-       MX31_PIN_SD24           = IOMUX_PIN(0xff, 239),
-       MX31_PIN_SD23           = IOMUX_PIN(0xff, 240),
-       MX31_PIN_SD22           = IOMUX_PIN(0xff, 241),
-       MX31_PIN_SD21           = IOMUX_PIN(0xff, 242),
-       MX31_PIN_SD20           = IOMUX_PIN(0xff, 243),
-       MX31_PIN_SD19           = IOMUX_PIN(0xff, 244),
-       MX31_PIN_SD18           = IOMUX_PIN(0xff, 245),
-       MX31_PIN_SD17           = IOMUX_PIN(0xff, 246),
-       MX31_PIN_SD16           = IOMUX_PIN(0xff, 247),
-       MX31_PIN_SD15           = IOMUX_PIN(0xff, 248),
-       MX31_PIN_SD14           = IOMUX_PIN(0xff, 249),
-       MX31_PIN_SD13           = IOMUX_PIN(0xff, 250),
-       MX31_PIN_SD12           = IOMUX_PIN(0xff, 251),
-       MX31_PIN_SD11           = IOMUX_PIN(0xff, 252),
-       MX31_PIN_SD10           = IOMUX_PIN(0xff, 253),
-       MX31_PIN_SD9            = IOMUX_PIN(0xff, 254),
-       MX31_PIN_SD8            = IOMUX_PIN(0xff, 255),
-       MX31_PIN_SD7            = IOMUX_PIN(0xff, 256),
-       MX31_PIN_SD6            = IOMUX_PIN(0xff, 257),
-       MX31_PIN_SD5            = IOMUX_PIN(0xff, 258),
-       MX31_PIN_SD4            = IOMUX_PIN(0xff, 259),
-       MX31_PIN_SD3            = IOMUX_PIN(0xff, 260),
-       MX31_PIN_SD2            = IOMUX_PIN(0xff, 261),
-       MX31_PIN_SD1            = IOMUX_PIN(0xff, 262),
-       MX31_PIN_SD0            = IOMUX_PIN(0xff, 263),
-       MX31_PIN_SDBA0          = IOMUX_PIN(0xff, 264),
-       MX31_PIN_SDBA1          = IOMUX_PIN(0xff, 265),
-       MX31_PIN_A25            = IOMUX_PIN(0xff, 266),
-       MX31_PIN_A24            = IOMUX_PIN(0xff, 267),
-       MX31_PIN_A23            = IOMUX_PIN(0xff, 268),
-       MX31_PIN_A22            = IOMUX_PIN(0xff, 269),
-       MX31_PIN_A21            = IOMUX_PIN(0xff, 270),
-       MX31_PIN_A20            = IOMUX_PIN(0xff, 271),
-       MX31_PIN_A19            = IOMUX_PIN(0xff, 272),
-       MX31_PIN_A18            = IOMUX_PIN(0xff, 273),
-       MX31_PIN_A17            = IOMUX_PIN(0xff, 274),
-       MX31_PIN_A16            = IOMUX_PIN(0xff, 275),
-       MX31_PIN_A14            = IOMUX_PIN(0xff, 276),
-       MX31_PIN_A15            = IOMUX_PIN(0xff, 277),
-       MX31_PIN_A13            = IOMUX_PIN(0xff, 278),
-       MX31_PIN_A12            = IOMUX_PIN(0xff, 279),
-       MX31_PIN_A11            = IOMUX_PIN(0xff, 280),
-       MX31_PIN_MA10           = IOMUX_PIN(0xff, 281),
-       MX31_PIN_A10            = IOMUX_PIN(0xff, 282),
-       MX31_PIN_A9             = IOMUX_PIN(0xff, 283),
-       MX31_PIN_A8             = IOMUX_PIN(0xff, 284),
-       MX31_PIN_A7             = IOMUX_PIN(0xff, 285),
-       MX31_PIN_A6             = IOMUX_PIN(0xff, 286),
-       MX31_PIN_A5             = IOMUX_PIN(0xff, 287),
-       MX31_PIN_A4             = IOMUX_PIN(0xff, 288),
-       MX31_PIN_A3             = IOMUX_PIN(0xff, 289),
-       MX31_PIN_A2             = IOMUX_PIN(0xff, 290),
-       MX31_PIN_A1             = IOMUX_PIN(0xff, 291),
-       MX31_PIN_A0             = IOMUX_PIN(0xff, 292),
-       MX31_PIN_VPG1           = IOMUX_PIN(0xff, 293),
-       MX31_PIN_VPG0           = IOMUX_PIN(0xff, 294),
-       MX31_PIN_DVFS1          = IOMUX_PIN(0xff, 295),
-       MX31_PIN_DVFS0          = IOMUX_PIN(0xff, 296),
-       MX31_PIN_VSTBY          = IOMUX_PIN(0xff, 297),
-       MX31_PIN_POWER_FAIL     = IOMUX_PIN(0xff, 298),
-       MX31_PIN_CKIL           = IOMUX_PIN(0xff, 299),
-       MX31_PIN_BOOT_MODE4     = IOMUX_PIN(0xff, 300),
-       MX31_PIN_BOOT_MODE3     = IOMUX_PIN(0xff, 301),
-       MX31_PIN_BOOT_MODE2     = IOMUX_PIN(0xff, 302),
-       MX31_PIN_BOOT_MODE1     = IOMUX_PIN(0xff, 303),
-       MX31_PIN_BOOT_MODE0     = IOMUX_PIN(0xff, 304),
-       MX31_PIN_CLKO           = IOMUX_PIN(0xff, 305),
-       MX31_PIN_POR_B          = IOMUX_PIN(0xff, 306),
-       MX31_PIN_RESET_IN_B     = IOMUX_PIN(0xff, 307),
-       MX31_PIN_CKIH           = IOMUX_PIN(0xff, 308),
-       MX31_PIN_SIMPD0         = IOMUX_PIN(35,   309),
-       MX31_PIN_SRX0           = IOMUX_PIN(34,   310),
-       MX31_PIN_STX0           = IOMUX_PIN(33,   311),
-       MX31_PIN_SVEN0          = IOMUX_PIN(32,   312),
-       MX31_PIN_SRST0          = IOMUX_PIN(67,   313),
-       MX31_PIN_SCLK0          = IOMUX_PIN(66,   314),
-       MX31_PIN_GPIO3_1        = IOMUX_PIN(65,   315),
-       MX31_PIN_GPIO3_0        = IOMUX_PIN(64,   316),
-       MX31_PIN_GPIO1_6        = IOMUX_PIN( 6,   317),
-       MX31_PIN_GPIO1_5        = IOMUX_PIN( 5,   318),
-       MX31_PIN_GPIO1_4        = IOMUX_PIN( 4,   319),
-       MX31_PIN_GPIO1_3        = IOMUX_PIN( 3,   320),
-       MX31_PIN_GPIO1_2        = IOMUX_PIN( 2,   321),
-       MX31_PIN_GPIO1_1        = IOMUX_PIN( 1,   322),
-       MX31_PIN_GPIO1_0        = IOMUX_PIN( 0,   323),
-       MX31_PIN_PWMO           = IOMUX_PIN( 9,   324),
-       MX31_PIN_WATCHDOG_RST   = IOMUX_PIN(0xff, 325),
-       MX31_PIN_COMPARE        = IOMUX_PIN( 8,   326),
-       MX31_PIN_CAPTURE        = IOMUX_PIN( 7,   327),
-};
-
-#define PIN_MAX 327
-#define NB_PORTS 12 /* NB_PINS/32, we chose 32 pins per "PORT" */
-
-/*
- * Convenience values for use with mxc_iomux_mode()
- *
- * Format here is MX31_PIN_(pin name)__(function)
- */
-#define MX31_PIN_CSPI3_MOSI__RXD3      IOMUX_MODE(MX31_PIN_CSPI3_MOSI, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSPI3_MISO__TXD3      IOMUX_MODE(MX31_PIN_CSPI3_MISO, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSPI3_SCLK__RTS3      IOMUX_MODE(MX31_PIN_CSPI3_SCLK, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSPI3_SPI_RDY__CTS3   IOMUX_MODE(MX31_PIN_CSPI3_SPI_RDY, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CTS1__CTS1            IOMUX_MODE(MX31_PIN_CTS1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_RTS1__RTS1            IOMUX_MODE(MX31_PIN_RTS1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_RTS1__SFS             IOMUX_MODE(MX31_PIN_RTS1, IOMUX_CONFIG_ALT2)
-#define MX31_PIN_TXD1__TXD1            IOMUX_MODE(MX31_PIN_TXD1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_TXD1__SCK             IOMUX_MODE(MX31_PIN_TXD1, IOMUX_CONFIG_ALT2)
-#define MX31_PIN_RXD1__RXD1            IOMUX_MODE(MX31_PIN_RXD1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_RXD1__STXDA           IOMUX_MODE(MX31_PIN_RXD1, IOMUX_CONFIG_ALT2)
-#define MX31_PIN_DCD_DCE1__DCD_DCE1    IOMUX_MODE(MX31_PIN_DCD_DCE1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_RI_DCE1__RI_DCE1      IOMUX_MODE(MX31_PIN_RI_DCE1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_DSR_DCE1__DSR_DCE1    IOMUX_MODE(MX31_PIN_DSR_DCE1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_DTR_DCE1__DTR_DCE1    IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_DTR_DCE1__SRXDA       IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_ALT2)
-#define MX31_PIN_CTS2__CTS2            IOMUX_MODE(MX31_PIN_CTS2, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_RTS2__RTS2            IOMUX_MODE(MX31_PIN_RTS2, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_TXD2__TXD2            IOMUX_MODE(MX31_PIN_TXD2, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_RXD2__RXD2            IOMUX_MODE(MX31_PIN_RXD2, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_DCD_DTE1__DCD_DTE2    IOMUX_MODE(MX31_PIN_DCD_DTE1, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_RI_DTE1__RI_DTE2      IOMUX_MODE(MX31_PIN_RI_DTE1, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_DSR_DTE1__DSR_DTE2    IOMUX_MODE(MX31_PIN_DSR_DTE1, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_DTR_DTE1__DTR_DTE2    IOMUX_MODE(MX31_PIN_DTR_DTE1, IOMUX_OCONFIG_ALT3 | IOMUX_ICONFIG_NONE)
-#define MX31_PIN_PC_RST__CTS5          IOMUX_MODE(MX31_PIN_PC_RST, IOMUX_CONFIG_ALT2)
-#define MX31_PIN_PC_VS2__RTS5          IOMUX_MODE(MX31_PIN_PC_VS2, IOMUX_CONFIG_ALT2)
-#define MX31_PIN_PC_BVD2__TXD5         IOMUX_MODE(MX31_PIN_PC_BVD2, IOMUX_CONFIG_ALT2)
-#define MX31_PIN_PC_BVD1__RXD5         IOMUX_MODE(MX31_PIN_PC_BVD1, IOMUX_CONFIG_ALT2)
-#define MX31_PIN_CSPI1_MOSI__MOSI      IOMUX_MODE(MX31_PIN_CSPI1_MOSI, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI1_MISO__MISO      IOMUX_MODE(MX31_PIN_CSPI1_MISO, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI1_SCLK__SCLK      IOMUX_MODE(MX31_PIN_CSPI1_SCLK, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI1_SPI_RDY__SPI_RDY        IOMUX_MODE(MX31_PIN_CSPI1_SPI_RDY, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI1_SS0__SS0                IOMUX_MODE(MX31_PIN_CSPI1_SS0, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI1_SS1__SS1                IOMUX_MODE(MX31_PIN_CSPI1_SS1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI1_SS2__SS2                IOMUX_MODE(MX31_PIN_CSPI1_SS2, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI2_MOSI__MOSI      IOMUX_MODE(MX31_PIN_CSPI2_MOSI, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI2_MOSI__SCL       IOMUX_MODE(MX31_PIN_CSPI2_MOSI, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSPI2_MISO__MISO      IOMUX_MODE(MX31_PIN_CSPI2_MISO, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI2_MISO__SDA       IOMUX_MODE(MX31_PIN_CSPI2_MISO, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSPI2_SCLK__SCLK      IOMUX_MODE(MX31_PIN_CSPI2_SCLK, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI2_SPI_RDY__SPI_RDY        IOMUX_MODE(MX31_PIN_CSPI2_SPI_RDY, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI2_SS0__SS0                IOMUX_MODE(MX31_PIN_CSPI2_SS0, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI2_SS1__SS1                IOMUX_MODE(MX31_PIN_CSPI2_SS1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI2_SS2__SS2                IOMUX_MODE(MX31_PIN_CSPI2_SS2, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI3_MOSI__MOSI      IOMUX_MODE(MX31_PIN_CSPI3_MOSI, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI3_MISO__MISO      IOMUX_MODE(MX31_PIN_CSPI3_MISO, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI3_SCLK__SCLK      IOMUX_MODE(MX31_PIN_CSPI3_SCLK, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI3_SPI_RDY__SPI_RDY        IOMUX_MODE(MX31_PIN_CSPI3_SPI_RDY, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_BATT_LINE__OWIRE      IOMUX_MODE(MX31_PIN_BATT_LINE, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CS4__CS4              IOMUX_MODE(MX31_PIN_CS4, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SD1_DATA3__SD1_DATA3  IOMUX_MODE(MX31_PIN_SD1_DATA3, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SD1_DATA2__SD1_DATA2  IOMUX_MODE(MX31_PIN_SD1_DATA2, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SD1_DATA1__SD1_DATA1  IOMUX_MODE(MX31_PIN_SD1_DATA1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SD1_DATA0__SD1_DATA0  IOMUX_MODE(MX31_PIN_SD1_DATA0, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SD1_CLK__SD1_CLK      IOMUX_MODE(MX31_PIN_SD1_CLK, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SD1_CMD__SD1_CMD      IOMUX_MODE(MX31_PIN_SD1_CMD, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_ATA_CS0__GPIO3_26     IOMUX_MODE(MX31_PIN_ATA_CS0, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_ATA_CS1__GPIO3_27     IOMUX_MODE(MX31_PIN_ATA_CS1, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_PC_PWRON__SD2_DATA3   IOMUX_MODE(MX31_PIN_PC_PWRON, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_PC_VS1__SD2_DATA2     IOMUX_MODE(MX31_PIN_PC_VS1, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_PC_READY__SD2_DATA1   IOMUX_MODE(MX31_PIN_PC_READY, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_PC_WAIT_B__SD2_DATA0  IOMUX_MODE(MX31_PIN_PC_WAIT_B, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_PC_CD2_B__SD2_CLK     IOMUX_MODE(MX31_PIN_PC_CD2_B, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_PC_CD1_B__SD2_CMD     IOMUX_MODE(MX31_PIN_PC_CD1_B, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_ATA_DIOR__GPIO3_28    IOMUX_MODE(MX31_PIN_ATA_DIOR, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_ATA_DIOW__GPIO3_29    IOMUX_MODE(MX31_PIN_ATA_DIOW, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_LD0__LD0              IOMUX_MODE(MX31_PIN_LD0, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD1__LD1              IOMUX_MODE(MX31_PIN_LD1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD2__LD2              IOMUX_MODE(MX31_PIN_LD2, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD3__LD3              IOMUX_MODE(MX31_PIN_LD3, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD4__LD4              IOMUX_MODE(MX31_PIN_LD4, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD5__LD5              IOMUX_MODE(MX31_PIN_LD5, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD6__LD6              IOMUX_MODE(MX31_PIN_LD6, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD7__LD7              IOMUX_MODE(MX31_PIN_LD7, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD8__LD8              IOMUX_MODE(MX31_PIN_LD8, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD9__LD9              IOMUX_MODE(MX31_PIN_LD9, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD10__LD10            IOMUX_MODE(MX31_PIN_LD10, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD11__LD11            IOMUX_MODE(MX31_PIN_LD11, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD12__LD12            IOMUX_MODE(MX31_PIN_LD12, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD13__LD13            IOMUX_MODE(MX31_PIN_LD13, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD14__LD14            IOMUX_MODE(MX31_PIN_LD14, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD15__LD15            IOMUX_MODE(MX31_PIN_LD15, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD16__LD16            IOMUX_MODE(MX31_PIN_LD16, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_LD17__LD17            IOMUX_MODE(MX31_PIN_LD17, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_VSYNC3__VSYNC3                IOMUX_MODE(MX31_PIN_VSYNC3, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_HSYNC__HSYNC          IOMUX_MODE(MX31_PIN_HSYNC, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_FPSHIFT__FPSHIFT      IOMUX_MODE(MX31_PIN_FPSHIFT, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_DRDY0__DRDY0          IOMUX_MODE(MX31_PIN_DRDY0, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_D3_REV__D3_REV                IOMUX_MODE(MX31_PIN_D3_REV, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CONTRAST__CONTRAST    IOMUX_MODE(MX31_PIN_CONTRAST, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_D3_SPL__D3_SPL                IOMUX_MODE(MX31_PIN_D3_SPL, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_D3_CLS__D3_CLS                IOMUX_MODE(MX31_PIN_D3_CLS, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_GPIO1_1__GPIO          IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_DCD_DTE1__I2C2_SDA    IOMUX_MODE(MX31_PIN_DCD_DTE1, IOMUX_CONFIG_ALT2)
-#define MX31_PIN_RI_DTE1__I2C2_SCL     IOMUX_MODE(MX31_PIN_RI_DTE1, IOMUX_CONFIG_ALT2)
-#define MX31_PIN_CSPI2_SS2__I2C3_SDA   IOMUX_MODE(MX31_PIN_CSPI2_SS2, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSPI2_SCLK__I2C3_SCL  IOMUX_MODE(MX31_PIN_CSPI2_SCLK, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSI_D4__CSI_D4                IOMUX_MODE(MX31_PIN_CSI_D4, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_D5__CSI_D5                IOMUX_MODE(MX31_PIN_CSI_D5, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_D6__CSI_D6                IOMUX_MODE(MX31_PIN_CSI_D6, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_D7__CSI_D7                IOMUX_MODE(MX31_PIN_CSI_D7, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_D8__CSI_D8                IOMUX_MODE(MX31_PIN_CSI_D8, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_D9__CSI_D9                IOMUX_MODE(MX31_PIN_CSI_D9, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_D10__CSI_D10      IOMUX_MODE(MX31_PIN_CSI_D10, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_D11__CSI_D11      IOMUX_MODE(MX31_PIN_CSI_D11, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_D12__CSI_D12      IOMUX_MODE(MX31_PIN_CSI_D12, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_D13__CSI_D13      IOMUX_MODE(MX31_PIN_CSI_D13, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_D14__CSI_D14      IOMUX_MODE(MX31_PIN_CSI_D14, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_D15__CSI_D15      IOMUX_MODE(MX31_PIN_CSI_D15, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_HSYNC__CSI_HSYNC  IOMUX_MODE(MX31_PIN_CSI_HSYNC, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_MCLK__CSI_MCLK    IOMUX_MODE(MX31_PIN_CSI_MCLK, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_PIXCLK__CSI_PIXCLK        IOMUX_MODE(MX31_PIN_CSI_PIXCLK, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSI_VSYNC__CSI_VSYNC  IOMUX_MODE(MX31_PIN_CSI_VSYNC, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_GPIO3_0__GPIO3_0      IOMUX_MODE(MX31_PIN_GPIO3_0, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_GPIO3_1__GPIO3_1      IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_TXD2__GPIO1_28                IOMUX_MODE(MX31_PIN_TXD2, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_CSI_D4__GPIO3_4       IOMUX_MODE(MX31_PIN_CSI_D4, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_CSI_D5__GPIO3_5       IOMUX_MODE(MX31_PIN_CSI_D5, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_USBOTG_DATA0__USBOTG_DATA0    IOMUX_MODE(MX31_PIN_USBOTG_DATA0, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBOTG_DATA1__USBOTG_DATA1    IOMUX_MODE(MX31_PIN_USBOTG_DATA1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBOTG_DATA2__USBOTG_DATA2    IOMUX_MODE(MX31_PIN_USBOTG_DATA2, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBOTG_DATA3__USBOTG_DATA3    IOMUX_MODE(MX31_PIN_USBOTG_DATA3, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBOTG_DATA4__USBOTG_DATA4    IOMUX_MODE(MX31_PIN_USBOTG_DATA4, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBOTG_DATA5__USBOTG_DATA5    IOMUX_MODE(MX31_PIN_USBOTG_DATA5, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBOTG_DATA6__USBOTG_DATA6    IOMUX_MODE(MX31_PIN_USBOTG_DATA6, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBOTG_DATA7__USBOTG_DATA7    IOMUX_MODE(MX31_PIN_USBOTG_DATA7, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBOTG_CLK__USBOTG_CLK                IOMUX_MODE(MX31_PIN_USBOTG_CLK, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBOTG_DIR__USBOTG_DIR                IOMUX_MODE(MX31_PIN_USBOTG_DIR, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBOTG_NXT__USBOTG_NXT                IOMUX_MODE(MX31_PIN_USBOTG_NXT, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBOTG_STP__USBOTG_STP                IOMUX_MODE(MX31_PIN_USBOTG_STP, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_CSPI1_MOSI__USBH1_RXDM                IOMUX_MODE(MX31_PIN_CSPI1_MOSI, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSPI1_MISO__USBH1_RXDP                IOMUX_MODE(MX31_PIN_CSPI1_MISO, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSPI1_SS0__USBH1_TXDM         IOMUX_MODE(MX31_PIN_CSPI1_SS0, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSPI1_SS1__USBH1_TXDP         IOMUX_MODE(MX31_PIN_CSPI1_SS1, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSPI1_SS2__USBH1_RCV          IOMUX_MODE(MX31_PIN_CSPI1_SS2, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSPI1_SCLK__USBH1_OEB         IOMUX_MODE(MX31_PIN_CSPI1_SCLK, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_CSPI1_SPI_RDY__USBH1_FS       IOMUX_MODE(MX31_PIN_CSPI1_SPI_RDY, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_SFS6__USBH1_SUSPEND   IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_NFRE_B__GPIO1_11      IOMUX_MODE(MX31_PIN_NFRE_B, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_NFALE__GPIO1_12       IOMUX_MODE(MX31_PIN_NFALE, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_USBH2_DATA0__USBH2_DATA0      IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBH2_DATA1__USBH2_DATA1      IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_STXD3__USBH2_DATA2    IOMUX_MODE(MX31_PIN_STXD3, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SRXD3__USBH2_DATA3    IOMUX_MODE(MX31_PIN_SRXD3, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SCK3__USBH2_DATA4     IOMUX_MODE(MX31_PIN_SCK3, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SFS3__USBH2_DATA5     IOMUX_MODE(MX31_PIN_SFS3, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_STXD6__USBH2_DATA6    IOMUX_MODE(MX31_PIN_STXD6, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SRXD6__USBH2_DATA7    IOMUX_MODE(MX31_PIN_SRXD6, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBH2_CLK__USBH2_CLK          IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBH2_DIR__USBH2_DIR          IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBH2_NXT__USBH2_NXT          IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_USBH2_STP__USBH2_STP          IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SCK6__GPIO1_25                IOMUX_MODE(MX31_PIN_SCK6, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_USB_OC__GPIO1_30      IOMUX_MODE(MX31_PIN_USB_OC, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_I2C_DAT__I2C1_SDA     IOMUX_MODE(MX31_PIN_I2C_DAT, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_I2C_CLK__I2C1_SCL     IOMUX_MODE(MX31_PIN_I2C_CLK, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_GPIO1_0__GPIO1_0      IOMUX_MODE(MX31_PIN_GPIO1_0, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_SVEN0__GPIO2_0                IOMUX_MODE(MX31_PIN_SVEN0, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_STX0__GPIO2_1         IOMUX_MODE(MX31_PIN_STX0, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_SRX0__GPIO2_2         IOMUX_MODE(MX31_PIN_SRX0, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_SIMPD0__GPIO2_3       IOMUX_MODE(MX31_PIN_SIMPD0, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_DTR_DCE1__GPIO2_8     IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_DSR_DCE1__GPIO2_9     IOMUX_MODE(MX31_PIN_DSR_DCE1, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_RI_DCE1__GPIO2_10     IOMUX_MODE(MX31_PIN_RI_DCE1, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_DCD_DCE1__GPIO2_11    IOMUX_MODE(MX31_PIN_DCD_DCE1, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_STXD5__GPIO1_21       IOMUX_MODE(MX31_PIN_STXD5, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_SRXD5__GPIO1_22       IOMUX_MODE(MX31_PIN_SRXD5, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_GPIO1_3__GPIO1_3      IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_CSPI2_SS1__CSPI3_SS1  IOMUX_MODE(MX31_PIN_CSPI2_SS1, IOMUX_CONFIG_ALT1)
-#define MX31_PIN_RTS1__GPIO2_6         IOMUX_MODE(MX31_PIN_RTS1, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_CTS1__GPIO2_7         IOMUX_MODE(MX31_PIN_CTS1, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_LCS0__GPIO3_23                IOMUX_MODE(MX31_PIN_LCS0, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_STXD4__STXD4          IOMUX_MODE(MX31_PIN_STXD4, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SRXD4__SRXD4          IOMUX_MODE(MX31_PIN_SRXD4, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SCK4__SCK4            IOMUX_MODE(MX31_PIN_SCK4, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SFS4__SFS4            IOMUX_MODE(MX31_PIN_SFS4, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_STXD5__STXD5          IOMUX_MODE(MX31_PIN_STXD5, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SRXD5__SRXD5          IOMUX_MODE(MX31_PIN_SRXD5, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SCK5__SCK5            IOMUX_MODE(MX31_PIN_SCK5, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_SFS5__SFS5            IOMUX_MODE(MX31_PIN_SFS5, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_ROW0_KEY_ROW0     IOMUX_MODE(MX31_PIN_KEY_ROW0, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_ROW1_KEY_ROW1     IOMUX_MODE(MX31_PIN_KEY_ROW1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_ROW2_KEY_ROW2     IOMUX_MODE(MX31_PIN_KEY_ROW2, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_ROW3_KEY_ROW3     IOMUX_MODE(MX31_PIN_KEY_ROW3, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_ROW4_KEY_ROW4     IOMUX_MODE(MX31_PIN_KEY_ROW4, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_ROW4_GPIO         IOMUX_MODE(MX31_PIN_KEY_ROW4, IOMUX_CONFIG_GPIO)
-#define MX31_PIN_KEY_ROW5_KEY_ROW5     IOMUX_MODE(MX31_PIN_KEY_ROW5, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_ROW6_KEY_ROW6     IOMUX_MODE(MX31_PIN_KEY_ROW6, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_ROW7_KEY_ROW7     IOMUX_MODE(MX31_PIN_KEY_ROW7, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_COL0_KEY_COL0     IOMUX_MODE(MX31_PIN_KEY_COL0, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_COL1_KEY_COL1     IOMUX_MODE(MX31_PIN_KEY_COL1, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_COL2_KEY_COL2     IOMUX_MODE(MX31_PIN_KEY_COL2, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_COL3_KEY_COL3     IOMUX_MODE(MX31_PIN_KEY_COL3, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_COL4_KEY_COL4     IOMUX_MODE(MX31_PIN_KEY_COL4, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_COL5_KEY_COL5     IOMUX_MODE(MX31_PIN_KEY_COL5, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_COL6_KEY_COL6     IOMUX_MODE(MX31_PIN_KEY_COL6, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_KEY_COL7_KEY_COL7     IOMUX_MODE(MX31_PIN_KEY_COL7, IOMUX_CONFIG_FUNC)
-#define MX31_PIN_WATCHDOG_RST__WATCHDOG_RST    IOMUX_MODE(MX31_PIN_WATCHDOG_RST, IOMUX_CONFIG_FUNC)
-
-
-/*
- * XXX: The SS0, SS1, SS2, SS3 lines of spi3 are multiplexed with cspi2_ss0,
- * cspi2_ss1, cspi1_ss0 cspi1_ss1
- */
-
-/*
- * This function configures the pad value for a IOMUX pin.
- */
-void mxc_iomux_set_pad(enum iomux_pins, u32);
-
-#endif /* ifndef __MACH_IOMUX_MX3_H__ */
diff --git a/arch/arm/mach-imx/iomux-mx35.h b/arch/arm/mach-imx/iomux-mx35.h
deleted file mode 100644 (file)
index 7fb5259..0000000
+++ /dev/null
@@ -1,1254 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH <armlinux@phytec.de>
- */
-
-#ifndef __MACH_IOMUX_MX35_H__
-#define __MACH_IOMUX_MX35_H__
-
-#include "iomux-v3.h"
-
-/*
- * The naming convention for the pad modes is MX35_PAD_<padname>__<padmode>
- * If <padname> or <padmode> refers to a GPIO, it is named
- * GPIO_<unit>_<num> see also iomux-v3.h
- */
-
-/*                                                                       PAD    MUX   ALT INPSE PATH */
-#define MX35_PAD_CAPTURE__GPT_CAPIN1                           IOMUX_PAD(0x328, 0x004, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CAPTURE__GPT_CMPOUT2                          IOMUX_PAD(0x328, 0x004, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CAPTURE__CSPI2_SS1                            IOMUX_PAD(0x328, 0x004, 2, 0x7f4, 0, NO_PAD_CTRL)
-#define MX35_PAD_CAPTURE__EPIT1_EPITO                          IOMUX_PAD(0x328, 0x004, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CAPTURE__CCM_CLK32K                           IOMUX_PAD(0x328, 0x004, 4, 0x7d0, 0, NO_PAD_CTRL)
-#define MX35_PAD_CAPTURE__GPIO1_4                              IOMUX_PAD(0x328, 0x004, 5, 0x850, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_COMPARE__GPT_CMPOUT1                          IOMUX_PAD(0x32c, 0x008, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_COMPARE__GPT_CAPIN2                           IOMUX_PAD(0x32c, 0x008, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_COMPARE__GPT_CMPOUT3                          IOMUX_PAD(0x32c, 0x008, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_COMPARE__EPIT2_EPITO                          IOMUX_PAD(0x32c, 0x008, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_COMPARE__GPIO1_5                              IOMUX_PAD(0x32c, 0x008, 5, 0x854, 0, NO_PAD_CTRL)
-#define MX35_PAD_COMPARE__SDMA_EXTDMA_2                                IOMUX_PAD(0x32c, 0x008, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_WDOG_RST__WDOG_WDOG_B                         IOMUX_PAD(0x330, 0x00c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_WDOG_RST__IPU_FLASH_STROBE                    IOMUX_PAD(0x330, 0x00c, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_WDOG_RST__GPIO1_6                             IOMUX_PAD(0x330, 0x00c, 5, 0x858, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_GPIO1_0__GPIO1_0                              IOMUX_PAD(0x334, 0x010, 0, 0x82c, 0, NO_PAD_CTRL)
-#define MX35_PAD_GPIO1_0__CCM_PMIC_RDY                         IOMUX_PAD(0x334, 0x010, 1, 0x7d4, 0, NO_PAD_CTRL)
-#define MX35_PAD_GPIO1_0__OWIRE_LINE                           IOMUX_PAD(0x334, 0x010, 2, 0x990, 0, NO_PAD_CTRL)
-#define MX35_PAD_GPIO1_0__SDMA_EXTDMA_0                                IOMUX_PAD(0x334, 0x010, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_GPIO1_1__GPIO1_1                              IOMUX_PAD(0x338, 0x014, 0, 0x838, 0, NO_PAD_CTRL)
-#define MX35_PAD_GPIO1_1__PWM_PWMO                             IOMUX_PAD(0x338, 0x014, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_GPIO1_1__CSPI1_SS2                            IOMUX_PAD(0x338, 0x014, 3, 0x7d8, 0, NO_PAD_CTRL)
-#define MX35_PAD_GPIO1_1__SCC_TAMPER_DETECT                    IOMUX_PAD(0x338, 0x014, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_GPIO1_1__SDMA_EXTDMA_1                                IOMUX_PAD(0x338, 0x014, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_GPIO2_0__GPIO2_0                              IOMUX_PAD(0x33c, 0x018, 0, 0x868, 0, NO_PAD_CTRL)
-#define MX35_PAD_GPIO2_0__USB_TOP_USBOTG_CLK                   IOMUX_PAD(0x33c, 0x018, 1, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_GPIO3_0__GPIO3_0                              IOMUX_PAD(0x340, 0x01c, 0, 0x8e8, 0, NO_PAD_CTRL)
-#define MX35_PAD_GPIO3_0__USB_TOP_USBH2_CLK                    IOMUX_PAD(0x340, 0x01c, 1, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_RESET_IN_B__CCM_RESET_IN_B                    IOMUX_PAD(0x344, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_POR_B__CCM_POR_B                              IOMUX_PAD(0x348, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CLKO__CCM_CLKO                                        IOMUX_PAD(0x34c, 0x020, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CLKO__GPIO1_8                                 IOMUX_PAD(0x34c, 0x020, 5, 0x860, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_BOOT_MODE0__CCM_BOOT_MODE_0                   IOMUX_PAD(0x350, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_BOOT_MODE1__CCM_BOOT_MODE_1                   IOMUX_PAD(0x354, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CLK_MODE0__CCM_CLK_MODE_0                     IOMUX_PAD(0x358, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CLK_MODE1__CCM_CLK_MODE_1                     IOMUX_PAD(0x35c, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_POWER_FAIL__CCM_DSM_WAKEUP_INT_26             IOMUX_PAD(0x360, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_VSTBY__CCM_VSTBY                              IOMUX_PAD(0x364, 0x024, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_VSTBY__GPIO1_7                                        IOMUX_PAD(0x364, 0x024, 5, 0x85c, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_A0__EMI_EIM_DA_L_0                            IOMUX_PAD(0x368, 0x028, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A1__EMI_EIM_DA_L_1                            IOMUX_PAD(0x36c, 0x02c, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A2__EMI_EIM_DA_L_2                            IOMUX_PAD(0x370, 0x030, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A3__EMI_EIM_DA_L_3                            IOMUX_PAD(0x374, 0x034, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A4__EMI_EIM_DA_L_4                            IOMUX_PAD(0x378, 0x038, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A5__EMI_EIM_DA_L_5                            IOMUX_PAD(0x37c, 0x03c, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A6__EMI_EIM_DA_L_6                            IOMUX_PAD(0x380, 0x040, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A7__EMI_EIM_DA_L_7                            IOMUX_PAD(0x384, 0x044, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A8__EMI_EIM_DA_H_8                            IOMUX_PAD(0x388, 0x048, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A9__EMI_EIM_DA_H_9                            IOMUX_PAD(0x38c, 0x04c, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A10__EMI_EIM_DA_H_10                          IOMUX_PAD(0x390, 0x050, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_MA10__EMI_MA10                                        IOMUX_PAD(0x394, 0x054, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A11__EMI_EIM_DA_H_11                          IOMUX_PAD(0x398, 0x058, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A12__EMI_EIM_DA_H_12                          IOMUX_PAD(0x39c, 0x05c, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A13__EMI_EIM_DA_H_13                          IOMUX_PAD(0x3a0, 0x060, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A14__EMI_EIM_DA_H2_14                         IOMUX_PAD(0x3a4, 0x064, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A15__EMI_EIM_DA_H2_15                         IOMUX_PAD(0x3a8, 0x068, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A16__EMI_EIM_A_16                             IOMUX_PAD(0x3ac, 0x06c, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A17__EMI_EIM_A_17                             IOMUX_PAD(0x3b0, 0x070, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A18__EMI_EIM_A_18                             IOMUX_PAD(0x3b4, 0x074, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A19__EMI_EIM_A_19                             IOMUX_PAD(0x3b8, 0x078, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A20__EMI_EIM_A_20                             IOMUX_PAD(0x3bc, 0x07c, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A21__EMI_EIM_A_21                             IOMUX_PAD(0x3c0, 0x080, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A22__EMI_EIM_A_22                             IOMUX_PAD(0x3c4, 0x084, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A23__EMI_EIM_A_23                             IOMUX_PAD(0x3c8, 0x088, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A24__EMI_EIM_A_24                             IOMUX_PAD(0x3cc, 0x08c, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_A25__EMI_EIM_A_25                             IOMUX_PAD(0x3d0, 0x090, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SDBA1__EMI_EIM_SDBA1                          IOMUX_PAD(0x3d4, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SDBA0__EMI_EIM_SDBA0                          IOMUX_PAD(0x3d8, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD0__EMI_DRAM_D_0                             IOMUX_PAD(0x3dc, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD1__EMI_DRAM_D_1                             IOMUX_PAD(0x3e0, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD2__EMI_DRAM_D_2                             IOMUX_PAD(0x3e4, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD3__EMI_DRAM_D_3                             IOMUX_PAD(0x3e8, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD4__EMI_DRAM_D_4                             IOMUX_PAD(0x3ec, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD5__EMI_DRAM_D_5                             IOMUX_PAD(0x3f0, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD6__EMI_DRAM_D_6                             IOMUX_PAD(0x3f4, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD7__EMI_DRAM_D_7                             IOMUX_PAD(0x3f8, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD8__EMI_DRAM_D_8                             IOMUX_PAD(0x3fc, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD9__EMI_DRAM_D_9                             IOMUX_PAD(0x400, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD10__EMI_DRAM_D_10                           IOMUX_PAD(0x404, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD11__EMI_DRAM_D_11                           IOMUX_PAD(0x408, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD12__EMI_DRAM_D_12                           IOMUX_PAD(0x40c, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD13__EMI_DRAM_D_13                           IOMUX_PAD(0x410, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD14__EMI_DRAM_D_14                           IOMUX_PAD(0x414, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD15__EMI_DRAM_D_15                           IOMUX_PAD(0x418, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD16__EMI_DRAM_D_16                           IOMUX_PAD(0x41c, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD17__EMI_DRAM_D_17                           IOMUX_PAD(0x420, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD18__EMI_DRAM_D_18                           IOMUX_PAD(0x424, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD19__EMI_DRAM_D_19                           IOMUX_PAD(0x428, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD20__EMI_DRAM_D_20                           IOMUX_PAD(0x42c, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD21__EMI_DRAM_D_21                           IOMUX_PAD(0x430, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD22__EMI_DRAM_D_22                           IOMUX_PAD(0x434, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD23__EMI_DRAM_D_23                           IOMUX_PAD(0x438, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD24__EMI_DRAM_D_24                           IOMUX_PAD(0x43c, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD25__EMI_DRAM_D_25                           IOMUX_PAD(0x440, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD26__EMI_DRAM_D_26                           IOMUX_PAD(0x444, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD27__EMI_DRAM_D_27                           IOMUX_PAD(0x448, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD28__EMI_DRAM_D_28                           IOMUX_PAD(0x44c, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD29__EMI_DRAM_D_29                           IOMUX_PAD(0x450, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD30__EMI_DRAM_D_30                           IOMUX_PAD(0x454, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD31__EMI_DRAM_D_31                           IOMUX_PAD(0x458, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_DQM0__EMI_DRAM_DQM_0                          IOMUX_PAD(0x45c, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_DQM1__EMI_DRAM_DQM_1                          IOMUX_PAD(0x460, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_DQM2__EMI_DRAM_DQM_2                          IOMUX_PAD(0x464, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_DQM3__EMI_DRAM_DQM_3                          IOMUX_PAD(0x468, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_EB0__EMI_EIM_EB0_B                            IOMUX_PAD(0x46c, 0x094, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_EB1__EMI_EIM_EB1_B                            IOMUX_PAD(0x470, 0x098, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_OE__EMI_EIM_OE                                        IOMUX_PAD(0x474, 0x09c, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CS0__EMI_EIM_CS0                              IOMUX_PAD(0x478, 0x0a0, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CS1__EMI_EIM_CS1                              IOMUX_PAD(0x47c, 0x0a4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CS1__EMI_NANDF_CE3                            IOMUX_PAD(0x47c, 0x0a4, 3, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CS2__EMI_EIM_CS2                              IOMUX_PAD(0x480, 0x0a8, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CS3__EMI_EIM_CS3                              IOMUX_PAD(0x484, 0x0ac, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CS4__EMI_EIM_CS4                              IOMUX_PAD(0x488, 0x0b0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CS4__EMI_DTACK_B                              IOMUX_PAD(0x488, 0x0b0, 1, 0x800, 0, NO_PAD_CTRL)
-#define MX35_PAD_CS4__EMI_NANDF_CE1                            IOMUX_PAD(0x488, 0x0b0, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CS4__GPIO1_20                                 IOMUX_PAD(0x488, 0x0b0, 5, 0x83c, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_CS5__EMI_EIM_CS5                              IOMUX_PAD(0x48c, 0x0b4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CS5__CSPI2_SS2                                        IOMUX_PAD(0x48c, 0x0b4, 1, 0x7f8, 0, NO_PAD_CTRL)
-#define MX35_PAD_CS5__CSPI1_SS2                                        IOMUX_PAD(0x48c, 0x0b4, 2, 0x7d8, 1, NO_PAD_CTRL)
-#define MX35_PAD_CS5__EMI_NANDF_CE2                            IOMUX_PAD(0x48c, 0x0b4, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CS5__GPIO1_21                                 IOMUX_PAD(0x48c, 0x0b4, 5, 0x840, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_NF_CE0__EMI_NANDF_CE0                         IOMUX_PAD(0x490, 0x0b8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NF_CE0__GPIO1_22                              IOMUX_PAD(0x490, 0x0b8, 5, 0x844, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_ECB__EMI_EIM_ECB                              IOMUX_PAD(0x494, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LBA__EMI_EIM_LBA                              IOMUX_PAD(0x498, 0x0bc, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_BCLK__EMI_EIM_BCLK                            IOMUX_PAD(0x49c, 0x0c0, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_RW__EMI_EIM_RW                                        IOMUX_PAD(0x4a0, 0x0c4, 0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_RAS__EMI_DRAM_RAS                             IOMUX_PAD(0x4a4, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CAS__EMI_DRAM_CAS                             IOMUX_PAD(0x4a8, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SDWE__EMI_DRAM_SDWE                           IOMUX_PAD(0x4ac, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SDCKE0__EMI_DRAM_SDCKE_0                      IOMUX_PAD(0x4b0, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SDCKE1__EMI_DRAM_SDCKE_1                      IOMUX_PAD(0x4b4, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SDCLK__EMI_DRAM_SDCLK                         IOMUX_PAD(0x4b8, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SDQS0__EMI_DRAM_SDQS_0                                IOMUX_PAD(0x4bc, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SDQS1__EMI_DRAM_SDQS_1                                IOMUX_PAD(0x4c0, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SDQS2__EMI_DRAM_SDQS_2                                IOMUX_PAD(0x4c4, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SDQS3__EMI_DRAM_SDQS_3                                IOMUX_PAD(0x4c8, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_NFWE_B__EMI_NANDF_WE_B                                IOMUX_PAD(0x4cc, 0x0c8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NFWE_B__USB_TOP_USBH2_DATA_3                  IOMUX_PAD(0x4cc, 0x0c8, 1, 0x9d8, 0, NO_PAD_CTRL)
-#define MX35_PAD_NFWE_B__IPU_DISPB_D0_VSYNC                    IOMUX_PAD(0x4cc, 0x0c8, 2, 0x924, 0, NO_PAD_CTRL)
-#define MX35_PAD_NFWE_B__GPIO2_18                              IOMUX_PAD(0x4cc, 0x0c8, 5, 0x88c, 0, NO_PAD_CTRL)
-#define MX35_PAD_NFWE_B__ARM11P_TOP_TRACE_0                    IOMUX_PAD(0x4cc, 0x0c8, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_NFRE_B__EMI_NANDF_RE_B                                IOMUX_PAD(0x4d0, 0x0cc, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NFRE_B__USB_TOP_USBH2_DIR                     IOMUX_PAD(0x4d0, 0x0cc, 1, 0x9ec, 0, NO_PAD_CTRL)
-#define MX35_PAD_NFRE_B__IPU_DISPB_BCLK                                IOMUX_PAD(0x4d0, 0x0cc, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NFRE_B__GPIO2_19                              IOMUX_PAD(0x4d0, 0x0cc, 5, 0x890, 0, NO_PAD_CTRL)
-#define MX35_PAD_NFRE_B__ARM11P_TOP_TRACE_1                    IOMUX_PAD(0x4d0, 0x0cc, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_NFALE__EMI_NANDF_ALE                          IOMUX_PAD(0x4d4, 0x0d0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NFALE__USB_TOP_USBH2_STP                      IOMUX_PAD(0x4d4, 0x0d0, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NFALE__IPU_DISPB_CS0                          IOMUX_PAD(0x4d4, 0x0d0, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NFALE__GPIO2_20                               IOMUX_PAD(0x4d4, 0x0d0, 5, 0x898, 0, NO_PAD_CTRL)
-#define MX35_PAD_NFALE__ARM11P_TOP_TRACE_2                     IOMUX_PAD(0x4d4, 0x0d0, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_NFCLE__EMI_NANDF_CLE                          IOMUX_PAD(0x4d8, 0x0d4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NFCLE__USB_TOP_USBH2_NXT                      IOMUX_PAD(0x4d8, 0x0d4, 1, 0x9f0, 0, NO_PAD_CTRL)
-#define MX35_PAD_NFCLE__IPU_DISPB_PAR_RS                       IOMUX_PAD(0x4d8, 0x0d4, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NFCLE__GPIO2_21                               IOMUX_PAD(0x4d8, 0x0d4, 5, 0x89c, 0, NO_PAD_CTRL)
-#define MX35_PAD_NFCLE__ARM11P_TOP_TRACE_3                     IOMUX_PAD(0x4d8, 0x0d4, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_NFWP_B__EMI_NANDF_WP_B                                IOMUX_PAD(0x4dc, 0x0d8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NFWP_B__USB_TOP_USBH2_DATA_7                  IOMUX_PAD(0x4dc, 0x0d8, 1, 0x9e8, 0, NO_PAD_CTRL)
-#define MX35_PAD_NFWP_B__IPU_DISPB_WR                          IOMUX_PAD(0x4dc, 0x0d8, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NFWP_B__GPIO2_22                              IOMUX_PAD(0x4dc, 0x0d8, 5, 0x8a0, 0, NO_PAD_CTRL)
-#define MX35_PAD_NFWP_B__ARM11P_TOP_TRCTL                      IOMUX_PAD(0x4dc, 0x0d8, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_NFRB__EMI_NANDF_RB                            IOMUX_PAD(0x4e0, 0x0dc, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NFRB__IPU_DISPB_RD                            IOMUX_PAD(0x4e0, 0x0dc, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_NFRB__GPIO2_23                                        IOMUX_PAD(0x4e0, 0x0dc, 5, 0x8a4, 0, NO_PAD_CTRL)
-#define MX35_PAD_NFRB__ARM11P_TOP_TRCLK                                IOMUX_PAD(0x4e0, 0x0dc, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D15__EMI_EIM_D_15                             IOMUX_PAD(0x4e4, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D14__EMI_EIM_D_14                             IOMUX_PAD(0x4e8, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D13__EMI_EIM_D_13                             IOMUX_PAD(0x4ec, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D12__EMI_EIM_D_12                             IOMUX_PAD(0x4f0, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D11__EMI_EIM_D_11                             IOMUX_PAD(0x4f4, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D10__EMI_EIM_D_10                             IOMUX_PAD(0x4f8, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D9__EMI_EIM_D_9                               IOMUX_PAD(0x4fc, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D8__EMI_EIM_D_8                               IOMUX_PAD(0x500, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D7__EMI_EIM_D_7                               IOMUX_PAD(0x504, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D6__EMI_EIM_D_6                               IOMUX_PAD(0x508, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D5__EMI_EIM_D_5                               IOMUX_PAD(0x50c, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D4__EMI_EIM_D_4                               IOMUX_PAD(0x510, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D3__EMI_EIM_D_3                               IOMUX_PAD(0x514, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D2__EMI_EIM_D_2                               IOMUX_PAD(0x518, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D1__EMI_EIM_D_1                               IOMUX_PAD(0x51c, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D0__EMI_EIM_D_0                               IOMUX_PAD(0x520, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSI_D8__IPU_CSI_D_8                           IOMUX_PAD(0x524, 0x0e0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D8__KPP_COL_0                             IOMUX_PAD(0x524, 0x0e0, 1, 0x950, 0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D8__GPIO1_20                              IOMUX_PAD(0x524, 0x0e0, 5, 0x83c, 1, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D8__ARM11P_TOP_EVNTBUS_13                 IOMUX_PAD(0x524, 0x0e0, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSI_D9__IPU_CSI_D_9                           IOMUX_PAD(0x528, 0x0e4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D9__KPP_COL_1                             IOMUX_PAD(0x528, 0x0e4, 1, 0x954, 0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D9__GPIO1_21                              IOMUX_PAD(0x528, 0x0e4, 5, 0x840, 1, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D9__ARM11P_TOP_EVNTBUS_14                 IOMUX_PAD(0x528, 0x0e4, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSI_D10__IPU_CSI_D_10                         IOMUX_PAD(0x52c, 0x0e8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D10__KPP_COL_2                            IOMUX_PAD(0x52c, 0x0e8, 1, 0x958, 0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D10__GPIO1_22                             IOMUX_PAD(0x52c, 0x0e8, 5, 0x844, 1, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D10__ARM11P_TOP_EVNTBUS_15                        IOMUX_PAD(0x52c, 0x0e8, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSI_D11__IPU_CSI_D_11                         IOMUX_PAD(0x530, 0x0ec, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D11__KPP_COL_3                            IOMUX_PAD(0x530, 0x0ec, 1, 0x95c, 0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D11__GPIO1_23                             IOMUX_PAD(0x530, 0x0ec, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSI_D12__IPU_CSI_D_12                         IOMUX_PAD(0x534, 0x0f0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D12__KPP_ROW_0                            IOMUX_PAD(0x534, 0x0f0, 1, 0x970, 0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D12__GPIO1_24                             IOMUX_PAD(0x534, 0x0f0, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSI_D13__IPU_CSI_D_13                         IOMUX_PAD(0x538, 0x0f4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D13__KPP_ROW_1                            IOMUX_PAD(0x538, 0x0f4, 1, 0x974, 0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D13__GPIO1_25                             IOMUX_PAD(0x538, 0x0f4, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSI_D14__IPU_CSI_D_14                         IOMUX_PAD(0x53c, 0x0f8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D14__KPP_ROW_2                            IOMUX_PAD(0x53c, 0x0f8, 1, 0x978, 0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D14__GPIO1_26                             IOMUX_PAD(0x53c, 0x0f8, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSI_D15__IPU_CSI_D_15                         IOMUX_PAD(0x540, 0x0fc, 0, 0x97c, 0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D15__KPP_ROW_3                            IOMUX_PAD(0x540, 0x0fc, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_D15__GPIO1_27                             IOMUX_PAD(0x540, 0x0fc, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSI_MCLK__IPU_CSI_MCLK                                IOMUX_PAD(0x544, 0x100, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_MCLK__GPIO1_28                            IOMUX_PAD(0x544, 0x100, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC                      IOMUX_PAD(0x548, 0x104, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_VSYNC__GPIO1_29                           IOMUX_PAD(0x548, 0x104, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSI_HSYNC__IPU_CSI_HSYNC                      IOMUX_PAD(0x54c, 0x108, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_HSYNC__GPIO1_30                           IOMUX_PAD(0x54c, 0x108, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK                    IOMUX_PAD(0x550, 0x10c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSI_PIXCLK__GPIO1_31                          IOMUX_PAD(0x550, 0x10c, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_I2C1_CLK__I2C1_SCL                            IOMUX_PAD(0x554, 0x110, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_I2C1_CLK__GPIO2_24                            IOMUX_PAD(0x554, 0x110, 5, 0x8a8, 0, NO_PAD_CTRL)
-#define MX35_PAD_I2C1_CLK__CCM_USB_BYP_CLK                     IOMUX_PAD(0x554, 0x110, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_I2C1_DAT__I2C1_SDA                            IOMUX_PAD(0x558, 0x114, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_I2C1_DAT__GPIO2_25                            IOMUX_PAD(0x558, 0x114, 5, 0x8ac, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_I2C2_CLK__I2C2_SCL                            IOMUX_PAD(0x55c, 0x118, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_I2C2_CLK__CAN1_TXCAN                          IOMUX_PAD(0x55c, 0x118, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR                   IOMUX_PAD(0x55c, 0x118, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_I2C2_CLK__GPIO2_26                            IOMUX_PAD(0x55c, 0x118, 5, 0x8b0, 0, NO_PAD_CTRL)
-#define MX35_PAD_I2C2_CLK__SDMA_DEBUG_BUS_DEVICE_2             IOMUX_PAD(0x55c, 0x118, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_I2C2_DAT__I2C2_SDA                            IOMUX_PAD(0x560, 0x11c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_I2C2_DAT__CAN1_RXCAN                          IOMUX_PAD(0x560, 0x11c, 1, 0x7c8, 0, NO_PAD_CTRL)
-#define MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC                    IOMUX_PAD(0x560, 0x11c, 2, 0x9f4, 0, NO_PAD_CTRL)
-#define MX35_PAD_I2C2_DAT__GPIO2_27                            IOMUX_PAD(0x560, 0x11c, 5, 0x8b4, 0, NO_PAD_CTRL)
-#define MX35_PAD_I2C2_DAT__SDMA_DEBUG_BUS_DEVICE_3             IOMUX_PAD(0x560, 0x11c, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_STXD4__AUDMUX_AUD4_TXD                                IOMUX_PAD(0x564, 0x120, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_STXD4__GPIO2_28                               IOMUX_PAD(0x564, 0x120, 5, 0x8b8, 0, NO_PAD_CTRL)
-#define MX35_PAD_STXD4__ARM11P_TOP_ARM_COREASID0               IOMUX_PAD(0x564, 0x120, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SRXD4__AUDMUX_AUD4_RXD                                IOMUX_PAD(0x568, 0x124, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SRXD4__GPIO2_29                               IOMUX_PAD(0x568, 0x124, 5, 0x8bc, 0, NO_PAD_CTRL)
-#define MX35_PAD_SRXD4__ARM11P_TOP_ARM_COREASID1               IOMUX_PAD(0x568, 0x124, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SCK4__AUDMUX_AUD4_TXC                         IOMUX_PAD(0x56c, 0x128, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SCK4__GPIO2_30                                        IOMUX_PAD(0x56c, 0x128, 5, 0x8c4, 0, NO_PAD_CTRL)
-#define MX35_PAD_SCK4__ARM11P_TOP_ARM_COREASID2                        IOMUX_PAD(0x56c, 0x128, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS                      IOMUX_PAD(0x570, 0x12c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_STXFS4__GPIO2_31                              IOMUX_PAD(0x570, 0x12c, 5, 0x8c8, 0, NO_PAD_CTRL)
-#define MX35_PAD_STXFS4__ARM11P_TOP_ARM_COREASID3              IOMUX_PAD(0x570, 0x12c, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_STXD5__AUDMUX_AUD5_TXD                                IOMUX_PAD(0x574, 0x130, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_STXD5__SPDIF_SPDIF_OUT1                       IOMUX_PAD(0x574, 0x130, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_STXD5__CSPI2_MOSI                             IOMUX_PAD(0x574, 0x130, 2, 0x7ec, 0, NO_PAD_CTRL)
-#define MX35_PAD_STXD5__GPIO1_0                                        IOMUX_PAD(0x574, 0x130, 5, 0x82c, 1, NO_PAD_CTRL)
-#define MX35_PAD_STXD5__ARM11P_TOP_ARM_COREASID4               IOMUX_PAD(0x574, 0x130, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SRXD5__AUDMUX_AUD5_RXD                                IOMUX_PAD(0x578, 0x134, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SRXD5__SPDIF_SPDIF_IN1                                IOMUX_PAD(0x578, 0x134, 1, 0x998, 0, NO_PAD_CTRL)
-#define MX35_PAD_SRXD5__CSPI2_MISO                             IOMUX_PAD(0x578, 0x134, 2, 0x7e8, 0, NO_PAD_CTRL)
-#define MX35_PAD_SRXD5__GPIO1_1                                        IOMUX_PAD(0x578, 0x134, 5, 0x838, 1, NO_PAD_CTRL)
-#define MX35_PAD_SRXD5__ARM11P_TOP_ARM_COREASID5               IOMUX_PAD(0x578, 0x134, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SCK5__AUDMUX_AUD5_TXC                         IOMUX_PAD(0x57c, 0x138, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SCK5__SPDIF_SPDIF_EXTCLK                      IOMUX_PAD(0x57c, 0x138, 1, 0x994, 0, NO_PAD_CTRL)
-#define MX35_PAD_SCK5__CSPI2_SCLK                              IOMUX_PAD(0x57c, 0x138, 2, 0x7e0, 0, NO_PAD_CTRL)
-#define MX35_PAD_SCK5__GPIO1_2                                 IOMUX_PAD(0x57c, 0x138, 5, 0x848, 0, NO_PAD_CTRL)
-#define MX35_PAD_SCK5__ARM11P_TOP_ARM_COREASID6                        IOMUX_PAD(0x57c, 0x138, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_STXFS5__AUDMUX_AUD5_TXFS                      IOMUX_PAD(0x580, 0x13c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_STXFS5__CSPI2_RDY                             IOMUX_PAD(0x580, 0x13c, 2, 0x7e4, 0, NO_PAD_CTRL)
-#define MX35_PAD_STXFS5__GPIO1_3                               IOMUX_PAD(0x580, 0x13c, 5, 0x84c, 0, NO_PAD_CTRL)
-#define MX35_PAD_STXFS5__ARM11P_TOP_ARM_COREASID7              IOMUX_PAD(0x580, 0x13c, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SCKR__ESAI_SCKR                               IOMUX_PAD(0x584, 0x140, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SCKR__GPIO1_4                                 IOMUX_PAD(0x584, 0x140, 5, 0x850, 1, NO_PAD_CTRL)
-#define MX35_PAD_SCKR__ARM11P_TOP_EVNTBUS_10                   IOMUX_PAD(0x584, 0x140, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FSR__ESAI_FSR                                 IOMUX_PAD(0x588, 0x144, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FSR__GPIO1_5                                  IOMUX_PAD(0x588, 0x144, 5, 0x854, 1, NO_PAD_CTRL)
-#define MX35_PAD_FSR__ARM11P_TOP_EVNTBUS_11                    IOMUX_PAD(0x588, 0x144, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_HCKR__ESAI_HCKR                               IOMUX_PAD(0x58c, 0x148, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_HCKR__AUDMUX_AUD5_RXFS                                IOMUX_PAD(0x58c, 0x148, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_HCKR__CSPI2_SS0                               IOMUX_PAD(0x58c, 0x148, 2, 0x7f0, 0, NO_PAD_CTRL)
-#define MX35_PAD_HCKR__IPU_FLASH_STROBE                                IOMUX_PAD(0x58c, 0x148, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_HCKR__GPIO1_6                                 IOMUX_PAD(0x58c, 0x148, 5, 0x858, 1, NO_PAD_CTRL)
-#define MX35_PAD_HCKR__ARM11P_TOP_EVNTBUS_12                   IOMUX_PAD(0x58c, 0x148, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SCKT__ESAI_SCKT                               IOMUX_PAD(0x590, 0x14c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SCKT__GPIO1_7                                 IOMUX_PAD(0x590, 0x14c, 5, 0x85c, 1, NO_PAD_CTRL)
-#define MX35_PAD_SCKT__IPU_CSI_D_0                             IOMUX_PAD(0x590, 0x14c, 6, 0x930, 0, NO_PAD_CTRL)
-#define MX35_PAD_SCKT__KPP_ROW_2                               IOMUX_PAD(0x590, 0x14c, 7, 0x978, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_FST__ESAI_FST                                 IOMUX_PAD(0x594, 0x150, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FST__GPIO1_8                                  IOMUX_PAD(0x594, 0x150, 5, 0x860, 1, NO_PAD_CTRL)
-#define MX35_PAD_FST__IPU_CSI_D_1                              IOMUX_PAD(0x594, 0x150, 6, 0x934, 0, NO_PAD_CTRL)
-#define MX35_PAD_FST__KPP_ROW_3                                        IOMUX_PAD(0x594, 0x150, 7, 0x97c, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_HCKT__ESAI_HCKT                               IOMUX_PAD(0x598, 0x154, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_HCKT__AUDMUX_AUD5_RXC                         IOMUX_PAD(0x598, 0x154, 1, 0x7a8, 0, NO_PAD_CTRL)
-#define MX35_PAD_HCKT__GPIO1_9                                 IOMUX_PAD(0x598, 0x154, 5, 0x864, 0, NO_PAD_CTRL)
-#define MX35_PAD_HCKT__IPU_CSI_D_2                             IOMUX_PAD(0x598, 0x154, 6, 0x938, 0, NO_PAD_CTRL)
-#define MX35_PAD_HCKT__KPP_COL_3                               IOMUX_PAD(0x598, 0x154, 7, 0x95c, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_TX5_RX0__ESAI_TX5_RX0                         IOMUX_PAD(0x59c, 0x158, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX5_RX0__AUDMUX_AUD4_RXC                      IOMUX_PAD(0x59c, 0x158, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX5_RX0__CSPI2_SS2                            IOMUX_PAD(0x59c, 0x158, 2, 0x7f8, 1, NO_PAD_CTRL)
-#define MX35_PAD_TX5_RX0__CAN2_TXCAN                           IOMUX_PAD(0x59c, 0x158, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX5_RX0__UART2_DTR                            IOMUX_PAD(0x59c, 0x158, 4, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX5_RX0__GPIO1_10                             IOMUX_PAD(0x59c, 0x158, 5, 0x830, 0, NO_PAD_CTRL)
-#define MX35_PAD_TX5_RX0__EMI_M3IF_CHOSEN_MASTER_0             IOMUX_PAD(0x59c, 0x158, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_TX4_RX1__ESAI_TX4_RX1                         IOMUX_PAD(0x5a0, 0x15c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX4_RX1__AUDMUX_AUD4_RXFS                     IOMUX_PAD(0x5a0, 0x15c, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX4_RX1__CSPI2_SS3                            IOMUX_PAD(0x5a0, 0x15c, 2, 0x7fc, 0, NO_PAD_CTRL)
-#define MX35_PAD_TX4_RX1__CAN2_RXCAN                           IOMUX_PAD(0x5a0, 0x15c, 3, 0x7cc, 0, NO_PAD_CTRL)
-#define MX35_PAD_TX4_RX1__UART2_DSR                            IOMUX_PAD(0x5a0, 0x15c, 4, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX4_RX1__GPIO1_11                             IOMUX_PAD(0x5a0, 0x15c, 5, 0x834, 0, NO_PAD_CTRL)
-#define MX35_PAD_TX4_RX1__IPU_CSI_D_3                          IOMUX_PAD(0x5a0, 0x15c, 6, 0x93c, 0, NO_PAD_CTRL)
-#define MX35_PAD_TX4_RX1__KPP_ROW_0                            IOMUX_PAD(0x5a0, 0x15c, 7, 0x970, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_TX3_RX2__ESAI_TX3_RX2                         IOMUX_PAD(0x5a4, 0x160, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX3_RX2__I2C3_SCL                             IOMUX_PAD(0x5a4, 0x160, 1, 0x91c, 0, NO_PAD_CTRL)
-#define MX35_PAD_TX3_RX2__EMI_NANDF_CE1                                IOMUX_PAD(0x5a4, 0x160, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX3_RX2__GPIO1_12                             IOMUX_PAD(0x5a4, 0x160, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX3_RX2__IPU_CSI_D_4                          IOMUX_PAD(0x5a4, 0x160, 6, 0x940, 0, NO_PAD_CTRL)
-#define MX35_PAD_TX3_RX2__KPP_ROW_1                            IOMUX_PAD(0x5a4, 0x160, 7, 0x974, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_TX2_RX3__ESAI_TX2_RX3                         IOMUX_PAD(0x5a8, 0x164, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX2_RX3__I2C3_SDA                             IOMUX_PAD(0x5a8, 0x164, 1, 0x920, 0, NO_PAD_CTRL)
-#define MX35_PAD_TX2_RX3__EMI_NANDF_CE2                                IOMUX_PAD(0x5a8, 0x164, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX2_RX3__GPIO1_13                             IOMUX_PAD(0x5a8, 0x164, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX2_RX3__IPU_CSI_D_5                          IOMUX_PAD(0x5a8, 0x164, 6, 0x944, 0, NO_PAD_CTRL)
-#define MX35_PAD_TX2_RX3__KPP_COL_0                            IOMUX_PAD(0x5a8, 0x164, 7, 0x950, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_TX1__ESAI_TX1                                 IOMUX_PAD(0x5ac, 0x168, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX1__CCM_PMIC_RDY                             IOMUX_PAD(0x5ac, 0x168, 1, 0x7d4, 1, NO_PAD_CTRL)
-#define MX35_PAD_TX1__CSPI1_SS2                                        IOMUX_PAD(0x5ac, 0x168, 2, 0x7d8, 2, NO_PAD_CTRL)
-#define MX35_PAD_TX1__EMI_NANDF_CE3                            IOMUX_PAD(0x5ac, 0x168, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX1__UART2_RI                                 IOMUX_PAD(0x5ac, 0x168, 4, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX1__GPIO1_14                                 IOMUX_PAD(0x5ac, 0x168, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX1__IPU_CSI_D_6                              IOMUX_PAD(0x5ac, 0x168, 6, 0x948, 0, NO_PAD_CTRL)
-#define MX35_PAD_TX1__KPP_COL_1                                        IOMUX_PAD(0x5ac, 0x168, 7, 0x954, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_TX0__ESAI_TX0                                 IOMUX_PAD(0x5b0, 0x16c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX0__SPDIF_SPDIF_EXTCLK                       IOMUX_PAD(0x5b0, 0x16c, 1, 0x994, 1, NO_PAD_CTRL)
-#define MX35_PAD_TX0__CSPI1_SS3                                        IOMUX_PAD(0x5b0, 0x16c, 2, 0x7dc, 0, NO_PAD_CTRL)
-#define MX35_PAD_TX0__EMI_DTACK_B                              IOMUX_PAD(0x5b0, 0x16c, 3, 0x800, 1, NO_PAD_CTRL)
-#define MX35_PAD_TX0__UART2_DCD                                        IOMUX_PAD(0x5b0, 0x16c, 4, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX0__GPIO1_15                                 IOMUX_PAD(0x5b0, 0x16c, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TX0__IPU_CSI_D_7                              IOMUX_PAD(0x5b0, 0x16c, 6, 0x94c, 0, NO_PAD_CTRL)
-#define MX35_PAD_TX0__KPP_COL_2                                        IOMUX_PAD(0x5b0, 0x16c, 7, 0x958, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_CSPI1_MOSI__CSPI1_MOSI                                IOMUX_PAD(0x5b4, 0x170, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_MOSI__GPIO1_16                          IOMUX_PAD(0x5b4, 0x170, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_MOSI__ECT_CTI_TRIG_OUT1_2               IOMUX_PAD(0x5b4, 0x170, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSPI1_MISO__CSPI1_MISO                                IOMUX_PAD(0x5b8, 0x174, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_MISO__GPIO1_17                          IOMUX_PAD(0x5b8, 0x174, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_MISO__ECT_CTI_TRIG_OUT1_3               IOMUX_PAD(0x5b8, 0x174, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSPI1_SS0__CSPI1_SS0                          IOMUX_PAD(0x5bc, 0x178, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SS0__OWIRE_LINE                         IOMUX_PAD(0x5bc, 0x178, 1, 0x990, 1, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SS0__CSPI2_SS3                          IOMUX_PAD(0x5bc, 0x178, 2, 0x7fc, 1, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SS0__GPIO1_18                           IOMUX_PAD(0x5bc, 0x178, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SS0__ECT_CTI_TRIG_OUT1_4                        IOMUX_PAD(0x5bc, 0x178, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSPI1_SS1__CSPI1_SS1                          IOMUX_PAD(0x5c0, 0x17c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SS1__PWM_PWMO                           IOMUX_PAD(0x5c0, 0x17c, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SS1__CCM_CLK32K                         IOMUX_PAD(0x5c0, 0x17c, 2, 0x7d0, 1, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SS1__GPIO1_19                           IOMUX_PAD(0x5c0, 0x17c, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SS1__IPU_DIAGB_29                       IOMUX_PAD(0x5c0, 0x17c, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SS1__ECT_CTI_TRIG_OUT1_5                        IOMUX_PAD(0x5c0, 0x17c, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSPI1_SCLK__CSPI1_SCLK                                IOMUX_PAD(0x5c4, 0x180, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SCLK__GPIO3_4                           IOMUX_PAD(0x5c4, 0x180, 5, 0x904, 0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SCLK__IPU_DIAGB_30                      IOMUX_PAD(0x5c4, 0x180, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SCLK__EMI_M3IF_CHOSEN_MASTER_1          IOMUX_PAD(0x5c4, 0x180, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CSPI1_SPI_RDY__CSPI1_RDY                      IOMUX_PAD(0x5c8, 0x184, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SPI_RDY__GPIO3_5                                IOMUX_PAD(0x5c8, 0x184, 5, 0x908, 0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SPI_RDY__IPU_DIAGB_31                   IOMUX_PAD(0x5c8, 0x184, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CSPI1_SPI_RDY__EMI_M3IF_CHOSEN_MASTER_2       IOMUX_PAD(0x5c8, 0x184, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_RXD1__UART1_RXD_MUX                           IOMUX_PAD(0x5cc, 0x188, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_RXD1__CSPI2_MOSI                              IOMUX_PAD(0x5cc, 0x188, 1, 0x7ec, 1, NO_PAD_CTRL)
-#define MX35_PAD_RXD1__KPP_COL_4                               IOMUX_PAD(0x5cc, 0x188, 4, 0x960, 0, NO_PAD_CTRL)
-#define MX35_PAD_RXD1__GPIO3_6                                 IOMUX_PAD(0x5cc, 0x188, 5, 0x90c, 0, NO_PAD_CTRL)
-#define MX35_PAD_RXD1__ARM11P_TOP_EVNTBUS_16                   IOMUX_PAD(0x5cc, 0x188, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_TXD1__UART1_TXD_MUX                           IOMUX_PAD(0x5d0, 0x18c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TXD1__CSPI2_MISO                              IOMUX_PAD(0x5d0, 0x18c, 1, 0x7e8, 1, NO_PAD_CTRL)
-#define MX35_PAD_TXD1__KPP_COL_5                               IOMUX_PAD(0x5d0, 0x18c, 4, 0x964, 0, NO_PAD_CTRL)
-#define MX35_PAD_TXD1__GPIO3_7                                 IOMUX_PAD(0x5d0, 0x18c, 5, 0x910, 0, NO_PAD_CTRL)
-#define MX35_PAD_TXD1__ARM11P_TOP_EVNTBUS_17                   IOMUX_PAD(0x5d0, 0x18c, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_RTS1__UART1_RTS                               IOMUX_PAD(0x5d4, 0x190, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_RTS1__CSPI2_SCLK                              IOMUX_PAD(0x5d4, 0x190, 1, 0x7e0, 1, NO_PAD_CTRL)
-#define MX35_PAD_RTS1__I2C3_SCL                                        IOMUX_PAD(0x5d4, 0x190, 2, 0x91c, 1, NO_PAD_CTRL)
-#define MX35_PAD_RTS1__IPU_CSI_D_0                             IOMUX_PAD(0x5d4, 0x190, 3, 0x930, 1, NO_PAD_CTRL)
-#define MX35_PAD_RTS1__KPP_COL_6                               IOMUX_PAD(0x5d4, 0x190, 4, 0x968, 0, NO_PAD_CTRL)
-#define MX35_PAD_RTS1__GPIO3_8                                 IOMUX_PAD(0x5d4, 0x190, 5, 0x914, 0, NO_PAD_CTRL)
-#define MX35_PAD_RTS1__EMI_NANDF_CE1                           IOMUX_PAD(0x5d4, 0x190, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_RTS1__ARM11P_TOP_EVNTBUS_18                   IOMUX_PAD(0x5d4, 0x190, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CTS1__UART1_CTS                               IOMUX_PAD(0x5d8, 0x194, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CTS1__CSPI2_RDY                               IOMUX_PAD(0x5d8, 0x194, 1, 0x7e4, 1, NO_PAD_CTRL)
-#define MX35_PAD_CTS1__I2C3_SDA                                        IOMUX_PAD(0x5d8, 0x194, 2, 0x920, 1, NO_PAD_CTRL)
-#define MX35_PAD_CTS1__IPU_CSI_D_1                             IOMUX_PAD(0x5d8, 0x194, 3, 0x934, 1, NO_PAD_CTRL)
-#define MX35_PAD_CTS1__KPP_COL_7                               IOMUX_PAD(0x5d8, 0x194, 4, 0x96c, 0, NO_PAD_CTRL)
-#define MX35_PAD_CTS1__GPIO3_9                                 IOMUX_PAD(0x5d8, 0x194, 5, 0x918, 0, NO_PAD_CTRL)
-#define MX35_PAD_CTS1__EMI_NANDF_CE2                           IOMUX_PAD(0x5d8, 0x194, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CTS1__ARM11P_TOP_EVNTBUS_19                   IOMUX_PAD(0x5d8, 0x194, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_RXD2__UART2_RXD_MUX                           IOMUX_PAD(0x5dc, 0x198, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_RXD2__KPP_ROW_4                               IOMUX_PAD(0x5dc, 0x198, 4, 0x980, 0, NO_PAD_CTRL)
-#define MX35_PAD_RXD2__GPIO3_10                                        IOMUX_PAD(0x5dc, 0x198, 5, 0x8ec, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_TXD2__UART2_TXD_MUX                           IOMUX_PAD(0x5e0, 0x19c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_TXD2__SPDIF_SPDIF_EXTCLK                      IOMUX_PAD(0x5e0, 0x19c, 1, 0x994, 2, NO_PAD_CTRL)
-#define MX35_PAD_TXD2__KPP_ROW_5                               IOMUX_PAD(0x5e0, 0x19c, 4, 0x984, 0, NO_PAD_CTRL)
-#define MX35_PAD_TXD2__GPIO3_11                                        IOMUX_PAD(0x5e0, 0x19c, 5, 0x8f0, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_RTS2__UART2_RTS                               IOMUX_PAD(0x5e4, 0x1a0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_RTS2__SPDIF_SPDIF_IN1                         IOMUX_PAD(0x5e4, 0x1a0, 1, 0x998, 1, NO_PAD_CTRL)
-#define MX35_PAD_RTS2__CAN2_RXCAN                              IOMUX_PAD(0x5e4, 0x1a0, 2, 0x7cc, 1, NO_PAD_CTRL)
-#define MX35_PAD_RTS2__IPU_CSI_D_2                             IOMUX_PAD(0x5e4, 0x1a0, 3, 0x938, 1, NO_PAD_CTRL)
-#define MX35_PAD_RTS2__KPP_ROW_6                               IOMUX_PAD(0x5e4, 0x1a0, 4, 0x988, 0, NO_PAD_CTRL)
-#define MX35_PAD_RTS2__GPIO3_12                                        IOMUX_PAD(0x5e4, 0x1a0, 5, 0x8f4, 0, NO_PAD_CTRL)
-#define MX35_PAD_RTS2__AUDMUX_AUD5_RXC                         IOMUX_PAD(0x5e4, 0x1a0, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_RTS2__UART3_RXD_MUX                           IOMUX_PAD(0x5e4, 0x1a0, 7, 0x9a0, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_CTS2__UART2_CTS                               IOMUX_PAD(0x5e8, 0x1a4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CTS2__SPDIF_SPDIF_OUT1                                IOMUX_PAD(0x5e8, 0x1a4, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CTS2__CAN2_TXCAN                              IOMUX_PAD(0x5e8, 0x1a4, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CTS2__IPU_CSI_D_3                             IOMUX_PAD(0x5e8, 0x1a4, 3, 0x93c, 1, NO_PAD_CTRL)
-#define MX35_PAD_CTS2__KPP_ROW_7                               IOMUX_PAD(0x5e8, 0x1a4, 4, 0x98c, 0, NO_PAD_CTRL)
-#define MX35_PAD_CTS2__GPIO3_13                                        IOMUX_PAD(0x5e8, 0x1a4, 5, 0x8f8, 0, NO_PAD_CTRL)
-#define MX35_PAD_CTS2__AUDMUX_AUD5_RXFS                                IOMUX_PAD(0x5e8, 0x1a4, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CTS2__UART3_TXD_MUX                           IOMUX_PAD(0x5e8, 0x1a4, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_RTCK__ARM11P_TOP_RTCK                         IOMUX_PAD(0x5ec, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_TCK__SJC_TCK                                  IOMUX_PAD(0x5f0, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_TMS__SJC_TMS                                  IOMUX_PAD(0x5f4, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_TDI__SJC_TDI                                  IOMUX_PAD(0x5f8, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_TDO__SJC_TDO                                  IOMUX_PAD(0x5fc, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_TRSTB__SJC_TRSTB                              IOMUX_PAD(0x600, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_DE_B__SJC_DE_B                                        IOMUX_PAD(0x604, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SJC_MOD__SJC_MOD                              IOMUX_PAD(0x608, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_USBOTG_PWR__USB_TOP_USBOTG_PWR                        IOMUX_PAD(0x60c, 0x1a8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_USBOTG_PWR__USB_TOP_USBH2_PWR                 IOMUX_PAD(0x60c, 0x1a8, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_USBOTG_PWR__GPIO3_14                          IOMUX_PAD(0x60c, 0x1a8, 5, 0x8fc, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_USBOTG_OC__USB_TOP_USBOTG_OC                  IOMUX_PAD(0x610, 0x1ac, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_USBOTG_OC__USB_TOP_USBH2_OC                   IOMUX_PAD(0x610, 0x1ac, 1, 0x9f4, 1, NO_PAD_CTRL)
-#define MX35_PAD_USBOTG_OC__GPIO3_15                           IOMUX_PAD(0x610, 0x1ac, 5, 0x900, 0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD0__IPU_DISPB_DAT_0                          IOMUX_PAD(0x614, 0x1b0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD0__GPIO2_0                                  IOMUX_PAD(0x614, 0x1b0, 5, 0x868, 1, NO_PAD_CTRL)
-#define MX35_PAD_LD0__SDMA_SDMA_DEBUG_PC_0                     IOMUX_PAD(0x614, 0x1b0, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD1__IPU_DISPB_DAT_1                          IOMUX_PAD(0x618, 0x1b4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD1__GPIO2_1                                  IOMUX_PAD(0x618, 0x1b4, 5, 0x894, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD1__SDMA_SDMA_DEBUG_PC_1                     IOMUX_PAD(0x618, 0x1b4, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD2__IPU_DISPB_DAT_2                          IOMUX_PAD(0x61c, 0x1b8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD2__GPIO2_2                                  IOMUX_PAD(0x61c, 0x1b8, 5, 0x8c0, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD2__SDMA_SDMA_DEBUG_PC_2                     IOMUX_PAD(0x61c, 0x1b8, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD3__IPU_DISPB_DAT_3                          IOMUX_PAD(0x620, 0x1bc, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD3__GPIO2_3                                  IOMUX_PAD(0x620, 0x1bc, 5, 0x8cc, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD3__SDMA_SDMA_DEBUG_PC_3                     IOMUX_PAD(0x620, 0x1bc, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD4__IPU_DISPB_DAT_4                          IOMUX_PAD(0x624, 0x1c0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD4__GPIO2_4                                  IOMUX_PAD(0x624, 0x1c0, 5, 0x8d0, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD4__SDMA_SDMA_DEBUG_PC_4                     IOMUX_PAD(0x624, 0x1c0, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD5__IPU_DISPB_DAT_5                          IOMUX_PAD(0x628, 0x1c4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD5__GPIO2_5                                  IOMUX_PAD(0x628, 0x1c4, 5, 0x8d4, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD5__SDMA_SDMA_DEBUG_PC_5                     IOMUX_PAD(0x628, 0x1c4, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD6__IPU_DISPB_DAT_6                          IOMUX_PAD(0x62c, 0x1c8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD6__GPIO2_6                                  IOMUX_PAD(0x62c, 0x1c8, 5, 0x8d8, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD6__SDMA_SDMA_DEBUG_PC_6                     IOMUX_PAD(0x62c, 0x1c8, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD7__IPU_DISPB_DAT_7                          IOMUX_PAD(0x630, 0x1cc, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD7__GPIO2_7                                  IOMUX_PAD(0x630, 0x1cc, 5, 0x8dc, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD7__SDMA_SDMA_DEBUG_PC_7                     IOMUX_PAD(0x630, 0x1cc, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD8__IPU_DISPB_DAT_8                          IOMUX_PAD(0x634, 0x1d0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD8__GPIO2_8                                  IOMUX_PAD(0x634, 0x1d0, 5, 0x8e0, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD8__SDMA_SDMA_DEBUG_PC_8                     IOMUX_PAD(0x634, 0x1d0, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD9__IPU_DISPB_DAT_9                          IOMUX_PAD(0x638, 0x1d4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD9__GPIO2_9                                  IOMUX_PAD(0x638, 0x1d4, 5, 0x8e4, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD9__SDMA_SDMA_DEBUG_PC_9                     IOMUX_PAD(0x638, 0x1d4, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD10__IPU_DISPB_DAT_10                                IOMUX_PAD(0x63c, 0x1d8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD10__GPIO2_10                                        IOMUX_PAD(0x63c, 0x1d8, 5, 0x86c, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD10__SDMA_SDMA_DEBUG_PC_10                   IOMUX_PAD(0x63c, 0x1d8, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD11__IPU_DISPB_DAT_11                                IOMUX_PAD(0x640, 0x1dc, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD11__GPIO2_11                                        IOMUX_PAD(0x640, 0x1dc, 5, 0x870, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD11__SDMA_SDMA_DEBUG_PC_11                   IOMUX_PAD(0x640, 0x1dc, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD11__ARM11P_TOP_TRACE_4                      IOMUX_PAD(0x640, 0x1dc, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD12__IPU_DISPB_DAT_12                                IOMUX_PAD(0x644, 0x1e0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD12__GPIO2_12                                        IOMUX_PAD(0x644, 0x1e0, 5, 0x874, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD12__SDMA_SDMA_DEBUG_PC_12                   IOMUX_PAD(0x644, 0x1e0, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD12__ARM11P_TOP_TRACE_5                      IOMUX_PAD(0x644, 0x1e0, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD13__IPU_DISPB_DAT_13                                IOMUX_PAD(0x648, 0x1e4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD13__GPIO2_13                                        IOMUX_PAD(0x648, 0x1e4, 5, 0x878, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD13__SDMA_SDMA_DEBUG_PC_13                   IOMUX_PAD(0x648, 0x1e4, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD13__ARM11P_TOP_TRACE_6                      IOMUX_PAD(0x648, 0x1e4, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD14__IPU_DISPB_DAT_14                                IOMUX_PAD(0x64c, 0x1e8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD14__GPIO2_14                                        IOMUX_PAD(0x64c, 0x1e8, 5, 0x87c, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD14__SDMA_SDMA_DEBUG_EVENT_CHANNEL_0         IOMUX_PAD(0x64c, 0x1e8, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD14__ARM11P_TOP_TRACE_7                      IOMUX_PAD(0x64c, 0x1e8, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD15__IPU_DISPB_DAT_15                                IOMUX_PAD(0x650, 0x1ec, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD15__GPIO2_15                                        IOMUX_PAD(0x650, 0x1ec, 5, 0x880, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD15__SDMA_SDMA_DEBUG_EVENT_CHANNEL_1         IOMUX_PAD(0x650, 0x1ec, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD15__ARM11P_TOP_TRACE_8                      IOMUX_PAD(0x650, 0x1ec, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD16__IPU_DISPB_DAT_16                                IOMUX_PAD(0x654, 0x1f0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD16__IPU_DISPB_D12_VSYNC                     IOMUX_PAD(0x654, 0x1f0, 2, 0x928, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD16__GPIO2_16                                        IOMUX_PAD(0x654, 0x1f0, 5, 0x884, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD16__SDMA_SDMA_DEBUG_EVENT_CHANNEL_2         IOMUX_PAD(0x654, 0x1f0, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD16__ARM11P_TOP_TRACE_9                      IOMUX_PAD(0x654, 0x1f0, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD17__IPU_DISPB_DAT_17                                IOMUX_PAD(0x658, 0x1f4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD17__IPU_DISPB_CS2                           IOMUX_PAD(0x658, 0x1f4, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD17__GPIO2_17                                        IOMUX_PAD(0x658, 0x1f4, 5, 0x888, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD17__SDMA_SDMA_DEBUG_EVENT_CHANNEL_3         IOMUX_PAD(0x658, 0x1f4, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD17__ARM11P_TOP_TRACE_10                     IOMUX_PAD(0x658, 0x1f4, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD18__IPU_DISPB_DAT_18                                IOMUX_PAD(0x65c, 0x1f8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD18__IPU_DISPB_D0_VSYNC                      IOMUX_PAD(0x65c, 0x1f8, 1, 0x924, 1, NO_PAD_CTRL)
-#define MX35_PAD_LD18__IPU_DISPB_D12_VSYNC                     IOMUX_PAD(0x65c, 0x1f8, 2, 0x928, 1, NO_PAD_CTRL)
-#define MX35_PAD_LD18__ESDHC3_CMD                              IOMUX_PAD(0x65c, 0x1f8, 3, 0x818, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD18__USB_TOP_USBOTG_DATA_3                   IOMUX_PAD(0x65c, 0x1f8, 4, 0x9b0, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD18__GPIO3_24                                        IOMUX_PAD(0x65c, 0x1f8, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD18__SDMA_SDMA_DEBUG_EVENT_CHANNEL_4         IOMUX_PAD(0x65c, 0x1f8, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD18__ARM11P_TOP_TRACE_11                     IOMUX_PAD(0x65c, 0x1f8, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD19__IPU_DISPB_DAT_19                                IOMUX_PAD(0x660, 0x1fc, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD19__IPU_DISPB_BCLK                          IOMUX_PAD(0x660, 0x1fc, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD19__IPU_DISPB_CS1                           IOMUX_PAD(0x660, 0x1fc, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD19__ESDHC3_CLK                              IOMUX_PAD(0x660, 0x1fc, 3, 0x814, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD19__USB_TOP_USBOTG_DIR                      IOMUX_PAD(0x660, 0x1fc, 4, 0x9c4, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD19__GPIO3_25                                        IOMUX_PAD(0x660, 0x1fc, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD19__SDMA_SDMA_DEBUG_EVENT_CHANNEL_5         IOMUX_PAD(0x660, 0x1fc, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD19__ARM11P_TOP_TRACE_12                     IOMUX_PAD(0x660, 0x1fc, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD20__IPU_DISPB_DAT_20                                IOMUX_PAD(0x664, 0x200, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD20__IPU_DISPB_CS0                           IOMUX_PAD(0x664, 0x200, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD20__IPU_DISPB_SD_CLK                                IOMUX_PAD(0x664, 0x200, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD20__ESDHC3_DAT0                             IOMUX_PAD(0x664, 0x200, 3, 0x81c, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD20__GPIO3_26                                        IOMUX_PAD(0x664, 0x200, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD20__SDMA_SDMA_DEBUG_CORE_STATUS_3           IOMUX_PAD(0x664, 0x200, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD20__ARM11P_TOP_TRACE_13                     IOMUX_PAD(0x664, 0x200, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD21__IPU_DISPB_DAT_21                                IOMUX_PAD(0x668, 0x204, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD21__IPU_DISPB_PAR_RS                                IOMUX_PAD(0x668, 0x204, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD21__IPU_DISPB_SER_RS                                IOMUX_PAD(0x668, 0x204, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD21__ESDHC3_DAT1                             IOMUX_PAD(0x668, 0x204, 3, 0x820, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD21__USB_TOP_USBOTG_STP                      IOMUX_PAD(0x668, 0x204, 4, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD21__GPIO3_27                                        IOMUX_PAD(0x668, 0x204, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD21__SDMA_DEBUG_EVENT_CHANNEL_SEL            IOMUX_PAD(0x668, 0x204, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD21__ARM11P_TOP_TRACE_14                     IOMUX_PAD(0x668, 0x204, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD22__IPU_DISPB_DAT_22                                IOMUX_PAD(0x66c, 0x208, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD22__IPU_DISPB_WR                            IOMUX_PAD(0x66c, 0x208, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD22__IPU_DISPB_SD_D_I                                IOMUX_PAD(0x66c, 0x208, 2, 0x92c, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD22__ESDHC3_DAT2                             IOMUX_PAD(0x66c, 0x208, 3, 0x824, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD22__USB_TOP_USBOTG_NXT                      IOMUX_PAD(0x66c, 0x208, 4, 0x9c8, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD22__GPIO3_28                                        IOMUX_PAD(0x66c, 0x208, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD22__SDMA_DEBUG_BUS_ERROR                    IOMUX_PAD(0x66c, 0x208, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD22__ARM11P_TOP_TRCTL                                IOMUX_PAD(0x66c, 0x208, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_LD23__IPU_DISPB_DAT_23                                IOMUX_PAD(0x670, 0x20c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD23__IPU_DISPB_RD                            IOMUX_PAD(0x670, 0x20c, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD23__IPU_DISPB_SD_D_IO                       IOMUX_PAD(0x670, 0x20c, 2, 0x92c, 1, NO_PAD_CTRL)
-#define MX35_PAD_LD23__ESDHC3_DAT3                             IOMUX_PAD(0x670, 0x20c, 3, 0x828, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD23__USB_TOP_USBOTG_DATA_7                   IOMUX_PAD(0x670, 0x20c, 4, 0x9c0, 0, NO_PAD_CTRL)
-#define MX35_PAD_LD23__GPIO3_29                                        IOMUX_PAD(0x670, 0x20c, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD23__SDMA_DEBUG_MATCHED_DMBUS                        IOMUX_PAD(0x670, 0x20c, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_LD23__ARM11P_TOP_TRCLK                                IOMUX_PAD(0x670, 0x20c, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC                  IOMUX_PAD(0x674, 0x210, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_HSYNC__IPU_DISPB_SD_D_IO                   IOMUX_PAD(0x674, 0x210, 2, 0x92c, 2, NO_PAD_CTRL)
-#define MX35_PAD_D3_HSYNC__GPIO3_30                            IOMUX_PAD(0x674, 0x210, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_HSYNC__SDMA_DEBUG_RTBUFFER_WRITE           IOMUX_PAD(0x674, 0x210, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_HSYNC__ARM11P_TOP_TRACE_15                 IOMUX_PAD(0x674, 0x210, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK                  IOMUX_PAD(0x678, 0x214, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_FPSHIFT__IPU_DISPB_SD_CLK                  IOMUX_PAD(0x678, 0x214, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_FPSHIFT__GPIO3_31                          IOMUX_PAD(0x678, 0x214, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_FPSHIFT__SDMA_SDMA_DEBUG_CORE_STATUS_0     IOMUX_PAD(0x678, 0x214, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_FPSHIFT__ARM11P_TOP_TRACE_16               IOMUX_PAD(0x678, 0x214, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY                    IOMUX_PAD(0x67c, 0x218, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_DRDY__IPU_DISPB_SD_D_O                     IOMUX_PAD(0x67c, 0x218, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_DRDY__GPIO1_0                              IOMUX_PAD(0x67c, 0x218, 5, 0x82c, 2, NO_PAD_CTRL)
-#define MX35_PAD_D3_DRDY__SDMA_SDMA_DEBUG_CORE_STATUS_1                IOMUX_PAD(0x67c, 0x218, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_DRDY__ARM11P_TOP_TRACE_17                  IOMUX_PAD(0x67c, 0x218, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_CONTRAST__IPU_DISPB_CONTR                     IOMUX_PAD(0x680, 0x21c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CONTRAST__GPIO1_1                             IOMUX_PAD(0x680, 0x21c, 5, 0x838, 2, NO_PAD_CTRL)
-#define MX35_PAD_CONTRAST__SDMA_SDMA_DEBUG_CORE_STATUS_2       IOMUX_PAD(0x680, 0x21c, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_CONTRAST__ARM11P_TOP_TRACE_18                 IOMUX_PAD(0x680, 0x21c, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC                  IOMUX_PAD(0x684, 0x220, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_VSYNC__IPU_DISPB_CS1                       IOMUX_PAD(0x684, 0x220, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_VSYNC__GPIO1_2                             IOMUX_PAD(0x684, 0x220, 5, 0x848, 1, NO_PAD_CTRL)
-#define MX35_PAD_D3_VSYNC__SDMA_DEBUG_YIELD                    IOMUX_PAD(0x684, 0x220, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_VSYNC__ARM11P_TOP_TRACE_19                 IOMUX_PAD(0x684, 0x220, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D3_REV__IPU_DISPB_D3_REV                      IOMUX_PAD(0x688, 0x224, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_REV__IPU_DISPB_SER_RS                      IOMUX_PAD(0x688, 0x224, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_REV__GPIO1_3                               IOMUX_PAD(0x688, 0x224, 5, 0x84c, 1, NO_PAD_CTRL)
-#define MX35_PAD_D3_REV__SDMA_DEBUG_BUS_RWB                    IOMUX_PAD(0x688, 0x224, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_REV__ARM11P_TOP_TRACE_20                   IOMUX_PAD(0x688, 0x224, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS                      IOMUX_PAD(0x68c, 0x228, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_CLS__IPU_DISPB_CS2                         IOMUX_PAD(0x68c, 0x228, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_CLS__GPIO1_4                               IOMUX_PAD(0x68c, 0x228, 5, 0x850, 2, NO_PAD_CTRL)
-#define MX35_PAD_D3_CLS__SDMA_DEBUG_BUS_DEVICE_0               IOMUX_PAD(0x68c, 0x228, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_CLS__ARM11P_TOP_TRACE_21                   IOMUX_PAD(0x68c, 0x228, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_D3_SPL__IPU_DISPB_D3_SPL                      IOMUX_PAD(0x690, 0x22c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_SPL__IPU_DISPB_D12_VSYNC                   IOMUX_PAD(0x690, 0x22c, 2, 0x928, 2, NO_PAD_CTRL)
-#define MX35_PAD_D3_SPL__GPIO1_5                               IOMUX_PAD(0x690, 0x22c, 5, 0x854, 2, NO_PAD_CTRL)
-#define MX35_PAD_D3_SPL__SDMA_DEBUG_BUS_DEVICE_1               IOMUX_PAD(0x690, 0x22c, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_D3_SPL__ARM11P_TOP_TRACE_22                   IOMUX_PAD(0x690, 0x22c, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD1_CMD__ESDHC1_CMD                           IOMUX_PAD(0x694, 0x230, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_CMD__MSHC_SCLK                            IOMUX_PAD(0x694, 0x230, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_CMD__IPU_DISPB_D0_VSYNC                   IOMUX_PAD(0x694, 0x230, 3, 0x924, 2, NO_PAD_CTRL)
-#define MX35_PAD_SD1_CMD__USB_TOP_USBOTG_DATA_4                        IOMUX_PAD(0x694, 0x230, 4, 0x9b4, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_CMD__GPIO1_6                              IOMUX_PAD(0x694, 0x230, 5, 0x858, 2, NO_PAD_CTRL)
-#define MX35_PAD_SD1_CMD__ARM11P_TOP_TRCTL                     IOMUX_PAD(0x694, 0x230, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD1_CLK__ESDHC1_CLK                           IOMUX_PAD(0x698, 0x234, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_CLK__MSHC_BS                              IOMUX_PAD(0x698, 0x234, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_CLK__IPU_DISPB_BCLK                       IOMUX_PAD(0x698, 0x234, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_CLK__USB_TOP_USBOTG_DATA_5                        IOMUX_PAD(0x698, 0x234, 4, 0x9b8, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_CLK__GPIO1_7                              IOMUX_PAD(0x698, 0x234, 5, 0x85c, 2, NO_PAD_CTRL)
-#define MX35_PAD_SD1_CLK__ARM11P_TOP_TRCLK                     IOMUX_PAD(0x698, 0x234, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD1_DATA0__ESDHC1_DAT0                                IOMUX_PAD(0x69c, 0x238, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA0__MSHC_DATA_0                                IOMUX_PAD(0x69c, 0x238, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA0__IPU_DISPB_CS0                      IOMUX_PAD(0x69c, 0x238, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA0__USB_TOP_USBOTG_DATA_6              IOMUX_PAD(0x69c, 0x238, 4, 0x9bc, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA0__GPIO1_8                            IOMUX_PAD(0x69c, 0x238, 5, 0x860, 2, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA0__ARM11P_TOP_TRACE_23                        IOMUX_PAD(0x69c, 0x238, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD1_DATA1__ESDHC1_DAT1                                IOMUX_PAD(0x6a0, 0x23c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA1__MSHC_DATA_1                                IOMUX_PAD(0x6a0, 0x23c, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA1__IPU_DISPB_PAR_RS                   IOMUX_PAD(0x6a0, 0x23c, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA1__USB_TOP_USBOTG_DATA_0              IOMUX_PAD(0x6a0, 0x23c, 4, 0x9a4, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA1__GPIO1_9                            IOMUX_PAD(0x6a0, 0x23c, 5, 0x864, 1, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA1__ARM11P_TOP_TRACE_24                        IOMUX_PAD(0x6a0, 0x23c, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD1_DATA2__ESDHC1_DAT2                                IOMUX_PAD(0x6a4, 0x240, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA2__MSHC_DATA_2                                IOMUX_PAD(0x6a4, 0x240, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA2__IPU_DISPB_WR                       IOMUX_PAD(0x6a4, 0x240, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA2__USB_TOP_USBOTG_DATA_1              IOMUX_PAD(0x6a4, 0x240, 4, 0x9a8, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA2__GPIO1_10                           IOMUX_PAD(0x6a4, 0x240, 5, 0x830, 1, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA2__ARM11P_TOP_TRACE_25                        IOMUX_PAD(0x6a4, 0x240, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD1_DATA3__ESDHC1_DAT3                                IOMUX_PAD(0x6a8, 0x244, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA3__MSHC_DATA_3                                IOMUX_PAD(0x6a8, 0x244, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA3__IPU_DISPB_RD                       IOMUX_PAD(0x6a8, 0x244, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA3__USB_TOP_USBOTG_DATA_2              IOMUX_PAD(0x6a8, 0x244, 4, 0x9ac, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA3__GPIO1_11                           IOMUX_PAD(0x6a8, 0x244, 5, 0x834, 1, NO_PAD_CTRL)
-#define MX35_PAD_SD1_DATA3__ARM11P_TOP_TRACE_26                        IOMUX_PAD(0x6a8, 0x244, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD2_CMD__ESDHC2_CMD                           IOMUX_PAD(0x6ac, 0x248, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CMD__I2C3_SCL                             IOMUX_PAD(0x6ac, 0x248, 1, 0x91c, 2, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CMD__ESDHC1_DAT4                          IOMUX_PAD(0x6ac, 0x248, 2, 0x804, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CMD__IPU_CSI_D_2                          IOMUX_PAD(0x6ac, 0x248, 3, 0x938, 2, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CMD__USB_TOP_USBH2_DATA_4                 IOMUX_PAD(0x6ac, 0x248, 4, 0x9dc, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CMD__GPIO2_0                              IOMUX_PAD(0x6ac, 0x248, 5, 0x868, 2, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CMD__SPDIF_SPDIF_OUT1                     IOMUX_PAD(0x6ac, 0x248, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CMD__IPU_DISPB_D12_VSYNC                  IOMUX_PAD(0x6ac, 0x248, 7, 0x928, 3, NO_PAD_CTRL)
-
-#define MX35_PAD_SD2_CLK__ESDHC2_CLK                           IOMUX_PAD(0x6b0, 0x24c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CLK__I2C3_SDA                             IOMUX_PAD(0x6b0, 0x24c, 1, 0x920, 2, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CLK__ESDHC1_DAT5                          IOMUX_PAD(0x6b0, 0x24c, 2, 0x808, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CLK__IPU_CSI_D_3                          IOMUX_PAD(0x6b0, 0x24c, 3, 0x93c, 2, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CLK__USB_TOP_USBH2_DATA_5                 IOMUX_PAD(0x6b0, 0x24c, 4, 0x9e0, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CLK__GPIO2_1                              IOMUX_PAD(0x6b0, 0x24c, 5, 0x894, 1, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CLK__SPDIF_SPDIF_IN1                      IOMUX_PAD(0x6b0, 0x24c, 6, 0x998, 2, NO_PAD_CTRL)
-#define MX35_PAD_SD2_CLK__IPU_DISPB_CS2                                IOMUX_PAD(0x6b0, 0x24c, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_SD2_DATA0__ESDHC2_DAT0                                IOMUX_PAD(0x6b4, 0x250, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA0__UART3_RXD_MUX                      IOMUX_PAD(0x6b4, 0x250, 1, 0x9a0, 1, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA0__ESDHC1_DAT6                                IOMUX_PAD(0x6b4, 0x250, 2, 0x80c, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA0__IPU_CSI_D_4                                IOMUX_PAD(0x6b4, 0x250, 3, 0x940, 1, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA0__USB_TOP_USBH2_DATA_6               IOMUX_PAD(0x6b4, 0x250, 4, 0x9e4, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA0__GPIO2_2                            IOMUX_PAD(0x6b4, 0x250, 5, 0x8c0, 1, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA0__SPDIF_SPDIF_EXTCLK                 IOMUX_PAD(0x6b4, 0x250, 6, 0x994, 3, NO_PAD_CTRL)
-
-#define MX35_PAD_SD2_DATA1__ESDHC2_DAT1                                IOMUX_PAD(0x6b8, 0x254, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA1__UART3_TXD_MUX                      IOMUX_PAD(0x6b8, 0x254, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA1__ESDHC1_DAT7                                IOMUX_PAD(0x6b8, 0x254, 2, 0x810, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA1__IPU_CSI_D_5                                IOMUX_PAD(0x6b8, 0x254, 3, 0x944, 1, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA1__USB_TOP_USBH2_DATA_0               IOMUX_PAD(0x6b8, 0x254, 4, 0x9cc, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA1__GPIO2_3                            IOMUX_PAD(0x6b8, 0x254, 5, 0x8cc, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_SD2_DATA2__ESDHC2_DAT2                                IOMUX_PAD(0x6bc, 0x258, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA2__UART3_RTS                          IOMUX_PAD(0x6bc, 0x258, 1, 0x99c, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA2__CAN1_RXCAN                         IOMUX_PAD(0x6bc, 0x258, 2, 0x7c8, 1, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA2__IPU_CSI_D_6                                IOMUX_PAD(0x6bc, 0x258, 3, 0x948, 1, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA2__USB_TOP_USBH2_DATA_1               IOMUX_PAD(0x6bc, 0x258, 4, 0x9d0, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA2__GPIO2_4                            IOMUX_PAD(0x6bc, 0x258, 5, 0x8d0, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_SD2_DATA3__ESDHC2_DAT3                                IOMUX_PAD(0x6c0, 0x25c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA3__UART3_CTS                          IOMUX_PAD(0x6c0, 0x25c, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA3__CAN1_TXCAN                         IOMUX_PAD(0x6c0, 0x25c, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA3__IPU_CSI_D_7                                IOMUX_PAD(0x6c0, 0x25c, 3, 0x94c, 1, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA3__USB_TOP_USBH2_DATA_2               IOMUX_PAD(0x6c0, 0x25c, 4, 0x9d4, 0, NO_PAD_CTRL)
-#define MX35_PAD_SD2_DATA3__GPIO2_5                            IOMUX_PAD(0x6c0, 0x25c, 5, 0x8d4, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_CS0__ATA_CS0                              IOMUX_PAD(0x6c4, 0x260, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_CS0__CSPI1_SS3                            IOMUX_PAD(0x6c4, 0x260, 1, 0x7dc, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_CS0__IPU_DISPB_CS1                                IOMUX_PAD(0x6c4, 0x260, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_CS0__GPIO2_6                              IOMUX_PAD(0x6c4, 0x260, 5, 0x8d8, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_CS0__IPU_DIAGB_0                          IOMUX_PAD(0x6c4, 0x260, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_CS0__ARM11P_TOP_MAX1_HMASTER_0            IOMUX_PAD(0x6c4, 0x260, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_CS1__ATA_CS1                              IOMUX_PAD(0x6c8, 0x264, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_CS1__IPU_DISPB_CS2                                IOMUX_PAD(0x6c8, 0x264, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_CS1__CSPI2_SS0                            IOMUX_PAD(0x6c8, 0x264, 4, 0x7f0, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_CS1__GPIO2_7                              IOMUX_PAD(0x6c8, 0x264, 5, 0x8dc, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_CS1__IPU_DIAGB_1                          IOMUX_PAD(0x6c8, 0x264, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_CS1__ARM11P_TOP_MAX1_HMASTER_1            IOMUX_PAD(0x6c8, 0x264, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DIOR__ATA_DIOR                            IOMUX_PAD(0x6cc, 0x268, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOR__ESDHC3_DAT0                         IOMUX_PAD(0x6cc, 0x268, 1, 0x81c, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOR__USB_TOP_USBOTG_DIR                  IOMUX_PAD(0x6cc, 0x268, 2, 0x9c4, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOR__IPU_DISPB_BE0                       IOMUX_PAD(0x6cc, 0x268, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOR__CSPI2_SS1                           IOMUX_PAD(0x6cc, 0x268, 4, 0x7f4, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOR__GPIO2_8                             IOMUX_PAD(0x6cc, 0x268, 5, 0x8e0, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOR__IPU_DIAGB_2                         IOMUX_PAD(0x6cc, 0x268, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOR__ARM11P_TOP_MAX1_HMASTER_2           IOMUX_PAD(0x6cc, 0x268, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DIOW__ATA_DIOW                            IOMUX_PAD(0x6d0, 0x26c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOW__ESDHC3_DAT1                         IOMUX_PAD(0x6d0, 0x26c, 1, 0x820, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOW__USB_TOP_USBOTG_STP                  IOMUX_PAD(0x6d0, 0x26c, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOW__IPU_DISPB_BE1                       IOMUX_PAD(0x6d0, 0x26c, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOW__CSPI2_MOSI                          IOMUX_PAD(0x6d0, 0x26c, 4, 0x7ec, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOW__GPIO2_9                             IOMUX_PAD(0x6d0, 0x26c, 5, 0x8e4, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOW__IPU_DIAGB_3                         IOMUX_PAD(0x6d0, 0x26c, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DIOW__ARM11P_TOP_MAX1_HMASTER_3           IOMUX_PAD(0x6d0, 0x26c, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DMACK__ATA_DMACK                          IOMUX_PAD(0x6d4, 0x270, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DMACK__ESDHC3_DAT2                                IOMUX_PAD(0x6d4, 0x270, 1, 0x824, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DMACK__USB_TOP_USBOTG_NXT                 IOMUX_PAD(0x6d4, 0x270, 2, 0x9c8, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DMACK__CSPI2_MISO                         IOMUX_PAD(0x6d4, 0x270, 4, 0x7e8, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DMACK__GPIO2_10                           IOMUX_PAD(0x6d4, 0x270, 5, 0x86c, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DMACK__IPU_DIAGB_4                                IOMUX_PAD(0x6d4, 0x270, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DMACK__ARM11P_TOP_MAX0_HMASTER_0          IOMUX_PAD(0x6d4, 0x270, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_RESET_B__ATA_RESET_B                      IOMUX_PAD(0x6d8, 0x274, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_RESET_B__ESDHC3_DAT3                      IOMUX_PAD(0x6d8, 0x274, 1, 0x828, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_RESET_B__USB_TOP_USBOTG_DATA_0            IOMUX_PAD(0x6d8, 0x274, 2, 0x9a4, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_RESET_B__IPU_DISPB_SD_D_O                 IOMUX_PAD(0x6d8, 0x274, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_RESET_B__CSPI2_RDY                                IOMUX_PAD(0x6d8, 0x274, 4, 0x7e4, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_RESET_B__GPIO2_11                         IOMUX_PAD(0x6d8, 0x274, 5, 0x870, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_RESET_B__IPU_DIAGB_5                      IOMUX_PAD(0x6d8, 0x274, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_RESET_B__ARM11P_TOP_MAX0_HMASTER_1                IOMUX_PAD(0x6d8, 0x274, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_IORDY__ATA_IORDY                          IOMUX_PAD(0x6dc, 0x278, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_IORDY__ESDHC3_DAT4                                IOMUX_PAD(0x6dc, 0x278, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_IORDY__USB_TOP_USBOTG_DATA_1              IOMUX_PAD(0x6dc, 0x278, 2, 0x9a8, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_IORDY__IPU_DISPB_SD_D_IO                  IOMUX_PAD(0x6dc, 0x278, 3, 0x92c, 3, NO_PAD_CTRL)
-#define MX35_PAD_ATA_IORDY__ESDHC2_DAT4                                IOMUX_PAD(0x6dc, 0x278, 4, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_IORDY__GPIO2_12                           IOMUX_PAD(0x6dc, 0x278, 5, 0x874, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_IORDY__IPU_DIAGB_6                                IOMUX_PAD(0x6dc, 0x278, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_IORDY__ARM11P_TOP_MAX0_HMASTER_2          IOMUX_PAD(0x6dc, 0x278, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA0__ATA_DATA_0                         IOMUX_PAD(0x6e0, 0x27c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA0__ESDHC3_DAT5                                IOMUX_PAD(0x6e0, 0x27c, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA0__USB_TOP_USBOTG_DATA_2              IOMUX_PAD(0x6e0, 0x27c, 2, 0x9ac, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA0__IPU_DISPB_D12_VSYNC                        IOMUX_PAD(0x6e0, 0x27c, 3, 0x928, 4, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA0__ESDHC2_DAT5                                IOMUX_PAD(0x6e0, 0x27c, 4, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA0__GPIO2_13                           IOMUX_PAD(0x6e0, 0x27c, 5, 0x878, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA0__IPU_DIAGB_7                                IOMUX_PAD(0x6e0, 0x27c, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA0__ARM11P_TOP_MAX0_HMASTER_3          IOMUX_PAD(0x6e0, 0x27c, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA1__ATA_DATA_1                         IOMUX_PAD(0x6e4, 0x280, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA1__ESDHC3_DAT6                                IOMUX_PAD(0x6e4, 0x280, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA1__USB_TOP_USBOTG_DATA_3              IOMUX_PAD(0x6e4, 0x280, 2, 0x9b0, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA1__IPU_DISPB_SD_CLK                   IOMUX_PAD(0x6e4, 0x280, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA1__ESDHC2_DAT6                                IOMUX_PAD(0x6e4, 0x280, 4, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA1__GPIO2_14                           IOMUX_PAD(0x6e4, 0x280, 5, 0x87c, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA1__IPU_DIAGB_8                                IOMUX_PAD(0x6e4, 0x280, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA1__ARM11P_TOP_TRACE_27                        IOMUX_PAD(0x6e4, 0x280, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA2__ATA_DATA_2                         IOMUX_PAD(0x6e8, 0x284, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA2__ESDHC3_DAT7                                IOMUX_PAD(0x6e8, 0x284, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA2__USB_TOP_USBOTG_DATA_4              IOMUX_PAD(0x6e8, 0x284, 2, 0x9b4, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA2__IPU_DISPB_SER_RS                   IOMUX_PAD(0x6e8, 0x284, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA2__ESDHC2_DAT7                                IOMUX_PAD(0x6e8, 0x284, 4, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA2__GPIO2_15                           IOMUX_PAD(0x6e8, 0x284, 5, 0x880, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA2__IPU_DIAGB_9                                IOMUX_PAD(0x6e8, 0x284, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA2__ARM11P_TOP_TRACE_28                        IOMUX_PAD(0x6e8, 0x284, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA3__ATA_DATA_3                         IOMUX_PAD(0x6ec, 0x288, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA3__ESDHC3_CLK                         IOMUX_PAD(0x6ec, 0x288, 1, 0x814, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA3__USB_TOP_USBOTG_DATA_5              IOMUX_PAD(0x6ec, 0x288, 2, 0x9b8, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA3__CSPI2_SCLK                         IOMUX_PAD(0x6ec, 0x288, 4, 0x7e0, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA3__GPIO2_16                           IOMUX_PAD(0x6ec, 0x288, 5, 0x884, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA3__IPU_DIAGB_10                       IOMUX_PAD(0x6ec, 0x288, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA3__ARM11P_TOP_TRACE_29                        IOMUX_PAD(0x6ec, 0x288, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA4__ATA_DATA_4                         IOMUX_PAD(0x6f0, 0x28c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA4__ESDHC3_CMD                         IOMUX_PAD(0x6f0, 0x28c, 1, 0x818, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA4__USB_TOP_USBOTG_DATA_6              IOMUX_PAD(0x6f0, 0x28c, 2, 0x9bc, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA4__GPIO2_17                           IOMUX_PAD(0x6f0, 0x28c, 5, 0x888, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA4__IPU_DIAGB_11                       IOMUX_PAD(0x6f0, 0x28c, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA4__ARM11P_TOP_TRACE_30                        IOMUX_PAD(0x6f0, 0x28c, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA5__ATA_DATA_5                         IOMUX_PAD(0x6f4, 0x290, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA5__USB_TOP_USBOTG_DATA_7              IOMUX_PAD(0x6f4, 0x290, 2, 0x9c0, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA5__GPIO2_18                           IOMUX_PAD(0x6f4, 0x290, 5, 0x88c, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA5__IPU_DIAGB_12                       IOMUX_PAD(0x6f4, 0x290, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA5__ARM11P_TOP_TRACE_31                        IOMUX_PAD(0x6f4, 0x290, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA6__ATA_DATA_6                         IOMUX_PAD(0x6f8, 0x294, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA6__CAN1_TXCAN                         IOMUX_PAD(0x6f8, 0x294, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA6__UART1_DTR                          IOMUX_PAD(0x6f8, 0x294, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA6__AUDMUX_AUD6_TXD                    IOMUX_PAD(0x6f8, 0x294, 3, 0x7b4, 0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA6__GPIO2_19                           IOMUX_PAD(0x6f8, 0x294, 5, 0x890, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA6__IPU_DIAGB_13                       IOMUX_PAD(0x6f8, 0x294, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA7__ATA_DATA_7                         IOMUX_PAD(0x6fc, 0x298, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA7__CAN1_RXCAN                         IOMUX_PAD(0x6fc, 0x298, 1, 0x7c8, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA7__UART1_DSR                          IOMUX_PAD(0x6fc, 0x298, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA7__AUDMUX_AUD6_RXD                    IOMUX_PAD(0x6fc, 0x298, 3, 0x7b0, 0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA7__GPIO2_20                           IOMUX_PAD(0x6fc, 0x298, 5, 0x898, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA7__IPU_DIAGB_14                       IOMUX_PAD(0x6fc, 0x298, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA8__ATA_DATA_8                         IOMUX_PAD(0x700, 0x29c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA8__UART3_RTS                          IOMUX_PAD(0x700, 0x29c, 1, 0x99c, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA8__UART1_RI                           IOMUX_PAD(0x700, 0x29c, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA8__AUDMUX_AUD6_TXC                    IOMUX_PAD(0x700, 0x29c, 3, 0x7c0, 0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA8__GPIO2_21                           IOMUX_PAD(0x700, 0x29c, 5, 0x89c, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA8__IPU_DIAGB_15                       IOMUX_PAD(0x700, 0x29c, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA9__ATA_DATA_9                         IOMUX_PAD(0x704, 0x2a0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA9__UART3_CTS                          IOMUX_PAD(0x704, 0x2a0, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA9__UART1_DCD                          IOMUX_PAD(0x704, 0x2a0, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA9__AUDMUX_AUD6_TXFS                   IOMUX_PAD(0x704, 0x2a0, 3, 0x7c4, 0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA9__GPIO2_22                           IOMUX_PAD(0x704, 0x2a0, 5, 0x8a0, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA9__IPU_DIAGB_16                       IOMUX_PAD(0x704, 0x2a0, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA10__ATA_DATA_10                       IOMUX_PAD(0x708, 0x2a4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA10__UART3_RXD_MUX                     IOMUX_PAD(0x708, 0x2a4, 1, 0x9a0, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA10__AUDMUX_AUD6_RXC                   IOMUX_PAD(0x708, 0x2a4, 3, 0x7b8, 0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA10__GPIO2_23                          IOMUX_PAD(0x708, 0x2a4, 5, 0x8a4, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA10__IPU_DIAGB_17                      IOMUX_PAD(0x708, 0x2a4, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA11__ATA_DATA_11                       IOMUX_PAD(0x70c, 0x2a8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA11__UART3_TXD_MUX                     IOMUX_PAD(0x70c, 0x2a8, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA11__AUDMUX_AUD6_RXFS                  IOMUX_PAD(0x70c, 0x2a8, 3, 0x7bc, 0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA11__GPIO2_24                          IOMUX_PAD(0x70c, 0x2a8, 5, 0x8a8, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA11__IPU_DIAGB_18                      IOMUX_PAD(0x70c, 0x2a8, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA12__ATA_DATA_12                       IOMUX_PAD(0x710, 0x2ac, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA12__I2C3_SCL                          IOMUX_PAD(0x710, 0x2ac, 1, 0x91c, 3, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA12__GPIO2_25                          IOMUX_PAD(0x710, 0x2ac, 5, 0x8ac, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA12__IPU_DIAGB_19                      IOMUX_PAD(0x710, 0x2ac, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA13__ATA_DATA_13                       IOMUX_PAD(0x714, 0x2b0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA13__I2C3_SDA                          IOMUX_PAD(0x714, 0x2b0, 1, 0x920, 3, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA13__GPIO2_26                          IOMUX_PAD(0x714, 0x2b0, 5, 0x8b0, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA13__IPU_DIAGB_20                      IOMUX_PAD(0x714, 0x2b0, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA14__ATA_DATA_14                       IOMUX_PAD(0x718, 0x2b4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA14__IPU_CSI_D_0                       IOMUX_PAD(0x718, 0x2b4, 1, 0x930, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA14__KPP_ROW_0                         IOMUX_PAD(0x718, 0x2b4, 3, 0x970, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA14__GPIO2_27                          IOMUX_PAD(0x718, 0x2b4, 5, 0x8b4, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA14__IPU_DIAGB_21                      IOMUX_PAD(0x718, 0x2b4, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DATA15__ATA_DATA_15                       IOMUX_PAD(0x71c, 0x2b8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA15__IPU_CSI_D_1                       IOMUX_PAD(0x71c, 0x2b8, 1, 0x934, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA15__KPP_ROW_1                         IOMUX_PAD(0x71c, 0x2b8, 3, 0x974, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA15__GPIO2_28                          IOMUX_PAD(0x71c, 0x2b8, 5, 0x8b8, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DATA15__IPU_DIAGB_22                      IOMUX_PAD(0x71c, 0x2b8, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_INTRQ__ATA_INTRQ                          IOMUX_PAD(0x720, 0x2bc, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_INTRQ__IPU_CSI_D_2                                IOMUX_PAD(0x720, 0x2bc, 1, 0x938, 3, NO_PAD_CTRL)
-#define MX35_PAD_ATA_INTRQ__KPP_ROW_2                          IOMUX_PAD(0x720, 0x2bc, 3, 0x978, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_INTRQ__GPIO2_29                           IOMUX_PAD(0x720, 0x2bc, 5, 0x8bc, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_INTRQ__IPU_DIAGB_23                       IOMUX_PAD(0x720, 0x2bc, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_BUFF_EN__ATA_BUFFER_EN                    IOMUX_PAD(0x724, 0x2c0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_BUFF_EN__IPU_CSI_D_3                      IOMUX_PAD(0x724, 0x2c0, 1, 0x93c, 3, NO_PAD_CTRL)
-#define MX35_PAD_ATA_BUFF_EN__KPP_ROW_3                                IOMUX_PAD(0x724, 0x2c0, 3, 0x97c, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_BUFF_EN__GPIO2_30                         IOMUX_PAD(0x724, 0x2c0, 5, 0x8c4, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_BUFF_EN__IPU_DIAGB_24                     IOMUX_PAD(0x724, 0x2c0, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DMARQ__ATA_DMARQ                          IOMUX_PAD(0x728, 0x2c4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DMARQ__IPU_CSI_D_4                                IOMUX_PAD(0x728, 0x2c4, 1, 0x940, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DMARQ__KPP_COL_0                          IOMUX_PAD(0x728, 0x2c4, 3, 0x950, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DMARQ__GPIO2_31                           IOMUX_PAD(0x728, 0x2c4, 5, 0x8c8, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DMARQ__IPU_DIAGB_25                       IOMUX_PAD(0x728, 0x2c4, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DMARQ__ECT_CTI_TRIG_IN1_4                 IOMUX_PAD(0x728, 0x2c4, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DA0__ATA_DA_0                             IOMUX_PAD(0x72c, 0x2c8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA0__IPU_CSI_D_5                          IOMUX_PAD(0x72c, 0x2c8, 1, 0x944, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA0__KPP_COL_1                            IOMUX_PAD(0x72c, 0x2c8, 3, 0x954, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA0__GPIO3_0                              IOMUX_PAD(0x72c, 0x2c8, 5, 0x8e8, 1, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA0__IPU_DIAGB_26                         IOMUX_PAD(0x72c, 0x2c8, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA0__ECT_CTI_TRIG_IN1_5                   IOMUX_PAD(0x72c, 0x2c8, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DA1__ATA_DA_1                             IOMUX_PAD(0x730, 0x2cc, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA1__IPU_CSI_D_6                          IOMUX_PAD(0x730, 0x2cc, 1, 0x948, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA1__KPP_COL_2                            IOMUX_PAD(0x730, 0x2cc, 3, 0x958, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA1__GPIO3_1                              IOMUX_PAD(0x730, 0x2cc, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA1__IPU_DIAGB_27                         IOMUX_PAD(0x730, 0x2cc, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA1__ECT_CTI_TRIG_IN1_6                   IOMUX_PAD(0x730, 0x2cc, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_ATA_DA2__ATA_DA_2                             IOMUX_PAD(0x734, 0x2d0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA2__IPU_CSI_D_7                          IOMUX_PAD(0x734, 0x2d0, 1, 0x94c, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA2__KPP_COL_3                            IOMUX_PAD(0x734, 0x2d0, 3, 0x95c, 2, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA2__GPIO3_2                              IOMUX_PAD(0x734, 0x2d0, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA2__IPU_DIAGB_28                         IOMUX_PAD(0x734, 0x2d0, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_ATA_DA2__ECT_CTI_TRIG_IN1_7                   IOMUX_PAD(0x734, 0x2d0, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_MLB_CLK__MLB_MLBCLK                           IOMUX_PAD(0x738, 0x2d4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_MLB_CLK__GPIO3_3                              IOMUX_PAD(0x738, 0x2d4, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_MLB_DAT__MLB_MLBDAT                           IOMUX_PAD(0x73c, 0x2d8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_MLB_DAT__GPIO3_4                              IOMUX_PAD(0x73c, 0x2d8, 5, 0x904, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_MLB_SIG__MLB_MLBSIG                           IOMUX_PAD(0x740, 0x2dc, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_MLB_SIG__GPIO3_5                              IOMUX_PAD(0x740, 0x2dc, 5, 0x908, 1, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_TX_CLK__FEC_TX_CLK                                IOMUX_PAD(0x744, 0x2e0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_CLK__ESDHC1_DAT4                       IOMUX_PAD(0x744, 0x2e0, 1, 0x804, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_CLK__UART3_RXD_MUX                     IOMUX_PAD(0x744, 0x2e0, 2, 0x9a0, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_CLK__USB_TOP_USBH2_DIR                 IOMUX_PAD(0x744, 0x2e0, 3, 0x9ec, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_CLK__CSPI2_MOSI                                IOMUX_PAD(0x744, 0x2e0, 4, 0x7ec, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_CLK__GPIO3_6                           IOMUX_PAD(0x744, 0x2e0, 5, 0x90c, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_CLK__IPU_DISPB_D12_VSYNC               IOMUX_PAD(0x744, 0x2e0, 6, 0x928, 5, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_CLK__ARM11P_TOP_EVNTBUS_0              IOMUX_PAD(0x744, 0x2e0, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_RX_CLK__FEC_RX_CLK                                IOMUX_PAD(0x748, 0x2e4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_CLK__ESDHC1_DAT5                       IOMUX_PAD(0x748, 0x2e4, 1, 0x808, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_CLK__UART3_TXD_MUX                     IOMUX_PAD(0x748, 0x2e4, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_CLK__USB_TOP_USBH2_STP                 IOMUX_PAD(0x748, 0x2e4, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_CLK__CSPI2_MISO                                IOMUX_PAD(0x748, 0x2e4, 4, 0x7e8, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_CLK__GPIO3_7                           IOMUX_PAD(0x748, 0x2e4, 5, 0x910, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_CLK__IPU_DISPB_SD_D_I                  IOMUX_PAD(0x748, 0x2e4, 6, 0x92c, 4, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_CLK__ARM11P_TOP_EVNTBUS_1              IOMUX_PAD(0x748, 0x2e4, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_RX_DV__FEC_RX_DV                          IOMUX_PAD(0x74c, 0x2e8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_DV__ESDHC1_DAT6                                IOMUX_PAD(0x74c, 0x2e8, 1, 0x80c, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_DV__UART3_RTS                          IOMUX_PAD(0x74c, 0x2e8, 2, 0x99c, 2, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_DV__USB_TOP_USBH2_NXT                  IOMUX_PAD(0x74c, 0x2e8, 3, 0x9f0, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_DV__CSPI2_SCLK                         IOMUX_PAD(0x74c, 0x2e8, 4, 0x7e0, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_DV__GPIO3_8                            IOMUX_PAD(0x74c, 0x2e8, 5, 0x914, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_DV__IPU_DISPB_SD_CLK                   IOMUX_PAD(0x74c, 0x2e8, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_DV__ARM11P_TOP_EVNTBUS_2               IOMUX_PAD(0x74c, 0x2e8, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_COL__FEC_COL                              IOMUX_PAD(0x750, 0x2ec, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_COL__ESDHC1_DAT7                          IOMUX_PAD(0x750, 0x2ec, 1, 0x810, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_COL__UART3_CTS                            IOMUX_PAD(0x750, 0x2ec, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_COL__USB_TOP_USBH2_DATA_0                 IOMUX_PAD(0x750, 0x2ec, 3, 0x9cc, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_COL__CSPI2_RDY                            IOMUX_PAD(0x750, 0x2ec, 4, 0x7e4, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_COL__GPIO3_9                              IOMUX_PAD(0x750, 0x2ec, 5, 0x918, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_COL__IPU_DISPB_SER_RS                     IOMUX_PAD(0x750, 0x2ec, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_COL__ARM11P_TOP_EVNTBUS_3                 IOMUX_PAD(0x750, 0x2ec, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_RDATA0__FEC_RDATA_0                       IOMUX_PAD(0x754, 0x2f0, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA0__PWM_PWMO                          IOMUX_PAD(0x754, 0x2f0, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA0__UART3_DTR                         IOMUX_PAD(0x754, 0x2f0, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA0__USB_TOP_USBH2_DATA_1              IOMUX_PAD(0x754, 0x2f0, 3, 0x9d0, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA0__CSPI2_SS0                         IOMUX_PAD(0x754, 0x2f0, 4, 0x7f0, 2, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA0__GPIO3_10                          IOMUX_PAD(0x754, 0x2f0, 5, 0x8ec, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA0__IPU_DISPB_CS1                     IOMUX_PAD(0x754, 0x2f0, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA0__ARM11P_TOP_EVNTBUS_4              IOMUX_PAD(0x754, 0x2f0, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_TDATA0__FEC_TDATA_0                       IOMUX_PAD(0x758, 0x2f4, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA0__SPDIF_SPDIF_OUT1                  IOMUX_PAD(0x758, 0x2f4, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA0__UART3_DSR                         IOMUX_PAD(0x758, 0x2f4, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA0__USB_TOP_USBH2_DATA_2              IOMUX_PAD(0x758, 0x2f4, 3, 0x9d4, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA0__CSPI2_SS1                         IOMUX_PAD(0x758, 0x2f4, 4, 0x7f4, 2, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA0__GPIO3_11                          IOMUX_PAD(0x758, 0x2f4, 5, 0x8f0, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA0__IPU_DISPB_CS0                     IOMUX_PAD(0x758, 0x2f4, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA0__ARM11P_TOP_EVNTBUS_5              IOMUX_PAD(0x758, 0x2f4, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_TX_EN__FEC_TX_EN                          IOMUX_PAD(0x75c, 0x2f8, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_EN__SPDIF_SPDIF_IN1                    IOMUX_PAD(0x75c, 0x2f8, 1, 0x998, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_EN__UART3_RI                           IOMUX_PAD(0x75c, 0x2f8, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_EN__USB_TOP_USBH2_DATA_3               IOMUX_PAD(0x75c, 0x2f8, 3, 0x9d8, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_EN__GPIO3_12                           IOMUX_PAD(0x75c, 0x2f8, 5, 0x8f4, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_EN__IPU_DISPB_PAR_RS                   IOMUX_PAD(0x75c, 0x2f8, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_EN__ARM11P_TOP_EVNTBUS_6               IOMUX_PAD(0x75c, 0x2f8, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_MDC__FEC_MDC                              IOMUX_PAD(0x760, 0x2fc, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_MDC__CAN2_TXCAN                           IOMUX_PAD(0x760, 0x2fc, 1, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_MDC__UART3_DCD                            IOMUX_PAD(0x760, 0x2fc, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_MDC__USB_TOP_USBH2_DATA_4                 IOMUX_PAD(0x760, 0x2fc, 3, 0x9dc, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_MDC__GPIO3_13                             IOMUX_PAD(0x760, 0x2fc, 5, 0x8f8, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_MDC__IPU_DISPB_WR                         IOMUX_PAD(0x760, 0x2fc, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_MDC__ARM11P_TOP_EVNTBUS_7                 IOMUX_PAD(0x760, 0x2fc, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_MDIO__FEC_MDIO                            IOMUX_PAD(0x764, 0x300, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_MDIO__CAN2_RXCAN                          IOMUX_PAD(0x764, 0x300, 1, 0x7cc, 2, NO_PAD_CTRL)
-#define MX35_PAD_FEC_MDIO__USB_TOP_USBH2_DATA_5                        IOMUX_PAD(0x764, 0x300, 3, 0x9e0, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_MDIO__GPIO3_14                            IOMUX_PAD(0x764, 0x300, 5, 0x8fc, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_MDIO__IPU_DISPB_RD                                IOMUX_PAD(0x764, 0x300, 6, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_MDIO__ARM11P_TOP_EVNTBUS_8                        IOMUX_PAD(0x764, 0x300, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_TX_ERR__FEC_TX_ERR                                IOMUX_PAD(0x768, 0x304, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_ERR__OWIRE_LINE                                IOMUX_PAD(0x768, 0x304, 1, 0x990, 2, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_ERR__SPDIF_SPDIF_EXTCLK                        IOMUX_PAD(0x768, 0x304, 2, 0x994, 4, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_ERR__USB_TOP_USBH2_DATA_6              IOMUX_PAD(0x768, 0x304, 3, 0x9e4, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_ERR__GPIO3_15                          IOMUX_PAD(0x768, 0x304, 5, 0x900, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_ERR__IPU_DISPB_D0_VSYNC                        IOMUX_PAD(0x768, 0x304, 6, 0x924, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TX_ERR__ARM11P_TOP_EVNTBUS_9              IOMUX_PAD(0x768, 0x304, 7, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_RX_ERR__FEC_RX_ERR                                IOMUX_PAD(0x76c, 0x308, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_ERR__IPU_CSI_D_0                       IOMUX_PAD(0x76c, 0x308, 1, 0x930, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_ERR__USB_TOP_USBH2_DATA_7              IOMUX_PAD(0x76c, 0x308, 3, 0x9e8, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_ERR__KPP_COL_4                         IOMUX_PAD(0x76c, 0x308, 4, 0x960, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_ERR__GPIO3_16                          IOMUX_PAD(0x76c, 0x308, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RX_ERR__IPU_DISPB_SD_D_IO                 IOMUX_PAD(0x76c, 0x308, 6, 0x92c, 5, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_CRS__FEC_CRS                              IOMUX_PAD(0x770, 0x30c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_CRS__IPU_CSI_D_1                          IOMUX_PAD(0x770, 0x30c, 1, 0x934, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_CRS__USB_TOP_USBH2_PWR                    IOMUX_PAD(0x770, 0x30c, 3, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_CRS__KPP_COL_5                            IOMUX_PAD(0x770, 0x30c, 4, 0x964, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_CRS__GPIO3_17                             IOMUX_PAD(0x770, 0x30c, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_CRS__IPU_FLASH_STROBE                     IOMUX_PAD(0x770, 0x30c, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_RDATA1__FEC_RDATA_1                       IOMUX_PAD(0x774, 0x310, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA1__IPU_CSI_D_2                       IOMUX_PAD(0x774, 0x310, 1, 0x938, 4, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA1__AUDMUX_AUD6_RXC                   IOMUX_PAD(0x774, 0x310, 2, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA1__USB_TOP_USBH2_OC                  IOMUX_PAD(0x774, 0x310, 3, 0x9f4, 2, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA1__KPP_COL_6                         IOMUX_PAD(0x774, 0x310, 4, 0x968, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA1__GPIO3_18                          IOMUX_PAD(0x774, 0x310, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA1__IPU_DISPB_BE0                     IOMUX_PAD(0x774, 0x310, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_TDATA1__FEC_TDATA_1                       IOMUX_PAD(0x778, 0x314, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA1__IPU_CSI_D_3                       IOMUX_PAD(0x778, 0x314, 1, 0x93c, 4, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA1__AUDMUX_AUD6_RXFS                  IOMUX_PAD(0x778, 0x314, 2, 0x7bc, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA1__KPP_COL_7                         IOMUX_PAD(0x778, 0x314, 4, 0x96c, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA1__GPIO3_19                          IOMUX_PAD(0x778, 0x314, 5, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA1__IPU_DISPB_BE1                     IOMUX_PAD(0x778, 0x314, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_RDATA2__FEC_RDATA_2                       IOMUX_PAD(0x77c, 0x318, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA2__IPU_CSI_D_4                       IOMUX_PAD(0x77c, 0x318, 1, 0x940, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA2__AUDMUX_AUD6_TXD                   IOMUX_PAD(0x77c, 0x318, 2, 0x7b4, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA2__KPP_ROW_4                         IOMUX_PAD(0x77c, 0x318, 4, 0x980, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA2__GPIO3_20                          IOMUX_PAD(0x77c, 0x318, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_TDATA2__FEC_TDATA_2                       IOMUX_PAD(0x780, 0x31c, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA2__IPU_CSI_D_5                       IOMUX_PAD(0x780, 0x31c, 1, 0x944, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA2__AUDMUX_AUD6_RXD                   IOMUX_PAD(0x780, 0x31c, 2, 0x7b0, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA2__KPP_ROW_5                         IOMUX_PAD(0x780, 0x31c, 4, 0x984, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA2__GPIO3_21                          IOMUX_PAD(0x780, 0x31c, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_RDATA3__FEC_RDATA_3                       IOMUX_PAD(0x784, 0x320, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA3__IPU_CSI_D_6                       IOMUX_PAD(0x784, 0x320, 1, 0x948, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA3__AUDMUX_AUD6_TXC                   IOMUX_PAD(0x784, 0x320, 2, 0x7c0, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA3__KPP_ROW_6                         IOMUX_PAD(0x784, 0x320, 4, 0x988, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_RDATA3__GPIO3_22                          IOMUX_PAD(0x784, 0x320, 6, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_FEC_TDATA3__FEC_TDATA_3                       IOMUX_PAD(0x788, 0x324, 0, 0x0,   0, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA3__IPU_CSI_D_7                       IOMUX_PAD(0x788, 0x324, 1, 0x94c, 3, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA3__AUDMUX_AUD6_TXFS                  IOMUX_PAD(0x788, 0x324, 2, 0x7c4, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA3__KPP_ROW_7                         IOMUX_PAD(0x788, 0x324, 4, 0x98c, 1, NO_PAD_CTRL)
-#define MX35_PAD_FEC_TDATA3__GPIO3_23                          IOMUX_PAD(0x788, 0x324, 5, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_EXT_ARMCLK__CCM_EXT_ARMCLK                    IOMUX_PAD(0x78c, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-#define MX35_PAD_TEST_MODE__TCU_TEST_MODE                      IOMUX_PAD(0x790, 0x0,   0, 0x0,   0, NO_PAD_CTRL)
-
-
-#endif /* __MACH_IOMUX_MX35_H__ */
diff --git a/arch/arm/mach-imx/iomux-v1.c b/arch/arm/mach-imx/iomux-v1.c
deleted file mode 100644 (file)
index a4bec3b..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * arch/arm/plat-mxc/iomux-v1.c
- *
- * Copyright (C) 2004 Sascha Hauer, Synertronixx GmbH
- * Copyright (C) 2009 Uwe Kleine-Koenig, Pengutronix
- *
- * Common code for i.MX1, i.MX21 and i.MX27
- */
-
-#include <linux/errno.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/string.h>
-#include <linux/gpio.h>
-
-#include <asm/mach/map.h>
-
-#include "hardware.h"
-#include "iomux-v1.h"
-
-static void __iomem *imx_iomuxv1_baseaddr;
-static unsigned imx_iomuxv1_numports;
-
-static inline unsigned long imx_iomuxv1_readl(unsigned offset)
-{
-       return imx_readl(imx_iomuxv1_baseaddr + offset);
-}
-
-static inline void imx_iomuxv1_writel(unsigned long val, unsigned offset)
-{
-       imx_writel(val, imx_iomuxv1_baseaddr + offset);
-}
-
-static inline void imx_iomuxv1_rmwl(unsigned offset,
-               unsigned long mask, unsigned long value)
-{
-       unsigned long reg = imx_iomuxv1_readl(offset);
-
-       reg &= ~mask;
-       reg |= value;
-
-       imx_iomuxv1_writel(reg, offset);
-}
-
-static inline void imx_iomuxv1_set_puen(
-               unsigned int port, unsigned int pin, int on)
-{
-       unsigned long mask = 1 << pin;
-
-       imx_iomuxv1_rmwl(MXC_PUEN(port), mask, on ? mask : 0);
-}
-
-static inline void imx_iomuxv1_set_ddir(
-               unsigned int port, unsigned int pin, int out)
-{
-       unsigned long mask = 1 << pin;
-
-       imx_iomuxv1_rmwl(MXC_DDIR(port), mask, out ? mask : 0);
-}
-
-static inline void imx_iomuxv1_set_gpr(
-               unsigned int port, unsigned int pin, int af)
-{
-       unsigned long mask = 1 << pin;
-
-       imx_iomuxv1_rmwl(MXC_GPR(port), mask, af ? mask : 0);
-}
-
-static inline void imx_iomuxv1_set_gius(
-               unsigned int port, unsigned int pin, int inuse)
-{
-       unsigned long mask = 1 << pin;
-
-       imx_iomuxv1_rmwl(MXC_GIUS(port), mask, inuse ? mask : 0);
-}
-
-static inline void imx_iomuxv1_set_ocr(
-               unsigned int port, unsigned int pin, unsigned int ocr)
-{
-       unsigned long shift = (pin & 0xf) << 1;
-       unsigned long mask = 3 << shift;
-       unsigned long value = ocr << shift;
-       unsigned long offset = pin < 16 ? MXC_OCR1(port) : MXC_OCR2(port);
-
-       imx_iomuxv1_rmwl(offset, mask, value);
-}
-
-static inline void imx_iomuxv1_set_iconfa(
-               unsigned int port, unsigned int pin, unsigned int aout)
-{
-       unsigned long shift = (pin & 0xf) << 1;
-       unsigned long mask = 3 << shift;
-       unsigned long value = aout << shift;
-       unsigned long offset = pin < 16 ? MXC_ICONFA1(port) : MXC_ICONFA2(port);
-
-       imx_iomuxv1_rmwl(offset, mask, value);
-}
-
-static inline void imx_iomuxv1_set_iconfb(
-               unsigned int port, unsigned int pin, unsigned int bout)
-{
-       unsigned long shift = (pin & 0xf) << 1;
-       unsigned long mask = 3 << shift;
-       unsigned long value = bout << shift;
-       unsigned long offset = pin < 16 ? MXC_ICONFB1(port) : MXC_ICONFB2(port);
-
-       imx_iomuxv1_rmwl(offset, mask, value);
-}
-
-int mxc_gpio_mode(int gpio_mode)
-{
-       unsigned int pin = gpio_mode & GPIO_PIN_MASK;
-       unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
-       unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT;
-       unsigned int aout = (gpio_mode >> GPIO_AOUT_SHIFT) & 3;
-       unsigned int bout = (gpio_mode >> GPIO_BOUT_SHIFT) & 3;
-
-       if (port >= imx_iomuxv1_numports)
-               return -EINVAL;
-
-       /* Pullup enable */
-       imx_iomuxv1_set_puen(port, pin, gpio_mode & GPIO_PUEN);
-
-       /* Data direction */
-       imx_iomuxv1_set_ddir(port, pin, gpio_mode & GPIO_OUT);
-
-       /* Primary / alternate function */
-       imx_iomuxv1_set_gpr(port, pin, gpio_mode & GPIO_AF);
-
-       /* use as gpio? */
-       imx_iomuxv1_set_gius(port, pin, !(gpio_mode & (GPIO_PF | GPIO_AF)));
-
-       imx_iomuxv1_set_ocr(port, pin, ocr);
-
-       imx_iomuxv1_set_iconfa(port, pin, aout);
-
-       imx_iomuxv1_set_iconfb(port, pin, bout);
-
-       return 0;
-}
-
-static int imx_iomuxv1_setup_multiple(const int *list, unsigned count)
-{
-       size_t i;
-       int ret = 0;
-
-       for (i = 0; i < count; ++i) {
-               ret = mxc_gpio_mode(list[i]);
-
-               if (ret)
-                       return ret;
-       }
-
-       return ret;
-}
-
-int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
-               const char *label)
-{
-       int ret;
-
-       ret = imx_iomuxv1_setup_multiple(pin_list, count);
-       return ret;
-}
-
-int __init imx_iomuxv1_init(void __iomem *base, int numports)
-{
-       imx_iomuxv1_baseaddr = base;
-       imx_iomuxv1_numports = numports;
-
-       return 0;
-}
diff --git a/arch/arm/mach-imx/iomux-v1.h b/arch/arm/mach-imx/iomux-v1.h
deleted file mode 100644 (file)
index b948529..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
- * Copyright (C) 2009 by Holger Schurig <hs4233@mail.mn-solutions.de>
- */
-#ifndef __MACH_IOMUX_V1_H__
-#define __MACH_IOMUX_V1_H__
-
-/*
-*  GPIO Module and I/O Multiplexer
-*  x = 0..3 for reg_A, reg_B, reg_C, reg_D
-*/
-#define MXC_DDIR(x)    (0x00 + ((x) << 8))
-#define MXC_OCR1(x)    (0x04 + ((x) << 8))
-#define MXC_OCR2(x)    (0x08 + ((x) << 8))
-#define MXC_ICONFA1(x) (0x0c + ((x) << 8))
-#define MXC_ICONFA2(x) (0x10 + ((x) << 8))
-#define MXC_ICONFB1(x) (0x14 + ((x) << 8))
-#define MXC_ICONFB2(x) (0x18 + ((x) << 8))
-#define MXC_DR(x)      (0x1c + ((x) << 8))
-#define MXC_GIUS(x)    (0x20 + ((x) << 8))
-#define MXC_SSR(x)     (0x24 + ((x) << 8))
-#define MXC_ICR1(x)    (0x28 + ((x) << 8))
-#define MXC_ICR2(x)    (0x2c + ((x) << 8))
-#define MXC_IMR(x)     (0x30 + ((x) << 8))
-#define MXC_ISR(x)     (0x34 + ((x) << 8))
-#define MXC_GPR(x)     (0x38 + ((x) << 8))
-#define MXC_SWR(x)     (0x3c + ((x) << 8))
-#define MXC_PUEN(x)    (0x40 + ((x) << 8))
-
-#define MX1_NUM_GPIO_PORT      4
-#define MX21_NUM_GPIO_PORT     6
-#define MX27_NUM_GPIO_PORT     6
-
-#define GPIO_PIN_MASK 0x1f
-
-#define GPIO_PORT_SHIFT 5
-#define GPIO_PORT_MASK (0x7 << GPIO_PORT_SHIFT)
-
-#define GPIO_PORTA     (0 << GPIO_PORT_SHIFT)
-#define GPIO_PORTB     (1 << GPIO_PORT_SHIFT)
-#define GPIO_PORTC     (2 << GPIO_PORT_SHIFT)
-#define GPIO_PORTD     (3 << GPIO_PORT_SHIFT)
-#define GPIO_PORTE     (4 << GPIO_PORT_SHIFT)
-#define GPIO_PORTF     (5 << GPIO_PORT_SHIFT)
-
-#define GPIO_OUT       (1 << 8)
-#define GPIO_IN                (0 << 8)
-#define GPIO_PUEN      (1 << 9)
-
-#define GPIO_PF                (1 << 10)
-#define GPIO_AF                (1 << 11)
-
-#define GPIO_OCR_SHIFT 12
-#define GPIO_OCR_MASK  (3 << GPIO_OCR_SHIFT)
-#define GPIO_AIN       (0 << GPIO_OCR_SHIFT)
-#define GPIO_BIN       (1 << GPIO_OCR_SHIFT)
-#define GPIO_CIN       (2 << GPIO_OCR_SHIFT)
-#define GPIO_GPIO      (3 << GPIO_OCR_SHIFT)
-
-#define GPIO_AOUT_SHIFT        14
-#define GPIO_AOUT_MASK (3 << GPIO_AOUT_SHIFT)
-#define GPIO_AOUT      (0 << GPIO_AOUT_SHIFT)
-#define GPIO_AOUT_ISR  (1 << GPIO_AOUT_SHIFT)
-#define GPIO_AOUT_0    (2 << GPIO_AOUT_SHIFT)
-#define GPIO_AOUT_1    (3 << GPIO_AOUT_SHIFT)
-
-#define GPIO_BOUT_SHIFT        16
-#define GPIO_BOUT_MASK (3 << GPIO_BOUT_SHIFT)
-#define GPIO_BOUT      (0 << GPIO_BOUT_SHIFT)
-#define GPIO_BOUT_ISR  (1 << GPIO_BOUT_SHIFT)
-#define GPIO_BOUT_0    (2 << GPIO_BOUT_SHIFT)
-#define GPIO_BOUT_1    (3 << GPIO_BOUT_SHIFT)
-
-extern int mxc_gpio_mode(int gpio_mode);
-extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
-               const char *label);
-
-extern int imx_iomuxv1_init(void __iomem *base, int numports);
-
-#endif /* __MACH_IOMUX_V1_H__ */
diff --git a/arch/arm/mach-imx/iomux-v3.c b/arch/arm/mach-imx/iomux-v3.c
deleted file mode 100644 (file)
index 043cf3c..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
- * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH,
- *                       <armlinux@phytec.de>
- */
-#include <linux/errno.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/string.h>
-#include <linux/gpio.h>
-
-#include <asm/mach/map.h>
-
-#include "hardware.h"
-#include "iomux-v3.h"
-
-static void __iomem *base;
-
-/*
- * configures a single pad in the iomuxer
- */
-int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad)
-{
-       u32 mux_ctrl_ofs = (pad & MUX_CTRL_OFS_MASK) >> MUX_CTRL_OFS_SHIFT;
-       u32 mux_mode = (pad & MUX_MODE_MASK) >> MUX_MODE_SHIFT;
-       u32 sel_input_ofs = (pad & MUX_SEL_INPUT_OFS_MASK) >> MUX_SEL_INPUT_OFS_SHIFT;
-       u32 sel_input = (pad & MUX_SEL_INPUT_MASK) >> MUX_SEL_INPUT_SHIFT;
-       u32 pad_ctrl_ofs = (pad & MUX_PAD_CTRL_OFS_MASK) >> MUX_PAD_CTRL_OFS_SHIFT;
-       u32 pad_ctrl = (pad & MUX_PAD_CTRL_MASK) >> MUX_PAD_CTRL_SHIFT;
-
-       if (mux_ctrl_ofs)
-               imx_writel(mux_mode, base + mux_ctrl_ofs);
-
-       if (sel_input_ofs)
-               imx_writel(sel_input, base + sel_input_ofs);
-
-       if (!(pad_ctrl & NO_PAD_CTRL) && pad_ctrl_ofs)
-               imx_writel(pad_ctrl, base + pad_ctrl_ofs);
-
-       return 0;
-}
-
-int mxc_iomux_v3_setup_multiple_pads(const iomux_v3_cfg_t *pad_list,
-               unsigned count)
-{
-       const iomux_v3_cfg_t *p = pad_list;
-       int i;
-       int ret;
-
-       for (i = 0; i < count; i++) {
-               ret = mxc_iomux_v3_setup_pad(*p);
-               if (ret)
-                       return ret;
-               p++;
-       }
-       return 0;
-}
-
-void mxc_iomux_v3_init(void __iomem *iomux_v3_base)
-{
-       base = iomux_v3_base;
-}
diff --git a/arch/arm/mach-imx/iomux-v3.h b/arch/arm/mach-imx/iomux-v3.h
deleted file mode 100644 (file)
index 7db8ec9..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH,
- *                     <armlinux@phytec.de>
- */
-
-#ifndef __MACH_IOMUX_V3_H__
-#define __MACH_IOMUX_V3_H__
-
-/*
- *     build IOMUX_PAD structure
- *
- * This iomux scheme is based around pads, which are the physical balls
- * on the processor.
- *
- * - Each pad has a pad control register (IOMUXC_SW_PAD_CTRL_x) which controls
- *   things like driving strength and pullup/pulldown.
- * - Each pad can have but not necessarily does have an output routing register
- *   (IOMUXC_SW_MUX_CTL_PAD_x).
- * - Each pad can have but not necessarily does have an input routing register
- *   (IOMUXC_x_SELECT_INPUT)
- *
- * The three register sets do not have a fixed offset to each other,
- * hence we order this table by pad control registers (which all pads
- * have) and put the optional i/o routing registers into additional
- * fields.
- *
- * The naming convention for the pad modes is MX35_PAD_<padname>__<padmode>
- * If <padname> or <padmode> refers to a GPIO, it is named
- * GPIO_<unit>_<num>
- *
- * IOMUX/PAD Bit field definitions
- *
- * MUX_CTRL_OFS:           0..11 (12)
- * PAD_CTRL_OFS:          12..23 (12)
- * SEL_INPUT_OFS:         24..35 (12)
- * MUX_MODE + SION:       36..40  (5)
- * PAD_CTRL + NO_PAD_CTRL: 41..57 (17)
- * SEL_INP:               58..61  (4)
- * reserved:                63    (1)
-*/
-
-typedef u64 iomux_v3_cfg_t;
-
-#define MUX_CTRL_OFS_SHIFT     0
-#define MUX_CTRL_OFS_MASK      ((iomux_v3_cfg_t)0xfff << MUX_CTRL_OFS_SHIFT)
-#define MUX_PAD_CTRL_OFS_SHIFT 12
-#define MUX_PAD_CTRL_OFS_MASK  ((iomux_v3_cfg_t)0xfff << MUX_PAD_CTRL_OFS_SHIFT)
-#define MUX_SEL_INPUT_OFS_SHIFT        24
-#define MUX_SEL_INPUT_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_SEL_INPUT_OFS_SHIFT)
-
-#define MUX_MODE_SHIFT         36
-#define MUX_MODE_MASK          ((iomux_v3_cfg_t)0x1f << MUX_MODE_SHIFT)
-#define MUX_PAD_CTRL_SHIFT     41
-#define MUX_PAD_CTRL_MASK      ((iomux_v3_cfg_t)0x1ffff << MUX_PAD_CTRL_SHIFT)
-#define MUX_SEL_INPUT_SHIFT    58
-#define MUX_SEL_INPUT_MASK     ((iomux_v3_cfg_t)0xf << MUX_SEL_INPUT_SHIFT)
-
-#define MUX_PAD_CTRL(x)                ((iomux_v3_cfg_t)(x) << MUX_PAD_CTRL_SHIFT)
-
-#define IOMUX_PAD(_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _sel_input_ofs, \
-               _sel_input, _pad_ctrl)                                  \
-       (((iomux_v3_cfg_t)(_mux_ctrl_ofs) << MUX_CTRL_OFS_SHIFT) |      \
-               ((iomux_v3_cfg_t)(_mux_mode) << MUX_MODE_SHIFT) |       \
-               ((iomux_v3_cfg_t)(_pad_ctrl_ofs) << MUX_PAD_CTRL_OFS_SHIFT) | \
-               ((iomux_v3_cfg_t)(_pad_ctrl) << MUX_PAD_CTRL_SHIFT) |   \
-               ((iomux_v3_cfg_t)(_sel_input_ofs) << MUX_SEL_INPUT_OFS_SHIFT) | \
-               ((iomux_v3_cfg_t)(_sel_input) << MUX_SEL_INPUT_SHIFT))
-
-#define NEW_PAD_CTRL(cfg, pad) (((cfg) & ~MUX_PAD_CTRL_MASK) | MUX_PAD_CTRL(pad))
-/*
- * Use to set PAD control
- */
-
-#define NO_PAD_CTRL                    (1 << 16)
-#define PAD_CTL_DVS                    (1 << 13)
-#define PAD_CTL_HYS                    (1 << 8)
-
-#define PAD_CTL_PKE                    (1 << 7)
-#define PAD_CTL_PUE                    (1 << 6 | PAD_CTL_PKE)
-#define PAD_CTL_PUS_100K_DOWN          (0 << 4 | PAD_CTL_PUE)
-#define PAD_CTL_PUS_47K_UP             (1 << 4 | PAD_CTL_PUE)
-#define PAD_CTL_PUS_100K_UP            (2 << 4 | PAD_CTL_PUE)
-#define PAD_CTL_PUS_22K_UP             (3 << 4 | PAD_CTL_PUE)
-
-#define PAD_CTL_ODE                    (1 << 3)
-
-#define PAD_CTL_DSE_LOW                        (0 << 1)
-#define PAD_CTL_DSE_MED                        (1 << 1)
-#define PAD_CTL_DSE_HIGH               (2 << 1)
-#define PAD_CTL_DSE_MAX                        (3 << 1)
-
-#define PAD_CTL_SRE_FAST               (1 << 0)
-#define PAD_CTL_SRE_SLOW               (0 << 0)
-
-#define IOMUX_CONFIG_SION              (0x1 << 4)
-
-#define MX51_NUM_GPIO_PORT     4
-
-#define GPIO_PIN_MASK 0x1f
-
-#define GPIO_PORT_SHIFT 5
-#define GPIO_PORT_MASK (0x7 << GPIO_PORT_SHIFT)
-
-#define GPIO_PORTA     (0 << GPIO_PORT_SHIFT)
-#define GPIO_PORTB     (1 << GPIO_PORT_SHIFT)
-#define GPIO_PORTC     (2 << GPIO_PORT_SHIFT)
-#define GPIO_PORTD     (3 << GPIO_PORT_SHIFT)
-#define GPIO_PORTE     (4 << GPIO_PORT_SHIFT)
-#define GPIO_PORTF     (5 << GPIO_PORT_SHIFT)
-
-/*
- * setups a single pad in the iomuxer
- */
-int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad);
-
-/*
- * setups multiple pads
- * convenient way to call the above function with tables
- */
-int mxc_iomux_v3_setup_multiple_pads(const iomux_v3_cfg_t *pad_list,
-               unsigned count);
-
-/*
- * Initialise the iomux controller
- */
-void mxc_iomux_v3_init(void __iomem *iomux_v3_base);
-
-#endif /* __MACH_IOMUX_V3_H__*/
-
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c
deleted file mode 100644 (file)
index 4d9a56f..0000000
+++ /dev/null
@@ -1,562 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * armadillo5x0.c
- *
- * Copyright 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
- * updates in http://alberdroid.blogspot.com/
- *
- * Based on Atmark Techno, Inc. armadillo 500 BSP 2008
- * Based on mx31ads.c and pcm037.c Great Work!
- */
-
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/clk.h>
-#include <linux/platform_device.h>
-#include <linux/gpio.h>
-#include <linux/smsc911x.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/mtd/physmap.h>
-#include <linux/io.h>
-#include <linux/input.h>
-#include <linux/i2c.h>
-#include <linux/usb/otg.h>
-#include <linux/usb/ulpi.h>
-#include <linux/delay.h>
-#include <linux/regulator/machine.h>
-#include <linux/regulator/fixed.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-#include <asm/memory.h>
-#include <asm/mach/map.h>
-
-#include "common.h"
-#include "devices-imx31.h"
-#include "crmregs-imx3.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-#include "ulpi.h"
-
-static int armadillo5x0_pins[] = {
-       /* UART1 */
-       MX31_PIN_CTS1__CTS1,
-       MX31_PIN_RTS1__RTS1,
-       MX31_PIN_TXD1__TXD1,
-       MX31_PIN_RXD1__RXD1,
-       /* UART2 */
-       MX31_PIN_CTS2__CTS2,
-       MX31_PIN_RTS2__RTS2,
-       MX31_PIN_TXD2__TXD2,
-       MX31_PIN_RXD2__RXD2,
-       /* LAN9118_IRQ */
-       IOMUX_MODE(MX31_PIN_GPIO1_0, IOMUX_CONFIG_GPIO),
-       /* SDHC1 */
-       MX31_PIN_SD1_DATA3__SD1_DATA3,
-       MX31_PIN_SD1_DATA2__SD1_DATA2,
-       MX31_PIN_SD1_DATA1__SD1_DATA1,
-       MX31_PIN_SD1_DATA0__SD1_DATA0,
-       MX31_PIN_SD1_CLK__SD1_CLK,
-       MX31_PIN_SD1_CMD__SD1_CMD,
-       /* Framebuffer */
-       MX31_PIN_LD0__LD0,
-       MX31_PIN_LD1__LD1,
-       MX31_PIN_LD2__LD2,
-       MX31_PIN_LD3__LD3,
-       MX31_PIN_LD4__LD4,
-       MX31_PIN_LD5__LD5,
-       MX31_PIN_LD6__LD6,
-       MX31_PIN_LD7__LD7,
-       MX31_PIN_LD8__LD8,
-       MX31_PIN_LD9__LD9,
-       MX31_PIN_LD10__LD10,
-       MX31_PIN_LD11__LD11,
-       MX31_PIN_LD12__LD12,
-       MX31_PIN_LD13__LD13,
-       MX31_PIN_LD14__LD14,
-       MX31_PIN_LD15__LD15,
-       MX31_PIN_LD16__LD16,
-       MX31_PIN_LD17__LD17,
-       MX31_PIN_VSYNC3__VSYNC3,
-       MX31_PIN_HSYNC__HSYNC,
-       MX31_PIN_FPSHIFT__FPSHIFT,
-       MX31_PIN_DRDY0__DRDY0,
-       IOMUX_MODE(MX31_PIN_LCS1, IOMUX_CONFIG_GPIO), /*ADV7125_PSAVE*/
-       /* I2C2 */
-       MX31_PIN_CSPI2_MOSI__SCL,
-       MX31_PIN_CSPI2_MISO__SDA,
-       /* OTG */
-       MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
-       MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
-       MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
-       MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
-       MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
-       MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
-       MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
-       MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
-       MX31_PIN_USBOTG_CLK__USBOTG_CLK,
-       MX31_PIN_USBOTG_DIR__USBOTG_DIR,
-       MX31_PIN_USBOTG_NXT__USBOTG_NXT,
-       MX31_PIN_USBOTG_STP__USBOTG_STP,
-       /* USB host 2 */
-       IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_STXD3, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_SRXD3, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_SCK3, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_SFS3, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_STXD6, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_SRXD6, IOMUX_CONFIG_FUNC),
-};
-
-/* USB */
-
-#define OTG_RESET IOMUX_TO_GPIO(MX31_PIN_STXD4)
-#define USBH2_RESET IOMUX_TO_GPIO(MX31_PIN_SCK6)
-#define USBH2_CS IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)
-
-#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
-                       PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
-
-static int usbotg_init(struct platform_device *pdev)
-{
-       int err;
-
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
-
-       /* Chip already enabled by hardware */
-       /* OTG phy reset*/
-       err = gpio_request(OTG_RESET, "USB-OTG-RESET");
-       if (err) {
-               pr_err("Failed to request the usb otg reset gpio\n");
-               return err;
-       }
-
-       err = gpio_direction_output(OTG_RESET, 1/*HIGH*/);
-       if (err) {
-               pr_err("Failed to reset the usb otg phy\n");
-               goto otg_free_reset;
-       }
-
-       gpio_set_value(OTG_RESET, 0/*LOW*/);
-       mdelay(5);
-       gpio_set_value(OTG_RESET, 1/*HIGH*/);
-       mdelay(10);
-
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED |
-                       MXC_EHCI_INTERFACE_DIFF_UNI);
-
-otg_free_reset:
-       gpio_free(OTG_RESET);
-       return err;
-}
-
-static int usbh2_init(struct platform_device *pdev)
-{
-       int err;
-
-       mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
-
-       mxc_iomux_set_gpr(MUX_PGP_UH2, true);
-
-
-       /* Enable the chip */
-       err = gpio_request(USBH2_CS, "USB-H2-CS");
-       if (err) {
-               pr_err("Failed to request the usb host 2 CS gpio\n");
-               return err;
-       }
-
-       err = gpio_direction_output(USBH2_CS, 0/*Enabled*/);
-       if (err) {
-               pr_err("Failed to drive the usb host 2 CS gpio\n");
-               goto h2_free_cs;
-       }
-
-       /* H2 phy reset*/
-       err = gpio_request(USBH2_RESET, "USB-H2-RESET");
-       if (err) {
-               pr_err("Failed to request the usb host 2 reset gpio\n");
-               goto h2_free_cs;
-       }
-
-       err = gpio_direction_output(USBH2_RESET, 1/*HIGH*/);
-       if (err) {
-               pr_err("Failed to reset the usb host 2 phy\n");
-               goto h2_free_reset;
-       }
-
-       gpio_set_value(USBH2_RESET, 0/*LOW*/);
-       mdelay(5);
-       gpio_set_value(USBH2_RESET, 1/*HIGH*/);
-       mdelay(10);
-
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED |
-                       MXC_EHCI_INTERFACE_DIFF_UNI);
-
-h2_free_reset:
-       gpio_free(USBH2_RESET);
-h2_free_cs:
-       gpio_free(USBH2_CS);
-       return err;
-}
-
-static struct mxc_usbh_platform_data usbotg_pdata __initdata = {
-       .init   = usbotg_init,
-       .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
-};
-
-static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
-       .init   = usbh2_init,
-       .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
-};
-
-/* RTC over I2C*/
-#define ARMADILLO5X0_RTC_GPIO  IOMUX_TO_GPIO(MX31_PIN_SRXD4)
-
-static struct i2c_board_info armadillo5x0_i2c_rtc = {
-       I2C_BOARD_INFO("s35390a", 0x30),
-};
-
-/* GPIO BUTTONS */
-static struct gpio_keys_button armadillo5x0_buttons[] = {
-       {
-               .code           = KEY_ENTER, /*28*/
-               .gpio           = IOMUX_TO_GPIO(MX31_PIN_SCLK0),
-               .active_low     = 1,
-               .desc           = "menu",
-               .wakeup         = 1,
-       }, {
-               .code           = KEY_BACK, /*158*/
-               .gpio           = IOMUX_TO_GPIO(MX31_PIN_SRST0),
-               .active_low     = 1,
-               .desc           = "back",
-               .wakeup         = 1,
-       }
-};
-
-static const struct gpio_keys_platform_data
-               armadillo5x0_button_data __initconst = {
-       .buttons        = armadillo5x0_buttons,
-       .nbuttons       = ARRAY_SIZE(armadillo5x0_buttons),
-};
-
-/*
- * NAND Flash
- */
-static const struct mxc_nand_platform_data
-armadillo5x0_nand_board_info __initconst = {
-       .width          = 1,
-       .hw_ecc         = 1,
-};
-
-/*
- * MTD NOR Flash
- */
-static struct mtd_partition armadillo5x0_nor_flash_partitions[] = {
-       {
-               .name           = "nor.bootloader",
-               .offset         = 0x00000000,
-               .size           = 4*32*1024,
-       }, {
-               .name           = "nor.kernel",
-               .offset         = MTDPART_OFS_APPEND,
-               .size           = 16*128*1024,
-       }, {
-               .name           = "nor.userland",
-               .offset         = MTDPART_OFS_APPEND,
-               .size           = 110*128*1024,
-       }, {
-               .name           = "nor.config",
-               .offset         = MTDPART_OFS_APPEND,
-               .size           = 1*128*1024,
-       },
-};
-
-static const struct physmap_flash_data
-               armadillo5x0_nor_flash_pdata __initconst = {
-       .width          = 2,
-       .parts          = armadillo5x0_nor_flash_partitions,
-       .nr_parts       = ARRAY_SIZE(armadillo5x0_nor_flash_partitions),
-};
-
-static const struct resource armadillo5x0_nor_flash_resource __initconst = {
-       .flags          = IORESOURCE_MEM,
-       .start          = MX31_CS0_BASE_ADDR,
-       .end            = MX31_CS0_BASE_ADDR + SZ_64M - 1,
-};
-
-/*
- * FB support
- */
-static const struct fb_videomode fb_modedb[] = {
-       {       /* 640x480 @ 60 Hz */
-               .name           = "CRT-VGA",
-               .refresh        = 60,
-               .xres           = 640,
-               .yres           = 480,
-               .pixclock       = 39721,
-               .left_margin    = 35,
-               .right_margin   = 115,
-               .upper_margin   = 43,
-               .lower_margin   = 1,
-               .hsync_len      = 10,
-               .vsync_len      = 1,
-               .sync           = FB_SYNC_OE_ACT_HIGH,
-               .vmode          = FB_VMODE_NONINTERLACED,
-               .flag           = 0,
-       }, {/* 800x600 @ 56 Hz */
-               .name           = "CRT-SVGA",
-               .refresh        = 56,
-               .xres           = 800,
-               .yres           = 600,
-               .pixclock       = 30000,
-               .left_margin    = 30,
-               .right_margin   = 108,
-               .upper_margin   = 13,
-               .lower_margin   = 10,
-               .hsync_len      = 10,
-               .vsync_len      = 1,
-               .sync           = FB_SYNC_OE_ACT_HIGH | FB_SYNC_HOR_HIGH_ACT |
-                                 FB_SYNC_VERT_HIGH_ACT,
-               .vmode          = FB_VMODE_NONINTERLACED,
-               .flag           = 0,
-       },
-};
-
-static struct mx3fb_platform_data mx3fb_pdata __initdata = {
-       .name           = "CRT-VGA",
-       .mode           = fb_modedb,
-       .num_modes      = ARRAY_SIZE(fb_modedb),
-};
-
-/*
- * SDHC 1
- * MMC support
- */
-static int armadillo5x0_sdhc1_get_ro(struct device *dev)
-{
-       return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B));
-}
-
-static int armadillo5x0_sdhc1_init(struct device *dev,
-                                  irq_handler_t detect_irq, void *data)
-{
-       int ret;
-       int gpio_det, gpio_wp;
-
-       gpio_det = IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK);
-       gpio_wp = IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B);
-
-       ret = gpio_request(gpio_det, "sdhc-card-detect");
-       if (ret)
-               return ret;
-
-       gpio_direction_input(gpio_det);
-
-       ret = gpio_request(gpio_wp, "sdhc-write-protect");
-       if (ret)
-               goto err_gpio_free;
-
-       gpio_direction_input(gpio_wp);
-
-       /* When supported the trigger type have to be BOTH */
-       ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK)),
-                         detect_irq, IRQF_TRIGGER_FALLING,
-                         "sdhc-detect", data);
-
-       if (ret)
-               goto err_gpio_free_2;
-
-       return 0;
-
-err_gpio_free_2:
-       gpio_free(gpio_wp);
-
-err_gpio_free:
-       gpio_free(gpio_det);
-
-       return ret;
-
-}
-
-static void armadillo5x0_sdhc1_exit(struct device *dev, void *data)
-{
-       free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK)), data);
-       gpio_free(IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK));
-       gpio_free(IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B));
-}
-
-static const struct imxmmc_platform_data sdhc_pdata __initconst = {
-       .get_ro = armadillo5x0_sdhc1_get_ro,
-       .init = armadillo5x0_sdhc1_init,
-       .exit = armadillo5x0_sdhc1_exit,
-};
-
-/*
- * SMSC 9118
- * Network support
- */
-static struct resource armadillo5x0_smc911x_resources[] = {
-       {
-               .start  = MX31_CS3_BASE_ADDR,
-               .end    = MX31_CS3_BASE_ADDR + SZ_32M - 1,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               /* irq number is run-time assigned */
-               .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
-       },
-};
-
-static struct smsc911x_platform_config smsc911x_info = {
-       .flags          = SMSC911X_USE_16BIT,
-       .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
-       .irq_type       = SMSC911X_IRQ_TYPE_PUSH_PULL,
-};
-
-static struct platform_device armadillo5x0_smc911x_device = {
-       .name           = "smsc911x",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(armadillo5x0_smc911x_resources),
-       .resource       = armadillo5x0_smc911x_resources,
-       .dev            = {
-               .platform_data = &smsc911x_info,
-       },
-};
-
-/* UART device data */
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static struct platform_device *devices[] __initdata = {
-       &armadillo5x0_smc911x_device,
-};
-
-static struct regulator_consumer_supply dummy_supplies[] = {
-       REGULATOR_SUPPLY("vdd33a", "smsc911x"),
-       REGULATOR_SUPPLY("vddvario", "smsc911x"),
-};
-
-/*
- * Perform board specific initializations
- */
-static void __init armadillo5x0_init(void)
-{
-       imx31_soc_init();
-
-       mxc_iomux_setup_multiple_pins(armadillo5x0_pins,
-                       ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0");
-
-       regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
-
-       imx31_add_imx_i2c1(NULL);
-
-       /* Register UART */
-       imx31_add_imx_uart0(&uart_pdata);
-       imx31_add_imx_uart1(&uart_pdata);
-
-       /* Register FB */
-       imx31_add_ipu_core();
-       imx31_add_mx3_sdc_fb(&mx3fb_pdata);
-
-       /* Register NOR Flash */
-       platform_device_register_resndata(NULL, "physmap-flash", -1,
-                       &armadillo5x0_nor_flash_resource, 1,
-                       &armadillo5x0_nor_flash_pdata,
-                       sizeof(armadillo5x0_nor_flash_pdata));
-
-       /* Register NAND Flash */
-       imx31_add_mxc_nand(&armadillo5x0_nand_board_info);
-
-       /* set NAND page size to 2k if not configured via boot mode pins */
-       imx_writel(imx_readl(mx3_ccm_base + MXC_CCM_RCSR) | (1 << 30),
-                  mx3_ccm_base + MXC_CCM_RCSR);
-}
-
-static void __init armadillo5x0_late(void)
-{
-       armadillo5x0_smc911x_resources[1].start =
-               gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_0));
-       armadillo5x0_smc911x_resources[1].end =
-               gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_0));
-       platform_add_devices(devices, ARRAY_SIZE(devices));
-
-       imx_add_gpio_keys(&armadillo5x0_button_data);
-
-       /* SMSC9118 IRQ pin */
-       gpio_direction_input(MX31_PIN_GPIO1_0);
-
-       /* Register SDHC */
-       imx31_add_mxc_mmc(0, &sdhc_pdata);
-
-       /* RTC */
-       /* Get RTC IRQ and register the chip */
-       if (!gpio_request(ARMADILLO5X0_RTC_GPIO, "rtc")) {
-               if (!gpio_direction_input(ARMADILLO5X0_RTC_GPIO))
-                       armadillo5x0_i2c_rtc.irq =
-                               gpio_to_irq(ARMADILLO5X0_RTC_GPIO);
-               else
-                       gpio_free(ARMADILLO5X0_RTC_GPIO);
-       }
-
-       if (armadillo5x0_i2c_rtc.irq == 0)
-               pr_warn("armadillo5x0_init: failed to get RTC IRQ\n");
-       i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1);
-
-       /* USB */
-       usbotg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-                       ULPI_OTG_DRVVBUS_EXT);
-       if (usbotg_pdata.otg)
-               imx31_add_mxc_ehci_otg(&usbotg_pdata);
-       usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-                       ULPI_OTG_DRVVBUS_EXT);
-       if (usbh2_pdata.otg)
-               imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
-}
-
-static void __init armadillo5x0_timer_init(void)
-{
-       mx31_clocks_init(26000000);
-}
-
-MACHINE_START(ARMADILLO5X0, "Armadillo-500")
-       /* Maintainer: Alberto Panizzo  */
-       .atag_offset = 0x100,
-       .map_io = mx31_map_io,
-       .init_early = imx31_init_early,
-       .init_irq = mx31_init_irq,
-       .init_time      = armadillo5x0_timer_init,
-       .init_machine = armadillo5x0_init,
-       .init_late      = armadillo5x0_late,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-bug.c b/arch/arm/mach-imx/mach-bug.c
deleted file mode 100644 (file)
index 3929208..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2000 Deep Blue Solutions Ltd
- * Copyright (C) 2002 Shane Nay (shane@minirl.com)
- * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright 2011 Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-
-#include <asm/mach/time.h>
-#include <asm/mach/arch.h>
-#include <asm/mach-types.h>
-
-#include "common.h"
-#include "devices-imx31.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static const unsigned int bug_pins[] __initconst = {
-       MX31_PIN_PC_RST__CTS5,
-       MX31_PIN_PC_VS2__RTS5,
-       MX31_PIN_PC_BVD2__TXD5,
-       MX31_PIN_PC_BVD1__RXD5,
-};
-
-static void __init bug_board_init(void)
-{
-       imx31_soc_init();
-
-       mxc_iomux_setup_multiple_pins(bug_pins,
-                                     ARRAY_SIZE(bug_pins), "uart-4");
-       imx31_add_imx_uart4(&uart_pdata);
-}
-
-static void __init bug_timer_init(void)
-{
-       mx31_clocks_init(26000000);
-}
-
-MACHINE_START(BUG, "BugLabs BUGBase")
-       .map_io = mx31_map_io,
-       .init_early = imx31_init_early,
-       .init_irq = mx31_init_irq,
-       .init_time      = bug_timer_init,
-       .init_machine = bug_board_init,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx27.c b/arch/arm/mach-imx/mach-imx27.c
new file mode 100644 (file)
index 0000000..262422a
--- /dev/null
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2012 Sascha Hauer, Pengutronix
+ */
+
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/mm.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/time.h>
+
+#include "common.h"
+#include "hardware.h"
+#include "mx27.h"
+
+/* MX27 memory map definition */
+static struct map_desc imx27_io_desc[] __initdata = {
+       /*
+        * this fixed mapping covers:
+        * - AIPI1
+        * - AIPI2
+        * - AITC
+        * - ROM Patch
+        * - and some reserved space
+        */
+       imx_map_entry(MX27, AIPI, MT_DEVICE),
+       /*
+        * this fixed mapping covers:
+        * - CSI
+        * - ATA
+        */
+       imx_map_entry(MX27, SAHB1, MT_DEVICE),
+       /*
+        * this fixed mapping covers:
+        * - EMI
+        */
+       imx_map_entry(MX27, X_MEMC, MT_DEVICE),
+};
+
+/*
+ * Initialize the memory map. It is called during the
+ * system startup to create static physical to virtual
+ * memory map for the IO modules.
+ */
+static void __init mx27_map_io(void)
+{
+       iotable_init(imx27_io_desc, ARRAY_SIZE(imx27_io_desc));
+}
+
+static void __init imx27_init_early(void)
+{
+       mxc_set_cpu_type(MXC_CPU_MX27);
+}
+
+static void __init mx27_init_irq(void)
+{
+       void __iomem *avic_base;
+       struct device_node *np;
+
+       np = of_find_compatible_node(NULL, NULL, "fsl,avic");
+       avic_base = of_iomap(np, 0);
+       BUG_ON(!avic_base);
+       mxc_init_irq(avic_base);
+}
+
+static const char * const imx27_dt_board_compat[] __initconst = {
+       "fsl,imx27",
+       NULL
+};
+
+DT_MACHINE_START(IMX27_DT, "Freescale i.MX27 (Device Tree Support)")
+       .map_io         = mx27_map_io,
+       .init_early     = imx27_init_early,
+       .init_irq       = mx27_init_irq,
+       .init_late      = imx27_pm_init,
+       .dt_compat      = imx27_dt_board_compat,
+MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
deleted file mode 100644 (file)
index a329e50..0000000
+++ /dev/null
@@ -1,562 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * mach-imx27_visstrim_m10.c
- *
- * Copyright 2010  Javier Martin <javier.martin@vista-silicon.com>
- *
- * Based on mach-pcm038.c, mach-pca100.c, mach-mx27ads.c and others.
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/platform_device.h>
-#include <linux/mtd/physmap.h>
-#include <linux/i2c.h>
-#include <linux/platform_data/pca953x.h>
-#include <linux/input.h>
-#include <linux/gpio.h>
-#include <linux/delay.h>
-#include <linux/dma-map-ops.h>
-#include <linux/leds.h>
-#include <linux/platform_data/asoc-mx27vis.h>
-#include <sound/tlv320aic32x4.h>
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-#include <asm/system_info.h>
-#include <asm/memblock.h>
-
-#include "common.h"
-#include "devices-imx27.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx27.h"
-
-#define TVP5150_RSTN (GPIO_PORTC + 18)
-#define TVP5150_PWDN (GPIO_PORTC + 19)
-#define OTG_PHY_CS_GPIO (GPIO_PORTF + 17)
-#define SDHC1_IRQ_GPIO IMX_GPIO_NR(2, 25)
-
-#define VERSION_MASK           0x7
-#define MOTHERBOARD_SHIFT      4
-#define EXPBOARD_SHIFT         0
-
-#define MOTHERBOARD_BIT2       (GPIO_PORTD + 31)
-#define MOTHERBOARD_BIT1       (GPIO_PORTD + 30)
-#define MOTHERBOARD_BIT0       (GPIO_PORTD + 29)
-
-#define EXPBOARD_BIT2          (GPIO_PORTD + 25)
-#define EXPBOARD_BIT1          (GPIO_PORTD + 27)
-#define EXPBOARD_BIT0          (GPIO_PORTD + 28)
-
-#define AMP_GAIN_0             (GPIO_PORTF + 9)
-#define AMP_GAIN_1             (GPIO_PORTF + 8)
-#define AMP_MUTE_SDL           (GPIO_PORTE + 5)
-#define AMP_MUTE_SDR           (GPIO_PORTF + 7)
-
-static const int visstrim_m10_pins[] __initconst = {
-       /* UART1 (console) */
-       PE12_PF_UART1_TXD,
-       PE13_PF_UART1_RXD,
-       PE14_PF_UART1_CTS,
-       PE15_PF_UART1_RTS,
-       /* FEC */
-       PD0_AIN_FEC_TXD0,
-       PD1_AIN_FEC_TXD1,
-       PD2_AIN_FEC_TXD2,
-       PD3_AIN_FEC_TXD3,
-       PD4_AOUT_FEC_RX_ER,
-       PD5_AOUT_FEC_RXD1,
-       PD6_AOUT_FEC_RXD2,
-       PD7_AOUT_FEC_RXD3,
-       PD8_AF_FEC_MDIO,
-       PD9_AIN_FEC_MDC,
-       PD10_AOUT_FEC_CRS,
-       PD11_AOUT_FEC_TX_CLK,
-       PD12_AOUT_FEC_RXD0,
-       PD13_AOUT_FEC_RX_DV,
-       PD14_AOUT_FEC_RX_CLK,
-       PD15_AOUT_FEC_COL,
-       PD16_AIN_FEC_TX_ER,
-       PF23_AIN_FEC_TX_EN,
-       /* SSI1 */
-       PC20_PF_SSI1_FS,
-       PC21_PF_SSI1_RXD,
-       PC22_PF_SSI1_TXD,
-       PC23_PF_SSI1_CLK,
-       /* SDHC1 */
-       PE18_PF_SD1_D0,
-       PE19_PF_SD1_D1,
-       PE20_PF_SD1_D2,
-       PE21_PF_SD1_D3,
-       PE22_PF_SD1_CMD,
-       PE23_PF_SD1_CLK,
-       /* Both I2Cs */
-       PD17_PF_I2C_DATA,
-       PD18_PF_I2C_CLK,
-       PC5_PF_I2C2_SDA,
-       PC6_PF_I2C2_SCL,
-       /* USB OTG */
-       OTG_PHY_CS_GPIO | GPIO_GPIO | GPIO_OUT,
-       PC9_PF_USBOTG_DATA0,
-       PC11_PF_USBOTG_DATA1,
-       PC10_PF_USBOTG_DATA2,
-       PC13_PF_USBOTG_DATA3,
-       PC12_PF_USBOTG_DATA4,
-       PC7_PF_USBOTG_DATA5,
-       PC8_PF_USBOTG_DATA6,
-       PE25_PF_USBOTG_DATA7,
-       PE24_PF_USBOTG_CLK,
-       PE2_PF_USBOTG_DIR,
-       PE0_PF_USBOTG_NXT,
-       PE1_PF_USBOTG_STP,
-       PB23_PF_USB_PWR,
-       PB24_PF_USB_OC,
-       /* CSI */
-       TVP5150_RSTN | GPIO_GPIO | GPIO_OUT,
-       TVP5150_PWDN | GPIO_GPIO | GPIO_OUT,
-       PB10_PF_CSI_D0,
-       PB11_PF_CSI_D1,
-       PB12_PF_CSI_D2,
-       PB13_PF_CSI_D3,
-       PB14_PF_CSI_D4,
-       PB15_PF_CSI_MCLK,
-       PB16_PF_CSI_PIXCLK,
-       PB17_PF_CSI_D5,
-       PB18_PF_CSI_D6,
-       PB19_PF_CSI_D7,
-       PB20_PF_CSI_VSYNC,
-       PB21_PF_CSI_HSYNC,
-       /* mother board version */
-       MOTHERBOARD_BIT2 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
-       MOTHERBOARD_BIT1 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
-       MOTHERBOARD_BIT0 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
-       /* expansion board version */
-       EXPBOARD_BIT2 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
-       EXPBOARD_BIT1 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
-       EXPBOARD_BIT0 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
-       /* Audio AMP control */
-       AMP_GAIN_0 | GPIO_GPIO | GPIO_OUT,
-       AMP_GAIN_1 | GPIO_GPIO | GPIO_OUT,
-       AMP_MUTE_SDL | GPIO_GPIO | GPIO_OUT,
-       AMP_MUTE_SDR | GPIO_GPIO | GPIO_OUT,
-};
-
-static struct gpio visstrim_m10_version_gpios[] = {
-       { EXPBOARD_BIT0, GPIOF_IN, "exp-version-0" },
-       { EXPBOARD_BIT1, GPIOF_IN, "exp-version-1" },
-       { EXPBOARD_BIT2, GPIOF_IN, "exp-version-2" },
-       { MOTHERBOARD_BIT0, GPIOF_IN, "mother-version-0" },
-       { MOTHERBOARD_BIT1, GPIOF_IN, "mother-version-1" },
-       { MOTHERBOARD_BIT2, GPIOF_IN, "mother-version-2" },
-};
-
-static const struct gpio visstrim_m10_gpios[] __initconst = {
-       {
-               .gpio = TVP5150_RSTN,
-               .flags = GPIOF_DIR_OUT | GPIOF_INIT_HIGH,
-               .label = "tvp5150_rstn",
-       },
-       {
-               .gpio = TVP5150_PWDN,
-               .flags = GPIOF_DIR_OUT | GPIOF_INIT_LOW,
-               .label = "tvp5150_pwdn",
-       },
-       {
-               .gpio = OTG_PHY_CS_GPIO,
-               .flags = GPIOF_DIR_OUT | GPIOF_INIT_LOW,
-               .label = "usbotg_cs",
-       },
-       {
-               .gpio = AMP_GAIN_0,
-               .flags = GPIOF_DIR_OUT,
-               .label = "amp-gain-0",
-       },
-       {
-               .gpio = AMP_GAIN_1,
-               .flags = GPIOF_DIR_OUT,
-               .label = "amp-gain-1",
-       },
-       {
-               .gpio = AMP_MUTE_SDL,
-               .flags = GPIOF_DIR_OUT,
-               .label = "amp-mute-sdl",
-       },
-       {
-               .gpio = AMP_MUTE_SDR,
-               .flags = GPIOF_DIR_OUT,
-               .label = "amp-mute-sdr",
-       },
-};
-
-/* Camera */
-static struct mx2_camera_platform_data visstrim_camera = {
-       .flags = MX2_CAMERA_CCIR | MX2_CAMERA_CCIR_INTERLACE |
-                MX2_CAMERA_PCLK_SAMPLE_RISING,
-       .clk = 100000,
-};
-
-static phys_addr_t mx2_camera_base __initdata;
-#define MX2_CAMERA_BUF_SIZE SZ_8M
-
-static void __init visstrim_analog_camera_init(void)
-{
-       struct platform_device *pdev;
-
-       gpio_set_value(TVP5150_PWDN, 1);
-       ndelay(1);
-       gpio_set_value(TVP5150_RSTN, 0);
-       ndelay(500);
-       gpio_set_value(TVP5150_RSTN, 1);
-       ndelay(200000);
-
-       pdev = imx27_add_mx2_camera(&visstrim_camera);
-       if (IS_ERR(pdev))
-               return;
-
-       dma_declare_coherent_memory(&pdev->dev, mx2_camera_base,
-                                   mx2_camera_base, MX2_CAMERA_BUF_SIZE);
-}
-
-static void __init visstrim_reserve(void)
-{
-       /* reserve 4 MiB for mx2-camera */
-       mx2_camera_base = arm_memblock_steal(3 * MX2_CAMERA_BUF_SIZE,
-                       MX2_CAMERA_BUF_SIZE);
-}
-
-/* GPIOs used as events for applications */
-static struct gpio_keys_button visstrim_gpio_keys[] = {
-       {
-               .type   = EV_KEY,
-               .code   = KEY_RESTART,
-               .gpio   = (GPIO_PORTC + 15),
-               .desc   = "Default config",
-               .active_low = 0,
-               .wakeup = 1,
-       },
-       {
-               .type   = EV_KEY,
-               .code   = KEY_RECORD,
-               .gpio   = (GPIO_PORTF + 14),
-               .desc   = "Record",
-               .active_low = 0,
-               .wakeup = 1,
-       },
-       {
-               .type   = EV_KEY,
-               .code   = KEY_STOP,
-               .gpio   = (GPIO_PORTF + 13),
-               .desc   = "Stop",
-               .active_low = 0,
-               .wakeup = 1,
-       }
-};
-
-static const struct gpio_keys_platform_data
-               visstrim_gpio_keys_platform_data __initconst = {
-       .buttons        = visstrim_gpio_keys,
-       .nbuttons       = ARRAY_SIZE(visstrim_gpio_keys),
-};
-
-/* led */
-static const struct gpio_led visstrim_m10_leds[] __initconst = {
-       {
-               .name = "visstrim:ld0",
-               .default_trigger = "nand-disk",
-               .gpio = (GPIO_PORTC + 29),
-       },
-       {
-               .name = "visstrim:ld1",
-               .default_trigger = "nand-disk",
-               .gpio = (GPIO_PORTC + 24),
-       },
-       {
-               .name = "visstrim:ld2",
-               .default_trigger = "nand-disk",
-               .gpio = (GPIO_PORTC + 28),
-       },
-       {
-               .name = "visstrim:ld3",
-               .default_trigger = "nand-disk",
-               .gpio = (GPIO_PORTC + 25),
-       },
-};
-
-static const struct gpio_led_platform_data visstrim_m10_led_data __initconst = {
-       .leds = visstrim_m10_leds,
-       .num_leds = ARRAY_SIZE(visstrim_m10_leds),
-};
-
-/* Visstrim_SM10 has a microSD slot connected to sdhc1 */
-static int visstrim_m10_sdhc1_init(struct device *dev,
-               irq_handler_t detect_irq, void *data)
-{
-       int ret;
-
-       ret = request_irq(gpio_to_irq(SDHC1_IRQ_GPIO), detect_irq,
-                         IRQF_TRIGGER_FALLING, "mmc-detect", data);
-       return ret;
-}
-
-static void visstrim_m10_sdhc1_exit(struct device *dev, void *data)
-{
-       free_irq(gpio_to_irq(SDHC1_IRQ_GPIO), data);
-}
-
-static const struct imxmmc_platform_data visstrim_m10_sdhc_pdata __initconst = {
-       .init = visstrim_m10_sdhc1_init,
-       .exit = visstrim_m10_sdhc1_exit,
-};
-
-/* Visstrim_SM10 NOR flash */
-static struct physmap_flash_data visstrim_m10_flash_data = {
-       .width = 2,
-};
-
-static struct resource visstrim_m10_flash_resource = {
-       .start = 0xc0000000,
-       .end = 0xc0000000 + SZ_64M - 1,
-       .flags = IORESOURCE_MEM,
-};
-
-static struct platform_device visstrim_m10_nor_mtd_device = {
-       .name = "physmap-flash",
-       .id = 0,
-       .dev = {
-               .platform_data = &visstrim_m10_flash_data,
-       },
-       .num_resources = 1,
-       .resource = &visstrim_m10_flash_resource,
-};
-
-static struct platform_device *platform_devices[] __initdata = {
-       &visstrim_m10_nor_mtd_device,
-};
-
-/* Visstrim_M10 uses UART0 as console */
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-/* I2C */
-static const struct imxi2c_platform_data visstrim_m10_i2c_data __initconst = {
-       .bitrate = 100000,
-};
-
-static struct pca953x_platform_data visstrim_m10_pca9555_pdata = {
-       .gpio_base = 240, /* After MX27 internal GPIOs */
-       .invert = 0,
-};
-
-static struct aic32x4_pdata visstrim_m10_aic32x4_pdata = {
-       .power_cfg = AIC32X4_PWR_MICBIAS_2075_LDOIN |
-                    AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE |
-                    AIC32X4_PWR_AIC32X4_LDO_ENABLE |
-                    AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36 |
-                    AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED,
-       .micpga_routing = AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K |
-                        AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K,
-       .swapdacs = false,
-};
-
-static struct i2c_board_info visstrim_m10_i2c_devices[] = {
-       {
-               I2C_BOARD_INFO("pca9555", 0x20),
-               .platform_data = &visstrim_m10_pca9555_pdata,
-       },
-       {
-               I2C_BOARD_INFO("tlv320aic32x4", 0x18),
-               .platform_data = &visstrim_m10_aic32x4_pdata,
-       },
-       {
-                I2C_BOARD_INFO("m41t00", 0x68),
-       }
-};
-
-/* USB OTG */
-static int otg_phy_init(struct platform_device *pdev)
-{
-       return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
-}
-
-static const struct mxc_usbh_platform_data
-visstrim_m10_usbotg_pdata __initconst = {
-       .init = otg_phy_init,
-       .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
-};
-
-/* SSI */
-static const struct imx_ssi_platform_data visstrim_m10_ssi_pdata __initconst = {
-       .flags                  = IMX_SSI_DMA | IMX_SSI_SYN,
-};
-
-/* coda */
-
-static void __init visstrim_coda_init(void)
-{
-       struct platform_device *pdev;
-
-       pdev = imx27_add_coda();
-       dma_declare_coherent_memory(&pdev->dev,
-                                   mx2_camera_base + MX2_CAMERA_BUF_SIZE,
-                                   mx2_camera_base + MX2_CAMERA_BUF_SIZE,
-                                   MX2_CAMERA_BUF_SIZE);
-}
-
-/* DMA deinterlace */
-static struct platform_device visstrim_deinterlace = {
-       .name = "m2m-deinterlace",
-       .id = 0,
-};
-
-static void __init visstrim_deinterlace_init(void)
-{
-       int ret = -ENOMEM;
-       struct platform_device *pdev = &visstrim_deinterlace;
-
-       ret = platform_device_register(pdev);
-
-       dma_declare_coherent_memory(&pdev->dev,
-                                   mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE,
-                                   mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE,
-                                   MX2_CAMERA_BUF_SIZE);
-}
-
-/* Emma-PrP for format conversion */
-static void __init visstrim_emmaprp_init(void)
-{
-       struct platform_device *pdev;
-       int ret;
-
-       pdev = imx27_add_mx2_emmaprp();
-       if (IS_ERR(pdev))
-               return;
-
-       /*
-        * Use the same memory area as the analog camera since both
-        * devices are, by nature, exclusive.
-        */
-       ret = dma_declare_coherent_memory(&pdev->dev,
-                               mx2_camera_base, mx2_camera_base,
-                               MX2_CAMERA_BUF_SIZE);
-       if (ret)
-               pr_err("Failed to declare memory for emmaprp\n");
-}
-
-/* Audio */
-static const struct snd_mx27vis_platform_data snd_mx27vis_pdata __initconst = {
-       .amp_gain0_gpio = AMP_GAIN_0,
-       .amp_gain1_gpio = AMP_GAIN_1,
-       .amp_mutel_gpio = AMP_MUTE_SDL,
-       .amp_muter_gpio = AMP_MUTE_SDR,
-};
-
-static void __init visstrim_m10_revision(void)
-{
-       int exp_version = 0;
-       int mo_version = 0;
-       int ret;
-
-       ret = gpio_request_array(visstrim_m10_version_gpios,
-                                ARRAY_SIZE(visstrim_m10_version_gpios));
-       if (ret) {
-               pr_err("Failed to request version gpios");
-               return;
-       }
-
-       /* Get expansion board version (negative logic) */
-       exp_version |= !gpio_get_value(EXPBOARD_BIT2) << 2;
-       exp_version |= !gpio_get_value(EXPBOARD_BIT1) << 1;
-       exp_version |= !gpio_get_value(EXPBOARD_BIT0);
-
-       /* Get mother board version (negative logic) */
-       mo_version |= !gpio_get_value(MOTHERBOARD_BIT2) << 2;
-       mo_version |= !gpio_get_value(MOTHERBOARD_BIT1) << 1;
-       mo_version |= !gpio_get_value(MOTHERBOARD_BIT0);
-
-       system_rev = 0x27000;
-       system_rev |= (mo_version << MOTHERBOARD_SHIFT);
-       system_rev |= (exp_version << EXPBOARD_SHIFT);
-}
-
-static void __init visstrim_m10_board_init(void)
-{
-       int ret;
-
-       imx27_soc_init();
-       visstrim_m10_revision();
-
-       ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins,
-                       ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10");
-       if (ret)
-               pr_err("Failed to setup pins (%d)\n", ret);
-
-       imx27_add_imx_ssi(0, &visstrim_m10_ssi_pdata);
-       imx27_add_imx_uart0(&uart_pdata);
-
-       imx27_add_imx_i2c(0, &visstrim_m10_i2c_data);
-       imx27_add_imx_i2c(1, &visstrim_m10_i2c_data);
-       i2c_register_board_info(0, visstrim_m10_i2c_devices,
-                               ARRAY_SIZE(visstrim_m10_i2c_devices));
-
-       imx27_add_mxc_mmc(0, &visstrim_m10_sdhc_pdata);
-       imx27_add_mxc_ehci_otg(&visstrim_m10_usbotg_pdata);
-       imx27_add_fec(NULL);
-
-       platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
-}
-
-static void __init visstrim_m10_late_init(void)
-{
-       int mo_version, ret;
-
-       ret = gpio_request_array(visstrim_m10_gpios,
-                                ARRAY_SIZE(visstrim_m10_gpios));
-       if (ret)
-               pr_err("Failed to request gpios (%d)\n", ret);
-
-       imx_add_gpio_keys(&visstrim_gpio_keys_platform_data);
-
-       imx_add_platform_device("mx27vis", 0, NULL, 0, &snd_mx27vis_pdata,
-                               sizeof(snd_mx27vis_pdata));
-
-       gpio_led_register_device(0, &visstrim_m10_led_data);
-
-       /* Use mother board version to decide what video devices we shall use */
-       mo_version = (system_rev >> MOTHERBOARD_SHIFT) & VERSION_MASK;
-       if (mo_version & 0x1) {
-               visstrim_emmaprp_init();
-
-               /*
-                * Despite not being used, tvp5150 must be
-                * powered on to avoid I2C problems. To minimize
-                * power consupmtion keep reset enabled.
-                */
-               gpio_set_value(TVP5150_PWDN, 1);
-               ndelay(1);
-               gpio_set_value(TVP5150_RSTN, 0);
-       } else {
-               visstrim_deinterlace_init();
-               visstrim_analog_camera_init();
-       }
-
-       visstrim_coda_init();
-}
-
-static void __init visstrim_m10_timer_init(void)
-{
-       mx27_clocks_init((unsigned long)25000000);
-}
-
-MACHINE_START(IMX27_VISSTRIM_M10, "Vista Silicon Visstrim_M10")
-       .atag_offset = 0x100,
-       .reserve = visstrim_reserve,
-       .map_io = mx27_map_io,
-       .init_early = imx27_init_early,
-       .init_irq = mx27_init_irq,
-       .init_time      = visstrim_m10_timer_init,
-       .init_machine = visstrim_m10_board_init,
-       .init_late      = visstrim_m10_late_init,
-       .restart        = mxc_restart,
-MACHINE_END
index 128cf4c..445256e 100644 (file)
@@ -67,6 +67,9 @@ static const char *const imx7ulp_dt_compat[] __initconst = {
 
 static void __init imx7ulp_init_late(void)
 {
+       if (IS_ENABLED(CONFIG_ARM_IMX_CPUFREQ_DT))
+               platform_device_register_simple("imx-cpufreq-dt", -1, NULL, 0);
+
        imx7ulp_cpuidle_init();
 }
 
diff --git a/arch/arm/mach-imx/mach-kzm_arm11_01.c b/arch/arm/mach-imx/mach-kzm_arm11_01.c
deleted file mode 100644 (file)
index 63f7f78..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * KZM-ARM11-01 support
- *  Copyright (C) 2009  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- * based on code for MX31ADS,
- *  Copyright (C) 2000 Deep Blue Solutions Ltd
- *  Copyright (C) 2002 Shane Nay (shane@minirl.com)
- *  Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- */
-
-#include <linux/gpio.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/serial_8250.h>
-#include <linux/smsc911x.h>
-#include <linux/types.h>
-#include <linux/regulator/machine.h>
-#include <linux/regulator/fixed.h>
-
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-#include <asm/memory.h>
-#include <asm/setup.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/irq.h>
-#include <asm/mach/map.h>
-#include <asm/mach/time.h>
-
-#include "common.h"
-#include "devices-imx31.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-
-#define KZM_ARM11_IO_ADDRESS(x) (IOMEM(                                        \
-       IMX_IO_P2V_MODULE(x, MX31_CS4) ?:                               \
-       IMX_IO_P2V_MODULE(x, MX31_CS5)) ?:                              \
-       MX31_IO_ADDRESS(x))
-
-/*
- *  KZM-ARM11-01 Board Control Registers on FPGA
- */
-#define KZM_ARM11_CTL1         (MX31_CS4_BASE_ADDR + 0x1000)
-#define KZM_ARM11_CTL2         (MX31_CS4_BASE_ADDR + 0x1001)
-#define KZM_ARM11_RSW1         (MX31_CS4_BASE_ADDR + 0x1002)
-#define KZM_ARM11_BACK_LIGHT   (MX31_CS4_BASE_ADDR + 0x1004)
-#define KZM_ARM11_FPGA_REV     (MX31_CS4_BASE_ADDR + 0x1008)
-#define KZM_ARM11_7SEG_LED     (MX31_CS4_BASE_ADDR + 0x1010)
-#define KZM_ARM11_LEDS         (MX31_CS4_BASE_ADDR + 0x1020)
-#define KZM_ARM11_DIPSW2       (MX31_CS4_BASE_ADDR + 0x1003)
-
-/*
- * External UART for touch panel on FPGA
- */
-#define KZM_ARM11_16550                (MX31_CS4_BASE_ADDR + 0x1050)
-
-#if IS_ENABLED(CONFIG_SERIAL_8250)
-/*
- * KZM-ARM11-01 has an external UART on FPGA
- */
-static struct plat_serial8250_port serial_platform_data[] = {
-       {
-               .membase        = KZM_ARM11_IO_ADDRESS(KZM_ARM11_16550),
-               .mapbase        = KZM_ARM11_16550,
-               /* irq number is run-time assigned */
-               .irqflags       = IRQ_TYPE_EDGE_RISING,
-               .uartclk        = 14745600,
-               .regshift       = 0,
-               .iotype         = UPIO_MEM,
-               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
-                                 UPF_BUGGY_UART,
-       },
-       {},
-};
-
-static struct resource serial8250_resources[] = {
-       {
-               .start  = KZM_ARM11_16550,
-               .end    = KZM_ARM11_16550 + 0x10,
-               .flags  = IORESOURCE_MEM,
-       },
-       {
-               /* irq number is run-time assigned */
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device serial_device = {
-       .name           = "serial8250",
-       .id             = PLAT8250_DEV_PLATFORM,
-       .dev            = {
-                               .platform_data = serial_platform_data,
-                         },
-       .num_resources  = ARRAY_SIZE(serial8250_resources),
-       .resource       = serial8250_resources,
-};
-
-static int __init kzm_init_ext_uart(void)
-{
-       u8 tmp;
-
-       /*
-        * GPIO 1-1: external UART interrupt line
-        */
-       mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO));
-       gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1), "ext-uart-int");
-       gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1));
-
-       /*
-        * Unmask UART interrupt
-        */
-       tmp = __raw_readb(KZM_ARM11_IO_ADDRESS(KZM_ARM11_CTL1));
-       tmp |= 0x2;
-       __raw_writeb(tmp, KZM_ARM11_IO_ADDRESS(KZM_ARM11_CTL1));
-
-       serial_platform_data[0].irq =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1));
-       serial8250_resources[1].start =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1));
-       serial8250_resources[1].end =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1));
-
-       return platform_device_register(&serial_device);
-}
-#else
-static inline int kzm_init_ext_uart(void)
-{
-       return 0;
-}
-#endif
-
-/*
- * SMSC LAN9118
- */
-#if IS_ENABLED(CONFIG_SMSC911X)
-static struct smsc911x_platform_config kzm_smsc9118_config = {
-       .phy_interface  = PHY_INTERFACE_MODE_MII,
-       .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
-       .irq_type       = SMSC911X_IRQ_TYPE_PUSH_PULL,
-       .flags          = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
-};
-
-static struct resource kzm_smsc9118_resources[] = {
-       {
-               .start  = MX31_CS5_BASE_ADDR,
-               .end    = MX31_CS5_BASE_ADDR + SZ_128K - 1,
-               .flags  = IORESOURCE_MEM,
-       },
-       {
-               /* irq number is run-time assigned */
-               .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
-       },
-};
-
-static struct platform_device kzm_smsc9118_device = {
-       .name           = "smsc911x",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(kzm_smsc9118_resources),
-       .resource       = kzm_smsc9118_resources,
-       .dev            = {
-                               .platform_data = &kzm_smsc9118_config,
-                         },
-};
-
-static struct regulator_consumer_supply dummy_supplies[] = {
-       REGULATOR_SUPPLY("vdd33a", "smsc911x"),
-       REGULATOR_SUPPLY("vddvario", "smsc911x"),
-};
-
-static int __init kzm_init_smsc9118(void)
-{
-       /*
-        * GPIO 1-2: SMSC9118 interrupt line
-        */
-       mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO1_2, IOMUX_CONFIG_GPIO));
-       gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2), "smsc9118-int");
-       gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2));
-
-       regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
-
-       kzm_smsc9118_resources[1].start =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2));
-       kzm_smsc9118_resources[1].end =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2));
-
-       return platform_device_register(&kzm_smsc9118_device);
-}
-#else
-static inline int kzm_init_smsc9118(void)
-{
-       return 0;
-}
-#endif
-
-#if IS_ENABLED(CONFIG_SERIAL_IMX)
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static void __init kzm_init_imx_uart(void)
-{
-       imx31_add_imx_uart0(&uart_pdata);
-       imx31_add_imx_uart1(&uart_pdata);
-}
-#else
-static inline void kzm_init_imx_uart(void)
-{
-}
-#endif
-
-static int kzm_pins[] __initdata = {
-       MX31_PIN_CTS1__CTS1,
-       MX31_PIN_RTS1__RTS1,
-       MX31_PIN_TXD1__TXD1,
-       MX31_PIN_RXD1__RXD1,
-       MX31_PIN_DCD_DCE1__DCD_DCE1,
-       MX31_PIN_RI_DCE1__RI_DCE1,
-       MX31_PIN_DSR_DCE1__DSR_DCE1,
-       MX31_PIN_DTR_DCE1__DTR_DCE1,
-       MX31_PIN_CTS2__CTS2,
-       MX31_PIN_RTS2__RTS2,
-       MX31_PIN_TXD2__TXD2,
-       MX31_PIN_RXD2__RXD2,
-       MX31_PIN_DCD_DTE1__DCD_DTE2,
-       MX31_PIN_RI_DTE1__RI_DTE2,
-       MX31_PIN_DSR_DTE1__DSR_DTE2,
-       MX31_PIN_DTR_DTE1__DTR_DTE2,
-};
-
-/*
- * Board specific initialization.
- */
-static void __init kzm_board_init(void)
-{
-       imx31_soc_init();
-
-       mxc_iomux_setup_multiple_pins(kzm_pins,
-                                     ARRAY_SIZE(kzm_pins), "kzm");
-       kzm_init_imx_uart();
-
-       pr_info("Clock input source is 26MHz\n");
-}
-
-static void __init kzm_late_init(void)
-{
-       kzm_init_ext_uart();
-       kzm_init_smsc9118();
-}
-
-/*
- * This structure defines static mappings for the kzm-arm11-01 board.
- */
-static struct map_desc kzm_io_desc[] __initdata = {
-       {
-               .virtual        = (unsigned long)MX31_CS4_BASE_ADDR_VIRT,
-               .pfn            = __phys_to_pfn(MX31_CS4_BASE_ADDR),
-               .length         = MX31_CS4_SIZE,
-               .type           = MT_DEVICE
-       },
-       {
-               .virtual        = (unsigned long)MX31_CS5_BASE_ADDR_VIRT,
-               .pfn            = __phys_to_pfn(MX31_CS5_BASE_ADDR),
-               .length         = MX31_CS5_SIZE,
-               .type           = MT_DEVICE
-       },
-};
-
-/*
- * Set up static virtual mappings.
- */
-static void __init kzm_map_io(void)
-{
-       mx31_map_io();
-       iotable_init(kzm_io_desc, ARRAY_SIZE(kzm_io_desc));
-}
-
-static void __init kzm_timer_init(void)
-{
-       mx31_clocks_init(26000000);
-}
-
-MACHINE_START(KZM_ARM11_01, "Kyoto Microcomputer Co., Ltd. KZM-ARM11-01")
-       .atag_offset = 0x100,
-       .map_io = kzm_map_io,
-       .init_early = imx31_init_early,
-       .init_irq = mx31_init_irq,
-       .init_time      = kzm_timer_init,
-       .init_machine = kzm_board_init,
-       .init_late      = kzm_late_init,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c
deleted file mode 100644 (file)
index ec011e8..0000000
+++ /dev/null
@@ -1,338 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *  Copyright (C) 2000 Deep Blue Solutions Ltd
- *  Copyright (C) 2002 Shane Nay (shane@minirl.com)
- *  Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- */
-
-#include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/physmap.h>
-#include <linux/gpio/driver.h>
-#include <linux/gpio/machine.h>
-#include <linux/gpio.h>
-#include <linux/regulator/fixed.h>
-#include <linux/regulator/machine.h>
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-
-#include "common.h"
-#include "devices-imx21.h"
-#include "hardware.h"
-#include "iomux-mx21.h"
-
-#define MX21ADS_CS8900A_REG            (MX21_CS1_BASE_ADDR + 0x000000)
-#define MX21ADS_ST16C255_IOBASE_REG    (MX21_CS1_BASE_ADDR + 0x200000)
-#define MX21ADS_VERSION_REG            (MX21_CS1_BASE_ADDR + 0x400000)
-#define MX21ADS_IO_REG                 (MX21_CS1_BASE_ADDR + 0x800000)
-
-#define MX21ADS_MMC_CD                 IMX_GPIO_NR(4, 25)
-#define MX21ADS_CS8900A_IRQ_GPIO       IMX_GPIO_NR(5, 11)
-#define MX21ADS_MMGPIO_BASE            (6 * 32)
-
-/* MX21ADS_IO_REG bit definitions */
-#define MX21ADS_IO_SD_WP               (MX21ADS_MMGPIO_BASE + 0)
-#define MX21ADS_IO_TP6                 (MX21ADS_IO_SD_WP)
-#define MX21ADS_IO_SW_SEL              (MX21ADS_MMGPIO_BASE + 1)
-#define MX21ADS_IO_TP7                 (MX21ADS_IO_SW_SEL)
-#define MX21ADS_IO_RESET_E_UART                (MX21ADS_MMGPIO_BASE + 2)
-#define MX21ADS_IO_RESET_BASE          (MX21ADS_MMGPIO_BASE + 3)
-#define MX21ADS_IO_CSI_CTL2            (MX21ADS_MMGPIO_BASE + 4)
-#define MX21ADS_IO_CSI_CTL1            (MX21ADS_MMGPIO_BASE + 5)
-#define MX21ADS_IO_CSI_CTL0            (MX21ADS_MMGPIO_BASE + 6)
-#define MX21ADS_IO_UART1_EN            (MX21ADS_MMGPIO_BASE + 7)
-#define MX21ADS_IO_UART4_EN            (MX21ADS_MMGPIO_BASE + 8)
-#define MX21ADS_IO_LCDON               (MX21ADS_MMGPIO_BASE + 9)
-#define MX21ADS_IO_IRDA_EN             (MX21ADS_MMGPIO_BASE + 10)
-#define MX21ADS_IO_IRDA_FIR_SEL                (MX21ADS_MMGPIO_BASE + 11)
-#define MX21ADS_IO_IRDA_MD0_B          (MX21ADS_MMGPIO_BASE + 12)
-#define MX21ADS_IO_IRDA_MD1            (MX21ADS_MMGPIO_BASE + 13)
-#define MX21ADS_IO_LED4_ON             (MX21ADS_MMGPIO_BASE + 14)
-#define MX21ADS_IO_LED3_ON             (MX21ADS_MMGPIO_BASE + 15)
-
-static const int mx21ads_pins[] __initconst = {
-
-       /* CS8900A */
-       (GPIO_PORTE | GPIO_GPIO | GPIO_IN | 11),
-
-       /* UART1 */
-       PE12_PF_UART1_TXD,
-       PE13_PF_UART1_RXD,
-       PE14_PF_UART1_CTS,
-       PE15_PF_UART1_RTS,
-
-       /* UART3 (IrDA) - only TXD and RXD */
-       PE8_PF_UART3_TXD,
-       PE9_PF_UART3_RXD,
-
-       /* UART4 */
-       PB26_AF_UART4_RTS,
-       PB28_AF_UART4_TXD,
-       PB29_AF_UART4_CTS,
-       PB31_AF_UART4_RXD,
-
-       /* LCDC */
-       PA5_PF_LSCLK,
-       PA6_PF_LD0,
-       PA7_PF_LD1,
-       PA8_PF_LD2,
-       PA9_PF_LD3,
-       PA10_PF_LD4,
-       PA11_PF_LD5,
-       PA12_PF_LD6,
-       PA13_PF_LD7,
-       PA14_PF_LD8,
-       PA15_PF_LD9,
-       PA16_PF_LD10,
-       PA17_PF_LD11,
-       PA18_PF_LD12,
-       PA19_PF_LD13,
-       PA20_PF_LD14,
-       PA21_PF_LD15,
-       PA22_PF_LD16,
-       PA24_PF_REV,     /* Sharp panel dedicated signal */
-       PA25_PF_CLS,     /* Sharp panel dedicated signal */
-       PA26_PF_PS,      /* Sharp panel dedicated signal */
-       PA27_PF_SPL_SPR, /* Sharp panel dedicated signal */
-       PA28_PF_HSYNC,
-       PA29_PF_VSYNC,
-       PA30_PF_CONTRAST,
-       PA31_PF_OE_ACD,
-
-       /* MMC/SDHC */
-       PE18_PF_SD1_D0,
-       PE19_PF_SD1_D1,
-       PE20_PF_SD1_D2,
-       PE21_PF_SD1_D3,
-       PE22_PF_SD1_CMD,
-       PE23_PF_SD1_CLK,
-
-       /* NFC */
-       PF0_PF_NRFB,
-       PF1_PF_NFCE,
-       PF2_PF_NFWP,
-       PF3_PF_NFCLE,
-       PF4_PF_NFALE,
-       PF5_PF_NFRE,
-       PF6_PF_NFWE,
-       PF7_PF_NFIO0,
-       PF8_PF_NFIO1,
-       PF9_PF_NFIO2,
-       PF10_PF_NFIO3,
-       PF11_PF_NFIO4,
-       PF12_PF_NFIO5,
-       PF13_PF_NFIO6,
-       PF14_PF_NFIO7,
-};
-
-/* ADS's NOR flash: 2x AM29BDS128HE9VKI on 32-bit bus */
-static struct physmap_flash_data mx21ads_flash_data = {
-       .width = 4,
-};
-
-static struct resource mx21ads_flash_resource =
-       DEFINE_RES_MEM(MX21_CS0_BASE_ADDR, SZ_32M);
-
-static struct platform_device mx21ads_nor_mtd_device = {
-       .name = "physmap-flash",
-       .id = 0,
-       .dev = {
-               .platform_data = &mx21ads_flash_data,
-       },
-       .num_resources = 1,
-       .resource = &mx21ads_flash_resource,
-};
-
-static struct resource mx21ads_cs8900_resources[] __initdata = {
-       DEFINE_RES_MEM(MX21ADS_CS8900A_REG, SZ_1K),
-       /* irq number is run-time assigned */
-       DEFINE_RES_IRQ(-1),
-};
-
-static const struct platform_device_info mx21ads_cs8900_devinfo __initconst = {
-       .name = "cs89x0",
-       .id = 0,
-       .res = mx21ads_cs8900_resources,
-       .num_res = ARRAY_SIZE(mx21ads_cs8900_resources),
-};
-
-static const struct imxuart_platform_data uart_pdata_rts __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static const struct imxuart_platform_data uart_pdata_norts __initconst = {
-};
-
-static struct resource mx21ads_mmgpio_resource =
-       DEFINE_RES_MEM_NAMED(MX21ADS_IO_REG, SZ_2, "dat");
-
-static struct bgpio_pdata mx21ads_mmgpio_pdata = {
-       .label  = "mx21ads-mmgpio",
-       .base   = MX21ADS_MMGPIO_BASE,
-       .ngpio  = 16,
-};
-
-static struct platform_device mx21ads_mmgpio = {
-       .name = "basic-mmio-gpio",
-       .id = PLATFORM_DEVID_AUTO,
-       .resource = &mx21ads_mmgpio_resource,
-       .num_resources = 1,
-       .dev = {
-               .platform_data = &mx21ads_mmgpio_pdata,
-       },
-};
-
-static struct regulator_consumer_supply mx21ads_lcd_regulator_consumer =
-       REGULATOR_SUPPLY("lcd", "imx-fb.0");
-
-static struct regulator_init_data mx21ads_lcd_regulator_init_data = {
-       .constraints = {
-               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-       },
-       .consumer_supplies      = &mx21ads_lcd_regulator_consumer,
-       .num_consumer_supplies  = 1,
-};
-
-static struct fixed_voltage_config mx21ads_lcd_regulator_pdata = {
-       .supply_name    = "LCD",
-       .microvolts     = 3300000,
-       .init_data      = &mx21ads_lcd_regulator_init_data,
-};
-
-static struct platform_device mx21ads_lcd_regulator = {
-       .name = "reg-fixed-voltage",
-       .id = PLATFORM_DEVID_AUTO,
-       .dev = {
-               .platform_data = &mx21ads_lcd_regulator_pdata,
-       },
-};
-
-static struct gpiod_lookup_table mx21ads_lcd_regulator_gpiod_table = {
-       .dev_id = "reg-fixed-voltage.0", /* Let's hope ID 0 is what we get */
-       .table = {
-               GPIO_LOOKUP("mx21ads-mmgpio", 9, NULL, GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-/*
- * Connected is a portrait Sharp-QVGA display
- * of type: LQ035Q7DB02
- */
-static struct imx_fb_videomode mx21ads_modes[] = {
-       {
-               .mode = {
-                       .name           = "Sharp-LQ035Q7",
-                       .refresh        = 60,
-                       .xres           = 240,
-                       .yres           = 320,
-                       .pixclock       = 188679, /* in ps (5.3MHz) */
-                       .hsync_len      = 2,
-                       .left_margin    = 6,
-                       .right_margin   = 16,
-                       .vsync_len      = 1,
-                       .upper_margin   = 8,
-                       .lower_margin   = 10,
-               },
-               .pcr            = 0xfb108bc7,
-               .bpp            = 16,
-       },
-};
-
-static const struct imx_fb_platform_data mx21ads_fb_data __initconst = {
-       .mode = mx21ads_modes,
-       .num_modes = ARRAY_SIZE(mx21ads_modes),
-
-       .pwmr           = 0x00a903ff,
-       .lscr1          = 0x00120300,
-       .dmacr          = 0x00020008,
-};
-
-static int mx21ads_sdhc_get_ro(struct device *dev)
-{
-       return gpio_get_value(MX21ADS_IO_SD_WP);
-}
-
-static int mx21ads_sdhc_init(struct device *dev, irq_handler_t detect_irq,
-       void *data)
-{
-       int ret;
-
-       ret = gpio_request(MX21ADS_IO_SD_WP, "mmc-ro");
-       if (ret)
-               return ret;
-
-       return request_irq(gpio_to_irq(MX21ADS_MMC_CD), detect_irq,
-                          IRQF_TRIGGER_FALLING, "mmc-detect", data);
-}
-
-static void mx21ads_sdhc_exit(struct device *dev, void *data)
-{
-       free_irq(gpio_to_irq(MX21ADS_MMC_CD), data);
-       gpio_free(MX21ADS_IO_SD_WP);
-}
-
-static const struct imxmmc_platform_data mx21ads_sdhc_pdata __initconst = {
-       .ocr_avail = MMC_VDD_29_30 | MMC_VDD_30_31, /* 3.0V */
-       .get_ro = mx21ads_sdhc_get_ro,
-       .init = mx21ads_sdhc_init,
-       .exit = mx21ads_sdhc_exit,
-};
-
-static const struct mxc_nand_platform_data
-mx21ads_nand_board_info __initconst = {
-       .width = 1,
-       .hw_ecc = 1,
-};
-
-static struct platform_device *platform_devices[] __initdata = {
-       &mx21ads_mmgpio,
-       &mx21ads_lcd_regulator,
-       &mx21ads_nor_mtd_device,
-};
-
-static void __init mx21ads_board_init(void)
-{
-       imx21_soc_init();
-
-       mxc_gpio_setup_multiple_pins(mx21ads_pins, ARRAY_SIZE(mx21ads_pins),
-                       "mx21ads");
-
-       imx21_add_imx_uart0(&uart_pdata_rts);
-       imx21_add_imx_uart2(&uart_pdata_norts);
-       imx21_add_imx_uart3(&uart_pdata_rts);
-       imx21_add_mxc_nand(&mx21ads_nand_board_info);
-
-       imx21_add_imx_fb(&mx21ads_fb_data);
-}
-
-static void __init mx21ads_late_init(void)
-{
-       imx21_add_mxc_mmc(0, &mx21ads_sdhc_pdata);
-
-       gpiod_add_lookup_table(&mx21ads_lcd_regulator_gpiod_table);
-       platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
-
-       mx21ads_cs8900_resources[1].start =
-                       gpio_to_irq(MX21ADS_CS8900A_IRQ_GPIO);
-       mx21ads_cs8900_resources[1].end =
-                       gpio_to_irq(MX21ADS_CS8900A_IRQ_GPIO);
-       platform_device_register_full(&mx21ads_cs8900_devinfo);
-}
-
-static void __init mx21ads_timer_init(void)
-{
-       mx21_clocks_init(32768, 26000000);
-}
-
-MACHINE_START(MX21ADS, "Freescale i.MX21ADS")
-       /* maintainer: Freescale Semiconductor, Inc. */
-       .atag_offset = 0x100,
-       .map_io         = mx21_map_io,
-       .init_early = imx21_init_early,
-       .init_irq = mx21_init_irq,
-       .init_time      = mx21ads_timer_init,
-       .init_machine   = mx21ads_board_init,
-       .init_late      = mx21ads_late_init,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
deleted file mode 100644 (file)
index 2db4475..0000000
+++ /dev/null
@@ -1,470 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * Author: Fabio Estevam <fabio.estevam@freescale.com>
- */
-
-/*
- * This machine is known as:
- *  - i.MX27 3-Stack Development System
- *  - i.MX27 Platform Development Kit (i.MX27 PDK)
- */
-
-#include <linux/platform_device.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/irq.h>
-#include <linux/usb/otg.h>
-#include <linux/usb/ulpi.h>
-#include <linux/delay.h>
-#include <linux/mfd/mc13783.h>
-#include <linux/spi/spi.h>
-#include <linux/regulator/machine.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-
-#include "3ds_debugboard.h"
-#include "common.h"
-#include "devices-imx27.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx27.h"
-#include "ulpi.h"
-
-#define SD1_EN_GPIO            IMX_GPIO_NR(2, 25)
-#define OTG_PHY_RESET_GPIO     IMX_GPIO_NR(2, 23)
-#define SPI2_SS0               IMX_GPIO_NR(4, 21)
-#define PMIC_INT               IMX_GPIO_NR(3, 14)
-#define SPI1_SS0               IMX_GPIO_NR(4, 28)
-#define SD1_CD                 IMX_GPIO_NR(2, 26)
-#define LCD_RESET              IMX_GPIO_NR(1, 3)
-#define LCD_ENABLE             IMX_GPIO_NR(1, 31)
-
-static const int mx27pdk_pins[] __initconst = {
-       /* UART1 */
-       PE12_PF_UART1_TXD,
-       PE13_PF_UART1_RXD,
-       PE14_PF_UART1_CTS,
-       PE15_PF_UART1_RTS,
-       /* FEC */
-       PD0_AIN_FEC_TXD0,
-       PD1_AIN_FEC_TXD1,
-       PD2_AIN_FEC_TXD2,
-       PD3_AIN_FEC_TXD3,
-       PD4_AOUT_FEC_RX_ER,
-       PD5_AOUT_FEC_RXD1,
-       PD6_AOUT_FEC_RXD2,
-       PD7_AOUT_FEC_RXD3,
-       PD8_AF_FEC_MDIO,
-       PD9_AIN_FEC_MDC,
-       PD10_AOUT_FEC_CRS,
-       PD11_AOUT_FEC_TX_CLK,
-       PD12_AOUT_FEC_RXD0,
-       PD13_AOUT_FEC_RX_DV,
-       PD14_AOUT_FEC_RX_CLK,
-       PD15_AOUT_FEC_COL,
-       PD16_AIN_FEC_TX_ER,
-       PF23_AIN_FEC_TX_EN,
-       /* SDHC1 */
-       PE18_PF_SD1_D0,
-       PE19_PF_SD1_D1,
-       PE20_PF_SD1_D2,
-       PE21_PF_SD1_D3,
-       PE22_PF_SD1_CMD,
-       PE23_PF_SD1_CLK,
-       SD1_EN_GPIO | GPIO_GPIO | GPIO_OUT,
-       /* OTG */
-       OTG_PHY_RESET_GPIO | GPIO_GPIO | GPIO_OUT,
-       PC7_PF_USBOTG_DATA5,
-       PC8_PF_USBOTG_DATA6,
-       PC9_PF_USBOTG_DATA0,
-       PC10_PF_USBOTG_DATA2,
-       PC11_PF_USBOTG_DATA1,
-       PC12_PF_USBOTG_DATA4,
-       PC13_PF_USBOTG_DATA3,
-       PE0_PF_USBOTG_NXT,
-       PE1_PF_USBOTG_STP,
-       PE2_PF_USBOTG_DIR,
-       PE24_PF_USBOTG_CLK,
-       PE25_PF_USBOTG_DATA7,
-       /* CSPI1 */
-       PD31_PF_CSPI1_MOSI,
-       PD30_PF_CSPI1_MISO,
-       PD29_PF_CSPI1_SCLK,
-       PD25_PF_CSPI1_RDY,
-       SPI1_SS0 | GPIO_GPIO | GPIO_OUT,
-       /* CSPI2 */
-       PD22_PF_CSPI2_SCLK,
-       PD23_PF_CSPI2_MISO,
-       PD24_PF_CSPI2_MOSI,
-       SPI2_SS0 | GPIO_GPIO | GPIO_OUT,
-       /* I2C1 */
-       PD17_PF_I2C_DATA,
-       PD18_PF_I2C_CLK,
-       /* PMIC INT */
-       PMIC_INT | GPIO_GPIO | GPIO_IN,
-       /* LCD */
-       PA5_PF_LSCLK,
-       PA6_PF_LD0,
-       PA7_PF_LD1,
-       PA8_PF_LD2,
-       PA9_PF_LD3,
-       PA10_PF_LD4,
-       PA11_PF_LD5,
-       PA12_PF_LD6,
-       PA13_PF_LD7,
-       PA14_PF_LD8,
-       PA15_PF_LD9,
-       PA16_PF_LD10,
-       PA17_PF_LD11,
-       PA18_PF_LD12,
-       PA19_PF_LD13,
-       PA20_PF_LD14,
-       PA21_PF_LD15,
-       PA22_PF_LD16,
-       PA23_PF_LD17,
-       PA28_PF_HSYNC,
-       PA29_PF_VSYNC,
-       PA30_PF_CONTRAST,
-       LCD_ENABLE | GPIO_GPIO | GPIO_OUT,
-       LCD_RESET | GPIO_GPIO | GPIO_OUT,
-       /* SSI4 */
-       PC16_PF_SSI4_FS,
-       PC17_PF_SSI4_RXD,
-       PC18_PF_SSI4_TXD,
-       PC19_PF_SSI4_CLK,
-};
-
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-/*
- * Matrix keyboard
- */
-
-static const uint32_t mx27_3ds_keymap[] = {
-       KEY(0, 0, KEY_UP),
-       KEY(0, 1, KEY_DOWN),
-       KEY(1, 0, KEY_RIGHT),
-       KEY(1, 1, KEY_LEFT),
-       KEY(1, 2, KEY_ENTER),
-       KEY(2, 0, KEY_F6),
-       KEY(2, 1, KEY_F8),
-       KEY(2, 2, KEY_F9),
-       KEY(2, 3, KEY_F10),
-};
-
-static const struct matrix_keymap_data mx27_3ds_keymap_data __initconst = {
-       .keymap         = mx27_3ds_keymap,
-       .keymap_size    = ARRAY_SIZE(mx27_3ds_keymap),
-};
-
-static int mx27_3ds_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
-                               void *data)
-{
-       return request_irq(gpio_to_irq(SD1_CD), detect_irq,
-       IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "sdhc1-card-detect", data);
-}
-
-static void mx27_3ds_sdhc1_exit(struct device *dev, void *data)
-{
-       free_irq(gpio_to_irq(SD1_CD), data);
-}
-
-static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
-       .init = mx27_3ds_sdhc1_init,
-       .exit = mx27_3ds_sdhc1_exit,
-};
-
-static void mx27_3ds_sdhc1_enable_level_translator(void)
-{
-       /* Turn on TXB0108 OE pin */
-       gpio_request(SD1_EN_GPIO, "sd1_enable");
-       gpio_direction_output(SD1_EN_GPIO, 1);
-}
-
-
-static int otg_phy_init(void)
-{
-       gpio_request(OTG_PHY_RESET_GPIO, "usb-otg-reset");
-       gpio_direction_output(OTG_PHY_RESET_GPIO, 0);
-       mdelay(1);
-       gpio_set_value(OTG_PHY_RESET_GPIO, 1);
-       return 0;
-}
-
-static int mx27_3ds_otg_init(struct platform_device *pdev)
-{
-       return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
-}
-
-static struct mxc_usbh_platform_data otg_pdata __initdata = {
-       .init   = mx27_3ds_otg_init,
-       .portsc = MXC_EHCI_MODE_ULPI,
-};
-
-static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
-       .operating_mode = FSL_USB2_DR_DEVICE,
-       .phy_mode       = FSL_USB2_PHY_ULPI,
-};
-
-static bool otg_mode_host __initdata;
-
-static int __init mx27_3ds_otg_mode(char *options)
-{
-       if (!strcmp(options, "host"))
-               otg_mode_host = true;
-       else if (!strcmp(options, "device"))
-               otg_mode_host = false;
-       else
-               pr_info("otg_mode neither \"host\" nor \"device\". "
-                       "Defaulting to device\n");
-       return 1;
-}
-__setup("otg_mode=", mx27_3ds_otg_mode);
-
-/* Regulators */
-static struct regulator_init_data gpo_init = {
-       .constraints = {
-               .boot_on = 1,
-               .always_on = 1,
-       }
-};
-
-static struct regulator_consumer_supply vmmc1_consumers[] = {
-       REGULATOR_SUPPLY("vcore", "spi0.0"),
-};
-
-static struct regulator_init_data vmmc1_init = {
-       .constraints = {
-               .min_uV = 2800000,
-               .max_uV = 2800000,
-               .apply_uV = 1,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
-                                 REGULATOR_CHANGE_STATUS,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(vmmc1_consumers),
-       .consumer_supplies = vmmc1_consumers,
-};
-
-static struct regulator_consumer_supply vgen_consumers[] = {
-       REGULATOR_SUPPLY("vdd", "spi0.0"),
-};
-
-static struct regulator_init_data vgen_init = {
-       .constraints = {
-               .min_uV = 1800000,
-               .max_uV = 1800000,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(vgen_consumers),
-       .consumer_supplies = vgen_consumers,
-};
-
-static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = {
-       {
-               .id = MC13783_REG_VMMC1,
-               .init_data = &vmmc1_init,
-       }, {
-               .id = MC13783_REG_VGEN,
-               .init_data = &vgen_init,
-       }, {
-               .id = MC13783_REG_GPO1, /* Turn on 1.8V */
-               .init_data = &gpo_init,
-       }, {
-               .id = MC13783_REG_GPO3, /* Turn on 3.3V */
-               .init_data = &gpo_init,
-       },
-};
-
-/* MC13783 */
-static struct mc13xxx_codec_platform_data mx27_3ds_codec = {
-       .dac_ssi_port = MC13783_SSI1_PORT,
-       .adc_ssi_port = MC13783_SSI1_PORT,
-};
-
-static struct mc13xxx_platform_data mc13783_pdata = {
-       .regulators = {
-               .regulators = mx27_3ds_regulators,
-               .num_regulators = ARRAY_SIZE(mx27_3ds_regulators),
-
-       },
-       .flags  = MC13XXX_USE_TOUCHSCREEN | MC13XXX_USE_RTC |
-                                               MC13XXX_USE_CODEC,
-       .codec = &mx27_3ds_codec,
-};
-
-static struct imx_ssi_platform_data mx27_3ds_ssi_pdata = {
-       .flags = IMX_SSI_DMA | IMX_SSI_NET,
-};
-
-/* SPI */
-static struct gpiod_lookup_table mx27_spi1_gpiod_table = {
-       .dev_id = "imx27-cspi.0", /* Actual device name for spi1 */
-       .table = {
-               /*
-                * The i.MX27 has the i.MX21 GPIO controller, the SPI1 CS GPIO
-                * SPI1_SS0 is numbered IMX_GPIO_NR(4, 28).
-                *
-                * This is in "bank 4" which is subtracted by one in the macro
-                * so this is actually bank 3 on "imx21-gpio.3".
-                */
-               GPIO_LOOKUP_IDX("imx21-gpio.3", 28, "cs", 0, GPIO_ACTIVE_LOW),
-               { },
-       },
-};
-
-static struct gpiod_lookup_table mx27_spi2_gpiod_table = {
-       .dev_id = "imx27-cspi.1", /* Actual device name for spi2 */
-       .table = {
-               /*
-                * The i.MX27 has the i.MX21 GPIO controller, the SPI2 CS GPIO
-                * SPI2_SS0 is numbered IMX_GPIO_NR(4, 21).
-                *
-                * This is in "bank 4" which is subtracted by one in the macro
-                * so this is actually bank 3 on "imx21-gpio.3".
-                */
-               GPIO_LOOKUP_IDX("imx21-gpio.3", 21, "cs", 0, GPIO_ACTIVE_LOW),
-               { },
-       },
-};
-
-static struct imx_fb_videomode mx27_3ds_modes[] = {
-       {       /* 480x640 @ 60 Hz */
-               .mode = {
-                       .name           = "Epson-VGA",
-                       .refresh        = 60,
-                       .xres           = 480,
-                       .yres           = 640,
-                       .pixclock       = 41701,
-                       .left_margin    = 20,
-                       .right_margin   = 41,
-                       .upper_margin   = 10,
-                       .lower_margin   = 5,
-                       .hsync_len      = 20,
-                       .vsync_len      = 10,
-                       .sync           = FB_SYNC_OE_ACT_HIGH |
-                                               FB_SYNC_CLK_INVERT,
-                       .vmode          = FB_VMODE_NONINTERLACED,
-                       .flag           = 0,
-               },
-               .bpp            = 16,
-               .pcr            = 0xFAC08B82,
-       },
-};
-
-static const struct imx_fb_platform_data mx27_3ds_fb_data __initconst = {
-       .mode = mx27_3ds_modes,
-       .num_modes = ARRAY_SIZE(mx27_3ds_modes),
-       .pwmr           = 0x00A903FF,
-       .lscr1          = 0x00120300,
-       .dmacr          = 0x00020010,
-};
-
-/* LCD */
-static struct gpiod_lookup_table mx27_3ds_lcd_gpiod_table = {
-       .dev_id = "spi0.0", /* Bus 0 chipselect 0 */
-       .table = {
-               /*
-                * The i.MX27 has the i.MX21 GPIO controller, the GPIOs
-                * numbered IMX_GPIO_NR(1, 3) and IMX_GPIO_NR(1, 31)
-                * are in "bank 1" which is subtracted by one in the macro
-                * so these are actually bank 0 on "imx21-gpio.0".
-                */
-               GPIO_LOOKUP("imx21-gpio.0", 3, "reset", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("imx21-gpio.0", 31, "enable", GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-static struct spi_board_info mx27_3ds_spi_devs[] __initdata = {
-       {
-               .modalias       = "mc13783",
-               .max_speed_hz   = 1000000,
-               .bus_num        = 1,
-               .chip_select    = 0, /* SS0 */
-               .platform_data  = &mc13783_pdata,
-               /* irq number is run-time assigned */
-               .mode = SPI_CS_HIGH,
-       }, {
-               .modalias       = "l4f00242t03",
-               .max_speed_hz   = 5000000,
-               .bus_num        = 0,
-               .chip_select    = 0, /* SS0 */
-       },
-};
-
-static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = {
-       .bitrate = 100000,
-};
-
-static void __init mx27pdk_init(void)
-{
-       imx27_soc_init();
-
-       mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins),
-               "mx27pdk");
-       imx27_add_imx_uart0(&uart_pdata);
-       imx27_add_fec(NULL);
-       imx27_add_imx_keypad(&mx27_3ds_keymap_data);
-       imx27_add_imx2_wdt();
-
-       imx27_add_spi_imx1(&mx27_spi2_gpiod_table);
-       imx27_add_spi_imx0(&mx27_spi1_gpiod_table);
-
-       imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data);
-       imx27_add_imx_fb(&mx27_3ds_fb_data);
-
-       imx27_add_imx_ssi(0, &mx27_3ds_ssi_pdata);
-}
-
-static void __init mx27pdk_late_init(void)
-{
-       mx27_3ds_sdhc1_enable_level_translator();
-       imx27_add_mxc_mmc(0, &sdhc1_pdata);
-
-       otg_phy_init();
-
-       if (otg_mode_host) {
-               otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-                               ULPI_OTG_DRVVBUS_EXT);
-
-               if (otg_pdata.otg)
-                       imx27_add_mxc_ehci_otg(&otg_pdata);
-       }
-
-       if (!otg_mode_host)
-               imx27_add_fsl_usb2_udc(&otg_device_pdata);
-
-       gpiod_add_lookup_table(&mx27_3ds_lcd_gpiod_table);
-       mx27_3ds_spi_devs[0].irq = gpio_to_irq(PMIC_INT);
-       spi_register_board_info(mx27_3ds_spi_devs,
-                               ARRAY_SIZE(mx27_3ds_spi_devs));
-
-       if (mxc_expio_init(MX27_CS5_BASE_ADDR, IMX_GPIO_NR(3, 28)))
-               pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n");
-
-
-       imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0);
-}
-
-static void __init mx27pdk_timer_init(void)
-{
-       mx27_clocks_init(26000000);
-}
-
-MACHINE_START(MX27_3DS, "Freescale MX27PDK")
-       /* maintainer: Freescale Semiconductor, Inc. */
-       .atag_offset = 0x100,
-       .map_io = mx27_map_io,
-       .init_early = imx27_init_early,
-       .init_irq = mx27_init_irq,
-       .init_time      = mx27pdk_timer_init,
-       .init_machine = mx27pdk_init,
-       .init_late      = mx27pdk_late_init,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
deleted file mode 100644 (file)
index ba202f9..0000000
+++ /dev/null
@@ -1,407 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *  Copyright (C) 2000 Deep Blue Solutions Ltd
- *  Copyright (C) 2002 Shane Nay (shane@minirl.com)
- *  Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- */
-#include <linux/gpio/driver.h>
-/* Needed for gpio_to_irq() */
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/map.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
-#include <linux/i2c.h>
-#include <linux/irq.h>
-
-#include <linux/regulator/fixed.h>
-#include <linux/regulator/machine.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-#include <asm/mach/map.h>
-
-#include "common.h"
-#include "devices-imx27.h"
-#include "hardware.h"
-#include "iomux-mx27.h"
-
-/*
- * Base address of PBC controller, CS4
- */
-#define PBC_BASE_ADDRESS        0xf4300000
-#define PBC_REG_ADDR(offset)    (void __force __iomem *) \
-               (PBC_BASE_ADDRESS + (offset))
-
-/* When the PBC address connection is fixed in h/w, defined as 1 */
-#define PBC_ADDR_SH             0
-
-/* Offsets for the PBC Controller register */
-/*
- * PBC Board version register offset
- */
-#define PBC_VERSION_REG         PBC_REG_ADDR(0x00000 >> PBC_ADDR_SH)
-/*
- * PBC Board control register 1 set address.
- */
-#define PBC_BCTRL1_SET_REG      PBC_REG_ADDR(0x00008 >> PBC_ADDR_SH)
-/*
- * PBC Board control register 1 clear address.
- */
-#define PBC_BCTRL1_CLEAR_REG    PBC_REG_ADDR(0x0000C >> PBC_ADDR_SH)
-
-/* PBC Board Control Register 1 bit definitions */
-#define PBC_BCTRL1_LCDON        0x0800 /* Enable the LCD */
-
-/* to determine the correct external crystal reference */
-#define CKIH_27MHZ_BIT_SET      (1 << 3)
-
-static const int mx27ads_pins[] __initconst = {
-       /* UART0 */
-       PE12_PF_UART1_TXD,
-       PE13_PF_UART1_RXD,
-       PE14_PF_UART1_CTS,
-       PE15_PF_UART1_RTS,
-       /* UART1 */
-       PE3_PF_UART2_CTS,
-       PE4_PF_UART2_RTS,
-       PE6_PF_UART2_TXD,
-       PE7_PF_UART2_RXD,
-       /* UART2 */
-       PE8_PF_UART3_TXD,
-       PE9_PF_UART3_RXD,
-       PE10_PF_UART3_CTS,
-       PE11_PF_UART3_RTS,
-       /* UART3 */
-       PB26_AF_UART4_RTS,
-       PB28_AF_UART4_TXD,
-       PB29_AF_UART4_CTS,
-       PB31_AF_UART4_RXD,
-       /* UART4 */
-       PB18_AF_UART5_TXD,
-       PB19_AF_UART5_RXD,
-       PB20_AF_UART5_CTS,
-       PB21_AF_UART5_RTS,
-       /* UART5 */
-       PB10_AF_UART6_TXD,
-       PB12_AF_UART6_CTS,
-       PB11_AF_UART6_RXD,
-       PB13_AF_UART6_RTS,
-       /* FEC */
-       PD0_AIN_FEC_TXD0,
-       PD1_AIN_FEC_TXD1,
-       PD2_AIN_FEC_TXD2,
-       PD3_AIN_FEC_TXD3,
-       PD4_AOUT_FEC_RX_ER,
-       PD5_AOUT_FEC_RXD1,
-       PD6_AOUT_FEC_RXD2,
-       PD7_AOUT_FEC_RXD3,
-       PD8_AF_FEC_MDIO,
-       PD9_AIN_FEC_MDC,
-       PD10_AOUT_FEC_CRS,
-       PD11_AOUT_FEC_TX_CLK,
-       PD12_AOUT_FEC_RXD0,
-       PD13_AOUT_FEC_RX_DV,
-       PD14_AOUT_FEC_RX_CLK,
-       PD15_AOUT_FEC_COL,
-       PD16_AIN_FEC_TX_ER,
-       PF23_AIN_FEC_TX_EN,
-       /* I2C2 */
-       PC5_PF_I2C2_SDA,
-       PC6_PF_I2C2_SCL,
-       /* FB */
-       PA5_PF_LSCLK,
-       PA6_PF_LD0,
-       PA7_PF_LD1,
-       PA8_PF_LD2,
-       PA9_PF_LD3,
-       PA10_PF_LD4,
-       PA11_PF_LD5,
-       PA12_PF_LD6,
-       PA13_PF_LD7,
-       PA14_PF_LD8,
-       PA15_PF_LD9,
-       PA16_PF_LD10,
-       PA17_PF_LD11,
-       PA18_PF_LD12,
-       PA19_PF_LD13,
-       PA20_PF_LD14,
-       PA21_PF_LD15,
-       PA22_PF_LD16,
-       PA23_PF_LD17,
-       PA24_PF_REV,
-       PA25_PF_CLS,
-       PA26_PF_PS,
-       PA27_PF_SPL_SPR,
-       PA28_PF_HSYNC,
-       PA29_PF_VSYNC,
-       PA30_PF_CONTRAST,
-       PA31_PF_OE_ACD,
-       /* OWIRE */
-       PE16_AF_OWIRE,
-       /* SDHC1*/
-       PE18_PF_SD1_D0,
-       PE19_PF_SD1_D1,
-       PE20_PF_SD1_D2,
-       PE21_PF_SD1_D3,
-       PE22_PF_SD1_CMD,
-       PE23_PF_SD1_CLK,
-       /* SDHC2*/
-       PB4_PF_SD2_D0,
-       PB5_PF_SD2_D1,
-       PB6_PF_SD2_D2,
-       PB7_PF_SD2_D3,
-       PB8_PF_SD2_CMD,
-       PB9_PF_SD2_CLK,
-};
-
-static const struct mxc_nand_platform_data
-mx27ads_nand_board_info __initconst = {
-       .width = 1,
-       .hw_ecc = 1,
-};
-
-/* ADS's NOR flash */
-static struct physmap_flash_data mx27ads_flash_data = {
-       .width = 2,
-};
-
-static struct resource mx27ads_flash_resource = {
-       .start = 0xc0000000,
-       .end = 0xc0000000 + 0x02000000 - 1,
-       .flags = IORESOURCE_MEM,
-
-};
-
-static struct platform_device mx27ads_nor_mtd_device = {
-       .name = "physmap-flash",
-       .id = 0,
-       .dev = {
-               .platform_data = &mx27ads_flash_data,
-       },
-       .num_resources = 1,
-       .resource = &mx27ads_flash_resource,
-};
-
-static const struct imxi2c_platform_data mx27ads_i2c1_data __initconst = {
-       .bitrate = 100000,
-};
-
-static struct i2c_board_info mx27ads_i2c_devices[] = {
-};
-
-static void vgpio_set(struct gpio_chip *chip, unsigned offset, int value)
-{
-       if (value)
-               imx_writew(PBC_BCTRL1_LCDON, PBC_BCTRL1_SET_REG);
-       else
-               imx_writew(PBC_BCTRL1_LCDON, PBC_BCTRL1_CLEAR_REG);
-}
-
-static int vgpio_dir_out(struct gpio_chip *chip, unsigned offset, int value)
-{
-       return 0;
-}
-
-#define MX27ADS_LCD_GPIO       (6 * 32)
-
-static struct regulator_consumer_supply mx27ads_lcd_regulator_consumer =
-       REGULATOR_SUPPLY("lcd", "imx-fb.0");
-
-static struct regulator_init_data mx27ads_lcd_regulator_init_data = {
-       .constraints    = {
-               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-},
-       .consumer_supplies      = &mx27ads_lcd_regulator_consumer,
-       .num_consumer_supplies  = 1,
-};
-
-static struct fixed_voltage_config mx27ads_lcd_regulator_pdata = {
-       .supply_name    = "LCD",
-       .microvolts     = 3300000,
-       .init_data      = &mx27ads_lcd_regulator_init_data,
-};
-
-static struct gpiod_lookup_table mx27ads_lcd_regulator_gpiod_table = {
-       .dev_id = "reg-fixed-voltage.0", /* Let's hope ID 0 is what we get */
-       .table = {
-               GPIO_LOOKUP("LCD", 0, NULL, GPIO_ACTIVE_LOW),
-               { },
-       },
-};
-
-static void __init mx27ads_regulator_init(void)
-{
-       struct gpio_chip *vchip;
-
-       vchip = kzalloc(sizeof(*vchip), GFP_KERNEL);
-       vchip->owner            = THIS_MODULE;
-       vchip->label            = "LCD";
-       vchip->base             = MX27ADS_LCD_GPIO;
-       vchip->ngpio            = 1;
-       vchip->direction_output = vgpio_dir_out;
-       vchip->set              = vgpio_set;
-       gpiochip_add_data(vchip, NULL);
-
-       gpiod_add_lookup_table(&mx27ads_lcd_regulator_gpiod_table);
-
-       platform_device_register_data(NULL, "reg-fixed-voltage",
-                                     PLATFORM_DEVID_AUTO,
-                                     &mx27ads_lcd_regulator_pdata,
-                                     sizeof(mx27ads_lcd_regulator_pdata));
-}
-
-static struct imx_fb_videomode mx27ads_modes[] = {
-       {
-               .mode = {
-                       .name           = "Sharp-LQ035Q7",
-                       .refresh        = 60,
-                       .xres           = 240,
-                       .yres           = 320,
-                       .pixclock       = 188679, /* in ps (5.3MHz) */
-                       .hsync_len      = 1,
-                       .left_margin    = 9,
-                       .right_margin   = 16,
-                       .vsync_len      = 1,
-                       .upper_margin   = 7,
-                       .lower_margin   = 9,
-               },
-               .bpp            = 16,
-               .pcr            = 0xFB008BC0,
-       },
-};
-
-static const struct imx_fb_platform_data mx27ads_fb_data __initconst = {
-       .mode = mx27ads_modes,
-       .num_modes = ARRAY_SIZE(mx27ads_modes),
-
-       /*
-        * - HSYNC active high
-        * - VSYNC active high
-        * - clk notenabled while idle
-        * - clock inverted
-        * - data not inverted
-        * - data enable low active
-        * - enable sharp mode
-        */
-       .pwmr           = 0x00A903FF,
-       .lscr1          = 0x00120300,
-       .dmacr          = 0x00020010,
-};
-
-static int mx27ads_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
-                             void *data)
-{
-       return request_irq(gpio_to_irq(IMX_GPIO_NR(5, 21)), detect_irq,
-                          IRQF_TRIGGER_RISING, "sdhc1-card-detect", data);
-}
-
-static int mx27ads_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
-                             void *data)
-{
-       return request_irq(gpio_to_irq(IMX_GPIO_NR(2, 7)), detect_irq,
-                          IRQF_TRIGGER_RISING, "sdhc2-card-detect", data);
-}
-
-static void mx27ads_sdhc1_exit(struct device *dev, void *data)
-{
-       free_irq(gpio_to_irq(IMX_GPIO_NR(5, 21)), data);
-}
-
-static void mx27ads_sdhc2_exit(struct device *dev, void *data)
-{
-       free_irq(gpio_to_irq(IMX_GPIO_NR(2, 7)), data);
-}
-
-static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
-       .init = mx27ads_sdhc1_init,
-       .exit = mx27ads_sdhc1_exit,
-};
-
-static const struct imxmmc_platform_data sdhc2_pdata __initconst = {
-       .init = mx27ads_sdhc2_init,
-       .exit = mx27ads_sdhc2_exit,
-};
-
-static struct platform_device *platform_devices[] __initdata = {
-       &mx27ads_nor_mtd_device,
-};
-
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static void __init mx27ads_board_init(void)
-{
-       imx27_soc_init();
-
-       mxc_gpio_setup_multiple_pins(mx27ads_pins, ARRAY_SIZE(mx27ads_pins),
-                       "mx27ads");
-
-       imx27_add_imx_uart0(&uart_pdata);
-       imx27_add_imx_uart1(&uart_pdata);
-       imx27_add_imx_uart2(&uart_pdata);
-       imx27_add_imx_uart3(&uart_pdata);
-       imx27_add_imx_uart4(&uart_pdata);
-       imx27_add_imx_uart5(&uart_pdata);
-       imx27_add_mxc_nand(&mx27ads_nand_board_info);
-
-       /* only the i2c master 1 is used on this CPU card */
-       i2c_register_board_info(1, mx27ads_i2c_devices,
-                               ARRAY_SIZE(mx27ads_i2c_devices));
-       imx27_add_imx_i2c(1, &mx27ads_i2c1_data);
-       imx27_add_imx_fb(&mx27ads_fb_data);
-
-       imx27_add_fec(NULL);
-       imx27_add_mxc_w1();
-}
-
-static void __init mx27ads_late_init(void)
-{
-       mx27ads_regulator_init();
-
-       imx27_add_mxc_mmc(0, &sdhc1_pdata);
-       imx27_add_mxc_mmc(1, &sdhc2_pdata);
-
-       platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
-}
-
-static void __init mx27ads_timer_init(void)
-{
-       unsigned long fref = 26000000;
-
-       if ((imx_readw(PBC_VERSION_REG) & CKIH_27MHZ_BIT_SET) == 0)
-               fref = 27000000;
-
-       mx27_clocks_init(fref);
-}
-
-static struct map_desc mx27ads_io_desc[] __initdata = {
-       {
-               .virtual = PBC_BASE_ADDRESS,
-               .pfn = __phys_to_pfn(MX27_CS4_BASE_ADDR),
-               .length = SZ_1M,
-               .type = MT_DEVICE,
-       },
-};
-
-static void __init mx27ads_map_io(void)
-{
-       mx27_map_io();
-       iotable_init(mx27ads_io_desc, ARRAY_SIZE(mx27ads_io_desc));
-}
-
-MACHINE_START(MX27ADS, "Freescale i.MX27ADS")
-       /* maintainer: Freescale Semiconductor, Inc. */
-       .atag_offset = 0x100,
-       .map_io = mx27ads_map_io,
-       .init_early = imx27_init_early,
-       .init_irq = mx27_init_irq,
-       .init_time      = mx27ads_timer_init,
-       .init_machine = mx27ads_board_init,
-       .init_late      = mx27ads_late_init,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c
deleted file mode 100644 (file)
index 23e63d3..0000000
+++ /dev/null
@@ -1,615 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *  Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
- */
-
-#include <linux/delay.h>
-#include <linux/dma-mapping.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/clk.h>
-#include <linux/irq.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/platform_device.h>
-#include <linux/mfd/mc13783.h>
-#include <linux/spi/spi.h>
-#include <linux/regulator/machine.h>
-#include <linux/usb/otg.h>
-#include <linux/usb/ulpi.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-#include <asm/memory.h>
-#include <asm/mach/map.h>
-
-#include "3ds_debugboard.h"
-#include "common.h"
-#include "devices-imx31.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-#include "ulpi.h"
-
-static int mx31_3ds_pins[] = {
-       /* UART1 */
-       MX31_PIN_CTS1__CTS1,
-       MX31_PIN_RTS1__RTS1,
-       MX31_PIN_TXD1__TXD1,
-       MX31_PIN_RXD1__RXD1,
-       IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO),
-       /*SPI0*/
-       IOMUX_MODE(MX31_PIN_DSR_DCE1, IOMUX_CONFIG_ALT1),
-       IOMUX_MODE(MX31_PIN_RI_DCE1, IOMUX_CONFIG_ALT1),
-       /* SPI 1 */
-       MX31_PIN_CSPI2_SCLK__SCLK,
-       MX31_PIN_CSPI2_MOSI__MOSI,
-       MX31_PIN_CSPI2_MISO__MISO,
-       MX31_PIN_CSPI2_SPI_RDY__SPI_RDY,
-       MX31_PIN_CSPI2_SS0__SS0,
-       MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */
-       /* MC13783 IRQ */
-       IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO),
-       /* USB OTG reset */
-       IOMUX_MODE(MX31_PIN_USB_PWR, IOMUX_CONFIG_GPIO),
-       /* USB OTG */
-       MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
-       MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
-       MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
-       MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
-       MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
-       MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
-       MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
-       MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
-       MX31_PIN_USBOTG_CLK__USBOTG_CLK,
-       MX31_PIN_USBOTG_DIR__USBOTG_DIR,
-       MX31_PIN_USBOTG_NXT__USBOTG_NXT,
-       MX31_PIN_USBOTG_STP__USBOTG_STP,
-       /*Keyboard*/
-       MX31_PIN_KEY_ROW0_KEY_ROW0,
-       MX31_PIN_KEY_ROW1_KEY_ROW1,
-       MX31_PIN_KEY_ROW2_KEY_ROW2,
-       MX31_PIN_KEY_COL0_KEY_COL0,
-       MX31_PIN_KEY_COL1_KEY_COL1,
-       MX31_PIN_KEY_COL2_KEY_COL2,
-       MX31_PIN_KEY_COL3_KEY_COL3,
-       /* USB Host 2 */
-       IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_PC_VS2, IOMUX_CONFIG_ALT1),
-       IOMUX_MODE(MX31_PIN_PC_BVD1, IOMUX_CONFIG_ALT1),
-       IOMUX_MODE(MX31_PIN_PC_BVD2, IOMUX_CONFIG_ALT1),
-       IOMUX_MODE(MX31_PIN_PC_RST, IOMUX_CONFIG_ALT1),
-       IOMUX_MODE(MX31_PIN_IOIS16, IOMUX_CONFIG_ALT1),
-       IOMUX_MODE(MX31_PIN_PC_RW_B, IOMUX_CONFIG_ALT1),
-       /* USB Host2 reset */
-       IOMUX_MODE(MX31_PIN_USB_BYP, IOMUX_CONFIG_GPIO),
-       /* I2C1 */
-       MX31_PIN_I2C_CLK__I2C1_SCL,
-       MX31_PIN_I2C_DAT__I2C1_SDA,
-       /* SDHC1 */
-       MX31_PIN_SD1_DATA3__SD1_DATA3,
-       MX31_PIN_SD1_DATA2__SD1_DATA2,
-       MX31_PIN_SD1_DATA1__SD1_DATA1,
-       MX31_PIN_SD1_DATA0__SD1_DATA0,
-       MX31_PIN_SD1_CLK__SD1_CLK,
-       MX31_PIN_SD1_CMD__SD1_CMD,
-       MX31_PIN_GPIO3_1__GPIO3_1, /* Card detect */
-       MX31_PIN_GPIO3_0__GPIO3_0, /* OE */
-       /* Framebuffer */
-       MX31_PIN_LD0__LD0,
-       MX31_PIN_LD1__LD1,
-       MX31_PIN_LD2__LD2,
-       MX31_PIN_LD3__LD3,
-       MX31_PIN_LD4__LD4,
-       MX31_PIN_LD5__LD5,
-       MX31_PIN_LD6__LD6,
-       MX31_PIN_LD7__LD7,
-       MX31_PIN_LD8__LD8,
-       MX31_PIN_LD9__LD9,
-       MX31_PIN_LD10__LD10,
-       MX31_PIN_LD11__LD11,
-       MX31_PIN_LD12__LD12,
-       MX31_PIN_LD13__LD13,
-       MX31_PIN_LD14__LD14,
-       MX31_PIN_LD15__LD15,
-       MX31_PIN_LD16__LD16,
-       MX31_PIN_LD17__LD17,
-       MX31_PIN_VSYNC3__VSYNC3,
-       MX31_PIN_HSYNC__HSYNC,
-       MX31_PIN_FPSHIFT__FPSHIFT,
-       MX31_PIN_CONTRAST__CONTRAST,
-       /* SSI */
-       MX31_PIN_STXD4__STXD4,
-       MX31_PIN_SRXD4__SRXD4,
-       MX31_PIN_SCK4__SCK4,
-       MX31_PIN_SFS4__SFS4,
-};
-
-/*
- * FB support
- */
-static const struct fb_videomode fb_modedb[] = {
-       {       /* 480x640 @ 60 Hz */
-               .name           = "Epson-VGA",
-               .refresh        = 60,
-               .xres           = 480,
-               .yres           = 640,
-               .pixclock       = 41701,
-               .left_margin    = 20,
-               .right_margin   = 41,
-               .upper_margin   = 10,
-               .lower_margin   = 5,
-               .hsync_len      = 20,
-               .vsync_len      = 10,
-               .sync           = FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT,
-               .vmode          = FB_VMODE_NONINTERLACED,
-               .flag           = 0,
-       },
-};
-
-static struct mx3fb_platform_data mx3fb_pdata __initdata = {
-       .name           = "Epson-VGA",
-       .mode           = fb_modedb,
-       .num_modes      = ARRAY_SIZE(fb_modedb),
-};
-
-/* LCD */
-static struct gpiod_lookup_table mx31_3ds_lcd_gpiod_table = {
-       .dev_id = "spi0.2", /* Bus 0 chipselect 2 */
-       .table = {
-               /*
-                * "reset" has IOMUX_TO_GPIO(IOMUX_PIN(88, 28)).
-                * The macro only shifts 88 to bits 9..16 and then
-                * mask it and shift it back. The GPIO number is 88.
-                * 88 is 2*32+24
-                */
-               GPIO_LOOKUP("imx31-gpio.2", 24, "reset", GPIO_ACTIVE_HIGH),
-               /*
-                * Same reasoning as above for
-                * IOMUX_TO_GPIO(IOMUX_PIN(89, 27), pin 89 is 2*32+25.
-                */
-               GPIO_LOOKUP("imx31-gpio.2", 25, "enable", GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-/*
- * Support for SD card slot in personality board
- */
-#define MX31_3DS_GPIO_SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)
-#define MX31_3DS_GPIO_SDHC1_BE IOMUX_TO_GPIO(MX31_PIN_GPIO3_0)
-
-static struct gpio mx31_3ds_sdhc1_gpios[] = {
-       { MX31_3DS_GPIO_SDHC1_CD, GPIOF_IN, "sdhc1-card-detect" },
-       { MX31_3DS_GPIO_SDHC1_BE, GPIOF_OUT_INIT_LOW, "sdhc1-bus-en" },
-};
-
-static int mx31_3ds_sdhc1_init(struct device *dev,
-                              irq_handler_t detect_irq,
-                              void *data)
-{
-       int ret;
-
-       ret = gpio_request_array(mx31_3ds_sdhc1_gpios,
-                                ARRAY_SIZE(mx31_3ds_sdhc1_gpios));
-       if (ret) {
-               pr_warn("Unable to request the SD/MMC GPIOs.\n");
-               return ret;
-       }
-
-       ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)),
-                         detect_irq,
-                         IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
-                         "sdhc1-detect", data);
-       if (ret) {
-               pr_warn("Unable to request the SD/MMC card-detect IRQ.\n");
-               goto gpio_free;
-       }
-
-       return 0;
-
-gpio_free:
-       gpio_free_array(mx31_3ds_sdhc1_gpios,
-                       ARRAY_SIZE(mx31_3ds_sdhc1_gpios));
-       return ret;
-}
-
-static void mx31_3ds_sdhc1_exit(struct device *dev, void *data)
-{
-       free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)), data);
-       gpio_free_array(mx31_3ds_sdhc1_gpios,
-                        ARRAY_SIZE(mx31_3ds_sdhc1_gpios));
-}
-
-static void mx31_3ds_sdhc1_setpower(struct device *dev, unsigned int vdd)
-{
-       /*
-        * While the voltage stuff is done by the driver, activate the
-        * Buffer Enable Pin only if there is a card in slot to fix the card
-        * voltage issue caused by bi-directional chip TXB0108 on 3Stack.
-        * Done here because at this stage we have for sure a debounced value
-        * of the presence of the card, showed by the value of vdd.
-        * 7 == ilog2(MMC_VDD_165_195)
-        */
-       if (vdd > 7)
-               gpio_set_value(MX31_3DS_GPIO_SDHC1_BE, 1);
-       else
-               gpio_set_value(MX31_3DS_GPIO_SDHC1_BE, 0);
-}
-
-static struct imxmmc_platform_data sdhc1_pdata = {
-       .init           = mx31_3ds_sdhc1_init,
-       .exit           = mx31_3ds_sdhc1_exit,
-       .setpower       = mx31_3ds_sdhc1_setpower,
-};
-
-/*
- * Matrix keyboard
- */
-
-static const uint32_t mx31_3ds_keymap[] = {
-       KEY(0, 0, KEY_UP),
-       KEY(0, 1, KEY_DOWN),
-       KEY(1, 0, KEY_RIGHT),
-       KEY(1, 1, KEY_LEFT),
-       KEY(1, 2, KEY_ENTER),
-       KEY(2, 0, KEY_F6),
-       KEY(2, 1, KEY_F8),
-       KEY(2, 2, KEY_F9),
-       KEY(2, 3, KEY_F10),
-};
-
-static const struct matrix_keymap_data mx31_3ds_keymap_data __initconst = {
-       .keymap         = mx31_3ds_keymap,
-       .keymap_size    = ARRAY_SIZE(mx31_3ds_keymap),
-};
-
-/* Regulators */
-static struct regulator_init_data pwgtx_init = {
-       .constraints = {
-               .boot_on        = 1,
-               .always_on      = 1,
-       },
-};
-
-static struct regulator_init_data gpo_init = {
-       .constraints = {
-               .boot_on = 1,
-               .always_on = 1,
-       }
-};
-
-static struct regulator_consumer_supply vmmc2_consumers[] = {
-       REGULATOR_SUPPLY("vmmc", "imx31-mmc.0"),
-};
-
-static struct regulator_init_data vmmc2_init = {
-       .constraints = {
-               .min_uV = 3000000,
-               .max_uV = 3000000,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
-                                 REGULATOR_CHANGE_STATUS,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(vmmc2_consumers),
-       .consumer_supplies = vmmc2_consumers,
-};
-
-static struct regulator_consumer_supply vmmc1_consumers[] = {
-       REGULATOR_SUPPLY("vcore", "spi0.0"),
-};
-
-static struct regulator_init_data vmmc1_init = {
-       .constraints = {
-               .min_uV = 2800000,
-               .max_uV = 2800000,
-               .apply_uV = 1,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
-                                 REGULATOR_CHANGE_STATUS,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(vmmc1_consumers),
-       .consumer_supplies = vmmc1_consumers,
-};
-
-static struct regulator_consumer_supply vgen_consumers[] = {
-       REGULATOR_SUPPLY("vdd", "spi0.0"),
-};
-
-static struct regulator_init_data vgen_init = {
-       .constraints = {
-               .min_uV = 1800000,
-               .max_uV = 1800000,
-               .apply_uV = 1,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
-                                 REGULATOR_CHANGE_STATUS,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(vgen_consumers),
-       .consumer_supplies = vgen_consumers,
-};
-
-static struct mc13xxx_regulator_init_data mx31_3ds_regulators[] = {
-       {
-               .id = MC13783_REG_PWGT1SPI, /* Power Gate for ARM core. */
-               .init_data = &pwgtx_init,
-       }, {
-               .id = MC13783_REG_PWGT2SPI, /* Power Gate for L2 Cache. */
-               .init_data = &pwgtx_init,
-       }, {
-
-               .id = MC13783_REG_GPO1, /* Turn on 1.8V */
-               .init_data = &gpo_init,
-       }, {
-               .id = MC13783_REG_GPO3, /* Turn on 3.3V */
-               .init_data = &gpo_init,
-       }, {
-               .id = MC13783_REG_VMMC2, /* Power MMC/SD, WiFi/Bluetooth. */
-               .init_data = &vmmc2_init,
-       }, {
-               .id = MC13783_REG_VMMC1, /* Power LCD, CMOS, FM, GPS, Accel. */
-               .init_data = &vmmc1_init,
-       }, {
-               .id = MC13783_REG_VGEN,  /* Power LCD */
-               .init_data = &vgen_init,
-       },
-};
-
-/* MC13783 */
-static struct mc13xxx_codec_platform_data mx31_3ds_codec = {
-       .dac_ssi_port = MC13783_SSI1_PORT,
-       .adc_ssi_port = MC13783_SSI1_PORT,
-};
-
-static struct mc13xxx_platform_data mc13783_pdata = {
-       .regulators = {
-               .regulators = mx31_3ds_regulators,
-               .num_regulators = ARRAY_SIZE(mx31_3ds_regulators),
-       },
-       .codec = &mx31_3ds_codec,
-       .flags  = MC13XXX_USE_TOUCHSCREEN | MC13XXX_USE_RTC | MC13XXX_USE_CODEC,
-
-};
-
-static struct imx_ssi_platform_data mx31_3ds_ssi_pdata = {
-       .flags = IMX_SSI_DMA | IMX_SSI_NET,
-};
-
-static struct spi_board_info mx31_3ds_spi_devs[] __initdata = {
-       {
-               .modalias       = "mc13783",
-               .max_speed_hz   = 1000000,
-               .bus_num        = 1,
-               .chip_select    = 2, /* SS2 */
-               .platform_data  = &mc13783_pdata,
-               /* irq number is run-time assigned */
-               .mode = SPI_CS_HIGH,
-       }, {
-               .modalias       = "l4f00242t03",
-               .max_speed_hz   = 5000000,
-               .bus_num        = 0,
-               .chip_select    = 2, /* SS2 */
-       },
-};
-
-/*
- * NAND Flash
- */
-static const struct mxc_nand_platform_data
-mx31_3ds_nand_board_info __initconst = {
-       .width          = 1,
-       .hw_ecc         = 1,
-#ifdef CONFIG_MACH_MX31_3DS_MXC_NAND_USE_BBT
-       .flash_bbt      = 1,
-#endif
-};
-
-/*
- * USB OTG
- */
-
-#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
-                    PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
-
-#define USBOTG_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_PWR)
-#define USBH2_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_BYP)
-
-static int mx31_3ds_usbotg_init(void)
-{
-       int err;
-
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
-
-       err = gpio_request(USBOTG_RST_B, "otgusb-reset");
-       if (err) {
-               pr_err("Failed to request the USB OTG reset gpio\n");
-               return err;
-       }
-
-       err = gpio_direction_output(USBOTG_RST_B, 0);
-       if (err) {
-               pr_err("Failed to drive the USB OTG reset gpio\n");
-               goto usbotg_free_reset;
-       }
-
-       mdelay(1);
-       gpio_set_value(USBOTG_RST_B, 1);
-       return 0;
-
-usbotg_free_reset:
-       gpio_free(USBOTG_RST_B);
-       return err;
-}
-
-static int mx31_3ds_otg_init(struct platform_device *pdev)
-{
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
-}
-
-static int mx31_3ds_host2_init(struct platform_device *pdev)
-{
-       int err;
-
-       mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_PC_VS2, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_PC_BVD1, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_PC_BVD2, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_PC_RST, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_IOIS16, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_PC_RW_B, USB_PAD_CFG);
-
-       err = gpio_request(USBH2_RST_B, "usbh2-reset");
-       if (err) {
-               pr_err("Failed to request the USB Host 2 reset gpio\n");
-               return err;
-       }
-
-       err = gpio_direction_output(USBH2_RST_B, 0);
-       if (err) {
-               pr_err("Failed to drive the USB Host 2 reset gpio\n");
-               goto usbotg_free_reset;
-       }
-
-       mdelay(1);
-       gpio_set_value(USBH2_RST_B, 1);
-
-       mdelay(10);
-
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
-
-usbotg_free_reset:
-       gpio_free(USBH2_RST_B);
-       return err;
-}
-
-static struct mxc_usbh_platform_data otg_pdata __initdata = {
-       .init   = mx31_3ds_otg_init,
-       .portsc = MXC_EHCI_MODE_ULPI,
-};
-
-static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
-       .init = mx31_3ds_host2_init,
-       .portsc = MXC_EHCI_MODE_ULPI,
-};
-
-static const struct fsl_usb2_platform_data usbotg_pdata __initconst = {
-       .operating_mode = FSL_USB2_DR_DEVICE,
-       .phy_mode       = FSL_USB2_PHY_ULPI,
-};
-
-static bool otg_mode_host __initdata;
-
-static int __init mx31_3ds_otg_mode(char *options)
-{
-       if (!strcmp(options, "host"))
-               otg_mode_host = true;
-       else if (!strcmp(options, "device"))
-               otg_mode_host = false;
-       else
-               pr_info("otg_mode neither \"host\" nor \"device\". "
-                       "Defaulting to device\n");
-       return 1;
-}
-__setup("otg_mode=", mx31_3ds_otg_mode);
-
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static const struct imxi2c_platform_data mx31_3ds_i2c0_data __initconst = {
-       .bitrate = 100000,
-};
-
-static void __init mx31_3ds_init(void)
-{
-       imx31_soc_init();
-
-       /* Configure SPI1 IOMUX */
-       mxc_iomux_set_gpr(MUX_PGP_CSPI_BB, true);
-
-       mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins),
-                                     "mx31_3ds");
-
-       imx31_add_imx_uart0(&uart_pdata);
-       imx31_add_mxc_nand(&mx31_3ds_nand_board_info);
-
-       imx31_add_spi_imx1(NULL);
-
-       imx31_add_imx_keypad(&mx31_3ds_keymap_data);
-
-       imx31_add_imx2_wdt();
-       imx31_add_imx_i2c0(&mx31_3ds_i2c0_data);
-
-       imx31_add_spi_imx0(NULL);
-       imx31_add_ipu_core();
-       imx31_add_mx3_sdc_fb(&mx3fb_pdata);
-
-       imx31_add_imx_ssi(0, &mx31_3ds_ssi_pdata);
-
-       imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0);
-}
-
-static void __init mx31_3ds_late(void)
-{
-       gpiod_add_lookup_table(&mx31_3ds_lcd_gpiod_table);
-       mx31_3ds_spi_devs[0].irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
-       spi_register_board_info(mx31_3ds_spi_devs,
-                               ARRAY_SIZE(mx31_3ds_spi_devs));
-
-       mx31_3ds_usbotg_init();
-       if (otg_mode_host) {
-               otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-                               ULPI_OTG_DRVVBUS_EXT);
-               if (otg_pdata.otg)
-                       imx31_add_mxc_ehci_otg(&otg_pdata);
-       }
-       usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-                       ULPI_OTG_DRVVBUS_EXT);
-       if (usbh2_pdata.otg)
-               imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
-
-       if (!otg_mode_host)
-               imx31_add_fsl_usb2_udc(&usbotg_pdata);
-
-       if (mxc_expio_init(MX31_CS5_BASE_ADDR, IOMUX_TO_GPIO(MX31_PIN_GPIO1_1)))
-               printk(KERN_WARNING "Init of the debug board failed, all "
-                      "devices on the debug board are unusable.\n");
-
-       imx31_add_mxc_mmc(0, &sdhc1_pdata);
-}
-
-static void __init mx31_3ds_timer_init(void)
-{
-       mx31_clocks_init(26000000);
-}
-
-MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)")
-       /* Maintainer: Freescale Semiconductor, Inc. */
-       .atag_offset = 0x100,
-       .map_io = mx31_map_io,
-       .init_early = imx31_init_early,
-       .init_irq = mx31_init_irq,
-       .init_time      = mx31_3ds_timer_init,
-       .init_machine = mx31_3ds_init,
-       .init_late      = mx31_3ds_late,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx31ads.c b/arch/arm/mach-imx/mach-mx31ads.c
deleted file mode 100644 (file)
index 4978338..0000000
+++ /dev/null
@@ -1,579 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *  Copyright (C) 2000 Deep Blue Solutions Ltd
- *  Copyright (C) 2002 Shane Nay (shane@minirl.com)
- *  Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- */
-
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/clk.h>
-#include <linux/serial_8250.h>
-#include <linux/gpio.h>
-#include <linux/i2c.h>
-#include <linux/irq.h>
-#include <linux/irqdomain.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-#include <asm/memory.h>
-#include <asm/mach/map.h>
-
-#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
-#include <linux/mfd/wm8350/audio.h>
-#include <linux/mfd/wm8350/core.h>
-#include <linux/mfd/wm8350/pmic.h>
-#endif
-
-#include "common.h"
-#include "devices-imx31.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-
-/* Base address of PBC controller */
-#define PBC_BASE_ADDRESS       MX31_CS4_BASE_ADDR_VIRT
-
-/* PBC Board interrupt status register */
-#define PBC_INTSTATUS           0x000016
-
-/* PBC Board interrupt current status register */
-#define PBC_INTCURR_STATUS      0x000018
-
-/* PBC Interrupt mask register set address */
-#define PBC_INTMASK_SET         0x00001A
-
-/* PBC Interrupt mask register clear address */
-#define PBC_INTMASK_CLEAR       0x00001C
-
-/* External UART A */
-#define PBC_SC16C652_UARTA      0x010000
-
-/* External UART B */
-#define PBC_SC16C652_UARTB      0x010010
-
-#define PBC_INTSTATUS_REG      (PBC_INTSTATUS + PBC_BASE_ADDRESS)
-#define PBC_INTMASK_SET_REG    (PBC_INTMASK_SET + PBC_BASE_ADDRESS)
-#define PBC_INTMASK_CLEAR_REG  (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS)
-
-#define EXPIO_INT_XUART_INTA   10
-#define EXPIO_INT_XUART_INTB   11
-
-#define MXC_MAX_EXP_IO_LINES   16
-
-/* CS8900 */
-#define EXPIO_INT_ENET_INT     8
-#define CS4_CS8900_MMIO_START  0x20000
-
-static struct irq_domain *domain;
-
-/*
- * The serial port definition structure.
- */
-static struct plat_serial8250_port serial_platform_data[] = {
-       {
-               .membase  = (void *)(PBC_BASE_ADDRESS + PBC_SC16C652_UARTA),
-               .mapbase  = (unsigned long)(MX31_CS4_BASE_ADDR + PBC_SC16C652_UARTA),
-               .uartclk  = 14745600,
-               .regshift = 0,
-               .iotype   = UPIO_MEM,
-               .flags    = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ,
-       }, {
-               .membase  = (void *)(PBC_BASE_ADDRESS + PBC_SC16C652_UARTB),
-               .mapbase  = (unsigned long)(MX31_CS4_BASE_ADDR + PBC_SC16C652_UARTB),
-               .uartclk  = 14745600,
-               .regshift = 0,
-               .iotype   = UPIO_MEM,
-               .flags    = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ,
-       },
-       {},
-};
-
-static struct platform_device serial_device = {
-       .name   = "serial8250",
-       .id     = 0,
-       .dev    = {
-               .platform_data = serial_platform_data,
-       },
-};
-
-static struct resource mx31ads_cs8900_resources[] __initdata = {
-       DEFINE_RES_MEM(MX31_CS4_BASE_ADDR + CS4_CS8900_MMIO_START, SZ_64K),
-       DEFINE_RES_IRQ(-1),
-};
-
-static const struct platform_device_info mx31ads_cs8900_devinfo __initconst = {
-       .name = "cs89x0",
-       .id = 0,
-       .res = mx31ads_cs8900_resources,
-       .num_res = ARRAY_SIZE(mx31ads_cs8900_resources),
-};
-
-static int __init mxc_init_extuart(void)
-{
-       serial_platform_data[0].irq = irq_find_mapping(domain,
-                                                      EXPIO_INT_XUART_INTA);
-       serial_platform_data[1].irq = irq_find_mapping(domain,
-                                                      EXPIO_INT_XUART_INTB);
-       return platform_device_register(&serial_device);
-}
-
-static void __init mxc_init_ext_ethernet(void)
-{
-       mx31ads_cs8900_resources[1].start =
-                       irq_find_mapping(domain, EXPIO_INT_ENET_INT);
-       mx31ads_cs8900_resources[1].end =
-                       irq_find_mapping(domain, EXPIO_INT_ENET_INT);
-       platform_device_register_full(
-               (struct platform_device_info *)&mx31ads_cs8900_devinfo);
-}
-
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static unsigned int uart_pins[] = {
-       MX31_PIN_CTS1__CTS1,
-       MX31_PIN_RTS1__RTS1,
-       MX31_PIN_TXD1__TXD1,
-       MX31_PIN_RXD1__RXD1
-};
-
-static inline void mxc_init_imx_uart(void)
-{
-       mxc_iomux_setup_multiple_pins(uart_pins, ARRAY_SIZE(uart_pins), "uart-0");
-       imx31_add_imx_uart0(&uart_pdata);
-}
-
-static void mx31ads_expio_irq_handler(struct irq_desc *desc)
-{
-       u32 imr_val;
-       u32 int_valid;
-       u32 expio_irq;
-
-       imr_val = imx_readw(PBC_INTMASK_SET_REG);
-       int_valid = imx_readw(PBC_INTSTATUS_REG) & imr_val;
-
-       expio_irq = 0;
-       for (; int_valid != 0; int_valid >>= 1, expio_irq++) {
-               if ((int_valid & 1) == 0)
-                       continue;
-
-               generic_handle_irq(irq_find_mapping(domain, expio_irq));
-       }
-}
-
-/*
- * Disable an expio pin's interrupt by setting the bit in the imr.
- * @param d    an expio virtual irq description
- */
-static void expio_mask_irq(struct irq_data *d)
-{
-       u32 expio = d->hwirq;
-       /* mask the interrupt */
-       imx_writew(1 << expio, PBC_INTMASK_CLEAR_REG);
-       imx_readw(PBC_INTMASK_CLEAR_REG);
-}
-
-/*
- * Acknowledge an expanded io pin's interrupt by clearing the bit in the isr.
- * @param d    an expio virtual irq description
- */
-static void expio_ack_irq(struct irq_data *d)
-{
-       u32 expio = d->hwirq;
-       /* clear the interrupt status */
-       imx_writew(1 << expio, PBC_INTSTATUS_REG);
-}
-
-/*
- * Enable a expio pin's interrupt by clearing the bit in the imr.
- * @param d    an expio virtual irq description
- */
-static void expio_unmask_irq(struct irq_data *d)
-{
-       u32 expio = d->hwirq;
-       /* unmask the interrupt */
-       imx_writew(1 << expio, PBC_INTMASK_SET_REG);
-}
-
-static struct irq_chip expio_irq_chip = {
-       .name = "EXPIO(CPLD)",
-       .irq_ack = expio_ack_irq,
-       .irq_mask = expio_mask_irq,
-       .irq_unmask = expio_unmask_irq,
-};
-
-static void __init mx31ads_init_expio(void)
-{
-       int irq_base;
-       int i, irq;
-
-       printk(KERN_INFO "MX31ADS EXPIO(CPLD) hardware\n");
-
-       /*
-        * Configure INT line as GPIO input
-        */
-       mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_GPIO1_4, IOMUX_CONFIG_GPIO), "expio");
-
-       /* disable the interrupt and clear the status */
-       imx_writew(0xFFFF, PBC_INTMASK_CLEAR_REG);
-       imx_writew(0xFFFF, PBC_INTSTATUS_REG);
-
-       irq_base = irq_alloc_descs(-1, 0, MXC_MAX_EXP_IO_LINES, numa_node_id());
-       WARN_ON(irq_base < 0);
-
-       domain = irq_domain_add_legacy(NULL, MXC_MAX_EXP_IO_LINES, irq_base, 0,
-                                      &irq_domain_simple_ops, NULL);
-       WARN_ON(!domain);
-
-       for (i = irq_base; i < irq_base + MXC_MAX_EXP_IO_LINES; i++) {
-               irq_set_chip_and_handler(i, &expio_irq_chip, handle_level_irq);
-               irq_clear_status_flags(i, IRQ_NOREQUEST);
-       }
-       irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_4));
-       irq_set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
-       irq_set_chained_handler(irq, mx31ads_expio_irq_handler);
-}
-
-#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
-/* This section defines setup for the Wolfson Microelectronics
- * 1133-EV1 PMU/audio board.  When other PMU boards are supported the
- * regulator definitions may be shared with them, but for now they can
- * only be used with this board so would generate warnings about
- * unused statics and some of the configuration is specific to this
- * module.
- */
-
-/* CPU */
-static struct regulator_consumer_supply sw1a_consumers[] = {
-       {
-               .supply = "cpu_vcc",
-       }
-};
-
-static struct regulator_init_data sw1a_data = {
-       .constraints = {
-               .name = "SW1A",
-               .min_uV = 1275000,
-               .max_uV = 1600000,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
-                                 REGULATOR_CHANGE_MODE,
-               .valid_modes_mask = REGULATOR_MODE_NORMAL |
-                                   REGULATOR_MODE_FAST,
-               .state_mem = {
-                        .uV = 1400000,
-                        .mode = REGULATOR_MODE_NORMAL,
-                        .enabled = 1,
-                },
-               .initial_state = PM_SUSPEND_MEM,
-               .always_on = 1,
-               .boot_on = 1,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(sw1a_consumers),
-       .consumer_supplies = sw1a_consumers,
-};
-
-/* System IO - High */
-static struct regulator_init_data viohi_data = {
-       .constraints = {
-               .name = "VIOHO",
-               .min_uV = 2800000,
-               .max_uV = 2800000,
-               .state_mem = {
-                        .uV = 2800000,
-                        .mode = REGULATOR_MODE_NORMAL,
-                        .enabled = 1,
-                },
-               .initial_state = PM_SUSPEND_MEM,
-               .always_on = 1,
-               .boot_on = 1,
-       },
-};
-
-/* System IO - Low */
-static struct regulator_init_data violo_data = {
-       .constraints = {
-               .name = "VIOLO",
-               .min_uV = 1800000,
-               .max_uV = 1800000,
-               .state_mem = {
-                        .uV = 1800000,
-                        .mode = REGULATOR_MODE_NORMAL,
-                        .enabled = 1,
-                },
-               .initial_state = PM_SUSPEND_MEM,
-               .always_on = 1,
-               .boot_on = 1,
-       },
-};
-
-/* DDR RAM */
-static struct regulator_init_data sw2a_data = {
-       .constraints = {
-               .name = "SW2A",
-               .min_uV = 1800000,
-               .max_uV = 1800000,
-               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-               .state_mem = {
-                        .uV = 1800000,
-                        .mode = REGULATOR_MODE_NORMAL,
-                        .enabled = 1,
-                },
-               .state_disk = {
-                        .mode = REGULATOR_MODE_NORMAL,
-                        .enabled = 0,
-                },
-               .always_on = 1,
-               .boot_on = 1,
-               .initial_state = PM_SUSPEND_MEM,
-       },
-};
-
-static struct regulator_init_data ldo1_data = {
-       .constraints = {
-               .name = "VCAM/VMMC1/VMMC2",
-               .min_uV = 2800000,
-               .max_uV = 2800000,
-               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-               .apply_uV = 1,
-       },
-};
-
-static struct regulator_consumer_supply ldo2_consumers[] = {
-       { .supply = "AVDD", .dev_name = "1-001a" },
-       { .supply = "HPVDD", .dev_name = "1-001a" },
-};
-
-/* CODEC and SIM */
-static struct regulator_init_data ldo2_data = {
-       .constraints = {
-               .name = "VESIM/VSIM/AVDD",
-               .min_uV = 3300000,
-               .max_uV = 3300000,
-               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-               .apply_uV = 1,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(ldo2_consumers),
-       .consumer_supplies = ldo2_consumers,
-};
-
-/* General */
-static struct regulator_init_data vdig_data = {
-       .constraints = {
-               .name = "VDIG",
-               .min_uV = 1500000,
-               .max_uV = 1500000,
-               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-               .apply_uV = 1,
-               .always_on = 1,
-               .boot_on = 1,
-       },
-};
-
-/* Tranceivers */
-static struct regulator_init_data ldo4_data = {
-       .constraints = {
-               .name = "VRF1/CVDD_2.775",
-               .min_uV = 2500000,
-               .max_uV = 2500000,
-               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-               .apply_uV = 1,
-               .always_on = 1,
-               .boot_on = 1,
-       },
-};
-
-static struct wm8350_led_platform_data wm8350_led_data = {
-       .name            = "wm8350:white",
-       .default_trigger = "heartbeat",
-       .max_uA          = 27899,
-};
-
-static struct wm8350_audio_platform_data imx32ads_wm8350_setup = {
-       .vmid_discharge_msecs = 1000,
-       .drain_msecs = 30,
-       .cap_discharge_msecs = 700,
-       .vmid_charge_msecs = 700,
-       .vmid_s_curve = WM8350_S_CURVE_SLOW,
-       .dis_out4 = WM8350_DISCHARGE_SLOW,
-       .dis_out3 = WM8350_DISCHARGE_SLOW,
-       .dis_out2 = WM8350_DISCHARGE_SLOW,
-       .dis_out1 = WM8350_DISCHARGE_SLOW,
-       .vroi_out4 = WM8350_TIE_OFF_500R,
-       .vroi_out3 = WM8350_TIE_OFF_500R,
-       .vroi_out2 = WM8350_TIE_OFF_500R,
-       .vroi_out1 = WM8350_TIE_OFF_500R,
-       .vroi_enable = 0,
-       .codec_current_on = WM8350_CODEC_ISEL_1_0,
-       .codec_current_standby = WM8350_CODEC_ISEL_0_5,
-       .codec_current_charge = WM8350_CODEC_ISEL_1_5,
-};
-
-static int mx31_wm8350_init(struct wm8350 *wm8350)
-{
-       wm8350_gpio_config(wm8350, 0, WM8350_GPIO_DIR_IN,
-                          WM8350_GPIO0_PWR_ON_IN, WM8350_GPIO_ACTIVE_LOW,
-                          WM8350_GPIO_PULL_UP, WM8350_GPIO_INVERT_OFF,
-                          WM8350_GPIO_DEBOUNCE_ON);
-
-       wm8350_gpio_config(wm8350, 3, WM8350_GPIO_DIR_IN,
-                          WM8350_GPIO3_PWR_OFF_IN, WM8350_GPIO_ACTIVE_HIGH,
-                          WM8350_GPIO_PULL_DOWN, WM8350_GPIO_INVERT_OFF,
-                          WM8350_GPIO_DEBOUNCE_ON);
-
-       wm8350_gpio_config(wm8350, 4, WM8350_GPIO_DIR_IN,
-                          WM8350_GPIO4_MR_IN, WM8350_GPIO_ACTIVE_HIGH,
-                          WM8350_GPIO_PULL_DOWN, WM8350_GPIO_INVERT_OFF,
-                          WM8350_GPIO_DEBOUNCE_OFF);
-
-       wm8350_gpio_config(wm8350, 7, WM8350_GPIO_DIR_IN,
-                          WM8350_GPIO7_HIBERNATE_IN, WM8350_GPIO_ACTIVE_HIGH,
-                          WM8350_GPIO_PULL_DOWN, WM8350_GPIO_INVERT_OFF,
-                          WM8350_GPIO_DEBOUNCE_OFF);
-
-       wm8350_gpio_config(wm8350, 6, WM8350_GPIO_DIR_OUT,
-                          WM8350_GPIO6_SDOUT_OUT, WM8350_GPIO_ACTIVE_HIGH,
-                          WM8350_GPIO_PULL_NONE, WM8350_GPIO_INVERT_OFF,
-                          WM8350_GPIO_DEBOUNCE_OFF);
-
-       wm8350_gpio_config(wm8350, 8, WM8350_GPIO_DIR_OUT,
-                          WM8350_GPIO8_VCC_FAULT_OUT, WM8350_GPIO_ACTIVE_LOW,
-                          WM8350_GPIO_PULL_NONE, WM8350_GPIO_INVERT_OFF,
-                          WM8350_GPIO_DEBOUNCE_OFF);
-
-       wm8350_gpio_config(wm8350, 9, WM8350_GPIO_DIR_OUT,
-                          WM8350_GPIO9_BATT_FAULT_OUT, WM8350_GPIO_ACTIVE_LOW,
-                          WM8350_GPIO_PULL_NONE, WM8350_GPIO_INVERT_OFF,
-                          WM8350_GPIO_DEBOUNCE_OFF);
-
-       wm8350_register_regulator(wm8350, WM8350_DCDC_1, &sw1a_data);
-       wm8350_register_regulator(wm8350, WM8350_DCDC_3, &viohi_data);
-       wm8350_register_regulator(wm8350, WM8350_DCDC_4, &violo_data);
-       wm8350_register_regulator(wm8350, WM8350_DCDC_6, &sw2a_data);
-       wm8350_register_regulator(wm8350, WM8350_LDO_1, &ldo1_data);
-       wm8350_register_regulator(wm8350, WM8350_LDO_2, &ldo2_data);
-       wm8350_register_regulator(wm8350, WM8350_LDO_3, &vdig_data);
-       wm8350_register_regulator(wm8350, WM8350_LDO_4, &ldo4_data);
-
-       /* LEDs */
-       wm8350_dcdc_set_slot(wm8350, WM8350_DCDC_5, 1, 1,
-                            WM8350_DC5_ERRACT_SHUTDOWN_CONV);
-       wm8350_isink_set_flash(wm8350, WM8350_ISINK_A,
-                              WM8350_ISINK_FLASH_DISABLE,
-                              WM8350_ISINK_FLASH_TRIG_BIT,
-                              WM8350_ISINK_FLASH_DUR_32MS,
-                              WM8350_ISINK_FLASH_ON_INSTANT,
-                              WM8350_ISINK_FLASH_OFF_INSTANT,
-                              WM8350_ISINK_FLASH_MODE_EN);
-       wm8350_dcdc25_set_mode(wm8350, WM8350_DCDC_5,
-                              WM8350_ISINK_MODE_BOOST,
-                              WM8350_ISINK_ILIM_NORMAL,
-                              WM8350_DC5_RMP_20V,
-                              WM8350_DC5_FBSRC_ISINKA);
-       wm8350_register_led(wm8350, 0, WM8350_DCDC_5, WM8350_ISINK_A,
-                           &wm8350_led_data);
-
-       wm8350->codec.platform_data = &imx32ads_wm8350_setup;
-
-       regulator_has_full_constraints();
-
-       return 0;
-}
-
-static struct wm8350_platform_data __initdata mx31_wm8350_pdata = {
-       .init = mx31_wm8350_init,
-};
-#endif
-
-static struct i2c_board_info __initdata mx31ads_i2c1_devices[] = {
-#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
-       {
-               I2C_BOARD_INFO("wm8350", 0x1a),
-               .platform_data = &mx31_wm8350_pdata,
-               /* irq number is run-time assigned */
-       },
-#endif
-};
-
-static void __init mxc_init_i2c(void)
-{
-#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
-       mx31ads_i2c1_devices[0].irq =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
-#endif
-       i2c_register_board_info(1, mx31ads_i2c1_devices,
-                               ARRAY_SIZE(mx31ads_i2c1_devices));
-
-       mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MOSI, IOMUX_CONFIG_ALT1));
-       mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MISO, IOMUX_CONFIG_ALT1));
-
-       imx31_add_imx_i2c1(NULL);
-}
-
-static unsigned int ssi_pins[] = {
-       MX31_PIN_SFS5__SFS5,
-       MX31_PIN_SCK5__SCK5,
-       MX31_PIN_SRXD5__SRXD5,
-       MX31_PIN_STXD5__STXD5,
-};
-
-static void __init mxc_init_audio(void)
-{
-       imx31_add_imx_ssi(0, NULL);
-       mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi");
-}
-
-/*
- * Static mappings, starting from the CS4 start address up to the start address
- * of the CS8900.
- */
-static struct map_desc mx31ads_io_desc[] __initdata = {
-       {
-               .virtual        = (unsigned long)MX31_CS4_BASE_ADDR_VIRT,
-               .pfn            = __phys_to_pfn(MX31_CS4_BASE_ADDR),
-               .length         = CS4_CS8900_MMIO_START,
-               .type           = MT_DEVICE
-       },
-};
-
-static void __init mx31ads_map_io(void)
-{
-       mx31_map_io();
-       iotable_init(mx31ads_io_desc, ARRAY_SIZE(mx31ads_io_desc));
-}
-
-static void __init mx31ads_init(void)
-{
-       imx31_soc_init();
-
-       mxc_init_imx_uart();
-       mxc_init_audio();
-}
-
-static void __init mx31ads_late(void)
-{
-       mx31ads_init_expio();
-       mxc_init_extuart();
-       mxc_init_i2c();
-       mxc_init_ext_ethernet();
-}
-
-static void __init mx31ads_timer_init(void)
-{
-       mx31_clocks_init(26000000);
-}
-
-MACHINE_START(MX31ADS, "Freescale MX31ADS")
-       /* Maintainer: Freescale Semiconductor, Inc. */
-       .atag_offset = 0x100,
-       .map_io = mx31ads_map_io,
-       .init_early = imx31_init_early,
-       .init_irq       = mx31_init_irq,
-       .init_time      = mx31ads_timer_init,
-       .init_machine = mx31ads_init,
-       .init_late      = mx31ads_late,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx31lilly.c b/arch/arm/mach-imx/mach-mx31lilly.c
deleted file mode 100644 (file)
index 4b955cc..0000000
+++ /dev/null
@@ -1,312 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *  LILLY-1131 module support
- *
- *    Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
- *
- *  based on code for other MX31 boards,
- *
- *    Copyright 2005-2007 Freescale Semiconductor
- *    Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
- *    Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
- */
-
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/clk.h>
-#include <linux/gpio.h>
-#include <linux/delay.h>
-#include <linux/platform_device.h>
-#include <linux/interrupt.h>
-#include <linux/moduleparam.h>
-#include <linux/smsc911x.h>
-#include <linux/mtd/physmap.h>
-#include <linux/spi/spi.h>
-#include <linux/mfd/mc13783.h>
-#include <linux/usb/otg.h>
-#include <linux/usb/ulpi.h>
-#include <linux/regulator/machine.h>
-#include <linux/regulator/fixed.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-#include <asm/mach/map.h>
-
-#include "board-mx31lilly.h"
-#include "common.h"
-#include "devices-imx31.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-#include "ulpi.h"
-
-/*
- * This file contains module-specific initialization routines for LILLY-1131.
- * Initialization of peripherals found on the baseboard is implemented in the
- * appropriate baseboard support code.
- */
-
-static unsigned int mx31lilly_pins[] __initdata = {
-       MX31_PIN_CTS1__CTS1,
-       MX31_PIN_RTS1__RTS1,
-       MX31_PIN_TXD1__TXD1,
-       MX31_PIN_RXD1__RXD1,
-       MX31_PIN_CTS2__CTS2,
-       MX31_PIN_RTS2__RTS2,
-       MX31_PIN_TXD2__TXD2,
-       MX31_PIN_RXD2__RXD2,
-       MX31_PIN_CSPI3_MOSI__RXD3,
-       MX31_PIN_CSPI3_MISO__TXD3,
-       MX31_PIN_CSPI3_SCLK__RTS3,
-       MX31_PIN_CSPI3_SPI_RDY__CTS3,
-};
-
-/* UART */
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-/* SMSC ethernet support */
-
-static struct resource smsc91x_resources[] = {
-       {
-               .start  = MX31_CS4_BASE_ADDR,
-               .end    = MX31_CS4_BASE_ADDR + 0xffff,
-               .flags  = IORESOURCE_MEM,
-       },
-       {
-               /* irq number is run-time assigned */
-               .flags  = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
-       }
-};
-
-static struct smsc911x_platform_config smsc911x_config = {
-       .phy_interface  = PHY_INTERFACE_MODE_MII,
-       .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
-       .irq_type       = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
-       .flags          = SMSC911X_USE_32BIT |
-                         SMSC911X_SAVE_MAC_ADDRESS |
-                         SMSC911X_FORCE_INTERNAL_PHY,
-};
-
-static struct platform_device smsc91x_device = {
-       .name           = "smsc911x",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(smsc91x_resources),
-       .resource       = smsc91x_resources,
-       .dev            = {
-               .platform_data = &smsc911x_config,
-       }
-};
-
-/* NOR flash */
-static struct physmap_flash_data nor_flash_data = {
-       .width  = 2,
-};
-
-static struct resource nor_flash_resource = {
-       .start  = 0xa0000000,
-       .end    = 0xa1ffffff,
-       .flags  = IORESOURCE_MEM,
-};
-
-static struct platform_device physmap_flash_device = {
-       .name   = "physmap-flash",
-       .id     = 0,
-       .dev    = {
-               .platform_data  = &nor_flash_data,
-       },
-       .resource = &nor_flash_resource,
-       .num_resources = 1,
-};
-
-/* USB */
-
-#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
-                       PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
-
-static int usbh1_init(struct platform_device *pdev)
-{
-       int pins[] = {
-               MX31_PIN_CSPI1_MOSI__USBH1_RXDM,
-               MX31_PIN_CSPI1_MISO__USBH1_RXDP,
-               MX31_PIN_CSPI1_SS0__USBH1_TXDM,
-               MX31_PIN_CSPI1_SS1__USBH1_TXDP,
-               MX31_PIN_CSPI1_SS2__USBH1_RCV,
-               MX31_PIN_CSPI1_SCLK__USBH1_OEB,
-               MX31_PIN_CSPI1_SPI_RDY__USBH1_FS,
-       };
-
-       mxc_iomux_setup_multiple_pins(pins, ARRAY_SIZE(pins), "USB H1");
-
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_MOSI, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_MISO, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SS0, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SS1, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SS2, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SCLK, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SPI_RDY, USB_PAD_CFG);
-
-       mxc_iomux_set_gpr(MUX_PGP_USB_SUSPEND, true);
-
-       mdelay(10);
-
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED |
-                       MXC_EHCI_INTERFACE_SINGLE_UNI);
-}
-
-static int usbh2_init(struct platform_device *pdev)
-{
-       int pins[] = {
-               MX31_PIN_USBH2_DATA0__USBH2_DATA0,
-               MX31_PIN_USBH2_DATA1__USBH2_DATA1,
-               MX31_PIN_USBH2_CLK__USBH2_CLK,
-               MX31_PIN_USBH2_DIR__USBH2_DIR,
-               MX31_PIN_USBH2_NXT__USBH2_NXT,
-               MX31_PIN_USBH2_STP__USBH2_STP,
-       };
-
-       mxc_iomux_setup_multiple_pins(pins, ARRAY_SIZE(pins), "USB H2");
-
-       mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
-
-       mxc_iomux_set_gpr(MUX_PGP_UH2, true);
-
-       /* chip select */
-       mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_GPIO),
-                               "USBH2_CS");
-       gpio_request(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), "USBH2 CS");
-       gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), 0);
-
-       mdelay(10);
-
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
-}
-
-static const struct mxc_usbh_platform_data usbh1_pdata __initconst = {
-       .init   = usbh1_init,
-       .portsc = MXC_EHCI_MODE_UTMI | MXC_EHCI_SERIAL,
-};
-
-static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
-       .init   = usbh2_init,
-       .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
-};
-
-static void __init lilly1131_usb_init(void)
-{
-       imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
-
-       usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-                       ULPI_OTG_DRVVBUS_EXT);
-       if (usbh2_pdata.otg)
-               imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
-}
-
-static struct mc13xxx_platform_data mc13783_pdata __initdata = {
-       .flags = MC13XXX_USE_RTC | MC13XXX_USE_TOUCHSCREEN,
-};
-
-static struct spi_board_info mc13783_dev __initdata = {
-       .modalias       = "mc13783",
-       .max_speed_hz   = 1000000,
-       .bus_num        = 1,
-       .chip_select    = 0,
-       .platform_data  = &mc13783_pdata,
-       /* irq number is run-time assigned */
-};
-
-static struct platform_device *devices[] __initdata = {
-       &smsc91x_device,
-       &physmap_flash_device,
-};
-
-static int mx31lilly_baseboard;
-core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444);
-
-static struct regulator_consumer_supply dummy_supplies[] = {
-       REGULATOR_SUPPLY("vdd33a", "smsc911x"),
-       REGULATOR_SUPPLY("vddvario", "smsc911x"),
-};
-
-static void __init mx31lilly_board_init(void)
-{
-       imx31_soc_init();
-
-       mxc_iomux_setup_multiple_pins(mx31lilly_pins,
-                                     ARRAY_SIZE(mx31lilly_pins), "mx31lily");
-
-       imx31_add_imx_uart0(&uart_pdata);
-       imx31_add_imx_uart1(&uart_pdata);
-       imx31_add_imx_uart2(&uart_pdata);
-
-       mxc_iomux_alloc_pin(MX31_PIN_CS4__CS4, "Ethernet CS");
-
-       /* SPI */
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SCLK__SCLK, "SPI1_CLK");
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI1_MOSI__MOSI, "SPI1_TX");
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI1_MISO__MISO, "SPI1_RX");
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SPI_RDY__SPI_RDY, "SPI1_RDY");
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS0__SS0, "SPI1_SS0");
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS1__SS1, "SPI1_SS1");
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI1_SS2__SS2, "SPI1_SS2");
-
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SCLK__SCLK, "SPI2_CLK");
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MOSI__MOSI, "SPI2_TX");
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI2_MISO__MISO, "SPI2_RX");
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SPI_RDY__SPI_RDY, "SPI2_RDY");
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS0__SS0, "SPI2_SS0");
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS1__SS1, "SPI2_SS1");
-       mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS2__SS2, "SPI2_SS2");
-
-       imx31_add_spi_imx0(NULL);
-       imx31_add_spi_imx1(NULL);
-
-       regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
-}
-
-static void __init mx31lilly_late_init(void)
-{
-       if (mx31lilly_baseboard == MX31LILLY_DB)
-               mx31lilly_db_init();
-
-       mc13783_dev.irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
-       spi_register_board_info(&mc13783_dev, 1);
-
-       smsc91x_resources[1].start =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_0));
-       smsc91x_resources[1].end =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_0));
-       platform_add_devices(devices, ARRAY_SIZE(devices));
-
-       /* USB */
-       lilly1131_usb_init();
-}
-
-static void __init mx31lilly_timer_init(void)
-{
-       mx31_clocks_init(26000000);
-}
-
-MACHINE_START(LILLY1131, "INCO startec LILLY-1131")
-       .atag_offset = 0x100,
-       .map_io = mx31_map_io,
-       .init_early = imx31_init_early,
-       .init_irq = mx31_init_irq,
-       .init_time      = mx31lilly_timer_init,
-       .init_machine   = mx31lilly_board_init,
-       .init_late      = mx31lilly_late_init,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c
deleted file mode 100644 (file)
index aaccf52..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *  Copyright (C) 2000 Deep Blue Solutions Ltd
- *  Copyright (C) 2002 Shane Nay (shane@minirl.com)
- *  Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- *  Copyright (C) 2009 Daniel Mack <daniel@caiaq.de>
- */
-
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/memory.h>
-#include <linux/platform_device.h>
-#include <linux/gpio.h>
-#include <linux/moduleparam.h>
-#include <linux/smsc911x.h>
-#include <linux/mfd/mc13783.h>
-#include <linux/spi/spi.h>
-#include <linux/usb/otg.h>
-#include <linux/usb/ulpi.h>
-#include <linux/mtd/physmap.h>
-#include <linux/delay.h>
-#include <linux/regulator/machine.h>
-#include <linux/regulator/fixed.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-#include <asm/mach/map.h>
-#include <asm/page.h>
-#include <asm/setup.h>
-
-#include "board-mx31lite.h"
-#include "common.h"
-#include "devices-imx31.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-#include "ulpi.h"
-
-/*
- * This file contains the module-specific initialization routines.
- */
-
-static unsigned int mx31lite_pins[] = {
-       /* UART1 */
-       MX31_PIN_CTS1__CTS1,
-       MX31_PIN_RTS1__RTS1,
-       MX31_PIN_TXD1__TXD1,
-       MX31_PIN_RXD1__RXD1,
-       /* SPI 0 */
-       MX31_PIN_CSPI1_SCLK__SCLK,
-       MX31_PIN_CSPI1_MOSI__MOSI,
-       MX31_PIN_CSPI1_MISO__MISO,
-       MX31_PIN_CSPI1_SPI_RDY__SPI_RDY,
-       MX31_PIN_CSPI1_SS0__SS0,
-       MX31_PIN_CSPI1_SS1__SS1,
-       MX31_PIN_CSPI1_SS2__SS2,
-       /* LAN9117 IRQ pin */
-       IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_GPIO),
-       /* SPI 1 */
-       MX31_PIN_CSPI2_SCLK__SCLK,
-       MX31_PIN_CSPI2_MOSI__MOSI,
-       MX31_PIN_CSPI2_MISO__MISO,
-       MX31_PIN_CSPI2_SPI_RDY__SPI_RDY,
-       MX31_PIN_CSPI2_SS0__SS0,
-       MX31_PIN_CSPI2_SS1__SS1,
-       MX31_PIN_CSPI2_SS2__SS2,
-};
-
-/* UART */
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static const struct mxc_nand_platform_data
-mx31lite_nand_board_info __initconst  = {
-       .width = 1,
-       .hw_ecc = 1,
-};
-
-static struct smsc911x_platform_config smsc911x_config = {
-       .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
-       .irq_type       = SMSC911X_IRQ_TYPE_PUSH_PULL,
-       .flags          = SMSC911X_USE_16BIT,
-};
-
-static struct resource smsc911x_resources[] = {
-       {
-               .start          = MX31_CS4_BASE_ADDR,
-               .end            = MX31_CS4_BASE_ADDR + 0x100,
-               .flags          = IORESOURCE_MEM,
-       }, {
-               /* irq number is run-time assigned */
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device smsc911x_device = {
-       .name           = "smsc911x",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(smsc911x_resources),
-       .resource       = smsc911x_resources,
-       .dev            = {
-               .platform_data = &smsc911x_config,
-       },
-};
-
-static struct mc13xxx_platform_data mc13783_pdata __initdata = {
-       .flags = MC13XXX_USE_RTC,
-};
-
-static struct spi_board_info mc13783_spi_dev __initdata = {
-       .modalias       = "mc13783",
-       .max_speed_hz   = 1000000,
-       .bus_num        = 1,
-       .chip_select    = 0,
-       .platform_data  = &mc13783_pdata,
-       /* irq number is run-time assigned */
-};
-
-/*
- * USB
- */
-
-#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
-                       PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
-
-static int usbh2_init(struct platform_device *pdev)
-{
-       int pins[] = {
-               MX31_PIN_USBH2_DATA0__USBH2_DATA0,
-               MX31_PIN_USBH2_DATA1__USBH2_DATA1,
-               MX31_PIN_USBH2_CLK__USBH2_CLK,
-               MX31_PIN_USBH2_DIR__USBH2_DIR,
-               MX31_PIN_USBH2_NXT__USBH2_NXT,
-               MX31_PIN_USBH2_STP__USBH2_STP,
-       };
-
-       mxc_iomux_setup_multiple_pins(pins, ARRAY_SIZE(pins), "USB H2");
-
-       mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
-
-       mxc_iomux_set_gpr(MUX_PGP_UH2, true);
-
-       /* chip select */
-       mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_GPIO),
-                               "USBH2_CS");
-       gpio_request(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), "USBH2 CS");
-       gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), 0);
-
-       mdelay(10);
-
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
-}
-
-static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
-       .init   = usbh2_init,
-       .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
-};
-
-/*
- * NOR flash
- */
-
-static struct physmap_flash_data nor_flash_data = {
-       .width  = 2,
-};
-
-static struct resource nor_flash_resource = {
-       .start  = 0xa0000000,
-       .end    = 0xa1ffffff,
-       .flags  = IORESOURCE_MEM,
-};
-
-static struct platform_device physmap_flash_device = {
-       .name   = "physmap-flash",
-       .id     = 0,
-       .dev    = {
-               .platform_data  = &nor_flash_data,
-       },
-       .resource = &nor_flash_resource,
-       .num_resources = 1,
-};
-
-/*
- * This structure defines the MX31 memory map.
- */
-static struct map_desc mx31lite_io_desc[] __initdata = {
-       {
-               .virtual = (unsigned long)MX31_CS4_BASE_ADDR_VIRT,
-               .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR),
-               .length = MX31_CS4_SIZE,
-               .type = MT_DEVICE
-       }
-};
-
-/*
- * Set up static virtual mappings.
- */
-static void __init mx31lite_map_io(void)
-{
-       mx31_map_io();
-       iotable_init(mx31lite_io_desc, ARRAY_SIZE(mx31lite_io_desc));
-}
-
-static int mx31lite_baseboard;
-core_param(mx31lite_baseboard, mx31lite_baseboard, int, 0444);
-
-static struct regulator_consumer_supply dummy_supplies[] = {
-       REGULATOR_SUPPLY("vdd33a", "smsc911x"),
-       REGULATOR_SUPPLY("vddvario", "smsc911x"),
-};
-
-static void __init mx31lite_init(void)
-{
-       imx31_soc_init();
-
-       mxc_iomux_setup_multiple_pins(mx31lite_pins, ARRAY_SIZE(mx31lite_pins),
-                                     "mx31lite");
-
-       imx31_add_imx_uart0(&uart_pdata);
-       imx31_add_spi_imx0(NULL);
-
-       /* NOR and NAND flash */
-       platform_device_register(&physmap_flash_device);
-       imx31_add_mxc_nand(&mx31lite_nand_board_info);
-
-       imx31_add_spi_imx1(NULL);
-
-       regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
-}
-
-static void __init mx31lite_late(void)
-{
-       int ret;
-
-       if (mx31lite_baseboard == MX31LITE_DB)
-               mx31lite_db_init();
-
-       mc13783_spi_dev.irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
-       spi_register_board_info(&mc13783_spi_dev, 1);
-
-       /* USB */
-       usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-                       ULPI_OTG_DRVVBUS_EXT);
-       if (usbh2_pdata.otg)
-               imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
-
-       /* SMSC9117 IRQ pin */
-       ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq");
-       if (ret)
-               pr_warn("could not get LAN irq gpio\n");
-       else {
-               gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_SFS6));
-               smsc911x_resources[1].start =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SFS6));
-               smsc911x_resources[1].end =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SFS6));
-               platform_device_register(&smsc911x_device);
-       }
-}
-
-static void __init mx31lite_timer_init(void)
-{
-       mx31_clocks_init(26000000);
-}
-
-MACHINE_START(MX31LITE, "LogicPD i.MX31 SOM")
-       /* Maintainer: Freescale Semiconductor, Inc. */
-       .atag_offset = 0x100,
-       .map_io = mx31lite_map_io,
-       .init_early = imx31_init_early,
-       .init_irq = mx31_init_irq,
-       .init_time      = mx31lite_timer_init,
-       .init_machine = mx31lite_init,
-       .init_late      = mx31lite_late,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
deleted file mode 100644 (file)
index 7f780ad..0000000
+++ /dev/null
@@ -1,581 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *  Copyright (C) 2008 Valentin Longchamp, EPFL Mobots group
- */
-
-#include <linux/delay.h>
-#include <linux/dma-map-ops.h>
-#include <linux/gfp.h>
-#include <linux/gpio.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/moduleparam.h>
-#include <linux/leds.h>
-#include <linux/memory.h>
-#include <linux/mtd/physmap.h>
-#include <linux/mtd/partitions.h>
-#include <linux/platform_device.h>
-#include <linux/regulator/machine.h>
-#include <linux/mfd/mc13783.h>
-#include <linux/spi/spi.h>
-#include <linux/types.h>
-#include <linux/memblock.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/err.h>
-#include <linux/input.h>
-
-#include <linux/usb/otg.h>
-#include <linux/usb/ulpi.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-#include <asm/mach/map.h>
-#include <asm/memblock.h>
-#include <linux/platform_data/asoc-imx-ssi.h>
-
-#include "board-mx31moboard.h"
-#include "common.h"
-#include "devices-imx31.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-#include "ulpi.h"
-
-static unsigned int moboard_pins[] = {
-       /* UART0 */
-       MX31_PIN_TXD1__TXD1, MX31_PIN_RXD1__RXD1,
-       MX31_PIN_CTS1__GPIO2_7,
-       /* UART4 */
-       MX31_PIN_PC_RST__CTS5, MX31_PIN_PC_VS2__RTS5,
-       MX31_PIN_PC_BVD2__TXD5, MX31_PIN_PC_BVD1__RXD5,
-       /* I2C0 */
-       MX31_PIN_I2C_DAT__I2C1_SDA, MX31_PIN_I2C_CLK__I2C1_SCL,
-       /* I2C1 */
-       MX31_PIN_DCD_DTE1__I2C2_SDA, MX31_PIN_RI_DTE1__I2C2_SCL,
-       /* SDHC1 */
-       MX31_PIN_SD1_DATA3__SD1_DATA3, MX31_PIN_SD1_DATA2__SD1_DATA2,
-       MX31_PIN_SD1_DATA1__SD1_DATA1, MX31_PIN_SD1_DATA0__SD1_DATA0,
-       MX31_PIN_SD1_CLK__SD1_CLK, MX31_PIN_SD1_CMD__SD1_CMD,
-       MX31_PIN_ATA_CS0__GPIO3_26, MX31_PIN_ATA_CS1__GPIO3_27,
-       /* USB reset */
-       MX31_PIN_GPIO1_0__GPIO1_0,
-       /* USB OTG */
-       MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
-       MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
-       MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
-       MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
-       MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
-       MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
-       MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
-       MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
-       MX31_PIN_USBOTG_CLK__USBOTG_CLK, MX31_PIN_USBOTG_DIR__USBOTG_DIR,
-       MX31_PIN_USBOTG_NXT__USBOTG_NXT, MX31_PIN_USBOTG_STP__USBOTG_STP,
-       MX31_PIN_USB_OC__GPIO1_30,
-       /* USB H2 */
-       MX31_PIN_USBH2_DATA0__USBH2_DATA0,
-       MX31_PIN_USBH2_DATA1__USBH2_DATA1,
-       MX31_PIN_STXD3__USBH2_DATA2, MX31_PIN_SRXD3__USBH2_DATA3,
-       MX31_PIN_SCK3__USBH2_DATA4, MX31_PIN_SFS3__USBH2_DATA5,
-       MX31_PIN_STXD6__USBH2_DATA6, MX31_PIN_SRXD6__USBH2_DATA7,
-       MX31_PIN_USBH2_CLK__USBH2_CLK, MX31_PIN_USBH2_DIR__USBH2_DIR,
-       MX31_PIN_USBH2_NXT__USBH2_NXT, MX31_PIN_USBH2_STP__USBH2_STP,
-       MX31_PIN_SCK6__GPIO1_25,
-       /* LEDs */
-       MX31_PIN_SVEN0__GPIO2_0, MX31_PIN_STX0__GPIO2_1,
-       MX31_PIN_SRX0__GPIO2_2, MX31_PIN_SIMPD0__GPIO2_3,
-       /* SPI1 */
-       MX31_PIN_CSPI2_MOSI__MOSI, MX31_PIN_CSPI2_MISO__MISO,
-       MX31_PIN_CSPI2_SCLK__SCLK, MX31_PIN_CSPI2_SPI_RDY__SPI_RDY,
-       MX31_PIN_CSPI2_SS0__SS0, MX31_PIN_CSPI2_SS2__SS2,
-       /* Atlas IRQ */
-       MX31_PIN_GPIO1_3__GPIO1_3,
-       /* SPI2 */
-       MX31_PIN_CSPI3_MOSI__MOSI, MX31_PIN_CSPI3_MISO__MISO,
-       MX31_PIN_CSPI3_SCLK__SCLK, MX31_PIN_CSPI3_SPI_RDY__SPI_RDY,
-       MX31_PIN_CSPI2_SS1__CSPI3_SS1,
-       /* SSI */
-       MX31_PIN_STXD4__STXD4, MX31_PIN_SRXD4__SRXD4,
-       MX31_PIN_SCK4__SCK4, MX31_PIN_SFS4__SFS4,
-};
-
-static struct physmap_flash_data mx31moboard_flash_data = {
-       .width  = 2,
-};
-
-static struct resource mx31moboard_flash_resource = {
-       .start  = 0xa0000000,
-       .end    = 0xa1ffffff,
-       .flags  = IORESOURCE_MEM,
-};
-
-static struct platform_device mx31moboard_flash = {
-       .name   = "physmap-flash",
-       .id     = 0,
-       .dev    = {
-               .platform_data  = &mx31moboard_flash_data,
-       },
-       .resource = &mx31moboard_flash_resource,
-       .num_resources = 1,
-};
-
-static void __init moboard_uart0_init(void)
-{
-       if (!gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack")) {
-               gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0);
-               gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1));
-       }
-}
-
-static const struct imxuart_platform_data uart0_pdata __initconst = {
-};
-
-static const struct imxuart_platform_data uart4_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static const struct imxi2c_platform_data moboard_i2c0_data __initconst = {
-       .bitrate = 400000,
-};
-
-static const struct imxi2c_platform_data moboard_i2c1_data __initconst = {
-       .bitrate = 100000,
-};
-
-static struct regulator_consumer_supply sdhc_consumers[] = {
-       {
-               .dev_name = "imx31-mmc.0",
-               .supply = "sdhc0_vcc",
-       },
-       {
-               .dev_name = "imx31-mmc.1",
-               .supply = "sdhc1_vcc",
-       },
-};
-
-static struct regulator_init_data sdhc_vreg_data = {
-       .constraints = {
-               .min_uV = 2700000,
-               .max_uV = 3000000,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
-                       REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
-               .valid_modes_mask = REGULATOR_MODE_NORMAL |
-                       REGULATOR_MODE_FAST,
-               .always_on = 0,
-               .boot_on = 1,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(sdhc_consumers),
-       .consumer_supplies = sdhc_consumers,
-};
-
-static struct regulator_consumer_supply cam_consumers[] = {
-       {
-               .dev_name = "mx3_camera.0",
-               .supply = "cam_vcc",
-       },
-};
-
-static struct regulator_init_data cam_vreg_data = {
-       .constraints = {
-               .min_uV = 2700000,
-               .max_uV = 3000000,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
-                       REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
-               .valid_modes_mask = REGULATOR_MODE_NORMAL |
-                       REGULATOR_MODE_FAST,
-               .always_on = 0,
-               .boot_on = 1,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(cam_consumers),
-       .consumer_supplies = cam_consumers,
-};
-
-static struct mc13xxx_regulator_init_data moboard_regulators[] = {
-       {
-               .id = MC13783_REG_VMMC1,
-               .init_data = &sdhc_vreg_data,
-       },
-       {
-               .id = MC13783_REG_VCAM,
-               .init_data = &cam_vreg_data,
-       },
-};
-
-static struct mc13xxx_led_platform_data moboard_led[] = {
-       {
-               .id = MC13783_LED_R1,
-               .name = "coreboard-led-4:red",
-       },
-       {
-               .id = MC13783_LED_G1,
-               .name = "coreboard-led-4:green",
-       },
-       {
-               .id = MC13783_LED_B1,
-               .name = "coreboard-led-4:blue",
-       },
-       {
-               .id = MC13783_LED_R2,
-               .name = "coreboard-led-5:red",
-       },
-       {
-               .id = MC13783_LED_G2,
-               .name = "coreboard-led-5:green",
-       },
-       {
-               .id = MC13783_LED_B2,
-               .name = "coreboard-led-5:blue",
-       },
-};
-
-static struct mc13xxx_leds_platform_data moboard_leds = {
-       .num_leds = ARRAY_SIZE(moboard_led),
-       .led = moboard_led,
-       .led_control[0] = MC13783_LED_C0_ENABLE | MC13783_LED_C0_ABMODE(0),
-       .led_control[1] = MC13783_LED_C1_SLEWLIM,
-       .led_control[2] = MC13783_LED_C2_SLEWLIM,
-       .led_control[3] = MC13783_LED_C3_PERIOD(0) |
-                         MC13783_LED_C3_CURRENT_R1(2) |
-                         MC13783_LED_C3_CURRENT_G1(2) |
-                         MC13783_LED_C3_CURRENT_B1(2),
-       .led_control[4] = MC13783_LED_C4_PERIOD(0) |
-                         MC13783_LED_C4_CURRENT_R2(3) |
-                         MC13783_LED_C4_CURRENT_G2(3) |
-                         MC13783_LED_C4_CURRENT_B2(3),
-};
-
-static struct mc13xxx_buttons_platform_data moboard_buttons = {
-       .b1on_flags = MC13783_BUTTON_DBNC_750MS | MC13783_BUTTON_ENABLE |
-                       MC13783_BUTTON_POL_INVERT,
-       .b1on_key = KEY_POWER,
-};
-
-static struct mc13xxx_codec_platform_data moboard_codec = {
-       .dac_ssi_port = MC13783_SSI1_PORT,
-       .adc_ssi_port = MC13783_SSI1_PORT,
-};
-
-static struct mc13xxx_platform_data moboard_pmic = {
-       .regulators = {
-               .regulators = moboard_regulators,
-               .num_regulators = ARRAY_SIZE(moboard_regulators),
-       },
-       .leds = &moboard_leds,
-       .buttons = &moboard_buttons,
-       .codec = &moboard_codec,
-       .flags = MC13XXX_USE_RTC | MC13XXX_USE_ADC | MC13XXX_USE_CODEC,
-};
-
-static struct imx_ssi_platform_data moboard_ssi_pdata = {
-       .flags = IMX_SSI_DMA | IMX_SSI_NET,
-};
-
-static struct spi_board_info moboard_spi_board_info[] __initdata = {
-       {
-               .modalias = "mc13783",
-               /* irq number is run-time assigned */
-               .max_speed_hz = 300000,
-               .bus_num = 1,
-               .chip_select = 0,
-               .platform_data = &moboard_pmic,
-               .mode = SPI_CS_HIGH,
-       },
-};
-
-#define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0)
-#define SDHC1_WP IOMUX_TO_GPIO(MX31_PIN_ATA_CS1)
-
-static int moboard_sdhc1_get_ro(struct device *dev)
-{
-       return !gpio_get_value(SDHC1_WP);
-}
-
-static int moboard_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
-               void *data)
-{
-       int ret;
-
-       ret = gpio_request(SDHC1_CD, "sdhc-detect");
-       if (ret)
-               return ret;
-
-       gpio_direction_input(SDHC1_CD);
-
-       ret = gpio_request(SDHC1_WP, "sdhc-wp");
-       if (ret)
-               goto err_gpio_free;
-       gpio_direction_input(SDHC1_WP);
-
-       ret = request_irq(gpio_to_irq(SDHC1_CD), detect_irq,
-               IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
-               "sdhc1-card-detect", data);
-       if (ret)
-               goto err_gpio_free_2;
-
-       return 0;
-
-err_gpio_free_2:
-       gpio_free(SDHC1_WP);
-err_gpio_free:
-       gpio_free(SDHC1_CD);
-
-       return ret;
-}
-
-static void moboard_sdhc1_exit(struct device *dev, void *data)
-{
-       free_irq(gpio_to_irq(SDHC1_CD), data);
-       gpio_free(SDHC1_WP);
-       gpio_free(SDHC1_CD);
-}
-
-static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
-       .get_ro = moboard_sdhc1_get_ro,
-       .init   = moboard_sdhc1_init,
-       .exit   = moboard_sdhc1_exit,
-};
-
-/*
- * this pin is dedicated for all mx31moboard systems, so we do it here
- */
-#define USB_RESET_B    IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)
-#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
-                     PAD_CTL_ODE_CMOS)
-
-#define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC)
-#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
-
-static void usb_xcvr_reset(void)
-{
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
-       mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
-
-       mxc_iomux_set_gpr(MUX_PGP_UH2, true);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
-       mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
-
-       gpio_request(OTG_EN_B, "usb-udc-en");
-       gpio_direction_output(OTG_EN_B, 0);
-       gpio_request(USBH2_EN_B, "usbh2-en");
-       gpio_direction_output(USBH2_EN_B, 0);
-
-       gpio_request(USB_RESET_B, "usb-reset");
-       gpio_direction_output(USB_RESET_B, 0);
-       mdelay(1);
-       gpio_set_value(USB_RESET_B, 1);
-       mdelay(1);
-}
-
-static int moboard_usbh2_init_hw(struct platform_device *pdev)
-{
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
-}
-
-static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
-       .init   = moboard_usbh2_init_hw,
-       .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
-};
-
-static int __init moboard_usbh2_init(void)
-{
-       struct platform_device *pdev;
-
-       usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-                       ULPI_OTG_DRVVBUS_EXT);
-       if (!usbh2_pdata.otg)
-               return -ENODEV;
-
-       pdev = imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
-
-       return PTR_ERR_OR_ZERO(pdev);
-}
-
-static const struct gpio_led mx31moboard_leds[] __initconst = {
-       {
-               .name   = "coreboard-led-0:red:running",
-               .default_trigger = "heartbeat",
-               .gpio   = IOMUX_TO_GPIO(MX31_PIN_SVEN0),
-       }, {
-               .name   = "coreboard-led-1:red",
-               .gpio   = IOMUX_TO_GPIO(MX31_PIN_STX0),
-       }, {
-               .name   = "coreboard-led-2:red",
-               .gpio   = IOMUX_TO_GPIO(MX31_PIN_SRX0),
-       }, {
-               .name   = "coreboard-led-3:red",
-               .gpio   = IOMUX_TO_GPIO(MX31_PIN_SIMPD0),
-       },
-};
-
-static const struct gpio_led_platform_data mx31moboard_led_pdata __initconst = {
-       .num_leds       = ARRAY_SIZE(mx31moboard_leds),
-       .leds           = mx31moboard_leds,
-};
-
-static struct platform_device *devices[] __initdata = {
-       &mx31moboard_flash,
-};
-
-static struct mx3_camera_pdata camera_pdata __initdata = {
-       .flags          = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10,
-       .mclk_10khz     = 4800,
-};
-
-static phys_addr_t mx3_camera_base __initdata;
-#define MX3_CAMERA_BUF_SIZE SZ_4M
-
-static int __init mx31moboard_init_cam(void)
-{
-       int ret;
-       struct platform_device *pdev;
-
-       imx31_add_ipu_core();
-
-       pdev = imx31_alloc_mx3_camera(&camera_pdata);
-       if (IS_ERR(pdev))
-               return PTR_ERR(pdev);
-
-       ret = dma_declare_coherent_memory(&pdev->dev,
-                                         mx3_camera_base, mx3_camera_base,
-                                         MX3_CAMERA_BUF_SIZE);
-       if (ret)
-               goto err;
-
-       ret = platform_device_add(pdev);
-       if (ret)
-err:
-               platform_device_put(pdev);
-
-       return ret;
-
-}
-
-static void mx31moboard_poweroff(void)
-{
-       struct clk *clk = clk_get_sys("imx2-wdt.0", NULL);
-
-       if (!IS_ERR(clk))
-               clk_prepare_enable(clk);
-
-       mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST);
-
-       imx_writew(1 << 6 | 1 << 2, MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));
-}
-
-static int mx31moboard_baseboard;
-core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444);
-
-/*
- * Board specific initialization.
- */
-static void __init mx31moboard_init(void)
-{
-       imx31_soc_init();
-
-       mxc_iomux_setup_multiple_pins(moboard_pins, ARRAY_SIZE(moboard_pins),
-               "moboard");
-
-       platform_add_devices(devices, ARRAY_SIZE(devices));
-
-       imx31_add_imx2_wdt();
-
-       imx31_add_imx_uart0(&uart0_pdata);
-       imx31_add_imx_uart4(&uart4_pdata);
-
-       imx31_add_imx_i2c0(&moboard_i2c0_data);
-       imx31_add_imx_i2c1(&moboard_i2c1_data);
-
-       imx31_add_spi_imx1(NULL);
-       imx31_add_spi_imx2(NULL);
-
-       mx31moboard_init_cam();
-
-       imx31_add_imx_ssi(0, &moboard_ssi_pdata);
-
-       pm_power_off = mx31moboard_poweroff;
-}
-
-static void __init mx31moboard_late(void)
-{
-       gpio_led_register_device(-1, &mx31moboard_led_pdata);
-
-       moboard_uart0_init();
-
-       gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq");
-       gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
-       moboard_spi_board_info[0].irq =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
-       spi_register_board_info(moboard_spi_board_info,
-               ARRAY_SIZE(moboard_spi_board_info));
-
-       imx31_add_mxc_mmc(0, &sdhc1_pdata);
-
-       usb_xcvr_reset();
-       moboard_usbh2_init();
-
-       imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0);
-
-       switch (mx31moboard_baseboard) {
-       case MX31NOBOARD:
-               break;
-       case MX31DEVBOARD:
-               mx31moboard_devboard_init();
-               break;
-       case MX31MARXBOT:
-               mx31moboard_marxbot_init();
-               break;
-       case MX31SMARTBOT:
-       case MX31EYEBOT:
-               mx31moboard_smartbot_init(mx31moboard_baseboard);
-               break;
-       default:
-               printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n",
-                       mx31moboard_baseboard);
-       }
-}
-
-static void __init mx31moboard_timer_init(void)
-{
-       mx31_clocks_init(26000000);
-}
-
-static void __init mx31moboard_reserve(void)
-{
-       /* reserve 4 MiB for mx3-camera */
-       mx3_camera_base = arm_memblock_steal(MX3_CAMERA_BUF_SIZE,
-                       MX3_CAMERA_BUF_SIZE);
-}
-
-MACHINE_START(MX31MOBOARD, "EPFL Mobots mx31moboard")
-       /* Maintainer: Philippe Retornaz, EPFL Mobots group */
-       .atag_offset = 0x100,
-       .reserve = mx31moboard_reserve,
-       .map_io = mx31_map_io,
-       .init_early = imx31_init_early,
-       .init_irq = mx31_init_irq,
-       .init_time      = mx31moboard_timer_init,
-       .init_machine = mx31moboard_init,
-       .init_late      = mx31moboard_late,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
deleted file mode 100644 (file)
index 802e0ab..0000000
+++ /dev/null
@@ -1,516 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright (C) 2009 Marc Kleine-Budde, Pengutronix
- *
- * Author: Fabio Estevam <fabio.estevam@freescale.com>
- *
- * Copyright (C) 2011 Meprolight, Ltd.
- * Alex Gershgorin <alexg@meprolight.com>
- *
- * Modified from i.MX31 3-Stack Development System
- */
-
-/*
- * This machine is known as:
- *  - i.MX35 3-Stack Development System
- *  - i.MX35 Platform Development Kit (i.MX35 PDK)
- */
-
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/memory.h>
-#include <linux/gpio.h>
-#include <linux/usb/otg.h>
-
-#include <linux/mtd/physmap.h>
-#include <linux/mfd/mc13892.h>
-#include <linux/regulator/machine.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-#include <asm/mach/map.h>
-
-#include <video/platform_lcd.h>
-
-#include "3ds_debugboard.h"
-#include "common.h"
-#include "devices-imx35.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx35.h"
-
-#define GPIO_MC9S08DZ60_GPS_ENABLE 0
-#define GPIO_MC9S08DZ60_HDD_ENABLE 4
-#define GPIO_MC9S08DZ60_WIFI_ENABLE 5
-#define GPIO_MC9S08DZ60_LCD_ENABLE 6
-#define GPIO_MC9S08DZ60_SPEAKER_ENABLE 8
-
-static const struct fb_videomode fb_modedb[] = {
-       {
-                /* 800x480 @ 55 Hz */
-               .name = "Ceramate-CLAA070VC01",
-               .refresh = 55,
-               .xres = 800,
-               .yres = 480,
-               .pixclock = 40000,
-               .left_margin = 40,
-               .right_margin = 40,
-               .upper_margin = 5,
-               .lower_margin = 5,
-               .hsync_len = 20,
-               .vsync_len = 10,
-               .sync = FB_SYNC_OE_ACT_HIGH,
-               .vmode = FB_VMODE_NONINTERLACED,
-               .flag = 0,
-        },
-};
-
-static struct mx3fb_platform_data mx3fb_pdata __initdata = {
-       .name = "Ceramate-CLAA070VC01",
-       .mode = fb_modedb,
-       .num_modes = ARRAY_SIZE(fb_modedb),
-};
-
-static struct i2c_board_info __initdata i2c_devices_3ds[] = {
-       {
-               I2C_BOARD_INFO("mc9s08dz60", 0x69),
-       },
-};
-
-static int lcd_power_gpio = -ENXIO;
-
-static int mc9s08dz60_gpiochip_match(struct gpio_chip *chip, void *data)
-{
-       return !strcmp(chip->label, data);
-}
-
-static void mx35_3ds_lcd_set_power(
-                               struct plat_lcd_data *pd, unsigned int power)
-{
-       struct gpio_chip *chip;
-
-       if (!gpio_is_valid(lcd_power_gpio)) {
-               chip = gpiochip_find(
-                               "mc9s08dz60", mc9s08dz60_gpiochip_match);
-               if (chip) {
-                       lcd_power_gpio =
-                               chip->base + GPIO_MC9S08DZ60_LCD_ENABLE;
-                       if (gpio_request(lcd_power_gpio, "lcd_power") < 0) {
-                               pr_err("error: gpio already requested!\n");
-                               lcd_power_gpio = -ENXIO;
-                       }
-               } else {
-                       pr_err("error: didn't find mc9s08dz60 gpio chip\n");
-               }
-       }
-
-       if (gpio_is_valid(lcd_power_gpio))
-               gpio_set_value_cansleep(lcd_power_gpio, power);
-}
-
-static struct plat_lcd_data mx35_3ds_lcd_data = {
-       .set_power = mx35_3ds_lcd_set_power,
-};
-
-static struct platform_device mx35_3ds_lcd = {
-       .name = "platform-lcd",
-       .dev.platform_data = &mx35_3ds_lcd_data,
-};
-
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static struct physmap_flash_data mx35pdk_flash_data = {
-       .width  = 2,
-};
-
-static struct resource mx35pdk_flash_resource = {
-       .start  = MX35_CS0_BASE_ADDR,
-       .end    = MX35_CS0_BASE_ADDR + SZ_64M - 1,
-       .flags  = IORESOURCE_MEM,
-};
-
-static struct platform_device mx35pdk_flash = {
-       .name   = "physmap-flash",
-       .id     = 0,
-       .dev    = {
-               .platform_data  = &mx35pdk_flash_data,
-       },
-       .resource = &mx35pdk_flash_resource,
-       .num_resources = 1,
-};
-
-static const struct mxc_nand_platform_data mx35pdk_nand_board_info __initconst = {
-       .width = 1,
-       .hw_ecc = 1,
-       .flash_bbt = 1,
-};
-
-static struct platform_device *devices[] __initdata = {
-       &mx35pdk_flash,
-};
-
-static const iomux_v3_cfg_t mx35pdk_pads[] __initconst = {
-       /* UART1 */
-       MX35_PAD_CTS1__UART1_CTS,
-       MX35_PAD_RTS1__UART1_RTS,
-       MX35_PAD_TXD1__UART1_TXD_MUX,
-       MX35_PAD_RXD1__UART1_RXD_MUX,
-       /* FEC */
-       MX35_PAD_FEC_TX_CLK__FEC_TX_CLK,
-       MX35_PAD_FEC_RX_CLK__FEC_RX_CLK,
-       MX35_PAD_FEC_RX_DV__FEC_RX_DV,
-       MX35_PAD_FEC_COL__FEC_COL,
-       MX35_PAD_FEC_RDATA0__FEC_RDATA_0,
-       MX35_PAD_FEC_TDATA0__FEC_TDATA_0,
-       MX35_PAD_FEC_TX_EN__FEC_TX_EN,
-       MX35_PAD_FEC_MDC__FEC_MDC,
-       MX35_PAD_FEC_MDIO__FEC_MDIO,
-       MX35_PAD_FEC_TX_ERR__FEC_TX_ERR,
-       MX35_PAD_FEC_RX_ERR__FEC_RX_ERR,
-       MX35_PAD_FEC_CRS__FEC_CRS,
-       MX35_PAD_FEC_RDATA1__FEC_RDATA_1,
-       MX35_PAD_FEC_TDATA1__FEC_TDATA_1,
-       MX35_PAD_FEC_RDATA2__FEC_RDATA_2,
-       MX35_PAD_FEC_TDATA2__FEC_TDATA_2,
-       MX35_PAD_FEC_RDATA3__FEC_RDATA_3,
-       MX35_PAD_FEC_TDATA3__FEC_TDATA_3,
-       /* USBOTG */
-       MX35_PAD_USBOTG_PWR__USB_TOP_USBOTG_PWR,
-       MX35_PAD_USBOTG_OC__USB_TOP_USBOTG_OC,
-       /* USBH1 */
-       MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR,
-       MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC,
-       /* SDCARD */
-       MX35_PAD_SD1_CMD__ESDHC1_CMD,
-       MX35_PAD_SD1_CLK__ESDHC1_CLK,
-       MX35_PAD_SD1_DATA0__ESDHC1_DAT0,
-       MX35_PAD_SD1_DATA1__ESDHC1_DAT1,
-       MX35_PAD_SD1_DATA2__ESDHC1_DAT2,
-       MX35_PAD_SD1_DATA3__ESDHC1_DAT3,
-       /* I2C1 */
-       MX35_PAD_I2C1_CLK__I2C1_SCL,
-       MX35_PAD_I2C1_DAT__I2C1_SDA,
-       /* Display */
-       MX35_PAD_LD0__IPU_DISPB_DAT_0,
-       MX35_PAD_LD1__IPU_DISPB_DAT_1,
-       MX35_PAD_LD2__IPU_DISPB_DAT_2,
-       MX35_PAD_LD3__IPU_DISPB_DAT_3,
-       MX35_PAD_LD4__IPU_DISPB_DAT_4,
-       MX35_PAD_LD5__IPU_DISPB_DAT_5,
-       MX35_PAD_LD6__IPU_DISPB_DAT_6,
-       MX35_PAD_LD7__IPU_DISPB_DAT_7,
-       MX35_PAD_LD8__IPU_DISPB_DAT_8,
-       MX35_PAD_LD9__IPU_DISPB_DAT_9,
-       MX35_PAD_LD10__IPU_DISPB_DAT_10,
-       MX35_PAD_LD11__IPU_DISPB_DAT_11,
-       MX35_PAD_LD12__IPU_DISPB_DAT_12,
-       MX35_PAD_LD13__IPU_DISPB_DAT_13,
-       MX35_PAD_LD14__IPU_DISPB_DAT_14,
-       MX35_PAD_LD15__IPU_DISPB_DAT_15,
-       MX35_PAD_LD16__IPU_DISPB_DAT_16,
-       MX35_PAD_LD17__IPU_DISPB_DAT_17,
-       MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC,
-       MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK,
-       MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY,
-       MX35_PAD_CONTRAST__IPU_DISPB_CONTR,
-       MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC,
-       MX35_PAD_D3_REV__IPU_DISPB_D3_REV,
-       MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS,
-       /*PMIC IRQ*/
-       MX35_PAD_GPIO2_0__GPIO2_0,
-};
-
-static struct regulator_consumer_supply sw1_consumers[] = {
-       {
-               .supply = "cpu_vcc",
-       }
-};
-
-static struct regulator_consumer_supply vcam_consumers[] = {
-       /* sgtl5000 */
-       REGULATOR_SUPPLY("VDDA", "0-000a"),
-};
-
-static struct regulator_init_data sw1_init = {
-       .constraints = {
-               .name = "SW1",
-               .min_uV = 600000,
-               .max_uV = 1375000,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
-               .valid_modes_mask = 0,
-               .always_on = 1,
-               .boot_on = 1,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(sw1_consumers),
-       .consumer_supplies = sw1_consumers,
-};
-
-static struct regulator_init_data sw2_init = {
-       .constraints = {
-               .name = "SW2",
-               .always_on = 1,
-               .boot_on = 1,
-       }
-};
-
-static struct regulator_init_data sw3_init = {
-       .constraints = {
-               .name = "SW3",
-               .always_on = 1,
-               .boot_on = 1,
-       }
-};
-
-static struct regulator_init_data sw4_init = {
-       .constraints = {
-               .name = "SW4",
-               .always_on = 1,
-               .boot_on = 1,
-       }
-};
-
-static struct regulator_init_data viohi_init = {
-       .constraints = {
-               .name = "VIOHI",
-               .boot_on = 1,
-       }
-};
-
-static struct regulator_init_data vusb_init = {
-       .constraints = {
-               .name = "VUSB",
-               .boot_on = 1,
-       }
-};
-
-static struct regulator_init_data vdig_init = {
-       .constraints = {
-               .name = "VDIG",
-               .boot_on = 1,
-       }
-};
-
-static struct regulator_init_data vpll_init = {
-       .constraints = {
-               .name = "VPLL",
-               .boot_on = 1,
-       }
-};
-
-static struct regulator_init_data vusb2_init = {
-       .constraints = {
-               .name = "VUSB2",
-               .boot_on = 1,
-       }
-};
-
-static struct regulator_init_data vvideo_init = {
-       .constraints = {
-               .name = "VVIDEO",
-               .boot_on = 1
-       }
-};
-
-static struct regulator_init_data vcam_init = {
-       .constraints = {
-               .name = "VCAM",
-               .min_uV = 2500000,
-               .max_uV = 3000000,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
-                                       REGULATOR_CHANGE_MODE,
-               .valid_modes_mask = REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL,
-               .boot_on = 1
-       },
-       .num_consumer_supplies = ARRAY_SIZE(vcam_consumers),
-       .consumer_supplies = vcam_consumers,
-};
-
-static struct regulator_init_data vgen1_init = {
-       .constraints = {
-               .name = "VGEN1",
-       }
-};
-
-static struct regulator_init_data vgen2_init = {
-       .constraints = {
-               .name = "VGEN2",
-               .boot_on = 1,
-       }
-};
-
-static struct regulator_init_data vgen3_init = {
-       .constraints = {
-               .name = "VGEN3",
-       }
-};
-
-static struct mc13xxx_regulator_init_data mx35_3ds_regulators[] = {
-       { .id = MC13892_SW1, .init_data = &sw1_init },
-       { .id = MC13892_SW2, .init_data = &sw2_init },
-       { .id = MC13892_SW3, .init_data = &sw3_init },
-       { .id = MC13892_SW4, .init_data = &sw4_init },
-       { .id = MC13892_VIOHI, .init_data = &viohi_init },
-       { .id = MC13892_VPLL, .init_data = &vpll_init },
-       { .id = MC13892_VDIG, .init_data = &vdig_init },
-       { .id = MC13892_VUSB2, .init_data = &vusb2_init },
-       { .id = MC13892_VVIDEO, .init_data = &vvideo_init },
-       { .id = MC13892_VCAM, .init_data = &vcam_init },
-       { .id = MC13892_VGEN1, .init_data = &vgen1_init },
-       { .id = MC13892_VGEN2, .init_data = &vgen2_init },
-       { .id = MC13892_VGEN3, .init_data = &vgen3_init },
-       { .id = MC13892_VUSB, .init_data = &vusb_init },
-};
-
-static struct mc13xxx_platform_data mx35_3ds_mc13892_data = {
-       .flags = MC13XXX_USE_RTC | MC13XXX_USE_TOUCHSCREEN,
-       .regulators = {
-               .num_regulators = ARRAY_SIZE(mx35_3ds_regulators),
-               .regulators = mx35_3ds_regulators,
-       },
-};
-
-#define GPIO_PMIC_INT IMX_GPIO_NR(2, 0)
-
-static struct i2c_board_info mx35_3ds_i2c_mc13892 = {
-
-       I2C_BOARD_INFO("mc13892", 0x08),
-       .platform_data = &mx35_3ds_mc13892_data,
-       /* irq number is run-time assigned */
-};
-
-static void __init imx35_3ds_init_mc13892(void)
-{
-       int ret = gpio_request_one(GPIO_PMIC_INT, GPIOF_DIR_IN, "pmic irq");
-
-       if (ret) {
-               pr_err("failed to get pmic irq: %d\n", ret);
-               return;
-       }
-
-       mx35_3ds_i2c_mc13892.irq = gpio_to_irq(GPIO_PMIC_INT);
-       i2c_register_board_info(0, &mx35_3ds_i2c_mc13892, 1);
-}
-
-static int mx35_3ds_otg_init(struct platform_device *pdev)
-{
-       return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
-}
-
-/* OTG config */
-static const struct fsl_usb2_platform_data usb_otg_pdata __initconst = {
-       .operating_mode = FSL_USB2_DR_DEVICE,
-       .phy_mode       = FSL_USB2_PHY_UTMI_WIDE,
-       .workaround     = FLS_USB2_WORKAROUND_ENGCM09152,
-/*
- * ENGCM09152 also requires a hardware change.
- * Please check the MX35 Chip Errata document for details.
- */
-};
-
-static struct mxc_usbh_platform_data otg_pdata __initdata = {
-       .init   = mx35_3ds_otg_init,
-       .portsc = MXC_EHCI_MODE_UTMI,
-};
-
-static int mx35_3ds_usbh_init(struct platform_device *pdev)
-{
-       return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_SINGLE_UNI |
-                         MXC_EHCI_INTERNAL_PHY);
-}
-
-/* USB HOST config */
-static const struct mxc_usbh_platform_data usb_host_pdata __initconst = {
-       .init           = mx35_3ds_usbh_init,
-       .portsc         = MXC_EHCI_MODE_SERIAL,
-};
-
-static bool otg_mode_host __initdata;
-
-static int __init mx35_3ds_otg_mode(char *options)
-{
-       if (!strcmp(options, "host"))
-               otg_mode_host = true;
-       else if (!strcmp(options, "device"))
-               otg_mode_host = false;
-       else
-               pr_info("otg_mode neither \"host\" nor \"device\". "
-                       "Defaulting to device\n");
-       return 1;
-}
-__setup("otg_mode=", mx35_3ds_otg_mode);
-
-static const struct imxi2c_platform_data mx35_3ds_i2c0_data __initconst = {
-       .bitrate = 100000,
-};
-
-/*
- * Board specific initialization.
- */
-static void __init mx35_3ds_init(void)
-{
-       imx35_soc_init();
-
-       mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads));
-
-       imx35_add_fec(NULL);
-       imx35_add_imx2_wdt();
-       imx35_add_mxc_rtc();
-       platform_add_devices(devices, ARRAY_SIZE(devices));
-
-       imx35_add_imx_uart0(&uart_pdata);
-
-       if (otg_mode_host)
-               imx35_add_mxc_ehci_otg(&otg_pdata);
-
-       imx35_add_mxc_ehci_hs(&usb_host_pdata);
-
-       if (!otg_mode_host)
-               imx35_add_fsl_usb2_udc(&usb_otg_pdata);
-
-       imx35_add_mxc_nand(&mx35pdk_nand_board_info);
-       imx35_add_sdhci_esdhc_imx(0, NULL);
-
-       imx35_add_imx_i2c0(&mx35_3ds_i2c0_data);
-
-       i2c_register_board_info(
-               0, i2c_devices_3ds, ARRAY_SIZE(i2c_devices_3ds));
-
-       imx35_add_ipu_core();
-}
-
-static void __init mx35_3ds_late_init(void)
-{
-       struct platform_device *imx35_fb_pdev;
-
-       if (mxc_expio_init(MX35_CS5_BASE_ADDR, IMX_GPIO_NR(1, 1)))
-               pr_warn("Init of the debugboard failed, all "
-                       "devices on the debugboard are unusable.\n");
-
-       imx35_fb_pdev = imx35_add_mx3_sdc_fb(&mx3fb_pdata);
-       mx35_3ds_lcd.dev.parent = &imx35_fb_pdev->dev;
-       platform_device_register(&mx35_3ds_lcd);
-
-       imx35_3ds_init_mc13892();
-}
-
-static void __init mx35pdk_timer_init(void)
-{
-       mx35_clocks_init();
-}
-
-MACHINE_START(MX35_3DS, "Freescale MX35PDK")
-       /* Maintainer: Freescale Semiconductor, Inc */
-       .atag_offset = 0x100,
-       .map_io = mx35_map_io,
-       .init_early = imx35_init_early,
-       .init_irq = mx35_init_irq,
-       .init_time      = mx35pdk_timer_init,
-       .init_machine = mx35_3ds_init,
-       .init_late      = mx35_3ds_late_init,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
deleted file mode 100644 (file)
index 27a3678..0000000
+++ /dev/null
@@ -1,426 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright 2007 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
- * Copyright (C) 2009 Sascha Hauer (kernel@pengutronix.de)
- */
-
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/i2c.h>
-#include <linux/property.h>
-#include <linux/dma-mapping.h>
-#include <linux/spi/spi.h>
-#include <linux/spi/eeprom.h>
-#include <linux/irq.h>
-#include <linux/delay.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/usb/otg.h>
-#include <linux/usb/ulpi.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach-types.h>
-#include <asm/mach/time.h>
-
-#include "common.h"
-#include "devices-imx27.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx27.h"
-#include "ulpi.h"
-
-#define OTG_PHY_CS_GPIO (GPIO_PORTB + 23)
-#define USBH2_PHY_CS_GPIO (GPIO_PORTB + 24)
-#define SPI1_SS0 (GPIO_PORTD + 28)
-#define SPI1_SS1 (GPIO_PORTD + 27)
-#define SD2_CD (GPIO_PORTC + 29)
-
-static const int pca100_pins[] __initconst = {
-       /* UART1 */
-       PE12_PF_UART1_TXD,
-       PE13_PF_UART1_RXD,
-       PE14_PF_UART1_CTS,
-       PE15_PF_UART1_RTS,
-       /* SDHC */
-       PB4_PF_SD2_D0,
-       PB5_PF_SD2_D1,
-       PB6_PF_SD2_D2,
-       PB7_PF_SD2_D3,
-       PB8_PF_SD2_CMD,
-       PB9_PF_SD2_CLK,
-       SD2_CD | GPIO_GPIO | GPIO_IN,
-       /* FEC */
-       PD0_AIN_FEC_TXD0,
-       PD1_AIN_FEC_TXD1,
-       PD2_AIN_FEC_TXD2,
-       PD3_AIN_FEC_TXD3,
-       PD4_AOUT_FEC_RX_ER,
-       PD5_AOUT_FEC_RXD1,
-       PD6_AOUT_FEC_RXD2,
-       PD7_AOUT_FEC_RXD3,
-       PD8_AF_FEC_MDIO,
-       PD9_AIN_FEC_MDC,
-       PD10_AOUT_FEC_CRS,
-       PD11_AOUT_FEC_TX_CLK,
-       PD12_AOUT_FEC_RXD0,
-       PD13_AOUT_FEC_RX_DV,
-       PD14_AOUT_FEC_RX_CLK,
-       PD15_AOUT_FEC_COL,
-       PD16_AIN_FEC_TX_ER,
-       PF23_AIN_FEC_TX_EN,
-       /* SSI1 */
-       PC20_PF_SSI1_FS,
-       PC21_PF_SSI1_RXD,
-       PC22_PF_SSI1_TXD,
-       PC23_PF_SSI1_CLK,
-       /* onboard I2C */
-       PC5_PF_I2C2_SDA,
-       PC6_PF_I2C2_SCL,
-       /* external I2C */
-       PD17_PF_I2C_DATA,
-       PD18_PF_I2C_CLK,
-       /* SPI1 */
-       PD25_PF_CSPI1_RDY,
-       PD29_PF_CSPI1_SCLK,
-       PD30_PF_CSPI1_MISO,
-       PD31_PF_CSPI1_MOSI,
-       /* OTG */
-       OTG_PHY_CS_GPIO | GPIO_GPIO | GPIO_OUT,
-       PC7_PF_USBOTG_DATA5,
-       PC8_PF_USBOTG_DATA6,
-       PC9_PF_USBOTG_DATA0,
-       PC10_PF_USBOTG_DATA2,
-       PC11_PF_USBOTG_DATA1,
-       PC12_PF_USBOTG_DATA4,
-       PC13_PF_USBOTG_DATA3,
-       PE0_PF_USBOTG_NXT,
-       PE1_PF_USBOTG_STP,
-       PE2_PF_USBOTG_DIR,
-       PE24_PF_USBOTG_CLK,
-       PE25_PF_USBOTG_DATA7,
-       /* USBH2 */
-       USBH2_PHY_CS_GPIO | GPIO_GPIO | GPIO_OUT,
-       PA0_PF_USBH2_CLK,
-       PA1_PF_USBH2_DIR,
-       PA2_PF_USBH2_DATA7,
-       PA3_PF_USBH2_NXT,
-       PA4_PF_USBH2_STP,
-       PD19_AF_USBH2_DATA4,
-       PD20_AF_USBH2_DATA3,
-       PD21_AF_USBH2_DATA6,
-       PD22_AF_USBH2_DATA0,
-       PD23_AF_USBH2_DATA2,
-       PD24_AF_USBH2_DATA1,
-       PD26_AF_USBH2_DATA5,
-       /* display */
-       PA5_PF_LSCLK,
-       PA6_PF_LD0,
-       PA7_PF_LD1,
-       PA8_PF_LD2,
-       PA9_PF_LD3,
-       PA10_PF_LD4,
-       PA11_PF_LD5,
-       PA12_PF_LD6,
-       PA13_PF_LD7,
-       PA14_PF_LD8,
-       PA15_PF_LD9,
-       PA16_PF_LD10,
-       PA17_PF_LD11,
-       PA18_PF_LD12,
-       PA19_PF_LD13,
-       PA20_PF_LD14,
-       PA21_PF_LD15,
-       PA22_PF_LD16,
-       PA23_PF_LD17,
-       PA26_PF_PS,
-       PA28_PF_HSYNC,
-       PA29_PF_VSYNC,
-       PA31_PF_OE_ACD,
-       /* free GPIO */
-       GPIO_PORTC | 31 | GPIO_GPIO | GPIO_IN, /* GPIO0_IRQ */
-       GPIO_PORTC | 25 | GPIO_GPIO | GPIO_IN, /* GPIO1_IRQ */
-       GPIO_PORTE | 5 | GPIO_GPIO | GPIO_IN, /* GPIO2_IRQ */
-};
-
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static const struct mxc_nand_platform_data
-pca100_nand_board_info __initconst = {
-       .width = 1,
-       .hw_ecc = 1,
-};
-
-static const struct imxi2c_platform_data pca100_i2c1_data __initconst = {
-       .bitrate = 100000,
-};
-
-static const struct property_entry board_eeprom_properties[] = {
-       PROPERTY_ENTRY_U32("pagesize", 32),
-       { }
-};
-
-static struct i2c_board_info pca100_i2c_devices[] = {
-       {
-               I2C_BOARD_INFO("24c32", 0x52), /* E0=0, E1=1, E2=0 */
-               .properties = board_eeprom_properties,
-       }, {
-               I2C_BOARD_INFO("pcf8563", 0x51),
-       }, {
-               I2C_BOARD_INFO("lm75", 0x4a),
-       }
-};
-
-static struct spi_eeprom at25320 = {
-       .name           = "at25320an",
-       .byte_len       = 4096,
-       .page_size      = 32,
-       .flags          = EE_ADDR2,
-};
-
-static struct spi_board_info pca100_spi_board_info[] __initdata = {
-       {
-               .modalias = "at25",
-               .max_speed_hz = 30000,
-               .bus_num = 0,
-               .chip_select = 1,
-               .platform_data = &at25320,
-       },
-};
-
-static struct gpiod_lookup_table pca100_spi0_gpiod_table = {
-       .dev_id = "imx27-cspi.0", /* Actual device name for spi0 */
-       .table = {
-               /*
-                * The i.MX27 has the i.MX21 GPIO controller, port D is
-                * bank 3 and thus named "imx21-gpio.3".
-                * SPI1_SS0 is GPIO_PORTD + 28
-                * SPI1_SS1 is GPIO_PORTD + 27
-                */
-               GPIO_LOOKUP_IDX("imx21-gpio.3", 28, "cs", 0, GPIO_ACTIVE_LOW),
-               GPIO_LOOKUP_IDX("imx21-gpio.3", 27, "cs", 1, GPIO_ACTIVE_LOW),
-               { },
-       },
-};
-
-static void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
-{
-       mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT);
-       gpio_set_value(GPIO_PORTC + 20, 1);
-       udelay(2);
-       gpio_set_value(GPIO_PORTC + 20, 0);
-       mxc_gpio_mode(PC20_PF_SSI1_FS);
-       msleep(2);
-}
-
-static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
-{
-       mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT);  /* FS */
-       gpio_set_value(GPIO_PORTC + 20, 0);
-       mxc_gpio_mode(GPIO_PORTC | 22 | GPIO_GPIO | GPIO_OUT);  /* TX */
-       gpio_set_value(GPIO_PORTC + 22, 0);
-       mxc_gpio_mode(GPIO_PORTC | 28 | GPIO_GPIO | GPIO_OUT);  /* reset */
-       gpio_set_value(GPIO_PORTC + 28, 0);
-       udelay(10);
-       gpio_set_value(GPIO_PORTC + 28, 1);
-       mxc_gpio_mode(PC20_PF_SSI1_FS);
-       mxc_gpio_mode(PC22_PF_SSI1_TXD);
-       msleep(2);
-}
-
-static const struct imx_ssi_platform_data pca100_ssi_pdata __initconst = {
-       .ac97_reset             = pca100_ac97_cold_reset,
-       .ac97_warm_reset        = pca100_ac97_warm_reset,
-       .flags                  = IMX_SSI_USE_AC97,
-};
-
-static int pca100_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
-               void *data)
-{
-       int ret;
-
-       ret = request_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), detect_irq,
-                         IRQF_TRIGGER_FALLING, "imx-mmc-detect", data);
-       if (ret)
-               printk(KERN_ERR
-                       "pca100: Failed to request irq for sd/mmc detection\n");
-
-       return ret;
-}
-
-static void pca100_sdhc2_exit(struct device *dev, void *data)
-{
-       free_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), data);
-}
-
-static const struct imxmmc_platform_data sdhc_pdata __initconst = {
-       .init = pca100_sdhc2_init,
-       .exit = pca100_sdhc2_exit,
-};
-
-static int otg_phy_init(struct platform_device *pdev)
-{
-       gpio_set_value(OTG_PHY_CS_GPIO, 0);
-
-       mdelay(10);
-
-       return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
-}
-
-static struct mxc_usbh_platform_data otg_pdata __initdata = {
-       .init   = otg_phy_init,
-       .portsc = MXC_EHCI_MODE_ULPI,
-};
-
-static int usbh2_phy_init(struct platform_device *pdev)
-{
-       gpio_set_value(USBH2_PHY_CS_GPIO, 0);
-
-       mdelay(10);
-
-       return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
-}
-
-static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
-       .init   = usbh2_phy_init,
-       .portsc = MXC_EHCI_MODE_ULPI,
-};
-
-static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
-       .operating_mode = FSL_USB2_DR_DEVICE,
-       .phy_mode       = FSL_USB2_PHY_ULPI,
-};
-
-static bool otg_mode_host __initdata;
-
-static int __init pca100_otg_mode(char *options)
-{
-       if (!strcmp(options, "host"))
-               otg_mode_host = true;
-       else if (!strcmp(options, "device"))
-               otg_mode_host = false;
-       else
-               pr_info("otg_mode neither \"host\" nor \"device\". "
-                       "Defaulting to device\n");
-       return 1;
-}
-__setup("otg_mode=", pca100_otg_mode);
-
-/* framebuffer info */
-static struct imx_fb_videomode pca100_fb_modes[] = {
-       {
-               .mode = {
-                       .name           = "EMERGING-ETV570G0DHU",
-                       .refresh        = 60,
-                       .xres           = 640,
-                       .yres           = 480,
-                       .pixclock       = 39722, /* in ps (25.175 MHz) */
-                       .hsync_len      = 30,
-                       .left_margin    = 114,
-                       .right_margin   = 16,
-                       .vsync_len      = 3,
-                       .upper_margin   = 32,
-                       .lower_margin   = 0,
-               },
-               /*
-                * TFT
-                * Pixel pol active high
-                * HSYNC active low
-                * VSYNC active low
-                * use HSYNC for ACD count
-                * line clock disable while idle
-                * always enable line clock even if no data
-                */
-               .pcr = 0xf0c08080,
-               .bpp = 16,
-       },
-};
-
-static const struct imx_fb_platform_data pca100_fb_data __initconst = {
-       .mode = pca100_fb_modes,
-       .num_modes = ARRAY_SIZE(pca100_fb_modes),
-
-       .pwmr           = 0x00A903FF,
-       .lscr1          = 0x00120300,
-       .dmacr          = 0x00020010,
-};
-
-static void __init pca100_init(void)
-{
-       int ret;
-
-       imx27_soc_init();
-
-       ret = mxc_gpio_setup_multiple_pins(pca100_pins,
-                       ARRAY_SIZE(pca100_pins), "PCA100");
-       if (ret)
-               printk(KERN_ERR "pca100: Failed to setup pins (%d)\n", ret);
-
-       imx27_add_imx_uart0(&uart_pdata);
-
-       imx27_add_mxc_nand(&pca100_nand_board_info);
-
-       /* only the i2c master 1 is used on this CPU card */
-       i2c_register_board_info(1, pca100_i2c_devices,
-                               ARRAY_SIZE(pca100_i2c_devices));
-
-       imx27_add_imx_i2c(1, &pca100_i2c1_data);
-
-       mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_IN);
-       mxc_gpio_mode(GPIO_PORTD | 27 | GPIO_GPIO | GPIO_IN);
-       spi_register_board_info(pca100_spi_board_info,
-                               ARRAY_SIZE(pca100_spi_board_info));
-       imx27_add_spi_imx0(&pca100_spi0_gpiod_table);
-
-       imx27_add_imx_fb(&pca100_fb_data);
-
-       imx27_add_fec(NULL);
-       imx27_add_imx2_wdt();
-       imx27_add_mxc_w1();
-}
-
-static void __init pca100_late_init(void)
-{
-       imx27_add_imx_ssi(0, &pca100_ssi_pdata);
-
-       imx27_add_mxc_mmc(1, &sdhc_pdata);
-
-       gpio_request(OTG_PHY_CS_GPIO, "usb-otg-cs");
-       gpio_direction_output(OTG_PHY_CS_GPIO, 1);
-       gpio_request(USBH2_PHY_CS_GPIO, "usb-host2-cs");
-       gpio_direction_output(USBH2_PHY_CS_GPIO, 1);
-
-       if (otg_mode_host) {
-               otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-                               ULPI_OTG_DRVVBUS_EXT);
-
-               if (otg_pdata.otg)
-                       imx27_add_mxc_ehci_otg(&otg_pdata);
-       } else {
-               gpio_set_value(OTG_PHY_CS_GPIO, 0);
-               imx27_add_fsl_usb2_udc(&otg_device_pdata);
-       }
-
-       usbh2_pdata.otg = imx_otg_ulpi_create(
-                       ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
-
-       if (usbh2_pdata.otg)
-               imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
-}
-
-static void __init pca100_timer_init(void)
-{
-       mx27_clocks_init(26000000);
-}
-
-MACHINE_START(PCA100, "phyCARD-i.MX27")
-       .atag_offset = 0x100,
-       .map_io = mx27_map_io,
-       .init_early = imx27_init_early,
-       .init_irq = mx27_init_irq,
-       .init_machine   = pca100_init,
-       .init_late      = pca100_late_init,
-       .init_time      = pca100_timer_init,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c
deleted file mode 100644 (file)
index c7d23e9..0000000
+++ /dev/null
@@ -1,585 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *  Copyright (C) 2008 Sascha Hauer, Pengutronix
- */
-
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/dma-mapping.h>
-#include <linux/platform_device.h>
-#include <linux/mtd/physmap.h>
-#include <linux/mtd/plat-ram.h>
-#include <linux/memory.h>
-#include <linux/gpio.h>
-#include <linux/smsc911x.h>
-#include <linux/interrupt.h>
-#include <linux/i2c.h>
-#include <linux/property.h>
-#include <linux/delay.h>
-#include <linux/spi/spi.h>
-#include <linux/irq.h>
-#include <linux/can/platform/sja1000.h>
-#include <linux/usb/otg.h>
-#include <linux/usb/ulpi.h>
-#include <linux/gfp.h>
-#include <linux/regulator/machine.h>
-#include <linux/regulator/fixed.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-#include <asm/mach/map.h>
-
-#include "common.h"
-#include "devices-imx31.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-#include "pcm037.h"
-#include "ulpi.h"
-
-static enum pcm037_board_variant pcm037_instance = PCM037_PCM970;
-
-static int __init pcm037_variant_setup(char *str)
-{
-       if (!strcmp("eet", str))
-               pcm037_instance = PCM037_EET;
-       else if (strcmp("pcm970", str))
-               pr_warn("Unknown pcm037 baseboard variant %s\n", str);
-
-       return 1;
-}
-
-/* Supported values: "pcm970" (default) and "eet" */
-__setup("pcm037_variant=", pcm037_variant_setup);
-
-enum pcm037_board_variant pcm037_variant(void)
-{
-       return pcm037_instance;
-}
-
-/* UART1 with RTS/CTS handshake signals */
-static unsigned int pcm037_uart1_handshake_pins[] = {
-       MX31_PIN_CTS1__CTS1,
-       MX31_PIN_RTS1__RTS1,
-       MX31_PIN_TXD1__TXD1,
-       MX31_PIN_RXD1__RXD1,
-};
-
-/* UART1 without RTS/CTS handshake signals */
-static unsigned int pcm037_uart1_pins[] = {
-       MX31_PIN_TXD1__TXD1,
-       MX31_PIN_RXD1__RXD1,
-};
-
-static unsigned int pcm037_pins[] = {
-       /* I2C */
-       MX31_PIN_CSPI2_MOSI__SCL,
-       MX31_PIN_CSPI2_MISO__SDA,
-       MX31_PIN_CSPI2_SS2__I2C3_SDA,
-       MX31_PIN_CSPI2_SCLK__I2C3_SCL,
-       /* SDHC1 */
-       MX31_PIN_SD1_DATA3__SD1_DATA3,
-       MX31_PIN_SD1_DATA2__SD1_DATA2,
-       MX31_PIN_SD1_DATA1__SD1_DATA1,
-       MX31_PIN_SD1_DATA0__SD1_DATA0,
-       MX31_PIN_SD1_CLK__SD1_CLK,
-       MX31_PIN_SD1_CMD__SD1_CMD,
-       IOMUX_MODE(MX31_PIN_SCK6, IOMUX_CONFIG_GPIO), /* card detect */
-       IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_GPIO), /* write protect */
-       /* SPI1 */
-       MX31_PIN_CSPI1_MOSI__MOSI,
-       MX31_PIN_CSPI1_MISO__MISO,
-       MX31_PIN_CSPI1_SCLK__SCLK,
-       MX31_PIN_CSPI1_SPI_RDY__SPI_RDY,
-       MX31_PIN_CSPI1_SS0__SS0,
-       MX31_PIN_CSPI1_SS1__SS1,
-       MX31_PIN_CSPI1_SS2__SS2,
-       /* UART2 */
-       MX31_PIN_TXD2__TXD2,
-       MX31_PIN_RXD2__RXD2,
-       MX31_PIN_CTS2__CTS2,
-       MX31_PIN_RTS2__RTS2,
-       /* UART3 */
-       MX31_PIN_CSPI3_MOSI__RXD3,
-       MX31_PIN_CSPI3_MISO__TXD3,
-       MX31_PIN_CSPI3_SCLK__RTS3,
-       MX31_PIN_CSPI3_SPI_RDY__CTS3,
-       /* LAN9217 irq pin */
-       IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO),
-       /* Onewire */
-       MX31_PIN_BATT_LINE__OWIRE,
-       /* Framebuffer */
-       MX31_PIN_LD0__LD0,
-       MX31_PIN_LD1__LD1,
-       MX31_PIN_LD2__LD2,
-       MX31_PIN_LD3__LD3,
-       MX31_PIN_LD4__LD4,
-       MX31_PIN_LD5__LD5,
-       MX31_PIN_LD6__LD6,
-       MX31_PIN_LD7__LD7,
-       MX31_PIN_LD8__LD8,
-       MX31_PIN_LD9__LD9,
-       MX31_PIN_LD10__LD10,
-       MX31_PIN_LD11__LD11,
-       MX31_PIN_LD12__LD12,
-       MX31_PIN_LD13__LD13,
-       MX31_PIN_LD14__LD14,
-       MX31_PIN_LD15__LD15,
-       MX31_PIN_LD16__LD16,
-       MX31_PIN_LD17__LD17,
-       MX31_PIN_VSYNC3__VSYNC3,
-       MX31_PIN_HSYNC__HSYNC,
-       MX31_PIN_FPSHIFT__FPSHIFT,
-       MX31_PIN_DRDY0__DRDY0,
-       MX31_PIN_D3_REV__D3_REV,
-       MX31_PIN_CONTRAST__CONTRAST,
-       MX31_PIN_D3_SPL__D3_SPL,
-       MX31_PIN_D3_CLS__D3_CLS,
-       MX31_PIN_LCS0__GPIO3_23,
-       /* GPIO */
-       IOMUX_MODE(MX31_PIN_ATA_DMACK, IOMUX_CONFIG_GPIO),
-       /* OTG */
-       MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
-       MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
-       MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
-       MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
-       MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
-       MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
-       MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
-       MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
-       MX31_PIN_USBOTG_CLK__USBOTG_CLK,
-       MX31_PIN_USBOTG_DIR__USBOTG_DIR,
-       MX31_PIN_USBOTG_NXT__USBOTG_NXT,
-       MX31_PIN_USBOTG_STP__USBOTG_STP,
-       /* USB host 2 */
-       IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_STXD3, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_SRXD3, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_SCK3, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_SFS3, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_STXD6, IOMUX_CONFIG_FUNC),
-       IOMUX_MODE(MX31_PIN_SRXD6, IOMUX_CONFIG_FUNC),
-};
-
-static struct physmap_flash_data pcm037_flash_data = {
-       .width  = 2,
-};
-
-static struct resource pcm037_flash_resource = {
-       .start  = 0xa0000000,
-       .end    = 0xa1ffffff,
-       .flags  = IORESOURCE_MEM,
-};
-
-static struct platform_device pcm037_flash = {
-       .name   = "physmap-flash",
-       .id     = 0,
-       .dev    = {
-               .platform_data  = &pcm037_flash_data,
-       },
-       .resource = &pcm037_flash_resource,
-       .num_resources = 1,
-};
-
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static struct resource smsc911x_resources[] = {
-       {
-               .start          = MX31_CS1_BASE_ADDR + 0x300,
-               .end            = MX31_CS1_BASE_ADDR + 0x300 + SZ_64K - 1,
-               .flags          = IORESOURCE_MEM,
-       }, {
-               /* irq number is run-time assigned */
-               .flags          = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
-       },
-};
-
-static struct smsc911x_platform_config smsc911x_info = {
-       .flags          = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY |
-                         SMSC911X_SAVE_MAC_ADDRESS,
-       .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
-       .irq_type       = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
-       .phy_interface  = PHY_INTERFACE_MODE_MII,
-};
-
-static struct platform_device pcm037_eth = {
-       .name           = "smsc911x",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(smsc911x_resources),
-       .resource       = smsc911x_resources,
-       .dev            = {
-               .platform_data = &smsc911x_info,
-       },
-};
-
-static struct platdata_mtd_ram pcm038_sram_data = {
-       .bankwidth = 2,
-};
-
-static struct resource pcm038_sram_resource = {
-       .start = MX31_CS4_BASE_ADDR,
-       .end   = MX31_CS4_BASE_ADDR + 512 * 1024 - 1,
-       .flags = IORESOURCE_MEM,
-};
-
-static struct platform_device pcm037_sram_device = {
-       .name = "mtd-ram",
-       .id = 0,
-       .dev = {
-               .platform_data = &pcm038_sram_data,
-       },
-       .num_resources = 1,
-       .resource = &pcm038_sram_resource,
-};
-
-static const struct mxc_nand_platform_data
-pcm037_nand_board_info __initconst = {
-       .width = 1,
-       .hw_ecc = 1,
-};
-
-static const struct imxi2c_platform_data pcm037_i2c1_data __initconst = {
-       .bitrate = 100000,
-};
-
-static const struct imxi2c_platform_data pcm037_i2c2_data __initconst = {
-       .bitrate = 20000,
-};
-
-static const struct property_entry board_eeprom_properties[] = {
-       PROPERTY_ENTRY_U32("pagesize", 32),
-       { }
-};
-
-static struct i2c_board_info pcm037_i2c_devices[] = {
-       {
-               I2C_BOARD_INFO("24c32", 0x52), /* E0=0, E1=1, E2=0 */
-               .properties = board_eeprom_properties,
-       }, {
-               I2C_BOARD_INFO("pcf8563", 0x51),
-       }
-};
-
-/* Not connected by default */
-#ifdef PCM970_SDHC_RW_SWITCH
-static int pcm970_sdhc1_get_ro(struct device *dev)
-{
-       return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_SFS6));
-}
-#endif
-
-#define SDHC1_GPIO_WP  IOMUX_TO_GPIO(MX31_PIN_SFS6)
-#define SDHC1_GPIO_DET IOMUX_TO_GPIO(MX31_PIN_SCK6)
-
-static int pcm970_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
-               void *data)
-{
-       int ret;
-
-       ret = gpio_request(SDHC1_GPIO_DET, "sdhc-detect");
-       if (ret)
-               return ret;
-
-       gpio_direction_input(SDHC1_GPIO_DET);
-
-#ifdef PCM970_SDHC_RW_SWITCH
-       ret = gpio_request(SDHC1_GPIO_WP, "sdhc-wp");
-       if (ret)
-               goto err_gpio_free;
-       gpio_direction_input(SDHC1_GPIO_WP);
-#endif
-
-       ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SCK6)), detect_irq,
-                       IRQF_TRIGGER_FALLING, "sdhc-detect", data);
-       if (ret)
-               goto err_gpio_free_2;
-
-       return 0;
-
-err_gpio_free_2:
-#ifdef PCM970_SDHC_RW_SWITCH
-       gpio_free(SDHC1_GPIO_WP);
-err_gpio_free:
-#endif
-       gpio_free(SDHC1_GPIO_DET);
-
-       return ret;
-}
-
-static void pcm970_sdhc1_exit(struct device *dev, void *data)
-{
-       free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SCK6)), data);
-       gpio_free(SDHC1_GPIO_DET);
-       gpio_free(SDHC1_GPIO_WP);
-}
-
-static const struct imxmmc_platform_data sdhc_pdata __initconst = {
-#ifdef PCM970_SDHC_RW_SWITCH
-       .get_ro = pcm970_sdhc1_get_ro,
-#endif
-       .init = pcm970_sdhc1_init,
-       .exit = pcm970_sdhc1_exit,
-};
-
-static struct platform_device *devices[] __initdata = {
-       &pcm037_flash,
-       &pcm037_sram_device,
-};
-
-static const struct fb_videomode fb_modedb[] = {
-       {
-               /* 240x320 @ 60 Hz Sharp */
-               .name           = "Sharp-LQ035Q7DH06-QVGA",
-               .refresh        = 60,
-               .xres           = 240,
-               .yres           = 320,
-               .pixclock       = 185925,
-               .left_margin    = 9,
-               .right_margin   = 16,
-               .upper_margin   = 7,
-               .lower_margin   = 9,
-               .hsync_len      = 1,
-               .vsync_len      = 1,
-               .sync           = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_SHARP_MODE |
-                                 FB_SYNC_CLK_INVERT | FB_SYNC_CLK_IDLE_EN,
-               .vmode          = FB_VMODE_NONINTERLACED,
-               .flag           = 0,
-       }, {
-               /* 240x320 @ 60 Hz */
-               .name           = "TX090",
-               .refresh        = 60,
-               .xres           = 240,
-               .yres           = 320,
-               .pixclock       = 38255,
-               .left_margin    = 144,
-               .right_margin   = 0,
-               .upper_margin   = 7,
-               .lower_margin   = 40,
-               .hsync_len      = 96,
-               .vsync_len      = 1,
-               .sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH,
-               .vmode          = FB_VMODE_NONINTERLACED,
-               .flag           = 0,
-       }, {
-               /* 240x320 @ 60 Hz */
-               .name           = "CMEL-OLED",
-               .refresh        = 60,
-               .xres           = 240,
-               .yres           = 320,
-               .pixclock       = 185925,
-               .left_margin    = 9,
-               .right_margin   = 16,
-               .upper_margin   = 7,
-               .lower_margin   = 9,
-               .hsync_len      = 1,
-               .vsync_len      = 1,
-               .sync           = FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT,
-               .vmode          = FB_VMODE_NONINTERLACED,
-               .flag           = 0,
-       },
-};
-
-static struct mx3fb_platform_data mx3fb_pdata = {
-       .name           = "Sharp-LQ035Q7DH06-QVGA",
-       .mode           = fb_modedb,
-       .num_modes      = ARRAY_SIZE(fb_modedb),
-};
-
-static struct resource pcm970_sja1000_resources[] = {
-       {
-               .start   = MX31_CS5_BASE_ADDR,
-               .end     = MX31_CS5_BASE_ADDR + 0x100 - 1,
-               .flags   = IORESOURCE_MEM,
-       }, {
-               /* irq number is run-time assigned */
-               .flags   = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
-       },
-};
-
-static struct sja1000_platform_data pcm970_sja1000_platform_data = {
-       .osc_freq       = 16000000,
-       .ocr            = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL,
-       .cdr            = CDR_CBP,
-};
-
-static struct platform_device pcm970_sja1000 = {
-       .name = "sja1000_platform",
-       .dev = {
-               .platform_data = &pcm970_sja1000_platform_data,
-       },
-       .resource = pcm970_sja1000_resources,
-       .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
-};
-
-static int pcm037_otg_init(struct platform_device *pdev)
-{
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
-}
-
-static struct mxc_usbh_platform_data otg_pdata __initdata = {
-       .init   = pcm037_otg_init,
-       .portsc = MXC_EHCI_MODE_ULPI,
-};
-
-static int pcm037_usbh2_init(struct platform_device *pdev)
-{
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
-}
-
-static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
-       .init   = pcm037_usbh2_init,
-       .portsc = MXC_EHCI_MODE_ULPI,
-};
-
-static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
-       .operating_mode = FSL_USB2_DR_DEVICE,
-       .phy_mode       = FSL_USB2_PHY_ULPI,
-};
-
-static bool otg_mode_host __initdata;
-
-static int __init pcm037_otg_mode(char *options)
-{
-       if (!strcmp(options, "host"))
-               otg_mode_host = true;
-       else if (!strcmp(options, "device"))
-               otg_mode_host = false;
-       else
-               pr_info("otg_mode neither \"host\" nor \"device\". "
-                       "Defaulting to device\n");
-       return 1;
-}
-__setup("otg_mode=", pcm037_otg_mode);
-
-static struct regulator_consumer_supply dummy_supplies[] = {
-       REGULATOR_SUPPLY("vdd33a", "smsc911x"),
-       REGULATOR_SUPPLY("vddvario", "smsc911x"),
-};
-
-/*
- * Board specific initialization.
- */
-static void __init pcm037_init(void)
-{
-       imx31_soc_init();
-
-       regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
-
-       mxc_iomux_set_gpr(MUX_PGP_UH2, 1);
-
-       mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins),
-                       "pcm037");
-
-#define H2_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS \
-               | PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
-
-       mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, H2_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, H2_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, H2_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_STP, H2_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, H2_PAD_CFG); /* USBH2_DATA0 */
-       mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, H2_PAD_CFG); /* USBH2_DATA1 */
-       mxc_iomux_set_pad(MX31_PIN_SRXD6, H2_PAD_CFG);  /* USBH2_DATA2 */
-       mxc_iomux_set_pad(MX31_PIN_STXD6, H2_PAD_CFG);  /* USBH2_DATA3 */
-       mxc_iomux_set_pad(MX31_PIN_SFS3, H2_PAD_CFG);   /* USBH2_DATA4 */
-       mxc_iomux_set_pad(MX31_PIN_SCK3, H2_PAD_CFG);   /* USBH2_DATA5 */
-       mxc_iomux_set_pad(MX31_PIN_SRXD3, H2_PAD_CFG);  /* USBH2_DATA6 */
-       mxc_iomux_set_pad(MX31_PIN_STXD3, H2_PAD_CFG);  /* USBH2_DATA7 */
-
-       if (pcm037_variant() == PCM037_EET)
-               mxc_iomux_setup_multiple_pins(pcm037_uart1_pins,
-                       ARRAY_SIZE(pcm037_uart1_pins), "pcm037_uart1");
-       else
-               mxc_iomux_setup_multiple_pins(pcm037_uart1_handshake_pins,
-                       ARRAY_SIZE(pcm037_uart1_handshake_pins),
-                       "pcm037_uart1");
-
-       platform_add_devices(devices, ARRAY_SIZE(devices));
-
-       imx31_add_imx2_wdt();
-       imx31_add_imx_uart0(&uart_pdata);
-       /* XXX: should't this have .flags = 0 (i.e. no RTSCTS) on PCM037_EET? */
-       imx31_add_imx_uart1(&uart_pdata);
-       imx31_add_imx_uart2(&uart_pdata);
-
-       imx31_add_mxc_w1();
-
-       /* I2C adapters and devices */
-       i2c_register_board_info(1, pcm037_i2c_devices,
-                       ARRAY_SIZE(pcm037_i2c_devices));
-
-       imx31_add_imx_i2c1(&pcm037_i2c1_data);
-       imx31_add_imx_i2c2(&pcm037_i2c2_data);
-
-       imx31_add_mxc_nand(&pcm037_nand_board_info);
-       imx31_add_ipu_core();
-       imx31_add_mx3_sdc_fb(&mx3fb_pdata);
-
-       if (otg_mode_host) {
-               otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-                               ULPI_OTG_DRVVBUS_EXT);
-               if (otg_pdata.otg)
-                       imx31_add_mxc_ehci_otg(&otg_pdata);
-       }
-
-       usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-                       ULPI_OTG_DRVVBUS_EXT);
-       if (usbh2_pdata.otg)
-               imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
-
-       if (!otg_mode_host)
-               imx31_add_fsl_usb2_udc(&otg_device_pdata);
-}
-
-static void __init pcm037_timer_init(void)
-{
-       mx31_clocks_init(26000000);
-}
-
-static void __init pcm037_init_late(void)
-{
-       int ret;
-
-       /* LAN9217 IRQ pin */
-       ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1), "lan9217-irq");
-       if (!ret) {
-               gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
-               smsc911x_resources[1].start =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
-               smsc911x_resources[1].end =
-                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
-               platform_device_register(&pcm037_eth);
-       } else {
-               pr_warn("could not get LAN irq gpio\n");
-       }
-
-       imx31_add_mxc_mmc(0, &sdhc_pdata);
-
-       pcm970_sja1000_resources[1].start =
-                       gpio_to_irq(IOMUX_TO_GPIO(IOMUX_PIN(48, 105)));
-       pcm970_sja1000_resources[1].end =
-                       gpio_to_irq(IOMUX_TO_GPIO(IOMUX_PIN(48, 105)));
-       platform_device_register(&pcm970_sja1000);
-
-       pcm037_eet_init_devices();
-}
-
-MACHINE_START(PCM037, "Phytec Phycore pcm037")
-       /* Maintainer: Pengutronix */
-       .atag_offset = 0x100,
-       .map_io = mx31_map_io,
-       .init_early = imx31_init_early,
-       .init_irq = mx31_init_irq,
-       .init_time      = pcm037_timer_init,
-       .init_machine = pcm037_init,
-       .init_late = pcm037_init_late,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-pcm037_eet.c b/arch/arm/mach-imx/mach-pcm037_eet.c
deleted file mode 100644 (file)
index 8b0e03a..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2009
- * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
- */
-#include <linux/gpio.h>
-#include <linux/input.h>
-#include <linux/platform_device.h>
-#include <linux/spi/spi.h>
-
-#include <asm/mach-types.h>
-
-#include "pcm037.h"
-#include "common.h"
-#include "devices-imx31.h"
-#include "iomux-mx3.h"
-
-static unsigned int pcm037_eet_pins[] = {
-       /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */
-       IOMUX_MODE(MX31_PIN_KEY_COL7, IOMUX_CONFIG_GPIO),
-       /* GPIO keys */
-       IOMUX_MODE(MX31_PIN_GPIO1_0,    IOMUX_CONFIG_GPIO), /* 0 */
-       IOMUX_MODE(MX31_PIN_GPIO1_1,    IOMUX_CONFIG_GPIO), /* 1 */
-       IOMUX_MODE(MX31_PIN_GPIO1_2,    IOMUX_CONFIG_GPIO), /* 2 */
-       IOMUX_MODE(MX31_PIN_GPIO1_3,    IOMUX_CONFIG_GPIO), /* 3 */
-       IOMUX_MODE(MX31_PIN_SVEN0,      IOMUX_CONFIG_GPIO), /* 32 */
-       IOMUX_MODE(MX31_PIN_STX0,       IOMUX_CONFIG_GPIO), /* 33 */
-       IOMUX_MODE(MX31_PIN_SRX0,       IOMUX_CONFIG_GPIO), /* 34 */
-       IOMUX_MODE(MX31_PIN_SIMPD0,     IOMUX_CONFIG_GPIO), /* 35 */
-       IOMUX_MODE(MX31_PIN_RTS1,       IOMUX_CONFIG_GPIO), /* 38 */
-       IOMUX_MODE(MX31_PIN_CTS1,       IOMUX_CONFIG_GPIO), /* 39 */
-       IOMUX_MODE(MX31_PIN_KEY_ROW4,   IOMUX_CONFIG_GPIO), /* 50 */
-       IOMUX_MODE(MX31_PIN_KEY_ROW5,   IOMUX_CONFIG_GPIO), /* 51 */
-       IOMUX_MODE(MX31_PIN_KEY_ROW6,   IOMUX_CONFIG_GPIO), /* 52 */
-       IOMUX_MODE(MX31_PIN_KEY_ROW7,   IOMUX_CONFIG_GPIO), /* 53 */
-
-       /* LEDs */
-       IOMUX_MODE(MX31_PIN_DTR_DTE1,   IOMUX_CONFIG_GPIO), /* 44 */
-       IOMUX_MODE(MX31_PIN_DSR_DTE1,   IOMUX_CONFIG_GPIO), /* 45 */
-       IOMUX_MODE(MX31_PIN_KEY_COL5,   IOMUX_CONFIG_GPIO), /* 55 */
-       IOMUX_MODE(MX31_PIN_KEY_COL6,   IOMUX_CONFIG_GPIO), /* 56 */
-};
-
-/* SPI */
-static struct spi_board_info pcm037_spi_dev[] = {
-       {
-               .modalias       = "dac124s085",
-               .max_speed_hz   = 400000,
-               .bus_num        = 0,
-               .chip_select    = 1,            /* Index in pcm037_spi1_cs[] */
-               .mode           = SPI_CPHA,
-       },
-};
-
-/* GPIO-keys input device */
-static struct gpio_keys_button pcm037_gpio_keys[] = {
-       {
-               .type   = EV_KEY,
-               .code   = KEY_L,
-               .gpio   = 0,
-               .desc   = "Wheel Manual",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = KEY_A,
-               .gpio   = 1,
-               .desc   = "Wheel AF",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = KEY_V,
-               .gpio   = 2,
-               .desc   = "Wheel View",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = KEY_M,
-               .gpio   = 3,
-               .desc   = "Wheel Menu",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = KEY_UP,
-               .gpio   = 32,
-               .desc   = "Nav Pad Up",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = KEY_RIGHT,
-               .gpio   = 33,
-               .desc   = "Nav Pad Right",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = KEY_DOWN,
-               .gpio   = 34,
-               .desc   = "Nav Pad Down",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = KEY_LEFT,
-               .gpio   = 35,
-               .desc   = "Nav Pad Left",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = KEY_ENTER,
-               .gpio   = 38,
-               .desc   = "Nav Pad Ok",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = KEY_O,
-               .gpio   = 39,
-               .desc   = "Wheel Off",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = BTN_FORWARD,
-               .gpio   = 50,
-               .desc   = "Focus Forward",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = BTN_BACK,
-               .gpio   = 51,
-               .desc   = "Focus Backward",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = BTN_MIDDLE,
-               .gpio   = 52,
-               .desc   = "Release Half",
-               .wakeup = 0,
-       }, {
-               .type   = EV_KEY,
-               .code   = BTN_EXTRA,
-               .gpio   = 53,
-               .desc   = "Release Full",
-               .wakeup = 0,
-       },
-};
-
-static const struct gpio_keys_platform_data
-               pcm037_gpio_keys_platform_data __initconst = {
-       .buttons        = pcm037_gpio_keys,
-       .nbuttons       = ARRAY_SIZE(pcm037_gpio_keys),
-       .rep            = 0, /* No auto-repeat */
-};
-
-int __init pcm037_eet_init_devices(void)
-{
-       if (pcm037_variant() != PCM037_EET)
-               return 0;
-
-       mxc_iomux_setup_multiple_pins(pcm037_eet_pins,
-                               ARRAY_SIZE(pcm037_eet_pins), "pcm037_eet");
-
-       /* SPI */
-       spi_register_board_info(pcm037_spi_dev, ARRAY_SIZE(pcm037_spi_dev));
-       imx31_add_spi_imx0(NULL);
-
-       imx_add_gpio_keys(&pcm037_gpio_keys_platform_data);
-
-       return 0;
-}
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
deleted file mode 100644 (file)
index 017a501..0000000
+++ /dev/null
@@ -1,412 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *  Copyright (C) 2009 Sascha Hauer, Pengutronix
- */
-
-#include <linux/types.h>
-#include <linux/init.h>
-
-#include <linux/platform_device.h>
-#include <linux/mtd/physmap.h>
-#include <linux/mtd/plat-ram.h>
-#include <linux/memory.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/smc911x.h>
-#include <linux/interrupt.h>
-#include <linux/delay.h>
-#include <linux/i2c.h>
-#include <linux/property.h>
-#include <linux/usb/otg.h>
-#include <linux/usb/ulpi.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-#include <asm/mach/map.h>
-
-#include "common.h"
-#include "devices-imx35.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx35.h"
-#include "ulpi.h"
-
-static const struct fb_videomode fb_modedb[] = {
-       {
-               /* 240x320 @ 60 Hz */
-               .name           = "Sharp-LQ035Q7",
-               .refresh        = 60,
-               .xres           = 240,
-               .yres           = 320,
-               .pixclock       = 185925,
-               .left_margin    = 9,
-               .right_margin   = 16,
-               .upper_margin   = 7,
-               .lower_margin   = 9,
-               .hsync_len      = 1,
-               .vsync_len      = 1,
-               .sync           = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_SHARP_MODE | FB_SYNC_CLK_INVERT | FB_SYNC_CLK_IDLE_EN,
-               .vmode          = FB_VMODE_NONINTERLACED,
-               .flag           = 0,
-       }, {
-               /* 240x320 @ 60 Hz */
-               .name           = "TX090",
-               .refresh        = 60,
-               .xres           = 240,
-               .yres           = 320,
-               .pixclock       = 38255,
-               .left_margin    = 144,
-               .right_margin   = 0,
-               .upper_margin   = 7,
-               .lower_margin   = 40,
-               .hsync_len      = 96,
-               .vsync_len      = 1,
-               .sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH,
-               .vmode          = FB_VMODE_NONINTERLACED,
-               .flag           = 0,
-       },
-};
-
-static struct mx3fb_platform_data mx3fb_pdata __initdata = {
-       .name           = "Sharp-LQ035Q7",
-       .mode           = fb_modedb,
-       .num_modes      = ARRAY_SIZE(fb_modedb),
-};
-
-static struct physmap_flash_data pcm043_flash_data = {
-       .width  = 2,
-};
-
-static struct resource pcm043_flash_resource = {
-       .start  = 0xa0000000,
-       .end    = 0xa1ffffff,
-       .flags  = IORESOURCE_MEM,
-};
-
-static struct platform_device pcm043_flash = {
-       .name   = "physmap-flash",
-       .id     = 0,
-       .dev    = {
-               .platform_data  = &pcm043_flash_data,
-       },
-       .resource = &pcm043_flash_resource,
-       .num_resources = 1,
-};
-
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static const struct imxi2c_platform_data pcm043_i2c0_data __initconst = {
-       .bitrate = 50000,
-};
-
-static const struct property_entry board_eeprom_properties[] = {
-       PROPERTY_ENTRY_U32("pagesize", 32),
-       { }
-};
-
-static struct i2c_board_info pcm043_i2c_devices[] = {
-       {
-               I2C_BOARD_INFO("24c32", 0x52), /* E0=0, E1=1, E2=0 */
-               .properties = board_eeprom_properties,
-       }, {
-               I2C_BOARD_INFO("pcf8563", 0x51),
-       },
-};
-
-static struct platform_device *devices[] __initdata = {
-       &pcm043_flash,
-};
-
-static const iomux_v3_cfg_t pcm043_pads[] __initconst = {
-       /* UART1 */
-       MX35_PAD_CTS1__UART1_CTS,
-       MX35_PAD_RTS1__UART1_RTS,
-       MX35_PAD_TXD1__UART1_TXD_MUX,
-       MX35_PAD_RXD1__UART1_RXD_MUX,
-       /* UART2 */
-       MX35_PAD_CTS2__UART2_CTS,
-       MX35_PAD_RTS2__UART2_RTS,
-       MX35_PAD_TXD2__UART2_TXD_MUX,
-       MX35_PAD_RXD2__UART2_RXD_MUX,
-       /* FEC */
-       MX35_PAD_FEC_TX_CLK__FEC_TX_CLK,
-       MX35_PAD_FEC_RX_CLK__FEC_RX_CLK,
-       MX35_PAD_FEC_RX_DV__FEC_RX_DV,
-       MX35_PAD_FEC_COL__FEC_COL,
-       MX35_PAD_FEC_RDATA0__FEC_RDATA_0,
-       MX35_PAD_FEC_TDATA0__FEC_TDATA_0,
-       MX35_PAD_FEC_TX_EN__FEC_TX_EN,
-       MX35_PAD_FEC_MDC__FEC_MDC,
-       MX35_PAD_FEC_MDIO__FEC_MDIO,
-       MX35_PAD_FEC_TX_ERR__FEC_TX_ERR,
-       MX35_PAD_FEC_RX_ERR__FEC_RX_ERR,
-       MX35_PAD_FEC_CRS__FEC_CRS,
-       MX35_PAD_FEC_RDATA1__FEC_RDATA_1,
-       MX35_PAD_FEC_TDATA1__FEC_TDATA_1,
-       MX35_PAD_FEC_RDATA2__FEC_RDATA_2,
-       MX35_PAD_FEC_TDATA2__FEC_TDATA_2,
-       MX35_PAD_FEC_RDATA3__FEC_RDATA_3,
-       MX35_PAD_FEC_TDATA3__FEC_TDATA_3,
-       /* I2C1 */
-       MX35_PAD_I2C1_CLK__I2C1_SCL,
-       MX35_PAD_I2C1_DAT__I2C1_SDA,
-       /* Display */
-       MX35_PAD_LD0__IPU_DISPB_DAT_0,
-       MX35_PAD_LD1__IPU_DISPB_DAT_1,
-       MX35_PAD_LD2__IPU_DISPB_DAT_2,
-       MX35_PAD_LD3__IPU_DISPB_DAT_3,
-       MX35_PAD_LD4__IPU_DISPB_DAT_4,
-       MX35_PAD_LD5__IPU_DISPB_DAT_5,
-       MX35_PAD_LD6__IPU_DISPB_DAT_6,
-       MX35_PAD_LD7__IPU_DISPB_DAT_7,
-       MX35_PAD_LD8__IPU_DISPB_DAT_8,
-       MX35_PAD_LD9__IPU_DISPB_DAT_9,
-       MX35_PAD_LD10__IPU_DISPB_DAT_10,
-       MX35_PAD_LD11__IPU_DISPB_DAT_11,
-       MX35_PAD_LD12__IPU_DISPB_DAT_12,
-       MX35_PAD_LD13__IPU_DISPB_DAT_13,
-       MX35_PAD_LD14__IPU_DISPB_DAT_14,
-       MX35_PAD_LD15__IPU_DISPB_DAT_15,
-       MX35_PAD_LD16__IPU_DISPB_DAT_16,
-       MX35_PAD_LD17__IPU_DISPB_DAT_17,
-       MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC,
-       MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK,
-       MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY,
-       MX35_PAD_CONTRAST__IPU_DISPB_CONTR,
-       MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC,
-       MX35_PAD_D3_REV__IPU_DISPB_D3_REV,
-       MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS,
-       /* gpio */
-       MX35_PAD_ATA_CS0__GPIO2_6,
-       /* USB host */
-       MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR,
-       MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC,
-       /* SSI */
-       MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS,
-       MX35_PAD_STXD4__AUDMUX_AUD4_TXD,
-       MX35_PAD_SRXD4__AUDMUX_AUD4_RXD,
-       MX35_PAD_SCK4__AUDMUX_AUD4_TXC,
-       /* CAN2 */
-       MX35_PAD_TX5_RX0__CAN2_TXCAN,
-       MX35_PAD_TX4_RX1__CAN2_RXCAN,
-       /* esdhc */
-       MX35_PAD_SD1_CMD__ESDHC1_CMD,
-       MX35_PAD_SD1_CLK__ESDHC1_CLK,
-       MX35_PAD_SD1_DATA0__ESDHC1_DAT0,
-       MX35_PAD_SD1_DATA1__ESDHC1_DAT1,
-       MX35_PAD_SD1_DATA2__ESDHC1_DAT2,
-       MX35_PAD_SD1_DATA3__ESDHC1_DAT3,
-       MX35_PAD_ATA_DATA10__GPIO2_23, /* WriteProtect */
-       MX35_PAD_ATA_DATA11__GPIO2_24, /* CardDetect */
-};
-
-#define AC97_GPIO_TXFS IMX_GPIO_NR(2, 31)
-#define AC97_GPIO_TXD  IMX_GPIO_NR(2, 28)
-#define AC97_GPIO_RESET        IMX_GPIO_NR(2, 0)
-
-static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
-{
-       iomux_v3_cfg_t txfs_gpio = MX35_PAD_STXFS4__GPIO2_31;
-       iomux_v3_cfg_t txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
-       int ret;
-
-       ret = gpio_request(AC97_GPIO_TXFS, "SSI");
-       if (ret) {
-               printk("failed to get GPIO_TXFS: %d\n", ret);
-               return;
-       }
-
-       mxc_iomux_v3_setup_pad(txfs_gpio);
-
-       /* warm reset */
-       gpio_direction_output(AC97_GPIO_TXFS, 1);
-       udelay(2);
-       gpio_set_value(AC97_GPIO_TXFS, 0);
-
-       gpio_free(AC97_GPIO_TXFS);
-       mxc_iomux_v3_setup_pad(txfs);
-}
-
-static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
-{
-       iomux_v3_cfg_t txfs_gpio = MX35_PAD_STXFS4__GPIO2_31;
-       iomux_v3_cfg_t txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
-       iomux_v3_cfg_t txd_gpio = MX35_PAD_STXD4__GPIO2_28;
-       iomux_v3_cfg_t txd = MX35_PAD_STXD4__AUDMUX_AUD4_TXD;
-       iomux_v3_cfg_t reset_gpio = MX35_PAD_SD2_CMD__GPIO2_0;
-       int ret;
-
-       ret = gpio_request(AC97_GPIO_TXFS, "SSI");
-       if (ret)
-               goto err1;
-
-       ret = gpio_request(AC97_GPIO_TXD, "SSI");
-       if (ret)
-               goto err2;
-
-       ret = gpio_request(AC97_GPIO_RESET, "SSI");
-       if (ret)
-               goto err3;
-
-       mxc_iomux_v3_setup_pad(txfs_gpio);
-       mxc_iomux_v3_setup_pad(txd_gpio);
-       mxc_iomux_v3_setup_pad(reset_gpio);
-
-       gpio_direction_output(AC97_GPIO_TXFS, 0);
-       gpio_direction_output(AC97_GPIO_TXD, 0);
-
-       /* cold reset */
-       gpio_direction_output(AC97_GPIO_RESET, 0);
-       udelay(10);
-       gpio_direction_output(AC97_GPIO_RESET, 1);
-
-       mxc_iomux_v3_setup_pad(txd);
-       mxc_iomux_v3_setup_pad(txfs);
-
-       gpio_free(AC97_GPIO_RESET);
-err3:
-       gpio_free(AC97_GPIO_TXD);
-err2:
-       gpio_free(AC97_GPIO_TXFS);
-err1:
-       if (ret)
-               printk("%s failed with %d\n", __func__, ret);
-       mdelay(1);
-}
-
-static const struct imx_ssi_platform_data pcm043_ssi_pdata __initconst = {
-       .ac97_reset = pcm043_ac97_cold_reset,
-       .ac97_warm_reset = pcm043_ac97_warm_reset,
-       .flags = IMX_SSI_USE_AC97,
-};
-
-static const struct mxc_nand_platform_data
-pcm037_nand_board_info __initconst = {
-       .width = 1,
-       .hw_ecc = 1,
-};
-
-static int pcm043_otg_init(struct platform_device *pdev)
-{
-       return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
-}
-
-static struct mxc_usbh_platform_data otg_pdata __initdata = {
-       .init   = pcm043_otg_init,
-       .portsc = MXC_EHCI_MODE_UTMI,
-};
-
-static int pcm043_usbh1_init(struct platform_device *pdev)
-{
-       return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_SINGLE_UNI |
-                       MXC_EHCI_INTERNAL_PHY | MXC_EHCI_IPPUE_DOWN);
-}
-
-static const struct mxc_usbh_platform_data usbh1_pdata __initconst = {
-       .init   = pcm043_usbh1_init,
-       .portsc = MXC_EHCI_MODE_SERIAL,
-};
-
-static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
-       .operating_mode = FSL_USB2_DR_DEVICE,
-       .phy_mode       = FSL_USB2_PHY_UTMI,
-};
-
-static bool otg_mode_host __initdata;
-
-static int __init pcm043_otg_mode(char *options)
-{
-       if (!strcmp(options, "host"))
-               otg_mode_host = true;
-       else if (!strcmp(options, "device"))
-               otg_mode_host = false;
-       else
-               pr_info("otg_mode neither \"host\" nor \"device\". "
-                       "Defaulting to device\n");
-       return 1;
-}
-__setup("otg_mode=", pcm043_otg_mode);
-
-static struct esdhc_platform_data sd1_pdata = {
-       .wp_type = ESDHC_WP_GPIO,
-       .cd_type = ESDHC_CD_GPIO,
-};
-
-static struct gpiod_lookup_table sd1_gpio_table = {
-       .dev_id = "sdhci-esdhc-imx35.0",
-       .table = {
-               /* Card detect: bank 2 offset 24 */
-               GPIO_LOOKUP("imx35-gpio.2", 24, "cd", GPIO_ACTIVE_LOW),
-               /* Write protect: bank 2 offset 23 */
-               GPIO_LOOKUP("imx35-gpio.2", 23, "wp", GPIO_ACTIVE_LOW),
-               { },
-       },
-};
-
-/*
- * Board specific initialization.
- */
-static void __init pcm043_init(void)
-{
-       imx35_soc_init();
-
-       mxc_iomux_v3_setup_multiple_pads(pcm043_pads, ARRAY_SIZE(pcm043_pads));
-
-       imx35_add_fec(NULL);
-       platform_add_devices(devices, ARRAY_SIZE(devices));
-       imx35_add_imx2_wdt();
-
-       imx35_add_imx_uart0(&uart_pdata);
-       imx35_add_mxc_nand(&pcm037_nand_board_info);
-
-       imx35_add_imx_uart1(&uart_pdata);
-
-       i2c_register_board_info(0, pcm043_i2c_devices,
-                       ARRAY_SIZE(pcm043_i2c_devices));
-
-       imx35_add_imx_i2c0(&pcm043_i2c0_data);
-
-       imx35_add_ipu_core();
-       imx35_add_mx3_sdc_fb(&mx3fb_pdata);
-
-       if (otg_mode_host) {
-               otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-                               ULPI_OTG_DRVVBUS_EXT);
-               if (otg_pdata.otg)
-                       imx35_add_mxc_ehci_otg(&otg_pdata);
-       }
-       imx35_add_mxc_ehci_hs(&usbh1_pdata);
-
-       if (!otg_mode_host)
-               imx35_add_fsl_usb2_udc(&otg_device_pdata);
-
-       imx35_add_flexcan1();
-}
-
-static void __init pcm043_late_init(void)
-{
-       imx35_add_imx_ssi(0, &pcm043_ssi_pdata);
-
-       gpiod_add_lookup_table(&sd1_gpio_table);
-       imx35_add_sdhci_esdhc_imx(0, &sd1_pdata);
-}
-
-static void __init pcm043_timer_init(void)
-{
-       mx35_clocks_init();
-}
-
-MACHINE_START(PCM043, "Phytec Phycore pcm043")
-       /* Maintainer: Pengutronix */
-       .atag_offset = 0x100,
-       .map_io = mx35_map_io,
-       .init_early = imx35_init_early,
-       .init_irq = mx35_init_irq,
-       .init_time = pcm043_timer_init,
-       .init_machine   = pcm043_init,
-       .init_late      = pcm043_late_init,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-qong.c b/arch/arm/mach-imx/mach-qong.c
deleted file mode 100644 (file)
index 5b362da..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *  Copyright (C) 2009 Ilya Yanok, Emcraft Systems Ltd, <yanok@emcraft.com>
- */
-
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/memory.h>
-#include <linux/platform_device.h>
-#include <linux/mtd/physmap.h>
-#include <linux/mtd/platnand.h>
-#include <linux/gpio.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-#include <asm/mach/map.h>
-#include <asm/page.h>
-#include <asm/setup.h>
-
-#include "common.h"
-#include "devices-imx31.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-
-/* FPGA defines */
-#define QONG_FPGA_VERSION(major, minor, rev)   \
-       (((major & 0xF) << 12) | ((minor & 0xF) << 8) | (rev & 0xFF))
-
-#define QONG_FPGA_BASEADDR             MX31_CS1_BASE_ADDR
-#define QONG_FPGA_PERIPH_SIZE          (1 << 24)
-
-#define QONG_FPGA_CTRL_BASEADDR                QONG_FPGA_BASEADDR
-#define QONG_FPGA_CTRL_SIZE            0x10
-/* FPGA control registers */
-#define QONG_FPGA_CTRL_VERSION         0x00
-
-#define QONG_DNET_ID           1
-#define QONG_DNET_BASEADDR     \
-       (QONG_FPGA_BASEADDR + QONG_DNET_ID * QONG_FPGA_PERIPH_SIZE)
-#define QONG_DNET_SIZE         0x00001000
-
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static int uart_pins[] = {
-       MX31_PIN_CTS1__CTS1,
-       MX31_PIN_RTS1__RTS1,
-       MX31_PIN_TXD1__TXD1,
-       MX31_PIN_RXD1__RXD1
-};
-
-static inline void __init mxc_init_imx_uart(void)
-{
-       mxc_iomux_setup_multiple_pins(uart_pins, ARRAY_SIZE(uart_pins),
-                       "uart-0");
-       imx31_add_imx_uart0(&uart_pdata);
-}
-
-static struct resource dnet_resources[] = {
-       {
-               .name   = "dnet-memory",
-               .start  = QONG_DNET_BASEADDR,
-               .end    = QONG_DNET_BASEADDR + QONG_DNET_SIZE - 1,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               /* irq number is run-time assigned */
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device dnet_device = {
-       .name                   = "dnet",
-       .id                     = -1,
-       .num_resources          = ARRAY_SIZE(dnet_resources),
-       .resource               = dnet_resources,
-};
-
-static int __init qong_init_dnet(void)
-{
-       int ret;
-
-       dnet_resources[1].start =
-               gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1));
-       dnet_resources[1].end =
-               gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1));
-       ret = platform_device_register(&dnet_device);
-       return ret;
-}
-
-/* MTD NOR flash */
-
-static struct physmap_flash_data qong_flash_data = {
-       .width = 2,
-};
-
-static struct resource qong_flash_resource = {
-       .start = MX31_CS0_BASE_ADDR,
-       .end = MX31_CS0_BASE_ADDR + SZ_128M - 1,
-       .flags = IORESOURCE_MEM,
-};
-
-static struct platform_device qong_nor_mtd_device = {
-       .name = "physmap-flash",
-       .id = 0,
-       .dev = {
-               .platform_data = &qong_flash_data,
-               },
-       .resource = &qong_flash_resource,
-       .num_resources = 1,
-};
-
-static void qong_init_nor_mtd(void)
-{
-       (void)platform_device_register(&qong_nor_mtd_device);
-}
-
-/*
- * Hardware specific access to control-lines
- */
-static void qong_nand_cmd_ctrl(struct nand_chip *nand_chip, int cmd,
-                              unsigned int ctrl)
-{
-       if (cmd == NAND_CMD_NONE)
-               return;
-
-       if (ctrl & NAND_CLE)
-               writeb(cmd, nand_chip->legacy.IO_ADDR_W + (1 << 24));
-       else
-               writeb(cmd, nand_chip->legacy.IO_ADDR_W + (1 << 23));
-}
-
-/*
- * Read the Device Ready pin.
- */
-static int qong_nand_device_ready(struct nand_chip *chip)
-{
-       return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_NFRB));
-}
-
-static void qong_nand_select_chip(struct nand_chip *chip, int cs)
-{
-       if (cs >= 0)
-               gpio_set_value(IOMUX_TO_GPIO(MX31_PIN_NFCE_B), 0);
-       else
-               gpio_set_value(IOMUX_TO_GPIO(MX31_PIN_NFCE_B), 1);
-}
-
-static struct platform_nand_data qong_nand_data = {
-       .chip = {
-               .nr_chips               = 1,
-               .chip_delay             = 20,
-               .options                = 0,
-       },
-       .ctrl = {
-               .cmd_ctrl               = qong_nand_cmd_ctrl,
-               .dev_ready              = qong_nand_device_ready,
-               .select_chip            = qong_nand_select_chip,
-       }
-};
-
-static struct resource qong_nand_resource = {
-       .start          = MX31_CS3_BASE_ADDR,
-       .end            = MX31_CS3_BASE_ADDR + SZ_32M - 1,
-       .flags          = IORESOURCE_MEM,
-};
-
-static struct platform_device qong_nand_device = {
-       .name           = "gen_nand",
-       .id             = -1,
-       .dev            = {
-               .platform_data = &qong_nand_data,
-       },
-       .num_resources  = 1,
-       .resource       = &qong_nand_resource,
-};
-
-static void __init qong_init_nand_mtd(void)
-{
-       /* init CS */
-       imx_writel(0x00004f00, MX31_IO_ADDRESS(MX31_WEIM_CSCRxU(3)));
-       imx_writel(0x20013b31, MX31_IO_ADDRESS(MX31_WEIM_CSCRxL(3)));
-       imx_writel(0x00020800, MX31_IO_ADDRESS(MX31_WEIM_CSCRxA(3)));
-
-       mxc_iomux_set_gpr(MUX_SDCTL_CSD1_SEL, true);
-
-       /* enable pin */
-       mxc_iomux_mode(IOMUX_MODE(MX31_PIN_NFCE_B, IOMUX_CONFIG_GPIO));
-       if (!gpio_request(IOMUX_TO_GPIO(MX31_PIN_NFCE_B), "nand_enable"))
-               gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_NFCE_B), 0);
-
-       /* ready/busy pin */
-       mxc_iomux_mode(IOMUX_MODE(MX31_PIN_NFRB, IOMUX_CONFIG_GPIO));
-       if (!gpio_request(IOMUX_TO_GPIO(MX31_PIN_NFRB), "nand_rdy"))
-               gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_NFRB));
-
-       /* write protect pin */
-       mxc_iomux_mode(IOMUX_MODE(MX31_PIN_NFWP_B, IOMUX_CONFIG_GPIO));
-       if (!gpio_request(IOMUX_TO_GPIO(MX31_PIN_NFWP_B), "nand_wp"))
-               gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_NFWP_B));
-
-       platform_device_register(&qong_nand_device);
-}
-
-static void __init qong_init_fpga(void)
-{
-       void __iomem *regs;
-       u32 fpga_ver;
-
-       regs = ioremap(QONG_FPGA_CTRL_BASEADDR, QONG_FPGA_CTRL_SIZE);
-       if (!regs) {
-               printk(KERN_ERR "%s: failed to map registers, aborting.\n",
-                               __func__);
-               return;
-       }
-
-       fpga_ver = readl(regs + QONG_FPGA_CTRL_VERSION);
-       iounmap(regs);
-       printk(KERN_INFO "Qong FPGA version %d.%d.%d\n",
-                       (fpga_ver & 0xF000) >> 12,
-                       (fpga_ver & 0x0F00) >> 8, fpga_ver & 0x00FF);
-       if (fpga_ver < QONG_FPGA_VERSION(0, 8, 7)) {
-               printk(KERN_ERR "qong: Unexpected FPGA version, FPGA-based "
-                               "devices won't be registered!\n");
-               return;
-       }
-
-       /* register FPGA-based devices */
-       qong_init_nand_mtd();
-       qong_init_dnet();
-}
-
-/*
- * Board specific initialization.
- */
-static void __init qong_init(void)
-{
-       imx31_soc_init();
-
-       mxc_init_imx_uart();
-       qong_init_nor_mtd();
-       imx31_add_imx2_wdt();
-}
-
-static void __init qong_timer_init(void)
-{
-       mx31_clocks_init(26000000);
-}
-
-MACHINE_START(QONG, "Dave/DENX QongEVB-LITE")
-       /* Maintainer: DENX Software Engineering GmbH */
-       .atag_offset = 0x100,
-       .map_io = mx31_map_io,
-       .init_early = imx31_init_early,
-       .init_irq = mx31_init_irq,
-       .init_time      = qong_timer_init,
-       .init_machine = qong_init,
-       .init_late      = qong_init_fpga,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mach-vpr200.c b/arch/arm/mach-imx/mach-vpr200.c
deleted file mode 100644 (file)
index fae5a41..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright (C) 2009 Marc Kleine-Budde, Pengutronix
- * Copyright 2010 Creative Product Design
- *
- * Derived from mx35 3stack.
- * Original author: Fabio Estevam <fabio.estevam@freescale.com>
- */
-
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/mtd/physmap.h>
-#include <linux/memory.h>
-#include <linux/gpio.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/time.h>
-
-#include <linux/i2c.h>
-#include <linux/mfd/mc13xxx.h>
-
-#include "common.h"
-#include "devices-imx35.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx35.h"
-
-#define GPIO_LCDPWR    IMX_GPIO_NR(1, 2)
-#define GPIO_PMIC_INT  IMX_GPIO_NR(2, 0)
-
-#define GPIO_BUTTON1   IMX_GPIO_NR(1, 4)
-#define GPIO_BUTTON2   IMX_GPIO_NR(1, 5)
-#define GPIO_BUTTON3   IMX_GPIO_NR(1, 7)
-#define GPIO_BUTTON4   IMX_GPIO_NR(1, 8)
-#define GPIO_BUTTON5   IMX_GPIO_NR(1, 9)
-#define GPIO_BUTTON6   IMX_GPIO_NR(1, 10)
-#define GPIO_BUTTON7   IMX_GPIO_NR(1, 11)
-#define GPIO_BUTTON8   IMX_GPIO_NR(1, 12)
-
-static const struct fb_videomode fb_modedb[] = {
-       {
-               /* 800x480 @ 60 Hz */
-               .name           = "PT0708048",
-               .refresh        = 60,
-               .xres           = 800,
-               .yres           = 480,
-               .pixclock       = KHZ2PICOS(33260),
-               .left_margin    = 50,
-               .right_margin   = 156,
-               .upper_margin   = 10,
-               .lower_margin   = 10,
-               .hsync_len      = 1,    /* note: DE only display */
-               .vsync_len      = 1,    /* note: DE only display */
-               .sync           = FB_SYNC_CLK_IDLE_EN | FB_SYNC_OE_ACT_HIGH,
-               .vmode          = FB_VMODE_NONINTERLACED,
-               .flag           = 0,
-       }, {
-               /* 800x480 @ 60 Hz */
-               .name           = "CTP-CLAA070LC0ACW",
-               .refresh        = 60,
-               .xres           = 800,
-               .yres           = 480,
-               .pixclock       = KHZ2PICOS(27000),
-               .left_margin    = 50,
-               .right_margin   = 50,   /* whole line should have 900 clocks */
-               .upper_margin   = 10,
-               .lower_margin   = 10,   /* whole frame should have 500 lines */
-               .hsync_len      = 1,    /* note: DE only display */
-               .vsync_len      = 1,    /* note: DE only display */
-               .sync           = FB_SYNC_CLK_IDLE_EN | FB_SYNC_OE_ACT_HIGH,
-               .vmode          = FB_VMODE_NONINTERLACED,
-               .flag           = 0,
-       }
-};
-
-static struct mx3fb_platform_data mx3fb_pdata __initdata = {
-       .name           = "PT0708048",
-       .mode           = fb_modedb,
-       .num_modes      = ARRAY_SIZE(fb_modedb),
-};
-
-static struct physmap_flash_data vpr200_flash_data = {
-       .width  = 2,
-};
-
-static struct resource vpr200_flash_resource = {
-       .start  = MX35_CS0_BASE_ADDR,
-       .end    = MX35_CS0_BASE_ADDR + SZ_64M - 1,
-       .flags  = IORESOURCE_MEM,
-};
-
-static struct platform_device vpr200_flash = {
-       .name   = "physmap-flash",
-       .id     = 0,
-       .dev    = {
-               .platform_data  = &vpr200_flash_data,
-       },
-       .resource = &vpr200_flash_resource,
-       .num_resources = 1,
-};
-
-static const struct mxc_nand_platform_data
-               vpr200_nand_board_info __initconst = {
-       .width = 1,
-       .hw_ecc = 1,
-       .flash_bbt = 1,
-};
-
-#define VPR_KEY_DEBOUNCE       500
-static struct gpio_keys_button vpr200_gpio_keys_table[] = {
-       {KEY_F2, GPIO_BUTTON1, 1, "vpr-keys: F2", 0, VPR_KEY_DEBOUNCE},
-       {KEY_F3, GPIO_BUTTON2, 1, "vpr-keys: F3", 0, VPR_KEY_DEBOUNCE},
-       {KEY_F4, GPIO_BUTTON3, 1, "vpr-keys: F4", 0, VPR_KEY_DEBOUNCE},
-       {KEY_F5, GPIO_BUTTON4, 1, "vpr-keys: F5", 0, VPR_KEY_DEBOUNCE},
-       {KEY_F6, GPIO_BUTTON5, 1, "vpr-keys: F6", 0, VPR_KEY_DEBOUNCE},
-       {KEY_F7, GPIO_BUTTON6, 1, "vpr-keys: F7", 0, VPR_KEY_DEBOUNCE},
-       {KEY_F8, GPIO_BUTTON7, 1, "vpr-keys: F8", 1, VPR_KEY_DEBOUNCE},
-       {KEY_F9, GPIO_BUTTON8, 1, "vpr-keys: F9", 1, VPR_KEY_DEBOUNCE},
-};
-
-static const struct gpio_keys_platform_data
-               vpr200_gpio_keys_data __initconst = {
-       .buttons = vpr200_gpio_keys_table,
-       .nbuttons = ARRAY_SIZE(vpr200_gpio_keys_table),
-};
-
-static struct mc13xxx_platform_data vpr200_pmic = {
-       .flags = MC13XXX_USE_ADC | MC13XXX_USE_TOUCHSCREEN,
-};
-
-static const struct imxi2c_platform_data vpr200_i2c0_data __initconst = {
-       .bitrate = 50000,
-};
-
-static struct i2c_board_info vpr200_i2c_devices[] = {
-       {
-               I2C_BOARD_INFO("24c02", 0x50), /* E0=0, E1=0, E2=0 */
-       }, {
-               I2C_BOARD_INFO("mc13892", 0x08),
-               .platform_data = &vpr200_pmic,
-               /* irq number is run-time assigned */
-       }
-};
-
-static const iomux_v3_cfg_t vpr200_pads[] __initconst = {
-       /* UART1 */
-       MX35_PAD_TXD1__UART1_TXD_MUX,
-       MX35_PAD_RXD1__UART1_RXD_MUX,
-       /* UART3 */
-       MX35_PAD_ATA_DATA10__UART3_RXD_MUX,
-       MX35_PAD_ATA_DATA11__UART3_TXD_MUX,
-       /* FEC */
-       MX35_PAD_FEC_TX_CLK__FEC_TX_CLK,
-       MX35_PAD_FEC_RX_CLK__FEC_RX_CLK,
-       MX35_PAD_FEC_RX_DV__FEC_RX_DV,
-       MX35_PAD_FEC_COL__FEC_COL,
-       MX35_PAD_FEC_RDATA0__FEC_RDATA_0,
-       MX35_PAD_FEC_TDATA0__FEC_TDATA_0,
-       MX35_PAD_FEC_TX_EN__FEC_TX_EN,
-       MX35_PAD_FEC_MDC__FEC_MDC,
-       MX35_PAD_FEC_MDIO__FEC_MDIO,
-       MX35_PAD_FEC_TX_ERR__FEC_TX_ERR,
-       MX35_PAD_FEC_RX_ERR__FEC_RX_ERR,
-       MX35_PAD_FEC_CRS__FEC_CRS,
-       MX35_PAD_FEC_RDATA1__FEC_RDATA_1,
-       MX35_PAD_FEC_TDATA1__FEC_TDATA_1,
-       MX35_PAD_FEC_RDATA2__FEC_RDATA_2,
-       MX35_PAD_FEC_TDATA2__FEC_TDATA_2,
-       MX35_PAD_FEC_RDATA3__FEC_RDATA_3,
-       MX35_PAD_FEC_TDATA3__FEC_TDATA_3,
-       /* Display */
-       MX35_PAD_LD0__IPU_DISPB_DAT_0,
-       MX35_PAD_LD1__IPU_DISPB_DAT_1,
-       MX35_PAD_LD2__IPU_DISPB_DAT_2,
-       MX35_PAD_LD3__IPU_DISPB_DAT_3,
-       MX35_PAD_LD4__IPU_DISPB_DAT_4,
-       MX35_PAD_LD5__IPU_DISPB_DAT_5,
-       MX35_PAD_LD6__IPU_DISPB_DAT_6,
-       MX35_PAD_LD7__IPU_DISPB_DAT_7,
-       MX35_PAD_LD8__IPU_DISPB_DAT_8,
-       MX35_PAD_LD9__IPU_DISPB_DAT_9,
-       MX35_PAD_LD10__IPU_DISPB_DAT_10,
-       MX35_PAD_LD11__IPU_DISPB_DAT_11,
-       MX35_PAD_LD12__IPU_DISPB_DAT_12,
-       MX35_PAD_LD13__IPU_DISPB_DAT_13,
-       MX35_PAD_LD14__IPU_DISPB_DAT_14,
-       MX35_PAD_LD15__IPU_DISPB_DAT_15,
-       MX35_PAD_LD16__IPU_DISPB_DAT_16,
-       MX35_PAD_LD17__IPU_DISPB_DAT_17,
-       MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK,
-       MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY,
-       MX35_PAD_CONTRAST__IPU_DISPB_CONTR,
-       /* LCD Enable */
-       MX35_PAD_D3_VSYNC__GPIO1_2,
-       /* USBOTG */
-       MX35_PAD_USBOTG_PWR__USB_TOP_USBOTG_PWR,
-       MX35_PAD_USBOTG_OC__USB_TOP_USBOTG_OC,
-       /* SDCARD */
-       MX35_PAD_SD1_CMD__ESDHC1_CMD,
-       MX35_PAD_SD1_CLK__ESDHC1_CLK,
-       MX35_PAD_SD1_DATA0__ESDHC1_DAT0,
-       MX35_PAD_SD1_DATA1__ESDHC1_DAT1,
-       MX35_PAD_SD1_DATA2__ESDHC1_DAT2,
-       MX35_PAD_SD1_DATA3__ESDHC1_DAT3,
-       /* PMIC */
-       MX35_PAD_GPIO2_0__GPIO2_0,
-       /* GPIO keys */
-       MX35_PAD_SCKR__GPIO1_4,
-       MX35_PAD_COMPARE__GPIO1_5,
-       MX35_PAD_SCKT__GPIO1_7,
-       MX35_PAD_FST__GPIO1_8,
-       MX35_PAD_HCKT__GPIO1_9,
-       MX35_PAD_TX5_RX0__GPIO1_10,
-       MX35_PAD_TX4_RX1__GPIO1_11,
-       MX35_PAD_TX3_RX2__GPIO1_12,
-};
-
-/* USB Device config */
-static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
-       .operating_mode = FSL_USB2_DR_DEVICE,
-       .phy_mode       = FSL_USB2_PHY_UTMI,
-       .workaround     = FLS_USB2_WORKAROUND_ENGCM09152,
-};
-
-static int vpr200_usbh_init(struct platform_device *pdev)
-{
-       return mx35_initialize_usb_hw(pdev->id,
-                       MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY);
-}
-
-/* USB HOST config */
-static const struct mxc_usbh_platform_data usb_host_pdata __initconst = {
-       .init = vpr200_usbh_init,
-       .portsc = MXC_EHCI_MODE_SERIAL,
-};
-
-static struct platform_device *devices[] __initdata = {
-       &vpr200_flash,
-};
-
-/*
- * Board specific initialization.
- */
-static void __init vpr200_board_init(void)
-{
-       imx35_soc_init();
-
-       mxc_iomux_v3_setup_multiple_pads(vpr200_pads, ARRAY_SIZE(vpr200_pads));
-
-       imx35_add_fec(NULL);
-       imx35_add_imx2_wdt();
-
-       imx35_add_imx_uart0(NULL);
-       imx35_add_imx_uart2(NULL);
-
-       imx35_add_ipu_core();
-       imx35_add_mx3_sdc_fb(&mx3fb_pdata);
-
-       imx35_add_fsl_usb2_udc(&otg_device_pdata);
-       imx35_add_mxc_ehci_hs(&usb_host_pdata);
-
-       imx35_add_mxc_nand(&vpr200_nand_board_info);
-       imx35_add_sdhci_esdhc_imx(0, NULL);
-}
-
-static void __init vpr200_late_init(void)
-{
-       imx_add_gpio_keys(&vpr200_gpio_keys_data);
-
-       platform_add_devices(devices, ARRAY_SIZE(devices));
-
-       if (0 != gpio_request(GPIO_LCDPWR, "LCDPWR"))
-               printk(KERN_WARNING "vpr200: Couldn't get LCDPWR gpio\n");
-       else
-               gpio_direction_output(GPIO_LCDPWR, 0);
-
-       if (0 != gpio_request(GPIO_PMIC_INT, "PMIC_INT"))
-               printk(KERN_WARNING "vpr200: Couldn't get PMIC_INT gpio\n");
-       else
-               gpio_direction_input(GPIO_PMIC_INT);
-
-       vpr200_i2c_devices[1].irq = gpio_to_irq(GPIO_PMIC_INT);
-       i2c_register_board_info(0, vpr200_i2c_devices,
-                       ARRAY_SIZE(vpr200_i2c_devices));
-
-       imx35_add_imx_i2c0(&vpr200_i2c0_data);
-}
-
-static void __init vpr200_timer_init(void)
-{
-       mx35_clocks_init();
-}
-
-MACHINE_START(VPR200, "VPR200")
-       /* Maintainer: Creative Product Design */
-       .map_io = mx35_map_io,
-       .init_early = imx35_init_early,
-       .init_irq = mx35_init_irq,
-       .init_time = vpr200_timer_init,
-       .init_machine = vpr200_board_init,
-       .init_late      = vpr200_late_init,
-       .restart        = mxc_restart,
-MACHINE_END
diff --git a/arch/arm/mach-imx/mm-imx21.c b/arch/arm/mach-imx/mm-imx21.c
deleted file mode 100644 (file)
index b834026..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * arch/arm/mach-imx/mm-imx21.c
- *
- * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
- */
-
-#include <linux/mm.h>
-#include <linux/init.h>
-#include <linux/pinctrl/machine.h>
-#include <asm/mach/map.h>
-
-#include "common.h"
-#include "devices/devices-common.h"
-#include "hardware.h"
-#include "iomux-v1.h"
-
-/* MX21 memory map definition */
-static struct map_desc imx21_io_desc[] __initdata = {
-       /*
-        * this fixed mapping covers:
-        * - AIPI1
-        * - AIPI2
-        * - AITC
-        * - ROM Patch
-        * - and some reserved space
-        */
-       imx_map_entry(MX21, AIPI, MT_DEVICE),
-       /*
-        * this fixed mapping covers:
-        * - CSI
-        * - ATA
-        */
-       imx_map_entry(MX21, SAHB1, MT_DEVICE),
-       /*
-        * this fixed mapping covers:
-        * - EMI
-        */
-       imx_map_entry(MX21, X_MEMC, MT_DEVICE),
-};
-
-/*
- * Initialize the memory map. It is called during the
- * system startup to create static physical to virtual
- * memory map for the IO modules.
- */
-void __init mx21_map_io(void)
-{
-       iotable_init(imx21_io_desc, ARRAY_SIZE(imx21_io_desc));
-}
-
-void __init imx21_init_early(void)
-{
-       mxc_set_cpu_type(MXC_CPU_MX21);
-       imx_iomuxv1_init(MX21_IO_ADDRESS(MX21_GPIO_BASE_ADDR),
-                       MX21_NUM_GPIO_PORT);
-}
-
-void __init mx21_init_irq(void)
-{
-       mxc_init_irq(MX21_IO_ADDRESS(MX21_AVIC_BASE_ADDR));
-}
-
-static const struct resource imx21_audmux_res[] __initconst = {
-       DEFINE_RES_MEM(MX21_AUDMUX_BASE_ADDR, SZ_4K),
-};
-
-void __init imx21_soc_init(void)
-{
-       mxc_arch_reset_init(MX21_IO_ADDRESS(MX21_WDOG_BASE_ADDR));
-       mxc_device_init();
-
-       mxc_register_gpio("imx21-gpio", 0, MX21_GPIO1_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
-       mxc_register_gpio("imx21-gpio", 1, MX21_GPIO2_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
-       mxc_register_gpio("imx21-gpio", 2, MX21_GPIO3_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
-       mxc_register_gpio("imx21-gpio", 3, MX21_GPIO4_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
-       mxc_register_gpio("imx21-gpio", 4, MX21_GPIO5_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
-       mxc_register_gpio("imx21-gpio", 5, MX21_GPIO6_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
-
-       pinctrl_provide_dummies();
-       imx_add_imx_dma("imx21-dma", MX21_DMA_BASE_ADDR, MX21_INT_DMACH0);
-       platform_device_register_simple("imx21-audmux", 0, imx21_audmux_res,
-                                       ARRAY_SIZE(imx21_audmux_res));
-}
diff --git a/arch/arm/mach-imx/mm-imx27.c b/arch/arm/mach-imx/mm-imx27.c
deleted file mode 100644 (file)
index 2717614..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * arch/arm/mach-imx/mm-imx27.c
- *
- * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
- */
-
-#include <linux/mm.h>
-#include <linux/init.h>
-#include <linux/pinctrl/machine.h>
-#include <asm/mach/map.h>
-
-#include "common.h"
-#include "devices/devices-common.h"
-#include "hardware.h"
-#include "iomux-v1.h"
-
-/* MX27 memory map definition */
-static struct map_desc imx27_io_desc[] __initdata = {
-       /*
-        * this fixed mapping covers:
-        * - AIPI1
-        * - AIPI2
-        * - AITC
-        * - ROM Patch
-        * - and some reserved space
-        */
-       imx_map_entry(MX27, AIPI, MT_DEVICE),
-       /*
-        * this fixed mapping covers:
-        * - CSI
-        * - ATA
-        */
-       imx_map_entry(MX27, SAHB1, MT_DEVICE),
-       /*
-        * this fixed mapping covers:
-        * - EMI
-        */
-       imx_map_entry(MX27, X_MEMC, MT_DEVICE),
-};
-
-/*
- * Initialize the memory map. It is called during the
- * system startup to create static physical to virtual
- * memory map for the IO modules.
- */
-void __init mx27_map_io(void)
-{
-       iotable_init(imx27_io_desc, ARRAY_SIZE(imx27_io_desc));
-}
-
-void __init imx27_init_early(void)
-{
-       mxc_set_cpu_type(MXC_CPU_MX27);
-       imx_iomuxv1_init(MX27_IO_ADDRESS(MX27_GPIO_BASE_ADDR),
-                       MX27_NUM_GPIO_PORT);
-}
-
-void __init mx27_init_irq(void)
-{
-       mxc_init_irq(MX27_IO_ADDRESS(MX27_AVIC_BASE_ADDR));
-}
-
-static const struct resource imx27_audmux_res[] __initconst = {
-       DEFINE_RES_MEM(MX27_AUDMUX_BASE_ADDR, SZ_4K),
-};
-
-void __init imx27_soc_init(void)
-{
-       mxc_arch_reset_init(MX27_IO_ADDRESS(MX27_WDOG_BASE_ADDR));
-       mxc_device_init();
-
-       /* i.mx27 has the i.mx21 type gpio */
-       mxc_register_gpio("imx21-gpio", 0, MX27_GPIO1_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
-       mxc_register_gpio("imx21-gpio", 1, MX27_GPIO2_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
-       mxc_register_gpio("imx21-gpio", 2, MX27_GPIO3_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
-       mxc_register_gpio("imx21-gpio", 3, MX27_GPIO4_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
-       mxc_register_gpio("imx21-gpio", 4, MX27_GPIO5_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
-       mxc_register_gpio("imx21-gpio", 5, MX27_GPIO6_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
-
-       pinctrl_provide_dummies();
-       imx_add_imx_dma("imx27-dma", MX27_DMA_BASE_ADDR, MX27_INT_DMACH0);
-       /* imx27 has the imx21 type audmux */
-       platform_device_register_simple("imx21-audmux", 0, imx27_audmux_res,
-                                       ARRAY_SIZE(imx27_audmux_res));
-
-       imx27_pm_init();
-}
index ea2d58a..5056438 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/of_address.h>
 #include <linux/pinctrl/machine.h>
 
 #include <asm/system_misc.h>
@@ -19,9 +20,7 @@
 
 #include "common.h"
 #include "crmregs-imx3.h"
-#include "devices/devices-common.h"
 #include "hardware.h"
-#include "iomux-v3.h"
 
 void __iomem *mx3_ccm_base;
 
@@ -71,40 +70,6 @@ static void __iomem *imx3_ioremap_caller(phys_addr_t phys_addr, size_t size,
        return __arm_ioremap_caller(phys_addr, size, mtype, caller);
 }
 
-static void __init imx3_init_l2x0(void)
-{
-#ifdef CONFIG_CACHE_L2X0
-       void __iomem *l2x0_base;
-       void __iomem *clkctl_base;
-
-/*
- * First of all, we must repair broken chip settings. There are some
- * i.MX35 CPUs in the wild, comming with bogus L2 cache settings. These
- * misconfigured CPUs will run amok immediately when the L2 cache gets enabled.
- * Workaraound is to setup the correct register setting prior enabling the
- * L2 cache. This should not hurt already working CPUs, as they are using the
- * same value.
- */
-#define L2_MEM_VAL 0x10
-
-       clkctl_base = ioremap(MX35_CLKCTL_BASE_ADDR, 4096);
-       if (clkctl_base != NULL) {
-               writel(0x00000515, clkctl_base + L2_MEM_VAL);
-               iounmap(clkctl_base);
-       } else {
-               pr_err("L2 cache: Cannot fix timing. Trying to continue without\n");
-       }
-
-       l2x0_base = ioremap(MX3x_L2CC_BASE_ADDR, 4096);
-       if (!l2x0_base) {
-               printk(KERN_ERR "remapping L2 cache area failed\n");
-               return;
-       }
-
-       l2x0_init(l2x0_base, 0x00030024, 0x00000000);
-#endif
-}
-
 #ifdef CONFIG_SOC_IMX31
 static struct map_desc mx31_io_desc[] __initdata = {
        imx_map_entry(MX31, X_MEMC, MT_DEVICE),
@@ -135,70 +100,26 @@ static void imx31_idle(void)
 
 void __init imx31_init_early(void)
 {
+       struct device_node *np;
+
        mxc_set_cpu_type(MXC_CPU_MX31);
        arch_ioremap_caller = imx3_ioremap_caller;
        arm_pm_idle = imx31_idle;
-       mx3_ccm_base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR);
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx31-ccm");
+       mx3_ccm_base = of_iomap(np, 0);
+       BUG_ON(!mx3_ccm_base);
 }
 
 void __init mx31_init_irq(void)
 {
-       mxc_init_irq(MX31_IO_ADDRESS(MX31_AVIC_BASE_ADDR));
-}
-
-static struct sdma_script_start_addrs imx31_to1_sdma_script __initdata = {
-       .per_2_per_addr = 1677,
-};
-
-static struct sdma_script_start_addrs imx31_to2_sdma_script __initdata = {
-       .ap_2_ap_addr = 423,
-       .ap_2_bp_addr = 829,
-       .bp_2_ap_addr = 1029,
-};
-
-static struct sdma_platform_data imx31_sdma_pdata __initdata = {
-       .fw_name = "sdma-imx31-to2.bin",
-       .script_addrs = &imx31_to2_sdma_script,
-};
-
-static const struct resource imx31_audmux_res[] __initconst = {
-       DEFINE_RES_MEM(MX31_AUDMUX_BASE_ADDR, SZ_16K),
-};
-
-static const struct resource imx31_rnga_res[] __initconst = {
-       DEFINE_RES_MEM(MX31_RNGA_BASE_ADDR, SZ_16K),
-};
-
-void __init imx31_soc_init(void)
-{
-       int to_version = mx31_revision() >> 4;
+       void __iomem *avic_base;
+       struct device_node *np;
 
-       imx3_init_l2x0();
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx31-avic");
+       avic_base = of_iomap(np, 0);
+       BUG_ON(!avic_base);
 
-       mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));
-       mxc_device_init();
-
-       mxc_register_gpio("imx31-gpio", 0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0);
-       mxc_register_gpio("imx31-gpio", 1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0);
-       mxc_register_gpio("imx31-gpio", 2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0);
-
-       pinctrl_provide_dummies();
-
-       if (to_version == 1) {
-               strncpy(imx31_sdma_pdata.fw_name, "sdma-imx31-to1.bin",
-                       strlen(imx31_sdma_pdata.fw_name));
-               imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script;
-       }
-
-       imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata);
-
-       imx_set_aips(MX31_IO_ADDRESS(MX31_AIPS1_BASE_ADDR));
-       imx_set_aips(MX31_IO_ADDRESS(MX31_AIPS2_BASE_ADDR));
-
-       platform_device_register_simple("imx31-audmux", 0, imx31_audmux_res,
-                                       ARRAY_SIZE(imx31_audmux_res));
-       platform_device_register_simple("mxc_rnga", -1, imx31_rnga_res,
-                                       ARRAY_SIZE(imx31_rnga_res));
+       mxc_init_irq(avic_base);
 }
 #endif /* ifdef CONFIG_SOC_IMX31 */
 
@@ -228,85 +149,25 @@ static void imx35_idle(void)
 
 void __init imx35_init_early(void)
 {
+       struct device_node *np;
+
        mxc_set_cpu_type(MXC_CPU_MX35);
-       mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR));
        arm_pm_idle = imx35_idle;
        arch_ioremap_caller = imx3_ioremap_caller;
-       mx3_ccm_base = MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR);
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx35-ccm");
+       mx3_ccm_base = of_iomap(np, 0);
+       BUG_ON(!mx3_ccm_base);
 }
 
 void __init mx35_init_irq(void)
 {
-       mxc_init_irq(MX35_IO_ADDRESS(MX35_AVIC_BASE_ADDR));
-}
-
-static struct sdma_script_start_addrs imx35_to1_sdma_script __initdata = {
-       .ap_2_ap_addr = 642,
-       .uart_2_mcu_addr = 817,
-       .mcu_2_app_addr = 747,
-       .uartsh_2_mcu_addr = 1183,
-       .per_2_shp_addr = 1033,
-       .mcu_2_shp_addr = 961,
-       .ata_2_mcu_addr = 1333,
-       .mcu_2_ata_addr = 1252,
-       .app_2_mcu_addr = 683,
-       .shp_2_per_addr = 1111,
-       .shp_2_mcu_addr = 892,
-};
-
-static struct sdma_script_start_addrs imx35_to2_sdma_script __initdata = {
-       .ap_2_ap_addr = 729,
-       .uart_2_mcu_addr = 904,
-       .per_2_app_addr = 1597,
-       .mcu_2_app_addr = 834,
-       .uartsh_2_mcu_addr = 1270,
-       .per_2_shp_addr = 1120,
-       .mcu_2_shp_addr = 1048,
-       .ata_2_mcu_addr = 1429,
-       .mcu_2_ata_addr = 1339,
-       .app_2_per_addr = 1531,
-       .app_2_mcu_addr = 770,
-       .shp_2_per_addr = 1198,
-       .shp_2_mcu_addr = 979,
-};
-
-static struct sdma_platform_data imx35_sdma_pdata __initdata = {
-       .fw_name = "sdma-imx35-to2.bin",
-       .script_addrs = &imx35_to2_sdma_script,
-};
-
-static const struct resource imx35_audmux_res[] __initconst = {
-       DEFINE_RES_MEM(MX35_AUDMUX_BASE_ADDR, SZ_16K),
-};
-
-void __init imx35_soc_init(void)
-{
-       int to_version = mx35_revision() >> 4;
-
-       imx3_init_l2x0();
-
-       mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR));
-       mxc_device_init();
-
-       mxc_register_gpio("imx35-gpio", 0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0);
-       mxc_register_gpio("imx35-gpio", 1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0);
-       mxc_register_gpio("imx35-gpio", 2, MX35_GPIO3_BASE_ADDR, SZ_16K, MX35_INT_GPIO3, 0);
-
-       pinctrl_provide_dummies();
-       if (to_version == 1) {
-               strncpy(imx35_sdma_pdata.fw_name, "sdma-imx35-to1.bin",
-                       strlen(imx35_sdma_pdata.fw_name));
-               imx35_sdma_pdata.script_addrs = &imx35_to1_sdma_script;
-       }
-
-       imx_add_imx_sdma("imx35-sdma", MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata);
+       void __iomem *avic_base;
+       struct device_node *np;
 
-       /* Setup AIPS registers */
-       imx_set_aips(MX35_IO_ADDRESS(MX35_AIPS1_BASE_ADDR));
-       imx_set_aips(MX35_IO_ADDRESS(MX35_AIPS2_BASE_ADDR));
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx35-avic");
+       avic_base = of_iomap(np, 0);
+       BUG_ON(!avic_base);
 
-       /* i.mx35 has the i.mx31 type audmux */
-       platform_device_register_simple("imx31-audmux", 0, imx35_audmux_res,
-                                       ARRAY_SIZE(imx35_audmux_res));
+       mxc_init_irq(avic_base);
 }
 #endif /* ifdef CONFIG_SOC_IMX35 */
diff --git a/arch/arm/mach-imx/mx21.h b/arch/arm/mach-imx/mx21.h
deleted file mode 100644 (file)
index 38be12a..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
- * Copyright 2009 Holger Schurig, hs4233@mail.mn-solutions.de
- *
- * This contains i.MX21-specific hardware definitions. For those
- * hardware pieces that are common between i.MX21 and i.MX27, have a
- * look at mx2x.h.
- */
-
-#ifndef __MACH_MX21_H__
-#define __MACH_MX21_H__
-
-#define MX21_AIPI_BASE_ADDR            0x10000000
-#define MX21_AIPI_SIZE                 SZ_1M
-#define MX21_DMA_BASE_ADDR                     (MX21_AIPI_BASE_ADDR + 0x01000)
-#define MX21_WDOG_BASE_ADDR                    (MX21_AIPI_BASE_ADDR + 0x02000)
-#define MX21_GPT1_BASE_ADDR                    (MX21_AIPI_BASE_ADDR + 0x03000)
-#define MX21_GPT2_BASE_ADDR                    (MX21_AIPI_BASE_ADDR + 0x04000)
-#define MX21_GPT3_BASE_ADDR                    (MX21_AIPI_BASE_ADDR + 0x05000)
-#define MX21_PWM_BASE_ADDR                     (MX21_AIPI_BASE_ADDR + 0x06000)
-#define MX21_RTC_BASE_ADDR                     (MX21_AIPI_BASE_ADDR + 0x07000)
-#define MX21_KPP_BASE_ADDR                     (MX21_AIPI_BASE_ADDR + 0x08000)
-#define MX21_OWIRE_BASE_ADDR                   (MX21_AIPI_BASE_ADDR + 0x09000)
-#define MX21_UART1_BASE_ADDR                   (MX21_AIPI_BASE_ADDR + 0x0a000)
-#define MX21_UART2_BASE_ADDR                   (MX21_AIPI_BASE_ADDR + 0x0b000)
-#define MX21_UART3_BASE_ADDR                   (MX21_AIPI_BASE_ADDR + 0x0c000)
-#define MX21_UART4_BASE_ADDR                   (MX21_AIPI_BASE_ADDR + 0x0d000)
-#define MX21_CSPI1_BASE_ADDR                   (MX21_AIPI_BASE_ADDR + 0x0e000)
-#define MX21_CSPI2_BASE_ADDR                   (MX21_AIPI_BASE_ADDR + 0x0f000)
-#define MX21_SSI1_BASE_ADDR                    (MX21_AIPI_BASE_ADDR + 0x10000)
-#define MX21_SSI2_BASE_ADDR                    (MX21_AIPI_BASE_ADDR + 0x11000)
-#define MX21_I2C_BASE_ADDR                     (MX21_AIPI_BASE_ADDR + 0x12000)
-#define MX21_SDHC1_BASE_ADDR                   (MX21_AIPI_BASE_ADDR + 0x13000)
-#define MX21_SDHC2_BASE_ADDR                   (MX21_AIPI_BASE_ADDR + 0x14000)
-#define MX21_GPIO_BASE_ADDR                    (MX21_AIPI_BASE_ADDR + 0x15000)
-#define MX21_GPIO1_BASE_ADDR                   (MX21_GPIO_BASE_ADDR + 0x000)
-#define MX21_GPIO2_BASE_ADDR                   (MX21_GPIO_BASE_ADDR + 0x100)
-#define MX21_GPIO3_BASE_ADDR                   (MX21_GPIO_BASE_ADDR + 0x200)
-#define MX21_GPIO4_BASE_ADDR                   (MX21_GPIO_BASE_ADDR + 0x300)
-#define MX21_GPIO5_BASE_ADDR                   (MX21_GPIO_BASE_ADDR + 0x400)
-#define MX21_GPIO6_BASE_ADDR                   (MX21_GPIO_BASE_ADDR + 0x500)
-#define MX21_AUDMUX_BASE_ADDR                  (MX21_AIPI_BASE_ADDR + 0x16000)
-#define MX21_CSPI3_BASE_ADDR                   (MX21_AIPI_BASE_ADDR + 0x17000)
-#define MX21_LCDC_BASE_ADDR                    (MX21_AIPI_BASE_ADDR + 0x21000)
-#define MX21_SLCDC_BASE_ADDR                   (MX21_AIPI_BASE_ADDR + 0x22000)
-#define MX21_USBOTG_BASE_ADDR                  (MX21_AIPI_BASE_ADDR + 0x24000)
-#define MX21_EMMA_PP_BASE_ADDR                 (MX21_AIPI_BASE_ADDR + 0x26000)
-#define MX21_EMMA_PRP_BASE_ADDR                        (MX21_AIPI_BASE_ADDR + 0x26400)
-#define MX21_CCM_BASE_ADDR                     (MX21_AIPI_BASE_ADDR + 0x27000)
-#define MX21_SYSCTRL_BASE_ADDR                 (MX21_AIPI_BASE_ADDR + 0x27800)
-#define MX21_JAM_BASE_ADDR                     (MX21_AIPI_BASE_ADDR + 0x3e000)
-#define MX21_MAX_BASE_ADDR                     (MX21_AIPI_BASE_ADDR + 0x3f000)
-
-#define MX21_AVIC_BASE_ADDR            0x10040000
-
-#define MX21_SAHB1_BASE_ADDR           0x80000000
-#define MX21_SAHB1_SIZE                        SZ_1M
-#define MX21_CSI_BASE_ADDR                     (MX2x_SAHB1_BASE_ADDR + 0x0000)
-
-/* Memory regions and CS */
-#define MX21_SDRAM_BASE_ADDR           0xc0000000
-#define MX21_CSD1_BASE_ADDR            0xc4000000
-
-#define MX21_CS0_BASE_ADDR             0xc8000000
-#define MX21_CS1_BASE_ADDR             0xcc000000
-#define MX21_CS2_BASE_ADDR             0xd0000000
-#define MX21_CS3_BASE_ADDR             0xd1000000
-#define MX21_CS4_BASE_ADDR             0xd2000000
-#define MX21_PCMCIA_MEM_BASE_ADDR      0xd4000000
-#define MX21_CS5_BASE_ADDR             0xdd000000
-
-/* NAND, SDRAM, WEIM etc controllers */
-#define MX21_X_MEMC_BASE_ADDR          0xdf000000
-#define MX21_X_MEMC_SIZE               SZ_256K
-
-#define MX21_SDRAMC_BASE_ADDR          (MX21_X_MEMC_BASE_ADDR + 0x0000)
-#define MX21_EIM_BASE_ADDR             (MX21_X_MEMC_BASE_ADDR + 0x1000)
-#define MX21_PCMCIA_CTL_BASE_ADDR      (MX21_X_MEMC_BASE_ADDR + 0x2000)
-#define MX21_NFC_BASE_ADDR             (MX21_X_MEMC_BASE_ADDR + 0x3000)
-
-#define MX21_IRAM_BASE_ADDR            0xffffe800      /* internal ram */
-
-#define MX21_IO_P2V(x)                 IMX_IO_P2V(x)
-#define MX21_IO_ADDRESS(x)             IOMEM(MX21_IO_P2V(x))
-
-/* fixed interrupt numbers */
-#include <asm/irq.h>
-#define MX21_INT_CSPI3         (NR_IRQS_LEGACY + 6)
-#define MX21_INT_GPIO          (NR_IRQS_LEGACY + 8)
-#define MX21_INT_FIRI          (NR_IRQS_LEGACY + 9)
-#define MX21_INT_SDHC2         (NR_IRQS_LEGACY + 10)
-#define MX21_INT_SDHC1         (NR_IRQS_LEGACY + 11)
-#define MX21_INT_I2C           (NR_IRQS_LEGACY + 12)
-#define MX21_INT_SSI2          (NR_IRQS_LEGACY + 13)
-#define MX21_INT_SSI1          (NR_IRQS_LEGACY + 14)
-#define MX21_INT_CSPI2         (NR_IRQS_LEGACY + 15)
-#define MX21_INT_CSPI1         (NR_IRQS_LEGACY + 16)
-#define MX21_INT_UART4         (NR_IRQS_LEGACY + 17)
-#define MX21_INT_UART3         (NR_IRQS_LEGACY + 18)
-#define MX21_INT_UART2         (NR_IRQS_LEGACY + 19)
-#define MX21_INT_UART1         (NR_IRQS_LEGACY + 20)
-#define MX21_INT_KPP           (NR_IRQS_LEGACY + 21)
-#define MX21_INT_RTC           (NR_IRQS_LEGACY + 22)
-#define MX21_INT_PWM           (NR_IRQS_LEGACY + 23)
-#define MX21_INT_GPT3          (NR_IRQS_LEGACY + 24)
-#define MX21_INT_GPT2          (NR_IRQS_LEGACY + 25)
-#define MX21_INT_GPT1          (NR_IRQS_LEGACY + 26)
-#define MX21_INT_WDOG          (NR_IRQS_LEGACY + 27)
-#define MX21_INT_PCMCIA                (NR_IRQS_LEGACY + 28)
-#define MX21_INT_NFC           (NR_IRQS_LEGACY + 29)
-#define MX21_INT_BMI           (NR_IRQS_LEGACY + 30)
-#define MX21_INT_CSI           (NR_IRQS_LEGACY + 31)
-#define MX21_INT_DMACH0                (NR_IRQS_LEGACY + 32)
-#define MX21_INT_DMACH1                (NR_IRQS_LEGACY + 33)
-#define MX21_INT_DMACH2                (NR_IRQS_LEGACY + 34)
-#define MX21_INT_DMACH3                (NR_IRQS_LEGACY + 35)
-#define MX21_INT_DMACH4                (NR_IRQS_LEGACY + 36)
-#define MX21_INT_DMACH5                (NR_IRQS_LEGACY + 37)
-#define MX21_INT_DMACH6                (NR_IRQS_LEGACY + 38)
-#define MX21_INT_DMACH7                (NR_IRQS_LEGACY + 39)
-#define MX21_INT_DMACH8                (NR_IRQS_LEGACY + 40)
-#define MX21_INT_DMACH9                (NR_IRQS_LEGACY + 41)
-#define MX21_INT_DMACH10       (NR_IRQS_LEGACY + 42)
-#define MX21_INT_DMACH11       (NR_IRQS_LEGACY + 43)
-#define MX21_INT_DMACH12       (NR_IRQS_LEGACY + 44)
-#define MX21_INT_DMACH13       (NR_IRQS_LEGACY + 45)
-#define MX21_INT_DMACH14       (NR_IRQS_LEGACY + 46)
-#define MX21_INT_DMACH15       (NR_IRQS_LEGACY + 47)
-#define MX21_INT_EMMAENC       (NR_IRQS_LEGACY + 49)
-#define MX21_INT_EMMADEC       (NR_IRQS_LEGACY + 50)
-#define MX21_INT_EMMAPRP       (NR_IRQS_LEGACY + 51)
-#define MX21_INT_EMMAPP                (NR_IRQS_LEGACY + 52)
-#define MX21_INT_USBWKUP       (NR_IRQS_LEGACY + 53)
-#define MX21_INT_USBDMA                (NR_IRQS_LEGACY + 54)
-#define MX21_INT_USBHOST       (NR_IRQS_LEGACY + 55)
-#define MX21_INT_USBFUNC       (NR_IRQS_LEGACY + 56)
-#define MX21_INT_USBMNP                (NR_IRQS_LEGACY + 57)
-#define MX21_INT_USBCTRL       (NR_IRQS_LEGACY + 58)
-#define MX21_INT_SLCDC         (NR_IRQS_LEGACY + 60)
-#define MX21_INT_LCDC          (NR_IRQS_LEGACY + 61)
-
-/* fixed DMA request numbers */
-#define MX21_DMA_REQ_CSPI3_RX  1
-#define MX21_DMA_REQ_CSPI3_TX  2
-#define MX21_DMA_REQ_EXT       3
-#define MX21_DMA_REQ_FIRI_RX   4
-#define MX21_DMA_REQ_SDHC2     6
-#define MX21_DMA_REQ_SDHC1     7
-#define MX21_DMA_REQ_SSI2_RX0  8
-#define MX21_DMA_REQ_SSI2_TX0  9
-#define MX21_DMA_REQ_SSI2_RX1  10
-#define MX21_DMA_REQ_SSI2_TX1  11
-#define MX21_DMA_REQ_SSI1_RX0  12
-#define MX21_DMA_REQ_SSI1_TX0  13
-#define MX21_DMA_REQ_SSI1_RX1  14
-#define MX21_DMA_REQ_SSI1_TX1  15
-#define MX21_DMA_REQ_CSPI2_RX  16
-#define MX21_DMA_REQ_CSPI2_TX  17
-#define MX21_DMA_REQ_CSPI1_RX  18
-#define MX21_DMA_REQ_CSPI1_TX  19
-#define MX21_DMA_REQ_UART4_RX  20
-#define MX21_DMA_REQ_UART4_TX  21
-#define MX21_DMA_REQ_UART3_RX  22
-#define MX21_DMA_REQ_UART3_TX  23
-#define MX21_DMA_REQ_UART2_RX  24
-#define MX21_DMA_REQ_UART2_TX  25
-#define MX21_DMA_REQ_UART1_RX  26
-#define MX21_DMA_REQ_UART1_TX  27
-#define MX21_DMA_REQ_BMI_TX    28
-#define MX21_DMA_REQ_BMI_RX    29
-#define MX21_DMA_REQ_CSI_STAT  30
-#define MX21_DMA_REQ_CSI_RX    31
-
-#endif /* ifndef __MACH_MX21_H__ */
index c6f7aae..241c04d 100644 (file)
 
 #define MX27_AIPI_BASE_ADDR            0x10000000
 #define MX27_AIPI_SIZE                 SZ_1M
-#define MX27_DMA_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x01000)
-#define MX27_WDOG_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x02000)
-#define MX27_GPT1_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x03000)
-#define MX27_GPT2_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x04000)
-#define MX27_GPT3_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x05000)
-#define MX27_PWM_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x06000)
-#define MX27_RTC_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x07000)
-#define MX27_KPP_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x08000)
-#define MX27_OWIRE_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x09000)
-#define MX27_UART1_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x0a000)
-#define MX27_UART2_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x0b000)
-#define MX27_UART3_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x0c000)
-#define MX27_UART4_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x0d000)
-#define MX27_CSPI1_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x0e000)
-#define MX27_CSPI2_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x0f000)
-#define MX27_SSI1_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x10000)
-#define MX27_SSI2_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x11000)
-#define MX27_I2C1_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x12000)
-#define MX27_SDHC1_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x13000)
-#define MX27_SDHC2_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x14000)
-#define MX27_GPIO_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x15000)
-#define MX27_GPIO1_BASE_ADDR                   (MX27_GPIO_BASE_ADDR + 0x000)
-#define MX27_GPIO2_BASE_ADDR                   (MX27_GPIO_BASE_ADDR + 0x100)
-#define MX27_GPIO3_BASE_ADDR                   (MX27_GPIO_BASE_ADDR + 0x200)
-#define MX27_GPIO4_BASE_ADDR                   (MX27_GPIO_BASE_ADDR + 0x300)
-#define MX27_GPIO5_BASE_ADDR                   (MX27_GPIO_BASE_ADDR + 0x400)
-#define MX27_GPIO6_BASE_ADDR                   (MX27_GPIO_BASE_ADDR + 0x500)
-#define MX27_AUDMUX_BASE_ADDR                  (MX27_AIPI_BASE_ADDR + 0x16000)
-#define MX27_CSPI3_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x17000)
-#define MX27_MSHC_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x18000)
-#define MX27_GPT4_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x19000)
-#define MX27_GPT5_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x1a000)
-#define MX27_UART5_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x1b000)
-#define MX27_UART6_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x1c000)
-#define MX27_I2C2_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x1d000)
-#define MX27_SDHC3_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x1e000)
-#define MX27_GPT6_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x1f000)
-#define MX27_LCDC_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x21000)
-#define MX27_SLCDC_BASE_ADDR                   (MX27_AIPI_BASE_ADDR + 0x22000)
-#define MX27_VPU_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x23000)
-#define MX27_USB_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x24000)
-#define MX27_USB_OTG_BASE_ADDR                 (MX27_USB_BASE_ADDR + 0x0000)
-#define MX27_USB_HS1_BASE_ADDR                 (MX27_USB_BASE_ADDR + 0x0200)
-#define MX27_USB_HS2_BASE_ADDR                 (MX27_USB_BASE_ADDR + 0x0400)
-#define MX27_SAHARA_BASE_ADDR                  (MX27_AIPI_BASE_ADDR + 0x25000)
-#define MX27_EMMAPP_BASE_ADDR                  (MX27_AIPI_BASE_ADDR + 0x26000)
-#define MX27_EMMAPRP_BASE_ADDR                 (MX27_AIPI_BASE_ADDR + 0x26400)
-#define MX27_CCM_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x27000)
-#define MX27_SYSCTRL_BASE_ADDR                 (MX27_AIPI_BASE_ADDR + 0x27800)
-#define MX27_IIM_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x28000)
-#define MX27_RTIC_BASE_ADDR                    (MX27_AIPI_BASE_ADDR + 0x2a000)
-#define MX27_FEC_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x2b000)
-#define MX27_SCC_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x2c000)
-#define MX27_ETB_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x3b000)
-#define MX27_ETB_RAM_BASE_ADDR                 (MX27_AIPI_BASE_ADDR + 0x3c000)
-#define MX27_JAM_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x3e000)
-#define MX27_MAX_BASE_ADDR                     (MX27_AIPI_BASE_ADDR + 0x3f000)
-
-#define MX27_AVIC_BASE_ADDR            0x10040000
-
-/* ROM patch */
-#define MX27_ROMP_BASE_ADDR            0x10041000
 
 #define MX27_SAHB1_BASE_ADDR           0x80000000
 #define MX27_SAHB1_SIZE                        SZ_1M
-#define MX27_CSI_BASE_ADDR                     (MX27_SAHB1_BASE_ADDR + 0x0000)
-#define MX27_ATA_BASE_ADDR                     (MX27_SAHB1_BASE_ADDR + 0x1000)
-
-/* Memory regions and CS */
-#define MX27_SDRAM_BASE_ADDR           0xa0000000
-#define MX27_CSD1_BASE_ADDR            0xb0000000
 
-#define MX27_CS0_BASE_ADDR             0xc0000000
-#define MX27_CS1_BASE_ADDR             0xc8000000
-#define MX27_CS2_BASE_ADDR             0xd0000000
-#define MX27_CS3_BASE_ADDR             0xd2000000
-#define MX27_CS4_BASE_ADDR             0xd4000000
-#define MX27_CS5_BASE_ADDR             0xd6000000
-
-/* NAND, SDRAM, WEIM, M3IF, EMI controllers */
 #define MX27_X_MEMC_BASE_ADDR          0xd8000000
 #define MX27_X_MEMC_SIZE               SZ_1M
-#define MX27_NFC_BASE_ADDR                     (MX27_X_MEMC_BASE_ADDR)
-#define MX27_SDRAMC_BASE_ADDR                  (MX27_X_MEMC_BASE_ADDR + 0x1000)
-#define MX27_WEIM_BASE_ADDR                    (MX27_X_MEMC_BASE_ADDR + 0x2000)
-#define MX27_M3IF_BASE_ADDR                    (MX27_X_MEMC_BASE_ADDR + 0x3000)
-#define MX27_PCMCIA_CTL_BASE_ADDR              (MX27_X_MEMC_BASE_ADDR + 0x4000)
-
-#define MX27_WEIM_CSCRx_BASE_ADDR(cs)  (MX27_WEIM_BASE_ADDR + (cs) * 0x10)
-#define MX27_WEIM_CSCRxU(cs)                   (MX27_WEIM_CSCRx_BASE_ADDR(cs))
-#define MX27_WEIM_CSCRxL(cs)                   (MX27_WEIM_CSCRx_BASE_ADDR(cs) + 0x4)
-#define MX27_WEIM_CSCRxA(cs)                   (MX27_WEIM_CSCRx_BASE_ADDR(cs) + 0x8)
-
-#define MX27_PCMCIA_MEM_BASE_ADDR      0xdc000000
-
-/* IRAM */
-#define MX27_IRAM_BASE_ADDR            0xffff4c00      /* internal ram */
 
 #define MX27_IO_P2V(x)                 IMX_IO_P2V(x)
-#define MX27_IO_ADDRESS(x)             IOMEM(MX27_IO_P2V(x))
-
-/* fixed interrupt numbers */
-#include <asm/irq.h>
-#define MX27_INT_I2C2          (NR_IRQS_LEGACY + 1)
-#define MX27_INT_GPT6          (NR_IRQS_LEGACY + 2)
-#define MX27_INT_GPT5          (NR_IRQS_LEGACY + 3)
-#define MX27_INT_GPT4          (NR_IRQS_LEGACY + 4)
-#define MX27_INT_RTIC          (NR_IRQS_LEGACY + 5)
-#define MX27_INT_CSPI3         (NR_IRQS_LEGACY + 6)
-#define MX27_INT_MSHC          (NR_IRQS_LEGACY + 7)
-#define MX27_INT_GPIO          (NR_IRQS_LEGACY + 8)
-#define MX27_INT_SDHC3         (NR_IRQS_LEGACY + 9)
-#define MX27_INT_SDHC2         (NR_IRQS_LEGACY + 10)
-#define MX27_INT_SDHC1         (NR_IRQS_LEGACY + 11)
-#define MX27_INT_I2C1          (NR_IRQS_LEGACY + 12)
-#define MX27_INT_SSI2          (NR_IRQS_LEGACY + 13)
-#define MX27_INT_SSI1          (NR_IRQS_LEGACY + 14)
-#define MX27_INT_CSPI2         (NR_IRQS_LEGACY + 15)
-#define MX27_INT_CSPI1         (NR_IRQS_LEGACY + 16)
-#define MX27_INT_UART4         (NR_IRQS_LEGACY + 17)
-#define MX27_INT_UART3         (NR_IRQS_LEGACY + 18)
-#define MX27_INT_UART2         (NR_IRQS_LEGACY + 19)
-#define MX27_INT_UART1         (NR_IRQS_LEGACY + 20)
-#define MX27_INT_KPP           (NR_IRQS_LEGACY + 21)
-#define MX27_INT_RTC           (NR_IRQS_LEGACY + 22)
-#define MX27_INT_PWM           (NR_IRQS_LEGACY + 23)
-#define MX27_INT_GPT3          (NR_IRQS_LEGACY + 24)
-#define MX27_INT_GPT2          (NR_IRQS_LEGACY + 25)
-#define MX27_INT_GPT1          (NR_IRQS_LEGACY + 26)
-#define MX27_INT_WDOG          (NR_IRQS_LEGACY + 27)
-#define MX27_INT_PCMCIA                (NR_IRQS_LEGACY + 28)
-#define MX27_INT_NFC           (NR_IRQS_LEGACY + 29)
-#define MX27_INT_ATA           (NR_IRQS_LEGACY + 30)
-#define MX27_INT_CSI           (NR_IRQS_LEGACY + 31)
-#define MX27_INT_DMACH0                (NR_IRQS_LEGACY + 32)
-#define MX27_INT_DMACH1                (NR_IRQS_LEGACY + 33)
-#define MX27_INT_DMACH2                (NR_IRQS_LEGACY + 34)
-#define MX27_INT_DMACH3                (NR_IRQS_LEGACY + 35)
-#define MX27_INT_DMACH4                (NR_IRQS_LEGACY + 36)
-#define MX27_INT_DMACH5                (NR_IRQS_LEGACY + 37)
-#define MX27_INT_DMACH6                (NR_IRQS_LEGACY + 38)
-#define MX27_INT_DMACH7                (NR_IRQS_LEGACY + 39)
-#define MX27_INT_DMACH8                (NR_IRQS_LEGACY + 40)
-#define MX27_INT_DMACH9                (NR_IRQS_LEGACY + 41)
-#define MX27_INT_DMACH10       (NR_IRQS_LEGACY + 42)
-#define MX27_INT_DMACH11       (NR_IRQS_LEGACY + 43)
-#define MX27_INT_DMACH12       (NR_IRQS_LEGACY + 44)
-#define MX27_INT_DMACH13       (NR_IRQS_LEGACY + 45)
-#define MX27_INT_DMACH14       (NR_IRQS_LEGACY + 46)
-#define MX27_INT_DMACH15       (NR_IRQS_LEGACY + 47)
-#define MX27_INT_UART6         (NR_IRQS_LEGACY + 48)
-#define MX27_INT_UART5         (NR_IRQS_LEGACY + 49)
-#define MX27_INT_FEC           (NR_IRQS_LEGACY + 50)
-#define MX27_INT_EMMAPRP       (NR_IRQS_LEGACY + 51)
-#define MX27_INT_EMMAPP                (NR_IRQS_LEGACY + 52)
-#define MX27_INT_VPU           (NR_IRQS_LEGACY + 53)
-#define MX27_INT_USB_HS1       (NR_IRQS_LEGACY + 54)
-#define MX27_INT_USB_HS2       (NR_IRQS_LEGACY + 55)
-#define MX27_INT_USB_OTG       (NR_IRQS_LEGACY + 56)
-#define MX27_INT_SCC_SMN       (NR_IRQS_LEGACY + 57)
-#define MX27_INT_SCC_SCM       (NR_IRQS_LEGACY + 58)
-#define MX27_INT_SAHARA                (NR_IRQS_LEGACY + 59)
-#define MX27_INT_SLCDC         (NR_IRQS_LEGACY + 60)
-#define MX27_INT_LCDC          (NR_IRQS_LEGACY + 61)
-#define MX27_INT_IIM           (NR_IRQS_LEGACY + 62)
-#define MX27_INT_CCM           (NR_IRQS_LEGACY + 63)
-
-/* fixed DMA request numbers */
-#define MX27_DMA_REQ_CSPI3_RX  1
-#define MX27_DMA_REQ_CSPI3_TX  2
-#define MX27_DMA_REQ_EXT       3
-#define MX27_DMA_REQ_MSHC      4
-#define MX27_DMA_REQ_SDHC2     6
-#define MX27_DMA_REQ_SDHC1     7
-#define MX27_DMA_REQ_SSI2_RX0  8
-#define MX27_DMA_REQ_SSI2_TX0  9
-#define MX27_DMA_REQ_SSI2_RX1  10
-#define MX27_DMA_REQ_SSI2_TX1  11
-#define MX27_DMA_REQ_SSI1_RX0  12
-#define MX27_DMA_REQ_SSI1_TX0  13
-#define MX27_DMA_REQ_SSI1_RX1  14
-#define MX27_DMA_REQ_SSI1_TX1  15
-#define MX27_DMA_REQ_CSPI2_RX  16
-#define MX27_DMA_REQ_CSPI2_TX  17
-#define MX27_DMA_REQ_CSPI1_RX  18
-#define MX27_DMA_REQ_CSPI1_TX  19
-#define MX27_DMA_REQ_UART4_RX  20
-#define MX27_DMA_REQ_UART4_TX  21
-#define MX27_DMA_REQ_UART3_RX  22
-#define MX27_DMA_REQ_UART3_TX  23
-#define MX27_DMA_REQ_UART2_RX  24
-#define MX27_DMA_REQ_UART2_TX  25
-#define MX27_DMA_REQ_UART1_RX  26
-#define MX27_DMA_REQ_UART1_TX  27
-#define MX27_DMA_REQ_ATA_TX    28
-#define MX27_DMA_REQ_ATA_RCV   29
-#define MX27_DMA_REQ_CSI_STAT  30
-#define MX27_DMA_REQ_CSI_RX    31
-#define MX27_DMA_REQ_UART5_TX  32
-#define MX27_DMA_REQ_UART5_RX  33
-#define MX27_DMA_REQ_UART6_TX  34
-#define MX27_DMA_REQ_UART6_RX  35
-#define MX27_DMA_REQ_SDHC3     36
-#define MX27_DMA_REQ_NFC       37
 
 #endif /* ifndef __MACH_MX27_H__ */
index d957467..08a72e2 100644 (file)
 #ifndef __MACH_MX31_H__
 #define __MACH_MX31_H__
 
-/*
- * IRAM
- */
-#define MX31_IRAM_BASE_ADDR            0x1ffc0000      /* internal ram */
-#define MX31_IRAM_SIZE                 SZ_16K
-
-#define MX31_L2CC_BASE_ADDR            0x30000000
-#define MX31_L2CC_SIZE                 SZ_1M
-
 #define MX31_AIPS1_BASE_ADDR           0x43f00000
 #define MX31_AIPS1_SIZE                        SZ_1M
-#define MX31_MAX_BASE_ADDR                     (MX31_AIPS1_BASE_ADDR + 0x04000)
-#define MX31_EVTMON_BASE_ADDR                  (MX31_AIPS1_BASE_ADDR + 0x08000)
-#define MX31_CLKCTL_BASE_ADDR                  (MX31_AIPS1_BASE_ADDR + 0x0c000)
-#define MX31_ETB_SLOT4_BASE_ADDR               (MX31_AIPS1_BASE_ADDR + 0x10000)
-#define MX31_ETB_SLOT5_BASE_ADDR               (MX31_AIPS1_BASE_ADDR + 0x14000)
-#define MX31_ECT_CTIO_BASE_ADDR                        (MX31_AIPS1_BASE_ADDR + 0x18000)
-#define MX31_I2C1_BASE_ADDR                    (MX31_AIPS1_BASE_ADDR + 0x80000)
-#define MX31_I2C3_BASE_ADDR                    (MX31_AIPS1_BASE_ADDR + 0x84000)
-#define MX31_USB_BASE_ADDR                     (MX31_AIPS1_BASE_ADDR + 0x88000)
-#define MX31_USB_OTG_BASE_ADDR                 (MX31_USB_BASE_ADDR + 0x0000)
-#define MX31_USB_HS1_BASE_ADDR                 (MX31_USB_BASE_ADDR + 0x0200)
-#define MX31_USB_HS2_BASE_ADDR                 (MX31_USB_BASE_ADDR + 0x0400)
-#define MX31_ATA_BASE_ADDR                     (MX31_AIPS1_BASE_ADDR + 0x8c000)
-#define MX31_UART1_BASE_ADDR                   (MX31_AIPS1_BASE_ADDR + 0x90000)
-#define MX31_UART2_BASE_ADDR                   (MX31_AIPS1_BASE_ADDR + 0x94000)
-#define MX31_I2C2_BASE_ADDR                    (MX31_AIPS1_BASE_ADDR + 0x98000)
-#define MX31_OWIRE_BASE_ADDR                   (MX31_AIPS1_BASE_ADDR + 0x9c000)
-#define MX31_SSI1_BASE_ADDR                    (MX31_AIPS1_BASE_ADDR + 0xa0000)
-#define MX31_CSPI1_BASE_ADDR                   (MX31_AIPS1_BASE_ADDR + 0xa4000)
-#define MX31_KPP_BASE_ADDR                     (MX31_AIPS1_BASE_ADDR + 0xa8000)
-#define MX31_IOMUXC_BASE_ADDR                  (MX31_AIPS1_BASE_ADDR + 0xac000)
-#define MX31_UART4_BASE_ADDR                   (MX31_AIPS1_BASE_ADDR + 0xb0000)
-#define MX31_UART5_BASE_ADDR                   (MX31_AIPS1_BASE_ADDR + 0xb4000)
-#define MX31_ECT_IP1_BASE_ADDR                 (MX31_AIPS1_BASE_ADDR + 0xb8000)
-#define MX31_ECT_IP2_BASE_ADDR                 (MX31_AIPS1_BASE_ADDR + 0xbc000)
-
 #define MX31_SPBA0_BASE_ADDR           0x50000000
 #define MX31_SPBA0_SIZE                        SZ_1M
-#define MX31_SDHC1_BASE_ADDR                   (MX31_SPBA0_BASE_ADDR + 0x04000)
-#define MX31_SDHC2_BASE_ADDR                   (MX31_SPBA0_BASE_ADDR + 0x08000)
-#define MX31_UART3_BASE_ADDR                   (MX31_SPBA0_BASE_ADDR + 0x0c000)
-#define MX31_CSPI2_BASE_ADDR                   (MX31_SPBA0_BASE_ADDR + 0x10000)
-#define MX31_SSI2_BASE_ADDR                    (MX31_SPBA0_BASE_ADDR + 0x14000)
-#define MX31_SIM1_BASE_ADDR                    (MX31_SPBA0_BASE_ADDR + 0x18000)
-#define MX31_IIM_BASE_ADDR                     (MX31_SPBA0_BASE_ADDR + 0x1c000)
-#define MX31_ATA_DMA_BASE_ADDR                 (MX31_SPBA0_BASE_ADDR + 0x20000)
-#define MX31_MSHC1_BASE_ADDR                   (MX31_SPBA0_BASE_ADDR + 0x24000)
-#define MX31_SPBA_CTRL_BASE_ADDR               (MX31_SPBA0_BASE_ADDR + 0x3c000)
-
 #define MX31_AIPS2_BASE_ADDR           0x53f00000
 #define MX31_AIPS2_SIZE                        SZ_1M
-#define MX31_CCM_BASE_ADDR                     (MX31_AIPS2_BASE_ADDR + 0x80000)
-#define MX31_CSPI3_BASE_ADDR                   (MX31_AIPS2_BASE_ADDR + 0x84000)
-#define MX31_FIRI_BASE_ADDR                    (MX31_AIPS2_BASE_ADDR + 0x8c000)
-#define MX31_GPT1_BASE_ADDR                    (MX31_AIPS2_BASE_ADDR + 0x90000)
-#define MX31_EPIT1_BASE_ADDR                   (MX31_AIPS2_BASE_ADDR + 0x94000)
-#define MX31_EPIT2_BASE_ADDR                   (MX31_AIPS2_BASE_ADDR + 0x98000)
-#define MX31_GPIO3_BASE_ADDR                   (MX31_AIPS2_BASE_ADDR + 0xa4000)
-#define MX31_SCC_BASE_ADDR                     (MX31_AIPS2_BASE_ADDR + 0xac000)
-#define MX31_SCM_BASE_ADDR                     (MX31_AIPS2_BASE_ADDR + 0xae000)
-#define MX31_SMN_BASE_ADDR                     (MX31_AIPS2_BASE_ADDR + 0xaf000)
-#define MX31_RNGA_BASE_ADDR                    (MX31_AIPS2_BASE_ADDR + 0xb0000)
-#define MX31_IPU_CTRL_BASE_ADDR                        (MX31_AIPS2_BASE_ADDR + 0xc0000)
-#define MX31_AUDMUX_BASE_ADDR                  (MX31_AIPS2_BASE_ADDR + 0xc4000)
-#define MX31_MPEG4_ENC_BASE_ADDR               (MX31_AIPS2_BASE_ADDR + 0xc8000)
-#define MX31_GPIO1_BASE_ADDR                   (MX31_AIPS2_BASE_ADDR + 0xcc000)
-#define MX31_GPIO2_BASE_ADDR                   (MX31_AIPS2_BASE_ADDR + 0xd0000)
-#define MX31_SDMA_BASE_ADDR                    (MX31_AIPS2_BASE_ADDR + 0xd4000)
-#define MX31_RTC_BASE_ADDR                     (MX31_AIPS2_BASE_ADDR + 0xd8000)
-#define MX31_WDOG_BASE_ADDR                    (MX31_AIPS2_BASE_ADDR + 0xdc000)
-#define MX31_PWM_BASE_ADDR                     (MX31_AIPS2_BASE_ADDR + 0xe0000)
-#define MX31_RTIC_BASE_ADDR                    (MX31_AIPS2_BASE_ADDR + 0xec000)
-
-#define MX31_ROMP_BASE_ADDR            0x60000000
-#define MX31_ROMP_BASE_ADDR_VIRT       IOMEM(0xfc500000)
-#define MX31_ROMP_SIZE                 SZ_1M
-
 #define MX31_AVIC_BASE_ADDR            0x68000000
 #define MX31_AVIC_SIZE                 SZ_1M
-
-#define MX31_IPU_MEM_BASE_ADDR         0x70000000
-#define MX31_CSD0_BASE_ADDR            0x80000000
-#define MX31_CSD1_BASE_ADDR            0x90000000
-
-#define MX31_CS0_BASE_ADDR             0xa0000000
-#define MX31_CS1_BASE_ADDR             0xa8000000
-#define MX31_CS2_BASE_ADDR             0xb0000000
-#define MX31_CS3_BASE_ADDR             0xb2000000
-
-#define MX31_CS4_BASE_ADDR             0xb4000000
-#define MX31_CS4_BASE_ADDR_VIRT                IOMEM(0xf6000000)
-#define MX31_CS4_SIZE                  SZ_32M
-
-#define MX31_CS5_BASE_ADDR             0xb6000000
-#define MX31_CS5_BASE_ADDR_VIRT                IOMEM(0xf8000000)
-#define MX31_CS5_SIZE                  SZ_32M
-
 #define MX31_X_MEMC_BASE_ADDR          0xb8000000
 #define MX31_X_MEMC_SIZE               SZ_64K
-#define MX31_NFC_BASE_ADDR                     (MX31_X_MEMC_BASE_ADDR + 0x0000)
-#define MX31_ESDCTL_BASE_ADDR                  (MX31_X_MEMC_BASE_ADDR + 0x1000)
-#define MX31_WEIM_BASE_ADDR                    (MX31_X_MEMC_BASE_ADDR + 0x2000)
-#define MX31_M3IF_BASE_ADDR                    (MX31_X_MEMC_BASE_ADDR + 0x3000)
-#define MX31_EMI_CTL_BASE_ADDR                 (MX31_X_MEMC_BASE_ADDR + 0x4000)
-#define MX31_PCMCIA_CTL_BASE_ADDR              MX31_EMI_CTL_BASE_ADDR
-
-#define MX31_WEIM_CSCRx_BASE_ADDR(cs)  (MX31_WEIM_BASE_ADDR + (cs) * 0x10)
-#define MX31_WEIM_CSCRxU(cs)                   (MX31_WEIM_CSCRx_BASE_ADDR(cs))
-#define MX31_WEIM_CSCRxL(cs)                   (MX31_WEIM_CSCRx_BASE_ADDR(cs) + 0x4)
-#define MX31_WEIM_CSCRxA(cs)                   (MX31_WEIM_CSCRx_BASE_ADDR(cs) + 0x8)
-
-#define MX31_PCMCIA_MEM_BASE_ADDR      0xbc000000
 
 #define MX31_IO_P2V(x)                 IMX_IO_P2V(x)
-#define MX31_IO_ADDRESS(x)             IOMEM(MX31_IO_P2V(x))
-
-/*
- * Interrupt numbers
- */
-#include <asm/irq.h>
-#define MX31_INT_I2C3          (NR_IRQS_LEGACY + 3)
-#define MX31_INT_I2C2          (NR_IRQS_LEGACY + 4)
-#define MX31_INT_MPEG4_ENCODER (NR_IRQS_LEGACY + 5)
-#define MX31_INT_RTIC          (NR_IRQS_LEGACY + 6)
-#define MX31_INT_FIRI          (NR_IRQS_LEGACY + 7)
-#define MX31_INT_SDHC2         (NR_IRQS_LEGACY + 8)
-#define MX31_INT_SDHC1         (NR_IRQS_LEGACY + 9)
-#define MX31_INT_I2C1          (NR_IRQS_LEGACY + 10)
-#define MX31_INT_SSI2          (NR_IRQS_LEGACY + 11)
-#define MX31_INT_SSI1          (NR_IRQS_LEGACY + 12)
-#define MX31_INT_CSPI2         (NR_IRQS_LEGACY + 13)
-#define MX31_INT_CSPI1         (NR_IRQS_LEGACY + 14)
-#define MX31_INT_ATA           (NR_IRQS_LEGACY + 15)
-#define MX31_INT_MBX           (NR_IRQS_LEGACY + 16)
-#define MX31_INT_CSPI3         (NR_IRQS_LEGACY + 17)
-#define MX31_INT_UART3         (NR_IRQS_LEGACY + 18)
-#define MX31_INT_IIM           (NR_IRQS_LEGACY + 19)
-#define MX31_INT_SIM2          (NR_IRQS_LEGACY + 20)
-#define MX31_INT_SIM1          (NR_IRQS_LEGACY + 21)
-#define MX31_INT_RNGA          (NR_IRQS_LEGACY + 22)
-#define MX31_INT_EVTMON                (NR_IRQS_LEGACY + 23)
-#define MX31_INT_KPP           (NR_IRQS_LEGACY + 24)
-#define MX31_INT_RTC           (NR_IRQS_LEGACY + 25)
-#define MX31_INT_PWM           (NR_IRQS_LEGACY + 26)
-#define MX31_INT_EPIT2         (NR_IRQS_LEGACY + 27)
-#define MX31_INT_EPIT1         (NR_IRQS_LEGACY + 28)
-#define MX31_INT_GPT           (NR_IRQS_LEGACY + 29)
-#define MX31_INT_POWER_FAIL    (NR_IRQS_LEGACY + 30)
-#define MX31_INT_CCM_DVFS      (NR_IRQS_LEGACY + 31)
-#define MX31_INT_UART2         (NR_IRQS_LEGACY + 32)
-#define MX31_INT_NFC           (NR_IRQS_LEGACY + 33)
-#define MX31_INT_SDMA          (NR_IRQS_LEGACY + 34)
-#define MX31_INT_USB_HS1       (NR_IRQS_LEGACY + 35)
-#define MX31_INT_USB_HS2       (NR_IRQS_LEGACY + 36)
-#define MX31_INT_USB_OTG       (NR_IRQS_LEGACY + 37)
-#define MX31_INT_MSHC1         (NR_IRQS_LEGACY + 39)
-#define MX31_INT_MSHC2         (NR_IRQS_LEGACY + 40)
-#define MX31_INT_IPU_ERR       (NR_IRQS_LEGACY + 41)
-#define MX31_INT_IPU_SYN       (NR_IRQS_LEGACY + 42)
-#define MX31_INT_UART1         (NR_IRQS_LEGACY + 45)
-#define MX31_INT_UART4         (NR_IRQS_LEGACY + 46)
-#define MX31_INT_UART5         (NR_IRQS_LEGACY + 47)
-#define MX31_INT_ECT           (NR_IRQS_LEGACY + 48)
-#define MX31_INT_SCC_SCM       (NR_IRQS_LEGACY + 49)
-#define MX31_INT_SCC_SMN       (NR_IRQS_LEGACY + 50)
-#define MX31_INT_GPIO2         (NR_IRQS_LEGACY + 51)
-#define MX31_INT_GPIO1         (NR_IRQS_LEGACY + 52)
-#define MX31_INT_CCM           (NR_IRQS_LEGACY + 53)
-#define MX31_INT_PCMCIA                (NR_IRQS_LEGACY + 54)
-#define MX31_INT_WDOG          (NR_IRQS_LEGACY + 55)
-#define MX31_INT_GPIO3         (NR_IRQS_LEGACY + 56)
-#define MX31_INT_EXT_POWER     (NR_IRQS_LEGACY + 58)
-#define MX31_INT_EXT_TEMPER    (NR_IRQS_LEGACY + 59)
-#define MX31_INT_EXT_SENSOR60  (NR_IRQS_LEGACY + 60)
-#define MX31_INT_EXT_SENSOR61  (NR_IRQS_LEGACY + 61)
-#define MX31_INT_EXT_WDOG      (NR_IRQS_LEGACY + 62)
-#define MX31_INT_EXT_TV                (NR_IRQS_LEGACY + 63)
-
-#define MX31_DMA_REQ_SDHC1     20
-#define MX31_DMA_REQ_SDHC2     21
-#define MX31_DMA_REQ_SSI2_RX1  22
-#define MX31_DMA_REQ_SSI2_TX1  23
-#define MX31_DMA_REQ_SSI2_RX0  24
-#define MX31_DMA_REQ_SSI2_TX0  25
-#define MX31_DMA_REQ_SSI1_RX1  26
-#define MX31_DMA_REQ_SSI1_TX1  27
-#define MX31_DMA_REQ_SSI1_RX0  28
-#define MX31_DMA_REQ_SSI1_TX0  29
-
-#define MX31_PROD_SIGNATURE            0x1     /* For MX31 */
 
 #endif /* ifndef __MACH_MX31_H__ */
diff --git a/arch/arm/mach-imx/mx31lilly-db.c b/arch/arm/mach-imx/mx31lilly-db.c
deleted file mode 100644 (file)
index 00a5ee3..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *  LILLY-1131 development board support
- *
- *    Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
- *
- *  based on code for other MX31 boards,
- *
- *    Copyright 2005-2007 Freescale Semiconductor
- *    Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
- *    Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
- */
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/platform_device.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include "board-mx31lilly.h"
-#include "common.h"
-#include "devices-imx31.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-
-/*
- * This file contains board-specific initialization routines for the
- * LILLY-1131 development board. If you design an own baseboard for the
- * module, use this file as base for support code.
- */
-
-static unsigned int lilly_db_board_pins[] __initdata = {
-       MX31_PIN_SD1_DATA3__SD1_DATA3,
-       MX31_PIN_SD1_DATA2__SD1_DATA2,
-       MX31_PIN_SD1_DATA1__SD1_DATA1,
-       MX31_PIN_SD1_DATA0__SD1_DATA0,
-       MX31_PIN_SD1_CLK__SD1_CLK,
-       MX31_PIN_SD1_CMD__SD1_CMD,
-       MX31_PIN_LD0__LD0,
-       MX31_PIN_LD1__LD1,
-       MX31_PIN_LD2__LD2,
-       MX31_PIN_LD3__LD3,
-       MX31_PIN_LD4__LD4,
-       MX31_PIN_LD5__LD5,
-       MX31_PIN_LD6__LD6,
-       MX31_PIN_LD7__LD7,
-       MX31_PIN_LD8__LD8,
-       MX31_PIN_LD9__LD9,
-       MX31_PIN_LD10__LD10,
-       MX31_PIN_LD11__LD11,
-       MX31_PIN_LD12__LD12,
-       MX31_PIN_LD13__LD13,
-       MX31_PIN_LD14__LD14,
-       MX31_PIN_LD15__LD15,
-       MX31_PIN_LD16__LD16,
-       MX31_PIN_LD17__LD17,
-       MX31_PIN_VSYNC3__VSYNC3,
-       MX31_PIN_HSYNC__HSYNC,
-       MX31_PIN_FPSHIFT__FPSHIFT,
-       MX31_PIN_DRDY0__DRDY0,
-       MX31_PIN_CONTRAST__CONTRAST,
-};
-
-/* MMC support */
-
-static int mxc_mmc1_get_ro(struct device *dev)
-{
-       return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_LCS0));
-}
-
-static int gpio_det, gpio_wp;
-
-#define MMC_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
-                       PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
-
-static int mxc_mmc1_init(struct device *dev,
-                        irq_handler_t detect_irq, void *data)
-{
-       int ret;
-
-       gpio_det = IOMUX_TO_GPIO(MX31_PIN_GPIO1_1);
-       gpio_wp = IOMUX_TO_GPIO(MX31_PIN_LCS0);
-
-       mxc_iomux_set_pad(MX31_PIN_SD1_DATA0, MMC_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SD1_DATA1, MMC_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SD1_DATA2, MMC_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SD1_DATA3, MMC_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SD1_CLK, MMC_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SD1_CMD, MMC_PAD_CFG);
-
-       ret = gpio_request(gpio_det, "MMC detect");
-       if (ret)
-               return ret;
-
-       ret = gpio_request(gpio_wp, "MMC w/p");
-       if (ret)
-               goto exit_free_det;
-
-       gpio_direction_input(gpio_det);
-       gpio_direction_input(gpio_wp);
-
-       ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1)),
-                         detect_irq, IRQF_TRIGGER_FALLING,
-                         "MMC detect", data);
-       if (ret)
-               goto exit_free_wp;
-
-       return 0;
-
-exit_free_wp:
-       gpio_free(gpio_wp);
-
-exit_free_det:
-       gpio_free(gpio_det);
-
-       return ret;
-}
-
-static void mxc_mmc1_exit(struct device *dev, void *data)
-{
-       gpio_free(gpio_det);
-       gpio_free(gpio_wp);
-       free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1)), data);
-}
-
-static const struct imxmmc_platform_data mmc_pdata __initconst = {
-       .get_ro = mxc_mmc1_get_ro,
-       .init   = mxc_mmc1_init,
-       .exit   = mxc_mmc1_exit,
-};
-
-/* Framebuffer support */
-static const struct fb_videomode fb_modedb = {
-       /* 640x480 TFT panel (IPS-056T) */
-       .name           = "CRT-VGA",
-       .refresh        = 64,
-       .xres           = 640,
-       .yres           = 480,
-       .pixclock       = 30000,
-       .left_margin    = 200,
-       .right_margin   = 2,
-       .upper_margin   = 2,
-       .lower_margin   = 2,
-       .hsync_len      = 3,
-       .vsync_len      = 1,
-       .sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH,
-       .vmode          = FB_VMODE_NONINTERLACED,
-       .flag           = 0,
-};
-
-static struct mx3fb_platform_data fb_pdata __initdata = {
-       .name           = "CRT-VGA",
-       .mode           = &fb_modedb,
-       .num_modes      = 1,
-};
-
-#define LCD_VCC_EN_GPIO         (7)
-
-static void __init mx31lilly_init_fb(void)
-{
-       if (gpio_request(LCD_VCC_EN_GPIO, "LCD enable") != 0) {
-               printk(KERN_WARNING "unable to request LCD_VCC_EN pin.\n");
-               return;
-       }
-
-       imx31_add_ipu_core();
-       imx31_add_mx3_sdc_fb(&fb_pdata);
-       gpio_direction_output(LCD_VCC_EN_GPIO, 1);
-}
-
-void __init mx31lilly_db_init(void)
-{
-       mxc_iomux_setup_multiple_pins(lilly_db_board_pins,
-                                       ARRAY_SIZE(lilly_db_board_pins),
-                                       "development board pins");
-       imx31_add_mxc_mmc(0, &mmc_pdata);
-       mx31lilly_init_fb();
-}
diff --git a/arch/arm/mach-imx/mx31lite-db.c b/arch/arm/mach-imx/mx31lite-db.c
deleted file mode 100644 (file)
index 13da732..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *  LogicPD i.MX31 SOM-LV development board support
- *
- *    Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
- *
- *  based on code for other MX31 boards,
- *
- *    Copyright 2005-2007 Freescale Semiconductor
- *    Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
- *    Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
- */
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/leds.h>
-#include <linux/platform_device.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include "board-mx31lite.h"
-#include "common.h"
-#include "devices-imx31.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-
-/*
- * This file contains board-specific initialization routines for the
- * LogicPD i.MX31 SOM-LV development board, aka 'LiteKit'.
- * If you design an own baseboard for the module, use this file as base
- * for support code.
- */
-
-static unsigned int litekit_db_board_pins[] __initdata = {
-       /* SDHC1 */
-       MX31_PIN_SD1_DATA0__SD1_DATA0,
-       MX31_PIN_SD1_DATA1__SD1_DATA1,
-       MX31_PIN_SD1_DATA2__SD1_DATA2,
-       MX31_PIN_SD1_DATA3__SD1_DATA3,
-       MX31_PIN_SD1_CLK__SD1_CLK,
-       MX31_PIN_SD1_CMD__SD1_CMD,
-};
-
-/* MMC */
-
-static int gpio_det, gpio_wp;
-
-#define MMC_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
-                    PAD_CTL_ODE_CMOS)
-
-static int mxc_mmc1_get_ro(struct device *dev)
-{
-       return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_GPIO1_6));
-}
-
-static int mxc_mmc1_init(struct device *dev,
-                        irq_handler_t detect_irq, void *data)
-{
-       int ret;
-
-       gpio_det = IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1);
-       gpio_wp = IOMUX_TO_GPIO(MX31_PIN_GPIO1_6);
-
-       mxc_iomux_set_pad(MX31_PIN_SD1_DATA0,
-                         MMC_PAD_CFG | PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
-       mxc_iomux_set_pad(MX31_PIN_SD1_DATA1,
-                         MMC_PAD_CFG | PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
-       mxc_iomux_set_pad(MX31_PIN_SD1_DATA2,
-                         MMC_PAD_CFG | PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
-       mxc_iomux_set_pad(MX31_PIN_SD1_DATA3,
-                         MMC_PAD_CFG | PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
-       mxc_iomux_set_pad(MX31_PIN_SD1_CMD,
-                         MMC_PAD_CFG | PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
-       mxc_iomux_set_pad(MX31_PIN_SD1_CLK, MMC_PAD_CFG);
-
-       ret = gpio_request(gpio_det, "MMC detect");
-       if (ret)
-               return ret;
-
-       ret = gpio_request(gpio_wp, "MMC w/p");
-       if (ret)
-               goto exit_free_det;
-
-       gpio_direction_input(gpio_det);
-       gpio_direction_input(gpio_wp);
-
-       ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)),
-                         detect_irq,
-                         IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
-                         "MMC detect", data);
-       if (ret)
-               goto exit_free_wp;
-
-       return 0;
-
-exit_free_wp:
-       gpio_free(gpio_wp);
-
-exit_free_det:
-       gpio_free(gpio_det);
-
-       return ret;
-}
-
-static void mxc_mmc1_exit(struct device *dev, void *data)
-{
-       gpio_free(gpio_det);
-       gpio_free(gpio_wp);
-       free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)), data);
-}
-
-static const struct imxmmc_platform_data mmc_pdata __initconst = {
-       .get_ro  = mxc_mmc1_get_ro,
-       .init      = mxc_mmc1_init,
-       .exit      = mxc_mmc1_exit,
-};
-
-/* GPIO LEDs */
-
-static const struct gpio_led litekit_leds[] __initconst = {
-       {
-               .name           = "GPIO0",
-               .gpio           = IOMUX_TO_GPIO(MX31_PIN_COMPARE),
-               .active_low     = 1,
-               .default_state  = LEDS_GPIO_DEFSTATE_OFF,
-       },
-       {
-               .name           = "GPIO1",
-               .gpio           = IOMUX_TO_GPIO(MX31_PIN_CAPTURE),
-               .active_low     = 1,
-               .default_state  = LEDS_GPIO_DEFSTATE_OFF,
-       }
-};
-
-static const struct gpio_led_platform_data
-               litekit_led_platform_data __initconst = {
-       .leds           = litekit_leds,
-       .num_leds       = ARRAY_SIZE(litekit_leds),
-};
-
-void __init mx31lite_db_init(void)
-{
-       mxc_iomux_setup_multiple_pins(litekit_db_board_pins,
-                                       ARRAY_SIZE(litekit_db_board_pins),
-                                       "development board pins");
-       imx31_add_mxc_mmc(0, &mmc_pdata);
-       gpio_led_register_device(-1, &litekit_led_platform_data);
-       imx31_add_imx2_wdt();
-       imx31_add_mxc_rtc();
-}
diff --git a/arch/arm/mach-imx/mx31moboard-devboard.c b/arch/arm/mach-imx/mx31moboard-devboard.c
deleted file mode 100644 (file)
index 6a9db06..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
- */
-
-#include <linux/gpio.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/delay.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/types.h>
-
-#include <linux/usb/otg.h>
-
-#include "board-mx31moboard.h"
-#include "common.h"
-#include "devices-imx31.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-#include "ulpi.h"
-
-static unsigned int devboard_pins[] = {
-       /* UART1 */
-       MX31_PIN_CTS2__CTS2, MX31_PIN_RTS2__RTS2,
-       MX31_PIN_TXD2__TXD2, MX31_PIN_RXD2__RXD2,
-       /* SDHC2 */
-       MX31_PIN_PC_PWRON__SD2_DATA3, MX31_PIN_PC_VS1__SD2_DATA2,
-       MX31_PIN_PC_READY__SD2_DATA1, MX31_PIN_PC_WAIT_B__SD2_DATA0,
-       MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD,
-       MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29,
-       /* USB H1 */
-       MX31_PIN_CSPI1_MISO__USBH1_RXDP, MX31_PIN_CSPI1_MOSI__USBH1_RXDM,
-       MX31_PIN_CSPI1_SS0__USBH1_TXDM, MX31_PIN_CSPI1_SS1__USBH1_TXDP,
-       MX31_PIN_CSPI1_SS2__USBH1_RCV, MX31_PIN_CSPI1_SCLK__USBH1_OEB,
-       MX31_PIN_CSPI1_SPI_RDY__USBH1_FS, MX31_PIN_SFS6__USBH1_SUSPEND,
-       MX31_PIN_NFRE_B__GPIO1_11, MX31_PIN_NFALE__GPIO1_12,
-       /* SEL */
-       MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9,
-       MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
-};
-
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-#define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR)
-#define SDHC2_WP IOMUX_TO_GPIO(MX31_PIN_ATA_DIOW)
-
-static int devboard_sdhc2_get_ro(struct device *dev)
-{
-       return !gpio_get_value(SDHC2_WP);
-}
-
-static int devboard_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
-               void *data)
-{
-       int ret;
-
-       ret = gpio_request(SDHC2_CD, "sdhc-detect");
-       if (ret)
-               return ret;
-
-       gpio_direction_input(SDHC2_CD);
-
-       ret = gpio_request(SDHC2_WP, "sdhc-wp");
-       if (ret)
-               goto err_gpio_free;
-       gpio_direction_input(SDHC2_WP);
-
-       ret = request_irq(gpio_to_irq(SDHC2_CD), detect_irq,
-               IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
-               "sdhc2-card-detect", data);
-       if (ret)
-               goto err_gpio_free_2;
-
-       return 0;
-
-err_gpio_free_2:
-       gpio_free(SDHC2_WP);
-err_gpio_free:
-       gpio_free(SDHC2_CD);
-
-       return ret;
-}
-
-static void devboard_sdhc2_exit(struct device *dev, void *data)
-{
-       free_irq(gpio_to_irq(SDHC2_CD), data);
-       gpio_free(SDHC2_WP);
-       gpio_free(SDHC2_CD);
-}
-
-static const struct imxmmc_platform_data sdhc2_pdata __initconst = {
-       .get_ro = devboard_sdhc2_get_ro,
-       .init   = devboard_sdhc2_init,
-       .exit   = devboard_sdhc2_exit,
-};
-
-#define SEL0 IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
-#define SEL1 IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
-#define SEL2 IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
-#define SEL3 IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)
-
-static void devboard_init_sel_gpios(void)
-{
-       if (!gpio_request(SEL0, "sel0")) {
-               gpio_direction_input(SEL0);
-               gpio_export(SEL0, true);
-       }
-
-       if (!gpio_request(SEL1, "sel1")) {
-               gpio_direction_input(SEL1);
-               gpio_export(SEL1, true);
-       }
-
-       if (!gpio_request(SEL2, "sel2")) {
-               gpio_direction_input(SEL2);
-               gpio_export(SEL2, true);
-       }
-
-       if (!gpio_request(SEL3, "sel3")) {
-               gpio_direction_input(SEL3);
-               gpio_export(SEL3, true);
-       }
-}
-#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
-                       PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
-
-static int devboard_usbh1_hw_init(struct platform_device *pdev)
-{
-       mxc_iomux_set_gpr(MUX_PGP_USB_SUSPEND, true);
-
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_MISO, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_MOSI, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SS0, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SS1, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SS2, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SCLK, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SPI_RDY, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SFS6, USB_PAD_CFG);
-
-       mdelay(10);
-
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED |
-                       MXC_EHCI_INTERFACE_SINGLE_UNI);
-}
-
-#define USBH1_VBUSEN_B IOMUX_TO_GPIO(MX31_PIN_NFRE_B)
-#define USBH1_MODE     IOMUX_TO_GPIO(MX31_PIN_NFALE)
-
-static int devboard_isp1105_init(struct usb_phy *otg)
-{
-       int ret = gpio_request(USBH1_MODE, "usbh1-mode");
-       if (ret)
-               return ret;
-       /* single ended */
-       gpio_direction_output(USBH1_MODE, 0);
-
-       ret = gpio_request(USBH1_VBUSEN_B, "usbh1-vbusen");
-       if (ret) {
-               gpio_free(USBH1_MODE);
-               return ret;
-       }
-       gpio_direction_output(USBH1_VBUSEN_B, 1);
-
-       return 0;
-}
-
-
-static int devboard_isp1105_set_vbus(struct usb_otg *otg, bool on)
-{
-       if (on)
-               gpio_set_value(USBH1_VBUSEN_B, 0);
-       else
-               gpio_set_value(USBH1_VBUSEN_B, 1);
-
-       return 0;
-}
-
-static struct mxc_usbh_platform_data usbh1_pdata __initdata = {
-       .init   = devboard_usbh1_hw_init,
-       .portsc = MXC_EHCI_MODE_UTMI | MXC_EHCI_SERIAL,
-};
-
-static int __init devboard_usbh1_init(void)
-{
-       struct usb_phy *phy;
-       struct platform_device *pdev;
-
-       phy = kzalloc(sizeof(*phy), GFP_KERNEL);
-       if (!phy)
-               return -ENOMEM;
-
-       phy->otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
-       if (!phy->otg) {
-               kfree(phy);
-               return -ENOMEM;
-       }
-
-       phy->label      = "ISP1105";
-       phy->init       = devboard_isp1105_init;
-       phy->otg->set_vbus      = devboard_isp1105_set_vbus;
-
-       usbh1_pdata.otg = phy;
-
-       pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
-
-       return PTR_ERR_OR_ZERO(pdev);
-}
-
-
-static const struct fsl_usb2_platform_data usb_pdata __initconst = {
-       .operating_mode = FSL_USB2_DR_DEVICE,
-       .phy_mode       = FSL_USB2_PHY_ULPI,
-};
-
-/*
- * system init for baseboard usage. Will be called by mx31moboard init.
- */
-void __init mx31moboard_devboard_init(void)
-{
-       printk(KERN_INFO "Initializing mx31devboard peripherals\n");
-
-       mxc_iomux_setup_multiple_pins(devboard_pins, ARRAY_SIZE(devboard_pins),
-               "devboard");
-
-       imx31_add_imx_uart1(&uart_pdata);
-
-       imx31_add_mxc_mmc(1, &sdhc2_pdata);
-
-       devboard_init_sel_gpios();
-
-       imx31_add_fsl_usb2_udc(&usb_pdata);
-
-       devboard_usbh1_init();
-}
diff --git a/arch/arm/mach-imx/mx31moboard-marxbot.c b/arch/arm/mach-imx/mx31moboard-marxbot.c
deleted file mode 100644 (file)
index c269000..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
- */
-
-#include <linux/delay.h>
-#include <linux/gpio.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/i2c.h>
-#include <linux/spi/spi.h>
-#include <linux/slab.h>
-#include <linux/platform_device.h>
-#include <linux/types.h>
-
-#include <linux/usb/otg.h>
-
-#include "board-mx31moboard.h"
-#include "common.h"
-#include "devices-imx31.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-#include "ulpi.h"
-
-static unsigned int marxbot_pins[] = {
-       /* SDHC2 */
-       MX31_PIN_PC_PWRON__SD2_DATA3, MX31_PIN_PC_VS1__SD2_DATA2,
-       MX31_PIN_PC_READY__SD2_DATA1, MX31_PIN_PC_WAIT_B__SD2_DATA0,
-       MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD,
-       MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29,
-       /* dsPIC resets */
-       MX31_PIN_STXD5__GPIO1_21, MX31_PIN_SRXD5__GPIO1_22,
-       /*battery detection */
-       MX31_PIN_LCS0__GPIO3_23,
-       /* USB H1 */
-       MX31_PIN_CSPI1_MISO__USBH1_RXDP, MX31_PIN_CSPI1_MOSI__USBH1_RXDM,
-       MX31_PIN_CSPI1_SS0__USBH1_TXDM, MX31_PIN_CSPI1_SS1__USBH1_TXDP,
-       MX31_PIN_CSPI1_SS2__USBH1_RCV, MX31_PIN_CSPI1_SCLK__USBH1_OEB,
-       MX31_PIN_CSPI1_SPI_RDY__USBH1_FS, MX31_PIN_SFS6__USBH1_SUSPEND,
-       MX31_PIN_NFRE_B__GPIO1_11, MX31_PIN_NFALE__GPIO1_12,
-       /* SEL */
-       MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9,
-       MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
-};
-
-#define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR)
-#define SDHC2_WP IOMUX_TO_GPIO(MX31_PIN_ATA_DIOW)
-
-static int marxbot_sdhc2_get_ro(struct device *dev)
-{
-       return !gpio_get_value(SDHC2_WP);
-}
-
-static int marxbot_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
-               void *data)
-{
-       int ret;
-
-       ret = gpio_request(SDHC2_CD, "sdhc-detect");
-       if (ret)
-               return ret;
-
-       gpio_direction_input(SDHC2_CD);
-
-       ret = gpio_request(SDHC2_WP, "sdhc-wp");
-       if (ret)
-               goto err_gpio_free;
-       gpio_direction_input(SDHC2_WP);
-
-       ret = request_irq(gpio_to_irq(SDHC2_CD), detect_irq,
-               IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
-               "sdhc2-card-detect", data);
-       if (ret)
-               goto err_gpio_free_2;
-
-       return 0;
-
-err_gpio_free_2:
-       gpio_free(SDHC2_WP);
-err_gpio_free:
-       gpio_free(SDHC2_CD);
-
-       return ret;
-}
-
-static void marxbot_sdhc2_exit(struct device *dev, void *data)
-{
-       free_irq(gpio_to_irq(SDHC2_CD), data);
-       gpio_free(SDHC2_WP);
-       gpio_free(SDHC2_CD);
-}
-
-static const struct imxmmc_platform_data sdhc2_pdata __initconst = {
-       .get_ro = marxbot_sdhc2_get_ro,
-       .init   = marxbot_sdhc2_init,
-       .exit   = marxbot_sdhc2_exit,
-};
-
-#define TRSLAT_RST_B   IOMUX_TO_GPIO(MX31_PIN_STXD5)
-#define DSPICS_RST_B   IOMUX_TO_GPIO(MX31_PIN_SRXD5)
-
-static void dspics_resets_init(void)
-{
-       if (!gpio_request(TRSLAT_RST_B, "translator-rst")) {
-               gpio_direction_output(TRSLAT_RST_B, 0);
-               gpio_export(TRSLAT_RST_B, false);
-       }
-
-       if (!gpio_request(DSPICS_RST_B, "dspics-rst")) {
-               gpio_direction_output(DSPICS_RST_B, 0);
-               gpio_export(DSPICS_RST_B, false);
-       }
-}
-
-static struct spi_board_info marxbot_spi_board_info[] __initdata = {
-       {
-               .modalias = "spidev",
-               .max_speed_hz = 300000,
-               .bus_num = 1,
-               .chip_select = 1, /* according spi1_cs[] ! */
-       },
-};
-
-#define SEL0 IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
-#define SEL1 IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
-#define SEL2 IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
-#define SEL3 IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)
-
-static void marxbot_init_sel_gpios(void)
-{
-       if (!gpio_request(SEL0, "sel0")) {
-               gpio_direction_input(SEL0);
-               gpio_export(SEL0, true);
-       }
-
-       if (!gpio_request(SEL1, "sel1")) {
-               gpio_direction_input(SEL1);
-               gpio_export(SEL1, true);
-       }
-
-       if (!gpio_request(SEL2, "sel2")) {
-               gpio_direction_input(SEL2);
-               gpio_export(SEL2, true);
-       }
-
-       if (!gpio_request(SEL3, "sel3")) {
-               gpio_direction_input(SEL3);
-               gpio_export(SEL3, true);
-       }
-}
-
-#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
-                       PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
-
-static int marxbot_usbh1_hw_init(struct platform_device *pdev)
-{
-       mxc_iomux_set_gpr(MUX_PGP_USB_SUSPEND, true);
-
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_MISO, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_MOSI, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SS0, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SS1, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SS2, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SCLK, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_CSPI1_SPI_RDY, USB_PAD_CFG);
-       mxc_iomux_set_pad(MX31_PIN_SFS6, USB_PAD_CFG);
-
-       mdelay(10);
-
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED |
-                       MXC_EHCI_INTERFACE_SINGLE_UNI);
-}
-
-#define USBH1_VBUSEN_B IOMUX_TO_GPIO(MX31_PIN_NFRE_B)
-#define USBH1_MODE     IOMUX_TO_GPIO(MX31_PIN_NFALE)
-
-static int marxbot_isp1105_init(struct usb_phy *otg)
-{
-       int ret = gpio_request(USBH1_MODE, "usbh1-mode");
-       if (ret)
-               return ret;
-       /* single ended */
-       gpio_direction_output(USBH1_MODE, 0);
-
-       ret = gpio_request(USBH1_VBUSEN_B, "usbh1-vbusen");
-       if (ret) {
-               gpio_free(USBH1_MODE);
-               return ret;
-       }
-       gpio_direction_output(USBH1_VBUSEN_B, 1);
-
-       return 0;
-}
-
-
-static int marxbot_isp1105_set_vbus(struct usb_otg *otg, bool on)
-{
-       if (on)
-               gpio_set_value(USBH1_VBUSEN_B, 0);
-       else
-               gpio_set_value(USBH1_VBUSEN_B, 1);
-
-       return 0;
-}
-
-static struct mxc_usbh_platform_data usbh1_pdata __initdata = {
-       .init   = marxbot_usbh1_hw_init,
-       .portsc = MXC_EHCI_MODE_UTMI | MXC_EHCI_SERIAL,
-};
-
-static int __init marxbot_usbh1_init(void)
-{
-       struct usb_phy *phy;
-       struct platform_device *pdev;
-
-       phy = kzalloc(sizeof(*phy), GFP_KERNEL);
-       if (!phy)
-               return -ENOMEM;
-
-       phy->otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
-       if (!phy->otg) {
-               kfree(phy);
-               return -ENOMEM;
-       }
-
-       phy->label      = "ISP1105";
-       phy->init       = marxbot_isp1105_init;
-       phy->otg->set_vbus      = marxbot_isp1105_set_vbus;
-
-       usbh1_pdata.otg = phy;
-
-       pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
-
-       return PTR_ERR_OR_ZERO(pdev);
-}
-
-static const struct fsl_usb2_platform_data usb_pdata __initconst = {
-       .operating_mode = FSL_USB2_DR_DEVICE,
-       .phy_mode       = FSL_USB2_PHY_ULPI,
-};
-
-/*
- * system init for baseboard usage. Will be called by mx31moboard init.
- */
-void __init mx31moboard_marxbot_init(void)
-{
-       printk(KERN_INFO "Initializing mx31marxbot peripherals\n");
-
-       mxc_iomux_setup_multiple_pins(marxbot_pins, ARRAY_SIZE(marxbot_pins),
-               "marxbot");
-
-       marxbot_init_sel_gpios();
-
-       dspics_resets_init();
-
-       imx31_add_mxc_mmc(1, &sdhc2_pdata);
-
-       spi_register_board_info(marxbot_spi_board_info,
-               ARRAY_SIZE(marxbot_spi_board_info));
-
-       /* battery present pin */
-       gpio_request(IOMUX_TO_GPIO(MX31_PIN_LCS0), "bat-present");
-       gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0));
-       gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false);
-
-       imx31_add_fsl_usb2_udc(&usb_pdata);
-
-       marxbot_usbh1_init();
-}
diff --git a/arch/arm/mach-imx/mx31moboard-smartbot.c b/arch/arm/mach-imx/mx31moboard-smartbot.c
deleted file mode 100644 (file)
index d165bd9..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
- */
-
-#include <linux/delay.h>
-#include <linux/gpio.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/i2c.h>
-#include <linux/platform_device.h>
-#include <linux/types.h>
-
-#include <linux/usb/otg.h>
-#include <linux/usb/ulpi.h>
-
-#include "board-mx31moboard.h"
-#include "common.h"
-#include "devices-imx31.h"
-#include "ehci.h"
-#include "hardware.h"
-#include "iomux-mx3.h"
-#include "ulpi.h"
-
-static unsigned int smartbot_pins[] = {
-       /* UART1 */
-       MX31_PIN_CTS2__CTS2, MX31_PIN_RTS2__RTS2,
-       MX31_PIN_TXD2__TXD2, MX31_PIN_RXD2__RXD2,
-       /* ENABLES */
-       MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9,
-       MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
-};
-
-static const struct imxuart_platform_data uart_pdata __initconst = {
-       .flags = IMXUART_HAVE_RTSCTS,
-};
-
-static const struct fsl_usb2_platform_data usb_pdata __initconst = {
-       .operating_mode = FSL_USB2_DR_DEVICE,
-       .phy_mode       = FSL_USB2_PHY_ULPI,
-};
-
-#if defined(CONFIG_USB_ULPI)
-
-static int smartbot_otg_init(struct platform_device *pdev)
-{
-       return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
-}
-
-static struct mxc_usbh_platform_data otg_host_pdata __initdata = {
-       .init   = smartbot_otg_init,
-       .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
-};
-
-static int __init smartbot_otg_host_init(void)
-{
-       struct platform_device *pdev;
-
-       otg_host_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
-               ULPI_OTG_DRVVBUS_EXT);
-       if (!otg_host_pdata.otg)
-               return -ENODEV;
-
-       pdev = imx31_add_mxc_ehci_otg(&otg_host_pdata);
-
-       return PTR_ERR_OR_ZERO(pdev);
-}
-#else
-static inline int smartbot_otg_host_init(void) { return 0; }
-#endif
-
-#define POWER_EN IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
-#define DSPIC_RST_B IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
-#define TRSLAT_RST_B IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
-#define TRSLAT_SRC_CHOICE IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)
-
-static void smartbot_resets_init(void)
-{
-       if (!gpio_request(POWER_EN, "power-enable")) {
-               gpio_direction_output(POWER_EN, 0);
-               gpio_export(POWER_EN, false);
-       }
-
-       if (!gpio_request(DSPIC_RST_B, "dspic-rst")) {
-               gpio_direction_output(DSPIC_RST_B, 0);
-               gpio_export(DSPIC_RST_B, false);
-       }
-
-       if (!gpio_request(TRSLAT_RST_B, "translator-rst")) {
-               gpio_direction_output(TRSLAT_RST_B, 0);
-               gpio_export(TRSLAT_RST_B, false);
-       }
-
-       if (!gpio_request(TRSLAT_SRC_CHOICE, "translator-src-choice")) {
-               gpio_direction_output(TRSLAT_SRC_CHOICE, 0);
-               gpio_export(TRSLAT_SRC_CHOICE, false);
-       }
-}
-/*
- * system init for baseboard usage. Will be called by mx31moboard init.
- */
-void __init mx31moboard_smartbot_init(int board)
-{
-       printk(KERN_INFO "Initializing mx31smartbot peripherals\n");
-
-       mxc_iomux_setup_multiple_pins(smartbot_pins, ARRAY_SIZE(smartbot_pins),
-               "smartbot");
-
-       imx31_add_imx_uart1(&uart_pdata);
-
-       switch (board) {
-       case MX31SMARTBOT:
-               imx31_add_fsl_usb2_udc(&usb_pdata);
-               break;
-       case MX31EYEBOT:
-               smartbot_otg_host_init();
-               break;
-       default:
-               printk(KERN_WARNING "Unknown board %d, USB OTG not initialized",
-                       board);
-       }
-
-       smartbot_resets_init();
-}
index 760de6a..5a8a87a 100644 (file)
 #ifndef __MACH_MX35_H__
 #define __MACH_MX35_H__
 
-/*
- * IRAM
- */
-#define MX35_IRAM_BASE_ADDR            0x10000000      /* internal ram */
-#define MX35_IRAM_SIZE                 SZ_128K
-
-#define MX35_L2CC_BASE_ADDR            0x30000000
-#define MX35_L2CC_SIZE                 SZ_1M
-
 #define MX35_AIPS1_BASE_ADDR           0x43f00000
 #define MX35_AIPS1_SIZE                        SZ_1M
-#define MX35_MAX_BASE_ADDR                     (MX35_AIPS1_BASE_ADDR + 0x04000)
-#define MX35_EVTMON_BASE_ADDR                  (MX35_AIPS1_BASE_ADDR + 0x08000)
-#define MX35_CLKCTL_BASE_ADDR                  (MX35_AIPS1_BASE_ADDR + 0x0c000)
-#define MX35_ETB_SLOT4_BASE_ADDR               (MX35_AIPS1_BASE_ADDR + 0x10000)
-#define MX35_ETB_SLOT5_BASE_ADDR               (MX35_AIPS1_BASE_ADDR + 0x14000)
-#define MX35_ECT_CTIO_BASE_ADDR                        (MX35_AIPS1_BASE_ADDR + 0x18000)
-#define MX35_I2C1_BASE_ADDR                    (MX35_AIPS1_BASE_ADDR + 0x80000)
-#define MX35_I2C3_BASE_ADDR                    (MX35_AIPS1_BASE_ADDR + 0x84000)
-#define MX35_UART1_BASE_ADDR                   (MX35_AIPS1_BASE_ADDR + 0x90000)
-#define MX35_UART2_BASE_ADDR                   (MX35_AIPS1_BASE_ADDR + 0x94000)
-#define MX35_I2C2_BASE_ADDR                    (MX35_AIPS1_BASE_ADDR + 0x98000)
-#define MX35_OWIRE_BASE_ADDR                   (MX35_AIPS1_BASE_ADDR + 0x9c000)
-#define MX35_SSI1_BASE_ADDR                    (MX35_AIPS1_BASE_ADDR + 0xa0000)
-#define MX35_CSPI1_BASE_ADDR                   (MX35_AIPS1_BASE_ADDR + 0xa4000)
-#define MX35_KPP_BASE_ADDR                     (MX35_AIPS1_BASE_ADDR + 0xa8000)
-#define MX35_IOMUXC_BASE_ADDR                  (MX35_AIPS1_BASE_ADDR + 0xac000)
-#define MX35_ECT_IP1_BASE_ADDR                 (MX35_AIPS1_BASE_ADDR + 0xb8000)
-#define MX35_ECT_IP2_BASE_ADDR                 (MX35_AIPS1_BASE_ADDR + 0xbc000)
-
 #define MX35_SPBA0_BASE_ADDR           0x50000000
 #define MX35_SPBA0_SIZE                        SZ_1M
-#define MX35_UART3_BASE_ADDR                   (MX35_SPBA0_BASE_ADDR + 0x0c000)
-#define MX35_CSPI2_BASE_ADDR                   (MX35_SPBA0_BASE_ADDR + 0x10000)
-#define MX35_SSI2_BASE_ADDR                    (MX35_SPBA0_BASE_ADDR + 0x14000)
-#define MX35_ATA_BASE_ADDR                     (MX35_SPBA0_BASE_ADDR + 0x20000)
-#define MX35_MSHC1_BASE_ADDR                   (MX35_SPBA0_BASE_ADDR + 0x24000)
-#define MX35_FEC_BASE_ADDR             0x50038000
-#define MX35_SPBA_CTRL_BASE_ADDR               (MX35_SPBA0_BASE_ADDR + 0x3c000)
-
 #define MX35_AIPS2_BASE_ADDR           0x53f00000
 #define MX35_AIPS2_SIZE                        SZ_1M
-#define MX35_CCM_BASE_ADDR                     (MX35_AIPS2_BASE_ADDR + 0x80000)
-#define MX35_GPT1_BASE_ADDR                    (MX35_AIPS2_BASE_ADDR + 0x90000)
-#define MX35_EPIT1_BASE_ADDR                   (MX35_AIPS2_BASE_ADDR + 0x94000)
-#define MX35_EPIT2_BASE_ADDR                   (MX35_AIPS2_BASE_ADDR + 0x98000)
-#define MX35_GPIO3_BASE_ADDR                   (MX35_AIPS2_BASE_ADDR + 0xa4000)
-#define MX35_SCC_BASE_ADDR                     (MX35_AIPS2_BASE_ADDR + 0xac000)
-#define MX35_RNGA_BASE_ADDR                    (MX35_AIPS2_BASE_ADDR + 0xb0000)
-#define MX35_ESDHC1_BASE_ADDR                  (MX35_AIPS2_BASE_ADDR + 0xb4000)
-#define MX35_ESDHC2_BASE_ADDR                  (MX35_AIPS2_BASE_ADDR + 0xb8000)
-#define MX35_ESDHC3_BASE_ADDR                  (MX35_AIPS2_BASE_ADDR + 0xbc000)
-#define MX35_IPU_CTRL_BASE_ADDR                        (MX35_AIPS2_BASE_ADDR + 0xc0000)
-#define MX35_AUDMUX_BASE_ADDR                  (MX35_AIPS2_BASE_ADDR + 0xc4000)
-#define MX35_GPIO1_BASE_ADDR                   (MX35_AIPS2_BASE_ADDR + 0xcc000)
-#define MX35_GPIO2_BASE_ADDR                   (MX35_AIPS2_BASE_ADDR + 0xd0000)
-#define MX35_SDMA_BASE_ADDR                    (MX35_AIPS2_BASE_ADDR + 0xd4000)
-#define MX35_RTC_BASE_ADDR                     (MX35_AIPS2_BASE_ADDR + 0xd8000)
-#define MX35_WDOG_BASE_ADDR                    (MX35_AIPS2_BASE_ADDR + 0xdc000)
-#define MX35_PWM_BASE_ADDR                     (MX35_AIPS2_BASE_ADDR + 0xe0000)
-#define MX35_CAN1_BASE_ADDR                    (MX35_AIPS2_BASE_ADDR + 0xe4000)
-#define MX35_CAN2_BASE_ADDR                    (MX35_AIPS2_BASE_ADDR + 0xe8000)
-#define MX35_RTIC_BASE_ADDR                    (MX35_AIPS2_BASE_ADDR + 0xec000)
-#define MX35_IIM_BASE_ADDR                     (MX35_AIPS2_BASE_ADDR + 0xf0000)
-#define MX35_USB_BASE_ADDR                     (MX35_AIPS2_BASE_ADDR + 0xf4000)
-#define MX35_USB_OTG_BASE_ADDR                 (MX35_USB_BASE_ADDR + 0x0000)
-/*
- * The Reference Manual (IMX35RM, Rev. 2, 3/2009) claims an offset of 0x200 for
- * HS.  When host support was implemented only a preliminary document was
- * available, which told 0x400.  This works fine.
- */
-#define MX35_USB_HS_BASE_ADDR                  (MX35_USB_BASE_ADDR + 0x0400)
-
-#define MX35_ROMP_BASE_ADDR            0x60000000
-#define MX35_ROMP_SIZE                 SZ_1M
-
 #define MX35_AVIC_BASE_ADDR            0x68000000
 #define MX35_AVIC_SIZE                 SZ_1M
-
-/*
- * Memory regions and CS
- */
-#define MX35_IPU_MEM_BASE_ADDR         0x70000000
-#define MX35_CSD0_BASE_ADDR            0x80000000
-#define MX35_CSD1_BASE_ADDR            0x90000000
-
-#define MX35_CS0_BASE_ADDR             0xa0000000
-#define MX35_CS1_BASE_ADDR             0xa8000000
-#define MX35_CS2_BASE_ADDR             0xb0000000
-#define MX35_CS3_BASE_ADDR             0xb2000000
-
-#define MX35_CS4_BASE_ADDR             0xb4000000
-#define MX35_CS4_BASE_ADDR_VIRT                0xf6000000
-#define MX35_CS4_SIZE                  SZ_32M
-
-#define MX35_CS5_BASE_ADDR             0xb6000000
-#define MX35_CS5_BASE_ADDR_VIRT                0xf8000000
-#define MX35_CS5_SIZE                  SZ_32M
-
-/*
- * NAND, SDRAM, WEIM, M3IF, EMI controllers
- */
 #define MX35_X_MEMC_BASE_ADDR          0xb8000000
 #define MX35_X_MEMC_SIZE               SZ_64K
-#define MX35_ESDCTL_BASE_ADDR                  (MX35_X_MEMC_BASE_ADDR + 0x1000)
-#define MX35_WEIM_BASE_ADDR                    (MX35_X_MEMC_BASE_ADDR + 0x2000)
-#define MX35_M3IF_BASE_ADDR                    (MX35_X_MEMC_BASE_ADDR + 0x3000)
-#define MX35_EMI_CTL_BASE_ADDR                 (MX35_X_MEMC_BASE_ADDR + 0x4000)
-#define MX35_PCMCIA_CTL_BASE_ADDR              MX35_EMI_CTL_BASE_ADDR
-
-#define MX35_NFC_BASE_ADDR             0xbb000000
-#define MX35_PCMCIA_MEM_BASE_ADDR      0xbc000000
 
 #define MX35_IO_P2V(x)                 IMX_IO_P2V(x)
-#define MX35_IO_ADDRESS(x)             IOMEM(MX35_IO_P2V(x))
-
-/*
- * Interrupt numbers
- */
-#include <asm/irq.h>
-#define MX35_INT_OWIRE         (NR_IRQS_LEGACY + 2)
-#define MX35_INT_I2C3          (NR_IRQS_LEGACY + 3)
-#define MX35_INT_I2C2          (NR_IRQS_LEGACY + 4)
-#define MX35_INT_RTIC          (NR_IRQS_LEGACY + 6)
-#define MX35_INT_ESDHC1                (NR_IRQS_LEGACY + 7)
-#define MX35_INT_ESDHC2                (NR_IRQS_LEGACY + 8)
-#define MX35_INT_ESDHC3                (NR_IRQS_LEGACY + 9)
-#define MX35_INT_I2C1          (NR_IRQS_LEGACY + 10)
-#define MX35_INT_SSI1          (NR_IRQS_LEGACY + 11)
-#define MX35_INT_SSI2          (NR_IRQS_LEGACY + 12)
-#define MX35_INT_CSPI2         (NR_IRQS_LEGACY + 13)
-#define MX35_INT_CSPI1         (NR_IRQS_LEGACY + 14)
-#define MX35_INT_ATA           (NR_IRQS_LEGACY + 15)
-#define MX35_INT_GPU2D         (NR_IRQS_LEGACY + 16)
-#define MX35_INT_ASRC          (NR_IRQS_LEGACY + 17)
-#define MX35_INT_UART3         (NR_IRQS_LEGACY + 18)
-#define MX35_INT_IIM           (NR_IRQS_LEGACY + 19)
-#define MX35_INT_RNGA          (NR_IRQS_LEGACY + 22)
-#define MX35_INT_EVTMON                (NR_IRQS_LEGACY + 23)
-#define MX35_INT_KPP           (NR_IRQS_LEGACY + 24)
-#define MX35_INT_RTC           (NR_IRQS_LEGACY + 25)
-#define MX35_INT_PWM           (NR_IRQS_LEGACY + 26)
-#define MX35_INT_EPIT2         (NR_IRQS_LEGACY + 27)
-#define MX35_INT_EPIT1         (NR_IRQS_LEGACY + 28)
-#define MX35_INT_GPT           (NR_IRQS_LEGACY + 29)
-#define MX35_INT_POWER_FAIL    (NR_IRQS_LEGACY + 30)
-#define MX35_INT_UART2         (NR_IRQS_LEGACY + 32)
-#define MX35_INT_NFC           (NR_IRQS_LEGACY + 33)
-#define MX35_INT_SDMA          (NR_IRQS_LEGACY + 34)
-#define MX35_INT_USB_HS                (NR_IRQS_LEGACY + 35)
-#define MX35_INT_USB_OTG       (NR_IRQS_LEGACY + 37)
-#define MX35_INT_MSHC1         (NR_IRQS_LEGACY + 39)
-#define MX35_INT_ESAI          (NR_IRQS_LEGACY + 40)
-#define MX35_INT_IPU_ERR       (NR_IRQS_LEGACY + 41)
-#define MX35_INT_IPU_SYN       (NR_IRQS_LEGACY + 42)
-#define MX35_INT_CAN1          (NR_IRQS_LEGACY + 43)
-#define MX35_INT_CAN2          (NR_IRQS_LEGACY + 44)
-#define MX35_INT_UART1         (NR_IRQS_LEGACY + 45)
-#define MX35_INT_MLB           (NR_IRQS_LEGACY + 46)
-#define MX35_INT_SPDIF         (NR_IRQS_LEGACY + 47)
-#define MX35_INT_ECT           (NR_IRQS_LEGACY + 48)
-#define MX35_INT_SCC_SCM       (NR_IRQS_LEGACY + 49)
-#define MX35_INT_SCC_SMN       (NR_IRQS_LEGACY + 50)
-#define MX35_INT_GPIO2         (NR_IRQS_LEGACY + 51)
-#define MX35_INT_GPIO1         (NR_IRQS_LEGACY + 52)
-#define MX35_INT_WDOG          (NR_IRQS_LEGACY + 55)
-#define MX35_INT_GPIO3         (NR_IRQS_LEGACY + 56)
-#define MX35_INT_FEC           (NR_IRQS_LEGACY + 57)
-#define MX35_INT_EXT_POWER     (NR_IRQS_LEGACY + 58)
-#define MX35_INT_EXT_TEMPER    (NR_IRQS_LEGACY + 59)
-#define MX35_INT_EXT_SENSOR60  (NR_IRQS_LEGACY + 60)
-#define MX35_INT_EXT_SENSOR61  (NR_IRQS_LEGACY + 61)
-#define MX35_INT_EXT_WDOG      (NR_IRQS_LEGACY + 62)
-#define MX35_INT_EXT_TV                (NR_IRQS_LEGACY + 63)
-
-#define MX35_DMA_REQ_SSI2_RX1   22
-#define MX35_DMA_REQ_SSI2_TX1   23
-#define MX35_DMA_REQ_SSI2_RX0   24
-#define MX35_DMA_REQ_SSI2_TX0   25
-#define MX35_DMA_REQ_SSI1_RX1   26
-#define MX35_DMA_REQ_SSI1_TX1   27
-#define MX35_DMA_REQ_SSI1_RX0   28
-#define MX35_DMA_REQ_SSI1_TX0   29
-
-#define MX35_PROD_SIGNATURE            0x1     /* For MX31 */
 
 #endif /* ifndef __MACH_MX35_H__ */
diff --git a/arch/arm/mach-imx/pcm037.h b/arch/arm/mach-imx/pcm037.h
deleted file mode 100644 (file)
index 470d3c8..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __PCM037_H__
-#define __PCM037_H__
-
-enum pcm037_board_variant {
-       PCM037_PCM970,
-       PCM037_EET,
-};
-
-extern enum pcm037_board_variant pcm037_variant(void);
-
-#ifdef CONFIG_MACH_PCM037_EET
-int pcm037_eet_init_devices(void);
-#else
-static inline int pcm037_eet_init_devices(void) { return 0; }
-#endif
-
-#endif
index d943535..020e6de 100644 (file)
@@ -7,6 +7,7 @@
  * modify it under the terms of the GNU General Public License.
  */
 
+#include <linux/of_address.h>
 #include <linux/kernel.h>
 #include <linux/suspend.h>
 #include <linux/io.h>
 
 static int mx27_suspend_enter(suspend_state_t state)
 {
+       void __iomem *ccm_base;
+       struct device_node *np;
        u32 cscr;
+
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm");
+       ccm_base = of_iomap(np, 0);
+       BUG_ON(!ccm_base);
+
        switch (state) {
        case PM_SUSPEND_MEM:
                /* Clear MPEN and SPEN to disable MPLL/SPLL */
-               cscr = imx_readl(MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR));
+               cscr = imx_readl(ccm_base);
                cscr &= 0xFFFFFFFC;
-               imx_writel(cscr, MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR));
+               imx_writel(cscr, ccm_base);
                /* Executes WFI */
                cpu_do_idle();
                break;
diff --git a/arch/arm/mach-imx/ulpi.h b/arch/arm/mach-imx/ulpi.h
deleted file mode 100644 (file)
index b367902..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __MACH_ULPI_H
-#define __MACH_ULPI_H
-
-#include <linux/usb/ulpi.h>
-
-#ifdef CONFIG_USB_ULPI_VIEWPORT
-static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
-{
-       return otg_ulpi_create(&ulpi_viewport_access_ops, flags);
-}
-#else
-static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
-{
-       return NULL;
-}
-#endif
-
-#endif /* __MACH_ULPI_H */
-
index 52744fe..576d1ab 100644 (file)
@@ -3,6 +3,7 @@ menuconfig ARCH_MSTARV7
        depends on ARCH_MULTI_V7
        select ARM_GIC
        select ARM_HEAVY_MB
+       select MST_IRQ
        help
          Support for newer MStar/Sigmastar SoC families that are
          based on Armv7 cores like the Cortex A7 and share the same
index 2d962fe..a3a64bf 100644 (file)
@@ -35,13 +35,8 @@ ENTRY(ll_get_coherency_base)
 
        /*
         * MMU is disabled, use the physical address of the coherency
-        * base address. However, if the coherency fabric isn't mapped
-        * (i.e its virtual address is zero), it means coherency is
-        * not enabled, so we return 0.
+        * base address, (or 0x0 if the coherency fabric is not mapped)
         */
-       ldr     r1, =coherency_base
-       cmp     r1, #0
-       beq     2f
        adr     r1, 3f
        ldr     r3, [r1]
        ldr     r1, [r1, r3]
index adfe1f6..3f6dc55 100644 (file)
@@ -88,7 +88,7 @@
  * OMAP730/850 has a slightly different config for the pin mux.
  * - config regs are the OMAP7XX_IO_CONF_x regs (see omap7xx.h) regs and
  *   not the FUNC_MUX_CTRL_x regs from hardware.h
- * - for pull-up/down, only has one enable bit which is is in the same register
+ * - for pull-up/down, only has one enable bit which is in the same register
  *   as mux config
  */
 #define MUX_CFG_7XX(desc, mux_reg, mode_offset, mode,  \
index ea23205..3ee7bdf 100644 (file)
@@ -7,6 +7,7 @@ config ARCH_OMAP2
        depends on ARCH_MULTI_V6
        select ARCH_OMAP2PLUS
        select CPU_V6
+       select PM_GENERIC_DOMAINS if PM
        select SOC_HAS_OMAP2_SDRC
 
 config ARCH_OMAP3
index 5eef093..bf2b5f8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file contains the address info for various AM33XX modules.
  *
- * Copyright (C) 2011 Texas Instruments, Inc. - http://www.ti.com/
+ * Copyright (C) 2011 Texas Instruments, Inc. - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index 334923d..7290f03 100644 (file)
@@ -3,7 +3,7 @@
  * Copyright (C) 2005 Nokia Corporation
  * Author: Paul Mundt <paul.mundt@nokia.com>
  *
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
  *
  * Modified from the original mach-omap/omap2/board-generic.c did by Paul
  * to support the OMAP2+ device tree boards with an unique board file.
index 32c90fd..b4d5144 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX Clock Domain data.
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  * Vaibhav Hiremath <hvaibhav@ti.com>
  *
  * This program is free software; you can redistribute it and/or
index 65fbd13..127dc7a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * TI81XX Clock Domain data.
  *
- * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments, Inc. - https://www.ti.com/
  * Copyright (C) 2013 SKTB SKiT, http://www.skitlab.ru/
  *
  * This program is free software; you can redistribute it and/or
index c0823fd..e7ae2bb 100644 (file)
@@ -4,7 +4,7 @@
  * This file is automatically generated from the AM33XX hardware databases.
  * Vaibhav Hiremath <hvaibhav@ti.com>
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index 44663b5..fc88688 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP54xx Clock Management register bits
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley (paul@pwsan.com)
  * Rajendra Nayak (rnayak@ti.com)
index a78ccba..2725af4 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * DRA7xx Clock Management register bits
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Generated by code originally written by:
  * Paul Walmsley (paul@pwsan.com)
index 7be363a..eb86bbd 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP54xx CM1 instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley (paul@pwsan.com)
  * Rajendra Nayak (rnayak@ti.com)
index 28660ed..aae3831 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * DRA7xx CM1 instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Generated by code originally written by:
  * Paul Walmsley (paul@pwsan.com)
index c5da1f5..8e49765 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP54xx CM2 instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley (paul@pwsan.com)
  * Rajendra Nayak (rnayak@ti.com)
index e16fc58..f873460 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * DRA7xx CM2 instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Generated by code originally written by:
  * Paul Walmsley (paul@pwsan.com)
index 084d454..ac4882e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX CM functions
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  * Vaibhav Hiremath <hvaibhav@ti.com>
  *
  * Reference taken from from OMAP4 cminst44xx.c
index a91f7d2..63b362b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX CM offset macros
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  * Vaibhav Hiremath <hvaibhav@ti.com>
  *
  * This program is free software; you can redistribute it and/or
index 5d73a10..bd91223 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Clock domain register offsets for TI81XX.
  *
- * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments, Inc. - https://www.ti.com/
  * Copyright (C) 2013 SKTB SKiT, http://www.skitlab.ru/
  *
  * This program is free software; you can redistribute it and/or
index 6f5f897..a92d277 100644 (file)
@@ -174,8 +174,10 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
                 */
                if (mpuss_can_lose_context) {
                        error = cpu_cluster_pm_enter();
-                       if (error)
+                       if (error) {
+                               omap_set_pwrdm_state(mpu_pd, PWRDM_POWER_ON);
                                goto cpu_cluster_pm_out;
+                       }
                }
        }
 
index 46012ca..2000fca 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP2plus display device setup / initialization.
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
  *     Senthilvadivu Guruswamy
  *     Sumit Semwal
  *
index 8cc109c..dfc9b21 100644 (file)
@@ -13,7 +13,7 @@
  * Copyright (C) 2009 Texas Instruments
  * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
  * Converted DMA library into platform driver
  *     - G, Manjunath Kondaiah <manjugk@ti.com>
  */
index c2bd8d8..6297c62 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * arch/arm/plat-omap/include/plat/l3_2xxx.h - L3 firewall definitions
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
  *     Sumit Semwal
  */
 #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_L3_2XXX_H
index 995ebcc..60ea7b2 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * arch/arm/plat-omap/include/plat/l3_3xxx.h - L3 firewall definitions
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
  *     Sumit Semwal
  */
 #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_L3_3XXX_H
index 556e69c..418e107 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * arch/arm/plat-omap/include/plat/l4_2xxx.h - L4 firewall definitions
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
  *     Sumit Semwal
  */
 #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_L4_2XXX_H
index bfa5e1b..93c20bb 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP IOMMU quirks for various TI SoCs
  *
- * Copyright (C) 2015-2019 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2015-2019 Texas Instruments Incorporated - https://www.ti.com/
  *      Suman Anna <s-anna@ti.com>
  */
 
index 5f4ab24..e298410 100644 (file)
@@ -26,7 +26,6 @@ extern struct omap_hwmod_ocp_if am33xx_mpu__prcm;
 extern struct omap_hwmod_ocp_if am33xx_l3_s__l3_main;
 extern struct omap_hwmod_ocp_if am33xx_gfx__l3_main;
 extern struct omap_hwmod_ocp_if am33xx_l3_main__gfx;
-extern struct omap_hwmod_ocp_if am33xx_l4_wkup__rtc;
 extern struct omap_hwmod_ocp_if am33xx_l3_s__gpmc;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer2;
 extern struct omap_hwmod_ocp_if am33xx_l3_main__ocmc;
@@ -43,7 +42,6 @@ extern struct omap_hwmod am33xx_ocmcram_hwmod;
 extern struct omap_hwmod am33xx_smartreflex0_hwmod;
 extern struct omap_hwmod am33xx_smartreflex1_hwmod;
 extern struct omap_hwmod am33xx_gpmc_hwmod;
-extern struct omap_hwmod am33xx_rtc_hwmod;
 
 extern struct omap_hwmod_class am33xx_emif_hwmod_class;
 extern struct omap_hwmod_class am33xx_l4_hwmod_class;
index b389d65..ab5146b 100644 (file)
@@ -74,30 +74,6 @@ struct omap_hwmod_ocp_if am33xx_l3_s__l3_main = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* gfx -> l3 main */
-struct omap_hwmod_ocp_if am33xx_gfx__l3_main = {
-       .master         = &am33xx_gfx_hwmod,
-       .slave          = &am33xx_l3_main_hwmod,
-       .clk            = "dpll_core_m4_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l3 main -> gfx */
-struct omap_hwmod_ocp_if am33xx_l3_main__gfx = {
-       .master         = &am33xx_l3_main_hwmod,
-       .slave          = &am33xx_gfx_hwmod,
-       .clk            = "dpll_core_m4_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4 wkup -> rtc */
-struct omap_hwmod_ocp_if am33xx_l4_wkup__rtc = {
-       .master         = &am33xx_l4_wkup_hwmod,
-       .slave          = &am33xx_rtc_hwmod,
-       .clk            = "clkdiv32k_ick",
-       .user           = OCP_USER_MPU,
-};
-
 /* l3s cfg -> gpmc */
 struct omap_hwmod_ocp_if am33xx_l3_s__gpmc = {
        .master         = &am33xx_l3_s_hwmod,
index 4b3cd59..bcc120e 100644 (file)
@@ -26,7 +26,6 @@
 #define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
 #define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
 #define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst))
-#define PRCM_FLAGS(oh, flag) ((oh).prcm.omap4.flags = (flag))
 
 /*
  * 'l3' class
@@ -133,30 +132,6 @@ struct omap_hwmod_class am33xx_wkup_m3_hwmod_class = {
        .name           = "wkup_m3",
 };
 
-/* gfx */
-/* Pseudo hwmod for reset control purpose only */
-static struct omap_hwmod_class am33xx_gfx_hwmod_class = {
-       .name   = "gfx",
-};
-
-static struct omap_hwmod_rst_info am33xx_gfx_resets[] = {
-       { .name = "gfx", .rst_shift = 0, .st_shift = 0},
-};
-
-struct omap_hwmod am33xx_gfx_hwmod = {
-       .name           = "gfx",
-       .class          = &am33xx_gfx_hwmod_class,
-       .clkdm_name     = "gfx_l3_clkdm",
-       .main_clk       = "gfx_fck_div_ck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-       .rst_lines      = am33xx_gfx_resets,
-       .rst_lines_cnt  = ARRAY_SIZE(am33xx_gfx_resets),
-};
-
 /*
  * 'prcm' class
  * power and reset manager (whole prcm infrastructure)
@@ -274,67 +249,24 @@ struct omap_hwmod am33xx_gpmc_hwmod = {
        },
 };
 
-
-/*
- * 'rtc' class
- * rtc subsystem
- */
-static struct omap_hwmod_class_sysconfig am33xx_rtc_sysc = {
-       .rev_offs       = 0x0074,
-       .sysc_offs      = 0x0078,
-       .sysc_flags     = SYSC_HAS_SIDLEMODE,
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO |
-                         SIDLE_SMART | SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type3,
-};
-
-static struct omap_hwmod_class am33xx_rtc_hwmod_class = {
-       .name           = "rtc",
-       .sysc           = &am33xx_rtc_sysc,
-       .unlock         = &omap_hwmod_rtc_unlock,
-       .lock           = &omap_hwmod_rtc_lock,
-};
-
-struct omap_hwmod am33xx_rtc_hwmod = {
-       .name           = "rtc",
-       .class          = &am33xx_rtc_hwmod_class,
-       .clkdm_name     = "l4_rtc_clkdm",
-       .main_clk       = "clk_32768_ck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
 static void omap_hwmod_am33xx_clkctrl(void)
 {
        CLKCTRL(am33xx_smartreflex0_hwmod,
                AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_smartreflex1_hwmod,
                AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET);
-       PRCM_FLAGS(am33xx_rtc_hwmod, HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l4_wkup_hwmod, AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l3_main_hwmod, AM33XX_CM_PER_L3_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_gfx_hwmod, AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_mpu_hwmod , AM33XX_CM_MPU_MPU_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l3_instr_hwmod , AM33XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_ocmcram_hwmod , AM33XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET);
 }
 
-static void omap_hwmod_am33xx_rst(void)
-{
-       RSTCTRL(am33xx_gfx_hwmod, AM33XX_RM_GFX_RSTCTRL_OFFSET);
-       RSTST(am33xx_gfx_hwmod, AM33XX_RM_GFX_RSTST_OFFSET);
-}
-
 void omap_hwmod_am33xx_reg(void)
 {
        omap_hwmod_am33xx_clkctrl();
-       omap_hwmod_am33xx_rst();
 }
 
 static void omap_hwmod_am43xx_clkctrl(void)
@@ -343,25 +275,16 @@ static void omap_hwmod_am43xx_clkctrl(void)
                AM43XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_smartreflex1_hwmod,
                AM43XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_rtc_hwmod, AM43XX_CM_RTC_RTC_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_gpmc_hwmod, AM43XX_CM_PER_GPMC_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l4_ls_hwmod, AM43XX_CM_PER_L4LS_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l4_wkup_hwmod, AM43XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l3_main_hwmod, AM43XX_CM_PER_L3_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_gfx_hwmod, AM43XX_CM_GFX_GFX_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_mpu_hwmod , AM43XX_CM_MPU_MPU_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l3_instr_hwmod , AM43XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_ocmcram_hwmod , AM43XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET);
 }
 
-static void omap_hwmod_am43xx_rst(void)
-{
-       RSTCTRL(am33xx_gfx_hwmod, AM43XX_RM_GFX_RSTCTRL_OFFSET);
-       RSTST(am33xx_gfx_hwmod, AM43XX_RM_GFX_RSTST_OFFSET);
-}
-
 void omap_hwmod_am43xx_reg(void)
 {
        omap_hwmod_am43xx_clkctrl();
-       omap_hwmod_am43xx_rst();
 }
index 3cf9c4c..b232f6c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * omap_hwmod_33xx_data.c: Hardware modules present on the AM33XX chips
  *
- * Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) {2012} Texas Instruments Incorporated - https://www.ti.com/
  *
  * This file is automatically generated from the AM33XX hardware databases.
  * This program is free software; you can redistribute it and/or
@@ -274,16 +274,13 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
        &am33xx_l3_main__l4_hs,
        &am33xx_l3_main__l3_s,
        &am33xx_l3_main__l3_instr,
-       &am33xx_l3_main__gfx,
        &am33xx_l3_s__l3_main,
        &am33xx_wkup_m3__l4_wkup,
-       &am33xx_gfx__l3_main,
        &am33xx_l3_main__debugss,
        &am33xx_l4_wkup__wkup_m3,
        &am33xx_l4_wkup__control,
        &am33xx_l4_wkup__smartreflex0,
        &am33xx_l4_wkup__smartreflex1,
-       &am33xx_l4_wkup__rtc,
        &am33xx_l3_s__gpmc,
        &am33xx_l3_main__ocmc,
        NULL,
index b88d12d..b97cb74 100644 (file)
@@ -143,11 +143,9 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
        &am43xx_l3_main__l4_hs,
        &am33xx_l3_main__l3_s,
        &am33xx_l3_main__l3_instr,
-       &am33xx_l3_main__gfx,
        &am33xx_l3_s__l3_main,
        &am43xx_l3_main__emif,
        &am43xx_wkup_m3__l4_wkup,
-       &am33xx_gfx__l3_main,
        &am43xx_l4_wkup__wkup_m3,
        &am43xx_l4_wkup__control,
        &am43xx_l4_wkup__smartreflex0,
@@ -157,11 +155,6 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
        NULL,
 };
 
-static struct omap_hwmod_ocp_if *am43xx_rtc_hwmod_ocp_ifs[] __initdata = {
-       &am33xx_l4_wkup__rtc,
-       NULL,
-};
-
 int __init am43xx_hwmod_init(void)
 {
        int ret;
@@ -170,8 +163,5 @@ int __init am43xx_hwmod_init(void)
        omap_hwmod_init();
        ret = omap_hwmod_register_links(am43xx_hwmod_ocp_ifs);
 
-       if (!ret && of_machine_is_compatible("ti,am4372"))
-               ret = omap_hwmod_register_links(am43xx_rtc_hwmod_ocp_ifs);
-
        return ret;
 }
index 665ca74..37c5911 100644 (file)
@@ -124,21 +124,6 @@ static struct omap_hwmod_class omap44xx_l4_hwmod_class = {
        .name   = "l4",
 };
 
-/* l4_abe */
-static struct omap_hwmod omap44xx_l4_abe_hwmod = {
-       .name           = "l4_abe",
-       .class          = &omap44xx_l4_hwmod_class,
-       .clkdm_name     = "abe_clkdm",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM1_ABE_L4ABE_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_ABE_AESS_CONTEXT_OFFSET,
-                       .lostcontext_mask = OMAP4430_LOSTMEM_AESSMEM_MASK,
-                       .flags        = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
-               },
-       },
-};
-
 /* l4_cfg */
 static struct omap_hwmod omap44xx_l4_cfg_hwmod = {
        .name           = "l4_cfg",
@@ -771,22 +756,6 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_3 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l3_main_1 -> l4_abe */
-static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l4_abe = {
-       .master         = &omap44xx_l3_main_1_hwmod,
-       .slave          = &omap44xx_l4_abe_hwmod,
-       .clk            = "l3_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* mpu -> l4_abe */
-static struct omap_hwmod_ocp_if omap44xx_mpu__l4_abe = {
-       .master         = &omap44xx_mpu_hwmod,
-       .slave          = &omap44xx_l4_abe_hwmod,
-       .clk            = "ocp_abe_iclk",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l3_main_1 -> l4_cfg */
 static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l4_cfg = {
        .master         = &omap44xx_l3_main_1_hwmod,
@@ -988,8 +957,6 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
        &omap44xx_l3_main_1__l3_main_3,
        &omap44xx_l3_main_2__l3_main_3,
        &omap44xx_l4_cfg__l3_main_3,
-       &omap44xx_l3_main_1__l4_abe,
-       &omap44xx_mpu__l4_abe,
        &omap44xx_l3_main_1__l4_cfg,
        &omap44xx_l3_main_2__l4_per,
        &omap44xx_l4_cfg__l4_wkup,
index 7c38c1b..85b9ab4 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Hardware modules present on the OMAP54xx chips
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley
  * Benoit Cousson
@@ -121,19 +121,6 @@ static struct omap_hwmod_class omap54xx_l4_hwmod_class = {
        .name   = "l4",
 };
 
-/* l4_abe */
-static struct omap_hwmod omap54xx_l4_abe_hwmod = {
-       .name           = "l4_abe",
-       .class          = &omap54xx_l4_hwmod_class,
-       .clkdm_name     = "abe_clkdm",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_ABE_L4_ABE_CLKCTRL_OFFSET,
-                       .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
-               },
-       },
-};
-
 /* l4_cfg */
 static struct omap_hwmod omap54xx_l4_cfg_hwmod = {
        .name           = "l4_cfg",
@@ -395,22 +382,6 @@ static struct omap_hwmod_ocp_if omap54xx_l4_cfg__l3_main_3 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l3_main_1 -> l4_abe */
-static struct omap_hwmod_ocp_if omap54xx_l3_main_1__l4_abe = {
-       .master         = &omap54xx_l3_main_1_hwmod,
-       .slave          = &omap54xx_l4_abe_hwmod,
-       .clk            = "abe_iclk",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* mpu -> l4_abe */
-static struct omap_hwmod_ocp_if omap54xx_mpu__l4_abe = {
-       .master         = &omap54xx_mpu_hwmod,
-       .slave          = &omap54xx_l4_abe_hwmod,
-       .clk            = "abe_iclk",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l3_main_1 -> l4_cfg */
 static struct omap_hwmod_ocp_if omap54xx_l3_main_1__l4_cfg = {
        .master         = &omap54xx_l3_main_1_hwmod,
@@ -478,8 +449,6 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
        &omap54xx_l3_main_1__l3_main_3,
        &omap54xx_l3_main_2__l3_main_3,
        &omap54xx_l4_cfg__l3_main_3,
-       &omap54xx_l3_main_1__l4_abe,
-       &omap54xx_mpu__l4_abe,
        &omap54xx_l3_main_1__l4_cfg,
        &omap54xx_l3_main_2__l4_per,
        &omap54xx_l3_main_1__l4_wkup,
index adb0784..05e163c 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Hardware modules present on the DRA7xx chips
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley
  * Benoit Cousson
@@ -419,41 +419,6 @@ static struct omap_hwmod dra7xx_qspi_hwmod = {
 };
 
 /*
- * 'rtcss' class
- *
- */
-static struct omap_hwmod_class_sysconfig dra7xx_rtcss_sysc = {
-       .rev_offs       = 0x0074,
-       .sysc_offs      = 0x0078,
-       .sysc_flags     = SYSC_HAS_SIDLEMODE,
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type3,
-};
-
-static struct omap_hwmod_class dra7xx_rtcss_hwmod_class = {
-       .name   = "rtcss",
-       .sysc   = &dra7xx_rtcss_sysc,
-       .unlock = &omap_hwmod_rtc_unlock,
-       .lock   = &omap_hwmod_rtc_lock,
-};
-
-/* rtcss */
-static struct omap_hwmod dra7xx_rtcss_hwmod = {
-       .name           = "rtcss",
-       .class          = &dra7xx_rtcss_hwmod_class,
-       .clkdm_name     = "rtc_clkdm",
-       .main_clk       = "sys_32k_ck",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_RTC_RTCSS_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_RTC_RTCSS_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/*
  * 'sata' class
  *
  */
@@ -702,14 +667,6 @@ static struct omap_hwmod_ocp_if dra7xx_l3_main_1__qspi = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_per3 -> rtcss */
-static struct omap_hwmod_ocp_if dra7xx_l4_per3__rtcss = {
-       .master         = &dra7xx_l4_per3_hwmod,
-       .slave          = &dra7xx_rtcss_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l4_cfg -> sata */
 static struct omap_hwmod_ocp_if dra7xx_l4_cfg__sata = {
        .master         = &dra7xx_l4_cfg_hwmod,
@@ -786,7 +743,6 @@ static struct omap_hwmod_ocp_if *dra72x_hwmod_ocp_ifs[] __initdata = {
 };
 
 static struct omap_hwmod_ocp_if *rtc_hwmod_ocp_ifs[] __initdata = {
-       &dra7xx_l4_per3__rtcss,
        NULL,
 };
 
index 50fb699..450ab99 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * DM81xx hwmod data.
  *
- * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments, Inc. - https://www.ti.com/
  * Copyright (C) 2013 SKTB SKiT, http://www.skitlab.ru/
  *
  * This program is free software; you can redistribute it and/or
index 336fdfc..533dd64 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP SoC specific OPP Data helpers
  *
- * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2009-2010 Texas Instruments Incorporated - https://www.ti.com/
  *     Nishanth Menon
  *     Kevin Hilman
  * Copyright (C) 2010 Nokia Corporation.
index d2925e8..6f6a6a6 100644 (file)
@@ -3,7 +3,7 @@
   * This file configures the internal USB PHY in OMAP4430. Used
   * with TWL6030 transceiver and MUSB on OMAP4430.
   *
-  * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
+  * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com
   * Author: Hema HK <hemahk@ti.com>
   */
 
index c2d459f..b610c5f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP3 OPP table definitions.
  *
- * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2009-2010 Texas Instruments Incorporated - https://www.ti.com/
  *     Nishanth Menon
  *     Kevin Hilman
  * Copyright (C) 2010-2011 Nokia Corporation.
index 985aeab..d937c5e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP4 OPP table definitions.
  *
- * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010-2012 Texas Instruments Incorporated - https://www.ti.com/
  *     Nishanth Menon
  *     Kevin Hilman
  *     Thara Gopinath
index fceb1e5..919d35d 100644 (file)
@@ -34,8 +34,6 @@
 #include "prm2xxx_3xxx.h"
 #include "pm.h"
 
-u32 enable_off_mode;
-
 #ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
index 01ec1ba..da829a9 100644 (file)
@@ -28,6 +28,8 @@
 #include "clockdomain.h"
 #include "pm.h"
 
+u32 enable_off_mode;
+
 #ifdef CONFIG_SUSPEND
 /*
  * omap_pm_suspend: points to a function that does the SoC-specific
index 2a883a0..80e84ae 100644 (file)
@@ -49,11 +49,7 @@ static inline int omap4_opp_init(void)
 extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
 extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
 
-#ifdef CONFIG_PM_DEBUG
 extern u32 enable_off_mode;
-#else
-#define enable_off_mode 0
-#endif
 
 #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
 extern void pm_dbg_update_time(struct powerdomain *pwrdm, int prev);
index 58236c7..56f2c0b 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * AM33XX Arch Power Management Routines
  *
- * Copyright (C) 2016-2018 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2016-2018 Texas Instruments Incorporated - https://www.ti.com/
  *     Dave Gerlach
  */
 
@@ -25,7 +25,6 @@
 #include "control.h"
 #include "clockdomain.h"
 #include "iomap.h"
-#include "omap_hwmod.h"
 #include "pm.h"
 #include "powerdomain.h"
 #include "prm33xx.h"
@@ -36,7 +35,6 @@
 static struct powerdomain *cefuse_pwrdm, *gfx_pwrdm, *per_pwrdm, *mpu_pwrdm;
 static struct clockdomain *gfx_l4ls_clkdm;
 static void __iomem *scu_base;
-static struct omap_hwmod *rtc_oh;
 
 static int (*idle_fn)(u32 wfi_flags);
 
@@ -267,13 +265,6 @@ static struct am33xx_pm_sram_addr *amx3_get_sram_addrs(void)
                return NULL;
 }
 
-static void __iomem *am43xx_get_rtc_base_addr(void)
-{
-       rtc_oh = omap_hwmod_lookup("rtc");
-
-       return omap_hwmod_get_mpu_rt_va(rtc_oh);
-}
-
 static void am43xx_save_context(void)
 {
 }
@@ -297,16 +288,6 @@ static void am43xx_restore_context(void)
        writel_relaxed(0x0, AM33XX_L4_WK_IO_ADDRESS(0x44df2e14));
 }
 
-static void am43xx_prepare_rtc_suspend(void)
-{
-       omap_hwmod_enable(rtc_oh);
-}
-
-static void am43xx_prepare_rtc_resume(void)
-{
-       omap_hwmod_idle(rtc_oh);
-}
-
 static struct am33xx_pm_platform_data am33xx_ops = {
        .init = am33xx_suspend_init,
        .deinit = amx3_suspend_deinit,
@@ -317,10 +298,7 @@ static struct am33xx_pm_platform_data am33xx_ops = {
        .get_sram_addrs = amx3_get_sram_addrs,
        .save_context = am33xx_save_context,
        .restore_context = am33xx_restore_context,
-       .prepare_rtc_suspend = am43xx_prepare_rtc_suspend,
-       .prepare_rtc_resume = am43xx_prepare_rtc_resume,
        .check_off_mode_enable = am33xx_check_off_mode_enable,
-       .get_rtc_base_addr = am43xx_get_rtc_base_addr,
 };
 
 static struct am33xx_pm_platform_data am43xx_ops = {
@@ -333,10 +311,7 @@ static struct am33xx_pm_platform_data am43xx_ops = {
        .get_sram_addrs = amx3_get_sram_addrs,
        .save_context = am43xx_save_context,
        .restore_context = am43xx_restore_context,
-       .prepare_rtc_suspend = am43xx_prepare_rtc_suspend,
-       .prepare_rtc_resume = am43xx_prepare_rtc_resume,
        .check_off_mode_enable = am43xx_check_off_mode_enable,
-       .get_rtc_base_addr = am43xx_get_rtc_base_addr,
 };
 
 static struct am33xx_pm_platform_data *am33xx_pm_get_pdata(void)
index f5dfddf..71c1d18 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 #include <linux/omap-gpmc.h>
 
 #include <trace/events/power.h>
@@ -410,7 +411,12 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
        if (!pwrst)
                return -ENOMEM;
        pwrst->pwrdm = pwrdm;
-       pwrst->next_state = PWRDM_POWER_RET;
+
+       if (enable_off_mode)
+               pwrst->next_state = PWRDM_POWER_OFF;
+       else
+               pwrst->next_state = PWRDM_POWER_RET;
+
        list_add(&pwrst->node, &pwrst_list);
 
        if (pwrdm_has_hdwr_sar(pwrdm))
@@ -444,6 +450,22 @@ static void __init pm_errata_configure(void)
        }
 }
 
+static void __init omap3_pm_check_pmic(void)
+{
+       struct device_node *np;
+
+       np = of_find_compatible_node(NULL, NULL, "ti,twl4030-power-idle");
+       if (!np)
+               np = of_find_compatible_node(NULL, NULL, "ti,twl4030-power-idle-osc-off");
+
+       if (np) {
+               of_node_put(np);
+               enable_off_mode = 1;
+       } else {
+               enable_off_mode = 0;
+       }
+}
+
 int __init omap3_pm_init(void)
 {
        struct power_state *pwrst, *tmp;
@@ -477,6 +499,8 @@ int __init omap3_pm_init(void)
                goto err2;
        }
 
+       omap3_pm_check_pmic();
+
        ret = pwrdm_for_each(pwrdms_setup, NULL);
        if (ret) {
                pr_err("Failed to setup powerdomains\n");
index 869adb8..626055e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX Power domain data
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index 7078a61..899da0a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM43x PRCM defines
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com/
  *
  * This file is licensed under the terms of the GNU General Public License
  * version 2.  This program is licensed "as is" without any warranty of any
index 6ef3882..bdbfa07 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP54xx PRCM MPU instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley (paul@pwsan.com)
  * Rajendra Nayak (rnayak@ti.com)
index 33d0013..2e30324 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * DRA7xx PRCM MPU instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Generated by code originally written by:
  * Paul Walmsley (paul@pwsan.com)
index 84feece..7dfdff0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX PRM_XXX register bits
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index d514166..9144cc0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX PRM functions
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index 66302c6..d0b7404 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX PRM instance offset macros
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index ee0f1cc..7329d6f 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP54xx PRM instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley (paul@pwsan.com)
  * Rajendra Nayak (rnayak@ti.com)
index cf99307..e5aee04 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * DRA7xx PRM instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Generated by code originally written by:
  * Paul Walmsley (paul@pwsan.com)
index 810d2b1..cb6f3e6 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP54XX SCRM registers and bitfields
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Benoit Cousson (b-cousson@ti.com)
  *
index dc22124..ac3d0b3 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Low level suspend code for AM33XX SoCs
  *
- * Copyright (C) 2012-2018 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2012-2018 Texas Instruments Incorporated - https://www.ti.com/
  *     Dave Gerlach, Vaibhav Bedia
  */
 
index 90d2907..832c913 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Low level suspend code for AM43XX SoCs
  *
- * Copyright (C) 2013-2018 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2013-2018 Texas Instruments Incorporated - https://www.ti.com/
  *     Dave Gerlach, Vaibhav Bedia
  */
 
index a1e6caf..192b0e7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file contains the address data for various TI81XX modules.
  *
- * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments, Inc. - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index aac274d..e60d76d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Based on voltagedomains44xx_data.c
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  */
 #include <linux/kernel.h>
 #include <linux/err.h>
similarity index 69%
rename from arch/arm/plat-samsung/Kconfig
rename to arch/arm/mach-s3c/Kconfig
index 301e572..25606e6 100644 (file)
@@ -2,12 +2,16 @@
 #
 # Copyright 2009 Simtec Electronics
 
+source "arch/arm/mach-s3c/Kconfig.s3c24xx"
+source "arch/arm/mach-s3c/Kconfig.s3c64xx"
+
 config PLAT_SAMSUNG
        bool
-       depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_EXYNOS || ARCH_S5PV210
+       depends on PLAT_S3C24XX || ARCH_S3C64XX
        default y
        select GENERIC_IRQ_CHIP
        select NO_IOPORT_MAP
+       select SOC_SAMSUNG
        help
          Base platform code for all Samsung SoC based systems
 
@@ -154,7 +158,7 @@ config S3C_DEV_WDT
        bool
        default y if ARCH_S3C24XX
        help
-         Complie in platform device definition for Watchdog Timer
+         Compile in platform device definition for Watchdog Timer
 
 config S3C_DEV_NAND
        bool
@@ -169,7 +173,7 @@ config S3C_DEV_ONENAND
 config S3C_DEV_RTC
        bool
        help
-         Complie in platform device definition for RTC
+         Compile in platform device definition for RTC
 
 config SAMSUNG_DEV_ADC
        bool
@@ -234,54 +238,6 @@ config SAMSUNG_PM_GPIO
          pinctrl-samsung driver.
 endif
 
-comment "Power management"
-
-config SAMSUNG_PM_DEBUG
-       bool "Samsung PM Suspend debug"
-       depends on PM && DEBUG_KERNEL
-       depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
-       depends on DEBUG_EXYNOS_UART || DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART
-       help
-         Say Y here if you want verbose debugging from the PM Suspend and
-         Resume code. See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
-         for more information.
-
-config S3C_PM_DEBUG_LED_SMDK
-       bool "SMDK LED suspend/resume debugging"
-       depends on PM && (MACH_SMDK6410)
-       help
-         Say Y here to enable the use of the SMDK LEDs on the baseboard
-        for debugging of the state of the suspend and resume process.
-
-        Note, this currently only works for S3C64XX based SMDK boards.
-
-config SAMSUNG_PM_CHECK
-       bool "S3C2410 PM Suspend Memory CRC"
-       depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210)
-       select CRC32
-       help
-         Enable the PM code's memory area checksum over sleep. This option
-         will generate CRCs of all blocks of memory, and store them before
-         going to sleep. The blocks are then checked on resume for any
-         errors.
-
-         Note, this can take several seconds depending on memory size
-         and CPU speed.
-
-         See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
-
-config SAMSUNG_PM_CHECK_CHUNKSIZE
-       int "S3C2410 PM Suspend CRC Chunksize (KiB)"
-       depends on PM && SAMSUNG_PM_CHECK
-       default 64
-       help
-         Set the chunksize in Kilobytes of the CRC for checking memory
-         corruption over suspend and resume. A smaller value will mean that
-         the CRC data block will take more memory, but will identify any
-         faults with better precision.
-
-         See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
-
 config SAMSUNG_WAKEMASK
        bool
        depends on PM
@@ -290,19 +246,5 @@ config SAMSUNG_WAKEMASK
          and above. This code allows a set of interrupt to wakeup-mask
          mappings. See <plat/wakeup-mask.h>
 
-config SAMSUNG_WDT_RESET
-       bool
-       help
-         Compile support for system restart by triggering watchdog reset.
-         Used on SoCs that do not provide dedicated reset control.
-
-config DEBUG_S3C_UART
-       depends on PLAT_SAMSUNG
-       int
-       default "0" if DEBUG_S3C_UART0
-       default "1" if DEBUG_S3C_UART1
-       default "2" if DEBUG_S3C_UART2
-       default "3" if DEBUG_S3C_UART3
-
 endmenu
 endif
similarity index 97%
rename from arch/arm/mach-s3c24xx/Kconfig
rename to arch/arm/mach-s3c/Kconfig.s3c24xx
index 7673dde..000e3e2 100644 (file)
@@ -123,11 +123,6 @@ config S3C24XX_PLL
          This also means that the PLL tables for the selected CPU(s) will
          be built which may increase the size of the kernel image.
 
-config S3C_SETUP_CAMIF
-       bool
-       help
-         Compile in common setup code for S3C CAMIF devices
-
 # cpu frequency items common between s3c2410 and s3c2440/s3c2442
 
 config S3C2410_IOTIMING
@@ -137,13 +132,6 @@ config S3C2410_IOTIMING
          Internal node to select io timing code that is common to the s3c2410
          and s3c2440/s3c2442 cpu frequency support.
 
-config S3C2410_CPUFREQ_UTILS
-       bool
-       depends on ARM_S3C24XX_CPUFREQ
-       help
-         Internal node to select timing code that is common to the s3c2410
-         and s3c2440/s3c244 cpu frequency support.
-
 # cpu frequency support common to s3c2412, s3c2413 and s3c2442
 
 config S3C2412_IOTIMING
@@ -468,7 +456,6 @@ config MACH_MINI2440
        select NEW_LEDS
        select S3C_DEV_NAND
        select S3C_DEV_USB_HOST
-       select S3C_SETUP_CAMIF
        help
          Say Y here to select support for the MINI2440. Is a 10cm x 10cm board
          available via various sources. It can come with a 3.5" or 7" touch LCD.
similarity index 98%
rename from arch/arm/mach-s3c64xx/Kconfig
rename to arch/arm/mach-s3c/Kconfig.s3c64xx
index ac3e356..f3fcb57 100644 (file)
@@ -13,15 +13,15 @@ menuconfig ARCH_S3C64XX
        select GPIO_SAMSUNG if ATAGS
        select GPIOLIB
        select HAVE_S3C2410_I2C if I2C
-       select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select HAVE_TCM
        select PLAT_SAMSUNG
        select PM_GENERIC_DOMAINS if PM
        select S3C_DEV_NAND if ATAGS
        select S3C_GPIO_TRACK if ATAGS
+       select S3C2410_WATCHDOG
        select SAMSUNG_ATAGS if ATAGS
        select SAMSUNG_WAKEMASK if PM
-       select SAMSUNG_WDT_RESET
+       select WATCHDOG
        help
          Samsung S3C64XX series based systems
 
@@ -165,7 +165,6 @@ config MACH_SMDK6410
        bool "SMDK6410"
        depends on ATAGS
        select CPU_S3C6410
-       select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select S3C64XX_SETUP_FB_24BPP
        select S3C64XX_SETUP_I2C1
        select S3C64XX_SETUP_IDE
similarity index 62%
rename from arch/arm/plat-samsung/Makefile
rename to arch/arm/mach-s3c/Makefile
index 3db9d2c..54188d1 100644 (file)
@@ -2,9 +2,16 @@
 #
 # Copyright 2009 Simtec Electronics
 
-ccflags-$(CONFIG_ARCH_S3C64XX) := -I$(srctree)/arch/arm/mach-s3c64xx/include
 ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include
 
+ifdef CONFIG_ARCH_S3C24XX
+include $(src)/Makefile.s3c24xx
+endif
+
+ifdef CONFIG_ARCH_S3C64XX
+include $(src)/Makefile.s3c64xx
+endif
+
 # Objects we always build independent of SoC choice
 
 obj-y                          += init.o cpu.o
@@ -24,12 +31,7 @@ obj-$(CONFIG_GPIO_SAMSUNG)     += gpio-samsung.o
 
 # PM support
 
-obj-$(CONFIG_PM_SLEEP)         += pm-common.o
-obj-$(CONFIG_EXYNOS_CPU_SUSPEND) += pm-common.o
-obj-$(CONFIG_SAMSUNG_PM)       += pm.o
+obj-$(CONFIG_SAMSUNG_PM)       += pm.o pm-common.o
 obj-$(CONFIG_SAMSUNG_PM_GPIO)  += pm-gpio.o
-obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o
-obj-$(CONFIG_SAMSUNG_PM_DEBUG) += pm-debug.o
 
 obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o
-obj-$(CONFIG_SAMSUNG_WDT_RESET)        += watchdog-reset.o
similarity index 81%
rename from arch/arm/mach-s3c24xx/Makefile
rename to arch/arm/mach-s3c/Makefile.s3c24xx
index 6692f2d..3483ab3 100644 (file)
@@ -7,7 +7,10 @@
 
 # core
 
-obj-y                          += common.o
+obj-y                          += s3c24xx.o
+obj-y                          += irq-s3c24xx.o
+obj-$(CONFIG_SPI_S3C24XX_FIQ)  += irq-s3c24xx-fiq.o
+obj-$(CONFIG_SPI_S3C24XX_FIQ)  += irq-s3c24xx-fiq-exports.o
 
 obj-$(CONFIG_CPU_S3C2410)      += s3c2410.o
 obj-$(CONFIG_S3C2410_PLL)      += pll-s3c2410.o
@@ -30,12 +33,12 @@ obj-$(CONFIG_CPU_S3C2443)   += s3c2443.o
 
 # PM
 
-obj-$(CONFIG_PM)               += pm.o
-obj-$(CONFIG_PM_SLEEP)         += irq-pm.o sleep.o
+obj-$(CONFIG_PM)               += pm-s3c24xx.o
+obj-$(CONFIG_PM_SLEEP)         += irq-pm-s3c24xx.o sleep-s3c24xx.o
 
 # common code
 
-obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += cpufreq-utils.o
+obj-$(CONFIG_ARM_S3C24XX_CPUFREQ) += cpufreq-utils-s3c24xx.o
 
 obj-$(CONFIG_S3C2410_IOTIMING) += iotiming-s3c2410.o
 obj-$(CONFIG_S3C2412_IOTIMING) += iotiming-s3c2412.o
@@ -80,7 +83,7 @@ obj-$(CONFIG_MACH_SMDK2443)           += mach-smdk2443.o
 
 # common bits of machine support
 
-obj-$(CONFIG_S3C24XX_SMDK)             += common-smdk.o
+obj-$(CONFIG_S3C24XX_SMDK)             += common-smdk-s3c24xx.o
 obj-$(CONFIG_S3C24XX_SIMTEC_AUDIO)     += simtec-audio.o
 obj-$(CONFIG_S3C24XX_SIMTEC_NOR)       += simtec-nor.o
 obj-$(CONFIG_S3C24XX_SIMTEC_PM)                += simtec-pm.o
@@ -93,8 +96,7 @@ obj-$(CONFIG_MACH_OSIRIS_DVS)         += mach-osiris-dvs.o
 
 # device setup
 
-obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
-obj-$(CONFIG_S3C2443_SETUP_SPI)                += setup-spi.o
-obj-$(CONFIG_ARCH_S3C24XX)             += setup-i2c.o
-obj-$(CONFIG_S3C24XX_SETUP_TS)         += setup-ts.o
-obj-$(CONFIG_S3C_SETUP_CAMIF)          += setup-camif.o
+obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio-s3c24xx.o
+obj-$(CONFIG_S3C2443_SETUP_SPI)                += setup-spi-s3c24xx.o
+obj-$(CONFIG_ARCH_S3C24XX)             += setup-i2c-s3c24xx.o
+obj-$(CONFIG_S3C24XX_SETUP_TS)         += setup-ts-s3c24xx.o
similarity index 56%
rename from arch/arm/mach-s3c64xx/Makefile
rename to arch/arm/mach-s3c/Makefile.s3c64xx
index 8caeb4a..0c18e31 100644 (file)
@@ -3,22 +3,22 @@
 # Copyright 2008 Openmoko, Inc.
 # Copyright 2008 Simtec Electronics
 
-ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
-asflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
+ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
+asflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
 
 # PM
 
-obj-$(CONFIG_PM)               += pm.o
-obj-$(CONFIG_PM_SLEEP)         += sleep.o
-obj-$(CONFIG_CPU_IDLE)         += cpuidle.o
+obj-$(CONFIG_PM)               += pm-s3c64xx.o
+obj-$(CONFIG_PM_SLEEP)         += sleep-s3c64xx.o
+obj-$(CONFIG_CPU_IDLE)         += cpuidle-s3c64xx.o
 
 ifdef CONFIG_SAMSUNG_ATAGS
 
-obj-$(CONFIG_PM_SLEEP)          += irq-pm.o
+obj-$(CONFIG_PM_SLEEP)          += irq-pm-s3c64xx.o
 
 # Core
 
-obj-y                          += common.o
+obj-y                          += s3c64xx.o
 obj-$(CONFIG_CPU_S3C6400)      += s3c6400.o
 obj-$(CONFIG_CPU_S3C6410)      += s3c6410.o
 
@@ -28,21 +28,21 @@ obj-$(CONFIG_S3C64XX_PL080) += pl080.o
 
 # Device support
 
-obj-y                          += dev-uart.o
-obj-y                          += dev-audio.o
+obj-y                          += dev-uart-s3c64xx.o
+obj-y                          += dev-audio-s3c64xx.o
 
 # Device setup
 
-obj-$(CONFIG_S3C64XX_SETUP_FB_24BPP)   += setup-fb-24bpp.o
-obj-$(CONFIG_S3C64XX_SETUP_I2C0)       += setup-i2c0.o
-obj-$(CONFIG_S3C64XX_SETUP_I2C1)       += setup-i2c1.o
-obj-$(CONFIG_S3C64XX_SETUP_IDE)                += setup-ide.o
-obj-$(CONFIG_S3C64XX_SETUP_KEYPAD)     += setup-keypad.o
-obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
-obj-$(CONFIG_S3C64XX_SETUP_SPI)                += setup-spi.o
-obj-$(CONFIG_S3C64XX_SETUP_USB_PHY) += setup-usb-phy.o
+obj-$(CONFIG_S3C64XX_SETUP_FB_24BPP)   += setup-fb-24bpp-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_I2C0)       += setup-i2c0-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_I2C1)       += setup-i2c1-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_IDE)                += setup-ide-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_KEYPAD)     += setup-keypad-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_SPI)                += setup-spi-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_USB_PHY) += setup-usb-phy-s3c64xx.o
 
-obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT)    += dev-backlight.o
+obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT)    += dev-backlight-s3c64xx.o
 
 # Machine support
 
similarity index 99%
rename from arch/arm/plat-samsung/adc.c
rename to arch/arm/mach-s3c/adc.c
index 55b1925..0232520 100644 (file)
@@ -19,8 +19,8 @@
 #include <linux/io.h>
 #include <linux/regulator/consumer.h>
 
-#include <plat/regs-adc.h>
-#include <plat/adc.h>
+#include "regs-adc.h"
+#include <linux/soc/samsung/s3c-adc.h>
 
 /* This driver is designed to control the usage of the ADC block between
  * the touchscreen and any other drivers that may need to use it, such as
similarity index 78%
rename from arch/arm/mach-s3c64xx/ata-core.h
rename to arch/arm/mach-s3c/ata-core-s3c64xx.h
index 6d9a81f..4863ad9 100644 (file)
@@ -6,8 +6,8 @@
  * Samsung CF-ATA Controller core functions
  */
 
-#ifndef __ASM_PLAT_ATA_CORE_H
-#define __ASM_PLAT_ATA_CORE_H __FILE__
+#ifndef __ASM_PLAT_ATA_CORE_S3C64XX_H
+#define __ASM_PLAT_ATA_CORE_S3C64XX_H __FILE__
 
 /* These functions are only for use with the core support code, such as
  * the cpu specific initialisation code
@@ -21,4 +21,4 @@ static inline void s3c_cfcon_setname(char *name)
 #endif
 }
 
-#endif /* __ASM_PLAT_ATA_CORE_H */
+#endif /* __ASM_PLAT_ATA_CORE_S3C64XX_H */
similarity index 78%
rename from arch/arm/mach-s3c64xx/backlight.h
rename to arch/arm/mach-s3c/backlight-s3c64xx.h
index 028663f..2a2b358 100644 (file)
@@ -4,8 +4,8 @@
  *              http://www.samsung.com
  */
 
-#ifndef __ASM_PLAT_BACKLIGHT_H
-#define __ASM_PLAT_BACKLIGHT_H __FILE__
+#ifndef __ASM_PLAT_BACKLIGHT_S3C64XX_H
+#define __ASM_PLAT_BACKLIGHT_S3C64XX_H __FILE__
 
 /* samsung_bl_gpio_info - GPIO info for PWM Backlight control
  * @no:                GPIO number for PWM timer out
@@ -19,4 +19,4 @@ struct samsung_bl_gpio_info {
 extern void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
        struct platform_pwm_backlight_data *bl_data);
 
-#endif /* __ASM_PLAT_BACKLIGHT_H */
+#endif /* __ASM_PLAT_BACKLIGHT_S3C64XX_H */
similarity index 97%
rename from arch/arm/mach-s3c24xx/bast-ide.c
rename to arch/arm/mach-s3c/bast-ide.c
index 0679443..da64db1 100644 (file)
@@ -19,7 +19,8 @@
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/map.h>
+#include "map.h"
+#include <mach/irqs.h>
 
 #include "bast.h"
 
similarity index 95%
rename from arch/arm/mach-s3c24xx/bast-irq.c
rename to arch/arm/mach-s3c/bast-irq.c
index 0372805..d299f12 100644 (file)
@@ -15,8 +15,8 @@
 #include <asm/mach-types.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
-#include <mach/regs-irq.h>
+#include "regs-irq.h"
+#include <mach/irqs.h>
 
 #include "bast.h"
 
@@ -62,7 +62,7 @@ bast_pc104_mask(struct irq_data *data)
 static void
 bast_pc104_maskack(struct irq_data *data)
 {
-       struct irq_desc *desc = irq_desc + BAST_IRQ_ISA;
+       struct irq_desc *desc = irq_to_desc(BAST_IRQ_ISA);
 
        bast_pc104_mask(data);
        desc->irq_data.chip->irq_ack(&desc->irq_data);
@@ -94,8 +94,6 @@ static void bast_irq_pc104_demux(struct irq_desc *desc)
 
        if (unlikely(stat == 0)) {
                /* ack if we get an irq with nothing (ie, startup) */
-
-               desc = irq_desc + BAST_IRQ_ISA;
                desc->irq_data.chip->irq_ack(&desc->irq_data);
        } else {
                /* handle the IRQ */
similarity index 96%
rename from arch/arm/mach-s3c24xx/common-smdk.c
rename to arch/arm/mach-s3c/common-smdk-s3c24xx.c
index 121646a..f860d8b 100644 (file)
 #include <asm/mach/irq.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 #include <linux/platform_data/leds-s3c24xx.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
+#include "gpio-cfg.h"
+#include "devs.h"
+#include "pm.h"
 
-#include "common-smdk.h"
+#include "common-smdk-s3c24xx.h"
 
 /* LED devices */
 
similarity index 62%
rename from arch/arm/plat-samsung/cpu.c
rename to arch/arm/mach-s3c/cpu.c
index e1ba88b..6e97725 100644 (file)
 #include <linux/init.h>
 #include <linux/io.h>
 
-#include <plat/map-base.h>
-#include <plat/cpu.h>
+#include <mach/map-base.h>
+#include "cpu.h"
 
 unsigned long samsung_cpu_id;
-static unsigned int samsung_cpu_rev;
-
-unsigned int samsung_rev(void)
-{
-       return samsung_cpu_rev;
-}
-EXPORT_SYMBOL(samsung_rev);
 
 void __init s3c64xx_init_cpu(void)
 {
@@ -34,15 +27,5 @@ void __init s3c64xx_init_cpu(void)
                samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0xA1C);
        }
 
-       samsung_cpu_rev = 0;
-
-       pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id);
-}
-
-void __init s5p_init_cpu(const void __iomem *cpuid_addr)
-{
-       samsung_cpu_id = readl_relaxed(cpuid_addr);
-       samsung_cpu_rev = samsung_cpu_id & 0xFF;
-
        pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id);
 }
similarity index 89%
rename from arch/arm/plat-samsung/include/plat/cpu.h
rename to arch/arm/mach-s3c/cpu.h
index fadcddb..20ff98d 100644 (file)
@@ -109,9 +109,6 @@ extern void s3c_init_cpu(unsigned long idcode,
 extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
 
 extern void s3c64xx_init_cpu(void);
-extern void s5p_init_cpu(const void __iomem *cpuid_addr);
-
-extern unsigned int samsung_rev(void);
 
 extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
 
@@ -126,15 +123,6 @@ extern struct syscore_ops s3c2412_pm_syscore_ops;
 extern struct syscore_ops s3c2416_pm_syscore_ops;
 extern struct syscore_ops s3c244x_pm_syscore_ops;
 
-/* system device subsystems */
-
-extern struct bus_type s3c2410_subsys;
-extern struct bus_type s3c2410a_subsys;
-extern struct bus_type s3c2412_subsys;
-extern struct bus_type s3c2416_subsys;
-extern struct bus_type s3c2440_subsys;
-extern struct bus_type s3c2442_subsys;
-extern struct bus_type s3c2443_subsys;
 extern struct bus_type s3c6410_subsys;
 
 #endif
similarity index 68%
rename from arch/arm/mach-s3c24xx/cpufreq-utils.c
rename to arch/arm/mach-s3c/cpufreq-utils-s3c24xx.c
index 1a7f38d..c1784d8 100644 (file)
 #include <linux/io.h>
 #include <linux/clk.h>
 
-#include <mach/map.h>
-#include <mach/regs-clock.h>
+#include "map.h"
+#include "regs-clock.h"
 
-#include <plat/cpu-freq-core.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
 
-#include "regs-mem.h"
+#include "regs-mem-s3c24xx.h"
 
 /**
  * s3c2410_cpufreq_setrefresh - set SDRAM refresh value
@@ -60,3 +60,35 @@ void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg)
        if (!IS_ERR(cfg->mpll))
                clk_set_rate(cfg->mpll, cfg->pll.frequency);
 }
+
+#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
+u32 s3c2440_read_camdivn(void)
+{
+       return __raw_readl(S3C2440_CAMDIVN);
+}
+
+void s3c2440_write_camdivn(u32 camdiv)
+{
+       __raw_writel(camdiv, S3C2440_CAMDIVN);
+}
+#endif
+
+u32 s3c24xx_read_clkdivn(void)
+{
+       return __raw_readl(S3C2410_CLKDIVN);
+}
+
+void s3c24xx_write_clkdivn(u32 clkdiv)
+{
+       __raw_writel(clkdiv, S3C2410_CLKDIVN);
+}
+
+u32 s3c24xx_read_mpllcon(void)
+{
+       return __raw_readl(S3C2410_MPLLCON);
+}
+
+void s3c24xx_write_locktime(u32 locktime)
+{
+       return __raw_writel(locktime, S3C2410_LOCKTIME);
+}
similarity index 92%
rename from arch/arm/mach-s3c64xx/cpuidle.c
rename to arch/arm/mach-s3c/cpuidle-s3c64xx.c
index 0bac6f6..b1c5f43 100644 (file)
 
 #include <asm/cpuidle.h>
 
-#include <plat/cpu.h>
-#include <mach/map.h>
+#include "cpu.h"
+#include "map.h"
 
-#include "regs-sys.h"
-#include "regs-syscon-power.h"
+#include "regs-sys-s3c64xx.h"
+#include "regs-syscon-power-s3c64xx.h"
 
 static int s3c64xx_enter_idle(struct cpuidle_device *dev,
                              struct cpuidle_driver *drv,
similarity index 95%
rename from arch/arm/mach-s3c64xx/crag6410.h
rename to arch/arm/mach-s3c/crag6410.h
index 00d9aa1..f39ea2c 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef MACH_CRAG6410_H
 #define MACH_CRAG6410_H
 
-#include <mach/gpio-samsung.h>
+#include "gpio-samsung.h"
 
 #define GLENFARCLAS_PMIC_IRQ_BASE      IRQ_BOARD_START
 #define BANFF_PMIC_IRQ_BASE            (IRQ_BOARD_START + 64)
similarity index 97%
rename from arch/arm/mach-s3c64xx/dev-audio.c
rename to arch/arm/mach-s3c/dev-audio-s3c64xx.c
index e3c49b5..fc2f077 100644 (file)
 #include <linux/export.h>
 
 #include <mach/irqs.h>
-#include <mach/map.h>
-#include <mach/dma.h>
+#include "map.h"
 
-#include <plat/devs.h>
+#include "devs.h"
 #include <linux/platform_data/asoc-s3c.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
 
 static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev)
 {
similarity index 98%
rename from arch/arm/mach-s3c64xx/dev-backlight.c
rename to arch/arm/mach-s3c/dev-backlight-s3c64xx.c
index 09e6da3..65488b6 100644 (file)
 #include <linux/io.h>
 #include <linux/pwm_backlight.h>
 
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
+#include "devs.h"
+#include "gpio-cfg.h"
 
-#include "backlight.h"
+#include "backlight-s3c64xx.h"
 
 struct samsung_bl_drvdata {
        struct platform_pwm_backlight_data plat_data;
similarity index 95%
rename from arch/arm/mach-s3c64xx/dev-uart.c
rename to arch/arm/mach-s3c/dev-uart-s3c64xx.c
index 5fb59ad..8288e8d 100644 (file)
 
 #include <asm/mach/arch.h>
 #include <asm/mach/irq.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
+#include "map.h"
 #include <mach/irqs.h>
 
-#include <plat/devs.h>
+#include "devs.h"
 
 /* Serial port registrations */
 
similarity index 97%
rename from arch/arm/plat-samsung/dev-uart.c
rename to arch/arm/mach-s3c/dev-uart.c
index 7476a5d..3d1f7f2 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 
-#include <plat/devs.h>
+#include "devs.h"
 
 /* uart devices */
 
similarity index 96%
rename from arch/arm/plat-samsung/devs.c
rename to arch/arm/mach-s3c/devs.c
index 089a176..06dec64 100644 (file)
@@ -5,6 +5,7 @@
 //
 // Base Samsung platform device definitions
 
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/dma.h>
 #include <mach/irqs.h>
-#include <mach/map.h>
+#include "map.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/adc.h>
+#ifdef CONFIG_PLAT_S3C24XX
+#include "regs-s3c2443-clock.h"
+#endif /* CONFIG_PLAT_S3C24XX */
+
+#include "cpu.h"
+#include "devs.h"
+#include <linux/soc/samsung/s3c-adc.h>
 #include <linux/platform_data/ata-samsung_cf.h>
-#include <plat/fb.h>
-#include <plat/fb-s3c2410.h>
+#include "fb.h"
+#include <linux/platform_data/fb-s3c2410.h>
 #include <linux/platform_data/hwmon-s3c.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/keypad.h>
+#include "keypad.h"
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <plat/pwm-core.h>
-#include <plat/sdhci.h>
+#include "pwm-core.h"
+#include "sdhci.h"
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/usb-ohci-s3c2410.h>
-#include <plat/usb-phy.h>
-#include <plat/regs-spi.h>
+#include "usb-phy.h"
 #include <linux/platform_data/asoc-s3c.h>
 #include <linux/platform_data/spi-s3c64xx.h>
 
@@ -833,16 +838,42 @@ struct platform_device s3c_device_rtc = {
 /* SDI */
 
 #ifdef CONFIG_PLAT_S3C24XX
+void s3c24xx_mci_def_set_power(unsigned char power_mode, unsigned short vdd)
+{
+       switch (power_mode) {
+       case MMC_POWER_ON:
+       case MMC_POWER_UP:
+               /* Configure GPE5...GPE10 pins in SD mode */
+               s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2),
+                                     S3C_GPIO_PULL_NONE);
+               break;
+
+       case MMC_POWER_OFF:
+       default:
+               gpio_direction_output(S3C2410_GPE(5), 0);
+               break;
+       }
+}
+
 static struct resource s3c_sdi_resource[] = {
        [0] = DEFINE_RES_MEM(S3C24XX_PA_SDI, S3C24XX_SZ_SDI),
        [1] = DEFINE_RES_IRQ(IRQ_SDI),
 };
 
+static struct s3c24xx_mci_pdata s3cmci_def_pdata = {
+       /* This is currently here to avoid a number of if (host->pdata)
+        * checks. Any zero fields to ensure reasonable defaults are picked. */
+       .no_wprotect = 1,
+       .no_detect = 1,
+       .set_power = s3c24xx_mci_def_set_power,
+};
+
 struct platform_device s3c_device_sdi = {
        .name           = "s3c2410-sdi",
        .id             = -1,
        .num_resources  = ARRAY_SIZE(s3c_sdi_resource),
        .resource       = s3c_sdi_resource,
+       .dev.platform_data = &s3cmci_def_pdata,
 };
 
 void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
@@ -1038,6 +1069,8 @@ struct platform_device s3c_device_usb_hsudc = {
 void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
 {
        s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc);
+       pd->phy_init = s3c_hsudc_init_phy;
+       pd->phy_uninit = s3c_hsudc_uninit_phy;
 }
 #endif /* CONFIG_PLAT_S3C24XX */
 
diff --git a/arch/arm/mach-s3c/dma.h b/arch/arm/mach-s3c/dma.h
new file mode 100644 (file)
index 0000000..59a4578
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "dma-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "dma-s3c64xx.h"
+#endif
similarity index 78%
rename from arch/arm/mach-s3c24xx/fb-core.h
rename to arch/arm/mach-s3c/fb-core-s3c24xx.h
index 1821e82..0e07f3b 100644 (file)
@@ -5,8 +5,8 @@
  *
  * Samsung framebuffer driver core functions
  */
-#ifndef __ASM_PLAT_FB_CORE_H
-#define __ASM_PLAT_FB_CORE_H __FILE__
+#ifndef __ASM_PLAT_FB_CORE_S3C24XX_H
+#define __ASM_PLAT_FB_CORE_S3C24XX_H __FILE__
 
 /*
  * These functions are only for use with the core support code, such as
@@ -21,4 +21,4 @@ static inline void s3c_fb_setname(char *name)
 #endif
 }
 
-#endif /* __ASM_PLAT_FB_CORE_H */
+#endif /* __ASM_PLAT_FB_CORE_S3C24XX_H */
similarity index 99%
rename from arch/arm/plat-samsung/include/plat/gpio-core.h
rename to arch/arm/mach-s3c/gpio-core.h
index c0bfceb..b361c8c 100644 (file)
@@ -11,7 +11,7 @@
 #define __PLAT_SAMSUNG_GPIO_CORE_H
 
 /* Bring in machine-local definitions, especially S3C_GPIO_END */
-#include <mach/gpio-samsung.h>
+#include "gpio-samsung.h"
 #include <linux/gpio/driver.h>
 
 #define GPIOCON_OFF    (0x00)
similarity index 99%
rename from arch/arm/mach-s3c24xx/include/mach/gpio-samsung.h
rename to arch/arm/mach-s3c/gpio-samsung-s3c24xx.h
index 2ad22b2..c29fdc9 100644 (file)
@@ -14,6 +14,8 @@
 #ifndef GPIO_SAMSUNG_S3C24XX_H
 #define GPIO_SAMSUNG_S3C24XX_H
 
+#include "map.h"
+
 /*
  * GPIO sizes for various SoCs:
  *
similarity index 99%
rename from arch/arm/plat-samsung/gpio-samsung.c
rename to arch/arm/mach-s3c/gpio-samsung.c
index 8955fd6..76ef415 100644 (file)
 #include <asm/irq.h>
 
 #include <mach/irqs.h>
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/gpio-core.h>
-#include <plat/gpio-cfg.h>
-#include <plat/gpio-cfg-helpers.h>
-#include <plat/pm.h>
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include "gpio-core.h"
+#include "gpio-cfg.h"
+#include "gpio-cfg-helpers.h"
+#include "pm.h"
 
 int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,
                                unsigned int off, samsung_gpio_pull_t pull)
diff --git a/arch/arm/mach-s3c/gpio-samsung.h b/arch/arm/mach-s3c/gpio-samsung.h
new file mode 100644 (file)
index 0000000..02f6f4a
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "gpio-samsung-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "gpio-samsung-s3c64xx.h"
+#endif
similarity index 94%
rename from arch/arm/mach-s3c24xx/gta02.h
rename to arch/arm/mach-s3c/gta02.h
index d5610ba..043ae38 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef __MACH_S3C24XX_GTA02_H
 #define __MACH_S3C24XX_GTA02_H __FILE__
 
-#include <mach/regs-gpio.h>
+#include "regs-gpio.h"
 
 #define GTA02_GPIO_AUX_LED     S3C2410_GPB(2)
 #define GTA02_GPIO_USB_PULLUP  S3C2410_GPB(9)
similarity index 96%
rename from arch/arm/mach-s3c24xx/h1940-bluetooth.c
rename to arch/arm/mach-s3c/h1940-bluetooth.c
index 186b532..59edcf8 100644 (file)
 #include <linux/gpio.h>
 #include <linux/rfkill.h>
 
-#include <plat/gpio-cfg.h>
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+#include "gpio-cfg.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 
 #include "h1940.h"
 
similarity index 54%
rename from arch/arm/mach-s3c24xx/include/mach/hardware.h
rename to arch/arm/mach-s3c/hardware-s3c24xx.h
index f28ac6c..33b3746 100644 (file)
@@ -6,16 +6,9 @@
  * S3C2410 - hardware
  */
 
-#ifndef __ASM_ARCH_HARDWARE_H
-#define __ASM_ARCH_HARDWARE_H
-
-#ifndef __ASSEMBLY__
+#ifndef __ASM_ARCH_HARDWARE_S3C24XX_H
+#define __ASM_ARCH_HARDWARE_S3C24XX_H
 
 extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg);
 
-#endif /* __ASSEMBLY__ */
-
-#include <linux/sizes.h>
-#include <mach/map.h>
-
-#endif /* __ASM_ARCH_HARDWARE_H */
+#endif /* __ASM_ARCH_HARDWARE_S3C24XX_H */
diff --git a/arch/arm/mach-s3c/include/mach/io-s3c24xx.h b/arch/arm/mach-s3c/include/mach/io-s3c24xx.h
new file mode 100644 (file)
index 0000000..738b775
--- /dev/null
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * arch/arm/mach-s3c2410/include/mach/io.h
+ *  from arch/arm/mach-rpc/include/mach/io.h
+ *
+ * Copyright (C) 1997 Russell King
+ *          (C) 2003 Simtec Electronics
+*/
+
+#ifndef __ASM_ARM_ARCH_IO_S3C24XX_H
+#define __ASM_ARM_ARCH_IO_S3C24XX_H
+
+#include <mach/map-base.h>
+
+/*
+ * ISA style IO, for each machine to sort out mappings for,
+ * if it implements it. We reserve two 16M regions for ISA,
+ * so the PC/104 can use separate addresses for 8-bit and
+ * 16-bit port I/O.
+ */
+#define PCIO_BASE              S3C_ADDR(0x02000000)
+#define IO_SPACE_LIMIT         0x00ffffff
+#define S3C24XX_VA_ISA_WORD    (PCIO_BASE)
+#define S3C24XX_VA_ISA_BYTE    (PCIO_BASE + 0x01000000)
+
+#ifdef CONFIG_ISA
+
+#define inb(p)         readb(S3C24XX_VA_ISA_BYTE + (p))
+#define inw(p)         readw(S3C24XX_VA_ISA_WORD + (p))
+#define inl(p)         readl(S3C24XX_VA_ISA_WORD + (p))
+
+#define outb(v,p)      writeb((v), S3C24XX_VA_ISA_BYTE + (p))
+#define outw(v,p)      writew((v), S3C24XX_VA_ISA_WORD + (p))
+#define outl(v,p)      writel((v), S3C24XX_VA_ISA_WORD + (p))
+
+#define insb(p,d,l)    readsb(S3C24XX_VA_ISA_BYTE + (p),d,l)
+#define insw(p,d,l)    readsw(S3C24XX_VA_ISA_WORD + (p),d,l)
+#define insl(p,d,l)    readsl(S3C24XX_VA_ISA_WORD + (p),d,l)
+
+#define outsb(p,d,l)   writesb(S3C24XX_VA_ISA_BYTE + (p),d,l)
+#define outsw(p,d,l)   writesw(S3C24XX_VA_ISA_WORD + (p),d,l)
+#define outsl(p,d,l)   writesl(S3C24XX_VA_ISA_WORD + (p),d,l)
+
+#else
+
+#define __io(x) (PCIO_BASE + (x))
+
+#endif
+
+#endif
diff --git a/arch/arm/mach-s3c/include/mach/io.h b/arch/arm/mach-s3c/include/mach/io.h
new file mode 100644 (file)
index 0000000..30a0135
--- /dev/null
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2020 Krzysztof Kozlowski <krzk@kernel.org>
+ */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "io-s3c24xx.h"
+#endif
diff --git a/arch/arm/mach-s3c/include/mach/irqs.h b/arch/arm/mach-s3c/include/mach/irqs.h
new file mode 100644 (file)
index 0000000..0bff1c1
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "irqs-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "irqs-s3c64xx.h"
+#endif
similarity index 98%
rename from arch/arm/plat-samsung/init.c
rename to arch/arm/mach-s3c/init.c
index e9acf02..9d92f03 100644 (file)
@@ -23,8 +23,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
+#include "cpu.h"
+#include "devs.h"
 
 static struct cpu_table *cpu;
 
similarity index 97%
rename from arch/arm/mach-s3c24xx/iotiming-s3c2410.c
rename to arch/arm/mach-s3c/iotiming-s3c2410.c
index 9f90aaf..28d9f47 100644 (file)
 #include <linux/io.h>
 #include <linux/slab.h>
 
-#include <mach/map.h>
-#include <mach/regs-clock.h>
+#include "map.h"
+#include "regs-clock.h"
 
-#include <plat/cpu-freq-core.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
 
-#include "regs-mem.h"
+#include "regs-mem-s3c24xx.h"
 
 #define print_ns(x) ((x) / 10), ((x) % 10)
 
@@ -129,7 +129,7 @@ static unsigned int calc_0124(unsigned int cyc, unsigned long hclk_tns,
        return 0;
 }
 
-int calc_tacp(unsigned int cyc, unsigned long hclk, unsigned long *v)
+static int calc_tacp(unsigned int cyc, unsigned long hclk, unsigned long *v)
 {
        /* Currently no support for Tacp calculations. */
        return 0;
@@ -288,8 +288,8 @@ static unsigned int get_0124(unsigned long hclk_tns,
  * Given the BANKCON setting in @bt and the current frequency settings
  * in @cfg, update the cycle timing information.
  */
-void s3c2410_iotiming_getbank(struct s3c_cpufreq_config *cfg,
-                             struct s3c2410_iobank_timing *bt)
+static void s3c2410_iotiming_getbank(struct s3c_cpufreq_config *cfg,
+                                    struct s3c2410_iobank_timing *bt)
 {
        unsigned long bankcon = bt->bankcon;
        unsigned long hclk = cfg->freq.hclk_tns;
similarity index 98%
rename from arch/arm/mach-s3c24xx/iotiming-s3c2412.c
rename to arch/arm/mach-s3c/iotiming-s3c2412.c
index 59356d1..003f89c 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
+#include "cpu.h"
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
 
-#include <mach/s3c2412.h>
+#include "s3c2412.h"
 
 #define print_ns(x) ((x) / 10), ((x) % 10)
 
similarity index 93%
rename from arch/arm/mach-s3c24xx/irq-pm.c
rename to arch/arm/mach-s3c/irq-pm-s3c24xx.c
index e0131b1..4d5e283 100644 (file)
 #include <linux/syscore_ops.h>
 #include <linux/io.h>
 
-#include <plat/cpu.h>
-#include <plat/pm.h>
-#include <plat/map-base.h>
-#include <plat/map-s3c.h>
-
-#include <mach/regs-irq.h>
-#include <mach/regs-gpio.h>
-#include <mach/pm-core.h>
+#include "cpu.h"
+#include "pm.h"
+#include <mach/map-base.h>
+#include "map-s3c.h"
+
+#include "regs-irq.h"
+#include "regs-gpio.h"
+#include "pm-core.h"
 
 #include <asm/irq.h>
 
similarity index 97%
rename from arch/arm/mach-s3c64xx/irq-pm.c
rename to arch/arm/mach-s3c/irq-pm-s3c64xx.c
index 31b2211..4a1e935 100644 (file)
 #include <linux/io.h>
 #include <linux/of.h>
 
-#include <mach/map.h>
+#include "map.h"
 
-#include <mach/regs-gpio.h>
-#include <plat/cpu.h>
-#include <plat/pm.h>
+#include "regs-gpio.h"
+#include "cpu.h"
+#include "pm.h"
 
 /* We handled all the IRQ types in this code, to save having to make several
  * small files to handle each different type separately. Having the EINT_GRP
diff --git a/arch/arm/mach-s3c/irq-s3c24xx-fiq-exports.c b/arch/arm/mach-s3c/irq-s3c24xx-fiq-exports.c
new file mode 100644 (file)
index 0000000..84cf863
--- /dev/null
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <linux/stddef.h>
+#include <linux/export.h>
+#include <linux/spi/s3c24xx-fiq.h>
+
+EXPORT_SYMBOL(s3c24xx_spi_fiq_rx);
+EXPORT_SYMBOL(s3c24xx_spi_fiq_txrx);
+EXPORT_SYMBOL(s3c24xx_spi_fiq_tx);
similarity index 94%
rename from drivers/spi/spi-s3c24xx-fiq.S
rename to arch/arm/mach-s3c/irq-s3c24xx-fiq.S
index e95d628..b54cbd0 100644 (file)
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
-#include <mach/map.h>
-#include <mach/regs-irq.h>
-#include <plat/regs-spi.h>
+#include "map.h"
+#include "regs-irq.h"
 
-#include "spi-s3c24xx-fiq.h"
+#include <linux/spi/s3c24xx-fiq.h>
+
+#define S3C2410_SPTDAT           (0x10)
+#define S3C2410_SPRDAT           (0x14)
 
        .text
 
similarity index 99%
rename from drivers/irqchip/irq-s3c24xx.c
rename to arch/arm/mach-s3c/irq-s3c24xx.c
index d2031fe..79b5f19 100644 (file)
 #include <asm/exception.h>
 #include <asm/mach/irq.h>
 
-#include <mach/regs-irq.h>
-#include <mach/regs-gpio.h>
+#include <mach/irqs.h>
+#include "regs-irq.h"
+#include "regs-gpio.h"
 
-#include <plat/cpu.h>
-#include <plat/regs-irqtype.h>
-#include <plat/pm.h>
+#include "cpu.h"
+#include "regs-irqtype.h"
+#include "pm.h"
 
 #define S3C_IRQTYPE_NONE       0
 #define S3C_IRQTYPE_EINT       1
@@ -375,14 +376,17 @@ asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs)
 /**
  * s3c24xx_set_fiq - set the FIQ routing
  * @irq: IRQ number to route to FIQ on processor.
+ * @ack_ptr: pointer to a location for storing the bit mask
  * @on: Whether to route @irq to the FIQ, or to remove the FIQ routing.
  *
  * Change the state of the IRQ to FIQ routing depending on @irq and @on. If
  * @on is true, the @irq is checked to see if it can be routed and the
  * interrupt controller updated to route the IRQ. If @on is false, the FIQ
  * routing is cleared, regardless of which @irq is specified.
+ *
+ * returns the mask value for the register.
  */
-int s3c24xx_set_fiq(unsigned int irq, bool on)
+int s3c24xx_set_fiq(unsigned int irq, u32 *ack_ptr, bool on)
 {
        u32 intmod;
        unsigned offs;
@@ -390,15 +394,18 @@ int s3c24xx_set_fiq(unsigned int irq, bool on)
        if (on) {
                offs = irq - FIQ_START;
                if (offs > 31)
-                       return -EINVAL;
+                       return 0;
 
                intmod = 1 << offs;
        } else {
                intmod = 0;
        }
 
+       if (ack_ptr)
+               *ack_ptr = intmod;
        writel_relaxed(intmod, S3C2410_INTMOD);
-       return 0;
+
+       return intmod;
 }
 
 EXPORT_SYMBOL_GPL(s3c24xx_set_fiq);
similarity index 83%
rename from arch/arm/mach-s3c24xx/mach-amlm5900.c
rename to arch/arm/mach-s3c/mach-amlm5900.c
index 9a9daf5..94c4512 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/list.h>
 #include <linux/timer.h>
 #include <linux/init.h>
+#include <linux/gpio/machine.h>
 #include <linux/gpio.h>
 #include <linux/device.h>
 #include <linux/platform_device.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/flash.h>
 
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
-#include <mach/regs-lcd.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/gpio-cfg.h>
+#include "devs.h"
+#include "cpu.h"
+#include "gpio-cfg.h"
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
 
-#include <plat/samsung-time.h>
-
-#include "common.h"
+#include "s3c24xx.h"
 
 static struct resource amlm5900_nor_resource =
                        DEFINE_RES_MEM(0x00000000, SZ_16M);
@@ -124,6 +121,19 @@ static struct s3c2410_uartcfg amlm5900_uartcfgs[] = {
        }
 };
 
+static struct gpiod_lookup_table amlm5900_mmc_gpio_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
 
 static struct platform_device *amlm5900_devices[] __initdata = {
 #ifdef CONFIG_FB_S3C2410
@@ -143,13 +153,13 @@ static void __init amlm5900_map_io(void)
 {
        s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
        s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init amlm5900_init_time(void)
 {
        s3c2410_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 #ifdef CONFIG_FB_S3C2410
@@ -180,13 +190,17 @@ static struct s3c2410fb_mach_info __initdata amlm5900_fb_info = {
 
        .gpccon =       0xaaaaaaaa,
        .gpccon_mask =  0xffffffff,
+       .gpccon_reg =   S3C2410_GPCCON,
        .gpcup =        0x0000ffff,
        .gpcup_mask =   0xffffffff,
+       .gpcup_reg =    S3C2410_GPCUP,
 
        .gpdcon =       0xaaaaaaaa,
        .gpdcon_mask =  0xffffffff,
+       .gpdcon_reg =   S3C2410_GPDCON,
        .gpdup =        0x0000ffff,
        .gpdup_mask =   0xffffffff,
+       .gpdup_reg =    S3C2410_GPDUP,
 };
 #endif
 
@@ -219,6 +233,7 @@ static void __init amlm5900_init(void)
        s3c24xx_fb_set_platdata(&amlm5900_fb_info);
 #endif
        s3c_i2c0_set_platdata(NULL);
+       gpiod_add_lookup_table(&amlm5900_mmc_gpio_table);
        platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices));
 }
 
similarity index 97%
rename from arch/arm/mach-s3c24xx/mach-anubis.c
rename to arch/arm/mach-s3c/mach-anubis.c
index 2832624..90e3fd9 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 
 
 #include <net/ax88796.h>
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
+#include "devs.h"
+#include "cpu.h"
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
-#include <plat/samsung-time.h>
 
 #include "anubis.h"
-#include "common.h"
+#include "s3c24xx.h"
 #include "simtec.h"
 
 #define COPYRIGHT ", Copyright 2005-2009 Simtec Electronics"
@@ -384,7 +381,7 @@ static void __init anubis_map_io(void)
 {
        s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
        s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 
        /* check for the newer revision boards with large page nand */
 
@@ -403,7 +400,7 @@ static void __init anubis_map_io(void)
 static void __init anubis_init_time(void)
 {
        s3c2440_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init anubis_init(void)
similarity index 93%
rename from arch/arm/mach-s3c64xx/mach-anw6410.c
rename to arch/arm/mach-s3c/mach-anw6410.c
index 0d3d5be..825714e 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
-#include <mach/map.h>
+#include "map.h"
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/fb.h>
+#include "fb.h"
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
+#include "devs.h"
+#include "cpu.h"
 #include <mach/irqs.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-#include <plat/samsung-time.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 
-#include "common.h"
-#include "regs-modem.h"
+#include "s3c64xx.h"
+#include "regs-modem-s3c64xx.h"
 
 /* DM9000 */
 #define ANW6410_PA_DM9000      (0x18000000)
@@ -204,7 +202,7 @@ static void __init anw6410_map_io(void)
        s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc));
        s3c64xx_set_xtal_freq(12000000);
        s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
 
        anw6410_lcd_mode_set();
 }
@@ -228,6 +226,5 @@ MACHINE_START(ANW6410, "A&W6410")
        .init_irq       = s3c6410_init_irq,
        .map_io         = anw6410_map_io,
        .init_machine   = anw6410_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
+       .init_time      = s3c64xx_timer_init,
 MACHINE_END
similarity index 87%
rename from arch/arm/mach-s3c24xx/mach-at2440evb.c
rename to arch/arm/mach-s3c/mach-at2440evb.c
index 04dedeb..5fa49d4 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 
 #include <linux/mtd/nand_ecc.h>
 #include <linux/mtd/partitions.h>
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
+#include "devs.h"
+#include "cpu.h"
 #include <linux/platform_data/mmc-s3cmci.h>
-#include <plat/samsung-time.h>
 
-#include "common.h"
+#include "s3c24xx.h"
 
 static struct map_desc at2440evb_iodesc[] __initdata = {
        /* Nothing here */
@@ -136,18 +133,26 @@ static struct platform_device at2440evb_device_eth = {
 };
 
 static struct s3c24xx_mci_pdata at2440evb_mci_pdata __initdata = {
-       /* Intentionally left blank */
+       .set_power      = s3c24xx_mci_def_set_power,
 };
 
 static struct gpiod_lookup_table at2440evb_mci_gpio_table = {
        .dev_id = "s3c2410-sdi",
        .table = {
                /* Card detect S3C2410_GPG(10) */
-               GPIO_LOOKUP("GPG", 10, "cd", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("GPIOG", 10, "cd", GPIO_ACTIVE_LOW),
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
                { },
        },
 };
 
+
 /* 7" LCD panel */
 
 static struct s3c2410fb_display at2440evb_lcd_cfg __initdata = {
@@ -197,13 +202,13 @@ static void __init at2440evb_map_io(void)
 {
        s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
        s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init at2440evb_init_time(void)
 {
        s3c2440_init_clocks(16934400);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init at2440evb_init(void)
similarity index 97%
rename from arch/arm/mach-s3c24xx/mach-bast.c
rename to arch/arm/mach-s3c/mach-bast.c
index 6465eab..328f5d9 100644 (file)
 #include <asm/mach/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/fb.h>
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq.h>
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
+#include <linux/platform_data/fb-s3c2410.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include <linux/soc/samsung/s3c-cpu-freq.h>
+#include "devs.h"
+#include "gpio-cfg.h"
 
 #include "bast.h"
-#include "common.h"
+#include "s3c24xx.h"
 #include "simtec.h"
 
 #define COPYRIGHT ", Copyright 2004-2008 Simtec Electronics"
@@ -550,13 +547,13 @@ static void __init bast_map_io(void)
 
        s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
        s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init bast_init_time(void)
 {
        s3c2410_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init bast_init(void)
similarity index 98%
rename from arch/arm/mach-s3c64xx/mach-crag6410-module.c
rename to arch/arm/mach-s3c/mach-crag6410-module.c
index 34f1baa..407ad49 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <linux/platform_data/spi-s3c64xx.h>
 
-#include <plat/cpu.h>
+#include "cpu.h"
 #include <mach/irqs.h>
 
 #include "crag6410.h"
@@ -378,8 +378,7 @@ static const struct {
          .i2c_devs = wm2200_i2c, .num_i2c_devs = ARRAY_SIZE(wm2200_i2c) },
 };
 
-static int wlf_gf_module_probe(struct i2c_client *i2c,
-                              const struct i2c_device_id *i2c_id)
+static int wlf_gf_module_probe(struct i2c_client *i2c)
 {
        int ret, i, j, id, rev;
 
@@ -432,7 +431,7 @@ static struct i2c_driver wlf_gf_module_driver = {
        .driver = {
                .name = "wlf-gf-module"
        },
-       .probe = wlf_gf_module_probe,
+       .probe_new = wlf_gf_module_probe,
        .id_table = wlf_gf_module_id,
 };
 
similarity index 97%
rename from arch/arm/mach-s3c64xx/mach-crag6410.c
rename to arch/arm/mach-s3c/mach-crag6410.c
index da96542..4a12c75 100644 (file)
 #include <asm/mach-types.h>
 
 #include <video/samsung_fimd.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 #include <mach/irqs.h>
 
-#include <plat/fb.h>
-#include <plat/sdhci.h>
-#include <plat/gpio-cfg.h>
+#include "fb.h"
+#include "sdhci.h"
+#include "gpio-cfg.h"
 #include <linux/platform_data/spi-s3c64xx.h>
 
-#include <plat/keypad.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/adc.h>
+#include "keypad.h"
+#include "devs.h"
+#include "cpu.h"
+#include <linux/soc/samsung/s3c-adc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/pm.h>
-#include <plat/samsung-time.h>
+#include "pm.h"
 
-#include "common.h"
+#include "s3c64xx.h"
 #include "crag6410.h"
-#include "regs-gpio-memport.h"
-#include "regs-modem.h"
-#include "regs-sys.h"
+#include "regs-gpio-memport-s3c64xx.h"
+#include "regs-modem-s3c64xx.h"
+#include "regs-sys-s3c64xx.h"
 
 /* serial port setup */
 
@@ -750,7 +748,7 @@ static void __init crag6410_map_io(void)
        s3c64xx_init_io(NULL, 0);
        s3c64xx_set_xtal_freq(12000000);
        s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
 
        /* LCD type and Bypass set by bootloader */
 }
@@ -877,6 +875,5 @@ MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
        .init_irq       = s3c6410_init_irq,
        .map_io         = crag6410_map_io,
        .init_machine   = crag6410_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
+       .init_time      = s3c64xx_timer_init,
 MACHINE_END
similarity index 92%
rename from arch/arm/mach-s3c24xx/mach-gta02.c
rename to arch/arm/mach-s3c/mach-gta02.c
index 7327481..3c75c7d 100644 (file)
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <linux/platform_data/usb-ohci-s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
-#include <mach/fb.h>
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-irq.h>
-#include <mach/gpio-samsung.h>
+#include "regs-gpio.h"
+#include "regs-irq.h"
+#include "gpio-samsung.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
-#include <plat/pm.h>
-#include <plat/samsung-time.h>
+#include "cpu.h"
+#include "devs.h"
+#include "gpio-cfg.h"
+#include "pm.h"
 
-#include "common.h"
+#include "s3c24xx.h"
 #include "gta02.h"
 
 static struct pcf50633 *gta02_pcf;
@@ -489,11 +487,25 @@ static struct platform_device gta02_audio = {
        .id = -1,
 };
 
+static struct gpiod_lookup_table gta02_mmc_gpio_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
 static void __init gta02_map_io(void)
 {
        s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
        s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 
@@ -540,7 +552,12 @@ static void __init gta02_machine_init(void)
 
        i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
 
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+
        gpiod_add_lookup_table(&gta02_audio_gpio_table);
+       gpiod_add_lookup_table(&gta02_mmc_gpio_table);
        platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
        pm_power_off = gta02_poweroff;
 
@@ -550,7 +567,7 @@ static void __init gta02_machine_init(void)
 static void __init gta02_init_time(void)
 {
        s3c2442_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 MACHINE_START(NEO1973_GTA02, "GTA02")
similarity index 94%
rename from arch/arm/mach-s3c24xx/mach-h1940.c
rename to arch/arm/mach-s3c/mach-h1940.c
index ecb8402..53d51aa 100644 (file)
 
 #include <sound/uda1380.h>
 
-#include <mach/fb.h>
-#include <mach/hardware.h>
-#include <mach/regs-clock.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
-#include <plat/pm.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
+#include <linux/platform_data/fb-s3c2410.h>
+#include "map.h"
+#include "hardware-s3c24xx.h"
+#include "regs-clock.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "gpio-cfg.h"
+#include "pm.h"
+
+#include "s3c24xx.h"
 #include "h1940.h"
 
 #define H1940_LATCH            ((void __force __iomem *)0xF8000000)
@@ -180,9 +179,9 @@ static struct s3c2410_ts_mach_info h1940_ts_cfg __initdata = {
                .cfg_gpio = s3c24xx_ts_cfg_gpio,
 };
 
-/**
+/*
  * Set lcd on or off
- **/
+ */
 static struct s3c2410fb_display h1940_lcd __initdata = {
        .lcdcon5=       S3C2410_LCDCON5_FRM565 | \
                        S3C2410_LCDCON5_INVVLINE | \
@@ -211,12 +210,16 @@ static struct s3c2410fb_mach_info h1940_fb_info __initdata = {
        .lpcsel =       0x02,
        .gpccon =       0xaa940659,
        .gpccon_mask =  0xffffc0f0,
+       .gpccon_reg =   S3C2410_GPCCON,
        .gpcup =        0x0000ffff,
        .gpcup_mask =   0xffffffff,
+       .gpcup_reg =    S3C2410_GPCUP,
        .gpdcon =       0xaa84aaa0,
        .gpdcon_mask =  0xffffffff,
+       .gpdcon_reg =   S3C2410_GPDCON,
        .gpdup =        0x0000faff,
        .gpdup_mask =   0xffffffff,
+       .gpdup_reg =    S3C2410_GPDUP,
 };
 
 static int power_supply_init(struct device *dev)
@@ -446,6 +449,8 @@ static struct platform_device h1940_device_bluetooth = {
 
 static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd)
 {
+       s3c24xx_mci_def_set_power(power_mode, vdd);
+
        switch (power_mode) {
        case MMC_POWER_OFF:
                gpio_set_value(H1940_LATCH_SD_POWER, 0);
@@ -468,9 +473,16 @@ static struct gpiod_lookup_table h1940_mmc_gpio_table = {
        .dev_id = "s3c2410-sdi",
        .table = {
                /* Card detect S3C2410_GPF(5) */
-               GPIO_LOOKUP("GPF", 5, "cd", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("GPIOF", 5, "cd", GPIO_ACTIVE_LOW),
                /* Write protect S3C2410_GPH(8) */
-               GPIO_LOOKUP("GPH", 8, "wp", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_LOW),
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
                { },
        },
 };
@@ -674,7 +686,7 @@ static void __init h1940_map_io(void)
 {
        s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
        s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 
        /* setup PM */
 
@@ -691,7 +703,7 @@ static void __init h1940_map_io(void)
 static void __init h1940_init_time(void)
 {
        s3c2410_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 /* H1940 and RX3715 need to reserve this for suspend */
@@ -708,6 +720,9 @@ static void __init h1940_init(void)
        s3c24xx_fb_set_platdata(&h1940_fb_info);
        gpiod_add_lookup_table(&h1940_mmc_gpio_table);
        gpiod_add_lookup_table(&h1940_audio_gpio_table);
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
        s3c24xx_mci_set_platdata(&h1940_mmc_cfg);
        s3c24xx_udc_set_platdata(&h1940_udc_cfg);
        s3c24xx_ts_set_platdata(&h1940_ts_cfg);
similarity index 95%
rename from arch/arm/mach-s3c64xx/mach-hmt.c
rename to arch/arm/mach-s3c/mach-hmt.c
index 0d9acaf..b287e99 100644 (file)
 #include <asm/mach/irq.h>
 
 #include <video/samsung_fimd.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
+#include "map.h"
 #include <mach/irqs.h>
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <mach/gpio-samsung.h>
-#include <plat/fb.h>
+#include "gpio-samsung.h"
+#include "fb.h"
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include "devs.h"
+#include "cpu.h"
 
-#include "common.h"
+#include "s3c64xx.h"
 
 #define UCON S3C2410_UCON_DEFAULT
 #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
@@ -251,7 +249,7 @@ static void __init hmt_map_io(void)
        s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
        s3c64xx_set_xtal_freq(12000000);
        s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
 }
 
 static void __init hmt_machine_init(void)
@@ -280,6 +278,5 @@ MACHINE_START(HMT, "Airgoo-HMT")
        .init_irq       = s3c6410_init_irq,
        .map_io         = hmt_map_io,
        .init_machine   = hmt_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
+       .init_time      = s3c64xx_timer_init,
 MACHINE_END
similarity index 97%
rename from arch/arm/mach-s3c24xx/mach-jive.c
rename to arch/arm/mach-s3c/mach-jive.c
index 8233dcf..2a29c3e 100644 (file)
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/fb.h>
-#include <mach/gpio-samsung.h>
+#include "hardware-s3c24xx.h"
+#include "regs-gpio.h"
+#include <linux/platform_data/fb-s3c2410.h>
+#include "gpio-samsung.h"
 
 #include <asm/mach-types.h>
 
 #include <linux/mtd/nand_ecc.h>
 #include <linux/mtd/partitions.h>
 
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/pm.h>
+#include "gpio-cfg.h"
+#include "devs.h"
+#include "cpu.h"
+#include "pm.h"
 #include <linux/platform_data/usb-s3c2410_udc.h>
-#include <plat/samsung-time.h>
 
-#include "common.h"
+#include "s3c24xx.h"
 #include "s3c2412-power.h"
 
 static struct map_desc jive_iodesc[] __initdata = {
@@ -321,6 +320,7 @@ static struct s3c2410fb_mach_info jive_lcd_config = {
         * data. */
 
        .gpcup          = (0xf << 1) | (0x3f << 10),
+       .gpcup_reg      = S3C2410_GPCUP,
 
        .gpccon         = (S3C2410_GPC1_VCLK   | S3C2410_GPC2_VLINE |
                           S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
@@ -334,8 +334,12 @@ static struct s3c2410fb_mach_info jive_lcd_config = {
                           S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
                           S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
 
+       .gpccon_reg     = S3C2410_GPCCON,
+
        .gpdup          = (0x3f << 2) | (0x3f << 10),
 
+       .gpdup_reg      = S3C2410_GPDUP,
+
        .gpdcon         = (S3C2410_GPD2_VD10  | S3C2410_GPD3_VD11 |
                           S3C2410_GPD4_VD12  | S3C2410_GPD5_VD13 |
                           S3C2410_GPD6_VD14  | S3C2410_GPD7_VD15 |
@@ -349,6 +353,8 @@ static struct s3c2410fb_mach_info jive_lcd_config = {
                           S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
                           S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
                           S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
+
+       .gpdcon_reg     = S3C2410_GPDCON,
 };
 
 /* ILI9320 support. */
@@ -523,13 +529,13 @@ static void __init jive_map_io(void)
 {
        s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
        s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init jive_init_time(void)
 {
        s3c2412_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void jive_power_off(void)
similarity index 94%
rename from arch/arm/mach-s3c24xx/mach-mini2440.c
rename to arch/arm/mach-s3c/mach-mini2440.c
index 057dcba..dc22ab8 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/hardware.h>
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <asm/mach-types.h>
 
-#include <mach/regs-gpio.h>
+#include "regs-gpio.h"
 #include <linux/platform_data/leds-s3c24xx.h>
-#include <mach/regs-lcd.h>
 #include <mach/irqs.h>
-#include <mach/gpio-samsung.h>
+#include "gpio-samsung.h"
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <linux/mtd/nand_ecc.h>
 #include <linux/mtd/partitions.h>
 
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include "gpio-cfg.h"
+#include "devs.h"
+#include "cpu.h"
 
 #include <sound/s3c24xx_uda134x.h>
 
-#include "common.h"
+#include "s3c24xx.h"
 
 #define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300)
 
@@ -215,6 +212,9 @@ static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
                           S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
                           S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
 
+       .gpccon_reg     = S3C2410_GPCCON,
+       .gpcup_reg      = S3C2410_GPCUP,
+
        .gpdup          = (0x3f << 2) | (0x3f << 10),
 
        .gpdcon         = (S3C2410_GPD2_VD10  | S3C2410_GPD3_VD11 |
@@ -230,13 +230,16 @@ static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
                           S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
                           S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
                           S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
+
+       .gpdcon_reg     = S3C2410_GPDCON,
+       .gpdup_reg      = S3C2410_GPDUP,
 };
 
 /* MMC/SD  */
 
 static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
        .wprotect_invert        = 1,
-       .set_power              = NULL,
+       .set_power              = s3c24xx_mci_def_set_power,
        .ocr_avail              = MMC_VDD_32_33|MMC_VDD_33_34,
 };
 
@@ -244,9 +247,16 @@ static struct gpiod_lookup_table mini2440_mmc_gpio_table = {
        .dev_id = "s3c2410-sdi",
        .table = {
                /* Card detect S3C2410_GPG(8) */
-               GPIO_LOOKUP("GPG", 8, "cd", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("GPIOG", 8, "cd", GPIO_ACTIVE_LOW),
                /* Write protect S3C2410_GPH(8) */
-               GPIO_LOOKUP("GPH", 8, "wp", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_HIGH),
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
                { },
        },
 };
@@ -587,13 +597,13 @@ static void __init mini2440_map_io(void)
 {
        s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
        s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init mini2440_init_time(void)
 {
        s3c2440_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 /*
@@ -716,6 +726,11 @@ static void __init mini2440_init(void)
                s3c_gpio_setpull(mini2440_buttons[i].gpio, S3C_GPIO_PULL_UP);
                s3c_gpio_cfgpin(mini2440_buttons[i].gpio, S3C2410_GPIO_INPUT);
        }
+
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+
        if (features.lcd_index != -1) {
                int li;
 
similarity index 95%
rename from arch/arm/mach-s3c64xx/mach-mini6410.c
rename to arch/arm/mach-s3c/mach-mini6410.c
index 6fbb578..741fa1f 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/adc.h>
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/fb.h>
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include <linux/soc/samsung/s3c-adc.h>
+#include "cpu.h"
+#include "devs.h"
+#include "fb.h"
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/mmc-sdhci-s3c.h>
-#include <plat/sdhci.h>
+#include "sdhci.h"
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <mach/irqs.h>
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
-#include <plat/samsung-time.h>
 
-#include "common.h"
-#include "regs-modem.h"
-#include "regs-srom.h"
+#include "s3c64xx.h"
+#include "regs-modem-s3c64xx.h"
+#include "regs-srom-s3c64xx.h"
 
 #define UCON S3C2410_UCON_DEFAULT
 #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
@@ -238,7 +237,7 @@ static void __init mini6410_map_io(void)
        s3c64xx_init_io(NULL, 0);
        s3c64xx_set_xtal_freq(12000000);
        s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
 
        /* set the LCD type */
        tmp = __raw_readl(S3C64XX_SPCON);
@@ -362,6 +361,5 @@ MACHINE_START(MINI6410, "MINI6410")
        .init_irq       = s3c6410_init_irq,
        .map_io         = mini6410_map_io,
        .init_machine   = mini6410_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
+       .init_time      = s3c64xx_timer_init,
 MACHINE_END
similarity index 94%
rename from arch/arm/mach-s3c24xx/mach-n30.c
rename to arch/arm/mach-s3c/mach-n30.c
index 998ccff..e40c1fc 100644 (file)
 #include <linux/io.h>
 #include <linux/mmc/host.h>
 
-#include <mach/hardware.h>
+#include "hardware-s3c24xx.h"
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <linux/platform_data/leds-s3c24xx.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
 
 #include <asm/mach/arch.h>
 #include <asm/mach/irq.h>
 
 #include <linux/platform_data/i2c-s3c2410.h>
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
+#include "cpu.h"
+#include "devs.h"
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
-#include <plat/samsung-time.h>
 
-#include "common.h"
+#include "s3c24xx.h"
 
 static struct map_desc n30_iodesc[] __initdata = {
        /* nothing here yet */
@@ -368,6 +366,8 @@ static struct s3c2410fb_mach_info n30_fb_info __initdata = {
 
 static void n30_sdi_set_power(unsigned char power_mode, unsigned short vdd)
 {
+       s3c24xx_mci_def_set_power(power_mode, vdd);
+
        switch (power_mode) {
        case MMC_POWER_ON:
        case MMC_POWER_UP:
@@ -389,10 +389,17 @@ static struct gpiod_lookup_table n30_mci_gpio_table = {
        .dev_id = "s3c2410-sdi",
        .table = {
                /* Card detect S3C2410_GPF(1) */
-               GPIO_LOOKUP("GPF", 1, "cd", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("GPIOF", 1, "cd", GPIO_ACTIVE_LOW),
                /* Write protect S3C2410_GPG(10) */
-               GPIO_LOOKUP("GPG", 10, "wp", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("GPIOG", 10, "wp", GPIO_ACTIVE_LOW),
                { },
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
        },
 };
 
@@ -572,13 +579,13 @@ static void __init n30_map_io(void)
        s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
        n30_hwinit();
        s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init n30_init_time(void)
 {
        s3c2410_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 /* GPB3 is the line that controls the pull-up for the USB D+ line */
@@ -600,6 +607,10 @@ static void __init n30_init(void)
                              S3C2410_MISCCR_USBSUSPND0 |
                              S3C2410_MISCCR_USBSUSPND1, 0x0);
 
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+
        if (machine_is_n30()) {
                /* Turn off suspend on both USB ports, and switch the
                 * selectable USB port to USB device mode. */
similarity index 87%
rename from arch/arm/mach-s3c64xx/mach-ncp.c
rename to arch/arm/mach-s3c/mach-ncp.c
index 13fea5c..1a45bed 100644 (file)
 #include <asm/mach/irq.h>
 
 #include <mach/irqs.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
+#include "map.h"
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/fb.h>
+#include "fb.h"
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include "devs.h"
+#include "cpu.h"
 
-#include "common.h"
+#include "s3c64xx.h"
 
 #define UCON S3C2410_UCON_DEFAULT
 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE
@@ -81,7 +79,7 @@ static void __init ncp_map_io(void)
        s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc));
        s3c64xx_set_xtal_freq(12000000);
        s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
 }
 
 static void __init ncp_machine_init(void)
@@ -98,6 +96,5 @@ MACHINE_START(NCP, "NCP")
        .init_irq       = s3c6410_init_irq,
        .map_io         = ncp_map_io,
        .init_machine   = ncp_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
+       .init_time      = s3c64xx_timer_init,
 MACHINE_END
similarity index 90%
rename from arch/arm/mach-s3c24xx/mach-nexcoder.c
rename to arch/arm/mach-s3c/mach-nexcoder.c
index c2f3475..2a454c9 100644 (file)
 #include <asm/mach/irq.h>
 
 #include <asm/setup.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
 //#include <asm/debug-ll.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 #include <linux/platform_data/i2c-s3c2410.h>
 
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include "gpio-cfg.h"
+#include "devs.h"
+#include "cpu.h"
 
-#include "common.h"
+#include "s3c24xx.h"
 
 static struct map_desc nexcoder_iodesc[] __initdata = {
        /* nothing here yet */
@@ -131,7 +129,7 @@ static void __init nexcoder_map_io(void)
 {
        s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
        s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 
        nexcoder_sensorboard_init();
 }
@@ -139,12 +137,17 @@ static void __init nexcoder_map_io(void)
 static void __init nexcoder_init_time(void)
 {
        s3c2440_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init nexcoder_init(void)
 {
        s3c_i2c0_set_platdata(NULL);
+
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+
        platform_add_devices(nexcoder_devices, ARRAY_SIZE(nexcoder_devices));
 };
 
similarity index 98%
rename from arch/arm/mach-s3c24xx/mach-osiris-dvs.c
rename to arch/arm/mach-s3c/mach-osiris-dvs.c
index 5d819b6..2e283ae 100644 (file)
@@ -14,8 +14,8 @@
 
 #include <linux/mfd/tps65010.h>
 
-#include <plat/cpu-freq.h>
-#include <mach/gpio-samsung.h>
+#include <linux/soc/samsung/s3c-cpu-freq.h>
+#include "gpio-samsung.h"
 
 #define OSIRIS_GPIO_DVS        S3C2410_GPB(5)
 
similarity index 96%
rename from arch/arm/mach-s3c24xx/mach-osiris.c
rename to arch/arm/mach-s3c/mach-osiris.c
index 1574488..81744ca 100644 (file)
 #include <linux/mtd/nand_ecc.h>
 #include <linux/mtd/partitions.h>
 
-#include <plat/cpu.h>
-#include <plat/cpu-freq.h>
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
-
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
-
-#include "common.h"
+#include "cpu.h"
+#include <linux/soc/samsung/s3c-cpu-freq.h>
+#include "devs.h"
+#include "gpio-cfg.h"
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "s3c24xx.h"
 #include "osiris.h"
-#include "regs-mem.h"
+#include "regs-mem-s3c24xx.h"
 
 /* onboard perihperal map */
 
@@ -359,7 +356,7 @@ static void __init osiris_map_io(void)
 
        s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
        s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 
        /* check for the newer revision boards with large page nand */
 
@@ -384,7 +381,7 @@ static void __init osiris_map_io(void)
 static void __init osiris_init_time(void)
 {
        s3c2440_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init osiris_init(void)
similarity index 88%
rename from arch/arm/mach-s3c24xx/mach-otom.c
rename to arch/arm/mach-s3c/mach-otom.c
index 4e24d89..460ee97 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/samsung-time.h>
+#include "cpu.h"
+#include "devs.h"
 
-#include "common.h"
+#include "s3c24xx.h"
 #include "otom.h"
 
 static struct map_desc otom11_iodesc[] __initdata = {
@@ -95,18 +94,22 @@ static void __init otom11_map_io(void)
 {
        s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
        s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init otom11_init_time(void)
 {
        s3c2410_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init otom11_init(void)
 {
        s3c_i2c0_set_platdata(NULL);
+
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
        platform_add_devices(otom11_devices, ARRAY_SIZE(otom11_devices));
 }
 
similarity index 88%
rename from arch/arm/mach-s3c24xx/mach-qt2410.c
rename to arch/arm/mach-s3c/mach-qt2410.c
index f3131d9..151e8e3 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
 #include <linux/platform_data/leds-s3c24xx.h>
-#include <mach/regs-lcd.h>
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <mach/gpio-samsung.h>
+#include "gpio-samsung.h"
 
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/pm.h>
-#include <plat/samsung-time.h>
+#include "gpio-cfg.h"
+#include "devs.h"
+#include "cpu.h"
+#include "pm.h"
 
-#include "common.h"
-#include "common-smdk.h"
+#include "s3c24xx.h"
+#include "common-smdk-s3c24xx.h"
 
 static struct map_desc qt2410_iodesc[] __initdata = {
        { 0xe0000000, __phys_to_pfn(S3C2410_CS3+0x01000000), SZ_1M, MT_DEVICE }
@@ -225,6 +222,20 @@ static struct gpiod_lookup_table qt2410_spi_gpiod_table = {
        },
 };
 
+static struct gpiod_lookup_table qt2410_mmc_gpiod_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
 /* Board devices */
 
 static struct platform_device *qt2410_devices[] __initdata = {
@@ -309,13 +320,13 @@ static void __init qt2410_map_io(void)
 {
        s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
        s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init qt2410_init_time(void)
 {
        s3c2410_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init qt2410_machine_init(void)
@@ -343,9 +354,13 @@ static void __init qt2410_machine_init(void)
        s3c24xx_udc_set_platdata(&qt2410_udc_cfg);
        s3c_i2c0_set_platdata(NULL);
 
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
        gpiod_add_lookup_table(&qt2410_spi_gpiod_table);
        s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
        gpiod_add_lookup_table(&qt2410_led_gpio_table);
+       gpiod_add_lookup_table(&qt2410_mmc_gpiod_table);
        platform_add_devices(qt2410_devices, ARRAY_SIZE(qt2410_devices));
        s3c_pm_init();
 }
similarity index 95%
rename from arch/arm/mach-s3c64xx/mach-real6410.c
rename to arch/arm/mach-s3c/mach-real6410.c
index 1e98e53..9d218a5 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 #include <mach/irqs.h>
 
-#include <plat/adc.h>
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/fb.h>
+#include <linux/soc/samsung/s3c-adc.h>
+#include "cpu.h"
+#include "devs.h"
+#include "fb.h"
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
-#include <plat/samsung-time.h>
 
-#include "common.h"
-#include "regs-modem.h"
-#include "regs-srom.h"
+#include "s3c64xx.h"
+#include "regs-modem-s3c64xx.h"
+#include "regs-srom-s3c64xx.h"
 
 #define UCON S3C2410_UCON_DEFAULT
 #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
@@ -208,7 +207,7 @@ static void __init real6410_map_io(void)
        s3c64xx_init_io(NULL, 0);
        s3c24xx_init_clocks(12000000);
        s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
 
        /* set the LCD type */
        tmp = __raw_readl(S3C64XX_SPCON);
@@ -330,6 +329,5 @@ MACHINE_START(REAL6410, "REAL6410")
        .init_irq       = s3c6410_init_irq,
        .map_io         = real6410_map_io,
        .init_machine   = real6410_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
+       .init_time      = s3c64xx_timer_init,
 MACHINE_END
similarity index 94%
rename from arch/arm/mach-s3c24xx/mach-rx1950.c
rename to arch/arm/mach-s3c/mach-rx1950.c
index 3645b9c..b9758f0 100644 (file)
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
 #include <sound/uda1380.h>
 
-#include <mach/fb.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
+#include "hardware-s3c24xx.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
-#include <plat/samsung-time.h>
-#include <plat/gpio-cfg.h>
+#include "cpu.h"
+#include "devs.h"
+#include "pm.h"
+#include "gpio-cfg.h"
 
-#include "common.h"
+#include "s3c24xx.h"
 #include "h1940.h"
 
 #define LCD_PWM_PERIOD 192960
@@ -361,14 +360,17 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
        .lpcsel = 0x02,
        .gpccon = 0xaa9556a9,
        .gpccon_mask = 0xffc003fc,
+       .gpccon_reg = S3C2410_GPCCON,
        .gpcup = 0x0000ffff,
        .gpcup_mask = 0xffffffff,
+       .gpcup_reg = S3C2410_GPCUP,
 
        .gpdcon = 0xaa90aaa1,
        .gpdcon_mask = 0xffc0fff0,
+       .gpdcon_reg = S3C2410_GPDCON,
        .gpdup = 0x0000fcfd,
        .gpdup_mask = 0xffffffff,
-
+       .gpdup_reg = S3C2410_GPDUP,
 };
 
 static struct pwm_lookup rx1950_pwm_lookup[] = {
@@ -549,6 +551,8 @@ static struct platform_device rx1950_backlight = {
 
 static void rx1950_set_mmc_power(unsigned char power_mode, unsigned short vdd)
 {
+       s3c24xx_mci_def_set_power(power_mode, vdd);
+
        switch (power_mode) {
        case MMC_POWER_OFF:
                gpio_direction_output(S3C2410_GPJ(1), 0);
@@ -571,9 +575,16 @@ static struct gpiod_lookup_table rx1950_mmc_gpio_table = {
        .dev_id = "s3c2410-sdi",
        .table = {
                /* Card detect S3C2410_GPF(5) */
-               GPIO_LOOKUP("GPF", 5, "cd", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("GPIOF", 5, "cd", GPIO_ACTIVE_LOW),
                /* Write protect S3C2410_GPH(8) */
-               GPIO_LOOKUP("GPH", 8, "wp", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_LOW),
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
                { },
        },
 };
@@ -767,7 +778,7 @@ static void __init rx1950_map_io(void)
 {
        s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
        s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 
        /* setup PM */
 
@@ -781,7 +792,7 @@ static void __init rx1950_map_io(void)
 static void __init rx1950_init_time(void)
 {
        s3c2442_init_clocks(16934000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init rx1950_init_machine(void)
@@ -829,6 +840,9 @@ static void __init rx1950_init_machine(void)
 
        pwm_add_table(rx1950_pwm_lookup, ARRAY_SIZE(rx1950_pwm_lookup));
        gpiod_add_lookup_table(&rx1950_audio_gpio_table);
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
        platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
 
        i2c_register_board_info(0, rx1950_i2c_devices,
similarity index 89%
rename from arch/arm/mach-s3c24xx/mach-rx3715.c
rename to arch/arm/mach-s3c/mach-rx3715.c
index 017010d..a03662a 100644 (file)
 #include <asm/mach/map.h>
 
 #include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/fb.h>
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
-#include <plat/samsung-time.h>
+#include "cpu.h"
+#include "devs.h"
+#include "pm.h"
 
-#include "common.h"
+#include "s3c24xx.h"
 #include "h1940.h"
 
 static struct map_desc rx3715_iodesc[] __initdata = {
@@ -125,13 +123,17 @@ static struct s3c2410fb_mach_info rx3715_fb_info __initdata = {
 
        .gpccon =       0xaa955699,
        .gpccon_mask =  0xffc003cc,
+       .gpccon_reg =   S3C2410_GPCCON,
        .gpcup =        0x0000ffff,
        .gpcup_mask =   0xffffffff,
+       .gpcup_reg =    S3C2410_GPCUP,
 
        .gpdcon =       0xaa95aaa1,
        .gpdcon_mask =  0xffc0fff0,
+       .gpdcon_reg =   S3C2410_GPDCON,
        .gpdup =        0x0000faff,
        .gpdup_mask =   0xffffffff,
+       .gpdup_reg =    S3C2410_GPDUP,
 };
 
 static struct mtd_partition __initdata rx3715_nand_part[] = {
@@ -174,13 +176,13 @@ static void __init rx3715_map_io(void)
 {
        s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
        s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init rx3715_init_time(void)
 {
        s3c2440_init_clocks(16934000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 /* H1940 and RX3715 need to reserve this for suspend */
@@ -199,6 +201,9 @@ static void __init rx3715_init_machine(void)
 
        s3c_nand_set_platdata(&rx3715_nand_info);
        s3c24xx_fb_set_platdata(&rx3715_fb_info);
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
        platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices));
 }
 
similarity index 92%
rename from arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
rename to arch/arm/mach-s3c/mach-s3c2416-dt.c
index aa71027..418544d 100644 (file)
 #include <linux/serial_s3c.h>
 
 #include <asm/mach/arch.h>
-#include <mach/map.h>
+#include "map.h"
 
-#include <plat/cpu.h>
-#include <plat/pm.h>
+#include "cpu.h"
+#include "pm.h"
 
-#include "common.h"
+#include "s3c24xx.h"
 
 static void __init s3c2416_dt_map_io(void)
 {
similarity index 70%
rename from arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
rename to arch/arm/mach-s3c/mach-s3c64xx-dt.c
index 1724f5e..00169c1 100644 (file)
@@ -8,11 +8,10 @@
 #include <asm/mach/map.h>
 #include <asm/system_misc.h>
 
-#include <plat/cpu.h>
-#include <mach/map.h>
+#include "cpu.h"
+#include "map.h"
 
-#include "common.h"
-#include "watchdog-reset.h"
+#include "s3c64xx.h"
 
 /*
  * IO mapping for shared system controller IP.
@@ -39,20 +38,6 @@ static void __init s3c64xx_dt_map_io(void)
                panic("SoC is not S3C64xx!");
 }
 
-static void __init s3c64xx_dt_init_machine(void)
-{
-       samsung_wdt_reset_of_init();
-}
-
-static void s3c64xx_dt_restart(enum reboot_mode mode, const char *cmd)
-{
-       if (mode != REBOOT_SOFT)
-               samsung_wdt_reset();
-
-       /* if all else fails, or mode was for soft, jump to 0 */
-       soft_restart(0);
-}
-
 static const char *const s3c64xx_dt_compat[] __initconst = {
        "samsung,s3c6400",
        "samsung,s3c6410",
@@ -63,6 +48,4 @@ DT_MACHINE_START(S3C6400_DT, "Samsung S3C64xx (Flattened Device Tree)")
        /* Maintainer: Tomasz Figa <tomasz.figa@gmail.com> */
        .dt_compat      = s3c64xx_dt_compat,
        .map_io         = s3c64xx_dt_map_io,
-       .init_machine   = s3c64xx_dt_init_machine,
-       .restart        = s3c64xx_dt_restart,
 MACHINE_END
similarity index 96%
rename from arch/arm/mach-s3c64xx/mach-smartq.c
rename to arch/arm/mach-s3c/mach-smartq.c
index 5025db6..5b6e7c2 100644 (file)
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
 
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
+#include "cpu.h"
+#include "devs.h"
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/gpio-cfg.h>
+#include "gpio-cfg.h"
 #include <linux/platform_data/hwmon-s3c.h>
 #include <linux/platform_data/usb-ohci-s3c2410.h>
-#include <plat/sdhci.h>
+#include "sdhci.h"
 #include <linux/platform_data/touchscreen-s3c2410.h>
 
 #include <video/platform_lcd.h>
-#include <plat/samsung-time.h>
 
-#include "common.h"
+#include "s3c64xx.h"
 #include "mach-smartq.h"
-#include "regs-modem.h"
+#include "regs-modem-s3c64xx.h"
 
 #define UCON S3C2410_UCON_DEFAULT
 #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
@@ -384,7 +383,7 @@ void __init smartq_map_io(void)
        s3c64xx_set_xtal_freq(12000000);
        s3c64xx_set_xusbxti_freq(12000000);
        s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
 
        smartq_lcd_mode_set();
 }
similarity index 91%
rename from arch/arm/mach-s3c64xx/mach-smartq5.c
rename to arch/arm/mach-s3c/mach-smartq5.c
index 44e9edb..8c94022 100644 (file)
 
 #include <video/samsung_fimd.h>
 #include <mach/irqs.h>
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/fb.h>
-#include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
+#include "cpu.h"
+#include "devs.h"
+#include "fb.h"
+#include "gpio-cfg.h"
 
-#include "common.h"
+#include "s3c64xx.h"
 #include "mach-smartq.h"
 
 static struct gpio_led smartq5_leds[] = {
@@ -151,6 +150,5 @@ MACHINE_START(SMARTQ5, "SmartQ 5")
        .init_irq       = s3c6410_init_irq,
        .map_io         = smartq_map_io,
        .init_machine   = smartq5_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
+       .init_time      = s3c64xx_timer_init,
 MACHINE_END
similarity index 92%
rename from arch/arm/mach-s3c64xx/mach-smartq7.c
rename to arch/arm/mach-s3c/mach-smartq7.c
index 815ee7d..ab24396 100644 (file)
 
 #include <video/samsung_fimd.h>
 #include <mach/irqs.h>
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/fb.h>
-#include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
+#include "cpu.h"
+#include "devs.h"
+#include "fb.h"
+#include "gpio-cfg.h"
 
-#include "common.h"
+#include "s3c64xx.h"
 #include "mach-smartq.h"
 
 static struct gpio_led smartq7_leds[] = {
@@ -167,6 +166,5 @@ MACHINE_START(SMARTQ7, "SmartQ 7")
        .init_irq       = s3c6410_init_irq,
        .map_io         = smartq_map_io,
        .init_machine   = smartq7_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
+       .init_time      = s3c64xx_timer_init,
 MACHINE_END
similarity index 86%
rename from arch/arm/mach-s3c24xx/mach-smdk2410.c
rename to arch/arm/mach-s3c/mach-smdk2410.c
index 18dfef5..ca83d5a 100644 (file)
 #include <linux/serial_s3c.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
 #include <linux/platform_data/i2c-s3c2410.h>
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include "devs.h"
+#include "cpu.h"
 
-#include "common.h"
-#include "common-smdk.h"
+#include "s3c24xx.h"
+#include "common-smdk-s3c24xx.h"
 
 static struct map_desc smdk2410_iodesc[] __initdata = {
   /* nothing here yet */
@@ -81,19 +81,22 @@ static void __init smdk2410_map_io(void)
 {
        s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
        s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init smdk2410_init_time(void)
 {
        s3c2410_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init smdk2410_init(void)
 {
        s3c_i2c0_set_platdata(NULL);
        platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices));
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
        smdk_machine_init();
 }
 
similarity index 86%
rename from arch/arm/mach-s3c24xx/mach-smdk2413.c
rename to arch/arm/mach-s3c/mach-smdk2413.c
index ca80167..c43095b 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
 #include <asm/hardware/iomd.h>
 #include <asm/setup.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
 //#include <asm/debug-ll.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
+#include "hardware-s3c24xx.h"
+#include "regs-gpio.h"
 
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <mach/gpio-samsung.h>
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include "devs.h"
+#include "cpu.h"
 
-#include "common.h"
-#include "common-smdk.h"
+#include "s3c24xx.h"
+#include "common-smdk-s3c24xx.h"
 
 static struct map_desc smdk2413_iodesc[] __initdata = {
 };
@@ -99,13 +98,13 @@ static void __init smdk2413_map_io(void)
 {
        s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
        s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init smdk2413_init_time(void)
 {
        s3c2412_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init smdk2413_machine_init(void)
@@ -119,6 +118,9 @@ static void __init smdk2413_machine_init(void)
 
        s3c24xx_udc_set_platdata(&smdk2413_udc_cfg);
        s3c_i2c0_set_platdata(NULL);
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
 
        platform_add_devices(smdk2413_devices, ARRAY_SIZE(smdk2413_devices));
        smdk_machine_init();
@@ -132,7 +134,7 @@ MACHINE_START(S3C2413, "S3C2413")
        .init_irq       = s3c2412_init_irq,
        .map_io         = smdk2413_map_io,
        .init_machine   = smdk2413_machine_init,
-       .init_time      = samsung_timer_init,
+       .init_time      = s3c24xx_timer_init,
 MACHINE_END
 
 MACHINE_START(SMDK2412, "SMDK2412")
@@ -143,7 +145,7 @@ MACHINE_START(SMDK2412, "SMDK2412")
        .init_irq       = s3c2412_init_irq,
        .map_io         = smdk2413_map_io,
        .init_machine   = smdk2413_machine_init,
-       .init_time      = samsung_timer_init,
+       .init_time      = s3c24xx_timer_init,
 MACHINE_END
 
 MACHINE_START(SMDK2413, "SMDK2413")
similarity index 93%
rename from arch/arm/mach-s3c24xx/mach-smdk2416.c
rename to arch/arm/mach-s3c/mach-smdk2416.c
index 61c3e45..4d883a7 100644 (file)
 #include <asm/mach/irq.h>
 
 #include <video/samsung_fimd.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/regs-s3c2443-clock.h>
-#include <mach/gpio-samsung.h>
+#include "hardware-s3c24xx.h"
+#include "regs-gpio.h"
+#include "regs-s3c2443-clock.h"
+#include "gpio-samsung.h"
 
 #include <linux/platform_data/leds-s3c24xx.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
+#include "gpio-cfg.h"
+#include "devs.h"
+#include "cpu.h"
 #include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <plat/sdhci.h>
+#include "sdhci.h"
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/s3c-hsudc.h>
-#include <plat/samsung-time.h>
 
-#include <plat/fb.h>
+#include "fb.h"
 
-#include "common.h"
-#include "common-smdk.h"
+#include "s3c24xx.h"
+#include "common-smdk-s3c24xx.h"
 
 static struct map_desc smdk2416_iodesc[] __initdata = {
        /* ISA IO Space map (memory space selected by A24) */
@@ -215,14 +213,14 @@ static struct platform_device *smdk2416_devices[] __initdata = {
 static void __init smdk2416_init_time(void)
 {
        s3c2416_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init smdk2416_map_io(void)
 {
        s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
        s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init smdk2416_machine_init(void)
similarity index 87%
rename from arch/arm/mach-s3c24xx/mach-smdk2440.c
rename to arch/arm/mach-s3c/mach-smdk2440.c
index 7bafcd8..7f6fe0d 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
 
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include "devs.h"
+#include "cpu.h"
 
-#include "common.h"
-#include "common-smdk.h"
+#include "s3c24xx.h"
+#include "common-smdk-s3c24xx.h"
 
 static struct map_desc smdk2440_iodesc[] __initdata = {
        /* ISA IO Space map (memory space selected by A24) */
@@ -137,6 +136,11 @@ static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
        .gpdcon_mask    = 0xffffffff,
        .gpdup          = 0x0000faff,
        .gpdup_mask     = 0xffffffff,
+
+       .gpccon_reg     = S3C2410_GPCCON,
+       .gpcup_reg      = S3C2410_GPCUP,
+       .gpdcon_reg     = S3C2410_GPDCON,
+       .gpdup_reg      = S3C2410_GPDUP,
 #endif
 
        .lpcsel         = ((0xCE6) & ~7) | 1<<4,
@@ -154,20 +158,22 @@ static void __init smdk2440_map_io(void)
 {
        s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
        s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init smdk2440_init_time(void)
 {
        s3c2440_init_clocks(16934400);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init smdk2440_machine_init(void)
 {
        s3c24xx_fb_set_platdata(&smdk2440_fb_info);
        s3c_i2c0_set_platdata(NULL);
-
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
        platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
        smdk_machine_init();
 }
similarity index 90%
rename from arch/arm/mach-s3c24xx/mach-smdk2443.c
rename to arch/arm/mach-s3c/mach-smdk2443.c
index 2358ed5..fc54c91 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
+#include "regs-gpio.h"
 
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include "devs.h"
+#include "cpu.h"
 
-#include "common.h"
-#include "common-smdk.h"
+#include "s3c24xx.h"
+#include "common-smdk-s3c24xx.h"
 
 static struct map_desc smdk2443_iodesc[] __initdata = {
        /* ISA IO Space map (memory space selected by A24) */
@@ -112,13 +109,13 @@ static void __init smdk2443_map_io(void)
 {
        s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
        s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init smdk2443_init_time(void)
 {
        s3c2443_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init smdk2443_machine_init(void)
similarity index 87%
rename from arch/arm/mach-s3c64xx/mach-smdk6400.c
rename to arch/arm/mach-s3c/mach-smdk6400.c
index cbd1684..8272213 100644 (file)
 #include <asm/mach/irq.h>
 
 #include <mach/irqs.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
+#include "map.h"
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
+#include "devs.h"
+#include "cpu.h"
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <mach/gpio-samsung.h>
-#include <plat/samsung-time.h>
+#include "gpio-samsung.h"
 
-#include "common.h"
+#include "s3c64xx.h"
 
 #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
@@ -62,7 +60,7 @@ static void __init smdk6400_map_io(void)
        s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc));
        s3c64xx_set_xtal_freq(12000000);
        s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
 }
 
 static struct platform_device *smdk6400_devices[] __initdata = {
@@ -88,6 +86,5 @@ MACHINE_START(SMDK6400, "SMDK6400")
        .init_irq       = s3c6400_init_irq,
        .map_io         = smdk6400_map_io,
        .init_machine   = smdk6400_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
+       .init_time      = s3c64xx_timer_init,
 MACHINE_END
similarity index 97%
rename from arch/arm/mach-s3c64xx/mach-smdk6410.c
rename to arch/arm/mach-s3c/mach-smdk6410.c
index 56f406c..ae18c13 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
 #include <mach/irqs.h>
-#include <mach/map.h>
+#include "map.h"
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 #include <linux/platform_data/ata-samsung_cf.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/fb.h>
-#include <plat/gpio-cfg.h>
+#include "fb.h"
+#include "gpio-cfg.h"
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/adc.h>
+#include "devs.h"
+#include "cpu.h"
+#include <linux/soc/samsung/s3c-adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/keypad.h>
-#include <plat/samsung-time.h>
+#include "keypad.h"
 
-#include "backlight.h"
-#include "common.h"
-#include "regs-modem.h"
-#include "regs-srom.h"
-#include "regs-sys.h"
+#include "backlight-s3c64xx.h"
+#include "s3c64xx.h"
+#include "regs-modem-s3c64xx.h"
+#include "regs-srom-s3c64xx.h"
+#include "regs-sys-s3c64xx.h"
 
 #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
@@ -635,7 +633,7 @@ static void __init smdk6410_map_io(void)
        s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
        s3c64xx_set_xtal_freq(12000000);
        s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
 
        /* set the LCD type */
 
@@ -704,6 +702,5 @@ MACHINE_START(SMDK6410, "SMDK6410")
        .init_irq       = s3c6410_init_irq,
        .map_io         = smdk6410_map_io,
        .init_machine   = smdk6410_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
+       .init_time      = s3c64xx_timer_init,
 MACHINE_END
similarity index 81%
rename from arch/arm/mach-s3c24xx/mach-tct_hammer.c
rename to arch/arm/mach-s3c/mach-tct_hammer.c
index 8d8ddd6..2a61df3 100644 (file)
@@ -7,6 +7,7 @@
 // derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
 // Ben Dooks <ben@simtec.co.uk>
 
+#include <linux/gpio/machine.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/flash.h>
 
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
+#include "devs.h"
+#include "cpu.h"
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
-#include <plat/samsung-time.h>
 
-#include "common.h"
+#include "s3c24xx.h"
 
 static struct resource tct_hammer_nor_resource =
                        DEFINE_RES_MEM(0x00000000, SZ_16M);
@@ -103,6 +102,19 @@ static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = {
        }
 };
 
+static struct gpiod_lookup_table tct_hammer_mmc_gpio_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
 
 static struct platform_device *tct_hammer_devices[] __initdata = {
        &s3c_device_adc,
@@ -119,18 +131,19 @@ static void __init tct_hammer_map_io(void)
 {
        s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
        s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init tct_hammer_init_time(void)
 {
        s3c2410_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init tct_hammer_init(void)
 {
        s3c_i2c0_set_platdata(NULL);
+       gpiod_add_lookup_table(&tct_hammer_mmc_gpio_table);
        platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices));
 }
 
similarity index 96%
rename from arch/arm/mach-s3c24xx/mach-vr1000.c
rename to arch/arm/mach-s3c/mach-vr1000.c
index 6a3fb2b..5c3d07c 100644 (file)
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
 
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
+#include "cpu.h"
+#include "devs.h"
 
 #include "bast.h"
-#include "common.h"
+#include "s3c24xx.h"
 #include "simtec.h"
 #include "vr1000.h"
 
@@ -328,13 +326,13 @@ static void __init vr1000_map_io(void)
 
        s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
        s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init vr1000_init_time(void)
 {
        s3c2410_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init vr1000_init(void)
similarity index 88%
rename from arch/arm/mach-s3c24xx/mach-vstms.c
rename to arch/arm/mach-s3c/mach-vstms.c
index c5fa215..05f19f5 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
 #include <asm/setup.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
 
-#include <mach/fb.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include "devs.h"
+#include "cpu.h"
 
-#include "common.h"
+#include "s3c24xx.h"
 
 static struct map_desc vstms_iodesc[] __initdata = {
 };
@@ -136,20 +135,22 @@ static void __init vstms_map_io(void)
 {
        s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
        s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
 }
 
 static void __init vstms_init_time(void)
 {
        s3c2412_init_clocks(12000000);
-       samsung_timer_init();
+       s3c24xx_timer_init();
 }
 
 static void __init vstms_init(void)
 {
        s3c_i2c0_set_platdata(NULL);
        s3c_nand_set_platdata(&vstms_nand_info);
-
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
        platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices));
 }
 
similarity index 87%
rename from arch/arm/plat-samsung/include/plat/map-s3c.h
rename to arch/arm/mach-s3c/map-s3c.h
index 4244acb..a18fdd3 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef __ASM_PLAT_MAP_S3C_H
 #define __ASM_PLAT_MAP_S3C_H __FILE__
 
+#include "map.h"
+
 #define S3C24XX_VA_IRQ         S3C_VA_IRQ
 #define S3C24XX_VA_MEMCTRL     S3C_VA_MEM
 #define S3C24XX_VA_UART                S3C_VA_UART
 
 #define S3C_VA_USB_HSPHY       S3C64XX_VA_USB_HSPHY
 
-/*
- * ISA style IO, for each machine to sort out mappings for,
- * if it implements it. We reserve two 16M regions for ISA.
- */
-
 #define S3C2410_ADDR(x)                S3C_ADDR(x)
 
-#define S3C24XX_VA_ISA_WORD    S3C2410_ADDR(0x02000000)
-#define S3C24XX_VA_ISA_BYTE    S3C2410_ADDR(0x03000000)
-
 /* deal with the registers that move under the 2412/2413 */
 
 #if defined(CONFIG_CPU_S3C2412)
@@ -71,6 +65,6 @@ extern void __iomem *s3c24xx_va_gpio2;
 #define S3C24XX_VA_GPIO2 S3C24XX_VA_GPIO
 #endif
 
-#include <plat/map-s5p.h>
+#include "map-s5p.h"
 
 #endif /* __ASM_PLAT_MAP_S3C_H */
similarity index 97%
rename from arch/arm/mach-s3c24xx/include/mach/map.h
rename to arch/arm/mach-s3c/map-s3c24xx.h
index bca9311..b5dba78 100644 (file)
@@ -9,8 +9,8 @@
 #ifndef __ASM_ARCH_MAP_H
 #define __ASM_ARCH_MAP_H
 
-#include <plat/map-base.h>
-#include <plat/map-s3c.h>
+#include <mach/map-base.h>
+#include "map-s3c.h"
 
 /*
  * interrupt controller is the first thing we put in, to make
@@ -86,6 +86,8 @@
 #define S3C2410_PA_SPI    (0x59000000)
 #define S3C2443_PA_SPI0                (0x52000000)
 #define S3C2443_PA_SPI1                S3C2410_PA_SPI
+#define S3C2410_SPI1           (0x20)
+#define S3C2412_SPI1           (0x100)
 
 /* SDI */
 #define S3C2410_PA_SDI    (0x5A000000)
similarity index 98%
rename from arch/arm/mach-s3c64xx/include/mach/map.h
rename to arch/arm/mach-s3c/map-s3c64xx.h
index 9372a53..d7740d2 100644 (file)
@@ -11,8 +11,8 @@
 #ifndef __ASM_ARCH_MAP_H
 #define __ASM_ARCH_MAP_H __FILE__
 
-#include <plat/map-base.h>
-#include <plat/map-s3c.h>
+#include <mach/map-base.h>
+#include "map-s3c.h"
 
 /*
  * Post-mux Chip Select Regions Xm0CSn_
similarity index 85%
rename from arch/arm/plat-samsung/include/plat/map-s5p.h
rename to arch/arm/mach-s3c/map-s5p.h
index d69a0ca..cd23792 100644 (file)
@@ -9,14 +9,12 @@
 #ifndef __ASM_PLAT_MAP_S5P_H
 #define __ASM_PLAT_MAP_S5P_H __FILE__
 
-#define S5P_VA_CHIPID          S3C_ADDR(0x02000000)
-
 #define VA_VIC(x)              (S3C_VA_IRQ + ((x) * 0x10000))
 #define VA_VIC0                        VA_VIC(0)
 #define VA_VIC1                        VA_VIC(1)
 #define VA_VIC2                        VA_VIC(2)
 #define VA_VIC3                        VA_VIC(3)
 
-#include <plat/map-s3c.h>
+#include "map-s3c.h"
 
 #endif /* __ASM_PLAT_MAP_S5P_H */
diff --git a/arch/arm/mach-s3c/map.h b/arch/arm/mach-s3c/map.h
new file mode 100644 (file)
index 0000000..7cfb517
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "map-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "map-s3c64xx.h"
+#endif
similarity index 77%
rename from arch/arm/mach-s3c24xx/nand-core.h
rename to arch/arm/mach-s3c/nand-core-s3c24xx.h
index 8de633d..a143167 100644 (file)
@@ -6,8 +6,8 @@
  * S3C -  Nand Controller core functions
  */
 
-#ifndef __ASM_ARCH_NAND_CORE_H
-#define __ASM_ARCH_NAND_CORE_H __FILE__
+#ifndef __ASM_ARCH_NAND_CORE_S3C24XX_H
+#define __ASM_ARCH_NAND_CORE_S3C24XX_H __FILE__
 
 /* These functions are only for use with the core support code, such as
  * the cpu specific initialisation code
@@ -21,4 +21,4 @@ static inline void s3c_nand_setname(char *name)
 #endif
 }
 
-#endif /* __ASM_ARCH_NAND_CORE_H */
+#endif /* __ASM_ARCH_NAND_CORE_S3C24XX_H */
similarity index 82%
rename from arch/arm/mach-s3c64xx/onenand-core.h
rename to arch/arm/mach-s3c/onenand-core-s3c64xx.h
index 0cf6b5e..e2dfdd1 100644 (file)
@@ -7,8 +7,8 @@
  * Samsung OneNAD Controller core functions
  */
 
-#ifndef __ASM_ARCH_ONENAND_CORE_H
-#define __ASM_ARCH_ONENAND_CORE_H __FILE__
+#ifndef __ASM_ARCH_ONENAND_CORE_S3C64XX_H
+#define __ASM_ARCH_ONENAND_CORE_S3C64XX_H __FILE__
 
 /* These functions are only for use with the core support code, such as
  * the cpu specific initialisation code
@@ -29,4 +29,4 @@ static inline void s3c64xx_onenand1_setname(char *name)
 #endif
 }
 
-#endif /* __ASM_ARCH_ONENAND_CORE_H */
+#endif /* __ASM_ARCH_ONENAND_CORE_S3C64XX_H */
similarity index 98%
rename from arch/arm/mach-s3c64xx/pl080.c
rename to arch/arm/mach-s3c/pl080.c
index 152edbe..4730f08 100644 (file)
 #include <linux/amba/pl08x.h>
 #include <linux/of.h>
 
-#include <plat/cpu.h>
+#include "cpu.h"
 #include <mach/irqs.h>
-#include <mach/map.h>
+#include "map.h"
 
-#include "regs-sys.h"
+#include "regs-sys-s3c64xx.h"
 
 static int pl08x_get_xfer_signal(const struct pl08x_channel_data *cd)
 {
similarity index 96%
rename from arch/arm/plat-samsung/platformdata.c
rename to arch/arm/mach-s3c/platformdata.c
index cbc3b4b..e643c81 100644 (file)
@@ -9,8 +9,8 @@
 #include <linux/string.h>
 #include <linux/platform_device.h>
 
-#include <plat/devs.h>
-#include <plat/sdhci.h>
+#include "devs.h"
+#include "sdhci.h"
 
 void __init *s3c_set_platdata(void *pd, size_t pdsize,
                              struct platform_device *pdev)
similarity index 97%
rename from arch/arm/mach-s3c24xx/pll-s3c2410.c
rename to arch/arm/mach-s3c/pll-s3c2410.c
index 0561f79..3fbc99e 100644 (file)
@@ -15,8 +15,8 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 /* This array should be sorted in ascending order of the frequencies */
 static struct cpufreq_frequency_table pll_vals_12MHz[] = {
similarity index 97%
rename from arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c
rename to arch/arm/mach-s3c/pll-s3c2440-12000000.c
index 2ec3a2f..fdb8e8c 100644 (file)
@@ -13,8 +13,8 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 /* This array should be sorted in ascending order of the frequencies */
 static struct cpufreq_frequency_table s3c2440_plls_12[] = {
similarity index 98%
rename from arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c
rename to arch/arm/mach-s3c/pll-s3c2440-16934400.c
index 4b3d9e3..438b6fc 100644 (file)
@@ -13,8 +13,8 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 /* This array should be sorted in ascending order of the frequencies */
 static struct cpufreq_frequency_table s3c2440_plls_169344[] = {
similarity index 95%
rename from arch/arm/plat-samsung/pm-common.c
rename to arch/arm/mach-s3c/pm-common.c
index 59a10c6..618bd44 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 
-#include <plat/pm-common.h>
+#include "pm-common.h"
 
 /* helper functions to save and restore register state */
 
@@ -55,6 +55,8 @@ void s3c_pm_do_restore(const struct sleep_save *ptr, int count)
 
 /**
  * s3c_pm_do_restore_core() - early restore register values from save list.
+ * @ptr: Pointer to an array of registers.
+ * @count: Size of the ptr array.
  *
  * This is similar to s3c_pm_do_restore() except we try and minimise the
  * side effects of the function in case registers that hardware might need
diff --git a/arch/arm/mach-s3c/pm-common.h b/arch/arm/mach-s3c/pm-common.h
new file mode 100644 (file)
index 0000000..18b9607
--- /dev/null
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ *     Tomasz Figa <t.figa@samsung.com>
+ * Copyright (c) 2004 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Written by Ben Dooks, <ben@simtec.co.uk>
+ */
+
+#ifndef __PLAT_SAMSUNG_PM_COMMON_H
+#define __PLAT_SAMSUNG_PM_COMMON_H __FILE__
+
+#include <linux/irq.h>
+#include <linux/soc/samsung/s3c-pm.h>
+
+/* sleep save info */
+
+/**
+ * struct sleep_save - save information for shared peripherals.
+ * @reg: Pointer to the register to save.
+ * @val: Holder for the value saved from reg.
+ *
+ * This describes a list of registers which is used by the pm core and
+ * other subsystem to save and restore register values over suspend.
+ */
+struct sleep_save {
+       void __iomem    *reg;
+       unsigned long   val;
+};
+
+#define SAVE_ITEM(x) \
+       { .reg = (x) }
+
+/* helper functions to save/restore lists of registers. */
+
+extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
+extern void s3c_pm_do_restore(const struct sleep_save *ptr, int count);
+extern void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count);
+
+#endif
similarity index 94%
rename from arch/arm/mach-s3c24xx/include/mach/pm-core.h
rename to arch/arm/mach-s3c/pm-core-s3c24xx.h
index 5e4ce89..bcb7978 100644 (file)
 #include <linux/io.h>
 
 #include "regs-clock.h"
-#include "regs-irq.h"
+#include "regs-irq-s3c24xx.h"
+#include <mach/irqs.h>
 
 static inline void s3c_pm_debug_init_uart(void)
 {
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
        unsigned long tmp = __raw_readl(S3C2410_CLKCON);
 
        /* re-start uart clocks */
@@ -24,6 +26,7 @@ static inline void s3c_pm_debug_init_uart(void)
 
        __raw_writel(tmp, S3C2410_CLKCON);
        udelay(10);
+#endif
 }
 
 static inline void s3c_pm_arch_prepare_irqs(void)
@@ -75,11 +78,6 @@ static inline void s3c_pm_arch_show_resume_irqs(void)
                                s3c_irqwake_eintmask);
 }
 
-static inline void s3c_pm_arch_update_uart(void __iomem *regs,
-                                          struct pm_uart_save *save)
-{
-}
-
 static inline void s3c_pm_restored_gpios(void) { }
 static inline void samsung_pm_saved_gpios(void) { }
 
similarity index 58%
rename from arch/arm/mach-s3c64xx/include/mach/pm-core.h
rename to arch/arm/mach-s3c/pm-core-s3c64xx.h
index bbf79ed..06f564e 100644 (file)
 #include <linux/serial_s3c.h>
 #include <linux/delay.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/regs-clock.h>
-#include <mach/map.h>
+#include "regs-gpio.h"
+#include "regs-clock.h"
+#include "map.h"
 
 static inline void s3c_pm_debug_init_uart(void)
 {
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
        u32 tmp = __raw_readl(S3C_PCLK_GATE);
 
        /* As a note, since the S3C64XX UARTs generally have multiple
@@ -35,6 +36,7 @@ static inline void s3c_pm_debug_init_uart(void)
 
        __raw_writel(tmp, S3C_PCLK_GATE);
        udelay(10);
+#endif
 }
 
 static inline void s3c_pm_arch_prepare_irqs(void)
@@ -63,48 +65,6 @@ static inline void s3c_pm_arch_show_resume_irqs(void)
 #define s3c_irqwake_intallow  0
 #endif
 
-static inline void s3c_pm_arch_update_uart(void __iomem *regs,
-                                          struct pm_uart_save *save)
-{
-       u32 ucon = __raw_readl(regs + S3C2410_UCON);
-       u32 ucon_clk = ucon & S3C6400_UCON_CLKMASK;
-       u32 save_clk = save->ucon & S3C6400_UCON_CLKMASK;
-       u32 new_ucon;
-       u32 delta;
-
-       /* S3C64XX UART blocks only support level interrupts, so ensure that
-        * when we restore unused UART blocks we force the level interrupt
-        * settigs. */
-       save->ucon |= S3C2410_UCON_TXILEVEL | S3C2410_UCON_RXILEVEL;
-
-       /* We have a constraint on changing the clock type of the UART
-        * between UCLKx and PCLK, so ensure that when we restore UCON
-        * that the CLK field is correctly modified if the bootloader
-        * has changed anything.
-        */
-       if (ucon_clk != save_clk) {
-               new_ucon = save->ucon;
-               delta = ucon_clk ^ save_clk;
-
-               /* change from UCLKx => wrong PCLK,
-                * either UCLK can be tested for by a bit-test
-                * with UCLK0 */
-               if (ucon_clk & S3C6400_UCON_UCLK0 &&
-                   !(save_clk & S3C6400_UCON_UCLK0) &&
-                   delta & S3C6400_UCON_PCLK2) {
-                       new_ucon &= ~S3C6400_UCON_UCLK0;
-               } else if (delta == S3C6400_UCON_PCLK2) {
-                       /* as an precaution, don't change from
-                        * PCLK2 => PCLK or vice-versa */
-                       new_ucon ^= S3C6400_UCON_PCLK2;
-               }
-
-               S3C_PMDBG("ucon change %04x => %04x (save=%04x)\n",
-                         ucon, new_ucon, save->ucon);
-               save->ucon = new_ucon;
-       }
-}
-
 static inline void s3c_pm_restored_gpios(void)
 {
        /* ensure sleep mode has been cleared from the system */
diff --git a/arch/arm/mach-s3c/pm-core.h b/arch/arm/mach-s3c/pm-core.h
new file mode 100644 (file)
index 0000000..b0e1d27
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "pm-core-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "pm-core-s3c64xx.h"
+#endif
similarity index 99%
rename from arch/arm/plat-samsung/pm-gpio.c
rename to arch/arm/mach-s3c/pm-gpio.c
index cb2e3bc..cfdbc23 100644 (file)
 #include <linux/io.h>
 #include <linux/gpio.h>
 
-#include <mach/gpio-samsung.h>
+#include "gpio-samsung.h"
 
-#include <plat/gpio-core.h>
-#include <plat/pm.h>
+#include "gpio-core.h"
+#include "pm.h"
 
 /* PM GPIO helpers */
 
similarity index 80%
rename from arch/arm/mach-s3c24xx/pm-h1940.S
rename to arch/arm/mach-s3c/pm-h1940.S
index a7bbe33..3bf6685 100644 (file)
@@ -7,10 +7,9 @@
 
 #include <linux/linkage.h>
 #include <asm/assembler.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
+#include "map.h"
 
-#include <mach/regs-gpio.h>
+#include "regs-gpio.h"
 
        .text
        .global h1940_pm_return
similarity index 96%
rename from arch/arm/mach-s3c24xx/pm-s3c2410.c
rename to arch/arm/mach-s3c/pm-s3c2410.c
index 2d8ea70..a664198 100644 (file)
 
 #include <asm/mach-types.h>
 
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 
-#include <plat/gpio-cfg.h>
-#include <plat/cpu.h>
-#include <plat/pm.h>
+#include "gpio-cfg.h"
+#include "cpu.h"
+#include "pm.h"
 
 #include "h1940.h"
 
similarity index 94%
rename from arch/arm/mach-s3c24xx/pm-s3c2412.c
rename to arch/arm/mach-s3c/pm-s3c2412.c
index 2dfdaab..6a96044 100644 (file)
 #include <asm/cacheflush.h>
 #include <asm/irq.h>
 
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
+#include <mach/irqs.h>
+#include "regs-gpio.h"
 
-#include <plat/cpu.h>
-#include <plat/pm.h>
-#include <plat/wakeup-mask.h>
+#include "cpu.h"
+#include "pm.h"
+#include "wakeup-mask.h"
 
-#include "regs-dsc.h"
+#include "regs-dsc-s3c24xx.h"
 #include "s3c2412-power.h"
 
 extern void s3c2412_sleep_enter(void);
similarity index 95%
rename from arch/arm/mach-s3c24xx/pm-s3c2416.c
rename to arch/arm/mach-s3c/pm-s3c2416.c
index 9a2f05e..f69ad84 100644 (file)
 
 #include <asm/cacheflush.h>
 
-#include <mach/regs-s3c2443-clock.h>
+#include "regs-s3c2443-clock.h"
 
-#include <plat/cpu.h>
-#include <plat/pm.h>
+#include "cpu.h"
+#include "pm.h"
 
 #include "s3c2412-power.h"
 
similarity index 93%
rename from arch/arm/mach-s3c24xx/pm.c
rename to arch/arm/mach-s3c/pm-s3c24xx.c
index c64988c..3a8f5c3 100644 (file)
 #include <linux/serial_s3c.h>
 #include <linux/io.h>
 
-#include <mach/regs-clock.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-irq.h>
-#include <mach/gpio-samsung.h>
+#include "regs-clock.h"
+#include "regs-gpio.h"
+#include "regs-irq.h"
+#include "gpio-samsung.h"
 
 #include <asm/mach/time.h>
 
-#include <plat/gpio-cfg.h>
-#include <plat/pm.h>
+#include "gpio-cfg.h"
+#include "pm.h"
 
-#include "regs-mem.h"
+#include "regs-mem-s3c24xx.h"
 
 #define PFX "s3c24xx-pm: "
 
similarity index 81%
rename from arch/arm/mach-s3c64xx/pm.c
rename to arch/arm/mach-s3c/pm-s3c64xx.c
index fd6dbb2..4f17781 100644 (file)
 #include <linux/gpio.h>
 #include <linux/pm_domain.h>
 
-#include <mach/map.h>
+#include "map.h"
 #include <mach/irqs.h>
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
-#include <plat/wakeup-mask.h>
+#include "cpu.h"
+#include "devs.h"
+#include "pm.h"
+#include "wakeup-mask.h"
 
-#include <mach/regs-gpio.h>
-#include <mach/regs-clock.h>
-#include <mach/gpio-samsung.h>
+#include "regs-gpio.h"
+#include "regs-clock.h"
+#include "gpio-samsung.h"
 
-#include "regs-gpio-memport.h"
-#include "regs-modem.h"
-#include "regs-sys.h"
-#include "regs-syscon-power.h"
+#include "regs-gpio-memport-s3c64xx.h"
+#include "regs-modem-s3c64xx.h"
+#include "regs-sys-s3c64xx.h"
+#include "regs-syscon-power-s3c64xx.h"
 
 struct s3c64xx_pm_domain {
        char *const name;
@@ -305,6 +305,56 @@ static void s3c64xx_pm_prepare(void)
        __raw_writel(__raw_readl(S3C64XX_WAKEUP_STAT), S3C64XX_WAKEUP_STAT);
 }
 
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
+void s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save)
+{
+       u32 ucon;
+       u32 ucon_clk
+       u32 save_clk;
+       u32 new_ucon;
+       u32 delta;
+
+       if (!soc_is_s3c64xx())
+               return;
+
+       ucon = __raw_readl(regs + S3C2410_UCON);
+       ucon_clk = ucon & S3C6400_UCON_CLKMASK;
+       sav_clk = save->ucon & S3C6400_UCON_CLKMASK;
+
+       /* S3C64XX UART blocks only support level interrupts, so ensure that
+        * when we restore unused UART blocks we force the level interrupt
+        * settigs. */
+       save->ucon |= S3C2410_UCON_TXILEVEL | S3C2410_UCON_RXILEVEL;
+
+       /* We have a constraint on changing the clock type of the UART
+        * between UCLKx and PCLK, so ensure that when we restore UCON
+        * that the CLK field is correctly modified if the bootloader
+        * has changed anything.
+        */
+       if (ucon_clk != save_clk) {
+               new_ucon = save->ucon;
+               delta = ucon_clk ^ save_clk;
+
+               /* change from UCLKx => wrong PCLK,
+                * either UCLK can be tested for by a bit-test
+                * with UCLK0 */
+               if (ucon_clk & S3C6400_UCON_UCLK0 &&
+                   !(save_clk & S3C6400_UCON_UCLK0) &&
+                   delta & S3C6400_UCON_PCLK2) {
+                       new_ucon &= ~S3C6400_UCON_UCLK0;
+               } else if (delta == S3C6400_UCON_PCLK2) {
+                       /* as an precaution, don't change from
+                        * PCLK2 => PCLK or vice-versa */
+                       new_ucon ^= S3C6400_UCON_PCLK2;
+               }
+
+               S3C_PMDBG("ucon change %04x => %04x (save=%04x)\n",
+                         ucon, new_ucon, save->ucon);
+               save->ucon = new_ucon;
+       }
+}
+#endif
+
 int __init s3c64xx_pm_init(void)
 {
        int i;
similarity index 94%
rename from arch/arm/plat-samsung/pm.c
rename to arch/arm/mach-s3c/pm.c
index d6bfd66..c563bb9 100644 (file)
 #include <asm/cacheflush.h>
 #include <asm/suspend.h>
 
-#include <mach/map.h>
-#include <mach/regs-clock.h>
-#include <mach/regs-irq.h>
+#include "map.h"
+#include "regs-clock.h"
+#include "regs-irq.h"
 #include <mach/irqs.h>
 
 #include <asm/irq.h>
 
-#include <plat/pm.h>
-#include <mach/pm-core.h>
+#include "cpu.h"
+#include "pm.h"
+#include "pm-core.h"
 
 /* for external use */
 
@@ -70,8 +71,7 @@ static int s3c_pm_enter(suspend_state_t state)
 {
        int ret;
        /* ensure the debug is initialised (if enabled) */
-
-       s3c_pm_debug_init();
+       s3c_pm_debug_init_uart();
 
        S3C_PMDBG("%s(%d)\n", __func__, state);
 
@@ -100,7 +100,7 @@ static int s3c_pm_enter(suspend_state_t state)
                samsung_pm_saved_gpios();
        }
 
-       s3c_pm_save_uarts();
+       s3c_pm_save_uarts(soc_is_s3c2410());
        s3c_pm_save_core();
 
        /* set the irq configuration for wake */
@@ -137,14 +137,14 @@ static int s3c_pm_enter(suspend_state_t state)
        /* restore the system state */
 
        s3c_pm_restore_core();
-       s3c_pm_restore_uarts();
+       s3c_pm_restore_uarts(soc_is_s3c2410());
 
        if (!of_have_populated_dt()) {
                samsung_pm_restore_gpios();
                s3c_pm_restored_gpios();
        }
 
-       s3c_pm_debug_init();
+       s3c_pm_debug_init_uart();
 
        /* check what irq (if any) restored the system */
 
similarity index 98%
rename from arch/arm/plat-samsung/include/plat/pm.h
rename to arch/arm/mach-s3c/pm.h
index 2746137..eed61e5 100644 (file)
@@ -11,7 +11,7 @@
  * management
 */
 
-#include <plat/pm-common.h>
+#include "pm-common.h"
 
 struct device;
 
similarity index 99%
rename from arch/arm/mach-s3c24xx/include/mach/regs-clock.h
rename to arch/arm/mach-s3c/regs-clock-s3c24xx.h
index 7ca3dd4..933ddb5 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef __ASM_ARM_REGS_CLOCK
 #define __ASM_ARM_REGS_CLOCK
 
+#include "map.h"
+
 #define S3C2410_CLKREG(x) ((x) + S3C24XX_VA_CLKPWR)
 
 #define S3C2410_PLLVAL(_m,_p,_s) ((_m) << 12 | ((_p) << 4) | ((_s)))
diff --git a/arch/arm/mach-s3c/regs-clock.h b/arch/arm/mach-s3c/regs-clock.h
new file mode 100644 (file)
index 0000000..7df31f2
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "regs-clock-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "regs-clock-s3c64xx.h"
+#endif
similarity index 77%
rename from arch/arm/mach-s3c24xx/regs-dsc.h
rename to arch/arm/mach-s3c/regs-dsc-s3c24xx.h
index b500636..8b8b572 100644 (file)
@@ -7,8 +7,8 @@
  */
 
 
-#ifndef __ASM_ARCH_REGS_DSC_H
-#define __ASM_ARCH_REGS_DSC_H __FILE__
+#ifndef __ASM_ARCH_REGS_DSC_S3C24XX_H
+#define __ASM_ARCH_REGS_DSC_S3C24XX_H __FILE__
 
 /* S3C2412 */
 #define S3C2412_DSC0      S3C2410_GPIOREG(0xdc)
@@ -18,5 +18,5 @@
 #define S3C2440_DSC0      S3C2410_GPIOREG(0xc4)
 #define S3C2440_DSC1      S3C2410_GPIOREG(0xc8)
 
-#endif /* __ASM_ARCH_REGS_DSC_H */
+#endif /* __ASM_ARCH_REGS_DSC_S3C24XX_H */
 
similarity index 99%
rename from arch/arm/mach-s3c24xx/include/mach/regs-gpio.h
rename to arch/arm/mach-s3c/regs-gpio-s3c24xx.h
index 594e967..9a7e262 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef __ASM_ARCH_REGS_GPIO_H
 #define __ASM_ARCH_REGS_GPIO_H
 
+#include "map-s3c.h"
+
 #define S3C24XX_MISCCR         S3C24XX_GPIOREG2(0x80)
 
 /* general configuration options */
diff --git a/arch/arm/mach-s3c/regs-gpio.h b/arch/arm/mach-s3c/regs-gpio.h
new file mode 100644 (file)
index 0000000..0d41cb7
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "regs-gpio-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "regs-gpio-s3c64xx.h"
+#endif
similarity index 98%
rename from arch/arm/mach-s3c24xx/include/mach/regs-irq.h
rename to arch/arm/mach-s3c/regs-irq-s3c24xx.h
index 8d8e669..c0b97b2 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef ___ASM_ARCH_REGS_IRQ_H
 #define ___ASM_ARCH_REGS_IRQ_H
 
+#include "map-s3c.h"
+
 /* interrupt controller */
 
 #define S3C2410_IRQREG(x)   ((x) + S3C24XX_VA_IRQ)
diff --git a/arch/arm/mach-s3c/regs-irq.h b/arch/arm/mach-s3c/regs-irq.h
new file mode 100644 (file)
index 0000000..57f0dda
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "regs-irq-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "regs-irq-s3c64xx.h"
+#endif
similarity index 98%
rename from arch/arm/mach-s3c24xx/regs-mem.h
rename to arch/arm/mach-s3c/regs-mem-s3c24xx.h
index 2f3bc48..8fed34a 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef __ARCH_ARM_MACH_S3C24XX_REGS_MEM_H
 #define __ARCH_ARM_MACH_S3C24XX_REGS_MEM_H __FILE__
 
+#include "map-s3c.h"
+
 #define S3C2410_MEMREG(x)              (S3C24XX_VA_MEMCTRL + (x))
 
 #define S3C2410_BWSCON                 S3C2410_MEMREG(0x00)
@@ -10,6 +10,9 @@
 #ifndef __ASM_ARM_REGS_S3C2443_CLOCK
 #define __ASM_ARM_REGS_S3C2443_CLOCK
 
+#include <linux/delay.h>
+#include "map-s3c.h"
+
 #define S3C2443_CLKREG(x)              ((x) + S3C24XX_VA_CLKPWR)
 
 #define S3C2443_PLLCON_MDIVSHIFT       16
@@ -184,5 +187,52 @@ s3c2443_get_epll(unsigned int pllval, unsigned int baseclk)
        return (unsigned int)fvco;
 }
 
+static inline void s3c_hsudc_init_phy(void)
+{
+       u32 cfg;
+
+       cfg = readl(S3C2443_PWRCFG) | S3C2443_PWRCFG_USBPHY;
+       writel(cfg, S3C2443_PWRCFG);
+
+       cfg = readl(S3C2443_URSTCON);
+       cfg |= (S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST);
+       writel(cfg, S3C2443_URSTCON);
+       mdelay(1);
+
+       cfg = readl(S3C2443_URSTCON);
+       cfg &= ~(S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST);
+       writel(cfg, S3C2443_URSTCON);
+
+       cfg = readl(S3C2443_PHYCTRL);
+       cfg &= ~(S3C2443_PHYCTRL_CLKSEL | S3C2443_PHYCTRL_DSPORT);
+       cfg |= (S3C2443_PHYCTRL_EXTCLK | S3C2443_PHYCTRL_PLLSEL);
+       writel(cfg, S3C2443_PHYCTRL);
+
+       cfg = readl(S3C2443_PHYPWR);
+       cfg &= ~(S3C2443_PHYPWR_FSUSPEND | S3C2443_PHYPWR_PLL_PWRDN |
+               S3C2443_PHYPWR_XO_ON | S3C2443_PHYPWR_PLL_REFCLK |
+               S3C2443_PHYPWR_ANALOG_PD);
+       cfg |= S3C2443_PHYPWR_COMMON_ON;
+       writel(cfg, S3C2443_PHYPWR);
+
+       cfg = readl(S3C2443_UCLKCON);
+       cfg |= (S3C2443_UCLKCON_DETECT_VBUS | S3C2443_UCLKCON_FUNC_CLKEN |
+               S3C2443_UCLKCON_TCLKEN);
+       writel(cfg, S3C2443_UCLKCON);
+}
+
+static inline void s3c_hsudc_uninit_phy(void)
+{
+       u32 cfg;
+
+       cfg = readl(S3C2443_PWRCFG) & ~S3C2443_PWRCFG_USBPHY;
+       writel(cfg, S3C2443_PWRCFG);
+
+       writel(S3C2443_PHYPWR_FSUSPEND, S3C2443_PHYPWR);
+
+       cfg = readl(S3C2443_UCLKCON) & ~S3C2443_UCLKCON_FUNC_CLKEN;
+       writel(cfg, S3C2443_UCLKCON);
+}
+
 #endif /*  __ASM_ARM_REGS_S3C2443_CLOCK */
 
similarity index 81%
rename from arch/arm/mach-s3c24xx/include/mach/rtc-core.h
rename to arch/arm/mach-s3c/rtc-core-s3c24xx.h
index 8851033..e7258b2 100644 (file)
@@ -5,8 +5,8 @@
  * Samsung RTC Controller core functions
  */
 
-#ifndef __RTC_CORE_H
-#define __RTC_CORE_H __FILE__
+#ifndef __RTC_CORE_S3C24XX_H
+#define __RTC_CORE_S3C24XX_H __FILE__
 
 /* These functions are only for use with the core support code, such as
  * the cpu specific initialisation code
@@ -20,4 +20,4 @@ static inline void s3c_rtc_setname(char *name)
        s3c_device_rtc.name = name;
 }
 
-#endif /* __RTC_CORE_H */
+#endif /* __RTC_CORE_S3C24XX_H */
similarity index 88%
rename from arch/arm/mach-s3c24xx/s3c2410.c
rename to arch/arm/mach-s3c/s3c2410.c
index 21fd540..4d39d99 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
+#include "map.h"
+#include "gpio-samsung.h"
 #include <asm/irq.h>
 #include <asm/system_misc.h>
 
-#include <plat/cpu-freq.h>
 
-#include <mach/regs-clock.h>
+#include "regs-clock.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
+#include "cpu.h"
+#include "devs.h"
+#include "pm.h"
 
-#include <plat/gpio-core.h>
-#include <plat/gpio-cfg.h>
-#include <plat/gpio-cfg-helpers.h>
+#include "gpio-core.h"
+#include "gpio-cfg.h"
+#include "gpio-cfg-helpers.h"
 
-#include "common.h"
+#include "s3c24xx.h"
 
 /* Initial IO mappings */
 
-static struct map_desc s3c2410_iodesc[] __initdata = {
+static struct map_desc s3c2410_iodesc[] __initdata __maybe_unused = {
        IODESC_ENT(CLKPWR),
        IODESC_ENT(TIMER),
        IODESC_ENT(WATCHDOG),
similarity index 92%
rename from arch/arm/mach-s3c24xx/s3c2412.c
rename to arch/arm/mach-s3c/s3c2412.c
index 8fe4d46..0b1ca78 100644 (file)
 #include <asm/irq.h>
 #include <asm/system_misc.h>
 
-#include <mach/hardware.h>
-#include <mach/regs-clock.h>
-#include <mach/regs-gpio.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
-#include <plat/regs-spi.h>
-
-#include "common.h"
-#include "nand-core.h"
-#include "regs-dsc.h"
+#include "map.h"
+#include "regs-clock.h"
+#include "regs-gpio.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "pm.h"
+
+#include "s3c24xx.h"
+#include "nand-core-s3c24xx.h"
+#include "regs-dsc-s3c24xx.h"
 #include "s3c2412-power.h"
 
 #ifndef CONFIG_CPU_S3C2412_ONLY
@@ -57,7 +55,7 @@ static inline void s3c2412_init_gpio2(void)
 
 /* Initial IO mappings */
 
-static struct map_desc s3c2412_iodesc[] __initdata = {
+static struct map_desc s3c2412_iodesc[] __initdata __maybe_unused = {
        IODESC_ENT(CLKPWR),
        IODESC_ENT(TIMER),
        IODESC_ENT(WATCHDOG),
similarity index 96%
rename from arch/arm/mach-s3c24xx/include/mach/s3c2412.h
rename to arch/arm/mach-s3c/s3c2412.h
index 4ff83f9..ed09a0e 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef __ARCH_ARM_MACH_S3C24XX_S3C2412_H
 #define __ARCH_ARM_MACH_S3C24XX_S3C2412_H __FILE__
 
+#include "map-s3c.h"
+
 #define S3C2412_MEMREG(x)              (S3C24XX_VA_MEMCTRL + (x))
 #define S3C2412_EBIREG(x)              (S3C2412_VA_EBI + (x))
 
similarity index 84%
rename from arch/arm/mach-s3c24xx/s3c2416.c
rename to arch/arm/mach-s3c/s3c2416.c
index 9514196..126e6ed 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
+#include "map.h"
+#include "gpio-samsung.h"
 #include <asm/proc-fns.h>
 #include <asm/irq.h>
 #include <asm/system_misc.h>
 
-#include <mach/regs-s3c2443-clock.h>
-#include <mach/rtc-core.h>
+#include "regs-s3c2443-clock.h"
+#include "rtc-core-s3c24xx.h"
 
-#include <plat/gpio-core.h>
-#include <plat/gpio-cfg.h>
-#include <plat/gpio-cfg-helpers.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/sdhci.h>
-#include <plat/pm.h>
+#include "gpio-core.h"
+#include "gpio-cfg.h"
+#include "gpio-cfg-helpers.h"
+#include "devs.h"
+#include "cpu.h"
+#include "sdhci.h"
+#include "pm.h"
 
-#include <plat/iic-core.h>
-#include <plat/adc-core.h>
+#include "iic-core.h"
+#include "adc-core.h"
 
-#include "common.h"
-#include "fb-core.h"
-#include "nand-core.h"
-#include "spi-core.h"
+#include "s3c24xx.h"
+#include "fb-core-s3c24xx.h"
+#include "nand-core-s3c24xx.h"
+#include "spi-core-s3c24xx.h"
 
-static struct map_desc s3c2416_iodesc[] __initdata = {
+static struct map_desc s3c2416_iodesc[] __initdata __maybe_unused = {
        IODESC_ENT(WATCHDOG),
        IODESC_ENT(CLKPWR),
        IODESC_ENT(TIMER),
similarity index 85%
rename from arch/arm/mach-s3c24xx/s3c2440.c
rename to arch/arm/mach-s3c/s3c2440.c
index 451d985..c6cdee4 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
 #include <asm/irq.h>
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/pm.h>
+#include "devs.h"
+#include "cpu.h"
+#include "pm.h"
 
-#include <plat/gpio-core.h>
-#include <plat/gpio-cfg.h>
-#include <plat/gpio-cfg-helpers.h>
+#include "gpio-core.h"
+#include "gpio-cfg.h"
+#include "gpio-cfg-helpers.h"
+#include "gpio-samsung.h"
 
-#include "common.h"
+#include "s3c24xx.h"
 
 static struct device s3c2440_dev = {
        .bus            = &s3c2440_subsys,
similarity index 82%
rename from arch/arm/mach-s3c24xx/s3c2442.c
rename to arch/arm/mach-s3c/s3c2442.c
index 432d683..0c0e30b 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
 #include <linux/atomic.h>
 #include <asm/irq.h>
 
-#include <mach/regs-clock.h>
+#include "regs-clock.h"
 
-#include <plat/cpu.h>
-#include <plat/pm.h>
+#include "cpu.h"
+#include "pm.h"
 
-#include <plat/gpio-core.h>
-#include <plat/gpio-cfg.h>
-#include <plat/gpio-cfg-helpers.h>
+#include "gpio-core.h"
+#include "gpio-cfg.h"
+#include "gpio-cfg-helpers.h"
+#include "gpio-samsung.h"
 
-#include "common.h"
+#include "s3c24xx.h"
 
 static struct device s3c2442_dev = {
        .bus            = &s3c2442_subsys,
similarity index 83%
rename from arch/arm/mach-s3c24xx/s3c2443.c
rename to arch/arm/mach-s3c/s3c2443.c
index 4cbeb74..08f9101 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
+#include "map.h"
+#include "gpio-samsung.h"
+#include <mach/irqs.h>
 #include <asm/irq.h>
 #include <asm/system_misc.h>
 
-#include <mach/regs-s3c2443-clock.h>
-#include <mach/rtc-core.h>
+#include "regs-s3c2443-clock.h"
+#include "rtc-core-s3c24xx.h"
 
-#include <plat/gpio-core.h>
-#include <plat/gpio-cfg.h>
-#include <plat/gpio-cfg-helpers.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/adc-core.h>
+#include "gpio-core.h"
+#include "gpio-cfg.h"
+#include "gpio-cfg-helpers.h"
+#include "devs.h"
+#include "cpu.h"
+#include "adc-core.h"
 
-#include "fb-core.h"
-#include "nand-core.h"
-#include "spi-core.h"
+#include "s3c24xx.h"
+#include "fb-core-s3c24xx.h"
+#include "nand-core-s3c24xx.h"
+#include "spi-core-s3c24xx.h"
 
-static struct map_desc s3c2443_iodesc[] __initdata = {
+static struct map_desc s3c2443_iodesc[] __initdata __maybe_unused = {
        IODESC_ENT(WATCHDOG),
        IODESC_ENT(CLKPWR),
        IODESC_ENT(TIMER),
similarity index 90%
rename from arch/arm/mach-s3c24xx/s3c244x.c
rename to arch/arm/mach-s3c/s3c244x.c
index a75f588..95df349 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
+#include "map.h"
 #include <asm/irq.h>
 
-#include <plat/cpu-freq.h>
+#include "regs-clock.h"
+#include "regs-gpio.h"
 
-#include <mach/regs-clock.h>
-#include <mach/regs-gpio.h>
+#include "devs.h"
+#include "cpu.h"
+#include "pm.h"
 
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/pm.h>
+#include "s3c24xx.h"
+#include "nand-core-s3c24xx.h"
+#include "regs-dsc-s3c24xx.h"
 
-#include "common.h"
-#include "nand-core.h"
-#include "regs-dsc.h"
-
-static struct map_desc s3c244x_iodesc[] __initdata = {
+static struct map_desc s3c244x_iodesc[] __initdata __maybe_unused = {
        IODESC_ENT(CLKPWR),
        IODESC_ENT(TIMER),
        IODESC_ENT(WATCHDOG),
similarity index 97%
rename from arch/arm/mach-s3c24xx/common.c
rename to arch/arm/mach-s3c/s3c24xx.c
index 3dc029c..ccfed48 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/platform_data/clk-s3c2410.h>
 #include <linux/platform_data/dma-s3c24xx.h>
 #include <linux/dmaengine.h>
+#include <linux/clk/samsung.h>
 
-#include <mach/hardware.h>
-#include <mach/regs-clock.h>
+#include "hardware-s3c24xx.h"
+#include "map.h"
+#include "regs-clock.h"
 #include <asm/irq.h>
 #include <asm/cacheflush.h>
 #include <asm/system_info.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/dma.h>
+#include "regs-gpio.h"
+#include "dma-s3c24xx.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/cpu-freq.h>
-#include <plat/pwm-core.h>
+#include "cpu.h"
+#include "devs.h"
+#include "pwm-core.h"
 
-#include "common.h"
+#include "s3c24xx.h"
 
 /* table of supported CPUs */
 
@@ -137,7 +139,7 @@ static struct cpu_table cpu_ids[] __initdata = {
 
 /* minimal IO mapping */
 
-static struct map_desc s3c_iodesc[] __initdata = {
+static struct map_desc s3c_iodesc[] __initdata __maybe_unused = {
        IODESC_ENT(GPIO),
        IODESC_ENT(IRQ),
        IODESC_ENT(MEMCTRL),
@@ -220,13 +222,13 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
        samsung_pwm_set_platdata(&s3c24xx_pwm_variant);
 }
 
-void __init samsung_set_timer_source(unsigned int event, unsigned int source)
+void __init s3c24xx_set_timer_source(unsigned int event, unsigned int source)
 {
        s3c24xx_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
        s3c24xx_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
 }
 
-void __init samsung_timer_init(void)
+void __init s3c24xx_timer_init(void)
 {
        unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
                IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2, IRQ_TIMER3, IRQ_TIMER4,
@@ -662,10 +664,17 @@ static struct resource s3c2410_dclk_resource[] = {
        [0] = DEFINE_RES_MEM(0x56000084, 0x4),
 };
 
+static struct s3c2410_clk_platform_data s3c_clk_platform_data = {
+       .modify_misccr = s3c2410_modify_misccr,
+};
+
 struct platform_device s3c2410_device_dclk = {
        .name           = "s3c2410-dclk",
        .id             = 0,
        .num_resources  = ARRAY_SIZE(s3c2410_dclk_resource),
        .resource       = s3c2410_dclk_resource,
+       .dev            = {
+               .platform_data = &s3c_clk_platform_data,
+       },
 };
 #endif
similarity index 85%
rename from arch/arm/mach-s3c24xx/common.h
rename to arch/arm/mach-s3c/s3c24xx.h
index d087b20..5848bef 100644 (file)
@@ -10,6 +10,7 @@
 #define __ARCH_ARM_MACH_S3C24XX_COMMON_H __FILE__
 
 #include <linux/reboot.h>
+#include <mach/irqs.h>
 
 struct s3c2410_uartcfg;
 
@@ -108,19 +109,16 @@ extern struct platform_device s3c2443_device_dma;
 
 extern struct platform_device s3c2410_device_dclk;
 
-#ifdef CONFIG_S3C2410_COMMON_CLK
-void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
-                                   int current_soc,
-                                   void __iomem *reg_base);
-#endif
-#ifdef CONFIG_S3C2412_COMMON_CLK
-void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
-                               unsigned long ext_f, void __iomem *reg_base);
-#endif
-#ifdef CONFIG_S3C2443_COMMON_CLK
-void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
-                                   int current_soc,
-                                   void __iomem *reg_base);
-#endif
+enum s3c24xx_timer_mode {
+       S3C24XX_PWM0,
+       S3C24XX_PWM1,
+       S3C24XX_PWM2,
+       S3C24XX_PWM3,
+       S3C24XX_PWM4,
+};
+
+extern void __init s3c24xx_set_timer_source(enum s3c24xx_timer_mode event,
+                                           enum s3c24xx_timer_mode source);
+extern void __init s3c24xx_timer_init(void);
 
 #endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */
similarity index 88%
rename from arch/arm/mach-s3c64xx/s3c6400.c
rename to arch/arm/mach-s3c/s3c6400.c
index 545eea7..802f4fb 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
 #include <asm/irq.h>
 
-#include <plat/cpu-freq.h>
-#include <mach/regs-clock.h>
+#include "regs-clock.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/sdhci.h>
-#include <plat/iic-core.h>
+#include "cpu.h"
+#include "devs.h"
+#include "sdhci.h"
+#include "iic-core.h"
 
-#include "common.h"
-#include "onenand-core.h"
+#include "s3c64xx.h"
+#include "onenand-core-s3c64xx.h"
 
 void __init s3c6400_map_io(void)
 {
similarity index 87%
rename from arch/arm/mach-s3c64xx/s3c6410.c
rename to arch/arm/mach-s3c/s3c6410.c
index 47e04e0..dae17d5 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
 #include <asm/irq.h>
 
-#include <plat/cpu-freq.h>
-#include <mach/regs-clock.h>
+#include <linux/soc/samsung/s3c-pm.h>
+#include "regs-clock.h"
 
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/sdhci.h>
-#include <plat/adc-core.h>
-#include <plat/iic-core.h>
+#include "cpu.h"
+#include "devs.h"
+#include "sdhci.h"
+#include "adc-core.h"
+#include "iic-core.h"
 
-#include "ata-core.h"
-#include "common.h"
-#include "onenand-core.h"
+#include "ata-core-s3c64xx.h"
+#include "s3c64xx.h"
+#include "onenand-core-s3c64xx.h"
 
 void __init s3c6410_map_io(void)
 {
similarity index 91%
rename from arch/arm/mach-s3c64xx/common.c
rename to arch/arm/mach-s3c/s3c64xx.c
index 13e9107..4dfb648 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/platform_device.h>
 #include <linux/reboot.h>
 #include <linux/io.h>
+#include <linux/clk/samsung.h>
 #include <linux/dma-mapping.h>
 #include <linux/irq.h>
 #include <linux/gpio.h>
 #include <asm/mach/map.h>
 #include <asm/system_misc.h>
 
-#include <mach/map.h>
+#include "map.h"
 #include <mach/irqs.h>
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
-#include <plat/gpio-cfg.h>
-#include <plat/pwm-core.h>
-#include <plat/regs-irqtype.h>
-
-#include "common.h"
-#include "irq-uart.h"
-#include "watchdog-reset.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "pm.h"
+#include "gpio-cfg.h"
+#include "pwm-core.h"
+#include "regs-irqtype.h"
+#include "s3c64xx.h"
+#include "irq-uart-s3c64xx.h"
 
 /* External clock frequency */
 static unsigned long xtal_f __ro_after_init = 12000000;
@@ -97,7 +95,12 @@ static struct cpu_table cpu_ids[] __initdata = {
 
 /* minimal IO mapping */
 
-/* see notes on uart map in arch/arm/mach-s3c64xx/include/mach/debug-macro.S */
+/*
+ * note, for the boot process to work we have to keep the UART
+ * virtual address aligned to an 1MiB boundary for the L1
+ * mapping the head code makes. We keep the UART virtual address
+ * aligned and add in the offset when we load the value here.
+ */
 #define UART_OFFS (S3C_PA_UART & 0xfffff)
 
 static struct map_desc s3c_iodesc[] __initdata = {
@@ -170,13 +173,13 @@ static struct samsung_pwm_variant s3c64xx_pwm_variant = {
        .tclk_mask      = (1 << 7) | (1 << 6) | (1 << 5),
 };
 
-void __init samsung_set_timer_source(unsigned int event, unsigned int source)
+void __init s3c64xx_set_timer_source(unsigned int event, unsigned int source)
 {
        s3c64xx_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
        s3c64xx_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
 }
 
-void __init samsung_timer_init(void)
+void __init s3c64xx_timer_init(void)
 {
        unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
                IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
@@ -228,13 +231,7 @@ core_initcall(s3c64xx_dev_init);
 
 void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
 {
-       /*
-        * FIXME: there is no better place to put this at the moment
-        * (s3c64xx_clk_init needs ioremap and must happen before init_time
-        * samsung_wdt_reset_init needs clocks)
-        */
        s3c64xx_clk_init(NULL, xtal_f, xusbxti_f, soc_is_s3c6400(), S3C_VA_SYS);
-       samsung_wdt_reset_init(S3C_VA_WATCHDOG);
 
        printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
 
@@ -428,12 +425,3 @@ static int __init s3c64xx_init_irq_eint(void)
        return 0;
 }
 arch_initcall(s3c64xx_init_irq_eint);
-
-void s3c64xx_restart(enum reboot_mode mode, const char *cmd)
-{
-       if (mode != REBOOT_SOFT)
-               samsung_wdt_reset();
-
-       /* if all else fails, or mode was for soft, jump to 0 */
-       soft_restart(0);
-}
similarity index 80%
rename from arch/arm/mach-s3c64xx/common.h
rename to arch/arm/mach-s3c/s3c64xx.h
index 0367088..92258e4 100644 (file)
 void s3c64xx_init_irq(u32 vic0, u32 vic1);
 void s3c64xx_init_io(struct map_desc *mach_desc, int size);
 
-void s3c64xx_restart(enum reboot_mode mode, const char *cmd);
-
 struct device_node;
-void s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
-       unsigned long xusbxti_f, bool is_s3c6400, void __iomem *reg_base);
 void s3c64xx_set_xtal_freq(unsigned long freq);
 void s3c64xx_set_xusbxti_freq(unsigned long freq);
 
@@ -54,4 +50,17 @@ extern struct pl08x_platform_data s3c64xx_dma0_plat_data;
 extern struct pl08x_platform_data s3c64xx_dma1_plat_data;
 #endif
 
+/* Samsung HR-Timer Clock mode */
+enum s3c64xx_timer_mode {
+       S3C64XX_PWM0,
+       S3C64XX_PWM1,
+       S3C64XX_PWM2,
+       S3C64XX_PWM3,
+       S3C64XX_PWM4,
+};
+
+extern void __init s3c64xx_set_timer_source(enum s3c64xx_timer_mode event,
+                                           enum s3c64xx_timer_mode source);
+extern void __init s3c64xx_timer_init(void);
+
 #endif /* __ARCH_ARM_MACH_S3C64XX_COMMON_H */
similarity index 99%
rename from arch/arm/plat-samsung/include/plat/sdhci.h
rename to arch/arm/mach-s3c/sdhci.h
index 5731e42..9f9d419 100644 (file)
@@ -15,7 +15,7 @@
 #define __PLAT_S3C_SDHCI_H __FILE__
 
 #include <linux/platform_data/mmc-sdhci-s3c.h>
-#include <plat/devs.h>
+#include "devs.h"
 
 /* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
  * @pd: The default platform data for this device.
similarity index 86%
rename from arch/arm/mach-s3c64xx/setup-fb-24bpp.c
rename to arch/arm/mach-s3c/setup-fb-24bpp-s3c64xx.c
index 2c7178b..cfa34b5 100644 (file)
@@ -12,9 +12,9 @@
 #include <linux/fb.h>
 #include <linux/gpio.h>
 
-#include <plat/fb.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
+#include "fb.h"
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
 
 void s3c64xx_fb_gpio_setup_24bpp(void)
 {
similarity index 79%
rename from arch/arm/mach-s3c24xx/setup-i2c.c
rename to arch/arm/mach-s3c/setup-i2c-s3c24xx.c
index 1a01d44..0d88366 100644 (file)
 
 struct platform_device;
 
-#include <plat/gpio-cfg.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
+
+#include "gpio-cfg.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
 
 void s3c_i2c0_cfg_gpio(struct platform_device *dev)
 {
similarity index 90%
rename from arch/arm/mach-s3c64xx/setup-i2c0.c
rename to arch/arm/mach-s3c/setup-i2c0-s3c64xx.c
index 552eb50..a6ef8d2 100644 (file)
@@ -14,8 +14,8 @@
 struct platform_device; /* don't need the contents */
 
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
 
 void s3c_i2c0_cfg_gpio(struct platform_device *dev)
 {
similarity index 90%
rename from arch/arm/mach-s3c64xx/setup-i2c1.c
rename to arch/arm/mach-s3c/setup-i2c1-s3c64xx.c
index d231f0f..0fe3736 100644 (file)
@@ -14,8 +14,8 @@
 struct platform_device; /* don't need the contents */
 
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
 
 void s3c_i2c1_cfg_gpio(struct platform_device *dev)
 {
similarity index 89%
rename from arch/arm/mach-s3c64xx/setup-ide.c
rename to arch/arm/mach-s3c/setup-ide-s3c64xx.c
index 810139a..f11f2b0 100644 (file)
@@ -9,12 +9,13 @@
 #include <linux/gpio.h>
 #include <linux/io.h>
 
-#include <mach/map.h>
-#include <mach/regs-clock.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
 #include <linux/platform_data/ata-samsung_cf.h>
 
+#include "map.h"
+#include "regs-clock.h"
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
+
 void s3c64xx_ide_setup_gpio(void)
 {
        u32 reg;
similarity index 86%
rename from arch/arm/mach-s3c64xx/setup-keypad.c
rename to arch/arm/mach-s3c/setup-keypad-s3c64xx.c
index 3519610..8463ad3 100644 (file)
@@ -6,9 +6,9 @@
 // GPIO configuration for S3C64XX KeyPad device
 
 #include <linux/gpio.h>
-#include <plat/gpio-cfg.h>
-#include <plat/keypad.h>
-#include <mach/gpio-samsung.h>
+#include "gpio-cfg.h"
+#include "keypad.h"
+#include "gpio-samsung.h"
 
 void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
 {
similarity index 89%
rename from arch/arm/mach-s3c24xx/setup-sdhci-gpio.c
rename to arch/arm/mach-s3c/setup-sdhci-gpio-s3c24xx.c
index 218346a..02131b3 100644 (file)
 #include <linux/io.h>
 #include <linux/gpio.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-#include <plat/gpio-cfg.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
+#include "sdhci.h"
 
 void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
 {
similarity index 95%
rename from arch/arm/mach-s3c64xx/setup-sdhci-gpio.c
rename to arch/arm/mach-s3c/setup-sdhci-gpio-s3c64xx.c
index 138455a..646ff94 100644 (file)
@@ -13,9 +13,9 @@
 #include <linux/io.h>
 #include <linux/gpio.h>
 
-#include <plat/gpio-cfg.h>
-#include <plat/sdhci.h>
-#include <mach/gpio-samsung.h>
+#include "gpio-cfg.h"
+#include "sdhci.h"
+#include "gpio-samsung.h"
 
 void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
 {
similarity index 85%
rename from arch/arm/mach-s3c24xx/setup-spi.c
rename to arch/arm/mach-s3c/setup-spi-s3c24xx.c
index 6c2b96a..93fa1bb 100644 (file)
@@ -8,10 +8,10 @@
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
 
-#include <plat/gpio-cfg.h>
+#include "gpio-cfg.h"
 
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
+#include "hardware-s3c24xx.h"
+#include "regs-gpio.h"
 
 #ifdef CONFIG_S3C64XX_DEV_SPI0
 int s3c64xx_spi0_cfg_gpio(void)
similarity index 83%
rename from arch/arm/mach-s3c64xx/setup-spi.c
rename to arch/arm/mach-s3c/setup-spi-s3c64xx.c
index 39dfae1..efcf78d 100644 (file)
@@ -4,8 +4,9 @@
 //             http://www.samsung.com/
 
 #include <linux/gpio.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
+#include <linux/platform_data/spi-s3c64xx.h>
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
 
 #ifdef CONFIG_S3C64XX_DEV_SPI0
 int s3c64xx_spi0_cfg_gpio(void)
similarity index 81%
rename from arch/arm/mach-s3c24xx/setup-ts.c
rename to arch/arm/mach-s3c/setup-ts-s3c24xx.c
index 53a14d4..57363ea 100644 (file)
 
 struct platform_device; /* don't need the contents */
 
-#include <plat/gpio-cfg.h>
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
+#include <linux/platform_data/touchscreen-s3c2410.h>
+
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
 
 /**
  * s3c24xx_ts_cfg_gpio - configure gpio for s3c2410 systems
+ * @dev: Device to configure GPIO for (ignored)
  *
  * Configure the GPIO for the S3C2410 system, where we have external FETs
  * connected to the device (later systems such as the S3C2440 integrate
similarity index 92%
rename from arch/arm/mach-s3c64xx/setup-usb-phy.c
rename to arch/arm/mach-s3c/setup-usb-phy-s3c64xx.c
index d6b0e3b..500d105 100644 (file)
@@ -8,12 +8,12 @@
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
-#include <mach/map.h>
-#include <plat/cpu.h>
-#include <plat/usb-phy.h>
+#include "map.h"
+#include "cpu.h"
+#include "usb-phy.h"
 
-#include "regs-sys.h"
-#include "regs-usb-hsotg-phy.h"
+#include "regs-sys-s3c64xx.h"
+#include "regs-usb-hsotg-phy-s3c64xx.h"
 
 enum samsung_usb_phy_type {
        USB_PHY_TYPE_DEVICE,
@@ -31,7 +31,7 @@ static int s3c_usb_otgphy_init(struct platform_device *pdev)
        phyclk = readl(S3C_PHYCLK) & ~S3C_PHYCLK_CLKSEL_MASK;
 
        xusbxti = clk_get(&pdev->dev, "xusbxti");
-       if (xusbxti && !IS_ERR(xusbxti)) {
+       if (!IS_ERR(xusbxti)) {
                switch (clk_get_rate(xusbxti)) {
                case 12 * MHZ:
                        phyclk |= S3C_PHYCLK_CLKSEL_12M;
similarity index 86%
rename from arch/arm/mach-s3c24xx/simtec-audio.c
rename to arch/arm/mach-s3c/simtec-audio.c
index 12e17f8..487485b 100644 (file)
 #include <linux/device.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
 
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
-#include <plat/devs.h>
+#include "devs.h"
 
 #include "bast.h"
 #include "simtec.h"
@@ -65,6 +66,10 @@ int __init simtec_audio_add(const char *name, bool has_lr_routing,
        if (has_lr_routing)
                simtec_audio_platdata.startup = simtec_audio_startup_lrroute;
 
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+
        platform_device_register(&s3c_device_iis);
        platform_device_register(&simtec_audio_dev);
        return 0;
similarity index 98%
rename from arch/arm/mach-s3c24xx/simtec-nor.c
rename to arch/arm/mach-s3c/simtec-nor.c
index 26b1849..a6fba05 100644 (file)
@@ -21,7 +21,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/map.h>
+#include "map.h"
 
 #include "bast.h"
 #include "simtec.h"
similarity index 91%
rename from arch/arm/mach-s3c24xx/simtec-pm.c
rename to arch/arm/mach-s3c/simtec-pm.c
index c19074d..490256a 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/hardware.h>
-
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
+#include "map.h"
+#include "regs-gpio.h"
 
 #include <asm/mach-types.h>
 
-#include <plat/pm.h>
+#include "pm.h"
 
-#include "regs-mem.h"
+#include "regs-mem-s3c24xx.h"
 
 #define COPYRIGHT ", Copyright 2005 Simtec Electronics"
 
similarity index 96%
rename from arch/arm/mach-s3c24xx/simtec-usb.c
rename to arch/arm/mach-s3c/simtec-usb.c
index dc1016f..18fe064 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
+#include "gpio-samsung.h"
+#include <mach/irqs.h>
 #include <asm/irq.h>
 
 #include <linux/platform_data/usb-ohci-s3c2410.h>
-#include <plat/devs.h>
+#include "devs.h"
 
 #include "bast.h"
 #include "simtec.h"
similarity index 90%
rename from arch/arm/mach-s3c24xx/sleep-s3c2410.S
rename to arch/arm/mach-s3c/sleep-s3c2410.S
index 659f9ef..04aded9 100644 (file)
 #include <linux/linkage.h>
 #include <linux/serial_s3c.h>
 #include <asm/assembler.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
+#include "map.h"
 
-#include <mach/regs-gpio.h>
-#include <mach/regs-clock.h>
+#include "regs-gpio.h"
+#include "regs-clock.h"
 
-#include "regs-mem.h"
+#include "regs-mem-s3c24xx.h"
 
        /* s3c2410_cpu_suspend
         *
similarity index 93%
rename from arch/arm/mach-s3c24xx/sleep-s3c2412.S
rename to arch/arm/mach-s3c/sleep-s3c2412.S
index c373f1c..b4b6173 100644 (file)
@@ -8,10 +8,9 @@
 
 #include <linux/linkage.h>
 #include <asm/assembler.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
+#include "map.h"
 
-#include <mach/regs-irq.h>
+#include "regs-irq.h"
 
        .text
 
similarity index 92%
rename from arch/arm/mach-s3c24xx/sleep.S
rename to arch/arm/mach-s3c/sleep-s3c24xx.S
index f0f11ad..4b2af91 100644 (file)
 #include <linux/linkage.h>
 #include <linux/serial_s3c.h>
 #include <asm/assembler.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
+#include "map.h"
 
-#include <mach/regs-gpio.h>
-#include <mach/regs-clock.h>
+#include "regs-gpio.h"
+#include "regs-clock.h"
 
 /*
  * S3C24XX_DEBUG_RESUME is dangerous if your bootloader does not
similarity index 97%
rename from arch/arm/mach-s3c64xx/sleep.S
rename to arch/arm/mach-s3c/sleep-s3c64xx.S
index 39e16a0..739e53f 100644 (file)
 
 #include <linux/linkage.h>
 #include <asm/assembler.h>
-#include <mach/map.h>
+#include "map.h"
 
 #undef S3C64XX_VA_GPIO
 #define S3C64XX_VA_GPIO (0x0)
 
-#include <mach/regs-gpio.h>
+#include "regs-gpio.h"
 
 #define LL_UART (S3C_PA_UART + (0x400 * CONFIG_S3C_LOWLEVEL_UART_PORT))
 
similarity index 81%
rename from arch/arm/mach-s3c24xx/spi-core.h
rename to arch/arm/mach-s3c/spi-core-s3c24xx.h
index 1048fac..0576674 100644 (file)
@@ -3,8 +3,8 @@
  * Copyright (C) 2012 Heiko Stuebner <heiko@sntech.de>
  */
 
-#ifndef __PLAT_S3C_SPI_CORE_H
-#define __PLAT_S3C_SPI_CORE_H
+#ifndef __PLAT_S3C_SPI_CORE_S3C24XX_H
+#define __PLAT_S3C_SPI_CORE_S3C24XX_H
 
 /* These functions are only for use with the core support code, such as
  * the cpu specific initialisation code
@@ -24,4 +24,4 @@ static inline void s3c24xx_spi_setname(char *name)
 #endif
 }
 
-#endif /* __PLAT_S3C_SPI_CORE_H */
+#endif /* __PLAT_S3C_SPI_CORE_S3C24XX_H */
similarity index 94%
rename from arch/arm/plat-samsung/wakeup-mask.c
rename to arch/arm/mach-s3c/wakeup-mask.c
index 24f96fb..b490e75 100644 (file)
@@ -11,8 +11,8 @@
 #include <linux/irq.h>
 #include <linux/io.h>
 
-#include <plat/wakeup-mask.h>
-#include <plat/pm.h>
+#include "wakeup-mask.h"
+#include "pm.h"
 
 void samsung_sync_wakemask(void __iomem *reg,
                           const struct samsung_wakeup_mask *mask, int nr_mask)
diff --git a/arch/arm/mach-s3c24xx/include/mach/fb.h b/arch/arm/mach-s3c24xx/include/mach/fb.h
deleted file mode 100644 (file)
index 4e539cb..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#include <plat/fb-s3c2410.h>
diff --git a/arch/arm/mach-s3c24xx/include/mach/io.h b/arch/arm/mach-s3c24xx/include/mach/io.h
deleted file mode 100644 (file)
index f960e6d..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * arch/arm/mach-s3c2410/include/mach/io.h
- *  from arch/arm/mach-rpc/include/mach/io.h
- *
- * Copyright (C) 1997 Russell King
- *          (C) 2003 Simtec Electronics
-*/
-
-#ifndef __ASM_ARM_ARCH_IO_H
-#define __ASM_ARM_ARCH_IO_H
-
-#include <mach/hardware.h>
-
-#define IO_SPACE_LIMIT 0xffffffff
-
-/*
- * We use two different types of addressing - PC style addresses, and ARM
- * addresses.  PC style accesses the PC hardware with the normal PC IO
- * addresses, eg 0x3f8 for serial#1.  ARM addresses are above A28
- * and are translated to the start of IO.  Note that all addresses are
- * not shifted left!
- */
-
-#define __PORT_PCIO(x) ((x) < (1<<28))
-
-#define PCIO_BASE       (S3C24XX_VA_ISA_WORD)
-#define PCIO_BASE_b     (S3C24XX_VA_ISA_BYTE)
-#define PCIO_BASE_w     (S3C24XX_VA_ISA_WORD)
-#define PCIO_BASE_l     (S3C24XX_VA_ISA_WORD)
-/*
- * Dynamic IO functions - let the compiler
- * optimize the expressions
- */
-
-#define DECLARE_DYN_OUT(sz,fnsuffix,instr) \
-static inline void __out##fnsuffix (unsigned int val, unsigned int port) \
-{ \
-       unsigned long temp;                                   \
-       __asm__ __volatile__(                                 \
-       "cmp    %2, #(1<<28)\n\t"                             \
-       "mov    %0, %2\n\t"                                   \
-       "addcc  %0, %0, %3\n\t"                               \
-       "str" instr " %1, [%0, #0 ]     @ out" #fnsuffix      \
-       : "=&r" (temp)                                        \
-       : "r" (val), "r" (port), "Ir" (PCIO_BASE_##fnsuffix)  \
-       : "cc");                                              \
-}
-
-
-#define DECLARE_DYN_IN(sz,fnsuffix,instr)                              \
-static inline unsigned sz __in##fnsuffix (unsigned int port)           \
-{                                                                      \
-       unsigned long temp, value;                                      \
-       __asm__ __volatile__(                                           \
-       "cmp    %2, #(1<<28)\n\t"                                       \
-       "mov    %0, %2\n\t"                                             \
-       "addcc  %0, %0, %3\n\t"                                         \
-       "ldr" instr "   %1, [%0, #0 ]   @ in" #fnsuffix         \
-       : "=&r" (temp), "=r" (value)                                    \
-       : "r" (port), "Ir" (PCIO_BASE_##fnsuffix)       \
-       : "cc");                                                        \
-       return (unsigned sz)value;                                      \
-}
-
-static inline void __iomem *__ioaddr (unsigned long port)
-{
-       return __PORT_PCIO(port) ? (PCIO_BASE + port) : (void __iomem *)port;
-}
-
-#define DECLARE_IO(sz,fnsuffix,instr)  \
-       DECLARE_DYN_IN(sz,fnsuffix,instr) \
-       DECLARE_DYN_OUT(sz,fnsuffix,instr)
-
-DECLARE_IO(char,b,"b")
-DECLARE_IO(short,w,"h")
-DECLARE_IO(int,l,"")
-
-#undef DECLARE_IO
-#undef DECLARE_DYN_IN
-
-/*
- * Constant address IO functions
- *
- * These have to be macros for the 'J' constraint to work -
- * +/-4096 immediate operand.
- */
-#define __outbc(value,port)                                            \
-({                                                                     \
-       if (__PORT_PCIO((port)))                                        \
-               __asm__ __volatile__(                                   \
-               "strb   %0, [%1, %2]    @ outbc"                        \
-               : : "r" (value), "r" (PCIO_BASE), "Jr" ((port)));       \
-       else                                                            \
-               __asm__ __volatile__(                                   \
-               "strb   %0, [%1, #0]    @ outbc"                        \
-               : : "r" (value), "r" ((port)));                         \
-})
-
-#define __inbc(port)                                                   \
-({                                                                     \
-       unsigned char result;                                           \
-       if (__PORT_PCIO((port)))                                        \
-               __asm__ __volatile__(                                   \
-               "ldrb   %0, [%1, %2]    @ inbc"                         \
-               : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port)));      \
-       else                                                            \
-               __asm__ __volatile__(                                   \
-               "ldrb   %0, [%1, #0]    @ inbc"                         \
-               : "=r" (result) : "r" ((port)));                        \
-       result;                                                         \
-})
-
-#define __outwc(value,port)                                            \
-({                                                                     \
-       unsigned long v = value;                                        \
-       if (__PORT_PCIO((port))) {                                      \
-               if ((port) < 256 && (port) > -256)                      \
-                       __asm__ __volatile__(                           \
-                       "strh   %0, [%1, %2]    @ outwc"                \
-                       : : "r" (v), "r" (PCIO_BASE), "Jr" ((port)));   \
-               else if ((port) > 0)                                    \
-                       __asm__ __volatile__(                           \
-                       "strh   %0, [%1, %2]    @ outwc"                \
-                       : : "r" (v),                                    \
-                           "r" (PCIO_BASE + ((port) & ~0xff)),         \
-                            "Jr" (((port) & 0xff)));                   \
-               else                                                    \
-                       __asm__ __volatile__(                           \
-                       "strh   %0, [%1, #0]    @ outwc"                \
-                       : : "r" (v),                                    \
-                           "r" (PCIO_BASE + (port)));                  \
-       } else                                                          \
-               __asm__ __volatile__(                                   \
-               "strh   %0, [%1, #0]    @ outwc"                        \
-               : : "r" (v), "r" ((port)));                             \
-})
-
-#define __inwc(port)                                                   \
-({                                                                     \
-       unsigned short result;                                          \
-       if (__PORT_PCIO((port))) {                                      \
-               if ((port) < 256 && (port) > -256 )                     \
-                       __asm__ __volatile__(                           \
-                       "ldrh   %0, [%1, %2]    @ inwc"                 \
-                       : "=r" (result)                                 \
-                       : "r" (PCIO_BASE),                              \
-                         "Jr" ((port)));                               \
-               else if ((port) > 0)                                    \
-                       __asm__ __volatile__(                           \
-                       "ldrh   %0, [%1, %2]    @ inwc"                 \
-                       : "=r" (result)                                 \
-                       : "r" (PCIO_BASE + ((port) & ~0xff)),           \
-                         "Jr" (((port) & 0xff)));                      \
-               else                                                    \
-                       __asm__ __volatile__(                           \
-                       "ldrh   %0, [%1, #0]    @ inwc"                 \
-                       : "=r" (result)                                 \
-                       : "r" (PCIO_BASE + ((port))));                  \
-       } else                                                          \
-               __asm__ __volatile__(                                   \
-               "ldrh   %0, [%1, #0]    @ inwc"                         \
-               : "=r" (result) : "r" ((port)));                        \
-       result;                                                         \
-})
-
-#define __outlc(value,port)                                            \
-({                                                                     \
-       unsigned long v = value;                                        \
-       if (__PORT_PCIO((port)))                                        \
-               __asm__ __volatile__(                                   \
-               "str    %0, [%1, %2]    @ outlc"                        \
-               : : "r" (v), "r" (PCIO_BASE), "Jr" ((port)));   \
-       else                                                            \
-               __asm__ __volatile__(                                   \
-               "str    %0, [%1, #0]    @ outlc"                        \
-               : : "r" (v), "r" ((port)));             \
-})
-
-#define __inlc(port)                                                   \
-({                                                                     \
-       unsigned long result;                                           \
-       if (__PORT_PCIO((port)))                                        \
-               __asm__ __volatile__(                                   \
-               "ldr    %0, [%1, %2]    @ inlc"                         \
-               : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port)));      \
-       else                                                            \
-               __asm__ __volatile__(                                   \
-               "ldr    %0, [%1, #0]    @ inlc"                         \
-               : "=r" (result) : "r" ((port)));                \
-       result;                                                         \
-})
-
-#define __ioaddrc(port)        ((__PORT_PCIO(port) ? PCIO_BASE + (port) : (void __iomem *)0 + (port)))
-
-#define inb(p)         (__builtin_constant_p((p)) ? __inbc(p)     : __inb(p))
-#define inw(p)         (__builtin_constant_p((p)) ? __inwc(p)     : __inw(p))
-#define inl(p)         (__builtin_constant_p((p)) ? __inlc(p)     : __inl(p))
-#define outb(v,p)      (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
-#define outw(v,p)      (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
-#define outl(v,p)      (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
-#define __ioaddr(p)    (__builtin_constant_p((p)) ? __ioaddr(p)  : __ioaddrc(p))
-
-#define insb(p,d,l)    __raw_readsb(__ioaddr(p),d,l)
-#define insw(p,d,l)    __raw_readsw(__ioaddr(p),d,l)
-#define insl(p,d,l)    __raw_readsl(__ioaddr(p),d,l)
-
-#define outsb(p,d,l)   __raw_writesb(__ioaddr(p),d,l)
-#define outsw(p,d,l)   __raw_writesw(__ioaddr(p),d,l)
-#define outsl(p,d,l)   __raw_writesl(__ioaddr(p),d,l)
-
-#endif
diff --git a/arch/arm/mach-s3c24xx/setup-camif.c b/arch/arm/mach-s3c24xx/setup-camif.c
deleted file mode 100644 (file)
index 2b262fa..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
-//
-// Helper functions for S3C24XX/S3C64XX SoC series CAMIF driver
-
-#include <linux/gpio.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
-
-/* Number of camera port pins, without FIELD */
-#define S3C_CAMIF_NUM_GPIOS    13
-
-/* Default camera port configuration helpers. */
-
-static void camif_get_gpios(int *gpio_start, int *gpio_reset)
-{
-#ifdef CONFIG_ARCH_S3C24XX
-       *gpio_start = S3C2410_GPJ(0);
-       *gpio_reset = S3C2410_GPJ(12);
-#else
-       /* s3c64xx */
-       *gpio_start = S3C64XX_GPF(0);
-       *gpio_reset = S3C64XX_GPF(3);
-#endif
-}
-
-int s3c_camif_gpio_get(void)
-{
-       int gpio_start, gpio_reset;
-       int ret, i;
-
-       camif_get_gpios(&gpio_start, &gpio_reset);
-
-       for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) {
-               int gpio = gpio_start + i;
-
-               if (gpio == gpio_reset)
-                       continue;
-
-               ret = gpio_request(gpio, "camif");
-               if (!ret)
-                       ret = s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
-               if (ret) {
-                       pr_err("failed to configure GPIO %d\n", gpio);
-                       for (--i; i >= 0; i--)
-                               gpio_free(gpio--);
-                       return ret;
-               }
-               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
-       }
-
-       return 0;
-}
-
-void s3c_camif_gpio_put(void)
-{
-       int i, gpio_start, gpio_reset;
-
-       camif_get_gpios(&gpio_start, &gpio_reset);
-
-       for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) {
-               int gpio = gpio_start + i;
-               if (gpio != gpio_reset)
-                       gpio_free(gpio);
-       }
-}
diff --git a/arch/arm/mach-s3c64xx/include/mach/hardware.h b/arch/arm/mach-s3c64xx/include/mach/hardware.h
deleted file mode 100644 (file)
index c4ed359..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* linux/arch/arm/mach-s3c6400/include/mach/hardware.h
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *      Ben Dooks <ben@simtec.co.uk>
- *      http://armlinux.simtec.co.uk/
- *
- * S3C6400 - Hardware support
- */
-
-#ifndef __ASM_ARCH_HARDWARE_H
-#define __ASM_ARCH_HARDWARE_H __FILE__
-
-/* currently nothing here, placeholder */
-
-#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c64xx/watchdog-reset.h b/arch/arm/mach-s3c64xx/watchdog-reset.h
deleted file mode 100644 (file)
index 1042d6c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2008 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C2410 - System define for arch_reset() function
- */
-
-#ifndef __PLAT_SAMSUNG_WATCHDOG_RESET_H
-#define __PLAT_SAMSUNG_WATCHDOG_RESET_H
-
-extern void samsung_wdt_reset(void);
-extern void samsung_wdt_reset_of_init(void);
-extern void samsung_wdt_reset_init(void __iomem *base);
-
-#endif /* __PLAT_SAMSUNG_WATCHDOG_RESET_H */
index 03984a7..95d4e82 100644 (file)
@@ -14,10 +14,10 @@ config ARCH_S5PV210
        select COMMON_CLK_SAMSUNG
        select GPIOLIB
        select HAVE_S3C2410_I2C if I2C
-       select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select HAVE_S3C_RTC if RTC_CLASS
        select PINCTRL
        select PINCTRL_EXYNOS
+       select SOC_SAMSUNG
        help
          Samsung S5PV210/S5PC110 series based systems
 
index e7b551e..aa0a1f0 100644 (file)
@@ -3,12 +3,5 @@
 # Copyright (c) 2010 Samsung Electronics Co., Ltd.
 #              http://www.samsung.com/
 
-ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/arch/arm/plat-samsung/include
-
-# Core
-
 obj-$(CONFIG_PM_SLEEP)         += pm.o sleep.o
-
-# machine support
-
 obj-y                          += s5pv210.o
index b336df0..d59c094 100644 (file)
 #include <linux/suspend.h>
 #include <linux/syscore_ops.h>
 #include <linux/io.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #include <asm/cacheflush.h>
 #include <asm/suspend.h>
 
-#include <plat/pm-common.h>
-
 #include "common.h"
 #include "regs-clock.h"
 
+/* helper functions to save and restore register state */
+struct sleep_save {
+       void __iomem    *reg;
+       unsigned long   val;
+};
+
+#define SAVE_ITEM(x) \
+       { .reg = (x) }
+
+/**
+ * s3c_pm_do_save() - save a set of registers for restoration on resume.
+ * @ptr: Pointer to an array of registers.
+ * @count: Size of the ptr array.
+ *
+ * Run through the list of registers given, saving their contents in the
+ * array for later restoration when we wakeup.
+ */
+static void s3c_pm_do_save(struct sleep_save *ptr, int count)
+{
+       for (; count > 0; count--, ptr++) {
+               ptr->val = readl_relaxed(ptr->reg);
+               S3C_PMDBG("saved %p value %08lx\n", ptr->reg, ptr->val);
+       }
+}
+
+/**
+ * s3c_pm_do_restore() - restore register values from the save list.
+ * @ptr: Pointer to an array of registers.
+ * @count: Size of the ptr array.
+ *
+ * Restore the register values saved from s3c_pm_do_save().
+ *
+ * WARNING: Do not put any debug in here that may effect memory or use
+ * peripherals, as things may be changing!
+*/
+
+static void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count)
+{
+       for (; count > 0; count--, ptr++)
+               writel_relaxed(ptr->val, ptr->reg);
+}
+
 static struct sleep_save s5pv210_core_save[] = {
        /* Clock ETC */
        SAVE_ITEM(S5P_MDNIE_SEL),
@@ -99,8 +140,6 @@ static int s5pv210_suspend_enter(suspend_state_t state)
        u32 eint_wakeup_mask = s5pv210_read_eint_wakeup_mask();
        int ret;
 
-       s3c_pm_debug_init();
-
        S3C_PMDBG("%s: suspending the system...\n", __func__);
 
        S3C_PMDBG("%s: wakeup masks: %08x,%08x\n", __func__,
@@ -113,7 +152,7 @@ static int s5pv210_suspend_enter(suspend_state_t state)
                return -EINVAL;
        }
 
-       s3c_pm_save_uarts();
+       s3c_pm_save_uarts(false);
        s5pv210_pm_prepare();
        flush_cache_all();
        s3c_pm_check_store();
@@ -122,7 +161,7 @@ static int s5pv210_suspend_enter(suspend_state_t state)
        if (ret)
                return ret;
 
-       s3c_pm_restore_uarts();
+       s3c_pm_restore_uarts(false);
 
        S3C_PMDBG("%s: wakeup stat: %08x\n", __func__,
                        __raw_readl(S5P_WAKEUP_STAT));
index 2a35c83..9cad230 100644 (file)
@@ -9,7 +9,9 @@
 #ifndef __ASM_ARCH_REGS_CLOCK_H
 #define __ASM_ARCH_REGS_CLOCK_H __FILE__
 
-#include <plat/map-base.h>
+#define S3C_ADDR_BASE          0xF6000000
+#define S3C_ADDR(x)            ((void __iomem __force *)S3C_ADDR_BASE + (x))
+#define S3C_VA_SYS             S3C_ADDR(0x00100000)
 
 #define S5P_CLKREG(x)          (S3C_VA_SYS + (x))
 
index 868f9c2..a21ed3b 100644 (file)
@@ -13,8 +13,6 @@
 #include <asm/mach/map.h>
 #include <asm/system_misc.h>
 
-#include <plat/map-base.h>
-
 #include "common.h"
 #include "regs-clock.h"
 
index 4777fff..af9dbd6 100644 (file)
@@ -2,8 +2,6 @@
 #ifndef __ASM_RCAR_GEN2_H__
 #define __ASM_RCAR_GEN2_H__
 
-void rcar_gen2_timer_init(void);
-void rcar_gen2_reserve(void);
 void rcar_gen2_pm_init(void);
 
 #endif /* __ASM_RCAR_GEN2_H__ */
index e00f5b3..d42d934 100644 (file)
@@ -59,7 +59,7 @@ static unsigned int __init get_extal_freq(void)
 #define CNTCR 0
 #define CNTFID0 0x20
 
-void __init rcar_gen2_timer_init(void)
+static void __init rcar_gen2_timer_init(void)
 {
        bool need_update = true;
        void __iomem *base;
@@ -174,7 +174,7 @@ static int __init rcar_gen2_scan_mem(unsigned long node, const char *uname,
        return 0;
 }
 
-void __init rcar_gen2_reserve(void)
+static void __init rcar_gen2_reserve(void)
 {
        struct memory_reserve_config mrc;
 
index cec195d..5dde732 100644 (file)
@@ -1,4 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 # Empty file waiting for deletion once Makefile.boot isn't needed any more.
 # Patch waits for application at
-# http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7889/1 .
+# https://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7889/1 .
index d57112a..c23dbf8 100644 (file)
@@ -354,8 +354,8 @@ static void __init free_highpages(void)
        /* set highmem page free */
        for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE,
                                &range_start, &range_end, NULL) {
-               unsigned long start = PHYS_PFN(range_start);
-               unsigned long end = PHYS_PFN(range_end);
+               unsigned long start = PFN_UP(range_start);
+               unsigned long end = PFN_DOWN(range_end);
 
                /* Ignore complete lowmem entries */
                if (end <= max_low)
index 93fd7fc..272670e 100644 (file)
@@ -23,7 +23,7 @@ config OMAP_DEBUG_LEDS
 
 config POWER_AVS_OMAP
        bool "AVS(Adaptive Voltage Scaling) support for OMAP IP versions 1&2"
-       depends on POWER_AVS && (ARCH_OMAP3 || ARCH_OMAP4) && PM
+       depends on (ARCH_OMAP3 || ARCH_OMAP4) && PM
        select POWER_SUPPLY
        help
          Say Y to enable AVS(Adaptive Voltage Scaling)
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
deleted file mode 100644 (file)
index 32ab086..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2011 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com/
- *
- * Header file for samsung s3c and s5p time support
- */
-
-#ifndef __ASM_PLAT_SAMSUNG_TIME_H
-#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
-
-/* Samsung HR-Timer Clock mode */
-enum samsung_timer_mode {
-       SAMSUNG_PWM0,
-       SAMSUNG_PWM1,
-       SAMSUNG_PWM2,
-       SAMSUNG_PWM3,
-       SAMSUNG_PWM4,
-};
-
-extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
-                                       enum samsung_timer_mode source);
-
-extern void __init samsung_timer_init(void);
-
-#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
diff --git a/arch/arm/plat-samsung/watchdog-reset.c b/arch/arm/plat-samsung/watchdog-reset.c
deleted file mode 100644 (file)
index 71d85ff..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
-//
-// Watchdog reset support for Samsung SoCs.
-
-#include <linux/clk.h>
-#include <linux/err.h>
-#include <linux/io.h>
-#include <linux/delay.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
-
-#define S3C2410_WTCON                  0x00
-#define S3C2410_WTDAT                  0x04
-#define S3C2410_WTCNT                  0x08
-
-#define S3C2410_WTCON_ENABLE           (1 << 5)
-#define S3C2410_WTCON_DIV16            (0 << 3)
-#define S3C2410_WTCON_RSTEN            (1 << 0)
-#define S3C2410_WTCON_PRESCALE(x)      ((x) << 8)
-
-static void __iomem *wdt_base;
-static struct clk *wdt_clock;
-
-void samsung_wdt_reset(void)
-{
-       if (!wdt_base) {
-               pr_err("%s: wdt reset not initialized\n", __func__);
-               /* delay to allow the serial port to show the message */
-               mdelay(50);
-               return;
-       }
-
-       if (!IS_ERR(wdt_clock))
-               clk_prepare_enable(wdt_clock);
-
-       /* disable watchdog, to be safe  */
-       __raw_writel(0, wdt_base + S3C2410_WTCON);
-
-       /* put initial values into count and data */
-       __raw_writel(0x80, wdt_base + S3C2410_WTCNT);
-       __raw_writel(0x80, wdt_base + S3C2410_WTDAT);
-
-       /* set the watchdog to go and reset... */
-       __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV16 |
-                       S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x20),
-                       wdt_base + S3C2410_WTCON);
-
-       /* wait for reset to assert... */
-       mdelay(500);
-
-       pr_err("Watchdog reset failed to assert reset\n");
-
-       /* delay to allow the serial port to show the message */
-       mdelay(50);
-}
-
-#ifdef CONFIG_OF
-static const struct of_device_id s3c2410_wdt_match[] = {
-       { .compatible = "samsung,s3c2410-wdt" },
-       { .compatible = "samsung,s3c6410-wdt" },
-       {},
-};
-
-void __init samsung_wdt_reset_of_init(void)
-{
-       struct device_node *np;
-
-       np = of_find_matching_node(NULL, s3c2410_wdt_match);
-       if (!np) {
-               pr_err("%s: failed to find watchdog node\n", __func__);
-               return;
-       }
-
-       wdt_base = of_iomap(np, 0);
-       if (!wdt_base) {
-               pr_err("%s: failed to map watchdog registers\n", __func__);
-               return;
-       }
-
-       wdt_clock = of_clk_get(np, 0);
-}
-#endif
-
-void __init samsung_wdt_reset_init(void __iomem *base)
-{
-       wdt_base = base;
-       wdt_clock = clk_get(NULL, "watchdog");
-}
index f858c35..1515f6f 100644 (file)
@@ -636,6 +636,26 @@ config ARM64_ERRATUM_1542419
 
          If unsure, say Y.
 
+config ARM64_ERRATUM_1508412
+       bool "Cortex-A77: 1508412: workaround deadlock on sequence of NC/Device load and store exclusive or PAR read"
+       default y
+       help
+         This option adds a workaround for Arm Cortex-A77 erratum 1508412.
+
+         Affected Cortex-A77 cores (r0p0, r1p0) could deadlock on a sequence
+         of a store-exclusive or read of PAR_EL1 and a load with device or
+         non-cacheable memory attributes. The workaround depends on a firmware
+         counterpart.
+
+         KVM guests must also have the workaround implemented or they can
+         deadlock the system.
+
+         Work around the issue by inserting DMB SY barriers around PAR_EL1
+         register reads and warning KVM users. The DMB barrier is sufficient
+         to prevent a speculative PAR_EL1 read.
+
+         If unsure, say Y.
+
 config CAVIUM_ERRATUM_22375
        bool "Cavium erratum 22375, 24313"
        default y
@@ -982,7 +1002,7 @@ config NUMA
 config NODES_SHIFT
        int "Maximum NUMA Nodes (as a power of 2)"
        range 1 10
-       default "2"
+       default "4"
        depends on NEED_MULTIPLE_NODES
        help
          Specify the maximum number of NUMA Nodes available on the target
index cd58f84..5c4ac1c 100644 (file)
@@ -54,6 +54,7 @@ config ARCH_BCM_IPROC
 config ARCH_BERLIN
        bool "Marvell Berlin SoC Family"
        select DW_APB_ICTL
+       select DW_APB_TIMER_OF
        select GPIOLIB
        select PINCTRL
        help
@@ -80,7 +81,6 @@ config ARCH_EXYNOS
        select EXYNOS_CHIPID
        select EXYNOS_PM_DOMAINS if PM_GENERIC_DOMAINS
        select EXYNOS_PMU
-       select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select HAVE_S3C_RTC if RTC_CLASS
        select PINCTRL
        select PINCTRL_EXYNOS
@@ -300,6 +300,13 @@ config ARCH_VEXPRESS
          This enables support for the ARMv8 software model (Versatile
          Express).
 
+config ARCH_VISCONTI
+       bool "Toshiba Visconti SoC Family"
+       select PINCTRL
+       select PINCTRL_VISCONTI
+       help
+         This enables support for Toshiba Visconti SoCs Family.
+
 config ARCH_VULCAN
        def_bool n
 
index 270e8aa..9b11706 100644 (file)
@@ -27,5 +27,6 @@ subdir-y += socionext
 subdir-y += sprd
 subdir-y += synaptics
 subdir-y += ti
+subdir-y += toshiba
 subdir-y += xilinx
 subdir-y += zte
index 2006ad5..2c78cae 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/clock/actions,s700-cmu.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/power/owl-s700-powergate.h>
 #include <dt-bindings/reset/actions,s700-reset.h>
 
 / {
 
                pinctrl: pinctrl@e01b0000 {
                        compatible = "actions,s700-pinctrl";
-                       reg = <0x0 0xe01b0000 0x0 0x1000>;
+                       reg = <0x0 0xe01b0000 0x0 0x100>;
                        clocks = <&cmu CLK_GPIO>;
                        gpio-controller;
                        gpio-ranges = <&pinctrl 0 0 136>;
                                     <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
                };
+
+               dma: dma-controller@e0230000 {
+                       compatible = "actions,s700-dma";
+                       reg = <0x0 0xe0230000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
+                       #dma-cells = <1>;
+                       dma-channels = <10>;
+                       dma-requests = <44>;
+                       clocks = <&cmu CLK_DMAC>;
+                       power-domains = <&sps S700_PD_DMA>;
+               };
        };
 };
index 916d10d..211d1e9 100644 (file)
@@ -15,6 +15,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinephone-1.2.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinetab.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-sopine-baseboard.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-teres-i.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a100-allwinner-perf1.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-bananapi-m2-plus.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-bananapi-m2-plus-v1.2.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-emlid-neutis-n5-devboard.dtb
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a100-allwinner-perf1.dts b/arch/arm64/boot/dts/allwinner/sun50i-a100-allwinner-perf1.dts
new file mode 100644 (file)
index 0000000..d34c2bb
--- /dev/null
@@ -0,0 +1,180 @@
+// SPDX-License-Identifier: (GPL-2.0+ or MIT)
+/*
+ * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com>
+ */
+
+/dts-v1/;
+
+#include "sun50i-a100.dtsi"
+
+/{
+       model = "Allwinner A100 Perf1";
+       compatible = "allwinner,a100-perf1", "allwinner,sun50i-a100";
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+};
+
+&pio {
+       vcc-pb-supply = <&reg_dcdc1>;
+       vcc-pc-supply = <&reg_eldo1>;
+       vcc-pd-supply = <&reg_dcdc1>;
+       vcc-pe-supply = <&reg_dldo2>;
+       vcc-pf-supply = <&reg_dcdc1>;
+       vcc-pg-supply = <&reg_dldo1>;
+       vcc-ph-supply = <&reg_dcdc1>;
+};
+
+&r_pio {
+       /*
+        * FIXME: We can't add that supply for now since it would
+        * create a circular dependency between pinctrl, the regulator
+        * and the RSB Bus.
+        *
+        * vcc-pl-supply = <&reg_aldo3>;
+        */
+};
+
+&r_i2c0 {
+       status = "okay";
+
+       axp803: pmic@34 {
+               compatible = "x-powers,axp803";
+               reg = <0x34>;
+               interrupt-parent = <&r_intc>;
+               interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+               x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
+       };
+};
+
+#include "axp803.dtsi"
+
+&ac_power_supply {
+       status = "okay";
+};
+
+&reg_aldo1 {
+       regulator-always-on;
+       regulator-min-microvolt = <1800000>;
+       regulator-max-microvolt = <1800000>;
+       regulator-name = "vcc-pll-avcc";
+};
+
+&reg_aldo2 {
+       regulator-always-on;
+       regulator-min-microvolt = <1800000>;
+       regulator-max-microvolt = <1800000>;
+       regulator-name = "vcc-dram-1";
+};
+
+&reg_aldo3 {
+       regulator-always-on;
+       regulator-min-microvolt = <3300000>;
+       regulator-max-microvolt = <3300000>;
+       regulator-name = "vcc-usb-pl";
+};
+
+&reg_dcdc1 {
+       regulator-always-on;
+       regulator-min-microvolt = <3300000>;
+       regulator-max-microvolt = <3300000>;
+       regulator-name = "vcc-io-usb-pd-emmc-nand-card";
+};
+
+&reg_dcdc2 {
+       regulator-always-on;
+       /*
+        * FIXME: update min and max before support dvfs.
+        */
+       regulator-min-microvolt = <500000>;
+       regulator-max-microvolt = <1300000>;
+       regulator-name = "vdd-cpux";
+};
+
+/* DCDC3 is polyphased with DCDC2 */
+
+&reg_dcdc4 {
+       regulator-always-on;
+       regulator-min-microvolt = <950000>;
+       regulator-max-microvolt = <950000>;
+       regulator-name = "vdd-sys-usb-dram";
+};
+
+&reg_dcdc5 {
+       regulator-always-on;
+       regulator-min-microvolt = <1500000>;
+       regulator-max-microvolt = <1500000>;
+       regulator-name = "vcc-dram-2";
+};
+
+&reg_dldo1 {
+       regulator-min-microvolt = <3300000>;
+       regulator-max-microvolt = <3300000>;
+       regulator-name = "vcc-pg-dcxo-wifi";
+};
+
+&reg_dldo2 {
+       regulator-min-microvolt = <1800000>;
+       regulator-max-microvolt = <2800000>;
+       regulator-name = "vcc-pe-csi";
+};
+
+&reg_dldo3 {
+       regulator-min-microvolt = <1800000>;
+       regulator-max-microvolt = <3300000>;
+       regulator-name = "ldo-avdd-csi";
+};
+
+&reg_dldo4 {
+       regulator-min-microvolt = <1800000>;
+       regulator-max-microvolt = <2800000>;
+       regulator-name = "avcc-csi";
+};
+
+&reg_eldo1 {
+       regulator-min-microvolt = <1800000>;
+       regulator-max-microvolt = <1800000>;
+       regulator-name = "vcc-pc-lvds-csi-efuse-emmc-nand";
+};
+
+&reg_eldo2 {
+       regulator-min-microvolt = <1200000>;
+       regulator-max-microvolt = <1800000>;
+       regulator-name = "dvdd-csi";
+};
+
+&reg_eldo3 {
+       regulator-min-microvolt = <1800000>;
+       regulator-max-microvolt = <1800000>;
+       regulator-name = "vcc-mipi-lcd";
+};
+
+&reg_fldo1 {
+       regulator-always-on;
+       regulator-min-microvolt = <900000>;
+       regulator-max-microvolt = <900000>;
+       regulator-name = "vdd-cpus-usb";
+};
+
+&reg_ldo_io0 {
+       regulator-min-microvolt = <3300000>;
+       regulator-max-microvolt = <3300000>;
+       regulator-name = "vcc-ctp";
+       status = "okay";
+};
+
+&reg_drivevbus {
+       regulator-name = "usb0-vbus";
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pb_pins>;
+       status = "okay";
+};
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a100.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a100.dtsi
new file mode 100644 (file)
index 0000000..cc321c0
--- /dev/null
@@ -0,0 +1,364 @@
+// SPDX-License-Identifier: (GPL-2.0+ or MIT)
+/*
+ * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com>
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/clock/sun50i-a100-ccu.h>
+#include <dt-bindings/clock/sun50i-a100-r-ccu.h>
+#include <dt-bindings/reset/sun50i-a100-ccu.h>
+#include <dt-bindings/reset/sun50i-a100-r-ccu.h>
+
+/ {
+       interrupt-parent = <&gic>;
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu0: cpu@0 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       reg = <0x0>;
+                       enable-method = "psci";
+               };
+
+               cpu@1 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       reg = <0x1>;
+                       enable-method = "psci";
+               };
+
+               cpu@2 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       reg = <0x2>;
+                       enable-method = "psci";
+               };
+
+               cpu@3 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       reg = <0x3>;
+                       enable-method = "psci";
+               };
+       };
+
+       psci {
+               compatible = "arm,psci-1.0";
+               method = "smc";
+       };
+
+       dcxo24M: dcxo24M-clk {
+               compatible = "fixed-clock";
+               clock-frequency = <24000000>;
+               clock-output-names = "dcxo24M";
+               #clock-cells = <0>;
+       };
+
+       iosc: internal-osc-clk {
+               compatible = "fixed-clock";
+               clock-frequency = <16000000>;
+               clock-accuracy = <300000000>;
+               clock-output-names = "iosc";
+               #clock-cells = <0>;
+       };
+
+       osc32k: osc32k-clk {
+               compatible = "fixed-clock";
+               clock-frequency = <32768>;
+               clock-output-names = "osc32k";
+               #clock-cells = <0>;
+       };
+
+       timer {
+               compatible = "arm,armv8-timer";
+               interrupts = <GIC_PPI 13
+                       (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
+                            <GIC_PPI 14
+                       (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
+                            <GIC_PPI 11
+                       (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
+                            <GIC_PPI 10
+                       (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0 0 0x3fffffff>;
+
+               ccu: clock@3001000 {
+                       compatible = "allwinner,sun50i-a100-ccu";
+                       reg = <0x03001000 0x1000>;
+                       clocks = <&dcxo24M>, <&osc32k>, <&iosc>;
+                       clock-names = "hosc", "losc", "iosc";
+                       #clock-cells = <1>;
+                       #reset-cells = <1>;
+               };
+
+               gic: interrupt-controller@3021000 {
+                       compatible = "arm,gic-400";
+                       reg = <0x03021000 0x1000>, <0x03022000 0x2000>,
+                             <0x03024000 0x2000>, <0x03026000 0x2000>;
+                       interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) |
+                                                IRQ_TYPE_LEVEL_HIGH)>;
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
+               };
+
+               efuse@3006000 {
+                       compatible = "allwinner,sun50i-a100-sid",
+                                    "allwinner,sun50i-a64-sid";
+                       reg = <0x03006000 0x1000>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       ths_calibration: calib@14 {
+                               reg = <0x14 8>;
+                       };
+               };
+
+               pio: pinctrl@300b000 {
+                       compatible = "allwinner,sun50i-a100-pinctrl";
+                       reg = <0x0300b000 0x400>;
+                       interrupts = <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>,
+                                    <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_APB1>, <&dcxo24M>, <&osc32k>;
+                       clock-names = "apb", "hosc", "losc";
+                       gpio-controller;
+                       #gpio-cells = <3>;
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
+
+                       uart0_pb_pins: uart0-pb-pins {
+                               pins = "PB9", "PB10";
+                               function = "uart0";
+                       };
+               };
+
+               uart0: serial@5000000 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x05000000 0x400>;
+                       interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&ccu CLK_BUS_UART0>;
+                       resets = <&ccu RST_BUS_UART0>;
+                       status = "disabled";
+               };
+
+               uart1: serial@5000400 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x05000400 0x400>;
+                       interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&ccu CLK_BUS_UART1>;
+                       resets = <&ccu RST_BUS_UART1>;
+                       status = "disabled";
+               };
+
+               uart2: serial@5000800 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x05000800 0x400>;
+                       interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&ccu CLK_BUS_UART2>;
+                       resets = <&ccu RST_BUS_UART2>;
+                       status = "disabled";
+               };
+
+               uart3: serial@5000c00 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x05000c00 0x400>;
+                       interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&ccu CLK_BUS_UART3>;
+                       resets = <&ccu RST_BUS_UART3>;
+                       status = "disabled";
+               };
+
+               uart4: serial@5001000 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x05001000 0x400>;
+                       interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&ccu CLK_BUS_UART4>;
+                       resets = <&ccu RST_BUS_UART4>;
+                       status = "disabled";
+               };
+
+               i2c0: i2c@5002000 {
+                       compatible = "allwinner,sun50i-a100-i2c",
+                                    "allwinner,sun6i-a31-i2c";
+                       reg = <0x05002000 0x400>;
+                       interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_I2C0>;
+                       resets = <&ccu RST_BUS_I2C0>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               i2c1: i2c@5002400 {
+                       compatible = "allwinner,sun50i-a100-i2c",
+                                    "allwinner,sun6i-a31-i2c";
+                       reg = <0x05002400 0x400>;
+                       interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_I2C1>;
+                       resets = <&ccu RST_BUS_I2C1>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               i2c2: i2c@5002800 {
+                       compatible = "allwinner,sun50i-a100-i2c",
+                                    "allwinner,sun6i-a31-i2c";
+                       reg = <0x05002800 0x400>;
+                       interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_I2C2>;
+                       resets = <&ccu RST_BUS_I2C2>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               i2c3: i2c@5002c00 {
+                       compatible = "allwinner,sun50i-a100-i2c",
+                                    "allwinner,sun6i-a31-i2c";
+                       reg = <0x05002c00 0x400>;
+                       interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_I2C3>;
+                       resets = <&ccu RST_BUS_I2C3>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               ths: thermal-sensor@5070400 {
+                       compatible = "allwinner,sun50i-a100-ths";
+                       reg = <0x05070400 0x100>;
+                       interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_THS>;
+                       clock-names = "bus";
+                       resets = <&ccu RST_BUS_THS>;
+                       nvmem-cells = <&ths_calibration>;
+                       nvmem-cell-names = "calibration";
+                       #thermal-sensor-cells = <1>;
+               };
+
+               r_ccu: clock@7010000 {
+                       compatible = "allwinner,sun50i-a100-r-ccu";
+                       reg = <0x07010000 0x300>;
+                       clocks = <&dcxo24M>, <&osc32k>, <&iosc>,
+                                <&ccu CLK_PLL_PERIPH0>;
+                       clock-names = "hosc", "losc", "iosc", "pll-periph";
+                       #clock-cells = <1>;
+                       #reset-cells = <1>;
+               };
+
+               r_intc: interrupt-controller@7010320 {
+                       compatible = "allwinner,sun50i-a100-nmi",
+                                    "allwinner,sun9i-a80-nmi";
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       reg = <0x07010320 0xc>;
+                       interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
+               };
+
+               r_pio: pinctrl@7022000 {
+                       compatible = "allwinner,sun50i-a100-r-pinctrl";
+                       reg = <0x07022000 0x400>;
+                       interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&r_ccu CLK_R_APB1>, <&dcxo24M>, <&osc32k>;
+                       clock-names = "apb", "hosc", "losc";
+                       gpio-controller;
+                       #gpio-cells = <3>;
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
+
+                       r_i2c0_pins: r-i2c0-pins {
+                               pins = "PL0", "PL1";
+                               function = "s_i2c0";
+                       };
+
+                       r_i2c1_pins: r-i2c1-pins {
+                               pins = "PL8", "PL9";
+                               function = "s_i2c1";
+                       };
+               };
+
+               r_uart: serial@7080000 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x07080000 0x400>;
+                       interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&r_ccu CLK_R_APB2_UART>;
+                       resets = <&r_ccu RST_R_APB2_UART>;
+                       status = "disabled";
+               };
+
+               r_i2c0: i2c@7081400 {
+                       compatible = "allwinner,sun50i-a100-i2c",
+                                    "allwinner,sun6i-a31-i2c";
+                       reg = <0x07081400 0x400>;
+                       interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&r_ccu CLK_R_APB2_I2C0>;
+                       resets = <&r_ccu RST_R_APB2_I2C0>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&r_i2c0_pins>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               r_i2c1: i2c@7081800 {
+                       compatible = "allwinner,sun50i-a100-i2c",
+                                    "allwinner,sun6i-a31-i2c";
+                       reg = <0x07081800 0x400>;
+                       interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&r_ccu CLK_R_APB2_I2C1>;
+                       resets = <&r_ccu RST_R_APB2_I2C1>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&r_i2c1_pins>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+       };
+
+       thermal-zones {
+               cpu-thermal-zone {
+                       polling-delay-passive = <0>;
+                       polling-delay = <0>;
+                       thermal-sensors = <&ths 0>;
+               };
+
+               ddr-thermal-zone {
+                       polling-delay-passive = <0>;
+                       polling-delay = <0>;
+                       thermal-sensors = <&ths 2>;
+               };
+
+               gpu-thermal-zone {
+                       polling-delay-passive = <0>;
+                       polling-delay = <0>;
+                       thermal-sensors = <&ths 1>;
+               };
+       };
+};
index 883f217..3ea5182 100644 (file)
                                    "Microphone", "Microphone Jack",
                                    "Microphone", "Onboard Microphone";
        simple-audio-card,routing =
-                       "Left DAC", "AIF1 Slot 0 Left",
-                       "Right DAC", "AIF1 Slot 0 Right",
-                       "AIF1 Slot 0 Left ADC", "Left ADC",
-                       "AIF1 Slot 0 Right ADC", "Right ADC",
+                       "Left DAC", "DACL",
+                       "Right DAC", "DACR",
+                       "ADCL", "Left ADC",
+                       "ADCR", "Right ADC",
                        "Headphone Jack", "HP",
                        "MIC2", "Microphone Jack",
                        "Onboard Microphone", "MBIAS",
index fde9c7a..d894ec5 100644 (file)
                                    "Microphone", "Microphone Jack",
                                    "Microphone", "Onboard Microphone";
        simple-audio-card,routing =
-                       "Left DAC", "AIF1 Slot 0 Left",
-                       "Right DAC", "AIF1 Slot 0 Right",
-                       "AIF1 Slot 0 Left ADC", "Left ADC",
-                       "AIF1 Slot 0 Right ADC", "Right ADC",
+                       "Left DAC", "DACL",
+                       "Right DAC", "DACR",
+                       "ADCL", "Left ADC",
+                       "ADCR", "Right ADC",
                        "Headphone Jack", "HP",
                        "MIC2", "Microphone Jack",
                        "Onboard Microphone", "MBIAS",
index 2165f23..329cf27 100644 (file)
        simple-audio-card,widgets = "Microphone", "Microphone Jack",
                                    "Headphone", "Headphone Jack";
        simple-audio-card,routing =
-                       "Left DAC", "AIF1 Slot 0 Left",
-                       "Right DAC", "AIF1 Slot 0 Right",
+                       "Left DAC", "DACL",
+                       "Right DAC", "DACR",
                        "Headphone Jack", "HP",
-                       "AIF1 Slot 0 Left ADC", "Left ADC",
-                       "AIF1 Slot 0 Right ADC", "Right ADC",
+                       "ADCL", "Left ADC",
+                       "ADCR", "Right ADC",
                        "MIC2", "Microphone Jack";
        status = "okay";
 };
index 64b1c54..896f34f 100644 (file)
                                    "Headphone", "Headphone Jack",
                                    "Speaker", "Internal Speaker";
        simple-audio-card,routing =
-                       "Left DAC", "AIF1 Slot 0 Left",
-                       "Right DAC", "AIF1 Slot 0 Right",
+                       "Left DAC", "DACL",
+                       "Right DAC", "DACR",
                        "Speaker Amp INL", "LINEOUT",
                        "Speaker Amp INR", "LINEOUT",
                        "Internal Speaker", "Speaker Amp OUTL",
                        "Internal Speaker", "Speaker Amp OUTR",
                        "Headphone Jack", "HP",
-                       "AIF1 Slot 0 Left ADC", "Left ADC",
-                       "AIF1 Slot 0 Right ADC", "Right ADC",
+                       "ADCL", "Left ADC",
+                       "ADCR", "Right ADC",
                        "Internal Microphone Left", "MBIAS",
                        "MIC1", "Internal Microphone Left",
                        "Internal Microphone Right", "HBIAS",
index 25150ab..5780713 100644 (file)
                        "Internal Speaker", "Speaker Amp OUTR",
                        "Speaker Amp INL", "LINEOUT",
                        "Speaker Amp INR", "LINEOUT",
-                       "Left DAC", "AIF1 Slot 0 Left",
-                       "Right DAC", "AIF1 Slot 0 Right",
-                       "AIF1 Slot 0 Left ADC", "Left ADC",
-                       "AIF1 Slot 0 Right ADC", "Right ADC",
+                       "Left DAC", "DACL",
+                       "Right DAC", "DACR",
+                       "ADCL", "Left ADC",
+                       "ADCR", "Right ADC",
                        "Internal Microphone", "MBIAS",
                        "MIC1", "Internal Microphone",
                        "Headset Microphone", "HBIAS",
index dc4ab6b..3ab0f03 100644 (file)
                                    "Headphone", "Headphone Jack",
                                    "Speaker", "Internal Speaker";
        simple-audio-card,routing =
-                       "Left DAC", "AIF1 Slot 0 Left",
-                       "Right DAC", "AIF1 Slot 0 Right",
+                       "Left DAC", "DACL",
+                       "Right DAC", "DACR",
                        "Speaker Amp INL", "LINEOUT",
                        "Speaker Amp INR", "LINEOUT",
                        "Internal Speaker", "Speaker Amp OUTL",
                        "Internal Speaker", "Speaker Amp OUTR",
                        "Headphone Jack", "HP",
-                       "AIF1 Slot 0 Left ADC", "Left ADC",
-                       "AIF1 Slot 0 Right ADC", "Right ADC",
+                       "ADCL", "Left ADC",
+                       "ADCR", "Right ADC",
                        "Internal Microphone Left", "MBIAS",
                        "MIC1", "Internal Microphone Left",
                        "Internal Microphone Right", "HBIAS",
index 2f6ea9f..9ebb9e0 100644 (file)
        simple-audio-card,widgets = "Microphone", "Microphone Jack",
                                    "Headphone", "Headphone Jack";
        simple-audio-card,routing =
-                       "Left DAC", "AIF1 Slot 0 Left",
-                       "Right DAC", "AIF1 Slot 0 Right",
+                       "Left DAC", "DACL",
+                       "Right DAC", "DACR",
                        "Headphone Jack", "HP",
-                       "AIF1 Slot 0 Left ADC", "Left ADC",
-                       "AIF1 Slot 0 Right ADC", "Right ADC",
+                       "ADCL", "Left ADC",
+                       "ADCR", "Right ADC",
                        "MIC2", "Microphone Jack";
        status = "okay";
 };
index f5df5f7..a1864a8 100644 (file)
                                    "Microphone", "Internal Microphone",
                                    "Speaker", "Internal Speaker";
        simple-audio-card,routing =
-                       "Left DAC", "AIF1 Slot 0 Left",
-                       "Right DAC", "AIF1 Slot 0 Right",
-                       "AIF1 Slot 0 Left ADC", "Left ADC",
-                       "AIF1 Slot 0 Right ADC", "Right ADC",
+                       "Left DAC", "DACL",
+                       "Right DAC", "DACR",
+                       "ADCL", "Left ADC",
+                       "ADCR", "Right ADC",
                        "Headphone Jack", "HP",
                        "Speaker Amp INL", "LINEOUT",
                        "Speaker Amp INR", "LINEOUT",
index 8dfbcd1..dc23881 100644 (file)
@@ -51,7 +51,7 @@
                        reg = <0>;
                        enable-method = "psci";
                        next-level-cache = <&L2>;
-                       clocks = <&ccu 21>;
+                       clocks = <&ccu CLK_CPUX>;
                        clock-names = "cpu";
                        #cooling-cells = <2>;
                };
@@ -62,7 +62,7 @@
                        reg = <1>;
                        enable-method = "psci";
                        next-level-cache = <&L2>;
-                       clocks = <&ccu 21>;
+                       clocks = <&ccu CLK_CPUX>;
                        clock-names = "cpu";
                        #cooling-cells = <2>;
                };
@@ -73,7 +73,7 @@
                        reg = <2>;
                        enable-method = "psci";
                        next-level-cache = <&L2>;
-                       clocks = <&ccu 21>;
+                       clocks = <&ccu CLK_CPUX>;
                        clock-names = "cpu";
                        #cooling-cells = <2>;
                };
@@ -84,7 +84,7 @@
                        reg = <3>;
                        enable-method = "psci";
                        next-level-cache = <&L2>;
-                       clocks = <&ccu 21>;
+                       clocks = <&ccu CLK_CPUX>;
                        clock-names = "cpu";
                        #cooling-cells = <2>;
                };
                simple-audio-card,mclk-fs = <128>;
                simple-audio-card,aux-devs = <&codec_analog>;
                simple-audio-card,routing =
-                               "Left DAC", "AIF1 Slot 0 Left",
-                               "Right DAC", "AIF1 Slot 0 Right",
-                               "AIF1 Slot 0 Left ADC", "Left ADC",
-                               "AIF1 Slot 0 Right ADC", "Right ADC";
+                               "Left DAC", "DACL",
+                               "Right DAC", "DACR",
+                               "ADCL", "Left ADC",
+                               "ADCR", "Right ADC";
                status = "disabled";
 
                cpudai: simple-audio-card,cpu {
        timer {
                compatible = "arm,armv8-timer";
                allwinner,erratum-unknown1;
+               arm,no-tick-in-suspend;
                interrupts = <GIC_PPI 13
                        (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
                             <GIC_PPI 14
 
                codec: codec@1c22e00 {
                        #sound-dai-cells = <0>;
-                       compatible = "allwinner,sun8i-a33-codec";
+                       compatible = "allwinner,sun50i-a64-codec",
+                                    "allwinner,sun8i-a33-codec";
                        reg = <0x01c22e00 0x600>;
                        interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
index 6735e31..10489e5 100644 (file)
@@ -67,6 +67,7 @@
 
        timer {
                compatible = "arm,armv8-timer";
+               arm,no-tick-in-suspend;
                interrupts = <GIC_PPI 13
                                (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
                             <GIC_PPI 14
                                     <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
+                                    <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-names = "gp",
                                          "gpmmu",
                                          "pp",
                                          "pp2",
                                          "ppmmu2",
                                          "pp3",
-                                         "ppmmu3",
-                                         "pmu";
+                                         "ppmmu3";
                        clocks = <&ccu CLK_BUS_GPU>, <&ccu CLK_GPU>;
                        clock-names = "bus", "core";
                        resets = <&ccu RST_BUS_GPU>;
index 9ce78a7..28c77d6 100644 (file)
@@ -90,6 +90,7 @@
 
        timer {
                compatible = "arm,armv8-timer";
+               arm,no-tick-in-suspend;
                interrupts = <GIC_PPI 13
                        (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
                             <GIC_PPI 14
index a6fb01c..0f89398 100644 (file)
                        mac-address = [00 00 00 00 00 00];
                        resets = <&rst EMAC0_RESET>, <&rst EMAC0_OCP_RESET>;
                        reset-names = "stmmaceth", "stmmaceth-ocp";
-                       clocks = <&clkmgr STRATIX10_EMAC0_CLK>;
-                       clock-names = "stmmaceth";
+                       clocks = <&clkmgr STRATIX10_EMAC0_CLK>, <&clkmgr STRATIX10_EMAC_PTP_CLK>;
+                       clock-names = "stmmaceth", "ptp_ref";
                        tx-fifo-depth = <16384>;
                        rx-fifo-depth = <16384>;
                        snps,multicast-filter-bins = <256>;
                        mac-address = [00 00 00 00 00 00];
                        resets = <&rst EMAC1_RESET>, <&rst EMAC1_OCP_RESET>;
                        reset-names = "stmmaceth", "stmmaceth-ocp";
-                       clocks = <&clkmgr STRATIX10_EMAC1_CLK>;
-                       clock-names = "stmmaceth";
+                       clocks = <&clkmgr STRATIX10_EMAC1_CLK>, <&clkmgr STRATIX10_EMAC_PTP_CLK>;
+                       clock-names = "stmmaceth", "ptp_ref";
                        tx-fifo-depth = <16384>;
                        rx-fifo-depth = <16384>;
                        snps,multicast-filter-bins = <256>;
                        mac-address = [00 00 00 00 00 00];
                        resets = <&rst EMAC2_RESET>, <&rst EMAC2_OCP_RESET>;
                        reset-names = "stmmaceth", "stmmaceth-ocp";
-                       clocks = <&clkmgr STRATIX10_EMAC2_CLK>;
-                       clock-names = "stmmaceth";
+                       clocks = <&clkmgr STRATIX10_EMAC2_CLK>, <&clkmgr STRATIX10_EMAC_PTP_CLK>;
+                       clock-names = "stmmaceth", "ptp_ref";
                        tx-fifo-depth = <16384>;
                        rx-fifo-depth = <16384>;
                        snps,multicast-filter-bins = <256>;
index d5e7e2b..4eb2cd1 100644 (file)
                                     <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
                };
 
-               gic: gic@f0100000 {
+               gic: interrupt-controller@f0200000 {
                        compatible = "arm,gic-v3";
                        reg = <0x0 0xf0200000 0x0 0x10000>,     /* GIC Dist */
                              <0x0 0xf0280000 0x0 0x200000>,    /* GICR */
index 4e2239f..ced0394 100644 (file)
@@ -8,6 +8,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-ugoos-am6.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-kii-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb
@@ -24,6 +25,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s805x-libretech-ac.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-libretech-cc.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-libretech-cc-v2.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
index cb1360a..7740f97 100644 (file)
        pinctrl-0 = <&uart_ao_a_pins>;
        pinctrl-names = "default";
 };
+
+&usb {
+       status = "okay";
+       dr_mode = "otg";
+       vbus-supply = <&usb_pwr>;
+};
index b9efc84..724ee17 100644 (file)
                #size-cells = <2>;
                ranges;
 
+               usb: usb@ffe09080 {
+                       compatible = "amlogic,meson-axg-usb-ctrl";
+                       reg = <0x0 0xffe09080 0x0 0x20>;
+                       interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
+                       #address-cells = <2>;
+                       #size-cells = <2>;
+                       ranges;
+
+                       clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1_DDR_BRIDGE>;
+                       clock-names = "usb_ctrl", "ddr";
+                       resets = <&reset RESET_USB_OTG>;
+
+                       dr_mode = "otg";
+
+                       phys = <&usb2_phy1>;
+                       phy-names = "usb2-phy1";
+
+                       dwc2: usb@ff400000 {
+                               compatible = "amlogic,meson-g12a-usb", "snps,dwc2";
+                               reg = <0x0 0xff400000 0x0 0x40000>;
+                               interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clkc CLKID_USB1>;
+                               clock-names = "otg";
+                               phys = <&usb2_phy1>;
+                               dr_mode = "peripheral";
+                               g-rx-fifo-size = <192>;
+                               g-np-tx-fifo-size = <128>;
+                               g-tx-fifo-size = <128 128 16 16 16>;
+                       };
+
+                       dwc3: usb@ff500000 {
+                               compatible = "snps,dwc3";
+                               reg = <0x0 0xff500000 0x0 0x100000>;
+                               interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
+                               dr_mode = "host";
+                               maximum-speed = "high-speed";
+                               snps,dis_u2_susphy_quirk;
+                       };
+               };
+
                ethmac: ethernet@ff3f0000 {
                        compatible = "amlogic,meson-axg-dwmac",
                                     "snps,dwmac-3.70a",
                                      "timing-adjustment";
                        rx-fifo-depth = <4096>;
                        tx-fifo-depth = <2048>;
+                       resets = <&reset RESET_ETHERNET>;
+                       reset-names = "stmmaceth";
                        status = "disabled";
                };
 
                                clock-names = "core", "clkin0", "clkin1";
                                resets = <&reset RESET_SD_EMMC_C>;
                        };
+
+                       usb2_phy1: phy@9020 {
+                               compatible = "amlogic,meson-gxl-usb2-phy";
+                               #phy-cells = <0>;
+                               reg = <0x0 0x9020 0x0 0x20>;
+                               clocks = <&clkc CLKID_USB>;
+                               clock-names = "phy";
+                               resets = <&reset RESET_USB_OTG>;
+                               reset-names = "phy";
+                       };
                };
 
                sram: sram@fffc0000 {
index 1e83ec5..8514fe6 100644 (file)
                };
 
                ethmac: ethernet@ff3f0000 {
-                       compatible = "amlogic,meson-axg-dwmac",
+                       compatible = "amlogic,meson-g12a-dwmac",
                                     "snps,dwmac-3.70a",
                                     "snps,dwmac";
                        reg = <0x0 0xff3f0000 0x0 0x10000>,
                                      "timing-adjustment";
                        rx-fifo-depth = <4096>;
                        tx-fifo-depth = <2048>;
+                       resets = <&reset RESET_ETHERNET>;
+                       reset-names = "stmmaceth";
                        status = "disabled";
 
                        mdio0: mdio {
                                hwrng: rng@218 {
                                        compatible = "amlogic,meson-rng";
                                        reg = <0x0 0x218 0x0 0x4>;
+                                       clocks = <&clkc CLKID_RNG0>;
+                                       clock-names = "core";
                                };
                        };
 
index 224c890..f42cf4b 100644 (file)
@@ -5,8 +5,6 @@
  * Copyright (c) 2019 Christian Hewitt <christianshewitt@gmail.com>
  */
 
-#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
-
 / {
        model = "Khadas VIM3";
 
                regulator-boot-on;
                regulator-always-on;
        };
-
-       sound {
-               compatible = "amlogic,axg-sound-card";
-               model = "G12B-KHADAS-VIM3";
-               audio-aux-devs = <&tdmout_a>;
-               audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
-                               "TDMOUT_A IN 1", "FRDDR_B OUT 0",
-                               "TDMOUT_A IN 2", "FRDDR_C OUT 0",
-                               "TDM_A Playback", "TDMOUT_A OUT";
-
-               assigned-clocks = <&clkc CLKID_MPLL2>,
-                                 <&clkc CLKID_MPLL0>,
-                                 <&clkc CLKID_MPLL1>;
-               assigned-clock-parents = <0>, <0>, <0>;
-               assigned-clock-rates = <294912000>,
-                                      <270950400>,
-                                      <393216000>;
-               status = "okay";
-
-               dai-link-0 {
-                       sound-dai = <&frddr_a>;
-               };
-
-               dai-link-1 {
-                       sound-dai = <&frddr_b>;
-               };
-
-               dai-link-2 {
-                       sound-dai = <&frddr_c>;
-               };
-
-               /* 8ch hdmi interface */
-               dai-link-3 {
-                       sound-dai = <&tdmif_a>;
-                       dai-format = "i2s";
-                       dai-tdm-slot-tx-mask-0 = <1 1>;
-                       dai-tdm-slot-tx-mask-1 = <1 1>;
-                       dai-tdm-slot-tx-mask-2 = <1 1>;
-                       dai-tdm-slot-tx-mask-3 = <1 1>;
-                       mclk-fs = <256>;
-
-                       codec {
-                               sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
-                       };
-               };
-
-               /* hdmi glue */
-               dai-link-4 {
-                       sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
-
-                       codec {
-                               sound-dai = <&hdmi_tx>;
-                       };
-               };
-       };
-};
-
-&arb {
-       status = "okay";
-};
-
-&clkc_audio {
-       status = "okay";
 };
 
 &cpu0 {
        clock-latency = <50000>;
 };
 
-&frddr_a {
-       status = "okay";
-};
-
-&frddr_b {
-       status = "okay";
-};
-
-&frddr_c {
-       status = "okay";
-};
-
 &pwm_ab {
        pinctrl-0 = <&pwm_a_e_pins>;
        pinctrl-names = "default";
        status = "okay";
 };
 
-&tdmif_a {
-       status = "okay";
-};
-
-&tdmout_a {
-       status = "okay";
-};
-
-&tohdmitx {
-       status = "okay";
-};
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
new file mode 100644 (file)
index 0000000..ce1198a
--- /dev/null
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+/dts-v1/;
+
+/* The Amlogic S922X Rev. C supports the same OPPs as the A311D variant */
+#include "meson-g12b-a311d.dtsi"
+#include "meson-g12b-odroid-n2.dtsi"
+
+/ {
+       compatible = "hardkernel,odroid-n2-plus", "amlogic,s922x", "amlogic,g12b";
+       model = "Hardkernel ODROID-N2Plus";
+};
+
+&vddcpu_a {
+       regulator-min-microvolt = <680000>;
+       regulator-max-microvolt = <1040000>;
+
+       pwms = <&pwm_ab 0 1500 0>;
+};
+
+&vddcpu_b {
+       regulator-min-microvolt = <680000>;
+       regulator-max-microvolt = <1040000>;
+
+       pwms = <&pwm_AO_cd 1 1500 0>;
+};
+
index 34fffa6..a198a91 100644 (file)
@@ -7,625 +7,9 @@
 /dts-v1/;
 
 #include "meson-g12b-s922x.dtsi"
-#include <dt-bindings/input/input.h>
-#include <dt-bindings/gpio/meson-g12a-gpio.h>
-#include <dt-bindings/sound/meson-g12a-toacodec.h>
-#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
+#include "meson-g12b-odroid-n2.dtsi"
 
 / {
        compatible = "hardkernel,odroid-n2", "amlogic,s922x", "amlogic,g12b";
        model = "Hardkernel ODROID-N2";
-
-       aliases {
-               serial0 = &uart_AO;
-               ethernet0 = &ethmac;
-       };
-
-       dioo2133: audio-amplifier-0 {
-               compatible = "simple-audio-amplifier";
-               enable-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
-               VCC-supply = <&vcc_5v>;
-               sound-name-prefix = "U19";
-               status = "okay";
-       };
-
-       chosen {
-               stdout-path = "serial0:115200n8";
-       };
-
-       memory@0 {
-               device_type = "memory";
-               reg = <0x0 0x0 0x0 0x40000000>;
-       };
-
-       emmc_pwrseq: emmc-pwrseq {
-               compatible = "mmc-pwrseq-emmc";
-               reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
-       };
-
-       leds {
-               compatible = "gpio-leds";
-
-               blue {
-                       label = "n2:blue";
-                       gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
-                       linux,default-trigger = "heartbeat";
-               };
-       };
-
-       tflash_vdd: regulator-tflash_vdd {
-               compatible = "regulator-fixed";
-
-               regulator-name = "TFLASH_VDD";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
-               regulator-always-on;
-       };
-
-       tf_io: gpio-regulator-tf_io {
-               compatible = "regulator-gpio";
-
-               regulator-name = "TF_IO";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
-               gpios-states = <0>;
-
-               states = <3300000 0>,
-                        <1800000 1>;
-       };
-
-       flash_1v8: regulator-flash_1v8 {
-               compatible = "regulator-fixed";
-               regulator-name = "FLASH_1V8";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <1800000>;
-               vin-supply = <&vcc_3v3>;
-               regulator-always-on;
-       };
-
-       main_12v: regulator-main_12v {
-               compatible = "regulator-fixed";
-               regulator-name = "12V";
-               regulator-min-microvolt = <12000000>;
-               regulator-max-microvolt = <12000000>;
-               regulator-always-on;
-       };
-
-       vcc_5v: regulator-vcc_5v {
-               compatible = "regulator-fixed";
-               regulator-name = "5V";
-               regulator-min-microvolt = <5000000>;
-               regulator-max-microvolt = <5000000>;
-               regulator-always-on;
-               vin-supply = <&main_12v>;
-       };
-
-       vcc_1v8: regulator-vcc_1v8 {
-               compatible = "regulator-fixed";
-               regulator-name = "VCC_1V8";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <1800000>;
-               vin-supply = <&vcc_3v3>;
-               regulator-always-on;
-       };
-
-       vcc_3v3: regulator-vcc_3v3 {
-               compatible = "regulator-fixed";
-               regulator-name = "VCC_3V3";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               vin-supply = <&vddao_3v3>;
-               regulator-always-on;
-               /* FIXME: actually controlled by VDDCPU_B_EN */
-       };
-
-       vddcpu_a: regulator-vddcpu-a {
-               /*
-                * MP8756GD Regulator.
-                */
-               compatible = "pwm-regulator";
-
-               regulator-name = "VDDCPU_A";
-               regulator-min-microvolt = <721000>;
-               regulator-max-microvolt = <1022000>;
-
-               vin-supply = <&main_12v>;
-
-               pwms = <&pwm_ab 0 1250 0>;
-               pwm-dutycycle-range = <100 0>;
-
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       vddcpu_b: regulator-vddcpu-b {
-               /*
-                * Silergy SY8120B1ABC Regulator.
-                */
-               compatible = "pwm-regulator";
-
-               regulator-name = "VDDCPU_B";
-               regulator-min-microvolt = <721000>;
-               regulator-max-microvolt = <1022000>;
-
-               vin-supply = <&main_12v>;
-
-               pwms = <&pwm_AO_cd 1 1250 0>;
-               pwm-dutycycle-range = <100 0>;
-
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       hub_5v: regulator-hub_5v {
-               compatible = "regulator-fixed";
-               regulator-name = "HUB_5V";
-               regulator-min-microvolt = <5000000>;
-               regulator-max-microvolt = <5000000>;
-               vin-supply = <&vcc_5v>;
-
-               /* Connected to the Hub CHIPENABLE, LOW sets low power state */
-               gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
-       };
-
-       usb_pwr_en: regulator-usb_pwr_en {
-               compatible = "regulator-fixed";
-               regulator-name = "USB_PWR_EN";
-               regulator-min-microvolt = <5000000>;
-               regulator-max-microvolt = <5000000>;
-               vin-supply = <&vcc_5v>;
-
-               /* Connected to the microUSB port power enable */
-               gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
-       };
-
-       vddao_1v8: regulator-vddao_1v8 {
-               compatible = "regulator-fixed";
-               regulator-name = "VDDAO_1V8";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <1800000>;
-               vin-supply = <&vddao_3v3>;
-               regulator-always-on;
-       };
-
-       vddao_3v3: regulator-vddao_3v3 {
-               compatible = "regulator-fixed";
-               regulator-name = "VDDAO_3V3";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               vin-supply = <&main_12v>;
-               regulator-always-on;
-       };
-
-       hdmi-connector {
-               compatible = "hdmi-connector";
-               type = "a";
-
-               port {
-                       hdmi_connector_in: endpoint {
-                               remote-endpoint = <&hdmi_tx_tmds_out>;
-                       };
-               };
-       };
-
-       sound {
-               compatible = "amlogic,axg-sound-card";
-               model = "G12B-ODROID-N2";
-               audio-widgets = "Line", "Lineout";
-               audio-aux-devs = <&tdmout_b>, <&tdmout_c>, <&tdmin_a>,
-                                <&tdmin_b>, <&tdmin_c>, <&tdmin_lb>,
-                                <&dioo2133>;
-               audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
-                               "TDMOUT_B IN 1", "FRDDR_B OUT 1",
-                               "TDMOUT_B IN 2", "FRDDR_C OUT 1",
-                               "TDM_B Playback", "TDMOUT_B OUT",
-                               "TDMOUT_C IN 0", "FRDDR_A OUT 2",
-                               "TDMOUT_C IN 1", "FRDDR_B OUT 2",
-                               "TDMOUT_C IN 2", "FRDDR_C OUT 2",
-                               "TDM_C Playback", "TDMOUT_C OUT",
-                               "TDMIN_A IN 4", "TDM_B Loopback",
-                               "TDMIN_B IN 4", "TDM_B Loopback",
-                               "TDMIN_C IN 4", "TDM_B Loopback",
-                               "TDMIN_LB IN 1", "TDM_B Loopback",
-                               "TDMIN_A IN 5", "TDM_C Loopback",
-                               "TDMIN_B IN 5", "TDM_C Loopback",
-                               "TDMIN_C IN 5", "TDM_C Loopback",
-                               "TDMIN_LB IN 2", "TDM_C Loopback",
-                               "TODDR_A IN 0", "TDMIN_A OUT",
-                               "TODDR_B IN 0", "TDMIN_A OUT",
-                               "TODDR_C IN 0", "TDMIN_A OUT",
-                               "TODDR_A IN 1", "TDMIN_B OUT",
-                               "TODDR_B IN 1", "TDMIN_B OUT",
-                               "TODDR_C IN 1", "TDMIN_B OUT",
-                               "TODDR_A IN 2", "TDMIN_C OUT",
-                               "TODDR_B IN 2", "TDMIN_C OUT",
-                               "TODDR_C IN 2", "TDMIN_C OUT",
-                               "TODDR_A IN 6", "TDMIN_LB OUT",
-                               "TODDR_B IN 6", "TDMIN_LB OUT",
-                               "TODDR_C IN 6", "TDMIN_LB OUT",
-                               "U19 INL", "ACODEC LOLP",
-                               "U19 INR", "ACODEC LORP",
-                               "Lineout", "U19 OUTL",
-                               "Lineout", "U19 OUTR";
-
-               assigned-clocks = <&clkc CLKID_MPLL2>,
-                                 <&clkc CLKID_MPLL0>,
-                                 <&clkc CLKID_MPLL1>;
-               assigned-clock-parents = <0>, <0>, <0>;
-               assigned-clock-rates = <294912000>,
-                                      <270950400>,
-                                      <393216000>;
-               status = "okay";
-
-               dai-link-0 {
-                       sound-dai = <&frddr_a>;
-               };
-
-               dai-link-1 {
-                       sound-dai = <&frddr_b>;
-               };
-
-               dai-link-2 {
-                       sound-dai = <&frddr_c>;
-               };
-
-               dai-link-3 {
-                       sound-dai = <&toddr_a>;
-               };
-
-               dai-link-4 {
-                       sound-dai = <&toddr_b>;
-               };
-
-               dai-link-5 {
-                       sound-dai = <&toddr_c>;
-               };
-
-               /* 8ch hdmi interface */
-               dai-link-6 {
-                       sound-dai = <&tdmif_b>;
-                       dai-format = "i2s";
-                       dai-tdm-slot-tx-mask-0 = <1 1>;
-                       dai-tdm-slot-tx-mask-1 = <1 1>;
-                       dai-tdm-slot-tx-mask-2 = <1 1>;
-                       dai-tdm-slot-tx-mask-3 = <1 1>;
-                       mclk-fs = <256>;
-
-                       codec-0 {
-                               sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
-                       };
-
-                       codec-1 {
-                               sound-dai = <&toacodec TOACODEC_IN_B>;
-                       };
-               };
-
-               /* i2s jack output interface */
-               dai-link-7 {
-                       sound-dai = <&tdmif_c>;
-                       dai-format = "i2s";
-                       dai-tdm-slot-tx-mask-0 = <1 1>;
-                       mclk-fs = <256>;
-
-                       codec-0 {
-                               sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>;
-                       };
-
-                       codec-1 {
-                               sound-dai = <&toacodec TOACODEC_IN_C>;
-                       };
-               };
-
-               /* hdmi glue */
-               dai-link-8 {
-                       sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
-
-                       codec {
-                               sound-dai = <&hdmi_tx>;
-                       };
-               };
-
-               /* acodec glue */
-               dai-link-9 {
-                       sound-dai = <&toacodec TOACODEC_OUT>;
-
-                       codec {
-                               sound-dai = <&acodec>;
-                       };
-               };
-       };
-};
-
-&acodec {
-       AVDD-supply = <&vddao_1v8>;
-       status = "okay";
-};
-
-&arb {
-       status = "okay";
-};
-
-&cec_AO {
-       pinctrl-0 = <&cec_ao_a_h_pins>;
-       pinctrl-names = "default";
-       status = "disabled";
-       hdmi-phandle = <&hdmi_tx>;
-};
-
-&cecb_AO {
-       pinctrl-0 = <&cec_ao_b_h_pins>;
-       pinctrl-names = "default";
-       status = "okay";
-       hdmi-phandle = <&hdmi_tx>;
-};
-
-&clkc_audio {
-       status = "okay";
-};
-
-&cpu0 {
-       cpu-supply = <&vddcpu_b>;
-       operating-points-v2 = <&cpu_opp_table_0>;
-       clocks = <&clkc CLKID_CPU_CLK>;
-       clock-latency = <50000>;
-};
-
-&cpu1 {
-       cpu-supply = <&vddcpu_b>;
-       operating-points-v2 = <&cpu_opp_table_0>;
-       clocks = <&clkc CLKID_CPU_CLK>;
-       clock-latency = <50000>;
-};
-
-&cpu100 {
-       cpu-supply = <&vddcpu_a>;
-       operating-points-v2 = <&cpub_opp_table_1>;
-       clocks = <&clkc CLKID_CPUB_CLK>;
-       clock-latency = <50000>;
-};
-
-&cpu101 {
-       cpu-supply = <&vddcpu_a>;
-       operating-points-v2 = <&cpub_opp_table_1>;
-       clocks = <&clkc CLKID_CPUB_CLK>;
-       clock-latency = <50000>;
-};
-
-&cpu102 {
-       cpu-supply = <&vddcpu_a>;
-       operating-points-v2 = <&cpub_opp_table_1>;
-       clocks = <&clkc CLKID_CPUB_CLK>;
-       clock-latency = <50000>;
-};
-
-&cpu103 {
-       cpu-supply = <&vddcpu_a>;
-       operating-points-v2 = <&cpub_opp_table_1>;
-       clocks = <&clkc CLKID_CPUB_CLK>;
-       clock-latency = <50000>;
-};
-
-&ext_mdio {
-       external_phy: ethernet-phy@0 {
-               /* Realtek RTL8211F (0x001cc916) */     
-               reg = <0>;
-               max-speed = <1000>;
-
-               reset-assert-us = <10000>;
-               reset-deassert-us = <30000>;
-               reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
-
-               interrupt-parent = <&gpio_intc>;
-               /* MAC_INTR on GPIOZ_14 */
-               interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
-       };
-};
-
-&ethmac {
-       pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
-       pinctrl-names = "default";
-       status = "okay";
-       phy-mode = "rgmii";
-       phy-handle = <&external_phy>;
-       amlogic,tx-delay-ns = <2>;
-};
-
-&frddr_a {
-       status = "okay";
-};
-
-&frddr_b {
-       status = "okay";
-};
-
-&frddr_c {
-       status = "okay";
-};
-
-&gpio {
-       /*
-        * WARNING: The USB Hub on the Odroid-N2 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 = <GPIOH_4 GPIO_ACTIVE_HIGH>;
-               output-high;
-               line-name = "usb-hub-reset";
-       };
-};
-
-&hdmi_tx {
-       status = "okay";
-       pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
-       pinctrl-names = "default";
-       hdmi-supply = <&vcc_5v>;
-};
-
-&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";
-       linux,rc-map-name = "rc-odroid";
-};
-
-&pwm_ab {
-       pinctrl-0 = <&pwm_a_e_pins>;
-       pinctrl-names = "default";
-       clocks = <&xtal>;
-       clock-names = "clkin0";
-       status = "okay";
-};
-
-&pwm_AO_cd {
-       pinctrl-0 = <&pwm_ao_d_e_pins>;
-       pinctrl-names = "default";
-       clocks = <&xtal>;
-       clock-names = "clkin1";
-       status = "okay";
-};
-
-/* SD card */
-&sd_emmc_b {
-       status = "okay";
-       pinctrl-0 = <&sdcard_c_pins>;
-       pinctrl-1 = <&sdcard_clk_gate_c_pins>;
-       pinctrl-names = "default", "clk-gate";
-
-       bus-width = <4>;
-       cap-sd-highspeed;
-       max-frequency = <50000000>;
-       disable-wp;
-
-       cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
-       vmmc-supply = <&tflash_vdd>;
-       vqmmc-supply = <&tf_io>;
-
-};
-
-/* eMMC */
-&sd_emmc_c {
-       status = "okay";
-       pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
-       pinctrl-1 = <&emmc_clk_gate_pins>;
-       pinctrl-names = "default", "clk-gate";
-
-       bus-width = <8>;
-       cap-mmc-highspeed;
-       mmc-ddr-1_8v;
-       mmc-hs200-1_8v;
-       max-frequency = <200000000>;
-       disable-wp;
-
-       mmc-pwrseq = <&emmc_pwrseq>;
-       vmmc-supply = <&vcc_3v3>;
-       vqmmc-supply = <&flash_1v8>;
-};
-
-/*
- * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR pins
- * and eMMC Data 4 to 7 pins.
- * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0,
- * and change bus-width to 4 then spifc can be enabled.
- * The SW1 slide should also be set to the correct position.
- */
-&spifc {
-       status = "disabled";
-       pinctrl-0 = <&nor_pins>;
-       pinctrl-names = "default";
-
-       mx25u64: spi-flash@0 {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               compatible = "mxicy,mx25u6435f", "jedec,spi-nor";
-               reg = <0>;
-               spi-max-frequency = <104000000>;
-       };
-};
-
-&tdmif_b {
-       status = "okay";
-};
-
-&tdmif_c {
-       status = "okay";
-};
-
-&tdmin_a {
-       status = "okay";
-};
-
-&tdmin_b {
-       status = "okay";
-};
-
-&tdmin_c {
-       status = "okay";
-};
-
-&tdmin_lb {
-       status = "okay";
-};
-
-&tdmout_b {
-       status = "okay";
-};
-
-&tdmout_c {
-       status = "okay";
-};
-
-&toacodec {
-       status = "okay";
-};
-
-&tohdmitx {
-       status = "okay";
-};
-
-&toddr_a {
-       status = "okay";
-};
-
-&toddr_b {
-       status = "okay";
-};
-
-&toddr_c {
-       status = "okay";
-};
-
-&uart_AO {
-       status = "okay";
-       pinctrl-0 = <&uart_ao_a_pins>;
-       pinctrl-names = "default";
-};
-
-&usb {
-       status = "okay";
-       vbus-supply = <&usb_pwr_en>;
-};
-
-&usb2_phy0 {
-       phy-supply = <&vcc_5v>;
-};
-
-&usb2_phy1 {
-       /* Enable the hub which is connected to this port */
-       phy-supply = <&hub_5v>;
 };
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
new file mode 100644 (file)
index 0000000..6982632
--- /dev/null
@@ -0,0 +1,625 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/sound/meson-g12a-toacodec.h>
+#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
+
+/ {
+       aliases {
+               serial0 = &uart_AO;
+               ethernet0 = &ethmac;
+       };
+
+       dioo2133: audio-amplifier-0 {
+               compatible = "simple-audio-amplifier";
+               enable-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
+               VCC-supply = <&vcc_5v>;
+               sound-name-prefix = "U19";
+               status = "okay";
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x0 0x0 0x40000000>;
+       };
+
+       emmc_pwrseq: emmc-pwrseq {
+               compatible = "mmc-pwrseq-emmc";
+               reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               blue {
+                       label = "n2:blue";
+                       gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       tflash_vdd: regulator-tflash_vdd {
+               compatible = "regulator-fixed";
+
+               regulator-name = "TFLASH_VDD";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+               regulator-always-on;
+       };
+
+       tf_io: gpio-regulator-tf_io {
+               compatible = "regulator-gpio";
+
+               regulator-name = "TF_IO";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
+               gpios-states = <0>;
+
+               states = <3300000 0>,
+                        <1800000 1>;
+       };
+
+       flash_1v8: regulator-flash_1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "FLASH_1V8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vcc_3v3>;
+               regulator-always-on;
+       };
+
+       main_12v: regulator-main_12v {
+               compatible = "regulator-fixed";
+               regulator-name = "12V";
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+               regulator-always-on;
+       };
+
+       vcc_5v: regulator-vcc_5v {
+               compatible = "regulator-fixed";
+               regulator-name = "5V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+               vin-supply = <&main_12v>;
+       };
+
+       vcc_1v8: regulator-vcc_1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_1V8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vcc_3v3>;
+               regulator-always-on;
+       };
+
+       vcc_3v3: regulator-vcc_3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vddao_3v3>;
+               regulator-always-on;
+               /* FIXME: actually controlled by VDDCPU_B_EN */
+       };
+
+       vddcpu_a: regulator-vddcpu-a {
+               /*
+                * MP8756GD Regulator.
+                */
+               compatible = "pwm-regulator";
+
+               regulator-name = "VDDCPU_A";
+               regulator-min-microvolt = <721000>;
+               regulator-max-microvolt = <1022000>;
+
+               vin-supply = <&main_12v>;
+
+               pwms = <&pwm_ab 0 1250 0>;
+               pwm-dutycycle-range = <100 0>;
+
+               regulator-boot-on;
+               regulator-always-on;
+       };
+
+       vddcpu_b: regulator-vddcpu-b {
+               /*
+                * Silergy SY8120B1ABC Regulator.
+                */
+               compatible = "pwm-regulator";
+
+               regulator-name = "VDDCPU_B";
+               regulator-min-microvolt = <721000>;
+               regulator-max-microvolt = <1022000>;
+
+               vin-supply = <&main_12v>;
+
+               pwms = <&pwm_AO_cd 1 1250 0>;
+               pwm-dutycycle-range = <100 0>;
+
+               regulator-boot-on;
+               regulator-always-on;
+       };
+
+       hub_5v: regulator-hub_5v {
+               compatible = "regulator-fixed";
+               regulator-name = "HUB_5V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&vcc_5v>;
+
+               /* Connected to the Hub CHIPENABLE, LOW sets low power state */
+               gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       usb_pwr_en: regulator-usb_pwr_en {
+               compatible = "regulator-fixed";
+               regulator-name = "USB_PWR_EN";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&vcc_5v>;
+
+               /* Connected to the microUSB port power enable */
+               gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       vddao_1v8: regulator-vddao_1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDAO_1V8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vddao_3v3>;
+               regulator-always-on;
+       };
+
+       vddao_3v3: regulator-vddao_3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDAO_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&main_12v>;
+               regulator-always-on;
+       };
+
+       hdmi-connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi_tx_tmds_out>;
+                       };
+               };
+       };
+
+       sound {
+               compatible = "amlogic,axg-sound-card";
+               model = "G12B-ODROID-N2";
+               audio-widgets = "Line", "Lineout";
+               audio-aux-devs = <&tdmout_b>, <&tdmout_c>, <&tdmin_a>,
+                                <&tdmin_b>, <&tdmin_c>, <&tdmin_lb>,
+                                <&dioo2133>;
+               audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
+                               "TDMOUT_B IN 1", "FRDDR_B OUT 1",
+                               "TDMOUT_B IN 2", "FRDDR_C OUT 1",
+                               "TDM_B Playback", "TDMOUT_B OUT",
+                               "TDMOUT_C IN 0", "FRDDR_A OUT 2",
+                               "TDMOUT_C IN 1", "FRDDR_B OUT 2",
+                               "TDMOUT_C IN 2", "FRDDR_C OUT 2",
+                               "TDM_C Playback", "TDMOUT_C OUT",
+                               "TDMIN_A IN 4", "TDM_B Loopback",
+                               "TDMIN_B IN 4", "TDM_B Loopback",
+                               "TDMIN_C IN 4", "TDM_B Loopback",
+                               "TDMIN_LB IN 1", "TDM_B Loopback",
+                               "TDMIN_A IN 5", "TDM_C Loopback",
+                               "TDMIN_B IN 5", "TDM_C Loopback",
+                               "TDMIN_C IN 5", "TDM_C Loopback",
+                               "TDMIN_LB IN 2", "TDM_C Loopback",
+                               "TODDR_A IN 0", "TDMIN_A OUT",
+                               "TODDR_B IN 0", "TDMIN_A OUT",
+                               "TODDR_C IN 0", "TDMIN_A OUT",
+                               "TODDR_A IN 1", "TDMIN_B OUT",
+                               "TODDR_B IN 1", "TDMIN_B OUT",
+                               "TODDR_C IN 1", "TDMIN_B OUT",
+                               "TODDR_A IN 2", "TDMIN_C OUT",
+                               "TODDR_B IN 2", "TDMIN_C OUT",
+                               "TODDR_C IN 2", "TDMIN_C OUT",
+                               "TODDR_A IN 6", "TDMIN_LB OUT",
+                               "TODDR_B IN 6", "TDMIN_LB OUT",
+                               "TODDR_C IN 6", "TDMIN_LB OUT",
+                               "U19 INL", "ACODEC LOLP",
+                               "U19 INR", "ACODEC LORP",
+                               "Lineout", "U19 OUTL",
+                               "Lineout", "U19 OUTR";
+
+               assigned-clocks = <&clkc CLKID_MPLL2>,
+                                 <&clkc CLKID_MPLL0>,
+                                 <&clkc CLKID_MPLL1>;
+               assigned-clock-parents = <0>, <0>, <0>;
+               assigned-clock-rates = <294912000>,
+                                      <270950400>,
+                                      <393216000>;
+               status = "okay";
+
+               dai-link-0 {
+                       sound-dai = <&frddr_a>;
+               };
+
+               dai-link-1 {
+                       sound-dai = <&frddr_b>;
+               };
+
+               dai-link-2 {
+                       sound-dai = <&frddr_c>;
+               };
+
+               dai-link-3 {
+                       sound-dai = <&toddr_a>;
+               };
+
+               dai-link-4 {
+                       sound-dai = <&toddr_b>;
+               };
+
+               dai-link-5 {
+                       sound-dai = <&toddr_c>;
+               };
+
+               /* 8ch hdmi interface */
+               dai-link-6 {
+                       sound-dai = <&tdmif_b>;
+                       dai-format = "i2s";
+                       dai-tdm-slot-tx-mask-0 = <1 1>;
+                       dai-tdm-slot-tx-mask-1 = <1 1>;
+                       dai-tdm-slot-tx-mask-2 = <1 1>;
+                       dai-tdm-slot-tx-mask-3 = <1 1>;
+                       mclk-fs = <256>;
+
+                       codec-0 {
+                               sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
+                       };
+
+                       codec-1 {
+                               sound-dai = <&toacodec TOACODEC_IN_B>;
+                       };
+               };
+
+               /* i2s jack output interface */
+               dai-link-7 {
+                       sound-dai = <&tdmif_c>;
+                       dai-format = "i2s";
+                       dai-tdm-slot-tx-mask-0 = <1 1>;
+                       mclk-fs = <256>;
+
+                       codec-0 {
+                               sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>;
+                       };
+
+                       codec-1 {
+                               sound-dai = <&toacodec TOACODEC_IN_C>;
+                       };
+               };
+
+               /* hdmi glue */
+               dai-link-8 {
+                       sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
+
+                       codec {
+                               sound-dai = <&hdmi_tx>;
+                       };
+               };
+
+               /* acodec glue */
+               dai-link-9 {
+                       sound-dai = <&toacodec TOACODEC_OUT>;
+
+                       codec {
+                               sound-dai = <&acodec>;
+                       };
+               };
+       };
+};
+
+&acodec {
+       AVDD-supply = <&vddao_1v8>;
+       status = "okay";
+};
+
+&arb {
+       status = "okay";
+};
+
+&cec_AO {
+       pinctrl-0 = <&cec_ao_a_h_pins>;
+       pinctrl-names = "default";
+       status = "disabled";
+       hdmi-phandle = <&hdmi_tx>;
+};
+
+&cecb_AO {
+       pinctrl-0 = <&cec_ao_b_h_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+       hdmi-phandle = <&hdmi_tx>;
+};
+
+&clkc_audio {
+       status = "okay";
+};
+
+&cpu0 {
+       cpu-supply = <&vddcpu_b>;
+       operating-points-v2 = <&cpu_opp_table_0>;
+       clocks = <&clkc CLKID_CPU_CLK>;
+       clock-latency = <50000>;
+};
+
+&cpu1 {
+       cpu-supply = <&vddcpu_b>;
+       operating-points-v2 = <&cpu_opp_table_0>;
+       clocks = <&clkc CLKID_CPU_CLK>;
+       clock-latency = <50000>;
+};
+
+&cpu100 {
+       cpu-supply = <&vddcpu_a>;
+       operating-points-v2 = <&cpub_opp_table_1>;
+       clocks = <&clkc CLKID_CPUB_CLK>;
+       clock-latency = <50000>;
+};
+
+&cpu101 {
+       cpu-supply = <&vddcpu_a>;
+       operating-points-v2 = <&cpub_opp_table_1>;
+       clocks = <&clkc CLKID_CPUB_CLK>;
+       clock-latency = <50000>;
+};
+
+&cpu102 {
+       cpu-supply = <&vddcpu_a>;
+       operating-points-v2 = <&cpub_opp_table_1>;
+       clocks = <&clkc CLKID_CPUB_CLK>;
+       clock-latency = <50000>;
+};
+
+&cpu103 {
+       cpu-supply = <&vddcpu_a>;
+       operating-points-v2 = <&cpub_opp_table_1>;
+       clocks = <&clkc CLKID_CPUB_CLK>;
+       clock-latency = <50000>;
+};
+
+&ext_mdio {
+       external_phy: ethernet-phy@0 {
+               /* Realtek RTL8211F (0x001cc916) */     
+               reg = <0>;
+               max-speed = <1000>;
+
+               reset-assert-us = <10000>;
+               reset-deassert-us = <30000>;
+               reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
+
+               interrupt-parent = <&gpio_intc>;
+               /* MAC_INTR on GPIOZ_14 */
+               interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
+       };
+};
+
+&ethmac {
+       pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+       phy-mode = "rgmii";
+       phy-handle = <&external_phy>;
+       amlogic,tx-delay-ns = <2>;
+};
+
+&frddr_a {
+       status = "okay";
+};
+
+&frddr_b {
+       status = "okay";
+};
+
+&frddr_c {
+       status = "okay";
+};
+
+&gpio {
+       /*
+        * WARNING: The USB Hub on the Odroid-N2 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 = <GPIOH_4 GPIO_ACTIVE_HIGH>;
+               output-high;
+               line-name = "usb-hub-reset";
+       };
+};
+
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
+       pinctrl-names = "default";
+       hdmi-supply = <&vcc_5v>;
+};
+
+&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";
+       linux,rc-map-name = "rc-odroid";
+};
+
+&pwm_ab {
+       pinctrl-0 = <&pwm_a_e_pins>;
+       pinctrl-names = "default";
+       clocks = <&xtal>;
+       clock-names = "clkin0";
+       status = "okay";
+};
+
+&pwm_AO_cd {
+       pinctrl-0 = <&pwm_ao_d_e_pins>;
+       pinctrl-names = "default";
+       clocks = <&xtal>;
+       clock-names = "clkin1";
+       status = "okay";
+};
+
+/* SD card */
+&sd_emmc_b {
+       status = "okay";
+       pinctrl-0 = <&sdcard_c_pins>;
+       pinctrl-1 = <&sdcard_clk_gate_c_pins>;
+       pinctrl-names = "default", "clk-gate";
+
+       bus-width = <4>;
+       cap-sd-highspeed;
+       max-frequency = <50000000>;
+       disable-wp;
+
+       cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
+       vmmc-supply = <&tflash_vdd>;
+       vqmmc-supply = <&tf_io>;
+
+};
+
+/* eMMC */
+&sd_emmc_c {
+       status = "okay";
+       pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
+       pinctrl-1 = <&emmc_clk_gate_pins>;
+       pinctrl-names = "default", "clk-gate";
+
+       bus-width = <8>;
+       cap-mmc-highspeed;
+       mmc-ddr-1_8v;
+       mmc-hs200-1_8v;
+       max-frequency = <200000000>;
+       disable-wp;
+
+       mmc-pwrseq = <&emmc_pwrseq>;
+       vmmc-supply = <&vcc_3v3>;
+       vqmmc-supply = <&flash_1v8>;
+};
+
+/*
+ * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR pins
+ * and eMMC Data 4 to 7 pins.
+ * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0,
+ * and change bus-width to 4 then spifc can be enabled.
+ * The SW1 slide should also be set to the correct position.
+ */
+&spifc {
+       status = "disabled";
+       pinctrl-0 = <&nor_pins>;
+       pinctrl-names = "default";
+
+       mx25u64: spi-flash@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "mxicy,mx25u6435f", "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <104000000>;
+       };
+};
+
+&tdmif_b {
+       status = "okay";
+};
+
+&tdmif_c {
+       status = "okay";
+};
+
+&tdmin_a {
+       status = "okay";
+};
+
+&tdmin_b {
+       status = "okay";
+};
+
+&tdmin_c {
+       status = "okay";
+};
+
+&tdmin_lb {
+       status = "okay";
+};
+
+&tdmout_b {
+       status = "okay";
+};
+
+&tdmout_c {
+       status = "okay";
+};
+
+&toacodec {
+       status = "okay";
+};
+
+&tohdmitx {
+       status = "okay";
+};
+
+&toddr_a {
+       status = "okay";
+};
+
+&toddr_b {
+       status = "okay";
+};
+
+&toddr_c {
+       status = "okay";
+};
+
+&uart_AO {
+       status = "okay";
+       pinctrl-0 = <&uart_ao_a_pins>;
+       pinctrl-names = "default";
+};
+
+&usb {
+       status = "okay";
+       vbus-supply = <&usb_pwr_en>;
+};
+
+&usb2_phy0 {
+       phy-supply = <&vcc_5v>;
+};
+
+&usb2_phy1 {
+       /* Enable the hub which is connected to this port */
+       phy-supply = <&hub_5v>;
+};
index 0edd137..726b91d 100644 (file)
@@ -13,6 +13,7 @@
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/power/meson-gxbb-power.h>
+#include <dt-bindings/reset/amlogic,meson-gxbb-reset.h>
 #include <dt-bindings/thermal/thermal.h>
 
 / {
                        interrupt-names = "macirq";
                        rx-fifo-depth = <4096>;
                        tx-fifo-depth = <2048>;
+                       resets = <&reset RESET_ETHERNET>;
+                       reset-names = "stmmaceth";
                        power-domains = <&pwrc PWRC_GXBB_ETHERNET_MEM_ID>;
                        status = "disabled";
                };
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc-v2.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc-v2.dts
new file mode 100644 (file)
index 0000000..675eaa8
--- /dev/null
@@ -0,0 +1,318 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 BayLibre, SAS.
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/sound/meson-aiu.h>
+
+#include "meson-gxl-s905x.dtsi"
+
+/ {
+       compatible = "libretech,aml-s905x-cc-v2", "amlogic,s905x",
+                    "amlogic,meson-gxl";
+       model = "Libre Computer AML-S905X-CC V2";
+
+       aliases {
+               serial0 = &uart_AO;
+               ethernet0 = &ethmac;
+               spi0 = &spifc;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       emmc_pwrseq: emmc-pwrseq {
+               compatible = "mmc-pwrseq-emmc";
+               reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
+       };
+
+       hdmi-connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi_tx_tmds_out>;
+                       };
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led-blue {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_STATUS;
+                       gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+                       panic-indicator;
+               };
+
+               led-green {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_DISK_ACTIVITY;
+                       gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "disk-activity";
+               };
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x0 0x0 0x80000000>;
+       };
+
+       ao_5v: regulator-ao_5v {
+               compatible = "regulator-fixed";
+               regulator-name = "AO_5V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&dc_in>;
+               regulator-always-on;
+       };
+
+       dc_in: regulator-dc_in {
+               compatible = "regulator-fixed";
+               regulator-name = "DC_IN";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+
+       vcck: regulator-vcck {
+               compatible = "regulator-fixed";
+               regulator-name = "VCCK";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&ao_5v>;
+               regulator-always-on;
+       };
+
+       vcc_card: regulator-vcc_card {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_CARD";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vddio_ao3v3>;
+
+               gpio = <&gpio GPIOCLK_1 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       vcc5v: regulator-vcc5v {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC5V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&ao_5v>;
+
+               gpio = <&gpio GPIOH_3 GPIO_OPEN_DRAIN>;
+       };
+
+       vddio_ao3v3: regulator-vddio_ao3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDIO_AO3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&ao_5v>;
+               regulator-always-on;
+       };
+
+
+       vddio_card: regulator-vddio-card {
+               compatible = "regulator-gpio";
+               regulator-name = "VDDIO_CARD";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
+               gpios-states = <0>;
+
+               states = <3300000 0>,
+                        <1800000 1>;
+
+               regulator-settling-time-up-us = <200>;
+               regulator-settling-time-down-us = <50000>;
+       };
+
+       vddio_ao18: regulator-vddio_ao18 {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDIO_AO18";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vddio_ao3v3>;
+               regulator-always-on;
+       };
+
+       vcc_1v8: regulator-vcc_1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC 1V8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vddio_ao3v3>;
+               regulator-always-on;
+       };
+
+       sound {
+               compatible = "amlogic,gx-sound-card";
+               model = "GXL-LIBRETECH-S905X-CC-V2";
+               assigned-clocks = <&clkc CLKID_MPLL0>,
+                                 <&clkc CLKID_MPLL1>,
+                                 <&clkc CLKID_MPLL2>;
+               assigned-clock-parents = <0>, <0>, <0>;
+               assigned-clock-rates = <294912000>,
+                                      <270950400>,
+                                      <393216000>;
+               status = "okay";
+
+               dai-link-0 {
+                       sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
+               };
+
+               dai-link-1 {
+                       sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
+                       dai-format = "i2s";
+                       mclk-fs = <256>;
+
+                       codec-0 {
+                               sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
+                       };
+               };
+
+               dai-link-2 {
+                       sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
+
+                       codec-0 {
+                               sound-dai = <&hdmi_tx>;
+                       };
+               };
+       };
+};
+
+
+&aiu {
+       status = "okay";
+};
+
+&cec_AO {
+       status = "okay";
+       pinctrl-0 = <&ao_cec_pins>;
+       pinctrl-names = "default";
+       hdmi-phandle = <&hdmi_tx>;
+};
+
+
+&ethmac {
+       status = "okay";
+};
+
+&internal_phy {
+       pinctrl-0 = <&eth_link_led_pins>, <&eth_act_led_pins>;
+       pinctrl-names = "default";
+};
+
+&ir {
+       status = "okay";
+       pinctrl-0 = <&remote_input_ao_pins>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       hdmi-supply = <&vcc5v>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
+};
+
+&saradc {
+       status = "okay";
+       vref-supply = <&vddio_ao18>;
+};
+
+/* SD card */
+&sd_emmc_b {
+       pinctrl-0 = <&sdcard_pins>;
+       pinctrl-1 = <&sdcard_clk_gate_pins>;
+       pinctrl-names = "default", "clk-gate";
+
+       bus-width = <4>;
+       cap-sd-highspeed;
+       sd-uhs-sdr12;
+       sd-uhs-sdr25;
+       sd-uhs-sdr50;
+       sd-uhs-ddr50;
+       max-frequency = <100000000>;
+       disable-wp;
+
+       cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
+
+       vmmc-supply = <&vcc_card>;
+       vqmmc-supply = <&vddio_card>;
+
+       status = "okay";
+};
+
+/* eMMC */
+&sd_emmc_c {
+       pinctrl-0 = <&emmc_pins>;
+       pinctrl-1 = <&emmc_clk_gate_pins>;
+       pinctrl-names = "default", "clk-gate";
+
+       bus-width = <8>;
+       cap-mmc-highspeed;
+       mmc-hs200-1_8v;
+       max-frequency = <200000000>;
+       disable-wp;
+
+       mmc-pwrseq = <&emmc_pwrseq>;
+       vmmc-supply = <&vddio_ao3v3>;
+       vqmmc-supply = <&vcc_1v8>;
+
+       status = "okay";
+};
+
+&spifc {
+       status = "okay";
+       pinctrl-0 = <&nor_pins>;
+       pinctrl-names = "default";
+
+       nor_4u1: spi-flash@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <3000000>;
+       };
+};
+
+&uart_AO {
+       status = "okay";
+       pinctrl-0 = <&uart_ao_a_pins>;
+       pinctrl-names = "default";
+};
+
+&usb {
+       status = "okay";
+       dr_mode = "host";
+};
+
+&usb2_phy0 {
+       pinctrl-names = "default";
+       phy-supply = <&vcc5v>;
+};
+
+&usb2_phy1 {
+       phy-supply = <&vcc5v>;
+};
index 94f75b4..7b46555 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
 
 / {
        aliases {
 
                led-white {
                        label = "vim3:white:sys";
-                       gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>;
+                       gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
                };
 
                led-red {
                        label = "vim3:red";
-                       gpios = <&gpio_expander 5 GPIO_ACTIVE_LOW>;
+                       gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>;
                };
        };
 
                };
        };
 
+
+       sound {
+               compatible = "amlogic,axg-sound-card";
+               model = "G12B-KHADAS-VIM3";
+               audio-aux-devs = <&tdmout_a>;
+               audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
+                               "TDMOUT_A IN 1", "FRDDR_B OUT 0",
+                               "TDMOUT_A IN 2", "FRDDR_C OUT 0",
+                               "TDM_A Playback", "TDMOUT_A OUT";
+
+               assigned-clocks = <&clkc CLKID_MPLL2>,
+                                 <&clkc CLKID_MPLL0>,
+                                 <&clkc CLKID_MPLL1>;
+               assigned-clock-parents = <0>, <0>, <0>;
+               assigned-clock-rates = <294912000>,
+                                      <270950400>,
+                                      <393216000>;
+               status = "okay";
+
+               dai-link-0 {
+                       sound-dai = <&frddr_a>;
+               };
+
+               dai-link-1 {
+                       sound-dai = <&frddr_b>;
+               };
+
+               dai-link-2 {
+                       sound-dai = <&frddr_c>;
+               };
+
+               /* 8ch hdmi interface */
+               dai-link-3 {
+                       sound-dai = <&tdmif_a>;
+                       dai-format = "i2s";
+                       dai-tdm-slot-tx-mask-0 = <1 1>;
+                       dai-tdm-slot-tx-mask-1 = <1 1>;
+                       dai-tdm-slot-tx-mask-2 = <1 1>;
+                       dai-tdm-slot-tx-mask-3 = <1 1>;
+                       mclk-fs = <256>;
+
+                       codec {
+                               sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
+                       };
+               };
+
+               /* hdmi glue */
+               dai-link-4 {
+                       sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
+
+                       codec {
+                               sound-dai = <&hdmi_tx>;
+                       };
+               };
+       };
+
        wifi32k: wifi32k {
                compatible = "pwm-clock";
                #clock-cells = <0>;
        };
 };
 
+&arb {
+       status = "okay";
+};
+
+&clkc_audio {
+       status = "okay";
+};
+
 &cec_AO {
        pinctrl-0 = <&cec_ao_a_h_pins>;
        pinctrl-names = "default";
         amlogic,tx-delay-ns = <2>;
 };
 
+&frddr_a {
+       status = "okay";
+};
+
+&frddr_b {
+       status = "okay";
+};
+
+&frddr_c {
+       status = "okay";
+};
+
 &hdmi_tx {
        status = "okay";
        pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
        };
 };
 
+
+&tdmif_a {
+       status = "okay";
+};
+
+&tdmout_a {
+       status = "okay";
+};
+
+&tohdmitx {
+       status = "okay";
+};
+
 &uart_A {
        status = "okay";
        pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
index 0da56c0..4b517ca 100644 (file)
                regulator-boot-on;
                regulator-always-on;
        };
-
-       sound {
-               compatible = "amlogic,axg-sound-card";
-               model = "SM1-KHADAS-VIM3L";
-               audio-aux-devs = <&tdmout_a>;
-               audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
-                               "TDMOUT_A IN 1", "FRDDR_B OUT 0",
-                               "TDMOUT_A IN 2", "FRDDR_C OUT 0",
-                               "TDM_A Playback", "TDMOUT_A OUT";
-
-               assigned-clocks = <&clkc CLKID_MPLL2>,
-                                 <&clkc CLKID_MPLL0>,
-                                 <&clkc CLKID_MPLL1>;
-               assigned-clock-parents = <0>, <0>, <0>;
-               assigned-clock-rates = <294912000>,
-                                      <270950400>,
-                                      <393216000>;
-               status = "okay";
-
-               dai-link-0 {
-                       sound-dai = <&frddr_a>;
-               };
-
-               dai-link-1 {
-                       sound-dai = <&frddr_b>;
-               };
-
-               dai-link-2 {
-                       sound-dai = <&frddr_c>;
-               };
-
-               /* 8ch hdmi interface */
-               dai-link-3 {
-                       sound-dai = <&tdmif_a>;
-                       dai-format = "i2s";
-                       dai-tdm-slot-tx-mask-0 = <1 1>;
-                       dai-tdm-slot-tx-mask-1 = <1 1>;
-                       dai-tdm-slot-tx-mask-2 = <1 1>;
-                       dai-tdm-slot-tx-mask-3 = <1 1>;
-                       mclk-fs = <256>;
-
-                       codec {
-                               sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
-                       };
-               };
-
-               /* hdmi glue */
-               dai-link-4 {
-                       sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
-
-                       codec {
-                               sound-dai = <&hdmi_tx>;
-                       };
-               };
-       };
-};
-
-&arb {
-       status = "okay";
-};
-
-&clkc_audio {
-       status = "okay";
 };
 
 &cpu0 {
        clock-latency = <50000>;
 };
 
-&frddr_a {
-       status = "okay";
-};
-
-&frddr_b {
-       status = "okay";
-};
-
-&frddr_c {
-       status = "okay";
-};
-
 &pwm_AO_cd {
        pinctrl-0 = <&pwm_ao_d_e_pins>;
        pinctrl-names = "default";
 };
  */
 
-&tdmif_a {
-       status = "okay";
-};
-
-&tdmout_a {
-       status = "okay";
-};
-
-&tohdmitx {
-       status = "okay";
-};
index 3feb188..a83c82c 100644 (file)
                dwgpio: gpio@1c024000 {
                        compatible = "snps,dw-apb-gpio";
                        reg = <0x0 0x1c024000 0x0 0x1000>;
-                       reg-io-width = <4>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                        porta: gpio-controller@0 {
                                compatible = "snps,dw-apb-gpio-port";
                                gpio-controller;
+                               #gpio-cells = <2>;
                                snps,nr-gpios = <32>;
                                reg = <0>;
                        };
index 8c802d8..0f37e77 100644 (file)
                dwgpio: gpio@1c024000 {
                        compatible = "snps,dw-apb-gpio";
                        reg = <0x0 0x1c024000 0x0 0x1000>;
-                       reg-io-width = <4>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                        porta: gpio-controller@0 {
                                compatible = "snps,dw-apb-gpio-port";
                                gpio-controller;
+                               #gpio-cells = <2>;
                                snps,nr-gpios = <32>;
                                reg = <0>;
                        };
index eeee51f..40d95c5 100644 (file)
                                        reg = <0x0f0000 0x10000>;
                                        interrupts = <7>;
                                        clocks = <&mb_clk24mhz>, <&soc_smc50mhz>;
-                                       clock-names = "wdogclk", "apb_pclk";
+                                       clock-names = "wdog_clk", "apb_pclk";
                                };
 
                                v2m_timer01: timer@110000 {
index 001a0a3..4c4a381 100644 (file)
                                        reg = <0x0f0000 0x1000>;
                                        interrupts = <0>;
                                        clocks = <&v2m_refclk32khz>, <&v2m_clk24mhz>;
-                                       clock-names = "wdogclk", "apb_pclk";
+                                       clock-names = "wdog_clk", "apb_pclk";
                                };
 
                                v2m_timer01: timer@110000 {
index 3980206..2cfeaf3 100644 (file)
                        reg = <0x66090000 0x1000>;
                        interrupts = <GIC_SPI 406 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&iprocslow>, <&iprocslow>;
-                       clock-names = "wdogclk", "apb_pclk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                gpio_g: gpio@660a0000 {
index a9b92e5..43aa5e9 100644 (file)
 };
 
 &nand {
-       status = "ok";
+       status = "okay";
        nandcs@0 {
                compatible = "brcm,nandcs";
                reg = <0>;
index 0098dfd..b425b12 100644 (file)
                        reg = <0x000c0000 0x1000>;
                        interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&hsls_25m_div2_clk>, <&hsls_div4_clk>;
-                       clock-names = "wdogclk", "apb_pclk";
+                       clock-names = "wdog_clk", "apb_pclk";
                        timeout-sec = <60>;
                };
 
index 24aab3e..829fea2 100644 (file)
@@ -87,8 +87,8 @@
 
        i2c_max98504: i2c-gpio-0 {
                compatible = "i2c-gpio";
-               gpios = <&gpd0 1 GPIO_ACTIVE_HIGH /* SPK_AMP_SDA */
-                        &gpd0 0 GPIO_ACTIVE_HIGH /* SPK_AMP_SCL */ >;
+               sda-gpios = <&gpd0 1 GPIO_ACTIVE_HIGH>;
+               scl-gpios = <&gpd0 0 GPIO_ACTIVE_HIGH>;
                i2c-gpio,delay-us = <2>;
                #address-cells = <1>;
                #size-cells = <0>;
index 74ac4ac..8eb4576 100644 (file)
                };
 
                syscon_disp: syscon@13b80000 {
-                       compatible = "syscon";
+                       compatible = "samsung,exynos5433-sysreg", "syscon";
                        reg = <0x13b80000 0x1010>;
                };
 
                syscon_cam0: syscon@120f0000 {
-                       compatible = "syscon";
+                       compatible = "samsung,exynos5433-sysreg", "syscon";
                        reg = <0x120f0000 0x1020>;
                };
 
                syscon_cam1: syscon@145f0000 {
-                       compatible = "syscon";
+                       compatible = "samsung,exynos5433-sysreg", "syscon";
                        reg = <0x145f0000 0x1038>;
                };
 
                        operating-points-v2 = <&gpu_opp_table>;
                        status = "disabled";
 
-                       gpu_opp_table: opp_table {
+                       gpu_opp_table: opp-table {
                                compatible = "operating-points-v2";
 
                                opp-160000000 {
                                 <&cmu_peric CLK_SCLK_I2S1>;
                        clock-names = "iis", "i2s_opclk0", "i2s_opclk1";
                        #clock-cells = <1>;
-                       samsung,supports-6ch;
-                       samsung,supports-rstclr;
-                       samsung,supports-tdm;
-                       samsung,supports-low-rfs;
                        #sound-dai-cells = <1>;
                        status = "disabled";
                };
index 903c0eb..f8d5943 100644 (file)
@@ -30,12 +30,17 @@ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-rdb.dtb
 
 dtb-$(CONFIG_ARCH_MXC) += imx8mm-beacon-kit.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mm-evk.dtb
+dtb-$(CONFIG_ARCH_MXC) += imx8mm-ddr4-evk.dtb
+dtb-$(CONFIG_ARCH_MXC) += imx8mm-var-som-symphony.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mn-evk.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mn-ddr4-evk.dtb
+dtb-$(CONFIG_ARCH_MXC) += imx8mn-var-som-symphony.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mp-evk.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mq-evk.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mq-hummingboard-pulse.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mq-librem5-devkit.dtb
+dtb-$(CONFIG_ARCH_MXC) += imx8mq-librem5-r2.dtb
+dtb-$(CONFIG_ARCH_MXC) += imx8mq-librem5-r3.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mq-nitrogen.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mq-phanbell.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mq-pico-pi.dtb
index 9927b09..242f4b0 100644 (file)
@@ -87,7 +87,7 @@
        status = "okay";
 };
 
-&pcie {
+&pcie1 {
        status = "okay";
 };
 
index ff19ec4..6a2c091 100644 (file)
@@ -1,8 +1,9 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * Device Tree Include file for Freescale Layerscape-1012A family SoC.
+ * Device Tree Include file for NXP Layerscape-1012A family SoC.
  *
  * Copyright 2016 Freescale Semiconductor, Inc.
+ * Copyright 2019-2020 NXP
  *
  */
 
                        interrupts = <0 126 IRQ_TYPE_LEVEL_HIGH>;
                };
 
-               pcie: pcie@3400000 {
+               pcie1: pcie@3400000 {
                        compatible = "fsl,ls1012a-pcie";
                        reg = <0x00 0x03400000 0x0 0x00100000   /* controller registers */
                               0x40 0x00000000 0x0 0x00002000>; /* configuration space */
index 4b4cc6a..d66d8b2 100644 (file)
 
 /dts-v1/;
 #include "fsl-ls1028a-kontron-sl28-var4.dts"
+#include <dt-bindings/leds/common.h>
 
 / {
        model = "Kontron KBox A-230-LS";
        compatible = "kontron,kbox-a-230-ls", "kontron,sl28-var4",
                     "kontron,sl28", "fsl,ls1028a";
+
+       leds {
+               compatible = "gpio-leds";
+
+               alarm-led {
+                       function = LED_FUNCTION_ALARM;
+                       color = <LED_COLOR_ID_YELLOW>;
+                       gpios = <&sl28cpld_gpio0 0 GPIO_ACTIVE_HIGH>;
+               };
+
+               power-led {
+                       linux,default-trigger = "default-on";
+                       function = LED_FUNCTION_POWER;
+                       color = <LED_COLOR_ID_GREEN>;
+                       gpios = <&sl28cpld_gpio1 3 GPIO_ACTIVE_HIGH>;
+               };
+       };
 };
 
 &enetc_mdio_pf3 {
index 0973a6a..c45d7b4 100644 (file)
        compatible = "kontron,sl28-var3-ads2", "kontron,sl28-var3",
                     "kontron,sl28", "fsl,ls1028a";
 
+       pwm-fan {
+               compatible = "pwm-fan";
+               cooling-min-state = <0>;
+               cooling-max-state = <3>;
+               #cooling-cells = <2>;
+               pwms = <&sl28cpld_pwm0 0 4000000>;
+               cooling-levels = <1 128 192 255>;
+       };
+
        sound {
                #address-cells = <1>;
                #size-cells = <0>;
index 852dad8..8161dd2 100644 (file)
@@ -8,6 +8,9 @@
 
 /dts-v1/;
 #include "fsl-ls1028a.dtsi"
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 
 / {
        model = "Kontron SMARC-sAL28";
                spi1 = &dspi2;
        };
 
+       buttons0 {
+               compatible = "gpio-keys";
+
+               power-button {
+                       interrupts-extended = <&sl28cpld_intc
+                                              4 IRQ_TYPE_EDGE_BOTH>;
+                       linux,code = <KEY_POWER>;
+                       label = "Power";
+               };
+
+               sleep-button {
+                       interrupts-extended = <&sl28cpld_intc
+                                              5 IRQ_TYPE_EDGE_BOTH>;
+                       linux,code = <KEY_SLEEP>;
+                       label = "Sleep";
+               };
+       };
+
+       buttons1 {
+               compatible = "gpio-keys-polled";
+               poll-interval = <200>;
+
+               lid-switch {
+                       linux,input-type = <EV_SW>;
+                       linux,code = <SW_LID>;
+                       gpios = <&sl28cpld_gpio3 4 GPIO_ACTIVE_LOW>;
+                       label = "Lid";
+               };
+       };
+
        chosen {
                stdout-path = "serial0:115200n8";
        };
@@ -42,6 +75,7 @@
 &enetc_port0 {
        phy-handle = <&phy0>;
        phy-connection-type = "sgmii";
+       managed = "in-band-status";
        status = "okay";
 
        mdio {
                reg = <0x32>;
        };
 
+       sl28cpld@4a {
+               compatible = "kontron,sl28cpld";
+               reg = <0x4a>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               watchdog@4 {
+                       compatible = "kontron,sl28cpld-wdt";
+                       reg = <0x4>;
+                       kontron,assert-wdt-timeout-pin;
+               };
+
+               hwmon@b {
+                       compatible = "kontron,sl28cpld-fan";
+                       reg = <0xb>;
+               };
+
+               sl28cpld_pwm0: pwm@c {
+                       compatible = "kontron,sl28cpld-pwm";
+                       reg = <0xc>;
+                       #pwm-cells = <2>;
+               };
+
+               sl28cpld_pwm1: pwm@e {
+                       compatible = "kontron,sl28cpld-pwm";
+                       reg = <0xe>;
+                       #pwm-cells = <2>;
+               };
+
+               sl28cpld_gpio0: gpio@10 {
+                       compatible = "kontron,sl28cpld-gpio";
+                       reg = <0x10>;
+                       interrupts-extended = <&gpio2 6
+                                              IRQ_TYPE_EDGE_FALLING>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-line-names =
+                               "GPIO0_CAM0_PWR_N", "GPIO1_CAM1_PWR_N",
+                               "GPIO2_CAM0_RST_N", "GPIO3_CAM1_RST_N",
+                               "GPIO4_HDA_RST_N", "GPIO5_PWM_OUT",
+                               "GPIO6_TACHIN", "GPIO7";
+
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+               };
+
+               sl28cpld_gpio1: gpio@15 {
+                       compatible = "kontron,sl28cpld-gpio";
+                       reg = <0x15>;
+                       interrupts-extended = <&gpio2 6
+                                              IRQ_TYPE_EDGE_FALLING>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-line-names =
+                               "GPIO8", "GPIO9", "GPIO10", "GPIO11",
+                               "", "", "", "";
+
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+               };
+
+               sl28cpld_gpio2: gpio@1a {
+                       compatible = "kontron,sl28cpld-gpo";
+                       reg = <0x1a>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-line-names =
+                               "LCD0 voltage enable",
+                               "LCD0 backlight enable",
+                               "eMMC reset", "LVDS bridge reset",
+                               "LVDS bridge power-down",
+                               "SDIO power enable",
+                               "", "";
+               };
+
+               sl28cpld_gpio3: gpio@1b {
+                       compatible = "kontron,sl28cpld-gpi";
+                       reg = <0x1b>;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-line-names =
+                               "Power button", "Force recovery", "Sleep",
+                               "Battery low", "Lid state", "Charging",
+                               "Charger present", "";
+               };
+
+               sl28cpld_intc: interrupt-controller@1c {
+                       compatible = "kontron,sl28cpld-intc";
+                       reg = <0x1c>;
+                       interrupts-extended = <&gpio2 6
+                                              IRQ_TYPE_EDGE_FALLING>;
+
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+               };
+       };
+
        eeprom@50 {
                compatible = "atmel,24c32";
                reg = <0x50>;
index e4f00c2..13cdc95 100644 (file)
        status = "okay";
 };
 
+&lpuart0 {
+       status = "okay";
+};
+
 &sai1 {
        status = "okay";
 };
index 0efeb8f..73e4f94 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Device Tree Include file for NXP Layerscape-1028A family SoC.
  *
- * Copyright 2018 NXP
+ * Copyright 2018-2020 NXP
  *
  * Harninder Rai <harninder.rai@nxp.com>
  *
                        status = "disabled";
                };
 
-               pcie@3400000 {
+               pcie1: pcie@3400000 {
                        compatible = "fsl,ls1028a-pcie";
                        reg = <0x00 0x03400000 0x0 0x00100000   /* controller registers */
                               0x80 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie@3500000 {
+               pcie2: pcie@3500000 {
                        compatible = "fsl,ls1028a-pcie";
                        reg = <0x00 0x03500000 0x0 0x00100000   /* controller registers */
                               0x88 0x00000000 0x0 0x00002000>; /* configuration space */
                        compatible = "arm,sp805", "arm,primecell";
                        reg = <0x0 0xc000000 0x0 0x1000>;
                        clocks = <&clockgen 4 15>, <&clockgen 4 15>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster1_core1_watchdog: watchdog@c010000 {
                        compatible = "arm,sp805", "arm,primecell";
                        reg = <0x0 0xc010000 0x0 0x1000>;
                        clocks = <&clockgen 4 15>, <&clockgen 4 15>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                sai1: audio-controller@f100000 {
index 5c2e370..0464b8a 100644 (file)
@@ -1,9 +1,9 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * Device Tree Include file for Freescale Layerscape-1043A family SoC.
+ * Device Tree Include file for NXP Layerscape-1043A family SoC.
  *
  * Copyright 2014-2015 Freescale Semiconductor, Inc.
- * Copyright 2018 NXP
+ * Copyright 2018, 2020 NXP
  *
  * Mingkai Hu <Mingkai.hu@freescale.com>
  */
                        interrupts = <0 160 0x4>;
                };
 
-               pcie@3400000 {
+               pcie1: pcie@3400000 {
                        compatible = "fsl,ls1043a-pcie";
                        reg = <0x00 0x03400000 0x0 0x00100000   /* controller registers */
                               0x40 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie@3500000 {
+               pcie2: pcie@3500000 {
                        compatible = "fsl,ls1043a-pcie";
                        reg = <0x00 0x03500000 0x0 0x00100000   /* controller registers */
                               0x48 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie@3600000 {
+               pcie3: pcie@3600000 {
                        compatible = "fsl,ls1043a-pcie";
                        reg = <0x00 0x03600000 0x0 0x00100000   /* controller registers */
                               0x50 0x00000000 0x0 0x00002000>; /* configuration space */
index 0246d97..1fa39ba 100644 (file)
@@ -1,9 +1,9 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * Device Tree Include file for Freescale Layerscape-1046A family SoC.
+ * Device Tree Include file for NXP Layerscape-1046A family SoC.
  *
  * Copyright 2016 Freescale Semiconductor, Inc.
- * Copyright 2018 NXP
+ * Copyright 2018, 2020 NXP
  *
  * Mingkai Hu <mingkai.hu@nxp.com>
  */
                                     <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>;
                };
 
-               pcie@3400000 {
+               pcie1: pcie@3400000 {
                        compatible = "fsl,ls1046a-pcie";
                        reg = <0x00 0x03400000 0x0 0x00100000   /* controller registers */
                               0x40 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie_ep@3400000 {
+               pcie_ep1: pcie_ep@3400000 {
                        compatible = "fsl,ls1046a-pcie-ep","fsl,ls-pcie-ep";
                        reg = <0x00 0x03400000 0x0 0x00100000
                                0x40 0x00000000 0x8 0x00000000>;
                        status = "disabled";
                };
 
-               pcie@3500000 {
+               pcie2: pcie@3500000 {
                        compatible = "fsl,ls1046a-pcie";
                        reg = <0x00 0x03500000 0x0 0x00100000   /* controller registers */
                               0x48 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie_ep@3500000 {
+               pcie_ep2: pcie_ep@3500000 {
                        compatible = "fsl,ls1046a-pcie-ep","fsl,ls-pcie-ep";
                        reg = <0x00 0x03500000 0x0 0x00100000
                                0x48 0x00000000 0x8 0x00000000>;
                        status = "disabled";
                };
 
-               pcie@3600000 {
+               pcie3: pcie@3600000 {
                        compatible = "fsl,ls1046a-pcie";
                        reg = <0x00 0x03600000 0x0 0x00100000   /* controller registers */
                               0x50 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie_ep@3600000 {
+               pcie_ep3: pcie_ep@3600000 {
                        compatible = "fsl,ls1046a-pcie-ep", "fsl,ls-pcie-ep";
                        reg = <0x00 0x03600000 0x0 0x00100000
                                0x50 0x00000000 0x8 0x00000000>;
index 169f474..ff58052 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Device Tree Include file for NXP Layerscape-1088A family SoC.
  *
- * Copyright 2017 NXP
+ * Copyright 2017-2020 NXP
  *
  * Harninder Rai <harninder.rai@nxp.com>
  *
        };
 
        thermal-zones {
-               cpu_thermal: cpu-thermal {
+               core-cluster {
                        polling-delay-passive = <1000>;
                        polling-delay = <5000>;
                        thermal-sensors = <&tmu 0>;
 
                        trips {
-                               cpu_alert: cpu-alert {
+                               core_cluster_alert: core-cluster-alert {
                                        temperature = <85000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit: cpu-crit {
+                               core-cluster-crit {
                                        temperature = <95000>;
                                        hysteresis = <2000>;
                                        type = "critical";
 
                        cooling-maps {
                                map0 {
-                                       trip = <&cpu_alert>;
+                                       trip = <&core_cluster_alert>;
                                        cooling-device =
                                                <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
                                                <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
                                };
                        };
                };
+
+               soc {
+                       polling-delay-passive = <1000>;
+                       polling-delay = <5000>;
+                       thermal-sensors = <&tmu 1>;
+
+                       trips {
+                               soc-crit {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+               };
        };
 
        timer {
                        compatible = "fsl,qoriq-tmu";
                        reg = <0x0 0x1f80000 0x0 0x10000>;
                        interrupts = <0 23 0x4>;
-                       fsl,tmu-range = <0xb0000 0x9002a 0x6004c 0x30062>;
+                       fsl,tmu-range = <0xb0000 0x9002a 0x6004c 0x70062>;
                        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
+                               <0x00000000 0x00000023
+                               0x00000001 0x0000002a
+                               0x00000002 0x00000030
+                               0x00000003 0x00000037
+                               0x00000004 0x0000003d
+                               0x00000005 0x00000044
+                               0x00000006 0x0000004a
+                               0x00000007 0x00000051
+                               0x00000008 0x00000057
+                               0x00000009 0x0000005e
+                               0x0000000a 0x00000064
+                               0x0000000b 0x0000006b
                                /* Calibration data group 2 */
-                               0x00010000 0x00000025
-                               0x00010001 0x0000002c
-                               0x00010002 0x00000035
-                               0x00010003 0x0000003d
-                               0x00010004 0x00000045
-                               0x00010005 0x0000004e
-                               0x00010006 0x00000057
-                               0x00010007 0x00000061
-                               0x00010008 0x0000006b
-                               0x00010009 0x00000076
+                               0x00010000 0x00000022
+                               0x00010001 0x0000002a
+                               0x00010002 0x00000032
+                               0x00010003 0x0000003a
+                               0x00010004 0x00000042
+                               0x00010005 0x0000004a
+                               0x00010006 0x00000052
+                               0x00010007 0x0000005a
+                               0x00010008 0x00000062
+                               0x00010009 0x0000006a
                                /* Calibration data group 3 */
-                               0x00020000 0x00000029
-                               0x00020001 0x00000033
-                               0x00020002 0x0000003d
-                               0x00020003 0x00000049
-                               0x00020004 0x00000056
-                               0x00020005 0x00000061
-                               0x00020006 0x0000006d
+                               0x00020000 0x00000021
+                               0x00020001 0x0000002b
+                               0x00020002 0x00000035
+                               0x00020003 0x00000040
+                               0x00020004 0x0000004a
+                               0x00020005 0x00000054
+                               0x00020006 0x0000005e
                                /* Calibration data group 4 */
-                               0x00030000 0x00000021
-                               0x00030001 0x0000002a
-                               0x00030002 0x0000003c
-                               0x00030003 0x0000004e>;
+                               0x00030000 0x00000010
+                               0x00030001 0x0000001c
+                               0x00030002 0x00000027
+                               0x00030003 0x00000032
+                               0x00030004 0x0000003e
+                               0x00030005 0x00000049
+                               0x00030006 0x00000054
+                               0x00030007 0x00000060>;
                        little-endian;
                        #thermal-sensor-cells = <1>;
                };
                        };
                };
 
-               pcie@3400000 {
+               pcie1: pcie@3400000 {
                        compatible = "fsl,ls1088a-pcie";
                        reg = <0x00 0x03400000 0x0 0x00100000   /* controller registers */
                               0x20 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie@3500000 {
+               pcie2: pcie@3500000 {
                        compatible = "fsl,ls1088a-pcie";
                        reg = <0x00 0x03500000 0x0 0x00100000   /* controller registers */
                               0x28 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie@3600000 {
+               pcie3: pcie@3600000 {
                        compatible = "fsl,ls1088a-pcie";
                        reg = <0x00 0x03600000 0x0 0x00100000   /* controller registers */
                               0x30 0x00000000 0x0 0x00002000>; /* configuration space */
                cluster1_core0_watchdog: wdt@c000000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc000000 0x0 0x1000>;
-                       clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clocks = <&clockgen 4 15>, <&clockgen 4 15>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster1_core1_watchdog: wdt@c010000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc010000 0x0 0x1000>;
-                       clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clocks = <&clockgen 4 15>, <&clockgen 4 15>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster1_core2_watchdog: wdt@c020000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc020000 0x0 0x1000>;
-                       clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clocks = <&clockgen 4 15>, <&clockgen 4 15>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster1_core3_watchdog: wdt@c030000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc030000 0x0 0x1000>;
-                       clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clocks = <&clockgen 4 15>, <&clockgen 4 15>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster2_core0_watchdog: wdt@c100000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc100000 0x0 0x1000>;
-                       clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clocks = <&clockgen 4 15>, <&clockgen 4 15>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster2_core1_watchdog: wdt@c110000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc110000 0x0 0x1000>;
-                       clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clocks = <&clockgen 4 15>, <&clockgen 4 15>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster2_core2_watchdog: wdt@c120000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc120000 0x0 0x1000>;
-                       clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clocks = <&clockgen 4 15>, <&clockgen 4 15>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster2_core3_watchdog: wdt@c130000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc130000 0x0 0x1000>;
-                       clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clocks = <&clockgen 4 15>, <&clockgen 4 15>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                fsl_mc: fsl-mc@80c000000 {
index 41102da..bf72918 100644 (file)
        };
 
        thermal-zones {
-               cpu_thermal: cpu-thermal {
+               ddr-controller1 {
                        polling-delay-passive = <1000>;
                        polling-delay = <5000>;
+                       thermal-sensors = <&tmu 1>;
 
+                       trips {
+                               ddr-ctrler1-crit {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+               };
+
+               ddr-controller2 {
+                       polling-delay-passive = <1000>;
+                       polling-delay = <5000>;
+                       thermal-sensors = <&tmu 2>;
+
+                       trips {
+                               ddr-ctrler2-crit {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+               };
+
+               ddr-controller3 {
+                       polling-delay-passive = <1000>;
+                       polling-delay = <5000>;
+                       thermal-sensors = <&tmu 3>;
+
+                       trips {
+                               ddr-ctrler3-crit {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+               };
+
+               core-cluster1 {
+                       polling-delay-passive = <1000>;
+                       polling-delay = <5000>;
                        thermal-sensors = <&tmu 4>;
 
                        trips {
-                               cpu_alert: cpu-alert {
-                                       temperature = <75000>;
+                               core_cluster1_alert: core-cluster1-alert {
+                                       temperature = <85000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
-                               cpu_crit: cpu-crit {
-                                       temperature = <85000>;
+
+                               core-cluster1-crit {
+                                       temperature = <95000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                                };
 
                        cooling-maps {
                                map0 {
-                                       trip = <&cpu_alert>;
+                                       trip = <&core_cluster1_alert>;
                                        cooling-device =
                                                <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                               <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                               <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               core-cluster2 {
+                       polling-delay-passive = <1000>;
+                       polling-delay = <5000>;
+                       thermal-sensors = <&tmu 5>;
+
+                       trips {
+                               core_cluster2_alert: core-cluster2-alert {
+                                       temperature = <85000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               core-cluster2-crit {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&core_cluster2_alert>;
+                                       cooling-device =
                                                <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                               <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                               <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               core-cluster3 {
+                       polling-delay-passive = <1000>;
+                       polling-delay = <5000>;
+                       thermal-sensors = <&tmu 6>;
+
+                       trips {
+                               core_cluster3_alert: core-cluster3-alert {
+                                       temperature = <85000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               core-cluster3-crit {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&core_cluster3_alert>;
+                                       cooling-device =
                                                <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                               <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                               <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               core-cluster4 {
+                       polling-delay-passive = <1000>;
+                       polling-delay = <5000>;
+                       thermal-sensors = <&tmu 7>;
+
+                       trips {
+                               core_cluster4_alert: core-cluster4-alert {
+                                       temperature = <85000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               core-cluster4-crit {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&core_cluster4_alert>;
+                                       cooling-device =
                                                <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
                                                <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
                                };
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc000000 0x0 0x1000>;
                        clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster1_core1_watchdog: wdt@c010000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc010000 0x0 0x1000>;
                        clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster2_core0_watchdog: wdt@c100000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc100000 0x0 0x1000>;
                        clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster2_core1_watchdog: wdt@c110000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc110000 0x0 0x1000>;
                        clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster3_core0_watchdog: wdt@c200000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc200000 0x0 0x1000>;
                        clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster3_core1_watchdog: wdt@c210000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc210000 0x0 0x1000>;
                        clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster4_core0_watchdog: wdt@c300000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc300000 0x0 0x1000>;
                        clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                cluster4_core1_watchdog: wdt@c310000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xc310000 0x0 0x1000>;
                        clocks = <&clockgen 4 3>, <&clockgen 4 3>;
-                       clock-names = "apb_pclk", "wdog_clk";
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                crypto: crypto@8000000 {
index d247e42..83072da 100644 (file)
                        status = "disabled";
                };
 
-               pcie@3400000 {
+               pcie1: pcie@3400000 {
                        compatible = "fsl,lx2160a-pcie";
                        reg = <0x00 0x03400000 0x0 0x00100000   /* controller registers */
                               0x80 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie@3500000 {
+               pcie2: pcie@3500000 {
                        compatible = "fsl,lx2160a-pcie";
                        reg = <0x00 0x03500000 0x0 0x00100000   /* controller registers */
                               0x88 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie@3600000 {
+               pcie3: pcie@3600000 {
                        compatible = "fsl,lx2160a-pcie";
                        reg = <0x00 0x03600000 0x0 0x00100000   /* controller registers */
                               0x90 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie@3700000 {
+               pcie4: pcie@3700000 {
                        compatible = "fsl,lx2160a-pcie";
                        reg = <0x00 0x03700000 0x0 0x00100000   /* controller registers */
                               0x98 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie@3800000 {
+               pcie5: pcie@3800000 {
                        compatible = "fsl,lx2160a-pcie";
                        reg = <0x00 0x03800000 0x0 0x00100000   /* controller registers */
                               0xa0 0x00000000 0x0 0x00002000>; /* configuration space */
                        status = "disabled";
                };
 
-               pcie@3900000 {
+               pcie6: pcie@3900000 {
                        compatible = "fsl,lx2160a-pcie";
                        reg = <0x00 0x03900000 0x0 0x00100000   /* controller registers */
                               0xa8 0x00000000 0x0 0x00002000>; /* configuration space */
index baa5f99..d6b9ded 100644 (file)
                led0 {
                        label = "gen_led0";
                        gpios = <&pca6416_1 4 GPIO_ACTIVE_HIGH>;
-                       default-state = "none";
+                       default-state = "off";
                };
 
                led1 {
                        label = "gen_led1";
                        gpios = <&pca6416_1 5 GPIO_ACTIVE_HIGH>;
-                       default-state = "none";
+                       default-state = "off";
                };
 
                led2 {
                        label = "gen_led2";
                        gpios = <&pca6416_1 6 GPIO_ACTIVE_HIGH>;
-                       default-state = "none";
+                       default-state = "off";
                };
 
                led3 {
@@ -70,7 +70,7 @@
 &ecspi2 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_espi2>;
-       cs-gpios = <&gpio5 9 0>;
+       cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        eeprom@0 {
                >;
        };
 
-       pinctrl_pcal6414: pcal6414-gpio {
+       pinctrl_pcal6414: pcal6414-gpiogrp {
                fsl,pins = <
                        MX8MM_IOMUXC_SAI2_MCLK_GPIO4_IO27               0x19
                >;
                >;
        };
 
-       pinctrl_usdhc2_gpio: usdhc2grpgpio {
+       pinctrl_usdhc2_gpio: usdhc2gpiogrp {
                fsl,pins = <
                        MX8MM_IOMUXC_SD2_CD_B_USDHC2_CD_B       0x41
                        MX8MM_IOMUXC_SD2_RESET_B_GPIO2_IO19     0x41
                >;
        };
 
-       pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
+       pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
                fsl,pins = <
                        MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x194
                        MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d4
                >;
        };
 
-       pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
+       pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
                fsl,pins = <
                        MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x196
                        MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d6
index 94911b1..6de86a4 100644 (file)
                reg = <0x4b>;
                pinctrl-0 = <&pinctrl_pmic>;
                interrupt-parent = <&gpio1>;
-               interrupts = <3 GPIO_ACTIVE_LOW>;
+               interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
                rohm,reset-snvs-powered;
 
                regulators {
                        buck1_reg: BUCK1 {
-                               regulator-name = "BUCK1";
+                               regulator-name = "buck1";
                                regulator-min-microvolt = <700000>;
                                regulator-max-microvolt = <1300000>;
                                regulator-boot-on;
@@ -88,7 +88,7 @@
                        };
 
                        buck2_reg: BUCK2 {
-                               regulator-name = "BUCK2";
+                               regulator-name = "buck2";
                                regulator-min-microvolt = <700000>;
                                regulator-max-microvolt = <1300000>;
                                regulator-boot-on;
 
                        buck3_reg: BUCK3 {
                                // BUCK5 in datasheet
-                               regulator-name = "BUCK3";
+                               regulator-name = "buck3";
                                regulator-min-microvolt = <700000>;
                                regulator-max-microvolt = <1350000>;
                                regulator-boot-on;
 
                        buck4_reg: BUCK4 {
                                // BUCK6 in datasheet
-                               regulator-name = "BUCK4";
+                               regulator-name = "buck4";
                                regulator-min-microvolt = <3000000>;
                                regulator-max-microvolt = <3300000>;
                                regulator-boot-on;
 
                        buck5_reg: BUCK5 {
                                // BUCK7 in datasheet
-                               regulator-name = "BUCK5";
+                               regulator-name = "buck5";
                                regulator-min-microvolt = <1605000>;
                                regulator-max-microvolt = <1995000>;
                                regulator-boot-on;
 
                        buck6_reg: BUCK6 {
                                // BUCK8 in datasheet
-                               regulator-name = "BUCK6";
+                               regulator-name = "buck6";
                                regulator-min-microvolt = <800000>;
                                regulator-max-microvolt = <1400000>;
                                regulator-boot-on;
                        };
 
                        ldo1_reg: LDO1 {
-                               regulator-name = "LDO1";
+                               regulator-name = "ldo1";
                                regulator-min-microvolt = <1600000>;
                                regulator-max-microvolt = <3300000>;
                                regulator-boot-on;
                        };
 
                        ldo2_reg: LDO2 {
-                               regulator-name = "LDO2";
+                               regulator-name = "ldo2";
                                regulator-min-microvolt = <800000>;
                                regulator-max-microvolt = <900000>;
                                regulator-boot-on;
                        };
 
                        ldo3_reg: LDO3 {
-                               regulator-name = "LDO3";
+                               regulator-name = "ldo3";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <3300000>;
                                regulator-boot-on;
                        };
 
                        ldo4_reg: LDO4 {
-                               regulator-name = "LDO4";
+                               regulator-name = "ldo4";
                                regulator-min-microvolt = <900000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-boot-on;
                        };
 
                        ldo6_reg: LDO6 {
-                               regulator-name = "LDO6";
+                               regulator-name = "ldo6";
                                regulator-min-microvolt = <900000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-boot-on;
        status = "okay";
 
        eeprom@50 {
-               compatible = "microchip, at24c64d", "atmel,24c64";
+               compatible = "microchip,24c64", "atmel,24c64";
                pagesize = <32>;
                read-only;      /* Manufacturing EEPROM programmed at factory */
                reg = <0x50>;
                        >;
                };
 
-               pinctrl_pmic: pmicirq {
+               pinctrl_pmic: pmicirqgrp {
                        fsl,pins = <
-                               MX8MM_IOMUXC_GPIO1_IO03_GPIO1_IO3               0x41
+                               MX8MM_IOMUXC_GPIO1_IO03_GPIO1_IO3       0x141
                        >;
                };
 
                        >;
                };
 
-               pinctrl_usdhc1_gpio: usdhc1grpgpio {
+               pinctrl_usdhc1_gpio: usdhc1gpiogrp {
                        fsl,pins = <
                                MX8MM_IOMUXC_SD1_RESET_B_GPIO2_IO10     0x41
                        >;
                        >;
                };
 
-               pinctrl_usdhc1_100mhz: usdhc1grp100mhz {
+               pinctrl_usdhc1_100mhz: usdhc1-100mhzgrp {
                        fsl,pins = <
                                MX8MM_IOMUXC_SD1_CLK_USDHC1_CLK         0x194
                                MX8MM_IOMUXC_SD1_CMD_USDHC1_CMD         0x1d4
                        >;
                };
 
-               pinctrl_usdhc1_200mhz: usdhc1grp200mhz {
+               pinctrl_usdhc1_200mhz: usdhc1-200mhzgrp {
                        fsl,pins = <
                                MX8MM_IOMUXC_SD1_CLK_USDHC1_CLK         0x196
                                MX8MM_IOMUXC_SD1_CMD_USDHC1_CMD         0x1d6
                        >;
                };
 
-               pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+               pinctrl_usdhc3_100mhz: usdhc3-100mhzgrp {
                        fsl,pins = <
                                MX8MM_IOMUXC_NAND_WE_B_USDHC3_CLK               0x194
                                MX8MM_IOMUXC_NAND_WP_B_USDHC3_CMD               0x1d4
                        >;
                };
 
-               pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+               pinctrl_usdhc3_200mhz: usdhc3-200mhzgrp {
                        fsl,pins = <
                                MX8MM_IOMUXC_NAND_WE_B_USDHC3_CLK               0x196
                                MX8MM_IOMUXC_NAND_WP_B_USDHC3_CMD               0x1d6
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-ddr4-evk.dts b/arch/arm64/boot/dts/freescale/imx8mm-ddr4-evk.dts
new file mode 100644 (file)
index 0000000..6c079c0
--- /dev/null
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 NXP
+ */
+
+/dts-v1/;
+
+#include "imx8mm-evk.dtsi"
+
+/ {
+       model = "FSL i.MX8MM DDR4 EVK with CYW43455 WIFI/BT board";
+       compatible = "fsl,imx8mm-ddr4-evk", "fsl,imx8mm";
+
+       leds {
+               pinctrl-0 = <&pinctrl_gpio_led_2>;
+
+               status {
+                       gpios = <&gpio3 4 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       nand-on-flash-bbt;
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl_gpmi_nand: gpmi-nand {
+               fsl,pins = <
+                       MX8MM_IOMUXC_NAND_ALE_RAWNAND_ALE               0x00000096
+                       MX8MM_IOMUXC_NAND_CE0_B_RAWNAND_CE0_B           0x00000096
+                       MX8MM_IOMUXC_NAND_CE1_B_RAWNAND_CE1_B           0x00000096
+                       MX8MM_IOMUXC_NAND_CLE_RAWNAND_CLE               0x00000096
+                       MX8MM_IOMUXC_NAND_DATA00_RAWNAND_DATA00         0x00000096
+                       MX8MM_IOMUXC_NAND_DATA01_RAWNAND_DATA01         0x00000096
+                       MX8MM_IOMUXC_NAND_DATA02_RAWNAND_DATA02         0x00000096
+                       MX8MM_IOMUXC_NAND_DATA03_RAWNAND_DATA03         0x00000096
+                       MX8MM_IOMUXC_NAND_DATA04_RAWNAND_DATA04         0x00000096
+                       MX8MM_IOMUXC_NAND_DATA05_RAWNAND_DATA05         0x00000096
+                       MX8MM_IOMUXC_NAND_DATA06_RAWNAND_DATA06         0x00000096
+                       MX8MM_IOMUXC_NAND_DATA07_RAWNAND_DATA07         0x00000096
+                       MX8MM_IOMUXC_NAND_RE_B_RAWNAND_RE_B             0x00000096
+                       MX8MM_IOMUXC_NAND_READY_B_RAWNAND_READY_B       0x00000056
+                       MX8MM_IOMUXC_NAND_WE_B_RAWNAND_WE_B             0x00000096
+                       MX8MM_IOMUXC_NAND_WP_B_RAWNAND_WP_B             0x00000096
+               >;
+       };
+
+       pinctrl_gpio_led_2: gpioled2grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_NAND_CE3_B_GPIO3_IO4       0x19
+               >;
+       };
+};
index 0f1d7f8..4e2820d 100644 (file)
@@ -1,97 +1,20 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * Copyright 2019 NXP
+ * Copyright 2019-2020 NXP
  */
 
 /dts-v1/;
 
 #include <dt-bindings/usb/pd.h>
-#include "imx8mm.dtsi"
+#include "imx8mm-evk.dtsi"
 
 / {
        model = "FSL i.MX8MM EVK board";
        compatible = "fsl,imx8mm-evk", "fsl,imx8mm";
 
-       chosen {
-               stdout-path = &uart2;
+       aliases {
+               spi0 = &flexspi;
        };
-
-       memory@40000000 {
-               device_type = "memory";
-               reg = <0x0 0x40000000 0 0x80000000>;
-       };
-
-       leds {
-               compatible = "gpio-leds";
-               pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_gpio_led>;
-
-               status {
-                       label = "status";
-                       gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>;
-                       default-state = "on";
-               };
-       };
-
-       reg_usdhc2_vmmc: regulator-usdhc2 {
-               compatible = "regulator-fixed";
-               pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_reg_usdhc2_vmmc>;
-               regulator-name = "VSD_3V3";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
-       };
-
-       wm8524: audio-codec {
-               #sound-dai-cells = <0>;
-               compatible = "wlf,wm8524";
-               pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_gpio_wlf>;
-               wlf,mute-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
-       };
-
-       sound-wm8524 {
-               compatible = "simple-audio-card";
-               simple-audio-card,name = "wm8524-audio";
-               simple-audio-card,format = "i2s";
-               simple-audio-card,frame-master = <&cpudai>;
-               simple-audio-card,bitclock-master = <&cpudai>;
-               simple-audio-card,widgets =
-                       "Line", "Left Line Out Jack",
-                       "Line", "Right Line Out Jack";
-               simple-audio-card,routing =
-                       "Left Line Out Jack", "LINEVOUTL",
-                       "Right Line Out Jack", "LINEVOUTR";
-
-               cpudai: simple-audio-card,cpu {
-                       sound-dai = <&sai3>;
-                       dai-tdm-slot-num = <2>;
-                       dai-tdm-slot-width = <32>;
-               };
-
-               simple-audio-card,codec {
-                       sound-dai = <&wm8524>;
-                       clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
-               };
-       };
-};
-
-&A53_0 {
-       cpu-supply = <&buck2_reg>;
-};
-
-&A53_1 {
-       cpu-supply = <&buck2_reg>;
-};
-
-&A53_2 {
-       cpu-supply = <&buck2_reg>;
-};
-
-&A53_3 {
-       cpu-supply = <&buck2_reg>;
 };
 
 &ddrc {
        };
 };
 
-&fec1 {
+&flexspi {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_fec1>;
-       phy-mode = "rgmii-id";
-       phy-handle = <&ethphy0>;
-       phy-reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
-       phy-reset-duration = <10>;
-       fsl,magic-packet;
+       pinctrl-0 = <&pinctrl_flexspi>;
        status = "okay";
 
-       mdio {
+       flash@0 {
+               reg = <0>;
                #address-cells = <1>;
-               #size-cells = <0>;
-
-               ethphy0: ethernet-phy@0 {
-                       compatible = "ethernet-phy-ieee802.3-c22";
-                       reg = <0>;
-               };
-       };
-};
-
-&i2c1 {
-       clock-frequency = <400000>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c1>;
-       status = "okay";
-
-       pmic@4b {
-               compatible = "rohm,bd71847";
-               reg = <0x4b>;
-               pinctrl-0 = <&pinctrl_pmic>;
-               interrupt-parent = <&gpio1>;
-               interrupts = <3 GPIO_ACTIVE_LOW>;
-               rohm,reset-snvs-powered;
-
-               regulators {
-                       buck1_reg: BUCK1 {
-                               regulator-name = "BUCK1";
-                               regulator-min-microvolt = <700000>;
-                               regulator-max-microvolt = <1300000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                               regulator-ramp-delay = <1250>;
-                       };
-
-                       buck2_reg: BUCK2 {
-                               regulator-name = "BUCK2";
-                               regulator-min-microvolt = <700000>;
-                               regulator-max-microvolt = <1300000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                               regulator-ramp-delay = <1250>;
-                               rohm,dvs-run-voltage = <1000000>;
-                               rohm,dvs-idle-voltage = <900000>;
-                       };
-
-                       buck3_reg: BUCK3 {
-                               // BUCK5 in datasheet
-                               regulator-name = "BUCK3";
-                               regulator-min-microvolt = <700000>;
-                               regulator-max-microvolt = <1350000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       buck4_reg: BUCK4 {
-                               // BUCK6 in datasheet
-                               regulator-name = "BUCK4";
-                               regulator-min-microvolt = <3000000>;
-                               regulator-max-microvolt = <3300000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       buck5_reg: BUCK5 {
-                               // BUCK7 in datasheet
-                               regulator-name = "BUCK5";
-                               regulator-min-microvolt = <1605000>;
-                               regulator-max-microvolt = <1995000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       buck6_reg: BUCK6 {
-                               // BUCK8 in datasheet
-                               regulator-name = "BUCK6";
-                               regulator-min-microvolt = <800000>;
-                               regulator-max-microvolt = <1400000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       ldo1_reg: LDO1 {
-                               regulator-name = "LDO1";
-                               regulator-min-microvolt = <1600000>;
-                               regulator-max-microvolt = <3300000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       ldo2_reg: LDO2 {
-                               regulator-name = "LDO2";
-                               regulator-min-microvolt = <800000>;
-                               regulator-max-microvolt = <900000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       ldo3_reg: LDO3 {
-                               regulator-name = "LDO3";
-                               regulator-min-microvolt = <1800000>;
-                               regulator-max-microvolt = <3300000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       ldo4_reg: LDO4 {
-                               regulator-name = "LDO4";
-                               regulator-min-microvolt = <900000>;
-                               regulator-max-microvolt = <1800000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       ldo6_reg: LDO6 {
-                               regulator-name = "LDO6";
-                               regulator-min-microvolt = <900000>;
-                               regulator-max-microvolt = <1800000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-               };
-       };
-};
-
-&i2c2 {
-       clock-frequency = <400000>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c2>;
-       status = "okay";
-
-       ptn5110: tcpc@50 {
-               compatible = "nxp,ptn5110";
-               pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_typec1>;
-               reg = <0x50>;
-               interrupt-parent = <&gpio2>;
-               interrupts = <11 8>;
-               status = "okay";
-
-               port {
-                       typec1_dr_sw: endpoint {
-                               remote-endpoint = <&usb1_drd_sw>;
-                       };
-               };
-
-               typec1_con: connector {
-                       compatible = "usb-c-connector";
-                       label = "USB-C";
-                       power-role = "dual";
-                       data-role = "dual";
-                       try-power-role = "sink";
-                       source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
-                       sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)
-                                    PDO_VAR(5000, 20000, 3000)>;
-                       op-sink-microwatt = <15000000>;
-                       self-powered;
-               };
+               #size-cells = <1>;
+               compatible = "jedec,spi-nor";
+               spi-max-frequency = <80000000>;
+               spi-tx-bus-width = <4>;
+               spi-rx-bus-width = <4>;
        };
 };
 
-&i2c3 {
-       clock-frequency = <400000>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c3>;
-       status = "okay";
-
-       pca6416: gpio@20 {
-               compatible = "ti,tca6416";
-               reg = <0x20>;
-               gpio-controller;
-               #gpio-cells = <2>;
-       };
-};
-
-&sai3 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_sai3>;
-       assigned-clocks = <&clk IMX8MM_CLK_SAI3>;
-       assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
-       assigned-clock-rates = <24576000>;
-       status = "okay";
-};
-
-&snvs_pwrkey {
-       status = "okay";
-};
-
-&uart2 { /* console */
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart2>;
-       status = "okay";
-};
-
-&usbotg1 {
-       dr_mode = "otg";
-       hnp-disable;
-       srp-disable;
-       adp-disable;
-       usb-role-switch;
-       status = "okay";
-
-       port {
-               usb1_drd_sw: endpoint {
-                       remote-endpoint = <&typec1_dr_sw>;
-               };
-       };
-};
-
-&usdhc2 {
-       assigned-clocks = <&clk IMX8MM_CLK_USDHC2>;
-       assigned-clock-rates = <200000000>;
-       pinctrl-names = "default", "state_100mhz", "state_200mhz";
-       pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>;
-       pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>;
-       pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>;
-       cd-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
-       bus-width = <4>;
-       vmmc-supply = <&reg_usdhc2_vmmc>;
-       status = "okay";
-};
-
 &usdhc3 {
        assigned-clocks = <&clk IMX8MM_CLK_USDHC3_ROOT>;
        assigned-clock-rates = <400000000>;
        status = "okay";
 };
 
-&wdog1 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_wdog>;
-       fsl,ext-reset-output;
-       status = "okay";
-};
-
 &iomuxc {
-       pinctrl-names = "default";
-
-       pinctrl_fec1: fec1grp {
-               fsl,pins = <
-                       MX8MM_IOMUXC_ENET_MDC_ENET1_MDC                 0x3
-                       MX8MM_IOMUXC_ENET_MDIO_ENET1_MDIO               0x3
-                       MX8MM_IOMUXC_ENET_TD3_ENET1_RGMII_TD3           0x1f
-                       MX8MM_IOMUXC_ENET_TD2_ENET1_RGMII_TD2           0x1f
-                       MX8MM_IOMUXC_ENET_TD1_ENET1_RGMII_TD1           0x1f
-                       MX8MM_IOMUXC_ENET_TD0_ENET1_RGMII_TD0           0x1f
-                       MX8MM_IOMUXC_ENET_RD3_ENET1_RGMII_RD3           0x91
-                       MX8MM_IOMUXC_ENET_RD2_ENET1_RGMII_RD2           0x91
-                       MX8MM_IOMUXC_ENET_RD1_ENET1_RGMII_RD1           0x91
-                       MX8MM_IOMUXC_ENET_RD0_ENET1_RGMII_RD0           0x91
-                       MX8MM_IOMUXC_ENET_TXC_ENET1_RGMII_TXC           0x1f
-                       MX8MM_IOMUXC_ENET_RXC_ENET1_RGMII_RXC           0x91
-                       MX8MM_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL     0x91
-                       MX8MM_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL     0x1f
-                       MX8MM_IOMUXC_SAI2_RXC_GPIO4_IO22                0x19
-               >;
-       };
-
-       pinctrl_gpio_led: gpioledgrp {
-               fsl,pins = <
-                       MX8MM_IOMUXC_NAND_READY_B_GPIO3_IO16    0x19
-               >;
-       };
-
-       pinctrl_gpio_wlf: gpiowlfgrp {
+       pinctrl_flexspi: flexspigrp {
                fsl,pins = <
-                       MX8MM_IOMUXC_I2C4_SDA_GPIO5_IO21        0xd6
-               >;
-       };
-
-       pinctrl_i2c1: i2c1grp {
-               fsl,pins = <
-                       MX8MM_IOMUXC_I2C1_SCL_I2C1_SCL                  0x400001c3
-                       MX8MM_IOMUXC_I2C1_SDA_I2C1_SDA                  0x400001c3
-               >;
-       };
-
-       pinctrl_i2c2: i2c2grp {
-               fsl,pins = <
-                       MX8MM_IOMUXC_I2C2_SCL_I2C2_SCL                  0x400001c3
-                       MX8MM_IOMUXC_I2C2_SDA_I2C2_SDA                  0x400001c3
-               >;
-       };
-
-       pinctrl_i2c3: i2c3grp {
-               fsl,pins = <
-                       MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL                  0x400001c3
-                       MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA                  0x400001c3
-               >;
-       };
-
-       pinctrl_pmic: pmicirq {
-               fsl,pins = <
-                       MX8MM_IOMUXC_GPIO1_IO03_GPIO1_IO3               0x41
-               >;
-       };
-
-       pinctrl_reg_usdhc2_vmmc: regusdhc2vmmc {
-               fsl,pins = <
-                       MX8MM_IOMUXC_SD2_RESET_B_GPIO2_IO19     0x41
-               >;
-       };
-
-       pinctrl_sai3: sai3grp {
-               fsl,pins = <
-                       MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC     0xd6
-                       MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK      0xd6
-                       MX8MM_IOMUXC_SAI3_MCLK_SAI3_MCLK        0xd6
-                       MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0     0xd6
-               >;
-       };
-
-       pinctrl_typec1: typec1grp {
-               fsl,pins = <
-                       MX8MM_IOMUXC_SD1_STROBE_GPIO2_IO11      0x159
-               >;
-       };
-
-       pinctrl_uart2: uart2grp {
-               fsl,pins = <
-                       MX8MM_IOMUXC_UART2_RXD_UART2_DCE_RX     0x140
-                       MX8MM_IOMUXC_UART2_TXD_UART2_DCE_TX     0x140
-               >;
-       };
-
-       pinctrl_usdhc2_gpio: usdhc2grpgpio {
-               fsl,pins = <
-                       MX8MM_IOMUXC_GPIO1_IO15_GPIO1_IO15      0x1c4
-               >;
-       };
-
-       pinctrl_usdhc2: usdhc2grp {
-               fsl,pins = <
-                       MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK         0x190
-                       MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d0
-                       MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0     0x1d0
-                       MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1     0x1d0
-                       MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2     0x1d0
-                       MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3     0x1d0
-                       MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT  0x1d0
-               >;
-       };
-
-       pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
-               fsl,pins = <
-                       MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK         0x194
-                       MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d4
-                       MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0     0x1d4
-                       MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1     0x1d4
-                       MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2     0x1d4
-                       MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3     0x1d4
-                       MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT  0x1d0
-               >;
-       };
-
-       pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
-               fsl,pins = <
-                       MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK         0x196
-                       MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d6
-                       MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0     0x1d6
-                       MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1     0x1d6
-                       MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2     0x1d6
-                       MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3     0x1d6
-                       MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT  0x1d0
+                       MX8MM_IOMUXC_NAND_ALE_QSPI_A_SCLK               0x1c2
+                       MX8MM_IOMUXC_NAND_CE0_B_QSPI_A_SS0_B            0x82
+                       MX8MM_IOMUXC_NAND_DATA00_QSPI_A_DATA0           0x82
+                       MX8MM_IOMUXC_NAND_DATA01_QSPI_A_DATA1           0x82
+                       MX8MM_IOMUXC_NAND_DATA02_QSPI_A_DATA2           0x82
+                       MX8MM_IOMUXC_NAND_DATA03_QSPI_A_DATA3           0x82
                >;
        };
 
        pinctrl_usdhc3: usdhc3grp {
                fsl,pins = <
-                       MX8MM_IOMUXC_NAND_WE_B_USDHC3_CLK               0x190
-                       MX8MM_IOMUXC_NAND_WP_B_USDHC3_CMD               0x1d0
-                       MX8MM_IOMUXC_NAND_DATA04_USDHC3_DATA0           0x1d0
-                       MX8MM_IOMUXC_NAND_DATA05_USDHC3_DATA1           0x1d0
-                       MX8MM_IOMUXC_NAND_DATA06_USDHC3_DATA2           0x1d0
-                       MX8MM_IOMUXC_NAND_DATA07_USDHC3_DATA3           0x1d0
-                       MX8MM_IOMUXC_NAND_RE_B_USDHC3_DATA4             0x1d0
-                       MX8MM_IOMUXC_NAND_CE2_B_USDHC3_DATA5            0x1d0
-                       MX8MM_IOMUXC_NAND_CE3_B_USDHC3_DATA6            0x1d0
-                       MX8MM_IOMUXC_NAND_CLE_USDHC3_DATA7              0x1d0
-                       MX8MM_IOMUXC_NAND_CE1_B_USDHC3_STROBE           0x190
-               >;
-       };
-
-       pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
-               fsl,pins = <
-                       MX8MM_IOMUXC_NAND_WE_B_USDHC3_CLK               0x194
-                       MX8MM_IOMUXC_NAND_WP_B_USDHC3_CMD               0x1d4
-                       MX8MM_IOMUXC_NAND_DATA04_USDHC3_DATA0           0x1d4
-                       MX8MM_IOMUXC_NAND_DATA05_USDHC3_DATA1           0x1d4
-                       MX8MM_IOMUXC_NAND_DATA06_USDHC3_DATA2           0x1d4
-                       MX8MM_IOMUXC_NAND_DATA07_USDHC3_DATA3           0x1d4
-                       MX8MM_IOMUXC_NAND_RE_B_USDHC3_DATA4             0x1d4
-                       MX8MM_IOMUXC_NAND_CE2_B_USDHC3_DATA5            0x1d4
-                       MX8MM_IOMUXC_NAND_CE3_B_USDHC3_DATA6            0x1d4
-                       MX8MM_IOMUXC_NAND_CLE_USDHC3_DATA7              0x1d4
-                       MX8MM_IOMUXC_NAND_CE1_B_USDHC3_STROBE           0x194
-               >;
-       };
-
-       pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
-               fsl,pins = <
-                       MX8MM_IOMUXC_NAND_WE_B_USDHC3_CLK               0x196
-                       MX8MM_IOMUXC_NAND_WP_B_USDHC3_CMD               0x1d6
-                       MX8MM_IOMUXC_NAND_DATA04_USDHC3_DATA0           0x1d6
-                       MX8MM_IOMUXC_NAND_DATA05_USDHC3_DATA1           0x1d6
-                       MX8MM_IOMUXC_NAND_DATA06_USDHC3_DATA2           0x1d6
-                       MX8MM_IOMUXC_NAND_DATA07_USDHC3_DATA3           0x1d6
-                       MX8MM_IOMUXC_NAND_RE_B_USDHC3_DATA4             0x1d6
-                       MX8MM_IOMUXC_NAND_CE2_B_USDHC3_DATA5            0x1d6
-                       MX8MM_IOMUXC_NAND_CE3_B_USDHC3_DATA6            0x1d6
-                       MX8MM_IOMUXC_NAND_CLE_USDHC3_DATA7              0x1d6
-                       MX8MM_IOMUXC_NAND_CE1_B_USDHC3_STROBE           0x196
-               >;
-       };
-
-       pinctrl_wdog: wdoggrp {
-               fsl,pins = <
-                       MX8MM_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B    0xc6
+                       MX8MM_IOMUXC_NAND_WE_B_USDHC3_CLK               0x190
+                       MX8MM_IOMUXC_NAND_WP_B_USDHC3_CMD               0x1d0
+                       MX8MM_IOMUXC_NAND_DATA04_USDHC3_DATA0           0x1d0
+                       MX8MM_IOMUXC_NAND_DATA05_USDHC3_DATA1           0x1d0
+                       MX8MM_IOMUXC_NAND_DATA06_USDHC3_DATA2           0x1d0
+                       MX8MM_IOMUXC_NAND_DATA06_USDHC3_DATA2           0x1d0
+                       MX8MM_IOMUXC_NAND_DATA07_USDHC3_DATA3           0x1d0
+                       MX8MM_IOMUXC_NAND_RE_B_USDHC3_DATA4             0x1d0
+                       MX8MM_IOMUXC_NAND_CE2_B_USDHC3_DATA5            0x1d0
+                       MX8MM_IOMUXC_NAND_CE3_B_USDHC3_DATA6            0x1d0
+                       MX8MM_IOMUXC_NAND_CLE_USDHC3_DATA7              0x1d0
+                       MX8MM_IOMUXC_NAND_CE1_B_USDHC3_STROBE           0x190
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3-100mhzgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_NAND_WE_B_USDHC3_CLK               0x194
+                       MX8MM_IOMUXC_NAND_WP_B_USDHC3_CMD               0x1d4
+                       MX8MM_IOMUXC_NAND_DATA04_USDHC3_DATA0           0x1d4
+                       MX8MM_IOMUXC_NAND_DATA05_USDHC3_DATA1           0x1d4
+                       MX8MM_IOMUXC_NAND_DATA06_USDHC3_DATA2           0x1d4
+                       MX8MM_IOMUXC_NAND_DATA07_USDHC3_DATA3           0x1d4
+                       MX8MM_IOMUXC_NAND_RE_B_USDHC3_DATA4             0x1d4
+                       MX8MM_IOMUXC_NAND_CE2_B_USDHC3_DATA5            0x1d4
+                       MX8MM_IOMUXC_NAND_CE3_B_USDHC3_DATA6            0x1d4
+                       MX8MM_IOMUXC_NAND_CLE_USDHC3_DATA7              0x1d4
+                       MX8MM_IOMUXC_NAND_CE1_B_USDHC3_STROBE           0x194
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3-200mhzgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_NAND_WE_B_USDHC3_CLK               0x196
+                       MX8MM_IOMUXC_NAND_WP_B_USDHC3_CMD               0x1d6
+                       MX8MM_IOMUXC_NAND_DATA04_USDHC3_DATA0           0x1d6
+                       MX8MM_IOMUXC_NAND_DATA05_USDHC3_DATA1           0x1d6
+                       MX8MM_IOMUXC_NAND_DATA06_USDHC3_DATA2           0x1d6
+                       MX8MM_IOMUXC_NAND_DATA07_USDHC3_DATA3           0x1d6
+                       MX8MM_IOMUXC_NAND_RE_B_USDHC3_DATA4             0x1d6
+                       MX8MM_IOMUXC_NAND_CE2_B_USDHC3_DATA5            0x1d6
+                       MX8MM_IOMUXC_NAND_CE3_B_USDHC3_DATA6            0x1d6
+                       MX8MM_IOMUXC_NAND_CLE_USDHC3_DATA7              0x1d6
+                       MX8MM_IOMUXC_NAND_CE1_B_USDHC3_STROBE           0x196
                >;
        };
 };
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
new file mode 100644 (file)
index 0000000..f305a53
--- /dev/null
@@ -0,0 +1,474 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2020 NXP
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/usb/pd.h>
+#include "imx8mm.dtsi"
+
+/ {
+       chosen {
+               stdout-path = &uart2;
+       };
+
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x0 0x40000000 0 0x80000000>;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_led>;
+
+               status {
+                       label = "status";
+                       gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>;
+                       default-state = "on";
+               };
+       };
+
+       reg_usdhc2_vmmc: regulator-usdhc2 {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_usdhc2_vmmc>;
+               regulator-name = "VSD_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       wm8524: audio-codec {
+               #sound-dai-cells = <0>;
+               compatible = "wlf,wm8524";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_wlf>;
+               wlf,mute-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
+       };
+
+       sound-wm8524 {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "wm8524-audio";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,frame-master = <&cpudai>;
+               simple-audio-card,bitclock-master = <&cpudai>;
+               simple-audio-card,widgets =
+                       "Line", "Left Line Out Jack",
+                       "Line", "Right Line Out Jack";
+               simple-audio-card,routing =
+                       "Left Line Out Jack", "LINEVOUTL",
+                       "Right Line Out Jack", "LINEVOUTR";
+
+               cpudai: simple-audio-card,cpu {
+                       sound-dai = <&sai3>;
+                       dai-tdm-slot-num = <2>;
+                       dai-tdm-slot-width = <32>;
+               };
+
+               simple-audio-card,codec {
+                       sound-dai = <&wm8524>;
+                       clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
+               };
+       };
+};
+
+&A53_0 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&A53_1 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&A53_2 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&A53_3 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&fec1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec1>;
+       phy-mode = "rgmii-id";
+       phy-handle = <&ethphy0>;
+       fsl,magic-packet;
+       status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ethphy0: ethernet-phy@0 {
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       reg = <0>;
+                       reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
+                       reset-assert-us = <10000>;
+               };
+       };
+};
+
+&i2c1 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       pmic@4b {
+               compatible = "rohm,bd71847";
+               reg = <0x4b>;
+               pinctrl-0 = <&pinctrl_pmic>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
+               rohm,reset-snvs-powered;
+
+               #clock-cells = <0>;
+               clocks = <&osc_32k 0>;
+               clock-output-names = "clk-32k-out";
+
+               regulators {
+                       buck1_reg: BUCK1 {
+                               regulator-name = "buck1";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <1250>;
+                       };
+
+                       buck2_reg: BUCK2 {
+                               regulator-name = "buck2";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <1250>;
+                               rohm,dvs-run-voltage = <1000000>;
+                               rohm,dvs-idle-voltage = <900000>;
+                       };
+
+                       buck3_reg: BUCK3 {
+                               // BUCK5 in datasheet
+                               regulator-name = "buck3";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck4_reg: BUCK4 {
+                               // BUCK6 in datasheet
+                               regulator-name = "buck4";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck5_reg: BUCK5 {
+                               // BUCK7 in datasheet
+                               regulator-name = "buck5";
+                               regulator-min-microvolt = <1605000>;
+                               regulator-max-microvolt = <1995000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck6_reg: BUCK6 {
+                               // BUCK8 in datasheet
+                               regulator-name = "buck6";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1400000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo1_reg: LDO1 {
+                               regulator-name = "ldo1";
+                               regulator-min-microvolt = <1600000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo2_reg: LDO2 {
+                               regulator-name = "ldo2";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <900000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo3_reg: LDO3 {
+                               regulator-name = "ldo3";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo4_reg: LDO4 {
+                               regulator-name = "ldo4";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo6_reg: LDO6 {
+                               regulator-name = "ldo6";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c2 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       ptn5110: tcpc@50 {
+               compatible = "nxp,ptn5110";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_typec1>;
+               reg = <0x50>;
+               interrupt-parent = <&gpio2>;
+               interrupts = <11 8>;
+               status = "okay";
+
+               port {
+                       typec1_dr_sw: endpoint {
+                               remote-endpoint = <&usb1_drd_sw>;
+                       };
+               };
+
+               typec1_con: connector {
+                       compatible = "usb-c-connector";
+                       label = "USB-C";
+                       power-role = "dual";
+                       data-role = "dual";
+                       try-power-role = "sink";
+                       source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
+                       sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)
+                                    PDO_VAR(5000, 20000, 3000)>;
+                       op-sink-microwatt = <15000000>;
+                       self-powered;
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       pca6416: gpio@20 {
+               compatible = "ti,tca6416";
+               reg = <0x20>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+};
+
+&sai3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sai3>;
+       assigned-clocks = <&clk IMX8MM_CLK_SAI3>;
+       assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
+       assigned-clock-rates = <24576000>;
+       status = "okay";
+};
+
+&snvs_pwrkey {
+       status = "okay";
+};
+
+&uart2 { /* console */
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&usbotg1 {
+       dr_mode = "otg";
+       hnp-disable;
+       srp-disable;
+       adp-disable;
+       usb-role-switch;
+       samsung,picophy-pre-emp-curr-control = <3>;
+       samsung,picophy-dc-vol-level-adjust = <7>;
+       status = "okay";
+
+       port {
+               usb1_drd_sw: endpoint {
+                       remote-endpoint = <&typec1_dr_sw>;
+               };
+       };
+};
+
+&usdhc2 {
+       assigned-clocks = <&clk IMX8MM_CLK_USDHC2>;
+       assigned-clock-rates = <200000000>;
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>;
+       pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>;
+       pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>;
+       cd-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
+       bus-width = <4>;
+       vmmc-supply = <&reg_usdhc2_vmmc>;
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl_fec1: fec1grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_ENET_MDC_ENET1_MDC                 0x3
+                       MX8MM_IOMUXC_ENET_MDIO_ENET1_MDIO               0x3
+                       MX8MM_IOMUXC_ENET_TD3_ENET1_RGMII_TD3           0x1f
+                       MX8MM_IOMUXC_ENET_TD2_ENET1_RGMII_TD2           0x1f
+                       MX8MM_IOMUXC_ENET_TD1_ENET1_RGMII_TD1           0x1f
+                       MX8MM_IOMUXC_ENET_TD0_ENET1_RGMII_TD0           0x1f
+                       MX8MM_IOMUXC_ENET_RD3_ENET1_RGMII_RD3           0x91
+                       MX8MM_IOMUXC_ENET_RD2_ENET1_RGMII_RD2           0x91
+                       MX8MM_IOMUXC_ENET_RD1_ENET1_RGMII_RD1           0x91
+                       MX8MM_IOMUXC_ENET_RD0_ENET1_RGMII_RD0           0x91
+                       MX8MM_IOMUXC_ENET_TXC_ENET1_RGMII_TXC           0x1f
+                       MX8MM_IOMUXC_ENET_RXC_ENET1_RGMII_RXC           0x91
+                       MX8MM_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL     0x91
+                       MX8MM_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL     0x1f
+                       MX8MM_IOMUXC_SAI2_RXC_GPIO4_IO22                0x19
+               >;
+       };
+
+       pinctrl_gpio_led: gpioledgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_NAND_READY_B_GPIO3_IO16    0x19
+               >;
+       };
+
+       pinctrl_gpio_wlf: gpiowlfgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_I2C4_SDA_GPIO5_IO21        0xd6
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_I2C1_SCL_I2C1_SCL                  0x400001c3
+                       MX8MM_IOMUXC_I2C1_SDA_I2C1_SDA                  0x400001c3
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_I2C2_SCL_I2C2_SCL                  0x400001c3
+                       MX8MM_IOMUXC_I2C2_SDA_I2C2_SDA                  0x400001c3
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL                  0x400001c3
+                       MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA                  0x400001c3
+               >;
+       };
+
+       pinctrl_pmic: pmicirqgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_GPIO1_IO03_GPIO1_IO3               0x141
+               >;
+       };
+
+       pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD2_RESET_B_GPIO2_IO19     0x41
+               >;
+       };
+
+       pinctrl_sai3: sai3grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC     0xd6
+                       MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK      0xd6
+                       MX8MM_IOMUXC_SAI3_MCLK_SAI3_MCLK        0xd6
+                       MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0     0xd6
+               >;
+       };
+
+       pinctrl_typec1: typec1grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD1_STROBE_GPIO2_IO11      0x159
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_UART2_RXD_UART2_DCE_RX     0x140
+                       MX8MM_IOMUXC_UART2_TXD_UART2_DCE_TX     0x140
+               >;
+       };
+
+       pinctrl_usdhc2_gpio: usdhc2grpgpiogrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_GPIO1_IO15_GPIO1_IO15      0x1c4
+               >;
+       };
+
+       pinctrl_usdhc2: usdhc2grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK         0x190
+                       MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d0
+                       MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0     0x1d0
+                       MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1     0x1d0
+                       MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2     0x1d0
+                       MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3     0x1d0
+                       MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT  0x1d0
+               >;
+       };
+
+       pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK         0x194
+                       MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d4
+                       MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0     0x1d4
+                       MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1     0x1d4
+                       MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2     0x1d4
+                       MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3     0x1d4
+                       MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT  0x1d0
+               >;
+       };
+
+       pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK         0x196
+                       MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d6
+                       MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0     0x1d6
+                       MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1     0x1d6
+                       MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2     0x1d6
+                       MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3     0x1d6
+                       MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT  0x1d0
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B    0xc6
+               >;
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-var-som-symphony.dts b/arch/arm64/boot/dts/freescale/imx8mm-var-som-symphony.dts
new file mode 100644 (file)
index 0000000..ac1fe15
--- /dev/null
@@ -0,0 +1,255 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (C) 2020 Krzysztof Kozlowski <krzk@kernel.org>
+ */
+
+/dts-v1/;
+
+#include "imx8mm-var-som.dtsi"
+
+/ {
+       model = "Variscite VAR-SOM-MX8MM Symphony evaluation board";
+       compatible = "variscite,var-som-mx8mm-symphony", "variscite,var-som-mx8mm", "fsl,imx8mm";
+
+       reg_usdhc2_vmmc: regulator-usdhc2-vmmc {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_usdhc2_vmmc>;
+               regulator-name = "VSD_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_usb_otg2_vbus: regulator-usb-otg2-vbus {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_usb_otg2_vbus>;
+               regulator-name = "usb_otg2_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio5 1 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               back {
+                       label = "Back";
+                       gpios = <&pca9534 1 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_BACK>;
+               };
+
+               home {
+                       label = "Home";
+                       gpios = <&pca9534 2 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_HOME>;
+               };
+
+               menu {
+                       label = "Menu";
+                       gpios = <&pca9534 3 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_MENU>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led {
+                       label = "Heartbeat";
+                       gpios = <&pca9534 0 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+};
+
+&ethphy {
+       reset-gpios = <&pca9534 5 GPIO_ACTIVE_HIGH>;
+};
+
+&i2c2 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       pca9534: gpio@20 {
+               compatible = "nxp,pca9534";
+               reg = <0x20>;
+               gpio-controller;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pca9534>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
+               #gpio-cells = <2>;
+               wakeup-source;
+
+               /* USB 3.0 OTG (usbotg1) / SATA port switch, set to USB 3.0 */
+               usb3-sata-sel-hog {
+                       gpio-hog;
+                       gpios = <4 GPIO_ACTIVE_HIGH>;
+                       output-low;
+                       line-name = "usb3_sata_sel";
+               };
+
+               som-vselect-hog {
+                       gpio-hog;
+                       gpios = <6 GPIO_ACTIVE_HIGH>;
+                       output-low;
+                       line-name = "som_vselect";
+               };
+
+               enet-sel-hog {
+                       gpio-hog;
+                       gpios = <7 GPIO_ACTIVE_HIGH>;
+                       output-low;
+                       line-name = "enet_sel";
+               };
+       };
+
+       extcon_usbotg1: typec@3d {
+               compatible = "nxp,ptn5150";
+               reg = <0x3d>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_ptn5150>;
+               status = "okay";
+       };
+};
+
+&i2c3 {
+       /* Capacitive touch controller */
+       ft5x06_ts: touchscreen@38 {
+               compatible = "edt,edt-ft5406";
+               reg = <0x38>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_captouch>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <4 IRQ_TYPE_LEVEL_HIGH>;
+
+               touchscreen-size-x = <800>;
+               touchscreen-size-y = <480>;
+               touchscreen-inverted-x;
+               touchscreen-inverted-y;
+       };
+
+       rtc@68 {
+               compatible = "dallas,ds1337";
+               reg = <0x68>;
+       };
+};
+
+/* Header */
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+/* Header */
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&usbotg1 {
+       disable-over-current;
+       extcon = <&extcon_usbotg1>, <&extcon_usbotg1>;
+};
+
+&usbotg2 {
+       dr_mode = "host";
+       vbus-supply = <&reg_usb_otg2_vbus>;
+       srp-disable;
+       hnp-disable;
+       adp-disable;
+       disable-over-current;
+       /delete-property/ usb-role-switch;
+       /*
+        * FIXME: having USB2 enabled hangs the boot just after:
+        * [    1.943365] ci_hdrc ci_hdrc.1: EHCI Host Controller
+        * [    1.948287] ci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 1
+        * [    1.971006] ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00
+        * [    1.977203] hub 1-0:1.0: USB hub found
+        * [    1.980987] hub 1-0:1.0: 1 port detected
+        */
+       status = "disabled";
+};
+
+&pinctrl_fec1 {
+       fsl,pins = <
+               MX8MM_IOMUXC_ENET_MDC_ENET1_MDC                 0x3
+               MX8MM_IOMUXC_ENET_MDIO_ENET1_MDIO               0x3
+               MX8MM_IOMUXC_ENET_TD3_ENET1_RGMII_TD3           0x1f
+               MX8MM_IOMUXC_ENET_TD2_ENET1_RGMII_TD2           0x1f
+               MX8MM_IOMUXC_ENET_TD1_ENET1_RGMII_TD1           0x1f
+               MX8MM_IOMUXC_ENET_TD0_ENET1_RGMII_TD0           0x1f
+               MX8MM_IOMUXC_ENET_RD3_ENET1_RGMII_RD3           0x91
+               MX8MM_IOMUXC_ENET_RD2_ENET1_RGMII_RD2           0x91
+               MX8MM_IOMUXC_ENET_RD1_ENET1_RGMII_RD1           0x91
+               MX8MM_IOMUXC_ENET_RD0_ENET1_RGMII_RD0           0x91
+               MX8MM_IOMUXC_ENET_TXC_ENET1_RGMII_TXC           0x1f
+               MX8MM_IOMUXC_ENET_RXC_ENET1_RGMII_RXC           0x91
+               MX8MM_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL     0x91
+               MX8MM_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL     0x1f
+               /* Remove the MX8MM_IOMUXC_GPIO1_IO09_GPIO1_IO9 as not used */
+       >;
+};
+
+&iomuxc {
+       pinctrl_captouch: captouchgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SPDIF_RX_GPIO5_IO4         0x16
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_I2C2_SCL_I2C2_SCL          0x400001c3
+                       MX8MM_IOMUXC_I2C2_SDA_I2C2_SDA          0x400001c3
+               >;
+       };
+
+       pinctrl_pca9534: pca9534grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_GPIO1_IO07_GPIO1_IO7       0x16
+               >;
+       };
+
+       pinctrl_ptn5150: ptn5150grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_GPIO1_IO11_GPIO1_IO11      0x16
+               >;
+       };
+
+       pinctrl_reg_usb_otg2_vbus: regusbotg2vbusgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SAI3_TXD_GPIO5_IO1         0x16
+               >;
+       };
+
+       pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD2_RESET_B_GPIO2_IO19     0x41
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_UART1_RXD_UART1_DCE_RX     0x140
+                       MX8MM_IOMUXC_UART1_TXD_UART1_DCE_TX     0x140
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_UART3_RXD_UART3_DCE_RX     0x140
+                       MX8MM_IOMUXC_UART3_TXD_UART3_DCE_TX     0x140
+               >;
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-var-som.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-var-som.dtsi
new file mode 100644 (file)
index 0000000..4107fe9
--- /dev/null
@@ -0,0 +1,561 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2019 NXP
+ * Copyright (C) 2020 Krzysztof Kozlowski <krzk@kernel.org>
+ */
+
+#include "imx8mm.dtsi"
+
+/ {
+       model = "Variscite VAR-SOM-MX8MM module";
+       compatible = "variscite,var-som-mx8mm", "fsl,imx8mm";
+
+       chosen {
+               stdout-path = &uart4;
+       };
+
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x0 0x40000000 0 0x80000000>;
+       };
+
+       reg_eth_phy: regulator-eth-phy {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_eth_phy>;
+               regulator-name = "eth_phy_pwr";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpio2 9 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+};
+
+&A53_0 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&A53_1 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&A53_2 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&A53_3 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&ddrc {
+       operating-points-v2 = <&ddrc_opp_table>;
+
+       ddrc_opp_table: opp-table {
+               compatible = "operating-points-v2";
+
+               opp-25M {
+                       opp-hz = /bits/ 64 <25000000>;
+               };
+
+               opp-100M {
+                       opp-hz = /bits/ 64 <100000000>;
+               };
+
+               opp-750M {
+                       opp-hz = /bits/ 64 <750000000>;
+               };
+       };
+};
+
+&ecspi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi1>;
+       cs-gpios = <&gpio1 14 GPIO_ACTIVE_LOW>,
+                  <&gpio1  0 GPIO_ACTIVE_LOW>;
+       /delete-property/ dmas;
+       /delete-property/ dma-names;
+       status = "okay";
+
+       /* Resistive touch controller */
+       touchscreen@0 {
+               reg = <0>;
+               compatible = "ti,ads7846";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_restouch>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
+
+               spi-max-frequency = <1500000>;
+               pendown-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>;
+
+               ti,x-min = /bits/ 16 <125>;
+               touchscreen-size-x = /bits/ 16 <4008>;
+               ti,y-min = /bits/ 16 <282>;
+               touchscreen-size-y = /bits/ 16 <3864>;
+               ti,x-plate-ohms = /bits/ 16 <180>;
+               touchscreen-max-pressure = /bits/ 16 <255>;
+               touchscreen-average-samples = /bits/ 16 <10>;
+               ti,debounce-tol = /bits/ 16 <3>;
+               ti,debounce-rep = /bits/ 16 <1>;
+               ti,settle-delay-usec = /bits/ 16 <150>;
+               ti,keep-vref-on;
+               wakeup-source;
+       };
+};
+
+&fec1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec1>;
+       phy-mode = "rgmii";
+       phy-handle = <&ethphy>;
+       phy-supply = <&reg_eth_phy>;
+       fsl,magic-packet;
+       status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ethphy: ethernet-phy@4 {
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       reg = <4>;
+                       reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+                       reset-assert-us = <10000>;
+                       reset-deassert-us = <10000>;
+               };
+       };
+};
+
+&i2c1 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       pmic@4b {
+               compatible = "rohm,bd71847";
+               reg = <0x4b>;
+               pinctrl-0 = <&pinctrl_pmic>;
+               interrupt-parent = <&gpio2>;
+               /*
+                * The interrupt is not correct. It should be level low,
+                * however with internal pull up this causes IRQ storm.
+                */
+               interrupts = <8 IRQ_TYPE_EDGE_RISING>;
+               rohm,reset-snvs-powered;
+
+               #clock-cells = <0>;
+               clocks = <&osc_32k 0>;
+               clock-output-names = "clk-32k-out";
+
+               regulators {
+                       buck1_reg: BUCK1 {
+                               regulator-name = "buck1";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <1250>;
+                       };
+
+                       buck2_reg: BUCK2 {
+                               regulator-name = "buck2";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <1250>;
+                               rohm,dvs-run-voltage = <1000000>;
+                               rohm,dvs-idle-voltage = <900000>;
+                       };
+
+                       buck3_reg: BUCK3 {
+                               regulator-name = "buck3";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck4_reg: BUCK4 {
+                               regulator-name = "buck4";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck5_reg: BUCK5 {
+                               regulator-name = "buck5";
+                               regulator-min-microvolt = <1605000>;
+                               regulator-max-microvolt = <1995000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck6_reg: BUCK6 {
+                               regulator-name = "buck6";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1400000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo1_reg: LDO1 {
+                               regulator-name = "ldo1";
+                               regulator-min-microvolt = <1600000>;
+                               regulator-max-microvolt = <1900000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo2_reg: LDO2 {
+                               regulator-name = "ldo2";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <900000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo3_reg: LDO3 {
+                               regulator-name = "ldo3";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo4_reg: LDO4 {
+                               regulator-name = "ldo4";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo5_reg: LDO5 {
+                               regulator-compatible = "ldo5";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                       };
+
+                       ldo6_reg: LDO6 {
+                               regulator-name = "ldo6";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       /* TODO: configure audio, as of now just put a placeholder */
+       wm8904: codec@1a {
+               compatible = "wlf,wm8904";
+               reg = <0x1a>;
+               status = "disabled";
+       };
+};
+
+&snvs_pwrkey {
+       status = "okay";
+};
+
+/* Bluetooth */
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       assigned-clocks = <&clk IMX8MM_CLK_UART2>;
+       assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_80M>;
+       uart-has-rtscts;
+       status = "okay";
+};
+
+/* Console */
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4>;
+       status = "okay";
+};
+
+&usbotg1 {
+       dr_mode = "otg";
+       usb-role-switch;
+       status = "okay";
+};
+
+&usbotg2 {
+       dr_mode = "otg";
+       usb-role-switch;
+       status = "okay";
+};
+
+/* WIFI */
+&usdhc1 {
+       #address-cells = <1>;
+       #size-cells = <0>;
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc1>;
+       pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
+       bus-width = <4>;
+       non-removable;
+       keep-power-in-suspend;
+       status = "okay";
+
+       brcmf: bcrmf@1 {
+               reg = <1>;
+               compatible = "brcm,bcm4329-fmac";
+       };
+};
+
+/* SD */
+&usdhc2 {
+       assigned-clocks = <&clk IMX8MM_CLK_USDHC2>;
+       assigned-clock-rates = <200000000>;
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>;
+       pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>;
+       pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>;
+       cd-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+       bus-width = <4>;
+       vmmc-supply = <&reg_usdhc2_vmmc>;
+       status = "okay";
+};
+
+/* eMMC */
+&usdhc3 {
+       assigned-clocks = <&clk IMX8MM_CLK_USDHC3_ROOT>;
+       assigned-clock-rates = <400000000>;
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       bus-width = <8>;
+       non-removable;
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl_ecspi1: ecspi1grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK            0x13
+                       MX8MM_IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI            0x13
+                       MX8MM_IOMUXC_ECSPI1_MISO_ECSPI1_MISO            0x13
+                       MX8MM_IOMUXC_GPIO1_IO14_GPIO1_IO14              0x13
+                       MX8MM_IOMUXC_GPIO1_IO00_GPIO1_IO0               0x13
+               >;
+       };
+
+       pinctrl_fec1: fec1grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_ENET_MDC_ENET1_MDC                 0x3
+                       MX8MM_IOMUXC_ENET_MDIO_ENET1_MDIO               0x3
+                       MX8MM_IOMUXC_ENET_TD3_ENET1_RGMII_TD3           0x1f
+                       MX8MM_IOMUXC_ENET_TD2_ENET1_RGMII_TD2           0x1f
+                       MX8MM_IOMUXC_ENET_TD1_ENET1_RGMII_TD1           0x1f
+                       MX8MM_IOMUXC_ENET_TD0_ENET1_RGMII_TD0           0x1f
+                       MX8MM_IOMUXC_ENET_RD3_ENET1_RGMII_RD3           0x91
+                       MX8MM_IOMUXC_ENET_RD2_ENET1_RGMII_RD2           0x91
+                       MX8MM_IOMUXC_ENET_RD1_ENET1_RGMII_RD1           0x91
+                       MX8MM_IOMUXC_ENET_RD0_ENET1_RGMII_RD0           0x91
+                       MX8MM_IOMUXC_ENET_TXC_ENET1_RGMII_TXC           0x1f
+                       MX8MM_IOMUXC_ENET_RXC_ENET1_RGMII_RXC           0x91
+                       MX8MM_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL     0x91
+                       MX8MM_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL     0x1f
+                       MX8MM_IOMUXC_GPIO1_IO09_GPIO1_IO9               0x19
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_I2C1_SCL_I2C1_SCL          0x400001c3
+                       MX8MM_IOMUXC_I2C1_SDA_I2C1_SDA          0x400001c3
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL          0x400001c3
+                       MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA          0x400001c3
+               >;
+       };
+
+       pinctrl_pmic: pmicirqgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD1_DATA6_GPIO2_IO8        0x41
+               >;
+       };
+
+       pinctrl_reg_eth_phy: regethphygrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD1_DATA7_GPIO2_IO9        0x41
+               >;
+       };
+
+       pinctrl_restouch: restouchgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_GPIO1_IO03_GPIO1_IO3       0x1c0
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SAI3_TXFS_UART2_DCE_RX     0x140
+                       MX8MM_IOMUXC_SAI3_TXC_UART2_DCE_TX      0x140
+                       MX8MM_IOMUXC_SAI3_RXC_UART2_DCE_CTS_B   0x140
+                       MX8MM_IOMUXC_SAI3_RXD_UART2_DCE_RTS_B   0x140
+               >;
+       };
+
+       pinctrl_uart4: uart4grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_UART4_RXD_UART4_DCE_RX     0x140
+                       MX8MM_IOMUXC_UART4_TXD_UART4_DCE_TX     0x140
+               >;
+       };
+
+       pinctrl_usdhc1: usdhc1grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD1_CLK_USDHC1_CLK         0x190
+                       MX8MM_IOMUXC_SD1_CMD_USDHC1_CMD         0x1d0
+                       MX8MM_IOMUXC_SD1_DATA0_USDHC1_DATA0     0x1d0
+                       MX8MM_IOMUXC_SD1_DATA1_USDHC1_DATA1     0x1d0
+                       MX8MM_IOMUXC_SD1_DATA2_USDHC1_DATA2     0x1d0
+                       MX8MM_IOMUXC_SD1_DATA3_USDHC1_DATA3     0x1d0
+               >;
+       };
+
+       pinctrl_usdhc1_100mhz: usdhc1-100mhzgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD1_CLK_USDHC1_CLK         0x194
+                       MX8MM_IOMUXC_SD1_CMD_USDHC1_CMD         0x1d4
+                       MX8MM_IOMUXC_SD1_DATA0_USDHC1_DATA0     0x1d4
+                       MX8MM_IOMUXC_SD1_DATA1_USDHC1_DATA1     0x1d4
+                       MX8MM_IOMUXC_SD1_DATA2_USDHC1_DATA2     0x1d4
+                       MX8MM_IOMUXC_SD1_DATA3_USDHC1_DATA3     0x1d4
+               >;
+       };
+
+       pinctrl_usdhc1_200mhz: usdhc1-200mhzgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD1_CLK_USDHC1_CLK         0x196
+                       MX8MM_IOMUXC_SD1_CMD_USDHC1_CMD         0x1d6
+                       MX8MM_IOMUXC_SD1_DATA0_USDHC1_DATA0     0x1d6
+                       MX8MM_IOMUXC_SD1_DATA1_USDHC1_DATA1     0x1d6
+                       MX8MM_IOMUXC_SD1_DATA2_USDHC1_DATA2     0x1d6
+                       MX8MM_IOMUXC_SD1_DATA3_USDHC1_DATA3     0x1d6
+               >;
+       };
+
+       pinctrl_usdhc2_gpio: usdhc2gpiogrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_GPIO1_IO10_GPIO1_IO10      0xc1
+               >;
+       };
+
+       pinctrl_usdhc2: usdhc2grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK         0x190
+                       MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d0
+                       MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0     0x1d0
+                       MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1     0x1d0
+                       MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2     0x1d0
+                       MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3     0x1d0
+                       MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT  0x1d0
+               >;
+       };
+
+       pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK         0x194
+                       MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d4
+                       MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0     0x1d4
+                       MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1     0x1d4
+                       MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2     0x1d4
+                       MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3     0x1d4
+                       MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT  0x1d0
+               >;
+       };
+
+       pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK         0x196
+                       MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d6
+                       MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0     0x1d6
+                       MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1     0x1d6
+                       MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2     0x1d6
+                       MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3     0x1d6
+                       MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT  0x1d0
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_NAND_WE_B_USDHC3_CLK       0x190
+                       MX8MM_IOMUXC_NAND_WP_B_USDHC3_CMD       0x1d0
+                       MX8MM_IOMUXC_NAND_DATA04_USDHC3_DATA0   0x1d0
+                       MX8MM_IOMUXC_NAND_DATA05_USDHC3_DATA1   0x1d0
+                       MX8MM_IOMUXC_NAND_DATA06_USDHC3_DATA2   0x1d0
+                       MX8MM_IOMUXC_NAND_DATA07_USDHC3_DATA3   0x1d0
+                       MX8MM_IOMUXC_NAND_RE_B_USDHC3_DATA4     0x1d0
+                       MX8MM_IOMUXC_NAND_CE2_B_USDHC3_DATA5    0x1d0
+                       MX8MM_IOMUXC_NAND_CE3_B_USDHC3_DATA6    0x1d0
+                       MX8MM_IOMUXC_NAND_CLE_USDHC3_DATA7      0x1d0
+                       MX8MM_IOMUXC_NAND_CE1_B_USDHC3_STROBE   0x190
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3-100mhzgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_NAND_WE_B_USDHC3_CLK       0x194
+                       MX8MM_IOMUXC_NAND_WP_B_USDHC3_CMD       0x1d4
+                       MX8MM_IOMUXC_NAND_DATA04_USDHC3_DATA0   0x1d4
+                       MX8MM_IOMUXC_NAND_DATA05_USDHC3_DATA1   0x1d4
+                       MX8MM_IOMUXC_NAND_DATA06_USDHC3_DATA2   0x1d4
+                       MX8MM_IOMUXC_NAND_DATA07_USDHC3_DATA3   0x1d4
+                       MX8MM_IOMUXC_NAND_RE_B_USDHC3_DATA4     0x1d4
+                       MX8MM_IOMUXC_NAND_CE2_B_USDHC3_DATA5    0x1d4
+                       MX8MM_IOMUXC_NAND_CE3_B_USDHC3_DATA6    0x1d4
+                       MX8MM_IOMUXC_NAND_CLE_USDHC3_DATA7      0x1d4
+                       MX8MM_IOMUXC_NAND_CE1_B_USDHC3_STROBE   0x194
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3-200mhzgrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_NAND_WE_B_USDHC3_CLK       0x196
+                       MX8MM_IOMUXC_NAND_WP_B_USDHC3_CMD       0x1d6
+                       MX8MM_IOMUXC_NAND_DATA04_USDHC3_DATA0   0x1d6
+                       MX8MM_IOMUXC_NAND_DATA05_USDHC3_DATA1   0x1d6
+                       MX8MM_IOMUXC_NAND_DATA06_USDHC3_DATA2   0x1d6
+                       MX8MM_IOMUXC_NAND_DATA07_USDHC3_DATA3   0x1d6
+                       MX8MM_IOMUXC_NAND_RE_B_USDHC3_DATA4     0x1d6
+                       MX8MM_IOMUXC_NAND_CE2_B_USDHC3_DATA5    0x1d6
+                       MX8MM_IOMUXC_NAND_CE3_B_USDHC3_DATA6    0x1d6
+                       MX8MM_IOMUXC_NAND_CLE_USDHC3_DATA7      0x1d6
+                       MX8MM_IOMUXC_NAND_CE1_B_USDHC3_STROBE   0x196
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX8MM_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B    0xc6
+               >;
+       };
+};
index 76f040e..b83f400 100644 (file)
                                reg = <0x30be0000 0x10000>;
                                interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
                                             <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
+                                            <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
+                                            <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clk IMX8MM_CLK_ENET1_ROOT>,
                                         <&clk IMX8MM_CLK_ENET1_ROOT>,
                                         <&clk IMX8MM_CLK_ENET_TIMER>,
index a1e5483..46e76cf 100644 (file)
                reg = <0x4b>;
                pinctrl-0 = <&pinctrl_pmic>;
                interrupt-parent = <&gpio1>;
-               interrupts = <3 GPIO_ACTIVE_LOW>;
+               interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
                rohm,reset-snvs-powered;
 
                regulators {
                        buck1_reg: BUCK1 {
-                               regulator-name = "BUCK1";
+                               regulator-name = "buck1";
                                regulator-min-microvolt = <700000>;
                                regulator-max-microvolt = <1300000>;
                                regulator-boot-on;
@@ -69,7 +69,7 @@
                        };
 
                        buck2_reg: BUCK2 {
-                               regulator-name = "BUCK2";
+                               regulator-name = "buck2";
                                regulator-min-microvolt = <700000>;
                                regulator-max-microvolt = <1300000>;
                                regulator-boot-on;
 
                        buck3_reg: BUCK3 {
                                // BUCK5 in datasheet
-                               regulator-name = "BUCK3";
+                               regulator-name = "buck3";
                                regulator-min-microvolt = <700000>;
                                regulator-max-microvolt = <1350000>;
                        };
 
                        buck4_reg: BUCK4 {
                                // BUCK6 in datasheet
-                               regulator-name = "BUCK4";
+                               regulator-name = "buck4";
                                regulator-min-microvolt = <3000000>;
                                regulator-max-microvolt = <3300000>;
                                regulator-boot-on;
@@ -95,7 +95,7 @@
 
                        buck5_reg: BUCK5 {
                                // BUCK7 in datasheet
-                               regulator-name = "BUCK5";
+                               regulator-name = "buck5";
                                regulator-min-microvolt = <1605000>;
                                regulator-max-microvolt = <1995000>;
                                regulator-boot-on;
 
                        buck6_reg: BUCK6 {
                                // BUCK8 in datasheet
-                               regulator-name = "BUCK6";
+                               regulator-name = "buck6";
                                regulator-min-microvolt = <800000>;
                                regulator-max-microvolt = <1400000>;
                                regulator-boot-on;
                        };
 
                        ldo1_reg: LDO1 {
-                               regulator-name = "LDO1";
+                               regulator-name = "ldo1";
                                regulator-min-microvolt = <1600000>;
                                regulator-max-microvolt = <3300000>;
                                regulator-boot-on;
                        };
 
                        ldo2_reg: LDO2 {
-                               regulator-name = "LDO2";
+                               regulator-name = "ldo2";
                                regulator-min-microvolt = <800000>;
                                regulator-max-microvolt = <900000>;
                                regulator-boot-on;
                        };
 
                        ldo3_reg: LDO3 {
-                               regulator-name = "LDO3";
+                               regulator-name = "ldo3";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <3300000>;
                                regulator-boot-on;
                        };
 
                        ldo4_reg: LDO4 {
-                               regulator-name = "LDO4";
+                               regulator-name = "ldo4";
                                regulator-min-microvolt = <900000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-boot-on;
                        };
 
                        ldo6_reg: LDO6 {
-                               regulator-name = "LDO6";
+                               regulator-name = "ldo6";
                                regulator-min-microvolt = <900000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-boot-on;
                };
        };
 };
-
-&iomuxc {
-       pinctrl_pmic: pmicirq {
-               fsl,pins = <
-                       MX8MN_IOMUXC_GPIO1_IO03_GPIO1_IO3       0x41
-               >;
-       };
-};
index b846526..707d848 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "imx8mn.dtsi"
 #include "imx8mn-evk.dtsi"
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        model = "NXP i.MX8MNano EVK board";
@@ -19,7 +20,7 @@
                reg = <0x25>;
                pinctrl-0 = <&pinctrl_pmic>;
                interrupt-parent = <&gpio1>;
-               interrupts = <3 GPIO_ACTIVE_LOW>;
+               interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
 
                regulators {
                        buck1: BUCK1{
index 98f5324..4aa0dbd 100644 (file)
        srp-disable;
        adp-disable;
        usb-role-switch;
+       samsung,picophy-pre-emp-curr-control = <3>;
+       samsung,picophy-dc-vol-level-adjust = <7>;
        status = "okay";
 
        port {
 };
 
 &iomuxc {
-       pinctrl-names = "default";
-
        pinctrl_fec1: fec1grp {
                fsl,pins = <
                        MX8MN_IOMUXC_ENET_MDC_ENET1_MDC         0x3
                >;
        };
 
-       pinctrl_pmic: pmicirq {
+       pinctrl_pmic: pmicirqgrp {
                fsl,pins = <
-                       MX8MN_IOMUXC_GPIO1_IO03_GPIO1_IO3       0x41
+                       MX8MN_IOMUXC_GPIO1_IO03_GPIO1_IO3       0x141
                >;
        };
 
-       pinctrl_reg_usdhc2_vmmc: regusdhc2vmmc {
+       pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp {
                fsl,pins = <
                        MX8MN_IOMUXC_SD2_RESET_B_GPIO2_IO19     0x41
                >;
                >;
        };
 
-       pinctrl_usdhc2_gpio: usdhc2grpgpio {
+       pinctrl_usdhc2_gpio: usdhc2gpiogrp {
                fsl,pins = <
                        MX8MN_IOMUXC_GPIO1_IO15_GPIO1_IO15      0x1c4
                >;
                >;
        };
 
-       pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
+       pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
                fsl,pins = <
                        MX8MN_IOMUXC_SD2_CLK_USDHC2_CLK         0x194
                        MX8MN_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d4
                >;
        };
 
-       pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
+       pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
                fsl,pins = <
                        MX8MN_IOMUXC_SD2_CLK_USDHC2_CLK         0x196
                        MX8MN_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d6
                >;
        };
 
-       pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+       pinctrl_usdhc3_100mhz: usdhc3-100mhzgrp {
                fsl,pins = <
                        MX8MN_IOMUXC_NAND_WE_B_USDHC3_CLK               0x40000194
                        MX8MN_IOMUXC_NAND_WP_B_USDHC3_CMD               0x1d4
                >;
        };
 
-       pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+       pinctrl_usdhc3_200mhz: usdhc3-200mhzgrp {
                fsl,pins = <
                        MX8MN_IOMUXC_NAND_WE_B_USDHC3_CLK               0x40000196
                        MX8MN_IOMUXC_NAND_WP_B_USDHC3_CMD               0x1d6
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts b/arch/arm64/boot/dts/freescale/imx8mn-var-som-symphony.dts
new file mode 100644 (file)
index 0000000..f61c487
--- /dev/null
@@ -0,0 +1,240 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2019-2020 Variscite Ltd.
+ * Copyright (C) 2020 Krzysztof Kozlowski <krzk@kernel.org>
+ */
+
+/dts-v1/;
+
+#include "imx8mn-var-som.dtsi"
+
+/ {
+       model = "Variscite VAR-SOM-MX8MN Symphony evaluation board";
+       compatible = "variscite,var-som-mx8mn-symphony", "variscite,var-som-mx8mn", "fsl,imx8mn";
+
+       reg_usdhc2_vmmc: regulator-usdhc2-vmmc {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_usdhc2_vmmc>;
+               regulator-name = "VSD_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpio4 22 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               back {
+                       label = "Back";
+                       gpios = <&pca9534 1 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_BACK>;
+               };
+
+               home {
+                       label = "Home";
+                       gpios = <&pca9534 2 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_HOME>;
+               };
+
+               menu {
+                       label = "Menu";
+                       gpios = <&pca9534 3 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_MENU>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led {
+                       label = "Heartbeat";
+                       gpios = <&pca9534 0 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+};
+
+&ethphy {
+       reset-gpios = <&pca9534 5 GPIO_ACTIVE_HIGH>;
+};
+
+&i2c2 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       pca9534: gpio@20 {
+               compatible = "nxp,pca9534";
+               reg = <0x20>;
+               gpio-controller;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pca9534>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
+               #gpio-cells = <2>;
+               wakeup-source;
+
+               /* USB 3.0 OTG (usbotg1) / SATA port switch, set to USB 3.0 */
+               usb3-sata-sel-hog {
+                       gpio-hog;
+                       gpios = <4 GPIO_ACTIVE_HIGH>;
+                       output-low;
+                       line-name = "usb3_sata_sel";
+               };
+
+               som-vselect-hog {
+                       gpio-hog;
+                       gpios = <6 GPIO_ACTIVE_HIGH>;
+                       output-low;
+                       line-name = "som_vselect";
+               };
+
+               enet-sel-hog {
+                       gpio-hog;
+                       gpios = <7 GPIO_ACTIVE_HIGH>;
+                       output-low;
+                       line-name = "enet_sel";
+               };
+       };
+
+       extcon_usbotg1: typec@3d {
+               compatible = "nxp,ptn5150";
+               reg = <0x3d>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_ptn5150>;
+               status = "okay";
+       };
+};
+
+&i2c3 {
+       /* Capacitive touch controller */
+       ft5x06_ts: touchscreen@38 {
+               compatible = "edt,edt-ft5406";
+               reg = <0x38>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_captouch>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <4 IRQ_TYPE_LEVEL_HIGH>;
+
+               touchscreen-size-x = <800>;
+               touchscreen-size-y = <480>;
+               touchscreen-inverted-x;
+               touchscreen-inverted-y;
+       };
+
+       rtc@68 {
+               compatible = "dallas,ds1337";
+               reg = <0x68>;
+       };
+};
+
+/* Header */
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+/* Header */
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&usbotg1 {
+       disable-over-current;
+       extcon = <&extcon_usbotg1>, <&extcon_usbotg1>;
+};
+
+&pinctrl_fec1 {
+       fsl,pins = <
+               MX8MN_IOMUXC_ENET_MDC_ENET1_MDC                 0x3
+               MX8MN_IOMUXC_ENET_MDIO_ENET1_MDIO               0x3
+               MX8MN_IOMUXC_ENET_TD3_ENET1_RGMII_TD3           0x1f
+               MX8MN_IOMUXC_ENET_TD2_ENET1_RGMII_TD2           0x1f
+               MX8MN_IOMUXC_ENET_TD1_ENET1_RGMII_TD1           0x1f
+               MX8MN_IOMUXC_ENET_TD0_ENET1_RGMII_TD0           0x1f
+               MX8MN_IOMUXC_ENET_RD3_ENET1_RGMII_RD3           0x91
+               MX8MN_IOMUXC_ENET_RD2_ENET1_RGMII_RD2           0x91
+               MX8MN_IOMUXC_ENET_RD1_ENET1_RGMII_RD1           0x91
+               MX8MN_IOMUXC_ENET_RD0_ENET1_RGMII_RD0           0x91
+               MX8MN_IOMUXC_ENET_TXC_ENET1_RGMII_TXC           0x1f
+               MX8MN_IOMUXC_ENET_RXC_ENET1_RGMII_RXC           0x91
+               MX8MN_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL     0x91
+               MX8MN_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL     0x1f
+               /* Remove the MX8MM_IOMUXC_GPIO1_IO09_GPIO1_IO9 as not used */
+       >;
+};
+
+&pinctrl_fec1_sleep {
+       fsl,pins = <
+               MX8MN_IOMUXC_ENET_MDC_GPIO1_IO16                0x120
+               MX8MN_IOMUXC_ENET_MDIO_GPIO1_IO17               0x120
+               MX8MN_IOMUXC_ENET_TD3_GPIO1_IO18                0x120
+               MX8MN_IOMUXC_ENET_TD2_GPIO1_IO19                0x120
+               MX8MN_IOMUXC_ENET_TD1_GPIO1_IO20                0x120
+               MX8MN_IOMUXC_ENET_TD0_GPIO1_IO21                0x120
+               MX8MN_IOMUXC_ENET_RD3_GPIO1_IO29                0x120
+               MX8MN_IOMUXC_ENET_RD2_GPIO1_IO28                0x120
+               MX8MN_IOMUXC_ENET_RD1_GPIO1_IO27                0x120
+               MX8MN_IOMUXC_ENET_RD0_GPIO1_IO26                0x120
+               MX8MN_IOMUXC_ENET_TXC_GPIO1_IO23                0x120
+               MX8MN_IOMUXC_ENET_RXC_GPIO1_IO25                0x120
+               MX8MN_IOMUXC_ENET_RX_CTL_GPIO1_IO24             0x120
+               MX8MN_IOMUXC_ENET_TX_CTL_GPIO1_IO22             0x120
+               /* Remove the MX8MM_IOMUXC_GPIO1_IO09_GPIO1_IO9 as not used */
+       >;
+};
+
+&iomuxc {
+       pinctrl_captouch: captouchgrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_SPDIF_RX_GPIO5_IO4         0x16
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_I2C2_SCL_I2C2_SCL          0x400001c3
+                       MX8MN_IOMUXC_I2C2_SDA_I2C2_SDA          0x400001c3
+               >;
+       };
+
+       pinctrl_pca9534: pca9534grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_GPIO1_IO07_GPIO1_IO7       0x16
+               >;
+       };
+
+       pinctrl_ptn5150: ptn5150grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_GPIO1_IO11_GPIO1_IO11      0x16
+               >;
+       };
+
+       pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_SAI2_RXC_GPIO4_IO22        0x41
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_UART1_RXD_UART1_DCE_RX     0x140
+                       MX8MN_IOMUXC_UART1_TXD_UART1_DCE_TX     0x140
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_UART3_RXD_UART3_DCE_RX     0x140
+                       MX8MN_IOMUXC_UART3_TXD_UART3_DCE_TX     0x140
+               >;
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-var-som.dtsi b/arch/arm64/boot/dts/freescale/imx8mn-var-som.dtsi
new file mode 100644 (file)
index 0000000..a2d0190
--- /dev/null
@@ -0,0 +1,551 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2019 NXP
+ * Copyright 2019-2020 Variscite Ltd.
+ * Copyright (C) 2020 Krzysztof Kozlowski <krzk@kernel.org>
+ */
+
+#include "imx8mn.dtsi"
+
+/ {
+       model = "Variscite VAR-SOM-MX8MN module";
+       compatible = "variscite,var-som-mx8mn", "fsl,imx8mn";
+
+       chosen {
+               stdout-path = &uart4;
+       };
+
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x0 0x40000000 0 0x40000000>;
+       };
+
+       reg_eth_phy: regulator-eth-phy {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_eth_phy>;
+               regulator-name = "eth_phy_pwr";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpio2 9 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+};
+
+&A53_0 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&A53_1 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&A53_2 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&A53_3 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&ecspi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi1>;
+       cs-gpios = <&gpio1 14 GPIO_ACTIVE_LOW>,
+                  <&gpio1  0 GPIO_ACTIVE_LOW>;
+       /delete-property/ dmas;
+       /delete-property/ dma-names;
+       status = "okay";
+
+       /* Resistive touch controller */
+       touchscreen@0 {
+               reg = <0>;
+               compatible = "ti,ads7846";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_restouch>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
+
+               spi-max-frequency = <1500000>;
+               pendown-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>;
+
+               ti,x-min = /bits/ 16 <125>;
+               touchscreen-size-x = /bits/ 16 <4008>;
+               ti,y-min = /bits/ 16 <282>;
+               touchscreen-size-y = /bits/ 16 <3864>;
+               ti,x-plate-ohms = /bits/ 16 <180>;
+               touchscreen-max-pressure = /bits/ 16 <255>;
+               touchscreen-average-samples = /bits/ 16 <10>;
+               ti,debounce-tol = /bits/ 16 <3>;
+               ti,debounce-rep = /bits/ 16 <1>;
+               ti,settle-delay-usec = /bits/ 16 <150>;
+               ti,keep-vref-on;
+               wakeup-source;
+       };
+};
+
+&fec1 {
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&pinctrl_fec1>;
+       pinctrl-1 = <&pinctrl_fec1_sleep>;
+       phy-mode = "rgmii";
+       phy-handle = <&ethphy>;
+       phy-supply = <&reg_eth_phy>;
+       fsl,magic-packet;
+       status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ethphy: ethernet-phy@4 {
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       reg = <4>;
+                       reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+                       reset-assert-us = <10000>;
+               };
+       };
+};
+
+&i2c1 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       pmic@4b {
+               compatible = "rohm,bd71847";
+               reg = <0x4b>;
+               pinctrl-0 = <&pinctrl_pmic>;
+               interrupt-parent = <&gpio2>;
+               /*
+                * The interrupt is not correct. It should be level low,
+                * however with internal pull up this causes IRQ storm.
+                */
+               interrupts = <8 IRQ_TYPE_EDGE_RISING>;
+               rohm,reset-snvs-powered;
+
+               regulators {
+                       buck1_reg: BUCK1 {
+                               regulator-name = "buck1";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <1250>;
+                       };
+
+                       buck2_reg: BUCK2 {
+                               regulator-name = "buck2";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <1250>;
+                               rohm,dvs-run-voltage = <1000000>;
+                               rohm,dvs-idle-voltage = <900000>;
+                       };
+
+                       buck3_reg: BUCK3 {
+                               regulator-name = "buck3";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck4_reg: BUCK4 {
+                               regulator-name = "buck4";
+                               regulator-min-microvolt = <2600000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck5_reg: BUCK5 {
+                               regulator-name = "buck5";
+                               regulator-min-microvolt = <1605000>;
+                               regulator-max-microvolt = <1995000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck6_reg: BUCK6 {
+                               regulator-name = "buck6";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1400000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo1_reg: LDO1 {
+                               regulator-name = "ldo1";
+                               regulator-min-microvolt = <1600000>;
+                               regulator-max-microvolt = <1900000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo2_reg: LDO2 {
+                               regulator-name = "ldo2";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <900000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo3_reg: LDO3 {
+                               regulator-name = "ldo3";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo4_reg: LDO4 {
+                               regulator-name = "ldo4";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                       };
+
+                       ldo5_reg: LDO5 {
+                               regulator-compatible = "ldo5";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                       };
+
+                       ldo6_reg: LDO6 {
+                               regulator-name = "ldo6";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       /* TODO: configure audio, as of now just put a placeholder */
+       wm8904: codec@1a {
+               compatible = "wlf,wm8904";
+               reg = <0x1a>;
+               status = "disabled";
+       };
+};
+
+&snvs_pwrkey {
+       status = "okay";
+};
+
+/* Bluetooth */
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       assigned-clocks = <&clk IMX8MN_CLK_UART2>;
+       assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_80M>;
+       uart-has-rtscts;
+       status = "okay";
+};
+
+/* Console */
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4>;
+       status = "okay";
+};
+
+&usbotg1 {
+       dr_mode = "otg";
+       usb-role-switch;
+       status = "okay";
+};
+
+/* WIFI */
+&usdhc1 {
+       #address-cells = <1>;
+       #size-cells = <0>;
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc1>;
+       pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
+       bus-width = <4>;
+       non-removable;
+       keep-power-in-suspend;
+       status = "okay";
+
+       brcmf: bcrmf@1 {
+               reg = <1>;
+               compatible = "brcm,bcm4329-fmac";
+       };
+};
+
+/* SD */
+&usdhc2 {
+       assigned-clocks = <&clk IMX8MN_CLK_USDHC2>;
+       assigned-clock-rates = <200000000>;
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>;
+       pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>;
+       pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>;
+       cd-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+       bus-width = <4>;
+       vmmc-supply = <&reg_usdhc2_vmmc>;
+       status = "okay";
+};
+
+/* eMMC */
+&usdhc3 {
+       assigned-clocks = <&clk IMX8MN_CLK_USDHC3_ROOT>;
+       assigned-clock-rates = <400000000>;
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       bus-width = <8>;
+       non-removable;
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl_ecspi1: ecspi1grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK            0x13
+                       MX8MN_IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI            0x13
+                       MX8MN_IOMUXC_ECSPI1_MISO_ECSPI1_MISO            0x13
+                       MX8MN_IOMUXC_GPIO1_IO14_GPIO1_IO14              0x13
+                       MX8MN_IOMUXC_GPIO1_IO00_GPIO1_IO0               0x13
+               >;
+       };
+
+       pinctrl_fec1: fec1grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_ENET_MDC_ENET1_MDC                 0x3
+                       MX8MN_IOMUXC_ENET_MDIO_ENET1_MDIO               0x3
+                       MX8MN_IOMUXC_ENET_TD3_ENET1_RGMII_TD3           0x1f
+                       MX8MN_IOMUXC_ENET_TD2_ENET1_RGMII_TD2           0x1f
+                       MX8MN_IOMUXC_ENET_TD1_ENET1_RGMII_TD1           0x1f
+                       MX8MN_IOMUXC_ENET_TD0_ENET1_RGMII_TD0           0x1f
+                       MX8MN_IOMUXC_ENET_RD3_ENET1_RGMII_RD3           0x91
+                       MX8MN_IOMUXC_ENET_RD2_ENET1_RGMII_RD2           0x91
+                       MX8MN_IOMUXC_ENET_RD1_ENET1_RGMII_RD1           0x91
+                       MX8MN_IOMUXC_ENET_RD0_ENET1_RGMII_RD0           0x91
+                       MX8MN_IOMUXC_ENET_TXC_ENET1_RGMII_TXC           0x1f
+                       MX8MN_IOMUXC_ENET_RXC_ENET1_RGMII_RXC           0x91
+                       MX8MN_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL     0x91
+                       MX8MN_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL     0x1f
+                       MX8MN_IOMUXC_GPIO1_IO09_GPIO1_IO9               0x19
+               >;
+       };
+
+       pinctrl_fec1_sleep: fec1sleepgrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_ENET_MDC_GPIO1_IO16                0x120
+                       MX8MN_IOMUXC_ENET_MDIO_GPIO1_IO17               0x120
+                       MX8MN_IOMUXC_ENET_TD3_GPIO1_IO18                0x120
+                       MX8MN_IOMUXC_ENET_TD2_GPIO1_IO19                0x120
+                       MX8MN_IOMUXC_ENET_TD1_GPIO1_IO20                0x120
+                       MX8MN_IOMUXC_ENET_TD0_GPIO1_IO21                0x120
+                       MX8MN_IOMUXC_ENET_RD3_GPIO1_IO29                0x120
+                       MX8MN_IOMUXC_ENET_RD2_GPIO1_IO28                0x120
+                       MX8MN_IOMUXC_ENET_RD1_GPIO1_IO27                0x120
+                       MX8MN_IOMUXC_ENET_RD0_GPIO1_IO26                0x120
+                       MX8MN_IOMUXC_ENET_TXC_GPIO1_IO23                0x120
+                       MX8MN_IOMUXC_ENET_RXC_GPIO1_IO25                0x120
+                       MX8MN_IOMUXC_ENET_RX_CTL_GPIO1_IO24             0x120
+                       MX8MN_IOMUXC_ENET_TX_CTL_GPIO1_IO22             0x120
+                       MX8MN_IOMUXC_GPIO1_IO09_GPIO1_IO9               0x120
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_I2C1_SCL_I2C1_SCL          0x400001c3
+                       MX8MN_IOMUXC_I2C1_SDA_I2C1_SDA          0x400001c3
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_I2C3_SCL_I2C3_SCL          0x400001c3
+                       MX8MN_IOMUXC_I2C3_SDA_I2C3_SDA          0x400001c3
+               >;
+       };
+
+       pinctrl_pmic: pmicirqgrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_SD1_DATA6_GPIO2_IO8        0x101
+               >;
+       };
+
+       pinctrl_reg_eth_phy: regethphygrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_SD1_DATA7_GPIO2_IO9        0x41
+               >;
+       };
+
+       pinctrl_restouch: restouchgrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_GPIO1_IO03_GPIO1_IO3       0x1c0
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_SAI3_TXFS_UART2_DCE_RX     0x140
+                       MX8MN_IOMUXC_SAI3_TXC_UART2_DCE_TX      0x140
+                       MX8MN_IOMUXC_SAI3_RXC_UART2_DCE_CTS_B   0x140
+                       MX8MN_IOMUXC_SAI3_RXD_UART2_DCE_RTS_B   0x140
+               >;
+       };
+
+       pinctrl_uart4: uart4grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_UART4_RXD_UART4_DCE_RX     0x140
+                       MX8MN_IOMUXC_UART4_TXD_UART4_DCE_TX     0x140
+               >;
+       };
+
+       pinctrl_usdhc1: usdhc1grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_SD1_CLK_USDHC1_CLK         0x190
+                       MX8MN_IOMUXC_SD1_CMD_USDHC1_CMD         0x1d0
+                       MX8MN_IOMUXC_SD1_DATA0_USDHC1_DATA0     0x1d0
+                       MX8MN_IOMUXC_SD1_DATA1_USDHC1_DATA1     0x1d0
+                       MX8MN_IOMUXC_SD1_DATA2_USDHC1_DATA2     0x1d0
+                       MX8MN_IOMUXC_SD1_DATA3_USDHC1_DATA3     0x1d0
+               >;
+       };
+
+       pinctrl_usdhc1_100mhz: usdhc1-100mhzgrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_SD1_CLK_USDHC1_CLK         0x194
+                       MX8MN_IOMUXC_SD1_CMD_USDHC1_CMD         0x1d4
+                       MX8MN_IOMUXC_SD1_DATA0_USDHC1_DATA0     0x1d4
+                       MX8MN_IOMUXC_SD1_DATA1_USDHC1_DATA1     0x1d4
+                       MX8MN_IOMUXC_SD1_DATA2_USDHC1_DATA2     0x1d4
+                       MX8MN_IOMUXC_SD1_DATA3_USDHC1_DATA3     0x1d4
+               >;
+       };
+
+       pinctrl_usdhc1_200mhz: usdhc1-200mhzgrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_SD1_CLK_USDHC1_CLK         0x196
+                       MX8MN_IOMUXC_SD1_CMD_USDHC1_CMD         0x1d6
+                       MX8MN_IOMUXC_SD1_DATA0_USDHC1_DATA0     0x1d6
+                       MX8MN_IOMUXC_SD1_DATA1_USDHC1_DATA1     0x1d6
+                       MX8MN_IOMUXC_SD1_DATA2_USDHC1_DATA2     0x1d6
+                       MX8MN_IOMUXC_SD1_DATA3_USDHC1_DATA3     0x1d6
+               >;
+       };
+
+       pinctrl_usdhc2_gpio: usdhc2gpiogrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_GPIO1_IO10_GPIO1_IO10      0x41
+               >;
+       };
+
+       pinctrl_usdhc2: usdhc2grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_SD2_CLK_USDHC2_CLK         0x190
+                       MX8MN_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d0
+                       MX8MN_IOMUXC_SD2_DATA0_USDHC2_DATA0     0x1d0
+                       MX8MN_IOMUXC_SD2_DATA1_USDHC2_DATA1     0x1d0
+                       MX8MN_IOMUXC_SD2_DATA2_USDHC2_DATA2     0x1d0
+                       MX8MN_IOMUXC_SD2_DATA3_USDHC2_DATA3     0x1d0
+                       MX8MN_IOMUXC_GPIO1_IO04_USDHC2_VSELECT  0x1d0
+               >;
+       };
+
+       pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_SD2_CLK_USDHC2_CLK         0x194
+                       MX8MN_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d4
+                       MX8MN_IOMUXC_SD2_DATA0_USDHC2_DATA0     0x1d4
+                       MX8MN_IOMUXC_SD2_DATA1_USDHC2_DATA1     0x1d4
+                       MX8MN_IOMUXC_SD2_DATA2_USDHC2_DATA2     0x1d4
+                       MX8MN_IOMUXC_SD2_DATA3_USDHC2_DATA3     0x1d4
+                       MX8MN_IOMUXC_GPIO1_IO04_USDHC2_VSELECT  0x1d0
+               >;
+       };
+
+       pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_SD2_CLK_USDHC2_CLK         0x196
+                       MX8MN_IOMUXC_SD2_CMD_USDHC2_CMD         0x1d6
+                       MX8MN_IOMUXC_SD2_DATA0_USDHC2_DATA0     0x1d6
+                       MX8MN_IOMUXC_SD2_DATA1_USDHC2_DATA1     0x1d6
+                       MX8MN_IOMUXC_SD2_DATA2_USDHC2_DATA2     0x1d6
+                       MX8MN_IOMUXC_SD2_DATA3_USDHC2_DATA3     0x1d6
+                       MX8MN_IOMUXC_GPIO1_IO04_USDHC2_VSELECT  0x1d0
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_NAND_WE_B_USDHC3_CLK       0x190
+                       MX8MN_IOMUXC_NAND_WP_B_USDHC3_CMD       0x1d0
+                       MX8MN_IOMUXC_NAND_DATA04_USDHC3_DATA0   0x1d0
+                       MX8MN_IOMUXC_NAND_DATA05_USDHC3_DATA1   0x1d0
+                       MX8MN_IOMUXC_NAND_DATA06_USDHC3_DATA2   0x1d0
+                       MX8MN_IOMUXC_NAND_DATA07_USDHC3_DATA3   0x1d0
+                       MX8MN_IOMUXC_NAND_RE_B_USDHC3_DATA4     0x1d0
+                       MX8MN_IOMUXC_NAND_CE2_B_USDHC3_DATA5    0x1d0
+                       MX8MN_IOMUXC_NAND_CE3_B_USDHC3_DATA6    0x1d0
+                       MX8MN_IOMUXC_NAND_CLE_USDHC3_DATA7      0x1d0
+                       MX8MN_IOMUXC_NAND_CE1_B_USDHC3_STROBE   0x190
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3-100mhzgrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_NAND_WE_B_USDHC3_CLK       0x194
+                       MX8MN_IOMUXC_NAND_WP_B_USDHC3_CMD       0x1d4
+                       MX8MN_IOMUXC_NAND_DATA04_USDHC3_DATA0   0x1d4
+                       MX8MN_IOMUXC_NAND_DATA05_USDHC3_DATA1   0x1d4
+                       MX8MN_IOMUXC_NAND_DATA06_USDHC3_DATA2   0x1d4
+                       MX8MN_IOMUXC_NAND_DATA07_USDHC3_DATA3   0x1d4
+                       MX8MN_IOMUXC_NAND_RE_B_USDHC3_DATA4     0x1d4
+                       MX8MN_IOMUXC_NAND_CE2_B_USDHC3_DATA5    0x1d4
+                       MX8MN_IOMUXC_NAND_CE3_B_USDHC3_DATA6    0x1d4
+                       MX8MN_IOMUXC_NAND_CLE_USDHC3_DATA7      0x1d4
+                       MX8MN_IOMUXC_NAND_CE1_B_USDHC3_STROBE   0x194
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3-200mhzgrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_NAND_WE_B_USDHC3_CLK       0x196
+                       MX8MN_IOMUXC_NAND_WP_B_USDHC3_CMD       0x1d6
+                       MX8MN_IOMUXC_NAND_DATA04_USDHC3_DATA0   0x1d6
+                       MX8MN_IOMUXC_NAND_DATA05_USDHC3_DATA1   0x1d6
+                       MX8MN_IOMUXC_NAND_DATA06_USDHC3_DATA2   0x1d6
+                       MX8MN_IOMUXC_NAND_DATA07_USDHC3_DATA3   0x1d6
+                       MX8MN_IOMUXC_NAND_RE_B_USDHC3_DATA4     0x1d6
+                       MX8MN_IOMUXC_NAND_CE2_B_USDHC3_DATA5    0x1d6
+                       MX8MN_IOMUXC_NAND_CE3_B_USDHC3_DATA6    0x1d6
+                       MX8MN_IOMUXC_NAND_CLE_USDHC3_DATA7      0x1d6
+                       MX8MN_IOMUXC_NAND_CE1_B_USDHC3_STROBE   0x196
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B    0xc6
+               >;
+       };
+};
index 9385dd7..746faf1 100644 (file)
                                reg = <0x30be0000 0x10000>;
                                interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
                                             <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
+                                            <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
+                                            <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clk IMX8MN_CLK_ENET1_ROOT>,
                                         <&clk IMX8MN_CLK_ENET1_ROOT>,
                                         <&clk IMX8MN_CLK_ENET_TIMER>,
index 3da1fff..ad66f12 100644 (file)
 };
 
 &iomuxc {
-       pinctrl-names = "default";
-
        pinctrl_fec: fecgrp {
                fsl,pins = <
                        MX8MP_IOMUXC_SAI1_RXD2__ENET1_MDC               0x3
                >;
        };
 
-       pinctrl_reg_usdhc2_vmmc: regusdhc2vmmc {
+       pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp {
                fsl,pins = <
                        MX8MP_IOMUXC_SD2_RESET_B__GPIO2_IO19    0x41
                >;
                >;
        };
 
-       pinctrl_usdhc2_100mhz: usdhc2grp-100mhz {
+       pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
                fsl,pins = <
                        MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK        0x194
                        MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD        0x1d4
                >;
        };
 
-       pinctrl_usdhc2_200mhz: usdhc2grp-200mhz {
+       pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
                fsl,pins = <
                        MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK        0x196
                        MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD        0x1d6
                >;
        };
 
-       pinctrl_usdhc2_gpio: usdhc2grp-gpio {
+       pinctrl_usdhc2_gpio: usdhc2gpiogrp {
                fsl,pins = <
                        MX8MP_IOMUXC_SD2_CD_B__GPIO2_IO12       0x1c4
                >;
                >;
        };
 
-       pinctrl_usdhc3_100mhz: usdhc3grp-100mhz {
+       pinctrl_usdhc3_100mhz: usdhc3-100mhzgrp {
                fsl,pins = <
                        MX8MP_IOMUXC_NAND_WE_B__USDHC3_CLK      0x194
                        MX8MP_IOMUXC_NAND_WP_B__USDHC3_CMD      0x1d4
                >;
        };
 
-       pinctrl_usdhc3_200mhz: usdhc3grp-200mhz {
+       pinctrl_usdhc3_200mhz: usdhc3-200mhzgrp {
                fsl,pins = <
                        MX8MP_IOMUXC_NAND_WE_B__USDHC3_CLK      0x196
                        MX8MP_IOMUXC_NAND_WP_B__USDHC3_CMD      0x1d6
index 319ab34..0fef066 100644 (file)
  * <mux_reg conf_reg input_reg mux_mode input_val>
  */
 #define MX8MP_IOMUXC_GPIO1_IO00__GPIO1_IO00                          0x014 0x274 0x000 0x0 0x0
-#define MX8MP_IOMUXC_GPIO1_IO00__CCMSRCGPCMIX_ENET_PHY_REF_CLK_ROOT  0x014 0x274 0x000 0x1 0x0
-#define MX8MP_IOMUXC_GPIO1_IO00__MEDIAMIX_ISP_FL_TRIG_0              0x014 0x274 0x5D4 0x3 0x0
-#define MX8MP_IOMUXC_GPIO1_IO00__ANAMIX_REF_CLK_32K                  0x014 0x274 0x000 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO00__CCMSRCGPCMIX_EXT_CLK1               0x014 0x274 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO00__SJC_FAIL                            0x014 0x274 0x000 0x7 0x0
+#define MX8MP_IOMUXC_GPIO1_IO00__CCM_ENET_PHY_REF_CLK_ROOT           0x014 0x274 0x000 0x1 0x0
+#define MX8MP_IOMUXC_GPIO1_IO00__ISP_FL_TRIG_0                       0x014 0x274 0x5D4 0x3 0x0
+#define MX8MP_IOMUXC_GPIO1_IO00__CCM_EXT_CLK1                        0x014 0x274 0x000 0x6 0x0
 #define MX8MP_IOMUXC_GPIO1_IO01__GPIO1_IO01                          0x018 0x278 0x000 0x0 0x0
 #define MX8MP_IOMUXC_GPIO1_IO01__PWM1_OUT                            0x018 0x278 0x000 0x1 0x0
-#define MX8MP_IOMUXC_GPIO1_IO01__MEDIAMIX_ISP_SHUTTER_TRIG_0         0x018 0x278 0x5DC 0x3 0x0
-#define MX8MP_IOMUXC_GPIO1_IO01__ANAMIX_REF_CLK_24M                  0x018 0x278 0x000 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO01__CCMSRCGPCMIX_EXT_CLK2               0x018 0x278 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO01__SJC_ACTIVE                          0x018 0x278 0x000 0x7 0x0
+#define MX8MP_IOMUXC_GPIO1_IO01__ISP_SHUTTER_TRIG_0                  0x018 0x278 0x5DC 0x3 0x0
+#define MX8MP_IOMUXC_GPIO1_IO01__CCM_EXT_CLK2                        0x018 0x278 0x000 0x6 0x0
 #define MX8MP_IOMUXC_GPIO1_IO02__GPIO1_IO02                          0x01C 0x27C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_GPIO1_IO02__WDOG1_WDOG_B                        0x01C 0x27C 0x000 0x1 0x0
-#define MX8MP_IOMUXC_GPIO1_IO02__MEDIAMIX_ISP_FLASH_TRIG_0           0x01C 0x27C 0x000 0x3 0x0
+#define MX8MP_IOMUXC_GPIO1_IO02__ISP_FLASH_TRIG_0                    0x01C 0x27C 0x000 0x3 0x0
 #define MX8MP_IOMUXC_GPIO1_IO02__WDOG1_WDOG_ANY                      0x01C 0x27C 0x000 0x5 0x0
 #define MX8MP_IOMUXC_GPIO1_IO02__SJC_DE_B                            0x01C 0x27C 0x000 0x7 0x0
 #define MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03                          0x020 0x280 0x000 0x0 0x0
 #define MX8MP_IOMUXC_GPIO1_IO03__USDHC1_VSELECT                      0x020 0x280 0x000 0x1 0x0
-#define MX8MP_IOMUXC_GPIO1_IO03__MEDIAMIX_ISP_PRELIGHT_TRIG_0        0x020 0x280 0x000 0x3 0x0
+#define MX8MP_IOMUXC_GPIO1_IO03__ISP_PRELIGHT_TRIG_0                 0x020 0x280 0x000 0x3 0x0
 #define MX8MP_IOMUXC_GPIO1_IO03__SDMA1_EXT_EVENT00                   0x020 0x280 0x000 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO03__ANAMIX_XTAL_OK                      0x020 0x280 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO03__SJC_DONE                            0x020 0x280 0x000 0x7 0x0
 #define MX8MP_IOMUXC_GPIO1_IO04__GPIO1_IO04                          0x024 0x284 0x000 0x0 0x0
 #define MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT                      0x024 0x284 0x000 0x1 0x0
-#define MX8MP_IOMUXC_GPIO1_IO04__MEDIAMIX_ISP_SHUTTER_OPEN_0         0x024 0x284 0x000 0x3 0x0
+#define MX8MP_IOMUXC_GPIO1_IO04__ISP_SHUTTER_OPEN_0                  0x024 0x284 0x000 0x3 0x0
 #define MX8MP_IOMUXC_GPIO1_IO04__SDMA1_EXT_EVENT01                   0x024 0x284 0x000 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO04__ANAMIX_XTAL_OK_LV                   0x024 0x284 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO04__USDHC1_TEST_TRIG                    0x024 0x284 0x000 0x7 0x0
 #define MX8MP_IOMUXC_GPIO1_IO05__GPIO1_IO05                          0x028 0x288 0x000 0x0 0x0
 #define MX8MP_IOMUXC_GPIO1_IO05__M7_NMI                              0x028 0x288 0x000 0x1 0x0
-#define MX8MP_IOMUXC_GPIO1_IO05__MEDIAMIX_ISP_FL_TRIG_1              0x028 0x288 0x5D8 0x3 0x0
-#define MX8MP_IOMUXC_GPIO1_IO05__CCMSRCGPCMIX_PMIC_READY             0x028 0x288 0x554 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO05__CCMSRCGPCMIX_INT_BOOT               0x028 0x288 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO05__USDHC2_TEST_TRIG                    0x028 0x288 0x000 0x7 0x0
+#define MX8MP_IOMUXC_GPIO1_IO05__ISP_FL_TRIG_1                       0x028 0x288 0x5D8 0x3 0x0
+#define MX8MP_IOMUXC_GPIO1_IO05__CCM_PMIC_READY                      0x028 0x288 0x554 0x5 0x0
 #define MX8MP_IOMUXC_GPIO1_IO06__GPIO1_IO06                          0x02C 0x28C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_GPIO1_IO06__ENET_QOS_MDC                        0x02C 0x28C 0x000 0x1 0x0
-#define MX8MP_IOMUXC_GPIO1_IO06__MEDIAMIX_ISP_SHUTTER_TRIG_1         0x02C 0x28C 0x5E0 0x3 0x0
+#define MX8MP_IOMUXC_GPIO1_IO06__ISP_SHUTTER_TRIG_1                  0x02C 0x28C 0x5E0 0x3 0x0
 #define MX8MP_IOMUXC_GPIO1_IO06__USDHC1_CD_B                         0x02C 0x28C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO06__CCMSRCGPCMIX_EXT_CLK3               0x02C 0x28C 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO06__ECSPI1_TEST_TRIG                    0x02C 0x28C 0x000 0x7 0x0
+#define MX8MP_IOMUXC_GPIO1_IO06__CCM_EXT_CLK3                        0x02C 0x28C 0x000 0x6 0x0
 #define MX8MP_IOMUXC_GPIO1_IO07__GPIO1_IO07                          0x030 0x290 0x000 0x0 0x0
 #define MX8MP_IOMUXC_GPIO1_IO07__ENET_QOS_MDIO                       0x030 0x290 0x590 0x1 0x0
-#define MX8MP_IOMUXC_GPIO1_IO07__MEDIAMIX_ISP_FLASH_TRIG_1           0x030 0x290 0x000 0x3 0x0
+#define MX8MP_IOMUXC_GPIO1_IO07__ISP_FLASH_TRIG_1                    0x030 0x290 0x000 0x3 0x0
 #define MX8MP_IOMUXC_GPIO1_IO07__USDHC1_WP                           0x030 0x290 0x000 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO07__CCMSRCGPCMIX_EXT_CLK4               0x030 0x290 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO07__ECSPI2_TEST_TRIG                    0x030 0x290 0x000 0x7 0x0
+#define MX8MP_IOMUXC_GPIO1_IO07__CCM_EXT_CLK4                        0x030 0x290 0x000 0x6 0x0
 #define MX8MP_IOMUXC_GPIO1_IO08__GPIO1_IO08                          0x034 0x294 0x000 0x0 0x0
 #define MX8MP_IOMUXC_GPIO1_IO08__ENET_QOS_1588_EVENT0_IN             0x034 0x294 0x000 0x1 0x0
 #define MX8MP_IOMUXC_GPIO1_IO08__PWM1_OUT                            0x034 0x294 0x000 0x2 0x0
-#define MX8MP_IOMUXC_GPIO1_IO08__MEDIAMIX_ISP_PRELIGHT_TRIG_1        0x034 0x294 0x000 0x3 0x0
+#define MX8MP_IOMUXC_GPIO1_IO08__ISP_PRELIGHT_TRIG_1                 0x034 0x294 0x000 0x3 0x0
 #define MX8MP_IOMUXC_GPIO1_IO08__ENET_QOS_1588_EVENT0_AUX_IN         0x034 0x294 0x000 0x4 0x0
 #define MX8MP_IOMUXC_GPIO1_IO08__USDHC2_RESET_B                      0x034 0x294 0x000 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO08__CCMSRCGPCMIX_WAIT                   0x034 0x294 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO08__FLEXSPI_TEST_TRIG                   0x034 0x294 0x000 0x7 0x0
 #define MX8MP_IOMUXC_GPIO1_IO09__GPIO1_IO09                          0x038 0x298 0x000 0x0 0x0
 #define MX8MP_IOMUXC_GPIO1_IO09__ENET_QOS_1588_EVENT0_OUT            0x038 0x298 0x000 0x1 0x0
 #define MX8MP_IOMUXC_GPIO1_IO09__PWM2_OUT                            0x038 0x298 0x000 0x2 0x0
-#define MX8MP_IOMUXC_GPIO1_IO09__MEDIAMIX_ISP_SHUTTER_OPEN_1         0x038 0x298 0x000 0x3 0x0
+#define MX8MP_IOMUXC_GPIO1_IO09__ISP_SHUTTER_OPEN_1                  0x038 0x298 0x000 0x3 0x0
 #define MX8MP_IOMUXC_GPIO1_IO09__USDHC3_RESET_B                      0x038 0x298 0x000 0x4 0x0
-#define MX8MP_IOMUXC_GPIO1_IO09__AUDIOMIX_EXT_EVENT00                0x038 0x298 0x000 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO09__CCMSRCGPCMIX_STOP                   0x038 0x298 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO09__RAWNAND_TEST_TRIG                   0x038 0x298 0x000 0x7 0x0
+#define MX8MP_IOMUXC_GPIO1_IO09__SDMA2_EXT_EVENT00                   0x038 0x298 0x000 0x5 0x0
 #define MX8MP_IOMUXC_GPIO1_IO10__GPIO1_IO10                          0x03C 0x29C 0x000 0x0 0x0
-#define MX8MP_IOMUXC_GPIO1_IO10__HSIOMIX_usb1_OTG_ID                 0x03C 0x29C 0x000 0x1 0x0
+#define MX8MP_IOMUXC_GPIO1_IO10__USB1_OTG_ID                         0x03C 0x29C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_GPIO1_IO10__PWM3_OUT                            0x03C 0x29C 0x000 0x2 0x0
-#define MX8MP_IOMUXC_GPIO1_IO10__OCOTP_FUSE_LATCHED                  0x03C 0x29C 0x000 0x7 0x0
 #define MX8MP_IOMUXC_GPIO1_IO11__GPIO1_IO11                          0x040 0x2A0 0x000 0x0 0x0
-#define MX8MP_IOMUXC_GPIO1_IO11__HSIOMIX_usb2_OTG_ID                 0x040 0x2A0 0x000 0x1 0x0
+#define MX8MP_IOMUXC_GPIO1_IO11__USB2_OTG_ID                         0x040 0x2A0 0x000 0x1 0x0
 #define MX8MP_IOMUXC_GPIO1_IO11__PWM2_OUT                            0x040 0x2A0 0x000 0x2 0x0
 #define MX8MP_IOMUXC_GPIO1_IO11__USDHC3_VSELECT                      0x040 0x2A0 0x000 0x4 0x0
-#define MX8MP_IOMUXC_GPIO1_IO11__CCMSRCGPCMIX_PMIC_READY             0x040 0x2A0 0x554 0x5 0x1
-#define MX8MP_IOMUXC_GPIO1_IO11__CCMSRCGPCMIX_OUT0                   0x040 0x2A0 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO11__CAAM_RNG_OSC_OBS                    0x040 0x2A0 0x000 0x7 0x0
+#define MX8MP_IOMUXC_GPIO1_IO11__CCM_PMIC_READY                      0x040 0x2A0 0x554 0x5 0x1
 #define MX8MP_IOMUXC_GPIO1_IO12__GPIO1_IO12                          0x044 0x2A4 0x000 0x0 0x0
-#define MX8MP_IOMUXC_GPIO1_IO12__HSIOMIX_usb1_OTG_PWR                0x044 0x2A4 0x000 0x1 0x0
-#define MX8MP_IOMUXC_GPIO1_IO12__AUDIOMIX_EXT_EVENT01                0x044 0x2A4 0x000 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO12__CCMSRCGPCMIX_OUT1                   0x044 0x2A4 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO12__CSU_CSU_ALARM_AUT00                 0x044 0x2A4 0x000 0x7 0x0
+#define MX8MP_IOMUXC_GPIO1_IO12__USB1_OTG_PWR                        0x044 0x2A4 0x000 0x1 0x0
+#define MX8MP_IOMUXC_GPIO1_IO12__SDMA2_EXT_EVENT01                   0x044 0x2A4 0x000 0x5 0x0
 #define MX8MP_IOMUXC_GPIO1_IO13__GPIO1_IO13                          0x048 0x2A8 0x000 0x0 0x0
-#define MX8MP_IOMUXC_GPIO1_IO13__HSIOMIX_usb1_OTG_OC                 0x048 0x2A8 0x000 0x1 0x0
+#define MX8MP_IOMUXC_GPIO1_IO13__USB1_OTG_OC                         0x048 0x2A8 0x000 0x1 0x0
 #define MX8MP_IOMUXC_GPIO1_IO13__PWM2_OUT                            0x048 0x2A8 0x000 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO13__CCMSRCGPCMIX_OUT2                   0x048 0x2A8 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO13__CSU_CSU_ALARM_AUT01                 0x048 0x2A8 0x000 0x7 0x0
 #define MX8MP_IOMUXC_GPIO1_IO14__GPIO1_IO14                          0x04C 0x2AC 0x000 0x0 0x0
-#define MX8MP_IOMUXC_GPIO1_IO14__HSIOMIX_usb2_OTG_PWR                0x04C 0x2AC 0x000 0x1 0x0
+#define MX8MP_IOMUXC_GPIO1_IO14__USB2_OTG_PWR                        0x04C 0x2AC 0x000 0x1 0x0
 #define MX8MP_IOMUXC_GPIO1_IO14__USDHC3_CD_B                         0x04C 0x2AC 0x608 0x4 0x0
 #define MX8MP_IOMUXC_GPIO1_IO14__PWM3_OUT                            0x04C 0x2AC 0x000 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO14__CCMSRCGPCMIX_CLKO1                  0x04C 0x2AC 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO14__CSU_CSU_ALARM_AUT02                 0x04C 0x2AC 0x000 0x7 0x0
+#define MX8MP_IOMUXC_GPIO1_IO14__CCM_CLKO1                           0x04C 0x2AC 0x000 0x6 0x0
 #define MX8MP_IOMUXC_GPIO1_IO15__GPIO1_IO15                          0x050 0x2B0 0x000 0x0 0x0
-#define MX8MP_IOMUXC_GPIO1_IO15__HSIOMIX_usb2_OTG_OC                 0x050 0x2B0 0x000 0x1 0x0
+#define MX8MP_IOMUXC_GPIO1_IO15__USB2_OTG_OC                         0x050 0x2B0 0x000 0x1 0x0
 #define MX8MP_IOMUXC_GPIO1_IO15__USDHC3_WP                           0x050 0x2B0 0x634 0x4 0x0
 #define MX8MP_IOMUXC_GPIO1_IO15__PWM4_OUT                            0x050 0x2B0 0x000 0x5 0x0
-#define MX8MP_IOMUXC_GPIO1_IO15__CCMSRCGPCMIX_CLKO2                  0x050 0x2B0 0x000 0x6 0x0
-#define MX8MP_IOMUXC_GPIO1_IO15__CSU_CSU_INT_DEB                     0x050 0x2B0 0x000 0x7 0x0
+#define MX8MP_IOMUXC_GPIO1_IO15__CCM_CLKO2                           0x050 0x2B0 0x000 0x6 0x0
 #define MX8MP_IOMUXC_ENET_MDC__ENET_QOS_MDC                          0x054 0x2B4 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_MDC__AUDIOMIX_SAI6_TX_DATA00               0x054 0x2B4 0x000 0x2 0x0
 #define MX8MP_IOMUXC_ENET_MDC__GPIO1_IO16                            0x054 0x2B4 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_MDC__USDHC3_STROBE                         0x054 0x2B4 0x630 0x6 0x0
-#define MX8MP_IOMUXC_ENET_MDC__SIM_M_HADDR15                         0x054 0x2B4 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_MDIO__ENET_QOS_MDIO                        0x058 0x2B8 0x590 0x0 0x1
 #define MX8MP_IOMUXC_ENET_MDIO__AUDIOMIX_SAI6_TX_SYNC                0x058 0x2B8 0x528 0x2 0x0
+#define MX8MP_IOMUXC_ENET_MDIO__AUDIOMIX_PDM_BIT_STREAM03            0x058 0x2B8 0x4CC 0x3 0x0
 #define MX8MP_IOMUXC_ENET_MDIO__GPIO1_IO17                           0x058 0x2B8 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_MDIO__USDHC3_DATA5                         0x058 0x2B8 0x624 0x6 0x0
-#define MX8MP_IOMUXC_ENET_MDIO__SIM_M_HADDR16                        0x058 0x2B8 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_TD3__ENET_QOS_RGMII_TD3                    0x05C 0x2BC 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_TD3__AUDIOMIX_SAI6_TX_BCLK                 0x05C 0x2BC 0x524 0x2 0x0
+#define MX8MP_IOMUXC_ENET_TD3__AUDIOMIX_PDM_BIT_STREAM02             0x05C 0x2BC 0x4C8 0x3 0x0
 #define MX8MP_IOMUXC_ENET_TD3__GPIO1_IO18                            0x05C 0x2BC 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_TD3__USDHC3_DATA6                          0x05C 0x2BC 0x628 0x6 0x0
-#define MX8MP_IOMUXC_ENET_TD3__SIM_M_HADDR17                         0x05C 0x2BC 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_TD2__ENET_QOS_RGMII_TD2                    0x060 0x2C0 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_TD2__CCM_ENET_QOS_CLOCK_GENERATE_REF_CLK   0x060 0x2C0 0x000 0x1 0x0
 #define MX8MP_IOMUXC_ENET_TD2__AUDIOMIX_SAI6_RX_DATA00               0x060 0x2C0 0x51C 0x2 0x0
+#define MX8MP_IOMUXC_ENET_TD2__AUDIOMIX_PDM_BIT_STREAM01             0x060 0x2C0 0x4C4 0x3 0x0
 #define MX8MP_IOMUXC_ENET_TD2__GPIO1_IO19                            0x060 0x2C0 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_TD2__USDHC3_DATA7                          0x060 0x2C0 0x62C 0x6 0x0
-#define MX8MP_IOMUXC_ENET_TD2__SIM_M_HADDR18                         0x060 0x2C0 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_TD1__ENET_QOS_RGMII_TD1                    0x064 0x2C4 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_TD1__AUDIOMIX_SAI6_RX_SYNC                 0x064 0x2C4 0x520 0x2 0x0
+#define MX8MP_IOMUXC_ENET_TD1__AUDIOMIX_PDM_BIT_STREAM00             0x064 0x2C4 0x4C0 0x3 0x0
 #define MX8MP_IOMUXC_ENET_TD1__GPIO1_IO20                            0x064 0x2C4 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_TD1__USDHC3_CD_B                           0x064 0x2C4 0x608 0x6 0x1
-#define MX8MP_IOMUXC_ENET_TD1__SIM_M_HADDR19                         0x064 0x2C4 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_TD0__ENET_QOS_RGMII_TD0                    0x068 0x2C8 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_TD0__AUDIOMIX_SAI6_RX_BCLK                 0x068 0x2C8 0x518 0x2 0x0
+#define MX8MP_IOMUXC_ENET_TD0__AUDIOMIX_PDM_CLK                      0x068 0x2C8 0x000 0x3 0x0
 #define MX8MP_IOMUXC_ENET_TD0__GPIO1_IO21                            0x068 0x2C8 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_TD0__USDHC3_WP                             0x068 0x2C8 0x634 0x6 0x1
-#define MX8MP_IOMUXC_ENET_TD0__SIM_M_HADDR20                         0x068 0x2C8 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_TX_CTL__ENET_QOS_RGMII_TX_CTL              0x06C 0x2CC 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_TX_CTL__AUDIOMIX_SAI6_MCLK                 0x06C 0x2CC 0x514 0x2 0x0
-#define MX8MP_IOMUXC_ENET_TX_CTL__AUDIOMIX_SPDIF_OUT                 0x06C 0x2CC 0x000 0x3 0x0
+#define MX8MP_IOMUXC_ENET_TX_CTL__AUDIOMIX_SPDIF1_OUT                0x06C 0x2CC 0x000 0x3 0x0
 #define MX8MP_IOMUXC_ENET_TX_CTL__GPIO1_IO22                         0x06C 0x2CC 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_TX_CTL__USDHC3_DATA0                       0x06C 0x2CC 0x610 0x6 0x0
-#define MX8MP_IOMUXC_ENET_TX_CTL__SIM_M_HADDR21                      0x06C 0x2CC 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_TXC__CCM_ENET_QOS_CLOCK_GENERATE_TX_CLK    0x070 0x2D0 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_TXC__ENET_QOS_TX_ER                        0x070 0x2D0 0x000 0x1 0x0
 #define MX8MP_IOMUXC_ENET_TXC__AUDIOMIX_SAI7_TX_DATA00               0x070 0x2D0 0x000 0x2 0x0
 #define MX8MP_IOMUXC_ENET_TXC__GPIO1_IO23                            0x070 0x2D0 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_TXC__USDHC3_DATA1                          0x070 0x2D0 0x614 0x6 0x0
-#define MX8MP_IOMUXC_ENET_TXC__SIM_M_HADDR22                         0x070 0x2D0 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_RX_CTL__ENET_QOS_RGMII_RX_CTL              0x074 0x2D4 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_RX_CTL__AUDIOMIX_SAI7_TX_SYNC              0x074 0x2D4 0x540 0x2 0x0
-#define MX8MP_IOMUXC_ENET_RX_CTL__AUDIOMIX_BIT_STREAM03              0x074 0x2D4 0x4CC 0x3 0x1
+#define MX8MP_IOMUXC_ENET_RX_CTL__AUDIOMIX_PDM_BIT_STREAM03          0x074 0x2D4 0x4CC 0x3 0x1
 #define MX8MP_IOMUXC_ENET_RX_CTL__GPIO1_IO24                         0x074 0x2D4 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_RX_CTL__USDHC3_DATA2                       0x074 0x2D4 0x618 0x6 0x0
-#define MX8MP_IOMUXC_ENET_RX_CTL__SIM_M_HADDR23                      0x074 0x2D4 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_RXC__CCM_ENET_QOS_CLOCK_GENERATE_RX_CLK    0x078 0x2D8 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_RXC__ENET_QOS_RX_ER                        0x078 0x2D8 0x000 0x1 0x0
 #define MX8MP_IOMUXC_ENET_RXC__AUDIOMIX_SAI7_TX_BCLK                 0x078 0x2D8 0x53C 0x2 0x0
-#define MX8MP_IOMUXC_ENET_RXC__AUDIOMIX_BIT_STREAM02                 0x078 0x2D8 0x4C8 0x3 0x1
+#define MX8MP_IOMUXC_ENET_RXC__AUDIOMIX_PDM_BIT_STREAM02             0x078 0x2D8 0x4C8 0x3 0x1
 #define MX8MP_IOMUXC_ENET_RXC__GPIO1_IO25                            0x078 0x2D8 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_RXC__USDHC3_DATA3                          0x078 0x2D8 0x61C 0x6 0x0
-#define MX8MP_IOMUXC_ENET_RXC__SIM_M_HADDR24                         0x078 0x2D8 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_RD0__ENET_QOS_RGMII_RD0                    0x07C 0x2DC 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_RD0__AUDIOMIX_SAI7_RX_DATA00               0x07C 0x2DC 0x534 0x2 0x0
-#define MX8MP_IOMUXC_ENET_RD0__AUDIOMIX_BIT_STREAM01                 0x07C 0x2DC 0x4C4 0x3 0x1
+#define MX8MP_IOMUXC_ENET_RD0__AUDIOMIX_PDM_BIT_STREAM01             0x07C 0x2DC 0x4C4 0x3 0x1
 #define MX8MP_IOMUXC_ENET_RD0__GPIO1_IO26                            0x07C 0x2DC 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_RD0__USDHC3_DATA4                          0x07C 0x2DC 0x620 0x6 0x0
-#define MX8MP_IOMUXC_ENET_RD0__SIM_M_HADDR25                         0x07C 0x2DC 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_RD1__ENET_QOS_RGMII_RD1                    0x080 0x2E0 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_RD1__AUDIOMIX_SAI7_RX_SYNC                 0x080 0x2E0 0x538 0x2 0x0
-#define MX8MP_IOMUXC_ENET_RD1__AUDIOMIX_BIT_STREAM00                 0x080 0x2E0 0x4C0 0x3 0x1
+#define MX8MP_IOMUXC_ENET_RD1__AUDIOMIX_PDM_BIT_STREAM00             0x080 0x2E0 0x4C0 0x3 0x1
 #define MX8MP_IOMUXC_ENET_RD1__GPIO1_IO27                            0x080 0x2E0 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_RD1__USDHC3_RESET_B                        0x080 0x2E0 0x000 0x6 0x0
-#define MX8MP_IOMUXC_ENET_RD1__SIM_M_HADDR26                         0x080 0x2E0 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_RD2__ENET_QOS_RGMII_RD2                    0x084 0x2E4 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_RD2__AUDIOMIX_SAI7_RX_BCLK                 0x084 0x2E4 0x530 0x2 0x0
-#define MX8MP_IOMUXC_ENET_RD2__AUDIOMIX_CLK                          0x084 0x2E4 0x000 0x3 0x0
+#define MX8MP_IOMUXC_ENET_RD2__AUDIOMIX_PDM_CLK                      0x084 0x2E4 0x000 0x3 0x0
 #define MX8MP_IOMUXC_ENET_RD2__GPIO1_IO28                            0x084 0x2E4 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_RD2__USDHC3_CLK                            0x084 0x2E4 0x604 0x6 0x0
-#define MX8MP_IOMUXC_ENET_RD2__SIM_M_HADDR27                         0x084 0x2E4 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ENET_RD3__ENET_QOS_RGMII_RD3                    0x088 0x2E8 0x000 0x0 0x0
 #define MX8MP_IOMUXC_ENET_RD3__AUDIOMIX_SAI7_MCLK                    0x088 0x2E8 0x52C 0x2 0x0
-#define MX8MP_IOMUXC_ENET_RD3__AUDIOMIX_SPDIF_IN                     0x088 0x2E8 0x544 0x3 0x0
+#define MX8MP_IOMUXC_ENET_RD3__AUDIOMIX_SPDIF1_IN                    0x088 0x2E8 0x544 0x3 0x0
 #define MX8MP_IOMUXC_ENET_RD3__GPIO1_IO29                            0x088 0x2E8 0x000 0x5 0x0
 #define MX8MP_IOMUXC_ENET_RD3__USDHC3_CMD                            0x088 0x2E8 0x60C 0x6 0x0
-#define MX8MP_IOMUXC_ENET_RD3__SIM_M_HADDR28                         0x088 0x2E8 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD1_CLK__USDHC1_CLK                             0x08C 0x2EC 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD1_CLK__ENET1_MDC                              0x08C 0x2EC 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SD1_CLK__I2C5_SCL                               0x08C 0x2EC 0x5C4 0x3 0x0
 #define MX8MP_IOMUXC_SD1_CLK__UART1_DCE_TX                           0x08C 0x2EC 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD1_CLK__UART1_DTE_RX                           0x08C 0x2EC 0x5E8 0x4 0x0
 #define MX8MP_IOMUXC_SD1_CLK__GPIO2_IO00                             0x08C 0x2EC 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD1_CLK__SIM_M_HADDR29                          0x08C 0x2EC 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD1_CMD__USDHC1_CMD                             0x090 0x2F0 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD1_CMD__ENET1_MDIO                             0x090 0x2F0 0x57C 0x1 0x0
 #define MX8MP_IOMUXC_SD1_CMD__I2C5_SDA                               0x090 0x2F0 0x5C8 0x3 0x0
 #define MX8MP_IOMUXC_SD1_CMD__UART1_DCE_RX                           0x090 0x2F0 0x5E8 0x4 0x1
 #define MX8MP_IOMUXC_SD1_CMD__UART1_DTE_TX                           0x090 0x2F0 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD1_CMD__GPIO2_IO01                             0x090 0x2F0 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD1_CMD__SIM_M_HADDR30                          0x090 0x2F0 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD1_DATA0__USDHC1_DATA0                         0x094 0x2F4 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD1_DATA0__ENET1_RGMII_TD1                      0x094 0x2F4 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SD1_DATA0__I2C6_SCL                             0x094 0x2F4 0x5CC 0x3 0x0
 #define MX8MP_IOMUXC_SD1_DATA0__UART1_DCE_RTS                        0x094 0x2F4 0x5E4 0x4 0x0
 #define MX8MP_IOMUXC_SD1_DATA0__UART1_DTE_CTS                        0x094 0x2F4 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD1_DATA0__GPIO2_IO02                           0x094 0x2F4 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD1_DATA0__SIM_M_HADDR31                        0x094 0x2F4 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD1_DATA1__USDHC1_DATA1                         0x098 0x2F8 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD1_DATA1__ENET1_RGMII_TD0                      0x098 0x2F8 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SD1_DATA1__I2C6_SDA                             0x098 0x2F8 0x5D0 0x3 0x0
 #define MX8MP_IOMUXC_SD1_DATA1__UART1_DCE_CTS                        0x098 0x2F8 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD1_DATA1__UART1_DTE_RTS                        0x098 0x2F8 0x5E4 0x4 0x1
 #define MX8MP_IOMUXC_SD1_DATA1__GPIO2_IO03                           0x098 0x2F8 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD1_DATA1__SIM_M_HBURST00                       0x098 0x2F8 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD1_DATA2__USDHC1_DATA2                         0x09C 0x2FC 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD1_DATA2__ENET1_RGMII_RD0                      0x09C 0x2FC 0x580 0x1 0x0
 #define MX8MP_IOMUXC_SD1_DATA2__I2C4_SCL                             0x09C 0x2FC 0x5BC 0x3 0x0
 #define MX8MP_IOMUXC_SD1_DATA2__UART2_DCE_TX                         0x09C 0x2FC 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD1_DATA2__UART2_DTE_RX                         0x09C 0x2FC 0x5F0 0x4 0x0
 #define MX8MP_IOMUXC_SD1_DATA2__GPIO2_IO04                           0x09C 0x2FC 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD1_DATA2__SIM_M_HBURST01                       0x09C 0x2FC 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD1_DATA3__USDHC1_DATA3                         0x0A0 0x300 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD1_DATA3__ENET1_RGMII_RD1                      0x0A0 0x300 0x584 0x1 0x0
 #define MX8MP_IOMUXC_SD1_DATA3__I2C4_SDA                             0x0A0 0x300 0x5C0 0x3 0x0
 #define MX8MP_IOMUXC_SD1_DATA3__UART2_DCE_RX                         0x0A0 0x300 0x5F0 0x4 0x1
 #define MX8MP_IOMUXC_SD1_DATA3__UART2_DTE_TX                         0x0A0 0x300 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD1_DATA3__GPIO2_IO05                           0x0A0 0x300 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD1_DATA3__SIM_M_HBURST02                       0x0A0 0x300 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD1_DATA4__USDHC1_DATA4                         0x0A4 0x304 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD1_DATA4__ENET1_RGMII_TX_CTL                   0x0A4 0x304 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SD1_DATA4__I2C1_SCL                             0x0A4 0x304 0x5A4 0x3 0x0
 #define MX8MP_IOMUXC_SD1_DATA4__UART2_DCE_RTS                        0x0A4 0x304 0x5EC 0x4 0x0
 #define MX8MP_IOMUXC_SD1_DATA4__UART2_DTE_CTS                        0x0A4 0x304 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD1_DATA4__GPIO2_IO06                           0x0A4 0x304 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD1_DATA4__SIM_M_HRESP                          0x0A4 0x304 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD1_DATA5__USDHC1_DATA5                         0x0A8 0x308 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD1_DATA5__ENET1_TX_ER                          0x0A8 0x308 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SD1_DATA5__I2C1_SDA                             0x0A8 0x308 0x5A8 0x3 0x0
 #define MX8MP_IOMUXC_SD1_DATA5__UART2_DCE_CTS                        0x0A8 0x308 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD1_DATA5__UART2_DTE_RTS                        0x0A8 0x308 0x5EC 0x4 0x1
 #define MX8MP_IOMUXC_SD1_DATA5__GPIO2_IO07                           0x0A8 0x308 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD1_DATA5__TPSMP_HDATA05                        0x0A8 0x308 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD1_DATA6__USDHC1_DATA6                         0x0AC 0x30C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD1_DATA6__ENET1_RGMII_RX_CTL                   0x0AC 0x30C 0x588 0x1 0x0
 #define MX8MP_IOMUXC_SD1_DATA6__I2C2_SCL                             0x0AC 0x30C 0x5AC 0x3 0x0
 #define MX8MP_IOMUXC_SD1_DATA6__UART3_DCE_TX                         0x0AC 0x30C 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD1_DATA6__UART3_DTE_RX                         0x0AC 0x30C 0x5F8 0x4 0x0
 #define MX8MP_IOMUXC_SD1_DATA6__GPIO2_IO08                           0x0AC 0x30C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD1_DATA6__TPSMP_HDATA06                        0x0AC 0x30C 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD1_DATA7__USDHC1_DATA7                         0x0B0 0x310 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD1_DATA7__ENET1_RX_ER                          0x0B0 0x310 0x58C 0x1 0x0
 #define MX8MP_IOMUXC_SD1_DATA7__I2C2_SDA                             0x0B0 0x310 0x5B0 0x3 0x0
 #define MX8MP_IOMUXC_SD1_DATA7__UART3_DCE_RX                         0x0B0 0x310 0x5F8 0x4 0x1
 #define MX8MP_IOMUXC_SD1_DATA7__UART3_DTE_TX                         0x0B0 0x310 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD1_DATA7__GPIO2_IO09                           0x0B0 0x310 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD1_DATA7__TPSMP_HDATA07                        0x0B0 0x310 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD1_RESET_B__USDHC1_RESET_B                     0x0B4 0x314 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD1_RESET_B__ENET1_TX_CLK                       0x0B4 0x314 0x578 0x1 0x0
 #define MX8MP_IOMUXC_SD1_RESET_B__I2C3_SCL                           0x0B4 0x314 0x5B4 0x3 0x0
 #define MX8MP_IOMUXC_SD1_RESET_B__UART3_DCE_RTS                      0x0B4 0x314 0x5F4 0x4 0x0
 #define MX8MP_IOMUXC_SD1_RESET_B__UART3_DTE_CTS                      0x0B4 0x314 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD1_RESET_B__GPIO2_IO10                         0x0B4 0x314 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD1_RESET_B__ECSPI3_TEST_TRIG                   0x0B4 0x314 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD1_STROBE__USDHC1_STROBE                       0x0B8 0x318 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD1_STROBE__I2C3_SDA                            0x0B8 0x318 0x5B8 0x3 0x0
 #define MX8MP_IOMUXC_SD1_STROBE__UART3_DCE_CTS                       0x0B8 0x318 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD1_STROBE__UART3_DTE_RTS                       0x0B8 0x318 0x5F4 0x4 0x1
 #define MX8MP_IOMUXC_SD1_STROBE__GPIO2_IO11                          0x0B8 0x318 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD1_STROBE__USDHC3_TEST_TRIG                    0x0B8 0x318 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD2_CD_B__USDHC2_CD_B                           0x0BC 0x31C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD2_CD_B__GPIO2_IO12                            0x0BC 0x31C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD2_CD_B__CCMSRCGPCMIX_TESTER_ACK               0x0BC 0x31C 0x000 0x6 0x0
 #define MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK                             0x0C0 0x320 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD2_CLK__ECSPI2_SCLK                            0x0C0 0x320 0x568 0x2 0x0
 #define MX8MP_IOMUXC_SD2_CLK__UART4_DCE_RX                           0x0C0 0x320 0x600 0x3 0x0
 #define MX8MP_IOMUXC_SD2_CLK__UART4_DTE_TX                           0x0C0 0x320 0x000 0x3 0x0
 #define MX8MP_IOMUXC_SD2_CLK__GPIO2_IO13                             0x0C0 0x320 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD2_CLK__CCMSRCGPCMIX_OBSERVE0                  0x0C0 0x320 0x000 0x6 0x0
-#define MX8MP_IOMUXC_SD2_CLK__OBSERVE_MUX_OUT00                      0x0C0 0x320 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD2_CMD__USDHC2_CMD                             0x0C4 0x324 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD2_CMD__ECSPI2_MOSI                            0x0C4 0x324 0x570 0x2 0x0
 #define MX8MP_IOMUXC_SD2_CMD__UART4_DCE_TX                           0x0C4 0x324 0x000 0x3 0x0
 #define MX8MP_IOMUXC_SD2_CMD__UART4_DTE_RX                           0x0C4 0x324 0x600 0x3 0x1
-#define MX8MP_IOMUXC_SD2_CMD__AUDIOMIX_CLK                           0x0C4 0x324 0x000 0x4 0x0
+#define MX8MP_IOMUXC_SD2_CMD__AUDIOMIX_PDM_CLK                       0x0C4 0x324 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SD2_CMD__GPIO2_IO14                             0x0C4 0x324 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD2_CMD__CCMSRCGPCMIX_OBSERVE1                  0x0C4 0x324 0x000 0x6 0x0
-#define MX8MP_IOMUXC_SD2_CMD__OBSERVE_MUX_OUT01                      0x0C4 0x324 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD2_DATA0__USDHC2_DATA0                         0x0C8 0x328 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD2_DATA0__I2C4_SDA                             0x0C8 0x328 0x5C0 0x2 0x1
 #define MX8MP_IOMUXC_SD2_DATA0__UART2_DCE_RX                         0x0C8 0x328 0x5F0 0x3 0x2
 #define MX8MP_IOMUXC_SD2_DATA0__UART2_DTE_TX                         0x0C8 0x328 0x000 0x3 0x0
-#define MX8MP_IOMUXC_SD2_DATA0__AUDIOMIX_BIT_STREAM00                0x0C8 0x328 0x4C0 0x4 0x2
+#define MX8MP_IOMUXC_SD2_DATA0__AUDIOMIX_PDM_BIT_STREAM00            0x0C8 0x328 0x4C0 0x4 0x2
 #define MX8MP_IOMUXC_SD2_DATA0__GPIO2_IO15                           0x0C8 0x328 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD2_DATA0__CCMSRCGPCMIX_OBSERVE2                0x0C8 0x328 0x000 0x6 0x0
-#define MX8MP_IOMUXC_SD2_DATA0__OBSERVE_MUX_OUT02                    0x0C8 0x328 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1                         0x0CC 0x32C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD2_DATA1__I2C4_SCL                             0x0CC 0x32C 0x5BC 0x2 0x1
 #define MX8MP_IOMUXC_SD2_DATA1__UART2_DCE_TX                         0x0CC 0x32C 0x000 0x3 0x0
 #define MX8MP_IOMUXC_SD2_DATA1__UART2_DTE_RX                         0x0CC 0x32C 0x5F0 0x3 0x3
-#define MX8MP_IOMUXC_SD2_DATA1__AUDIOMIX_BIT_STREAM01                0x0CC 0x32C 0x4C4 0x4 0x1
+#define MX8MP_IOMUXC_SD2_DATA1__AUDIOMIX_PDM_BIT_STREAM01            0x0CC 0x32C 0x4C4 0x4 0x2
 #define MX8MP_IOMUXC_SD2_DATA1__GPIO2_IO16                           0x0CC 0x32C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD2_DATA1__CCMSRCGPCMIX_WAIT                    0x0CC 0x32C 0x000 0x6 0x0
-#define MX8MP_IOMUXC_SD2_DATA1__OBSERVE_MUX_OUT03                    0x0CC 0x32C 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2                         0x0D0 0x330 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD2_DATA2__ECSPI2_SS0                           0x0D0 0x330 0x574 0x2 0x0
-#define MX8MP_IOMUXC_SD2_DATA2__AUDIOMIX_SPDIF_OUT                   0x0D0 0x330 0x000 0x3 0x0
-#define MX8MP_IOMUXC_SD2_DATA2__AUDIOMIX_BIT_STREAM02                0x0D0 0x330 0x4C8 0x4 0x1
+#define MX8MP_IOMUXC_SD2_DATA2__AUDIOMIX_SPDIF1_OUT                  0x0D0 0x330 0x000 0x3 0x0
+#define MX8MP_IOMUXC_SD2_DATA2__AUDIOMIX_PDM_BIT_STREAM02            0x0D0 0x330 0x4C8 0x4 0x2
 #define MX8MP_IOMUXC_SD2_DATA2__GPIO2_IO17                           0x0D0 0x330 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD2_DATA2__CCMSRCGPCMIX_STOP                    0x0D0 0x330 0x000 0x6 0x0
-#define MX8MP_IOMUXC_SD2_DATA2__OBSERVE_MUX_OUT04                    0x0D0 0x330 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3                         0x0D4 0x334 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD2_DATA3__ECSPI2_MISO                          0x0D4 0x334 0x56C 0x2 0x0
-#define MX8MP_IOMUXC_SD2_DATA3__AUDIOMIX_SPDIF_IN                    0x0D4 0x334 0x544 0x3 0x1
-#define MX8MP_IOMUXC_SD2_DATA3__AUDIOMIX_BIT_STREAM03                0x0D4 0x334 0x4CC 0x4 0x2
+#define MX8MP_IOMUXC_SD2_DATA3__AUDIOMIX_SPDIF1_IN                   0x0D4 0x334 0x544 0x3 0x1
+#define MX8MP_IOMUXC_SD2_DATA3__AUDIOMIX_PDM_BIT_STREAM03            0x0D4 0x334 0x4CC 0x4 0x2
 #define MX8MP_IOMUXC_SD2_DATA3__GPIO2_IO18                           0x0D4 0x334 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD2_DATA3__CCMSRCGPCMIX_EARLY_RESET             0x0D4 0x334 0x000 0x6 0x0
+#define MX8MP_IOMUXC_SD2_DATA3__SRC_EARLY_RESET                      0x0D4 0x334 0x000 0x6 0x0
 #define MX8MP_IOMUXC_SD2_RESET_B__USDHC2_RESET_B                     0x0D8 0x338 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD2_RESET_B__GPIO2_IO19                         0x0D8 0x338 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SD2_RESET_B__CCMSRCGPCMIX_SYSTEM_RESET          0x0D8 0x338 0x000 0x6 0x0
+#define MX8MP_IOMUXC_SD2_RESET_B__SRC_SYSTEM_RESET                   0x0D8 0x338 0x000 0x6 0x0
 #define MX8MP_IOMUXC_SD2_WP__USDHC2_WP                               0x0DC 0x33C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SD2_WP__GPIO2_IO20                              0x0DC 0x33C 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SD2_WP__CORESIGHT_EVENTI                        0x0DC 0x33C 0x000 0x6 0x0
-#define MX8MP_IOMUXC_SD2_WP__SIM_M_HMASTLOCK                         0x0DC 0x33C 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_ALE__RAWNAND_ALE                           0x0E0 0x340 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_ALE__NAND_ALE                              0x0E0 0x340 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_ALE__FLEXSPI_A_SCLK                        0x0E0 0x340 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_ALE__AUDIOMIX_SAI3_TX_BCLK                 0x0E0 0x340 0x4E8 0x2 0x0
-#define MX8MP_IOMUXC_NAND_ALE__MEDIAMIX_ISP_FL_TRIG_0                0x0E0 0x340 0x5D4 0x3 0x1
+#define MX8MP_IOMUXC_NAND_ALE__ISP_FL_TRIG_0                         0x0E0 0x340 0x5D4 0x3 0x1
 #define MX8MP_IOMUXC_NAND_ALE__UART3_DCE_RX                          0x0E0 0x340 0x5F8 0x4 0x2
 #define MX8MP_IOMUXC_NAND_ALE__UART3_DTE_TX                          0x0E0 0x340 0x000 0x4 0x0
 #define MX8MP_IOMUXC_NAND_ALE__GPIO3_IO00                            0x0E0 0x340 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_ALE__CORESIGHT_TRACE_CLK                   0x0E0 0x340 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_ALE__SIM_M_HPROT00                         0x0E0 0x340 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_CE0_B__RAWNAND_CE0_B                       0x0E4 0x344 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_CE0_B__NAND_CE0_B                          0x0E4 0x344 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_CE0_B__FLEXSPI_A_SS0_B                     0x0E4 0x344 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_CE0_B__AUDIOMIX_SAI3_TX_DATA00             0x0E4 0x344 0x000 0x2 0x0
-#define MX8MP_IOMUXC_NAND_CE0_B__MEDIAMIX_ISP_SHUTTER_TRIG_0         0x0E4 0x344 0x5DC 0x3 0x1
+#define MX8MP_IOMUXC_NAND_CE0_B__ISP_SHUTTER_TRIG_0                  0x0E4 0x344 0x5DC 0x3 0x1
 #define MX8MP_IOMUXC_NAND_CE0_B__UART3_DCE_TX                        0x0E4 0x344 0x000 0x4 0x0
 #define MX8MP_IOMUXC_NAND_CE0_B__UART3_DTE_RX                        0x0E4 0x344 0x5F8 0x4 0x3
 #define MX8MP_IOMUXC_NAND_CE0_B__GPIO3_IO01                          0x0E4 0x344 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_CE0_B__CORESIGHT_TRACE_CTL                 0x0E4 0x344 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_CE0_B__SIM_M_HPROT01                       0x0E4 0x344 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_CE1_B__RAWNAND_CE1_B                       0x0E8 0x348 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_CE1_B__NAND_CE1_B                          0x0E8 0x348 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_CE1_B__FLEXSPI_A_SS1_B                     0x0E8 0x348 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_CE1_B__USDHC3_STROBE                       0x0E8 0x348 0x630 0x2 0x1
 #define MX8MP_IOMUXC_NAND_CE1_B__I2C4_SCL                            0x0E8 0x348 0x5BC 0x4 0x2
 #define MX8MP_IOMUXC_NAND_CE1_B__GPIO3_IO02                          0x0E8 0x348 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_CE1_B__CORESIGHT_TRACE00                   0x0E8 0x348 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_CE1_B__SIM_M_HPROT02                       0x0E8 0x348 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_CE2_B__RAWNAND_CE2_B                       0x0EC 0x34C 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_CE2_B__NAND_CE2_B                          0x0EC 0x34C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_CE2_B__FLEXSPI_B_SS0_B                     0x0EC 0x34C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_CE2_B__USDHC3_DATA5                        0x0EC 0x34C 0x624 0x2 0x1
 #define MX8MP_IOMUXC_NAND_CE2_B__I2C4_SDA                            0x0EC 0x34C 0x5C0 0x4 0x2
 #define MX8MP_IOMUXC_NAND_CE2_B__GPIO3_IO03                          0x0EC 0x34C 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_CE2_B__CORESIGHT_TRACE01                   0x0EC 0x34C 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_CE2_B__SIM_M_HPROT03                       0x0EC 0x34C 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_CE3_B__RAWNAND_CE3_B                       0x0F0 0x350 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_CE3_B__NAND_CE3_B                          0x0F0 0x350 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_CE3_B__FLEXSPI_B_SS1_B                     0x0F0 0x350 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_CE3_B__USDHC3_DATA6                        0x0F0 0x350 0x628 0x2 0x1
 #define MX8MP_IOMUXC_NAND_CE3_B__I2C3_SDA                            0x0F0 0x350 0x5B8 0x4 0x1
 #define MX8MP_IOMUXC_NAND_CE3_B__GPIO3_IO04                          0x0F0 0x350 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_CE3_B__CORESIGHT_TRACE02                   0x0F0 0x350 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_CE3_B__SIM_M_HADDR00                       0x0F0 0x350 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_CLE__RAWNAND_CLE                           0x0F4 0x354 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_CLE__NAND_CLE                              0x0F4 0x354 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_CLE__FLEXSPI_B_SCLK                        0x0F4 0x354 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_CLE__USDHC3_DATA7                          0x0F4 0x354 0x62C 0x2 0x1
 #define MX8MP_IOMUXC_NAND_CLE__UART4_DCE_RX                          0x0F4 0x354 0x600 0x4 0x2
 #define MX8MP_IOMUXC_NAND_CLE__UART4_DTE_TX                          0x0F4 0x354 0x000 0x4 0x0
 #define MX8MP_IOMUXC_NAND_CLE__GPIO3_IO05                            0x0F4 0x354 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_CLE__CORESIGHT_TRACE03                     0x0F4 0x354 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_CLE__SIM_M_HADDR01                         0x0F4 0x354 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_DATA00__RAWNAND_DATA00                     0x0F8 0x358 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_DATA00__NAND_DATA00                        0x0F8 0x358 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_DATA00__FLEXSPI_A_DATA00                   0x0F8 0x358 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_DATA00__AUDIOMIX_SAI3_RX_DATA00            0x0F8 0x358 0x4E4 0x2 0x0
-#define MX8MP_IOMUXC_NAND_DATA00__MEDIAMIX_ISP_FLASH_TRIG_0          0x0F8 0x358 0x000 0x3 0x0
+#define MX8MP_IOMUXC_NAND_DATA00__ISP_FLASH_TRIG_0                   0x0F8 0x358 0x000 0x3 0x0
 #define MX8MP_IOMUXC_NAND_DATA00__UART4_DCE_RX                       0x0F8 0x358 0x600 0x4 0x3
 #define MX8MP_IOMUXC_NAND_DATA00__UART4_DTE_TX                       0x0F8 0x358 0x000 0x4 0x0
 #define MX8MP_IOMUXC_NAND_DATA00__GPIO3_IO06                         0x0F8 0x358 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_DATA00__CORESIGHT_TRACE04                  0x0F8 0x358 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_DATA00__SIM_M_HADDR02                      0x0F8 0x358 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_DATA01__RAWNAND_DATA01                     0x0FC 0x35C 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_DATA01__NAND_DATA01                        0x0FC 0x35C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_DATA01__FLEXSPI_A_DATA01                   0x0FC 0x35C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_DATA01__AUDIOMIX_SAI3_TX_SYNC              0x0FC 0x35C 0x4EC 0x2 0x0
-#define MX8MP_IOMUXC_NAND_DATA01__MEDIAMIX_ISP_PRELIGHT_TRIG_0       0x0FC 0x35C 0x000 0x3 0x0
+#define MX8MP_IOMUXC_NAND_DATA01__ISP_PRELIGHT_TRIG_0                0x0FC 0x35C 0x000 0x3 0x0
 #define MX8MP_IOMUXC_NAND_DATA01__UART4_DCE_TX                       0x0FC 0x35C 0x000 0x4 0x0
 #define MX8MP_IOMUXC_NAND_DATA01__UART4_DTE_RX                       0x0FC 0x35C 0x600 0x4 0x4
 #define MX8MP_IOMUXC_NAND_DATA01__GPIO3_IO07                         0x0FC 0x35C 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_DATA01__CORESIGHT_TRACE05                  0x0FC 0x35C 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_DATA01__SIM_M_HADDR03                      0x0FC 0x35C 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_DATA02__RAWNAND_DATA02                     0x100 0x360 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_DATA02__NAND_DATA02                        0x100 0x360 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_DATA02__FLEXSPI_A_DATA02                   0x100 0x360 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_DATA02__USDHC3_CD_B                        0x100 0x360 0x608 0x2 0x2
 #define MX8MP_IOMUXC_NAND_DATA02__UART4_DCE_CTS                      0x100 0x360 0x000 0x3 0x0
 #define MX8MP_IOMUXC_NAND_DATA02__I2C4_SDA                           0x100 0x360 0x5C0 0x4 0x3
 #define MX8MP_IOMUXC_NAND_DATA02__GPIO3_IO08                         0x100 0x360 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_DATA02__CORESIGHT_TRACE06                  0x100 0x360 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_DATA02__SIM_M_HADDR04                      0x100 0x360 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_DATA03__RAWNAND_DATA03                     0x104 0x364 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_DATA03__NAND_DATA03                        0x104 0x364 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_DATA03__FLEXSPI_A_DATA03                   0x104 0x364 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_DATA03__USDHC3_WP                          0x104 0x364 0x634 0x2 0x2
 #define MX8MP_IOMUXC_NAND_DATA03__UART4_DCE_RTS                      0x104 0x364 0x5FC 0x3 0x1
 #define MX8MP_IOMUXC_NAND_DATA03__UART4_DTE_CTS                      0x104 0x364 0x000 0x3 0x0
-#define MX8MP_IOMUXC_NAND_DATA03__MEDIAMIX_ISP_FL_TRIG_1             0x104 0x364 0x5D8 0x4 0x1
+#define MX8MP_IOMUXC_NAND_DATA03__ISP_FL_TRIG_1                      0x104 0x364 0x5D8 0x4 0x1
 #define MX8MP_IOMUXC_NAND_DATA03__GPIO3_IO09                         0x104 0x364 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_DATA03__CORESIGHT_TRACE07                  0x104 0x364 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_DATA03__SIM_M_HADDR05                      0x104 0x364 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_DATA04__RAWNAND_DATA04                     0x108 0x368 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_DATA04__NAND_DATA04                        0x108 0x368 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_DATA04__FLEXSPI_B_DATA00                   0x108 0x368 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_DATA04__USDHC3_DATA0                       0x108 0x368 0x610 0x2 0x1
 #define MX8MP_IOMUXC_NAND_DATA04__FLEXSPI_A_DATA04                   0x108 0x368 0x000 0x3 0x0
-#define MX8MP_IOMUXC_NAND_DATA04__MEDIAMIX_ISP_SHUTTER_TRIG_1        0x108 0x368 0x5E0 0x4 0x1
+#define MX8MP_IOMUXC_NAND_DATA04__ISP_SHUTTER_TRIG_1                 0x108 0x368 0x5E0 0x4 0x1
 #define MX8MP_IOMUXC_NAND_DATA04__GPIO3_IO10                         0x108 0x368 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_DATA04__CORESIGHT_TRACE08                  0x108 0x368 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_DATA04__SIM_M_HADDR06                      0x108 0x368 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_DATA05__RAWNAND_DATA05                     0x10C 0x36C 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_DATA05__NAND_DATA05                        0x10C 0x36C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_DATA05__FLEXSPI_B_DATA01                   0x10C 0x36C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_DATA05__USDHC3_DATA1                       0x10C 0x36C 0x614 0x2 0x1
 #define MX8MP_IOMUXC_NAND_DATA05__FLEXSPI_A_DATA05                   0x10C 0x36C 0x000 0x3 0x0
-#define MX8MP_IOMUXC_NAND_DATA05__MEDIAMIX_ISP_FLASH_TRIG_1          0x10C 0x36C 0x000 0x4 0x0
+#define MX8MP_IOMUXC_NAND_DATA05__ISP_FLASH_TRIG_1                   0x10C 0x36C 0x000 0x4 0x0
 #define MX8MP_IOMUXC_NAND_DATA05__GPIO3_IO11                         0x10C 0x36C 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_DATA05__CORESIGHT_TRACE09                  0x10C 0x36C 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_DATA05__SIM_M_HADDR07                      0x10C 0x36C 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_DATA06__RAWNAND_DATA06                     0x110 0x370 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_DATA06__NAND_DATA06                        0x110 0x370 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_DATA06__FLEXSPI_B_DATA02                   0x110 0x370 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_DATA06__USDHC3_DATA2                       0x110 0x370 0x618 0x2 0x1
 #define MX8MP_IOMUXC_NAND_DATA06__FLEXSPI_A_DATA06                   0x110 0x370 0x000 0x3 0x0
-#define MX8MP_IOMUXC_NAND_DATA06__MEDIAMIX_ISP_PRELIGHT_TRIG_1       0x110 0x370 0x000 0x4 0x0
+#define MX8MP_IOMUXC_NAND_DATA06__ISP_PRELIGHT_TRIG_1                0x110 0x370 0x000 0x4 0x0
 #define MX8MP_IOMUXC_NAND_DATA06__GPIO3_IO12                         0x110 0x370 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_DATA06__CORESIGHT_TRACE10                  0x110 0x370 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_DATA06__SIM_M_HADDR08                      0x110 0x370 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_DATA07__RAWNAND_DATA07                     0x114 0x374 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_DATA07__NAND_DATA07                        0x114 0x374 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_DATA07__FLEXSPI_B_DATA03                   0x114 0x374 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_DATA07__USDHC3_DATA3                       0x114 0x374 0x61C 0x2 0x1
 #define MX8MP_IOMUXC_NAND_DATA07__FLEXSPI_A_DATA07                   0x114 0x374 0x000 0x3 0x0
-#define MX8MP_IOMUXC_NAND_DATA07__MEDIAMIX_ISP_SHUTTER_OPEN_1        0x114 0x374 0x000 0x4 0x0
+#define MX8MP_IOMUXC_NAND_DATA07__ISP_SHUTTER_OPEN_1                 0x114 0x374 0x000 0x4 0x0
 #define MX8MP_IOMUXC_NAND_DATA07__GPIO3_IO13                         0x114 0x374 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_DATA07__CORESIGHT_TRACE11                  0x114 0x374 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_DATA07__SIM_M_HADDR09                      0x114 0x374 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_DQS__RAWNAND_DQS                           0x118 0x378 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_DQS__NAND_DQS                              0x118 0x378 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_DQS__FLEXSPI_A_DQS                         0x118 0x378 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_DQS__AUDIOMIX_SAI3_MCLK                    0x118 0x378 0x4E0 0x2 0x0
-#define MX8MP_IOMUXC_NAND_DQS__MEDIAMIX_ISP_SHUTTER_OPEN_0           0x118 0x378 0x000 0x3 0x0
+#define MX8MP_IOMUXC_NAND_DQS__ISP_SHUTTER_OPEN_0                    0x118 0x378 0x000 0x3 0x0
 #define MX8MP_IOMUXC_NAND_DQS__I2C3_SCL                              0x118 0x378 0x5B4 0x4 0x1
 #define MX8MP_IOMUXC_NAND_DQS__GPIO3_IO14                            0x118 0x378 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_DQS__CORESIGHT_TRACE12                     0x118 0x378 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_DQS__SIM_M_HADDR10                         0x118 0x378 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_RE_B__RAWNAND_RE_B                         0x11C 0x37C 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_RE_B__NAND_RE_B                            0x11C 0x37C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_RE_B__FLEXSPI_B_DQS                        0x11C 0x37C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_NAND_RE_B__USDHC3_DATA4                         0x11C 0x37C 0x620 0x2 0x1
 #define MX8MP_IOMUXC_NAND_RE_B__UART4_DCE_TX                         0x11C 0x37C 0x000 0x4 0x0
 #define MX8MP_IOMUXC_NAND_RE_B__UART4_DTE_RX                         0x11C 0x37C 0x600 0x4 0x5
 #define MX8MP_IOMUXC_NAND_RE_B__GPIO3_IO15                           0x11C 0x37C 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_RE_B__CORESIGHT_TRACE13                    0x11C 0x37C 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_RE_B__SIM_M_HADDR11                        0x11C 0x37C 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_READY_B__RAWNAND_READY_B                   0x120 0x380 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_READY_B__NAND_READY_B                      0x120 0x380 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_READY_B__USDHC3_RESET_B                    0x120 0x380 0x000 0x2 0x0
 #define MX8MP_IOMUXC_NAND_READY_B__I2C3_SCL                          0x120 0x380 0x5B4 0x4 0x2
 #define MX8MP_IOMUXC_NAND_READY_B__GPIO3_IO16                        0x120 0x380 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_READY_B__CORESIGHT_TRACE14                 0x120 0x380 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_READY_B__SIM_M_HADDR12                     0x120 0x380 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_WE_B__RAWNAND_WE_B                         0x124 0x384 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_WE_B__NAND_WE_B                            0x124 0x384 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_WE_B__USDHC3_CLK                           0x124 0x384 0x604 0x2 0x1
 #define MX8MP_IOMUXC_NAND_WE_B__I2C3_SDA                             0x124 0x384 0x5B8 0x4 0x2
 #define MX8MP_IOMUXC_NAND_WE_B__GPIO3_IO17                           0x124 0x384 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_WE_B__CORESIGHT_TRACE15                    0x124 0x384 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_WE_B__SIM_M_HADDR13                        0x124 0x384 0x000 0x7 0x0
-#define MX8MP_IOMUXC_NAND_WP_B__RAWNAND_WP_B                         0x128 0x388 0x000 0x0 0x0
+#define MX8MP_IOMUXC_NAND_WP_B__NAND_WP_B                            0x128 0x388 0x000 0x0 0x0
 #define MX8MP_IOMUXC_NAND_WP_B__USDHC3_CMD                           0x128 0x388 0x60C 0x2 0x1
 #define MX8MP_IOMUXC_NAND_WP_B__I2C4_SCL                             0x128 0x388 0x5BC 0x4 0x3
 #define MX8MP_IOMUXC_NAND_WP_B__GPIO3_IO18                           0x128 0x388 0x000 0x5 0x0
 #define MX8MP_IOMUXC_NAND_WP_B__CORESIGHT_EVENTO                     0x128 0x388 0x000 0x6 0x0
-#define MX8MP_IOMUXC_NAND_WP_B__SIM_M_HADDR14                        0x128 0x388 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SAI5_RXFS__AUDIOMIX_SAI5_RX_SYNC                0x12C 0x38C 0x508 0x0 0x0
 #define MX8MP_IOMUXC_SAI5_RXFS__AUDIOMIX_SAI1_TX_DATA00              0x12C 0x38C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI5_RXFS__PWM4_OUT                             0x12C 0x38C 0x000 0x2 0x0
 #define MX8MP_IOMUXC_SAI5_RXC__AUDIOMIX_SAI1_TX_DATA01               0x130 0x390 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI5_RXC__PWM3_OUT                              0x130 0x390 0x000 0x2 0x0
 #define MX8MP_IOMUXC_SAI5_RXC__I2C6_SDA                              0x130 0x390 0x5D0 0x3 0x1
-#define MX8MP_IOMUXC_SAI5_RXC__AUDIOMIX_CLK                          0x130 0x390 0x000 0x4 0x0
+#define MX8MP_IOMUXC_SAI5_RXC__AUDIOMIX_PDM_CLK                      0x130 0x390 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI5_RXC__GPIO3_IO20                            0x130 0x390 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI5_RXD0__AUDIOMIX_SAI5_RX_DATA00              0x134 0x394 0x4F8 0x0 0x0
 #define MX8MP_IOMUXC_SAI5_RXD0__AUDIOMIX_SAI1_TX_DATA02              0x134 0x394 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI5_RXD0__PWM2_OUT                             0x134 0x394 0x000 0x2 0x0
 #define MX8MP_IOMUXC_SAI5_RXD0__I2C5_SCL                             0x134 0x394 0x5C4 0x3 0x1
-#define MX8MP_IOMUXC_SAI5_RXD0__AUDIOMIX_BIT_STREAM00                0x134 0x394 0x4C0 0x4 0x3
+#define MX8MP_IOMUXC_SAI5_RXD0__AUDIOMIX_PDM_BIT_STREAM00            0x134 0x394 0x4C0 0x4 0x3
 #define MX8MP_IOMUXC_SAI5_RXD0__GPIO3_IO21                           0x134 0x394 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI5_RXD1__AUDIOMIX_SAI5_RX_DATA01              0x138 0x398 0x4FC 0x0 0x0
 #define MX8MP_IOMUXC_SAI5_RXD1__AUDIOMIX_SAI1_TX_DATA03              0x138 0x398 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI5_RXD1__AUDIOMIX_SAI1_TX_SYNC                0x138 0x398 0x4D8 0x2 0x0
 #define MX8MP_IOMUXC_SAI5_RXD1__AUDIOMIX_SAI5_TX_SYNC                0x138 0x398 0x510 0x3 0x0
-#define MX8MP_IOMUXC_SAI5_RXD1__AUDIOMIX_BIT_STREAM01                0x138 0x398 0x4C4 0x4 0x3
+#define MX8MP_IOMUXC_SAI5_RXD1__AUDIOMIX_PDM_BIT_STREAM01            0x138 0x398 0x4C4 0x4 0x3
 #define MX8MP_IOMUXC_SAI5_RXD1__GPIO3_IO22                           0x138 0x398 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI5_RXD1__CAN1_TX                              0x138 0x398 0x000 0x6 0x0
 #define MX8MP_IOMUXC_SAI5_RXD2__AUDIOMIX_SAI5_RX_DATA02              0x13C 0x39C 0x500 0x0 0x0
 #define MX8MP_IOMUXC_SAI5_RXD2__AUDIOMIX_SAI1_TX_DATA04              0x13C 0x39C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI5_RXD2__AUDIOMIX_SAI1_TX_SYNC                0x13C 0x39C 0x4D8 0x2 0x1
 #define MX8MP_IOMUXC_SAI5_RXD2__AUDIOMIX_SAI5_TX_BCLK                0x13C 0x39C 0x50C 0x3 0x0
-#define MX8MP_IOMUXC_SAI5_RXD2__AUDIOMIX_BIT_STREAM02                0x13C 0x39C 0x4C8 0x4 0x3
+#define MX8MP_IOMUXC_SAI5_RXD2__AUDIOMIX_PDM_BIT_STREAM02            0x13C 0x39C 0x4C8 0x4 0x3
 #define MX8MP_IOMUXC_SAI5_RXD2__GPIO3_IO23                           0x13C 0x39C 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI5_RXD2__CAN1_RX                              0x13C 0x39C 0x54C 0x6 0x0
 #define MX8MP_IOMUXC_SAI5_RXD3__AUDIOMIX_SAI5_RX_DATA03              0x140 0x3A0 0x504 0x0 0x0
 #define MX8MP_IOMUXC_SAI5_RXD3__AUDIOMIX_SAI1_TX_DATA05              0x140 0x3A0 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI5_RXD3__AUDIOMIX_SAI1_TX_SYNC                0x140 0x3A0 0x4D8 0x2 0x2
 #define MX8MP_IOMUXC_SAI5_RXD3__AUDIOMIX_SAI5_TX_DATA00              0x140 0x3A0 0x000 0x3 0x0
-#define MX8MP_IOMUXC_SAI5_RXD3__AUDIOMIX_BIT_STREAM03                0x140 0x3A0 0x4CC 0x4 0x3
+#define MX8MP_IOMUXC_SAI5_RXD3__AUDIOMIX_PDM_BIT_STREAM03            0x140 0x3A0 0x4CC 0x4 0x3
 #define MX8MP_IOMUXC_SAI5_RXD3__GPIO3_IO24                           0x140 0x3A0 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI5_RXD3__CAN2_TX                              0x140 0x3A0 0x000 0x6 0x0
 #define MX8MP_IOMUXC_SAI5_MCLK__AUDIOMIX_SAI5_MCLK                   0x144 0x3A4 0x4F0 0x0 0x0
 #define MX8MP_IOMUXC_SAI5_MCLK__GPIO3_IO25                           0x144 0x3A4 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI5_MCLK__CAN2_RX                              0x144 0x3A4 0x550 0x6 0x0
 #define MX8MP_IOMUXC_SAI1_RXFS__AUDIOMIX_SAI1_RX_SYNC                0x148 0x3A8 0x4D0 0x0 0x0
-#define MX8MP_IOMUXC_SAI1_RXFS__AUDIOMIX_SAI5_RX_SYNC                0x148 0x3A8 0x508 0x1 0x1
 #define MX8MP_IOMUXC_SAI1_RXFS__ENET1_1588_EVENT0_IN                 0x148 0x3A8 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI1_RXFS__GPIO4_IO00                           0x148 0x3A8 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_RXC__AUDIOMIX_SAI1_RX_BCLK                 0x14C 0x3AC 0x000 0x0 0x0
-#define MX8MP_IOMUXC_SAI1_RXC__AUDIOMIX_SAI5_RX_BCLK                 0x14C 0x3AC 0x4F4 0x1 0x1
-#define MX8MP_IOMUXC_SAI1_RXC__AUDIOMIX_CLK                          0x14C 0x3AC 0x000 0x3 0x0
+#define MX8MP_IOMUXC_SAI1_RXC__AUDIOMIX_PDM_CLK                      0x14C 0x3AC 0x000 0x3 0x0
 #define MX8MP_IOMUXC_SAI1_RXC__ENET1_1588_EVENT0_OUT                 0x14C 0x3AC 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI1_RXC__GPIO4_IO01                            0x14C 0x3AC 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_RXD0__AUDIOMIX_SAI1_RX_DATA00              0x150 0x3B0 0x000 0x0 0x0
-#define MX8MP_IOMUXC_SAI1_RXD0__AUDIOMIX_SAI5_RX_DATA00              0x150 0x3B0 0x4F8 0x1 0x1
 #define MX8MP_IOMUXC_SAI1_RXD0__AUDIOMIX_SAI1_TX_DATA01              0x150 0x3B0 0x000 0x2 0x0
-#define MX8MP_IOMUXC_SAI1_RXD0__AUDIOMIX_BIT_STREAM00                0x150 0x3B0 0x4C0 0x3 0x4
+#define MX8MP_IOMUXC_SAI1_RXD0__AUDIOMIX_PDM_BIT_STREAM00            0x150 0x3B0 0x4C0 0x3 0x4
 #define MX8MP_IOMUXC_SAI1_RXD0__ENET1_1588_EVENT1_IN                 0x150 0x3B0 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI1_RXD0__GPIO4_IO02                           0x150 0x3B0 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_RXD1__AUDIOMIX_SAI1_RX_DATA01              0x154 0x3B4 0x000 0x0 0x0
-#define MX8MP_IOMUXC_SAI1_RXD1__AUDIOMIX_SAI5_RX_DATA01              0x154 0x3B4 0x4FC 0x1 0x1
-#define MX8MP_IOMUXC_SAI1_RXD1__AUDIOMIX_BIT_STREAM01                0x154 0x3B4 0x4C4 0x3 0x4
+#define MX8MP_IOMUXC_SAI1_RXD1__AUDIOMIX_PDM_BIT_STREAM01            0x154 0x3B4 0x4C4 0x3 0x4
 #define MX8MP_IOMUXC_SAI1_RXD1__ENET1_1588_EVENT1_OUT                0x154 0x3B4 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI1_RXD1__GPIO4_IO03                           0x154 0x3B4 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_RXD2__AUDIOMIX_SAI1_RX_DATA02              0x158 0x3B8 0x000 0x0 0x0
-#define MX8MP_IOMUXC_SAI1_RXD2__AUDIOMIX_SAI5_RX_DATA02              0x158 0x3B8 0x500 0x1 0x1
-#define MX8MP_IOMUXC_SAI1_RXD2__AUDIOMIX_BIT_STREAM02                0x158 0x3B8 0x4C8 0x3 0x4
+#define MX8MP_IOMUXC_SAI1_RXD2__AUDIOMIX_PDM_BIT_STREAM02            0x158 0x3B8 0x4C8 0x3 0x4
 #define MX8MP_IOMUXC_SAI1_RXD2__ENET1_MDC                            0x158 0x3B8 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI1_RXD2__GPIO4_IO04                           0x158 0x3B8 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_RXD3__AUDIOMIX_SAI1_RX_DATA03              0x15C 0x3BC 0x000 0x0 0x0
-#define MX8MP_IOMUXC_SAI1_RXD3__AUDIOMIX_SAI5_RX_DATA03              0x15C 0x3BC 0x504 0x1 0x1
-#define MX8MP_IOMUXC_SAI1_RXD3__AUDIOMIX_BIT_STREAM03                0x15C 0x3BC 0x4CC 0x3 0x4
+#define MX8MP_IOMUXC_SAI1_RXD3__AUDIOMIX_PDM_BIT_STREAM03            0x15C 0x3BC 0x4CC 0x3 0x4
 #define MX8MP_IOMUXC_SAI1_RXD3__ENET1_MDIO                           0x15C 0x3BC 0x57C 0x4 0x1
 #define MX8MP_IOMUXC_SAI1_RXD3__GPIO4_IO05                           0x15C 0x3BC 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_RXD4__AUDIOMIX_SAI1_RX_DATA04              0x160 0x3C0 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SAI1_RXD7__ENET1_RGMII_RD3                      0x16C 0x3CC 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI1_RXD7__GPIO4_IO09                           0x16C 0x3CC 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_TXFS__AUDIOMIX_SAI1_TX_SYNC                0x170 0x3D0 0x4D8 0x0 0x4
-#define MX8MP_IOMUXC_SAI1_TXFS__AUDIOMIX_SAI5_TX_SYNC                0x170 0x3D0 0x510 0x1 0x1
 #define MX8MP_IOMUXC_SAI1_TXFS__ENET1_RGMII_RX_CTL                   0x170 0x3D0 0x588 0x4 0x1
 #define MX8MP_IOMUXC_SAI1_TXFS__GPIO4_IO10                           0x170 0x3D0 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_TXC__AUDIOMIX_SAI1_TX_BCLK                 0x174 0x3D4 0x4D4 0x0 0x1
-#define MX8MP_IOMUXC_SAI1_TXC__AUDIOMIX_SAI5_TX_BCLK                 0x174 0x3D4 0x50C 0x1 0x1
 #define MX8MP_IOMUXC_SAI1_TXC__ENET1_RGMII_RXC                       0x174 0x3D4 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI1_TXC__GPIO4_IO11                            0x174 0x3D4 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_TXD0__AUDIOMIX_SAI1_TX_DATA00              0x178 0x3D8 0x000 0x0 0x0
-#define MX8MP_IOMUXC_SAI1_TXD0__AUDIOMIX_SAI5_TX_DATA00              0x178 0x3D8 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI1_TXD0__ENET1_RGMII_TD0                      0x178 0x3D8 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI1_TXD0__GPIO4_IO12                           0x178 0x3D8 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_TXD1__AUDIOMIX_SAI1_TX_DATA01              0x17C 0x3DC 0x000 0x0 0x0
-#define MX8MP_IOMUXC_SAI1_TXD1__AUDIOMIX_SAI5_TX_DATA01              0x17C 0x3DC 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI1_TXD1__ENET1_RGMII_TD1                      0x17C 0x3DC 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI1_TXD1__GPIO4_IO13                           0x17C 0x3DC 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_TXD2__AUDIOMIX_SAI1_TX_DATA02              0x180 0x3E0 0x000 0x0 0x0
-#define MX8MP_IOMUXC_SAI1_TXD2__AUDIOMIX_SAI5_TX_DATA02              0x180 0x3E0 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI1_TXD2__ENET1_RGMII_TD2                      0x180 0x3E0 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI1_TXD2__GPIO4_IO14                           0x180 0x3E0 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_TXD3__AUDIOMIX_SAI1_TX_DATA03              0x184 0x3E4 0x000 0x0 0x0
-#define MX8MP_IOMUXC_SAI1_TXD3__AUDIOMIX_SAI5_TX_DATA03              0x184 0x3E4 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI1_TXD3__ENET1_RGMII_TD3                      0x184 0x3E4 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI1_TXD3__GPIO4_IO15                           0x184 0x3E4 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_TXD4__AUDIOMIX_SAI1_TX_DATA04              0x188 0x3E8 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SAI1_TXD6__GPIO4_IO18                           0x190 0x3F0 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_TXD7__AUDIOMIX_SAI1_TX_DATA07              0x194 0x3F4 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SAI1_TXD7__AUDIOMIX_SAI6_MCLK                   0x194 0x3F4 0x514 0x1 0x2
-#define MX8MP_IOMUXC_SAI1_TXD7__AUDIOMIX_CLK                         0x194 0x3F4 0x000 0x3 0x0
+#define MX8MP_IOMUXC_SAI1_TXD7__AUDIOMIX_PDM_CLK                     0x194 0x3F4 0x000 0x3 0x0
 #define MX8MP_IOMUXC_SAI1_TXD7__ENET1_TX_ER                          0x194 0x3F4 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI1_TXD7__GPIO4_IO19                           0x194 0x3F4 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI1_MCLK__AUDIOMIX_SAI1_MCLK                   0x198 0x3F8 0x000 0x0 0x0
-#define MX8MP_IOMUXC_SAI1_MCLK__AUDIOMIX_SAI5_MCLK                   0x198 0x3F8 0x4F0 0x1 0x1
 #define MX8MP_IOMUXC_SAI1_MCLK__AUDIOMIX_SAI1_TX_BCLK                0x198 0x3F8 0x4D4 0x2 0x2
 #define MX8MP_IOMUXC_SAI1_MCLK__ENET1_TX_CLK                         0x198 0x3F8 0x578 0x4 0x1
 #define MX8MP_IOMUXC_SAI1_MCLK__GPIO4_IO20                           0x198 0x3F8 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI2_RXFS__UART1_DCE_TX                         0x19C 0x3FC 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI2_RXFS__UART1_DTE_RX                         0x19C 0x3FC 0x5E8 0x4 0x2
 #define MX8MP_IOMUXC_SAI2_RXFS__GPIO4_IO21                           0x19C 0x3FC 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI2_RXFS__AUDIOMIX_BIT_STREAM02                0x19C 0x3FC 0x4C8 0x6 0x5
-#define MX8MP_IOMUXC_SAI2_RXFS__SIM_M_HSIZE00                        0x19C 0x3FC 0x000 0x7 0x0
+#define MX8MP_IOMUXC_SAI2_RXFS__AUDIOMIX_PDM_BIT_STREAM02            0x19C 0x3FC 0x4C8 0x6 0x5
 #define MX8MP_IOMUXC_SAI2_RXC__AUDIOMIX_SAI2_RX_BCLK                 0x1A0 0x400 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SAI2_RXC__AUDIOMIX_SAI5_TX_BCLK                 0x1A0 0x400 0x50C 0x1 0x2
 #define MX8MP_IOMUXC_SAI2_RXC__CAN1_TX                               0x1A0 0x400 0x000 0x3 0x0
 #define MX8MP_IOMUXC_SAI2_RXC__UART1_DCE_RX                          0x1A0 0x400 0x5E8 0x4 0x3
 #define MX8MP_IOMUXC_SAI2_RXC__UART1_DTE_TX                          0x1A0 0x400 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI2_RXC__GPIO4_IO22                            0x1A0 0x400 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI2_RXC__AUDIOMIX_BIT_STREAM01                 0x1A0 0x400 0x4C4 0x6 0x5
-#define MX8MP_IOMUXC_SAI2_RXC__SIM_M_HSIZE01                         0x1A0 0x400 0x000 0x7 0x0
+#define MX8MP_IOMUXC_SAI2_RXC__AUDIOMIX_PDM_BIT_STREAM01             0x1A0 0x400 0x4C4 0x6 0x5
 #define MX8MP_IOMUXC_SAI2_RXD0__AUDIOMIX_SAI2_RX_DATA00              0x1A4 0x404 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SAI2_RXD0__AUDIOMIX_SAI5_TX_DATA00              0x1A4 0x404 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI2_RXD0__ENET_QOS_1588_EVENT2_OUT             0x1A4 0x404 0x000 0x2 0x0
 #define MX8MP_IOMUXC_SAI2_RXD0__UART1_DCE_RTS                        0x1A4 0x404 0x5E4 0x4 0x2
 #define MX8MP_IOMUXC_SAI2_RXD0__UART1_DTE_CTS                        0x1A4 0x404 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI2_RXD0__GPIO4_IO23                           0x1A4 0x404 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI2_RXD0__AUDIOMIX_BIT_STREAM03                0x1A4 0x404 0x4CC 0x6 0x5
-#define MX8MP_IOMUXC_SAI2_RXD0__SIM_M_HSIZE02                        0x1A4 0x404 0x000 0x7 0x0
+#define MX8MP_IOMUXC_SAI2_RXD0__AUDIOMIX_PDM_BIT_STREAM03            0x1A4 0x404 0x4CC 0x6 0x5
 #define MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_SAI2_TX_SYNC                0x1A8 0x408 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_SAI5_TX_DATA01              0x1A8 0x408 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI2_TXFS__ENET_QOS_1588_EVENT3_OUT             0x1A8 0x408 0x000 0x2 0x0
 #define MX8MP_IOMUXC_SAI2_TXFS__UART1_DCE_CTS                        0x1A8 0x408 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI2_TXFS__UART1_DTE_RTS                        0x1A8 0x408 0x5E4 0x4 0x3
 #define MX8MP_IOMUXC_SAI2_TXFS__GPIO4_IO24                           0x1A8 0x408 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_BIT_STREAM02                0x1A8 0x408 0x4C8 0x6 0x6
-#define MX8MP_IOMUXC_SAI2_TXFS__SIM_M_HWRITE                         0x1A8 0x408 0x000 0x7 0x0
+#define MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_PDM_BIT_STREAM02            0x1A8 0x408 0x4C8 0x6 0x6
 #define MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI2_TX_BCLK                 0x1AC 0x40C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI5_TX_DATA02               0x1AC 0x40C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI2_TXC__CAN1_RX                               0x1AC 0x40C 0x54C 0x3 0x1
 #define MX8MP_IOMUXC_SAI2_TXC__GPIO4_IO25                            0x1AC 0x40C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_BIT_STREAM01                 0x1AC 0x40C 0x4C4 0x6 0x6
-#define MX8MP_IOMUXC_SAI2_TXC__SIM_M_HREADYOUT                       0x1AC 0x40C 0x000 0x7 0x0
+#define MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_PDM_BIT_STREAM01             0x1AC 0x40C 0x4C4 0x6 0x6
 #define MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI2_TX_DATA00              0x1B0 0x410 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI5_TX_DATA03              0x1B0 0x410 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI2_TXD0__ENET_QOS_1588_EVENT2_IN              0x1B0 0x410 0x000 0x2 0x0
 #define MX8MP_IOMUXC_SAI2_TXD0__CAN2_TX                              0x1B0 0x410 0x000 0x3 0x0
 #define MX8MP_IOMUXC_SAI2_TXD0__ENET_QOS_1588_EVENT2_AUX_IN          0x1B0 0x410 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI2_TXD0__GPIO4_IO26                           0x1B0 0x410 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI2_TXD0__CCMSRCGPCMIX_BOOT_MODE04             0x1B0 0x410 0x000 0x6 0x0
-#define MX8MP_IOMUXC_SAI2_TXD0__TPSMP_CLK                            0x1B0 0x410 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SAI2_MCLK__AUDIOMIX_SAI2_MCLK                   0x1B4 0x414 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SAI2_MCLK__AUDIOMIX_SAI5_MCLK                   0x1B4 0x414 0x4F0 0x1 0x2
 #define MX8MP_IOMUXC_SAI2_MCLK__ENET_QOS_1588_EVENT3_IN              0x1B4 0x414 0x000 0x2 0x0
 #define MX8MP_IOMUXC_SAI2_MCLK__ENET_QOS_1588_EVENT3_AUX_IN          0x1B4 0x414 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI2_MCLK__GPIO4_IO27                           0x1B4 0x414 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SAI2_MCLK__AUDIOMIX_SAI3_MCLK                   0x1B4 0x414 0x4E0 0x6 0x1
-#define MX8MP_IOMUXC_SAI2_MCLK__TPSMP_HDATA_DIR                      0x1B4 0x414 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_SAI3_RX_SYNC                0x1B8 0x418 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_SAI2_RX_DATA01              0x1B8 0x418 0x4DC 0x1 0x1
 #define MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_SAI5_RX_SYNC                0x1B8 0x418 0x508 0x2 0x2
 #define MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_SAI3_RX_DATA01              0x1B8 0x418 0x000 0x3 0x0
-#define MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_SPDIF_IN                    0x1B8 0x418 0x544 0x4 0x2
+#define MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_SPDIF1_IN                   0x1B8 0x418 0x544 0x4 0x2
 #define MX8MP_IOMUXC_SAI3_RXFS__GPIO4_IO28                           0x1B8 0x418 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_BIT_STREAM00                0x1B8 0x418 0x4C0 0x6 0x5
-#define MX8MP_IOMUXC_SAI3_RXFS__TPSMP_HTRANS00                       0x1B8 0x418 0x000 0x7 0x0
+#define MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_PDM_BIT_STREAM00            0x1B8 0x418 0x4C0 0x6 0x5
 #define MX8MP_IOMUXC_SAI3_RXC__AUDIOMIX_SAI3_RX_BCLK                 0x1BC 0x41C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SAI3_RXC__AUDIOMIX_SAI2_RX_DATA02               0x1BC 0x41C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI3_RXC__AUDIOMIX_SAI5_RX_BCLK                 0x1BC 0x41C 0x4F4 0x2 0x2
 #define MX8MP_IOMUXC_SAI3_RXC__UART2_DCE_CTS                         0x1BC 0x41C 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI3_RXC__UART2_DTE_RTS                         0x1BC 0x41C 0x5EC 0x4 0x2
 #define MX8MP_IOMUXC_SAI3_RXC__GPIO4_IO29                            0x1BC 0x41C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI3_RXC__AUDIOMIX_CLK                          0x1BC 0x41C 0x000 0x6 0x0
-#define MX8MP_IOMUXC_SAI3_RXC__TPSMP_HTRANS01                        0x1BC 0x41C 0x000 0x7 0x0
+#define MX8MP_IOMUXC_SAI3_RXC__AUDIOMIX_PDM_CLK                      0x1BC 0x41C 0x000 0x6 0x0
 #define MX8MP_IOMUXC_SAI3_RXD__AUDIOMIX_SAI3_RX_DATA00               0x1C0 0x420 0x4E4 0x0 0x1
 #define MX8MP_IOMUXC_SAI3_RXD__AUDIOMIX_SAI2_RX_DATA03               0x1C0 0x420 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI3_RXD__AUDIOMIX_SAI5_RX_DATA00               0x1C0 0x420 0x4F8 0x2 0x2
 #define MX8MP_IOMUXC_SAI3_RXD__UART2_DCE_RTS                         0x1C0 0x420 0x5EC 0x4 0x3
 #define MX8MP_IOMUXC_SAI3_RXD__UART2_DTE_CTS                         0x1C0 0x420 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI3_RXD__GPIO4_IO30                            0x1C0 0x420 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI3_RXD__AUDIOMIX_BIT_STREAM01                 0x1C0 0x420 0x4C4 0x6 0x7
-#define MX8MP_IOMUXC_SAI3_RXD__TPSMP_HDATA00                         0x1C0 0x420 0x000 0x7 0x0
+#define MX8MP_IOMUXC_SAI3_RXD__AUDIOMIX_PDM_BIT_STREAM01             0x1C0 0x420 0x4C4 0x6 0x7
 #define MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_SAI3_TX_SYNC                0x1C4 0x424 0x4EC 0x0 0x1
 #define MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_SAI2_TX_DATA01              0x1C4 0x424 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_SAI5_RX_DATA01              0x1C4 0x424 0x4FC 0x2 0x2
 #define MX8MP_IOMUXC_SAI3_TXFS__UART2_DCE_RX                         0x1C4 0x424 0x5F0 0x4 0x4
 #define MX8MP_IOMUXC_SAI3_TXFS__UART2_DTE_TX                         0x1C4 0x424 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI3_TXFS__GPIO4_IO31                           0x1C4 0x424 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_BIT_STREAM03                0x1C4 0x424 0x4CC 0x6 0x6
-#define MX8MP_IOMUXC_SAI3_TXFS__TPSMP_HDATA01                        0x1C4 0x424 0x000 0x7 0x0
+#define MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_PDM_BIT_STREAM03            0x1C4 0x424 0x4CC 0x6 0x6
 #define MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_SAI3_TX_BCLK                 0x1C8 0x428 0x4E8 0x0 0x1
 #define MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_SAI2_TX_DATA02               0x1C8 0x428 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_SAI5_RX_DATA02               0x1C8 0x428 0x500 0x2 0x2
 #define MX8MP_IOMUXC_SAI3_TXC__UART2_DCE_TX                          0x1C8 0x428 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI3_TXC__UART2_DTE_RX                          0x1C8 0x428 0x5F0 0x4 0x5
 #define MX8MP_IOMUXC_SAI3_TXC__GPIO5_IO00                            0x1C8 0x428 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_BIT_STREAM02                 0x1C8 0x428 0x4C8 0x6 0x7
-#define MX8MP_IOMUXC_SAI3_TXC__TPSMP_HDATA02                         0x1C8 0x428 0x000 0x7 0x0
+#define MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_PDM_BIT_STREAM02             0x1C8 0x428 0x4C8 0x6 0x7
 #define MX8MP_IOMUXC_SAI3_TXD__AUDIOMIX_SAI3_TX_DATA00               0x1CC 0x42C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SAI3_TXD__AUDIOMIX_SAI2_TX_DATA03               0x1CC 0x42C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI3_TXD__AUDIOMIX_SAI5_RX_DATA03               0x1CC 0x42C 0x504 0x2 0x2
 #define MX8MP_IOMUXC_SAI3_TXD__GPT1_CAPTURE2                         0x1CC 0x42C 0x598 0x3 0x0
-#define MX8MP_IOMUXC_SAI3_TXD__AUDIOMIX_SPDIF_EXT_CLK                0x1CC 0x42C 0x548 0x4 0x0
+#define MX8MP_IOMUXC_SAI3_TXD__AUDIOMIX_SPDIF1_EXT_CLK               0x1CC 0x42C 0x548 0x4 0x0
 #define MX8MP_IOMUXC_SAI3_TXD__GPIO5_IO01                            0x1CC 0x42C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI3_TXD__CCMSRCGPCMIX_BOOT_MODE05              0x1CC 0x42C 0x000 0x6 0x0
-#define MX8MP_IOMUXC_SAI3_TXD__TPSMP_HDATA03                         0x1CC 0x42C 0x000 0x7 0x0
 #define MX8MP_IOMUXC_SAI3_MCLK__AUDIOMIX_SAI3_MCLK                   0x1D0 0x430 0x4E0 0x0 0x2
 #define MX8MP_IOMUXC_SAI3_MCLK__PWM4_OUT                             0x1D0 0x430 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SAI3_MCLK__AUDIOMIX_SAI5_MCLK                   0x1D0 0x430 0x4F0 0x2 0x3
-#define MX8MP_IOMUXC_SAI3_MCLK__AUDIOMIX_SPDIF_OUT                   0x1D0 0x430 0x000 0x4 0x0
+#define MX8MP_IOMUXC_SAI3_MCLK__AUDIOMIX_SPDIF1_OUT                  0x1D0 0x430 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SAI3_MCLK__GPIO5_IO02                           0x1D0 0x430 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SAI3_MCLK__AUDIOMIX_SPDIF_IN                    0x1D0 0x430 0x544 0x6 0x3
-#define MX8MP_IOMUXC_SAI3_MCLK__TPSMP_HDATA04                        0x1D0 0x430 0x000 0x7 0x0
-#define MX8MP_IOMUXC_SPDIF_TX__AUDIOMIX_SPDIF_OUT                    0x1D4 0x434 0x000 0x0 0x0
+#define MX8MP_IOMUXC_SAI3_MCLK__AUDIOMIX_SPDIF1_IN                   0x1D0 0x430 0x544 0x6 0x3
+#define MX8MP_IOMUXC_SPDIF_TX__AUDIOMIX_SPDIF1_OUT                   0x1D4 0x434 0x000 0x0 0x0
 #define MX8MP_IOMUXC_SPDIF_TX__PWM3_OUT                              0x1D4 0x434 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SPDIF_TX__I2C5_SCL                              0x1D4 0x434 0x5C4 0x2 0x2
 #define MX8MP_IOMUXC_SPDIF_TX__GPT1_COMPARE1                         0x1D4 0x434 0x000 0x3 0x0
 #define MX8MP_IOMUXC_SPDIF_TX__CAN1_TX                               0x1D4 0x434 0x000 0x4 0x0
 #define MX8MP_IOMUXC_SPDIF_TX__GPIO5_IO03                            0x1D4 0x434 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SPDIF_RX__AUDIOMIX_SPDIF_IN                     0x1D8 0x438 0x544 0x0 0x4
+#define MX8MP_IOMUXC_SPDIF_RX__AUDIOMIX_SPDIF1_IN                    0x1D8 0x438 0x544 0x0 0x4
 #define MX8MP_IOMUXC_SPDIF_RX__PWM2_OUT                              0x1D8 0x438 0x000 0x1 0x0
 #define MX8MP_IOMUXC_SPDIF_RX__I2C5_SDA                              0x1D8 0x438 0x5C8 0x2 0x2
 #define MX8MP_IOMUXC_SPDIF_RX__GPT1_COMPARE2                         0x1D8 0x438 0x000 0x3 0x0
 #define MX8MP_IOMUXC_SPDIF_RX__GPIO5_IO04                            0x1D8 0x438 0x000 0x5 0x0
 #define MX8MP_IOMUXC_SPDIF_EXT_CLK__GPT1_COMPARE3                    0x1DC 0x43C 0x000 0x3 0x0
 #define MX8MP_IOMUXC_SPDIF_EXT_CLK__GPIO5_IO05                       0x1DC 0x43C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_SPDIF_EXT_CLK__AUDIOMIX_SPDIF_EXT_CLK           0x1DC 0x43C 0x548 0x0 0x1
+#define MX8MP_IOMUXC_SPDIF_EXT_CLK__AUDIOMIX_SPDIF1_EXT_CLK          0x1DC 0x43C 0x548 0x0 0x1
 #define MX8MP_IOMUXC_SPDIF_EXT_CLK__PWM1_OUT                         0x1DC 0x43C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_ECSPI1_SCLK__ECSPI1_SCLK                        0x1E0 0x440 0x558 0x0 0x0
 #define MX8MP_IOMUXC_ECSPI1_SCLK__UART3_DCE_RX                       0x1E0 0x440 0x5F8 0x1 0x4
 #define MX8MP_IOMUXC_ECSPI1_SCLK__I2C1_SCL                           0x1E0 0x440 0x5A4 0x2 0x1
 #define MX8MP_IOMUXC_ECSPI1_SCLK__AUDIOMIX_SAI7_RX_SYNC              0x1E0 0x440 0x538 0x3 0x1
 #define MX8MP_IOMUXC_ECSPI1_SCLK__GPIO5_IO06                         0x1E0 0x440 0x000 0x5 0x0
-#define MX8MP_IOMUXC_ECSPI1_SCLK__TPSMP_HDATA08                      0x1E0 0x440 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ECSPI1_MOSI__ECSPI1_MOSI                        0x1E4 0x444 0x560 0x0 0x0
 #define MX8MP_IOMUXC_ECSPI1_MOSI__UART3_DCE_TX                       0x1E4 0x444 0x000 0x1 0x0
 #define MX8MP_IOMUXC_ECSPI1_MOSI__UART3_DTE_RX                       0x1E4 0x444 0x5F8 0x1 0x5
 #define MX8MP_IOMUXC_ECSPI1_MOSI__I2C1_SDA                           0x1E4 0x444 0x5A8 0x2 0x1
 #define MX8MP_IOMUXC_ECSPI1_MOSI__AUDIOMIX_SAI7_RX_BCLK              0x1E4 0x444 0x530 0x3 0x1
 #define MX8MP_IOMUXC_ECSPI1_MOSI__GPIO5_IO07                         0x1E4 0x444 0x000 0x5 0x0
-#define MX8MP_IOMUXC_ECSPI1_MOSI__TPSMP_HDATA09                      0x1E4 0x444 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ECSPI1_MISO__ECSPI1_MISO                        0x1E8 0x448 0x55C 0x0 0x0
 #define MX8MP_IOMUXC_ECSPI1_MISO__UART3_DCE_CTS                      0x1E8 0x448 0x000 0x1 0x0
 #define MX8MP_IOMUXC_ECSPI1_MISO__UART3_DTE_RTS                      0x1E8 0x448 0x5F4 0x1 0x2
 #define MX8MP_IOMUXC_ECSPI1_MISO__I2C2_SCL                           0x1E8 0x448 0x5AC 0x2 0x1
 #define MX8MP_IOMUXC_ECSPI1_MISO__AUDIOMIX_SAI7_RX_DATA00            0x1E8 0x448 0x534 0x3 0x1
 #define MX8MP_IOMUXC_ECSPI1_MISO__GPIO5_IO08                         0x1E8 0x448 0x000 0x5 0x0
-#define MX8MP_IOMUXC_ECSPI1_MISO__TPSMP_HDATA10                      0x1E8 0x448 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ECSPI1_SS0__ECSPI1_SS0                          0x1EC 0x44C 0x564 0x0 0x0
 #define MX8MP_IOMUXC_ECSPI1_SS0__UART3_DCE_RTS                       0x1EC 0x44C 0x5F4 0x1 0x3
 #define MX8MP_IOMUXC_ECSPI1_SS0__UART3_DTE_CTS                       0x1EC 0x44C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_ECSPI1_SS0__I2C2_SDA                            0x1EC 0x44C 0x5B0 0x2 0x1
 #define MX8MP_IOMUXC_ECSPI1_SS0__AUDIOMIX_SAI7_TX_SYNC               0x1EC 0x44C 0x540 0x3 0x1
 #define MX8MP_IOMUXC_ECSPI1_SS0__GPIO5_IO09                          0x1EC 0x44C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_ECSPI1_SS0__TPSMP_HDATA11                       0x1EC 0x44C 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ECSPI2_SCLK__ECSPI2_SCLK                        0x1F0 0x450 0x568 0x0 0x1
 #define MX8MP_IOMUXC_ECSPI2_SCLK__UART4_DCE_RX                       0x1F0 0x450 0x600 0x1 0x6
 #define MX8MP_IOMUXC_ECSPI2_SCLK__UART4_DTE_TX                       0x1F0 0x450 0x000 0x1 0x0
 #define MX8MP_IOMUXC_ECSPI2_SCLK__I2C3_SCL                           0x1F0 0x450 0x5B4 0x2 0x3
 #define MX8MP_IOMUXC_ECSPI2_SCLK__AUDIOMIX_SAI7_TX_BCLK              0x1F0 0x450 0x53C 0x3 0x1
 #define MX8MP_IOMUXC_ECSPI2_SCLK__GPIO5_IO10                         0x1F0 0x450 0x000 0x5 0x0
-#define MX8MP_IOMUXC_ECSPI2_SCLK__TPSMP_HDATA12                      0x1F0 0x450 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ECSPI2_MOSI__ECSPI2_MOSI                        0x1F4 0x454 0x570 0x0 0x1
 #define MX8MP_IOMUXC_ECSPI2_MOSI__UART4_DCE_TX                       0x1F4 0x454 0x000 0x1 0x0
 #define MX8MP_IOMUXC_ECSPI2_MOSI__UART4_DTE_RX                       0x1F4 0x454 0x600 0x1 0x7
 #define MX8MP_IOMUXC_ECSPI2_MOSI__I2C3_SDA                           0x1F4 0x454 0x5B8 0x2 0x3
 #define MX8MP_IOMUXC_ECSPI2_MOSI__AUDIOMIX_SAI7_TX_DATA00            0x1F4 0x454 0x000 0x3 0x0
 #define MX8MP_IOMUXC_ECSPI2_MOSI__GPIO5_IO11                         0x1F4 0x454 0x000 0x5 0x0
-#define MX8MP_IOMUXC_ECSPI2_MOSI__TPSMP_HDATA13                      0x1F4 0x454 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ECSPI2_MISO__GPIO5_IO12                         0x1F8 0x458 0x000 0x5 0x0
-#define MX8MP_IOMUXC_ECSPI2_MISO__TPSMP_HDATA14                      0x1F8 0x458 0x000 0x7 0x0
 #define MX8MP_IOMUXC_ECSPI2_MISO__ECSPI2_MISO                        0x1F8 0x458 0x56C 0x0 0x1
 #define MX8MP_IOMUXC_ECSPI2_MISO__UART4_DCE_CTS                      0x1F8 0x458 0x000 0x1 0x0
 #define MX8MP_IOMUXC_ECSPI2_MISO__UART4_DTE_RTS                      0x1F8 0x458 0x5FC 0x1 0x2
 #define MX8MP_IOMUXC_ECSPI2_MISO__I2C4_SCL                           0x1F8 0x458 0x5BC 0x2 0x4
 #define MX8MP_IOMUXC_ECSPI2_MISO__AUDIOMIX_SAI7_MCLK                 0x1F8 0x458 0x52C 0x3 0x1
-#define MX8MP_IOMUXC_ECSPI2_MISO__CCMSRCGPCMIX_CLKO1                 0x1F8 0x458 0x000 0x4 0x0
+#define MX8MP_IOMUXC_ECSPI2_MISO__CCM_CLKO1                          0x1F8 0x458 0x000 0x4 0x0
 #define MX8MP_IOMUXC_ECSPI2_SS0__ECSPI2_SS0                          0x1FC 0x45C 0x574 0x0 0x1
 #define MX8MP_IOMUXC_ECSPI2_SS0__UART4_DCE_RTS                       0x1FC 0x45C 0x5FC 0x1 0x3
 #define MX8MP_IOMUXC_ECSPI2_SS0__UART4_DTE_CTS                       0x1FC 0x45C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_ECSPI2_SS0__I2C4_SDA                            0x1FC 0x45C 0x5C0 0x2 0x4
-#define MX8MP_IOMUXC_ECSPI2_SS0__CCMSRCGPCMIX_CLKO2                  0x1FC 0x45C 0x000 0x4 0x0
+#define MX8MP_IOMUXC_ECSPI2_SS0__CCM_CLKO2                           0x1FC 0x45C 0x000 0x4 0x0
 #define MX8MP_IOMUXC_ECSPI2_SS0__GPIO5_IO13                          0x1FC 0x45C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_ECSPI2_SS0__TPSMP_HDATA15                       0x1FC 0x45C 0x000 0x7 0x0
 #define MX8MP_IOMUXC_I2C1_SCL__I2C1_SCL                              0x200 0x460 0x5A4 0x0 0x2
 #define MX8MP_IOMUXC_I2C1_SCL__ENET_QOS_MDC                          0x200 0x460 0x000 0x1 0x0
 #define MX8MP_IOMUXC_I2C1_SCL__ECSPI1_SCLK                           0x200 0x460 0x558 0x3 0x1
 #define MX8MP_IOMUXC_I2C1_SCL__GPIO5_IO14                            0x200 0x460 0x000 0x5 0x0
-#define MX8MP_IOMUXC_I2C1_SCL__TPSMP_HDATA16                         0x200 0x460 0x000 0x7 0x0
 #define MX8MP_IOMUXC_I2C1_SDA__I2C1_SDA                              0x204 0x464 0x5A8 0x0 0x2
 #define MX8MP_IOMUXC_I2C1_SDA__ENET_QOS_MDIO                         0x204 0x464 0x590 0x1 0x2
 #define MX8MP_IOMUXC_I2C1_SDA__ECSPI1_MOSI                           0x204 0x464 0x560 0x3 0x1
 #define MX8MP_IOMUXC_I2C1_SDA__GPIO5_IO15                            0x204 0x464 0x000 0x5 0x0
-#define MX8MP_IOMUXC_I2C1_SDA__TPSMP_HDATA17                         0x204 0x464 0x000 0x7 0x0
 #define MX8MP_IOMUXC_I2C2_SCL__I2C2_SCL                              0x208 0x468 0x5AC 0x0 0x2
 #define MX8MP_IOMUXC_I2C2_SCL__ENET_QOS_1588_EVENT1_IN               0x208 0x468 0x000 0x1 0x0
 #define MX8MP_IOMUXC_I2C2_SCL__USDHC3_CD_B                           0x208 0x468 0x608 0x2 0x3
 #define MX8MP_IOMUXC_I2C2_SCL__ECSPI1_MISO                           0x208 0x468 0x55C 0x3 0x1
 #define MX8MP_IOMUXC_I2C2_SCL__ENET_QOS_1588_EVENT1_AUX_IN           0x208 0x468 0x000 0x4 0x0
 #define MX8MP_IOMUXC_I2C2_SCL__GPIO5_IO16                            0x208 0x468 0x000 0x5 0x0
-#define MX8MP_IOMUXC_I2C2_SCL__TPSMP_HDATA18                         0x208 0x468 0x000 0x7 0x0
 #define MX8MP_IOMUXC_I2C2_SDA__I2C2_SDA                              0x20C 0x46C 0x5B0 0x0 0x2
 #define MX8MP_IOMUXC_I2C2_SDA__ENET_QOS_1588_EVENT1_OUT              0x20C 0x46C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_I2C2_SDA__USDHC3_WP                             0x20C 0x46C 0x634 0x2 0x3
 #define MX8MP_IOMUXC_I2C2_SDA__ECSPI1_SS0                            0x20C 0x46C 0x564 0x3 0x1
 #define MX8MP_IOMUXC_I2C2_SDA__GPIO5_IO17                            0x20C 0x46C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_I2C2_SDA__TPSMP_HDATA19                         0x20C 0x46C 0x000 0x7 0x0
 #define MX8MP_IOMUXC_I2C3_SCL__I2C3_SCL                              0x210 0x470 0x5B4 0x0 0x4
 #define MX8MP_IOMUXC_I2C3_SCL__PWM4_OUT                              0x210 0x470 0x000 0x1 0x0
 #define MX8MP_IOMUXC_I2C3_SCL__GPT2_CLK                              0x210 0x470 0x000 0x2 0x0
 #define MX8MP_IOMUXC_I2C3_SCL__ECSPI2_SCLK                           0x210 0x470 0x568 0x3 0x2
 #define MX8MP_IOMUXC_I2C3_SCL__GPIO5_IO18                            0x210 0x470 0x000 0x5 0x0
-#define MX8MP_IOMUXC_I2C3_SCL__TPSMP_HDATA20                         0x210 0x470 0x000 0x7 0x0
 #define MX8MP_IOMUXC_I2C3_SDA__I2C3_SDA                              0x214 0x474 0x5B8 0x0 0x4
 #define MX8MP_IOMUXC_I2C3_SDA__PWM3_OUT                              0x214 0x474 0x000 0x1 0x0
 #define MX8MP_IOMUXC_I2C3_SDA__GPT3_CLK                              0x214 0x474 0x000 0x2 0x0
 #define MX8MP_IOMUXC_I2C3_SDA__ECSPI2_MOSI                           0x214 0x474 0x570 0x3 0x2
 #define MX8MP_IOMUXC_I2C3_SDA__GPIO5_IO19                            0x214 0x474 0x000 0x5 0x0
-#define MX8MP_IOMUXC_I2C3_SDA__TPSMP_HDATA21                         0x214 0x474 0x000 0x7 0x0
 #define MX8MP_IOMUXC_I2C4_SCL__I2C4_SCL                              0x218 0x478 0x5BC 0x0 0x5
 #define MX8MP_IOMUXC_I2C4_SCL__PWM2_OUT                              0x218 0x478 0x000 0x1 0x0
-#define MX8MP_IOMUXC_I2C4_SCL__HSIOMIX_PCIE_CLKREQ_B                 0x218 0x478 0x5A0 0x2 0x0
+#define MX8MP_IOMUXC_I2C4_SCL__PCIE_CLKREQ_B                         0x218 0x478 0x5A0 0x2 0x0
 #define MX8MP_IOMUXC_I2C4_SCL__ECSPI2_MISO                           0x218 0x478 0x56C 0x3 0x2
 #define MX8MP_IOMUXC_I2C4_SCL__GPIO5_IO20                            0x218 0x478 0x000 0x5 0x0
-#define MX8MP_IOMUXC_I2C4_SCL__TPSMP_HDATA22                         0x218 0x478 0x000 0x7 0x0
 #define MX8MP_IOMUXC_I2C4_SDA__I2C4_SDA                              0x21C 0x47C 0x5C0 0x0 0x5
 #define MX8MP_IOMUXC_I2C4_SDA__PWM1_OUT                              0x21C 0x47C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_I2C4_SDA__ECSPI2_SS0                            0x21C 0x47C 0x574 0x3 0x2
 #define MX8MP_IOMUXC_I2C4_SDA__GPIO5_IO21                            0x21C 0x47C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_I2C4_SDA__TPSMP_HDATA23                         0x21C 0x47C 0x000 0x7 0x0
 #define MX8MP_IOMUXC_UART1_RXD__UART1_DCE_RX                         0x220 0x480 0x5E8 0x0 0x4
 #define MX8MP_IOMUXC_UART1_RXD__UART1_DTE_TX                         0x220 0x480 0x000 0x0 0x0
 #define MX8MP_IOMUXC_UART1_RXD__ECSPI3_SCLK                          0x220 0x480 0x000 0x1 0x0
 #define MX8MP_IOMUXC_UART1_RXD__GPIO5_IO22                           0x220 0x480 0x000 0x5 0x0
-#define MX8MP_IOMUXC_UART1_RXD__TPSMP_HDATA24                        0x220 0x480 0x000 0x7 0x0
 #define MX8MP_IOMUXC_UART1_TXD__UART1_DCE_TX                         0x224 0x484 0x000 0x0 0x0
 #define MX8MP_IOMUXC_UART1_TXD__UART1_DTE_RX                         0x224 0x484 0x5E8 0x0 0x5
 #define MX8MP_IOMUXC_UART1_TXD__ECSPI3_MOSI                          0x224 0x484 0x000 0x1 0x0
 #define MX8MP_IOMUXC_UART1_TXD__GPIO5_IO23                           0x224 0x484 0x000 0x5 0x0
-#define MX8MP_IOMUXC_UART1_TXD__TPSMP_HDATA25                        0x224 0x484 0x000 0x7 0x0
 #define MX8MP_IOMUXC_UART2_RXD__UART2_DCE_RX                         0x228 0x488 0x5F0 0x0 0x6
 #define MX8MP_IOMUXC_UART2_RXD__UART2_DTE_TX                         0x228 0x488 0x000 0x0 0x0
 #define MX8MP_IOMUXC_UART2_RXD__ECSPI3_MISO                          0x228 0x488 0x000 0x1 0x0
 #define MX8MP_IOMUXC_UART2_RXD__GPT1_COMPARE3                        0x228 0x488 0x000 0x3 0x0
 #define MX8MP_IOMUXC_UART2_RXD__GPIO5_IO24                           0x228 0x488 0x000 0x5 0x0
-#define MX8MP_IOMUXC_UART2_RXD__TPSMP_HDATA26                        0x228 0x488 0x000 0x7 0x0
 #define MX8MP_IOMUXC_UART2_TXD__UART2_DCE_TX                         0x22C 0x48C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_UART2_TXD__UART2_DTE_RX                         0x22C 0x48C 0x5F0 0x0 0x7
 #define MX8MP_IOMUXC_UART2_TXD__ECSPI3_SS0                           0x22C 0x48C 0x000 0x1 0x0
 #define MX8MP_IOMUXC_UART2_TXD__GPT1_COMPARE2                        0x22C 0x48C 0x000 0x3 0x0
 #define MX8MP_IOMUXC_UART2_TXD__GPIO5_IO25                           0x22C 0x48C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_UART2_TXD__TPSMP_HDATA27                        0x22C 0x48C 0x000 0x7 0x0
 #define MX8MP_IOMUXC_UART3_RXD__UART3_DCE_RX                         0x230 0x490 0x5F8 0x0 0x6
 #define MX8MP_IOMUXC_UART3_RXD__UART3_DTE_TX                         0x230 0x490 0x000 0x0 0x0
 #define MX8MP_IOMUXC_UART3_RXD__UART1_DCE_CTS                        0x230 0x490 0x000 0x1 0x0
 #define MX8MP_IOMUXC_UART3_RXD__GPT1_CAPTURE2                        0x230 0x490 0x598 0x3 0x1
 #define MX8MP_IOMUXC_UART3_RXD__CAN2_TX                              0x230 0x490 0x000 0x4 0x0
 #define MX8MP_IOMUXC_UART3_RXD__GPIO5_IO26                           0x230 0x490 0x000 0x5 0x0
-#define MX8MP_IOMUXC_UART3_RXD__TPSMP_HDATA28                        0x230 0x490 0x000 0x7 0x0
 #define MX8MP_IOMUXC_UART3_TXD__UART3_DCE_TX                         0x234 0x494 0x000 0x0 0x0
 #define MX8MP_IOMUXC_UART3_TXD__UART3_DTE_RX                         0x234 0x494 0x5F8 0x0 0x7
 #define MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS                        0x234 0x494 0x5E4 0x1 0x5
 #define MX8MP_IOMUXC_UART3_TXD__GPT1_CLK                             0x234 0x494 0x59C 0x3 0x1
 #define MX8MP_IOMUXC_UART3_TXD__CAN2_RX                              0x234 0x494 0x550 0x4 0x2
 #define MX8MP_IOMUXC_UART3_TXD__GPIO5_IO27                           0x234 0x494 0x000 0x5 0x0
-#define MX8MP_IOMUXC_UART3_TXD__TPSMP_HDATA29                        0x234 0x494 0x000 0x7 0x0
 #define MX8MP_IOMUXC_UART4_RXD__UART4_DCE_RX                         0x238 0x498 0x600 0x0 0x8
 #define MX8MP_IOMUXC_UART4_RXD__UART4_DTE_TX                         0x238 0x498 0x000 0x0 0x0
 #define MX8MP_IOMUXC_UART4_RXD__UART2_DCE_CTS                        0x238 0x498 0x000 0x1 0x0
 #define MX8MP_IOMUXC_UART4_RXD__UART2_DTE_RTS                        0x238 0x498 0x5EC 0x1 0x4
-#define MX8MP_IOMUXC_UART4_RXD__HSIOMIX_PCIE_CLKREQ_B                0x238 0x498 0x5A0 0x2 0x1
+#define MX8MP_IOMUXC_UART4_RXD__PCIE_CLKREQ_B                        0x238 0x498 0x5A0 0x2 0x1
 #define MX8MP_IOMUXC_UART4_RXD__GPT1_COMPARE1                        0x238 0x498 0x000 0x3 0x0
 #define MX8MP_IOMUXC_UART4_RXD__I2C6_SCL                             0x238 0x498 0x5CC 0x4 0x2
 #define MX8MP_IOMUXC_UART4_RXD__GPIO5_IO28                           0x238 0x498 0x000 0x5 0x0
-#define MX8MP_IOMUXC_UART4_RXD__TPSMP_HDATA30                        0x238 0x498 0x000 0x7 0x0
 #define MX8MP_IOMUXC_UART4_TXD__UART4_DCE_TX                         0x23C 0x49C 0x000 0x0 0x0
 #define MX8MP_IOMUXC_UART4_TXD__UART4_DTE_RX                         0x23C 0x49C 0x600 0x0 0x9
 #define MX8MP_IOMUXC_UART4_TXD__UART2_DCE_RTS                        0x23C 0x49C 0x5EC 0x1 0x5
 #define MX8MP_IOMUXC_UART4_TXD__GPT1_CAPTURE1                        0x23C 0x49C 0x594 0x3 0x1
 #define MX8MP_IOMUXC_UART4_TXD__I2C6_SDA                             0x23C 0x49C 0x5D0 0x4 0x2
 #define MX8MP_IOMUXC_UART4_TXD__GPIO5_IO29                           0x23C 0x49C 0x000 0x5 0x0
-#define MX8MP_IOMUXC_UART4_TXD__TPSMP_HDATA31                        0x23C 0x49C 0x000 0x7 0x0
-#define MX8MP_IOMUXC_HDMI_DDC_SCL__HDMIMIX_EARC_SCL                  0x240 0x4A0 0x000 0x0 0x0
+#define MX8MP_IOMUXC_HDMI_DDC_SCL__HDMIMIX_HDMI_SCL                  0x240 0x4A0 0x000 0x0 0x0
 #define MX8MP_IOMUXC_HDMI_DDC_SCL__I2C5_SCL                          0x240 0x4A0 0x5C4 0x3 0x3
 #define MX8MP_IOMUXC_HDMI_DDC_SCL__CAN1_TX                           0x240 0x4A0 0x000 0x4 0x0
 #define MX8MP_IOMUXC_HDMI_DDC_SCL__GPIO3_IO26                        0x240 0x4A0 0x000 0x5 0x0
-#define MX8MP_IOMUXC_HDMI_DDC_SCL__AUDIOMIX_test_out00               0x240 0x4A0 0x000 0x6 0x0
-#define MX8MP_IOMUXC_HDMI_DDC_SDA__HDMIMIX_EARC_SDA                  0x244 0x4A4 0x000 0x0 0x0
+#define MX8MP_IOMUXC_HDMI_DDC_SDA__HDMIMIX_HDMI_SDA                  0x244 0x4A4 0x000 0x0 0x0
 #define MX8MP_IOMUXC_HDMI_DDC_SDA__I2C5_SDA                          0x244 0x4A4 0x5C8 0x3 0x3
 #define MX8MP_IOMUXC_HDMI_DDC_SDA__CAN1_RX                           0x244 0x4A4 0x54C 0x4 0x3
 #define MX8MP_IOMUXC_HDMI_DDC_SDA__GPIO3_IO27                        0x244 0x4A4 0x000 0x5 0x0
-#define MX8MP_IOMUXC_HDMI_DDC_SDA__AUDIOMIX_test_out01               0x244 0x4A4 0x000 0x6 0x0
-#define MX8MP_IOMUXC_HDMI_CEC__HDMIMIX_EARC_CEC                      0x248 0x4A8 0x000 0x0 0x0
+#define MX8MP_IOMUXC_HDMI_CEC__HDMIMIX_HDMI_CEC                      0x248 0x4A8 0x000 0x0 0x0
 #define MX8MP_IOMUXC_HDMI_CEC__I2C6_SCL                              0x248 0x4A8 0x5CC 0x3 0x3
 #define MX8MP_IOMUXC_HDMI_CEC__CAN2_TX                               0x248 0x4A8 0x000 0x4 0x0
 #define MX8MP_IOMUXC_HDMI_CEC__GPIO3_IO28                            0x248 0x4A8 0x000 0x5 0x0
-#define MX8MP_IOMUXC_HDMI_HPD__HDMIMIX_EARC_DC_HPD                   0x24C 0x4AC 0x000 0x0 0x0
-#define MX8MP_IOMUXC_HDMI_HPD__AUDIOMIX_EARC_HDMI_HPD_O              0x24C 0x4AC 0x000 0x1 0x0
+#define MX8MP_IOMUXC_HDMI_HPD__HDMIMIX_HDMI_HPD                      0x24C 0x4AC 0x000 0x0 0x0
+#define MX8MP_IOMUXC_HDMI_HPD__AUDIOMIX_HDMI_HPD_O                   0x24C 0x4AC 0x000 0x1 0x0
 #define MX8MP_IOMUXC_HDMI_HPD__I2C6_SDA                              0x24C 0x4AC 0x5D0 0x3 0x3
 #define MX8MP_IOMUXC_HDMI_HPD__CAN2_RX                               0x24C 0x4AC 0x550 0x4 0x3
 #define MX8MP_IOMUXC_HDMI_HPD__GPIO3_IO29                            0x24C 0x4AC 0x000 0x5 0x0
index a5154f1..6038f66 100644 (file)
                                reg = <0x30be0000 0x10000>;
                                interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
                                             <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
+                                            <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
+                                            <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clk IMX8MP_CLK_ENET1_ROOT>,
                                         <&clk IMX8MP_CLK_SIM_ENET_ROOT>,
                                         <&clk IMX8MP_CLK_ENET_TIMER>,
index c9241ab..2418cca 100644 (file)
        };
 };
 
+&dphy {
+       status = "okay";
+};
+
 &fec1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_fec1>;
        phy-mode = "rgmii-id";
        phy-handle = <&ethphy0>;
-       phy-reset-gpios = <&gpio1 9  GPIO_ACTIVE_LOW>;
-       phy-reset-duration = <10>;
        fsl,magic-packet;
        status = "okay";
 
                ethphy0: ethernet-phy@0 {
                        compatible = "ethernet-phy-ieee802.3-c22";
                        reg = <0>;
+                       reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+                       reset-assert-us = <10000>;
                };
        };
 };
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_wifi_reset>;
 
-       wl-reg-on {
+       wl-reg-on-hog {
                gpio-hog;
                gpios = <29 GPIO_ACTIVE_HIGH>;
                output-high;
        };
 };
 
+&lcdif {
+       status = "okay";
+};
+
+&mipi_dsi {
+       #address-cells = <1>;
+       #size-cells = <0>;
+       status = "okay";
+
+       panel@0 {
+               pinctrl-0 = <&pinctrl_mipi_dsi>;
+               pinctrl-names = "default";
+               compatible = "raydium,rm67191";
+               reg = <0>;
+               reset-gpios = <&gpio5 6 GPIO_ACTIVE_LOW>;
+               dsi-lanes = <4>;
+
+               port {
+                       panel_in: endpoint {
+                               remote-endpoint = <&mipi_dsi_out>;
+                       };
+               };
+       };
+
+       ports {
+               port@1 {
+                       reg = <1>;
+                       mipi_dsi_out: endpoint {
+                               remote-endpoint = <&panel_in>;
+                       };
+               };
+       };
+};
+
 &pcie0 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_pcie0>;
                >;
        };
 
+       pinctrl_mipi_dsi: mipidsigrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_ECSPI1_SCLK_GPIO5_IO6              0x16
+               >;
+       };
+
        pinctrl_pcie0: pcie0grp {
                fsl,pins = <
                        MX8MQ_IOMUXC_I2C4_SCL_PCIE1_CLKREQ_B            0x76
                >;
        };
 
-       pinctrl_reg_usdhc2: regusdhc2grpgpio {
+       pinctrl_reg_usdhc2: regusdhc2gpiogrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_RESET_B_GPIO2_IO19             0x41
                >;
index bfd91c1..366693f 100644 (file)
                >;
        };
 
-       pinctrl_usdhc2_gpio: usdhc2grpgpio {
+       pinctrl_usdhc2_gpio: usdhc2gpiogrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_CD_B_GPIO2_IO12        0x41
                >;
        };
 
-       pinctrl_usdhc2_vmmc: usdhc2vmmcgpio {
+       pinctrl_usdhc2_vmmc: usdhc2vmmcgpiogrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_GPIO1_IO13_GPIO1_IO13      0x41
                >;
                >;
        };
 
-       pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
+       pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK                 0x8d
                        MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD                 0xcd
                >;
        };
 
-       pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
+       pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK                 0x9f
                        MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD                 0xdf
index 6900ac2..af139b2 100644 (file)
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include "dt-bindings/input/input.h"
+#include <dt-bindings/interrupt-controller/irq.h>
 #include "dt-bindings/pwm/pwm.h"
 #include "dt-bindings/usb/pd.h"
 #include "imx8mq.dtsi"
@@ -60,7 +61,7 @@
                        label = "WWAN_WAKE";
                        gpios = <&gpio3 8 GPIO_ACTIVE_LOW>;
                        interrupt-parent = <&gpio3>;
-                       interrupts = <8 GPIO_ACTIVE_LOW>;
+                       interrupts = <8 IRQ_TYPE_LEVEL_LOW>;
                        wakeup-source;
                        linux,code = <KEY_PHONE>;
                };
                pinctrl-0 = <&pinctrl_pmic>;
                clocks = <&pmic_osc>;
                clock-names = "osc";
+               #clock-cells = <0>;
                clock-output-names = "pmic_clk";
                interrupt-parent = <&gpio1>;
-               interrupts = <3 GPIO_ACTIVE_LOW>;
-               interrupt-names = "irq";
+               interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
                rohm,reset-snvs-powered;
 
                regulators {
                >;
        };
 
-       pinctrl_usdhc1_100mhz: usdhc1grp100mhz {
+       pinctrl_usdhc1_100mhz: usdhc1-100mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x8d
                        MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xcd
                >;
        };
 
-       pinctrl_usdhc1_200mhz: usdhc1grp200mhz {
+       pinctrl_usdhc1_200mhz: usdhc1-200mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x9f
                        MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xdf
                >;
        };
 
-       pinctrl_usdhc2_pwr: usdhc2grppwr {
+       pinctrl_usdhc2_pwr: usdhc2pwrgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_RESET_B_GPIO2_IO19     0x41
                >;
        };
 
-       pinctrl_usdhc2_gpio: usdhc2grpgpio {
+       pinctrl_usdhc2_gpio: usdhc2gpiogrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_WP_GPIO2_IO20          0x80 /* WIFI_WAKE */
                >;
                >;
        };
 
-       pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
+       pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK         0x8d
                        MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD         0xcd
                >;
        };
 
-       pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
+       pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK         0x9f
                        MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD         0xcf
        };
 };
 
+&lcdif {
+       status = "okay";
+};
+
+&mipi_dsi {
+       status = "okay";
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       panel@0 {
+               compatible = "rocktech,jh057n00900";
+               reg = <0>;
+               backlight = <&backlight_dsi>;
+               reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
+               iovcc-supply = <&reg_1v8_p>;
+               vcc-supply = <&reg_2v8_p>;
+               port {
+                       panel_in: endpoint {
+                               remote-endpoint = <&mipi_dsi_out>;
+                       };
+               };
+       };
+
+       ports {
+               port@1 {
+                       reg = <1>;
+                       mipi_dsi_out: endpoint {
+                               remote-endpoint = <&panel_in>;
+                       };
+               };
+       };
+};
+
 &pgc_gpu {
        power-supply = <&buck3_reg>;
 };
diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5-r2.dts b/arch/arm64/boot/dts/freescale/imx8mq-librem5-r2.dts
new file mode 100644 (file)
index 0000000..d77fc5d
--- /dev/null
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+// Copyright (C) 2020 Purism SPC <kernel@puri.sm>
+//
+// Librem 5 Chestnut
+
+/dts-v1/;
+
+#include "imx8mq-librem5.dtsi"
+
+/ {
+       model = "Purism Librem 5r2";
+       compatible = "purism,librem5r2", "purism,librem5", "fsl,imx8mq";
+};
+
+&bq25895 {
+       ti,battery-regulation-voltage = <4192000>; /* uV */
+       ti,charge-current = <1600000>; /* uA */
+       ti,termination-current = <66000>;  /* uA */
+};
+
+&accel_gyro {
+       mount-matrix =  "1",  "0",  "0",
+                       "0", "-1",  "0",
+                       "0",  "0",  "1";
+};
+
+&proximity {
+       proximity-near-level = <220>;
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5-r3.dts b/arch/arm64/boot/dts/freescale/imx8mq-librem5-r3.dts
new file mode 100644 (file)
index 0000000..6704ea2
--- /dev/null
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+// Copyright (C) 2020 Purism SPC <kernel@puri.sm>
+
+/dts-v1/;
+
+#include "imx8mq-librem5.dtsi"
+
+/ {
+       model = "Purism Librem 5r3";
+       compatible = "purism,librem5r3", "purism,librem5", "fsl,imx8mq";
+};
+
+&accel_gyro {
+       mount-matrix =  "1",  "0",  "0",
+                       "0",  "1",  "0",
+                       "0",  "0", "-1";
+};
+
+&bq25895 {
+       ti,battery-regulation-voltage = <4200000>; /* uV */
+       ti,charge-current = <1500000>; /* uA */
+       ti,termination-current = <144000>;  /* uA */
+};
+
+&proximity {
+       proximity-near-level = <25>;
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi
new file mode 100644 (file)
index 0000000..e3c6d12
--- /dev/null
@@ -0,0 +1,1106 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2018-2020 Purism SPC
+ */
+
+/dts-v1/;
+
+#include "dt-bindings/input/input.h"
+#include <dt-bindings/interrupt-controller/irq.h>
+#include "dt-bindings/pwm/pwm.h"
+#include "dt-bindings/usb/pd.h"
+#include "imx8mq.dtsi"
+
+/ {
+       model = "Purism Librem 5";
+       compatible = "purism,librem5", "fsl,imx8mq";
+
+       backlight_dsi: backlight-dsi {
+               compatible = "led-backlight";
+               leds = <&led_backlight>;
+       };
+
+       pmic_osc: clock-pmic {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+               clock-output-names = "pmic_osc";
+       };
+
+       chosen {
+               stdout-path = &uart1;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_keys>;
+
+               vol-down {
+                       label = "VOL_DOWN";
+                       gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_VOLUMEDOWN>;
+               };
+
+               vol-up {
+                       label = "VOL_UP";
+                       gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_VOLUMEUP>;
+               };
+       };
+
+       reg_aud_1v8: regulator-audio-1v8 {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_audiopwr>;
+               regulator-name = "AUDIO_PWR_EN";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_gnss: regulator-gnss {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gnsspwr>;
+               regulator-name = "GNSS";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpio3 12 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_hub: regulator-hub {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_hub_pwr>;
+               regulator-name = "HUB";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_lcd_3v4: regulator-lcd-3v4 {
+               compatible = "regulator-fixed";
+               regulator-name = "LCD_3V4";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_dsibiasen>;
+               vin-supply = <&reg_vsys_3v4>;
+               gpio = <&gpio1 20 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_vdd_sen: regulator-vdd-sen {
+               compatible = "regulator-fixed";
+               regulator-name = "VDD_SEN";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       reg_vdd_3v3: regulator-vdd-3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VDD_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       reg_vdd_1v8: regulator-vdd-1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_1V8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+       };
+
+       reg_vsys_3v4: regulator-vsys-3v4 {
+               compatible = "regulator-fixed";
+               regulator-name = "VSYS_3V4";
+               regulator-min-microvolt = <3400000>;
+               regulator-max-microvolt = <3400000>;
+               regulator-always-on;
+       };
+
+       reg_wifi_3v3: regulator-wifi-3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "3V3_WIFI";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       sound {
+               compatible = "simple-audio-card";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_hp>;
+               simple-audio-card,name = "Librem 5";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,widgets =
+                       "Headphone", "Headphones",
+                       "Microphone", "Headset Mic",
+                       "Microphone", "Digital Mic",
+                       "Speaker", "Speaker";
+               simple-audio-card,routing =
+                       "Headphones", "HPOUTL",
+                       "Headphones", "HPOUTR",
+                       "Speaker", "SPKOUTL",
+                       "Speaker", "SPKOUTR",
+                       "Headset Mic", "MICBIAS",
+                       "IN3R", "Headset Mic",
+                       "DMICDAT", "Digital Mic";
+               simple-audio-card,hp-det-gpio = <&gpio3 9 GPIO_ACTIVE_HIGH>;
+
+               simple-audio-card,cpu {
+                       sound-dai = <&sai2>;
+               };
+
+               simple-audio-card,codec {
+                       sound-dai = <&codec>;
+                       clocks = <&clk IMX8MQ_CLK_SAI2_ROOT>;
+                       frame-master;
+                       bitclock-master;
+               };
+       };
+
+       sound-wwan {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "Modem";
+               simple-audio-card,format = "i2s";
+
+               simple-audio-card,cpu {
+                       sound-dai = <&sai6>;
+                       frame-inversion;
+               };
+
+               simple-audio-card,codec {
+                       sound-dai = <&bm818_codec>;
+                       frame-master;
+                       bitclock-master;
+               };
+       };
+
+       bm818_codec: sound-wwan-codec {
+               compatible = "broadmobi,bm818", "option,gtm601";
+               #sound-dai-cells = <0>;
+       };
+
+       vibrator {
+               compatible = "pwm-vibrator";
+               pwms = <&pwm1 0 1000000000 0>;
+               pwm-names = "enable";
+               vcc-supply = <&reg_vdd_3v3>;
+       };
+};
+
+&A53_0 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&A53_1 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&A53_2 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&A53_3 {
+       cpu-supply = <&buck2_reg>;
+};
+
+&ddrc {
+       operating-points-v2 = <&ddrc_opp_table>;
+
+       ddrc_opp_table: ddrc-opp-table {
+               compatible = "operating-points-v2";
+
+               opp-25M {
+                       opp-hz = /bits/ 64 <25000000>;
+               };
+
+               opp-100M {
+                       opp-hz = /bits/ 64 <100000000>;
+               };
+
+               opp-800M {
+                       opp-hz = /bits/ 64 <800000000>;
+               };
+       };
+};
+
+&dphy {
+       status = "okay";
+};
+
+&ecspi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi1>;
+       cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
+       #address-cells = <1>;
+       #size-cells = <0>;
+       status = "okay";
+
+       nor_flash: flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <1000000>;
+       };
+};
+
+&gpio1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pmic_5v>;
+
+       pmic-5v {
+               gpio-hog;
+               gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;
+               input;
+       };
+};
+
+&iomuxc {
+       pinctrl_audiopwr: audiopwrgrp {
+               fsl,pins = <
+                       /* AUDIO_POWER_EN_3V3 */
+                       MX8MQ_IOMUXC_GPIO1_IO04_GPIO1_IO4       0x83
+               >;
+       };
+
+       pinctrl_bl: blgrp {
+               fsl,pins = <
+                       /* BACKLINGE_EN */
+                       MX8MQ_IOMUXC_NAND_DQS_GPIO3_IO14        0x83
+               >;
+       };
+
+       pinctrl_charger_in: chargeringrp {
+               fsl,pins = <
+                       /* CHRG_INT */
+                       MX8MQ_IOMUXC_NAND_CE2_B_GPIO3_IO3       0x00
+                       /* CHG_STATUS_B */
+                       MX8MQ_IOMUXC_NAND_ALE_GPIO3_IO0         0x80
+               >;
+       };
+
+       pinctrl_dsibiasen: dsibiasengrp {
+               fsl,pins = <
+                       /* DSI_BIAS_EN */
+                       MX8MQ_IOMUXC_ENET_TD1_GPIO1_IO20        0x83
+               >;
+       };
+
+       pinctrl_dsien: dsiengrp {
+               fsl,pins = <
+                       /* DSI_EN_3V3 */
+                       MX8MQ_IOMUXC_GPIO1_IO05_GPIO1_IO5       0x83
+               >;
+       };
+
+       pinctrl_ecspi1: ecspigrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI    0x83
+                       MX8MQ_IOMUXC_ECSPI1_MISO_ECSPI1_MISO    0x83
+                       MX8MQ_IOMUXC_ECSPI1_SS0_GPIO5_IO9       0x19
+                       MX8MQ_IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK    0x83
+               >;
+       };
+
+       pinctrl_gauge: gaugegrp {
+               fsl,pins = <
+                       /* BAT_LOW */
+                       MX8MQ_IOMUXC_SAI5_RXC_GPIO3_IO20        0x80
+               >;
+       };
+
+       pinctrl_gnsspwr: gnsspwrgrp {
+               fsl,pins = <
+                       /* GPS3V3_EN */
+                       MX8MQ_IOMUXC_NAND_DATA06_GPIO3_IO12     0x83
+               >;
+       };
+
+       pinctrl_haptic: hapticgrp {
+               fsl,pins = <
+                       /* MOTO */
+                       MX8MQ_IOMUXC_SPDIF_EXT_CLK_PWM1_OUT     0x83
+               >;
+       };
+
+       pinctrl_hp: hpgrp {
+               fsl,pins = <
+                       /* HEADPHONE_DET_1V8 */
+                       MX8MQ_IOMUXC_NAND_DATA03_GPIO3_IO9      0x180
+               >;
+       };
+
+       pinctrl_hub_pwr: hubpwrgrp {
+               fsl,pins = <
+                       /* HUB_PWR_3V3_EN */
+                       MX8MQ_IOMUXC_GPIO1_IO14_GPIO1_IO14      0x83
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_I2C1_SCL_I2C1_SCL          0x40000026
+                       MX8MQ_IOMUXC_I2C1_SDA_I2C1_SDA          0x40000026
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_I2C2_SCL_I2C2_SCL          0x40000026
+                       MX8MQ_IOMUXC_I2C2_SDA_I2C2_SDA          0x40000026
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_I2C3_SCL_I2C3_SCL          0x40000026
+                       MX8MQ_IOMUXC_I2C3_SDA_I2C3_SDA          0x40000026
+               >;
+       };
+
+       pinctrl_i2c4: i2c4grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_I2C4_SCL_I2C4_SCL          0x40000026
+                       MX8MQ_IOMUXC_I2C4_SDA_I2C4_SDA          0x40000026
+               >;
+       };
+
+       pinctrl_keys: keysgrp {
+               fsl,pins = <
+                       /* VOL- */
+                       MX8MQ_IOMUXC_ENET_MDIO_GPIO1_IO17       0x01C0
+                       /* VOL+ */
+                       MX8MQ_IOMUXC_ENET_MDC_GPIO1_IO16        0x01C0
+               >;
+       };
+
+       pinctrl_led_b: ledbgrp {
+               fsl,pins = <
+                       /* LED_B */
+                       MX8MQ_IOMUXC_GPIO1_IO13_PWM2_OUT        0x06
+               >;
+       };
+
+       pinctrl_led_g: ledggrp {
+               fsl,pins = <
+                       /* LED_G */
+                       MX8MQ_IOMUXC_SAI3_MCLK_PWM4_OUT         0x06
+               >;
+       };
+
+       pinctrl_led_r: ledrgrp {
+               fsl,pins = <
+                       /* LED_R */
+                       MX8MQ_IOMUXC_SPDIF_TX_PWM3_OUT          0x06
+               >;
+       };
+
+       pinctrl_mag: maggrp {
+               fsl,pins = <
+                       /* INT_MAG */
+                       MX8MQ_IOMUXC_SAI5_RXD1_GPIO3_IO22       0x80
+               >;
+       };
+
+       pinctrl_pmic: pmicgrp {
+               fsl,pins = <
+                       /* PMIC_NINT */
+                       MX8MQ_IOMUXC_GPIO1_IO07_GPIO1_IO7       0x80
+               >;
+       };
+
+       pinctrl_pmic_5v: pmic5vgrp {
+               fsl,pins = <
+                       /* PMIC_5V */
+                       MX8MQ_IOMUXC_GPIO1_IO01_GPIO1_IO1       0x80
+               >;
+       };
+
+       pinctrl_prox: proxgrp {
+               fsl,pins = <
+                       /* INT_LIGHT */
+                       MX8MQ_IOMUXC_NAND_DATA01_GPIO3_IO7      0x80
+               >;
+       };
+
+       pinctrl_rtc: rtcgrp {
+               fsl,pins = <
+                       /* RTC_INT */
+                       MX8MQ_IOMUXC_GPIO1_IO09_GPIO1_IO9       0x80
+               >;
+       };
+
+       pinctrl_sai2: sai2grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SAI2_TXD0_SAI2_TX_DATA0    0xd6
+                       MX8MQ_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC     0xd6
+                       MX8MQ_IOMUXC_SAI2_MCLK_SAI2_MCLK        0xd6
+                       MX8MQ_IOMUXC_SAI2_RXD0_SAI2_RX_DATA0    0xd6
+                       MX8MQ_IOMUXC_SAI2_TXC_SAI2_TX_BCLK      0xd6
+               >;
+       };
+
+       pinctrl_sai6: sai6grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SAI1_RXD5_SAI6_RX_DATA0    0xd6
+                       MX8MQ_IOMUXC_SAI1_RXD6_SAI6_RX_SYNC     0xd6
+                       MX8MQ_IOMUXC_SAI1_TXD4_SAI6_RX_BCLK     0xd6
+                       MX8MQ_IOMUXC_SAI1_TXD5_SAI6_TX_DATA0    0xd6
+               >;
+       };
+
+       pinctrl_tcpc: tcpcgrp {
+               fsl,pins = <
+                       /* TCPC_INT */
+                       MX8MQ_IOMUXC_GPIO1_IO10_GPIO1_IO10      0x01C0
+               >;
+       };
+
+       pinctrl_typec: typecgrp {
+               fsl,pins = <
+                       /* TYPEC_MUX_EN */
+                       MX8MQ_IOMUXC_GPIO1_IO11_GPIO1_IO11      0x83
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_UART1_RXD_UART1_DCE_RX     0x49
+                       MX8MQ_IOMUXC_UART1_TXD_UART1_DCE_TX     0x49
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_UART2_TXD_UART2_DCE_TX     0x49
+                       MX8MQ_IOMUXC_UART2_RXD_UART2_DCE_RX     0x49
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_UART3_RXD_UART3_DCE_RX     0x49
+                       MX8MQ_IOMUXC_UART3_TXD_UART3_DCE_TX     0x49
+               >;
+       };
+
+       pinctrl_uart4: uart4grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_ECSPI2_SCLK_UART4_DCE_RX           0x49
+                       MX8MQ_IOMUXC_ECSPI2_MOSI_UART4_DCE_TX           0x49
+                       MX8MQ_IOMUXC_ECSPI2_MISO_UART4_DCE_CTS_B        0x49
+                       MX8MQ_IOMUXC_ECSPI2_SS0_UART4_DCE_RTS_B         0x49
+               >;
+       };
+
+       pinctrl_usdhc1: usdhc1grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x83
+                       MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xc3
+                       MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6             0xc3
+                       MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7             0xc3
+                       MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE           0x83
+                       MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B         0xc1
+               >;
+       };
+
+       pinctrl_usdhc1_100mhz: usdhc1grp100mhz {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x8d
+                       MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xcd
+                       MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0             0xcd
+                       MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1             0xcd
+                       MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2             0xcd
+                       MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3             0xcd
+                       MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4             0xcd
+                       MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5             0xcd
+                       MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6             0xcd
+                       MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7             0xcd
+                       MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE           0x8d
+                       MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B         0xc1
+               >;
+       };
+
+       pinctrl_usdhc1_200mhz: usdhc1grp200mhz {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x9f
+                       MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xdf
+                       MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0             0xdf
+                       MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1             0xdf
+                       MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2             0xdf
+                       MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3             0xdf
+                       MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4             0xdf
+                       MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5             0xdf
+                       MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6             0xdf
+                       MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7             0xdf
+                       MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE           0x9f
+                       MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B         0xc1
+               >;
+       };
+
+       pinctrl_usdhc2: usdhc2grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD2_CD_B_GPIO2_IO12        0x80
+                       MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK         0x83
+                       MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD         0xc3
+                       MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0     0xc3
+                       MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1     0xc3
+                       MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2     0xc3
+                       MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3     0xc3
+                       MX8MQ_IOMUXC_SD2_RESET_B_USDHC2_RESET_B 0xc1
+               >;
+       };
+
+       pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD2_CD_B_GPIO2_IO12        0x80
+                       MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK         0x8d
+                       MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD         0xcd
+                       MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0     0xcd
+                       MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1     0xcd
+                       MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2     0xcd
+                       MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3     0xcd
+                       MX8MQ_IOMUXC_SD2_RESET_B_USDHC2_RESET_B 0xc1
+               >;
+       };
+
+       pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD2_CD_B_GPIO2_IO12        0x80
+                       MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK         0x9f
+                       MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD         0xcf
+                       MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0     0xcf
+                       MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1     0xcf
+                       MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2     0xcf
+                       MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3     0xcf
+                       MX8MQ_IOMUXC_SD2_RESET_B_USDHC2_RESET_B 0xc1
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       /* nWDOG */
+                       MX8MQ_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B    0x1f
+               >;
+       };
+};
+
+&i2c1 {
+       clock-frequency = <387000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       typec_pd: usb-pd@3f {
+               compatible = "ti,tps6598x";
+               reg = <0x3f>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_typec>, <&pinctrl_tcpc>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-names = "irq";
+
+               connector {
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+
+                                       usb_con_hs: endpoint {
+                                               remote-endpoint = <&typec_hs>;
+                                       };
+                               };
+
+                               port@1 {
+                                       reg = <1>;
+
+                                       usb_con_ss: endpoint {
+                                               remote-endpoint = <&typec_ss>;
+                                       };
+                               };
+                       };
+               };
+       };
+
+       pmic: pmic@4b {
+               compatible = "rohm,bd71837";
+               reg = <0x4b>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pmic>;
+               clocks = <&pmic_osc>;
+               clock-names = "osc";
+               clock-output-names = "pmic_clk";
+               interrupt-parent = <&gpio1>;
+               interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
+               rohm,reset-snvs-powered;
+
+               regulators {
+                       buck1_reg: BUCK1 {
+                               regulator-name = "buck1";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               regulator-ramp-delay = <1250>;
+                               rohm,dvs-run-voltage = <900000>;
+                               rohm,dvs-idle-voltage = <850000>;
+                               rohm,dvs-suspend-voltage = <800000>;
+                               regulator-always-on;
+                       };
+
+                       buck2_reg: BUCK2 {
+                               regulator-name = "buck2";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               regulator-ramp-delay = <1250>;
+                               rohm,dvs-run-voltage = <1000000>;
+                               rohm,dvs-idle-voltage = <900000>;
+                               regulator-always-on;
+                       };
+
+                       buck3_reg: BUCK3 {
+                               regulator-name = "buck3";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               rohm,dvs-run-voltage = <900000>;
+                               regulator-always-on;
+                       };
+
+                       buck4_reg: BUCK4 {
+                               regulator-name = "buck4";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1300000>;
+                               rohm,dvs-run-voltage = <1000000>;
+                       };
+
+                       buck5_reg: BUCK5 {
+                               regulator-name = "buck5";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-always-on;
+                       };
+
+                       buck6_reg: BUCK6 {
+                               regulator-name = "buck6";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       buck7_reg: BUCK7 {
+                               regulator-name = "buck7";
+                               regulator-min-microvolt = <1605000>;
+                               regulator-max-microvolt = <1995000>;
+                               regulator-always-on;
+                       };
+
+                       buck8_reg: BUCK8 {
+                               regulator-name = "buck8";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1400000>;
+                               regulator-always-on;
+                       };
+
+                       ldo1_reg: LDO1 {
+                               regulator-name = "ldo1";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3300000>;
+                               /* leave on for snvs power button */
+                               regulator-always-on;
+                       };
+
+                       ldo2_reg: LDO2 {
+                               regulator-name = "ldo2";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <900000>;
+                               /* leave on for snvs power button */
+                               regulator-always-on;
+                       };
+
+                       ldo3_reg: LDO3 {
+                               regulator-name = "ldo3";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       ldo4_reg: LDO4 {
+                               regulator-name = "ldo4";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                       };
+
+                       ldo5_reg: LDO5 {
+                               /* VDD_PHY_0V9 - MIPI and HDMI domains */
+                               regulator-name = "ldo5";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       ldo6_reg: LDO6 {
+                               /* VDD_PHY_0V9 - MIPI, HDMI and USB domains */
+                               regulator-name = "ldo6";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                       };
+
+                       ldo7_reg: LDO7 {
+                               /* VDD_PHY_3V3 - USB domain */
+                               regulator-name = "ldo7";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+               };
+       };
+
+       rtc@68 {
+               compatible = "microcrystal,rv4162";
+               reg = <0x68>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_rtc>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <387000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       magnetometer@1e {
+               compatible = "st,lsm9ds1-magn";
+               reg = <0x1e>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_mag>;
+               interrupt-parent = <&gpio3>;
+               interrupts = <22 IRQ_TYPE_LEVEL_HIGH>;
+               vdd-supply = <&reg_vdd_sen>;
+               vddio-supply = <&reg_vdd_1v8>;
+       };
+
+       regulator@3e {
+               compatible = "tps65132";
+               reg = <0x3e>;
+
+               outp {
+                       regulator-name = "LCD_AVDD";
+                       vin-supply = <&reg_lcd_3v4>;
+               };
+
+               outn {
+                       regulator-name = "LCD_AVEE";
+                       vin-supply = <&reg_lcd_3v4>;
+               };
+       };
+
+       proximity: prox@60 {
+               compatible = "vishay,vcnl4040";
+               reg = <0x60>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_prox>;
+               interrupt-parent = <&gpio3>;
+               interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
+       };
+
+       accel_gyro: accel-gyro@6a       {
+               compatible = "st,lsm9ds1-imu";
+               reg = <0x6a>;
+               vdd-supply = <&reg_vdd_sen>;
+               vddio-supply = <&reg_vdd_1v8>;
+       };
+};
+
+&i2c3 {
+       clock-frequency = <387000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       codec: audio-codec@1a {
+               compatible = "wlf,wm8962";
+               reg = <0x1a>;
+               clocks = <&clk IMX8MQ_CLK_SAI2_ROOT>;
+               assigned-clocks = <&clk IMX8MQ_CLK_SAI2>;
+               assigned-clock-parents = <&clk IMX8MQ_AUDIO_PLL1_OUT>;
+               assigned-clock-rates = <24576000>;
+               #sound-dai-cells = <0>;
+               mic-cfg = <0x200>;
+               DCVDD-supply = <&reg_aud_1v8>;
+               DBVDD-supply = <&reg_aud_1v8>;
+               AVDD-supply = <&reg_aud_1v8>;
+               CPVDD-supply = <&reg_aud_1v8>;
+               MICVDD-supply = <&reg_aud_1v8>;
+               PLLVDD-supply = <&reg_aud_1v8>;
+               SPKVDD1-supply = <&reg_vsys_3v4>;
+               SPKVDD2-supply = <&reg_vsys_3v4>;
+               gpio-cfg = <
+                       0x0000 /* n/c */
+                       0x0001 /* gpio2, 1: default */
+                       0x0013 /* gpio3, 2: dmicclk */
+                       0x0000 /* n/c, 3: default */
+                       0x8014 /* gpio5, 4: dmic_dat */
+                       0x0000 /* gpio6, 5: default */
+               >;
+       };
+
+       backlight@36 {
+               compatible = "ti,lm36922";
+               reg = <0x36>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_bl>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               enable-gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
+               vled-supply = <&reg_vsys_3v4>;
+               ti,ovp-microvolt = <25000000>;
+
+               led_backlight: led@0 {
+                       reg = <0>;
+                       label = ":backlight";
+                       linux,default-trigger = "backlight";
+                       led-max-microamp = <20000>;
+               };
+       };
+
+       touchscreen@38 {
+               compatible = "edt,edt-ft5506";
+               reg = <0x38>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <27 IRQ_TYPE_EDGE_FALLING>;
+               touchscreen-size-x = <720>;
+               touchscreen-size-y = <1440>;
+       };
+};
+
+&i2c4 {
+       clock-frequency = <387000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c4>;
+       status = "okay";
+
+       bat: fuel-gauge@36 {
+               compatible = "maxim,max17055";
+               reg = <0x36>;
+               interrupt-parent = <&gpio3>;
+               interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gauge>;
+               maxim,over-heat-temp = <700>;
+               maxim,over-volt = <4500>;
+               maxim,rsns-microohm = <5000>;
+       };
+
+       bq25895: charger@6a {
+               compatible = "ti,bq25895", "ti,bq25890";
+               reg = <0x6a>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_charger_in>;
+               interrupt-parent = <&gpio3>;
+               interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
+               phys = <&usb3_phy0>;
+               ti,precharge-current = <130000>; /* uA */
+               ti,minimum-sys-voltage = <3700000>; /* uV */
+               ti,boost-voltage = <5000000>; /* uV */
+               ti,boost-max-current = <500000>; /* uA */
+               ti,use-vinmin-threshold = <1>; /* enable VINDPM */
+               ti,vinmin-threshold = <3900000>; /* uV */
+               monitored-battery = <&bat>;
+       };
+};
+
+&pgc_gpu {
+       power-supply = <&buck3_reg>;
+};
+
+&pgc_mipi {
+       power-supply = <&ldo5_reg>;
+};
+
+&pgc_vpu {
+       power-supply = <&buck4_reg>;
+};
+
+&pwm1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_haptic>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_led_b>;
+       status = "okay";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_led_g>;
+       status = "okay";
+};
+
+&pwm4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_led_r>;
+       status = "okay";
+};
+
+&sai2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sai2>;
+       assigned-clocks = <&clk IMX8MQ_CLK_SAI2>;
+       assigned-clock-parents = <&clk IMX8MQ_AUDIO_PLL1_OUT>;
+       assigned-clock-rates = <24576000>;
+       assigned-clocks = <&clk IMX8MQ_AUDIO_PLL1>, <&clk IMX8MQ_AUDIO_PLL2>;
+       assigned-clock-rates = <786432000>, <722534400>;
+       status = "okay";
+};
+
+&sai6 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sai6>;
+       assigned-clocks = <&clk IMX8MQ_CLK_SAI6>;
+       assigned-clock-parents = <&clk IMX8MQ_AUDIO_PLL1_OUT>;
+       assigned-clock-rates = <24576000>;
+       fsl,sai-synchronous-rx;
+       status = "okay";
+};
+
+&snvs_pwrkey {
+       status = "okay";
+};
+
+&snvs_rtc {
+       status = "disabled";
+};
+
+&uart1 { /* console */
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 { /* TPS - GPS - DEBUG */
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+
+       gnss {
+               compatible = "globaltop,pa6h";
+               vcc-supply = <&reg_gnss>;
+               current-speed = <9600>;
+       };
+};
+
+&uart3 { /* SMC */
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&uart4 { /* BT */
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4>;
+       uart-has-rtscts;
+       status = "okay";
+};
+
+&usb3_phy0 {
+       status = "okay";
+};
+
+&usb3_phy1 {
+       vbus-supply = <&reg_hub>;
+       status = "okay";
+};
+
+&usb_dwc3_0 {
+       #address-cells = <1>;
+       #size-cells = <0>;
+       dr_mode = "otg";
+       snps,dis_u3_susphy_quirk;
+       status = "okay";
+
+       port@0 {
+               reg = <0>;
+
+               typec_hs: endpoint {
+                       remote-endpoint = <&usb_con_hs>;
+               };
+       };
+
+       port@1 {
+               reg = <1>;
+
+               typec_ss: endpoint {
+                       remote-endpoint = <&usb_con_ss>;
+               };
+       };
+};
+
+&usb_dwc3_1 {
+       dr_mode = "host";
+       status = "okay";
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       /* Microchip USB2642 */
+       hub@1 {
+               compatible = "usb424,2640";
+               reg = <1>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               mass-storage@1 {
+                       compatible = "usb424,4041";
+                       reg = <1>;
+               };
+       };
+};
+
+&usdhc1 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc1>;
+       pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
+       bus-width = <8>;
+       vmmc-supply = <&reg_vdd_3v3>;
+       power-supply = <&reg_vdd_1v8>;
+       non-removable;
+       status = "okay";
+};
+
+&usdhc2 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc2>;
+       pinctrl-1 = <&pinctrl_usdhc2_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc2_200mhz>;
+       bus-width = <4>;
+       vmmc-supply = <&reg_wifi_3v3>;
+       cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
+       disable-wp;
+       cap-sdio-irq;
+       keep-power-in-suspend;
+       wakeup-source;
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+       status = "okay";
+};
index 77ab568..a3b9d61 100644 (file)
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include "imx8mq.dtsi"
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        model = "Google i.MX8MQ Phanbell";
                clocks = <&pmic_osc>;
                clock-output-names = "pmic_clk";
                interrupt-parent = <&gpio1>;
-               interrupts = <3 GPIO_ACTIVE_LOW>;
+               interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
 
                regulators {
                        buck1: BUCK1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_fec1>;
        phy-mode = "rgmii-id";
-       phy-reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
-       phy-reset-duration = <10>;
-       phy-reset-post-delay = <50>;
        phy-handle = <&ethphy0>;
        fsl,magic-packet;
        status = "okay";
                ethphy0: ethernet-phy@0 {
                        compatible = "ethernet-phy-ieee802.3-c22";
                        reg = <0>;
+                       reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+                       reset-assert-us = <10000>;
+                       reset-deassert-us = <50000>;
                };
        };
 };
                >;
        };
 
-       pinctrl_pmic: pmicirq {
+       pinctrl_pmic: pmicirqgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_GPIO1_IO03_GPIO1_IO3       0x41
                >;
                >;
        };
 
-       pinctrl_usdhc1_100mhz: usdhc1grp100mhz {
+       pinctrl_usdhc1_100mhz: usdhc1-100mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x85
                        MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xc5
                >;
        };
 
-       pinctrl_usdhc1_200mhz: usdhc1grp200mhz {
+       pinctrl_usdhc1_200mhz: usdhc1-200mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x87
                        MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xc7
                >;
        };
 
-       pinctrl_usdhc2_gpio: usdhc2grpgpio {
+       pinctrl_usdhc2_gpio: usdhc2gpiogrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_CD_B_GPIO2_IO12        0x41
                        MX8MQ_IOMUXC_SD2_RESET_B_GPIO2_IO19     0x41
                >;
        };
 
-       pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
+       pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK                 0x85
                        MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD                 0xc5
                >;
        };
 
-       pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
+       pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK                 0x87
                        MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD                 0xc7
index 59da96b..89cbec5 100644 (file)
@@ -9,6 +9,7 @@
 /dts-v1/;
 
 #include "imx8mq.dtsi"
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        model = "TechNexion PICO-PI-8M";
@@ -70,7 +71,7 @@
                clock-names = "osc";
                clock-output-names = "pmic_clk";
                interrupt-parent = <&gpio1>;
-               interrupts = <3 GPIO_ACTIVE_LOW>;
+               interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
                interrupt-names = "irq";
 
                regulators {
                >;
        };
 
-       pinctrl_pmic: pmicirq {
+       pinctrl_pmic: pmicirqgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_GPIO1_IO03_GPIO1_IO3       0x41
                >;
                >;
        };
 
-       pinctrl_usdhc1_100mhz: usdhc1grp100mhz {
+       pinctrl_usdhc1_100mhz: usdhc1-100mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x85
                        MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xc5
                >;
        };
 
-       pinctrl_usdhc1_200mhz: usdhc1grp200mhz {
+       pinctrl_usdhc1_200mhz: usdhc1-200mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x87
                        MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xc7
                >;
        };
 
-       pinctrl_usdhc2_gpio: usdhc2grpgpio {
+       pinctrl_usdhc2_gpio: usdhc2gpiogrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_CD_B_GPIO2_IO12        0x41
                >;
                >;
        };
 
-       pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
+       pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK                 0x85
                        MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD                 0xc5
                >;
        };
 
-       pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
+       pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK                 0x87
                        MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD                 0xc7
index 602c870..0187890 100644 (file)
@@ -20,8 +20,6 @@
        pinctrl-0 = <&pinctrl_fec1>;
        phy-mode = "rgmii-id";
        phy-handle = <&ethphy0>;
-       phy-reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
-       phy-reset-duration = <2>;
        fsl,magic-packet;
        status = "okay";
 
@@ -32,6 +30,8 @@
                ethphy0: ethernet-phy@4 {
                        compatible = "ethernet-phy-ieee802.3-c22";
                        reg = <4>;
+                       reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+                       reset-assert-us = <2000>;
                };
        };
 };
                >;
        };
 
-       pinctrl_usdhc1_100mhz: usdhc1grp100mhz {
+       pinctrl_usdhc1_100mhz: usdhc1-100mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x8d
                        MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xcd
                >;
        };
 
-       pinctrl_usdhc1_200mhz: usdhc1grp200mhz {
+       pinctrl_usdhc1_200mhz: usdhc1-200mhzgrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK                 0x9f
                        MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD                 0xdf
index b4795a0..5d5aa65 100644 (file)
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_fec1>;
        phy-mode = "rgmii-id";
-       phy-reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
        phy-handle = <&ethphy>;
        fsl,magic-packet;
        status = "okay";
                ethphy: ethernet-phy@3 {
                        compatible = "ethernet-phy-ieee802.3-c22";
                        reg = <3>;
+                       reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
                };
        };
 };
index 6b35813..bfad4b8 100644 (file)
@@ -15,7 +15,7 @@
 &ecspi1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
-       cs-gpios = <&gpio5 9 GPIO_ACTIVE_HIGH>;
+       cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
        status = "okay";
        #address-cells = <1>;
        #size-cells = <0>;
index 0d1088d..fa7a041 100644 (file)
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_gpio3_hog>;
 
-       usb-emulation {
+       usb-emulation-hog {
                gpio-hog;
                gpios = <10 GPIO_ACTIVE_HIGH>;
                output-low;
                line-name = "usb-emulation";
        };
 
-       usb-mode1 {
+       usb-mode1-hog {
                gpio-hog;
                gpios = <11 GPIO_ACTIVE_HIGH>;
                output-high;
                line-name = "usb-mode1";
        };
 
-       usb-pwr {
+       usb-pwr-hog {
                gpio-hog;
                gpios = <12 GPIO_ACTIVE_LOW>;
                output-high;
                line-name = "usb-pwr-ctrl-en-n";
        };
 
-       usb-mode2 {
+       usb-mode2-hog {
                gpio-hog;
                gpios = <13 GPIO_ACTIVE_HIGH>;
                output-high;
index 561fa79..5e0e7d0 100644 (file)
                                                  <&clk IMX8MQ_VIDEO_PLL1_OUT>;
                                assigned-clock-rates = <0>, <0>, <0>, <594000000>;
                                status = "disabled";
+
+                               port@0 {
+                                       lcdif_mipi_dsi: endpoint {
+                                               remote-endpoint = <&mipi_dsi_lcdif_in>;
+                                       };
+                               };
                        };
 
                        iomuxc: pinctrl@30330000 {
                        gpc: gpc@303a0000 {
                                compatible = "fsl,imx8mq-gpc";
                                reg = <0x303a0000 0x10000>;
+                               interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
                                interrupt-parent = <&gic>;
                                interrupt-controller;
                                #interrupt-cells = <3>;
                                };
                        };
 
+                       mipi_dsi: mipi-dsi@30a00000 {
+                               compatible = "fsl,imx8mq-nwl-dsi";
+                               reg = <0x30a00000 0x300>;
+                               clocks = <&clk IMX8MQ_CLK_DSI_CORE>,
+                                        <&clk IMX8MQ_CLK_DSI_AHB>,
+                                        <&clk IMX8MQ_CLK_DSI_IPG_DIV>,
+                                        <&clk IMX8MQ_CLK_DSI_PHY_REF>,
+                                        <&clk IMX8MQ_CLK_LCDIF_PIXEL>;
+                               clock-names = "core", "rx_esc", "tx_esc", "phy_ref", "lcdif";
+                               assigned-clocks = <&clk IMX8MQ_CLK_DSI_AHB>,
+                                                 <&clk IMX8MQ_CLK_DSI_CORE>,
+                                                 <&clk IMX8MQ_CLK_DSI_IPG_DIV>;
+                               assigned-clock-parents = <&clk IMX8MQ_SYS1_PLL_80M>,
+                                                        <&clk IMX8MQ_SYS1_PLL_266M>;
+                               assigned-clock-rates = <80000000>, <266000000>, <20000000>;
+                               interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
+                               mux-controls = <&mux 0>;
+                               power-domains = <&pgc_mipi>;
+                               phys = <&dphy>;
+                               phy-names = "dphy";
+                               resets = <&src IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N>,
+                                        <&src IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N>,
+                                        <&src IMX8MQ_RESET_MIPI_DSI_ESC_RESET_N>,
+                                        <&src IMX8MQ_RESET_MIPI_DSI_PCLK_RESET_N>;
+                               reset-names = "byte", "dpi", "esc", "pclk";
+                               status = "disabled";
+
+                               ports {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       port@0 {
+                                               reg = <0>;
+                                               #address-cells = <1>;
+                                               #size-cells = <0>;
+                                               mipi_dsi_lcdif_in: endpoint@0 {
+                                                       reg = <0>;
+                                                       remote-endpoint = <&lcdif_mipi_dsi>;
+                                               };
+                                       };
+                               };
+                       };
+
                        dphy: dphy@30a00300 {
                                compatible = "fsl,imx8mq-mipi-dphy";
                                reg = <0x30a00300 0x100>;
                                reg = <0x30be0000 0x10000>;
                                interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
                                             <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
+                                            <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
+                                            <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clk IMX8MQ_CLK_ENET1_ROOT>,
                                         <&clk IMX8MQ_CLK_ENET1_ROOT>,
                                         <&clk IMX8MQ_CLK_ENET_TIMER>,
index 75f17a2..f38acff 100644 (file)
                >;
        };
 
-       pinctrl_usdhc1_100mhz: usdhc1grp100mhz {
+       pinctrl_usdhc1_100mhz: usdhc1-100mhzgrp {
                fsl,pins = <
                        IMX8QXP_EMMC0_CLK_CONN_EMMC0_CLK                0x06000041
                        IMX8QXP_EMMC0_CMD_CONN_EMMC0_CMD                0x21
                >;
        };
 
-       pinctrl_usdhc1_200mhz: usdhc1grp200mhz {
+       pinctrl_usdhc1_200mhz: usdhc1-200mhzgrp {
                fsl,pins = <
                        IMX8QXP_EMMC0_CLK_CONN_EMMC0_CLK                0x06000041
                        IMX8QXP_EMMC0_CMD_CONN_EMMC0_CMD                0x21
                >;
        };
 
-       pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
+       pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
                fsl,pins = <
                        IMX8QXP_USDHC1_CLK_CONN_USDHC1_CLK              0x06000041      /* SODIMM  47 */
                        IMX8QXP_USDHC1_CMD_CONN_USDHC1_CMD              0x21            /* SODIMM 190 */
                >;
        };
 
-       pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
+       pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
                fsl,pins = <
                        IMX8QXP_USDHC1_CLK_CONN_USDHC1_CLK              0x06000041      /* SODIMM  47 */
                        IMX8QXP_USDHC1_CMD_CONN_USDHC1_CMD              0x21            /* SODIMM 190 */
index c1b614d..963300e 100644 (file)
        rt1711h: rt1711h@4e {
                compatible = "richtek,rt1711h";
                reg = <0x4e>;
-               status = "ok";
+               status = "okay";
                interrupt-parent = <&gpio27>;
                interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
                pinctrl-names = "default";
        };
 
        adv7533: adv7533@39 {
-               status = "ok";
+               status = "okay";
                compatible = "adi,adv7533";
                reg = <0x39>;
                adi,dsi-lanes = <4>;
                     &sdio_cfg_func>;
        /* WL_EN */
        vmmc-supply = <&wlan_en>;
-       status = "ok";
+       status = "okay";
 
        wlcore: wlcore@2 {
                compatible = "ti,wl1837";
index d25aac5..994140f 100644 (file)
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xe8a06000 0x0 0x1000>;
                        interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&crg_ctrl HI3660_OSC32K>;
-                       clock-names = "apb_pclk";
+                       clocks = <&crg_ctrl HI3660_OSC32K>,
+                                <&crg_ctrl HI3660_OSC32K>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                watchdog1: watchdog@e8a07000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xe8a07000 0x0 0x1000>;
                        interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&crg_ctrl HI3660_OSC32K>;
-                       clock-names = "apb_pclk";
+                       clocks = <&crg_ctrl HI3660_OSC32K>,
+                                <&crg_ctrl HI3660_OSC32K>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                tsensor: tsensor@fff30000 {
index 7dac33d..7f9f988 100644 (file)
                     &sdio_cfg_func>;
        /* WL_EN */
        vmmc-supply = <&wlan_en>;
-       status = "ok";
+       status = "okay";
 
        wlcore: wlcore@2 {
                compatible = "ti,wl1837";
index 533ed52..91d0867 100644 (file)
 &uart1 {
        assigned-clocks = <&sys_ctrl HI6220_UART1_SRC>;
        assigned-clock-rates = <150000000>;
-       status = "ok";
+       status = "okay";
 
        bluetooth {
                compatible = "ti,wl1835-st";
 };
 
 &uart2 {
-       status = "ok";
+       status = "okay";
        label = "LS-UART0";
 };
 
 &uart3 {
-       status = "ok";
+       status = "okay";
        label = "LS-UART1";
 };
 
 &ade {
-       status = "ok";
+       status = "okay";
 };
 
 &dsi {
-       status = "ok";
+       status = "okay";
 
        ports {
                /* 1 for output port */
 
 
 &i2c0 {
-       status = "ok";
+       status = "okay";
 };
 
 &i2c1 {
-       status = "ok";
+       status = "okay";
 };
 
 &i2c2 {
        #address-cells = <1>;
        #size-cells = <0>;
-       status = "ok";
+       status = "okay";
 
        adv7533: adv7533@39 {
                compatible = "adi,adv7533";
 };
 
 &spi0 {
-       status = "ok";
+       status = "okay";
 };
index 3d189d9..014735a 100644 (file)
                        clocks = <&sys_ctrl HI6220_EDMAC_ACLK>;
                        dma-no-cci;
                        dma-type = "hi6220_dma";
-                       status = "ok";
+                       status = "okay";
                };
 
                dual_timer0: timer@f8008000 {
                        compatible = "arm,sp805-wdt", "arm,primecell";
                        reg = <0x0 0xf8005000 0x0 0x1000>;
                        interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&ao_ctrl HI6220_WDT0_PCLK>;
-                       clock-names = "apb_pclk";
+                       clocks = <&ao_ctrl HI6220_WDT0_PCLK>,
+                                <&ao_ctrl HI6220_WDT0_PCLK>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
 
                tsensor: tsensor@0,f7030700 {
index e93c65e..369b69b 100644 (file)
 };
 
 &uart0 {
-       status = "ok";
+       status = "okay";
 };
 
 &peri_gpio0 {
-       status = "ok";
+       status = "okay";
 };
 
 &lbc {
-       status = "ok";
+       status = "okay";
        #address-cells = <2>;
        #size-cells = <1>;
        ranges = <0 0 0x0 0x90000000 0x08000000>,
index 677862b..9f4a930 100644 (file)
 };
 
 &ipmi0 {
-       status = "ok";
+       status = "okay";
 };
 
 &uart0 {
-       status = "ok";
+       status = "okay";
 };
 
 &eth0 {
-       status = "ok";
+       status = "okay";
 };
 
 &eth1 {
-       status = "ok";
+       status = "okay";
 };
 
 &eth2 {
-       status = "ok";
+       status = "okay";
 };
 
 &eth3 {
-       status = "ok";
+       status = "okay";
 };
 
 &sas1 {
-       status = "ok";
+       status = "okay";
 };
 
 &usb_ohci {
-       status = "ok";
+       status = "okay";
 };
 
 &usb_ehci {
-       status = "ok";
+       status = "okay";
 };
index fcbdffe..81a2312 100644 (file)
 };
 
 &uart0 {
-       status = "ok";
+       status = "okay";
 };
 
 &ipmi0 {
-       status = "ok";
+       status = "okay";
 };
 
 &usb_ohci {
-       status = "ok";
+       status = "okay";
 };
 
 &usb_ehci {
-       status = "ok";
+       status = "okay";
 };
 
 &eth0 {
-       status = "ok";
+       status = "okay";
 };
 
 &eth1 {
-       status = "ok";
+       status = "okay";
 };
 
 &eth2 {
-       status = "ok";
+       status = "okay";
 };
 
 &eth3 {
-       status = "ok";
+       status = "okay";
 };
 
 &sas1 {
-       status = "ok";
+       status = "okay";
 };
 
 &p0_pcie2_a {
-       status = "ok";
+       status = "okay";
 };
index 9d7f19e..e1c0fcb 100644 (file)
@@ -20,7 +20,7 @@
 
                service_reserved: svcbuffer@0 {
                        compatible = "shared-dma-pool";
-                       reg = <0x0 0x0 0x0 0x1000000>;
+                       reg = <0x0 0x0 0x0 0x2000000>;
                        alignment = <0x1000>;
                        no-map;
                };
                        snps,multicast-filter-bins = <256>;
                        iommus = <&smmu 1>;
                        altr,sysmgr-syscon = <&sysmgr 0x44 0>;
-                       clocks = <&clkmgr AGILEX_EMAC0_CLK>;
-                       clock-names = "stmmaceth";
+                       clocks = <&clkmgr AGILEX_EMAC0_CLK>, <&clkmgr AGILEX_EMAC_PTP_CLK>;
+                       clock-names = "stmmaceth", "ptp_ref";
                        status = "disabled";
                };
 
                        snps,multicast-filter-bins = <256>;
                        iommus = <&smmu 2>;
                        altr,sysmgr-syscon = <&sysmgr 0x48 8>;
-                       clocks = <&clkmgr AGILEX_EMAC1_CLK>;
-                       clock-names = "stmmaceth";
+                       clocks = <&clkmgr AGILEX_EMAC1_CLK>, <&clkmgr AGILEX_EMAC_PTP_CLK>;
+                       clock-names = "stmmaceth", "ptp_ref";
                        status = "disabled";
                };
 
                        snps,multicast-filter-bins = <256>;
                        iommus = <&smmu 3>;
                        altr,sysmgr-syscon = <&sysmgr 0x4c 16>;
-                       clocks = <&clkmgr AGILEX_EMAC2_CLK>;
-                       clock-names = "stmmaceth";
+                       clocks = <&clkmgr AGILEX_EMAC2_CLK>, <&clkmgr AGILEX_EMAC_PTP_CLK>;
+                       clock-names = "stmmaceth", "ptp_ref";
                        status = "disabled";
                };
 
index 64f3b13..081fe7a 100644 (file)
                ranges;
 
                timers: timer@fd100000 {
-                       compatible = "arm,sp804";
+                       compatible = "arm,sp804", "arm,primecell";
                        reg = <0x0 0xfd100000 0x1000>;
                        interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&clk_bus>;
-                       clock-names = "apb_pclk";
+                       clocks = <&clk_bus>, <&clk_bus>, <&clk_bus>;
+                       clock-names = "timer0clk", "timer1clk", "apb_pclk";
                };
                wdog: watchdog@fd200000 {
                        compatible = "arm,sp805", "arm,primecell";
                        reg = <0x0 0xfd200000 0x1000>;
                        interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&clk_bus>;
-                       clock-names = "apb_pclk";
+                       clocks = <&clk_bus>, <&clk_bus>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
                uart0: serial@fe000000 {
                        compatible = "arm,pl011", "arm,primecell";
index ac23592..604bb69 100644 (file)
                ranges;
 
                timers: timer@fd100000 {
-                       compatible = "arm,sp804";
+                       compatible = "arm,sp804", "arm,primecell";
                        reg = <0x0 0xfd100000 0x1000>;
                        interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&clk_bus>;
-                       clock-names = "apb_pclk";
+                       clocks = <&clk_bus>, <&clk_bus>, <&clk_bus>;
+                       clock-names = "timer0clk", "timer1clk", "apb_pclk";
                };
                wdog: watchdog@fd200000 {
                        compatible = "arm,sp805", "arm,primecell";
                        reg = <0x0 0xfd200000 0x1000>;
                        interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&clk_bus>;
-                       clock-names = "apb_pclk";
+                       clocks = <&clk_bus>, <&clk_bus>;
+                       clock-names = "wdog_clk", "apb_pclk";
                };
                uart0: serial@fe000000 {
                        compatible = "arm,pl011", "arm,primecell";
index 03733fd..215d2f7 100644 (file)
        compatible = "globalscale,espressobin-v7-emmc", "globalscale,espressobin-v7",
                     "globalscale,espressobin", "marvell,armada3720",
                     "marvell,armada3710";
+
+       aliases {
+               /* ethernet1 is wan port */
+               ethernet1 = &switch0port3;
+               ethernet3 = &switch0port1;
+       };
 };
 
 &switch0 {
        ports {
-               port@1 {
+               switch0port1: port@1 {
                        reg = <1>;
                        label = "lan1";
                        phy-handle = <&switch0phy0>;
                };
 
-               port@3 {
+               switch0port3: port@3 {
                        reg = <3>;
                        label = "wan";
                        phy-handle = <&switch0phy2>;
index 8570c5f..b6f4af8 100644 (file)
        model = "Globalscale Marvell ESPRESSOBin Board V7";
        compatible = "globalscale,espressobin-v7", "globalscale,espressobin",
                     "marvell,armada3720", "marvell,armada3710";
+
+       aliases {
+               /* ethernet1 is wan port */
+               ethernet1 = &switch0port3;
+               ethernet3 = &switch0port1;
+       };
 };
 
 &switch0 {
        ports {
-               port@1 {
+               switch0port1: port@1 {
                        reg = <1>;
                        label = "lan1";
                        phy-handle = <&switch0phy0>;
                };
 
-               port@3 {
+               switch0port3: port@3 {
                        reg = <3>;
                        label = "wan";
                        phy-handle = <&switch0phy2>;
index b97218c..0775c16 100644 (file)
 / {
        aliases {
                ethernet0 = &eth0;
+               /* for dsa slave device */
+               ethernet1 = &switch0port1;
+               ethernet2 = &switch0port2;
+               ethernet3 = &switch0port3;
                serial0 = &uart0;
                serial1 = &uart1;
        };
                        #address-cells = <1>;
                        #size-cells = <0>;
 
-                       port@0 {
+                       switch0port0: port@0 {
                                reg = <0>;
                                label = "cpu";
                                ethernet = <&eth0>;
                                };
                        };
 
-                       port@1 {
+                       switch0port1: port@1 {
                                reg = <1>;
                                label = "wan";
                                phy-handle = <&switch0phy0>;
                        };
 
-                       port@2 {
+                       switch0port2: port@2 {
                                reg = <2>;
                                label = "lan0";
                                phy-handle = <&switch0phy1>;
                        };
 
-                       port@3 {
+                       switch0port3: port@3 {
                                reg = <3>;
                                label = "lan1";
                                phy-handle = <&switch0phy2>;
index a5a12b2..44a0346 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/regulator/dlg,da9211-regulator.h>
 #include <dt-bindings/gpio/gpio.h>
 #include "mt8173.dtsi"
 
                                regulator-max-microamp  = <4400000>;
                                regulator-ramp-delay = <10000>;
                                regulator-always-on;
-                               regulator-allowed-modes = <0 1>;
+                               regulator-allowed-modes = <DA9211_BUCK_MODE_SYNC
+                                                          DA9211_BUCK_MODE_AUTO>;
                        };
 
                        da9211_vgpu_reg: BUCKB {
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&nor_gpio1_pins>;
-       bus-width = <8>;
-       max-frequency = <50000000>;
-       non-removable;
+
        flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
+               spi-max-frequency = <50000000>;
        };
 };
 
index ae405bd..cba2d89 100644 (file)
        chosen {
                stdout-path = "serial0:921600n8";
        };
+
+       reserved-memory {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+               scp_mem_reserved: scp_mem_region {
+                       compatible = "shared-dma-pool";
+                       reg = <0 0x50000000 0 0x2900000>;
+                       no-map;
+               };
+       };
 };
 
 &auxadc {
index f0a0705..85f7c33 100644 (file)
                regulator-max-microvolt = <3300000>;
        };
 
+       reserved_memory: reserved-memory {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               scp_mem_reserved: scp_mem_region {
+                       compatible = "shared-dma-pool";
+                       reg = <0 0x50000000 0 0x2900000>;
+                       no-map;
+               };
+       };
+
        max98357a: codec0 {
                compatible = "maxim,max98357a";
                sdmode-gpios = <&pio 175 0>;
                };
        };
 
+       scp_pins: scp {
+               pins_scp_uart {
+                       pinmux = <PINMUX_GPIO110__FUNC_TP_URXD1_AO>,
+                                <PINMUX_GPIO112__FUNC_TP_UTXD1_AO>;
+               };
+       };
+
        spi0_pins: spi0 {
                pins_spi{
                        pinmux = <PINMUX_GPIO85__FUNC_SPI0_MI>,
        };
 };
 
+&scp {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&scp_pins>;
+
+       cros_ec {
+               compatible = "google,cros-ec-rpmsg";
+               mtk,rpmsg-name = "cros-ec-rpmsg";
+       };
+};
+
 &soc_data {
        status = "okay";
 };
index 1021058..9cfd961 100644 (file)
                };
 
                watchdog: watchdog@10007000 {
-                       compatible = "mediatek,mt8183-wdt",
-                                    "mediatek,mt6589-wdt";
+                       compatible = "mediatek,mt8183-wdt";
                        reg = <0 0x10007000 0 0x100>;
                        #reset-cells = <1>;
                };
                        clock-names = "spi", "wrap";
                };
 
+               scp: scp@10500000 {
+                       compatible = "mediatek,mt8183-scp";
+                       reg = <0 0x10500000 0 0x80000>,
+                             <0 0x105c0000 0 0x19080>;
+                       reg-names = "sram", "cfg";
+                       interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&infracfg CLK_INFRA_SCPSYS>;
+                       clock-names = "main";
+                       memory-region = <&scp_mem_reserved>;
+                       status = "disabled";
+               };
+
                systimer: timer@10017000 {
                        compatible = "mediatek,mt8183-timer",
                                     "mediatek,mt6765-timer";
index dfceffe..29d8cf6 100644 (file)
@@ -56,7 +56,7 @@
        tca6416: gpio@20 {
                compatible = "ti,tca6416";
                reg = <0x20>;
-               rst-gpio = <&pio 65 GPIO_ACTIVE_HIGH>;
+               reset-gpios = <&pio 65 GPIO_ACTIVE_HIGH>;
                pinctrl-names = "default";
                pinctrl-0 = <&tca6416_pins>;
 
index cf712e8..3cb01c3 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/clock/microchip,sparx5.h>
 
 / {
        compatible = "microchip,sparx5";
@@ -13,6 +14,7 @@
        #size-cells = <1>;
 
        aliases {
+               spi0 = &spi0;
                serial0 = &uart0;
                serial1 = &uart1;
        };
                        interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
                };
 
+               cpu_ctrl: syscon@600000000 {
+                       compatible = "microchip,sparx5-cpu-syscon", "syscon",
+                                    "simple-mfd";
+                       reg = <0x6 0x00000000 0xd0>;
+                       mux: mux-controller {
+                               compatible = "mmio-mux";
+                               #mux-control-cells = <0>;
+                               /*
+                                * SI_OWNER and SI2_OWNER in GENERAL_CTRL
+                                * SPI:  value 9 - (SIMC,SIBM) = 0b1001
+                                * SPI2: value 6 - (SIBM,SIMC) = 0b0110
+                                */
+                               mux-reg-masks = <0x88 0xf0>;
+                       };
+               };
+
                uart0: serial@600100000 {
                        pinctrl-0 = <&uart_pins>;
                        pinctrl-names = "default";
                        status = "disabled";
                };
 
+               spi0: spi@600104000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "microchip,sparx5-spi";
+                       reg = <0x6 0x00104000 0x40>;
+                       num-cs = <16>;
+                       reg-io-width = <4>;
+                       reg-shift = <2>;
+                       clocks = <&ahb_clk>;
+                       interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
                timer1: timer@600105000 {
                        compatible = "snps,dw-apb-timer";
                        reg = <0x6 0x00105000 0x1000>;
                        interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
                };
 
+               sdhci0: mmc@600800000 {
+                       compatible = "microchip,dw-sparx5-sdhci";
+                       status = "disabled";
+                       reg = <0x6 0x00800000 0x1000>;
+                       pinctrl-0 = <&emmc_pins>;
+                       pinctrl-names = "default";
+                       clocks = <&clks CLK_ID_AUX1>;
+                       clock-names = "core";
+                       assigned-clocks = <&clks CLK_ID_AUX1>;
+                       assigned-clock-rates = <800000000>;
+                       interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+                       bus-width = <8>;
+               };
+
                gpio: pinctrl@6110101e0 {
                        compatible = "microchip,sparx5-pinctrl";
                        reg = <0x6 0x110101e0 0x90>, <0x6 0x10508010 0x100>;
                        interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
                        #interrupt-cells = <2>;
 
+                       cs1_pins: cs1-pins {
+                               pins = "GPIO_16";
+                               function = "si";
+                       };
+
+                       cs2_pins: cs2-pins {
+                               pins = "GPIO_17";
+                               function = "si";
+                       };
+
+                       cs3_pins: cs3-pins {
+                               pins = "GPIO_18";
+                               function = "si";
+                       };
+
+                       si2_pins: si2-pins {
+                               pins = "GPIO_39", "GPIO_40", "GPIO_41";
+                               function = "si2";
+                       };
+
                        uart_pins: uart-pins {
                                pins = "GPIO_10", "GPIO_11";
                                function = "uart";
                                pins = "GPIO_28", "GPIO_29";
                                function = "twi2";
                        };
+
+                       emmc_pins: emmc-pins {
+                               pins = "GPIO_34", "GPIO_35", "GPIO_36",
+                                       "GPIO_37", "GPIO_38", "GPIO_39",
+                                       "GPIO_40", "GPIO_41", "GPIO_42",
+                                       "GPIO_43", "GPIO_44", "GPIO_45",
+                                       "GPIO_46", "GPIO_47";
+                               function = "emmc";
+                       };
                };
 
                i2c0: i2c@600101000 {
                        clock-frequency = <100000>;
                        clocks = <&ahb_clk>;
                };
+
+               tmon0: tmon@610508110 {
+                       compatible = "microchip,sparx5-temp";
+                       reg = <0x6 0x10508110 0xc>;
+                       #thermal-sensor-cells = <0>;
+                       clocks = <&ahb_clk>;
+               };
        };
 };
diff --git a/arch/arm64/boot/dts/microchip/sparx5_nand.dtsi b/arch/arm64/boot/dts/microchip/sparx5_nand.dtsi
new file mode 100644 (file)
index 0000000..03f107e
--- /dev/null
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Microchip Technology Inc. and its subsidiaries.
+ */
+
+&gpio {
+       cs14_pins: cs14-pins {
+               pins = "GPIO_44";
+               function = "si";
+       };
+};
+
+&spi0 {
+       pinctrl-0 = <&si2_pins>;
+       pinctrl-names = "default";
+       spi@e {
+               compatible = "spi-mux";
+               mux-controls = <&mux>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <14>; /* CS14 */
+               spi-flash@6 {
+                       compatible = "spi-nand";
+                       pinctrl-0 = <&cs14_pins>;
+                       pinctrl-names = "default";
+                       reg = <0x6>; /* SPI2 */
+                       spi-max-frequency = <42000000>;
+                       rx-sample-delay-ns = <7>;  /* Tune for speed */
+               };
+       };
+};
index 91ee5b6..6b2da7c 100644 (file)
        };
 };
 
+&gpio {
+       emmc_pins: emmc-pins {
+               /* NB: No "GPIO_35", "GPIO_36", "GPIO_37"
+                * (N/A: CARD_nDETECT, CARD_WP, CARD_LED)
+                */
+               pins = "GPIO_34", "GPIO_38", "GPIO_39",
+                       "GPIO_40", "GPIO_41", "GPIO_42",
+                       "GPIO_43", "GPIO_44", "GPIO_45",
+                       "GPIO_46", "GPIO_47";
+               drive-strength = <3>;
+               function = "emmc";
+       };
+};
+
+&sdhci0 {
+       status = "okay";
+       bus-width = <8>;
+       non-removable;
+       pinctrl-0 = <&emmc_pins>;
+       max-frequency = <8000000>;
+       microchip,clock-delay = <10>;
+};
+
+&spi0 {
+       status = "okay";
+       spi@0 {
+               compatible = "spi-mux";
+               mux-controls = <&mux>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0>;      /* CS0 */
+               spi-flash@9 {
+                       compatible = "jedec,spi-nor";
+                       spi-max-frequency = <8000000>;
+                       reg = <0x9>;    /* SPI */
+               };
+       };
+       spi@1 {
+               compatible = "spi-mux";
+               mux-controls = <&mux 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <1>; /* CS1 */
+               spi-flash@9 {
+                       compatible = "spi-nand";
+                       pinctrl-0 = <&cs1_pins>;
+                       pinctrl-names = "default";
+                       spi-max-frequency = <8000000>;
+                       reg = <0x9>;    /* SPI */
+               };
+       };
+};
+
 &i2c1 {
        status = "okay";
 };
index feee4e9..45ca1af 100644 (file)
@@ -5,6 +5,7 @@
 
 /dts-v1/;
 #include "sparx5_pcb134_board.dtsi"
+#include "sparx5_nand.dtsi"
 
 / {
        model = "Sparx5 PCB134 Reference Board (NAND)";
index 18a535a..f37b478 100644 (file)
        };
 };
 
+&spi0 {
+       status = "okay";
+       spi@0 {
+               compatible = "spi-mux";
+               mux-controls = <&mux>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0>;      /* CS0 */
+               spi-flash@9 {
+                       compatible = "jedec,spi-nor";
+                       spi-max-frequency = <8000000>;
+                       reg = <0x9>;    /* SPI */
+               };
+       };
+};
+
+&spi0 {
+       status = "okay";
+       spi@0 {
+               compatible = "spi-mux";
+               mux-controls = <&mux>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0>;      /* CS0 */
+               spi-flash@9 {
+                       compatible = "jedec,spi-nor";
+                       spi-max-frequency = <8000000>;
+                       reg = <0x9>;    /* SPI */
+               };
+       };
+};
+
 &gpio {
        i2cmux_pins_i: i2cmux-pins-i {
               pins = "GPIO_16", "GPIO_17", "GPIO_18", "GPIO_19",
index 10081a6..bbb9852 100644 (file)
                reg = <0x00000000 0x00000000 0x10000000>;
        };
 };
+
+&gpio {
+       emmc_pins: emmc-pins {
+               /* NB: No "GPIO_35", "GPIO_36", "GPIO_37"
+                * (N/A: CARD_nDETECT, CARD_WP, CARD_LED)
+                */
+               pins = "GPIO_34", "GPIO_38", "GPIO_39",
+                       "GPIO_40", "GPIO_41", "GPIO_42",
+                       "GPIO_43", "GPIO_44", "GPIO_45",
+                       "GPIO_46", "GPIO_47";
+               drive-strength = <3>;
+               function = "emmc";
+       };
+};
+
+&sdhci0 {
+       status = "okay";
+       pinctrl-0 = <&emmc_pins>;
+       non-removable;
+       max-frequency = <52000000>;
+       bus-width = <8>;
+       microchip,clock-delay = <10>;
+};
index 20e409a..647cdb3 100644 (file)
@@ -5,6 +5,7 @@
 
 /dts-v1/;
 #include "sparx5_pcb135_board.dtsi"
+#include "sparx5_nand.dtsi"
 
 / {
        model = "Sparx5 PCB135 Reference Board (NAND)";
index d71f11a..b02b8c8 100644 (file)
        };
 };
 
+&spi0 {
+       status = "okay";
+       spi@0 {
+               compatible = "spi-mux";
+               mux-controls = <&mux>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0>; /* CS0 */
+               spi-flash@9 {
+                       compatible = "jedec,spi-nor";
+                       spi-max-frequency = <8000000>;
+                       reg = <0x9>; /* SPI */
+               };
+       };
+};
+
+&spi0 {
+       status = "okay";
+       spi@0 {
+               compatible = "spi-mux";
+               mux-controls = <&mux>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0>; /* CS0 */
+               spi-flash@9 {
+                       compatible = "jedec,spi-nor";
+                       spi-max-frequency = <8000000>;
+                       reg = <0x9>; /* SPI */
+               };
+       };
+};
+
 &axi {
        i2c0_imux: i2c0-imux@0 {
                compatible = "i2c-mux-pinctrl";
index 741f0e1..f82266f 100644 (file)
                reg = <0x00000000 0x00000000 0x10000000>;
        };
 };
+
+&gpio {
+       emmc_pins: emmc-pins {
+               /* NB: No "GPIO_35", "GPIO_36", "GPIO_37"
+                * (N/A: CARD_nDETECT, CARD_WP, CARD_LED)
+                */
+               pins = "GPIO_34", "GPIO_38", "GPIO_39",
+                       "GPIO_40", "GPIO_41", "GPIO_42",
+                       "GPIO_43", "GPIO_44", "GPIO_45",
+                       "GPIO_46", "GPIO_47";
+               drive-strength = <3>;
+               function = "emmc";
+       };
+};
+
+&sdhci0 {
+       status = "okay";
+       pinctrl-0 = <&emmc_pins>;
+       non-removable;
+       max-frequency = <52000000>;
+       bus-width = <8>;
+       microchip,clock-delay = <10>;
+};
index 2273fc5..9296d12 100644 (file)
@@ -9,3 +9,4 @@ dtb-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210-p2894-0050-a08.dtb
 dtb-$(CONFIG_ARCH_TEGRA_186_SOC) += tegra186-p2771-0000.dtb
 dtb-$(CONFIG_ARCH_TEGRA_194_SOC) += tegra194-p2972-0000.dtb
 dtb-$(CONFIG_ARCH_TEGRA_194_SOC) += tegra194-p3509-0000+p3668-0000.dtb
+dtb-$(CONFIG_ARCH_TEGRA_234_SOC) += tegra234-sim-vdk.dtb
index 802b8c5..381a849 100644 (file)
                        compatible = "atmel,24c02";
                        reg = <0x57>;
 
+                       label = "system";
                        vcc-supply = <&vdd_1v8>;
                        address-width = <8>;
                        pagesize = <8>;
index 53d92fd..fd91774 100644 (file)
                        compatible = "atmel,24c02";
                        reg = <0x50>;
 
+                       label = "module";
                        vcc-supply = <&vdd_1v8>;
                        address-width = <8>;
                        pagesize = <8>;
index 8eb61dd..0c46ab7 100644 (file)
@@ -85,7 +85,7 @@
                ranges = <0x02900000 0x0 0x02900000 0x200000>;
                status = "disabled";
 
-               dma-controller@2930000 {
+               adma: dma-controller@2930000 {
                        compatible = "nvidia,tegra186-adma";
                        reg = <0x02930000 0x20000>;
                        interrupt-parent = <&agic>;
                        clock-names = "clk";
                        status = "disabled";
                };
+
+               tegra_ahub: ahub@2900800 {
+                       compatible = "nvidia,tegra186-ahub";
+                       reg = <0x02900800 0x800>;
+                       clocks = <&bpmp TEGRA186_CLK_AHUB>;
+                       clock-names = "ahub";
+                       assigned-clocks = <&bpmp TEGRA186_CLK_AHUB>;
+                       assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x02900800 0x02900800 0x11800>;
+                       status = "disabled";
+
+                       tegra_admaif: admaif@290f000 {
+                               compatible = "nvidia,tegra186-admaif";
+                               reg = <0x0290f000 0x1000>;
+                               dmas = <&adma 1>, <&adma 1>,
+                                      <&adma 2>, <&adma 2>,
+                                      <&adma 3>, <&adma 3>,
+                                      <&adma 4>, <&adma 4>,
+                                      <&adma 5>, <&adma 5>,
+                                      <&adma 6>, <&adma 6>,
+                                      <&adma 7>, <&adma 7>,
+                                      <&adma 8>, <&adma 8>,
+                                      <&adma 9>, <&adma 9>,
+                                      <&adma 10>, <&adma 10>,
+                                      <&adma 11>, <&adma 11>,
+                                      <&adma 12>, <&adma 12>,
+                                      <&adma 13>, <&adma 13>,
+                                      <&adma 14>, <&adma 14>,
+                                      <&adma 15>, <&adma 15>,
+                                      <&adma 16>, <&adma 16>,
+                                      <&adma 17>, <&adma 17>,
+                                      <&adma 18>, <&adma 18>,
+                                      <&adma 19>, <&adma 19>,
+                                      <&adma 20>, <&adma 20>;
+                               dma-names = "rx1", "tx1",
+                                           "rx2", "tx2",
+                                           "rx3", "tx3",
+                                           "rx4", "tx4",
+                                           "rx5", "tx5",
+                                           "rx6", "tx6",
+                                           "rx7", "tx7",
+                                           "rx8", "tx8",
+                                           "rx9", "tx9",
+                                           "rx10", "tx10",
+                                           "rx11", "tx11",
+                                           "rx12", "tx12",
+                                           "rx13", "tx13",
+                                           "rx14", "tx14",
+                                           "rx15", "tx15",
+                                           "rx16", "tx16",
+                                           "rx17", "tx17",
+                                           "rx18", "tx18",
+                                           "rx19", "tx19",
+                                           "rx20", "tx20";
+                               status = "disabled";
+                       };
+
+                       tegra_i2s1: i2s@2901000 {
+                               compatible = "nvidia,tegra186-i2s",
+                                            "nvidia,tegra210-i2s";
+                               reg = <0x2901000 0x100>;
+                               clocks = <&bpmp TEGRA186_CLK_I2S1>,
+                                        <&bpmp TEGRA186_CLK_I2S1_SYNC_INPUT>;
+                               clock-names = "i2s", "sync_input";
+                               assigned-clocks = <&bpmp TEGRA186_CLK_I2S1>;
+                               assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <1536000>;
+                               sound-name-prefix = "I2S1";
+                               status = "disabled";
+                       };
+
+                       tegra_i2s2: i2s@2901100 {
+                               compatible = "nvidia,tegra186-i2s",
+                                            "nvidia,tegra210-i2s";
+                               reg = <0x2901100 0x100>;
+                               clocks = <&bpmp TEGRA186_CLK_I2S2>,
+                                        <&bpmp TEGRA186_CLK_I2S2_SYNC_INPUT>;
+                               clock-names = "i2s", "sync_input";
+                               assigned-clocks = <&bpmp TEGRA186_CLK_I2S2>;
+                               assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <1536000>;
+                               sound-name-prefix = "I2S2";
+                               status = "disabled";
+                       };
+
+                       tegra_i2s3: i2s@2901200 {
+                               compatible = "nvidia,tegra186-i2s",
+                                            "nvidia,tegra210-i2s";
+                               reg = <0x2901200 0x100>;
+                               clocks = <&bpmp TEGRA186_CLK_I2S3>,
+                                        <&bpmp TEGRA186_CLK_I2S3_SYNC_INPUT>;
+                               clock-names = "i2s", "sync_input";
+                               assigned-clocks = <&bpmp TEGRA186_CLK_I2S3>;
+                               assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <1536000>;
+                               sound-name-prefix = "I2S3";
+                               status = "disabled";
+                       };
+
+                       tegra_i2s4: i2s@2901300 {
+                               compatible = "nvidia,tegra186-i2s",
+                                            "nvidia,tegra210-i2s";
+                               reg = <0x2901300 0x100>;
+                               clocks = <&bpmp TEGRA186_CLK_I2S4>,
+                                        <&bpmp TEGRA186_CLK_I2S4_SYNC_INPUT>;
+                               clock-names = "i2s", "sync_input";
+                               assigned-clocks = <&bpmp TEGRA186_CLK_I2S4>;
+                               assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <1536000>;
+                               sound-name-prefix = "I2S4";
+                               status = "disabled";
+                       };
+
+                       tegra_i2s5: i2s@2901400 {
+                               compatible = "nvidia,tegra186-i2s",
+                                            "nvidia,tegra210-i2s";
+                               reg = <0x2901400 0x100>;
+                               clocks = <&bpmp TEGRA186_CLK_I2S5>,
+                                        <&bpmp TEGRA186_CLK_I2S5_SYNC_INPUT>;
+                               clock-names = "i2s", "sync_input";
+                               assigned-clocks = <&bpmp TEGRA186_CLK_I2S5>;
+                               assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <1536000>;
+                               sound-name-prefix = "I2S5";
+                               status = "disabled";
+                       };
+
+                       tegra_i2s6: i2s@2901500 {
+                               compatible = "nvidia,tegra186-i2s",
+                                            "nvidia,tegra210-i2s";
+                               reg = <0x2901500 0x100>;
+                               clocks = <&bpmp TEGRA186_CLK_I2S6>,
+                                        <&bpmp TEGRA186_CLK_I2S6_SYNC_INPUT>;
+                               clock-names = "i2s", "sync_input";
+                               assigned-clocks = <&bpmp TEGRA186_CLK_I2S6>;
+                               assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <1536000>;
+                               sound-name-prefix = "I2S6";
+                               status = "disabled";
+                       };
+
+                       tegra_dmic1: dmic@2904000 {
+                               compatible = "nvidia,tegra210-dmic";
+                               reg = <0x2904000 0x100>;
+                               clocks = <&bpmp TEGRA186_CLK_DMIC1>;
+                               clock-names = "dmic";
+                               assigned-clocks = <&bpmp TEGRA186_CLK_DMIC1>;
+                               assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <3072000>;
+                               sound-name-prefix = "DMIC1";
+                               status = "disabled";
+                       };
+
+                       tegra_dmic2: dmic@2904100 {
+                               compatible = "nvidia,tegra210-dmic";
+                               reg = <0x2904100 0x100>;
+                               clocks = <&bpmp TEGRA186_CLK_DMIC2>;
+                               clock-names = "dmic";
+                               assigned-clocks = <&bpmp TEGRA186_CLK_DMIC2>;
+                               assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <3072000>;
+                               sound-name-prefix = "DMIC2";
+                               status = "disabled";
+                       };
+
+                       tegra_dmic3: dmic@2904200 {
+                               compatible = "nvidia,tegra210-dmic";
+                               reg = <0x2904200 0x100>;
+                               clocks = <&bpmp TEGRA186_CLK_DMIC3>;
+                               clock-names = "dmic";
+                               assigned-clocks = <&bpmp TEGRA186_CLK_DMIC3>;
+                               assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <3072000>;
+                               sound-name-prefix = "DMIC3";
+                               status = "disabled";
+                       };
+
+                       tegra_dmic4: dmic@2904300 {
+                               compatible = "nvidia,tegra210-dmic";
+                               reg = <0x2904300 0x100>;
+                               clocks = <&bpmp TEGRA186_CLK_DMIC4>;
+                               clock-names = "dmic";
+                               assigned-clocks = <&bpmp TEGRA186_CLK_DMIC4>;
+                               assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <3072000>;
+                               sound-name-prefix = "DMIC4";
+                               status = "disabled";
+                       };
+
+                       tegra_dspk1: dspk@2905000 {
+                               compatible = "nvidia,tegra186-dspk";
+                               reg = <0x2905000 0x100>;
+                               clocks = <&bpmp TEGRA186_CLK_DSPK1>;
+                               clock-names = "dspk";
+                               assigned-clocks = <&bpmp TEGRA186_CLK_DSPK1>;
+                               assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <12288000>;
+                               sound-name-prefix = "DSPK1";
+                               status = "disabled";
+                       };
+
+                       tegra_dspk2: dspk@2905100 {
+                               compatible = "nvidia,tegra186-dspk";
+                               reg = <0x2905100 0x100>;
+                               clocks = <&bpmp TEGRA186_CLK_DSPK2>;
+                               clock-names = "dspk";
+                               assigned-clocks = <&bpmp TEGRA186_CLK_DSPK2>;
+                               assigned-clock-parents = <&bpmp TEGRA186_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <12288000>;
+                               sound-name-prefix = "DSPK2";
+                               status = "disabled";
+                       };
+               };
        };
 
        mc: memory-controller@2c00000 {
index 4c005b8..d71b7a1 100644 (file)
                        status = "okay";
                };
 
+               i2c@3160000 {
+                       status = "okay";
+
+                       eeprom@50 {
+                               compatible = "atmel,24c02";
+                               reg = <0x50>;
+
+                               label = "module";
+                               vcc-supply = <&vdd_1v8ls>;
+                               address-width = <8>;
+                               pagesize = <8>;
+                               size = <256>;
+                               read-only;
+                       };
+               };
+
                /* SDMMC1 (SD/MMC) */
                mmc@3400000 {
                        cd-gpios = <&gpio TEGRA194_MAIN_GPIO(A, 0) GPIO_ACTIVE_LOW>;
index 90b6ea5..54d057b 100644 (file)
                        };
                };
 
+               i2c@3160000 {
+                       eeprom@56 {
+                               compatible = "atmel,24c02";
+                               reg = <0x56>;
+
+                               label = "system";
+                               vcc-supply = <&vdd_1v8ls>;
+                               address-width = <8>;
+                               pagesize = <8>;
+                               size = <256>;
+                               read-only;
+                       };
+               };
+
                ddc: i2c@31c0000 {
                        status = "okay";
                };
index c1c5898..7f97b34 100644 (file)
                        status = "okay";
                };
 
+               i2c@3160000 {
+                       eeprom@57 {
+                               compatible = "atmel,24c02";
+                               reg = <0x57>;
+
+                               label = "system";
+                               vcc-supply = <&vdd_1v8>;
+                               address-width = <8>;
+                               pagesize = <8>;
+                               size = <256>;
+                               read-only;
+                       };
+               };
+
                hda@3510000 {
                        nvidia,model = "jetson-xavier-nx-hda";
                        status = "okay";
index 10cb836..a2893be 100644 (file)
                        status = "okay";
                };
 
+               i2c@3160000 {
+                       status = "okay";
+
+                       eeprom@50 {
+                               compatible = "atmel,24c02";
+                               reg = <0x50>;
+
+                               label = "module";
+                               vcc-supply = <&vdd_1v8ls>;
+                               address-width = <8>;
+                               pagesize = <8>;
+                               size = <256>;
+                               read-only;
+                       };
+               };
+
                /* SDMMC1 (SD/MMC) */
                mmc@3400000 {
                        status = "okay";
index ca5cb6a..e9c90f0 100644 (file)
@@ -83,7 +83,7 @@
                        ranges = <0x02900000 0x02900000 0x200000>;
                        status = "disabled";
 
-                       dma-controller@2930000 {
+                       adma: dma-controller@2930000 {
                                compatible = "nvidia,tegra194-adma",
                                             "nvidia,tegra186-adma";
                                reg = <0x02930000 0x20000>;
                                clock-names = "clk";
                                status = "disabled";
                        };
+
+                       tegra_ahub: ahub@2900800 {
+                               compatible = "nvidia,tegra194-ahub",
+                                            "nvidia,tegra186-ahub";
+                               reg = <0x02900800 0x800>;
+                               clocks = <&bpmp TEGRA194_CLK_AHUB>;
+                               clock-names = "ahub";
+                               assigned-clocks = <&bpmp TEGRA194_CLK_AHUB>;
+                               assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               ranges = <0x02900800 0x02900800 0x11800>;
+                               status = "disabled";
+
+                               tegra_admaif: admaif@290f000 {
+                                       compatible = "nvidia,tegra194-admaif",
+                                                    "nvidia,tegra186-admaif";
+                                       reg = <0x0290f000 0x1000>;
+                                       dmas = <&adma 1>, <&adma 1>,
+                                              <&adma 2>, <&adma 2>,
+                                              <&adma 3>, <&adma 3>,
+                                              <&adma 4>, <&adma 4>,
+                                              <&adma 5>, <&adma 5>,
+                                              <&adma 6>, <&adma 6>,
+                                              <&adma 7>, <&adma 7>,
+                                              <&adma 8>, <&adma 8>,
+                                              <&adma 9>, <&adma 9>,
+                                              <&adma 10>, <&adma 10>,
+                                              <&adma 11>, <&adma 11>,
+                                              <&adma 12>, <&adma 12>,
+                                              <&adma 13>, <&adma 13>,
+                                              <&adma 14>, <&adma 14>,
+                                              <&adma 15>, <&adma 15>,
+                                              <&adma 16>, <&adma 16>,
+                                              <&adma 17>, <&adma 17>,
+                                              <&adma 18>, <&adma 18>,
+                                              <&adma 19>, <&adma 19>,
+                                              <&adma 20>, <&adma 20>;
+                                       dma-names = "rx1", "tx1",
+                                                   "rx2", "tx2",
+                                                   "rx3", "tx3",
+                                                   "rx4", "tx4",
+                                                   "rx5", "tx5",
+                                                   "rx6", "tx6",
+                                                   "rx7", "tx7",
+                                                   "rx8", "tx8",
+                                                   "rx9", "tx9",
+                                                   "rx10", "tx10",
+                                                   "rx11", "tx11",
+                                                   "rx12", "tx12",
+                                                   "rx13", "tx13",
+                                                   "rx14", "tx14",
+                                                   "rx15", "tx15",
+                                                   "rx16", "tx16",
+                                                   "rx17", "tx17",
+                                                   "rx18", "tx18",
+                                                   "rx19", "tx19",
+                                                   "rx20", "tx20";
+                                       status = "disabled";
+                               };
+
+                               tegra_i2s1: i2s@2901000 {
+                                       compatible = "nvidia,tegra194-i2s",
+                                                    "nvidia,tegra210-i2s";
+                                       reg = <0x2901000 0x100>;
+                                       clocks = <&bpmp TEGRA194_CLK_I2S1>,
+                                                <&bpmp TEGRA194_CLK_I2S1_SYNC_INPUT>;
+                                       clock-names = "i2s", "sync_input";
+                                       assigned-clocks = <&bpmp TEGRA194_CLK_I2S1>;
+                                       assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                                       assigned-clock-rates = <1536000>;
+                                       sound-name-prefix = "I2S1";
+                                       status = "disabled";
+                               };
+
+                               tegra_i2s2: i2s@2901100 {
+                                       compatible = "nvidia,tegra194-i2s",
+                                                    "nvidia,tegra210-i2s";
+                                       reg = <0x2901100 0x100>;
+                                       clocks = <&bpmp TEGRA194_CLK_I2S2>,
+                                                <&bpmp TEGRA194_CLK_I2S2_SYNC_INPUT>;
+                                       clock-names = "i2s", "sync_input";
+                                       assigned-clocks = <&bpmp TEGRA194_CLK_I2S2>;
+                                       assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                                       assigned-clock-rates = <1536000>;
+                                       sound-name-prefix = "I2S2";
+                                       status = "disabled";
+                               };
+
+                               tegra_i2s3: i2s@2901200 {
+                                       compatible = "nvidia,tegra194-i2s",
+                                                    "nvidia,tegra210-i2s";
+                                       reg = <0x2901200 0x100>;
+                                       clocks = <&bpmp TEGRA194_CLK_I2S3>,
+                                                <&bpmp TEGRA194_CLK_I2S3_SYNC_INPUT>;
+                                       clock-names = "i2s", "sync_input";
+                                       assigned-clocks = <&bpmp TEGRA194_CLK_I2S3>;
+                                       assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                                       assigned-clock-rates = <1536000>;
+                                       sound-name-prefix = "I2S3";
+                                       status = "disabled";
+                               };
+
+                               tegra_i2s4: i2s@2901300 {
+                                       compatible = "nvidia,tegra194-i2s",
+                                                    "nvidia,tegra210-i2s";
+                                       reg = <0x2901300 0x100>;
+                                       clocks = <&bpmp TEGRA194_CLK_I2S4>,
+                                                <&bpmp TEGRA194_CLK_I2S4_SYNC_INPUT>;
+                                       clock-names = "i2s", "sync_input";
+                                       assigned-clocks = <&bpmp TEGRA194_CLK_I2S4>;
+                                       assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                                       assigned-clock-rates = <1536000>;
+                                       sound-name-prefix = "I2S4";
+                                       status = "disabled";
+                               };
+
+                               tegra_i2s5: i2s@2901400 {
+                                       compatible = "nvidia,tegra194-i2s",
+                                                    "nvidia,tegra210-i2s";
+                                       reg = <0x2901400 0x100>;
+                                       clocks = <&bpmp TEGRA194_CLK_I2S5>,
+                                                <&bpmp TEGRA194_CLK_I2S5_SYNC_INPUT>;
+                                       clock-names = "i2s", "sync_input";
+                                       assigned-clocks = <&bpmp TEGRA194_CLK_I2S5>;
+                                       assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                                       assigned-clock-rates = <1536000>;
+                                       sound-name-prefix = "I2S5";
+                                       status = "disabled";
+                               };
+
+                               tegra_i2s6: i2s@2901500 {
+                                       compatible = "nvidia,tegra194-i2s",
+                                                    "nvidia,tegra210-i2s";
+                                       reg = <0x2901500 0x100>;
+                                       clocks = <&bpmp TEGRA194_CLK_I2S6>,
+                                                <&bpmp TEGRA194_CLK_I2S6_SYNC_INPUT>;
+                                       clock-names = "i2s", "sync_input";
+                                       assigned-clocks = <&bpmp TEGRA194_CLK_I2S6>;
+                                       assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                                       assigned-clock-rates = <1536000>;
+                                       sound-name-prefix = "I2S6";
+                                       status = "disabled";
+                               };
+
+                               tegra_dmic1: dmic@2904000 {
+                                       compatible = "nvidia,tegra194-dmic",
+                                                    "nvidia,tegra210-dmic";
+                                       reg = <0x2904000 0x100>;
+                                       clocks = <&bpmp TEGRA194_CLK_DMIC1>;
+                                       clock-names = "dmic";
+                                       assigned-clocks = <&bpmp TEGRA194_CLK_DMIC1>;
+                                       assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                                       assigned-clock-rates = <3072000>;
+                                       sound-name-prefix = "DMIC1";
+                                       status = "disabled";
+                               };
+
+                               tegra_dmic2: dmic@2904100 {
+                                       compatible = "nvidia,tegra194-dmic",
+                                                    "nvidia,tegra210-dmic";
+                                       reg = <0x2904100 0x100>;
+                                       clocks = <&bpmp TEGRA194_CLK_DMIC2>;
+                                       clock-names = "dmic";
+                                       assigned-clocks = <&bpmp TEGRA194_CLK_DMIC2>;
+                                       assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                                       assigned-clock-rates = <3072000>;
+                                       sound-name-prefix = "DMIC2";
+                                       status = "disabled";
+                               };
+
+                               tegra_dmic3: dmic@2904200 {
+                                       compatible = "nvidia,tegra194-dmic",
+                                                    "nvidia,tegra210-dmic";
+                                       reg = <0x2904200 0x100>;
+                                       clocks = <&bpmp TEGRA194_CLK_DMIC3>;
+                                       clock-names = "dmic";
+                                       assigned-clocks = <&bpmp TEGRA194_CLK_DMIC3>;
+                                       assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                                       assigned-clock-rates = <3072000>;
+                                       sound-name-prefix = "DMIC3";
+                                       status = "disabled";
+                               };
+
+                               tegra_dmic4: dmic@2904300 {
+                                       compatible = "nvidia,tegra194-dmic",
+                                                    "nvidia,tegra210-dmic";
+                                       reg = <0x2904300 0x100>;
+                                       clocks = <&bpmp TEGRA194_CLK_DMIC4>;
+                                       clock-names = "dmic";
+                                       assigned-clocks = <&bpmp TEGRA194_CLK_DMIC4>;
+                                       assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                                       assigned-clock-rates = <3072000>;
+                                       sound-name-prefix = "DMIC4";
+                                       status = "disabled";
+                               };
+
+                               tegra_dspk1: dspk@2905000 {
+                                       compatible = "nvidia,tegra194-dspk",
+                                                    "nvidia,tegra186-dspk";
+                                       reg = <0x2905000 0x100>;
+                                       clocks = <&bpmp TEGRA194_CLK_DSPK1>;
+                                       clock-names = "dspk";
+                                       assigned-clocks = <&bpmp TEGRA194_CLK_DSPK1>;
+                                       assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                                       assigned-clock-rates = <12288000>;
+                                       sound-name-prefix = "DSPK1";
+                                       status = "disabled";
+                               };
+
+                               tegra_dspk2: dspk@2905100 {
+                                       compatible = "nvidia,tegra194-dspk",
+                                                    "nvidia,tegra186-dspk";
+                                       reg = <0x2905100 0x100>;
+                                       clocks = <&bpmp TEGRA194_CLK_DSPK2>;
+                                       clock-names = "dspk";
+                                       assigned-clocks = <&bpmp TEGRA194_CLK_DSPK2>;
+                                       assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;
+                                       assigned-clock-rates = <12288000>;
+                                       sound-name-prefix = "DSPK2";
+                                       status = "disabled";
+                               };
+                       };
                };
 
                pinmux: pinmux@2430000 {
                        clock-names = "div-clk";
                        resets = <&bpmp TEGRA194_RESET_I2C4>;
                        reset-names = "i2c";
+                       pinctrl-0 = <&state_dpaux1_i2c>;
+                       pinctrl-1 = <&state_dpaux1_off>;
+                       pinctrl-names = "default", "idle";
                        status = "disabled";
                };
 
                        clock-names = "div-clk";
                        resets = <&bpmp TEGRA194_RESET_I2C6>;
                        reset-names = "i2c";
+                       pinctrl-0 = <&state_dpaux0_i2c>;
+                       pinctrl-1 = <&state_dpaux0_off>;
+                       pinctrl-names = "default", "idle";
                        status = "disabled";
                };
 
-               gen7_i2c: i2c@31c0000 {
+               /* shares pads with dpaux2 */
+               dp_aux_ch2_i2c: i2c@31c0000 {
                        compatible = "nvidia,tegra194-i2c";
                        reg = <0x031c0000 0x10000>;
                        interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
                        clock-names = "div-clk";
                        resets = <&bpmp TEGRA194_RESET_I2C7>;
                        reset-names = "i2c";
+                       pinctrl-0 = <&state_dpaux2_i2c>;
+                       pinctrl-1 = <&state_dpaux2_off>;
+                       pinctrl-names = "default", "idle";
                        status = "disabled";
                };
 
-               gen9_i2c: i2c@31e0000 {
+               /* shares pads with dpaux3 */
+               dp_aux_ch3_i2c: i2c@31e0000 {
                        compatible = "nvidia,tegra194-i2c";
                        reg = <0x031e0000 0x10000>;
                        interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
                        clock-names = "div-clk";
                        resets = <&bpmp TEGRA194_RESET_I2C9>;
                        reset-names = "i2c";
+                       pinctrl-0 = <&state_dpaux3_i2c>;
+                       pinctrl-1 = <&state_dpaux3_off>;
+                       pinctrl-names = "default", "idle";
                        status = "disabled";
                };
 
 
                gpu@17000000 {
                        compatible = "nvidia,gv11b";
-                       reg = <0x17000000 0x10000000>,
-                             <0x18000000 0x10000000>;
+                       reg = <0x17000000 0x1000000>,
+                             <0x18000000 0x1000000>;
                        interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-names = "stall", "nonstall";
index 6a4b50a..6077d57 100644 (file)
                        compatible = "atmel,24c02";
                        reg = <0x50>;
 
+                       label = "module";
                        vcc-supply = <&vdd_1v8>;
                        address-width = <8>;
                        pagesize = <8>;
 
        vdd_gpu: regulator@100 {
                compatible = "pwm-regulator";
-               pwms = <&pwm 1 4880>;
+               pwms = <&pwm 1 8000>;
                regulator-name = "VDD_GPU";
                regulator-min-microvolt = <710000>;
                regulator-max-microvolt = <1320000>;
index 56adf28..4c9c2a0 100644 (file)
@@ -86,6 +86,7 @@
                        compatible = "atmel,24c02";
                        reg = <0x57>;
 
+                       label = "system";
                        vcc-supply = <&vdd_1v8>;
                        address-width = <8>;
                        pagesize = <8>;
index 2282ea1..859241d 100644 (file)
                        compatible = "atmel,24c02";
                        reg = <0x50>;
 
+                       label = "module";
                        vcc-supply = <&vdd_1v8>;
                        address-width = <8>;
                        pagesize = <8>;
                        compatible = "atmel,24c02";
                        reg = <0x57>;
 
+                       label = "system";
                        vcc-supply = <&vdd_1v8>;
                        address-width = <8>;
                        pagesize = <8>;
                                mode = "peripheral";
                                usb-role-switch;
 
+                               vbus-supply = <&vdd_5v0_usb>;
+
                                connector {
                                        compatible = "gpio-usb-b-connector",
                                                     "usb-b-connector";
                bus-width = <4>;
 
                cd-gpios = <&gpio TEGRA_GPIO(Z, 1) GPIO_ACTIVE_LOW>;
+               disable-wp;
 
                vqmmc-supply = <&vddio_sdmmc>;
                vmmc-supply = <&vdd_3v3_sd>;
                pinctrl-1 = <&dvfs_pwm_inactive_state>;
        };
 
+       aconnect@702c0000 {
+               status = "okay";
+
+               dma@702e2000 {
+                       status = "okay";
+               };
+
+               interrupt-controller@702f9000 {
+                       status = "okay";
+               };
+       };
+
        clk32k_in: clock@0 {
                compatible = "fixed-clock";
                clock-frequency = <32768>;
 
        vdd_gpu: regulator@6 {
                compatible = "pwm-regulator";
-               pwms = <&pwm 1 4880>;
+               pwms = <&pwm 1 8000>;
 
                regulator-name = "VDD_GPU";
                regulator-min-microvolt = <710000>;
 
                vin-supply = <&avdd_1v05_pll>;
        };
+
+       vdd_5v0_usb: regulator@8 {
+               compatible = "regulator-fixed";
+
+               regulator-name = "VDD_5V_USB";
+               regulator-min-microvolt = <50000000>;
+               regulator-max-microvolt = <50000000>;
+
+               vin-supply = <&vdd_5v0_sys>;
+       };
 };
index 8cca216..d47c889 100644 (file)
 
                        iommus = <&mc TEGRA_SWGROUP_DC>;
 
+                       nvidia,outputs = <&dsia &dsib &sor0 &sor1>;
                        nvidia,head = <0>;
                };
 
 
                        iommus = <&mc TEGRA_SWGROUP_DCB>;
 
+                       nvidia,outputs = <&dsia &dsib &sor0 &sor1>;
                        nvidia,head = <1>;
                };
 
-               dsi@54300000 {
+               dsia: dsi@54300000 {
                        compatible = "nvidia,tegra210-dsi";
                        reg = <0x0 0x54300000 0x0 0x00040000>;
                        clocks = <&tegra_car TEGRA210_CLK_DSIA>,
                        status = "disabled";
                };
 
-               dsi@54400000 {
+               dsib: dsi@54400000 {
                        compatible = "nvidia,tegra210-dsi";
                        reg = <0x0 0x54400000 0x0 0x00040000>;
                        clocks = <&tegra_car TEGRA210_CLK_DSIB>,
                        status = "disabled";
                };
 
-               sor@54540000 {
+               sor0: sor@54540000 {
                        compatible = "nvidia,tegra210-sor";
                        reg = <0x0 0x54540000 0x0 0x00040000>;
                        interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
                        status = "disabled";
                };
 
-               sor@54580000 {
+               sor1: sor@54580000 {
                        compatible = "nvidia,tegra210-sor1";
                        reg = <0x0 0x54580000 0x0 0x00040000>;
                        interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
                        clock-names = "clk";
                        status = "disabled";
                };
+
+               tegra_ahub: ahub@702d0800 {
+                       compatible = "nvidia,tegra210-ahub";
+                       reg = <0x702d0800 0x800>;
+                       clocks = <&tegra_car TEGRA210_CLK_D_AUDIO>;
+                       clock-names = "ahub";
+                       assigned-clocks = <&tegra_car TEGRA210_CLK_D_AUDIO>;
+                       assigned-clock-parents = <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x702d0000 0x702d0000 0x0000e400>;
+                       status = "disabled";
+
+                       tegra_admaif: admaif@702d0000 {
+                               compatible = "nvidia,tegra210-admaif";
+                               reg = <0x702d0000 0x800>;
+                               dmas = <&adma 1>,  <&adma 1>,
+                                      <&adma 2>,  <&adma 2>,
+                                      <&adma 3>,  <&adma 3>,
+                                      <&adma 4>,  <&adma 4>,
+                                      <&adma 5>,  <&adma 5>,
+                                      <&adma 6>,  <&adma 6>,
+                                      <&adma 7>,  <&adma 7>,
+                                      <&adma 8>,  <&adma 8>,
+                                      <&adma 9>,  <&adma 9>,
+                                      <&adma 10>, <&adma 10>;
+                               dma-names = "rx1",  "tx1",
+                                           "rx2",  "tx2",
+                                           "rx3",  "tx3",
+                                           "rx4",  "tx4",
+                                           "rx5",  "tx5",
+                                           "rx6",  "tx6",
+                                           "rx7",  "tx7",
+                                           "rx8",  "tx8",
+                                           "rx9",  "tx9",
+                                           "rx10", "tx10";
+                               status = "disabled";
+                       };
+
+                       tegra_i2s1: i2s@702d1000 {
+                               compatible = "nvidia,tegra210-i2s";
+                               reg = <0x702d1000 0x100>;
+                               clocks = <&tegra_car TEGRA210_CLK_I2S0>,
+                                        <&tegra_car TEGRA210_CLK_I2S0_SYNC>;
+                               clock-names = "i2s", "sync_input";
+                               assigned-clocks = <&tegra_car TEGRA210_CLK_I2S0>;
+                               assigned-clock-parents = <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <1536000>;
+                               sound-name-prefix = "I2S1";
+                               status = "disabled";
+                       };
+
+                       tegra_i2s2: i2s@702d1100 {
+                               compatible = "nvidia,tegra210-i2s";
+                               reg = <0x702d1100 0x100>;
+                               clocks = <&tegra_car TEGRA210_CLK_I2S1>,
+                                        <&tegra_car TEGRA210_CLK_I2S1_SYNC>;
+                               clock-names = "i2s", "sync_input";
+                               assigned-clocks = <&tegra_car TEGRA210_CLK_I2S1>;
+                               assigned-clock-parents = <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <1536000>;
+                               sound-name-prefix = "I2S2";
+                               status = "disabled";
+                       };
+
+                       tegra_i2s3: i2s@702d1200 {
+                               compatible = "nvidia,tegra210-i2s";
+                               reg = <0x702d1200 0x100>;
+                               clocks = <&tegra_car TEGRA210_CLK_I2S2>,
+                                        <&tegra_car TEGRA210_CLK_I2S2_SYNC>;
+                               clock-names = "i2s", "sync_input";
+                               assigned-clocks = <&tegra_car TEGRA210_CLK_I2S2>;
+                               assigned-clock-parents = <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <1536000>;
+                               sound-name-prefix = "I2S3";
+                               status = "disabled";
+                       };
+
+                       tegra_i2s4: i2s@702d1300 {
+                               compatible = "nvidia,tegra210-i2s";
+                               reg = <0x702d1300 0x100>;
+                               clocks = <&tegra_car TEGRA210_CLK_I2S3>,
+                                        <&tegra_car TEGRA210_CLK_I2S3_SYNC>;
+                               clock-names = "i2s", "sync_input";
+                               assigned-clocks = <&tegra_car TEGRA210_CLK_I2S3>;
+                               assigned-clock-parents = <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <1536000>;
+                               sound-name-prefix = "I2S4";
+                               status = "disabled";
+                       };
+
+                       tegra_i2s5: i2s@702d1400 {
+                               compatible = "nvidia,tegra210-i2s";
+                               reg = <0x702d1400 0x100>;
+                               clocks = <&tegra_car TEGRA210_CLK_I2S4>,
+                                        <&tegra_car TEGRA210_CLK_I2S4_SYNC>;
+                               clock-names = "i2s", "sync_input";
+                               assigned-clocks = <&tegra_car TEGRA210_CLK_I2S4>;
+                               assigned-clock-parents = <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <1536000>;
+                               sound-name-prefix = "I2S5";
+                               status = "disabled";
+                       };
+
+                       tegra_dmic1: dmic@702d4000 {
+                               compatible = "nvidia,tegra210-dmic";
+                               reg = <0x702d4000 0x100>;
+                               clocks = <&tegra_car TEGRA210_CLK_DMIC1>;
+                               clock-names = "dmic";
+                               assigned-clocks = <&tegra_car TEGRA210_CLK_DMIC1>;
+                               assigned-clock-parents = <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <3072000>;
+                               sound-name-prefix = "DMIC1";
+                               status = "disabled";
+                       };
+
+                       tegra_dmic2: dmic@702d4100 {
+                               compatible = "nvidia,tegra210-dmic";
+                               reg = <0x702d4100 0x100>;
+                               clocks = <&tegra_car TEGRA210_CLK_DMIC2>;
+                               clock-names = "dmic";
+                               assigned-clocks = <&tegra_car TEGRA210_CLK_DMIC2>;
+                               assigned-clock-parents = <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <3072000>;
+                               sound-name-prefix = "DMIC2";
+                               status = "disabled";
+                       };
+
+                       tegra_dmic3: dmic@702d4200 {
+                               compatible = "nvidia,tegra210-dmic";
+                               reg = <0x702d4200 0x100>;
+                               clocks = <&tegra_car TEGRA210_CLK_DMIC3>;
+                               clock-names = "dmic";
+                               assigned-clocks = <&tegra_car TEGRA210_CLK_DMIC3>;
+                               assigned-clock-parents = <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;
+                               assigned-clock-rates = <3072000>;
+                               sound-name-prefix = "DMIC3";
+                               status = "disabled";
+                       };
+               };
        };
 
        spi@70410000 {
diff --git a/arch/arm64/boot/dts/nvidia/tegra234-sim-vdk.dts b/arch/arm64/boot/dts/nvidia/tegra234-sim-vdk.dts
new file mode 100644 (file)
index 0000000..f6e6a24
--- /dev/null
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "tegra234.dtsi"
+
+/ {
+       model = "NVIDIA Tegra234 VDK";
+       compatible = "nvidia,tegra234-vdk", "nvidia,tegra234";
+
+       aliases {
+               sdhci3 = "/cbb@0/sdhci@3460000";
+               serial0 = &uarta;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8 earlycon=uart8250,mmio32,0x03100000";
+               stdout-path = "serial0:115200n8";
+       };
+
+       cbb@0 {
+               serial@3100000 {
+                       status = "okay";
+               };
+
+               sdhci@3460000 {
+                       status = "okay";
+                       bus-width = <8>;
+                       non-removable;
+                       only-1-8-v;
+               };
+
+               rtc@c2a0000 {
+                       status = "okay";
+               };
+
+               pmc@c360000 {
+                       nvidia,invert-interrupt;
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
new file mode 100644 (file)
index 0000000..f0efb3a
--- /dev/null
@@ -0,0 +1,189 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <dt-bindings/clock/tegra234-clock.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/mailbox/tegra186-hsp.h>
+#include <dt-bindings/reset/tegra234-reset.h>
+
+/ {
+       compatible = "nvidia,tegra234";
+       interrupt-parent = <&gic>;
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       bus@0 {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               ranges = <0x0 0x0 0x0 0x40000000>;
+
+               misc@100000 {
+                       compatible = "nvidia,tegra234-misc";
+                       reg = <0x00100000 0xf000>,
+                             <0x0010f000 0x1000>;
+                       status = "okay";
+               };
+
+               uarta: serial@3100000 {
+                       compatible = "nvidia,tegra234-uart", "nvidia,tegra20-uart";
+                       reg = <0x03100000 0x10000>;
+                       interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bpmp TEGRA234_CLK_UARTA>;
+                       clock-names = "serial";
+                       resets = <&bpmp TEGRA234_RESET_UARTA>;
+                       reset-names = "serial";
+                       status = "disabled";
+               };
+
+               mmc@3460000 {
+                       compatible = "nvidia,tegra234-sdhci", "nvidia,tegra186-sdhci";
+                       reg = <0x03460000 0x20000>;
+                       interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bpmp TEGRA234_CLK_SDMMC4>;
+                       clock-names = "sdhci";
+                       resets = <&bpmp TEGRA234_RESET_SDMMC4>;
+                       reset-names = "sdhci";
+                       dma-coherent;
+                       status = "disabled";
+               };
+
+               fuse@3810000 {
+                       compatible = "nvidia,tegra234-efuse";
+                       reg = <0x03810000 0x10000>;
+                       clocks = <&bpmp TEGRA234_CLK_FUSE>;
+                       clock-names = "fuse";
+               };
+
+               hsp_top0: hsp@3c00000 {
+                       compatible = "nvidia,tegra234-hsp", "nvidia,tegra194-hsp";
+                       reg = <0x03c00000 0xa0000>;
+                       interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "doorbell", "shared0", "shared1", "shared2",
+                                         "shared3", "shared4", "shared5", "shared6",
+                                         "shared7";
+                       #mbox-cells = <2>;
+               };
+
+               hsp_aon: hsp@c150000 {
+                       compatible = "nvidia,tegra234-hsp", "nvidia,tegra194-hsp";
+                       reg = <0x0c150000 0x90000>;
+                       interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
+                       /*
+                        * Shared interrupt 0 is routed only to AON/SPE, so
+                        * we only have 4 shared interrupts for the CCPLEX.
+                        */
+                       interrupt-names = "shared1", "shared2", "shared3", "shared4";
+                       #mbox-cells = <2>;
+               };
+
+               rtc@c2a0000 {
+                       compatible = "nvidia,tegra234-rtc", "nvidia,tegra20-rtc";
+                       reg = <0x0c2a0000 0x10000>;
+                       interrupt-parent = <&pmc>;
+                       interrupts = <73 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
+               pmc: pmc@c360000 {
+                       compatible = "nvidia,tegra234-pmc";
+                       reg = <0x0c360000 0x10000>,
+                             <0x0c370000 0x10000>,
+                             <0x0c380000 0x10000>,
+                             <0x0c390000 0x10000>,
+                             <0x0c3a0000 0x10000>;
+                       reg-names = "pmc", "wake", "aotag", "scratch", "misc";
+
+                       #interrupt-cells = <2>;
+                       interrupt-controller;
+               };
+
+               gic: interrupt-controller@f400000 {
+                       compatible = "arm,gic-v3";
+                       reg = <0x0f400000 0x010000>, /* GICD */
+                             <0x0f440000 0x200000>; /* GICR */
+                       interrupt-parent = <&gic>;
+                       interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+
+                       #redistributor-regions = <1>;
+                       #interrupt-cells = <3>;
+                       interrupt-controller;
+               };
+       };
+
+       sysram@40000000 {
+               compatible = "nvidia,tegra234-sysram", "mmio-sram";
+               reg = <0x0 0x40000000 0x0 0x50000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0x0 0x0 0x40000000 0x50000>;
+
+               cpu_bpmp_tx: shmem@4e000 {
+                       reg = <0x4e000 0x1000>;
+                       label = "cpu-bpmp-tx";
+                       pool;
+               };
+
+               cpu_bpmp_rx: shmem@4f000 {
+                       reg = <0x4f000 0x1000>;
+                       label = "cpu-bpmp-rx";
+                       pool;
+               };
+       };
+
+       bpmp: bpmp {
+               compatible = "nvidia,tegra234-bpmp", "nvidia,tegra186-bpmp";
+               mboxes = <&hsp_top0 TEGRA_HSP_MBOX_TYPE_DB
+                                   TEGRA_HSP_DB_MASTER_BPMP>;
+               shmem = <&cpu_bpmp_tx &cpu_bpmp_rx>;
+               #clock-cells = <1>;
+               #reset-cells = <1>;
+               #power-domain-cells = <1>;
+
+               bpmp_i2c: i2c {
+                       compatible = "nvidia,tegra186-bpmp-i2c";
+                       nvidia,bpmp-bus-id = <5>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       device_type = "cpu";
+                       reg = <0x000>;
+
+                       enable-method = "psci";
+               };
+       };
+
+       psci {
+               compatible = "arm,psci-1.0";
+               status = "okay";
+               method = "smc";
+       };
+
+       timer {
+               compatible = "arm,armv8-timer";
+               interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+               interrupt-parent = <&gic>;
+               always-on;
+       };
+};
index d8f1466..fb4631f 100644 (file)
@@ -1,11 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_QCOM)        += apq8016-sbc.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += apq8096-db820c.dtb
-dtb-$(CONFIG_ARCH_QCOM) += apq8096-ifc6640.dtb
+dtb-$(CONFIG_ARCH_QCOM)        += apq8096-ifc6640.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += ipq6018-cp01-c1.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += ipq8074-hk01.dtb
-dtb-$(CONFIG_ARCH_QCOM)        += msm8916-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += msm8916-longcheer-l8150.dtb
+dtb-$(CONFIG_ARCH_QCOM)        += msm8916-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += msm8916-samsung-a3u-eur.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += msm8916-samsung-a5u-eur.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += msm8992-bullhead-rev-101.dtb
@@ -18,7 +18,16 @@ dtb-$(CONFIG_ARCH_QCOM)      += msm8998-asus-novago-tp370ql.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += msm8998-hp-envy-x2.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += msm8998-lenovo-miix-630.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += msm8998-mtp.dtb
+dtb-$(CONFIG_ARCH_QCOM)        += qcs404-evb-1000.dtb
+dtb-$(CONFIG_ARCH_QCOM)        += qcs404-evb-4000.dtb
+dtb-$(CONFIG_ARCH_QCOM)        += qrb5165-rb5.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += sc7180-idp.dtb
+dtb-$(CONFIG_ARCH_QCOM)        += sc7180-trogdor-lazor-r0.dtb
+dtb-$(CONFIG_ARCH_QCOM)        += sc7180-trogdor-lazor-r1.dtb
+dtb-$(CONFIG_ARCH_QCOM)        += sc7180-trogdor-lazor-r1-kb.dtb
+dtb-$(CONFIG_ARCH_QCOM)        += sc7180-trogdor-lazor-r1-lte.dtb
+dtb-$(CONFIG_ARCH_QCOM)        += sc7180-trogdor-r1.dtb
+dtb-$(CONFIG_ARCH_QCOM)        += sc7180-trogdor-r1-lte.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += sdm630-sony-xperia-ganges-kirin.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += sdm630-sony-xperia-nile-discovery.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += sdm630-sony-xperia-nile-pioneer.dtb
@@ -30,8 +39,7 @@ dtb-$(CONFIG_ARCH_QCOM)       += sdm845-cheza-r2.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += sdm845-cheza-r3.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += sdm845-db845c.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += sdm845-mtp.dtb
+dtb-$(CONFIG_ARCH_QCOM)        += sdm845-xiaomi-beryllium.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += sdm850-lenovo-yoga-c630.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += sm8150-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)        += sm8250-mtp.dtb
-dtb-$(CONFIG_ARCH_QCOM)        += qcs404-evb-1000.dtb
-dtb-$(CONFIG_ARCH_QCOM)        += qcs404-evb-4000.dtb
index 1943435..3c7f975 100644 (file)
@@ -3,38 +3,13 @@
  * Copyright (c) 2015, The Linux Foundation. All rights reserved.
  */
 
-#include "msm8916.dtsi"
-#include "pm8916.dtsi"
+#include "msm8916-pm8916.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 #include <dt-bindings/pinctrl/qcom,pmic-mpp.h>
 #include <dt-bindings/sound/apq8016-lpass.h>
 
-/*
- * GPIO name legend: proper name = the GPIO line is used as GPIO
- *         NC = not connected (pin out but not routed from the chip to
- *              anything the board)
- *         "[PER]" = pin is muxed for [peripheral] (not GPIO)
- *         LSEC = Low Speed External Connector
- *         HSEC = High Speed External Connector
- *
- * Line names are taken from the schematic "DragonBoard410c"
- * dated monday, august 31, 2015. Page 5 in particular.
- *
- * For the lines routed to the external connectors the
- * lines are named after the 96Boards CE Specification 1.0,
- * Appendix "Expansion Connector Signal Description".
- *
- * When the 96Board naming of a line and the schematic name of
- * the same line are in conflict, the 96Board specification
- * takes precedence, which means that the external UART on the
- * LSEC is named UART0 while the schematic and SoC names this
- * UART3. This is only for the informational lines i.e. "[FOO]",
- * the GPIO named lines "GPIO-A" thru "GPIO-L" are the only
- * ones actually used for GPIO.
- */
-
 / {
        aliases {
                serial0 = &blsp1_uart2;
@@ -76,7 +51,7 @@
        };
 
        reserved-memory {
-               ramoops@bff00000{
+               ramoops@bff00000 {
                        compatible = "ramoops";
                        reg = <0x0 0xbff00000 0x0 0x100000>;
 
                };
        };
 
-       soc {
-               pinctrl@1000000 {
-                       gpio-line-names =
-                               "[UART0_TX]", /* GPIO_0, LSEC pin 5 */
-                               "[UART0_RX]", /* GPIO_1, LSEC pin 7 */
-                               "[UART0_CTS_N]", /* GPIO_2, LSEC pin 3 */
-                               "[UART0_RTS_N]", /* GPIO_3, LSEC pin 9 */
-                               "[UART1_TX]", /* GPIO_4, LSEC pin 11 */
-                               "[UART1_RX]", /* GPIO_5, LSEC pin 13 */
-                               "[I2C0_SDA]", /* GPIO_8, LSEC pin 17 */
-                               "[I2C0_SCL]", /* GPIO_7, LSEC pin 15 */
-                               "[SPI1_DOUT]", /* SPI1_MOSI, HSEC pin 1 */
-                               "[SPI1_DIN]", /* SPI1_MISO, HSEC pin 11 */
-                               "[SPI1_CS]", /* SPI1_CS_N, HSEC pin 7 */
-                               "[SPI1_SCLK]", /* SPI1_CLK, HSEC pin 9 */
-                               "GPIO-B", /* LS_EXP_GPIO_B, LSEC pin 24 */
-                               "GPIO-C", /* LS_EXP_GPIO_C, LSEC pin 25 */
-                               "[I2C3_SDA]", /* HSEC pin 38 */
-                               "[I2C3_SCL]", /* HSEC pin 36 */
-                               "[SPI0_MOSI]", /* LSEC pin 14 */
-                               "[SPI0_MISO]", /* LSEC pin 10 */
-                               "[SPI0_CS_N]", /* LSEC pin 12 */
-                               "[SPI0_CLK]", /* LSEC pin 8 */
-                               "HDMI_HPD_N", /* GPIO 20 */
-                               "USR_LED_1_CTRL",
-                               "[I2C1_SDA]", /* GPIO_22, LSEC pin 21 */
-                               "[I2C1_SCL]", /* GPIO_23, LSEC pin 19 */
-                               "GPIO-G", /* LS_EXP_GPIO_G, LSEC pin 29 */
-                               "GPIO-H", /* LS_EXP_GPIO_H, LSEC pin 30 */
-                               "[CSI0_MCLK]", /* HSEC pin 15 */
-                               "[CSI1_MCLK]", /* HSEC pin 17 */
-                               "GPIO-K", /* LS_EXP_GPIO_K, LSEC pin 33 */
-                               "[I2C2_SDA]", /* HSEC pin 34 */
-                               "[I2C2_SCL]", /* HSEC pin 32 */
-                               "DSI2HDMI_INT_N",
-                               "DSI_SW_SEL_APQ",
-                               "GPIO-L", /* LS_EXP_GPIO_L, LSEC pin 34 */
-                               "GPIO-J", /* LS_EXP_GPIO_J, LSEC pin 32 */
-                               "GPIO-I", /* LS_EXP_GPIO_I, LSEC pin 31 */
-                               "GPIO-A", /* LS_EXP_GPIO_A, LSEC pin 23 */
-                               "FORCED_USB_BOOT",
-                               "SD_CARD_DET_N",
-                               "[WCSS_BT_SSBI]",
-                               "[WCSS_WLAN_DATA_2]", /* GPIO 40 */
-                               "[WCSS_WLAN_DATA_1]",
-                               "[WCSS_WLAN_DATA_0]",
-                               "[WCSS_WLAN_SET]",
-                               "[WCSS_WLAN_CLK]",
-                               "[WCSS_FM_SSBI]",
-                               "[WCSS_FM_SDI]",
-                               "[WCSS_BT_DAT_CTL]",
-                               "[WCSS_BT_DAT_STB]",
-                               "NC",
-                               "NC", /* GPIO 50 */
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC", /* GPIO 60 */
-                               "NC",
-                               "NC",
-                               "[CDC_PDM0_CLK]",
-                               "[CDC_PDM0_SYNC]",
-                               "[CDC_PDM0_TX0]",
-                               "[CDC_PDM0_RX0]",
-                               "[CDC_PDM0_RX1]",
-                               "[CDC_PDM0_RX2]",
-                               "GPIO-D", /* LS_EXP_GPIO_D, LSEC pin 26 */
-                               "NC", /* GPIO 70 */
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC", /* GPIO 74 */
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "BOOT_CONFIG_0", /* GPIO 80 */
-                               "BOOT_CONFIG_1",
-                               "BOOT_CONFIG_2",
-                               "BOOT_CONFIG_3",
-                               "NC",
-                               "NC",
-                               "BOOT_CONFIG_5",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC", /* GPIO 90 */
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC",
-                               "NC", /* GPIO 100 */
-                               "NC",
-                               "NC",
-                               "NC",
-                               "SSBI_GPS",
-                               "NC",
-                               "NC",
-                               "KEY_VOLP_N",
-                               "NC",
-                               "NC",
-                               "[LS_EXP_MI2S_WS]", /* GPIO 110 */
-                               "NC",
-                               "NC",
-                               "[LS_EXP_MI2S_SCK]",
-                               "[LS_EXP_MI2S_DATA0]",
-                               "GPIO-E", /* LS_EXP_GPIO_E, LSEC pin 27 */
-                               "NC",
-                               "[DSI2HDMI_MI2S_WS]",
-                               "[DSI2HDMI_MI2S_SCK]",
-                               "[DSI2HDMI_MI2S_DATA0]",
-                               "USR_LED_2_CTRL", /* GPIO 120 */
-                               "SB_HS_ID";
-               };
-
-               dma@7884000 {
-                       status = "okay";
-               };
-
-               serial@78af000 {
-                       label = "LS-UART0";
-                       status = "okay";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&blsp1_uart1_default>;
-                       pinctrl-1 = <&blsp1_uart1_sleep>;
-               };
-
-               serial@78b0000 {
-                       label = "LS-UART1";
-                       status = "okay";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&blsp1_uart2_default>;
-                       pinctrl-1 = <&blsp1_uart2_sleep>;
-               };
-
-               i2c@78b6000 {
-               /* On Low speed expansion */
-                       label = "LS-I2C0";
-                       status = "okay";
-               };
-
-               i2c@78b8000 {
-               /* On High speed expansion */
-                       label = "HS-I2C2";
-                       status = "okay";
-
-                       adv_bridge: bridge@39 {
-                               status = "okay";
-
-                               compatible = "adi,adv7533";
-                               reg = <0x39>;
-
-                               interrupt-parent = <&msmgpio>;
-                               interrupts = <31 2>;
-
-                               adi,dsi-lanes = <4>;
-                               clocks = <&rpmcc RPM_SMD_BB_CLK2>;
-                               clock-names = "cec";
-
-                               pd-gpios = <&msmgpio 32 0>;
-
-                               avdd-supply = <&pm8916_l6>;
-                               v1p2-supply = <&pm8916_l6>;
-                               v3p3-supply = <&pm8916_l17>;
-
-                               pinctrl-names = "default","sleep";
-                               pinctrl-0 = <&adv7533_int_active &adv7533_switch_active>;
-                               pinctrl-1 = <&adv7533_int_suspend &adv7533_switch_suspend>;
-                               #sound-dai-cells = <1>;
+       usb2513 {
+               compatible = "smsc,usb3503";
+               reset-gpios = <&pm8916_gpios 3 GPIO_ACTIVE_LOW>;
+               initial-mode = <1>;
+       };
 
-                               ports {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
+       usb_id: usb-id {
+               compatible = "linux,extcon-usb-gpio";
+               id-gpio = <&msmgpio 121 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&usb_id_default>;
+       };
 
-                                       port@0 {
-                                               reg = <0>;
-                                               adv7533_in: endpoint {
-                                                       remote-endpoint = <&dsi0_out>;
-                                               };
-                                       };
+       hdmi-out {
+               compatible = "hdmi-connector";
+               type = "a";
 
-                                       port@1 {
-                                               reg = <1>;
-                                               adv7533_out: endpoint {
-                                                       remote-endpoint = <&hdmi_con>;
-                                               };
-                                       };
-                               };
+               port {
+                       hdmi_con: endpoint {
+                               remote-endpoint = <&adv7533_out>;
                        };
                };
+       };
 
-               i2c@78ba000 {
-               /* On Low speed expansion */
-                       label = "LS-I2C1";
-                       status = "okay";
-               };
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               autorepeat;
 
-               spi@78b7000 {
-               /* On High speed expansion */
-                       label = "HS-SPI1";
-                       status = "okay";
-               };
+               pinctrl-names = "default";
+               pinctrl-0 = <&msm_key_volp_n_default>;
 
-               spi@78b9000 {
-               /* On Low speed expansion */
-                       label = "LS-SPI0";
-                       status = "okay";
+               button@0 {
+                       label = "Volume Up";
+                       linux,code = <KEY_VOLUMEUP>;
+                       gpios = <&msmgpio 107 GPIO_ACTIVE_LOW>;
                };
+       };
 
-               leds {
-                       pinctrl-names = "default";
-                       pinctrl-0 = <&msmgpio_leds>,
-                                   <&pm8916_gpios_leds>,
-                                   <&pm8916_mpps_leds>;
-
-                       compatible = "gpio-leds";
-
-                       led@1 {
-                               label = "apq8016-sbc:green:user1";
-                               gpios = <&msmgpio 21 GPIO_ACTIVE_HIGH>;
-                               linux,default-trigger = "heartbeat";
-                               default-state = "off";
-                       };
-
-                       led@2 {
-                               label = "apq8016-sbc:green:user2";
-                               gpios = <&msmgpio 120 GPIO_ACTIVE_HIGH>;
-                               linux,default-trigger = "mmc0";
-                               default-state = "off";
-                       };
-
-                       led@3 {
-                               label = "apq8016-sbc:green:user3";
-                               gpios = <&pm8916_gpios 1 GPIO_ACTIVE_HIGH>;
-                               linux,default-trigger = "mmc1";
-                               default-state = "off";
-                       };
-
-                       led@4 {
-                               label = "apq8016-sbc:green:user4";
-                               gpios = <&pm8916_gpios 2 GPIO_ACTIVE_HIGH>;
-                               linux,default-trigger = "none";
-                               panic-indicator;
-                               default-state = "off";
-                       };
+       leds {
+               pinctrl-names = "default";
+               pinctrl-0 = <&msmgpio_leds>,
+                           <&pm8916_gpios_leds>,
+                           <&pm8916_mpps_leds>;
 
-                       led@5 {
-                               label = "apq8016-sbc:yellow:wlan";
-                               gpios = <&pm8916_mpps 2 GPIO_ACTIVE_HIGH>;
-                               linux,default-trigger = "phy0tx";
-                               default-state = "off";
-                       };
+               compatible = "gpio-leds";
 
-                       led@6 {
-                               label = "apq8016-sbc:blue:bt";
-                               gpios = <&pm8916_mpps 3 GPIO_ACTIVE_HIGH>;
-                               linux,default-trigger = "bluetooth-power";
-                               default-state = "off";
-                       };
+               led@1 {
+                       label = "apq8016-sbc:green:user1";
+                       gpios = <&msmgpio 21 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+                       default-state = "off";
                };
 
-               sdhci@7824000 {
-                       vmmc-supply = <&pm8916_l8>;
-                       vqmmc-supply = <&pm8916_l5>;
-
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
-                       pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
-                       status = "okay";
+               led@2 {
+                       label = "apq8016-sbc:green:user2";
+                       gpios = <&msmgpio 120 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "mmc0";
+                       default-state = "off";
                };
 
-               sdhci@7864000 {
-                       vmmc-supply = <&pm8916_l11>;
-                       vqmmc-supply = <&pm8916_l12>;
-
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on &sdc2_cd_on>;
-                       pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;
+               led@3 {
+                       label = "apq8016-sbc:green:user3";
+                       gpios = <&pm8916_gpios 1 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "mmc1";
+                       default-state = "off";
+               };
 
-                       cd-gpios = <&msmgpio 38 0x1>;
-                       status = "okay";
+               led@4 {
+                       label = "apq8016-sbc:green:user4";
+                       gpios = <&pm8916_gpios 2 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "none";
+                       panic-indicator;
+                       default-state = "off";
                };
 
-               usb@78d9000 {
-                       extcon = <&usb_id>, <&usb_id>;
-                       status = "okay";
-                       adp-disable;
-                       hnp-disable;
-                       srp-disable;
-                       dr_mode = "otg";
-                       pinctrl-names = "default", "device";
-                       pinctrl-0 = <&usb_sw_sel_pm &usb_hub_reset_pm>;
-                       pinctrl-1 = <&usb_sw_sel_pm_device &usb_hub_reset_pm_device>;
-                       ulpi {
-                               phy {
-                                       v1p8-supply = <&pm8916_l7>;
-                                       v3p3-supply = <&pm8916_l13>;
-                                       extcon = <&usb_id>;
-                               };
-                       };
+               led@5 {
+                       label = "apq8016-sbc:yellow:wlan";
+                       gpios = <&pm8916_mpps 2 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "phy0tx";
+                       default-state = "off";
                };
 
-               lpass@7708000 {
-                       status = "okay";
+               led@6 {
+                       label = "apq8016-sbc:blue:bt";
+                       gpios = <&pm8916_mpps 3 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "bluetooth-power";
+                       default-state = "off";
                };
+       };
+};
 
-               mdss@1a00000 {
-                       status = "okay";
+&blsp_dma {
+       status = "okay";
+};
 
-                       mdp@1a01000 {
-                               status = "okay";
-                       };
+&blsp_i2c2 {
+       /* On Low speed expansion */
+       status = "okay";
+       label = "LS-I2C0";
+};
 
-                       dsi@1a98000 {
-                               status = "okay";
+&blsp_i2c4 {
+       /* On High speed expansion */
+       status = "okay";
+       label = "HS-I2C2";
 
-                               vdda-supply = <&pm8916_l2>;
-                               vddio-supply = <&pm8916_l6>;
+       adv_bridge: bridge@39 {
+               status = "okay";
 
-                               ports {
-                                       port@1 {
-                                               endpoint {
-                                                       remote-endpoint = <&adv7533_in>;
-                                                       data-lanes = <0 1 2 3>;
-                                               };
-                                       };
-                               };
-                       };
+               compatible = "adi,adv7533";
+               reg = <0x39>;
 
-                       dsi-phy@1a98300 {
-                               status = "okay";
+               interrupt-parent = <&msmgpio>;
+               interrupts = <31 IRQ_TYPE_EDGE_FALLING>;
 
-                               vddio-supply = <&pm8916_l6>;
-                       };
-               };
+               adi,dsi-lanes = <4>;
+               clocks = <&rpmcc RPM_SMD_BB_CLK2>;
+               clock-names = "cec";
 
-               lpass_codec: codec{
-                       status = "okay";
-               };
+               pd-gpios = <&msmgpio 32 GPIO_ACTIVE_HIGH>;
 
-               /*
-               Internal Codec
-                       playback - Primary MI2S
-                       capture - Ter MI2S
-
-               External Primary:
-                       playback - secondary MI2S
-                       capture - Quat MI2S
-
-               External Secondary:
-                       playback - Quat MI2S
-                       capture - Quat MI2S
-
-               */
-
-               sound: sound {
-                       compatible = "qcom,apq8016-sbc-sndcard";
-                       reg = <0x07702000 0x4>, <0x07702004 0x4>;
-                       reg-names = "mic-iomux", "spkr-iomux";
-
-                       status = "okay";
-                       pinctrl-0 = <&cdc_pdm_lines_act &ext_sec_tlmm_lines_act &ext_mclk_tlmm_lines_act>;
-                       pinctrl-1 = <&cdc_pdm_lines_sus &ext_sec_tlmm_lines_sus &ext_mclk_tlmm_lines_sus>;
-                       pinctrl-names = "default", "sleep";
-                       qcom,model = "DB410c";
-                       qcom,audio-routing =
-                               "AMIC2", "MIC BIAS Internal2",
-                               "AMIC3", "MIC BIAS External1";
-
-                       external-dai-link@0 {
-                               link-name = "ADV7533";
-                               cpu {
-                                       sound-dai = <&lpass MI2S_QUATERNARY>;
-                               };
-                               codec {
-                                       sound-dai = <&adv_bridge 0>;
-                               };
-                       };
+               avdd-supply = <&pm8916_l6>;
+               v1p2-supply = <&pm8916_l6>;
+               v3p3-supply = <&pm8916_l17>;
 
-                       internal-codec-playback-dai-link@0 {
-                               link-name = "WCD";
-                               cpu {
-                                       sound-dai = <&lpass MI2S_PRIMARY>;
-                               };
-                               codec {
-                                       sound-dai = <&lpass_codec 0>, <&wcd_codec 0>;
-                               };
-                       };
+               pinctrl-names = "default","sleep";
+               pinctrl-0 = <&adv7533_int_active &adv7533_switch_active>;
+               pinctrl-1 = <&adv7533_int_suspend &adv7533_switch_suspend>;
+               #sound-dai-cells = <1>;
 
-                       internal-codec-capture-dai-link@0 {
-                               link-name = "WCD-Capture";
-                               cpu {
-                                       sound-dai = <&lpass MI2S_TERTIARY>;
-                               };
-                               codec {
-                                       sound-dai = <&lpass_codec 1>, <&wcd_codec 1>;
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       port@0 {
+                               reg = <0>;
+                               adv7533_in: endpoint {
+                                       remote-endpoint = <&dsi0_out>;
                                };
                        };
-               };
 
-               spmi@200f000 {
-                       pm8916@0 {
-                               gpios@c000 {
-                                       gpio-line-names =
-                                               "USR_LED_3_CTRL",
-                                               "USR_LED_4_CTRL",
-                                               "USB_HUB_RESET_N_PM",
-                                               "USB_SW_SEL_PM";
-                               };
-                               mpps@a000 {
-                                       gpio-line-names =
-                                               "VDD_PX_BIAS",
-                                               "WLAN_LED_CTRL",
-                                               "BT_LED_CTRL",
-                                               "GPIO-F"; /* LS_EXP_GPIO_F, LSEC pin 28 */
+                       port@1 {
+                               reg = <1>;
+                               adv7533_out: endpoint {
+                                       remote-endpoint = <&hdmi_con>;
                                };
                        };
                };
-
-               wcnss@a21b000 {
-                       status = "okay";
-               };
-
-               tpiu@820000 { status = "okay"; };
-               funnel@821000 { status = "okay"; };
-               replicator@824000 { status = "okay"; };
-               etf@825000 { status = "okay"; };
-               etr@826000 { status = "okay"; };
-               funnel@841000 { status = "okay"; };
-               debug@850000 { status = "okay"; };
-               debug@852000 { status = "okay"; };
-               debug@854000 { status = "okay"; };
-               debug@856000 { status = "okay"; };
-               etm@85c000 { status = "okay"; };
-               etm@85d000 { status = "okay"; };
-               etm@85e000 { status = "okay"; };
-               etm@85f000 { status = "okay"; };
-               cti@810000 { status = "okay"; };
-               cti@811000 { status = "okay"; };
-               cti@858000 { status = "okay"; };
-               cti@859000 { status = "okay"; };
-               cti@85a000 { status = "okay"; };
-               cti@85b000 { status = "okay"; };
-       };
-
-       usb2513 {
-               compatible = "smsc,usb3503";
-               reset-gpios = <&pm8916_gpios 3 GPIO_ACTIVE_LOW>;
-               initial-mode = <1>;
-       };
-
-       usb_id: usb-id {
-               compatible = "linux,extcon-usb-gpio";
-               id-gpio = <&msmgpio 121 GPIO_ACTIVE_HIGH>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&usb_id_default>;
        };
+};
 
-       hdmi-out {
-               compatible = "hdmi-connector";
-               type = "a";
+&blsp_i2c6 {
+       /* On Low speed expansion */
+       status = "okay";
+       label = "LS-I2C1";
+};
 
-               port {
-                       hdmi_con: endpoint {
-                               remote-endpoint = <&adv7533_out>;
-                       };
-               };
-       };
+&blsp_spi3 {
+       /* On High speed expansion */
+       status = "okay";
+       label = "HS-SPI1";
+};
 
-       gpio-keys {
-               compatible = "gpio-keys";
-               #address-cells = <1>;
-               #size-cells = <0>;
-               autorepeat;
+&blsp_spi5 {
+       /* On Low speed expansion */
+       status = "okay";
+       label = "LS-SPI0";
+};
 
-               pinctrl-names = "default";
-               pinctrl-0 = <&msm_key_volp_n_default>;
+&blsp1_uart1 {
+       status = "okay";
+       label = "LS-UART0";
+};
 
-               button@0 {
-                       label = "Volume Up";
-                       linux,code = <KEY_VOLUMEUP>;
-                       gpios = <&msmgpio 107 GPIO_ACTIVE_LOW>;
-               };
-       };
+&blsp1_uart2 {
+       status = "okay";
+       label = "LS-UART1";
 };
 
 &camss {
-       status = "ok";
+       status = "okay";
        ports {
-               #address-cells = <1>;
-               #size-cells = <0>;
                port@0 {
                        reg = <0>;
                        csiphy0_ep: endpoint {
 };
 
 &cci {
-       status = "ok";
+       status = "okay";
 };
 
 &cci_i2c0 {
        };
 };
 
-&spmi_bus {
-       pm8916_0: pm8916@0 {
-               pon@800 {
-                       resin {
-                               compatible = "qcom,pm8941-resin";
-                               interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
-                               debounce = <15625>;
-                               bias-pull-up;
-                               linux,code = <KEY_VOLUMEDOWN>;
-                       };
+&dsi0_out {
+       data-lanes = <0 1 2 3>;
+       remote-endpoint = <&adv7533_in>;
+};
+
+&lpass {
+       status = "okay";
+};
+
+&pm8916_resin {
+       status = "okay";
+       linux,code = <KEY_VOLUMEDOWN>;
+};
+
+&pronto {
+       status = "okay";
+};
+
+&sdhc_1 {
+       status = "okay";
+
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
+       pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
+};
+
+&sdhc_2 {
+       status = "okay";
+
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on &sdc2_cd_on>;
+       pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;
+
+       cd-gpios = <&msmgpio 38 GPIO_ACTIVE_LOW>;
+};
+
+&sound {
+       status = "okay";
+
+       pinctrl-0 = <&cdc_pdm_lines_act &ext_sec_tlmm_lines_act &ext_mclk_tlmm_lines_act>;
+       pinctrl-1 = <&cdc_pdm_lines_sus &ext_sec_tlmm_lines_sus &ext_mclk_tlmm_lines_sus>;
+       pinctrl-names = "default", "sleep";
+       qcom,model = "DB410c";
+       qcom,audio-routing =
+               "AMIC2", "MIC BIAS Internal2",
+               "AMIC3", "MIC BIAS External1";
+
+       external-dai-link@0 {
+               link-name = "ADV7533";
+               cpu {
+                       sound-dai = <&lpass MI2S_QUATERNARY>;
+               };
+               codec {
+                       sound-dai = <&adv_bridge 0>;
+               };
+       };
+
+       internal-codec-playback-dai-link@0 {
+               link-name = "WCD";
+               cpu {
+                       sound-dai = <&lpass MI2S_PRIMARY>;
+               };
+               codec {
+                       sound-dai = <&lpass_codec 0>, <&wcd_codec 0>;
+               };
+       };
+
+       internal-codec-capture-dai-link@0 {
+               link-name = "WCD-Capture";
+               cpu {
+                       sound-dai = <&lpass MI2S_TERTIARY>;
+               };
+               codec {
+                       sound-dai = <&lpass_codec 1>, <&wcd_codec 1>;
                };
        };
 };
 
-&wcd_codec {
+&usb {
        status = "okay";
+       extcon = <&usb_id>, <&usb_id>;
+
+       pinctrl-names = "default", "device";
+       pinctrl-0 = <&usb_sw_sel_pm &usb_hub_reset_pm>;
+       pinctrl-1 = <&usb_sw_sel_pm_device &usb_hub_reset_pm_device>;
+};
+
+&usb_hs_phy {
+       extcon = <&usb_id>;
+};
+
+&wcd_codec {
        clocks = <&gcc GCC_CODEC_DIGCODEC_CLK>;
        clock-names = "mclk";
        qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
        qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
 };
 
+/* Enable CoreSight */
+&cti0 { status = "okay"; };
+&cti1 { status = "okay"; };
+&cti12 { status = "okay"; };
+&cti13 { status = "okay"; };
+&cti14 { status = "okay"; };
+&cti15 { status = "okay"; };
+&debug0 { status = "okay"; };
+&debug1 { status = "okay"; };
+&debug2 { status = "okay"; };
+&debug3 { status = "okay"; };
+&etf { status = "okay"; };
+&etm0 { status = "okay"; };
+&etm1 { status = "okay"; };
+&etm2 { status = "okay"; };
+&etm3 { status = "okay"; };
+&etr { status = "okay"; };
+&funnel0 { status = "okay"; };
+&funnel1 { status = "okay"; };
+&replicator { status = "okay"; };
+&tpiu { status = "okay"; };
+
 &smd_rpm_regulators {
        vdd_l1_l2_l3-supply = <&pm8916_s3>;
        vdd_l4_l5_l6-supply = <&pm8916_s4>;
        drive-strength = <16>;
 };
 
+/*
+ * GPIO name legend: proper name = the GPIO line is used as GPIO
+ *         NC = not connected (pin out but not routed from the chip to
+ *              anything the board)
+ *         "[PER]" = pin is muxed for [peripheral] (not GPIO)
+ *         LSEC = Low Speed External Connector
+ *         HSEC = High Speed External Connector
+ *
+ * Line names are taken from the schematic "DragonBoard410c"
+ * dated monday, august 31, 2015. Page 5 in particular.
+ *
+ * For the lines routed to the external connectors the
+ * lines are named after the 96Boards CE Specification 1.0,
+ * Appendix "Expansion Connector Signal Description".
+ *
+ * When the 96Board naming of a line and the schematic name of
+ * the same line are in conflict, the 96Board specification
+ * takes precedence, which means that the external UART on the
+ * LSEC is named UART0 while the schematic and SoC names this
+ * UART3. This is only for the informational lines i.e. "[FOO]",
+ * the GPIO named lines "GPIO-A" thru "GPIO-L" are the only
+ * ones actually used for GPIO.
+ */
+
 &msmgpio {
+       gpio-line-names =
+               "[UART0_TX]", /* GPIO_0, LSEC pin 5 */
+               "[UART0_RX]", /* GPIO_1, LSEC pin 7 */
+               "[UART0_CTS_N]", /* GPIO_2, LSEC pin 3 */
+               "[UART0_RTS_N]", /* GPIO_3, LSEC pin 9 */
+               "[UART1_TX]", /* GPIO_4, LSEC pin 11 */
+               "[UART1_RX]", /* GPIO_5, LSEC pin 13 */
+               "[I2C0_SDA]", /* GPIO_8, LSEC pin 17 */
+               "[I2C0_SCL]", /* GPIO_7, LSEC pin 15 */
+               "[SPI1_DOUT]", /* SPI1_MOSI, HSEC pin 1 */
+               "[SPI1_DIN]", /* SPI1_MISO, HSEC pin 11 */
+               "[SPI1_CS]", /* SPI1_CS_N, HSEC pin 7 */
+               "[SPI1_SCLK]", /* SPI1_CLK, HSEC pin 9 */
+               "GPIO-B", /* LS_EXP_GPIO_B, LSEC pin 24 */
+               "GPIO-C", /* LS_EXP_GPIO_C, LSEC pin 25 */
+               "[I2C3_SDA]", /* HSEC pin 38 */
+               "[I2C3_SCL]", /* HSEC pin 36 */
+               "[SPI0_MOSI]", /* LSEC pin 14 */
+               "[SPI0_MISO]", /* LSEC pin 10 */
+               "[SPI0_CS_N]", /* LSEC pin 12 */
+               "[SPI0_CLK]", /* LSEC pin 8 */
+               "HDMI_HPD_N", /* GPIO 20 */
+               "USR_LED_1_CTRL",
+               "[I2C1_SDA]", /* GPIO_22, LSEC pin 21 */
+               "[I2C1_SCL]", /* GPIO_23, LSEC pin 19 */
+               "GPIO-G", /* LS_EXP_GPIO_G, LSEC pin 29 */
+               "GPIO-H", /* LS_EXP_GPIO_H, LSEC pin 30 */
+               "[CSI0_MCLK]", /* HSEC pin 15 */
+               "[CSI1_MCLK]", /* HSEC pin 17 */
+               "GPIO-K", /* LS_EXP_GPIO_K, LSEC pin 33 */
+               "[I2C2_SDA]", /* HSEC pin 34 */
+               "[I2C2_SCL]", /* HSEC pin 32 */
+               "DSI2HDMI_INT_N",
+               "DSI_SW_SEL_APQ",
+               "GPIO-L", /* LS_EXP_GPIO_L, LSEC pin 34 */
+               "GPIO-J", /* LS_EXP_GPIO_J, LSEC pin 32 */
+               "GPIO-I", /* LS_EXP_GPIO_I, LSEC pin 31 */
+               "GPIO-A", /* LS_EXP_GPIO_A, LSEC pin 23 */
+               "FORCED_USB_BOOT",
+               "SD_CARD_DET_N",
+               "[WCSS_BT_SSBI]",
+               "[WCSS_WLAN_DATA_2]", /* GPIO 40 */
+               "[WCSS_WLAN_DATA_1]",
+               "[WCSS_WLAN_DATA_0]",
+               "[WCSS_WLAN_SET]",
+               "[WCSS_WLAN_CLK]",
+               "[WCSS_FM_SSBI]",
+               "[WCSS_FM_SDI]",
+               "[WCSS_BT_DAT_CTL]",
+               "[WCSS_BT_DAT_STB]",
+               "NC",
+               "NC", /* GPIO 50 */
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC", /* GPIO 60 */
+               "NC",
+               "NC",
+               "[CDC_PDM0_CLK]",
+               "[CDC_PDM0_SYNC]",
+               "[CDC_PDM0_TX0]",
+               "[CDC_PDM0_RX0]",
+               "[CDC_PDM0_RX1]",
+               "[CDC_PDM0_RX2]",
+               "GPIO-D", /* LS_EXP_GPIO_D, LSEC pin 26 */
+               "NC", /* GPIO 70 */
+               "NC",
+               "NC",
+               "NC",
+               "NC", /* GPIO 74 */
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "BOOT_CONFIG_0", /* GPIO 80 */
+               "BOOT_CONFIG_1",
+               "BOOT_CONFIG_2",
+               "BOOT_CONFIG_3",
+               "NC",
+               "NC",
+               "BOOT_CONFIG_5",
+               "NC",
+               "NC",
+               "NC",
+               "NC", /* GPIO 90 */
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "NC", /* GPIO 100 */
+               "NC",
+               "NC",
+               "NC",
+               "SSBI_GPS",
+               "NC",
+               "NC",
+               "KEY_VOLP_N",
+               "NC",
+               "NC",
+               "[LS_EXP_MI2S_WS]", /* GPIO 110 */
+               "NC",
+               "NC",
+               "[LS_EXP_MI2S_SCK]",
+               "[LS_EXP_MI2S_DATA0]",
+               "GPIO-E", /* LS_EXP_GPIO_E, LSEC pin 27 */
+               "NC",
+               "[DSI2HDMI_MI2S_WS]",
+               "[DSI2HDMI_MI2S_SCK]",
+               "[DSI2HDMI_MI2S_DATA0]",
+               "USR_LED_2_CTRL", /* GPIO 120 */
+               "SB_HS_ID";
+
        msmgpio_leds: msmgpio-leds {
                pins = "gpio21", "gpio120";
                function = "gpio";
 };
 
 &pm8916_gpios {
+       gpio-line-names =
+               "USR_LED_3_CTRL",
+               "USR_LED_4_CTRL",
+               "USB_HUB_RESET_N_PM",
+               "USB_SW_SEL_PM";
+
        usb_hub_reset_pm: usb-hub-reset-pm {
                pins = "gpio3";
                function = PMIC_GPIO_FUNC_NORMAL;
 };
 
 &pm8916_mpps {
+       gpio-line-names =
+               "VDD_PX_BIAS",
+               "WLAN_LED_CTRL",
+               "BT_LED_CTRL",
+               "GPIO-F"; /* LS_EXP_GPIO_F, LSEC pin 28 */
+
        pinctrl-names = "default";
        pinctrl-0 = <&ls_exp_gpio_f>;
 
index b31117a..e8eaa95 100644 (file)
 &blsp1_uart3 {
        pinctrl-0 = <&serial_3_pins>;
        pinctrl-names = "default";
-       status = "ok";
+       status = "okay";
 };
 
 &i2c_1 {
        pinctrl-0 = <&i2c_1_pins>;
        pinctrl-names = "default";
-       status = "ok";
+       status = "okay";
 };
 
 &spi_0 {
        cs-select = <0>;
-       status = "ok";
+       status = "okay";
 
        m25p80@0 {
                #address-cells = <1>;
index 1aa8d85..a94dac7 100644 (file)
@@ -8,6 +8,7 @@
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/clock/qcom,gcc-ipq6018.h>
 #include <dt-bindings/reset/qcom,gcc-ipq6018.h>
+#include <dt-bindings/clock/qcom,apss-ipq.h>
 
 / {
        #address-cells = <2>;
                        reg = <0x0>;
                        enable-method = "psci";
                        next-level-cache = <&L2_0>;
+                       clocks = <&apcs_glb APCS_ALIAS0_CORE_CLK>;
+                       clock-names = "cpu";
+                       operating-points-v2 = <&cpu_opp_table>;
+                       cpu-supply = <&ipq6018_s2>;
                };
 
                CPU1: cpu@1 {
                        enable-method = "psci";
                        reg = <0x1>;
                        next-level-cache = <&L2_0>;
+                       clocks = <&apcs_glb APCS_ALIAS0_CORE_CLK>;
+                       clock-names = "cpu";
+                       operating-points-v2 = <&cpu_opp_table>;
+                       cpu-supply = <&ipq6018_s2>;
                };
 
                CPU2: cpu@2 {
                        enable-method = "psci";
                        reg = <0x2>;
                        next-level-cache = <&L2_0>;
+                       clocks = <&apcs_glb APCS_ALIAS0_CORE_CLK>;
+                       clock-names = "cpu";
+                       operating-points-v2 = <&cpu_opp_table>;
+                       cpu-supply = <&ipq6018_s2>;
                };
 
                CPU3: cpu@3 {
                        enable-method = "psci";
                        reg = <0x3>;
                        next-level-cache = <&L2_0>;
+                       clocks = <&apcs_glb APCS_ALIAS0_CORE_CLK>;
+                       clock-names = "cpu";
+                       operating-points-v2 = <&cpu_opp_table>;
+                       cpu-supply = <&ipq6018_s2>;
                };
 
                L2_0: l2-cache {
                };
        };
 
+       cpu_opp_table: cpu_opp_table {
+               compatible = "operating-points-v2";
+               opp-shared;
+
+               opp-864000000 {
+                       opp-hz = /bits/ 64 <864000000>;
+                       opp-microvolt = <725000>;
+                       clock-latency-ns = <200000>;
+               };
+               opp-1056000000 {
+                       opp-hz = /bits/ 64 <1056000000>;
+                       opp-microvolt = <787500>;
+                       clock-latency-ns = <200000>;
+               };
+               opp-1320000000 {
+                       opp-hz = /bits/ 64 <1320000000>;
+                       opp-microvolt = <862500>;
+                       clock-latency-ns = <200000>;
+               };
+               opp-1440000000 {
+                       opp-hz = /bits/ 64 <1440000000>;
+                       opp-microvolt = <925000>;
+                       clock-latency-ns = <200000>;
+               };
+               opp-1608000000 {
+                       opp-hz = /bits/ 64 <1608000000>;
+                       opp-microvolt = <987500>;
+                       clock-latency-ns = <200000>;
+               };
+               opp-1800000000 {
+                       opp-hz = /bits/ 64 <1800000000>;
+                       opp-microvolt = <1062500>;
+                       clock-latency-ns = <200000>;
+               };
+       };
+
        firmware {
                scm {
                        compatible = "qcom,scm";
                #size-cells = <2>;
                ranges;
 
+               rpm_msg_ram: memory@0x60000 {
+                       reg = <0x0 0x60000 0x0 0x6000>;
+                       no-map;
+               };
+
                tz: tz@48500000 {
                        reg = <0x0 0x48500000 0x0 0x00200000>;
                        no-map;
                };
 
                apcs_glb: mailbox@b111000 {
-                       compatible = "qcom,ipq8074-apcs-apps-global";
-                       reg = <0x0b111000 0xc>;
-
+                       compatible = "qcom,ipq6018-apcs-apps-global";
+                       reg = <0x0b111000 0x1000>;
+                       #clock-cells = <1>;
+                       clocks = <&a53pll>, <&xo>;
+                       clock-names = "pll", "xo";
                        #mbox-cells = <1>;
                };
 
+               a53pll: clock@b116000 {
+                       compatible = "qcom,ipq6018-a53pll";
+                       reg = <0x0b116000 0x40>;
+                       #clock-cells = <0>;
+                       clocks = <&xo>;
+                       clock-names = "xo";
+               };
+
                timer {
                        compatible = "arm,armv8-timer";
                        interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
                        #interrupt-cells = <2>;
                };
        };
+
+       rpm-glink {
+               compatible = "qcom,glink-rpm";
+               interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+               qcom,rpm-msg-ram = <&rpm_msg_ram>;
+               mboxes = <&apcs_glb 0>;
+
+               rpm_requests: glink-channel {
+                       compatible = "qcom,rpm-ipq6018";
+                       qcom,glink-channels = "rpm_requests";
+
+                       regulators {
+                               compatible = "qcom,rpm-mp5496-regulators";
+
+                               ipq6018_s2: s2 {
+                                       regulator-min-microvolt = <725000>;
+                                       regulator-max-microvolt = <1062500>;
+                                       regulator-always-on;
+                               };
+                       };
+               };
+       };
 };
index f4a7616..e8c37a1 100644 (file)
 };
 
 &blsp1_i2c2 {
-       status = "ok";
+       status = "okay";
 };
 
 &blsp1_spi1 {
-       status = "ok";
+       status = "okay";
 
        m25p80@0 {
                #address-cells = <1>;
 };
 
 &blsp1_uart3 {
-       status = "ok";
+       status = "okay";
 };
 
 &blsp1_uart5 {
-       status = "ok";
+       status = "okay";
 };
 
 &pcie0 {
-       status = "ok";
+       status = "okay";
        perst-gpio = <&tlmm 61 0x1>;
 };
 
 &pcie1 {
-       status = "ok";
+       status = "okay";
        perst-gpio = <&tlmm 58 0x1>;
 };
 
 &pcie_phy0 {
-       status = "ok";
+       status = "okay";
 };
 
 &pcie_phy1 {
-       status = "ok";
+       status = "okay";
 };
 
 &qpic_bam {
-       status = "ok";
+       status = "okay";
 };
 
 &qpic_nand {
-       status = "ok";
+       status = "okay";
 
        nand@0 {
                reg = <0>;
 };
 
 &sdhc_1 {
-       status = "ok";
+       status = "okay";
 };
 
 &qusb_phy_0 {
-       status = "ok";
+       status = "okay";
 };
 
 &qusb_phy_1 {
-       status = "ok";
+       status = "okay";
 };
 
 &ssphy_0 {
-       status = "ok";
+       status = "okay";
 };
 
 &ssphy_1 {
-       status = "ok";
+       status = "okay";
 };
 
 &usb_0 {
-       status = "ok";
+       status = "okay";
 };
 
 &usb_1 {
-       status = "ok";
+       status = "okay";
 };
index 96a5ec8..829e37a 100644 (file)
@@ -67,7 +67,7 @@
        };
 
        pmu {
-               compatible = "arm,armv8-pmuv3";
+               compatible = "arm,cortex-a53-pmu";
                interrupts = <GIC_PPI 7 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
        };
 
                                     <GIC_PPI 1 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
                };
 
+               watchdog: watchdog@b017000 {
+                       compatible = "qcom,kpss-wdt";
+                       reg = <0xb017000 0x1000>;
+                       interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;
+                       clocks = <&sleep_clk>;
+                       timeout-sec = <30>;
+               };
+
                timer@b120000 {
                        #address-cells = <1>;
                        #size-cells = <1>;
index 9f2c8e9..b9d3c5d 100644 (file)
@@ -2,8 +2,7 @@
 
 /dts-v1/;
 
-#include "msm8916.dtsi"
-#include "pm8916.dtsi"
+#include "msm8916-pm8916.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 
                };
        };
 
-       soc {
-               sdhci@7824000 {
-                       status = "okay";
-
-                       vmmc-supply = <&pm8916_l8>;
-                       vqmmc-supply = <&pm8916_l5>;
-
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
-                       pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
-               };
-
-               sdhci@7864000 {
-                       status = "okay";
-
-                       vmmc-supply = <&pm8916_l11>;
-                       vqmmc-supply = <&pm8916_l12>;
-
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on>;
-                       pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off>;
-
-                       non-removable;
-               };
-
-               serial@78b0000 {
-                       status = "okay";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&blsp1_uart2_default>;
-                       pinctrl-1 = <&blsp1_uart2_sleep>;
-               };
-
-               usb@78d9000 {
-                       status = "okay";
-                       dr_mode = "peripheral";
-                       extcon = <&usb_vbus>;
-
-                       hnp-disable;
-                       srp-disable;
-                       adp-disable;
-
-                       ulpi {
-                               phy {
-                                       extcon = <&usb_vbus>;
-                                       v1p8-supply = <&pm8916_l7>;
-                                       v3p3-supply = <&pm8916_l13>;
-                               };
-                       };
-               };
-
-               wcnss@a21b000 {
-                       status = "okay";
-               };
-       };
-
        // FIXME: Use extcon device provided by charger driver when available
        usb_vbus: usb-vbus {
                compatible = "linux,extcon-usb-gpio";
        };
 };
 
-&spmi_bus {
-       pm8916@0 {
-               pon@800 {
-                       volume-down {
-                               compatible = "qcom,pm8941-resin";
-                               interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
-                               bias-pull-up;
-                               linux,code = <KEY_VOLUMEDOWN>;
-                       };
-               };
-       };
+&blsp1_uart2 {
+       status = "okay";
+};
+
+&pm8916_resin {
+       status = "okay";
+       linux,code = <KEY_VOLUMEDOWN>;
+};
+
+&pronto {
+       status = "okay";
+};
+
+&sdhc_1 {
+       status = "okay";
+
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
+       pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
+};
+
+&sdhc_2 {
+       status = "okay";
+
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on>;
+       pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off>;
+
+       non-removable;
+};
+
+&usb {
+       status = "okay";
+       dr_mode = "peripheral";
+       extcon = <&usb_vbus>;
+};
+
+&usb_hs_phy {
+       extcon = <&usb_vbus>;
 };
 
 &smd_rpm_regulators {
index 0c6e81f..1bd0504 100644 (file)
@@ -3,8 +3,7 @@
  * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
  */
 
-#include "msm8916.dtsi"
-#include "pm8916.dtsi"
+#include "msm8916-pm8916.dtsi"
 
 / {
        aliases {
        chosen {
                stdout-path = "serial0";
        };
+};
 
-       soc {
-               serial@78b0000 {
-                       status = "okay";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&blsp1_uart2_default>;
-                       pinctrl-1 = <&blsp1_uart2_sleep>;
-               };
-       };
+&blsp1_uart2 {
+       status = "okay";
 };
diff --git a/arch/arm64/boot/dts/qcom/msm8916-pm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916-pm8916.dtsi
new file mode 100644 (file)
index 0000000..cd626e7
--- /dev/null
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include "msm8916.dtsi"
+#include "pm8916.dtsi"
+
+&camss {
+       vdda-supply = <&pm8916_l2>;
+};
+
+&dsi0 {
+       vdda-supply = <&pm8916_l2>;
+       vddio-supply = <&pm8916_l6>;
+};
+
+&dsi_phy0 {
+       vddio-supply = <&pm8916_l6>;
+};
+
+&mpss {
+       cx-supply = <&pm8916_s1>;
+       mx-supply = <&pm8916_l3>;
+       pll-supply = <&pm8916_l7>;
+};
+
+&pronto {
+       vddmx-supply = <&pm8916_l3>;
+       vddpx-supply = <&pm8916_l7>;
+
+       iris {
+               vddxo-supply = <&pm8916_l7>;
+               vddrfa-supply = <&pm8916_s3>;
+               vddpa-supply = <&pm8916_l9>;
+               vdddig-supply = <&pm8916_l5>;
+       };
+};
+
+&sdhc_1 {
+       vmmc-supply = <&pm8916_l8>;
+       vqmmc-supply = <&pm8916_l5>;
+};
+
+&sdhc_2 {
+       vmmc-supply = <&pm8916_l11>;
+       vqmmc-supply = <&pm8916_l12>;
+};
+
+&usb_hs_phy {
+       v1p8-supply = <&pm8916_l7>;
+       v3p3-supply = <&pm8916_l13>;
+};
+
+&rpm_requests {
+       smd_rpm_regulators: pm8916-regulators {
+               compatible = "qcom,rpm-pm8916-regulators";
+
+               pm8916_s1: s1 {};
+               pm8916_s3: s3 {};
+               pm8916_s4: s4 {};
+
+               pm8916_l1: l1 {};
+               pm8916_l2: l2 {};
+               pm8916_l3: l3 {};
+               pm8916_l4: l4 {};
+               pm8916_l5: l5 {};
+               pm8916_l6: l6 {};
+               pm8916_l7: l7 {};
+               pm8916_l8: l8 {};
+               pm8916_l9: l9 {};
+               pm8916_l10: l10 {};
+               pm8916_l11: l11 {};
+               pm8916_l12: l12 {};
+               pm8916_l13: l13 {};
+               pm8916_l14: l14 {};
+               pm8916_l15: l15 {};
+               pm8916_l16: l16 {};
+               pm8916_l17: l17 {};
+               pm8916_l18: l18 {};
+       };
+};
index a0c00d9..b18d21e 100644 (file)
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
-#include "msm8916.dtsi"
-#include "pm8916.dtsi"
+#include "msm8916-pm8916.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/irq.h>
                };
        };
 
-       soc {
-               sdhci@7824000 {
-                       status = "okay";
-
-                       vmmc-supply = <&pm8916_l8>;
-                       vqmmc-supply = <&pm8916_l5>;
-
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
-                       pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
-               };
-
-               sdhci@7864000 {
-                       status = "okay";
-
-                       vmmc-supply = <&pm8916_l11>;
-                       vqmmc-supply = <&pm8916_l12>;
-
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on &sdc2_cd_on>;
-                       pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;
-
-                       cd-gpios = <&msmgpio 38 GPIO_ACTIVE_LOW>;
-               };
-
-               serial@78b0000 {
-                       status = "okay";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&blsp1_uart2_default>;
-                       pinctrl-1 = <&blsp1_uart2_sleep>;
-               };
-
-               usb@78d9000 {
-                       status = "okay";
-                       extcon = <&muic>, <&muic>;
-
-                       hnp-disable;
-                       srp-disable;
-                       adp-disable;
-
-                       ulpi {
-                               phy {
-                                       extcon = <&muic>;
-                                       v1p8-supply = <&pm8916_l7>;
-                                       v3p3-supply = <&pm8916_l13>;
-                               };
-                       };
-               };
-
-               mdss@1a00000 {
-                       dsi@1a98000 {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-
-                               vdda-supply = <&pm8916_l2>;
-                               vddio-supply = <&pm8916_l6>;
-
-                               pinctrl-names = "default", "sleep";
-                               pinctrl-0 = <&mdss_default>;
-                               pinctrl-1 = <&mdss_sleep>;
-                       };
-
-                       dsi-phy@1a98300 {
-                               vddio-supply = <&pm8916_l6>;
-                       };
-               };
-
-               wcnss@a21b000 {
-                       status = "okay";
-               };
-       };
-
        gpio-keys {
                compatible = "gpio-keys";
 
                #address-cells = <1>;
                #size-cells = <0>;
 
-               muic: sm5502@25 {
+               muic: extcon@25 {
                        compatible = "siliconmitus,sm5502-muic";
 
                        reg = <0x25>;
        };
 };
 
-&spmi_bus {
-       pm8916@0 {
-               pon@800 {
-                       volume-down {
-                               compatible = "qcom,pm8941-resin";
-                               interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
-                               bias-pull-up;
-                               linux,code = <KEY_VOLUMEDOWN>;
-                       };
-               };
-       };
+&blsp1_uart2 {
+       status = "okay";
+};
+
+&dsi0 {
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&mdss_default>;
+       pinctrl-1 = <&mdss_sleep>;
+};
+
+&pm8916_resin {
+       status = "okay";
+       linux,code = <KEY_VOLUMEDOWN>;
+};
+
+&pronto {
+       status = "okay";
+};
+
+&sdhc_1 {
+       status = "okay";
+
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
+       pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
+};
+
+&sdhc_2 {
+       status = "okay";
+
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on &sdc2_cd_on>;
+       pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;
+
+       cd-gpios = <&msmgpio 38 GPIO_ACTIVE_LOW>;
+};
+
+&usb {
+       status = "okay";
+       extcon = <&muic>, <&muic>;
+};
+
+&usb_hs_phy {
+       extcon = <&muic>;
 };
 
 &smd_rpm_regulators {
index 410c7d1..086f07e 100644 (file)
                        };
                };
        };
+};
 
-       ports {
-               port@1 {
-                       dsi0_out: endpoint {
-                               remote-endpoint = <&panel_in>;
-                               data-lanes = <0 1>;
-                       };
-               };
-       };
+&dsi0_out {
+       data-lanes = <0 1>;
+       remote-endpoint = <&panel_in>;
 };
 
 &msmgpio {
index 67cae5f..aaa2189 100644 (file)
@@ -4,11 +4,11 @@
  */
 
 #include <dt-bindings/arm/coresight-cti-dt.h>
+#include <dt-bindings/clock/qcom,gcc-msm8916.h>
+#include <dt-bindings/clock/qcom,rpmcc.h>
 #include <dt-bindings/interconnect/qcom,msm8916.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
-#include <dt-bindings/clock/qcom,gcc-msm8916.h>
 #include <dt-bindings/reset/qcom,gcc-msm8916.h>
-#include <dt-bindings/clock/qcom,rpmcc.h>
 #include <dt-bindings/thermal/thermal.h>
 
 / {
                };
        };
 
+       clocks {
+               xo_board: xo-board {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <19200000>;
+               };
+
+               sleep_clk: sleep-clk {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <32768>;
+               };
+       };
+
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                };
 
                L2_0: l2-cache {
-                     compatible = "cache";
-                     cache-level = <2>;
+                       compatible = "cache";
+                       cache-level = <2>;
                };
 
                idle-states {
                };
        };
 
+       cpu_opp_table: cpu-opp-table {
+               compatible = "operating-points-v2";
+               opp-shared;
+
+               opp-200000000 {
+                       opp-hz = /bits/ 64 <200000000>;
+               };
+               opp-400000000 {
+                       opp-hz = /bits/ 64 <400000000>;
+               };
+               opp-800000000 {
+                       opp-hz = /bits/ 64 <800000000>;
+               };
+               opp-998400000 {
+                       opp-hz = /bits/ 64 <998400000>;
+               };
+       };
+
+       firmware {
+               scm: scm {
+                       compatible = "qcom,scm-msm8916", "qcom,scm";
+                       clocks = <&gcc GCC_CRYPTO_CLK>,
+                                <&gcc GCC_CRYPTO_AXI_CLK>,
+                                <&gcc GCC_CRYPTO_AHB_CLK>;
+                       clock-names = "core", "bus", "iface";
+                       #reset-cells = <1>;
+
+                       qcom,dload-mode = <&tcsr 0x6100>;
+               };
+       };
+
+       pmu {
+               compatible = "arm,cortex-a53-pmu";
+               interrupts = <GIC_PPI 7 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+       };
+
        psci {
                compatible = "arm,psci-1.0";
                method = "smc";
                };
        };
 
-       pmu {
-               compatible = "arm,cortex-a53-pmu";
-               interrupts = <GIC_PPI 7 (GIC_CPU_MASK_SIMPLE(4)| IRQ_TYPE_LEVEL_HIGH)>;
-       };
-
-       thermal-zones {
-               cpu0_1-thermal {
-                       polling-delay-passive = <250>;
-                       polling-delay = <1000>;
+       smd {
+               compatible = "qcom,smd";
 
-                       thermal-sensors = <&tsens 5>;
+               rpm {
+                       interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+                       qcom,ipc = <&apcs 8 0>;
+                       qcom,smd-edge = <15>;
 
-                       trips {
-                               cpu0_1_alert0: trip-point@0 {
-                                       temperature = <75000>;
-                                       hysteresis = <2000>;
-                                       type = "passive";
-                               };
-                               cpu0_1_crit: cpu_crit {
-                                       temperature = <110000>;
-                                       hysteresis = <2000>;
-                                       type = "critical";
-                               };
-                       };
+                       rpm_requests: rpm-requests {
+                               compatible = "qcom,rpm-msm8916";
+                               qcom,smd-channels = "rpm_requests";
 
-                       cooling-maps {
-                               map0 {
-                                       trip = <&cpu0_1_alert0>;
-                                       cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                                        <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                                        <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                                        <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               rpmcc: clock-controller {
+                                       compatible = "qcom,rpmcc-msm8916";
+                                       #clock-cells = <1>;
                                };
                        };
                };
+       };
 
-               cpu2_3-thermal {
-                       polling-delay-passive = <250>;
-                       polling-delay = <1000>;
+       smem {
+               compatible = "qcom,smem";
 
-                       thermal-sensors = <&tsens 4>;
+               memory-region = <&smem_mem>;
+               qcom,rpm-msg-ram = <&rpm_msg_ram>;
 
-                       trips {
-                               cpu2_3_alert0: trip-point0 {
-                                       temperature = <75000>;
-                                       hysteresis = <2000>;
-                                       type = "passive";
-                               };
-                               cpu2_3_crit: cpu_crit {
-                                       temperature = <110000>;
-                                       hysteresis = <2000>;
-                                       type = "critical";
-                               };
-                       };
+               hwlocks = <&tcsr_mutex 3>;
+       };
 
-                       cooling-maps {
-                               map0 {
-                                       trip = <&cpu2_3_alert0>;
-                                       cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                                        <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                                        <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                                        <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-                               };
-                       };
-               };
+       smp2p-hexagon {
+               compatible = "qcom,smp2p";
+               qcom,smem = <435>, <428>;
 
-               gpu-thermal {
-                       polling-delay-passive = <250>;
-                       polling-delay = <1000>;
+               interrupts = <GIC_SPI 27 IRQ_TYPE_EDGE_RISING>;
 
-                       thermal-sensors = <&tsens 2>;
+               qcom,ipc = <&apcs 8 14>;
 
-                       trips {
-                               gpu_alert0: trip-point0 {
-                                       temperature = <75000>;
-                                       hysteresis = <2000>;
-                                       type = "passive";
-                               };
-                               gpu_crit: gpu_crit {
-                                       temperature = <95000>;
-                                       hysteresis = <2000>;
-                                       type = "critical";
-                               };
-                       };
-               };
+               qcom,local-pid = <0>;
+               qcom,remote-pid = <1>;
 
-               camera-thermal {
-                       polling-delay-passive = <250>;
-                       polling-delay = <1000>;
+               hexagon_smp2p_out: master-kernel {
+                       qcom,entry-name = "master-kernel";
 
-                       thermal-sensors = <&tsens 1>;
+                       #qcom,smem-state-cells = <1>;
+               };
 
-                       trips {
-                               cam_alert0: trip-point0 {
-                                       temperature = <75000>;
-                                       hysteresis = <2000>;
-                                       type = "hot";
-                               };
-                       };
+               hexagon_smp2p_in: slave-kernel {
+                       qcom,entry-name = "slave-kernel";
+
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
                };
+       };
 
-               modem-thermal {
-                       polling-delay-passive = <250>;
-                       polling-delay = <1000>;
+       smp2p-wcnss {
+               compatible = "qcom,smp2p";
+               qcom,smem = <451>, <431>;
 
-                       thermal-sensors = <&tsens 0>;
+               interrupts = <GIC_SPI 143 IRQ_TYPE_EDGE_RISING>;
 
-                       trips {
-                               modem_alert0: trip-point0 {
-                                       temperature = <85000>;
-                                       hysteresis = <2000>;
-                                       type = "hot";
-                               };
-                       };
-               };
+               qcom,ipc = <&apcs 8 18>;
 
-       };
+               qcom,local-pid = <0>;
+               qcom,remote-pid = <4>;
 
-       cpu_opp_table: cpu-opp-table {
-               compatible = "operating-points-v2";
-               opp-shared;
+               wcnss_smp2p_out: master-kernel {
+                       qcom,entry-name = "master-kernel";
 
-               opp-200000000 {
-                       opp-hz = /bits/ 64 <200000000>;
-               };
-               opp-400000000 {
-                       opp-hz = /bits/ 64 <400000000>;
-               };
-               opp-800000000 {
-                       opp-hz = /bits/ 64 <800000000>;
+                       #qcom,smem-state-cells = <1>;
                };
-               opp-998400000 {
-                       opp-hz = /bits/ 64 <998400000>;
+
+               wcnss_smp2p_in: slave-kernel {
+                       qcom,entry-name = "slave-kernel";
+
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
                };
        };
 
-       timer {
-               compatible = "arm,armv8-timer";
-               interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-                            <GIC_PPI 3 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-                            <GIC_PPI 4 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-                            <GIC_PPI 1 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
-       };
+       smsm {
+               compatible = "qcom,smsm";
 
-       clocks {
-               xo_board: xo-board {
-                       compatible = "fixed-clock";
-                       #clock-cells = <0>;
-                       clock-frequency = <19200000>;
-               };
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               sleep_clk: sleep-clk {
-                       compatible = "fixed-clock";
-                       #clock-cells = <0>;
-                       clock-frequency = <32768>;
-               };
-       };
+               qcom,ipc-1 = <&apcs 8 13>;
+               qcom,ipc-3 = <&apcs 8 19>;
 
-       smem {
-               compatible = "qcom,smem";
+               apps_smsm: apps@0 {
+                       reg = <0>;
 
-               memory-region = <&smem_mem>;
-               qcom,rpm-msg-ram = <&rpm_msg_ram>;
+                       #qcom,smem-state-cells = <1>;
+               };
 
-               hwlocks = <&tcsr_mutex 3>;
-       };
+               hexagon_smsm: hexagon@1 {
+                       reg = <1>;
+                       interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>;
 
-       firmware {
-               scm: scm {
-                       compatible = "qcom,scm";
-                       clocks = <&gcc GCC_CRYPTO_CLK>, <&gcc GCC_CRYPTO_AXI_CLK>, <&gcc GCC_CRYPTO_AHB_CLK>;
-                       clock-names = "core", "bus", "iface";
-                       #reset-cells = <1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+               };
 
-                       qcom,dload-mode = <&tcsr 0x6100>;
+               wcnss_smsm: wcnss@6 {
+                       reg = <6>;
+                       interrupts = <GIC_SPI 144 IRQ_TYPE_EDGE_RISING>;
+
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
                };
        };
 
                ranges = <0 0 0 0xffffffff>;
                compatible = "simple-bus";
 
-               bimc: interconnect@400000 {
-                       compatible = "qcom,msm8916-bimc";
-                       reg = <0x00400000 0x62000>;
-                       #interconnect-cells = <1>;
-                       clock-names = "bus", "bus_a";
-                       clocks = <&rpmcc RPM_SMD_BIMC_CLK>,
-                                <&rpmcc RPM_SMD_BIMC_A_CLK>;
+               rng@22000 {
+                       compatible = "qcom,prng";
+                       reg = <0x00022000 0x200>;
+                       clocks = <&gcc GCC_PRNG_AHB_CLK>;
+                       clock-names = "core";
                };
 
                restart@4ab000 {
                        compatible = "qcom,pshold";
-                       reg = <0x4ab000 0x4>;
+                       reg = <0x004ab000 0x4>;
+               };
+
+               qfprom: qfprom@5c000 {
+                       compatible = "qcom,qfprom";
+                       reg = <0x0005c000 0x1000>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       tsens_caldata: caldata@d0 {
+                               reg = <0xd0 0x8>;
+                       };
+                       tsens_calsel: calsel@ec {
+                               reg = <0xec 0x4>;
+                       };
+               };
+
+               rpm_msg_ram: memory@60000 {
+                       compatible = "qcom,rpm-msg-ram";
+                       reg = <0x00060000 0x8000>;
+               };
+
+               bimc: interconnect@400000 {
+                       compatible = "qcom,msm8916-bimc";
+                       reg = <0x00400000 0x62000>;
+                       #interconnect-cells = <1>;
+                       clock-names = "bus", "bus_a";
+                       clocks = <&rpmcc RPM_SMD_BIMC_CLK>,
+                                <&rpmcc RPM_SMD_BIMC_A_CLK>;
+               };
+
+               tsens: thermal-sensor@4a9000 {
+                       compatible = "qcom,msm8916-tsens", "qcom,tsens-v0_1";
+                       reg = <0x004a9000 0x1000>, /* TM */
+                             <0x004a8000 0x1000>; /* SROT */
+                       nvmem-cells = <&tsens_caldata>, <&tsens_calsel>;
+                       nvmem-cell-names = "calib", "calib_sel";
+                       #qcom,sensors = <5>;
+                       interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "uplow";
+                       #thermal-sensor-cells = <1>;
                };
 
                pcnoc: interconnect@500000 {
                                 <&rpmcc RPM_SMD_SNOC_A_CLK>;
                };
 
-               msmgpio: pinctrl@1000000 {
-                       compatible = "qcom,msm8916-pinctrl";
-                       reg = <0x1000000 0x300000>;
-                       interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
-                       gpio-controller;
-                       gpio-ranges = <&msmgpio 0 0 122>;
-                       #gpio-cells = <2>;
-                       interrupt-controller;
-                       #interrupt-cells = <2>;
-               };
+               /* System CTIs */
+               /* CTI 0 - TMC connections */
+               cti0: cti@810000 {
+                       compatible = "arm,coresight-cti", "arm,primecell";
+                       reg = <0x00810000 0x1000>;
 
-               gcc: clock-controller@1800000 {
-                       compatible = "qcom,gcc-msm8916";
-                       #clock-cells = <1>;
-                       #reset-cells = <1>;
-                       #power-domain-cells = <1>;
-                       reg = <0x1800000 0x80000>;
-               };
+                       clocks = <&rpmcc RPM_QDSS_CLK>;
+                       clock-names = "apb_pclk";
 
-               tcsr_mutex_regs: syscon@1905000 {
-                       compatible = "syscon";
-                       reg = <0x1905000 0x20000>;
+                       status = "disabled";
                };
 
-               tcsr: syscon@1937000 {
-                       compatible = "qcom,tcsr-msm8916", "syscon";
-                       reg = <0x1937000 0x30000>;
-               };
+               /* CTI 1 - TPIU connections */
+               cti1: cti@811000 {
+                       compatible = "arm,coresight-cti", "arm,primecell";
+                       reg = <0x00811000 0x1000>;
 
-               tcsr_mutex: hwlock {
-                       compatible = "qcom,tcsr-mutex";
-                       syscon = <&tcsr_mutex_regs 0 0x1000>;
-                       #hwlock-cells = <1>;
-               };
+                       clocks = <&rpmcc RPM_QDSS_CLK>;
+                       clock-names = "apb_pclk";
 
-               rpm_msg_ram: memory@60000 {
-                       compatible = "qcom,rpm-msg-ram";
-                       reg = <0x60000 0x8000>;
+                       status = "disabled";
                };
 
-               blsp1_uart1: serial@78af000 {
-                       compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
-                       reg = <0x78af000 0x200>;
-                       interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_UART1_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>;
-                       clock-names = "core", "iface";
-                       dmas = <&blsp_dma 1>, <&blsp_dma 0>;
-                       dma-names = "rx", "tx";
+               /* CTIs 2-11 - no information - not instantiated */
+
+               tpiu: tpiu@820000 {
+                       compatible = "arm,coresight-tpiu", "arm,primecell";
+                       reg = <0x00820000 0x1000>;
+
+                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
+                       clock-names = "apb_pclk", "atclk";
+
                        status = "disabled";
-               };
 
-               a53pll: clock@b016000 {
-                       compatible = "qcom,msm8916-a53pll";
-                       reg = <0xb016000 0x40>;
-                       #clock-cells = <0>;
+                       in-ports {
+                               port {
+                                       tpiu_in: endpoint {
+                                               remote-endpoint = <&replicator_out1>;
+                                       };
+                               };
+                       };
                };
 
-               apcs: mailbox@b011000 {
-                       compatible = "qcom,msm8916-apcs-kpss-global", "syscon";
-                       reg = <0xb011000 0x1000>;
-                       #mbox-cells = <1>;
-                       clocks = <&a53pll>, <&gcc GPLL0_VOTE>;
-                       clock-names = "pll", "aux";
-                       #clock-cells = <0>;
-               };
+               funnel0: funnel@821000 {
+                       compatible = "arm,coresight-dynamic-funnel", "arm,primecell";
+                       reg = <0x00821000 0x1000>;
+
+                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
+                       clock-names = "apb_pclk", "atclk";
 
-               blsp1_uart2: serial@78b0000 {
-                       compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
-                       reg = <0x78b0000 0x200>;
-                       interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_UART2_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>;
-                       clock-names = "core", "iface";
-                       dmas = <&blsp_dma 3>, <&blsp_dma 2>;
-                       dma-names = "rx", "tx";
                        status = "disabled";
+
+                       in-ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               /*
+                                * Not described input ports:
+                                * 0 - connected to Resource and Power Manger CPU ETM
+                                * 1 - not-connected
+                                * 2 - connected to Modem CPU ETM
+                                * 3 - not-connected
+                                * 5 - not-connected
+                                * 6 - connected trought funnel to Wireless CPU ETM
+                                * 7 - connected to STM component
+                                */
+
+                               port@4 {
+                                       reg = <4>;
+                                       funnel0_in4: endpoint {
+                                               remote-endpoint = <&funnel1_out>;
+                                       };
+                               };
+                       };
+
+                       out-ports {
+                               port {
+                                       funnel0_out: endpoint {
+                                               remote-endpoint = <&etf_in>;
+                                       };
+                               };
+                       };
                };
 
-               blsp_dma: dma@7884000 {
-                       compatible = "qcom,bam-v1.7.0";
-                       reg = <0x07884000 0x23000>;
-                       interrupts = <GIC_SPI 238 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_AHB_CLK>;
-                       clock-names = "bam_clk";
-                       #dma-cells = <1>;
-                       qcom,ee = <0>;
+               replicator: replicator@824000 {
+                       compatible = "arm,coresight-dynamic-replicator", "arm,primecell";
+                       reg = <0x00824000 0x1000>;
+
+                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
+                       clock-names = "apb_pclk", "atclk";
+
                        status = "disabled";
+
+                       out-ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       replicator_out0: endpoint {
+                                               remote-endpoint = <&etr_in>;
+                                       };
+                               };
+                               port@1 {
+                                       reg = <1>;
+                                       replicator_out1: endpoint {
+                                               remote-endpoint = <&tpiu_in>;
+                                       };
+                               };
+                       };
+
+                       in-ports {
+                               port {
+                                       replicator_in: endpoint {
+                                               remote-endpoint = <&etf_out>;
+                                       };
+                               };
+                       };
                };
 
-               blsp_spi1: spi@78b5000 {
-                       compatible = "qcom,spi-qup-v2.2.1";
-                       reg = <0x078b5000 0x500>;
-                       interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_QUP1_SPI_APPS_CLK>,
-                                <&gcc GCC_BLSP1_AHB_CLK>;
-                       clock-names = "core", "iface";
-                       dmas = <&blsp_dma 5>, <&blsp_dma 4>;
-                       dma-names = "rx", "tx";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&spi1_default>;
-                       pinctrl-1 = <&spi1_sleep>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
+               etf: etf@825000 {
+                       compatible = "arm,coresight-tmc", "arm,primecell";
+                       reg = <0x00825000 0x1000>;
+
+                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
+                       clock-names = "apb_pclk", "atclk";
+
                        status = "disabled";
+
+                       in-ports {
+                               port {
+                                       etf_in: endpoint {
+                                               remote-endpoint = <&funnel0_out>;
+                                       };
+                               };
+                       };
+
+                       out-ports {
+                               port {
+                                       etf_out: endpoint {
+                                               remote-endpoint = <&replicator_in>;
+                                       };
+                               };
+                       };
                };
 
-               blsp_spi2: spi@78b6000 {
-                       compatible = "qcom,spi-qup-v2.2.1";
-                       reg = <0x078b6000 0x500>;
-                       interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_QUP2_SPI_APPS_CLK>,
-                                <&gcc GCC_BLSP1_AHB_CLK>;
-                       clock-names = "core", "iface";
-                       dmas = <&blsp_dma 7>, <&blsp_dma 6>;
-                       dma-names = "rx", "tx";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&spi2_default>;
-                       pinctrl-1 = <&spi2_sleep>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
+               etr: etr@826000 {
+                       compatible = "arm,coresight-tmc", "arm,primecell";
+                       reg = <0x00826000 0x1000>;
+
+                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
+                       clock-names = "apb_pclk", "atclk";
+
                        status = "disabled";
+
+                       in-ports {
+                               port {
+                                       etr_in: endpoint {
+                                               remote-endpoint = <&replicator_out0>;
+                                       };
+                               };
+                       };
                };
 
-               blsp_spi3: spi@78b7000 {
-                       compatible = "qcom,spi-qup-v2.2.1";
-                       reg = <0x078b7000 0x500>;
-                       interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_QUP3_SPI_APPS_CLK>,
-                                <&gcc GCC_BLSP1_AHB_CLK>;
-                       clock-names = "core", "iface";
-                       dmas = <&blsp_dma 9>, <&blsp_dma 8>;
-                       dma-names = "rx", "tx";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&spi3_default>;
-                       pinctrl-1 = <&spi3_sleep>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       status = "disabled";
-               };
+               funnel1: funnel@841000 {        /* APSS funnel only 4 inputs are used */
+                       compatible = "arm,coresight-dynamic-funnel", "arm,primecell";
+                       reg = <0x00841000 0x1000>;
 
-               blsp_spi4: spi@78b8000 {
-                       compatible = "qcom,spi-qup-v2.2.1";
-                       reg = <0x078b8000 0x500>;
-                       interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_QUP4_SPI_APPS_CLK>,
-                                <&gcc GCC_BLSP1_AHB_CLK>;
-                       clock-names = "core", "iface";
-                       dmas = <&blsp_dma 11>, <&blsp_dma 10>;
-                       dma-names = "rx", "tx";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&spi4_default>;
-                       pinctrl-1 = <&spi4_sleep>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       status = "disabled";
-               };
+                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
+                       clock-names = "apb_pclk", "atclk";
 
-               blsp_spi5: spi@78b9000 {
-                       compatible = "qcom,spi-qup-v2.2.1";
-                       reg = <0x078b9000 0x500>;
-                       interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_QUP5_SPI_APPS_CLK>,
-                                <&gcc GCC_BLSP1_AHB_CLK>;
-                       clock-names = "core", "iface";
-                       dmas = <&blsp_dma 13>, <&blsp_dma 12>;
-                       dma-names = "rx", "tx";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&spi5_default>;
-                       pinctrl-1 = <&spi5_sleep>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
                        status = "disabled";
-               };
 
-               blsp_spi6: spi@78ba000 {
-                       compatible = "qcom,spi-qup-v2.2.1";
-                       reg = <0x078ba000 0x500>;
-                       interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_QUP6_SPI_APPS_CLK>,
-                                <&gcc GCC_BLSP1_AHB_CLK>;
-                       clock-names = "core", "iface";
-                       dmas = <&blsp_dma 15>, <&blsp_dma 14>;
-                       dma-names = "rx", "tx";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&spi6_default>;
-                       pinctrl-1 = <&spi6_sleep>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       status = "disabled";
+                       in-ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       funnel1_in0: endpoint {
+                                               remote-endpoint = <&etm0_out>;
+                                       };
+                               };
+                               port@1 {
+                                       reg = <1>;
+                                       funnel1_in1: endpoint {
+                                               remote-endpoint = <&etm1_out>;
+                                       };
+                               };
+                               port@2 {
+                                       reg = <2>;
+                                       funnel1_in2: endpoint {
+                                               remote-endpoint = <&etm2_out>;
+                                       };
+                               };
+                               port@3 {
+                                       reg = <3>;
+                                       funnel1_in3: endpoint {
+                                               remote-endpoint = <&etm3_out>;
+                                       };
+                               };
+                       };
+
+                       out-ports {
+                               port {
+                                       funnel1_out: endpoint {
+                                               remote-endpoint = <&funnel0_in4>;
+                                       };
+                               };
+                       };
                };
 
-               blsp_i2c1: i2c@78b5000 {
-                       compatible = "qcom,i2c-qup-v2.2.1";
-                       reg = <0x078b5000 0x500>;
-                       interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_AHB_CLK>,
-                                <&gcc GCC_BLSP1_QUP1_I2C_APPS_CLK>;
-                       clock-names = "iface", "core";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&i2c1_default>;
-                       pinctrl-1 = <&i2c1_sleep>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
+               debug0: debug@850000 {
+                       compatible = "arm,coresight-cpu-debug", "arm,primecell";
+                       reg = <0x00850000 0x1000>;
+                       clocks = <&rpmcc RPM_QDSS_CLK>;
+                       clock-names = "apb_pclk";
+                       cpu = <&CPU0>;
                        status = "disabled";
                };
 
-               blsp_i2c2: i2c@78b6000 {
-                       compatible = "qcom,i2c-qup-v2.2.1";
-                       reg = <0x078b6000 0x500>;
-                       interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_AHB_CLK>,
-                                <&gcc GCC_BLSP1_QUP2_I2C_APPS_CLK>;
-                       clock-names = "iface", "core";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&i2c2_default>;
-                       pinctrl-1 = <&i2c2_sleep>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
+               debug1: debug@852000 {
+                       compatible = "arm,coresight-cpu-debug", "arm,primecell";
+                       reg = <0x00852000 0x1000>;
+                       clocks = <&rpmcc RPM_QDSS_CLK>;
+                       clock-names = "apb_pclk";
+                       cpu = <&CPU1>;
                        status = "disabled";
                };
 
-               blsp_i2c4: i2c@78b8000 {
-                       compatible = "qcom,i2c-qup-v2.2.1";
-                       reg = <0x078b8000 0x500>;
-                       interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_AHB_CLK>,
-                                <&gcc GCC_BLSP1_QUP4_I2C_APPS_CLK>;
-                       clock-names = "iface", "core";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&i2c4_default>;
-                       pinctrl-1 = <&i2c4_sleep>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
+               debug2: debug@854000 {
+                       compatible = "arm,coresight-cpu-debug", "arm,primecell";
+                       reg = <0x00854000 0x1000>;
+                       clocks = <&rpmcc RPM_QDSS_CLK>;
+                       clock-names = "apb_pclk";
+                       cpu = <&CPU2>;
                        status = "disabled";
                };
 
-               blsp_i2c5: i2c@78b9000 {
-                       compatible = "qcom,i2c-qup-v2.2.1";
-                       reg = <0x078b9000 0x500>;
-                       interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_AHB_CLK>,
-                                <&gcc GCC_BLSP1_QUP5_I2C_APPS_CLK>;
-                       clock-names = "iface", "core";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&i2c5_default>;
-                       pinctrl-1 = <&i2c5_sleep>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
+               debug3: debug@856000 {
+                       compatible = "arm,coresight-cpu-debug", "arm,primecell";
+                       reg = <0x00856000 0x1000>;
+                       clocks = <&rpmcc RPM_QDSS_CLK>;
+                       clock-names = "apb_pclk";
+                       cpu = <&CPU3>;
                        status = "disabled";
                };
 
-               blsp_i2c6: i2c@78ba000 {
-                       compatible = "qcom,i2c-qup-v2.2.1";
-                       reg = <0x078ba000 0x500>;
-                       interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_BLSP1_AHB_CLK>,
-                                <&gcc GCC_BLSP1_QUP6_I2C_APPS_CLK>;
-                       clock-names = "iface", "core";
-                       pinctrl-names = "default", "sleep";
-                       pinctrl-0 = <&i2c6_default>;
-                       pinctrl-1 = <&i2c6_sleep>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
+               /* Core CTIs; CTIs 12-15 */
+               /* CTI - CPU-0 */
+               cti12: cti@858000 {
+                       compatible = "arm,coresight-cti-v8-arch", "arm,coresight-cti",
+                                    "arm,primecell";
+                       reg = <0x00858000 0x1000>;
+
+                       clocks = <&rpmcc RPM_QDSS_CLK>;
+                       clock-names = "apb_pclk";
+
+                       cpu = <&CPU0>;
+                       arm,cs-dev-assoc = <&etm0>;
+
                        status = "disabled";
                };
 
-               lpass: lpass@7708000 {
-                       status = "disabled";
-                       compatible = "qcom,lpass-cpu-apq8016";
-                       clocks = <&gcc GCC_ULTAUDIO_AHBFABRIC_IXFABRIC_CLK>,
-                                <&gcc GCC_ULTAUDIO_PCNOC_MPORT_CLK>,
-                                <&gcc GCC_ULTAUDIO_PCNOC_SWAY_CLK>,
-                                <&gcc GCC_ULTAUDIO_LPAIF_PRI_I2S_CLK>,
-                                <&gcc GCC_ULTAUDIO_LPAIF_SEC_I2S_CLK>,
-                                <&gcc GCC_ULTAUDIO_LPAIF_SEC_I2S_CLK>,
-                                <&gcc GCC_ULTAUDIO_LPAIF_AUX_I2S_CLK>;
+               /* CTI - CPU-1 */
+               cti13: cti@859000 {
+                       compatible = "arm,coresight-cti-v8-arch", "arm,coresight-cti",
+                                    "arm,primecell";
+                       reg = <0x00859000 0x1000>;
 
-                       clock-names = "ahbix-clk",
-                                       "pcnoc-mport-clk",
-                                       "pcnoc-sway-clk",
-                                       "mi2s-bit-clk0",
-                                       "mi2s-bit-clk1",
-                                       "mi2s-bit-clk2",
-                                       "mi2s-bit-clk3";
-                       #sound-dai-cells = <1>;
+                       clocks = <&rpmcc RPM_QDSS_CLK>;
+                       clock-names = "apb_pclk";
 
-                       interrupts = <0 160 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-names = "lpass-irq-lpaif";
-                       reg = <0x07708000 0x10000>;
-                       reg-names = "lpass-lpaif";
+                       cpu = <&CPU1>;
+                       arm,cs-dev-assoc = <&etm1>;
 
-                       #address-cells = <1>;
-                       #size-cells = <0>;
+                       status = "disabled";
                };
 
-                lpass_codec: codec{
-                       compatible = "qcom,msm8916-wcd-digital-codec";
-                       reg = <0x0771c000 0x400>;
-                       clocks = <&gcc GCC_ULTAUDIO_AHBFABRIC_IXFABRIC_CLK>,
-                                <&gcc GCC_CODEC_DIGCODEC_CLK>;
-                       clock-names = "ahbix-clk", "mclk";
-                       #sound-dai-cells = <1>;
-                };
+               /* CTI - CPU-2 */
+               cti14: cti@85a000 {
+                       compatible = "arm,coresight-cti-v8-arch", "arm,coresight-cti",
+                                    "arm,primecell";
+                       reg = <0x0085a000 0x1000>;
 
-               sdhc_1: sdhci@7824000 {
-                       compatible = "qcom,sdhci-msm-v4";
-                       reg = <0x07824900 0x11c>, <0x07824000 0x800>;
-                       reg-names = "hc_mem", "core_mem";
+                       clocks = <&rpmcc RPM_QDSS_CLK>;
+                       clock-names = "apb_pclk";
+
+                       cpu = <&CPU2>;
+                       arm,cs-dev-assoc = <&etm2>;
 
-                       interrupts = <0 123 IRQ_TYPE_LEVEL_HIGH>, <0 138 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-names = "hc_irq", "pwr_irq";
-                       clocks = <&gcc GCC_SDCC1_APPS_CLK>,
-                                <&gcc GCC_SDCC1_AHB_CLK>,
-                                <&xo_board>;
-                       clock-names = "core", "iface", "xo";
-                       mmc-ddr-1_8v;
-                       bus-width = <8>;
-                       non-removable;
                        status = "disabled";
                };
 
-               sdhc_2: sdhci@7864000 {
-                       compatible = "qcom,sdhci-msm-v4";
-                       reg = <0x07864900 0x11c>, <0x07864000 0x800>;
-                       reg-names = "hc_mem", "core_mem";
+               /* CTI - CPU-3 */
+               cti15: cti@85b000 {
+                       compatible = "arm,coresight-cti-v8-arch", "arm,coresight-cti",
+                                    "arm,primecell";
+                       reg = <0x0085b000 0x1000>;
+
+                       clocks = <&rpmcc RPM_QDSS_CLK>;
+                       clock-names = "apb_pclk";
+
+                       cpu = <&CPU3>;
+                       arm,cs-dev-assoc = <&etm3>;
 
-                       interrupts = <0 125 IRQ_TYPE_LEVEL_HIGH>, <0 221 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-names = "hc_irq", "pwr_irq";
-                       clocks = <&gcc GCC_SDCC2_APPS_CLK>,
-                                <&gcc GCC_SDCC2_AHB_CLK>,
-                                <&xo_board>;
-                       clock-names = "core", "iface", "xo";
-                       bus-width = <4>;
                        status = "disabled";
                };
 
-               otg: usb@78d9000 {
-                       compatible = "qcom,ci-hdrc";
-                       reg = <0x78d9000 0x200>,
-                             <0x78d9200 0x200>;
-                       interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gcc GCC_USB_HS_AHB_CLK>,
-                                <&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>;
+               etm0: etm@85c000 {
+                       compatible = "arm,coresight-etm4x", "arm,primecell";
+                       reg = <0x0085c000 0x1000>;
+
+                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
+                       clock-names = "apb_pclk", "atclk";
+                       arm,coresight-loses-context-with-cpu;
+
+                       cpu = <&CPU0>;
+
                        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>;
+                       out-ports {
+                               port {
+                                       etm0_out: endpoint {
+                                               remote-endpoint = <&funnel1_in0>;
+                                       };
                                };
                        };
                };
 
-               intc: interrupt-controller@b000000 {
-                       compatible = "qcom,msm-qgic2";
-                       interrupt-controller;
-                       #interrupt-cells = <3>;
-                       reg = <0x0b000000 0x1000>, <0x0b002000 0x1000>;
-               };
+               etm1: etm@85d000 {
+                       compatible = "arm,coresight-etm4x", "arm,primecell";
+                       reg = <0x0085d000 0x1000>;
 
-               timer@b020000 {
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       ranges;
-                       compatible = "arm,armv7-timer-mem";
-                       reg = <0xb020000 0x1000>;
-                       clock-frequency = <19200000>;
+                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
+                       clock-names = "apb_pclk", "atclk";
+                       arm,coresight-loses-context-with-cpu;
 
-                       frame@b021000 {
-                               frame-number = <0>;
-                               interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
-                               reg = <0xb021000 0x1000>,
-                                     <0xb022000 0x1000>;
-                       };
+                       cpu = <&CPU1>;
 
-                       frame@b023000 {
-                               frame-number = <1>;
-                               interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
-                               reg = <0xb023000 0x1000>;
-                               status = "disabled";
-                       };
+                       status = "disabled";
 
-                       frame@b024000 {
-                               frame-number = <2>;
-                               interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
-                               reg = <0xb024000 0x1000>;
-                               status = "disabled";
+                       out-ports {
+                               port {
+                                       etm1_out: endpoint {
+                                               remote-endpoint = <&funnel1_in1>;
+                                       };
+                               };
                        };
+               };
 
-                       frame@b025000 {
-                               frame-number = <3>;
-                               interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
-                               reg = <0xb025000 0x1000>;
-                               status = "disabled";
-                       };
+               etm2: etm@85e000 {
+                       compatible = "arm,coresight-etm4x", "arm,primecell";
+                       reg = <0x0085e000 0x1000>;
 
-                       frame@b026000 {
-                               frame-number = <4>;
-                               interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
-                               reg = <0xb026000 0x1000>;
-                               status = "disabled";
-                       };
+                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
+                       clock-names = "apb_pclk", "atclk";
+                       arm,coresight-loses-context-with-cpu;
 
-                       frame@b027000 {
-                               frame-number = <5>;
-                               interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
-                               reg = <0xb027000 0x1000>;
-                               status = "disabled";
+                       cpu = <&CPU2>;
+
+                       status = "disabled";
+
+                       out-ports {
+                               port {
+                                       etm2_out: endpoint {
+                                               remote-endpoint = <&funnel1_in2>;
+                                       };
+                               };
                        };
+               };
 
-                       frame@b028000 {
-                               frame-number = <6>;
-                               interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
-                               reg = <0xb028000 0x1000>;
-                               status = "disabled";
+               etm3: etm@85f000 {
+                       compatible = "arm,coresight-etm4x", "arm,primecell";
+                       reg = <0x0085f000 0x1000>;
+
+                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
+                       clock-names = "apb_pclk", "atclk";
+                       arm,coresight-loses-context-with-cpu;
+
+                       cpu = <&CPU3>;
+
+                       status = "disabled";
+
+                       out-ports {
+                               port {
+                                       etm3_out: endpoint {
+                                               remote-endpoint = <&funnel1_in3>;
+                                       };
+                               };
                        };
                };
 
-               spmi_bus: spmi@200f000 {
-                       compatible = "qcom,spmi-pmic-arb";
-                       reg = <0x200f000 0x001000>,
-                             <0x2400000 0x400000>,
-                             <0x2c00000 0x400000>,
-                             <0x3800000 0x200000>,
-                             <0x200a000 0x002100>;
-                       reg-names = "core", "chnls", "obsrvr", "intr", "cnfg";
-                       interrupt-names = "periph_irq";
-                       interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>;
-                       qcom,ee = <0>;
-                       qcom,channel = <0>;
-                       #address-cells = <2>;
-                       #size-cells = <0>;
+               msmgpio: pinctrl@1000000 {
+                       compatible = "qcom,msm8916-pinctrl";
+                       reg = <0x01000000 0x300000>;
+                       interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       gpio-ranges = <&msmgpio 0 0 122>;
+                       #gpio-cells = <2>;
                        interrupt-controller;
-                       #interrupt-cells = <4>;
+                       #interrupt-cells = <2>;
                };
 
-               rng@22000 {
-                       compatible = "qcom,prng";
-                       reg = <0x00022000 0x200>;
-                       clocks = <&gcc GCC_PRNG_AHB_CLK>;
-                       clock-names = "core";
+               gcc: clock-controller@1800000 {
+                       compatible = "qcom,gcc-msm8916";
+                       #clock-cells = <1>;
+                       #reset-cells = <1>;
+                       #power-domain-cells = <1>;
+                       reg = <0x01800000 0x80000>;
                };
 
-               qfprom: qfprom@5c000 {
-                       compatible = "qcom,qfprom";
-                       reg = <0x5c000 0x1000>;
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       tsens_caldata: caldata@d0 {
-                               reg = <0xd0 0x8>;
-                       };
-                       tsens_calsel: calsel@ec {
-                               reg = <0xec 0x4>;
-                       };
+               tcsr_mutex: hwlock@1905000 {
+                       compatible = "qcom,tcsr-mutex";
+                       reg = <0x01905000 0x20000>;
+                       #hwlock-cells = <1>;
                };
 
-               tsens: thermal-sensor@4a9000 {
-                       compatible = "qcom,msm8916-tsens", "qcom,tsens-v0_1";
-                       reg = <0x4a9000 0x1000>, /* TM */
-                             <0x4a8000 0x1000>; /* SROT */
-                       nvmem-cells = <&tsens_caldata>, <&tsens_calsel>;
-                       nvmem-cell-names = "calib", "calib_sel";
-                       #qcom,sensors = <5>;
-                       interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-names = "uplow";
-                       #thermal-sensor-cells = <1>;
+               tcsr: syscon@1937000 {
+                       compatible = "qcom,tcsr-msm8916", "syscon";
+                       reg = <0x01937000 0x30000>;
                };
 
-               apps_iommu: iommu@1ef0000 {
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       #iommu-cells = <1>;
-                       compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1";
-                       ranges = <0 0x1e20000 0x40000>;
-                       reg = <0x1ef0000 0x3000>;
-                       clocks = <&gcc GCC_SMMU_CFG_CLK>,
-                                <&gcc GCC_APSS_TCU_CLK>;
-                       clock-names = "iface", "bus";
-                       qcom,iommu-secure-id = <17>;
+               mdss: mdss@1a00000 {
+                       compatible = "qcom,mdss";
+                       reg = <0x01a00000 0x1000>,
+                             <0x01ac8000 0x3000>;
+                       reg-names = "mdss_phys", "vbif_phys";
 
-                       // vfe:
-                       iommu-ctx@3000 {
-                               compatible = "qcom,msm-iommu-v1-sec";
-                               reg = <0x3000 0x1000>;
-                               interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
-                       };
+                       power-domains = <&gcc MDSS_GDSC>;
 
-                       // mdp_0:
-                       iommu-ctx@4000 {
-                               compatible = "qcom,msm-iommu-v1-ns";
-                               reg = <0x4000 0x1000>;
-                               interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
-                       };
+                       clocks = <&gcc GCC_MDSS_AHB_CLK>,
+                                <&gcc GCC_MDSS_AXI_CLK>,
+                                <&gcc GCC_MDSS_VSYNC_CLK>;
+                       clock-names = "iface",
+                                     "bus",
+                                     "vsync";
 
-                       // venus_ns:
-                       iommu-ctx@5000 {
-                               compatible = "qcom,msm-iommu-v1-sec";
-                               reg = <0x5000 0x1000>;
-                               interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
-                       };
-               };
+                       interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
+
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
 
-               gpu_iommu: iommu@1f08000 {
                        #address-cells = <1>;
                        #size-cells = <1>;
-                       #iommu-cells = <1>;
-                       compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1";
-                       ranges = <0 0x1f08000 0x10000>;
-                       clocks = <&gcc GCC_SMMU_CFG_CLK>,
-                                <&gcc GCC_GFX_TCU_CLK>;
-                       clock-names = "iface", "bus";
-                       qcom,iommu-secure-id = <18>;
+                       ranges;
 
-                       // gfx3d_user:
-                       iommu-ctx@1000 {
-                               compatible = "qcom,msm-iommu-v1-ns";
-                               reg = <0x1000 0x1000>;
-                               interrupts = <GIC_SPI 241 IRQ_TYPE_LEVEL_HIGH>;
-                       };
+                       mdp: mdp@1a01000 {
+                               compatible = "qcom,mdp5";
+                               reg = <0x01a01000 0x89000>;
+                               reg-names = "mdp_phys";
 
-                       // gfx3d_priv:
-                       iommu-ctx@2000 {
-                               compatible = "qcom,msm-iommu-v1-ns";
-                               reg = <0x2000 0x1000>;
-                               interrupts = <GIC_SPI 242 IRQ_TYPE_LEVEL_HIGH>;
-                       };
-               };
-
-               gpu@1c00000 {
-                       compatible = "qcom,adreno-306.0", "qcom,adreno";
-                       reg = <0x01c00000 0x20000>;
-                       reg-names = "kgsl_3d0_reg_memory";
-                       interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-names = "kgsl_3d0_irq";
-                       clock-names =
-                           "core",
-                           "iface",
-                           "mem",
-                           "mem_iface",
-                           "alt_mem_iface",
-                           "gfx3d";
-                       clocks =
-                           <&gcc GCC_OXILI_GFX3D_CLK>,
-                           <&gcc GCC_OXILI_AHB_CLK>,
-                           <&gcc GCC_OXILI_GMEM_CLK>,
-                           <&gcc GCC_BIMC_GFX_CLK>,
-                           <&gcc GCC_BIMC_GPU_CLK>,
-                           <&gcc GFX3D_CLK_SRC>;
-                       power-domains = <&gcc OXILI_GDSC>;
-                       operating-points-v2 = <&gpu_opp_table>;
-                       iommus = <&gpu_iommu 1>, <&gpu_iommu 2>;
-
-                       gpu_opp_table: opp-table {
-                               compatible = "operating-points-v2";
-
-                               opp-400000000 {
-                                       opp-hz = /bits/ 64 <400000000>;
-                               };
-                               opp-19200000 {
-                                       opp-hz = /bits/ 64 <19200000>;
-                               };
-                       };
-               };
-
-               mdss: mdss@1a00000 {
-                       compatible = "qcom,mdss";
-                       reg = <0x1a00000 0x1000>,
-                             <0x1ac8000 0x3000>;
-                       reg-names = "mdss_phys", "vbif_phys";
-
-                       power-domains = <&gcc MDSS_GDSC>;
-
-                       clocks = <&gcc GCC_MDSS_AHB_CLK>,
-                                <&gcc GCC_MDSS_AXI_CLK>,
-                                <&gcc GCC_MDSS_VSYNC_CLK>;
-                       clock-names = "iface",
-                                     "bus",
-                                     "vsync";
-
-                       interrupts = <0 72 IRQ_TYPE_LEVEL_HIGH>;
-
-                       interrupt-controller;
-                       #interrupt-cells = <1>;
-
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       ranges;
-
-                       mdp: mdp@1a01000 {
-                               compatible = "qcom,mdp5";
-                               reg = <0x1a01000 0x89000>;
-                               reg-names = "mdp_phys";
-
-                               interrupt-parent = <&mdss>;
-                               interrupts = <0 0>;
+                               interrupt-parent = <&mdss>;
+                               interrupts = <0>;
 
                                clocks = <&gcc GCC_MDSS_AHB_CLK>,
                                         <&gcc GCC_MDSS_AXI_CLK>,
 
                        dsi0: dsi@1a98000 {
                                compatible = "qcom,mdss-dsi-ctrl";
-                               reg = <0x1a98000 0x25c>;
+                               reg = <0x01a98000 0x25c>;
                                reg-names = "dsi_ctrl";
 
                                interrupt-parent = <&mdss>;
-                               interrupts = <4 0>;
+                               interrupts = <4>;
 
                                assigned-clocks = <&gcc BYTE0_CLK_SRC>,
                                                  <&gcc PCLK0_CLK_SRC>;
                                phys = <&dsi_phy0>;
                                phy-names = "dsi-phy";
 
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
                                ports {
                                        #address-cells = <1>;
                                        #size-cells = <0>;
 
                        dsi_phy0: dsi-phy@1a98300 {
                                compatible = "qcom,dsi-phy-28nm-lp";
-                               reg = <0x1a98300 0xd4>,
-                                     <0x1a98500 0x280>,
-                                     <0x1a98780 0x30>;
+                               reg = <0x01a98300 0xd4>,
+                                     <0x01a98500 0x280>,
+                                     <0x01a98780 0x30>;
                                reg-names = "dsi_pll",
                                            "dsi_phy",
                                            "dsi_phy_regulator";
                        };
                };
 
+               camss: camss@1b00000 {
+                       compatible = "qcom,msm8916-camss";
+                       reg = <0x01b0ac00 0x200>,
+                               <0x01b00030 0x4>,
+                               <0x01b0b000 0x200>,
+                               <0x01b00038 0x4>,
+                               <0x01b08000 0x100>,
+                               <0x01b08400 0x100>,
+                               <0x01b0a000 0x500>,
+                               <0x01b00020 0x10>,
+                               <0x01b10000 0x1000>;
+                       reg-names = "csiphy0",
+                               "csiphy0_clk_mux",
+                               "csiphy1",
+                               "csiphy1_clk_mux",
+                               "csid0",
+                               "csid1",
+                               "ispif",
+                               "csi_clk_mux",
+                               "vfe0";
+                       interrupts = <GIC_SPI 78 IRQ_TYPE_EDGE_RISING>,
+                               <GIC_SPI 79 IRQ_TYPE_EDGE_RISING>,
+                               <GIC_SPI 51 IRQ_TYPE_EDGE_RISING>,
+                               <GIC_SPI 52 IRQ_TYPE_EDGE_RISING>,
+                               <GIC_SPI 55 IRQ_TYPE_EDGE_RISING>,
+                               <GIC_SPI 57 IRQ_TYPE_EDGE_RISING>;
+                       interrupt-names = "csiphy0",
+                               "csiphy1",
+                               "csid0",
+                               "csid1",
+                               "ispif",
+                               "vfe0";
+                       power-domains = <&gcc VFE_GDSC>;
+                       clocks = <&gcc GCC_CAMSS_TOP_AHB_CLK>,
+                               <&gcc GCC_CAMSS_ISPIF_AHB_CLK>,
+                               <&gcc GCC_CAMSS_CSI0PHYTIMER_CLK>,
+                               <&gcc GCC_CAMSS_CSI1PHYTIMER_CLK>,
+                               <&gcc GCC_CAMSS_CSI0_AHB_CLK>,
+                               <&gcc GCC_CAMSS_CSI0_CLK>,
+                               <&gcc GCC_CAMSS_CSI0PHY_CLK>,
+                               <&gcc GCC_CAMSS_CSI0PIX_CLK>,
+                               <&gcc GCC_CAMSS_CSI0RDI_CLK>,
+                               <&gcc GCC_CAMSS_CSI1_AHB_CLK>,
+                               <&gcc GCC_CAMSS_CSI1_CLK>,
+                               <&gcc GCC_CAMSS_CSI1PHY_CLK>,
+                               <&gcc GCC_CAMSS_CSI1PIX_CLK>,
+                               <&gcc GCC_CAMSS_CSI1RDI_CLK>,
+                               <&gcc GCC_CAMSS_AHB_CLK>,
+                               <&gcc GCC_CAMSS_VFE0_CLK>,
+                               <&gcc GCC_CAMSS_CSI_VFE0_CLK>,
+                               <&gcc GCC_CAMSS_VFE_AHB_CLK>,
+                               <&gcc GCC_CAMSS_VFE_AXI_CLK>;
+                       clock-names = "top_ahb",
+                               "ispif_ahb",
+                               "csiphy0_timer",
+                               "csiphy1_timer",
+                               "csi0_ahb",
+                               "csi0",
+                               "csi0_phy",
+                               "csi0_pix",
+                               "csi0_rdi",
+                               "csi1_ahb",
+                               "csi1",
+                               "csi1_phy",
+                               "csi1_pix",
+                               "csi1_rdi",
+                               "ahb",
+                               "vfe0",
+                               "csi_vfe0",
+                               "vfe_ahb",
+                               "vfe_axi";
+                       iommus = <&apps_iommu 3>;
+                       status = "disabled";
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+               };
 
-               hexagon@4080000 {
-                       compatible = "qcom,q6v5-pil";
-                       reg = <0x04080000 0x100>,
-                             <0x04020000 0x040>;
+               cci: cci@1b0c000 {
+                       compatible = "qcom,msm8916-cci";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x01b0c000 0x1000>;
+                       interrupts = <GIC_SPI 50 IRQ_TYPE_EDGE_RISING>;
+                       clocks = <&gcc GCC_CAMSS_TOP_AHB_CLK>,
+                               <&gcc GCC_CAMSS_CCI_AHB_CLK>,
+                               <&gcc GCC_CAMSS_CCI_CLK>,
+                               <&gcc GCC_CAMSS_AHB_CLK>;
+                       clock-names = "camss_top_ahb", "cci_ahb",
+                                         "cci", "camss_ahb";
+                       assigned-clocks = <&gcc GCC_CAMSS_CCI_AHB_CLK>,
+                                         <&gcc GCC_CAMSS_CCI_CLK>;
+                       assigned-clock-rates = <80000000>, <19200000>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&cci0_default>;
+                       status = "disabled";
 
-                       reg-names = "qdsp6", "rmb";
+                       cci_i2c0: i2c-bus@0 {
+                               reg = <0>;
+                               clock-frequency = <400000>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+               };
 
-                       interrupts-extended = <&intc 0 24 1>,
-                                             <&hexagon_smp2p_in 0 0>,
-                                             <&hexagon_smp2p_in 1 0>,
-                                             <&hexagon_smp2p_in 2 0>,
-                                             <&hexagon_smp2p_in 3 0>;
-                       interrupt-names = "wdog", "fatal", "ready",
-                                         "handover", "stop-ack";
+               gpu@1c00000 {
+                       compatible = "qcom,adreno-306.0", "qcom,adreno";
+                       reg = <0x01c00000 0x20000>;
+                       reg-names = "kgsl_3d0_reg_memory";
+                       interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "kgsl_3d0_irq";
+                       clock-names =
+                           "core",
+                           "iface",
+                           "mem",
+                           "mem_iface",
+                           "alt_mem_iface",
+                           "gfx3d";
+                       clocks =
+                           <&gcc GCC_OXILI_GFX3D_CLK>,
+                           <&gcc GCC_OXILI_AHB_CLK>,
+                           <&gcc GCC_OXILI_GMEM_CLK>,
+                           <&gcc GCC_BIMC_GFX_CLK>,
+                           <&gcc GCC_BIMC_GPU_CLK>,
+                           <&gcc GFX3D_CLK_SRC>;
+                       power-domains = <&gcc OXILI_GDSC>;
+                       operating-points-v2 = <&gpu_opp_table>;
+                       iommus = <&gpu_iommu 1>, <&gpu_iommu 2>;
 
-                       clocks = <&gcc GCC_MSS_CFG_AHB_CLK>,
-                                <&gcc GCC_MSS_Q6_BIMC_AXI_CLK>,
-                                <&gcc GCC_BOOT_ROM_AHB_CLK>,
-                                <&xo_board>;
-                       clock-names = "iface", "bus", "mem", "xo";
+                       gpu_opp_table: opp-table {
+                               compatible = "operating-points-v2";
 
-                       qcom,smem-states = <&hexagon_smp2p_out 0>;
-                       qcom,smem-state-names = "stop";
+                               opp-400000000 {
+                                       opp-hz = /bits/ 64 <400000000>;
+                               };
+                               opp-19200000 {
+                                       opp-hz = /bits/ 64 <19200000>;
+                               };
+                       };
+               };
 
-                       resets = <&scm 0>;
-                       reset-names = "mss_restart";
+               venus: video-codec@1d00000 {
+                       compatible = "qcom,msm8916-venus";
+                       reg = <0x01d00000 0xff000>;
+                       interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+                       power-domains = <&gcc VENUS_GDSC>;
+                       clocks = <&gcc GCC_VENUS0_VCODEC0_CLK>,
+                                <&gcc GCC_VENUS0_AHB_CLK>,
+                                <&gcc GCC_VENUS0_AXI_CLK>;
+                       clock-names = "core", "iface", "bus";
+                       iommus = <&apps_iommu 5>;
+                       memory-region = <&venus_mem>;
+                       status = "okay";
 
-                       cx-supply = <&pm8916_s1>;
-                       mx-supply = <&pm8916_l3>;
-                       pll-supply = <&pm8916_l7>;
+                       video-decoder {
+                               compatible = "venus-decoder";
+                       };
 
-                       qcom,halt-regs = <&tcsr 0x18000 0x19000 0x1a000>;
+                       video-encoder {
+                               compatible = "venus-encoder";
+                       };
+               };
 
-                       status = "disabled";
+               apps_iommu: iommu@1ef0000 {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       #iommu-cells = <1>;
+                       compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1";
+                       ranges = <0 0x01e20000 0x40000>;
+                       reg = <0x01ef0000 0x3000>;
+                       clocks = <&gcc GCC_SMMU_CFG_CLK>,
+                                <&gcc GCC_APSS_TCU_CLK>;
+                       clock-names = "iface", "bus";
+                       qcom,iommu-secure-id = <17>;
 
-                       mba {
-                               memory-region = <&mba_mem>;
+                       // vfe:
+                       iommu-ctx@3000 {
+                               compatible = "qcom,msm-iommu-v1-sec";
+                               reg = <0x3000 0x1000>;
+                               interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
-                       mpss {
-                               memory-region = <&mpss_mem>;
+                       // mdp_0:
+                       iommu-ctx@4000 {
+                               compatible = "qcom,msm-iommu-v1-ns";
+                               reg = <0x4000 0x1000>;
+                               interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
-                       smd-edge {
-                               interrupts = <0 25 IRQ_TYPE_EDGE_RISING>;
-
-                               qcom,smd-edge = <0>;
-                               qcom,ipc = <&apcs 8 12>;
-                               qcom,remote-pid = <1>;
-
-                               label = "hexagon";
+                       // venus_ns:
+                       iommu-ctx@5000 {
+                               compatible = "qcom,msm-iommu-v1-sec";
+                               reg = <0x5000 0x1000>;
+                               interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
+                       };
+               };
 
-                               fastrpc {
-                                       compatible = "qcom,fastrpc";
-                                       qcom,smd-channels = "fastrpcsmd-apps-dsp";
-                                       label = "adsp";
+               gpu_iommu: iommu@1f08000 {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       #iommu-cells = <1>;
+                       compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1";
+                       ranges = <0 0x01f08000 0x10000>;
+                       clocks = <&gcc GCC_SMMU_CFG_CLK>,
+                                <&gcc GCC_GFX_TCU_CLK>;
+                       clock-names = "iface", "bus";
+                       qcom,iommu-secure-id = <18>;
 
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
+                       // gfx3d_user:
+                       iommu-ctx@1000 {
+                               compatible = "qcom,msm-iommu-v1-ns";
+                               reg = <0x1000 0x1000>;
+                               interrupts = <GIC_SPI 241 IRQ_TYPE_LEVEL_HIGH>;
+                       };
 
-                                       cb@1{
-                                               compatible = "qcom,fastrpc-compute-cb";
-                                               reg = <1>;
-                                       };
-                               };
+                       // gfx3d_priv:
+                       iommu-ctx@2000 {
+                               compatible = "qcom,msm-iommu-v1-ns";
+                               reg = <0x2000 0x1000>;
+                               interrupts = <GIC_SPI 242 IRQ_TYPE_LEVEL_HIGH>;
                        };
                };
 
-               pronto: wcnss@a21b000 {
-                       compatible = "qcom,pronto-v2-pil", "qcom,pronto";
-                       reg = <0x0a204000 0x2000>, <0x0a202000 0x1000>, <0x0a21b000 0x3000>;
-                       reg-names = "ccu", "dxe", "pmu";
+               spmi_bus: spmi@200f000 {
+                       compatible = "qcom,spmi-pmic-arb";
+                       reg = <0x0200f000 0x001000>,
+                             <0x02400000 0x400000>,
+                             <0x02c00000 0x400000>,
+                             <0x03800000 0x200000>,
+                             <0x0200a000 0x002100>;
+                       reg-names = "core", "chnls", "obsrvr", "intr", "cnfg";
+                       interrupt-names = "periph_irq";
+                       interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>;
+                       qcom,ee = <0>;
+                       qcom,channel = <0>;
+                       #address-cells = <2>;
+                       #size-cells = <0>;
+                       interrupt-controller;
+                       #interrupt-cells = <4>;
+               };
 
-                       memory-region = <&wcnss_mem>;
+               mpss: remoteproc@4080000 {
+                       compatible = "qcom,msm8916-mss-pil", "qcom,q6v5-pil";
+                       reg = <0x04080000 0x100>,
+                             <0x04020000 0x040>;
 
-                       interrupts-extended = <&intc 0 149 IRQ_TYPE_EDGE_RISING>,
-                                             <&wcnss_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
-                                             <&wcnss_smp2p_in 1 IRQ_TYPE_EDGE_RISING>,
-                                             <&wcnss_smp2p_in 2 IRQ_TYPE_EDGE_RISING>,
-                                             <&wcnss_smp2p_in 3 IRQ_TYPE_EDGE_RISING>;
-                       interrupt-names = "wdog", "fatal", "ready", "handover", "stop-ack";
+                       reg-names = "qdsp6", "rmb";
 
-                       vddmx-supply = <&pm8916_l3>;
-                       vddpx-supply = <&pm8916_l7>;
+                       interrupts-extended = <&intc GIC_SPI 24 IRQ_TYPE_EDGE_RISING>,
+                                             <&hexagon_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
+                                             <&hexagon_smp2p_in 1 IRQ_TYPE_EDGE_RISING>,
+                                             <&hexagon_smp2p_in 2 IRQ_TYPE_EDGE_RISING>,
+                                             <&hexagon_smp2p_in 3 IRQ_TYPE_EDGE_RISING>;
+                       interrupt-names = "wdog", "fatal", "ready",
+                                         "handover", "stop-ack";
 
-                       qcom,state = <&wcnss_smp2p_out 0>;
-                       qcom,state-names = "stop";
+                       clocks = <&gcc GCC_MSS_CFG_AHB_CLK>,
+                                <&gcc GCC_MSS_Q6_BIMC_AXI_CLK>,
+                                <&gcc GCC_BOOT_ROM_AHB_CLK>,
+                                <&xo_board>;
+                       clock-names = "iface", "bus", "mem", "xo";
 
-                       pinctrl-names = "default";
-                       pinctrl-0 = <&wcnss_pin_a>;
+                       qcom,smem-states = <&hexagon_smp2p_out 0>;
+                       qcom,smem-state-names = "stop";
 
-                       status = "disabled";
+                       resets = <&scm 0>;
+                       reset-names = "mss_restart";
 
-                       iris {
-                               compatible = "qcom,wcn3620";
+                       qcom,halt-regs = <&tcsr 0x18000 0x19000 0x1a000>;
 
-                               clocks = <&rpmcc RPM_SMD_RF_CLK2>;
-                               clock-names = "xo";
+                       status = "disabled";
 
-                               vddxo-supply = <&pm8916_l7>;
-                               vddrfa-supply = <&pm8916_s3>;
-                               vddpa-supply = <&pm8916_l9>;
-                               vdddig-supply = <&pm8916_l5>;
+                       mba {
+                               memory-region = <&mba_mem>;
                        };
 
-                       smd-edge {
-                               interrupts = <0 142 1>;
-
-                               qcom,ipc = <&apcs 8 17>;
-                               qcom,smd-edge = <6>;
-                               qcom,remote-pid = <4>;
-
-                               label = "pronto";
+                       mpss {
+                               memory-region = <&mpss_mem>;
+                       };
 
-                               wcnss {
-                                       compatible = "qcom,wcnss";
-                                       qcom,smd-channels = "WCNSS_CTRL";
+                       smd-edge {
+                               interrupts = <GIC_SPI 25 IRQ_TYPE_EDGE_RISING>;
 
-                                       qcom,mmio = <&pronto>;
+                               qcom,smd-edge = <0>;
+                               qcom,ipc = <&apcs 8 12>;
+                               qcom,remote-pid = <1>;
 
-                                       bt {
-                                               compatible = "qcom,wcnss-bt";
-                                       };
+                               label = "hexagon";
 
-                                       wifi {
-                                               compatible = "qcom,wcnss-wlan";
+                               fastrpc {
+                                       compatible = "qcom,fastrpc";
+                                       qcom,smd-channels = "fastrpcsmd-apps-dsp";
+                                       label = "adsp";
 
-                                               interrupts = <0 145 IRQ_TYPE_LEVEL_HIGH>,
-                                                            <0 146 IRQ_TYPE_LEVEL_HIGH>;
-                                               interrupt-names = "tx", "rx";
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
 
-                                               qcom,smem-states = <&apps_smsm 10>, <&apps_smsm 9>;
-                                               qcom,smem-state-names = "tx-enable", "tx-rings-empty";
+                                       cb@1 {
+                                               compatible = "qcom,fastrpc-compute-cb";
+                                               reg = <1>;
                                        };
                                };
                        };
                };
 
-               tpiu@820000 {
-                       compatible = "arm,coresight-tpiu", "arm,primecell";
-                       reg = <0x820000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
-                       clock-names = "apb_pclk", "atclk";
-
+               sound: sound@7702000 {
                        status = "disabled";
-
-                       in-ports {
-                               port {
-                                       tpiu_in: endpoint {
-                                               remote-endpoint = <&replicator_out1>;
-                                       };
-                               };
-                       };
+                       compatible = "qcom,apq8016-sbc-sndcard";
+                       reg = <0x07702000 0x4>, <0x07702004 0x4>;
+                       reg-names = "mic-iomux", "spkr-iomux";
                };
 
-               funnel@821000 {
-                       compatible = "arm,coresight-dynamic-funnel", "arm,primecell";
-                       reg = <0x821000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
-                       clock-names = "apb_pclk", "atclk";
-
+               lpass: audio-controller@7708000 {
                        status = "disabled";
+                       compatible = "qcom,lpass-cpu-apq8016";
+                       clocks = <&gcc GCC_ULTAUDIO_AHBFABRIC_IXFABRIC_CLK>,
+                                <&gcc GCC_ULTAUDIO_PCNOC_MPORT_CLK>,
+                                <&gcc GCC_ULTAUDIO_PCNOC_SWAY_CLK>,
+                                <&gcc GCC_ULTAUDIO_LPAIF_PRI_I2S_CLK>,
+                                <&gcc GCC_ULTAUDIO_LPAIF_SEC_I2S_CLK>,
+                                <&gcc GCC_ULTAUDIO_LPAIF_SEC_I2S_CLK>,
+                                <&gcc GCC_ULTAUDIO_LPAIF_AUX_I2S_CLK>;
 
-                       in-ports {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-
-                               /*
-                                * Not described input ports:
-                                * 0 - connected to Resource and Power Manger CPU ETM
-                                * 1 - not-connected
-                                * 2 - connected to Modem CPU ETM
-                                * 3 - not-connected
-                                * 5 - not-connected
-                                * 6 - connected trought funnel to Wireless CPU ETM
-                                * 7 - connected to STM component
-                                */
+                       clock-names = "ahbix-clk",
+                                       "pcnoc-mport-clk",
+                                       "pcnoc-sway-clk",
+                                       "mi2s-bit-clk0",
+                                       "mi2s-bit-clk1",
+                                       "mi2s-bit-clk2",
+                                       "mi2s-bit-clk3";
+                       #sound-dai-cells = <1>;
 
-                               port@4 {
-                                       reg = <4>;
-                                       funnel0_in4: endpoint {
-                                               remote-endpoint = <&funnel1_out>;
-                                       };
-                               };
-                       };
+                       interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "lpass-irq-lpaif";
+                       reg = <0x07708000 0x10000>;
+                       reg-names = "lpass-lpaif";
 
-                       out-ports {
-                               port {
-                                       funnel0_out: endpoint {
-                                               remote-endpoint = <&etf_in>;
-                                       };
-                               };
-                       };
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                };
 
-               replicator@824000 {
-                       compatible = "arm,coresight-dynamic-replicator", "arm,primecell";
-                       reg = <0x824000 0x1000>;
+               lpass_codec: audio-codec@771c000 {
+                       compatible = "qcom,msm8916-wcd-digital-codec";
+                       reg = <0x0771c000 0x400>;
+                       clocks = <&gcc GCC_ULTAUDIO_AHBFABRIC_IXFABRIC_CLK>,
+                                <&gcc GCC_CODEC_DIGCODEC_CLK>;
+                       clock-names = "ahbix-clk", "mclk";
+                       #sound-dai-cells = <1>;
+               };
 
-                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
-                       clock-names = "apb_pclk", "atclk";
+               sdhc_1: sdhci@7824000 {
+                       compatible = "qcom,sdhci-msm-v4";
+                       reg = <0x07824900 0x11c>, <0x07824000 0x800>;
+                       reg-names = "hc_mem", "core_mem";
 
+                       interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "hc_irq", "pwr_irq";
+                       clocks = <&gcc GCC_SDCC1_APPS_CLK>,
+                                <&gcc GCC_SDCC1_AHB_CLK>,
+                                <&xo_board>;
+                       clock-names = "core", "iface", "xo";
+                       mmc-ddr-1_8v;
+                       bus-width = <8>;
+                       non-removable;
                        status = "disabled";
-
-                       out-ports {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-
-                               port@0 {
-                                       reg = <0>;
-                                       replicator_out0: endpoint {
-                                               remote-endpoint = <&etr_in>;
-                                       };
-                               };
-                               port@1 {
-                                       reg = <1>;
-                                       replicator_out1: endpoint {
-                                               remote-endpoint = <&tpiu_in>;
-                                       };
-                               };
-                       };
-
-                       in-ports {
-                               port {
-                                       replicator_in: endpoint {
-                                               remote-endpoint = <&etf_out>;
-                                       };
-                               };
-                       };
                };
 
-               etf@825000 {
-                       compatible = "arm,coresight-tmc", "arm,primecell";
-                       reg = <0x825000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
-                       clock-names = "apb_pclk", "atclk";
+               sdhc_2: sdhci@7864000 {
+                       compatible = "qcom,sdhci-msm-v4";
+                       reg = <0x07864900 0x11c>, <0x07864000 0x800>;
+                       reg-names = "hc_mem", "core_mem";
 
+                       interrupts = <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "hc_irq", "pwr_irq";
+                       clocks = <&gcc GCC_SDCC2_APPS_CLK>,
+                                <&gcc GCC_SDCC2_AHB_CLK>,
+                                <&xo_board>;
+                       clock-names = "core", "iface", "xo";
+                       bus-width = <4>;
                        status = "disabled";
-
-                       in-ports {
-                               port {
-                                       etf_in: endpoint {
-                                               remote-endpoint = <&funnel0_out>;
-                                       };
-                               };
-                       };
-
-                       out-ports {
-                               port {
-                                       etf_out: endpoint {
-                                               remote-endpoint = <&replicator_in>;
-                                       };
-                               };
-                       };
                };
 
-               etr@826000 {
-                       compatible = "arm,coresight-tmc", "arm,primecell";
-                       reg = <0x826000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
-                       clock-names = "apb_pclk", "atclk";
-
-                       status = "disabled";
-
-                       in-ports {
-                               port {
-                                       etr_in: endpoint {
-                                               remote-endpoint = <&replicator_out0>;
-                                       };
-                               };
-                       };
-               };
-
-               funnel@841000 { /* APSS funnel only 4 inputs are used */
-                       compatible = "arm,coresight-dynamic-funnel", "arm,primecell";
-                       reg = <0x841000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
-                       clock-names = "apb_pclk", "atclk";
-
+               blsp_dma: dma@7884000 {
+                       compatible = "qcom,bam-v1.7.0";
+                       reg = <0x07884000 0x23000>;
+                       interrupts = <GIC_SPI 238 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_AHB_CLK>;
+                       clock-names = "bam_clk";
+                       #dma-cells = <1>;
+                       qcom,ee = <0>;
                        status = "disabled";
-
-                       in-ports {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-
-                               port@0 {
-                                       reg = <0>;
-                                       funnel1_in0: endpoint {
-                                               remote-endpoint = <&etm0_out>;
-                                       };
-                               };
-                               port@1 {
-                                       reg = <1>;
-                                       funnel1_in1: endpoint {
-                                               remote-endpoint = <&etm1_out>;
-                                       };
-                               };
-                               port@2 {
-                                       reg = <2>;
-                                       funnel1_in2: endpoint {
-                                               remote-endpoint = <&etm2_out>;
-                                       };
-                               };
-                               port@3 {
-                                       reg = <3>;
-                                       funnel1_in3: endpoint {
-                                               remote-endpoint = <&etm3_out>;
-                                       };
-                               };
-                       };
-
-                       out-ports {
-                               port {
-                                       funnel1_out: endpoint {
-                                               remote-endpoint = <&funnel0_in4>;
-                                       };
-                               };
-                       };
                };
 
-               debug@850000 {
-                       compatible = "arm,coresight-cpu-debug","arm,primecell";
-                       reg = <0x850000 0x1000>;
-                       clocks = <&rpmcc RPM_QDSS_CLK>;
-                       clock-names = "apb_pclk";
-                       cpu = <&CPU0>;
+               blsp1_uart1: serial@78af000 {
+                       compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
+                       reg = <0x078af000 0x200>;
+                       interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_UART1_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>;
+                       clock-names = "core", "iface";
+                       dmas = <&blsp_dma 1>, <&blsp_dma 0>;
+                       dma-names = "rx", "tx";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&blsp1_uart1_default>;
+                       pinctrl-1 = <&blsp1_uart1_sleep>;
                        status = "disabled";
                };
 
-               debug@852000 {
-                       compatible = "arm,coresight-cpu-debug","arm,primecell";
-                       reg = <0x852000 0x1000>;
-                       clocks = <&rpmcc RPM_QDSS_CLK>;
-                       clock-names = "apb_pclk";
-                       cpu = <&CPU1>;
+               blsp1_uart2: serial@78b0000 {
+                       compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
+                       reg = <0x078b0000 0x200>;
+                       interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_UART2_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>;
+                       clock-names = "core", "iface";
+                       dmas = <&blsp_dma 3>, <&blsp_dma 2>;
+                       dma-names = "rx", "tx";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&blsp1_uart2_default>;
+                       pinctrl-1 = <&blsp1_uart2_sleep>;
                        status = "disabled";
                };
 
-               debug@854000 {
-                       compatible = "arm,coresight-cpu-debug","arm,primecell";
-                       reg = <0x854000 0x1000>;
-                       clocks = <&rpmcc RPM_QDSS_CLK>;
-                       clock-names = "apb_pclk";
-                       cpu = <&CPU2>;
+               blsp_i2c1: i2c@78b5000 {
+                       compatible = "qcom,i2c-qup-v2.2.1";
+                       reg = <0x078b5000 0x500>;
+                       interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_AHB_CLK>,
+                                <&gcc GCC_BLSP1_QUP1_I2C_APPS_CLK>;
+                       clock-names = "iface", "core";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&i2c1_default>;
+                       pinctrl-1 = <&i2c1_sleep>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        status = "disabled";
                };
 
-               debug@856000 {
-                       compatible = "arm,coresight-cpu-debug","arm,primecell";
-                       reg = <0x856000 0x1000>;
-                       clocks = <&rpmcc RPM_QDSS_CLK>;
-                       clock-names = "apb_pclk";
-                       cpu = <&CPU3>;
+               blsp_spi1: spi@78b5000 {
+                       compatible = "qcom,spi-qup-v2.2.1";
+                       reg = <0x078b5000 0x500>;
+                       interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_QUP1_SPI_APPS_CLK>,
+                                <&gcc GCC_BLSP1_AHB_CLK>;
+                       clock-names = "core", "iface";
+                       dmas = <&blsp_dma 5>, <&blsp_dma 4>;
+                       dma-names = "rx", "tx";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&spi1_default>;
+                       pinctrl-1 = <&spi1_sleep>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        status = "disabled";
                };
 
-               etm0: etm@85c000 {
-                       compatible = "arm,coresight-etm4x", "arm,primecell";
-                       reg = <0x85c000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
-                       clock-names = "apb_pclk", "atclk";
-                       arm,coresight-loses-context-with-cpu;
-
-                       cpu = <&CPU0>;
-
+               blsp_i2c2: i2c@78b6000 {
+                       compatible = "qcom,i2c-qup-v2.2.1";
+                       reg = <0x078b6000 0x500>;
+                       interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_AHB_CLK>,
+                                <&gcc GCC_BLSP1_QUP2_I2C_APPS_CLK>;
+                       clock-names = "iface", "core";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&i2c2_default>;
+                       pinctrl-1 = <&i2c2_sleep>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        status = "disabled";
-
-                       out-ports {
-                               port {
-                                       etm0_out: endpoint {
-                                               remote-endpoint = <&funnel1_in0>;
-                                       };
-                               };
-                       };
                };
 
-               etm1: etm@85d000 {
-                       compatible = "arm,coresight-etm4x", "arm,primecell";
-                       reg = <0x85d000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
-                       clock-names = "apb_pclk", "atclk";
-                       arm,coresight-loses-context-with-cpu;
-
-                       cpu = <&CPU1>;
-
+               blsp_spi2: spi@78b6000 {
+                       compatible = "qcom,spi-qup-v2.2.1";
+                       reg = <0x078b6000 0x500>;
+                       interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_QUP2_SPI_APPS_CLK>,
+                                <&gcc GCC_BLSP1_AHB_CLK>;
+                       clock-names = "core", "iface";
+                       dmas = <&blsp_dma 7>, <&blsp_dma 6>;
+                       dma-names = "rx", "tx";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&spi2_default>;
+                       pinctrl-1 = <&spi2_sleep>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        status = "disabled";
-
-                       out-ports {
-                               port {
-                                       etm1_out: endpoint {
-                                               remote-endpoint = <&funnel1_in1>;
-                                       };
-                               };
-                       };
                };
 
-               etm2: etm@85e000 {
-                       compatible = "arm,coresight-etm4x", "arm,primecell";
-                       reg = <0x85e000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
-                       clock-names = "apb_pclk", "atclk";
-                       arm,coresight-loses-context-with-cpu;
-
-                       cpu = <&CPU2>;
-
+               blsp_spi3: spi@78b7000 {
+                       compatible = "qcom,spi-qup-v2.2.1";
+                       reg = <0x078b7000 0x500>;
+                       interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_QUP3_SPI_APPS_CLK>,
+                                <&gcc GCC_BLSP1_AHB_CLK>;
+                       clock-names = "core", "iface";
+                       dmas = <&blsp_dma 9>, <&blsp_dma 8>;
+                       dma-names = "rx", "tx";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&spi3_default>;
+                       pinctrl-1 = <&spi3_sleep>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        status = "disabled";
-
-                       out-ports {
-                               port {
-                                       etm2_out: endpoint {
-                                               remote-endpoint = <&funnel1_in2>;
-                                       };
-                               };
-                       };
                };
 
-               etm3: etm@85f000 {
-                       compatible = "arm,coresight-etm4x", "arm,primecell";
-                       reg = <0x85f000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>;
-                       clock-names = "apb_pclk", "atclk";
-                       arm,coresight-loses-context-with-cpu;
-
-                       cpu = <&CPU3>;
-
+               blsp_i2c4: i2c@78b8000 {
+                       compatible = "qcom,i2c-qup-v2.2.1";
+                       reg = <0x078b8000 0x500>;
+                       interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_AHB_CLK>,
+                                <&gcc GCC_BLSP1_QUP4_I2C_APPS_CLK>;
+                       clock-names = "iface", "core";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&i2c4_default>;
+                       pinctrl-1 = <&i2c4_sleep>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        status = "disabled";
-
-                       out-ports {
-                               port {
-                                       etm3_out: endpoint {
-                                               remote-endpoint = <&funnel1_in3>;
-                                       };
-                               };
-                       };
                };
 
-               /* System CTIs */
-               /* CTI 0 - TMC connections */
-               cti@810000 {
-                       compatible = "arm,coresight-cti", "arm,primecell";
-                       reg = <0x810000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>;
-                       clock-names = "apb_pclk";
-
+               blsp_spi4: spi@78b8000 {
+                       compatible = "qcom,spi-qup-v2.2.1";
+                       reg = <0x078b8000 0x500>;
+                       interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_QUP4_SPI_APPS_CLK>,
+                                <&gcc GCC_BLSP1_AHB_CLK>;
+                       clock-names = "core", "iface";
+                       dmas = <&blsp_dma 11>, <&blsp_dma 10>;
+                       dma-names = "rx", "tx";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&spi4_default>;
+                       pinctrl-1 = <&spi4_sleep>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        status = "disabled";
                };
 
-               /* CTI 1 - TPIU connections */
-               cti@811000 {
-                       compatible = "arm,coresight-cti", "arm,primecell";
-                       reg = <0x811000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>;
-                       clock-names = "apb_pclk";
-
+               blsp_i2c5: i2c@78b9000 {
+                       compatible = "qcom,i2c-qup-v2.2.1";
+                       reg = <0x078b9000 0x500>;
+                       interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_AHB_CLK>,
+                                <&gcc GCC_BLSP1_QUP5_I2C_APPS_CLK>;
+                       clock-names = "iface", "core";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&i2c5_default>;
+                       pinctrl-1 = <&i2c5_sleep>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        status = "disabled";
                };
 
-               /* CTIs 2-11 - no information - not instantiated */
-
-               /* Core CTIs; CTIs 12-15 */
-               /* CTI - CPU-0 */
-               cti@858000 {
-                       compatible = "arm,coresight-cti-v8-arch", "arm,coresight-cti",
-                                    "arm,primecell";
-                       reg = <0x858000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>;
-                       clock-names = "apb_pclk";
-
-                       cpu = <&CPU0>;
-                       arm,cs-dev-assoc = <&etm0>;
-
+               blsp_spi5: spi@78b9000 {
+                       compatible = "qcom,spi-qup-v2.2.1";
+                       reg = <0x078b9000 0x500>;
+                       interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_QUP5_SPI_APPS_CLK>,
+                                <&gcc GCC_BLSP1_AHB_CLK>;
+                       clock-names = "core", "iface";
+                       dmas = <&blsp_dma 13>, <&blsp_dma 12>;
+                       dma-names = "rx", "tx";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&spi5_default>;
+                       pinctrl-1 = <&spi5_sleep>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        status = "disabled";
                };
 
-               /* CTI - CPU-1 */
-               cti@859000 {
-                       compatible = "arm,coresight-cti-v8-arch", "arm,coresight-cti",
-                                    "arm,primecell";
-                       reg = <0x859000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>;
-                       clock-names = "apb_pclk";
-
-                       cpu = <&CPU1>;
-                       arm,cs-dev-assoc = <&etm1>;
-
+               blsp_i2c6: i2c@78ba000 {
+                       compatible = "qcom,i2c-qup-v2.2.1";
+                       reg = <0x078ba000 0x500>;
+                       interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_AHB_CLK>,
+                                <&gcc GCC_BLSP1_QUP6_I2C_APPS_CLK>;
+                       clock-names = "iface", "core";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&i2c6_default>;
+                       pinctrl-1 = <&i2c6_sleep>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        status = "disabled";
                };
 
-               /* CTI - CPU-2 */
-               cti@85a000 {
-                       compatible = "arm,coresight-cti-v8-arch", "arm,coresight-cti",
-                                    "arm,primecell";
-                       reg = <0x85a000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>;
-                       clock-names = "apb_pclk";
-
-                       cpu = <&CPU2>;
-                       arm,cs-dev-assoc = <&etm2>;
-
+               blsp_spi6: spi@78ba000 {
+                       compatible = "qcom,spi-qup-v2.2.1";
+                       reg = <0x078ba000 0x500>;
+                       interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_BLSP1_QUP6_SPI_APPS_CLK>,
+                                <&gcc GCC_BLSP1_AHB_CLK>;
+                       clock-names = "core", "iface";
+                       dmas = <&blsp_dma 15>, <&blsp_dma 14>;
+                       dma-names = "rx", "tx";
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&spi6_default>;
+                       pinctrl-1 = <&spi6_sleep>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        status = "disabled";
                };
 
-               /* CTI - CPU-3 */
-               cti@85b000 {
-                       compatible = "arm,coresight-cti-v8-arch", "arm,coresight-cti",
-                                    "arm,primecell";
-                       reg = <0x85b000 0x1000>;
-
-                       clocks = <&rpmcc RPM_QDSS_CLK>;
-                       clock-names = "apb_pclk";
-
-                       cpu = <&CPU3>;
-                       arm,cs-dev-assoc = <&etm3>;
-
+               usb: usb@78d9000 {
+                       compatible = "qcom,ci-hdrc";
+                       reg = <0x078d9000 0x200>,
+                             <0x078d9200 0x200>;
+                       interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&gcc GCC_USB_HS_AHB_CLK>,
+                                <&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";
+                       hnp-disable;
+                       srp-disable;
+                       adp-disable;
+                       ahb-burst-config = <0>;
+                       phy-names = "usb-phy";
+                       phys = <&usb_hs_phy>;
                        status = "disabled";
-               };
-
-
-               venus: video-codec@1d00000 {
-                       compatible = "qcom,msm8916-venus";
-                       reg = <0x01d00000 0xff000>;
-                       interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
-                       power-domains = <&gcc VENUS_GDSC>;
-                       clocks = <&gcc GCC_VENUS0_VCODEC0_CLK>,
-                                <&gcc GCC_VENUS0_AHB_CLK>,
-                                <&gcc GCC_VENUS0_AXI_CLK>;
-                       clock-names = "core", "iface", "bus";
-                       iommus = <&apps_iommu 5>;
-                       memory-region = <&venus_mem>;
-                       status = "okay";
-
-                       video-decoder {
-                               compatible = "venus-decoder";
-                       };
+                       #reset-cells = <1>;
 
-                       video-encoder {
-                               compatible = "venus-encoder";
+                       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>, <&usb 0>;
+                                       reset-names = "phy", "por";
+                                       qcom,init-seq = /bits/ 8 <0x0 0x44
+                                               0x1 0x6b 0x2 0x24 0x3 0x13>;
+                               };
                        };
                };
 
-               camss: camss@1b00000 {
-                       compatible = "qcom,msm8916-camss";
-                       reg = <0x1b0ac00 0x200>,
-                               <0x1b00030 0x4>,
-                               <0x1b0b000 0x200>,
-                               <0x1b00038 0x4>,
-                               <0x1b08000 0x100>,
-                               <0x1b08400 0x100>,
-                               <0x1b0a000 0x500>,
-                               <0x1b00020 0x10>,
-                               <0x1b10000 0x1000>;
-                       reg-names = "csiphy0",
-                               "csiphy0_clk_mux",
-                               "csiphy1",
-                               "csiphy1_clk_mux",
-                               "csid0",
-                               "csid1",
-                               "ispif",
-                               "csi_clk_mux",
-                               "vfe0";
-                       interrupts = <GIC_SPI 78 IRQ_TYPE_EDGE_RISING>,
-                               <GIC_SPI 79 IRQ_TYPE_EDGE_RISING>,
-                               <GIC_SPI 51 IRQ_TYPE_EDGE_RISING>,
-                               <GIC_SPI 52 IRQ_TYPE_EDGE_RISING>,
-                               <GIC_SPI 55 IRQ_TYPE_EDGE_RISING>,
-                               <GIC_SPI 57 IRQ_TYPE_EDGE_RISING>;
-                       interrupt-names = "csiphy0",
-                               "csiphy1",
-                               "csid0",
-                               "csid1",
-                               "ispif",
-                               "vfe0";
-                       power-domains = <&gcc VFE_GDSC>;
-                       clocks = <&gcc GCC_CAMSS_TOP_AHB_CLK>,
-                               <&gcc GCC_CAMSS_ISPIF_AHB_CLK>,
-                               <&gcc GCC_CAMSS_CSI0PHYTIMER_CLK>,
-                               <&gcc GCC_CAMSS_CSI1PHYTIMER_CLK>,
-                               <&gcc GCC_CAMSS_CSI0_AHB_CLK>,
-                               <&gcc GCC_CAMSS_CSI0_CLK>,
-                               <&gcc GCC_CAMSS_CSI0PHY_CLK>,
-                               <&gcc GCC_CAMSS_CSI0PIX_CLK>,
-                               <&gcc GCC_CAMSS_CSI0RDI_CLK>,
-                               <&gcc GCC_CAMSS_CSI1_AHB_CLK>,
-                               <&gcc GCC_CAMSS_CSI1_CLK>,
-                               <&gcc GCC_CAMSS_CSI1PHY_CLK>,
-                               <&gcc GCC_CAMSS_CSI1PIX_CLK>,
-                               <&gcc GCC_CAMSS_CSI1RDI_CLK>,
-                               <&gcc GCC_CAMSS_AHB_CLK>,
-                               <&gcc GCC_CAMSS_VFE0_CLK>,
-                               <&gcc GCC_CAMSS_CSI_VFE0_CLK>,
-                               <&gcc GCC_CAMSS_VFE_AHB_CLK>,
-                               <&gcc GCC_CAMSS_VFE_AXI_CLK>;
-                       clock-names = "top_ahb",
-                               "ispif_ahb",
-                               "csiphy0_timer",
-                               "csiphy1_timer",
-                               "csi0_ahb",
-                               "csi0",
-                               "csi0_phy",
-                               "csi0_pix",
-                               "csi0_rdi",
-                               "csi1_ahb",
-                               "csi1",
-                               "csi1_phy",
-                               "csi1_pix",
-                               "csi1_rdi",
-                               "ahb",
-                               "vfe0",
-                               "csi_vfe0",
-                               "vfe_ahb",
-                               "vfe_axi";
-                       vdda-supply = <&pm8916_l2>;
-                       iommus = <&apps_iommu 3>;
-                       status = "disabled";
-                       ports {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                       };
-               };
+               pronto: remoteproc@a21b000 {
+                       compatible = "qcom,pronto-v2-pil", "qcom,pronto";
+                       reg = <0x0a204000 0x2000>, <0x0a202000 0x1000>, <0x0a21b000 0x3000>;
+                       reg-names = "ccu", "dxe", "pmu";
+
+                       memory-region = <&wcnss_mem>;
+
+                       interrupts-extended = <&intc GIC_SPI 149 IRQ_TYPE_EDGE_RISING>,
+                                             <&wcnss_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
+                                             <&wcnss_smp2p_in 1 IRQ_TYPE_EDGE_RISING>,
+                                             <&wcnss_smp2p_in 2 IRQ_TYPE_EDGE_RISING>,
+                                             <&wcnss_smp2p_in 3 IRQ_TYPE_EDGE_RISING>;
+                       interrupt-names = "wdog", "fatal", "ready", "handover", "stop-ack";
+
+                       qcom,state = <&wcnss_smp2p_out 0>;
+                       qcom,state-names = "stop";
 
-               cci: cci@1b0c000 {
-                       compatible = "qcom,msm8916-cci";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       reg = <0x1b0c000 0x1000>;
-                       interrupts = <GIC_SPI 50 IRQ_TYPE_EDGE_RISING>;
-                       clocks = <&gcc GCC_CAMSS_TOP_AHB_CLK>,
-                               <&gcc GCC_CAMSS_CCI_AHB_CLK>,
-                               <&gcc GCC_CAMSS_CCI_CLK>,
-                               <&gcc GCC_CAMSS_AHB_CLK>;
-                       clock-names = "camss_top_ahb", "cci_ahb",
-                                         "cci", "camss_ahb";
-                       assigned-clocks = <&gcc GCC_CAMSS_CCI_AHB_CLK>,
-                                         <&gcc GCC_CAMSS_CCI_CLK>;
-                       assigned-clock-rates = <80000000>, <19200000>;
                        pinctrl-names = "default";
-                       pinctrl-0 = <&cci0_default>;
+                       pinctrl-0 = <&wcnss_pin_a>;
+
                        status = "disabled";
 
-                       cci_i2c0: i2c-bus@0 {
-                               reg = <0>;
-                               clock-frequency = <400000>;
-                               #address-cells = <1>;
-                               #size-cells = <0>;
+                       iris {
+                               compatible = "qcom,wcn3620";
+
+                               clocks = <&rpmcc RPM_SMD_RF_CLK2>;
+                               clock-names = "xo";
                        };
-               };
-       };
 
-       smd {
-               compatible = "qcom,smd";
+                       smd-edge {
+                               interrupts = <GIC_SPI 142 IRQ_TYPE_EDGE_RISING>;
 
-               rpm {
-                       interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-                       qcom,ipc = <&apcs 8 0>;
-                       qcom,smd-edge = <15>;
+                               qcom,ipc = <&apcs 8 17>;
+                               qcom,smd-edge = <6>;
+                               qcom,remote-pid = <4>;
 
-                       rpm-requests {
-                               compatible = "qcom,rpm-msm8916";
-                               qcom,smd-channels = "rpm_requests";
+                               label = "pronto";
 
-                               rpmcc: qcom,rpmcc {
-                                       compatible = "qcom,rpmcc-msm8916";
-                                       #clock-cells = <1>;
-                               };
+                               wcnss {
+                                       compatible = "qcom,wcnss";
+                                       qcom,smd-channels = "WCNSS_CTRL";
+
+                                       qcom,mmio = <&pronto>;
+
+                                       bt {
+                                               compatible = "qcom,wcnss-bt";
+                                       };
+
+                                       wifi {
+                                               compatible = "qcom,wcnss-wlan";
+
+                                               interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>,
+                                                            <GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>;
+                                               interrupt-names = "tx", "rx";
 
-                               smd_rpm_regulators: pm8916-regulators {
-                                       compatible = "qcom,rpm-pm8916-regulators";
-
-                                       pm8916_s1: s1 {};
-                                       pm8916_s3: s3 {};
-                                       pm8916_s4: s4 {};
-
-                                       pm8916_l1: l1 {};
-                                       pm8916_l2: l2 {};
-                                       pm8916_l3: l3 {};
-                                       pm8916_l4: l4 {};
-                                       pm8916_l5: l5 {};
-                                       pm8916_l6: l6 {};
-                                       pm8916_l7: l7 {};
-                                       pm8916_l8: l8 {};
-                                       pm8916_l9: l9 {};
-                                       pm8916_l10: l10 {};
-                                       pm8916_l11: l11 {};
-                                       pm8916_l12: l12 {};
-                                       pm8916_l13: l13 {};
-                                       pm8916_l14: l14 {};
-                                       pm8916_l15: l15 {};
-                                       pm8916_l16: l16 {};
-                                       pm8916_l17: l17 {};
-                                       pm8916_l18: l18 {};
+                                               qcom,smem-states = <&apps_smsm 10>, <&apps_smsm 9>;
+                                               qcom,smem-state-names = "tx-enable", "tx-rings-empty";
+                                       };
                                };
                        };
                };
-       };
 
-       hexagon-smp2p {
-               compatible = "qcom,smp2p";
-               qcom,smem = <435>, <428>;
+               intc: interrupt-controller@b000000 {
+                       compatible = "qcom,msm-qgic2";
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
+                       reg = <0x0b000000 0x1000>, <0x0b002000 0x1000>;
+               };
+
+               apcs: mailbox@b011000 {
+                       compatible = "qcom,msm8916-apcs-kpss-global", "syscon";
+                       reg = <0x0b011000 0x1000>;
+                       #mbox-cells = <1>;
+                       clocks = <&a53pll>, <&gcc GPLL0_VOTE>;
+                       clock-names = "pll", "aux";
+                       #clock-cells = <0>;
+               };
 
-               interrupts = <0 27 IRQ_TYPE_EDGE_RISING>;
+               a53pll: clock@b016000 {
+                       compatible = "qcom,msm8916-a53pll";
+                       reg = <0x0b016000 0x40>;
+                       #clock-cells = <0>;
+               };
 
-               qcom,ipc = <&apcs 8 14>;
+               timer@b020000 {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+                       compatible = "arm,armv7-timer-mem";
+                       reg = <0x0b020000 0x1000>;
+                       clock-frequency = <19200000>;
 
-               qcom,local-pid = <0>;
-               qcom,remote-pid = <1>;
+                       frame@b021000 {
+                               frame-number = <0>;
+                               interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
+                                            <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+                               reg = <0x0b021000 0x1000>,
+                                     <0x0b022000 0x1000>;
+                       };
 
-               hexagon_smp2p_out: master-kernel {
-                       qcom,entry-name = "master-kernel";
+                       frame@b023000 {
+                               frame-number = <1>;
+                               interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+                               reg = <0x0b023000 0x1000>;
+                               status = "disabled";
+                       };
 
-                       #qcom,smem-state-cells = <1>;
-               };
+                       frame@b024000 {
+                               frame-number = <2>;
+                               interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
+                               reg = <0x0b024000 0x1000>;
+                               status = "disabled";
+                       };
 
-               hexagon_smp2p_in: slave-kernel {
-                       qcom,entry-name = "slave-kernel";
+                       frame@b025000 {
+                               frame-number = <3>;
+                               interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+                               reg = <0x0b025000 0x1000>;
+                               status = "disabled";
+                       };
 
-                       interrupt-controller;
-                       #interrupt-cells = <2>;
+                       frame@b026000 {
+                               frame-number = <4>;
+                               interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+                               reg = <0x0b026000 0x1000>;
+                               status = "disabled";
+                       };
+
+                       frame@b027000 {
+                               frame-number = <5>;
+                               interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
+                               reg = <0x0b027000 0x1000>;
+                               status = "disabled";
+                       };
+
+                       frame@b028000 {
+                               frame-number = <6>;
+                               interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
+                               reg = <0x0b028000 0x1000>;
+                               status = "disabled";
+                       };
                };
        };
 
-       wcnss-smp2p {
-               compatible = "qcom,smp2p";
-               qcom,smem = <451>, <431>;
+       thermal-zones {
+               cpu0-1-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
 
-               interrupts = <0 143 IRQ_TYPE_EDGE_RISING>;
+                       thermal-sensors = <&tsens 5>;
 
-               qcom,ipc = <&apcs 8 18>;
+                       trips {
+                               cpu0_1_alert0: trip-point0 {
+                                       temperature = <75000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+                               cpu0_1_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
 
-               qcom,local-pid = <0>;
-               qcom,remote-pid = <4>;
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu0_1_alert0>;
+                                       cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
 
-               wcnss_smp2p_out: master-kernel {
-                       qcom,entry-name = "master-kernel";
+               cpu2-3-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
 
-                       #qcom,smem-state-cells = <1>;
-               };
+                       thermal-sensors = <&tsens 4>;
 
-               wcnss_smp2p_in: slave-kernel {
-                       qcom,entry-name = "slave-kernel";
+                       trips {
+                               cpu2_3_alert0: trip-point0 {
+                                       temperature = <75000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+                               cpu2_3_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
 
-                       interrupt-controller;
-                       #interrupt-cells = <2>;
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu2_3_alert0>;
+                                       cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
                };
-       };
 
-       smsm {
-               compatible = "qcom,smsm";
+               gpu-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
 
-               #address-cells = <1>;
-               #size-cells = <0>;
+                       thermal-sensors = <&tsens 2>;
 
-               qcom,ipc-1 = <&apcs 8 13>;
-               qcom,ipc-3 = <&apcs 8 19>;
+                       trips {
+                               gpu_alert0: trip-point0 {
+                                       temperature = <75000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+                               gpu_crit: gpu_crit {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+               };
 
-               apps_smsm: apps@0 {
-                       reg = <0>;
+               camera-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
 
-                       #qcom,smem-state-cells = <1>;
+                       thermal-sensors = <&tsens 1>;
+
+                       trips {
+                               cam_alert0: trip-point0 {
+                                       temperature = <75000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
                };
 
-               hexagon_smsm: hexagon@1 {
-                       reg = <1>;
-                       interrupts = <0 26 IRQ_TYPE_EDGE_RISING>;
+               modem-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
 
-                       interrupt-controller;
-                       #interrupt-cells = <2>;
+                       thermal-sensors = <&tsens 0>;
+
+                       trips {
+                               modem_alert0: trip-point0 {
+                                       temperature = <85000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
                };
 
-               wcnss_smsm: wcnss@6 {
-                       reg = <6>;
-                       interrupts = <0 144 IRQ_TYPE_EDGE_RISING>;
+       };
 
-                       interrupt-controller;
-                       #interrupt-cells = <2>;
-               };
+       timer {
+               compatible = "arm,armv8-timer";
+               interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 3 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 4 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 1 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
        };
 };
 
index 188fff2..8626b3a 100644 (file)
                blsp2_uart2: serial@f995e000 {
                        compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
                        reg = <0xf995e000 0x1000>;
-                       interrupt = <GIC_SPI 146 IRQ_TYPE_LEVEL_LOW>;
+                       interrupts = <GIC_SPI 146 IRQ_TYPE_LEVEL_LOW>;
                        clock-names = "core", "iface";
                        clocks = <&gcc GCC_BLSP2_UART2_APPS_CLK>,
                                <&gcc GCC_BLSP2_AHB_CLK>;
index 4032b74..791f254 100644 (file)
 };
 
 &sdhc1 {
-       status = "okay";
+       /* There is an issue with the eMMC causing permanent
+        * damage to the card if a quirk isn't addressed.
+        * Until it's fixed, disable the MMC so as not to brick
+        * devices.
+        */
+       status = "disabled";
 
        /* Downstream pushes 2.95V to the sdhci device,
         * but upstream driver REALLY wants to make vmmc 1.8v
index 9951286..fd6ae54 100644 (file)
                                "ispif",
                                "vfe0",
                                "vfe1";
-                       power-domains = <&mmcc VFE0_GDSC>;
+                       power-domains = <&mmcc VFE0_GDSC>,
+                                       <&mmcc VFE1_GDSC>;
                        clocks = <&mmcc CAMSS_TOP_AHB_CLK>,
                                <&mmcc CAMSS_ISPIF_AHB_CLK>,
                                <&mmcc CAMSS_CSI0PHYTIMER_CLK>,
index ea0e955..2e6a6f6 100644 (file)
@@ -44,7 +44,7 @@
                        gpio-ranges = <&pm660_gpios 0 0 13>;
                        #gpio-cells = <2>;
                        interrupt-controller;
-                       interrupt-cells =<2>;
+                       #interrupt-cells = <2>;
                };
        };
 };
index 0bcdf04..f931cb0 100644 (file)
@@ -1,24 +1,17 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <dt-bindings/iio/qcom,spmi-vadc.h>
-#include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/spmi/spmi.h>
 
 &spmi_bus {
 
-       pm8916_0: pm8916@0 {
+       pm8916_0: pmic@0 {
                compatible = "qcom,pm8916", "qcom,spmi-pmic";
                reg = <0x0 SPMI_USID>;
                #address-cells = <1>;
                #size-cells = <0>;
 
-               rtc@6000 {
-                       compatible = "qcom,pm8941-rtc";
-                       reg = <0x6000>;
-                       reg-names = "rtc", "alarm";
-                       interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
-               };
-
                pon@800 {
                        compatible = "qcom,pm8916-pon";
                        reg = <0x800>;
                                linux,code = <KEY_POWER>;
                        };
 
+                       pm8916_resin: resin {
+                               compatible = "qcom,pm8941-resin";
+                               interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
+                               debounce = <15625>;
+                               bias-pull-up;
+                               status = "disabled";
+                       };
+
                        watchdog {
                                compatible = "qcom,pm8916-wdt";
                                interrupts = <0x0 0x8 6 IRQ_TYPE_EDGE_RISING>;
                        };
                };
 
-               pm8916_gpios: gpios@c000 {
-                       compatible = "qcom,pm8916-gpio";
-                       reg = <0xc000>;
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       interrupts = <0 0xc0 0 IRQ_TYPE_NONE>,
-                                    <0 0xc1 0 IRQ_TYPE_NONE>,
-                                    <0 0xc2 0 IRQ_TYPE_NONE>,
-                                    <0 0xc3 0 IRQ_TYPE_NONE>;
-               };
-
-               pm8916_mpps: mpps@a000 {
-                       compatible = "qcom,pm8916-mpp";
-                       reg = <0xa000>;
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       interrupts = <0 0xa0 0 IRQ_TYPE_NONE>,
-                                    <0 0xa1 0 IRQ_TYPE_NONE>,
-                                    <0 0xa2 0 IRQ_TYPE_NONE>,
-                                    <0 0xa3 0 IRQ_TYPE_NONE>;
-               };
-
                pm8916_temp: temp-alarm@2400 {
                        compatible = "qcom,spmi-temp-alarm";
                        reg = <0x2400>;
@@ -71,7 +50,7 @@
                        #thermal-sensor-cells = <0>;
                };
 
-               pm8916_vadc: vadc@3100 {
+               pm8916_vadc: adc@3100 {
                        compatible = "qcom,spmi-vadc";
                        reg = <0x3100>;
                        interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
                        #size-cells = <0>;
                        #io-channel-cells = <1>;
 
-                       usb_in {
+                       adc-chan@0 {
                                reg = <VADC_USBIN>;
                                qcom,pre-scaling = <1 10>;
                        };
-                       vph_pwr {
+                       adc-chan@7 {
                                reg = <VADC_VSYS>;
                                qcom,pre-scaling = <1 3>;
                        };
-                       die_temp {
+                       adc-chan@8 {
                                reg = <VADC_DIE_TEMP>;
                        };
-                       ref_625mv {
+                       adc-chan@9 {
                                reg = <VADC_REF_625MV>;
                        };
-                       ref_1250v {
+                       adc-chan@a {
                                reg = <VADC_REF_1250MV>;
                        };
-                       ref_gnd {
+                       adc-chan@e {
                                reg = <VADC_GND_REF>;
                        };
-                       ref_vdd {
+                       adc-chan@f {
                                reg = <VADC_VDD_VADC>;
                        };
                };
+
+               rtc@6000 {
+                       compatible = "qcom,pm8941-rtc";
+                       reg = <0x6000>;
+                       reg-names = "rtc", "alarm";
+                       interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
+               };
+
+               pm8916_mpps: mpps@a000 {
+                       compatible = "qcom,pm8916-mpp";
+                       reg = <0xa000>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupts = <0 0xa0 0 IRQ_TYPE_NONE>,
+                                    <0 0xa1 0 IRQ_TYPE_NONE>,
+                                    <0 0xa2 0 IRQ_TYPE_NONE>,
+                                    <0 0xa3 0 IRQ_TYPE_NONE>;
+               };
+
+               pm8916_gpios: gpios@c000 {
+                       compatible = "qcom,pm8916-gpio";
+                       reg = <0xc000>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupts = <0 0xc0 0 IRQ_TYPE_NONE>,
+                                    <0 0xc1 0 IRQ_TYPE_NONE>,
+                                    <0 0xc2 0 IRQ_TYPE_NONE>,
+                                    <0 0xc3 0 IRQ_TYPE_NONE>;
+               };
        };
 
-       pm8916_1: pm8916@1 {
+       pm8916_1: pmic@1 {
                compatible = "qcom,pm8916", "qcom,spmi-pmic";
                reg = <0x1 SPMI_USID>;
                #address-cells = <1>;
                        status = "disabled";
                };
 
-               wcd_codec: codec@f000 {
+               wcd_codec: audio-codec@f000 {
                        compatible = "qcom,pm8916-wcd-analog-codec";
-                       reg = <0xf000 0x200>;
+                       reg = <0xf000>;
                        reg-names = "pmic-codec-core";
                        clocks = <&gcc GCC_CODEC_DIGCODEC_CLK>;
                        clock-names = "mclk";
index 479ad3a..08d5d51 100644 (file)
@@ -13,7 +13,7 @@
 };
 
 &ethernet {
-       status = "ok";
+       status = "okay";
 
        snps,reset-gpio = <&tlmm 60 GPIO_ACTIVE_LOW>;
        snps,reset-active-low;
index 6422cf9..a80c578 100644 (file)
@@ -97,7 +97,7 @@
 };
 
 &pcie {
-       status = "ok";
+       status = "okay";
 
        perst-gpio = <&tlmm 43 GPIO_ACTIVE_LOW>;
 
 };
 
 &pcie_phy {
-       status = "ok";
+       status = "okay";
 
        vdda-vp-supply = <&vreg_l3_1p05>;
        vdda-vph-supply = <&vreg_l5_1p8>;
 };
 
 &remoteproc_adsp {
-       status = "ok";
+       status = "okay";
 };
 
 &remoteproc_cdsp {
-       status = "ok";
+       status = "okay";
 };
 
 &remoteproc_wcss {
-       status = "ok";
+       status = "okay";
 };
 
 &rpm_requests {
 };
 
 &sdcc1 {
-       status = "ok";
+       status = "okay";
 
        supports-cqe;
        mmc-ddr-1_8v;
diff --git a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
new file mode 100644 (file)
index 0000000..1528a86
--- /dev/null
@@ -0,0 +1,686 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Copyright (c) 2020, Linaro Ltd.
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
+#include "sm8250.dtsi"
+#include "pm8150.dtsi"
+#include "pm8150b.dtsi"
+#include "pm8150l.dtsi"
+
+/ {
+       model = "Qualcomm Technologies, Inc. Robotics RB5";
+       compatible = "qcom,qrb5165-rb5", "qcom,sm8250";
+
+       aliases {
+               serial0 = &uart12;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       dc12v: dc12v-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "DC12V";
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+               regulator-always-on;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               user4 {
+                       label = "green:user4";
+                       gpios = <&pm8150_gpios 10 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "panic-indicator";
+                       default-state = "off";
+               };
+
+               wlan {
+                       label = "yellow:wlan";
+                       gpios = <&pm8150_gpios 9 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "phy0tx";
+                       default-state = "off";
+               };
+
+               bt {
+                       label = "blue:bt";
+                       gpios = <&pm8150_gpios 7 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "bluetooth-power";
+                       default-state = "off";
+               };
+
+       };
+
+       vbat: vbat-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "VBAT";
+               vin-supply = <&vreg_l11c_3p3>;
+               regulator-min-microvolt = <4200000>;
+               regulator-max-microvolt = <4200000>;
+               regulator-always-on;
+       };
+
+       vbat_som: vbat-som-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "VBAT_SOM";
+               vin-supply = <&dc12v>;
+               regulator-min-microvolt = <4200000>;
+               regulator-max-microvolt = <4200000>;
+               regulator-always-on;
+       };
+
+       vdc_3v3: vdc-3v3-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "VDC_3V3";
+               vin-supply = <&dc12v>;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       vdc_5v: vdc-5v-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "VDC_5V";
+
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+               vin-supply = <&vreg_l11c_3p3>;
+       };
+
+       vph_pwr: vph-pwr-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "vph_pwr";
+               regulator-min-microvolt = <3700000>;
+               regulator-max-microvolt = <3700000>;
+               regulator-always-on;
+       };
+
+       vreg_s4a_1p8: vreg-s4a-1p8 {
+               compatible = "regulator-fixed";
+               regulator-name = "vreg_s4a_1p8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-always-on;
+       };
+};
+
+&apps_rsc {
+       pm8009-rpmh-regulators {
+               compatible = "qcom,pm8009-rpmh-regulators";
+               qcom,pmic-id = "f";
+
+               vdd-s1-supply = <&vph_pwr>;
+               vdd-s2-supply = <&vph_pwr>;
+               vdd-l2-supply = <&vreg_s8c_1p3>;
+               vdd-l5-l6-supply = <&vreg_bob>;
+               vdd-l7-supply = <&vreg_s4a_1p8>;
+
+               vreg_l1f_1p1: ldo1 {
+                       regulator-name = "vreg_l1f_1p1";
+                       regulator-min-microvolt = <1104000>;
+                       regulator-max-microvolt = <1104000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l2f_1p2: ldo2 {
+                       regulator-name = "vreg_l2f_1p2";
+                       regulator-min-microvolt = <1200000>;
+                       regulator-max-microvolt = <1200000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l6f_2p8: ldo6 {
+                       regulator-name = "vreg_l6f_2p8";
+                       regulator-min-microvolt = <2800000>;
+                       regulator-max-microvolt = <2800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l7f_1p8: ldo7 {
+                       regulator-name = "vreg_l7f_1p8";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+       };
+
+       pm8150-rpmh-regulators {
+               compatible = "qcom,pm8150-rpmh-regulators";
+               qcom,pmic-id = "a";
+
+               vdd-s1-supply = <&vph_pwr>;
+               vdd-s2-supply = <&vph_pwr>;
+               vdd-s3-supply = <&vph_pwr>;
+               vdd-s4-supply = <&vph_pwr>;
+               vdd-s5-supply = <&vph_pwr>;
+               vdd-s6-supply = <&vph_pwr>;
+               vdd-s7-supply = <&vph_pwr>;
+               vdd-s8-supply = <&vph_pwr>;
+               vdd-s9-supply = <&vph_pwr>;
+               vdd-s10-supply = <&vph_pwr>;
+               vdd-l2-l10-supply = <&vreg_bob>;
+               vdd-l3-l4-l5-l18-supply = <&vreg_s6a_0p95>;
+               vdd-l6-l9-supply = <&vreg_s8c_1p3>;
+               vdd-l7-l12-l14-l15-supply = <&vreg_s5a_1p9>;
+               vdd-l13-l16-l17-supply = <&vreg_bob>;
+
+               vreg_l2a_3p1: ldo2 {
+                       regulator-name = "vreg_l2a_3p1";
+                       regulator-min-microvolt = <3072000>;
+                       regulator-max-microvolt = <3072000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l3a_0p9: ldo3 {
+                       regulator-name = "vreg_l3a_0p9";
+                       regulator-min-microvolt = <928000>;
+                       regulator-max-microvolt = <932000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l5a_0p88: ldo5 {
+                       regulator-name = "vreg_l5a_0p88";
+                       regulator-min-microvolt = <880000>;
+                       regulator-max-microvolt = <880000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l6a_1p2: ldo6 {
+                       regulator-name = "vreg_l6a_1p2";
+                       regulator-min-microvolt = <1200000>;
+                       regulator-max-microvolt = <1200000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l7a_1p7: ldo7 {
+                       regulator-name = "vreg_l7a_1p7";
+                       regulator-min-microvolt = <1704000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l9a_1p2: ldo9 {
+                       regulator-name = "vreg_l9a_1p2";
+                       regulator-min-microvolt = <1200000>;
+                       regulator-max-microvolt = <1200000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l10a_1p8: ldo10 {
+                       regulator-name = "vreg_l10a_1p8";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l12a_1p8: ldo12 {
+                       regulator-name = "vreg_l12a_1p8";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l13a_ts_3p0: ldo13 {
+                       regulator-name = "vreg_l13a_ts_3p0";
+                       regulator-min-microvolt = <3008000>;
+                       regulator-max-microvolt = <3008000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l14a_1p8: ldo14 {
+                       regulator-name = "vreg_l14a_1p8";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1880000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l15a_1p8: ldo15 {
+                       regulator-name = "vreg_l15a_1p8";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l16a_2p7: ldo16 {
+                       regulator-name = "vreg_l16a_2p7";
+                       regulator-min-microvolt = <2704000>;
+                       regulator-max-microvolt = <2960000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l17a_3p0: ldo17 {
+                       regulator-name = "vreg_l17a_3p0";
+                       regulator-min-microvolt = <2856000>;
+                       regulator-max-microvolt = <3008000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l18a_0p92: ldo18 {
+                       regulator-name = "vreg_l18a_0p92";
+                       regulator-min-microvolt = <800000>;
+                       regulator-max-microvolt = <912000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_s5a_1p9: smps5 {
+                       regulator-name = "vreg_s5a_1p9";
+                       regulator-min-microvolt = <1904000>;
+                       regulator-max-microvolt = <2000000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_s6a_0p95: smps6 {
+                       regulator-name = "vreg_s6a_0p95";
+                       regulator-min-microvolt = <920000>;
+                       regulator-max-microvolt = <1128000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+       };
+
+       pm8150l-rpmh-regulators {
+               compatible = "qcom,pm8150l-rpmh-regulators";
+               qcom,pmic-id = "c";
+
+               vdd-s1-supply = <&vph_pwr>;
+               vdd-s2-supply = <&vph_pwr>;
+               vdd-s3-supply = <&vph_pwr>;
+               vdd-s4-supply = <&vph_pwr>;
+               vdd-s5-supply = <&vph_pwr>;
+               vdd-s6-supply = <&vph_pwr>;
+               vdd-s7-supply = <&vph_pwr>;
+               vdd-s8-supply = <&vph_pwr>;
+               vdd-l1-l8-supply = <&vreg_s4a_1p8>;
+               vdd-l2-l3-supply = <&vreg_s8c_1p3>;
+               vdd-l4-l5-l6-supply = <&vreg_bob>;
+               vdd-l7-l11-supply = <&vreg_bob>;
+               vdd-l9-l10-supply = <&vreg_bob>;
+               vdd-bob-supply = <&vph_pwr>;
+
+               vreg_bob: bob {
+                       regulator-name = "vreg_bob";
+                       regulator-min-microvolt = <3008000>;
+                       regulator-max-microvolt = <4000000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
+               };
+
+               vreg_l1c_1p8: ldo1 {
+                       regulator-name = "vreg_l1c_1p8";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l2c_1p2: ldo2 {
+                       regulator-name = "vreg_l2c_1p2";
+                       regulator-min-microvolt = <1200000>;
+                       regulator-max-microvolt = <1200000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l3c_0p8: ldo3 {
+                       regulator-name = "vreg_l3c_0p8";
+                       regulator-min-microvolt = <800000>;
+                       regulator-max-microvolt = <800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l4c_1p7: ldo4 {
+                       regulator-name = "vreg_l4c_1p7";
+                       regulator-min-microvolt = <1704000>;
+                       regulator-max-microvolt = <2928000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l5c_1p8: ldo5 {
+                       regulator-name = "vreg_l5c_1p8";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <2928000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l6c_2p96: ldo6 {
+                       regulator-name = "vreg_l6c_2p96";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <2960000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l7c_cam_vcm0_2p85: ldo7 {
+                       regulator-name = "vreg_l7c_cam_vcm0_2p85";
+                       regulator-min-microvolt = <2856000>;
+                       regulator-max-microvolt = <3104000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l8c_1p8: ldo8 {
+                       regulator-name = "vreg_l8c_1p8";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l9c_2p96: ldo9 {
+                       regulator-name = "vreg_l9c_2p96";
+                       regulator-min-microvolt = <2704000>;
+                       regulator-max-microvolt = <2960000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l10c_3p0: ldo10 {
+                       regulator-name = "vreg_l10c_3p0";
+                       regulator-min-microvolt = <3000000>;
+                       regulator-max-microvolt = <3000000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l11c_3p3: ldo11 {
+                       regulator-name = "vreg_l11c_3p3";
+                       regulator-min-microvolt = <3296000>;
+                       regulator-max-microvolt = <3296000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+                       regulator-always-on;
+               };
+
+               vreg_s8c_1p3: smps8 {
+                       regulator-name = "vreg_s8c_1p3";
+                       regulator-min-microvolt = <1352000>;
+                       regulator-max-microvolt = <1352000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+       };
+};
+
+/* LS-I2C0 */
+&i2c4 {
+       status = "okay";
+};
+
+&i2c5 {
+       status = "okay";
+};
+
+/* LS-I2C1 */
+&i2c15 {
+       status = "okay";
+};
+
+&pm8150_gpios {
+       gpio-reserved-ranges = <1 1>, <3 2>, <7 1>;
+       gpio-line-names =
+               "NC",
+               "OPTION2",
+               "PM_GPIO-F",
+               "PM_SLP_CLK_IN",
+               "OPTION1",
+               "VOL_UP_N",
+               "PM8250_GPIO7", /* Blue LED */
+               "SP_ARI_PWR_ALARM",
+               "GPIO_9_P", /* Yellow LED */
+               "GPIO_10_P"; /* Green LED */
+};
+
+&pm8150b_gpios {
+       gpio-line-names =
+               "NC",
+               "NC",
+               "NC",
+               "NC",
+               "HAP_BOOST_EN", /* SOM */
+               "SMB_STAT", /* SOM */
+               "NC",
+               "NC",
+               "SDM_FORCE_USB_BOOT",
+               "NC",
+               "NC",
+               "NC";
+};
+
+&pm8150l_gpios {
+       gpio-line-names =
+               "NC",
+               "PM3003A_EN",
+               "NC",
+               "NC",
+               "PM_GPIO5", /* HDMI RST_N */
+               "PM_GPIO-A", /* PWM */
+               "PM_GPIO7",
+               "NC",
+               "NC",
+               "PM_GPIO-B",
+               "NC",
+               "PM3003A_MODE";
+};
+
+&qupv3_id_0 {
+       status = "okay";
+};
+
+&qupv3_id_1 {
+       status = "okay";
+};
+
+&qupv3_id_2 {
+       status = "okay";
+};
+
+/* CAN */
+&spi0 {
+       status = "okay";
+};
+
+&tlmm {
+       gpio-reserved-ranges = <40 4>;
+       gpio-line-names =
+               "GPIO-MM",
+               "GPIO-NN",
+               "GPIO-OO",
+               "GPIO-PP",
+               "GPIO-A",
+               "GPIO-C",
+               "GPIO-E",
+               "GPIO-D",
+               "I2C0-SDA",
+               "I2C0-SCL",
+               "GPIO-TT", /* GPIO_10 */
+               "NC",
+               "GPIO_12_I2C_SDA",
+               "GPIO_13_I2C_SCL",
+               "GPIO-X",
+               "GPIO_15_RGMII_INT",
+               "HST_BT_UART_CTS",
+               "HST_BT_UART_RFR",
+               "HST_BT_UART_TX",
+               "HST_BT_UART_RX",
+               "HST_WLAN_EN", /* GPIO_20 */
+               "HST_BT_EN",
+               "GPIO-AAA",
+               "GPIO-BBB",
+               "GPIO-CCC",
+               "GPIO-Z",
+               "GPIO-DDD",
+               "GPIO-BB",
+               "GPIO_28_CAN_SPI_MISO",
+               "GPIO_29_CAN_SPI_MOSI",
+               "GPIO_30_CAN_SPI_CLK", /* GPIO_30 */
+               "GPIO_31_CAN_SPI_CS",
+               "GPIO-UU",
+               "NC",
+               "UART1_TXD_SOM",
+               "UART1_RXD_SOM",
+               "UART0_CTS",
+               "UART0_RTS",
+               "UART0_TXD",
+               "UART0_RXD",
+               "SPI1_MISO", /* GPIO_40 */
+               "SPI1_MOSI",
+               "SPI1_CLK",
+               "SPI1_CS",
+               "I2C1_SDA",
+               "I2C1_SCL",
+               "GPIO-F",
+               "GPIO-JJ",
+               "Board_ID1",
+               "Board_ID2",
+               "NC", /* GPIO_50 */
+               "NC",
+               "SPI0_MISO",
+               "SPI0_MOSI",
+               "SPI0_SCLK",
+               "SPI0_CS",
+               "GPIO-QQ",
+               "GPIO-RR",
+               "USB2LAN_RESET",
+               "USB2LAN_EXTWAKE",
+               "NC", /* GPIO_60 */
+               "NC",
+               "NC",
+               "LT9611_INT",
+               "GPIO-AA",
+               "USB_CC_DIR",
+               "GPIO-G",
+               "GPIO-LL",
+               "USB_DP_HPD_1P8",
+               "NC",
+               "NC", /* GPIO_70 */
+               "SD_CMD",
+               "SD_DAT3",
+               "SD_SCLK",
+               "SD_DAT2",
+               "SD_DAT1",
+               "SD_DAT0", /* BOOT_CFG3 */
+               "SD_UFS_CARD_DET_N",
+               "GPIO-II",
+               "PCIE0_RST_N",
+               "PCIE0_CLK_REQ_N", /* GPIO_80 */
+               "PCIE0_WAKE_N",
+               "GPIO-CC",
+               "GPIO-DD",
+               "GPIO-EE",
+               "GPIO-FF",
+               "GPIO-GG",
+               "GPIO-HH",
+               "GPIO-VV",
+               "GPIO-WW",
+               "NC", /* GPIO_90 */
+               "NC",
+               "GPIO-K",
+               "GPIO-I",
+               "CSI0_MCLK",
+               "CSI1_MCLK",
+               "CSI2_MCLK",
+               "CSI3_MCLK",
+               "GPIO-AA", /* CSI4_MCLK */
+               "GPIO-BB", /* CSI5_MCLK */
+               "GPIO-KK", /* GPIO_100 */
+               "CCI_I2C_SDA0",
+               "CCI_I2C_SCL0",
+               "CCI_I2C_SDA1",
+               "CCI_I2C_SCL1",
+               "CCI_I2C_SDA2",
+               "CCI_I2C_SCL2",
+               "CCI_I2C_SDA3",
+               "CCI_I2C_SCL3",
+               "GPIO-L",
+               "NC", /* GPIO_110 */
+               "NC",
+               "ACCEL_INT",
+               "GYRO_INT",
+               "GPIO-J",
+               "GPIO-YY",
+               "GPIO-H",
+               "GPIO-ZZ",
+               "NC",
+               "NC",
+               "NC", /* GPIO_120 */
+               "NC",
+               "MAG_INT",
+               "MAG_DRDY_INT",
+               "HST_SW_CTRL",
+               "GPIO-M",
+               "GPIO-N",
+               "GPIO-O",
+               "GPIO-P",
+               "PS_INT",
+               "WSA1_EN", /* GPIO_130 */
+               "USB_HUB_RESET",
+               "SDM_FORCE_USB_BOOT",
+               "I2S1_CLK_HDMI",
+               "I2S1_DATA0_HDMI",
+               "I2S1_WS_HDMI",
+               "GPIO-B",
+               "GPIO_137", /* To LT9611_I2S_MCLK_3V3 */
+               "PCM_CLK",
+               "PCM_DI",
+               "PCM_DO", /* GPIO_140 */
+               "PCM_FS",
+               "HST_SLIM_CLK",
+               "HST_SLIM_DATA",
+               "GPIO-U",
+               "GPIO-Y",
+               "GPIO-R",
+               "GPIO-Q",
+               "GPIO-S",
+               "GPIO-T",
+               "GPIO-V", /* GPIO_150 */
+               "GPIO-W",
+               "DMIC_CLK1",
+               "DMIC_DATA1",
+               "DMIC_CLK2",
+               "DMIC_DATA2",
+               "WSA_SWR_CLK",
+               "WSA_SWR_DATA",
+               "DMIC_CLK3",
+               "DMIC_DATA3",
+               "I2C4_SDA", /* GPIO_160 */
+               "I2C4_SCL",
+               "SPI3_CS1",
+               "SPI3_CS2",
+               "SPI2_MISO_LS3",
+               "SPI2_MOSI_LS3",
+               "SPI2_CLK_LS3",
+               "SPI2_ACCEL_CS_LS3",
+               "SPI2_CS1",
+               "NC",
+               "GPIO-SS", /* GPIO_170 */
+               "GPIO-XX",
+               "SPI3_MISO",
+               "SPI3_MOSI",
+               "SPI3_CLK",
+               "SPI3_CS",
+               "HST_BLE_SNS_UART_TX",
+               "HST_BLE_SNS_UART_RX",
+               "HST_WLAN_UART_TX",
+               "HST_WLAN_UART_RX";
+};
+
+&uart12 {
+       status = "okay";
+};
+
+&ufs_mem_hc {
+       status = "okay";
+
+       vcc-supply = <&vreg_l17a_3p0>;
+       vcc-max-microamp = <800000>;
+       vccq-supply = <&vreg_l6a_1p2>;
+       vccq-max-microamp = <800000>;
+       vccq2-supply = <&vreg_s4a_1p8>;
+       vccq2-max-microamp = <800000>;
+};
+
+&ufs_mem_phy {
+       status = "okay";
+
+       vdda-phy-supply = <&vreg_l5a_0p88>;
+       vdda-max-microamp = <89900>;
+       vdda-pll-supply = <&vreg_l9a_1p2>;
+       vdda-pll-max-microamp = <18800>;
+};
index d8b5507..e77a792 100644 (file)
 &uart3 {
        status = "okay";
 
+       /delete-property/interrupts;
+       interrupts-extended = <&intc GIC_SPI 604 IRQ_TYPE_LEVEL_HIGH>,
+                               <&tlmm 41 IRQ_TYPE_EDGE_FALLING>;
+
+       pinctrl-names = "default", "sleep";
+       pinctrl-1 = <&qup_uart3_sleep>;
+
        bluetooth: wcn3990-bt {
                compatible = "qcom,wcn3990-bt";
                vddio-supply = <&vreg_l10a_1p8>;
                vddrf-supply = <&vreg_l2c_1p3>;
                vddch0-supply = <&vreg_l10c_3p3>;
                max-speed = <3200000>;
-               clocks = <&rpmhcc RPMH_RF_CLK2>;
        };
 };
 
 &qup_uart3_default {
        pinconf-cts {
                /*
-                * Configure a pull-down on 38 (CTS) to match the pull of
+                * Configure a pull-down on CTS to match the pull of
                 * the Bluetooth module.
                 */
                pins = "gpio38";
                bias-pull-down;
-               output-high;
        };
 
        pinconf-rts {
-               /* We'll drive 39 (RTS), so no pull */
+               /* We'll drive RTS, so no pull */
                pins = "gpio39";
                drive-strength = <2>;
                bias-disable;
        };
 
        pinconf-tx {
-               /* We'll drive 40 (TX), so no pull */
+               /* We'll drive TX, so no pull */
                pins = "gpio40";
                drive-strength = <2>;
                bias-disable;
-               output-high;
        };
 
        pinconf-rx {
                /*
-                * Configure a pull-up on 41 (RX). This is needed to avoid
+                * Configure a pull-up on RX. This is needed to avoid
                 * garbage data when the TX pin of the Bluetooth module is
                 * in tri-state (module powered off or not driving the
                 * signal yet).
        };
 };
 
+&tlmm {
+       qup_uart3_sleep: qup-uart3-sleep {
+               pinmux {
+                       pins = "gpio38", "gpio39",
+                              "gpio40", "gpio41";
+                       function = "gpio";
+               };
+
+               pinconf-cts {
+                       /*
+                        * Configure a pull-down on CTS to match the pull of
+                        * the Bluetooth module.
+                        */
+                       pins = "gpio38";
+                       bias-pull-down;
+               };
+
+               pinconf-rts {
+                       /*
+                        * Configure pull-down on RTS. As RTS is active low
+                        * signal, pull it low to indicate the BT SoC that it
+                        * can wakeup the system anytime from suspend state by
+                        * pulling RX low (by sending wakeup bytes).
+                        */
+                        pins = "gpio39";
+                        bias-pull-down;
+               };
+
+               pinconf-tx {
+                       /*
+                        * Configure pull-up on TX when it isn't actively driven
+                        * to prevent BT SoC from receiving garbage during sleep.
+                        */
+                       pins = "gpio40";
+                       bias-pull-up;
+               };
+
+               pinconf-rx {
+                       /*
+                        * Configure a pull-up on RX. This is needed to avoid
+                        * garbage data when the TX pin of the Bluetooth module
+                        * is floating which may cause spurious wakeups.
+                        */
+                       pins = "gpio41";
+                       bias-pull-up;
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r0.dts
new file mode 100644 (file)
index 0000000..ae4c23a
--- /dev/null
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google Lazor board device tree source
+ *
+ * Copyright 2020 Google LLC.
+ */
+
+/dts-v1/;
+
+#include "sc7180-trogdor-lazor.dtsi"
+
+/ {
+       model = "Google Lazor (rev0)";
+       compatible = "google,lazor-rev0", "qcom,sc7180";
+};
+
+&sn65dsi86_out {
+       /*
+        * Lane 0 was incorrectly mapped on the cable, but we've now decided
+        * that the cable is canon and in -rev1+ we'll make a board change
+        * that means we no longer need the swizzle.
+        */
+       lane-polarities = <1 0>;
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1-kb.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1-kb.dts
new file mode 100644 (file)
index 0000000..c3f426c
--- /dev/null
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google Lazor board device tree source
+ *
+ * Copyright 2020 Google LLC.
+ */
+
+#include "sc7180-trogdor-lazor-r1.dts"
+
+/ {
+       model = "Google Lazor (rev1+) with KB Backlight";
+       compatible = "google,lazor-sku2", "qcom,sc7180";
+};
+
+&keyboard_backlight {
+       status = "okay";
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1-lte.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1-lte.dts
new file mode 100644 (file)
index 0000000..73e59cf
--- /dev/null
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google Lazor board device tree source
+ *
+ * Copyright 2020 Google LLC.
+ */
+
+#include "sc7180-trogdor-lazor-r1.dts"
+#include "sc7180-trogdor-lte-sku.dtsi"
+
+/ {
+       model = "Google Lazor (rev1+) with LTE";
+       compatible = "google,lazor-sku0", "qcom,sc7180";
+};
+
+&keyboard_backlight {
+       status = "okay";
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dts
new file mode 100644 (file)
index 0000000..3151ae3
--- /dev/null
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google Lazor board device tree source
+ *
+ * Copyright 2020 Google LLC.
+ */
+
+/dts-v1/;
+
+#include "sc7180-trogdor-lazor.dtsi"
+
+/ {
+       model = "Google Lazor (rev1+)";
+       compatible = "google,lazor", "qcom,sc7180";
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi
new file mode 100644 (file)
index 0000000..180ef9e
--- /dev/null
@@ -0,0 +1,192 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google Lazor board device tree source
+ *
+ * Copyright 2020 Google LLC.
+ */
+
+#include "sc7180.dtsi"
+
+ap_ec_spi: &spi6 {};
+ap_h1_spi: &spi0 {};
+
+#include "sc7180-trogdor.dtsi"
+
+/ {
+       panel: panel {
+               compatible = "boe,nv133fhm-n62";
+               power-supply = <&pp3300_dx_edp>;
+               backlight = <&backlight>;
+               hpd-gpios = <&sn65dsi86_bridge 2 GPIO_ACTIVE_HIGH>;
+
+               ports {
+                       port {
+                               panel_in_edp: endpoint {
+                                       remote-endpoint = <&sn65dsi86_out>;
+                               };
+                       };
+               };
+       };
+};
+
+&ap_sar_sensor {
+       status = "okay";
+};
+
+ap_ts_pen_1v8: &i2c4 {
+       status = "okay";
+       clock-frequency = <400000>;
+
+       ap_ts: touchscreen@10 {
+               compatible = "hid-over-i2c";
+               reg = <0x10>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&ts_int_l>, <&ts_reset_l>;
+
+               interrupt-parent = <&tlmm>;
+               interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
+
+               post-power-on-delay-ms = <20>;
+               hid-descr-addr = <0x0001>;
+
+               vdd-supply = <&pp3300_ts>;
+       };
+};
+
+/* PINCTRL - modifications to sc7180-trogdor.dtsi */
+
+&ts_reset_l {
+       pinconf {
+               /* This pin is not connected on -rev0, pull up to park. */
+               /delete-property/bias-disable;
+               bias-pull-up;
+       };
+};
+
+/* PINCTRL - board-specific pinctrl */
+
+&tlmm {
+       gpio-line-names = "ESIM_MISO",
+                         "ESIM_MOSI",
+                         "ESIM_CLK",
+                         "ESIM_CS_L",
+                         "",
+                         "",
+                         "AP_TP_I2C_SDA",
+                         "AP_TP_I2C_SCL",
+                         "TS_RESET_L",
+                         "TS_INT_L",
+                         "",
+                         "EDP_BRIJ_IRQ",
+                         "AP_EDP_BKLTEN",
+                         "AP_RAM_ID2",
+                         "",
+                         "EDP_BRIJ_I2C_SDA",
+                         "EDP_BRIJ_I2C_SCL",
+                         "HUB_RST_L",
+                         "",
+                         "AP_RAM_ID1",
+                         "AP_SKU_ID2",
+                         "",
+                         "",
+                         "AMP_EN",
+                         "P_SENSOR_INT_L",
+                         "AP_SAR_SENSOR_SDA",
+                         "AP_SAR_SENSOR_SCL",
+                         "",
+                         "HP_IRQ",
+                         "AP_RAM_ID0",
+                         "EN_PP3300_DX_EDP",
+                         "AP_BRD_ID2",
+                         "BRIJ_SUSPEND",
+                         "AP_BRD_ID0",
+                         "AP_H1_SPI_MISO",
+                         "AP_H1_SPI_MOSI",
+                         "AP_H1_SPI_CLK",
+                         "AP_H1_SPI_CS_L",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "H1_AP_INT_ODL",
+                         "",
+                         "UART_AP_TX_DBG_RX",
+                         "UART_DBG_TX_AP_RX",
+                         "HP_I2C_SDA",
+                         "HP_I2C_SCL",
+                         "FORCED_USB_BOOT",
+                         "",
+                         "",
+                         "AMP_DIN",
+                         "",
+                         "HP_BCLK",
+                         "HP_LRCLK",
+                         "HP_DOUT",
+                         "HP_DIN",
+                         "HP_MCLK",
+                         "TRACKPAD_INT_1V8_ODL",
+                         "AP_EC_SPI_MISO",
+                         "AP_EC_SPI_MOSI",
+                         "AP_EC_SPI_CLK",
+                         "AP_EC_SPI_CS_L",
+                         "AP_SPI_CLK",
+                         "AP_SPI_MOSI",
+                         "AP_SPI_MISO",
+                         /*
+                          * AP_FLASH_WP_L is crossystem ABI. Schematics
+                          * call it BIOS_FLASH_WP_L.
+                          */
+                         "AP_FLASH_WP_L",
+                         "DBG_SPI_HOLD_L",
+                         "AP_SPI_CS0_L",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "UIM2_DATA",
+                         "UIM2_CLK",
+                         "UIM2_RST",
+                         "UIM2_PRESENT",
+                         "UIM1_DATA",
+                         "UIM1_CLK",
+                         "UIM1_RST",
+                         "",
+                         "EN_PP3300_CODEC",
+                         "EN_PP3300_HUB",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "AP_SKU_ID1",
+                         "AP_RST_REQ",
+                         "",
+                         "AP_BRD_ID1",
+                         "AP_EC_INT_L",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "EDP_BRIJ_EN",
+                         "AP_SKU_ID0",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "AP_TS_PEN_I2C_SDA",
+                         "AP_TS_PEN_I2C_SCL",
+                         "DP_HOT_PLUG_DET",
+                         "EC_IN_RW_ODL";
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi
new file mode 100644 (file)
index 0000000..44956e3
--- /dev/null
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google Trogdor dts fragment for LTE SKUs
+ *
+ * Copyright 2020 Google LLC.
+ */
+
+&ap_sar_sensor {
+       label = "proximity-wifi-lte";
+};
+
+&remoteproc_mpss {
+       firmware-name = "qcom/sc7180-trogdor/modem/mba.mbn",
+                       "qcom/sc7180-trogdor/modem/qdsp6sw.mbn";
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1-lte.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1-lte.dts
new file mode 100644 (file)
index 0000000..1123c02
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google Trogdor board device tree source
+ *
+ * Copyright 2020 Google LLC.
+ */
+
+#include "sc7180-trogdor-r1.dts"
+#include "sc7180-trogdor-lte-sku.dtsi"
+
+/ {
+       model = "Google Trogdor (rev1+) with LTE";
+       compatible = "google,trogdor-sku0", "qcom,sc7180";
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts
new file mode 100644 (file)
index 0000000..0a281c2
--- /dev/null
@@ -0,0 +1,191 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google Trogdor board device tree source
+ *
+ * Copyright 2020 Google LLC.
+ */
+
+/dts-v1/;
+
+#include "sc7180.dtsi"
+
+ap_ec_spi: &spi6 {};
+ap_h1_spi: &spi0 {};
+
+#include "sc7180-trogdor.dtsi"
+
+/ {
+       model = "Google Trogdor (rev1+)";
+       compatible = "google,trogdor", "qcom,sc7180";
+
+       panel: panel {
+               compatible = "auo,b116xa01";
+               power-supply = <&pp3300_dx_edp>;
+               backlight = <&backlight>;
+               hpd-gpios = <&sn65dsi86_bridge 2 GPIO_ACTIVE_HIGH>;
+
+               ports {
+                       port {
+                               panel_in_edp: endpoint {
+                                       remote-endpoint = <&sn65dsi86_out>;
+                               };
+                       };
+               };
+       };
+};
+
+&ap_sar_sensor_i2c {
+       /* Not hooked up */
+       status = "disabled";
+};
+
+ap_ts_pen_1v8: &i2c4 {
+       status = "okay";
+       clock-frequency = <400000>;
+
+       ap_ts: touchscreen@10 {
+               compatible = "elan,ekth3500";
+               reg = <0x10>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&ts_int_l>, <&ts_reset_l>;
+
+               interrupt-parent = <&tlmm>;
+               interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
+
+               vcc33-supply = <&pp3300_ts>;
+
+               reset-gpios = <&tlmm 8 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&sdhc_2 {
+       status = "okay";
+};
+
+/* PINCTRL - board-specific pinctrl */
+
+&tlmm {
+       gpio-line-names = "ESIM_MISO",
+                         "ESIM_MOSI",
+                         "ESIM_CLK",
+                         "ESIM_CS_L",
+                         "FP_TO_AP_IRQ_L",
+                         "FP_RST_L",
+                         "AP_TP_I2C_SDA",
+                         "AP_TP_I2C_SCL",
+                         "TS_RESET_L",
+                         "TS_INT_L",
+                         "FPMCU_BOOT0",
+                         "EDP_BRIJ_IRQ",
+                         "AP_EDP_BKLTEN",
+                         "",
+                         "",
+                         "EDP_BRIJ_I2C_SDA",
+                         "EDP_BRIJ_I2C_SCL",
+                         "HUB_RST_L",
+                         "PEN_RST_ODL",
+                         "AP_RAM_ID1",
+                         "AP_RAM_ID2",
+                         "PEN_IRQ_L",
+                         "FPMCU_SEL",
+                         "AMP_EN",
+                         "P_SENSOR_INT_L",
+                         "AP_SAR_SENSOR_SDA",
+                         "AP_SAR_SENSOR_SCL",
+                         "",
+                         "HP_IRQ",
+                         "AP_RAM_ID0",
+                         "EN_PP3300_DX_EDP",
+                         "AP_BRD_ID2",
+                         "BRIJ_SUSPEND",
+                         "AP_BRD_ID0",
+                         "AP_H1_SPI_MISO",
+                         "AP_H1_SPI_MOSI",
+                         "AP_H1_SPI_CLK",
+                         "AP_H1_SPI_CS_L",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "H1_AP_INT_ODL",
+                         "",
+                         "UART_AP_TX_DBG_RX",
+                         "UART_DBG_TX_AP_RX",
+                         "HP_I2C_SDA",
+                         "HP_I2C_SCL",
+                         "FORCED_USB_BOOT",
+                         "",
+                         "",
+                         "AMP_DIN",
+                         "PEN_PDCT_L",
+                         "HP_BCLK",
+                         "HP_LRCLK",
+                         "HP_DOUT",
+                         "HP_DIN",
+                         "HP_MCLK",
+                         "TRACKPAD_INT_1V8_ODL",
+                         "AP_EC_SPI_MISO",
+                         "AP_EC_SPI_MOSI",
+                         "AP_EC_SPI_CLK",
+                         "AP_EC_SPI_CS_L",
+                         "AP_SPI_CLK",
+                         "AP_SPI_MOSI",
+                         "AP_SPI_MISO",
+                         /*
+                          * AP_FLASH_WP_L is crossystem ABI. Schematics
+                          * call it BIOS_FLASH_WP_L.
+                          */
+                         "AP_FLASH_WP_L",
+                         "DBG_SPI_HOLD_L",
+                         "AP_SPI_CS0_L",
+                         "SD_CD_ODL",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "UIM2_DATA",
+                         "UIM2_CLK",
+                         "UIM2_RST",
+                         "UIM2_PRESENT",
+                         "UIM1_DATA",
+                         "UIM1_CLK",
+                         "UIM1_RST",
+                         "",
+                         "EN_PP3300_CODEC",
+                         "EN_PP3300_HUB",
+                         "",
+                         "AP_SPI_FP_MISO",
+                         "AP_SPI_FP_MOSI",
+                         "AP_SPI_FP_CLK",
+                         "AP_SPI_FP_CS_L",
+                         "AP_SKU_ID1",
+                         "AP_RST_REQ",
+                         "",
+                         "AP_BRD_ID1",
+                         "AP_EC_INT_L",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "EDP_BRIJ_EN",
+                         "AP_SKU_ID0",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "AP_TS_PEN_I2C_SDA",
+                         "AP_TS_PEN_I2C_SCL",
+                         "DP_HOT_PLUG_DET",
+                         "EC_IN_RW_ODL";
+};
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
new file mode 100644 (file)
index 0000000..bf87558
--- /dev/null
@@ -0,0 +1,1402 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google Trogdor device tree source (common between revisions)
+ *
+ * Copyright 2019 Google LLC.
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
+
+/* PMICs depend on spmi_bus label and so must come after SoC */
+#include "pm6150.dtsi"
+#include "pm6150l.dtsi"
+
+/*
+ * Reserved memory changes
+ *
+ * Delete all unused memory nodes and define the peripheral memory regions
+ * required by the board dts.
+ */
+
+/delete-node/ &hyp_mem;
+/delete-node/ &xbl_mem;
+/delete-node/ &aop_mem;
+/delete-node/ &sec_apps_mem;
+/delete-node/ &tz_mem;
+
+/* Increase the size from 2MB to 8MB */
+&rmtfs_mem {
+       reg = <0x0 0x84400000 0x0 0x800000>;
+};
+
+/ {
+       reserved-memory {
+               atf_mem: memory@80b00000 {
+                       reg = <0x0 0x80b00000 0x0 0x100000>;
+                       no-map;
+               };
+
+               mpss_mem: memory@86000000 {
+                       reg = <0x0 0x86000000 0x0 0x8c00000>;
+                       no-map;
+               };
+
+               camera_mem: memory@8ec00000 {
+                       reg = <0x0 0x8ec00000 0x0 0x500000>;
+                       no-map;
+               };
+
+               venus_mem: memory@8f600000 {
+                       reg = <0 0x8f600000 0 0x500000>;
+                       no-map;
+               };
+
+               wlan_mem: memory@94100000 {
+                       reg = <0x0 0x94100000 0x0 0x200000>;
+                       no-map;
+               };
+
+               mba_mem: memory@94400000 {
+                       reg = <0x0 0x94400000 0x0 0x200000>;
+                       no-map;
+               };
+       };
+
+       aliases {
+               bluetooth0 = &bluetooth;
+               hsuart0 = &uart3;
+               serial0 = &uart8;
+               wifi0 = &wifi;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       /* FIXED REGULATORS - parents above children */
+
+       /* This is the top level supply and variable voltage */
+       ppvar_sys: ppvar-sys-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "ppvar_sys";
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
+       /* This divides ppvar_sys by 2, so voltage is variable */
+       src_vph_pwr: src-vph-pwr-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "src_vph_pwr";
+
+               /* EC turns on with switchcap_on; always on for AP */
+               regulator-always-on;
+               regulator-boot-on;
+
+               vin-supply = <&ppvar_sys>;
+       };
+
+       pp5000_a: pp5000-a-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "pp5000_a";
+
+               /* EC turns on with en_pp5000_a; always on for AP */
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+
+               vin-supply = <&ppvar_sys>;
+       };
+
+       pp3300_a: pp3300-a-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "pp3300_a";
+
+               /* EC turns on with en_pp3300_a; always on for AP */
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+
+               /*
+                * Actually should be pp3300 but that's practically an alias for
+                * pp3300_a so we use pp3300's vin-supply here to avoid one more
+                * node.
+                */
+               vin-supply = <&ppvar_sys>;
+       };
+
+       pp3300_audio:
+       pp3300_codec: pp3300-codec-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "pp3300_codec";
+
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpio = <&tlmm 83 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+               pinctrl-names = "default";
+               pinctrl-0 = <&en_pp3300_codec>;
+
+               vin-supply = <&pp3300_a>;
+       };
+
+       pp3300_dx_edp:
+       pp3300_ts: pp3300-dx-edp-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "pp3300_dx_edp";
+
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpio = <&tlmm 30 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+               pinctrl-names = "default";
+               pinctrl-0 = <&en_pp3300_dx_edp>;
+
+               vin-supply = <&pp3300_a>;
+       };
+
+       pp3300_fp_tp: pp3300-fp-tp-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "pp3300_fp_tp";
+
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+
+               /* AP turns on with PP1800_VIO_OUT; always on for AP */
+               regulator-always-on;
+               regulator-boot-on;
+
+               vin-supply = <&pp3300_a>;
+       };
+
+       /* BOARD-SPECIFIC TOP LEVEL NODES */
+
+       backlight: backlight {
+               compatible = "pwm-backlight";
+
+               pwms = <&cros_ec_pwm 1>;
+               enable-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>;
+               power-supply = <&ppvar_sys>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&ap_edp_bklten>;
+       };
+
+       gpio_keys: gpio-keys {
+               compatible = "gpio-keys";
+               status = "disabled";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pen_pdct_l>;
+
+               pen-insert {
+                       label = "Pen Insert";
+
+                       /* Insert = low, eject = high */
+                       gpios = <&tlmm 52 GPIO_ACTIVE_LOW>;
+                       linux,code = <SW_PEN_INSERTED>;
+                       linux,input-type = <EV_SW>;
+                       wakeup-source;
+               };
+       };
+
+       max98357a: audio-codec-0 {
+               compatible = "maxim,max98357a";
+               pinctrl-names = "default";
+               pinctrl-0 = <&amp_en>;
+               sdmode-gpios = <&tlmm 23 GPIO_ACTIVE_HIGH>;
+               #sound-dai-cells = <0>;
+       };
+
+       pwmleds {
+               compatible = "pwm-leds";
+               keyboard_backlight: keyboard-backlight {
+                       status = "disabled";
+                       label = "cros_ec::kbd_backlight";
+                       pwms = <&cros_ec_pwm 0>;
+                       max-brightness = <1023>;
+               };
+       };
+};
+
+&qfprom {
+       vcc-supply = <&pp1800_l11a>;
+};
+
+&qspi {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&qspi_clk>, <&qspi_cs0>, <&qspi_data01>;
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+
+               /* TODO: Increase frequency after testing */
+               spi-max-frequency = <25000000>;
+               spi-tx-bus-width = <2>;
+               spi-rx-bus-width = <2>;
+       };
+};
+
+&apps_rsc {
+       pm6150-rpmh-regulators {
+               compatible = "qcom,pm6150-rpmh-regulators";
+               qcom,pmic-id = "a";
+
+               vddpx_1:
+               vdd2:
+               pp1125_s1a: smps1 {
+                       regulator-min-microvolt = <1128000>;
+                       regulator-max-microvolt = <1128000>;
+               };
+
+               /*
+                * pp2040_s5a (smps5) and pp1056_s4a (smps4) are just
+                * inputs to other rails on AOP-managed PMICs on trogdor.
+                * The system is already configured to manage these rails
+                * automatically (enable when needed, adjust voltage for
+                * headroom) so we won't specify anything here.
+                *
+                * NOTE: though the rails have a voltage implied by their
+                * name, the automatic headroom calculation might not result
+                * in them being that voltage.  ...and that's OK.
+                * Specifically the only point of these rails is to provide
+                * an input source for other rails and if we can satisify the
+                * needs of those other rails with a lower source voltage then
+                * we save power.
+                */
+
+               pp1200_l1a: ldo1 {
+                       regulator-min-microvolt = <1200000>;
+                       regulator-max-microvolt = <1200000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp1000_l2a: ldo2 {
+                       regulator-min-microvolt = <944000>;
+                       regulator-max-microvolt = <1056000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp1000_l3a: ldo3 {
+                       regulator-min-microvolt = <968000>;
+                       regulator-max-microvolt = <1064000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vdd_qlink_lv:
+               vdd_qlink_lv_ck:
+               vdd_qusb_hs0_core:
+               vdd_ufs1_core:
+               vdda_mipi_csi0_0p9:
+               vdda_mipi_csi1_0p9:
+               vdda_mipi_csi2_0p9:
+               vdda_mipi_csi3_0p9:
+               vdda_mipi_dsi0_pll:
+               vdda_pll_cc_ebi01:
+               vdda_qrefs_0p9:
+               vdda_usb_ss_dp_core:
+               pp900_l4a: ldo4 {
+                       regulator-min-microvolt = <824000>;
+                       regulator-max-microvolt = <928000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp2700_l5a: ldo5 {
+                       regulator-min-microvolt = <2704000>;
+                       regulator-max-microvolt = <2704000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               ebi0_cal:
+               ebi1_cal:
+               vddio_ck_ebi0:
+               vddio_ck_ebi1:
+               vddio_ebi0:
+               vddq:
+               pp600_l6a: ldo6 {
+                       regulator-min-microvolt = <568000>;
+                       regulator-max-microvolt = <648000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vdd_cx_wlan:
+               pp800_l9a: ldo9 {
+                       regulator-min-microvolt = <488000>;
+                       regulator-max-microvolt = <800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vdd1:
+               vddpx_3:
+               vddpx_7:
+               vio_in:
+               pp1800_l10a: ldo10 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vdd_qfprom:
+               vdda_apc1_cs_1p8:
+               vdda_qrefs_1p8:
+               vdda_qusb_hs0_1p8:
+               vddpx_11:
+               vreg_bb_clk:
+               pp1800_l11a: ldo11 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               mcp_vccq:
+               pp1800_l12a_r: ldo12 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp1800_l13a: ldo13 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp1800_prox:
+               pp1800_l14a: ldo14 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp1800_alc5682:
+               pp1800_l15a: ldo15 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp2700_l16a: ldo16 {
+                       regulator-min-microvolt = <2496000>;
+                       regulator-max-microvolt = <3304000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vdda_qusb_hs0_3p1:
+               vdd_pdphy:
+               pp3100_l17a: ldo17 {
+                       regulator-min-microvolt = <2920000>;
+                       regulator-max-microvolt = <3232000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp1800_pen:
+               pp1800_l18a: ldo18 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               mcp_vcc:
+               pp2850_l19a: ldo19 {
+                       regulator-min-microvolt = <2960000>;
+                       regulator-max-microvolt = <2960000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+       };
+
+       pm6150l-rpmh-regulators {
+               compatible = "qcom,pm6150l-rpmh-regulators";
+               qcom,pmic-id = "c";
+
+               pp1300_s8c: smps8 {
+                       regulator-min-microvolt = <1120000>;
+                       regulator-max-microvolt = <1408000>;
+               };
+
+               pp1800_l1c: ldo1 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vdd_wcss_adc_dac:
+               pp1300_l2c: ldo2 {
+                       regulator-min-microvolt = <1168000>;
+                       regulator-max-microvolt = <1304000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp1200_brij:
+               vdd_ufs1_1p2:
+               vdda_csi0_1p25:
+               vdda_csi1_1p25:
+               vdda_csi2_1p25:
+               vdda_csi3_1p25:
+               vdda_hv_ebi0:
+               vdda_mipi_dsi0_1p2:
+               vdda_usb_ss_dp_1p2:
+               vddpx_10:
+               pp1200_l3c: ldo3 {
+                       regulator-min-microvolt = <1200000>;
+                       regulator-max-microvolt = <1200000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               ld_pp1800_esim_l4c:
+               vddpx_5:
+               pp1800_l4c: ldo4 {
+                       regulator-min-microvolt = <1648000>;
+                       regulator-max-microvolt = <3304000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vddpx_6:
+               pp1800_l5c: ldo5 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vddpx_2:
+               ppvar_l6c: ldo6 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <3304000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp3300_hub:
+               pp3300_l7c: ldo7 {
+                       regulator-min-microvolt = <3304000>;
+                       regulator-max-microvolt = <3304000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+                       regulator-always-on;
+                       regulator-boot-on;
+               };
+
+               pp1800_brij_vccio:
+               pp1800_edp_vpll:
+               pp1800_l8c: ldo8 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp2950_l9c: ldo9 {
+                       regulator-min-microvolt = <2952000>;
+                       regulator-max-microvolt = <2952000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp3300_l10c: ldo10 {
+                       regulator-min-microvolt = <3000000>;
+                       regulator-max-microvolt = <3400000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               pp3300_l11c: ldo11 {
+                       regulator-min-microvolt = <3000000>;
+                       regulator-max-microvolt = <3400000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               src_vreg_bob: bob {
+                       regulator-min-microvolt = <3008000>;
+                       regulator-max-microvolt = <3960000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
+               };
+       };
+};
+
+&ap_ec_spi {
+       status = "okay";
+       cros_ec: ec@0 {
+               compatible = "google,cros-ec-spi";
+               reg = <0>;
+               interrupt-parent = <&tlmm>;
+               interrupts = <94 IRQ_TYPE_LEVEL_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&ap_ec_int_l>;
+               spi-max-frequency = <3000000>;
+
+               cros_ec_pwm: ec-pwm {
+                       compatible = "google,cros-ec-pwm";
+                       #pwm-cells = <1>;
+               };
+
+               i2c_tunnel: i2c-tunnel {
+                       compatible = "google,cros-ec-i2c-tunnel";
+                       google,remote-bus = <0>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               pdupdate {
+                       compatible = "google,cros-ec-pd-update";
+               };
+
+               typec {
+                       compatible = "google,cros-ec-typec";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       usb_c0: connector@0 {
+                               compatible = "usb-c-connector";
+                               reg = <0>;
+                               label = "left";
+                               power-role = "dual";
+                               data-role = "host";
+                               try-power-role = "source";
+                       };
+
+                       usb_c1: connector@1 {
+                               compatible = "usb-c-connector";
+                               reg = <1>;
+                               label = "right";
+                               power-role = "dual";
+                               data-role = "host";
+                               try-power-role = "source";
+                       };
+               };
+       };
+};
+
+&ap_h1_spi {
+       status = "okay";
+       cr50: tpm@0 {
+               compatible = "google,cr50";
+               reg = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&h1_ap_int_odl>;
+               spi-max-frequency = <800000>;
+               interrupt-parent = <&tlmm>;
+               interrupts = <42 IRQ_TYPE_EDGE_RISING>;
+       };
+};
+
+&dsi0 {
+       status = "okay";
+       vdda-supply = <&vdda_mipi_dsi0_1p2>;
+
+       ports {
+               port@1 {
+                       endpoint {
+                               remote-endpoint = <&sn65dsi86_in>;
+                               data-lanes = <0 1 2 3>;
+                       };
+               };
+       };
+};
+
+&dsi_phy {
+       status = "okay";
+       vdds-supply = <&vdda_mipi_dsi0_pll>;
+};
+
+edp_brij_i2c: &i2c2 {
+       status = "okay";
+       clock-frequency = <400000>;
+
+       sn65dsi86_bridge: bridge@2d {
+               compatible = "ti,sn65dsi86";
+               reg = <0x2d>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&edp_brij_en>, <&edp_brij_irq>;
+               gpio-controller;
+               #gpio-cells = <2>;
+
+               interrupt-parent = <&tlmm>;
+               interrupts = <11 IRQ_TYPE_LEVEL_HIGH>;
+
+               enable-gpios = <&tlmm 104 GPIO_ACTIVE_HIGH>;
+
+               vpll-supply = <&pp1800_edp_vpll>;
+               vccio-supply = <&pp1800_brij_vccio>;
+               vcca-supply = <&pp1200_brij>;
+               vcc-supply = <&pp1200_brij>;
+
+               clocks = <&rpmhcc RPMH_LN_BB_CLK3>;
+               clock-names = "refclk";
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       port@0 {
+                               reg = <0>;
+                               sn65dsi86_in: endpoint {
+                                       remote-endpoint = <&dsi0_out>;
+                               };
+                       };
+
+                       port@1 {
+                               reg = <1>;
+                               sn65dsi86_out: endpoint {
+                                       data-lanes = <0 1>;
+                                       remote-endpoint = <&panel_in_edp>;
+                               };
+                       };
+               };
+       };
+};
+
+ap_sar_sensor_i2c: &i2c5 {
+       status = "okay";
+       clock-frequency = <400000>;
+
+       ap_sar_sensor: proximity@28 {
+               compatible = "semtech,sx9310";
+               reg = <0x28>;
+               #io-channel-cells = <1>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&p_sensor_int_l>;
+
+               interrupt-parent = <&tlmm>;
+               interrupts = <24 IRQ_TYPE_LEVEL_LOW>;
+
+               vdd-supply = <&pp3300_a>;
+               svdd-supply = <&pp1800_prox>;
+
+               status = "disabled";
+               label = "proximity-wifi";
+       };
+};
+
+ap_tp_i2c: &i2c7 {
+       status = "okay";
+       clock-frequency = <400000>;
+
+       trackpad@15 {
+               compatible = "elan,ekth3000";
+               reg = <0x15>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&trackpad_int_1v8_odl>;
+
+               interrupt-parent = <&tlmm>;
+               interrupts = <58 IRQ_TYPE_EDGE_FALLING>;
+
+               vcc-supply = <&pp3300_fp_tp>;
+
+               wakeup-source;
+       };
+};
+
+hp_i2c: &i2c9 {
+       status = "okay";
+       clock-frequency = <400000>;
+
+       alc5682: codec@1a {
+               compatible = "realtek,rt5682i";
+               reg = <0x1a>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&hp_irq>;
+
+               #sound-dai-cells = <1>;
+
+               interrupt-parent = <&tlmm>;
+               /*
+                * This will get ignored because the interrupt type
+                * is set in rt5682.c.
+                */
+               interrupts = <28 IRQ_TYPE_EDGE_BOTH>;
+
+               AVDD-supply = <&pp1800_alc5682>;
+               MICVDD-supply = <&pp3300_codec>;
+               VBAT-supply = <&pp3300_audio>;
+
+               realtek,dmic1-data-pin = <1>;
+               realtek,dmic1-clk-pin = <1>;
+               realtek,jd-src = <1>;
+       };
+};
+
+&ipa {
+       status = "okay";
+
+       /*
+        * Trogdor doesn't have QHEE (Qualcomm's EL2 blob), so the
+        * modem needs to cover certain init steps (GSI init), and
+        * the AP needs to wait for it.
+        */
+       modem-init;
+};
+
+&mdp {
+       status = "okay";
+};
+
+&mdss {
+       status = "okay";
+};
+
+&pm6150_pwrkey {
+       status = "disabled";
+};
+
+&qupv3_id_0 {
+       status = "okay";
+};
+
+&qupv3_id_1 {
+       status = "okay";
+};
+
+&remoteproc_mpss {
+       status = "okay";
+       compatible = "qcom,sc7180-mss-pil";
+       iommus = <&apps_smmu 0x461 0x0>, <&apps_smmu 0x444 0x3>;
+       memory-region = <&mba_mem &mpss_mem>;
+
+       /* This gets overridden for SKUs with LTE support. */
+       firmware-name = "qcom/sc7180-trogdor/modem-nolte/mba.mbn",
+                       "qcom/sc7180-trogdor/modem-nolte/qdsp6sw.mbn";
+};
+
+&sdhc_1 {
+       status = "okay";
+
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&sdc1_on>;
+       pinctrl-1 = <&sdc1_off>;
+       vmmc-supply = <&mcp_vcc>;
+       vqmmc-supply = <&mcp_vccq>;
+};
+
+&sdhc_2 {
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&sdc2_on>;
+       pinctrl-1 = <&sdc2_off>;
+       vmmc-supply = <&pp2950_l9c>;
+       vqmmc-supply = <&ppvar_l6c>;
+
+       cd-gpios = <&tlmm 69 GPIO_ACTIVE_LOW>;
+};
+
+ap_spi_fp: &spi10 {
+       cros_ec_fp: ec@0 {
+               compatible = "google,cros-ec-spi";
+               reg = <0>;
+               interrupt-parent = <&tlmm>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&fp_to_ap_irq_l>, <&fp_rst_l>, <&fpmcu_boot0>, <&fpmcu_sel>;
+               spi-max-frequency = <3000000>;
+       };
+};
+
+#include <arm/cros-ec-keyboard.dtsi>
+#include <arm/cros-ec-sbs.dtsi>
+
+&uart3 {
+       status = "okay";
+
+       /delete-property/interrupts;
+       interrupts-extended = <&intc GIC_SPI 604 IRQ_TYPE_LEVEL_HIGH>,
+                               <&tlmm 41 IRQ_TYPE_EDGE_FALLING>;
+
+       pinctrl-names = "default", "sleep";
+       pinctrl-1 = <&qup_uart3_sleep>;
+
+       bluetooth: bluetooth {
+               compatible = "qcom,wcn3991-bt";
+               vddio-supply = <&pp1800_l10a>;
+               vddxo-supply = <&pp1800_l1c>;
+               vddrf-supply = <&pp1300_l2c>;
+               vddch0-supply = <&pp3300_l10c>;
+               max-speed = <3200000>;
+               clocks = <&rpmhcc RPMH_RF_CLK2>;
+       };
+};
+
+&uart8 {
+       status = "okay";
+};
+
+&usb_1 {
+       status = "okay";
+};
+
+&usb_1_dwc3 {
+       dr_mode = "host";
+};
+
+&usb_1_hsphy {
+       status = "okay";
+       vdd-supply = <&vdd_qusb_hs0_core>;
+       vdda-pll-supply = <&vdda_qusb_hs0_1p8>;
+       vdda-phy-dpdm-supply = <&vdda_qusb_hs0_3p1>;
+       qcom,imp-res-offset-value = <8>;
+       qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_15_PERCENT>;
+       qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
+       qcom,bias-ctrl-value = <0x22>;
+       qcom,charge-ctrl-value = <3>;
+       qcom,hsdisc-trim-value = <0>;
+};
+
+&usb_1_qmpphy {
+       status = "okay";
+       vdda-phy-supply = <&vdda_usb_ss_dp_1p2>;
+       vdda-pll-supply = <&vdda_usb_ss_dp_core>;
+};
+
+&venus {
+       video-firmware {
+               iommus = <&apps_smmu 0x0c42 0x0>;
+       };
+};
+
+&wifi {
+       status = "okay";
+       vdd-0.8-cx-mx-supply = <&vdd_cx_wlan>;
+       vdd-1.8-xo-supply = <&pp1800_l1c>;
+       vdd-1.3-rfa-supply = <&pp1300_l2c>;
+       vdd-3.3-ch0-supply = <&pp3300_l10c>;
+       vdd-3.3-ch1-supply = <&pp3300_l11c>;
+
+       wifi-firmware {
+               iommus = <&apps_smmu 0xc2 0x1>;
+       };
+};
+
+/* PINCTRL - additions to nodes defined in sc7180.dtsi */
+
+&qspi_cs0 {
+       pinconf {
+               pins = "gpio68";
+               bias-disable;
+       };
+};
+
+&qspi_clk {
+       pinconf {
+               pins = "gpio63";
+               bias-disable;
+       };
+};
+
+&qspi_data01 {
+       pinconf {
+               pins = "gpio64", "gpio65";
+
+               /* High-Z when no transfers; nice to park the lines */
+               bias-pull-up;
+       };
+};
+
+&qup_i2c2_default {
+       pinconf {
+               pins = "gpio15", "gpio16";
+               drive-strength = <2>;
+
+               /* Has external pullup */
+               bias-disable;
+       };
+};
+
+&qup_i2c4_default {
+       pinconf {
+               pins = "gpio115", "gpio116";
+               drive-strength = <2>;
+
+               /* Has external pullup */
+               bias-disable;
+       };
+};
+
+&qup_i2c5_default {
+       pinconf {
+               pins = "gpio25", "gpio26";
+               drive-strength = <2>;
+
+               /* Has external pullup */
+               bias-disable;
+       };
+};
+
+&qup_i2c7_default {
+       pinconf {
+               pins = "gpio6", "gpio7";
+               drive-strength = <2>;
+
+               /* Has external pullup */
+               bias-disable;
+       };
+};
+
+&qup_i2c9_default {
+       pinconf {
+               pins = "gpio46", "gpio47";
+               drive-strength = <2>;
+
+               /* Has external pullup */
+               bias-disable;
+       };
+};
+
+&qup_spi0_default {
+       pinconf {
+               pins = "gpio34", "gpio35", "gpio36", "gpio37";
+               drive-strength = <2>;
+               bias-disable;
+       };
+};
+
+&qup_spi6_default {
+       pinconf {
+               pins = "gpio59", "gpio60", "gpio61", "gpio62";
+               drive-strength = <2>;
+               bias-disable;
+       };
+};
+
+&qup_spi10_default {
+       pinconf {
+               pins = "gpio86", "gpio87", "gpio88", "gpio89";
+               drive-strength = <2>;
+               bias-disable;
+       };
+};
+
+&qup_uart3_default {
+       pinconf-cts {
+               /*
+                * Configure a pull-down on CTS to match the pull of
+                * the Bluetooth module.
+                */
+               pins = "gpio38";
+               bias-pull-down;
+       };
+
+       pinconf-rts-tx {
+               /* We'll drive RTS and TX, so no pull */
+               pins = "gpio39", "gpio40";
+               drive-strength = <2>;
+               bias-disable;
+       };
+
+       pinconf-rx {
+               /*
+                * Configure a pull-up on RX. This is needed to avoid
+                * garbage data when the TX pin of the Bluetooth module is
+                * in tri-state (module powered off or not driving the
+                * signal yet).
+                */
+               pins = "gpio41";
+               bias-pull-up;
+       };
+};
+
+&qup_uart8_default {
+       pinconf-tx {
+               pins = "gpio44";
+               drive-strength = <2>;
+               bias-disable;
+       };
+
+       pinconf-rx {
+               pins = "gpio45";
+               drive-strength = <2>;
+               bias-pull-up;
+       };
+};
+
+/* PINCTRL - board-specific pinctrl */
+
+&pm6150_gpio {
+       status = "disabled"; /* No GPIOs are connected */
+};
+
+&pm6150l_gpio {
+       gpio-line-names = "AP_SUSPEND",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "",
+                         "";
+};
+
+&tlmm {
+       /*
+        * pinctrl settings for pins that have no real owners.
+        */
+       pinctrl-names = "default";
+       pinctrl-0 = <&bios_flash_wp_l>, <&ap_suspend_l_neuter>;
+
+       amp_en: amp-en {
+               pinmux {
+                       pins = "gpio23";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio23";
+                       bias-pull-down;
+               };
+       };
+
+       ap_ec_int_l: ap-ec-int-l {
+               pinmux {
+                       pins = "gpio94";
+                       function = "gpio";
+                       input-enable;
+               };
+
+               pinconf {
+                       pins = "gpio94";
+                       bias-pull-up;
+               };
+       };
+
+       ap_edp_bklten: ap-edp-bklten {
+               pinmux {
+                       pins = "gpio12";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio12";
+                       drive-strength = <2>;
+                       bias-disable;
+
+                       /* Force backlight to be disabled to match state at boot. */
+                       output-low;
+               };
+       };
+
+       ap_suspend_l_neuter: ap-suspend-l-neuter {
+               pinmux  {
+                       pins = "gpio27";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio27";
+                       bias-disable;
+               };
+       };
+
+       bios_flash_wp_l: bios-flash-wp-l {
+               pinmux {
+                       pins = "gpio66";
+                       function = "gpio";
+                       input-enable;
+               };
+
+               pinconf {
+                       pins = "gpio66";
+                       bias-disable;
+               };
+       };
+
+       dp_hot_plug_det: dp-hot-plug-det {
+                pinmux {
+                        pins = "gpio117";
+                        function = "dp_hot";
+                };
+
+                config {
+                        pins = "gpio117";
+                        bias-disable;
+                        input-enable;
+                        drive-strength = <2>;
+                };
+        };
+
+       edp_brij_en: edp-brij-en {
+               pinmux {
+                       pins = "gpio104";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio104";
+                       drive-strength = <2>;
+                       bias-disable;
+               };
+       };
+
+       edp_brij_irq: edp-brij-irq {
+               pinmux {
+                       pins = "gpio11";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio11";
+                       drive-strength = <2>;
+                       bias-pull-down;
+               };
+       };
+
+       en_pp3300_codec: en-pp3300-codec {
+               pinmux {
+                       pins = "gpio83";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio83";
+                       drive-strength = <2>;
+                       bias-disable;
+               };
+       };
+
+       en_pp3300_dx_edp: en-pp3300-dx-edp {
+               pinmux {
+                       pins = "gpio30";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio30";
+                       drive-strength = <2>;
+                       bias-disable;
+               };
+       };
+
+       fpmcu_boot0: fpmcu-boot0 {
+               pinmux {
+                       pins = "gpio10";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio10";
+                       bias-disable;
+                       drive-strength = <2>;
+                       output-low;
+               };
+       };
+
+       fpmcu_sel: fpmcu-sel {
+               pinmux {
+                       pins = "gpio22";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio22";
+                       bias-disable;
+                       drive-strength = <2>;
+                       output-high;
+               };
+       };
+
+       fp_rst_l: fp-rst-l {
+               pinmux {
+                       pins = "gpio5";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio5";
+                       bias-disable;
+                       drive-strength = <2>;
+                       output-high;
+               };
+       };
+
+       fp_to_ap_irq_l: fp-to-ap-irq-l {
+               pinmux {
+                       pins = "gpio4";
+                       function = "gpio";
+                       input-enable;
+               };
+
+               pinconf {
+                       pins = "gpio4";
+
+                       /* Has external pullup */
+                       bias-disable;
+               };
+       };
+
+
+       h1_ap_int_odl: h1-ap-int-odl {
+               pinmux {
+                       pins = "gpio42";
+                       function = "gpio";
+                       input-enable;
+               };
+
+               pinconf {
+                       pins = "gpio42";
+                       bias-pull-up;
+               };
+       };
+
+       hp_irq: hp-irq {
+               pinmux {
+                       pins = "gpio28";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio28";
+                       bias-pull-up;
+               };
+       };
+
+       pen_irq_l: pen-irq-l {
+               pinmux {
+                       pins = "gpio21";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio21";
+
+                       /* Has external pullup */
+                       bias-disable;
+               };
+       };
+
+       pen_pdct_l: pen-pdct-l {
+               pinmux {
+                       pins = "gpio52";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio52";
+
+                       /* Has external pullup */
+                       bias-disable;
+               };
+       };
+
+       pen_rst_odl: pen-rst-odl {
+               pinmux  {
+                       pins = "gpio18";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio18";
+                       bias-disable;
+                       drive-strength = <2>;
+
+                       /*
+                        * The pen driver doesn't currently support
+                        * driving this reset line.  By specifying
+                        * output-high here we're relying on the fact
+                        * that this pin has a default pulldown at boot
+                        * (which makes sure the pen was in reset if it
+                        * was powered) and then we set it high here to
+                        * take it out of reset.  Better would be if the
+                        * pen driver could control this and we could
+                        * remove "output-high" here.
+                        */
+                       output-high; /* TODO: Remove this? */
+               };
+       };
+
+       p_sensor_int_l: p-sensor-int-l {
+               pinmux {
+                       pins = "gpio24";
+                       function = "gpio";
+                       input-enable;
+               };
+
+               pinconf {
+                       pins = "gpio24";
+                       bias-pull-up;
+               };
+       };
+
+       qup_uart3_sleep: qup-uart3-sleep {
+               pinmux {
+                       pins = "gpio38", "gpio39",
+                              "gpio40", "gpio41";
+                       function = "gpio";
+               };
+
+               pinconf-cts {
+                       /*
+                        * Configure a pull-down on CTS to match the pull of
+                        * the Bluetooth module.
+                        */
+                       pins = "gpio38";
+                       bias-pull-down;
+               };
+
+               pinconf-rts {
+                       /*
+                        * Configure pull-down on RTS. As RTS is active low
+                        * signal, pull it low to indicate the BT SoC that it
+                        * can wakeup the system anytime from suspend state by
+                        * pulling RX low (by sending wakeup bytes).
+                        */
+                        pins = "gpio39";
+                        bias-pull-down;
+               };
+
+               pinconf-tx {
+                       /*
+                        * Configure pull-up on TX when it isn't actively driven
+                        * to prevent BT SoC from receiving garbage during sleep.
+                        */
+                       pins = "gpio40";
+                       bias-pull-up;
+               };
+
+               pinconf-rx {
+                       /*
+                        * Configure a pull-up on RX. This is needed to avoid
+                        * garbage data when the TX pin of the Bluetooth module
+                        * is floating which may cause spurious wakeups.
+                        */
+                       pins = "gpio41";
+                       bias-pull-up;
+               };
+       };
+
+       trackpad_int_1v8_odl: trackpad-int-1v8-odl {
+               pinmux {
+                       pins = "gpio58";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio58";
+
+                       /* Has external pullup */
+                       bias-disable;
+               };
+       };
+
+       ts_int_l: ts-int-l {
+               pinmux  {
+                       pins = "gpio9";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio9";
+                       bias-pull-up;
+               };
+       };
+
+       ts_reset_l: ts-reset-l {
+               pinmux  {
+                       pins = "gpio8";
+                       function = "gpio";
+               };
+
+               pinconf {
+                       pins = "gpio8";
+                       bias-disable;
+                       drive-strength = <2>;
+               };
+       };
+};
index d46b383..6678f1e 100644 (file)
@@ -8,6 +8,7 @@
 #include <dt-bindings/clock/qcom,dispcc-sc7180.h>
 #include <dt-bindings/clock/qcom,gcc-sc7180.h>
 #include <dt-bindings/clock/qcom,gpucc-sc7180.h>
+#include <dt-bindings/clock/qcom,lpasscorecc-sc7180.h>
 #include <dt-bindings/clock/qcom,rpmh.h>
 #include <dt-bindings/clock/qcom,videocc-sc7180.h>
 #include <dt-bindings/interconnect/qcom,osm-l3.h>
                        capacity-dmips-mhz = <1024>;
                        dynamic-power-coefficient = <100>;
                        operating-points-v2 = <&cpu0_opp_table>;
-                       interconnects = <&gem_noc MASTER_APPSS_PROC &mc_virt SLAVE_EBI1>,
+                       interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        next-level-cache = <&L2_0>;
                        #cooling-cells = <2>;
                        dynamic-power-coefficient = <100>;
                        next-level-cache = <&L2_100>;
                        operating-points-v2 = <&cpu0_opp_table>;
-                       interconnects = <&gem_noc MASTER_APPSS_PROC &mc_virt SLAVE_EBI1>,
+                       interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        dynamic-power-coefficient = <100>;
                        next-level-cache = <&L2_200>;
                        operating-points-v2 = <&cpu0_opp_table>;
-                       interconnects = <&gem_noc MASTER_APPSS_PROC &mc_virt SLAVE_EBI1>,
+                       interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        dynamic-power-coefficient = <100>;
                        next-level-cache = <&L2_300>;
                        operating-points-v2 = <&cpu0_opp_table>;
-                       interconnects = <&gem_noc MASTER_APPSS_PROC &mc_virt SLAVE_EBI1>,
+                       interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        dynamic-power-coefficient = <100>;
                        next-level-cache = <&L2_400>;
                        operating-points-v2 = <&cpu0_opp_table>;
-                       interconnects = <&gem_noc MASTER_APPSS_PROC &mc_virt SLAVE_EBI1>,
+                       interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        dynamic-power-coefficient = <100>;
                        next-level-cache = <&L2_500>;
                        operating-points-v2 = <&cpu0_opp_table>;
-                       interconnects = <&gem_noc MASTER_APPSS_PROC &mc_virt SLAVE_EBI1>,
+                       interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        dynamic-power-coefficient = <405>;
                        next-level-cache = <&L2_600>;
                        operating-points-v2 = <&cpu6_opp_table>;
-                       interconnects = <&gem_noc MASTER_APPSS_PROC &mc_virt SLAVE_EBI1>,
+                       interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        qcom,freq-domain = <&cpufreq_hw 1>;
                        dynamic-power-coefficient = <405>;
                        next-level-cache = <&L2_700>;
                        operating-points-v2 = <&cpu6_opp_table>;
-                       interconnects = <&gem_noc MASTER_APPSS_PROC &mc_virt SLAVE_EBI1>,
+                       interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        qcom,freq-domain = <&cpufreq_hw 1>;
                        clocks = <&gcc GCC_SDCC1_APPS_CLK>,
                                        <&gcc GCC_SDCC1_AHB_CLK>;
                        clock-names = "core", "iface";
+                       interconnects = <&aggre1_noc MASTER_EMMC 0 &mc_virt SLAVE_EBI1 0>,
+                                       <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_EMMC_CFG 0>;
+                       interconnect-names = "sdhc-ddr","cpu-sdhc";
                        power-domains = <&rpmhpd SC7180_CX>;
                        operating-points-v2 = <&sdhc1_opp_table>;
 
                                opp-100000000 {
                                        opp-hz = /bits/ 64 <100000000>;
                                        required-opps = <&rpmhpd_opp_low_svs>;
+                                       opp-peak-kBps = <100000 100000>;
+                                       opp-avg-kBps = <100000 50000>;
                                };
 
                                opp-384000000 {
                                        opp-hz = /bits/ 64 <384000000>;
                                        required-opps = <&rpmhpd_opp_svs_l1>;
+                                       opp-peak-kBps = <600000 900000>;
+                                       opp-avg-kBps = <261438 300000>;
                                };
                        };
                };
                        #size-cells = <2>;
                        ranges;
                        iommus = <&apps_smmu 0x43 0x0>;
-                       interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>;
+                       interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>;
                        interconnect-names = "qup-core";
                        status = "disabled";
 
                                interrupts = <GIC_SPI 601 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>,
-                                               <&aggre1_noc MASTER_QUP_0 &mc_virt SLAVE_EBI1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>,
+                                               <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>;
                                interconnect-names = "qup-core", "qup-config",
                                                        "qup-memory";
                                status = "disabled";
                                #size-cells = <0>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 601 IRQ_TYPE_LEVEL_HIGH>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 602 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>,
-                                               <&aggre1_noc MASTER_QUP_0 &mc_virt SLAVE_EBI1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>,
+                                               <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>;
                                interconnect-names = "qup-core", "qup-config",
                                                        "qup-memory";
                                status = "disabled";
                                #size-cells = <0>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 602 IRQ_TYPE_LEVEL_HIGH>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 603 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>,
-                                               <&aggre1_noc MASTER_QUP_0 &mc_virt SLAVE_EBI1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>,
+                                               <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>;
                                interconnect-names = "qup-core", "qup-config",
                                                        "qup-memory";
                                status = "disabled";
                                interrupts = <GIC_SPI 603 IRQ_TYPE_LEVEL_HIGH>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 604 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>,
-                                               <&aggre1_noc MASTER_QUP_0 &mc_virt SLAVE_EBI1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>,
+                                               <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>;
                                interconnect-names = "qup-core", "qup-config",
                                                        "qup-memory";
                                status = "disabled";
                                #size-cells = <0>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 604 IRQ_TYPE_LEVEL_HIGH>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 605 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>,
-                                               <&aggre1_noc MASTER_QUP_0 &mc_virt SLAVE_EBI1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>,
+                                               <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>;
                                interconnect-names = "qup-core", "qup-config",
                                                        "qup-memory";
                                status = "disabled";
                                interrupts = <GIC_SPI 605 IRQ_TYPE_LEVEL_HIGH>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 606 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>,
-                                               <&aggre1_noc MASTER_QUP_0 &mc_virt SLAVE_EBI1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>,
+                                               <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>;
                                interconnect-names = "qup-core", "qup-config",
                                                        "qup-memory";
                                status = "disabled";
                                #size-cells = <0>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 606 IRQ_TYPE_LEVEL_HIGH>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_0 0 &qup_virt SLAVE_QUP_CORE_0 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_0 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                        #size-cells = <2>;
                        ranges;
                        iommus = <&apps_smmu 0x4c3 0x0>;
-                       interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>;
+                       interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>;
                        interconnect-names = "qup-core";
                        status = "disabled";
 
                                interrupts = <GIC_SPI 353 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>,
-                                               <&aggre2_noc MASTER_QUP_1 &mc_virt SLAVE_EBI1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>,
+                                               <&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>;
                                interconnect-names = "qup-core", "qup-config",
                                                        "qup-memory";
                                status = "disabled";
                                #size-cells = <0>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 353 IRQ_TYPE_LEVEL_HIGH>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>,
-                                               <&aggre2_noc MASTER_QUP_1 &mc_virt SLAVE_EBI1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>,
+                                               <&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>;
                                interconnect-names = "qup-core", "qup-config",
                                                        "qup-memory";
                                status = "disabled";
                                interrupts = <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 355 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>,
-                                               <&aggre2_noc MASTER_QUP_1 &mc_virt SLAVE_EBI1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>,
+                                               <&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>;
                                interconnect-names = "qup-core", "qup-config",
                                                        "qup-memory";
                                status = "disabled";
                                #size-cells = <0>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 355 IRQ_TYPE_LEVEL_HIGH>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 356 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>,
-                                               <&aggre2_noc MASTER_QUP_1 &mc_virt SLAVE_EBI1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>,
+                                               <&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>;
                                interconnect-names = "qup-core", "qup-config",
                                                        "qup-memory";
                                status = "disabled";
                                interrupts = <GIC_SPI 356 IRQ_TYPE_LEVEL_HIGH>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>,
-                                               <&aggre2_noc MASTER_QUP_1 &mc_virt SLAVE_EBI1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>,
+                                               <&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>;
                                interconnect-names = "qup-core", "qup-config",
                                                        "qup-memory";
                                status = "disabled";
                                #size-cells = <0>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 358 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>,
-                                               <&aggre2_noc MASTER_QUP_1 &mc_virt SLAVE_EBI1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>,
+                                               <&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>;
                                interconnect-names = "qup-core", "qup-config",
                                                        "qup-memory";
                                status = "disabled";
                                #size-cells = <0>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                                interrupts = <GIC_SPI 358 IRQ_TYPE_LEVEL_HIGH>;
                                power-domains = <&rpmhpd SC7180_CX>;
                                operating-points-v2 = <&qup_opp_table>;
-                               interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>,
-                                               <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>;
+                               interconnects = <&qup_virt MASTER_QUP_CORE_1 0 &qup_virt SLAVE_QUP_CORE_1 0>,
+                                               <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_QUP_1 0>;
                                interconnect-names = "qup-core", "qup-config";
                                status = "disabled";
                        };
                config_noc: interconnect@1500000 {
                        compatible = "qcom,sc7180-config-noc";
                        reg = <0 0x01500000 0 0x28000>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                system_noc: interconnect@1620000 {
                        compatible = "qcom,sc7180-system-noc";
                        reg = <0 0x01620000 0 0x17080>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                mc_virt: interconnect@1638000 {
                        compatible = "qcom,sc7180-mc-virt";
                        reg = <0 0x01638000 0 0x1000>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                qup_virt: interconnect@1650000 {
                        compatible = "qcom,sc7180-qup-virt";
                        reg = <0 0x01650000 0 0x1000>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                aggre1_noc: interconnect@16e0000 {
                        compatible = "qcom,sc7180-aggre1-noc";
                        reg = <0 0x016e0000 0 0x15080>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                aggre2_noc: interconnect@1705000 {
                        compatible = "qcom,sc7180-aggre2-noc";
                        reg = <0 0x01705000 0 0x9000>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                compute_noc: interconnect@170e000 {
                        compatible = "qcom,sc7180-compute-noc";
                        reg = <0 0x0170e000 0 0x6000>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                mmss_noc: interconnect@1740000 {
                        compatible = "qcom,sc7180-mmss-noc";
                        reg = <0 0x01740000 0 0x1c100>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                ipa_virt: interconnect@1e00000 {
                        compatible = "qcom,sc7180-ipa-virt";
                        reg = <0 0x01e00000 0 0x1000>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                        clocks = <&rpmhcc RPMH_IPA_CLK>;
                        clock-names = "core";
 
-                       interconnects = <&aggre2_noc MASTER_IPA &mc_virt SLAVE_EBI1>,
-                                       <&aggre2_noc MASTER_IPA &system_noc SLAVE_IMEM>,
-                                       <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_IPA_CFG>;
+                       interconnects = <&aggre2_noc MASTER_IPA 0 &mc_virt SLAVE_EBI1 0>,
+                                       <&aggre2_noc MASTER_IPA 0 &system_noc SLAVE_IMEM 0>,
+                                       <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_IPA_CFG 0>;
                        interconnect-names = "memory",
                                             "imem",
                                             "config";
                        gpio-ranges = <&tlmm 0 0 120>;
                        wakeup-parent = <&pdc>;
 
+                       dp_hot_plug_det: dp-hot-plug-det {
+                               pinmux {
+                                       pins = "gpio117";
+                                       function = "dp_hot";
+                               };
+
+                               pinconf {
+                                       pins = "gpio117";
+                                       bias-disable;
+                                       input-enable;
+                               };
+                       };
+
                        qspi_clk: qspi-clk {
                                pinmux {
                                        pins = "gpio63";
                        operating-points-v2 = <&gpu_opp_table>;
                        qcom,gmu = <&gmu>;
 
-                       interconnects = <&gem_noc MASTER_GFX3D &mc_virt SLAVE_EBI1>;
+                       interconnects = <&gem_noc MASTER_GFX3D 0 &mc_virt SLAVE_EBI1 0>;
                        interconnect-names = "gfx-mem";
 
                        gpu_opp_table: opp-table {
                        clocks = <&gcc GCC_SDCC2_APPS_CLK>,
                                        <&gcc GCC_SDCC2_AHB_CLK>;
                        clock-names = "core", "iface";
+
+                       interconnects = <&aggre1_noc MASTER_SDCC_2 0 &mc_virt SLAVE_EBI1 0>,
+                                       <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_SDCC_2 0>;
+                       interconnect-names = "sdhc-ddr","cpu-sdhc";
                        power-domains = <&rpmhpd SC7180_CX>;
                        operating-points-v2 = <&sdhc2_opp_table>;
 
                                opp-100000000 {
                                        opp-hz = /bits/ 64 <100000000>;
                                        required-opps = <&rpmhpd_opp_low_svs>;
+                                       opp-peak-kBps = <160000 100000>;
+                                       opp-avg-kBps = <80000 50000>;
                                };
 
                                opp-202000000 {
                                        opp-hz = /bits/ 64 <202000000>;
                                        required-opps = <&rpmhpd_opp_svs_l1>;
+                                       opp-peak-kBps = <200000 120000>;
+                                       opp-avg-kBps = <100000 60000>;
                                };
                        };
                };
                        clocks = <&gcc GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
                                 <&gcc GCC_QSPI_CORE_CLK>;
                        clock-names = "iface", "core";
-                       interconnects = <&gem_noc MASTER_APPSS_PROC
-                                       &config_noc SLAVE_QSPI_0>;
+                       interconnects = <&gem_noc MASTER_APPSS_PROC 0
+                                       &config_noc SLAVE_QSPI_0 0>;
                        interconnect-names = "qspi-config";
                        power-domains = <&rpmhpd SC7180_CX>;
                        operating-points-v2 = <&qspi_opp_table>;
                dc_noc: interconnect@9160000 {
                        compatible = "qcom,sc7180-dc-noc";
                        reg = <0 0x09160000 0 0x03200>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                system-cache-controller@9200000 {
                        compatible = "qcom,sc7180-llcc";
-                       reg = <0 0x09200000 0 0x200000>, <0 0x09600000 0 0x50000>;
+                       reg = <0 0x09200000 0 0x50000>, <0 0x09600000 0 0x50000>;
                        reg-names = "llcc_base", "llcc_broadcast_base";
                        interrupts = <GIC_SPI 582 IRQ_TYPE_LEVEL_HIGH>;
                };
                gem_noc: interconnect@9680000 {
                        compatible = "qcom,sc7180-gem-noc";
                        reg = <0 0x09680000 0 0x3e200>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                npu_noc: interconnect@9990000 {
                        compatible = "qcom,sc7180-npu-noc";
                        reg = <0 0x09990000 0 0x1600>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
 
                        resets = <&gcc GCC_USB30_PRIM_BCR>;
 
-                       interconnects = <&aggre2_noc MASTER_USB3 &mc_virt SLAVE_EBI1>,
-                                       <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_USB3>;
+                       interconnects = <&aggre2_noc MASTER_USB3 0 &mc_virt SLAVE_EBI1 0>,
+                                       <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_USB3 0>;
                        interconnect-names = "usb-ddr", "apps-usb";
 
                        usb_1_dwc3: dwc3@a600000 {
                        reg = <0 0x0aa00000 0 0xff000>;
                        interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
                        power-domains = <&videocc VENUS_GDSC>,
-                                       <&videocc VCODEC0_GDSC>;
-                       power-domain-names = "venus", "vcodec0";
+                                       <&videocc VCODEC0_GDSC>,
+                                       <&rpmhpd SC7180_CX>;
+                       power-domain-names = "venus", "vcodec0", "cx";
+                       operating-points-v2 = <&venus_opp_table>;
                        clocks = <&videocc VIDEO_CC_VENUS_CTL_CORE_CLK>,
                                 <&videocc VIDEO_CC_VENUS_AHB_CLK>,
                                 <&videocc VIDEO_CC_VENUS_CTL_AXI_CLK>,
                                      "vcodec0_core", "vcodec0_bus";
                        iommus = <&apps_smmu 0x0c00 0x60>;
                        memory-region = <&venus_mem>;
-                       interconnects = <&mmss_noc MASTER_VIDEO_P0 &mc_virt SLAVE_EBI1>,
-                                       <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_VENUS_CFG>;
+                       interconnects = <&mmss_noc MASTER_VIDEO_P0 0 &mc_virt SLAVE_EBI1 0>,
+                                       <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>;
                        interconnect-names = "video-mem", "cpu-cfg";
 
                        video-decoder {
                        video-encoder {
                                compatible = "venus-encoder";
                        };
+
+                       venus_opp_table: venus-opp-table {
+                               compatible = "operating-points-v2";
+
+                               opp-150000000 {
+                                       opp-hz = /bits/ 64 <150000000>;
+                                       required-opps = <&rpmhpd_opp_low_svs>;
+                               };
+
+                               opp-270000000 {
+                                       opp-hz = /bits/ 64 <270000000>;
+                                       required-opps = <&rpmhpd_opp_svs>;
+                               };
+
+                               opp-340000000 {
+                                       opp-hz = /bits/ 64 <340000000>;
+                                       required-opps = <&rpmhpd_opp_svs_l1>;
+                               };
+
+                               opp-434000000 {
+                                       opp-hz = /bits/ 64 <434000000>;
+                                       required-opps = <&rpmhpd_opp_nom>;
+                               };
+
+                               opp-500000097 {
+                                       opp-hz = /bits/ 64 <500000097>;
+                                       required-opps = <&rpmhpd_opp_turbo>;
+                               };
+                       };
                };
 
                videocc: clock-controller@ab00000 {
                camnoc_virt: interconnect@ac00000 {
                        compatible = "qcom,sc7180-camnoc-virt";
                        reg = <0 0x0ac00000 0 0x1000>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                        power-domains = <&dispcc MDSS_GDSC>;
 
                        clocks = <&gcc GCC_DISP_AHB_CLK>,
-                                <&gcc GCC_DISP_HF_AXI_CLK>,
                                 <&dispcc DISP_CC_MDSS_AHB_CLK>,
                                 <&dispcc DISP_CC_MDSS_MDP_CLK>;
-                       clock-names = "iface", "bus", "ahb", "core";
+                       clock-names = "iface", "ahb", "core";
 
                        assigned-clocks = <&dispcc DISP_CC_MDSS_MDP_CLK>;
                        assigned-clock-rates = <300000000>;
                        interrupt-controller;
                        #interrupt-cells = <1>;
 
+                       interconnects = <&mmss_noc MASTER_MDP0 &mc_virt SLAVE_EBI1>;
+                       interconnect-names = "mdp0-mem";
+
                        iommus = <&apps_smmu 0x800 0x2>;
 
                        #address-cells = <2>;
                                      <0 0x0aeb0000 0 0x2008>;
                                reg-names = "mdp", "vbif";
 
-                               clocks = <&dispcc DISP_CC_MDSS_AHB_CLK>,
+                               clocks = <&gcc GCC_DISP_HF_AXI_CLK>,
+                                        <&dispcc DISP_CC_MDSS_AHB_CLK>,
                                         <&dispcc DISP_CC_MDSS_ROT_CLK>,
                                         <&dispcc DISP_CC_MDSS_MDP_LUT_CLK>,
                                         <&dispcc DISP_CC_MDSS_MDP_CLK>,
                                         <&dispcc DISP_CC_MDSS_VSYNC_CLK>;
-                               clock-names = "iface", "rot", "lut", "core",
+                               clock-names = "bus", "iface", "rot", "lut", "core",
                                              "vsync";
                                assigned-clocks = <&dispcc DISP_CC_MDSS_MDP_CLK>,
                                                  <&dispcc DISP_CC_MDSS_VSYNC_CLK>,
                                power-domains = <&rpmhpd SC7180_CX>;
 
                                interrupt-parent = <&mdss>;
-                               interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupts = <0>;
 
                                status = "disabled";
 
                                reg-names = "dsi_ctrl";
 
                                interrupt-parent = <&mdss>;
-                               interrupts = <4 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupts = <4>;
 
                                clocks = <&dispcc DISP_CC_MDSS_BYTE0_CLK>,
                                         <&dispcc DISP_CC_MDSS_BYTE0_INTF_CLK>,
                        qcom,msa-fixed-perm;
                        status = "disabled";
                };
+
+               lpasscc: clock-controller@62d00000 {
+                       compatible = "qcom,sc7180-lpasscorecc";
+                       reg = <0 0x62d00000 0 0x50000>,
+                             <0 0x62780000 0 0x30000>;
+                       reg-names = "lpass_core_cc", "lpass_audio_cc";
+                       clocks = <&gcc GCC_LPASS_CFG_NOC_SWAY_CLK>,
+                                <&rpmhcc RPMH_CXO_CLK>;
+                       clock-names = "iface", "bi_tcxo";
+                       power-domains = <&lpass_hm LPASS_CORE_HM_GDSCR>;
+                       #clock-cells = <1>;
+                       #power-domain-cells = <1>;
+               };
+
+               lpass_hm: clock-controller@63000000 {
+                       compatible = "qcom,sc7180-lpasshm";
+                       reg = <0 0x63000000 0 0x28>;
+                       clocks = <&gcc GCC_LPASS_CFG_NOC_SWAY_CLK>,
+                                <&rpmhcc RPMH_CXO_CLK>;
+                       clock-names = "iface", "bi_tcxo";
+                       #clock-cells = <1>;
+                       #power-domain-cells = <1>;
+               };
        };
 
        thermal-zones {
                        polling-delay = <0>;
 
                        thermal-sensors = <&tsens0 1>;
+                       sustainable-power = <768>;
 
                        trips {
                                cpu0_alert0: trip-point0 {
                        polling-delay = <0>;
 
                        thermal-sensors = <&tsens0 2>;
+                       sustainable-power = <768>;
 
                        trips {
                                cpu1_alert0: trip-point0 {
                        polling-delay = <0>;
 
                        thermal-sensors = <&tsens0 3>;
+                       sustainable-power = <768>;
 
                        trips {
                                cpu2_alert0: trip-point0 {
                        polling-delay = <0>;
 
                        thermal-sensors = <&tsens0 4>;
+                       sustainable-power = <768>;
 
                        trips {
                                cpu3_alert0: trip-point0 {
                        polling-delay = <0>;
 
                        thermal-sensors = <&tsens0 5>;
+                       sustainable-power = <768>;
 
                        trips {
                                cpu4_alert0: trip-point0 {
                        polling-delay = <0>;
 
                        thermal-sensors = <&tsens0 6>;
+                       sustainable-power = <768>;
 
                        trips {
                                cpu5_alert0: trip-point0 {
                        polling-delay = <0>;
 
                        thermal-sensors = <&tsens0 9>;
+                       sustainable-power = <1202>;
 
                        trips {
                                cpu6_alert0: trip-point0 {
                        polling-delay = <0>;
 
                        thermal-sensors = <&tsens0 10>;
+                       sustainable-power = <1202>;
 
                        trips {
                                cpu7_alert0: trip-point0 {
                        polling-delay = <0>;
 
                        thermal-sensors = <&tsens0 11>;
+                       sustainable-power = <1202>;
 
                        trips {
                                cpu8_alert0: trip-point0 {
                        polling-delay = <0>;
 
                        thermal-sensors = <&tsens0 12>;
+                       sustainable-power = <1202>;
 
                        trips {
                                cpu9_alert0: trip-point0 {
index 88efe82..deb928d 100644 (file)
                                <GIC_SPI 472 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 473 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 474 IRQ_TYPE_LEVEL_HIGH>;
+
+                       status = "disabled";
                };
 
                tcsr_mutex_regs: syscon@1f40000 {
                                <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 349 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 350 IRQ_TYPE_LEVEL_HIGH>;
+
+                       status = "disabled";
                };
 
                lpass_smmu: iommu@5100000 {
                                <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 310 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 404 IRQ_TYPE_LEVEL_HIGH>;
+
+                       status = "disabled";
                };
 
                spmi_bus: spmi@800f000 {
                                <GIC_SPI 274 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 275 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 276 IRQ_TYPE_LEVEL_HIGH>;
+
+                       status = "disabled";
                };
 
                apcs_glb: mailbox@17911000 {
index a2a9868..7cc2365 100644 (file)
                        port@0 {
                                reg = <0>;
 
-                               lt9611_out: endpoint {
-                                       remote-endpoint = <&hdmi_con>;
+                               lt9611_a: endpoint {
+                                       remote-endpoint = <&dsi0_out>;
                                };
                        };
 
-                       port@1 {
-                               reg = <1>;
+                       port@2 {
+                               reg = <2>;
 
-                               lt9611_a: endpoint {
-                                       remote-endpoint = <&dsi0_out>;
+                               lt9611_out: endpoint {
+                                       remote-endpoint = <&hdmi_con>;
                                };
                        };
                };
 };
 
 &cci {
-       status = "ok";
+       status = "okay";
 };
 
 &cci_i2c0 {
diff --git a/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts b/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts
new file mode 100644 (file)
index 0000000..86cbae6
--- /dev/null
@@ -0,0 +1,380 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
+#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
+#include "sdm845.dtsi"
+#include "pm8998.dtsi"
+#include "pmi8998.dtsi"
+
+/*
+ * Delete following upstream (sdm845.dtsi) reserved
+ * memory mappings which are different in this device.
+ */
+/delete-node/ &tz_mem;
+/delete-node/ &adsp_mem;
+/delete-node/ &wlan_msa_mem;
+/delete-node/ &mpss_region;
+/delete-node/ &venus_mem;
+/delete-node/ &cdsp_mem;
+/delete-node/ &mba_region;
+/delete-node/ &slpi_mem;
+/delete-node/ &spss_mem;
+/delete-node/ &rmtfs_mem;
+
+/ {
+       model = "Xiaomi Pocophone F1";
+       compatible = "xiaomi,beryllium", "qcom,sdm845";
+
+       /* required for bootloader to select correct board */
+       qcom,board-id = <69 0>;
+       qcom,msm-id = <321 0x20001>;
+
+       aliases {
+               hsuart0 = &uart6;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               autorepeat;
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&vol_up_pin_a>;
+
+               vol-up {
+                       label = "Volume Up";
+                       linux,code = <KEY_VOLUMEUP>;
+                       gpios = <&pm8998_gpio 6 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       /* Reserved memory changes from downstream */
+       reserved-memory {
+               tz_mem: memory@86200000 {
+                       reg = <0 0x86200000 0 0x4900000>;
+                       no-map;
+               };
+
+               adsp_mem: memory@8c500000 {
+                       reg = <0 0x8c500000 0 0x1e00000>;
+                       no-map;
+               };
+
+               wlan_msa_mem: memory@8e300000 {
+                       reg = <0 0x8e300000 0 0x100000>;
+                       no-map;
+               };
+
+               mpss_region: memory@8e400000 {
+                       reg = <0 0x8e400000 0 0x7800000>;
+                       no-map;
+               };
+
+               venus_mem: memory@95c00000 {
+                       reg = <0 0x95c00000 0 0x500000>;
+                       no-map;
+               };
+
+               cdsp_mem: memory@96100000 {
+                       reg = <0 0x96100000 0 0x800000>;
+                       no-map;
+               };
+
+               mba_region: memory@96900000 {
+                       reg = <0 0x96900000 0 0x200000>;
+                       no-map;
+               };
+
+               slpi_mem: memory@96b00000 {
+                       reg = <0 0x96b00000 0 0x1400000>;
+                       no-map;
+               };
+
+               spss_mem: memory@97f00000 {
+                       reg = <0 0x97f00000 0 0x100000>;
+                       no-map;
+               };
+
+               rmtfs_mem: memory@f6301000 {
+                       compatible = "qcom,rmtfs-mem";
+                       reg = <0 0xf6301000 0 0x200000>;
+                       no-map;
+
+                       qcom,client-id = <1>;
+                       qcom,vmid = <15>;
+               };
+       };
+
+       vreg_s4a_1p8: vreg-s4a-1p8 {
+               compatible = "regulator-fixed";
+               regulator-name = "vreg_s4a_1p8";
+
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-always-on;
+       };
+};
+
+&adsp_pas {
+       status = "okay";
+       firmware-name = "qcom/sdm845/adsp.mdt";
+};
+
+&apps_rsc {
+       pm8998-rpmh-regulators {
+               compatible = "qcom,pm8998-rpmh-regulators";
+               qcom,pmic-id = "a";
+
+               vreg_l1a_0p875: ldo1 {
+                       regulator-min-microvolt = <880000>;
+                       regulator-max-microvolt = <880000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l5a_0p8: ldo5 {
+                       regulator-min-microvolt = <800000>;
+                       regulator-max-microvolt = <800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l7a_1p8: ldo7 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l12a_1p8: ldo12 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l13a_2p95: ldo13 {
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <2960000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l17a_1p3: ldo17 {
+                       regulator-min-microvolt = <1304000>;
+                       regulator-max-microvolt = <1304000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l20a_2p95: ldo20 {
+                       regulator-min-microvolt = <2960000>;
+                       regulator-max-microvolt = <2968000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l21a_2p95: ldo21 {
+                       regulator-min-microvolt = <2960000>;
+                       regulator-max-microvolt = <2968000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l24a_3p075: ldo24 {
+                       regulator-min-microvolt = <3088000>;
+                       regulator-max-microvolt = <3088000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l25a_3p3: ldo25 {
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3312000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+
+               vreg_l26a_1p2: ldo26 {
+                       regulator-min-microvolt = <1200000>;
+                       regulator-max-microvolt = <1200000>;
+                       regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+               };
+       };
+};
+
+&cdsp_pas {
+       status = "okay";
+       firmware-name = "qcom/sdm845/cdsp.mdt";
+};
+
+&gcc {
+       protected-clocks = <GCC_QSPI_CORE_CLK>,
+                          <GCC_QSPI_CORE_CLK_SRC>,
+                          <GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
+                          <GCC_LPASS_Q6_AXI_CLK>,
+                          <GCC_LPASS_SWAY_CLK>;
+};
+
+&gpu {
+       zap-shader {
+               memory-region = <&gpu_mem>;
+               firmware-name = "qcom/sdm845/a630_zap.mbn";
+       };
+};
+
+&mss_pil {
+       status = "okay";
+       firmware-name = "qcom/sdm845/mba.mbn", "qcom/sdm845/modem.mdt";
+};
+
+&pm8998_gpio {
+       vol_up_pin_a: vol-up-active {
+               pins = "gpio6";
+               function = "normal";
+               input-enable;
+               bias-pull-up;
+               qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
+       };
+};
+
+&pm8998_pon {
+       resin {
+               compatible = "qcom,pm8941-resin";
+               interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
+               debounce = <15625>;
+               bias-pull-up;
+               linux,code = <KEY_VOLUMEDOWN>;
+       };
+};
+
+&qupv3_id_0 {
+       status = "okay";
+};
+
+&sdhc_2 {
+       status = "okay";
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdc2_default_state &sdc2_card_det_n>;
+
+       vmmc-supply = <&vreg_l21a_2p95>;
+       vqmmc-supply = <&vreg_l13a_2p95>;
+
+       bus-width = <4>;
+       cd-gpios = <&tlmm 126 GPIO_ACTIVE_HIGH>;
+};
+
+&tlmm {
+       gpio-reserved-ranges = <0 4>, <81 4>;
+
+       sdc2_default_state: sdc2-default {
+               clk {
+                       pins = "sdc2_clk";
+                       bias-disable;
+                       drive-strength = <16>;
+               };
+
+               cmd {
+                       pins = "sdc2_cmd";
+                       bias-pull-up;
+                       drive-strength = <10>;
+               };
+
+               data {
+                       pins = "sdc2_data";
+                       bias-pull-up;
+                       drive-strength = <10>;
+               };
+       };
+
+       sdc2_card_det_n: sd-card-det-n {
+               pins = "gpio126";
+               function = "gpio";
+               bias-pull-up;
+       };
+};
+
+&uart6 {
+       status = "okay";
+
+       bluetooth {
+               compatible = "qcom,wcn3990-bt";
+
+               vddio-supply = <&vreg_s4a_1p8>;
+               vddxo-supply = <&vreg_l7a_1p8>;
+               vddrf-supply = <&vreg_l17a_1p3>;
+               vddch0-supply = <&vreg_l25a_3p3>;
+               max-speed = <3200000>;
+       };
+};
+
+&ufs_mem_hc {
+       status = "okay";
+
+       reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>;
+
+       vcc-supply = <&vreg_l20a_2p95>;
+       vcc-max-microamp = <800000>;
+};
+
+&ufs_mem_phy {
+       status = "okay";
+
+       vdda-phy-supply = <&vreg_l1a_0p875>;
+       vdda-pll-supply = <&vreg_l26a_1p2>;
+};
+
+&usb_1 {
+       status = "okay";
+};
+
+&usb_1_dwc3 {
+       dr_mode = "peripheral";
+};
+
+&usb_1_hsphy {
+       status = "okay";
+
+       vdd-supply = <&vreg_l1a_0p875>;
+       vdda-pll-supply = <&vreg_l12a_1p8>;
+       vdda-phy-dpdm-supply = <&vreg_l24a_3p075>;
+
+       qcom,imp-res-offset-value = <8>;
+       qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
+       qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
+       qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
+};
+
+&usb_1_qmpphy {
+       status = "okay";
+
+       vdda-phy-supply = <&vreg_l26a_1p2>;
+       vdda-pll-supply = <&vreg_l1a_0p875>;
+};
+
+&wifi {
+       status = "okay";
+
+       vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
+       vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
+       vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
+       vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
+};
+
+/* PINCTRL - additions to nodes defined in sdm845.dtsi */
+
+&qup_uart6_default {
+       pinmux {
+               pins = "gpio45", "gpio46", "gpio47", "gpio48";
+               function = "qup6";
+       };
+
+       cts {
+               pins = "gpio45";
+               bias-disable;
+       };
+
+       rts-tx {
+               pins = "gpio46", "gpio47";
+               drive-strength = <2>;
+               bias-disable;
+       };
+
+       rx {
+               pins = "gpio48";
+               bias-pull-up;
+       };
+};
index 2884577..40e8c11 100644 (file)
                        dynamic-power-coefficient = <100>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        operating-points-v2 = <&cpu0_opp_table>;
-                       interconnects = <&gladiator_noc MASTER_APPSS_PROC &mem_noc SLAVE_EBI1>,
+                       interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_0>;
                        dynamic-power-coefficient = <100>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        operating-points-v2 = <&cpu0_opp_table>;
-                       interconnects = <&gladiator_noc MASTER_APPSS_PROC &mem_noc SLAVE_EBI1>,
+                       interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_100>;
                        dynamic-power-coefficient = <100>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        operating-points-v2 = <&cpu0_opp_table>;
-                       interconnects = <&gladiator_noc MASTER_APPSS_PROC &mem_noc SLAVE_EBI1>,
+                       interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_200>;
                        dynamic-power-coefficient = <100>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        operating-points-v2 = <&cpu0_opp_table>;
-                       interconnects = <&gladiator_noc MASTER_APPSS_PROC &mem_noc SLAVE_EBI1>,
+                       interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_300>;
                        dynamic-power-coefficient = <396>;
                        qcom,freq-domain = <&cpufreq_hw 1>;
                        operating-points-v2 = <&cpu4_opp_table>;
-                       interconnects = <&gladiator_noc MASTER_APPSS_PROC &mem_noc SLAVE_EBI1>,
+                       interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_400>;
                        dynamic-power-coefficient = <396>;
                        qcom,freq-domain = <&cpufreq_hw 1>;
                        operating-points-v2 = <&cpu4_opp_table>;
-                       interconnects = <&gladiator_noc MASTER_APPSS_PROC &mem_noc SLAVE_EBI1>,
+                       interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_500>;
                        dynamic-power-coefficient = <396>;
                        qcom,freq-domain = <&cpufreq_hw 1>;
                        operating-points-v2 = <&cpu4_opp_table>;
-                       interconnects = <&gladiator_noc MASTER_APPSS_PROC &mem_noc SLAVE_EBI1>,
+                       interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_600>;
                        dynamic-power-coefficient = <396>;
                        qcom,freq-domain = <&cpufreq_hw 1>;
                        operating-points-v2 = <&cpu4_opp_table>;
-                       interconnects = <&gladiator_noc MASTER_APPSS_PROC &mem_noc SLAVE_EBI1>,
+                       interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
                                        <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_700>;
                qup_opp_table: qup-opp-table {
                        compatible = "operating-points-v2";
 
-                       opp-19200000 {
-                               opp-hz = /bits/ 64 <19200000>;
+                       opp-50000000 {
+                               opp-hz = /bits/ 64 <50000000>;
                                required-opps = <&rpmhpd_opp_min_svs>;
                        };
 
                                opp-hz = /bits/ 64 <100000000>;
                                required-opps = <&rpmhpd_opp_svs>;
                        };
+
+                       opp-128000000 {
+                               opp-hz = /bits/ 64 <128000000>;
+                               required-opps = <&rpmhpd_opp_nom>;
+                       };
                };
 
                qupv3_id_0: geniqup@8c0000 {
                mem_noc: interconnect@1380000 {
                        compatible = "qcom,sdm845-mem-noc";
                        reg = <0 0x01380000 0 0x27200>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                dc_noc: interconnect@14e0000 {
                        compatible = "qcom,sdm845-dc-noc";
                        reg = <0 0x014e0000 0 0x400>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                config_noc: interconnect@1500000 {
                        compatible = "qcom,sdm845-config-noc";
                        reg = <0 0x01500000 0 0x5080>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                system_noc: interconnect@1620000 {
                        compatible = "qcom,sdm845-system-noc";
                        reg = <0 0x01620000 0 0x18080>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                aggre1_noc: interconnect@16e0000 {
                        compatible = "qcom,sdm845-aggre1-noc";
                        reg = <0 0x016e0000 0 0x15080>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                aggre2_noc: interconnect@1700000 {
                        compatible = "qcom,sdm845-aggre2-noc";
                        reg = <0 0x01700000 0 0x1f300>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                mmss_noc: interconnect@1740000 {
                        compatible = "qcom,sdm845-mmss-noc";
                        reg = <0 0x01740000 0 0x1c100>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
                        clocks = <&rpmhcc RPMH_IPA_CLK>;
                        clock-names = "core";
 
-                       interconnects = <&aggre2_noc MASTER_IPA &mem_noc SLAVE_EBI1>,
-                                       <&aggre2_noc MASTER_IPA &system_noc SLAVE_IMEM>,
-                                       <&gladiator_noc MASTER_APPSS_PROC &config_noc SLAVE_IPA_CFG>;
+                       interconnects = <&aggre2_noc MASTER_IPA 0 &mem_noc SLAVE_EBI1 0>,
+                                       <&aggre2_noc MASTER_IPA 0 &system_noc SLAVE_IMEM 0>,
+                                       <&gladiator_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_IPA_CFG 0>;
                        interconnect-names = "memory",
                                             "imem",
                                             "config";
 
                        resets = <&gcc GCC_USB30_PRIM_BCR>;
 
-                       interconnects = <&aggre2_noc MASTER_USB3_0 &mem_noc SLAVE_EBI1>,
-                                       <&gladiator_noc MASTER_APPSS_PROC &config_noc SLAVE_USB3_0>;
+                       interconnects = <&aggre2_noc MASTER_USB3_0 0 &mem_noc SLAVE_EBI1 0>,
+                                       <&gladiator_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_USB3_0 0>;
                        interconnect-names = "usb-ddr", "apps-usb";
 
                        usb_1_dwc3: dwc3@a600000 {
 
                        resets = <&gcc GCC_USB30_SEC_BCR>;
 
-                       interconnects = <&aggre2_noc MASTER_USB3_1 &mem_noc SLAVE_EBI1>,
-                                       <&gladiator_noc MASTER_APPSS_PROC &config_noc SLAVE_USB3_1>;
+                       interconnects = <&aggre2_noc MASTER_USB3_1 0 &mem_noc SLAVE_EBI1 0>,
+                                       <&gladiator_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_USB3_1 0>;
                        interconnect-names = "usb-ddr", "apps-usb";
 
                        usb_2_dwc3: dwc3@a800000 {
                        interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
                        power-domains = <&videocc VENUS_GDSC>,
                                        <&videocc VCODEC0_GDSC>,
-                                       <&videocc VCODEC1_GDSC>;
-                       power-domain-names = "venus", "vcodec0", "vcodec1";
+                                       <&videocc VCODEC1_GDSC>,
+                                       <&rpmhpd SDM845_CX>;
+                       power-domain-names = "venus", "vcodec0", "vcodec1", "cx";
+                       operating-points-v2 = <&venus_opp_table>;
                        clocks = <&videocc VIDEO_CC_VENUS_CTL_CORE_CLK>,
                                 <&videocc VIDEO_CC_VENUS_AHB_CLK>,
                                 <&videocc VIDEO_CC_VENUS_CTL_AXI_CLK>,
                        video-core1 {
                                compatible = "venus-encoder";
                        };
+
+                       venus_opp_table: venus-opp-table {
+                               compatible = "operating-points-v2";
+
+                               opp-100000000 {
+                                       opp-hz = /bits/ 64 <100000000>;
+                                       required-opps = <&rpmhpd_opp_min_svs>;
+                               };
+
+                               opp-200000000 {
+                                       opp-hz = /bits/ 64 <200000000>;
+                                       required-opps = <&rpmhpd_opp_low_svs>;
+                               };
+
+                               opp-320000000 {
+                                       opp-hz = /bits/ 64 <320000000>;
+                                       required-opps = <&rpmhpd_opp_svs>;
+                               };
+
+                               opp-380000000 {
+                                       opp-hz = /bits/ 64 <380000000>;
+                                       required-opps = <&rpmhpd_opp_svs_l1>;
+                               };
+
+                               opp-444000000 {
+                                       opp-hz = /bits/ 64 <444000000>;
+                                       required-opps = <&rpmhpd_opp_nom>;
+                               };
+
+                               opp-533000097 {
+                                       opp-hz = /bits/ 64 <533000097>;
+                                       required-opps = <&rpmhpd_opp_turbo>;
+                               };
+                       };
                };
 
                videocc: clock-controller@ab00000 {
                        interrupt-controller;
                        #interrupt-cells = <1>;
 
+                       interconnects = <&mmss_noc MASTER_MDP0 0 &mem_noc SLAVE_EBI1 0>,
+                                       <&mmss_noc MASTER_MDP1 0 &mem_noc SLAVE_EBI1 0>;
+                       interconnect-names = "mdp0-mem", "mdp1-mem";
+
                        iommus = <&apps_smmu 0x880 0x8>,
                                 <&apps_smmu 0xc80 0x8>;
 
 
                        qcom,gmu = <&gmu>;
 
-                       interconnects = <&mem_noc MASTER_GFX3D &mem_noc SLAVE_EBI1>;
+                       interconnects = <&mem_noc MASTER_GFX3D 0 &mem_noc SLAVE_EBI1 0>;
                        interconnect-names = "gfx-mem";
 
                        gpu_opp_table: opp-table {
                gladiator_noc: interconnect@17900000 {
                        compatible = "qcom,sdm845-gladiator-noc";
                        reg = <0 0x17900000 0 0xd080>;
-                       #interconnect-cells = <1>;
+                       #interconnect-cells = <2>;
                        qcom,bcm-voters = <&apps_bcm_voter>;
                };
 
index b86a7ea..f0a872e 100644 (file)
@@ -10,6 +10,8 @@
 #include <dt-bindings/soc/qcom,rpmh-rsc.h>
 #include <dt-bindings/clock/qcom,rpmh.h>
 #include <dt-bindings/clock/qcom,gcc-sm8150.h>
+#include <dt-bindings/clock/qcom,gpucc-sm8150.h>
+#include <dt-bindings/interconnect/qcom,osm-l3.h>
 #include <dt-bindings/thermal/thermal.h>
 
 / {
                        };
                };
 
+               config_noc: interconnect@1500000 {
+                       compatible = "qcom,sm8150-config-noc";
+                       reg = <0 0x01500000 0 0x7400>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               system_noc: interconnect@1620000 {
+                       compatible = "qcom,sm8150-system-noc";
+                       reg = <0 0x01620000 0 0x19400>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               mc_virt: interconnect@163a000 {
+                       compatible = "qcom,sm8150-mc-virt";
+                       reg = <0 0x0163a000 0 0x1000>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               aggre1_noc: interconnect@16e0000 {
+                       compatible = "qcom,sm8150-aggre1-noc";
+                       reg = <0 0x016e0000 0 0xd080>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               aggre2_noc: interconnect@1700000 {
+                       compatible = "qcom,sm8150-aggre2-noc";
+                       reg = <0 0x01700000 0 0x20000>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               compute_noc: interconnect@1720000 {
+                       compatible = "qcom,sm8150-compute-noc";
+                       reg = <0 0x01720000 0 0x7000>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               mmss_noc: interconnect@1740000 {
+                       compatible = "qcom,sm8150-mmss-noc";
+                       reg = <0 0x01740000 0 0x1c100>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
                ufs_mem_hc: ufshc@1d84000 {
                        compatible = "qcom,sm8150-ufshc", "qcom,ufshc",
                                     "jedec,ufs-2.0";
                        };
                };
 
+               ipa_virt: interconnect@1e00000 {
+                       compatible = "qcom,sm8150-ipa-virt";
+                       reg = <0 0x01e00000 0 0x1000>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
                tcsr_mutex_regs: syscon@1f40000 {
                        compatible = "syscon";
                        reg = <0x0 0x01f40000 0x0 0x40000>;
                                     <GIC_SPI 305 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-names = "hfi", "gmu";
 
-                       clocks = <&gpucc 0>,
-                                <&gpucc 3>,
-                                <&gpucc 6>,
+                       clocks = <&gpucc GPU_CC_AHB_CLK>,
+                                <&gpucc GPU_CC_CX_GMU_CLK>,
+                                <&gpucc GPU_CC_CXO_CLK>,
                                 <&gcc GCC_DDRSS_GPU_AXI_CLK>,
                                 <&gcc GCC_GPU_MEMNOC_GFX_CLK>;
                        clock-names = "ahb", "gmu", "cxo", "axi", "memnoc";
 
-                       power-domains = <&gpucc 0>,
-                                       <&gpucc 1>;
+                       power-domains = <&gpucc GPU_CX_GDSC>,
+                                       <&gpucc GPU_GX_GDSC>;
                        power-domain-names = "cx", "gx";
 
                        iommus = <&adreno_smmu 5 0x400>;
                                <GIC_SPI 686 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 687 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 688 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gpucc 0>,
+                       clocks = <&gpucc GPU_CC_AHB_CLK>,
                                 <&gcc GCC_GPU_MEMNOC_GFX_CLK>,
                                 <&gcc GCC_GPU_SNOC_DVM_GFX_CLK>;
                        clock-names = "ahb", "bus", "iface";
 
-                       power-domains = <&gpucc 0>;
+                       power-domains = <&gpucc GPU_CX_GDSC>;
                };
 
                tlmm: pinctrl@3100000 {
 
                usb_1_hsphy: phy@88e2000 {
                        compatible = "qcom,sm8150-usb-hs-phy",
-                                                       "qcom,usb-snps-hs-7nm-phy";
+                                    "qcom,usb-snps-hs-7nm-phy";
                        reg = <0 0x088e2000 0 0x400>;
                        status = "disabled";
                        #phy-cells = <0>;
                        };
                };
 
+               dc_noc: interconnect@9160000 {
+                       compatible = "qcom,sm8150-dc-noc";
+                       reg = <0 0x09160000 0 0x3200>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               gem_noc: interconnect@9680000 {
+                       compatible = "qcom,sm8150-gem-noc";
+                       reg = <0 0x09680000 0 0x3e200>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
                usb_1: usb@a6f8800 {
                        compatible = "qcom,sm8150-dwc3", "qcom,dwc3";
                        reg = <0 0x0a6f8800 0 0x400>;
 
                        assigned-clocks = <&gcc GCC_USB30_PRIM_MOCK_UTMI_CLK>,
                                          <&gcc GCC_USB30_PRIM_MASTER_CLK>;
-                       assigned-clock-rates = <19200000>, <150000000>;
+                       assigned-clock-rates = <19200000>, <200000000>;
 
                        interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>,
                        };
                };
 
+               camnoc_virt: interconnect@ac00000 {
+                       compatible = "qcom,sm8150-camnoc-virt";
+                       reg = <0 0x0ac00000 0 0x1000>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
                aoss_qmp: power-controller@c300000 {
                        compatible = "qcom,sm8150-aoss-qmp";
                        reg = <0x0 0x0c300000 0x0 0x100000>;
                                        };
                                };
                        };
+
+                       apps_bcm_voter: bcm_voter {
+                               compatible = "qcom,bcm-voter";
+                       };
+               };
+
+               osm_l3: interconnect@18321000 {
+                       compatible = "qcom,sm8150-osm-l3";
+                       reg = <0 0x18321000 0 0x1400>;
+
+                       clocks = <&rpmhcc RPMH_CXO_CLK>, <&gcc GPLL0>;
+                       clock-names = "xo", "alternate";
+
+                       #interconnect-cells = <1>;
                };
 
                cpufreq_hw: cpufreq@18323000 {
index 6894f84..fd194ed 100644 (file)
@@ -17,7 +17,7 @@
        compatible = "qcom,sm8250-mtp";
 
        aliases {
-               serial0 = &uart2;
+               serial0 = &uart12;
        };
 
        chosen {
        firmware-name = "qcom/sm8250/cdsp.mbn";
 };
 
+&i2c1 {
+       status = "okay";
+       clock-frequency = <1000000>;
+
+       /* NQ NFC chip @28 */
+};
+
+&i2c13 {
+       status = "okay";
+
+       /* st,stmfts @ 49 */
+};
+
+&i2c15 {
+       status = "okay";
+
+       /* smb1390 @ 10 */
+       /* rtc6226 @ 64 */
+};
+
+&qupv3_id_0 {
+       status = "okay";
+};
+
 &qupv3_id_1 {
        status = "okay";
 };
 
+&qupv3_id_2 {
+       status = "okay";
+};
+
 &slpi {
        status = "okay";
        firmware-name = "qcom/sm8250/slpi.mbn";
        gpio-reserved-ranges = <28 4>, <40 4>;
 };
 
-&uart2 {
+&uart12 {
        status = "okay";
 };
 
index 377172e..d057d85 100644 (file)
@@ -5,11 +5,14 @@
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/clock/qcom,gcc-sm8250.h>
+#include <dt-bindings/clock/qcom,gpucc-sm8250.h>
 #include <dt-bindings/clock/qcom,rpmh.h>
+#include <dt-bindings/interconnect/qcom,osm-l3.h>
 #include <dt-bindings/mailbox/qcom-ipcc.h>
 #include <dt-bindings/power/qcom-aoss-qmp.h>
 #include <dt-bindings/power/qcom-rpmpd.h>
 #include <dt-bindings/soc/qcom,rpmh-rsc.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
        interrupt-parent = <&intc>;
@@ -72,7 +75,7 @@
 
                sleep_clk: sleep-clk {
                        compatible = "fixed-clock";
-                       clock-frequency = <32000>;
+                       clock-frequency = <32768>;
                        #clock-cells = <0>;
                };
        };
@@ -87,6 +90,8 @@
                        reg = <0x0 0x0>;
                        enable-method = "psci";
                        next-level-cache = <&L2_0>;
+                       qcom,freq-domain = <&cpufreq_hw 0>;
+                       #cooling-cells = <2>;
                        L2_0: l2-cache {
                              compatible = "cache";
                              next-level-cache = <&L3_0>;
                        reg = <0x0 0x100>;
                        enable-method = "psci";
                        next-level-cache = <&L2_100>;
+                       qcom,freq-domain = <&cpufreq_hw 0>;
+                       #cooling-cells = <2>;
                        L2_100: l2-cache {
                              compatible = "cache";
                              next-level-cache = <&L3_0>;
                        reg = <0x0 0x200>;
                        enable-method = "psci";
                        next-level-cache = <&L2_200>;
+                       qcom,freq-domain = <&cpufreq_hw 0>;
+                       #cooling-cells = <2>;
                        L2_200: l2-cache {
                              compatible = "cache";
                              next-level-cache = <&L3_0>;
                        reg = <0x0 0x300>;
                        enable-method = "psci";
                        next-level-cache = <&L2_300>;
+                       qcom,freq-domain = <&cpufreq_hw 0>;
+                       #cooling-cells = <2>;
                        L2_300: l2-cache {
                              compatible = "cache";
                              next-level-cache = <&L3_0>;
                        reg = <0x0 0x400>;
                        enable-method = "psci";
                        next-level-cache = <&L2_400>;
+                       qcom,freq-domain = <&cpufreq_hw 1>;
+                       #cooling-cells = <2>;
                        L2_400: l2-cache {
                              compatible = "cache";
                              next-level-cache = <&L3_0>;
                        reg = <0x0 0x500>;
                        enable-method = "psci";
                        next-level-cache = <&L2_500>;
+                       qcom,freq-domain = <&cpufreq_hw 1>;
+                       #cooling-cells = <2>;
                        L2_500: l2-cache {
                              compatible = "cache";
                              next-level-cache = <&L3_0>;
                        reg = <0x0 0x600>;
                        enable-method = "psci";
                        next-level-cache = <&L2_600>;
+                       qcom,freq-domain = <&cpufreq_hw 1>;
+                       #cooling-cells = <2>;
                        L2_600: l2-cache {
                              compatible = "cache";
                              next-level-cache = <&L3_0>;
                        reg = <0x0 0x700>;
                        enable-method = "psci";
                        next-level-cache = <&L2_700>;
+                       qcom,freq-domain = <&cpufreq_hw 2>;
+                       #cooling-cells = <2>;
                        L2_700: l2-cache {
                              compatible = "cache";
                              next-level-cache = <&L3_0>;
                        #clock-cells = <1>;
                        #reset-cells = <1>;
                        #power-domain-cells = <1>;
-                       clock-names = "bi_tcxo", "sleep_clk";
-                       clocks = <&rpmhcc RPMH_CXO_CLK>, <&sleep_clk>;
+                       clock-names = "bi_tcxo",
+                                     "bi_tcxo_ao",
+                                     "sleep_clk";
+                       clocks = <&rpmhcc RPMH_CXO_CLK>,
+                                <&rpmhcc RPMH_CXO_CLK_A>,
+                                <&sleep_clk>;
                };
 
                ipcc: mailbox@408000 {
                        #mbox-cells = <2>;
                };
 
+               qup_opp_table: qup-opp-table {
+                       compatible = "operating-points-v2";
+
+                       opp-50000000 {
+                               opp-hz = /bits/ 64 <50000000>;
+                               required-opps = <&rpmhpd_opp_min_svs>;
+                       };
+
+                       opp-75000000 {
+                               opp-hz = /bits/ 64 <75000000>;
+                               required-opps = <&rpmhpd_opp_low_svs>;
+                       };
+
+                       opp-120000000 {
+                               opp-hz = /bits/ 64 <120000000>;
+                               required-opps = <&rpmhpd_opp_svs>;
+                       };
+               };
+
                qupv3_id_2: geniqup@8c0000 {
                        compatible = "qcom,geni-se-qup";
                        reg = <0x0 0x008c0000 0x0 0x6000>;
                                interrupts = <GIC_SPI 373 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 583 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 584 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 585 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
+                               status = "disabled";
+                       };
+
+                       uart17: serial@88c000 {
+                               compatible = "qcom,geni-uart";
+                               reg = <0 0x0088c000 0 0x4000>;
+                               clock-names = "se";
+                               clocks = <&gcc GCC_QUPV3_WRAP2_S3_CLK>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&qup_uart17_default>;
+                               interrupts = <GIC_SPI 585 IRQ_TYPE_LEVEL_HIGH>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 586 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
+                               status = "disabled";
+                       };
+
+                       uart18: serial@890000 {
+                               compatible = "qcom,geni-uart";
+                               reg = <0 0x00890000 0 0x4000>;
+                               clock-names = "se";
+                               clocks = <&gcc GCC_QUPV3_WRAP2_S4_CLK>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&qup_uart18_default>;
+                               interrupts = <GIC_SPI 586 IRQ_TYPE_LEVEL_HIGH>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 587 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
                };
                                interrupts = <GIC_SPI 601 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 602 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 603 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
+                               status = "disabled";
+                       };
+
+                       uart2: serial@988000 {
+                               compatible = "qcom,geni-debug-uart";
+                               reg = <0 0x00988000 0 0x4000>;
+                               clock-names = "se";
+                               clocks = <&gcc GCC_QUPV3_WRAP0_S2_CLK>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&qup_uart2_default>;
+                               interrupts = <GIC_SPI 603 IRQ_TYPE_LEVEL_HIGH>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 604 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 605 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 606 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 607 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
+                               status = "disabled";
+                       };
+
+                       uart6: serial@998000 {
+                               compatible = "qcom,geni-uart";
+                               reg = <0 0x00998000 0 0x4000>;
+                               clock-names = "se";
+                               clocks = <&gcc GCC_QUPV3_WRAP0_S6_CLK>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&qup_uart6_default>;
+                               interrupts = <GIC_SPI 607 IRQ_TYPE_LEVEL_HIGH>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 608 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
                };
                                interrupts = <GIC_SPI 353 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 355 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 356 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
-                       uart2: serial@a90000 {
+                       uart12: serial@a90000 {
                                compatible = "qcom,geni-debug-uart";
                                reg = <0x0 0x00a90000 0x0 0x4000>;
                                clock-names = "se";
                                clocks = <&gcc GCC_QUPV3_WRAP1_S4_CLK>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&qup_uart12_default>;
                                interrupts = <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 358 IRQ_TYPE_LEVEL_HIGH>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               power-domains = <&rpmhpd SM8250_CX>;
+                               operating-points-v2 = <&qup_opp_table>;
                                status = "disabled";
                        };
                };
 
+               config_noc: interconnect@1500000 {
+                       compatible = "qcom,sm8250-config-noc";
+                       reg = <0 0x01500000 0 0xa580>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               system_noc: interconnect@1620000 {
+                       compatible = "qcom,sm8250-system-noc";
+                       reg = <0 0x01620000 0 0x1c200>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               mc_virt: interconnect@163d000 {
+                       compatible = "qcom,sm8250-mc-virt";
+                       reg = <0 0x0163d000 0 0x1000>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               aggre1_noc: interconnect@16e0000 {
+                       compatible = "qcom,sm8250-aggre1-noc";
+                       reg = <0 0x016e0000 0 0x1f180>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               aggre2_noc: interconnect@1700000 {
+                       compatible = "qcom,sm8250-aggre2-noc";
+                       reg = <0 0x01700000 0 0x33000>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               compute_noc: interconnect@1733000 {
+                       compatible = "qcom,sm8250-compute-noc";
+                       reg = <0 0x01733000 0 0xa180>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               mmss_noc: interconnect@1740000 {
+                       compatible = "qcom,sm8250-mmss-noc";
+                       reg = <0 0x01740000 0 0x1f080>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
                ufs_mem_hc: ufshc@1d84000 {
                        compatible = "qcom,sm8250-ufshc", "qcom,ufshc",
                                     "jedec,ufs-2.0";
                        };
                };
 
+               ipa_virt: interconnect@1e00000 {
+                       compatible = "qcom,sm8250-ipa-virt";
+                       reg = <0 0x01e00000 0 0x1000>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
                tcsr_mutex: hwlock@1f40000 {
                        compatible = "qcom,tcsr-mutex";
                        reg = <0x0 0x01f40000 0x0 0x40000>;
                                     <GIC_SPI 305 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-names = "hfi", "gmu";
 
-                       clocks = <&gpucc 0>,
-                                <&gpucc 3>,
-                                <&gpucc 6>,
+                       clocks = <&gpucc GPU_CC_AHB_CLK>,
+                                <&gpucc GPU_CC_CX_GMU_CLK>,
+                                <&gpucc GPU_CC_CXO_CLK>,
                                 <&gcc GCC_DDRSS_GPU_AXI_CLK>,
                                 <&gcc GCC_GPU_MEMNOC_GFX_CLK>;
                        clock-names = "ahb", "gmu", "cxo", "axi", "memnoc";
 
-                       power-domains = <&gpucc 0>,
-                                       <&gpucc 1>;
+                       power-domains = <&gpucc GPU_CX_GDSC>,
+                                       <&gpucc GPU_GX_GDSC>;
                        power-domain-names = "cx", "gx";
 
                        iommus = <&adreno_smmu 5 0x400>;
                                     <GIC_SPI 683 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 684 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 685 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&gpucc 0>,
+                       clocks = <&gpucc GPU_CC_AHB_CLK>,
                                 <&gcc GCC_GPU_MEMNOC_GFX_CLK>,
                                 <&gcc GCC_GPU_SNOC_DVM_GFX_CLK>;
                        clock-names = "ahb", "bus", "iface";
 
-                       power-domains = <&gpucc 0>;
+                       power-domains = <&gpucc GPU_CX_GDSC>;
                };
 
                slpi: remoteproc@5c00000 {
                        };
                };
 
+               dc_noc: interconnect@90c0000 {
+                       compatible = "qcom,sm8250-dc-noc";
+                       reg = <0 0x090c0000 0 0x4200>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               gem_noc: interconnect@9100000 {
+                       compatible = "qcom,sm8250-gem-noc";
+                       reg = <0 0x09100000 0 0xb4000>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
+               npu_noc: interconnect@9990000 {
+                       compatible = "qcom,sm8250-npu-noc";
+                       reg = <0 0x09990000 0 0x1600>;
+                       #interconnect-cells = <1>;
+                       qcom,bcm-voters = <&apps_bcm_voter>;
+               };
+
                pdc: interrupt-controller@b220000 {
                        compatible = "qcom,sm8250-pdc", "qcom,pdc";
                        reg = <0 0x0b220000 0 0x30000>, <0 0x17c000f0 0 0x60>;
                        interrupt-controller;
                };
 
+               tsens0: thermal-sensor@c263000 {
+                       compatible = "qcom,sm8250-tsens", "qcom,tsens-v2";
+                       reg = <0 0x0c263000 0 0x1ff>, /* TM */
+                             <0 0x0c222000 0 0x1ff>; /* SROT */
+                       #qcom,sensors = <16>;
+                       interrupts = <GIC_SPI 506 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 508 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "uplow", "critical";
+                       #thermal-sensor-cells = <1>;
+               };
+
+               tsens1: thermal-sensor@c265000 {
+                       compatible = "qcom,sm8250-tsens", "qcom,tsens-v2";
+                       reg = <0 0x0c265000 0 0x1ff>, /* TM */
+                             <0 0x0c223000 0 0x1ff>; /* SROT */
+                       #qcom,sensors = <9>;
+                       interrupts = <GIC_SPI 507 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 509 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "uplow", "critical";
+                       #thermal-sensor-cells = <1>;
+               };
+
                aoss_qmp: qmp@c300000 {
                        compatible = "qcom,sm8250-aoss-qmp";
                        reg = <0 0x0c300000 0 0x100000>;
                                        bias-disable;
                                };
                        };
+
+                       qup_uart2_default: qup-uart2-default {
+                               mux {
+                                       pins = "gpio117", "gpio118";
+                                       function = "qup2";
+                               };
+                       };
+
+                       qup_uart6_default: qup-uart6-default {
+                               mux {
+                                       pins = "gpio16", "gpio17",
+                                               "gpio18", "gpio19";
+                                       function = "qup6";
+                               };
+                       };
+
+                       qup_uart12_default: qup-uart12-default {
+                               mux {
+                                       pins = "gpio34", "gpio35";
+                                       function = "qup12";
+                               };
+                       };
+
+                       qup_uart17_default: qup-uart17-default {
+                               mux {
+                                       pins = "gpio52", "gpio53",
+                                               "gpio54", "gpio55";
+                                       function = "qup17";
+                               };
+                       };
+
+                       qup_uart18_default: qup-uart18-default {
+                               mux {
+                                       pins = "gpio58", "gpio59";
+                                       function = "qup18";
+                               };
+                       };
                };
 
                adsp: remoteproc@17300000 {
                                        };
                                };
                        };
+
+                       apps_bcm_voter: bcm_voter {
+                               compatible = "qcom,bcm-voter";
+                       };
+               };
+
+               epss_l3: interconnect@18591000 {
+                       compatible = "qcom,sm8250-epss-l3";
+                       reg = <0 0x18590000 0 0x1000>;
+
+                       clocks = <&rpmhcc RPMH_CXO_CLK>, <&gcc GPLL0>;
+                       clock-names = "xo", "alternate";
+
+                       #interconnect-cells = <1>;
+               };
+
+               cpufreq_hw: cpufreq@18591000 {
+                       compatible = "qcom,sm8250-cpufreq-epss", "qcom,cpufreq-epss";
+                       reg = <0 0x18591000 0 0x1000>,
+                             <0 0x18592000 0 0x1000>,
+                             <0 0x18593000 0 0x1000>;
+                       reg-names = "freq-domain0", "freq-domain1",
+                                   "freq-domain2";
+
+                       clocks = <&rpmhcc RPMH_CXO_CLK>, <&gcc GPLL0>;
+                       clock-names = "xo", "alternate";
+
+                       #freq-domain-cells = <1>;
                };
        };
 
                             <GIC_PPI 12
                                (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>;
        };
+
+       thermal-zones {
+               cpu0-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 1>;
+
+                       trips {
+                               cpu0_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu0_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu0_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <1000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu0_alert0>;
+                                       cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                               map1 {
+                                       trip = <&cpu0_alert1>;
+                                       cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               cpu1-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 2>;
+
+                       trips {
+                               cpu1_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu1_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu1_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <1000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu1_alert0>;
+                                       cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                               map1 {
+                                       trip = <&cpu1_alert1>;
+                                       cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               cpu2-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 3>;
+
+                       trips {
+                               cpu2_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu2_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu2_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <1000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu2_alert0>;
+                                       cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                               map1 {
+                                       trip = <&cpu2_alert1>;
+                                       cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               cpu3-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 4>;
+
+                       trips {
+                               cpu3_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu3_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu3_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <1000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu3_alert0>;
+                                       cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                               map1 {
+                                       trip = <&cpu3_alert1>;
+                                       cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               cpu4-top-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 7>;
+
+                       trips {
+                               cpu4_top_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu4_top_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu4_top_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <1000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu4_top_alert0>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                               map1 {
+                                       trip = <&cpu4_top_alert1>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               cpu5-top-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 8>;
+
+                       trips {
+                               cpu5_top_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu5_top_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu5_top_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <1000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu5_top_alert0>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                               map1 {
+                                       trip = <&cpu5_top_alert1>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               cpu6-top-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 9>;
+
+                       trips {
+                               cpu6_top_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu6_top_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu6_top_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <1000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu6_top_alert0>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                               map1 {
+                                       trip = <&cpu6_top_alert1>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               cpu7-top-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 10>;
+
+                       trips {
+                               cpu7_top_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu7_top_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu7_top_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <1000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu7_top_alert0>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                               map1 {
+                                       trip = <&cpu7_top_alert1>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               cpu4-bottom-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 11>;
+
+                       trips {
+                               cpu4_bottom_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu4_bottom_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu4_bottom_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <1000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu4_bottom_alert0>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                               map1 {
+                                       trip = <&cpu4_bottom_alert1>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               cpu5-bottom-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 12>;
+
+                       trips {
+                               cpu5_bottom_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu5_bottom_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu5_bottom_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <1000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu5_bottom_alert0>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                               map1 {
+                                       trip = <&cpu5_bottom_alert1>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               cpu6-bottom-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 13>;
+
+                       trips {
+                               cpu6_bottom_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu6_bottom_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu6_bottom_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <1000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu6_bottom_alert0>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                               map1 {
+                                       trip = <&cpu6_bottom_alert1>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               cpu7-bottom-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 14>;
+
+                       trips {
+                               cpu7_bottom_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu7_bottom_alert1: trip-point1 {
+                                       temperature = <95000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu7_bottom_crit: cpu_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <1000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu7_bottom_alert0>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                               map1 {
+                                       trip = <&cpu7_bottom_alert1>;
+                                       cooling-device = <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               aoss0-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 0>;
+
+                       trips {
+                               aoss0_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               cluster0-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 5>;
+
+                       trips {
+                               cluster0_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                               cluster0_crit: cluster0_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+               };
+
+               cluster1-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 6>;
+
+                       trips {
+                               cluster1_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                               cluster1_crit: cluster1_crit {
+                                       temperature = <110000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+               };
+
+               gpu-thermal-top {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 15>;
+
+                       trips {
+                               gpu1_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               aoss1-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 0>;
+
+                       trips {
+                               aoss1_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               wlan-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 1>;
+
+                       trips {
+                               wlan_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               video-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 2>;
+
+                       trips {
+                               video_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               mem-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 3>;
+
+                       trips {
+                               mem_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               q6-hvx-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 4>;
+
+                       trips {
+                               q6_hvx_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               camera-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 5>;
+
+                       trips {
+                               camera_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               compute-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 6>;
+
+                       trips {
+                               compute_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               npu-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 7>;
+
+                       trips {
+                               npu_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               gpu-thermal-bottom {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 8>;
+
+                       trips {
+                               gpu2_alert0: trip-point0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+       };
 };
index d790229..dffefe0 100644 (file)
@@ -21,6 +21,7 @@ dtb-$(CONFIG_ARCH_R8A774C0) += r8a774c0-ek874-mipi-2.1.dtb
 
 dtb-$(CONFIG_ARCH_R8A774E1) += r8a774e1-hihope-rzg2h.dtb
 dtb-$(CONFIG_ARCH_R8A774E1) += r8a774e1-hihope-rzg2h-ex.dtb
+dtb-$(CONFIG_ARCH_R8A774E1) += r8a774e1-hihope-rzg2h-ex-idk-1110wr.dtb
 
 dtb-$(CONFIG_ARCH_R8A77950) += r8a77950-salvator-x.dtb
 dtb-$(CONFIG_ARCH_R8A77950) += r8a77950-ulcb.dtb
@@ -53,3 +54,5 @@ dtb-$(CONFIG_ARCH_R8A77980) += r8a77980-v3hsk.dtb
 dtb-$(CONFIG_ARCH_R8A77990) += r8a77990-ebisu.dtb
 
 dtb-$(CONFIG_ARCH_R8A77995) += r8a77995-draak.dtb
+
+dtb-$(CONFIG_ARCH_R8A779A0) += r8a779a0-falcon.dtb
index 8e80f50..c15f1c5 100644 (file)
                        resets = <&cpg 905>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a774a1";
                        reg = <0 0xe6060000 0 0x50c>;
                };
                        status = "disabled";
                };
 
+               pciec0_ep: pcie-ep@fe000000 {
+                       compatible = "renesas,r8a774a1-pcie-ep",
+                                    "renesas,rcar-gen3-pcie-ep";
+                       reg = <0x0 0xfe000000 0 0x80000>,
+                             <0x0 0xfe100000 0 0x100000>,
+                             <0x0 0xfe200000 0 0x200000>,
+                             <0x0 0x30000000 0 0x8000000>,
+                             <0x0 0x38000000 0 0x8000000>;
+                       reg-names = "apb-base", "memory0", "memory1", "memory2", "memory3";
+                       interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 319>;
+                       clock-names = "pcie";
+                       resets = <&cpg 319>;
+                       power-domains = <&sysc R8A774A1_PD_ALWAYS_ON>;
+                       status = "disabled";
+               };
+
+               pciec1_ep: pcie-ep@ee800000 {
+                       compatible = "renesas,r8a774a1-pcie-ep",
+                                    "renesas,rcar-gen3-pcie-ep";
+                       reg = <0x0 0xee800000 0 0x80000>,
+                             <0x0 0xee900000 0 0x100000>,
+                             <0x0 0xeea00000 0 0x200000>,
+                             <0x0 0xc0000000 0 0x8000000>,
+                             <0x0 0xc8000000 0 0x8000000>;
+                       reg-names = "apb-base", "memory0", "memory1", "memory2", "memory3";
+                       interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 318>;
+                       clock-names = "pcie";
+                       resets = <&cpg 318>;
+                       power-domains = <&sysc R8A774A1_PD_ALWAYS_ON>;
+                       status = "disabled";
+               };
+
                fdp1@fe940000 {
                        compatible = "renesas,fdp1";
                        reg = <0 0xfe940000 0 0x2400>;
index a3edd55..60d7c8a 100644 (file)
@@ -14,3 +14,8 @@
        compatible = "hoperun,hihope-rzg2-ex", "hoperun,hihope-rzg2n",
                     "renesas,r8a774b1";
 };
+
+/* Set SW43 = ON and SW1001[7] = OFF for SATA port to be activated */
+&sata {
+       status = "okay";
+};
index 49e5add..39a1a26 100644 (file)
                        resets = <&cpg 905>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a774b1";
                        reg = <0 0xe6060000 0 0x50c>;
                };
                        status = "disabled";
                };
 
+               pciec0_ep: pcie-ep@fe000000 {
+                       compatible = "renesas,r8a774b1-pcie-ep",
+                                    "renesas,rcar-gen3-pcie-ep";
+                       reg = <0x0 0xfe000000 0 0x80000>,
+                             <0x0 0xfe100000 0 0x100000>,
+                             <0x0 0xfe200000 0 0x200000>,
+                             <0x0 0x30000000 0 0x8000000>,
+                             <0x0 0x38000000 0 0x8000000>;
+                       reg-names = "apb-base", "memory0", "memory1", "memory2", "memory3";
+                       interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 319>;
+                       clock-names = "pcie";
+                       resets = <&cpg 319>;
+                       power-domains = <&sysc R8A774B1_PD_ALWAYS_ON>;
+                       status = "disabled";
+               };
+
+               pciec1_ep: pcie-ep@ee800000 {
+                       compatible = "renesas,r8a774b1-pcie-ep",
+                                    "renesas,rcar-gen3-pcie-ep";
+                       reg = <0x0 0xee800000 0 0x80000>,
+                             <0x0 0xee900000 0 0x100000>,
+                             <0x0 0xeea00000 0 0x200000>,
+                             <0x0 0xc0000000 0 0x8000000>,
+                             <0x0 0xc8000000 0 0x8000000>;
+                       reg-names = "apb-base", "memory0", "memory1", "memory2", "memory3";
+                       interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 318>;
+                       clock-names = "pcie";
+                       resets = <&cpg 318>;
+                       power-domains = <&sysc R8A774B1_PD_ALWAYS_ON>;
+                       status = "disabled";
+               };
+
                fdp1@fe940000 {
                        compatible = "renesas,fdp1";
                        reg = <0 0xfe940000 0 0x2400>;
index 4217119..f27d9b2 100644 (file)
                        resets = <&cpg 906>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a774c0";
                        reg = <0 0xe6060000 0 0x508>;
                };
                        reg = <0 0xe6ea0000 0 0x0064>;
                        interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&cpg CPG_MOD 210>;
-                       dmas = <&dmac1 0x43>, <&dmac1 0x42>,
-                              <&dmac2 0x43>, <&dmac2 0x42>;
-                       dma-names = "tx", "rx", "tx", "rx";
+                       dmas = <&dmac0 0x43>, <&dmac0 0x42>;
+                       dma-names = "tx", "rx";
                        power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
                        resets = <&cpg 210>;
                        #address-cells = <1>;
                        status = "disabled";
                };
 
+               pciec0_ep: pcie-ep@fe000000 {
+                       compatible = "renesas,r8a774c0-pcie-ep",
+                                    "renesas,rcar-gen3-pcie-ep";
+                       reg = <0x0 0xfe000000 0 0x80000>,
+                             <0x0 0xfe100000 0 0x100000>,
+                             <0x0 0xfe200000 0 0x200000>,
+                             <0x0 0x30000000 0 0x8000000>,
+                             <0x0 0x38000000 0 0x8000000>;
+                       reg-names = "apb-base", "memory0", "memory1", "memory2", "memory3";
+                       interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 319>;
+                       clock-names = "pcie";
+                       resets = <&cpg 319>;
+                       power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
+                       status = "disabled";
+               };
+
                vspb0: vsp@fe960000 {
                        compatible = "renesas,vsp2";
                        reg = <0 0xfe960000 0 0x8000>;
diff --git a/arch/arm64/boot/dts/renesas/r8a774e1-hihope-rzg2h-ex-idk-1110wr.dts b/arch/arm64/boot/dts/renesas/r8a774e1-hihope-rzg2h-ex-idk-1110wr.dts
new file mode 100644 (file)
index 0000000..3b73391
--- /dev/null
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the HiHope RZ/G2H sub board connected
+ * to an Advantech IDK-1110WR 10.1" LVDS panel
+ *
+ * Copyright (C) 2020 Renesas Electronics Corp.
+ */
+
+#include "r8a774e1-hihope-rzg2h-ex.dts"
+#include "hihope-rzg2-ex-lvds.dtsi"
+#include "rzg2-advantech-idk-1110wr-panel.dtsi"
+
+&lvds0 {
+       status = "okay";
+};
index 265355e..8129959 100644 (file)
@@ -13,3 +13,8 @@
        compatible = "hoperun,hihope-rzg2-ex", "hoperun,hihope-rzg2h",
                     "renesas,r8a774e1";
 };
+
+/* Set SW43 = ON and SW1001[7] = OFF for SATA port to be activated */
+&sata {
+       status = "okay";
+};
index cdbe527..9525d5e 100644 (file)
                reg = <0x5 0x00000000 0x0 0x80000000>;
        };
 };
+
+&du {
+       clocks = <&cpg CPG_MOD 724>,
+                <&cpg CPG_MOD 723>,
+                <&cpg CPG_MOD 721>,
+                <&versaclock5 1>,
+                <&x302_clk>,
+                <&versaclock5 2>;
+       clock-names = "du.0", "du.1", "du.3",
+                     "dclkin.0", "dclkin.1", "dclkin.3";
+};
+
+&sdhi3 {
+       mmc-hs400-1_8v;
+};
index 0f86cfd..9cbf963 100644 (file)
                        power-domains = <&sysc R8A774E1_PD_CA57_CPU0>;
                        next-level-cache = <&L2_CA57>;
                        enable-method = "psci";
+                       cpu-idle-states = <&CPU_SLEEP_0>;
                        dynamic-power-coefficient = <854>;
                        clocks = <&cpg CPG_CORE R8A774E1_CLK_Z>;
                        operating-points-v2 = <&cluster0_opp>;
                        power-domains = <&sysc R8A774E1_PD_CA57_CPU1>;
                        next-level-cache = <&L2_CA57>;
                        enable-method = "psci";
+                       cpu-idle-states = <&CPU_SLEEP_0>;
                        clocks = <&cpg CPG_CORE R8A774E1_CLK_Z>;
                        operating-points-v2 = <&cluster0_opp>;
                        capacity-dmips-mhz = <1024>;
                        power-domains = <&sysc R8A774E1_PD_CA57_CPU2>;
                        next-level-cache = <&L2_CA57>;
                        enable-method = "psci";
+                       cpu-idle-states = <&CPU_SLEEP_0>;
                        clocks = <&cpg CPG_CORE R8A774E1_CLK_Z>;
                        operating-points-v2 = <&cluster0_opp>;
                        capacity-dmips-mhz = <1024>;
                        power-domains = <&sysc R8A774E1_PD_CA57_CPU3>;
                        next-level-cache = <&L2_CA57>;
                        enable-method = "psci";
+                       cpu-idle-states = <&CPU_SLEEP_0>;
                        clocks = <&cpg CPG_CORE R8A774E1_CLK_Z>;
                        operating-points-v2 = <&cluster0_opp>;
                        capacity-dmips-mhz = <1024>;
                        power-domains = <&sysc R8A774E1_PD_CA53_CPU0>;
                        next-level-cache = <&L2_CA53>;
                        enable-method = "psci";
+                       cpu-idle-states = <&CPU_SLEEP_1>;
                        #cooling-cells = <2>;
                        dynamic-power-coefficient = <277>;
                        clocks = <&cpg CPG_CORE R8A774E1_CLK_Z2>;
                        power-domains = <&sysc R8A774E1_PD_CA53_CPU1>;
                        next-level-cache = <&L2_CA53>;
                        enable-method = "psci";
+                       cpu-idle-states = <&CPU_SLEEP_1>;
                        clocks = <&cpg CPG_CORE R8A774E1_CLK_Z2>;
                        operating-points-v2 = <&cluster1_opp>;
                        capacity-dmips-mhz = <535>;
                        power-domains = <&sysc R8A774E1_PD_CA53_CPU2>;
                        next-level-cache = <&L2_CA53>;
                        enable-method = "psci";
+                       cpu-idle-states = <&CPU_SLEEP_1>;
                        clocks = <&cpg CPG_CORE R8A774E1_CLK_Z2>;
                        operating-points-v2 = <&cluster1_opp>;
                        capacity-dmips-mhz = <535>;
                        power-domains = <&sysc R8A774E1_PD_CA53_CPU3>;
                        next-level-cache = <&L2_CA53>;
                        enable-method = "psci";
+                       cpu-idle-states = <&CPU_SLEEP_1>;
                        clocks = <&cpg CPG_CORE R8A774E1_CLK_Z2>;
                        operating-points-v2 = <&cluster1_opp>;
                        capacity-dmips-mhz = <535>;
                        cache-unified;
                        cache-level = <2>;
                };
+
+               idle-states {
+                       entry-method = "psci";
+
+                       CPU_SLEEP_0: cpu-sleep-0 {
+                               compatible = "arm,idle-state";
+                               arm,psci-suspend-param = <0x0010000>;
+                               local-timer-stop;
+                               entry-latency-us = <400>;
+                               exit-latency-us = <500>;
+                               min-residency-us = <4000>;
+                       };
+
+                       CPU_SLEEP_1: cpu-sleep-1 {
+                               compatible = "arm,idle-state";
+                               arm,psci-suspend-param = <0x0010000>;
+                               local-timer-stop;
+                               entry-latency-us = <700>;
+                               exit-latency-us = <700>;
+                               min-residency-us = <5000>;
+                       };
+               };
        };
 
        extal_clk: extal {
                        resets = <&cpg 905>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a774e1";
                        reg = <0 0xe6060000 0 0x50c>;
                };
                };
 
                hsusb: usb@e6590000 {
+                       compatible = "renesas,usbhs-r8a774e1",
+                                    "renesas,rcar-gen3-usbhs";
                        reg = <0 0xe6590000 0 0x200>;
+                       interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 704>, <&cpg CPG_MOD 703>;
+                       dmas = <&usb_dmac0 0>, <&usb_dmac0 1>,
+                              <&usb_dmac1 0>, <&usb_dmac1 1>;
+                       dma-names = "ch0", "ch1", "ch2", "ch3";
+                       renesas,buswait = <11>;
+                       phys = <&usb2_phy0 3>;
+                       phy-names = "usb";
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 704>, <&cpg 703>;
                        status = "disabled";
+               };
 
-                       /* placeholder */
+               usb_dmac0: dma-controller@e65a0000 {
+                       compatible = "renesas,r8a774e1-usb-dmac",
+                                    "renesas,usb-dmac";
+                       reg = <0 0xe65a0000 0 0x100>;
+                       interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "ch0", "ch1";
+                       clocks = <&cpg CPG_MOD 330>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 330>;
+                       #dma-cells = <1>;
+                       dma-channels = <2>;
+               };
+
+               usb_dmac1: dma-controller@e65b0000 {
+                       compatible = "renesas,r8a774e1-usb-dmac",
+                                    "renesas,usb-dmac";
+                       reg = <0 0xe65b0000 0 0x100>;
+                       interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "ch0", "ch1";
+                       clocks = <&cpg CPG_MOD 331>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 331>;
+                       #dma-cells = <1>;
+                       dma-channels = <2>;
                };
 
                usb3_phy0: usb-phy@e65ee000 {
+                       compatible = "renesas,r8a774e1-usb3-phy",
+                                    "renesas,rcar-gen3-usb3-phy";
                        reg = <0 0xe65ee000 0 0x90>;
+                       clocks = <&cpg CPG_MOD 328>, <&usb3s0_clk>,
+                                <&usb_extal_clk>;
+                       clock-names = "usb3-if", "usb3s_clk", "usb_extal";
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 328>;
                        #phy-cells = <0>;
                        status = "disabled";
-
-                       /* placeholder */
                };
 
                dmac0: dma-controller@e6700000 {
                };
 
                pwm0: pwm@e6e30000 {
+                       compatible = "renesas,pwm-r8a774e1", "renesas,pwm-rcar";
                        reg = <0 0xe6e30000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
                        #pwm-cells = <2>;
                        status = "disabled";
+               };
 
-                       /* placeholder */
+               pwm1: pwm@e6e31000 {
+                       compatible = "renesas,pwm-r8a774e1", "renesas,pwm-rcar";
+                       reg = <0 0xe6e31000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm2: pwm@e6e32000 {
+                       compatible = "renesas,pwm-r8a774e1", "renesas,pwm-rcar";
+                       reg = <0 0xe6e32000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm3: pwm@e6e33000 {
+                       compatible = "renesas,pwm-r8a774e1", "renesas,pwm-rcar";
+                       reg = <0 0xe6e33000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm4: pwm@e6e34000 {
+                       compatible = "renesas,pwm-r8a774e1", "renesas,pwm-rcar";
+                       reg = <0 0xe6e34000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm5: pwm@e6e35000 {
+                       compatible = "renesas,pwm-r8a774e1", "renesas,pwm-rcar";
+                       reg = <0 0xe6e35000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm6: pwm@e6e36000 {
+                       compatible = "renesas,pwm-r8a774e1", "renesas,pwm-rcar";
+                       reg = <0 0xe6e36000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
                };
 
                scif0: serial@e6e60000 {
                        status = "disabled";
                };
 
+               vin0: video@e6ef0000 {
+                       compatible = "renesas,vin-r8a774e1";
+                       reg = <0 0xe6ef0000 0 0x1000>;
+                       interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 811>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 811>;
+                       renesas,id = <0>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@1 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       reg = <1>;
+
+                                       vin0csi20: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&csi20vin0>;
+                                       };
+                                       vin0csi40: endpoint@2 {
+                                               reg = <2>;
+                                               remote-endpoint = <&csi40vin0>;
+                                       };
+                               };
+                       };
+               };
+
+               vin1: video@e6ef1000 {
+                       compatible = "renesas,vin-r8a774e1";
+                       reg = <0 0xe6ef1000 0 0x1000>;
+                       interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 810>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 810>;
+                       renesas,id = <1>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@1 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       reg = <1>;
+
+                                       vin1csi20: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&csi20vin1>;
+                                       };
+                                       vin1csi40: endpoint@2 {
+                                               reg = <2>;
+                                               remote-endpoint = <&csi40vin1>;
+                                       };
+                               };
+                       };
+               };
+
+               vin2: video@e6ef2000 {
+                       compatible = "renesas,vin-r8a774e1";
+                       reg = <0 0xe6ef2000 0 0x1000>;
+                       interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 809>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 809>;
+                       renesas,id = <2>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@1 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       reg = <1>;
+
+                                       vin2csi20: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&csi20vin2>;
+                                       };
+                                       vin2csi40: endpoint@2 {
+                                               reg = <2>;
+                                               remote-endpoint = <&csi40vin2>;
+                                       };
+                               };
+                       };
+               };
+
+               vin3: video@e6ef3000 {
+                       compatible = "renesas,vin-r8a774e1";
+                       reg = <0 0xe6ef3000 0 0x1000>;
+                       interrupts = <GIC_SPI 191 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 808>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 808>;
+                       renesas,id = <3>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@1 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       reg = <1>;
+
+                                       vin3csi20: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&csi20vin3>;
+                                       };
+                                       vin3csi40: endpoint@2 {
+                                               reg = <2>;
+                                               remote-endpoint = <&csi40vin3>;
+                                       };
+                               };
+                       };
+               };
+
+               vin4: video@e6ef4000 {
+                       compatible = "renesas,vin-r8a774e1";
+                       reg = <0 0xe6ef4000 0 0x1000>;
+                       interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 807>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 807>;
+                       renesas,id = <4>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@1 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       reg = <1>;
+
+                                       vin4csi20: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&csi20vin4>;
+                                       };
+                               };
+                       };
+               };
+
+               vin5: video@e6ef5000 {
+                       compatible = "renesas,vin-r8a774e1";
+                       reg = <0 0xe6ef5000 0 0x1000>;
+                       interrupts = <GIC_SPI 175 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 806>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 806>;
+                       renesas,id = <5>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@1 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       reg = <1>;
+
+                                       vin5csi20: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&csi20vin5>;
+                                       };
+                               };
+                       };
+               };
+
+               vin6: video@e6ef6000 {
+                       compatible = "renesas,vin-r8a774e1";
+                       reg = <0 0xe6ef6000 0 0x1000>;
+                       interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 805>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 805>;
+                       renesas,id = <6>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@1 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       reg = <1>;
+
+                                       vin6csi20: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&csi20vin6>;
+                                       };
+                               };
+                       };
+               };
+
+               vin7: video@e6ef7000 {
+                       compatible = "renesas,vin-r8a774e1";
+                       reg = <0 0xe6ef7000 0 0x1000>;
+                       interrupts = <GIC_SPI 171 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 804>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 804>;
+                       renesas,id = <7>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@1 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       reg = <1>;
+
+                                       vin7csi20: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&csi20vin7>;
+                                       };
+                               };
+                       };
+               };
+
                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-r8a774e1", "renesas,rcar_sound-gen3";
                        reg = <0 0xec500000 0 0x1000>, /* SCU */
                              <0 0xec5a0000 0 0x100>,  /* ADG */
                              <0 0xec540000 0 0x1000>, /* SSIU */
                              <0 0xec760000 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 R8A774E1_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 R8A774E1_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";
 
-                       /* placeholder */
+                       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,ssiu {
+                               ssiu00: ssiu-0 {
+                                       dmas = <&audma0 0x15>, <&audma1 0x16>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu01: ssiu-1 {
+                                       dmas = <&audma0 0x35>, <&audma1 0x36>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu02: ssiu-2 {
+                                       dmas = <&audma0 0x37>, <&audma1 0x38>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu03: ssiu-3 {
+                                       dmas = <&audma0 0x47>, <&audma1 0x48>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu04: ssiu-4 {
+                                       dmas = <&audma0 0x3F>, <&audma1 0x40>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu05: ssiu-5 {
+                                       dmas = <&audma0 0x43>, <&audma1 0x44>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu06: ssiu-6 {
+                                       dmas = <&audma0 0x4F>, <&audma1 0x50>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu07: ssiu-7 {
+                                       dmas = <&audma0 0x53>, <&audma1 0x54>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu10: ssiu-8 {
+                                       dmas = <&audma0 0x49>, <&audma1 0x4a>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu11: ssiu-9 {
+                                       dmas = <&audma0 0x4B>, <&audma1 0x4C>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu12: ssiu-10 {
+                                       dmas = <&audma0 0x57>, <&audma1 0x58>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu13: ssiu-11 {
+                                       dmas = <&audma0 0x59>, <&audma1 0x5A>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu14: ssiu-12 {
+                                       dmas = <&audma0 0x5F>, <&audma1 0x60>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu15: ssiu-13 {
+                                       dmas = <&audma0 0xC3>, <&audma1 0xC4>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu16: ssiu-14 {
+                                       dmas = <&audma0 0xC7>, <&audma1 0xC8>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu17: ssiu-15 {
+                                       dmas = <&audma0 0xCB>, <&audma1 0xCC>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu20: ssiu-16 {
+                                       dmas = <&audma0 0x63>, <&audma1 0x64>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu21: ssiu-17 {
+                                       dmas = <&audma0 0x67>, <&audma1 0x68>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu22: ssiu-18 {
+                                       dmas = <&audma0 0x6B>, <&audma1 0x6C>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu23: ssiu-19 {
+                                       dmas = <&audma0 0x6D>, <&audma1 0x6E>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu24: ssiu-20 {
+                                       dmas = <&audma0 0xCF>, <&audma1 0xCE>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu25: ssiu-21 {
+                                       dmas = <&audma0 0xEB>, <&audma1 0xEC>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu26: ssiu-22 {
+                                       dmas = <&audma0 0xED>, <&audma1 0xEE>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu27: ssiu-23 {
+                                       dmas = <&audma0 0xEF>, <&audma1 0xF0>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu30: ssiu-24 {
+                                       dmas = <&audma0 0x6f>, <&audma1 0x70>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu31: ssiu-25 {
+                                       dmas = <&audma0 0x21>, <&audma1 0x22>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu32: ssiu-26 {
+                                       dmas = <&audma0 0x23>, <&audma1 0x24>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu33: ssiu-27 {
+                                       dmas = <&audma0 0x25>, <&audma1 0x26>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu34: ssiu-28 {
+                                       dmas = <&audma0 0x27>, <&audma1 0x28>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu35: ssiu-29 {
+                                       dmas = <&audma0 0x29>, <&audma1 0x2A>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu36: ssiu-30 {
+                                       dmas = <&audma0 0x2B>, <&audma1 0x2C>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu37: ssiu-31 {
+                                       dmas = <&audma0 0x2D>, <&audma1 0x2E>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu40: ssiu-32 {
+                                       dmas =  <&audma0 0x71>, <&audma1 0x72>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu41: ssiu-33 {
+                                       dmas = <&audma0 0x17>, <&audma1 0x18>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu42: ssiu-34 {
+                                       dmas = <&audma0 0x19>, <&audma1 0x1A>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu43: ssiu-35 {
+                                       dmas = <&audma0 0x1B>, <&audma1 0x1C>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu44: ssiu-36 {
+                                       dmas = <&audma0 0x1D>, <&audma1 0x1E>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu45: ssiu-37 {
+                                       dmas = <&audma0 0x1F>, <&audma1 0x20>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu46: ssiu-38 {
+                                       dmas = <&audma0 0x31>, <&audma1 0x32>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu47: ssiu-39 {
+                                       dmas = <&audma0 0x33>, <&audma1 0x34>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu50: ssiu-40 {
+                                       dmas = <&audma0 0x73>, <&audma1 0x74>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu60: ssiu-41 {
+                                       dmas = <&audma0 0x75>, <&audma1 0x76>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu70: ssiu-42 {
+                                       dmas = <&audma0 0x79>, <&audma1 0x7a>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu80: ssiu-43 {
+                                       dmas = <&audma0 0x7b>, <&audma1 0x7c>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu90: ssiu-44 {
+                                       dmas = <&audma0 0x7d>, <&audma1 0x7e>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu91: ssiu-45 {
+                                       dmas = <&audma0 0x7F>, <&audma1 0x80>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu92: ssiu-46 {
+                                       dmas = <&audma0 0x81>, <&audma1 0x82>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu93: ssiu-47 {
+                                       dmas = <&audma0 0x83>, <&audma1 0x84>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu94: ssiu-48 {
+                                       dmas = <&audma0 0xA3>, <&audma1 0xA4>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu95: ssiu-49 {
+                                       dmas = <&audma0 0xA5>, <&audma1 0xA6>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu96: ssiu-50 {
+                                       dmas = <&audma0 0xA7>, <&audma1 0xA8>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu97: ssiu-51 {
+                                       dmas = <&audma0 0xA9>, <&audma1 0xAA>;
+                                       dma-names = "rx", "tx";
+                               };
+                       };
 
                        rcar_sound,ssi {
+                               ssi0: ssi-0 {
+                                       interrupts = <GIC_SPI 370 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x01>, <&audma1 0x02>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi1: ssi-1 {
+                                       interrupts = <GIC_SPI 371 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x03>, <&audma1 0x04>;
+                                       dma-names = "rx", "tx";
+                               };
                                ssi2: ssi-2 {
-                                       /* placeholder */
+                                       interrupts = <GIC_SPI 372 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x05>, <&audma1 0x06>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi3: ssi-3 {
+                                       interrupts = <GIC_SPI 373 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x07>, <&audma1 0x08>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi4: ssi-4 {
+                                       interrupts = <GIC_SPI 374 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x09>, <&audma1 0x0a>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi5: ssi-5 {
+                                       interrupts = <GIC_SPI 375 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x0b>, <&audma1 0x0c>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi6: ssi-6 {
+                                       interrupts = <GIC_SPI 376 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x0d>, <&audma1 0x0e>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi7: ssi-7 {
+                                       interrupts = <GIC_SPI 377 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x0f>, <&audma1 0x10>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi8: ssi-8 {
+                                       interrupts = <GIC_SPI 378 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x11>, <&audma1 0x12>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi9: ssi-9 {
+                                       interrupts = <GIC_SPI 379 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x13>, <&audma1 0x14>;
+                                       dma-names = "rx", "tx";
                                };
                        };
                };
 
+               audma0: dma-controller@ec700000 {
+                       compatible = "renesas,dmac-r8a774e1",
+                                    "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 R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 502>;
+                       #dma-cells = <1>;
+                       dma-channels = <16>;
+                       iommus = <&ipmmu_mp0 0>, <&ipmmu_mp0 1>,
+                                <&ipmmu_mp0 2>, <&ipmmu_mp0 3>,
+                                <&ipmmu_mp0 4>, <&ipmmu_mp0 5>,
+                                <&ipmmu_mp0 6>, <&ipmmu_mp0 7>,
+                                <&ipmmu_mp0 8>, <&ipmmu_mp0 9>,
+                                <&ipmmu_mp0 10>, <&ipmmu_mp0 11>,
+                                <&ipmmu_mp0 12>, <&ipmmu_mp0 13>,
+                                <&ipmmu_mp0 14>, <&ipmmu_mp0 15>;
+               };
+
+               audma1: dma-controller@ec720000 {
+                       compatible = "renesas,dmac-r8a774e1",
+                                    "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 R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 501>;
+                       #dma-cells = <1>;
+                       dma-channels = <16>;
+                       iommus = <&ipmmu_mp0 16>, <&ipmmu_mp0 17>,
+                                <&ipmmu_mp0 18>, <&ipmmu_mp0 19>,
+                                <&ipmmu_mp0 20>, <&ipmmu_mp0 21>,
+                                <&ipmmu_mp0 22>, <&ipmmu_mp0 23>,
+                                <&ipmmu_mp0 24>, <&ipmmu_mp0 25>,
+                                <&ipmmu_mp0 26>, <&ipmmu_mp0 27>,
+                                <&ipmmu_mp0 28>, <&ipmmu_mp0 29>,
+                                <&ipmmu_mp0 30>, <&ipmmu_mp0 31>;
+               };
+
                xhci0: usb@ee000000 {
+                       compatible = "renesas,xhci-r8a774e1",
+                                    "renesas,rcar-gen3-xhci";
                        reg = <0 0xee000000 0 0xc00>;
+                       interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 328>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 328>;
                        status = "disabled";
-
-                       /* placeholder */
                };
 
                usb3_peri0: usb@ee020000 {
+                       compatible = "renesas,r8a774e1-usb3-peri",
+                                    "renesas,rcar-gen3-usb3-peri";
                        reg = <0 0xee020000 0 0x400>;
+                       interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 328>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 328>;
                        status = "disabled";
-
-                       /* placeholder */
                };
 
                ohci0: usb@ee080000 {
+                       compatible = "generic-ohci";
                        reg = <0 0xee080000 0 0x100>;
+                       interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>;
+                       phys = <&usb2_phy0 1>;
+                       phy-names = "usb";
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 703>, <&cpg 704>;
                        status = "disabled";
-
-                       /* placeholder */
                };
 
                ohci1: usb@ee0a0000 {
+                       compatible = "generic-ohci";
                        reg = <0 0xee0a0000 0 0x100>;
+                       interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 702>;
+                       phys = <&usb2_phy1 1>;
+                       phy-names = "usb";
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 702>;
                        status = "disabled";
-
-                       /* placeholder */
                };
 
                ehci0: usb@ee080100 {
+                       compatible = "generic-ehci";
                        reg = <0 0xee080100 0 0x100>;
+                       interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>;
+                       phys = <&usb2_phy0 2>;
+                       phy-names = "usb";
+                       companion = <&ohci0>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 703>, <&cpg 704>;
                        status = "disabled";
-
-                       /* placeholder */
                };
 
                ehci1: usb@ee0a0100 {
+                       compatible = "generic-ehci";
                        reg = <0 0xee0a0100 0 0x100>;
+                       interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 702>;
+                       phys = <&usb2_phy1 2>;
+                       phy-names = "usb";
+                       companion = <&ohci1>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 702>;
                        status = "disabled";
-
-                       /* placeholder */
                };
 
                usb2_phy0: usb-phy@ee080200 {
+                       compatible = "renesas,usb2-phy-r8a774e1",
+                                    "renesas,rcar-gen3-usb2-phy";
                        reg = <0 0xee080200 0 0x700>;
+                       interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 703>, <&cpg 704>;
+                       #phy-cells = <1>;
                        status = "disabled";
-
-                       /* placeholder */
                };
 
                usb2_phy1: usb-phy@ee0a0200 {
+                       compatible = "renesas,usb2-phy-r8a774e1",
+                                    "renesas,rcar-gen3-usb2-phy";
                        reg = <0 0xee0a0200 0 0x700>;
+                       clocks = <&cpg CPG_MOD 702>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 702>;
+                       #phy-cells = <1>;
                        status = "disabled";
-
-                       /* placeholder */
                };
 
                sdhi0: mmc@ee100000 {
                        status = "disabled";
                };
 
+               sata: sata@ee300000 {
+                       compatible = "renesas,sata-r8a774e1",
+                                    "renesas,rcar-gen3-sata";
+                       reg = <0 0xee300000 0 0x200000>;
+                       interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 815>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 815>;
+                       iommus = <&ipmmu_hc 2>;
+                       status = "disabled";
+               };
+
                gic: interrupt-controller@f1010000 {
                        compatible = "arm,gic-400";
                        #interrupt-cells = <3>;
                };
 
                pciec0: pcie@fe000000 {
+                       compatible = "renesas,pcie-r8a774e1",
+                                    "renesas,pcie-rcar-gen3";
                        reg = <0 0xfe000000 0 0x80000>;
                        #address-cells = <3>;
                        #size-cells = <2>;
+                       bus-range = <0x00 0xff>;
+                       device_type = "pci";
+                       ranges = <0x01000000 0 0x00000000 0 0xfe100000 0 0x00100000>,
+                                <0x02000000 0 0xfe200000 0 0xfe200000 0 0x00200000>,
+                                <0x02000000 0 0x30000000 0 0x30000000 0 0x08000000>,
+                                <0x42000000 0 0x38000000 0 0x38000000 0 0x08000000>;
+                       /* Map all possible DDR as inbound ranges */
+                       dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0 0x80000000>;
+                       interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
+                       #interrupt-cells = <1>;
+                       interrupt-map-mask = <0 0 0 0>;
+                       interrupt-map = <0 0 0 0 &gic GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 319>, <&pcie_bus_clk>;
+                       clock-names = "pcie", "pcie_bus";
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 319>;
+                       status = "disabled";
+               };
+
+               pciec1: pcie@ee800000 {
+                       compatible = "renesas,pcie-r8a774e1",
+                                    "renesas,pcie-rcar-gen3";
+                       reg = <0 0xee800000 0 0x80000>;
+                       #address-cells = <3>;
+                       #size-cells = <2>;
+                       bus-range = <0x00 0xff>;
+                       device_type = "pci";
+                       ranges = <0x01000000 0 0x00000000 0 0xee900000 0 0x00100000>,
+                                <0x02000000 0 0xeea00000 0 0xeea00000 0 0x00200000>,
+                                <0x02000000 0 0xc0000000 0 0xc0000000 0 0x08000000>,
+                                <0x42000000 0 0xc8000000 0 0xc8000000 0 0x08000000>;
+                       /* Map all possible DDR as inbound ranges */
+                       dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0 0x80000000>;
+                       interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>;
+                       #interrupt-cells = <1>;
+                       interrupt-map-mask = <0 0 0 0>;
+                       interrupt-map = <0 0 0 0 &gic GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 318>, <&pcie_bus_clk>;
+                       clock-names = "pcie", "pcie_bus";
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 318>;
+                       status = "disabled";
+               };
+
+               pciec0_ep: pcie-ep@fe000000 {
+                       compatible = "renesas,r8a774e1-pcie-ep",
+                                    "renesas,rcar-gen3-pcie-ep";
+                       reg = <0x0 0xfe000000 0 0x80000>,
+                             <0x0 0xfe100000 0 0x100000>,
+                             <0x0 0xfe200000 0 0x200000>,
+                             <0x0 0x30000000 0 0x8000000>,
+                             <0x0 0x38000000 0 0x8000000>;
+                       reg-names = "apb-base", "memory0", "memory1", "memory2", "memory3";
+                       interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 319>;
+                       clock-names = "pcie";
+                       resets = <&cpg 319>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       status = "disabled";
+               };
+
+               pciec1_ep: pcie-ep@ee800000 {
+                       compatible = "renesas,r8a774e1-pcie-ep",
+                                    "renesas,rcar-gen3-pcie-ep";
+                       reg = <0x0 0xee800000 0 0x80000>,
+                             <0x0 0xee900000 0 0x100000>,
+                             <0x0 0xeea00000 0 0x200000>,
+                             <0x0 0xc0000000 0 0x8000000>,
+                             <0x0 0xc8000000 0 0x8000000>;
+                       reg-names = "apb-base", "memory0", "memory1", "memory2", "memory3";
+                       interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 318>;
+                       clock-names = "pcie";
+                       resets = <&cpg 318>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
                        status = "disabled";
+               };
+
+               vspbc: vsp@fe920000 {
+                       compatible = "renesas,vsp2";
+                       reg = <0 0xfe920000 0 0x8000>;
+                       interrupts = <GIC_SPI 465 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 624>;
+                       power-domains = <&sysc R8A774E1_PD_A3VP>;
+                       resets = <&cpg 624>;
+
+                       renesas,fcp = <&fcpvb1>;
+               };
+
+               vspbd: vsp@fe960000 {
+                       compatible = "renesas,vsp2";
+                       reg = <0 0xfe960000 0 0x8000>;
+                       interrupts = <GIC_SPI 266 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 626>;
+                       power-domains = <&sysc R8A774E1_PD_A3VP>;
+                       resets = <&cpg 626>;
+
+                       renesas,fcp = <&fcpvb0>;
+               };
+
+               vspd0: vsp@fea20000 {
+                       compatible = "renesas,vsp2";
+                       reg = <0 0xfea20000 0 0x5000>;
+                       interrupts = <GIC_SPI 466 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 623>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 623>;
+
+                       renesas,fcp = <&fcpvd0>;
+               };
+
+               vspd1: vsp@fea28000 {
+                       compatible = "renesas,vsp2";
+                       reg = <0 0xfea28000 0 0x5000>;
+                       interrupts = <GIC_SPI 467 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 622>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 622>;
+
+                       renesas,fcp = <&fcpvd1>;
+               };
+
+               vspi0: vsp@fe9a0000 {
+                       compatible = "renesas,vsp2";
+                       reg = <0 0xfe9a0000 0 0x8000>;
+                       interrupts = <GIC_SPI 444 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 631>;
+                       power-domains = <&sysc R8A774E1_PD_A3VP>;
+                       resets = <&cpg 631>;
+
+                       renesas,fcp = <&fcpvi0>;
+               };
+
+               vspi1: vsp@fe9b0000 {
+                       compatible = "renesas,vsp2";
+                       reg = <0 0xfe9b0000 0 0x8000>;
+                       interrupts = <GIC_SPI 445 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 630>;
+                       power-domains = <&sysc R8A774E1_PD_A3VP>;
+                       resets = <&cpg 630>;
+
+                       renesas,fcp = <&fcpvi1>;
+               };
+
+               fdp1@fe940000 {
+                       compatible = "renesas,fdp1";
+                       reg = <0 0xfe940000 0 0x2400>;
+                       interrupts = <GIC_SPI 262 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 119>;
+                       power-domains = <&sysc R8A774E1_PD_A3VP>;
+                       resets = <&cpg 119>;
+                       renesas,fcp = <&fcpf0>;
+               };
+
+               fdp1@fe944000 {
+                       compatible = "renesas,fdp1";
+                       reg = <0 0xfe944000 0 0x2400>;
+                       interrupts = <GIC_SPI 263 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 118>;
+                       power-domains = <&sysc R8A774E1_PD_A3VP>;
+                       resets = <&cpg 118>;
+                       renesas,fcp = <&fcpf1>;
+               };
+
+               fcpf0: fcp@fe950000 {
+                       compatible = "renesas,fcpf";
+                       reg = <0 0xfe950000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 615>;
+                       power-domains = <&sysc R8A774E1_PD_A3VP>;
+                       resets = <&cpg 615>;
+               };
+
+               fcpf1: fcp@fe951000 {
+                       compatible = "renesas,fcpf";
+                       reg = <0 0xfe951000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 614>;
+                       power-domains = <&sysc R8A774E1_PD_A3VP>;
+                       resets = <&cpg 614>;
+               };
+
+               fcpvb0: fcp@fe96f000 {
+                       compatible = "renesas,fcpv";
+                       reg = <0 0xfe96f000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 607>;
+                       power-domains = <&sysc R8A774E1_PD_A3VP>;
+                       resets = <&cpg 607>;
+               };
+
+               fcpvb1: fcp@fe92f000 {
+                       compatible = "renesas,fcpv";
+                       reg = <0 0xfe92f000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 606>;
+                       power-domains = <&sysc R8A774E1_PD_A3VP>;
+                       resets = <&cpg 606>;
+               };
+
+               fcpvi0: fcp@fe9af000 {
+                       compatible = "renesas,fcpv";
+                       reg = <0 0xfe9af000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 611>;
+                       power-domains = <&sysc R8A774E1_PD_A3VP>;
+                       resets = <&cpg 611>;
+               };
+
+               fcpvi1: fcp@fe9bf000 {
+                       compatible = "renesas,fcpv";
+                       reg = <0 0xfe9bf000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 610>;
+                       power-domains = <&sysc R8A774E1_PD_A3VP>;
+                       resets = <&cpg 610>;
+               };
+
+               fcpvd0: fcp@fea27000 {
+                       compatible = "renesas,fcpv";
+                       reg = <0 0xfea27000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 603>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 603>;
+               };
+
+               fcpvd1: fcp@fea2f000 {
+                       compatible = "renesas,fcpv";
+                       reg = <0 0xfea2f000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 602>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 602>;
+               };
+
+               csi20: csi2@fea80000 {
+                       compatible = "renesas,r8a774e1-csi2";
+                       reg = <0 0xfea80000 0 0x10000>;
+                       interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 714>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 714>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@1 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
 
-                       /* placeholder */
+                                       reg = <1>;
+
+                                       csi20vin0: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&vin0csi20>;
+                                       };
+                                       csi20vin1: endpoint@1 {
+                                               reg = <1>;
+                                               remote-endpoint = <&vin1csi20>;
+                                       };
+                                       csi20vin2: endpoint@2 {
+                                               reg = <2>;
+                                               remote-endpoint = <&vin2csi20>;
+                                       };
+                                       csi20vin3: endpoint@3 {
+                                               reg = <3>;
+                                               remote-endpoint = <&vin3csi20>;
+                                       };
+                                       csi20vin4: endpoint@4 {
+                                               reg = <4>;
+                                               remote-endpoint = <&vin4csi20>;
+                                       };
+                                       csi20vin5: endpoint@5 {
+                                               reg = <5>;
+                                               remote-endpoint = <&vin5csi20>;
+                                       };
+                                       csi20vin6: endpoint@6 {
+                                               reg = <6>;
+                                               remote-endpoint = <&vin6csi20>;
+                                       };
+                                       csi20vin7: endpoint@7 {
+                                               reg = <7>;
+                                               remote-endpoint = <&vin7csi20>;
+                                       };
+                               };
+                       };
+               };
+
+               csi40: csi2@feaa0000 {
+                       compatible = "renesas,r8a774e1-csi2";
+                       reg = <0 0xfeaa0000 0 0x10000>;
+                       interrupts = <GIC_SPI 246 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 716>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 716>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@1 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       reg = <1>;
+
+                                       csi40vin0: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&vin0csi40>;
+                                       };
+                                       csi40vin1: endpoint@1 {
+                                               reg = <1>;
+                                               remote-endpoint = <&vin1csi40>;
+                                       };
+                                       csi40vin2: endpoint@2 {
+                                               reg = <2>;
+                                               remote-endpoint = <&vin2csi40>;
+                                       };
+                                       csi40vin3: endpoint@3 {
+                                               reg = <3>;
+                                               remote-endpoint = <&vin3csi40>;
+                                       };
+                               };
+                       };
                };
 
                hdmi0: hdmi@fead0000 {
+                       compatible = "renesas,r8a774e1-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 R8A774E1_CLK_HDMI>;
+                       clock-names = "iahb", "isfr";
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 729>;
                        status = "disabled";
 
-                       /* placeholder */
-
                        ports {
                                #address-cells = <1>;
                                #size-cells = <0>;
 
                                port@0 {
                                        reg = <0>;
+                                       dw_hdmi0_in: endpoint {
+                                               remote-endpoint = <&du_out_hdmi0>;
+                                       };
                                };
                                port@1 {
                                        reg = <1>;
                                };
                                port@2 {
+                                       /* HDMI sound */
                                        reg = <2>;
                                };
                        };
                };
 
                du: display@feb00000 {
+                       compatible = "renesas,du-r8a774e1";
                        reg = <0 0xfeb00000 0 0x80000>;
+                       interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 270 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 724>,
+                                <&cpg CPG_MOD 723>,
+                                <&cpg CPG_MOD 721>;
+                       clock-names = "du.0", "du.1", "du.3";
+                       resets = <&cpg 724>, <&cpg 722>;
+                       reset-names = "du.0", "du.3";
                        status = "disabled";
 
-                       /* placeholder */
+                       renesas,vsps = <&vspd0 0>, <&vspd1 0>, <&vspd0 1>;
+
                        ports {
                                #address-cells = <1>;
                                #size-cells = <0>;
 
                                port@0 {
                                        reg = <0>;
+                                       du_out_rgb: endpoint {
+                                       };
                                };
                                port@1 {
                                        reg = <1>;
+                                       du_out_hdmi0: endpoint {
+                                               remote-endpoint = <&dw_hdmi0_in>;
+                                       };
                                };
                                port@2 {
                                        reg = <2>;
+                                       du_out_lvds0: endpoint {
+                                               remote-endpoint = <&lvds0_in>;
+                                       };
+                               };
+                       };
+               };
+
+               lvds0: lvds@feb90000 {
+                       compatible = "renesas,r8a774e1-lvds";
+                       reg = <0 0xfeb90000 0 0x14>;
+                       clocks = <&cpg CPG_MOD 727>;
+                       power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
+                       resets = <&cpg 727>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       lvds0_in: endpoint {
+                                               remote-endpoint = <&du_out_lvds0>;
+                                       };
+                               };
+                               port@1 {
+                                       reg = <1>;
+                                       lvds0_out: endpoint {
+                                       };
                                };
                        };
                };
index 9beb8e7..18ce0fa 100644 (file)
                        resets = <&cpg 905>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a7795";
                        reg = <0 0xe6060000 0 0x50c>;
                };
index 4dfb7f0..f379c8d 100644 (file)
                        resets = <&cpg 905>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a7796";
                        reg = <0 0xe6060000 0 0x50c>;
                };
index 2ffc7e3..1e76033 100644 (file)
                reg = <0x6 0x00000000 0x1 0x00000000>;
        };
 };
+
+&du {
+       clocks = <&cpg CPG_MOD 724>,
+                <&cpg CPG_MOD 723>,
+                <&cpg CPG_MOD 722>,
+                <&versaclock6 1>,
+                <&x21_clk>,
+                <&versaclock6 2>;
+       clock-names = "du.0", "du.1", "du.2",
+                     "dclkin.0", "dclkin.1", "dclkin.2";
+};
+
+&hdmi0 {
+       status = "okay";
+
+       ports {
+               port@1 {
+                       reg = <1>;
+                       rcar_dw_hdmi0_out: endpoint {
+                               remote-endpoint = <&hdmi0_con>;
+                       };
+               };
+               port@2 {
+                       reg = <2>;
+                       dw_hdmi0_snd_in: endpoint {
+                               remote-endpoint = <&rsnd_endpoint1>;
+                       };
+               };
+       };
+};
+
+&hdmi0_con {
+       remote-endpoint = <&rcar_dw_hdmi0_out>;
+};
+
+&rcar_sound {
+       ports {
+               /* rsnd_port0 is on salvator-common */
+               rsnd_port1: port@1 {
+                       reg = <1>;
+                       rsnd_endpoint1: endpoint {
+                               remote-endpoint = <&dw_hdmi0_snd_in>;
+
+                               dai-format = "i2s";
+                               bitclock-master = <&rsnd_endpoint1>;
+                               frame-master = <&rsnd_endpoint1>;
+
+                               playback = <&ssi2>;
+                       };
+               };
+       };
+};
+
+&sound_card {
+       dais = <&rsnd_port0     /* ak4613 */
+               &rsnd_port1>;   /* HDMI0  */
+};
index 542c44c..1ba3031 100644 (file)
                        resets = <&cpg 905>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a77961";
                        reg = <0 0xe6060000 0 0x50c>;
                };
                };
 
                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-r8a77961", "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 0xec760000 0 0x200>;  /* Audio DMAC peri peri*/
-                       /* placeholder */
+                       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 R8A77961_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 R8A77961_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,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,dvc {
-                               dvc0: dvc-0 { };
-                               dvc1: dvc-1 { };
+                               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,src {
-                               src0: src-0 { };
-                               src1: src-1 { };
+                               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 { };
-                               ssi1: ssi-1 { };
-                               ssi2: ssi-2 { };
+                               ssi0: ssi-0 {
+                                       interrupts = <GIC_SPI 370 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x01>, <&audma1 0x02>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi1: ssi-1 {
+                                       interrupts = <GIC_SPI 371 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x03>, <&audma1 0x04>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi2: ssi-2 {
+                                       interrupts = <GIC_SPI 372 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x05>, <&audma1 0x06>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi3: ssi-3 {
+                                       interrupts = <GIC_SPI 373 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x07>, <&audma1 0x08>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi4: ssi-4 {
+                                       interrupts = <GIC_SPI 374 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x09>, <&audma1 0x0a>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi5: ssi-5 {
+                                       interrupts = <GIC_SPI 375 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x0b>, <&audma1 0x0c>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi6: ssi-6 {
+                                       interrupts = <GIC_SPI 376 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x0d>, <&audma1 0x0e>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi7: ssi-7 {
+                                       interrupts = <GIC_SPI 377 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x0f>, <&audma1 0x10>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi8: ssi-8 {
+                                       interrupts = <GIC_SPI 378 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x11>, <&audma1 0x12>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssi9: ssi-9 {
+                                       interrupts = <GIC_SPI 379 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x13>, <&audma1 0x14>;
+                                       dma-names = "rx", "tx";
+                               };
                        };
+
+                       rcar_sound,ssiu {
+                               ssiu00: ssiu-0 {
+                                       dmas = <&audma0 0x15>, <&audma1 0x16>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu01: ssiu-1 {
+                                       dmas = <&audma0 0x35>, <&audma1 0x36>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu02: ssiu-2 {
+                                       dmas = <&audma0 0x37>, <&audma1 0x38>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu03: ssiu-3 {
+                                       dmas = <&audma0 0x47>, <&audma1 0x48>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu04: ssiu-4 {
+                                       dmas = <&audma0 0x3F>, <&audma1 0x40>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu05: ssiu-5 {
+                                       dmas = <&audma0 0x43>, <&audma1 0x44>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu06: ssiu-6 {
+                                       dmas = <&audma0 0x4F>, <&audma1 0x50>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu07: ssiu-7 {
+                                       dmas = <&audma0 0x53>, <&audma1 0x54>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu10: ssiu-8 {
+                                       dmas = <&audma0 0x49>, <&audma1 0x4a>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu11: ssiu-9 {
+                                       dmas = <&audma0 0x4B>, <&audma1 0x4C>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu12: ssiu-10 {
+                                       dmas = <&audma0 0x57>, <&audma1 0x58>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu13: ssiu-11 {
+                                       dmas = <&audma0 0x59>, <&audma1 0x5A>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu14: ssiu-12 {
+                                       dmas = <&audma0 0x5F>, <&audma1 0x60>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu15: ssiu-13 {
+                                       dmas = <&audma0 0xC3>, <&audma1 0xC4>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu16: ssiu-14 {
+                                       dmas = <&audma0 0xC7>, <&audma1 0xC8>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu17: ssiu-15 {
+                                       dmas = <&audma0 0xCB>, <&audma1 0xCC>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu20: ssiu-16 {
+                                       dmas = <&audma0 0x63>, <&audma1 0x64>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu21: ssiu-17 {
+                                       dmas = <&audma0 0x67>, <&audma1 0x68>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu22: ssiu-18 {
+                                       dmas = <&audma0 0x6B>, <&audma1 0x6C>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu23: ssiu-19 {
+                                       dmas = <&audma0 0x6D>, <&audma1 0x6E>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu24: ssiu-20 {
+                                       dmas = <&audma0 0xCF>, <&audma1 0xCE>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu25: ssiu-21 {
+                                       dmas = <&audma0 0xEB>, <&audma1 0xEC>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu26: ssiu-22 {
+                                       dmas = <&audma0 0xED>, <&audma1 0xEE>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu27: ssiu-23 {
+                                       dmas = <&audma0 0xEF>, <&audma1 0xF0>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu30: ssiu-24 {
+                                       dmas = <&audma0 0x6f>, <&audma1 0x70>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu31: ssiu-25 {
+                                       dmas = <&audma0 0x21>, <&audma1 0x22>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu32: ssiu-26 {
+                                       dmas = <&audma0 0x23>, <&audma1 0x24>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu33: ssiu-27 {
+                                       dmas = <&audma0 0x25>, <&audma1 0x26>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu34: ssiu-28 {
+                                       dmas = <&audma0 0x27>, <&audma1 0x28>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu35: ssiu-29 {
+                                       dmas = <&audma0 0x29>, <&audma1 0x2A>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu36: ssiu-30 {
+                                       dmas = <&audma0 0x2B>, <&audma1 0x2C>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu37: ssiu-31 {
+                                       dmas = <&audma0 0x2D>, <&audma1 0x2E>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu40: ssiu-32 {
+                                       dmas =  <&audma0 0x71>, <&audma1 0x72>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu41: ssiu-33 {
+                                       dmas = <&audma0 0x17>, <&audma1 0x18>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu42: ssiu-34 {
+                                       dmas = <&audma0 0x19>, <&audma1 0x1A>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu43: ssiu-35 {
+                                       dmas = <&audma0 0x1B>, <&audma1 0x1C>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu44: ssiu-36 {
+                                       dmas = <&audma0 0x1D>, <&audma1 0x1E>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu45: ssiu-37 {
+                                       dmas = <&audma0 0x1F>, <&audma1 0x20>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu46: ssiu-38 {
+                                       dmas = <&audma0 0x31>, <&audma1 0x32>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu47: ssiu-39 {
+                                       dmas = <&audma0 0x33>, <&audma1 0x34>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu50: ssiu-40 {
+                                       dmas = <&audma0 0x73>, <&audma1 0x74>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu60: ssiu-41 {
+                                       dmas = <&audma0 0x75>, <&audma1 0x76>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu70: ssiu-42 {
+                                       dmas = <&audma0 0x79>, <&audma1 0x7a>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu80: ssiu-43 {
+                                       dmas = <&audma0 0x7b>, <&audma1 0x7c>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu90: ssiu-44 {
+                                       dmas = <&audma0 0x7d>, <&audma1 0x7e>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu91: ssiu-45 {
+                                       dmas = <&audma0 0x7F>, <&audma1 0x80>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu92: ssiu-46 {
+                                       dmas = <&audma0 0x81>, <&audma1 0x82>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu93: ssiu-47 {
+                                       dmas = <&audma0 0x83>, <&audma1 0x84>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu94: ssiu-48 {
+                                       dmas = <&audma0 0xA3>, <&audma1 0xA4>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu95: ssiu-49 {
+                                       dmas = <&audma0 0xA5>, <&audma1 0xA6>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu96: ssiu-50 {
+                                       dmas = <&audma0 0xA7>, <&audma1 0xA8>;
+                                       dma-names = "rx", "tx";
+                               };
+                               ssiu97: ssiu-51 {
+                                       dmas = <&audma0 0xA9>, <&audma1 0xAA>;
+                                       dma-names = "rx", "tx";
+                               };
+                       };
+               };
+
+               audma0: dma-controller@ec700000 {
+                       compatible = "renesas,dmac-r8a77961",
+                                    "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 R8A77961_PD_ALWAYS_ON>;
+                       resets = <&cpg 502>;
+                       #dma-cells = <1>;
+                       dma-channels = <16>;
+                       iommus = <&ipmmu_mp 0>, <&ipmmu_mp 1>,
+                              <&ipmmu_mp 2>, <&ipmmu_mp 3>,
+                              <&ipmmu_mp 4>, <&ipmmu_mp 5>,
+                              <&ipmmu_mp 6>, <&ipmmu_mp 7>,
+                              <&ipmmu_mp 8>, <&ipmmu_mp 9>,
+                              <&ipmmu_mp 10>, <&ipmmu_mp 11>,
+                              <&ipmmu_mp 12>, <&ipmmu_mp 13>,
+                              <&ipmmu_mp 14>, <&ipmmu_mp 15>;
+               };
+
+               audma1: dma-controller@ec720000 {
+                       compatible = "renesas,dmac-r8a77961",
+                                    "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 R8A77961_PD_ALWAYS_ON>;
+                       resets = <&cpg 501>;
+                       #dma-cells = <1>;
+                       dma-channels = <16>;
+                       iommus = <&ipmmu_mp 16>, <&ipmmu_mp 17>,
+                              <&ipmmu_mp 18>, <&ipmmu_mp 19>,
+                              <&ipmmu_mp 20>, <&ipmmu_mp 21>,
+                              <&ipmmu_mp 22>, <&ipmmu_mp 23>,
+                              <&ipmmu_mp 24>, <&ipmmu_mp 25>,
+                              <&ipmmu_mp 26>, <&ipmmu_mp 27>,
+                              <&ipmmu_mp 28>, <&ipmmu_mp 29>,
+                              <&ipmmu_mp 30>, <&ipmmu_mp 31>;
                };
 
                xhci0: usb@ee000000 {
                        status = "disabled";
                };
 
+               fcpf0: fcp@fe950000 {
+                       compatible = "renesas,fcpf";
+                       reg = <0 0xfe950000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 615>;
+                       power-domains = <&sysc R8A77961_PD_A3VC>;
+                       resets = <&cpg 615>;
+               };
+
+               fcpvb0: fcp@fe96f000 {
+                       compatible = "renesas,fcpv";
+                       reg = <0 0xfe96f000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 607>;
+                       power-domains = <&sysc R8A77961_PD_A3VC>;
+                       resets = <&cpg 607>;
+               };
+
+               fcpvi0: fcp@fe9af000 {
+                       compatible = "renesas,fcpv";
+                       reg = <0 0xfe9af000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 611>;
+                       power-domains = <&sysc R8A77961_PD_A3VC>;
+                       resets = <&cpg 611>;
+                       iommus = <&ipmmu_vc0 19>;
+               };
+
+               fcpvd0: fcp@fea27000 {
+                       compatible = "renesas,fcpv";
+                       reg = <0 0xfea27000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 603>;
+                       power-domains = <&sysc R8A77961_PD_ALWAYS_ON>;
+                       resets = <&cpg 603>;
+                       iommus = <&ipmmu_vi0 8>;
+               };
+
+               fcpvd1: fcp@fea2f000 {
+                       compatible = "renesas,fcpv";
+                       reg = <0 0xfea2f000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 602>;
+                       power-domains = <&sysc R8A77961_PD_ALWAYS_ON>;
+                       resets = <&cpg 602>;
+                       iommus = <&ipmmu_vi0 9>;
+               };
+
+               fcpvd2: fcp@fea37000 {
+                       compatible = "renesas,fcpv";
+                       reg = <0 0xfea37000 0 0x200>;
+                       clocks = <&cpg CPG_MOD 601>;
+                       power-domains = <&sysc R8A77961_PD_ALWAYS_ON>;
+                       resets = <&cpg 601>;
+                       iommus = <&ipmmu_vi0 10>;
+               };
+
+               vspb: vsp@fe960000 {
+                       compatible = "renesas,vsp2";
+                       reg = <0 0xfe960000 0 0x8000>;
+                       interrupts = <GIC_SPI 266 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 626>;
+                       power-domains = <&sysc R8A77961_PD_A3VC>;
+                       resets = <&cpg 626>;
+
+                       renesas,fcp = <&fcpvb0>;
+               };
+
+               vspd0: vsp@fea20000 {
+                       compatible = "renesas,vsp2";
+                       reg = <0 0xfea20000 0 0x5000>;
+                       interrupts = <GIC_SPI 466 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 623>;
+                       power-domains = <&sysc R8A77961_PD_ALWAYS_ON>;
+                       resets = <&cpg 623>;
+
+                       renesas,fcp = <&fcpvd0>;
+               };
+
+               vspd1: vsp@fea28000 {
+                       compatible = "renesas,vsp2";
+                       reg = <0 0xfea28000 0 0x5000>;
+                       interrupts = <GIC_SPI 467 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 622>;
+                       power-domains = <&sysc R8A77961_PD_ALWAYS_ON>;
+                       resets = <&cpg 622>;
+
+                       renesas,fcp = <&fcpvd1>;
+               };
+
+               vspd2: vsp@fea30000 {
+                       compatible = "renesas,vsp2";
+                       reg = <0 0xfea30000 0 0x5000>;
+                       interrupts = <GIC_SPI 468 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 621>;
+                       power-domains = <&sysc R8A77961_PD_ALWAYS_ON>;
+                       resets = <&cpg 621>;
+
+                       renesas,fcp = <&fcpvd2>;
+               };
+
+               vspi0: vsp@fe9a0000 {
+                       compatible = "renesas,vsp2";
+                       reg = <0 0xfe9a0000 0 0x8000>;
+                       interrupts = <GIC_SPI 444 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 631>;
+                       power-domains = <&sysc R8A77961_PD_A3VC>;
+                       resets = <&cpg 631>;
+
+                       renesas,fcp = <&fcpvi0>;
+               };
+
                csi20: csi2@fea80000 {
                        reg = <0 0xfea80000 0 0x10000>;
                        /* placeholder */
                };
 
                hdmi0: hdmi@fead0000 {
+                       compatible = "renesas,r8a77961-hdmi", "renesas,rcar-gen3-hdmi";
                        reg = <0 0xfead0000 0 0x10000>;
-                       /* placeholder */
+                       interrupts = <GIC_SPI 389 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 729>, <&cpg CPG_CORE R8A77961_CLK_HDMI>;
+                       clock-names = "iahb", "isfr";
+                       power-domains = <&sysc R8A77961_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>;
                };
 
                du: display@feb00000 {
+                       compatible = "renesas,du-r8a77961";
                        reg = <0 0xfeb00000 0 0x70000>;
-                       /* placeholder */
+                       interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 269 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 724>, <&cpg CPG_MOD 723>,
+                                <&cpg CPG_MOD 722>;
+                       clock-names = "du.0", "du.1", "du.2";
+                       resets = <&cpg 724>, <&cpg 722>;
+                       reset-names = "du.0", "du.2";
+
+                       renesas,vsps = <&vspd0 0>, <&vspd1 0>, <&vspd2 0>;
+                       status = "disabled";
 
                        ports {
                                #address-cells = <1>;
                                port@1 {
                                        reg = <1>;
                                        du_out_hdmi0: endpoint {
+                                               remote-endpoint = <&dw_hdmi0_in>;
                                        };
                                };
                                port@2 {
index fe4dc12..c355460 100644 (file)
                        resets = <&cpg 905>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a77965";
                        reg = <0 0xe6060000 0 0x50c>;
                };
index 2b9124a..baf8cc8 100644 (file)
                        resets = <&cpg 907>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a77970";
                        reg = <0 0xe6060000 0 0x504>;
                };
index 59f5bbd..d6cae90 100644 (file)
                        resets = <&cpg 907>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a77980";
                        reg = <0 0xe6060000 0 0x50c>;
                };
index 7402cfa..e0ccca2 100644 (file)
 
 &pfc {
        avb_pins: avb {
-               mux {
-                       groups = "avb_link", "avb_mii";
-                       function = "avb";
-               };
+               groups = "avb_link", "avb_mii";
+               function = "avb";
        };
 
        canfd0_pins: canfd0 {
index 1991bdc..33d7e65 100644 (file)
                        resets = <&cpg 906>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a77990";
                        reg = <0 0xe6060000 0 0x508>;
                };
                        reg = <0 0xe6ea0000 0 0x0064>;
                        interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&cpg CPG_MOD 210>;
-                       dmas = <&dmac1 0x43>, <&dmac1 0x42>,
-                              <&dmac2 0x43>, <&dmac2 0x42>;
-                       dma-names = "tx", "rx", "tx", "rx";
+                       dmas = <&dmac0 0x43>, <&dmac0 0x42>;
+                       dma-names = "tx", "rx";
                        power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
                        resets = <&cpg 210>;
                        #address-cells = <1>;
                        };
                };
 
+               drif00: rif@e6f40000 {
+                       compatible = "renesas,r8a77990-drif",
+                                    "renesas,rcar-gen3-drif";
+                       reg = <0 0xe6f40000 0 0x84>;
+                       interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 515>;
+                       clock-names = "fck";
+                       dmas = <&dmac1 0x20>, <&dmac2 0x20>;
+                       dma-names = "rx", "rx";
+                       power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+                       resets = <&cpg 515>;
+                       renesas,bonding = <&drif01>;
+                       status = "disabled";
+               };
+
+               drif01: rif@e6f50000 {
+                       compatible = "renesas,r8a77990-drif",
+                                    "renesas,rcar-gen3-drif";
+                       reg = <0 0xe6f50000 0 0x84>;
+                       interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 514>;
+                       clock-names = "fck";
+                       dmas = <&dmac1 0x22>, <&dmac2 0x22>;
+                       dma-names = "rx", "rx";
+                       power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+                       resets = <&cpg 514>;
+                       renesas,bonding = <&drif00>;
+                       status = "disabled";
+               };
+
+               drif10: rif@e6f60000 {
+                       compatible = "renesas,r8a77990-drif",
+                                    "renesas,rcar-gen3-drif";
+                       reg = <0 0xe6f60000 0 0x84>;
+                       interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 513>;
+                       clock-names = "fck";
+                       dmas = <&dmac1 0x24>, <&dmac2 0x24>;
+                       dma-names = "rx", "rx";
+                       power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+                       resets = <&cpg 513>;
+                       renesas,bonding = <&drif11>;
+                       status = "disabled";
+               };
+
+               drif11: rif@e6f70000 {
+                       compatible = "renesas,r8a77990-drif",
+                                    "renesas,rcar-gen3-drif";
+                       reg = <0 0xe6f70000 0 0x84>;
+                       interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 512>;
+                       clock-names = "fck";
+                       dmas = <&dmac1 0x26>, <&dmac2 0x26>;
+                       dma-names = "rx", "rx";
+                       power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+                       resets = <&cpg 512>;
+                       renesas,bonding = <&drif10>;
+                       status = "disabled";
+               };
+
+               drif20: rif@e6f80000 {
+                       compatible = "renesas,r8a77990-drif",
+                                    "renesas,rcar-gen3-drif";
+                       reg = <0 0xe6f80000 0 0x84>;
+                       interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 511>;
+                       clock-names = "fck";
+                       dmas = <&dmac0 0x28>;
+                       dma-names = "rx";
+                       power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+                       resets = <&cpg 511>;
+                       renesas,bonding = <&drif21>;
+                       status = "disabled";
+               };
+
+               drif21: rif@e6f90000 {
+                       compatible = "renesas,r8a77990-drif",
+                                    "renesas,rcar-gen3-drif";
+                       reg = <0 0xe6f90000 0 0x84>;
+                       interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 510>;
+                       clock-names = "fck";
+                       dmas = <&dmac0 0x2a>;
+                       dma-names = "rx";
+                       power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+                       resets = <&cpg 510>;
+                       renesas,bonding = <&drif20>;
+                       status = "disabled";
+               };
+
+               drif30: rif@e6fa0000 {
+                       compatible = "renesas,r8a77990-drif",
+                                    "renesas,rcar-gen3-drif";
+                       reg = <0 0xe6fa0000 0 0x84>;
+                       interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 509>;
+                       clock-names = "fck";
+                       dmas = <&dmac0 0x2c>;
+                       dma-names = "rx";
+                       power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+                       resets = <&cpg 509>;
+                       renesas,bonding = <&drif31>;
+                       status = "disabled";
+               };
+
+               drif31: rif@e6fb0000 {
+                       compatible = "renesas,r8a77990-drif",
+                                    "renesas,rcar-gen3-drif";
+                       reg = <0 0xe6fb0000 0 0x84>;
+                       interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 508>;
+                       clock-names = "fck";
+                       dmas = <&dmac0 0x2e>;
+                       dma-names = "rx";
+                       power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+                       resets = <&cpg 508>;
+                       renesas,bonding = <&drif30>;
+                       status = "disabled";
+               };
+
                rcar_sound: sound@ec500000 {
                        /*
                         * #sound-dai-cells is required
index 79c73a9..8f47188 100644 (file)
 
 &pfc {
        avb0_pins: avb {
-               mux {
-                       groups = "avb0_link", "avb0_mdio", "avb0_mii";
-                       function = "avb0";
-               };
+               groups = "avb0_link", "avb0_mdio", "avb0_mii";
+               function = "avb0";
        };
 
        can0_pins: can0 {
index 2c2272f..cd7ca97 100644 (file)
                        resets = <&cpg 906>;
                };
 
-               pfc: pin-controller@e6060000 {
+               pfc: pinctrl@e6060000 {
                        compatible = "renesas,pfc-r8a77995";
                        reg = <0 0xe6060000 0 0x508>;
                };
diff --git a/arch/arm64/boot/dts/renesas/r8a779a0-falcon-cpu.dtsi b/arch/arm64/boot/dts/renesas/r8a779a0-falcon-cpu.dtsi
new file mode 100644 (file)
index 0000000..4ba269a
--- /dev/null
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the Falcon CPU board
+ *
+ * Copyright (C) 2020 Renesas Electronics Corp.
+ */
+
+#include "r8a779a0.dtsi"
+
+/ {
+       model = "Renesas Falcon CPU board";
+       compatible = "renesas,falcon-cpu", "renesas,r8a779a0";
+
+       memory@48000000 {
+               device_type = "memory";
+               /* first 128MB is reserved for secure area. */
+               reg = <0x0 0x48000000 0x0 0x78000000>;
+       };
+
+       memory@500000000 {
+               device_type = "memory";
+               reg = <0x5 0x00000000 0x0 0x80000000>;
+       };
+
+       memory@600000000 {
+               device_type = "memory";
+               reg = <0x6 0x00000000 0x0 0x80000000>;
+       };
+
+       memory@700000000 {
+               device_type = "memory";
+               reg = <0x7 0x00000000 0x0 0x80000000>;
+       };
+};
+
+&extal_clk {
+       clock-frequency = <16666666>;
+};
+
+&extalr_clk {
+       clock-frequency = <32768>;
+};
+
+&scif0 {
+       status = "okay";
+};
diff --git a/arch/arm64/boot/dts/renesas/r8a779a0-falcon.dts b/arch/arm64/boot/dts/renesas/r8a779a0-falcon.dts
new file mode 100644 (file)
index 0000000..8eda70e
--- /dev/null
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the Falcon CPU and BreakOut boards
+ *
+ * Copyright (C) 2020 Renesas Electronics Corp.
+ */
+
+/dts-v1/;
+#include "r8a779a0-falcon-cpu.dtsi"
+
+/ {
+       model = "Renesas Falcon CPU and Breakout boards based on r8a779a0";
+       compatible = "renesas,falcon-breakout", "renesas,falcon-cpu", "renesas,r8a779a0";
+
+       aliases {
+               serial0 = &scif0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+};
diff --git a/arch/arm64/boot/dts/renesas/r8a779a0.dtsi b/arch/arm64/boot/dts/renesas/r8a779a0.dtsi
new file mode 100644 (file)
index 0000000..6cf77ce
--- /dev/null
@@ -0,0 +1,133 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the R-Car V3U (R8A779A0) SoC
+ *
+ * Copyright (C) 2020 Renesas Electronics Corp.
+ */
+
+#include <dt-bindings/clock/r8a779a0-cpg-mssr.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/power/r8a779a0-sysc.h>
+
+/ {
+       compatible = "renesas,r8a779a0";
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               a76_0: cpu@0 {
+                       compatible = "arm,cortex-a76";
+                       reg = <0>;
+                       device_type = "cpu";
+                       power-domains = <&sysc R8A779A0_PD_A1E0D0C0>;
+                       next-level-cache = <&L3_CA76_0>;
+               };
+
+               L3_CA76_0: cache-controller-0 {
+                       compatible = "cache";
+                       power-domains = <&sysc R8A779A0_PD_A2E0D0>;
+                       cache-unified;
+                       cache-level = <3>;
+               };
+       };
+
+       extal_clk: extal {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               /* This value must be overridden by the board */
+               clock-frequency = <0>;
+       };
+
+       extalr_clk: extalr {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               /* This value must be overridden by the board */
+               clock-frequency = <0>;
+       };
+
+       pmu_a76 {
+               compatible = "arm,cortex-a76-pmu";
+               interrupts-extended = <&gic GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>,
+                                     <&gic GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>,
+                                     <&gic GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>,
+                                     <&gic GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       /* External SCIF clock - to be overridden by boards that provide it */
+       scif_clk: scif {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <0>;
+       };
+
+       soc: soc {
+               compatible = "simple-bus";
+               interrupt-parent = <&gic>;
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               cpg: clock-controller@e6150000 {
+                       compatible = "renesas,r8a779a0-cpg-mssr";
+                       reg = <0 0xe6150000 0 0x4000>;
+                       clocks = <&extal_clk>, <&extalr_clk>;
+                       clock-names = "extal", "extalr";
+                       #clock-cells = <2>;
+                       #power-domain-cells = <0>;
+                       #reset-cells = <1>;
+               };
+
+               rst: reset-controller@e6160000 {
+                       compatible = "renesas,r8a779a0-rst";
+                       reg = <0 0xe6160000 0 0x4000>;
+               };
+
+               sysc: system-controller@e6180000 {
+                       compatible = "renesas,r8a779a0-sysc";
+                       reg = <0 0xe6180000 0 0x4000>;
+                       #power-domain-cells = <1>;
+               };
+
+               scif0: serial@e6e60000 {
+                       compatible = "renesas,scif-r8a779a0",
+                                    "renesas,rcar-gen3-scif", "renesas,scif";
+                       reg = <0 0xe6e60000 0 64>;
+                       interrupts = <GIC_SPI 251 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 702>,
+                                <&cpg CPG_CORE R8A779A0_CLK_S1D2>,
+                                <&scif_clk>;
+                       clock-names = "fck", "brg_int", "scif_clk";
+                       power-domains = <&sysc R8A779A0_PD_ALWAYS_ON>;
+                       resets = <&cpg 702>;
+                       status = "disabled";
+               };
+
+               gic: interrupt-controller@f1000000 {
+                       compatible = "arm,gic-v3";
+                       #interrupt-cells = <3>;
+                       #address-cells = <0>;
+                       interrupt-controller;
+                       reg = <0x0 0xf1000000 0 0x20000>,
+                             <0x0 0xf1060000 0 0x110000>;
+                       interrupts = <GIC_PPI 9
+                                     (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_HIGH)>;
+                       power-domains = <&sysc R8A779A0_PD_ALWAYS_ON>;
+               };
+
+               prr: chipid@fff00044 {
+                       compatible = "renesas,prr";
+                       reg = <0 0xfff00044 0 4>;
+               };
+       };
+
+       timer {
+               compatible = "arm,armv8-timer";
+               interrupts-extended = <&gic GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
+                                     <&gic GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
+                                     <&gic GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
+                                     <&gic GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>;
+       };
+};
index ff88af8..a2e085d 100644 (file)
        mmc-hs200-1_8v;
        mmc-hs400-1_8v;
        non-removable;
+       full-pwr-cycle-in-suspend;
        status = "okay";
 };
 
index b87b1f7..26661c7 100644 (file)
@@ -2,9 +2,11 @@
 dtb-$(CONFIG_ARCH_ROCKCHIP) += px30-evb.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3308-evb.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3308-roc-cc.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3318-a95x-z2.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3326-odroid-go2.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-a1.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-evb.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2s.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock64.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-roc-cc.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-evb-act8846.dtb
@@ -33,7 +35,9 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-pinebook-pro.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-mezzanine.dtb
-dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4a.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4b.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4c.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64-v2.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb
index e8b754d..2560b98 100644 (file)
        };
 
        spdif_tx: spdif-tx@ff3a0000 {
-               compatible = "rockchip,rk3308-spdif", "rockchip,rk3328-spdif";
+               compatible = "rockchip,rk3308-spdif", "rockchip,rk3066-spdif";
                reg = <0x0 0xff3a0000 0x0 0x1000>;
                interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&cru SCLK_SPDIF_TX>, <&cru HCLK_SPDIFTX>;
diff --git a/arch/arm64/boot/dts/rockchip/rk3318-a95x-z2.dts b/arch/arm64/boot/dts/rockchip/rk3318-a95x-z2.dts
new file mode 100644 (file)
index 0000000..30c73ef
--- /dev/null
@@ -0,0 +1,374 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+#include <dt-bindings/input/input.h>
+#include "rk3328.dtsi"
+
+/ {
+       model = "A95X Z2";
+       compatible = "zkmagic,a95x-z2", "rockchip,rk3318";
+
+       chosen {
+               stdout-path = "serial2:1500000n8";
+       };
+
+       adc-keys {
+               compatible = "adc-keys";
+               io-channels = <&saradc 0>;
+               io-channel-names = "buttons";
+               keyup-threshold-microvolt = <1800000>;
+               poll-interval = <100>;
+
+               recovery {
+                       label = "recovery";
+                       linux,code = <KEY_VENDOR>;
+                       press-threshold-microvolt = <17000>;
+               };
+       };
+
+       ir-receiver {
+               compatible = "gpio-ir-receiver";
+               gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>;
+               pinctrl-0 = <&ir_int>;
+               pinctrl-names = "default";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-0 = <&cyx_led_pin>;
+               pinctrl-names = "default";
+
+               cyx_led: led-0 {
+                       default-state = "on";
+                       gpios = <&gpio2 RK_PC7 GPIO_ACTIVE_LOW>;
+                       label = "CYX_LED";
+               };
+       };
+
+       sdio_pwrseq: sdio-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               pinctrl-0 = <&wifi_enable_h>;
+               pinctrl-names = "default";
+               reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
+       };
+
+       spdif-sound {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "SPDIF";
+
+               simple-audio-card,cpu {
+                       sound-dai = <&spdif>;
+               };
+
+               simple-audio-card,codec {
+                       sound-dai = <&spdif_out>;
+               };
+       };
+
+       spdif_out: spdif-out {
+               compatible = "linux,spdif-dit";
+               #sound-dai-cells = <0>;
+       };
+
+       /* Power tree */
+       vccio_1v8: vccio-1v8-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "vccio_1v8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-always-on;
+       };
+
+       vccio_3v3: vccio-3v3-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "vccio_3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       vcc_otg_vbus: otg-vbus-regulator {
+               compatible = "regulator-fixed";
+               gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
+               pinctrl-0 = <&otg_vbus_drv>;
+               pinctrl-names = "default";
+               regulator-name = "vcc_otg_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               enable-active-high;
+       };
+
+       vcc_sd: sdmmc-regulator {
+               compatible = "regulator-fixed";
+               gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>;
+               pinctrl-0 = <&sdmmc0m1_pin>;
+               pinctrl-names = "default";
+               regulator-name = "vcc_sd";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vccio_3v3>;
+       };
+
+       vdd_arm: vdd-arm {
+               compatible = "pwm-regulator";
+               pwms = <&pwm0 0 5000 1>;
+               regulator-name = "vdd_arm";
+               regulator-min-microvolt = <950000>;
+               regulator-max-microvolt = <1400000>;
+               regulator-settling-time-up-us = <250>;
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
+       vdd_log: vdd-log {
+               compatible = "pwm-regulator";
+               pwms = <&pwm1 0 5000 1>;
+               regulator-name = "vdd_log";
+               regulator-min-microvolt = <900000>;
+               regulator-max-microvolt = <1300000>;
+               regulator-settling-time-up-us = <250>;
+               regulator-always-on;
+               regulator-boot-on;
+       };
+};
+
+&analog_sound {
+       status = "okay";
+};
+
+&codec {
+       status = "okay";
+};
+
+&cpu0 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu1 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu2 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu3 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu0_opp_table {
+       opp-1200000000 {
+               status = "disabled";
+       };
+
+       opp-1296000000 {
+               status = "disabled";
+       };
+};
+
+&emmc {
+       bus-width = <8>;
+       cap-mmc-highspeed;
+       non-removable;
+       pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>;
+       pinctrl-names = "default";
+       status = "okay";
+};
+
+&gmac2phy {
+       assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>;
+       assigned-clock-rate = <50000000>;
+       assigned-clocks = <&cru SCLK_MAC2PHY>;
+       clock_in_out = "output";
+       status = "okay";
+};
+
+&gpu {
+       mali-supply = <&vdd_log>;
+};
+
+&hdmi {
+       ddc-i2c-scl-high-time-ns = <9625>;
+       ddc-i2c-scl-low-time-ns = <10000>;
+       status = "okay";
+};
+
+&hdmiphy {
+       status = "okay";
+};
+
+&hdmi_sound {
+       status = "okay";
+};
+
+&i2s0 {
+       status = "okay";
+};
+
+&i2s1 {
+       status = "okay";
+};
+
+&io_domains {
+       pmuio-supply = <&vccio_3v3>;
+       vccio1-supply = <&vccio_3v3>;
+       vccio2-supply = <&vccio_1v8>;
+       vccio3-supply = <&vccio_3v3>;
+       vccio4-supply = <&vccio_1v8>;
+       vccio5-supply = <&vccio_3v3>;
+       vccio6-supply = <&vccio_3v3>;
+       status = "okay";
+};
+
+&pinctrl {
+       ir {
+               ir_int: ir-int {
+                       rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       leds {
+               cyx_led_pin: cyx-led-pin {
+                       rockchip,pins = <2 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       pwm0 {
+               pwm0_pin_pull_up: pwm0-pin-pull-up {
+                       rockchip,pins = <2 RK_PA4 1 &pcfg_pull_up>;
+               };
+       };
+
+       pwm1 {
+               pwm1_pin_pull_up: pwm1-pin-pull-up {
+                       rockchip,pins = <2 RK_PA5 1 &pcfg_pull_up>;
+               };
+       };
+
+       sdio-pwrseq {
+               wifi_enable_h: wifi-enable-h {
+                       rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       sdmmc1 {
+               clk_32k_out: clk-32k-out {
+                       rockchip,pins = <1 RK_PD4 1 &pcfg_pull_none>;
+               };
+       };
+
+       usb {
+               host_vbus_drv: host-vbus-drv {
+                       rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               otg_vbus_drv: otg-vbus-drv {
+                       rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+};
+
+&pwm0 {
+       pinctrl-0 = <&pwm0_pin_pull_up>;
+       pinctrl-names = "active";
+       status = "okay";
+};
+
+&pwm1 {
+       pinctrl-0 = <&pwm1_pin_pull_up>;
+       pinctrl-names = "active";
+       status = "okay";
+};
+
+&saradc {
+       vref-supply = <&vccio_1v8>;
+       status = "okay";
+};
+
+&sdio {
+       bus-width = <4>;
+       cap-sd-highspeed;
+       cap-sdio-irq;
+       keep-power-in-suspend;
+       max-frequency = <125000000>;
+       mmc-pwrseq = <&sdio_pwrseq>;
+       non-removable;
+       pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk &clk_32k_out>;
+       pinctrl-names = "default";
+       sd-uhs-sdr104;
+       status = "okay";
+};
+
+&sdmmc {
+       bus-width = <4>;
+       cap-sd-highspeed;
+       pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>;
+       pinctrl-names = "default";
+       vmmc-supply = <&vcc_sd>;
+       status = "okay";
+};
+
+&spdif {
+       pinctrl-0 = <&spdifm0_tx>;
+       status = "okay";
+};
+
+&soc_crit {
+       temperature = <115000>; /* millicelsius */
+};
+
+&target {
+       temperature = <105000>; /* millicelsius */
+};
+
+&threshold {
+       temperature = <90000>; /* millicelsius */
+};
+
+&tsadc {
+       rockchip,hw-tshut-temp = <120000>;
+       status = "okay";
+};
+
+&u2phy {
+       status = "okay";
+};
+
+&u2phy_host {
+       status = "okay";
+};
+
+&u2phy_otg {
+       phy-supply = <&vcc_otg_vbus>;
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-0 = <&uart0_xfer &uart0_cts>;
+       status = "okay";
+};
+
+&uart2 {
+       status = "okay";
+};
+
+&usb20_otg {
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usb_host0_ehci {
+       status = "okay";
+};
+
+&usb_host0_ohci {
+       status = "okay";
+};
+
+&vop {
+       status = "okay";
+};
+
+&vop_mmu {
+       status = "okay";
+};
index 1969dab..a487679 100644 (file)
        cpu-supply = <&vdd_arm>;
 };
 
+&cpu1 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu2 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu3 {
+       cpu-supply = <&vdd_arm>;
+};
+
 &emmc {
        bus-width = <8>;
        cap-mmc-highspeed;
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
new file mode 100644 (file)
index 0000000..be7a31d
--- /dev/null
@@ -0,0 +1,368 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 David Bauer <mail@david-bauer.net>
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+#include "rk3328.dtsi"
+
+/ {
+       model = "FriendlyElec NanoPi R2S";
+       compatible = "friendlyarm,nanopi-r2s", "rockchip,rk3328";
+
+       chosen {
+               stdout-path = "serial2:1500000n8";
+       };
+
+       gmac_clk: gmac-clock {
+               compatible = "fixed-clock";
+               clock-frequency = <125000000>;
+               clock-output-names = "gmac_clk";
+               #clock-cells = <0>;
+       };
+
+       keys {
+               compatible = "gpio-keys";
+               pinctrl-0 = <&reset_button_pin>;
+               pinctrl-names = "default";
+
+               reset {
+                       label = "reset";
+                       gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+                       debounce-interval = <50>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-0 = <&lan_led_pin>,  <&sys_led_pin>, <&wan_led_pin>;
+               pinctrl-names = "default";
+
+               lan_led: led-0 {
+                       gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>;
+                       label = "nanopi-r2s:green:lan";
+               };
+
+               sys_led: led-1 {
+                       gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
+                       label = "nanopi-r2s:red:sys";
+               };
+
+               wan_led: led-2 {
+                       gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>;
+                       label = "nanopi-r2s:green:wan";
+               };
+       };
+
+       vcc_io_sdio: sdmmcio-regulator {
+               compatible = "regulator-gpio";
+               enable-active-high;
+               gpios = <&gpio1 RK_PD4 GPIO_ACTIVE_HIGH>;
+               pinctrl-0 = <&sdio_vcc_pin>;
+               pinctrl-names = "default";
+               regulator-name = "vcc_io_sdio";
+               regulator-always-on;
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-settling-time-us = <5000>;
+               regulator-type = "voltage";
+               startup-delay-us = <2000>;
+               states = <1800000 0x1
+                         3300000 0x0>;
+               vin-supply = <&vcc_io_33>;
+       };
+
+       vcc_sd: sdmmc-regulator {
+               compatible = "regulator-fixed";
+               gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>;
+               pinctrl-0 = <&sdmmc0m1_pin>;
+               pinctrl-names = "default";
+               regulator-name = "vcc_sd";
+               regulator-boot-on;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vcc_io_33>;
+       };
+
+       vdd_5v: vdd-5v {
+               compatible = "regulator-fixed";
+               regulator-name = "vdd_5v";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+       };
+};
+
+&cpu0 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu1 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu2 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&cpu3 {
+       cpu-supply = <&vdd_arm>;
+};
+
+&gmac2io {
+       assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>;
+       assigned-clock-parents = <&gmac_clk>, <&gmac_clk>;
+       clock_in_out = "input";
+       phy-handle = <&rtl8211e>;
+       phy-mode = "rgmii";
+       phy-supply = <&vcc_io_33>;
+       pinctrl-0 = <&rgmiim1_pins>;
+       pinctrl-names = "default";
+       rx_delay = <0x18>;
+       snps,aal;
+       tx_delay = <0x24>;
+       status = "okay";
+
+       mdio {
+               compatible = "snps,dwmac-mdio";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               rtl8211e: ethernet-phy@1 {
+                       reg = <1>;
+                       pinctrl-0 = <&eth_phy_reset_pin>;
+                       pinctrl-names = "default";
+                       reset-assert-us = <10000>;
+                       reset-deassert-us = <50000>;
+                       reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&i2c1 {
+       status = "okay";
+
+       rk805: pmic@18 {
+               compatible = "rockchip,rk805";
+               reg = <0x18>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <24 IRQ_TYPE_LEVEL_LOW>;
+               #clock-cells = <1>;
+               clock-output-names = "xin32k", "rk805-clkout2";
+               gpio-controller;
+               #gpio-cells = <2>;
+               pinctrl-0 = <&pmic_int_l>;
+               pinctrl-names = "default";
+               rockchip,system-power-controller;
+               wakeup-source;
+
+               vcc1-supply = <&vdd_5v>;
+               vcc2-supply = <&vdd_5v>;
+               vcc3-supply = <&vdd_5v>;
+               vcc4-supply = <&vdd_5v>;
+               vcc5-supply = <&vcc_io_33>;
+               vcc6-supply = <&vdd_5v>;
+
+               regulators {
+                       vdd_log: DCDC_REG1 {
+                               regulator-name = "vdd_log";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <712500>;
+                               regulator-max-microvolt = <1450000>;
+                               regulator-ramp-delay = <12500>;
+
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1000000>;
+                               };
+                       };
+
+                       vdd_arm: DCDC_REG2 {
+                               regulator-name = "vdd_arm";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <712500>;
+                               regulator-max-microvolt = <1450000>;
+                               regulator-ramp-delay = <12500>;
+
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <950000>;
+                               };
+                       };
+
+                       vcc_ddr: DCDC_REG3 {
+                               regulator-name = "vcc_ddr";
+                               regulator-always-on;
+                               regulator-boot-on;
+
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                               };
+                       };
+
+                       vcc_io_33: DCDC_REG4 {
+                               regulator-name = "vcc_io_33";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <3300000>;
+                               };
+                       };
+
+                       vcc_18: LDO_REG1 {
+                               regulator-name = "vcc_18";
+                               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>;
+                               };
+                       };
+
+                       vcc18_emmc: LDO_REG2 {
+                               regulator-name = "vcc18_emmc";
+                               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>;
+                               };
+                       };
+
+                       vdd_10: LDO_REG3 {
+                               regulator-name = "vdd_10";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1000000>;
+                               regulator-max-microvolt = <1000000>;
+
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1000000>;
+                               };
+                       };
+               };
+       };
+};
+
+&io_domains {
+       pmuio-supply = <&vcc_io_33>;
+       vccio1-supply = <&vcc_io_33>;
+       vccio2-supply = <&vcc18_emmc>;
+       vccio3-supply = <&vcc_io_sdio>;
+       vccio4-supply = <&vcc_18>;
+       vccio5-supply = <&vcc_io_33>;
+       vccio6-supply = <&vcc_io_33>;
+       status = "okay";
+};
+
+&pinctrl {
+       button {
+               reset_button_pin: reset-button-pin {
+                       rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       ethernet-phy {
+               eth_phy_reset_pin: eth-phy-reset-pin {
+                       rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>;
+               };
+       };
+
+       leds {
+               lan_led_pin: lan-led-pin {
+                       rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               sys_led_pin: sys-led-pin {
+                       rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               wan_led_pin: wan-led-pin {
+                       rockchip,pins = <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       pmic {
+               pmic_int_l: pmic-int-l {
+                       rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       sd {
+               sdio_vcc_pin: sdio-vcc-pin {
+                       rockchip,pins = <1 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+};
+
+&pwm2 {
+       status = "okay";
+};
+
+&sdmmc {
+       bus-width = <4>;
+       cap-sd-highspeed;
+       disable-wp;
+       pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>;
+       pinctrl-names = "default";
+       sd-uhs-sdr12;
+       sd-uhs-sdr25;
+       sd-uhs-sdr50;
+       sd-uhs-sdr104;
+       vmmc-supply = <&vcc_sd>;
+       vqmmc-supply = <&vcc_io_sdio>;
+       status = "okay";
+};
+
+&tsadc {
+       rockchip,hw-tshut-mode = <0>;
+       rockchip,hw-tshut-polarity = <0>;
+       status = "okay";
+};
+
+&u2phy {
+       status = "okay";
+};
+
+&u2phy_host {
+       status = "okay";
+};
+
+&u2phy_otg {
+       status = "okay";
+};
+
+&uart2 {
+       status = "okay";
+};
+
+&usb20_otg {
+       status = "okay";
+       dr_mode = "host";
+};
+
+&usb_host0_ehci {
+       status = "okay";
+};
+
+&usb_host0_ohci {
+       status = "okay";
+};
index 1c52f47..87fabc6 100644 (file)
        pinctrl-0 = <&rmii_pins>;
        tx_delay = <0x30>;
        rx_delay = <0x10>;
-       status = "ok";
+       status = "okay";
 };
 
 &i2c0 {
index b058ce9..ecce16e 100644 (file)
        snps,reset-delays-us = <0 10000 1000000>;
        tx_delay = <0x30>;
        rx_delay = <0x10>;
-       status = "ok";
+       status = "okay";
 };
 
 &i2c0 {
index 236ab0f..2582fa4 100644 (file)
        pinctrl-0 = <&rmii_pins>;
        tx_delay = <0x30>;
        rx_delay = <0x10>;
-       status = "ok";
+       status = "okay";
 };
 
 &i2c0 {
 };
 
 &io_domains {
-       status = "ok";
+       status = "okay";
 
        audio-supply = <&vcc_io>;
        gpio30-supply = <&vcc_io>;
index e36837c..635afdd 100644 (file)
                };
        };
 
+       ir-receiver {
+               compatible = "gpio-ir-receiver";
+               gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>;
+               linux,rc-map-name = "rc-khadas";
+               pinctrl-names = "default";
+               pinctrl-0 = <&ir_rx>;
+       };
+
        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
                };
        };
 
+       ir {
+               ir_rx: ir-rx {
+                   rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
        leds {
                sys_led_pin: sys-led-pin {
                        rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
        status = "okay";
 };
 
+&spi1 {
+       status = "okay";
+
+       spiflash: flash@0 {
+               compatible = "winbond,w25q128fw", "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <104000000>;
+       };
+};
+
 &tcphy0 {
        status = "okay";
 };
index 2acb3d5..754627d 100644 (file)
        model = "Firefly ROC-RK3399-PC Mezzanine Board";
        compatible = "firefly,roc-rk3399-pc-mezzanine", "rockchip,rk3399";
 
+       /* MP8009 PoE PD */
+       poe_12v: poe-12v {
+               compatible = "regulator-fixed";
+               regulator-name = "poe_12v";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+       };
+
        vcc3v3_ngff: vcc3v3-ngff {
                compatible = "regulator-fixed";
                regulator-name = "vcc3v3_ngff";
@@ -22,7 +32,7 @@
                regulator-boot-on;
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
-               vin-supply = <&dc_12v>;
+               vin-supply = <&sys_12v>;
        };
 
        vcc3v3_pcie: vcc3v3-pcie {
                pinctrl-0 = <&vcc3v3_pcie_en>;
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
-               vin-supply = <&dc_12v>;
+               vin-supply = <&sys_12v>;
        };
 };
 
+&sys_12v {
+       vin-supply = <&poe_12v>;
+};
+
 &pcie_phy {
        status = "okay";
 };
index b85ec31..e7a459f 100644 (file)
                regulator-max-microvolt = <5000000>;
        };
 
+       sys_12v: sys-12v {
+               compatible = "regulator-fixed";
+               regulator-name = "sys_12v";
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&dc_12v>;
+       };
+
        /* switched by pmic_sleep */
        vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
                compatible = "regulator-fixed";
                regulator-boot-on;
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
-               vin-supply = <&dc_12v>;
+               vin-supply = <&sys_12v>;
        };
 
        vcca_0v9: vcca-0v9 {
                regulator-boot-on;
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
-               vin-supply = <&dc_12v>;
+               vin-supply = <&sys_12v>;
        };
 
        vdd_log: vdd-log {
@@ -11,9 +11,6 @@
 #include "rk3399-opp.dtsi"
 
 / {
-       model = "Radxa ROCK Pi 4";
-       compatible = "radxa,rockpi4", "rockchip,rk3399";
-
        chosen {
                stdout-path = "serial2:1500000n8";
        };
        pinctrl-names = "default";
        pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
        sd-uhs-sdr104;
-       status = "okay";
-
-       brcmf: wifi@1 {
-               compatible = "brcm,bcm4329-fmac";
-               reg = <1>;
-               interrupt-parent = <&gpio0>;
-               interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
-               interrupt-names = "host-wake";
-               pinctrl-names = "default";
-               pinctrl-0 = <&wifi_host_wake_l>;
-       };
 };
 
 &sdmmc {
 &uart0 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
-       status = "okay";
-
-       bluetooth {
-               compatible = "brcm,bcm43438-bt";
-               clocks = <&rk808 1>;
-               clock-names = "ext_clock";
-               device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
-               host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
-               shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
-       };
 };
 
 &uart2 {
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4a.dts b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4a.dts
new file mode 100644 (file)
index 0000000..89f2af5
--- /dev/null
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Akash Gajjar <Akash_Gajjar@mentor.com>
+ * Copyright (c) 2019 Pragnesh Patel <Pragnesh_Patel@mentor.com>
+ */
+
+/dts-v1/;
+#include "rk3399-rock-pi-4.dtsi"
+
+/ {
+       model = "Radxa ROCK Pi 4A";
+       compatible = "radxa,rockpi4a", "radxa,rockpi4", "rockchip,rk3399";
+};
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts
new file mode 100644 (file)
index 0000000..f0055ce
--- /dev/null
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Akash Gajjar <Akash_Gajjar@mentor.com>
+ * Copyright (c) 2019 Pragnesh Patel <Pragnesh_Patel@mentor.com>
+ */
+
+/dts-v1/;
+#include "rk3399-rock-pi-4.dtsi"
+
+/ {
+       model = "Radxa ROCK Pi 4B";
+       compatible = "radxa,rockpi4b", "radxa,rockpi4", "rockchip,rk3399";
+};
+
+&sdio0 {
+       status = "okay";
+
+       brcmf: wifi@1 {
+               compatible = "brcm,bcm4329-fmac";
+               reg = <1>;
+               interrupt-parent = <&gpio0>;
+               interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
+               interrupt-names = "host-wake";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_host_wake_l>;
+       };
+};
+
+&uart0 {
+       status = "okay";
+
+       bluetooth {
+               compatible = "brcm,bcm43438-bt";
+               clocks = <&rk808 1>;
+               clock-names = "ext_clock";
+               device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
+               host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
+               shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
+       };
+};
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts
new file mode 100644 (file)
index 0000000..4c7ebb1
--- /dev/null
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd
+ * Copyright (c) 2019 Radxa Limited
+ * Copyright (c) 2019 Amarula Solutions(India)
+ */
+
+/dts-v1/;
+#include "rk3399-rock-pi-4.dtsi"
+
+/ {
+       model = "Radxa ROCK Pi 4C";
+       compatible = "radxa,rockpi4c", "radxa,rockpi4", "rockchip,rk3399";
+};
+
+&sdio0 {
+       status = "okay";
+
+       brcmf: wifi@1 {
+               compatible = "brcm,bcm4329-fmac";
+               reg = <1>;
+               interrupt-parent = <&gpio0>;
+               interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
+               interrupt-names = "host-wake";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_host_wake_l>;
+       };
+};
+
+&uart0 {
+       status = "okay";
+
+       bluetooth {
+               compatible = "brcm,bcm43438-bt";
+               clocks = <&rk808 1>;
+               clock-names = "ext_clock";
+               device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
+               host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
+               shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
+       };
+};
+
+&vcc5v0_host {
+       gpio = <&gpio3 RK_PD6 GPIO_ACTIVE_HIGH>;
+};
+
+&vcc5v0_host_en {
+       rockchip,pins = <3 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
+};
index 05c0beb..65506f2 100644 (file)
@@ -3,9 +3,11 @@
 # Make file to build device tree binaries for boards based on
 # Texas Instruments Inc processors
 #
-# Copyright (C) 2016-2018 Texas Instruments Incorporated - https://www.ti.com/
+# Copyright (C) 2016-2020 Texas Instruments Incorporated - https://www.ti.com/
 #
 
-dtb-$(CONFIG_ARCH_K3_AM6_SOC) += k3-am654-base-board.dtb
+dtb-$(CONFIG_ARCH_K3) += k3-am654-base-board.dtb
 
-dtb-$(CONFIG_ARCH_K3_J721E_SOC) += k3-j721e-common-proc-board.dtb
+dtb-$(CONFIG_ARCH_K3) += k3-j721e-common-proc-board.dtb
+
+dtb-$(CONFIG_ARCH_K3) += k3-j7200-common-proc-board.dtb
index 24ef18f..5335252 100644 (file)
                power-domains = <&k3_pds 148 TI_SCI_PD_EXCLUSIVE>;
        };
 
-       main_pmx0: pinmux@11c000 {
+       crypto: crypto@4e00000 {
+               compatible = "ti,am654-sa2ul";
+               reg = <0x0 0x4e00000 0x0 0x1200>;
+               power-domains = <&k3_pds 136 TI_SCI_PD_EXCLUSIVE>;
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges = <0x0 0x04e00000 0x00 0x04e00000 0x0 0x30000>;
+               status = "okay";
+
+               dmas = <&main_udmap 0xc000>, <&main_udmap 0x4000>,
+                               <&main_udmap 0x4001>;
+               dma-names = "tx", "rx1", "rx2";
+               dma-coherent;
+
+               rng: rng@4e10000 {
+                       compatible = "inside-secure,safexcel-eip76";
+                       reg = <0x0 0x4e10000 0x0 0x7d>;
+                       interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&k3_clks 136 1>;
+               };
+       };
+
+       main_pmx0: pinctrl@11c000 {
                compatible = "pinctrl-single";
                reg = <0x0 0x11c000 0x0 0x2e4>;
                #pinctrl-cells = <1>;
                pinctrl-single,function-mask = <0xffffffff>;
        };
 
-       main_pmx1: pinmux@11c2e8 {
+       main_pmx1: pinctrl@11c2e8 {
                compatible = "pinctrl-single";
                reg = <0x0 0x11c2e8 0x0 0x24>;
                #pinctrl-cells = <1>;
                no-1-8-v;
        };
 
-       scm_conf: scm_conf@100000 {
+       scm_conf: scm-conf@100000 {
                compatible = "syscon", "simple-mfd";
                reg = <0 0x00100000 0 0x1c000>;
                #address-cells = <1>;
                        reg = <0x00000210 0x4>;
                };
 
-               serdes0_clk: serdes_clk@4080 {
+               serdes0_clk: clock@4080 {
                        compatible = "syscon";
                        reg = <0x00004080 0x4>;
                };
 
-               serdes1_clk: serdes_clk@4090 {
+               serdes1_clk: clock@4090 {
                        compatible = "syscon";
                        reg = <0x00004090 0x4>;
                };
                                        <0x4090 0x3>; /* SERDES1 lane select */
                };
 
-               dss_oldi_io_ctrl: dss_oldi_io_ctrl@41E0 {
+               dss_oldi_io_ctrl: dss-oldi-io-ctrl@41e0 {
                        compatible = "syscon";
-                       reg = <0x0000041E0 0x14>;
+                       reg = <0x0000041e0 0x14>;
                };
 
-               ehrpwm_tbclk: syscon@4140 {
+               ehrpwm_tbclk: clock@4140 {
                        compatible = "ti,am654-ehrpwm-tbclk", "syscon";
                        reg = <0x4140 0x18>;
                        #clock-cells = <1>;
                ti,interrupt-ranges = <0 392 32>;
        };
 
-       main_navss {
+       main-navss {
                compatible = "simple-mfd";
                #address-cells = <2>;
                #size-cells = <2>;
                };
        };
 
-       main_gpio0:  main_gpio0@600000 {
+       main_gpio0: gpio@600000 {
                compatible = "ti,am654-gpio", "ti,keystone-gpio";
                reg = <0x0 0x600000 0x0 0x100>;
                gpio-controller;
                clock-names = "gpio";
        };
 
-       main_gpio1:  main_gpio1@601000 {
+       main_gpio1: gpio@601000 {
                compatible = "ti,am654-gpio", "ti,keystone-gpio";
                reg = <0x0 0x601000 0x0 0x100>;
                gpio-controller;
                ti,syscon-pcie-mode = <&pcie0_mode>;
                bus-range = <0x0 0xff>;
                num-viewport = <16>;
-               max-link-speed = <3>;
+               max-link-speed = <2>;
                dma-coherent;
                interrupts = <GIC_SPI 340 IRQ_TYPE_EDGE_RISING>;
                msi-map = <0x0 &gic_its 0x0 0x10000>;
                ti,syscon-pcie-mode = <&pcie0_mode>;
                num-ib-windows = <16>;
                num-ob-windows = <16>;
-               max-link-speed = <3>;
+               max-link-speed = <2>;
                dma-coherent;
                interrupts = <GIC_SPI 340 IRQ_TYPE_EDGE_RISING>;
        };
                ti,syscon-pcie-mode = <&pcie1_mode>;
                bus-range = <0x0 0xff>;
                num-viewport = <16>;
-               max-link-speed = <3>;
+               max-link-speed = <2>;
                dma-coherent;
                interrupts = <GIC_SPI 355 IRQ_TYPE_EDGE_RISING>;
                msi-map = <0x0 &gic_its 0x10000 0x10000>;
                ti,syscon-pcie-mode = <&pcie1_mode>;
                num-ib-windows = <16>;
                num-ob-windows = <16>;
-               max-link-speed = <3>;
+               max-link-speed = <2>;
                dma-coherent;
                interrupts = <GIC_SPI 355 IRQ_TYPE_EDGE_RISING>;
        };
index 51ca4b4..29aaf8d 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 &cbass_mcu {
-       mcu_conf: scm_conf@40f00000 {
+       mcu_conf: scm-conf@40f00000 {
                compatible = "syscon", "simple-mfd";
                reg = <0x0 0x40f00000 0x0 0x20000>;
                #address-cells = <1>;
                };
        };
 
-       mcu_navss {
+       mcu-navss {
                compatible = "simple-mfd";
                #address-cells = <2>;
                #size-cells = <2>;
index a1ffe88..ed42f13 100644 (file)
@@ -39,7 +39,7 @@
                reg = <0x43000014 0x4>;
        };
 
-       wkup_pmx0: pinmux@4301c000 {
+       wkup_pmx0: pinctrl@4301c000 {
                compatible = "pinctrl-single";
                reg = <0x4301c000 0x118>;
                #pinctrl-cells = <1>;
@@ -80,7 +80,7 @@
                ti,interrupt-ranges = <0 712 16>;
        };
 
-       wkup_gpio0: wkup_gpio0@42110000 {
+       wkup_gpio0: gpio@42110000 {
                compatible = "ti,am654-gpio", "ti,keystone-gpio";
                reg = <0x42110000 0x100>;
                gpio-controller;
@@ -95,7 +95,7 @@
                clock-names = "gpio";
        };
 
-       wkup_vtm0: thermal@42050000 {
+       wkup_vtm0: temperature-sensor@42050000 {
                compatible = "ti,am654-vtm";
                reg = <0x42050000 0x25c>;
                power-domains = <&k3_pds 80 TI_SCI_PD_EXCLUSIVE>;
index 27c0406..d84c0bc 100644 (file)
@@ -61,7 +61,7 @@
                interrupts = <GIC_PPI 7 IRQ_TYPE_LEVEL_HIGH>;
        };
 
-       cbass_main: interconnect@100000 {
+       cbass_main: bus@100000 {
                compatible = "simple-bus";
                #address-cells = <2>;
                #size-cells = <2>;
@@ -88,7 +88,7 @@
                         <0x05 0x00000000 0x05 0x00000000 0x01 0x0000000>,
                         <0x07 0x00000000 0x07 0x00000000 0x01 0x0000000>;
 
-               cbass_mcu: interconnect@28380000 {
+               cbass_mcu: bus@28380000 {
                        compatible = "simple-bus";
                        #address-cells = <2>;
                        #size-cells = <2>;
                                 <0x05 0x00000000 0x05 0x00000000 0x01 0x0000000>, /* FSS OSPI0 data region 3*/
                                 <0x07 0x00000000 0x07 0x00000000 0x01 0x0000000>; /* FSS OSPI1 data region 3*/
 
-                       cbass_wakeup: interconnect@42040000 {
+                       cbass_wakeup: bus@42040000 {
                                compatible = "simple-bus";
                                #address-cells = <1>;
                                #size-cells = <1>;
index b8a8a0f..d12dd89 100644 (file)
@@ -29,7 +29,7 @@
                #address-cells = <2>;
                #size-cells = <2>;
                ranges;
-               secure_ddr: secure_ddr@9e800000 {
+               secure_ddr: secure-ddr@9e800000 {
                        reg = <0 0x9e800000 0 0x01800000>; /* for OP-TEE */
                        alignment = <0x1000>;
                        no-map;
                >;
        };
 
-       push_button_pins_default: push_button__pins_default {
+       push_button_pins_default: push-button-pins-default {
                pinctrl-single,pins = <
                        AM65X_WKUP_IOPAD(0x0030, PIN_INPUT, 7) /* (R5) WKUP_GPIO0_24 */
                        AM65X_WKUP_IOPAD(0x003c, PIN_INPUT, 7) /* (P2) WKUP_GPIO0_27 */
                >;
        };
 
-       mcu_fss0_ospi0_pins_default: mcu-fss0-ospi0-pins_default {
+       mcu_fss0_ospi0_pins_default: mcu-fss0-ospi0-pins-default {
                pinctrl-single,pins = <
                        AM65X_WKUP_IOPAD(0x0000, PIN_OUTPUT, 0) /* (V1) MCU_OSPI0_CLK */
                        AM65X_WKUP_IOPAD(0x0008, PIN_INPUT, 0)   /* (U2) MCU_OSPI0_DQS */
                >;
        };
 
-       wkup_pca554_default: wkup_pca554_default {
+       wkup_pca554_default: wkup-pca554-default {
                pinctrl-single,pins = <
                        AM65X_WKUP_IOPAD(0x0034, PIN_INPUT, 7) /* (T1) MCU_OSPI1_CLK.WKUP_GPIO0_25 */
                >;
        };
 
-       mcu_cpsw_pins_default: mcu_cpsw_pins_default {
+       mcu_cpsw_pins_default: mcu-cpsw-pins-default {
                pinctrl-single,pins = <
                        AM65X_WKUP_IOPAD(0x0058, PIN_OUTPUT, 0) /* (N4) MCU_RGMII1_TX_CTL */
                        AM65X_WKUP_IOPAD(0x005c, PIN_INPUT, 0) /* (N5) MCU_RGMII1_RX_CTL */
                >;
        };
 
-       mcu_mdio_pins_default: mcu_mdio1_pins_default {
+       mcu_mdio_pins_default: mcu-mdio1-pins-default {
                pinctrl-single,pins = <
                        AM65X_WKUP_IOPAD(0x008c, PIN_OUTPUT, 0) /* (L1) MCU_MDIO0_MDC */
                        AM65X_WKUP_IOPAD(0x0088, PIN_INPUT, 0) /* (L4) MCU_MDIO0_MDIO */
                >;
        };
 
-       main_mmc1_pins_default: main_mmc1_pins_default {
+       main_mmc1_pins_default: main-mmc1-pins-default {
                pinctrl-single,pins = <
                        AM65X_IOPAD(0x02d4, PIN_INPUT_PULLDOWN, 0) /* (C27) MMC1_CLK */
                        AM65X_IOPAD(0x02d8, PIN_INPUT_PULLUP, 0) /* (C28) MMC1_CMD */
                >;
        };
 
-       usb1_pins_default: usb1_pins_default {
+       usb1_pins_default: usb1-pins-default {
                pinctrl-single,pins = <
                        AM65X_IOPAD(0x02c0, PIN_OUTPUT, 0) /* (AC8) USB1_DRVVBUS */
                >;
        pinctrl-0 = <&main_i2c1_pins_default>;
        clock-frequency = <400000>;
 
-       ov5640@3c {
+       ov5640: camera@3c {
                compatible = "ovti,ov5640";
                reg = <0x3c>;
 
index cdc3d40..9021c73 100644 (file)
@@ -2,13 +2,13 @@
 
 #include <dt-bindings/thermal/thermal.h>
 
-mpu0_thermal: mpu0_thermal {
+mpu0_thermal: mpu0-thermal {
        polling-delay-passive = <250>; /* milliseconds */
        polling-delay = <500>; /* milliseconds */
        thermal-sensors = <&wkup_vtm0 0>;
 
        trips {
-               mpu0_crit: mpu0_crit {
+               mpu0_crit: mpu0-crit {
                        temperature = <125000>; /* milliCelsius */
                        hysteresis = <2000>; /* milliCelsius */
                        type = "critical";
@@ -16,13 +16,13 @@ mpu0_thermal: mpu0_thermal {
        };
 };
 
-mpu1_thermal: mpu1_thermal {
+mpu1_thermal: mpu1-thermal {
        polling-delay-passive = <250>; /* milliseconds */
        polling-delay = <500>; /* milliseconds */
        thermal-sensors = <&wkup_vtm0 1>;
 
        trips {
-               mpu1_crit: mpu1_crit {
+               mpu1_crit: mpu1-crit {
                        temperature = <125000>; /* milliCelsius */
                        hysteresis = <2000>; /* milliCelsius */
                        type = "critical";
@@ -30,13 +30,13 @@ mpu1_thermal: mpu1_thermal {
        };
 };
 
-mcu_thermal: mcu_thermal {
+mcu_thermal: mcu-thermal {
        polling-delay-passive = <250>; /* milliseconds */
        polling-delay = <500>; /* milliseconds */
        thermal-sensors = <&wkup_vtm0 2>;
 
        trips {
-               mcu_crit: mcu_crit {
+               mcu_crit: mcu-crit {
                        temperature = <125000>; /* milliCelsius */
                        hysteresis = <2000>; /* milliCelsius */
                        type = "critical";
diff --git a/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts b/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts
new file mode 100644 (file)
index 0000000..ef03e76
--- /dev/null
@@ -0,0 +1,215 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+/dts-v1/;
+
+#include "k3-j7200-som-p0.dtsi"
+#include <dt-bindings/net/ti-dp83867.h>
+#include <dt-bindings/mux/ti-serdes.h>
+
+/ {
+       chosen {
+               stdout-path = "serial2:115200n8";
+               bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000";
+       };
+};
+
+&wkup_pmx0 {
+       mcu_cpsw_pins_default: mcu-cpsw-pins-default {
+               pinctrl-single,pins = <
+                       J721E_WKUP_IOPAD(0x0068, PIN_OUTPUT, 0) /* MCU_RGMII1_TX_CTL */
+                       J721E_WKUP_IOPAD(0x006c, PIN_INPUT, 0) /* MCU_RGMII1_RX_CTL */
+                       J721E_WKUP_IOPAD(0x0070, PIN_OUTPUT, 0) /* MCU_RGMII1_TD3 */
+                       J721E_WKUP_IOPAD(0x0074, PIN_OUTPUT, 0) /* MCU_RGMII1_TD2 */
+                       J721E_WKUP_IOPAD(0x0078, PIN_OUTPUT, 0) /* MCU_RGMII1_TD1 */
+                       J721E_WKUP_IOPAD(0x007c, PIN_OUTPUT, 0) /* MCU_RGMII1_TD0 */
+                       J721E_WKUP_IOPAD(0x0088, PIN_INPUT, 0) /* MCU_RGMII1_RD3 */
+                       J721E_WKUP_IOPAD(0x008c, PIN_INPUT, 0) /* MCU_RGMII1_RD2 */
+                       J721E_WKUP_IOPAD(0x0090, PIN_INPUT, 0) /* MCU_RGMII1_RD1 */
+                       J721E_WKUP_IOPAD(0x0094, PIN_INPUT, 0) /* MCU_RGMII1_RD0 */
+                       J721E_WKUP_IOPAD(0x0080, PIN_INPUT, 0) /* MCU_RGMII1_TXC */
+                       J721E_WKUP_IOPAD(0x0084, PIN_INPUT, 0) /* MCU_RGMII1_RXC */
+               >;
+       };
+
+       mcu_mdio_pins_default: mcu-mdio1-pins-default {
+               pinctrl-single,pins = <
+                       J721E_WKUP_IOPAD(0x009c, PIN_OUTPUT, 0) /* (L1) MCU_MDIO0_MDC */
+                       J721E_WKUP_IOPAD(0x0098, PIN_INPUT, 0) /* (L4) MCU_MDIO0_MDIO */
+               >;
+       };
+};
+
+&main_pmx0 {
+       main_i2c0_pins_default: main-i2c0-pins-default {
+               pinctrl-single,pins = <
+                       J721E_IOPAD(0xd4, PIN_INPUT_PULLUP, 0) /* (V3) I2C0_SCL */
+                       J721E_IOPAD(0xd8, PIN_INPUT_PULLUP, 0) /* (W2) I2C0_SDA */
+               >;
+       };
+
+       main_i2c1_pins_default: main-i2c1-pins-default {
+               pinctrl-single,pins = <
+                       J721E_IOPAD(0xdc, PIN_INPUT_PULLUP, 3) /* (U3) ECAP0_IN_APWM_OUT.I2C1_SCL */
+                       J721E_IOPAD(0xe0, PIN_INPUT_PULLUP, 3) /* (T3) EXT_REFCLK1.I2C1_SDA */
+               >;
+       };
+
+       main_mmc1_pins_default: main-mmc1-pins-default {
+               pinctrl-single,pins = <
+                       J721E_IOPAD(0x104, PIN_INPUT, 0) /* (M20) MMC1_CMD */
+                       J721E_IOPAD(0x100, PIN_INPUT, 0) /* (P21) MMC1_CLK */
+                       J721E_IOPAD(0xfc, PIN_INPUT, 0) /* (P25) MMC1_CLKLB */
+                       J721E_IOPAD(0xf8, PIN_INPUT, 0) /* (M19) MMC1_DAT0 */
+                       J721E_IOPAD(0xf4, PIN_INPUT, 0) /* (N21) MMC1_DAT1 */
+                       J721E_IOPAD(0xf0, PIN_INPUT, 0) /* (N20) MMC1_DAT2 */
+                       J721E_IOPAD(0xec, PIN_INPUT, 0) /* (N19) MMC1_DAT3 */
+                       J721E_IOPAD(0xe4, PIN_INPUT, 8) /* (V1) TIMER_IO0.MMC1_SDCD */
+               >;
+       };
+
+       main_usbss0_pins_default: main-usbss0-pins-default {
+               pinctrl-single,pins = <
+                       J721E_IOPAD(0x120, PIN_OUTPUT, 0) /* (T4) USB0_DRVVBUS */
+               >;
+       };
+};
+
+&wkup_uart0 {
+       /* Wakeup UART is used by System firmware */
+       status = "disabled";
+};
+
+&main_uart0 {
+       /* Shared with ATF on this platform */
+       power-domains = <&k3_pds 146 TI_SCI_PD_SHARED>;
+};
+
+&main_uart2 {
+       /* MAIN UART 2 is used by R5F firmware */
+       status = "disabled";
+};
+
+&main_uart3 {
+       /* UART not brought out */
+       status = "disabled";
+};
+
+&main_uart4 {
+       /* UART not brought out */
+       status = "disabled";
+};
+
+&main_uart5 {
+       /* UART not brought out */
+       status = "disabled";
+};
+
+&main_uart6 {
+       /* UART not brought out */
+       status = "disabled";
+};
+
+&main_uart7 {
+       /* UART not brought out */
+       status = "disabled";
+};
+
+&main_uart8 {
+       /* UART not brought out */
+       status = "disabled";
+};
+
+&main_uart9 {
+       /* UART not brought out */
+       status = "disabled";
+};
+
+&mcu_cpsw {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>;
+};
+
+&davinci_mdio {
+       phy0: ethernet-phy@0 {
+               reg = <0>;
+               ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
+               ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
+       };
+};
+
+&cpsw_port1 {
+       phy-mode = "rgmii-rxid";
+       phy-handle = <&phy0>;
+};
+
+&main_i2c0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&main_i2c0_pins_default>;
+       clock-frequency = <400000>;
+
+       exp1: gpio@20 {
+               compatible = "ti,tca6416";
+               reg = <0x20>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+
+       exp2: gpio@22 {
+               compatible = "ti,tca6424";
+               reg = <0x22>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+};
+
+&main_i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&main_i2c1_pins_default>;
+       clock-frequency = <400000>;
+
+       exp4: gpio@20 {
+               compatible = "ti,tca6408";
+               reg = <0x20>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+};
+
+&main_sdhci0 {
+       /* eMMC */
+       non-removable;
+       ti,driver-strength-ohm = <50>;
+       disable-wp;
+};
+
+&main_sdhci1 {
+       /* SD card */
+       pinctrl-0 = <&main_mmc1_pins_default>;
+       pinctrl-names = "default";
+       ti,driver-strength-ohm = <50>;
+       disable-wp;
+};
+
+&serdes_ln_ctrl {
+       idle-states = <J7200_SERDES0_LANE0_PCIE1_LANE0>, <J7200_SERDES0_LANE1_PCIE1_LANE1>,
+                     <J7200_SERDES0_LANE2_QSGMII_LANE1>, <J7200_SERDES0_LANE3_IP4_UNUSED>;
+};
+
+&usb_serdes_mux {
+       idle-states = <1>; /* USB0 to SERDES lane 3 */
+};
+
+&usbss0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&main_usbss0_pins_default>;
+       ti,vbus-divider;
+       ti,usb2-only;
+};
+
+&usb0 {
+       dr_mode = "otg";
+       maximum-speed = "high-speed";
+};
diff --git a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi
new file mode 100644 (file)
index 0000000..72d6496
--- /dev/null
@@ -0,0 +1,449 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for J7200 SoC Family Main Domain peripherals
+ *
+ * Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+&cbass_main {
+       msmc_ram: sram@70000000 {
+               compatible = "mmio-sram";
+               reg = <0x00 0x70000000 0x00 0x100000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0x00 0x00 0x70000000 0x100000>;
+
+               atf-sram@0 {
+                       reg = <0x00 0x20000>;
+               };
+       };
+
+       scm_conf: scm-conf@100000 {
+               compatible = "ti,j721e-system-controller", "syscon", "simple-mfd";
+               reg = <0x00 0x00100000 0x00 0x1c000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0x00 0x00 0x00100000 0x1c000>;
+
+               serdes_ln_ctrl: serdes-ln-ctrl@4080 {
+                       compatible = "mmio-mux";
+                       #mux-control-cells = <1>;
+                       mux-reg-masks = <0x4080 0x3>, <0x4084 0x3>, /* SERDES0 lane0/1 select */
+                                       <0x4088 0x3>, <0x408c 0x3>; /* SERDES0 lane2/3 select */
+               };
+
+               usb_serdes_mux: mux-controller@4000 {
+                       compatible = "mmio-mux";
+                       #mux-control-cells = <1>;
+                       mux-reg-masks = <0x4000 0x8000000>; /* USB0 to SERDES0 lane 1/3 mux */
+               };
+       };
+
+       gic500: interrupt-controller@1800000 {
+               compatible = "arm,gic-v3";
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+               #interrupt-cells = <3>;
+               interrupt-controller;
+               reg = <0x00 0x01800000 0x00 0x10000>,   /* GICD */
+                     <0x00 0x01900000 0x00 0x100000>;  /* GICR */
+
+               /* vcpumntirq: virtual CPU interface maintenance interrupt */
+               interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
+
+               gic_its: msi-controller@1820000 {
+                       compatible = "arm,gic-v3-its";
+                       reg = <0x00 0x01820000 0x00 0x10000>;
+                       socionext,synquacer-pre-its = <0x1000000 0x400000>;
+                       msi-controller;
+                       #msi-cells = <1>;
+               };
+       };
+
+       main_gpio_intr: interrupt-controller0 {
+               compatible = "ti,sci-intr";
+               ti,intr-trigger-type = <1>;
+               interrupt-controller;
+               interrupt-parent = <&gic500>;
+               #interrupt-cells = <1>;
+               ti,sci = <&dmsc>;
+               ti,sci-dev-id = <131>;
+               ti,interrupt-ranges = <8 392 56>;
+       };
+
+       main_navss: bus@30000000 {
+               compatible = "simple-mfd";
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges = <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>;
+               ti,sci-dev-id = <199>;
+
+               main_navss_intr: interrupt-controller1 {
+                       compatible = "ti,sci-intr";
+                       ti,intr-trigger-type = <4>;
+                       interrupt-controller;
+                       interrupt-parent = <&gic500>;
+                       #interrupt-cells = <1>;
+                       ti,sci = <&dmsc>;
+                       ti,sci-dev-id = <213>;
+                       ti,interrupt-ranges = <0 64 64>,
+                                             <64 448 64>,
+                                             <128 672 64>;
+               };
+
+               main_udmass_inta: msi-controller@33d00000 {
+                       compatible = "ti,sci-inta";
+                       reg = <0x00 0x33d00000 0x00 0x100000>;
+                       interrupt-controller;
+                       #interrupt-cells = <0>;
+                       interrupt-parent = <&main_navss_intr>;
+                       msi-controller;
+                       ti,sci = <&dmsc>;
+                       ti,sci-dev-id = <209>;
+                       ti,interrupt-ranges = <0 0 256>;
+               };
+
+               secure_proxy_main: mailbox@32c00000 {
+                       compatible = "ti,am654-secure-proxy";
+                       #mbox-cells = <1>;
+                       reg-names = "target_data", "rt", "scfg";
+                       reg = <0x00 0x32c00000 0x00 0x100000>,
+                             <0x00 0x32400000 0x00 0x100000>,
+                             <0x00 0x32800000 0x00 0x100000>;
+                       interrupt-names = "rx_011";
+                       interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
+               };
+
+               main_ringacc: ringacc@3c000000 {
+                       compatible = "ti,am654-navss-ringacc";
+                       reg =   <0x00 0x3c000000 0x00 0x400000>,
+                               <0x00 0x38000000 0x00 0x400000>,
+                               <0x00 0x31120000 0x00 0x100>,
+                               <0x00 0x33000000 0x00 0x40000>;
+                       reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target";
+                       ti,num-rings = <1024>;
+                       ti,sci-rm-range-gp-rings = <0x1>; /* GP ring range */
+                       ti,sci = <&dmsc>;
+                       ti,sci-dev-id = <211>;
+                       msi-parent = <&main_udmass_inta>;
+               };
+
+               main_udmap: dma-controller@31150000 {
+                       compatible = "ti,j721e-navss-main-udmap";
+                       reg =   <0x00 0x31150000 0x00 0x100>,
+                               <0x00 0x34000000 0x00 0x100000>,
+                               <0x00 0x35000000 0x00 0x100000>;
+                       reg-names = "gcfg", "rchanrt", "tchanrt";
+                       msi-parent = <&main_udmass_inta>;
+                       #dma-cells = <1>;
+
+                       ti,sci = <&dmsc>;
+                       ti,sci-dev-id = <212>;
+                       ti,ringacc = <&main_ringacc>;
+
+                       ti,sci-rm-range-tchan = <0x0d>, /* TX_CHAN */
+                                               <0x0f>, /* TX_HCHAN */
+                                               <0x10>; /* TX_UHCHAN */
+                       ti,sci-rm-range-rchan = <0x0a>, /* RX_CHAN */
+                                               <0x0b>, /* RX_HCHAN */
+                                               <0x0c>; /* RX_UHCHAN */
+                       ti,sci-rm-range-rflow = <0x00>; /* GP RFLOW */
+               };
+
+               cpts@310d0000 {
+                       compatible = "ti,j721e-cpts";
+                       reg = <0x00 0x310d0000 0x00 0x400>;
+                       reg-names = "cpts";
+                       clocks = <&k3_clks 201 1>;
+                       clock-names = "cpts";
+                       interrupts-extended = <&main_navss_intr 391>;
+                       interrupt-names = "cpts";
+                       ti,cpts-periodic-outputs = <6>;
+                       ti,cpts-ext-ts-inputs = <8>;
+               };
+       };
+
+       main_pmx0: pinctrl@11c000 {
+               compatible = "pinctrl-single";
+               /* Proxy 0 addressing */
+               reg = <0x00 0x11c000 0x00 0x2b4>;
+               #pinctrl-cells = <1>;
+               pinctrl-single,register-width = <32>;
+               pinctrl-single,function-mask = <0xffffffff>;
+       };
+
+       main_uart0: serial@2800000 {
+               compatible = "ti,j721e-uart", "ti,am654-uart";
+               reg = <0x00 0x02800000 0x00 0x100>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>;
+               clock-frequency = <48000000>;
+               current-speed = <115200>;
+               power-domains = <&k3_pds 146 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 146 2>;
+               clock-names = "fclk";
+       };
+
+       main_uart1: serial@2810000 {
+               compatible = "ti,j721e-uart", "ti,am654-uart";
+               reg = <0x00 0x02810000 0x00 0x100>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>;
+               clock-frequency = <48000000>;
+               current-speed = <115200>;
+               power-domains = <&k3_pds 278 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 278 2>;
+               clock-names = "fclk";
+       };
+
+       main_uart2: serial@2820000 {
+               compatible = "ti,j721e-uart", "ti,am654-uart";
+               reg = <0x00 0x02820000 0x00 0x100>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 194 IRQ_TYPE_LEVEL_HIGH>;
+               clock-frequency = <48000000>;
+               current-speed = <115200>;
+               power-domains = <&k3_pds 279 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 279 2>;
+               clock-names = "fclk";
+       };
+
+       main_uart3: serial@2830000 {
+               compatible = "ti,j721e-uart", "ti,am654-uart";
+               reg = <0x00 0x02830000 0x00 0x100>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 195 IRQ_TYPE_LEVEL_HIGH>;
+               clock-frequency = <48000000>;
+               current-speed = <115200>;
+               power-domains = <&k3_pds 280 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 280 2>;
+               clock-names = "fclk";
+       };
+
+       main_uart4: serial@2840000 {
+               compatible = "ti,j721e-uart", "ti,am654-uart";
+               reg = <0x00 0x02840000 0x00 0x100>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>;
+               clock-frequency = <48000000>;
+               current-speed = <115200>;
+               power-domains = <&k3_pds 281 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 281 2>;
+               clock-names = "fclk";
+       };
+
+       main_uart5: serial@2850000 {
+               compatible = "ti,j721e-uart", "ti,am654-uart";
+               reg = <0x00 0x02850000 0x00 0x100>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 197 IRQ_TYPE_LEVEL_HIGH>;
+               clock-frequency = <48000000>;
+               current-speed = <115200>;
+               power-domains = <&k3_pds 282 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 282 2>;
+               clock-names = "fclk";
+       };
+
+       main_uart6: serial@2860000 {
+               compatible = "ti,j721e-uart", "ti,am654-uart";
+               reg = <0x00 0x02860000 0x00 0x100>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>;
+               clock-frequency = <48000000>;
+               current-speed = <115200>;
+               power-domains = <&k3_pds 283 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 283 2>;
+               clock-names = "fclk";
+       };
+
+       main_uart7: serial@2870000 {
+               compatible = "ti,j721e-uart", "ti,am654-uart";
+               reg = <0x00 0x02870000 0x00 0x100>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 199 IRQ_TYPE_LEVEL_HIGH>;
+               clock-frequency = <48000000>;
+               current-speed = <115200>;
+               power-domains = <&k3_pds 284 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 284 2>;
+               clock-names = "fclk";
+       };
+
+       main_uart8: serial@2880000 {
+               compatible = "ti,j721e-uart", "ti,am654-uart";
+               reg = <0x00 0x02880000 0x00 0x100>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 248 IRQ_TYPE_LEVEL_HIGH>;
+               clock-frequency = <48000000>;
+               current-speed = <115200>;
+               power-domains = <&k3_pds 285 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 285 2>;
+               clock-names = "fclk";
+       };
+
+       main_uart9: serial@2890000 {
+               compatible = "ti,j721e-uart", "ti,am654-uart";
+               reg = <0x00 0x02890000 0x00 0x100>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 249 IRQ_TYPE_LEVEL_HIGH>;
+               clock-frequency = <48000000>;
+               current-speed = <115200>;
+               power-domains = <&k3_pds 286 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 286 2>;
+               clock-names = "fclk";
+       };
+
+       main_i2c0: i2c@2000000 {
+               compatible = "ti,j721e-i2c", "ti,omap4-i2c";
+               reg = <0x00 0x2000000 0x00 0x100>;
+               interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clock-names = "fck";
+               clocks = <&k3_clks 187 1>;
+               power-domains = <&k3_pds 187 TI_SCI_PD_SHARED>;
+       };
+
+       main_i2c1: i2c@2010000 {
+               compatible = "ti,j721e-i2c", "ti,omap4-i2c";
+               reg = <0x00 0x2010000 0x00 0x100>;
+               interrupts = <GIC_SPI 201 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clock-names = "fck";
+               clocks = <&k3_clks 188 1>;
+               power-domains = <&k3_pds 188 TI_SCI_PD_EXCLUSIVE>;
+       };
+
+       main_i2c2: i2c@2020000 {
+               compatible = "ti,j721e-i2c", "ti,omap4-i2c";
+               reg = <0x00 0x2020000 0x00 0x100>;
+               interrupts = <GIC_SPI 202 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clock-names = "fck";
+               clocks = <&k3_clks 189 1>;
+               power-domains = <&k3_pds 189 TI_SCI_PD_EXCLUSIVE>;
+       };
+
+       main_i2c3: i2c@2030000 {
+               compatible = "ti,j721e-i2c", "ti,omap4-i2c";
+               reg = <0x00 0x2030000 0x00 0x100>;
+               interrupts = <GIC_SPI 203 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clock-names = "fck";
+               clocks = <&k3_clks 190 1>;
+               power-domains = <&k3_pds 190 TI_SCI_PD_EXCLUSIVE>;
+       };
+
+       main_i2c4: i2c@2040000 {
+               compatible = "ti,j721e-i2c", "ti,omap4-i2c";
+               reg = <0x00 0x2040000 0x00 0x100>;
+               interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clock-names = "fck";
+               clocks = <&k3_clks 191 1>;
+               power-domains = <&k3_pds 191 TI_SCI_PD_EXCLUSIVE>;
+       };
+
+       main_i2c5: i2c@2050000 {
+               compatible = "ti,j721e-i2c", "ti,omap4-i2c";
+               reg = <0x00 0x2050000 0x00 0x100>;
+               interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clock-names = "fck";
+               clocks = <&k3_clks 192 1>;
+               power-domains = <&k3_pds 192 TI_SCI_PD_EXCLUSIVE>;
+       };
+
+       main_i2c6: i2c@2060000 {
+               compatible = "ti,j721e-i2c", "ti,omap4-i2c";
+               reg = <0x00 0x2060000 0x00 0x100>;
+               interrupts = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clock-names = "fck";
+               clocks = <&k3_clks 193 1>;
+               power-domains = <&k3_pds 193 TI_SCI_PD_EXCLUSIVE>;
+       };
+
+       main_sdhci0: mmc@4f80000 {
+               compatible = "ti,j7200-sdhci-8bit", "ti,j721e-sdhci-8bit";
+               reg = <0x00 0x04f80000 0x00 0x260>, <0x00 0x4f88000 0x00 0x134>;
+               interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+               power-domains = <&k3_pds 91 TI_SCI_PD_EXCLUSIVE>;
+               clock-names = "clk_xin", "clk_ahb";
+               clocks = <&k3_clks 91 3>, <&k3_clks 91 0>;
+               ti,otap-del-sel-legacy = <0x0>;
+               ti,otap-del-sel-mmc-hs = <0x0>;
+               ti,otap-del-sel-ddr52 = <0x6>;
+               ti,otap-del-sel-hs200 = <0x8>;
+               ti,otap-del-sel-hs400 = <0x0>;
+               ti,strobe-sel = <0x77>;
+               ti,trm-icp = <0x8>;
+               bus-width = <8>;
+               mmc-ddr-1_8v;
+               dma-coherent;
+       };
+
+       main_sdhci1: mmc@4fb0000 {
+               compatible = "ti,j7200-sdhci-4bit", "ti,j721e-sdhci-4bit";
+               reg = <0x00 0x04fb0000 0x00 0x260>, <0x00 0x4fb8000 0x00 0x134>;
+               interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+               power-domains = <&k3_pds 92 TI_SCI_PD_EXCLUSIVE>;
+               clock-names = "clk_xin", "clk_ahb";
+               clocks = <&k3_clks 92 2>, <&k3_clks 92 1>;
+               ti,otap-del-sel-legacy = <0x0>;
+               ti,otap-del-sel-sd-hs = <0x0>;
+               ti,otap-del-sel-sdr12 = <0xf>;
+               ti,otap-del-sel-sdr25 = <0xf>;
+               ti,otap-del-sel-sdr50 = <0xc>;
+               ti,otap-del-sel-sdr104 = <0x5>;
+               ti,otap-del-sel-ddr50 = <0xc>;
+               no-1-8-v;
+               dma-coherent;
+       };
+
+       usbss0: cdns-usb@4104000 {
+               compatible = "ti,j721e-usb";
+               reg = <0x00 0x4104000 0x00 0x100>;
+               dma-coherent;
+               power-domains = <&k3_pds 288 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 288 12>, <&k3_clks 288 3>;
+               clock-names = "ref", "lpm";
+               assigned-clocks = <&k3_clks 288 12>;    /* USB2_REFCLK */
+               assigned-clock-parents = <&k3_clks 288 13>; /* HFOSC0 */
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               usb0: usb@6000000 {
+                       compatible = "cdns,usb3";
+                       reg = <0x00 0x6000000 0x00 0x10000>,
+                             <0x00 0x6010000 0x00 0x10000>,
+                             <0x00 0x6020000 0x00 0x10000>;
+                       reg-names = "otg", "xhci", "dev";
+                       interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>,  /* irq.0 */
+                                    <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>, /* irq.6 */
+                                    <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>; /* otgirq.0 */
+                       interrupt-names = "host",
+                                         "peripheral",
+                                         "otg";
+                       maximum-speed = "super-speed";
+                       dr_mode = "otg";
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi
new file mode 100644 (file)
index 0000000..eb2a78a
--- /dev/null
@@ -0,0 +1,273 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for J7200 SoC Family MCU/WAKEUP Domain peripherals
+ *
+ * Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+&cbass_mcu_wakeup {
+       dmsc: dmsc@44083000 {
+               compatible = "ti,k2g-sci";
+               ti,host-id = <12>;
+
+               mbox-names = "rx", "tx";
+
+               mboxes= <&secure_proxy_main 11>,
+                       <&secure_proxy_main 13>;
+
+               reg-names = "debug_messages";
+               reg = <0x00 0x44083000 0x00 0x1000>;
+
+               k3_pds: power-controller {
+                       compatible = "ti,sci-pm-domain";
+                       #power-domain-cells = <2>;
+               };
+
+               k3_clks: clocks {
+                       compatible = "ti,k2g-sci-clk";
+                       #clock-cells = <2>;
+               };
+
+               k3_reset: reset-controller {
+                       compatible = "ti,sci-reset";
+                       #reset-cells = <2>;
+               };
+       };
+
+       mcu_conf: syscon@40f00000 {
+               compatible = "syscon", "simple-mfd";
+               reg = <0x00 0x40f00000 0x00 0x20000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0x00 0x00 0x40f00000 0x20000>;
+
+               phy_gmii_sel: phy@4040 {
+                       compatible = "ti,am654-phy-gmii-sel";
+                       reg = <0x4040 0x4>;
+                       #phy-cells = <1>;
+               };
+       };
+
+       chipid@43000014 {
+               compatible = "ti,am654-chipid";
+               reg = <0x00 0x43000014 0x00 0x4>;
+       };
+
+       wkup_pmx0: pinctrl@4301c000 {
+               compatible = "pinctrl-single";
+               /* Proxy 0 addressing */
+               reg = <0x00 0x4301c000 0x00 0x178>;
+               #pinctrl-cells = <1>;
+               pinctrl-single,register-width = <32>;
+               pinctrl-single,function-mask = <0xffffffff>;
+       };
+
+       mcu_ram: sram@41c00000 {
+               compatible = "mmio-sram";
+               reg = <0x00 0x41c00000 0x00 0x100000>;
+               ranges = <0x00 0x00 0x41c00000 0x100000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+       };
+
+       wkup_uart0: serial@42300000 {
+               compatible = "ti,j721e-uart", "ti,am654-uart";
+               reg = <0x00 0x42300000 0x00 0x100>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 897 IRQ_TYPE_LEVEL_HIGH>;
+               clock-frequency = <48000000>;
+               current-speed = <115200>;
+               power-domains = <&k3_pds 287 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 287 2>;
+               clock-names = "fclk";
+       };
+
+       mcu_uart0: serial@40a00000 {
+               compatible = "ti,j721e-uart", "ti,am654-uart";
+               reg = <0x00 0x40a00000 0x00 0x100>;
+               reg-shift = <2>;
+               reg-io-width = <4>;
+               interrupts = <GIC_SPI 846 IRQ_TYPE_LEVEL_HIGH>;
+               clock-frequency = <96000000>;
+               current-speed = <115200>;
+               power-domains = <&k3_pds 149 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 149 2>;
+               clock-names = "fclk";
+       };
+
+       wkup_gpio_intr: interrupt-controller2 {
+               compatible = "ti,sci-intr";
+               ti,intr-trigger-type = <1>;
+               interrupt-controller;
+               interrupt-parent = <&gic500>;
+               #interrupt-cells = <1>;
+               ti,sci = <&dmsc>;
+               ti,sci-dev-id = <137>;
+               ti,interrupt-ranges = <16 960 16>;
+       };
+
+       mcu_navss: bus@28380000 {
+               compatible = "simple-mfd";
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges = <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>;
+               dma-coherent;
+               dma-ranges;
+               ti,sci-dev-id = <232>;
+
+               mcu_ringacc: ringacc@2b800000 {
+                       compatible = "ti,am654-navss-ringacc";
+                       reg =   <0x00 0x2b800000 0x00 0x400000>,
+                               <0x00 0x2b000000 0x00 0x400000>,
+                               <0x00 0x28590000 0x00 0x100>,
+                               <0x00 0x2a500000 0x00 0x40000>;
+                       reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target";
+                       ti,num-rings = <286>;
+                       ti,sci-rm-range-gp-rings = <0x1>; /* GP ring range */
+                       ti,sci = <&dmsc>;
+                       ti,sci-dev-id = <235>;
+                       msi-parent = <&main_udmass_inta>;
+               };
+
+               mcu_udmap: dma-controller@285c0000 {
+                       compatible = "ti,j721e-navss-mcu-udmap";
+                       reg =   <0x00 0x285c0000 0x00 0x100>,
+                               <0x00 0x2a800000 0x00 0x40000>,
+                               <0x00 0x2aa00000 0x00 0x40000>;
+                       reg-names = "gcfg", "rchanrt", "tchanrt";
+                       msi-parent = <&main_udmass_inta>;
+                       #dma-cells = <1>;
+
+                       ti,sci = <&dmsc>;
+                       ti,sci-dev-id = <236>;
+                       ti,ringacc = <&mcu_ringacc>;
+
+                       ti,sci-rm-range-tchan = <0x0d>, /* TX_CHAN */
+                                               <0x0f>; /* TX_HCHAN */
+                       ti,sci-rm-range-rchan = <0x0a>, /* RX_CHAN */
+                                               <0x0b>; /* RX_HCHAN */
+                       ti,sci-rm-range-rflow = <0x00>; /* GP RFLOW */
+               };
+       };
+
+       mcu_cpsw: ethernet@46000000 {
+               compatible = "ti,j721e-cpsw-nuss";
+               #address-cells = <2>;
+               #size-cells = <2>;
+               reg = <0x00 0x46000000 0x00 0x200000>;
+               reg-names = "cpsw_nuss";
+               ranges = <0x00 0x00 0x00 0x46000000 0x00 0x200000>;
+               dma-coherent;
+               clocks = <&k3_clks 18 21>;
+               clock-names = "fck";
+               power-domains = <&k3_pds 18 TI_SCI_PD_EXCLUSIVE>;
+
+               dmas = <&mcu_udmap 0xf000>,
+                      <&mcu_udmap 0xf001>,
+                      <&mcu_udmap 0xf002>,
+                      <&mcu_udmap 0xf003>,
+                      <&mcu_udmap 0xf004>,
+                      <&mcu_udmap 0xf005>,
+                      <&mcu_udmap 0xf006>,
+                      <&mcu_udmap 0xf007>,
+                      <&mcu_udmap 0x7000>;
+               dma-names = "tx0", "tx1", "tx2", "tx3",
+                           "tx4", "tx5", "tx6", "tx7",
+                           "rx";
+
+               ethernet-ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       cpsw_port1: port@1 {
+                               reg = <1>;
+                               ti,mac-only;
+                               label = "port1";
+                               ti,syscon-efuse = <&mcu_conf 0x200>;
+                               phys = <&phy_gmii_sel 1>;
+                       };
+               };
+
+               davinci_mdio: mdio@f00 {
+                       compatible = "ti,cpsw-mdio","ti,davinci_mdio";
+                       reg = <0x00 0xf00 0x00 0x100>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       clocks = <&k3_clks 18 21>;
+                       clock-names = "fck";
+                       bus_freq = <1000000>;
+               };
+
+               cpts@3d000 {
+                       compatible = "ti,am65-cpts";
+                       reg = <0x00 0x3d000 0x00 0x400>;
+                       clocks = <&k3_clks 18 2>;
+                       clock-names = "cpts";
+                       interrupts-extended = <&gic500 GIC_SPI 858 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "cpts";
+                       ti,cpts-ext-ts-inputs = <4>;
+                       ti,cpts-periodic-outputs = <2>;
+               };
+       };
+
+       mcu_i2c0: i2c@40b00000 {
+               compatible = "ti,j721e-i2c", "ti,omap4-i2c";
+               reg = <0x00 0x40b00000 0x00 0x100>;
+               interrupts = <GIC_SPI 852 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clock-names = "fck";
+               clocks = <&k3_clks 194 1>;
+               power-domains = <&k3_pds 194 TI_SCI_PD_EXCLUSIVE>;
+       };
+
+       mcu_i2c1: i2c@40b10000 {
+               compatible = "ti,j721e-i2c", "ti,omap4-i2c";
+               reg = <0x00 0x40b10000 0x00 0x100>;
+               interrupts = <GIC_SPI 853 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clock-names = "fck";
+               clocks = <&k3_clks 195 1>;
+               power-domains = <&k3_pds 195 TI_SCI_PD_EXCLUSIVE>;
+       };
+
+       wkup_i2c0: i2c@42120000 {
+               compatible = "ti,j721e-i2c", "ti,omap4-i2c";
+               reg = <0x00 0x42120000 0x00 0x100>;
+               interrupts = <GIC_SPI 896 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clock-names = "fck";
+               clocks = <&k3_clks 197 1>;
+               power-domains = <&k3_pds 197 TI_SCI_PD_SHARED>;
+       };
+
+       fss: syscon@47000000 {
+               compatible = "syscon", "simple-mfd";
+               reg = <0x00 0x47000000 0x00 0x100>;
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               hbmc_mux: hbmc-mux {
+                       compatible = "mmio-mux";
+                       #mux-control-cells = <1>;
+                       mux-reg-masks = <0x4 0x2>; /* HBMC select */
+               };
+
+               hbmc: hyperbus@47034000 {
+                       compatible = "ti,am654-hbmc";
+                       reg = <0x00 0x47034000 0x00 0x100>,
+                               <0x05 0x00000000 0x01 0x0000000>;
+                       power-domains = <&k3_pds 102 TI_SCI_PD_EXCLUSIVE>;
+                       clocks = <&k3_clks 102 0>;
+                       assigned-clocks = <&k3_clks 102 5>;
+                       assigned-clock-rates = <333333333>;
+                       #address-cells = <2>;
+                       #size-cells = <1>;
+                       mux-controls = <&hbmc_mux 0>;
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/ti/k3-j7200-som-p0.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-som-p0.dtsi
new file mode 100644 (file)
index 0000000..6a98ba4
--- /dev/null
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+/dts-v1/;
+
+#include "k3-j7200.dtsi"
+
+/ {
+       memory@80000000 {
+               device_type = "memory";
+               /* 4G RAM */
+               reg = <0x00 0x80000000 0x00 0x80000000>,
+                     <0x08 0x80000000 0x00 0x80000000>;
+       };
+
+       reserved_memory: reserved-memory {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               secure_ddr: optee@9e800000 {
+                       reg = <0x00 0x9e800000 0x00 0x01800000>;
+                       alignment = <0x1000>;
+                       no-map;
+               };
+       };
+};
+
+&wkup_pmx0 {
+       mcu_fss0_hpb0_pins_default: mcu-fss0-hpb0-pins-default {
+               pinctrl-single,pins = <
+                       J721E_WKUP_IOPAD(0x0, PIN_OUTPUT, 1) /* (B6) MCU_OSPI0_CLK.MCU_HYPERBUS0_CK */
+                       J721E_WKUP_IOPAD(0x4, PIN_OUTPUT, 1) /* (C8) MCU_OSPI0_LBCLKO.MCU_HYPERBUS0_CKn */
+                       J721E_WKUP_IOPAD(0x2c, PIN_OUTPUT, 1) /* (D6) MCU_OSPI0_CSn0.MCU_HYPERBUS0_CSn0 */
+                       J721E_WKUP_IOPAD(0x30, PIN_OUTPUT, 1) /* (D7) MCU_OSPI0_CSn1.MCU_HYPERBUS0_RESETn */
+                       J721E_WKUP_IOPAD(0x8, PIN_INPUT, 1) /* (B7) MCU_OSPI0_DQS.MCU_HYPERBUS0_RWDS */
+                       J721E_WKUP_IOPAD(0xc, PIN_INPUT, 1) /* (D8) MCU_OSPI0_D0.MCU_HYPERBUS0_DQ0 */
+                       J721E_WKUP_IOPAD(0x10, PIN_INPUT, 1) /* (C7) MCU_OSPI0_D1.MCU_HYPERBUS0_DQ1 */
+                       J721E_WKUP_IOPAD(0x14, PIN_INPUT, 1) /* (C5) MCU_OSPI0_D2.MCU_HYPERBUS0_DQ2 */
+                       J721E_WKUP_IOPAD(0x18, PIN_INPUT, 1) /* (A5) MCU_OSPI0_D3.MCU_HYPERBUS0_DQ3 */
+                       J721E_WKUP_IOPAD(0x1c, PIN_INPUT, 1) /* (A6) MCU_OSPI0_D4.MCU_HYPERBUS0_DQ4 */
+                       J721E_WKUP_IOPAD(0x20, PIN_INPUT, 1) /* (B8) MCU_OSPI0_D5.MCU_HYPERBUS0_DQ5 */
+                       J721E_WKUP_IOPAD(0x24, PIN_INPUT, 1) /* (A8) MCU_OSPI0_D6.MCU_HYPERBUS0_DQ6 */
+                       J721E_WKUP_IOPAD(0x28, PIN_INPUT, 1) /* (A7) MCU_OSPI0_D7.MCU_HYPERBUS0_DQ7 */
+               >;
+       };
+};
+
+&hbmc {
+       /* OSPI and HBMC are muxed inside FSS, Bootloader will enable
+        * appropriate node based on board detection
+        */
+       status = "disabled";
+       pinctrl-names = "default";
+       pinctrl-0 = <&mcu_fss0_hpb0_pins_default>;
+       ranges = <0x00 0x00 0x05 0x00000000 0x4000000>, /* 64MB Flash on CS0 */
+                <0x01 0x00 0x05 0x04000000 0x800000>; /* 8MB RAM on CS1 */
+
+       flash@0,0 {
+               compatible = "cypress,hyperflash", "cfi-flash";
+               reg = <0x00 0x00 0x4000000>;
+       };
+};
diff --git a/arch/arm64/boot/dts/ti/k3-j7200.dtsi b/arch/arm64/boot/dts/ti/k3-j7200.dtsi
new file mode 100644 (file)
index 0000000..66169bc
--- /dev/null
@@ -0,0 +1,172 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for J7200 SoC Family
+ *
+ * Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/pinctrl/k3.h>
+#include <dt-bindings/soc/ti,sci_pm_domain.h>
+
+/ {
+       model = "Texas Instruments K3 J7200 SoC";
+       compatible = "ti,j7200";
+       interrupt-parent = <&gic500>;
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       aliases {
+               serial0 = &wkup_uart0;
+               serial1 = &mcu_uart0;
+               serial2 = &main_uart0;
+               serial3 = &main_uart1;
+               serial4 = &main_uart2;
+               serial5 = &main_uart3;
+               serial6 = &main_uart4;
+               serial7 = &main_uart5;
+               serial8 = &main_uart6;
+               serial9 = &main_uart7;
+               serial10 = &main_uart8;
+               serial11 = &main_uart9;
+       };
+
+       chosen { };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               cpu-map {
+                       cluster0: cluster0 {
+                               core0 {
+                                       cpu = <&cpu0>;
+                               };
+
+                               core1 {
+                                       cpu = <&cpu1>;
+                               };
+                       };
+
+               };
+
+               cpu0: cpu@0 {
+                       compatible = "arm,cortex-a72";
+                       reg = <0x000>;
+                       device_type = "cpu";
+                       enable-method = "psci";
+                       i-cache-size = <0xc000>;
+                       i-cache-line-size = <64>;
+                       i-cache-sets = <256>;
+                       d-cache-size = <0x8000>;
+                       d-cache-line-size = <64>;
+                       d-cache-sets = <128>;
+                       next-level-cache = <&L2_0>;
+               };
+
+               cpu1: cpu@1 {
+                       compatible = "arm,cortex-a72";
+                       reg = <0x001>;
+                       device_type = "cpu";
+                       enable-method = "psci";
+                       i-cache-size = <0xc000>;
+                       i-cache-line-size = <64>;
+                       i-cache-sets = <256>;
+                       d-cache-size = <0x8000>;
+                       d-cache-line-size = <64>;
+                       d-cache-sets = <128>;
+                       next-level-cache = <&L2_0>;
+               };
+       };
+
+       L2_0: l2-cache0 {
+               compatible = "cache";
+               cache-level = <2>;
+               cache-size = <0x100000>;
+               cache-line-size = <64>;
+               cache-sets = <2048>;
+               next-level-cache = <&msmc_l3>;
+       };
+
+       msmc_l3: l3-cache0 {
+               compatible = "cache";
+               cache-level = <3>;
+       };
+
+       firmware {
+               optee {
+                       compatible = "linaro,optee-tz";
+                       method = "smc";
+               };
+
+               psci: psci {
+                       compatible = "arm,psci-1.0";
+                       method = "smc";
+               };
+       };
+
+       a72_timer0: timer-cl0-cpu0 {
+               compatible = "arm,armv8-timer";
+               interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>, /* cntpsirq */
+                            <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>, /* cntpnsirq */
+                            <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>, /* cntvirq */
+                            <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>; /* cnthpirq */
+       };
+
+       pmu: pmu {
+               compatible = "arm,armv8-pmuv3";
+               interrupts = <GIC_PPI 7 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       cbass_main: bus@100000 {
+               compatible = "simple-bus";
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges = <0x00 0x00100000 0x00 0x00100000 0x00 0x00020000>, /* ctrl mmr */
+                        <0x00 0x00600000 0x00 0x00600000 0x00 0x00031100>, /* GPIO */
+                        <0x00 0x00a40000 0x00 0x00a40000 0x00 0x00000800>, /* timesync router */
+                        <0x00 0x01000000 0x00 0x01000000 0x00 0x0d000000>, /* Most peripherals */
+                        <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>, /* MAIN NAVSS */
+                        <0x00 0x70000000 0x00 0x70000000 0x00 0x00800000>, /* MSMC RAM */
+                        <0x00 0x18000000 0x00 0x18000000 0x00 0x08000000>, /* PCIe1 DAT0 */
+                        <0x41 0x00000000 0x41 0x00000000 0x01 0x00000000>, /* PCIe1 DAT1 */
+
+                        /* MCUSS_WKUP Range */
+                        <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>,
+                        <0x00 0x40200000 0x00 0x40200000 0x00 0x00998400>,
+                        <0x00 0x40f00000 0x00 0x40f00000 0x00 0x00020000>,
+                        <0x00 0x41000000 0x00 0x41000000 0x00 0x00020000>,
+                        <0x00 0x41400000 0x00 0x41400000 0x00 0x00020000>,
+                        <0x00 0x41c00000 0x00 0x41c00000 0x00 0x00100000>,
+                        <0x00 0x42040000 0x00 0x42040000 0x00 0x03ac2400>,
+                        <0x00 0x45100000 0x00 0x45100000 0x00 0x00c24000>,
+                        <0x00 0x46000000 0x00 0x46000000 0x00 0x00200000>,
+                        <0x00 0x47000000 0x00 0x47000000 0x00 0x00068400>,
+                        <0x00 0x50000000 0x00 0x50000000 0x00 0x10000000>,
+                        <0x05 0x00000000 0x05 0x00000000 0x01 0x00000000>,
+                        <0x07 0x00000000 0x07 0x00000000 0x01 0x00000000>;
+
+               cbass_mcu_wakeup: bus@28380000 {
+                       compatible = "simple-bus";
+                       #address-cells = <2>;
+                       #size-cells = <2>;
+                       ranges = <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>, /* MCU NAVSS*/
+                                <0x00 0x40200000 0x00 0x40200000 0x00 0x00998400>, /* First peripheral window */
+                                <0x00 0x40f00000 0x00 0x40f00000 0x00 0x00020000>, /* CTRL_MMR0 */
+                                <0x00 0x41000000 0x00 0x41000000 0x00 0x00020000>, /* MCU R5F Core0 */
+                                <0x00 0x41400000 0x00 0x41400000 0x00 0x00020000>, /* MCU R5F Core1 */
+                                <0x00 0x41c00000 0x00 0x41c00000 0x00 0x00100000>, /* MCU SRAM */
+                                <0x00 0x42040000 0x00 0x42040000 0x00 0x03ac2400>, /* WKUP peripheral window */
+                                <0x00 0x45100000 0x00 0x45100000 0x00 0x00c24000>, /* MMRs, remaining NAVSS */
+                                <0x00 0x46000000 0x00 0x46000000 0x00 0x00200000>, /* CPSW */
+                                <0x00 0x47000000 0x00 0x47000000 0x00 0x00068400>, /* OSPI register space */
+                                <0x00 0x50000000 0x00 0x50000000 0x00 0x10000000>, /* FSS OSPI0/1 data region 0 */
+                                <0x05 0x00000000 0x05 0x00000000 0x01 0x00000000>, /* FSS OSPI0 data region 3 */
+                                <0x07 0x00000000 0x07 0x00000000 0x01 0x00000000>; /* FSS OSPI1 data region 3 */
+               };
+       };
+};
+
+/* Now include the peripherals for each bus segments */
+#include "k3-j7200-main.dtsi"
+#include "k3-j7200-mcu-wakeup.dtsi"
index e8fc01d..52e1211 100644 (file)
 };
 
 &main_pmx0 {
-       sw10_button_pins_default: sw10_button_pins_default {
+       sw10_button_pins_default: sw10-button-pins-default {
                pinctrl-single,pins = <
                        J721E_IOPAD(0x0, PIN_INPUT, 7) /* (AC18) EXTINTn.GPIO0_0 */
                >;
        };
 
-       main_mmc1_pins_default: main_mmc1_pins_default {
+       main_mmc1_pins_default: main-mmc1-pins-default {
                pinctrl-single,pins = <
                        J721E_IOPAD(0x254, PIN_INPUT, 0) /* (R29) MMC1_CMD */
                        J721E_IOPAD(0x250, PIN_INPUT, 0) /* (P25) MMC1_CLK */
                >;
        };
 
-       main_usbss0_pins_default: main_usbss0_pins_default {
+       main_usbss0_pins_default: main-usbss0-pins-default {
                pinctrl-single,pins = <
                        J721E_IOPAD(0x290, PIN_OUTPUT, 0) /* (U6) USB0_DRVVBUS */
                        J721E_IOPAD(0x210, PIN_INPUT, 7) /* (W3) MCAN1_RX.GPIO1_3 */
                >;
        };
 
-       main_usbss1_pins_default: main_usbss1_pins_default {
+       main_usbss1_pins_default: main-usbss1-pins-default {
                pinctrl-single,pins = <
                        J721E_IOPAD(0x214, PIN_OUTPUT, 4) /* (V4) MCAN1_TX.USB1_DRVVBUS */
                >;
                >;
        };
 
-       mcasp10_pins_default: mcasp10_pins_default {
+       mcasp10_pins_default: mcasp10-pins-default {
                pinctrl-single,pins = <
                        J721E_IOPAD(0x158, PIN_OUTPUT_PULLDOWN, 12) /* (U23) RGMII5_TX_CTL.MCASP10_ACLKX */
                        J721E_IOPAD(0x15c, PIN_OUTPUT_PULLDOWN, 12) /* (U26) RGMII5_RX_CTL.MCASP10_AFSX */
                >;
        };
 
-       audi_ext_refclk2_pins_default: audi_ext_refclk2_pins_default {
+       audi_ext_refclk2_pins_default: audi-ext-refclk2-pins-default {
                pinctrl-single,pins = <
                        J721E_IOPAD(0x1a4, PIN_OUTPUT, 3) /* (W26) RGMII6_RXC.AUDIO_EXT_REFCLK2 */
                >;
 };
 
 &wkup_pmx0 {
-       sw11_button_pins_default: sw11_button_pins_default {
+       sw11_button_pins_default: sw11-button-pins-default {
                pinctrl-single,pins = <
                        J721E_WKUP_IOPAD(0xcc, PIN_INPUT, 7) /* (G28) WKUP_GPIO0_7 */
                >;
                >;
        };
 
-       mcu_cpsw_pins_default: mcu_cpsw_pins_default {
+       mcu_cpsw_pins_default: mcu-cpsw-pins-default {
                pinctrl-single,pins = <
                        J721E_WKUP_IOPAD(0x0058, PIN_OUTPUT, 0) /* MCU_RGMII1_TX_CTL */
                        J721E_WKUP_IOPAD(0x005c, PIN_INPUT, 0) /* MCU_RGMII1_RX_CTL */
                >;
        };
 
-       mcu_mdio_pins_default: mcu_mdio1_pins_default {
+       mcu_mdio_pins_default: mcu-mdio1-pins-default {
                pinctrl-single,pins = <
                        J721E_WKUP_IOPAD(0x008c, PIN_OUTPUT, 0) /* MCU_MDIO0_MDC */
                        J721E_WKUP_IOPAD(0x0088, PIN_INPUT, 0) /* MCU_MDIO0_MDIO */
        status = "disabled";
 };
 
-&mailbox0_cluster0 {
-       interrupts = <436>;
-
-       mbox_mcu_r5fss0_core0: mbox-mcu-r5fss0-core0 {
-               ti,mbox-rx = <0 0 0>;
-               ti,mbox-tx = <1 0 0>;
-       };
-
-       mbox_mcu_r5fss0_core1: mbox-mcu-r5fss0-core1 {
-               ti,mbox-rx = <2 0 0>;
-               ti,mbox-tx = <3 0 0>;
-       };
-};
-
-&mailbox0_cluster1 {
-       interrupts = <432>;
-
-       mbox_main_r5fss0_core0: mbox-main-r5fss0-core0 {
-               ti,mbox-rx = <0 0 0>;
-               ti,mbox-tx = <1 0 0>;
-       };
-
-       mbox_main_r5fss0_core1: mbox-main-r5fss0-core1 {
-               ti,mbox-rx = <2 0 0>;
-               ti,mbox-tx = <3 0 0>;
-       };
-};
-
-&mailbox0_cluster2 {
-       interrupts = <428>;
-
-       mbox_main_r5fss1_core0: mbox-main-r5fss1-core0 {
-               ti,mbox-rx = <0 0 0>;
-               ti,mbox-tx = <1 0 0>;
-       };
-
-       mbox_main_r5fss1_core1: mbox-main-r5fss1-core1 {
-               ti,mbox-rx = <2 0 0>;
-               ti,mbox-tx = <3 0 0>;
-       };
-};
-
-&mailbox0_cluster3 {
-       interrupts = <424>;
-
-       mbox_c66_0: mbox-c66-0 {
-               ti,mbox-rx = <0 0 0>;
-               ti,mbox-tx = <1 0 0>;
-       };
-
-       mbox_c66_1: mbox-c66-1 {
-               ti,mbox-rx = <2 0 0>;
-               ti,mbox-tx = <3 0 0>;
-       };
-};
-
-&mailbox0_cluster4 {
-       interrupts = <420>;
-
-       mbox_c71_0: mbox-c71-0 {
-               ti,mbox-rx = <0 0 0>;
-               ti,mbox-tx = <1 0 0>;
-       };
-};
-
-&mailbox0_cluster5 {
-       status = "disabled";
-};
-
-&mailbox0_cluster6 {
-       status = "disabled";
-};
-
-&mailbox0_cluster7 {
-       status = "disabled";
-};
-
-&mailbox0_cluster8 {
-       status = "disabled";
-};
-
-&mailbox0_cluster9 {
-       status = "disabled";
-};
-
-&mailbox0_cluster10 {
-       status = "disabled";
-};
-
-&mailbox0_cluster11 {
-       status = "disabled";
-};
-
 &main_sdhci0 {
        /* eMMC */
        non-removable;
 };
 
 &serdes_ln_ctrl {
-       idle-states = <SERDES0_LANE0_PCIE0_LANE0>, <SERDES0_LANE1_PCIE0_LANE1>,
-                     <SERDES1_LANE0_PCIE1_LANE0>, <SERDES1_LANE1_PCIE1_LANE1>,
-                     <SERDES2_LANE0_PCIE2_LANE0>, <SERDES2_LANE1_PCIE2_LANE1>,
-                     <SERDES3_LANE0_USB3_0_SWAP>, <SERDES3_LANE1_USB3_0>,
-                     <SERDES4_LANE0_EDP_LANE0>, <SERDES4_LANE1_EDP_LANE1>, <SERDES4_LANE2_EDP_LANE2>, <SERDES4_LANE3_EDP_LANE3>;
+       idle-states = <J721E_SERDES0_LANE0_PCIE0_LANE0>, <J721E_SERDES0_LANE1_PCIE0_LANE1>,
+                     <J721E_SERDES1_LANE0_PCIE1_LANE0>, <J721E_SERDES1_LANE1_PCIE1_LANE1>,
+                     <J721E_SERDES2_LANE0_PCIE2_LANE0>, <J721E_SERDES2_LANE1_PCIE2_LANE1>,
+                     <J721E_SERDES3_LANE0_USB3_0_SWAP>, <J721E_SERDES3_LANE1_USB3_0>,
+                     <J721E_SERDES4_LANE0_EDP_LANE0>, <J721E_SERDES4_LANE1_EDP_LANE1>,
+                     <J721E_SERDES4_LANE2_EDP_LANE2>, <J721E_SERDES4_LANE3_EDP_LANE3>;
 };
 
 &serdes_wiz3 {
                gpio-controller;
                #gpio-cells = <2>;
 
-               p09 {
+               p09-hog {
                        /* P11 - MCASP/TRACE_MUX_S0 */
                        gpio-hog;
                        gpios = <9 GPIO_ACTIVE_HIGH>;
                        line-name = "MCASP/TRACE_MUX_S0";
                };
 
-               p10 {
+               p10-hog {
                        /* P12 - MCASP/TRACE_MUX_S1 */
                        gpio-hog;
                        gpios = <10 GPIO_ACTIVE_HIGH>;
 
        status = "okay";
 };
+
+&serdes0 {
+       serdes0_pcie_link: link@0 {
+               reg = <0>;
+               cdns,num-lanes = <1>;
+               #phy-cells = <0>;
+               cdns,phy-type = <PHY_TYPE_PCIE>;
+               resets = <&serdes_wiz0 1>;
+       };
+};
+
+&serdes1 {
+       serdes1_pcie_link: link@0 {
+               reg = <0>;
+               cdns,num-lanes = <2>;
+               #phy-cells = <0>;
+               cdns,phy-type = <PHY_TYPE_PCIE>;
+               resets = <&serdes_wiz1 1>, <&serdes_wiz1 2>;
+       };
+};
+
+&serdes2 {
+       serdes2_pcie_link: link@0 {
+               reg = <0>;
+               cdns,num-lanes = <2>;
+               #phy-cells = <0>;
+               cdns,phy-type = <PHY_TYPE_PCIE>;
+               resets = <&serdes_wiz2 1>, <&serdes_wiz2 2>;
+       };
+};
+
+&pcie0_rc {
+       reset-gpios = <&exp1 6 GPIO_ACTIVE_HIGH>;
+       phys = <&serdes0_pcie_link>;
+       phy-names = "pcie-phy";
+       num-lanes = <1>;
+};
+
+&pcie1_rc {
+       reset-gpios = <&exp1 2 GPIO_ACTIVE_HIGH>;
+       phys = <&serdes1_pcie_link>;
+       phy-names = "pcie-phy";
+       num-lanes = <2>;
+};
+
+&pcie2_rc {
+       reset-gpios = <&exp2 20 GPIO_ACTIVE_HIGH>;
+       phys = <&serdes2_pcie_link>;
+       phy-names = "pcie-phy";
+       num-lanes = <2>;
+};
+
+&pcie0_ep {
+       phys = <&serdes0_pcie_link>;
+       phy-names = "pcie-phy";
+       num-lanes = <1>;
+       status = "disabled";
+};
+
+&pcie1_ep {
+       phys = <&serdes1_pcie_link>;
+       phy-names = "pcie-phy";
+       num-lanes = <2>;
+       status = "disabled";
+};
+
+&pcie2_ep {
+       phys = <&serdes2_pcie_link>;
+       phy-names = "pcie-phy";
+       num-lanes = <2>;
+       status = "disabled";
+};
+
+&pcie3_rc {
+       status = "disabled";
+};
+
+&pcie3_ep {
+       status = "disabled";
+};
index 12ceea9..e2a96b2 100644 (file)
@@ -6,7 +6,7 @@
  */
 #include <dt-bindings/phy/phy.h>
 #include <dt-bindings/mux/mux.h>
-#include <dt-bindings/mux/mux-j721e-wiz.h>
+#include <dt-bindings/mux/ti-serdes.h>
 
 &cbass_main {
        msmc_ram: sram@70000000 {
                #size-cells = <1>;
                ranges = <0x0 0x0 0x00100000 0x1c000>;
 
-               serdes_ln_ctrl: serdes-ln-ctrl@4080 {
+               pcie0_ctrl: syscon@4070 {
+                       compatible = "ti,j721e-system-controller", "syscon", "simple-mfd";
+                       reg = <0x00004070 0x4>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x4070 0x4070 0x4>;
+               };
+
+               pcie1_ctrl: syscon@4074 {
+                       compatible = "ti,j721e-system-controller", "syscon", "simple-mfd";
+                       reg = <0x00004074 0x4>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x4074 0x4074 0x4>;
+               };
+
+               pcie2_ctrl: syscon@4078 {
+                       compatible = "ti,j721e-system-controller", "syscon", "simple-mfd";
+                       reg = <0x00004078 0x4>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x4078 0x4078 0x4>;
+               };
+
+               pcie3_ctrl: syscon@407c {
+                       compatible = "ti,j721e-system-controller", "syscon", "simple-mfd";
+                       reg = <0x0000407c 0x4>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x407c 0x407c 0x4>;
+               };
+
+               serdes_ln_ctrl: mux@4080 {
                        compatible = "mmio-mux";
                        reg = <0x00004080 0x50>;
                        #mux-control-cells = <1>;
                                        <0x40b0 0x3>, <0x40b4 0x3>, /* SERDES3 lane0/1 select */
                                        <0x40c0 0x3>, <0x40c4 0x3>, <0x40c8 0x3>, <0x40cc 0x3>;
                                        /* SERDES4 lane0/1/2/3 select */
-                       idle-states = <SERDES0_LANE0_PCIE0_LANE0>, <SERDES0_LANE1_PCIE0_LANE1>,
-                                     <SERDES1_LANE0_PCIE1_LANE0>, <SERDES1_LANE1_PCIE1_LANE1>,
-                                     <SERDES2_LANE0_PCIE2_LANE0>, <SERDES2_LANE1_PCIE2_LANE1>,
-                                     <MUX_IDLE_AS_IS>, <SERDES3_LANE1_USB3_0>,
-                                     <SERDES4_LANE0_EDP_LANE0>, <SERDES4_LANE1_EDP_LANE1>, <SERDES4_LANE2_EDP_LANE2>, <SERDES4_LANE3_EDP_LANE3>;
+                       idle-states = <J721E_SERDES0_LANE0_PCIE0_LANE0>, <J721E_SERDES0_LANE1_PCIE0_LANE1>,
+                                     <J721E_SERDES1_LANE0_PCIE1_LANE0>, <J721E_SERDES1_LANE1_PCIE1_LANE1>,
+                                     <J721E_SERDES2_LANE0_PCIE2_LANE0>, <J721E_SERDES2_LANE1_PCIE2_LANE1>,
+                                     <MUX_IDLE_AS_IS>, <J721E_SERDES3_LANE1_USB3_0>,
+                                     <J721E_SERDES4_LANE0_EDP_LANE0>, <J721E_SERDES4_LANE1_EDP_LANE1>,
+                                     <J721E_SERDES4_LANE2_EDP_LANE2>, <J721E_SERDES4_LANE3_EDP_LANE3>;
                };
 
                usb_serdes_mux: mux-controller@4000 {
                ti,interrupt-ranges = <8 392 56>;
        };
 
-       main_navss {
+       main-navss {
                compatible = "simple-mfd";
                #address-cells = <2>;
                #size-cells = <2>;
                };
        };
 
-       main_pmx0: pinmux@11c000 {
+       main_crypto: crypto@4e00000 {
+               compatible = "ti,j721e-sa2ul";
+               reg = <0x0 0x4e00000 0x0 0x1200>;
+               power-domains = <&k3_pds 264 TI_SCI_PD_EXCLUSIVE>;
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges = <0x0 0x04e00000 0x00 0x04e00000 0x0 0x30000>;
+
+               status = "okay";
+
+               dmas = <&main_udmap 0xc000>, <&main_udmap 0x4000>,
+                               <&main_udmap 0x4001>;
+               dma-names = "tx", "rx1", "rx2";
+               dma-coherent;
+
+               rng: rng@4e10000 {
+                       compatible = "inside-secure,safexcel-eip76";
+                       reg = <0x0 0x4e10000 0x0 0x7d>;
+                       interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&k3_clks 264 1>;
+               };
+       };
+
+       main_pmx0: pinctrl@11c000 {
                compatible = "pinctrl-single";
                /* Proxy 0 addressing */
                reg = <0x0 0x11c000 0x0 0x2b4>;
                };
        };
 
+       pcie0_rc: pcie@2900000 {
+               compatible = "ti,j721e-pcie-host";
+               reg = <0x00 0x02900000 0x00 0x1000>,
+                     <0x00 0x02907000 0x00 0x400>,
+                     <0x00 0x0d000000 0x00 0x00800000>,
+                     <0x00 0x10000000 0x00 0x00001000>;
+               reg-names = "intd_cfg", "user_cfg", "reg", "cfg";
+               interrupt-names = "link_state";
+               interrupts = <GIC_SPI 318 IRQ_TYPE_EDGE_RISING>;
+               device_type = "pci";
+               ti,syscon-pcie-ctrl = <&pcie0_ctrl>;
+               max-link-speed = <3>;
+               num-lanes = <2>;
+               power-domains = <&k3_pds 239 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 239 1>;
+               clock-names = "fck";
+               #address-cells = <3>;
+               #size-cells = <2>;
+               bus-range = <0x0 0xf>;
+               vendor-id = <0x104c>;
+               device-id = <0xb00d>;
+               msi-map = <0x0 &gic_its 0x0 0x10000>;
+               dma-coherent;
+               ranges = <0x01000000 0x0 0x10001000 0x0 0x10001000 0x0 0x0010000>,
+                        <0x02000000 0x0 0x10011000 0x0 0x10011000 0x0 0x7fef000>;
+               dma-ranges = <0x02000000 0x0 0x0 0x0 0x0 0x10000 0x0>;
+       };
+
+       pcie0_ep: pcie-ep@2900000 {
+               compatible = "ti,j721e-pcie-ep";
+               reg = <0x00 0x02900000 0x00 0x1000>,
+                     <0x00 0x02907000 0x00 0x400>,
+                     <0x00 0x0d000000 0x00 0x00800000>,
+                     <0x00 0x10000000 0x00 0x08000000>;
+               reg-names = "intd_cfg", "user_cfg", "reg", "mem";
+               interrupt-names = "link_state";
+               interrupts = <GIC_SPI 318 IRQ_TYPE_EDGE_RISING>;
+               ti,syscon-pcie-ctrl = <&pcie0_ctrl>;
+               max-link-speed = <3>;
+               num-lanes = <2>;
+               power-domains = <&k3_pds 239 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 239 1>;
+               clock-names = "fck";
+               cdns,max-outbound-regions = <16>;
+               max-functions = /bits/ 8 <6>;
+               max-virtual-functions = /bits/ 16 <4 4 4 4 0 0>;
+               dma-coherent;
+       };
+
+       pcie1_rc: pcie@2910000 {
+               compatible = "ti,j721e-pcie-host";
+               reg = <0x00 0x02910000 0x00 0x1000>,
+                     <0x00 0x02917000 0x00 0x400>,
+                     <0x00 0x0d800000 0x00 0x00800000>,
+                     <0x00 0x18000000 0x00 0x00001000>;
+               reg-names = "intd_cfg", "user_cfg", "reg", "cfg";
+               interrupt-names = "link_state";
+               interrupts = <GIC_SPI 330 IRQ_TYPE_EDGE_RISING>;
+               device_type = "pci";
+               ti,syscon-pcie-ctrl = <&pcie1_ctrl>;
+               max-link-speed = <3>;
+               num-lanes = <2>;
+               power-domains = <&k3_pds 240 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 240 1>;
+               clock-names = "fck";
+               #address-cells = <3>;
+               #size-cells = <2>;
+               bus-range = <0x0 0xf>;
+               vendor-id = <0x104c>;
+               device-id = <0xb00d>;
+               msi-map = <0x0 &gic_its 0x10000 0x10000>;
+               dma-coherent;
+               ranges = <0x01000000 0x0 0x18001000 0x0 0x18001000 0x0 0x0010000>,
+                        <0x02000000 0x0 0x18011000 0x0 0x18011000 0x0 0x7fef000>;
+               dma-ranges = <0x02000000 0x0 0x0 0x0 0x0 0x10000 0x0>;
+       };
+
+       pcie1_ep: pcie-ep@2910000 {
+               compatible = "ti,j721e-pcie-ep";
+               reg = <0x00 0x02910000 0x00 0x1000>,
+                     <0x00 0x02917000 0x00 0x400>,
+                     <0x00 0x0d800000 0x00 0x00800000>,
+                     <0x00 0x18000000 0x00 0x08000000>;
+               reg-names = "intd_cfg", "user_cfg", "reg", "mem";
+               interrupt-names = "link_state";
+               interrupts = <GIC_SPI 330 IRQ_TYPE_EDGE_RISING>;
+               ti,syscon-pcie-ctrl = <&pcie1_ctrl>;
+               max-link-speed = <3>;
+               num-lanes = <2>;
+               power-domains = <&k3_pds 240 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 240 1>;
+               clock-names = "fck";
+               cdns,max-outbound-regions = <16>;
+               max-functions = /bits/ 8 <6>;
+               max-virtual-functions = /bits/ 16 <4 4 4 4 0 0>;
+               dma-coherent;
+       };
+
+       pcie2_rc: pcie@2920000 {
+               compatible = "ti,j721e-pcie-host";
+               reg = <0x00 0x02920000 0x00 0x1000>,
+                     <0x00 0x02927000 0x00 0x400>,
+                     <0x00 0x0e000000 0x00 0x00800000>,
+                     <0x44 0x00000000 0x00 0x00001000>;
+               reg-names = "intd_cfg", "user_cfg", "reg", "cfg";
+               interrupt-names = "link_state";
+               interrupts = <GIC_SPI 342 IRQ_TYPE_EDGE_RISING>;
+               device_type = "pci";
+               ti,syscon-pcie-ctrl = <&pcie2_ctrl>;
+               max-link-speed = <3>;
+               num-lanes = <2>;
+               power-domains = <&k3_pds 241 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 241 1>;
+               clock-names = "fck";
+               #address-cells = <3>;
+               #size-cells = <2>;
+               bus-range = <0x0 0xf>;
+               vendor-id = <0x104c>;
+               device-id = <0xb00d>;
+               msi-map = <0x0 &gic_its 0x20000 0x10000>;
+               dma-coherent;
+               ranges = <0x01000000 0x0 0x00001000 0x44 0x00001000 0x0 0x0010000>,
+                        <0x02000000 0x0 0x00011000 0x44 0x00011000 0x0 0x7fef000>;
+               dma-ranges = <0x02000000 0x0 0x0 0x0 0x0 0x10000 0x0>;
+       };
+
+       pcie2_ep: pcie-ep@2920000 {
+               compatible = "ti,j721e-pcie-ep";
+               reg = <0x00 0x02920000 0x00 0x1000>,
+                     <0x00 0x02927000 0x00 0x400>,
+                     <0x00 0x0e000000 0x00 0x00800000>,
+                     <0x44 0x00000000 0x00 0x08000000>;
+               reg-names = "intd_cfg", "user_cfg", "reg", "mem";
+               interrupt-names = "link_state";
+               interrupts = <GIC_SPI 342 IRQ_TYPE_EDGE_RISING>;
+               ti,syscon-pcie-ctrl = <&pcie2_ctrl>;
+               max-link-speed = <3>;
+               num-lanes = <2>;
+               power-domains = <&k3_pds 241 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 241 1>;
+               clock-names = "fck";
+               cdns,max-outbound-regions = <16>;
+               max-functions = /bits/ 8 <6>;
+               max-virtual-functions = /bits/ 16 <4 4 4 4 0 0>;
+               dma-coherent;
+       };
+
+       pcie3_rc: pcie@2930000 {
+               compatible = "ti,j721e-pcie-host";
+               reg = <0x00 0x02930000 0x00 0x1000>,
+                     <0x00 0x02937000 0x00 0x400>,
+                     <0x00 0x0e800000 0x00 0x00800000>,
+                     <0x44 0x10000000 0x00 0x00001000>;
+               reg-names = "intd_cfg", "user_cfg", "reg", "cfg";
+               interrupt-names = "link_state";
+               interrupts = <GIC_SPI 354 IRQ_TYPE_EDGE_RISING>;
+               device_type = "pci";
+               ti,syscon-pcie-ctrl = <&pcie3_ctrl>;
+               max-link-speed = <3>;
+               num-lanes = <2>;
+               power-domains = <&k3_pds 242 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 242 1>;
+               clock-names = "fck";
+               #address-cells = <3>;
+               #size-cells = <2>;
+               bus-range = <0x0 0xf>;
+               vendor-id = <0x104c>;
+               device-id = <0xb00d>;
+               msi-map = <0x0 &gic_its 0x30000 0x10000>;
+               dma-coherent;
+               ranges = <0x01000000 0x0 0x00001000 0x44 0x10001000 0x0 0x0010000>,
+                        <0x02000000 0x0 0x00011000 0x44 0x10011000 0x0 0x7fef000>;
+               dma-ranges = <0x02000000 0x0 0x0 0x0 0x0 0x10000 0x0>;
+       };
+
+       pcie3_ep: pcie-ep@2930000 {
+               compatible = "ti,j721e-pcie-ep";
+               reg = <0x00 0x02930000 0x00 0x1000>,
+                     <0x00 0x02937000 0x00 0x400>,
+                     <0x00 0x0e800000 0x00 0x00800000>,
+                     <0x44 0x10000000 0x00 0x08000000>;
+               reg-names = "intd_cfg", "user_cfg", "reg", "mem";
+               interrupt-names = "link_state";
+               interrupts = <GIC_SPI 354 IRQ_TYPE_EDGE_RISING>;
+               ti,syscon-pcie-ctrl = <&pcie3_ctrl>;
+               max-link-speed = <3>;
+               num-lanes = <2>;
+               power-domains = <&k3_pds 242 TI_SCI_PD_EXCLUSIVE>;
+               clocks = <&k3_clks 242 1>;
+               clock-names = "fck";
+               cdns,max-outbound-regions = <16>;
+               max-functions = /bits/ 8 <6>;
+               max-virtual-functions = /bits/ 16 <4 4 4 4 0 0>;
+               dma-coherent;
+               #address-cells = <2>;
+               #size-cells = <2>;
+       };
+
        main_uart0: serial@2800000 {
                compatible = "ti,j721e-uart", "ti,am654-uart";
                reg = <0x00 0x02800000 0x00 0x100>;
                no-1-8-v;
        };
 
-       usbss0: cdns_usb@4104000 {
+       usbss0: cdns-usb@4104000 {
                compatible = "ti,j721e-usb";
                reg = <0x00 0x4104000 0x00 0x100>;
                dma-coherent;
                };
        };
 
-       usbss1: cdns_usb@4114000 {
+       usbss1: cdns-usb@4114000 {
                compatible = "ti,j721e-usb";
                reg = <0x00 0x4114000 0x00 0x100>;
                dma-coherent;
                assigned-clocks = <&k3_clks 253 1>;
                assigned-clock-parents = <&k3_clks 253 5>;
        };
+
+       c66_0: dsp@4d80800000 {
+               compatible = "ti,j721e-c66-dsp";
+               reg = <0x4d 0x80800000 0x00 0x00048000>,
+                     <0x4d 0x80e00000 0x00 0x00008000>,
+                     <0x4d 0x80f00000 0x00 0x00008000>;
+               reg-names = "l2sram", "l1pram", "l1dram";
+               ti,sci = <&dmsc>;
+               ti,sci-dev-id = <142>;
+               ti,sci-proc-ids = <0x03 0xff>;
+               resets = <&k3_reset 142 1>;
+               firmware-name = "j7-c66_0-fw";
+       };
+
+       c66_1: dsp@4d81800000 {
+               compatible = "ti,j721e-c66-dsp";
+               reg = <0x4d 0x81800000 0x00 0x00048000>,
+                     <0x4d 0x81e00000 0x00 0x00008000>,
+                     <0x4d 0x81f00000 0x00 0x00008000>;
+               reg-names = "l2sram", "l1pram", "l1dram";
+               ti,sci = <&dmsc>;
+               ti,sci-dev-id = <143>;
+               ti,sci-proc-ids = <0x04 0xff>;
+               resets = <&k3_reset 143 1>;
+               firmware-name = "j7-c66_1-fw";
+       };
+
+       c71_0: dsp@64800000 {
+               compatible = "ti,j721e-c71-dsp";
+               reg = <0x00 0x64800000 0x00 0x00080000>,
+                     <0x00 0x64e00000 0x00 0x0000c000>;
+               reg-names = "l2sram", "l1dram";
+               ti,sci = <&dmsc>;
+               ti,sci-dev-id = <15>;
+               ti,sci-proc-ids = <0x30 0xff>;
+               resets = <&k3_reset 15 1>;
+               firmware-name = "j7-c71_0-fw";
+       };
 };
index c4a48e8..e581cb1 100644 (file)
@@ -53,7 +53,7 @@
                reg = <0x0 0x43000014 0x0 0x4>;
        };
 
-       wkup_pmx0: pinmux@4301c000 {
+       wkup_pmx0: pinctrl@4301c000 {
                compatible = "pinctrl-single";
                /* Proxy 0 addressing */
                reg = <0x00 0x4301c000 0x00 0x178>;
                };
        };
 
-       mcu_navss {
+       mcu-navss {
                compatible = "simple-mfd";
                #address-cells = <2>;
                #size-cells = <2>;
index 8fa3361..5dc3ba7 100644 (file)
                        alignment = <0x1000>;
                        no-map;
                };
+
+               c66_1_dma_memory_region: c66-dma-memory@a6000000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x00 0xa6000000 0x00 0x100000>;
+                       no-map;
+               };
+
+               c66_0_memory_region: c66-memory@a6100000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x00 0xa6100000 0x00 0xf00000>;
+                       no-map;
+               };
+
+               c66_0_dma_memory_region: c66-dma-memory@a7000000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x00 0xa7000000 0x00 0x100000>;
+                       no-map;
+               };
+
+               c66_1_memory_region: c66-memory@a7100000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x00 0xa7100000 0x00 0xf00000>;
+                       no-map;
+               };
+
+               c71_0_dma_memory_region: c71-dma-memory@a8000000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x00 0xa8000000 0x00 0x100000>;
+                       no-map;
+               };
+
+               c71_0_memory_region: c71-memory@a8100000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x00 0xa8100000 0x00 0xf00000>;
+                       no-map;
+               };
+
+               rtos_ipc_memory_region: ipc-memories@aa000000 {
+                       reg = <0x00 0xaa000000 0x00 0x01c00000>;
+                       alignment = <0x1000>;
+                       no-map;
+               };
        };
 };
 
 &wkup_pmx0 {
-       wkup_i2c0_pins_default: wkup_i2c0_pins_default {
+       wkup_i2c0_pins_default: wkup-i2c0-pins-default {
                pinctrl-single,pins = <
                        J721E_WKUP_IOPAD(0xf8, PIN_INPUT_PULLUP, 0) /* (J25) WKUP_I2C0_SCL */
                        J721E_WKUP_IOPAD(0xfc, PIN_INPUT_PULLUP, 0) /* (H24) WKUP_I2C0_SDA */
                #size-cells = <1>;
        };
 };
+
+&mailbox0_cluster0 {
+       interrupts = <436>;
+
+       mbox_mcu_r5fss0_core0: mbox-mcu-r5fss0-core0 {
+               ti,mbox-rx = <0 0 0>;
+               ti,mbox-tx = <1 0 0>;
+       };
+
+       mbox_mcu_r5fss0_core1: mbox-mcu-r5fss0-core1 {
+               ti,mbox-rx = <2 0 0>;
+               ti,mbox-tx = <3 0 0>;
+       };
+};
+
+&mailbox0_cluster1 {
+       interrupts = <432>;
+
+       mbox_main_r5fss0_core0: mbox-main-r5fss0-core0 {
+               ti,mbox-rx = <0 0 0>;
+               ti,mbox-tx = <1 0 0>;
+       };
+
+       mbox_main_r5fss0_core1: mbox-main-r5fss0-core1 {
+               ti,mbox-rx = <2 0 0>;
+               ti,mbox-tx = <3 0 0>;
+       };
+};
+
+&mailbox0_cluster2 {
+       interrupts = <428>;
+
+       mbox_main_r5fss1_core0: mbox-main-r5fss1-core0 {
+               ti,mbox-rx = <0 0 0>;
+               ti,mbox-tx = <1 0 0>;
+       };
+
+       mbox_main_r5fss1_core1: mbox-main-r5fss1-core1 {
+               ti,mbox-rx = <2 0 0>;
+               ti,mbox-tx = <3 0 0>;
+       };
+};
+
+&mailbox0_cluster3 {
+       interrupts = <424>;
+
+       mbox_c66_0: mbox-c66-0 {
+               ti,mbox-rx = <0 0 0>;
+               ti,mbox-tx = <1 0 0>;
+       };
+
+       mbox_c66_1: mbox-c66-1 {
+               ti,mbox-rx = <2 0 0>;
+               ti,mbox-tx = <3 0 0>;
+       };
+};
+
+&mailbox0_cluster4 {
+       interrupts = <420>;
+
+       mbox_c71_0: mbox-c71-0 {
+               ti,mbox-rx = <0 0 0>;
+               ti,mbox-tx = <1 0 0>;
+       };
+};
+
+&mailbox0_cluster5 {
+       status = "disabled";
+};
+
+&mailbox0_cluster6 {
+       status = "disabled";
+};
+
+&mailbox0_cluster7 {
+       status = "disabled";
+};
+
+&mailbox0_cluster8 {
+       status = "disabled";
+};
+
+&mailbox0_cluster9 {
+       status = "disabled";
+};
+
+&mailbox0_cluster10 {
+       status = "disabled";
+};
+
+&mailbox0_cluster11 {
+       status = "disabled";
+};
+
+&c66_0 {
+       mboxes = <&mailbox0_cluster3 &mbox_c66_0>;
+       memory-region = <&c66_0_dma_memory_region>,
+                       <&c66_0_memory_region>;
+};
+
+&c66_1 {
+       mboxes = <&mailbox0_cluster3 &mbox_c66_1>;
+       memory-region = <&c66_1_dma_memory_region>,
+                       <&c66_1_memory_region>;
+};
+
+&c71_0 {
+       mboxes = <&mailbox0_cluster4 &mbox_c71_0>;
+       memory-region = <&c71_0_dma_memory_region>,
+                       <&c71_0_memory_region>;
+};
index d035b61..cc483f7 100644 (file)
                interrupts = <GIC_PPI 7 IRQ_TYPE_LEVEL_HIGH>;
        };
 
-       cbass_main: interconnect@100000 {
+       cbass_main: bus@100000 {
                compatible = "simple-bus";
                #address-cells = <2>;
                #size-cells = <2>;
                ranges = <0x00 0x00100000 0x00 0x00100000 0x00 0x00020000>, /* ctrl mmr */
                         <0x00 0x00600000 0x00 0x00600000 0x00 0x00031100>, /* GPIO */
                         <0x00 0x00900000 0x00 0x00900000 0x00 0x00012000>, /* serdes */
-                        <0x00 0x00A40000 0x00 0x00A40000 0x00 0x00000800>, /* timesync router */
+                        <0x00 0x00a40000 0x00 0x00a40000 0x00 0x00000800>, /* timesync router */
                         <0x00 0x06000000 0x00 0x06000000 0x00 0x00400000>, /* USBSS0 */
                         <0x00 0x06400000 0x00 0x06400000 0x00 0x00400000>, /* USBSS1 */
                         <0x00 0x01000000 0x00 0x01000000 0x00 0x0af02400>, /* Most peripherals */
                         <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>, /* MAIN NAVSS */
-                        <0x00 0x0d000000 0x00 0x0d000000 0x00 0x01000000>, /* PCIe Core*/
+                        <0x00 0x0d000000 0x00 0x0d000000 0x00 0x01800000>, /* PCIe Core*/
+                        <0x00 0x0e000000 0x00 0x0e000000 0x00 0x01800000>, /* PCIe Core*/
                         <0x00 0x10000000 0x00 0x10000000 0x00 0x10000000>, /* PCIe DAT */
                         <0x00 0x64800000 0x00 0x64800000 0x00 0x00800000>, /* C71 */
+                        <0x44 0x00000000 0x44 0x00000000 0x00 0x08000000>, /* PCIe2 DAT */
+                        <0x44 0x10000000 0x44 0x10000000 0x00 0x08000000>, /* PCIe3 DAT */
                         <0x4d 0x80800000 0x4d 0x80800000 0x00 0x00800000>, /* C66_0 */
                         <0x4d 0x81800000 0x4d 0x81800000 0x00 0x00800000>, /* C66_1 */
                         <0x4e 0x20000000 0x4e 0x20000000 0x00 0x00080000>, /* GPU */
                         <0x05 0x00000000 0x05 0x00000000 0x01 0x00000000>,
                         <0x07 0x00000000 0x07 0x00000000 0x01 0x00000000>;
 
-               cbass_mcu_wakeup: interconnect@28380000 {
+               cbass_mcu_wakeup: bus@28380000 {
                        compatible = "simple-bus";
                        #address-cells = <2>;
                        #size-cells = <2>;
diff --git a/arch/arm64/boot/dts/toshiba/Makefile b/arch/arm64/boot/dts/toshiba/Makefile
new file mode 100644 (file)
index 0000000..8cd460d
--- /dev/null
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_VISCONTI) += tmpv7708-rm-mbrc.dtb
diff --git a/arch/arm64/boot/dts/toshiba/tmpv7708-rm-mbrc.dts b/arch/arm64/boot/dts/toshiba/tmpv7708-rm-mbrc.dts
new file mode 100644 (file)
index 0000000..ed0bf7f
--- /dev/null
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree File for TMPV7708 RM main board
+ *
+ * (C) Copyright 2020, Toshiba Corporation.
+ * (C) Copyright 2020, Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
+ */
+
+/dts-v1/;
+
+#include "tmpv7708.dtsi"
+
+/ {
+       model = "Toshiba TMPV7708 RM main board";
+       compatible = "toshiba,tmpv7708-rm-mbrc", "toshiba,tmpv7708";
+
+       aliases {
+               serial0 = &uart0;
+               serial1 = &uart1;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       /* 768MB memory */
+       memory@80000000 {
+               device_type = "memory";
+               reg = <0x0 0x80000000 0x0 0x30000000>;
+       };
+};
+
+&uart0 {
+       status = "okay";
+       clocks = <&uart_clk>;
+       clock-names = "apb_pclk";
+};
+
+&uart1 {
+       status = "okay";
+       clocks = <&uart_clk>;
+       clock-names = "apb_pclk";
+};
diff --git a/arch/arm64/boot/dts/toshiba/tmpv7708.dtsi b/arch/arm64/boot/dts/toshiba/tmpv7708.dtsi
new file mode 100644 (file)
index 0000000..242f25f
--- /dev/null
@@ -0,0 +1,390 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree Source for the TMPV7708
+ *
+ * (C) Copyright 2018 - 2020, Toshiba Corporation.
+ * (C) Copyright 2020, Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
+ *
+ */
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/memreserve/ 0x81000000 0x00300000;    /* cpu-release-addr */
+
+/ {
+       compatible = "toshiba,tmpv7708";
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu-map {
+                       cluster0 {
+                               core0 {
+                                       cpu = <&cpu0>;
+                               };
+                               core1 {
+                                       cpu = <&cpu1>;
+                               };
+                               core2 {
+                                       cpu = <&cpu2>;
+                               };
+                               core3 {
+                                       cpu = <&cpu3>;
+                               };
+                       };
+
+                       cluster1 {
+                               core0 {
+                                       cpu = <&cpu4>;
+                               };
+                               core1 {
+                                       cpu = <&cpu5>;
+                               };
+                               core2 {
+                                       cpu = <&cpu6>;
+                               };
+                               core3 {
+                                       cpu = <&cpu7>;
+                               };
+                       };
+               };
+
+               cpu0: cpu@0 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       enable-method = "spin-table";
+                       cpu-release-addr = <0x0 0x81100000>;
+                       reg = <0x00>;
+               };
+
+               cpu1: cpu@1 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       enable-method = "spin-table";
+                       cpu-release-addr = <0x0 0x81100000>;
+                       reg = <0x01>;
+               };
+
+               cpu2: cpu@2 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       enable-method = "spin-table";
+                       cpu-release-addr = <0x0 0x81100000>;
+                       reg = <0x02>;
+               };
+
+               cpu3: cpu@3 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       enable-method = "spin-table";
+                       cpu-release-addr = <0x0 0x81100000>;
+                       reg = <0x03>;
+               };
+
+               cpu4: cpu@100 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       enable-method = "spin-table";
+                       cpu-release-addr = <0x0 0x81100000>;
+                       reg = <0x100>;
+               };
+
+               cpu5: cpu@101 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       enable-method = "spin-table";
+                       cpu-release-addr = <0x0 0x81100000>;
+                       reg = <0x101>;
+               };
+
+               cpu6: cpu@102 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       enable-method = "spin-table";
+                       cpu-release-addr = <0x0 0x81100000>;
+                       reg = <0x102>;
+               };
+
+               cpu7: cpu@103 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       enable-method = "spin-table";
+                       cpu-release-addr = <0x0 0x81100000>;
+                       reg = <0x103>;
+               };
+       };
+
+       timer {
+               compatible = "arm,armv8-timer";
+               interrupt-parent = <&gic>;
+               interrupts =
+                       <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+                       <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+                       <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+                       <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>;
+       };
+
+       uart_clk: uart-clk {
+               compatible = "fixed-clock";
+               clock-frequency = <150000000>;
+               #clock-cells = <0>;
+       };
+
+       soc {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               compatible = "simple-bus";
+               interrupt-parent = <&gic>;
+               ranges;
+
+               gic: interrupt-controller@24001000 {
+                       compatible = "arm,gic-400";
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
+                       interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>;
+                       reg = <0 0x24001000 0 0x1000>,
+                             <0 0x24002000 0 0x2000>,
+                             <0 0x24004000 0 0x2000>,
+                             <0 0x24006000 0 0x2000>;
+               };
+
+               pmux: pmux@24190000 {
+                       compatible = "toshiba,tmpv7708-pinctrl";
+                       reg = <0 0x24190000 0 0x10000>;
+               };
+
+               uart0: serial@28200000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0 0x28200000 0 0x1000>;
+                       interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart0_pins>;
+                       status = "disabled";
+               };
+
+               uart1: serial@28201000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0 0x28201000 0 0x1000>;
+                       interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart1_pins>;
+                       status = "disabled";
+               };
+
+               uart2: serial@28202000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0 0x28202000 0 0x1000>;
+                       interrupts = <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart2_pins>;
+                       status = "disabled";
+               };
+
+               uart3: serial@28203000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0 0x28203000 0 0x1000>;
+                       interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart3_pins>;
+                       status = "disabled";
+               };
+
+               i2c0: i2c@28030000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0 0x28030000 0 0x1000>;
+                       interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c0_pins>;
+                       clock-frequency = <400000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               i2c1: i2c@28031000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0 0x28031000 0 0x1000>;
+                       interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c1_pins>;
+                       clock-frequency = <400000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               i2c2: i2c@28032000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0 0x28032000 0 0x1000>;
+                       interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c2_pins>;
+                       clock-frequency = <400000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               i2c3: i2c@28033000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0 0x28033000 0 0x1000>;
+                       interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c3_pins>;
+                       clock-frequency = <400000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               i2c4: i2c@28034000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0 0x28034000 0 0x1000>;
+                       interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c4_pins>;
+                       clock-frequency = <400000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               i2c5: i2c@28035000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0 0x28035000 0 0x1000>;
+                       interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c5_pins>;
+                       clock-frequency = <400000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               i2c6: i2c@28036000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0 0x28036000 0 0x1000>;
+                       interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c6_pins>;
+                       clock-frequency = <400000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               i2c7: i2c@28037000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0 0x28037000 0 0x1000>;
+                       interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c7_pins>;
+                       clock-frequency = <400000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               i2c8: i2c@28038000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0 0x28038000 0 0x1000>;
+                       interrupts = <GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c8_pins>;
+                       clock-frequency = <400000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               spi0: spi@28140000 {
+                       compatible = "arm,pl022", "arm,primecell";
+                       reg = <0 0x28140000 0 0x1000>;
+                       interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&spi0_pins>;
+                       num-cs = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               spi1: spi@28141000 {
+                       compatible = "arm,pl022", "arm,primecell";
+                       reg = <0 0x28141000 0 0x1000>;
+                       interrupts = <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&spi1_pins>;
+                       num-cs = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               spi2: spi@28142000 {
+                       compatible = "arm,pl022", "arm,primecell";
+                       reg = <0 0x28142000 0 0x1000>;
+                       interrupts = <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&spi2_pins>;
+                       num-cs = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               spi3: spi@28143000 {
+                       compatible = "arm,pl022", "arm,primecell";
+                       reg = <0 0x28143000 0 0x1000>;
+                       interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&spi3_pins>;
+                       num-cs = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               spi4: spi@28144000 {
+                       compatible = "arm,pl022", "arm,primecell";
+                       reg = <0 0x28144000 0 0x1000>;
+                       interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&spi4_pins>;
+                       num-cs = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               spi5: spi@28145000 {
+                       compatible = "arm,pl022", "arm,primecell";
+                       reg = <0 0x28145000 0 0x1000>;
+                       interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&spi5_pins>;
+                       num-cs = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               spi6: spi@28146000 {
+                       compatible = "arm,pl022", "arm,primecell";
+                       reg = <0 0x28146000 0 0x1000>;
+                       interrupts = <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&spi6_pins>;
+                       num-cs = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+       };
+};
+
+#include "tmpv7708_pins.dtsi"
diff --git a/arch/arm64/boot/dts/toshiba/tmpv7708_pins.dtsi b/arch/arm64/boot/dts/toshiba/tmpv7708_pins.dtsi
new file mode 100644 (file)
index 0000000..34de000
--- /dev/null
@@ -0,0 +1,93 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+&pmux {
+       spi0_pins: spi0-pins {
+               function = "spi0";
+               groups = "spi0_grp";
+       };
+       spi1_pins: spi1-pins {
+               function = "spi1";
+               groups = "spi1_grp";
+       };
+       spi2_pins: spi2-pins {
+               function = "spi2";
+               groups = "spi2_grp";
+       };
+       spi3_pins: spi3-pins {
+               function = "spi3";
+               groups = "spi3_grp";
+       };
+       spi4_pins: spi4-pins {
+               function = "spi4";
+               groups = "spi4_grp";
+       };
+       spi5_pins: spi5-pins {
+               function = "spi5";
+               groups = "spi5_grp";
+       };
+       spi6_pins: spi6-pins {
+               function = "spi6";
+               groups = "spi6_grp";
+       };
+       uart0_pins: uart0-pins {
+               function = "uart0";
+               groups = "uart0_grp";
+       };
+       uart1_pins: uart1-pins {
+               function = "uart1";
+               groups = "uart1_grp";
+       };
+       uart2_pins: uart2-pins {
+               function = "uart2";
+               groups = "uart2_grp";
+       };
+       uart3_pins: uart3-pins {
+               function = "uart3";
+               groups = "uart3_grp";
+       };
+       i2c0_pins: i2c0-pins {
+               function = "i2c0";
+               groups = "i2c0_grp";
+               bias-pull-up;
+       };
+       i2c1_pins: i2c1-pins {
+               function = "i2c1";
+               groups = "i2c1_grp";
+               bias-pull-up;
+       };
+       i2c2_pins: i2c2-pins {
+               function = "i2c2";
+               groups = "i2c2_grp";
+               bias-pull-up;
+       };
+       i2c3_pins: i2c3-pins {
+               function = "i2c3";
+               groups = "i2c3_grp";
+               bias-pull-up;
+       };
+       i2c4_pins: i2c4-pins {
+               function = "i2c4";
+               groups = "i2c4_grp";
+               bias-pull-up;
+       };
+       i2c5_pins: i2c5-pins {
+               function = "i2c5";
+               groups = "i2c5_grp";
+               bias-pull-up;
+       };
+       i2c6_pins: i2c6-pins {
+               function = "i2c6";
+               groups = "i2c6_grp";
+               bias-pull-up;
+       };
+       i2c7_pins: i2c7-pins {
+               function = "i2c7";
+               groups = "i2c7_grp";
+               bias-pull-up;
+       };
+       i2c8_pins: i2c8-pins {
+               function = "i2c8";
+               groups = "i2c8_grp";
+               bias-pull-up;
+       };
+};
index 9868ca1..c94c3bb 100644 (file)
 #include <dt-bindings/clock/xlnx-zynqmp-clk.h>
 / {
        pss_ref_clk: pss_ref_clk {
-               u-boot,dm-pre-reloc;
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency = <33333333>;
        };
 
        video_clk: video_clk {
-               u-boot,dm-pre-reloc;
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency = <27000000>;
        };
 
        pss_alt_ref_clk: pss_alt_ref_clk {
-               u-boot,dm-pre-reloc;
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency = <0>;
        };
 
        gt_crx_ref_clk: gt_crx_ref_clk {
-               u-boot,dm-pre-reloc;
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency = <108000000>;
        };
 
        aux_ref_clk: aux_ref_clk {
-               u-boot,dm-pre-reloc;
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency = <27000000>;
index d60110a..68ecd0f 100644 (file)
 
        leds {
                compatible = "gpio-leds";
-               ds2 {
+               led-ds2 {
                        label = "ds2";
                        gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
                };
 
-               ds3 {
+               led-ds3 {
                        label = "ds3";
                        gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "phy0tx"; /* WLAN tx */
                        default-state = "off";
                };
 
-               ds4 {
+               led-ds4 {
                        label = "ds4";
                        gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "phy0rx"; /* WLAN rx */
                        default-state = "off";
                };
 
-               ds5 {
+               led-ds5 {
                        label = "ds5";
                        gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "bluetooth-power";
                                compatible = "ti,tps65086";
                                reg = <0x5e>;
                                interrupt-parent = <&gpio>;
-                               interrupts = <77 GPIO_ACTIVE_LOW>;
+                               interrupts = <77 IRQ_TYPE_LEVEL_LOW>;
                                #gpio-cells = <2>;
                                gpio-controller;
                        };
index 4f80172..f1255f6 100644 (file)
                gpio-line-names = "PS_GTR_LAN_SEL0", "PS_GTR_LAN_SEL1", "PS_GTR_LAN_SEL2", "PS_GTR_LAN_SEL3",
                                "PCI_CLK_DIR_SEL", "IIC_MUX_RESET_B", "GEM3_EXP_RESET_B",
                                "", "", "", "", "", "", "", "", "";
-               gtr-sel0 {
+               gtr-sel0-hog {
                        gpio-hog;
                        gpios = <0 0>;
                        output-low; /* PCIE = 0, DP = 1 */
                        line-name = "sel0";
                };
-               gtr-sel1 {
+               gtr-sel1-hog {
                        gpio-hog;
                        gpios = <1 0>;
                        output-high; /* PCIE = 0, DP = 1 */
                        line-name = "sel1";
                };
-               gtr-sel2 {
+               gtr-sel2-hog {
                        gpio-hog;
                        gpios = <2 0>;
                        output-high; /* PCIE = 0, USB0 = 1 */
                        line-name = "sel2";
                };
-               gtr-sel3 {
+               gtr-sel3-hog {
                        gpio-hog;
                        gpios = <3 0>;
                        output-high; /* PCIE = 0, SATA = 1 */
index 3ec99f1..771f60e 100644 (file)
                        };
 
                        zynqmp_clk: clock-controller {
-                               u-boot,dm-pre-reloc;
                                #clock-cells = <1>;
                                compatible = "xlnx,zynqmp-clk";
                                clocks = <&pss_ref_clk>,
                ranges;
        };
 
-       amba_apu: amba-apu@0 {
+       amba_apu: axi@0 {
                compatible = "simple-bus";
                #address-cells = <2>;
                #size-cells = <1>;
                };
        };
 
-       amba: amba {
+       amba: axi {
                compatible = "simple-bus";
                #address-cells = <2>;
                #size-cells = <2>;
                };
 
                i2c0: i2c@ff020000 {
-                       compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10";
+                       compatible = "cdns,i2c-r1p14";
                        status = "disabled";
                        interrupt-parent = <&gic>;
                        interrupts = <0 17 4>;
                };
 
                i2c1: i2c@ff030000 {
-                       compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10";
+                       compatible = "cdns,i2c-r1p14";
                        status = "disabled";
                        interrupt-parent = <&gic>;
                        interrupts = <0 18 4>;
index 6d04b95..5cfe3cf 100644 (file)
@@ -57,6 +57,7 @@ CONFIG_ARCH_THUNDER=y
 CONFIG_ARCH_THUNDER2=y
 CONFIG_ARCH_UNIPHIER=y
 CONFIG_ARCH_VEXPRESS=y
+CONFIG_ARCH_VISCONTI=y
 CONFIG_ARCH_XGENE=y
 CONFIG_ARCH_ZX=y
 CONFIG_ARCH_ZYNQMP=y
@@ -199,6 +200,9 @@ CONFIG_MAC80211_LEDS=y
 CONFIG_RFKILL=m
 CONFIG_NET_9P=y
 CONFIG_NET_9P_VIRTIO=y
+CONFIG_NFC=m
+CONFIG_NFC_NCI=m
+CONFIG_NFC_S3FWRN5_I2C=m
 CONFIG_PCI=y
 CONFIG_PCIEPORTBUS=y
 CONFIG_PCI_IOV=y
@@ -208,6 +212,7 @@ CONFIG_HOTPLUG_PCI_ACPI=y
 CONFIG_PCI_AARDVARK=y
 CONFIG_PCI_TEGRA=y
 CONFIG_PCIE_RCAR_HOST=y
+CONFIG_PCIE_RCAR_EP=y
 CONFIG_PCI_HOST_GENERIC=y
 CONFIG_PCI_XGENE=y
 CONFIG_PCIE_ALTERA=y
@@ -224,6 +229,9 @@ CONFIG_PCIE_ARMADA_8K=y
 CONFIG_PCIE_KIRIN=y
 CONFIG_PCIE_HISI_STB=y
 CONFIG_PCIE_TEGRA194_HOST=m
+CONFIG_PCI_ENDPOINT=y
+CONFIG_PCI_ENDPOINT_CONFIGFS=y
+CONFIG_PCI_EPF_TEST=m
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_FW_LOADER_USER_HELPER=y
@@ -231,6 +239,7 @@ CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
 CONFIG_HISILICON_LPC=y
 CONFIG_SIMPLE_PM_BUS=y
 CONFIG_FSL_MC_BUS=y
+CONFIG_TEGRA_ACONNECT=m
 CONFIG_MTD=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_CFI=y
@@ -254,6 +263,7 @@ CONFIG_BLK_DEV_NBD=m
 CONFIG_VIRTIO_BLK=y
 CONFIG_BLK_DEV_NVME=m
 CONFIG_SRAM=y
+CONFIG_PCI_ENDPOINT_TEST=m
 CONFIG_EEPROM_AT24=m
 CONFIG_EEPROM_AT25=m
 CONFIG_UACCE=m
@@ -453,6 +463,7 @@ CONFIG_SPI_MESON_SPIFC=m
 CONFIG_SPI_ORION=y
 CONFIG_SPI_PL022=y
 CONFIG_SPI_ROCKCHIP=y
+CONFIG_SPI_RPCIF=m
 CONFIG_SPI_QCOM_QSPI=m
 CONFIG_SPI_QUP=y
 CONFIG_SPI_QCOM_GENI=m
@@ -489,6 +500,7 @@ CONFIG_GPIO_ALTERA=m
 CONFIG_GPIO_DWAPB=y
 CONFIG_GPIO_MB86S7X=y
 CONFIG_GPIO_MPC8XXX=y
+CONFIG_GPIO_MXC=y
 CONFIG_GPIO_PL061=y
 CONFIG_GPIO_RCAR=y
 CONFIG_GPIO_UNIPHIER=y
@@ -500,6 +512,7 @@ CONFIG_GPIO_PCA953X=y
 CONFIG_GPIO_PCA953X_IRQ=y
 CONFIG_GPIO_BD9571MWV=m
 CONFIG_GPIO_MAX77620=y
+CONFIG_GPIO_SL28CPLD=m
 CONFIG_POWER_AVS=y
 CONFIG_QCOM_CPR=y
 CONFIG_ROCKCHIP_IODOMAIN=y
@@ -513,6 +526,7 @@ CONFIG_SENSORS_ARM_SCPI=y
 CONFIG_SENSORS_LM90=m
 CONFIG_SENSORS_PWM_FAN=m
 CONFIG_SENSORS_RASPBERRYPI_HWMON=m
+CONFIG_SENSORS_SL28CPLD=m
 CONFIG_SENSORS_INA2XX=m
 CONFIG_SENSORS_INA3221=m
 CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y
@@ -535,6 +549,7 @@ CONFIG_QCOM_TSENS=y
 CONFIG_QCOM_SPMI_TEMP_ALARM=m
 CONFIG_UNIPHIER_THERMAL=y
 CONFIG_WATCHDOG=y
+CONFIG_SL28CPLD_WATCHDOG=m
 CONFIG_ARM_SP805_WATCHDOG=y
 CONFIG_ARM_SBSA_WATCHDOG=y
 CONFIG_ARM_SMC_WATCHDOG=y
@@ -560,6 +575,7 @@ CONFIG_MFD_MAX77620=y
 CONFIG_MFD_SPMI_PMIC=y
 CONFIG_MFD_RK808=y
 CONFIG_MFD_SEC_CORE=y
+CONFIG_MFD_SL28CPLD=y
 CONFIG_MFD_ROHM_BD718XX=y
 CONFIG_MFD_WCD934X=m
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
@@ -640,10 +656,14 @@ CONFIG_DRM_MSM=m
 CONFIG_DRM_TEGRA=m
 CONFIG_DRM_PANEL_LVDS=m
 CONFIG_DRM_PANEL_SIMPLE=m
-CONFIG_DRM_SIMPLE_BRIDGE=m
+CONFIG_DRM_PANEL_RAYDIUM_RM67191=m
+CONFIG_DRM_PANEL_SITRONIX_ST7703=m
 CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA=m
 CONFIG_DRM_DISPLAY_CONNECTOR=m
+CONFIG_DRM_NWL_MIPI_DSI=m
+CONFIG_DRM_LONTIUM_LT9611=m
 CONFIG_DRM_SII902X=m
+CONFIG_DRM_SIMPLE_BRIDGE=m
 CONFIG_DRM_THINE_THC63LVD1024=m
 CONFIG_DRM_TI_SN65DSI86=m
 CONFIG_DRM_I2C_ADV7511=m
@@ -654,6 +674,7 @@ CONFIG_DRM_VC4=m
 CONFIG_DRM_ETNAVIV=m
 CONFIG_DRM_HISI_HIBMC=m
 CONFIG_DRM_HISI_KIRIN=m
+CONFIG_DRM_MXSFB=m
 CONFIG_DRM_MESON=m
 CONFIG_DRM_PL111=m
 CONFIG_DRM_LIMA=m
@@ -676,6 +697,9 @@ CONFIG_SND_BCM2835_SOC_I2S=m
 CONFIG_SND_SOC_FSL_SAI=m
 CONFIG_SND_MESON_AXG_SOUND_CARD=m
 CONFIG_SND_MESON_GX_SOUND_CARD=m
+CONFIG_SND_SOC_QCOM=m
+CONFIG_SND_SOC_APQ8016_SBC=m
+CONFIG_SND_SOC_MSM8996=m
 CONFIG_SND_SOC_SDM845=m
 CONFIG_SND_SOC_ROCKCHIP=m
 CONFIG_SND_SOC_ROCKCHIP_SPDIF=m
@@ -684,6 +708,12 @@ CONFIG_SND_SOC_RK3399_GRU_SOUND=m
 CONFIG_SND_SOC_SAMSUNG=y
 CONFIG_SND_SOC_RCAR=m
 CONFIG_SND_SUN4I_SPDIF=m
+CONFIG_SND_SOC_TEGRA=m
+CONFIG_SND_SOC_TEGRA210_AHUB=m
+CONFIG_SND_SOC_TEGRA210_DMIC=m
+CONFIG_SND_SOC_TEGRA210_I2S=m
+CONFIG_SND_SOC_TEGRA186_DSPK=m
+CONFIG_SND_SOC_TEGRA210_ADMAIF=m
 CONFIG_SND_SOC_AK4613=m
 CONFIG_SND_SOC_ES7134=m
 CONFIG_SND_SOC_ES7241=m
@@ -709,6 +739,7 @@ CONFIG_USB_OHCI_EXYNOS=y
 CONFIG_USB_OHCI_HCD_PLATFORM=y
 CONFIG_USB_RENESAS_USBHS_HCD=m
 CONFIG_USB_RENESAS_USBHS=m
+CONFIG_USB_ACM=m
 CONFIG_USB_STORAGE=y
 CONFIG_USB_MUSB_HDRC=y
 CONFIG_USB_MUSB_SUNXI=y
@@ -718,6 +749,8 @@ CONFIG_USB_CHIPIDEA=y
 CONFIG_USB_CHIPIDEA_UDC=y
 CONFIG_USB_CHIPIDEA_HOST=y
 CONFIG_USB_ISP1760=y
+CONFIG_USB_SERIAL=m
+CONFIG_USB_SERIAL_FTDI_SIO=m
 CONFIG_USB_HSIC_USB3503=y
 CONFIG_NOP_USB_XCEIV=y
 CONFIG_USB_GADGET=y
@@ -811,6 +844,7 @@ CONFIG_MV_XOR_V2=y
 CONFIG_OWL_DMA=y
 CONFIG_PL330_DMA=y
 CONFIG_TEGRA20_APB_DMA=y
+CONFIG_TEGRA210_ADMA=m
 CONFIG_QCOM_BAM_DMA=y
 CONFIG_QCOM_HIDMA_MGMT=y
 CONFIG_QCOM_HIDMA=y
@@ -838,6 +872,7 @@ CONFIG_COMMON_CLK_FSL_SAI=y
 CONFIG_COMMON_CLK_S2MPS11=y
 CONFIG_COMMON_CLK_PWM=y
 CONFIG_COMMON_CLK_VC5=y
+CONFIG_COMMON_CLK_BD718XX=m
 CONFIG_CLK_RASPBERRYPI=m
 CONFIG_CLK_IMX8MM=y
 CONFIG_CLK_IMX8MN=y
@@ -865,6 +900,8 @@ CONFIG_SDM_VIDEOCC_845=y
 CONFIG_SDM_DISPCC_845=y
 CONFIG_SM_GCC_8150=y
 CONFIG_SM_GCC_8250=y
+CONFIG_SM_GPUCC_8150=y
+CONFIG_SM_GPUCC_8250=y
 CONFIG_QCOM_HFPLL=y
 CONFIG_HWSPINLOCK=y
 CONFIG_HWSPINLOCK_QCOM=y
@@ -928,6 +965,7 @@ CONFIG_TI_SCI_PM_DOMAINS=y
 CONFIG_EXTCON_PTN5150=m
 CONFIG_EXTCON_USB_GPIO=y
 CONFIG_EXTCON_USBC_CROS_EC=y
+CONFIG_RENESAS_RPCIF=m
 CONFIG_IIO=y
 CONFIG_EXYNOS_ADC=y
 CONFIG_MAX9611=m
@@ -946,14 +984,18 @@ CONFIG_PWM_MESON=m
 CONFIG_PWM_RCAR=m
 CONFIG_PWM_ROCKCHIP=y
 CONFIG_PWM_SAMSUNG=y
+CONFIG_PWM_SL28CPLD=m
 CONFIG_PWM_SUN4I=m
 CONFIG_PWM_TEGRA=m
+CONFIG_SL28CPLD_INTC=y
 CONFIG_QCOM_PDC=y
+CONFIG_RESET_IMX7=y
 CONFIG_RESET_QCOM_AOSS=y
 CONFIG_RESET_QCOM_PDC=m
 CONFIG_RESET_TI_SCI=y
 CONFIG_PHY_XGENE=y
 CONFIG_PHY_SUN4I_USB=y
+CONFIG_PHY_MIXEL_MIPI_DPHY=m
 CONFIG_PHY_HI6220_USB=y
 CONFIG_PHY_HISTB_COMBPHY=y
 CONFIG_PHY_HISI_INNO_USB2=y
@@ -961,6 +1003,7 @@ CONFIG_PHY_MVEBU_CP110_COMPHY=y
 CONFIG_PHY_QCOM_QMP=m
 CONFIG_PHY_QCOM_QUSB2=m
 CONFIG_PHY_QCOM_USB_HS=y
+CONFIG_PHY_QCOM_USB_SNPS_FEMTO_V2=y
 CONFIG_PHY_RCAR_GEN3_PCIE=y
 CONFIG_PHY_RCAR_GEN3_USB2=y
 CONFIG_PHY_RCAR_GEN3_USB3=m
@@ -996,6 +1039,12 @@ CONFIG_SLIMBUS=m
 CONFIG_SLIM_QCOM_CTRL=m
 CONFIG_SLIM_QCOM_NGD_CTRL=m
 CONFIG_MUX_MMIO=y
+CONFIG_INTERCONNECT=y
+CONFIG_INTERCONNECT_QCOM=y
+CONFIG_INTERCONNECT_QCOM_MSM8916=m
+CONFIG_INTERCONNECT_QCOM_SDM845=m
+CONFIG_INTERCONNECT_QCOM_SM8150=m
+CONFIG_INTERCONNECT_QCOM_SM8250=m
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
 CONFIG_EXT4_FS_POSIX_ACL=y
index e3d47b5..ec7720d 100644 (file)
@@ -10,6 +10,7 @@
  * #imm16 values used for BRK instruction generation
  * 0x004: for installing kprobes
  * 0x005: for installing uprobes
+ * 0x006: for kprobe software single-step
  * Allowed values for kgdb are 0x400 - 0x7ff
  * 0x100: for triggering a fault on purpose (reserved)
  * 0x400: for dynamic BRK instruction
@@ -19,6 +20,7 @@
  */
 #define KPROBES_BRK_IMM                        0x004
 #define UPROBES_BRK_IMM                        0x005
+#define KPROBES_BRK_SS_IMM             0x006
 #define FAULT_BRK_IMM                  0x100
 #define KGDB_DYN_DBG_BRK_IMM           0x400
 #define KGDB_COMPILED_DBG_BRK_IMM      0x401
index a4d1b5f..63d43b5 100644 (file)
@@ -24,6 +24,7 @@
 #define CTR_L1IP(ctr)          (((ctr) >> CTR_L1IP_SHIFT) & CTR_L1IP_MASK)
 
 #define ICACHE_POLICY_VPIPT    0
+#define ICACHE_POLICY_RESERVED 1
 #define ICACHE_POLICY_VIPT     2
 #define ICACHE_POLICY_PIPT     3
 
@@ -79,7 +80,7 @@ static inline u32 cache_type_cwg(void)
        return (read_cpuid_cachetype() >> CTR_CWG_SHIFT) & CTR_CWG_MASK;
 }
 
-#define __read_mostly __section(.data..read_mostly)
+#define __read_mostly __section(".data..read_mostly")
 
 static inline int cache_line_size_of_cpu(void)
 {
index 42868db..e7d9899 100644 (file)
@@ -65,7 +65,8 @@
 #define ARM64_HAS_ARMv8_4_TTL                  55
 #define ARM64_HAS_TLB_RANGE                    56
 #define ARM64_MTE                              57
+#define ARM64_WORKAROUND_1508412               58
 
-#define ARM64_NCAPS                            58
+#define ARM64_NCAPS                            59
 
 #endif /* __ASM_CPUCAPS_H */
index f7e7144..97244d4 100644 (file)
@@ -375,6 +375,23 @@ cpucap_multi_entry_cap_matches(const struct arm64_cpu_capabilities *entry,
        return false;
 }
 
+static __always_inline bool is_vhe_hyp_code(void)
+{
+       /* Only defined for code run in VHE hyp context */
+       return __is_defined(__KVM_VHE_HYPERVISOR__);
+}
+
+static __always_inline bool is_nvhe_hyp_code(void)
+{
+       /* Only defined for code run in NVHE hyp context */
+       return __is_defined(__KVM_NVHE_HYPERVISOR__);
+}
+
+static __always_inline bool is_hyp_code(void)
+{
+       return is_vhe_hyp_code() || is_nvhe_hyp_code();
+}
+
 extern DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS);
 extern struct static_key_false cpu_hwcap_keys[ARM64_NCAPS];
 extern struct static_key_false arm64_const_caps_ready;
@@ -428,35 +445,40 @@ static __always_inline bool __cpus_have_const_cap(int num)
 }
 
 /*
- * Test for a capability, possibly with a runtime check.
+ * Test for a capability without a runtime check.
  *
- * Before capabilities are finalized, this behaves as cpus_have_cap().
+ * Before capabilities are finalized, this will BUG().
  * After capabilities are finalized, this is patched to avoid a runtime check.
  *
  * @num must be a compile-time constant.
  */
-static __always_inline bool cpus_have_const_cap(int num)
+static __always_inline bool cpus_have_final_cap(int num)
 {
        if (system_capabilities_finalized())
                return __cpus_have_const_cap(num);
        else
-               return cpus_have_cap(num);
+               BUG();
 }
 
 /*
- * Test for a capability without a runtime check.
+ * Test for a capability, possibly with a runtime check for non-hyp code.
  *
- * Before capabilities are finalized, this will BUG().
+ * For hyp code, this behaves the same as cpus_have_final_cap().
+ *
+ * For non-hyp code:
+ * Before capabilities are finalized, this behaves as cpus_have_cap().
  * After capabilities are finalized, this is patched to avoid a runtime check.
  *
  * @num must be a compile-time constant.
  */
-static __always_inline bool cpus_have_final_cap(int num)
+static __always_inline bool cpus_have_const_cap(int num)
 {
-       if (system_capabilities_finalized())
+       if (is_hyp_code())
+               return cpus_have_final_cap(num);
+       else if (system_capabilities_finalized())
                return __cpus_have_const_cap(num);
        else
-               BUG();
+               return cpus_have_cap(num);
 }
 
 static inline void cpus_set_cap(unsigned int num)
index 7219cdd..9e2e9a6 100644 (file)
@@ -71,6 +71,7 @@
 #define ARM_CPU_PART_CORTEX_A55                0xD05
 #define ARM_CPU_PART_CORTEX_A76                0xD0B
 #define ARM_CPU_PART_NEOVERSE_N1       0xD0C
+#define ARM_CPU_PART_CORTEX_A77                0xD0D
 
 #define APM_CPU_PART_POTENZA           0x000
 
 #define MIDR_CORTEX_A55 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A55)
 #define MIDR_CORTEX_A76        MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76)
 #define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1)
+#define MIDR_CORTEX_A77        MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77)
 #define MIDR_THUNDERX  MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX)
 #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)
 #define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX)
index 0b298f4..657c921 100644 (file)
@@ -53,6 +53,7 @@
 
 /* kprobes BRK opcodes with ESR encoding  */
 #define BRK64_OPCODE_KPROBES   (AARCH64_BREAK_MON | (KPROBES_BRK_IMM << 5))
+#define BRK64_OPCODE_KPROBES_SS        (AARCH64_BREAK_MON | (KPROBES_BRK_SS_IMM << 5))
 /* uprobes BRK opcodes with ESR encoding  */
 #define BRK64_OPCODE_UPROBES   (AARCH64_BREAK_MON | (UPROBES_BRK_IMM << 5))
 
index 97e511d..8699ce3 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/percpu.h>
 
 #define __ARCH_WANT_KPROBES_INSN_SLOT
-#define MAX_INSN_SIZE                  1
+#define MAX_INSN_SIZE                  2
 
 #define flush_insn_slot(p)             do { } while (0)
 #define kretprobe_blacklist_size       0
index 0aecbab..781d029 100644 (file)
@@ -239,6 +239,7 @@ enum vcpu_sysreg {
 #define cp14_DBGWCR0   (DBGWCR0_EL1 * 2)
 #define cp14_DBGWVR0   (DBGWVR0_EL1 * 2)
 #define cp14_DBGDCCINT (MDCCINT_EL1 * 2)
+#define cp14_DBGVCR    (DBGVCR32_EL2 * 2)
 
 #define NR_COPRO_REGS  (NR_SYS_REGS * 2)
 
index d52c1b3..174817b 100644 (file)
 
 #include <linux/build_bug.h>
 #include <linux/types.h>
+#include <asm/alternative.h>
 
 #define __DEFINE_MRS_MSR_S_REGNUM                              \
 "      .irp    num,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\n" \
                write_sysreg_s(__scs_new, sysreg);                      \
 } while (0)
 
+#define read_sysreg_par() ({                                           \
+       u64 par;                                                        \
+       asm(ALTERNATIVE("nop", "dmb sy", ARM64_WORKAROUND_1508412));    \
+       par = read_sysreg(par_el1);                                     \
+       asm(ALTERNATIVE("nop", "dmb sy", ARM64_WORKAROUND_1508412));    \
+       par;                                                            \
+})
+
 #endif
 
 #endif /* __ASM_SYSREG_H */
index 09977ac..6069be5 100644 (file)
@@ -86,13 +86,12 @@ static inline bool is_kernel_in_hyp_mode(void)
 static __always_inline bool has_vhe(void)
 {
        /*
-        * The following macros are defined for code specic to VHE/nVHE.
-        * If has_vhe() is inlined into those compilation units, it can
-        * be determined statically. Otherwise fall back to caps.
+        * Code only run in VHE/NVHE hyp context can assume VHE is present or
+        * absent. Otherwise fall back to caps.
         */
-       if (__is_defined(__KVM_VHE_HYPERVISOR__))
+       if (is_vhe_hyp_code())
                return true;
-       else if (__is_defined(__KVM_NVHE_HYPERVISOR__))
+       else if (is_nvhe_hyp_code())
                return false;
        else
                return cpus_have_final_cap(ARM64_HAS_VIRT_HOST_EXTN);
index 24d75af..61314fd 100644 (file)
@@ -523,6 +523,16 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
                .cpu_enable = cpu_enable_trap_ctr_access,
        },
 #endif
+#ifdef CONFIG_ARM64_ERRATUM_1508412
+       {
+               /* we depend on the firmware portion for correctness */
+               .desc = "ARM erratum 1508412 (kernel portion)",
+               .capability = ARM64_WORKAROUND_1508412,
+               ERRATA_MIDR_RANGE(MIDR_CORTEX_A77,
+                                 0, 0,
+                                 1, 0),
+       },
+#endif
        {
        }
 };
index 6a7bb37..77605ae 100644 (file)
@@ -34,10 +34,10 @@ DEFINE_PER_CPU(struct cpuinfo_arm64, cpu_data);
 static struct cpuinfo_arm64 boot_cpu_data;
 
 static const char *icache_policy_str[] = {
-       [0 ... ICACHE_POLICY_PIPT]      = "RESERVED/UNKNOWN",
+       [ICACHE_POLICY_VPIPT]           = "VPIPT",
+       [ICACHE_POLICY_RESERVED]        = "RESERVED/UNKNOWN",
        [ICACHE_POLICY_VIPT]            = "VIPT",
        [ICACHE_POLICY_PIPT]            = "PIPT",
-       [ICACHE_POLICY_VPIPT]           = "VPIPT",
 };
 
 unsigned long __icache_flags;
@@ -334,10 +334,11 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info)
        case ICACHE_POLICY_VPIPT:
                set_bit(ICACHEF_VPIPT, &__icache_flags);
                break;
-       default:
+       case ICACHE_POLICY_RESERVED:
        case ICACHE_POLICY_VIPT:
                /* Assume aliasing */
                set_bit(ICACHEF_ALIASING, &__icache_flags);
+               break;
        }
 
        pr_info("Detected %s I-cache on CPU%d\n", icache_policy_str[l1ip], cpu);
index df67c0f..a71844f 100644 (file)
@@ -147,6 +147,6 @@ efi_debug_entry:
         * correctly at this alignment, we must ensure that .text is
         * placed at a 4k boundary in the Image to begin with.
         */
-       .align 12
+       .balign SEGMENT_ALIGN
 efi_header_end:
        .endm
index d0cf596..fa02efb 100644 (file)
@@ -54,7 +54,7 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md)
 }
 
 /* we will fill this structure from the stub, so don't put it in .bss */
-struct screen_info screen_info __section(.data);
+struct screen_info screen_info __section(".data");
 
 int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md)
 {
index f30007d..b295fb9 100644 (file)
@@ -365,6 +365,9 @@ alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
        br      x30
 #endif
        .else
+       /* Ensure any device/NC reads complete */
+       alternative_insn nop, "dmb sy", ARM64_WORKAROUND_1508412
+
        eret
        .endif
        sb
index 61684a5..c615b28 100644 (file)
@@ -87,7 +87,6 @@ KVM_NVHE_ALIAS(__icache_flags);
 /* Kernel symbols needed for cpus_have_final/const_caps checks. */
 KVM_NVHE_ALIAS(arm64_const_caps_ready);
 KVM_NVHE_ALIAS(cpu_hwcap_keys);
-KVM_NVHE_ALIAS(cpu_hwcaps);
 
 /* Static keys which are set if a vGIC trap should be handled in hyp. */
 KVM_NVHE_ALIAS(vgic_v2_cpuif_trap);
index af9987c..66adee8 100644 (file)
@@ -43,7 +43,7 @@ static void *image_load(struct kimage *image,
        u64 flags, value;
        bool be_image, be_kernel;
        struct kexec_buf kbuf;
-       unsigned long text_offset;
+       unsigned long text_offset, kernel_segment_number;
        struct kexec_segment *kernel_segment;
        int ret;
 
@@ -88,11 +88,37 @@ static void *image_load(struct kimage *image,
        /* Adjust kernel segment with TEXT_OFFSET */
        kbuf.memsz += text_offset;
 
-       ret = kexec_add_buffer(&kbuf);
-       if (ret)
+       kernel_segment_number = image->nr_segments;
+
+       /*
+        * The location of the kernel segment may make it impossible to satisfy
+        * the other segment requirements, so we try repeatedly to find a
+        * location that will work.
+        */
+       while ((ret = kexec_add_buffer(&kbuf)) == 0) {
+               /* Try to load additional data */
+               kernel_segment = &image->segment[kernel_segment_number];
+               ret = load_other_segments(image, kernel_segment->mem,
+                                         kernel_segment->memsz, initrd,
+                                         initrd_len, cmdline);
+               if (!ret)
+                       break;
+
+               /*
+                * We couldn't find space for the other segments; erase the
+                * kernel segment and try the next available hole.
+                */
+               image->nr_segments -= 1;
+               kbuf.buf_min = kernel_segment->mem + kernel_segment->memsz;
+               kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
+       }
+
+       if (ret) {
+               pr_err("Could not find any suitable kernel location!");
                return ERR_PTR(ret);
+       }
 
-       kernel_segment = &image->segment[image->nr_segments - 1];
+       kernel_segment = &image->segment[kernel_segment_number];
        kernel_segment->mem += text_offset;
        kernel_segment->memsz -= text_offset;
        image->start = kernel_segment->mem;
@@ -101,12 +127,7 @@ static void *image_load(struct kimage *image,
                                kernel_segment->mem, kbuf.bufsz,
                                kernel_segment->memsz);
 
-       /* Load additional data */
-       ret = load_other_segments(image,
-                               kernel_segment->mem, kernel_segment->memsz,
-                               initrd, initrd_len, cmdline);
-
-       return ERR_PTR(ret);
+       return 0;
 }
 
 #ifdef CONFIG_KEXEC_IMAGE_VERIFY_SIG
index 5b0e67b..03210f6 100644 (file)
@@ -240,6 +240,11 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
        return ret;
 }
 
+/*
+ * Tries to add the initrd and DTB to the image. If it is not possible to find
+ * valid locations, this function will undo changes to the image and return non
+ * zero.
+ */
 int load_other_segments(struct kimage *image,
                        unsigned long kernel_load_addr,
                        unsigned long kernel_size,
@@ -248,7 +253,8 @@ int load_other_segments(struct kimage *image,
 {
        struct kexec_buf kbuf;
        void *headers, *dtb = NULL;
-       unsigned long headers_sz, initrd_load_addr = 0, dtb_len;
+       unsigned long headers_sz, initrd_load_addr = 0, dtb_len,
+                     orig_segments = image->nr_segments;
        int ret = 0;
 
        kbuf.image = image;
@@ -334,6 +340,7 @@ int load_other_segments(struct kimage *image,
        return 0;
 
 out_err:
+       image->nr_segments = orig_segments;
        vfree(dtb);
        return ret;
 }
index deba738..f11a1a1 100644 (file)
@@ -36,25 +36,16 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
 static void __kprobes
 post_kprobe_handler(struct kprobe_ctlblk *, struct pt_regs *);
 
-static int __kprobes patch_text(kprobe_opcode_t *addr, u32 opcode)
-{
-       void *addrs[1];
-       u32 insns[1];
-
-       addrs[0] = addr;
-       insns[0] = opcode;
-
-       return aarch64_insn_patch_text(addrs, insns, 1);
-}
-
 static void __kprobes arch_prepare_ss_slot(struct kprobe *p)
 {
+       kprobe_opcode_t *addr = p->ainsn.api.insn;
+       void *addrs[] = {addr, addr + 1};
+       u32 insns[] = {p->opcode, BRK64_OPCODE_KPROBES_SS};
+
        /* prepare insn slot */
-       patch_text(p->ainsn.api.insn, p->opcode);
+       aarch64_insn_patch_text(addrs, insns, 2);
 
-       flush_icache_range((uintptr_t) (p->ainsn.api.insn),
-                          (uintptr_t) (p->ainsn.api.insn) +
-                          MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
+       flush_icache_range((uintptr_t)addr, (uintptr_t)(addr + MAX_INSN_SIZE));
 
        /*
         * Needs restoring of return address after stepping xol.
@@ -128,13 +119,18 @@ void *alloc_insn_page(void)
 /* arm kprobe: install breakpoint in text */
 void __kprobes arch_arm_kprobe(struct kprobe *p)
 {
-       patch_text(p->addr, BRK64_OPCODE_KPROBES);
+       void *addr = p->addr;
+       u32 insn = BRK64_OPCODE_KPROBES;
+
+       aarch64_insn_patch_text(&addr, &insn, 1);
 }
 
 /* disarm kprobe: remove breakpoint from text */
 void __kprobes arch_disarm_kprobe(struct kprobe *p)
 {
-       patch_text(p->addr, p->opcode);
+       void *addr = p->addr;
+
+       aarch64_insn_patch_text(&addr, &p->opcode, 1);
 }
 
 void __kprobes arch_remove_kprobe(struct kprobe *p)
@@ -163,20 +159,15 @@ static void __kprobes set_current_kprobe(struct kprobe *p)
 }
 
 /*
- * Interrupts need to be disabled before single-step mode is set, and not
- * reenabled until after single-step mode ends.
- * Without disabling interrupt on local CPU, there is a chance of
- * interrupt occurrence in the period of exception return and  start of
- * out-of-line single-step, that result in wrongly single stepping
- * into the interrupt handler.
+ * Mask all of DAIF while executing the instruction out-of-line, to keep things
+ * simple and avoid nesting exceptions. Interrupts do have to be disabled since
+ * the kprobe state is per-CPU and doesn't get migrated.
  */
 static void __kprobes kprobes_save_local_irqflag(struct kprobe_ctlblk *kcb,
                                                struct pt_regs *regs)
 {
        kcb->saved_irqflag = regs->pstate & DAIF_MASK;
-       regs->pstate |= PSR_I_BIT;
-       /* Unmask PSTATE.D for enabling software step exceptions. */
-       regs->pstate &= ~PSR_D_BIT;
+       regs->pstate |= DAIF_MASK;
 }
 
 static void __kprobes kprobes_restore_local_irqflag(struct kprobe_ctlblk *kcb,
@@ -219,10 +210,7 @@ static void __kprobes setup_singlestep(struct kprobe *p,
                slot = (unsigned long)p->ainsn.api.insn;
 
                set_ss_context(kcb, slot);      /* mark pending ss */
-
-               /* IRQs and single stepping do not mix well. */
                kprobes_save_local_irqflag(kcb, regs);
-               kernel_enable_single_step(regs);
                instruction_pointer_set(regs, slot);
        } else {
                /* insn simulation */
@@ -273,12 +261,8 @@ post_kprobe_handler(struct kprobe_ctlblk *kcb, struct pt_regs *regs)
        }
        /* call post handler */
        kcb->kprobe_status = KPROBE_HIT_SSDONE;
-       if (cur->post_handler)  {
-               /* post_handler can hit breakpoint and single step
-                * again, so we enable D-flag for recursive exception.
-                */
+       if (cur->post_handler)
                cur->post_handler(cur, regs, 0);
-       }
 
        reset_current_kprobe();
 }
@@ -302,8 +286,6 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr)
                if (!instruction_pointer(regs))
                        BUG();
 
-               kernel_disable_single_step();
-
                if (kcb->kprobe_status == KPROBE_REENTER)
                        restore_previous_kprobe(kcb);
                else
@@ -365,10 +347,6 @@ static void __kprobes kprobe_handler(struct pt_regs *regs)
                         * pre-handler and it returned non-zero, it will
                         * modify the execution path and no need to single
                         * stepping. Let's just reset current kprobe and exit.
-                        *
-                        * pre_handler can hit a breakpoint and can step thru
-                        * before return, keep PSTATE D-flag enabled until
-                        * pre_handler return back.
                         */
                        if (!p->pre_handler || !p->pre_handler(p, regs)) {
                                setup_singlestep(p, regs, kcb, 0);
@@ -399,7 +377,7 @@ kprobe_ss_hit(struct kprobe_ctlblk *kcb, unsigned long addr)
 }
 
 static int __kprobes
-kprobe_single_step_handler(struct pt_regs *regs, unsigned int esr)
+kprobe_breakpoint_ss_handler(struct pt_regs *regs, unsigned int esr)
 {
        struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
        int retval;
@@ -409,16 +387,15 @@ kprobe_single_step_handler(struct pt_regs *regs, unsigned int esr)
 
        if (retval == DBG_HOOK_HANDLED) {
                kprobes_restore_local_irqflag(kcb, regs);
-               kernel_disable_single_step();
-
                post_kprobe_handler(kcb, regs);
        }
 
        return retval;
 }
 
-static struct step_hook kprobes_step_hook = {
-       .fn = kprobe_single_step_handler,
+static struct break_hook kprobes_break_ss_hook = {
+       .imm = KPROBES_BRK_SS_IMM,
+       .fn = kprobe_breakpoint_ss_handler,
 };
 
 static int __kprobes
@@ -486,7 +463,7 @@ int __kprobes arch_trampoline_kprobe(struct kprobe *p)
 int __init arch_init_kprobes(void)
 {
        register_kernel_break_hook(&kprobes_break_hook);
-       register_kernel_step_hook(&kprobes_step_hook);
+       register_kernel_break_hook(&kprobes_break_ss_hook);
 
        return 0;
 }
index 25f3c80..c18eb7d 100644 (file)
@@ -135,8 +135,6 @@ static enum mitigation_state spectre_v2_get_cpu_hw_mitigation_state(void)
        return SPECTRE_VULNERABLE;
 }
 
-#define SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED   (1)
-
 static enum mitigation_state spectre_v2_get_cpu_fw_mitigation_state(void)
 {
        int ret;
index 82e75fc..09c96f5 100644 (file)
@@ -222,6 +222,7 @@ asmlinkage notrace void secondary_start_kernel(void)
        if (system_uses_irq_prio_masking())
                init_gic_priority_masking();
 
+       rcu_cpu_starting(cpu);
        preempt_disable();
        trace_hardirqs_off();
 
index 5892e79..056772c 100644 (file)
@@ -19,7 +19,7 @@
 #include <asm/smp_plat.h>
 
 extern void secondary_holding_pen(void);
-volatile unsigned long __section(.mmuoff.data.read)
+volatile unsigned long __section(".mmuoff.data.read")
 secondary_holding_pen_release = INVALID_HWID;
 
 static phys_addr_t cpu_release_addr[NR_CPUS];
index 7f96a1a..79280c5 100644 (file)
@@ -22,16 +22,21 @@ endif
 
 CC_COMPAT ?= $(CC)
 CC_COMPAT += $(CC_COMPAT_CLANG_FLAGS)
+
+ifneq ($(LLVM),)
+LD_COMPAT ?= $(LD)
+else
+LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)ld
+endif
 else
 CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc
+LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)ld
 endif
 
 cc32-option = $(call try-run,\
         $(CC_COMPAT) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
 cc32-disable-warning = $(call try-run,\
        $(CC_COMPAT) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
-cc32-ldoption = $(call try-run,\
-        $(CC_COMPAT) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
 cc32-as-instr = $(call try-run,\
        printf "%b\n" "$(1)" | $(CC_COMPAT) $(VDSO_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
 
@@ -122,14 +127,10 @@ dmbinstr := $(call cc32-as-instr,dmb ishld,-DCONFIG_AS_DMB_ISHLD=1)
 VDSO_CFLAGS += $(dmbinstr)
 VDSO_AFLAGS += $(dmbinstr)
 
-VDSO_LDFLAGS := $(VDSO_CPPFLAGS)
 # From arm vDSO Makefile
-VDSO_LDFLAGS += -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1
-VDSO_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
-VDSO_LDFLAGS += -nostdlib -shared -mfloat-abi=soft
-VDSO_LDFLAGS += -Wl,--hash-style=sysv
-VDSO_LDFLAGS += -Wl,--build-id=sha1
-VDSO_LDFLAGS += $(call cc32-ldoption,-fuse-ld=bfd)
+VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1
+VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096
+VDSO_LDFLAGS += -nostdlib -shared --hash-style=sysv --build-id=sha1
 
 
 # Borrow vdsomunge.c from the arm vDSO
@@ -189,8 +190,8 @@ quiet_cmd_vdsold_and_vdso_check = LD32    $@
       cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check)
 
 quiet_cmd_vdsold = LD32    $@
-      cmd_vdsold = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_LDFLAGS) \
-                   -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
+      cmd_vdsold = $(LD_COMPAT) $(VDSO_LDFLAGS) \
+                   -T $(filter %.lds,$^) $(filter %.o,$^) -o $@
 quiet_cmd_vdsocc = CC32    $@
       cmd_vdsocc = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) -c -o $@ $<
 quiet_cmd_vdsocc_gettimeofday = CC32    $@
index 6d78c04..1bda604 100644 (file)
@@ -278,7 +278,7 @@ SECTIONS
         * explicitly check instead of blindly discarding.
         */
        .plt : {
-               *(.plt) *(.plt.*) *(.iplt) *(.igot)
+               *(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt)
        }
        ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!")
 
index f56122e..5750ec3 100644 (file)
@@ -808,6 +808,25 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
 
                preempt_enable();
 
+               /*
+                * The ARMv8 architecture doesn't give the hypervisor
+                * a mechanism to prevent a guest from dropping to AArch32 EL0
+                * if implemented by the CPU. If we spot the guest in such
+                * state and that we decided it wasn't supposed to do so (like
+                * with the asymmetric AArch32 case), return to userspace with
+                * a fatal error.
+                */
+               if (!system_supports_32bit_el0() && vcpu_mode_is_32bit(vcpu)) {
+                       /*
+                        * As we have caught the guest red-handed, decide that
+                        * it isn't fit for purpose anymore by making the vcpu
+                        * invalid. The VMM can try and fix it by issuing  a
+                        * KVM_ARM_VCPU_INIT if it really wants to.
+                        */
+                       vcpu->arch.target = -1;
+                       ret = ARM_EXCEPTION_IL;
+               }
+
                ret = handle_exit(vcpu, ret);
        }
 
@@ -1719,7 +1738,8 @@ int kvm_arch_init(void *opaque)
                return -ENODEV;
        }
 
-       if (cpus_have_final_cap(ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE))
+       if (cpus_have_final_cap(ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE) ||
+           cpus_have_final_cap(ARM64_WORKAROUND_1508412))
                kvm_info("Guests without required CPU erratum workarounds can deadlock system!\n" \
                         "Only trusted guests should be used on this system.\n");
 
index 313a8fa..1f875a8 100644 (file)
@@ -140,9 +140,9 @@ static inline bool __translate_far_to_hpfar(u64 far, u64 *hpfar)
         * We do need to save/restore PAR_EL1 though, as we haven't
         * saved the guest context yet, and we may return early...
         */
-       par = read_sysreg(par_el1);
+       par = read_sysreg_par();
        if (!__kvm_at("s1e1r", far))
-               tmp = read_sysreg(par_el1);
+               tmp = read_sysreg_par();
        else
                tmp = SYS_PAR_EL1_F; /* back to the guest */
        write_sysreg(par, par_el1);
@@ -421,7 +421,7 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
        if (cpus_have_final_cap(ARM64_WORKAROUND_CAVIUM_TX2_219_TVM) &&
            kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_SYS64 &&
            handle_tx2_tvm(vcpu))
-               return true;
+               goto guest;
 
        /*
         * We trap the first access to the FP/SIMD to save the host context
@@ -431,13 +431,13 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
         * Similarly for trapped SVE accesses.
         */
        if (__hyp_handle_fpsimd(vcpu))
-               return true;
+               goto guest;
 
        if (__hyp_handle_ptrauth(vcpu))
-               return true;
+               goto guest;
 
        if (!__populate_fault_info(vcpu))
-               return true;
+               goto guest;
 
        if (static_branch_unlikely(&vgic_v2_cpuif_trap)) {
                bool valid;
@@ -452,7 +452,7 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
                        int ret = __vgic_v2_perform_cpuif_access(vcpu);
 
                        if (ret == 1)
-                               return true;
+                               goto guest;
 
                        /* Promote an illegal access to an SError.*/
                        if (ret == -1)
@@ -468,12 +468,17 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
                int ret = __vgic_v3_perform_cpuif_access(vcpu);
 
                if (ret == 1)
-                       return true;
+                       goto guest;
        }
 
 exit:
        /* Return to the host kernel and handle the exit */
        return false;
+
+guest:
+       /* Re-enter the guest */
+       asm(ALTERNATIVE("nop", "dmb sy", ARM64_WORKAROUND_1508412));
+       return true;
 }
 
 static inline void __kvm_unexpected_el2_exception(void)
index 7a98603..cce43bf 100644 (file)
@@ -43,7 +43,7 @@ static inline void __sysreg_save_el1_state(struct kvm_cpu_context *ctxt)
        ctxt_sys_reg(ctxt, CONTEXTIDR_EL1) = read_sysreg_el1(SYS_CONTEXTIDR);
        ctxt_sys_reg(ctxt, AMAIR_EL1)   = read_sysreg_el1(SYS_AMAIR);
        ctxt_sys_reg(ctxt, CNTKCTL_EL1) = read_sysreg_el1(SYS_CNTKCTL);
-       ctxt_sys_reg(ctxt, PAR_EL1)     = read_sysreg(par_el1);
+       ctxt_sys_reg(ctxt, PAR_EL1)     = read_sysreg_par();
        ctxt_sys_reg(ctxt, TPIDR_EL1)   = read_sysreg(tpidr_el1);
 
        ctxt_sys_reg(ctxt, SP_EL1)      = read_sysreg(sp_el1);
index ff9a0f5..ed27f06 100644 (file)
@@ -17,8 +17,6 @@ SYM_FUNC_START(__host_exit)
 
        get_host_ctxt   x0, x1
 
-       ALTERNATIVE(nop, SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN)
-
        /* Store the host regs x2 and x3 */
        stp     x2, x3,   [x0, #CPU_XREG_OFFSET(2)]
 
index 47224dc..b11a9d7 100644 (file)
@@ -57,16 +57,25 @@ __do_hyp_init:
        cmp     x0, #HVC_STUB_HCALL_NR
        b.lo    __kvm_handle_stub_hvc
 
-       /* Set tpidr_el2 for use by HYP to free a register */
-       msr     tpidr_el2, x2
-
-       mov     x2, #KVM_HOST_SMCCC_FUNC(__kvm_hyp_init)
-       cmp     x0, x2
-       b.eq    1f
+       // We only actively check bits [24:31], and everything
+       // else has to be zero, which we check at build time.
+#if (KVM_HOST_SMCCC_FUNC(__kvm_hyp_init) & 0xFFFFFFFF00FFFFFF)
+#error Unexpected __KVM_HOST_SMCCC_FUNC___kvm_hyp_init value
+#endif
+
+       ror     x0, x0, #24
+       eor     x0, x0, #((KVM_HOST_SMCCC_FUNC(__kvm_hyp_init) >> 24) & 0xF)
+       ror     x0, x0, #4
+       eor     x0, x0, #((KVM_HOST_SMCCC_FUNC(__kvm_hyp_init) >> 28) & 0xF)
+       cbz     x0, 1f
        mov     x0, #SMCCC_RET_NOT_SUPPORTED
        eret
 
-1:     phys_to_ttbr x0, x1
+1:
+       /* Set tpidr_el2 for use by HYP to free a register */
+       msr     tpidr_el2, x2
+
+       phys_to_ttbr x0, x1
 alternative_if ARM64_HAS_CNP
        orr     x0, x0, #TTBR_CNP_BIT
 alternative_else_nop_endif
index a457a03..8ae8160 100644 (file)
@@ -250,7 +250,7 @@ void __noreturn hyp_panic(void)
 {
        u64 spsr = read_sysreg_el2(SYS_SPSR);
        u64 elr = read_sysreg_el2(SYS_ELR);
-       u64 par = read_sysreg(par_el1);
+       u64 par = read_sysreg_par();
        bool restore_host = true;
        struct kvm_cpu_context *host_ctxt;
        struct kvm_vcpu *vcpu;
index 39ca71a..fbde89a 100644 (file)
@@ -128,7 +128,6 @@ void __kvm_tlb_flush_local_vmid(struct kvm_s2_mmu *mmu)
        struct tlb_inv_context cxt;
 
        /* Switch to requested VMID */
-       mmu = kern_hyp_va(mmu);
        __tlb_switch_to_guest(mmu, &cxt);
 
        __tlbi(vmalle1);
index 0cdf6e4..0271b4a 100644 (file)
@@ -635,7 +635,7 @@ static void stage2_flush_dcache(void *addr, u64 size)
 
 static bool stage2_pte_cacheable(kvm_pte_t pte)
 {
-       u64 memattr = FIELD_GET(KVM_PTE_LEAF_ATTR_LO_S2_MEMATTR, pte);
+       u64 memattr = pte & KVM_PTE_LEAF_ATTR_LO_S2_MEMATTR;
        return memattr == PAGE_S2_MEMATTR(NORMAL);
 }
 
@@ -846,7 +846,7 @@ int kvm_pgtable_stage2_init(struct kvm_pgtable *pgt, struct kvm *kvm)
        u32 start_level = VTCR_EL2_TGRAN_SL0_BASE - sl0;
 
        pgd_sz = kvm_pgd_pages(ia_bits, start_level) * PAGE_SIZE;
-       pgt->pgd = alloc_pages_exact(pgd_sz, GFP_KERNEL | __GFP_ZERO);
+       pgt->pgd = alloc_pages_exact(pgd_sz, GFP_KERNEL_ACCOUNT | __GFP_ZERO);
        if (!pgt->pgd)
                return -ENOMEM;
 
index fe69de1..62546e2 100644 (file)
@@ -215,7 +215,7 @@ void __noreturn hyp_panic(void)
 {
        u64 spsr = read_sysreg_el2(SYS_SPSR);
        u64 elr = read_sysreg_el2(SYS_ELR);
-       u64 par = read_sysreg(par_el1);
+       u64 par = read_sysreg_par();
 
        __hyp_call_panic(spsr, elr, par);
        unreachable();
index 9824025..25ea4ec 100644 (file)
@@ -31,7 +31,7 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)
                                val = SMCCC_RET_SUCCESS;
                                break;
                        case SPECTRE_UNAFFECTED:
-                               val = SMCCC_RET_NOT_REQUIRED;
+                               val = SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED;
                                break;
                        }
                        break;
index 19aacc7..1a01da9 100644 (file)
@@ -787,14 +787,28 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
                vma_shift = PAGE_SHIFT;
        }
 
-       if (vma_shift == PUD_SHIFT &&
-           !fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
-              vma_shift = PMD_SHIFT;
-
-       if (vma_shift == PMD_SHIFT &&
-           !fault_supports_stage2_huge_mapping(memslot, hva, PMD_SIZE)) {
-               force_pte = true;
+       switch (vma_shift) {
+#ifndef __PAGETABLE_PMD_FOLDED
+       case PUD_SHIFT:
+               if (fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
+                       break;
+               fallthrough;
+#endif
+       case CONT_PMD_SHIFT:
+               vma_shift = PMD_SHIFT;
+               fallthrough;
+       case PMD_SHIFT:
+               if (fault_supports_stage2_huge_mapping(memslot, hva, PMD_SIZE))
+                       break;
+               fallthrough;
+       case CONT_PTE_SHIFT:
                vma_shift = PAGE_SHIFT;
+               force_pte = true;
+               fallthrough;
+       case PAGE_SHIFT:
+               break;
+       default:
+               WARN_ONCE(1, "Unknown vma_shift %d", vma_shift);
        }
 
        vma_pagesize = 1UL << vma_shift;
@@ -839,6 +853,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
 
        if (kvm_is_device_pfn(pfn)) {
                device = true;
+               force_pte = true;
        } else if (logging_active && !write_fault) {
                /*
                 * Only actually map the page as writable if this was a write
index d9117bc..d0868d0 100644 (file)
@@ -95,7 +95,7 @@ static bool __vcpu_read_sys_reg_from_cpu(int reg, u64 *val)
        case AMAIR_EL1:         *val = read_sysreg_s(SYS_AMAIR_EL12);   break;
        case CNTKCTL_EL1:       *val = read_sysreg_s(SYS_CNTKCTL_EL12); break;
        case ELR_EL1:           *val = read_sysreg_s(SYS_ELR_EL12);     break;
-       case PAR_EL1:           *val = read_sysreg_s(SYS_PAR_EL1);      break;
+       case PAR_EL1:           *val = read_sysreg_par();               break;
        case DACR32_EL2:        *val = read_sysreg_s(SYS_DACR32_EL2);   break;
        case IFSR32_EL2:        *val = read_sysreg_s(SYS_IFSR32_EL2);   break;
        case DBGVCR32_EL2:      *val = read_sysreg_s(SYS_DBGVCR32_EL2); break;
@@ -1069,7 +1069,7 @@ static bool trap_ptrauth(struct kvm_vcpu *vcpu,
 static unsigned int ptrauth_visibility(const struct kvm_vcpu *vcpu,
                        const struct sys_reg_desc *rd)
 {
-       return vcpu_has_ptrauth(vcpu) ? 0 : REG_HIDDEN_USER | REG_HIDDEN_GUEST;
+       return vcpu_has_ptrauth(vcpu) ? 0 : REG_HIDDEN;
 }
 
 #define __PTRAUTH_KEY(k)                                               \
@@ -1153,6 +1153,22 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu,
        return val;
 }
 
+static unsigned int id_visibility(const struct kvm_vcpu *vcpu,
+                                 const struct sys_reg_desc *r)
+{
+       u32 id = sys_reg((u32)r->Op0, (u32)r->Op1,
+                        (u32)r->CRn, (u32)r->CRm, (u32)r->Op2);
+
+       switch (id) {
+       case SYS_ID_AA64ZFR0_EL1:
+               if (!vcpu_has_sve(vcpu))
+                       return REG_RAZ;
+               break;
+       }
+
+       return 0;
+}
+
 /* cpufeature ID register access trap handlers */
 
 static bool __access_id_reg(struct kvm_vcpu *vcpu,
@@ -1171,7 +1187,9 @@ static bool access_id_reg(struct kvm_vcpu *vcpu,
                          struct sys_reg_params *p,
                          const struct sys_reg_desc *r)
 {
-       return __access_id_reg(vcpu, p, r, false);
+       bool raz = sysreg_visible_as_raz(vcpu, r);
+
+       return __access_id_reg(vcpu, p, r, raz);
 }
 
 static bool access_raz_id_reg(struct kvm_vcpu *vcpu,
@@ -1192,72 +1210,7 @@ static unsigned int sve_visibility(const struct kvm_vcpu *vcpu,
        if (vcpu_has_sve(vcpu))
                return 0;
 
-       return REG_HIDDEN_USER | REG_HIDDEN_GUEST;
-}
-
-/* Visibility overrides for SVE-specific ID registers */
-static unsigned int sve_id_visibility(const struct kvm_vcpu *vcpu,
-                                     const struct sys_reg_desc *rd)
-{
-       if (vcpu_has_sve(vcpu))
-               return 0;
-
-       return REG_HIDDEN_USER;
-}
-
-/* Generate the emulated ID_AA64ZFR0_EL1 value exposed to the guest */
-static u64 guest_id_aa64zfr0_el1(const struct kvm_vcpu *vcpu)
-{
-       if (!vcpu_has_sve(vcpu))
-               return 0;
-
-       return read_sanitised_ftr_reg(SYS_ID_AA64ZFR0_EL1);
-}
-
-static bool access_id_aa64zfr0_el1(struct kvm_vcpu *vcpu,
-                                  struct sys_reg_params *p,
-                                  const struct sys_reg_desc *rd)
-{
-       if (p->is_write)
-               return write_to_read_only(vcpu, p, rd);
-
-       p->regval = guest_id_aa64zfr0_el1(vcpu);
-       return true;
-}
-
-static int get_id_aa64zfr0_el1(struct kvm_vcpu *vcpu,
-               const struct sys_reg_desc *rd,
-               const struct kvm_one_reg *reg, void __user *uaddr)
-{
-       u64 val;
-
-       if (WARN_ON(!vcpu_has_sve(vcpu)))
-               return -ENOENT;
-
-       val = guest_id_aa64zfr0_el1(vcpu);
-       return reg_to_user(uaddr, &val, reg->id);
-}
-
-static int set_id_aa64zfr0_el1(struct kvm_vcpu *vcpu,
-               const struct sys_reg_desc *rd,
-               const struct kvm_one_reg *reg, void __user *uaddr)
-{
-       const u64 id = sys_reg_to_index(rd);
-       int err;
-       u64 val;
-
-       if (WARN_ON(!vcpu_has_sve(vcpu)))
-               return -ENOENT;
-
-       err = reg_from_user(&val, uaddr, id);
-       if (err)
-               return err;
-
-       /* This is what we mean by invariant: you can't change it. */
-       if (val != guest_id_aa64zfr0_el1(vcpu))
-               return -EINVAL;
-
-       return 0;
+       return REG_HIDDEN;
 }
 
 /*
@@ -1299,13 +1252,17 @@ static int __set_id_reg(const struct kvm_vcpu *vcpu,
 static int get_id_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
                      const struct kvm_one_reg *reg, void __user *uaddr)
 {
-       return __get_id_reg(vcpu, rd, uaddr, false);
+       bool raz = sysreg_visible_as_raz(vcpu, rd);
+
+       return __get_id_reg(vcpu, rd, uaddr, raz);
 }
 
 static int set_id_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
                      const struct kvm_one_reg *reg, void __user *uaddr)
 {
-       return __set_id_reg(vcpu, rd, uaddr, false);
+       bool raz = sysreg_visible_as_raz(vcpu, rd);
+
+       return __set_id_reg(vcpu, rd, uaddr, raz);
 }
 
 static int get_raz_id_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
@@ -1397,6 +1354,7 @@ static bool access_mte_regs(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
        .access = access_id_reg,                \
        .get_user = get_id_reg,                 \
        .set_user = set_id_reg,                 \
+       .visibility = id_visibility,            \
 }
 
 /*
@@ -1518,7 +1476,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
        ID_SANITISED(ID_AA64PFR1_EL1),
        ID_UNALLOCATED(4,2),
        ID_UNALLOCATED(4,3),
-       { SYS_DESC(SYS_ID_AA64ZFR0_EL1), access_id_aa64zfr0_el1, .get_user = get_id_aa64zfr0_el1, .set_user = set_id_aa64zfr0_el1, .visibility = sve_id_visibility },
+       ID_SANITISED(ID_AA64ZFR0_EL1),
        ID_UNALLOCATED(4,5),
        ID_UNALLOCATED(4,6),
        ID_UNALLOCATED(4,7),
@@ -1897,9 +1855,9 @@ static const struct sys_reg_desc cp14_regs[] = {
        { Op1( 0), CRn( 0), CRm( 1), Op2( 0), trap_raz_wi },
        DBG_BCR_BVR_WCR_WVR(1),
        /* DBGDCCINT */
-       { Op1( 0), CRn( 0), CRm( 2), Op2( 0), trap_debug32 },
+       { Op1( 0), CRn( 0), CRm( 2), Op2( 0), trap_debug32, NULL, cp14_DBGDCCINT },
        /* DBGDSCRext */
-       { Op1( 0), CRn( 0), CRm( 2), Op2( 2), trap_debug32 },
+       { Op1( 0), CRn( 0), CRm( 2), Op2( 2), trap_debug32, NULL, cp14_DBGDSCRext },
        DBG_BCR_BVR_WCR_WVR(2),
        /* DBGDTR[RT]Xint */
        { Op1( 0), CRn( 0), CRm( 3), Op2( 0), trap_raz_wi },
@@ -1914,7 +1872,7 @@ static const struct sys_reg_desc cp14_regs[] = {
        { Op1( 0), CRn( 0), CRm( 6), Op2( 2), trap_raz_wi },
        DBG_BCR_BVR_WCR_WVR(6),
        /* DBGVCR */
-       { Op1( 0), CRn( 0), CRm( 7), Op2( 0), trap_debug32 },
+       { Op1( 0), CRn( 0), CRm( 7), Op2( 0), trap_debug32, NULL, cp14_DBGVCR },
        DBG_BCR_BVR_WCR_WVR(7),
        DBG_BCR_BVR_WCR_WVR(8),
        DBG_BCR_BVR_WCR_WVR(9),
@@ -2185,7 +2143,7 @@ static void perform_access(struct kvm_vcpu *vcpu,
        trace_kvm_sys_access(*vcpu_pc(vcpu), params, r);
 
        /* Check for regs disabled by runtime config */
-       if (sysreg_hidden_from_guest(vcpu, r)) {
+       if (sysreg_hidden(vcpu, r)) {
                kvm_inject_undefined(vcpu);
                return;
        }
@@ -2684,7 +2642,7 @@ int kvm_arm_sys_reg_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg
                return get_invariant_sys_reg(reg->id, uaddr);
 
        /* Check for regs disabled by runtime config */
-       if (sysreg_hidden_from_user(vcpu, r))
+       if (sysreg_hidden(vcpu, r))
                return -ENOENT;
 
        if (r->get_user)
@@ -2709,7 +2667,7 @@ int kvm_arm_sys_reg_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg
                return set_invariant_sys_reg(reg->id, uaddr);
 
        /* Check for regs disabled by runtime config */
-       if (sysreg_hidden_from_user(vcpu, r))
+       if (sysreg_hidden(vcpu, r))
                return -ENOENT;
 
        if (r->set_user)
@@ -2780,7 +2738,7 @@ static int walk_one_sys_reg(const struct kvm_vcpu *vcpu,
        if (!(rd->reg || rd->get_user))
                return 0;
 
-       if (sysreg_hidden_from_user(vcpu, rd))
+       if (sysreg_hidden(vcpu, rd))
                return 0;
 
        if (!copy_reg_to_user(rd, uind))
index 5a6fc30..0f95964 100644 (file)
@@ -59,8 +59,8 @@ struct sys_reg_desc {
                                   const struct sys_reg_desc *rd);
 };
 
-#define REG_HIDDEN_USER                (1 << 0) /* hidden from userspace ioctls */
-#define REG_HIDDEN_GUEST       (1 << 1) /* hidden from guest */
+#define REG_HIDDEN             (1 << 0) /* hidden from userspace and guest */
+#define REG_RAZ                        (1 << 1) /* RAZ from userspace and guest */
 
 static __printf(2, 3)
 inline void print_sys_reg_msg(const struct sys_reg_params *p,
@@ -111,22 +111,22 @@ static inline void reset_val(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r
        __vcpu_sys_reg(vcpu, r->reg) = r->val;
 }
 
-static inline bool sysreg_hidden_from_guest(const struct kvm_vcpu *vcpu,
-                                           const struct sys_reg_desc *r)
+static inline bool sysreg_hidden(const struct kvm_vcpu *vcpu,
+                                const struct sys_reg_desc *r)
 {
        if (likely(!r->visibility))
                return false;
 
-       return r->visibility(vcpu, r) & REG_HIDDEN_GUEST;
+       return r->visibility(vcpu, r) & REG_HIDDEN;
 }
 
-static inline bool sysreg_hidden_from_user(const struct kvm_vcpu *vcpu,
-                                          const struct sys_reg_desc *r)
+static inline bool sysreg_visible_as_raz(const struct kvm_vcpu *vcpu,
+                                        const struct sys_reg_desc *r)
 {
        if (likely(!r->visibility))
                return false;
 
-       return r->visibility(vcpu, r) & REG_HIDDEN_USER;
+       return r->visibility(vcpu, r) & REG_RAZ;
 }
 
 static inline int cmp_sys_reg(const struct sys_reg_desc *i1,
index e0bf83d..dc8d2a2 100644 (file)
@@ -56,9 +56,8 @@
        stp \reg1, \reg2, [\ptr], \val
        .endm
 
-       .weak memcpy
 SYM_FUNC_START_ALIAS(__memcpy)
-SYM_FUNC_START_PI(memcpy)
+SYM_FUNC_START_WEAK_PI(memcpy)
 #include "copy_template.S"
        ret
 SYM_FUNC_END_PI(memcpy)
index 02cda2e..1035dce 100644 (file)
@@ -45,9 +45,8 @@ C_h   .req    x12
 D_l    .req    x13
 D_h    .req    x14
 
-       .weak memmove
 SYM_FUNC_START_ALIAS(__memmove)
-SYM_FUNC_START_PI(memmove)
+SYM_FUNC_START_WEAK_PI(memmove)
        cmp     dstin, src
        b.lo    __memcpy
        add     tmp1, src, count
index 77c3c7b..a9c1c9a 100644 (file)
@@ -42,9 +42,8 @@ dst           .req    x8
 tmp3w          .req    w9
 tmp3           .req    x9
 
-       .weak memset
 SYM_FUNC_START_ALIAS(__memset)
-SYM_FUNC_START_PI(memset)
+SYM_FUNC_START_WEAK_PI(memset)
        mov     dst, dstin      /* Preserve return value.  */
        and     A_lw, val, #255
        orr     A_lw, A_lw, A_lw, lsl #8
index 94c99c1..1ee9400 100644 (file)
@@ -262,7 +262,7 @@ static bool __kprobes is_spurious_el1_translation_fault(unsigned long addr,
        local_irq_save(flags);
        asm volatile("at s1e1r, %0" :: "r" (addr));
        isb();
-       par = read_sysreg(par_el1);
+       par = read_sysreg_par();
        local_irq_restore(flags);
 
        /*
index beff3ad..1c0f3e0 100644 (file)
@@ -43,7 +43,7 @@
 u64 idmap_t0sz = TCR_T0SZ(VA_BITS);
 u64 idmap_ptrs_per_pgd = PTRS_PER_PGD;
 
-u64 __section(.mmuoff.data.write) vabits_actual;
+u64 __section(".mmuoff.data.write") vabits_actual;
 EXPORT_SYMBOL(vabits_actual);
 
 u64 kimage_voffset __ro_after_init;
index 2b135ce..bd1e662 100644 (file)
 #include <linux/compiler.h>
 
 /* Tag variables with this */
-#define __tcmdata __section(.tcm.data)
+#define __tcmdata __section(".tcm.data")
 /* Tag constants with this */
-#define __tcmconst __section(.tcm.rodata)
+#define __tcmconst __section(".tcm.rodata")
 /* Tag functions inside TCM called from outside TCM with this */
-#define __tcmfunc __section(.tcm.text) noinline
+#define __tcmfunc __section(".tcm.text") noinline
 /* Tag function inside TCM called from inside TCM  with this */
-#define __tcmlocalfunc __section(.tcm.text)
+#define __tcmlocalfunc __section(".tcm.text")
 
 void *tcm_alloc(size_t len);
 void tcm_free(void *addr, size_t len);
index 4eb6f74..2f1c706 100644 (file)
@@ -25,6 +25,6 @@
 # define SMP_CACHE_BYTES       (1 << 3)
 #endif
 
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(".data..read_mostly")
 
 #endif /* _ASM_IA64_CACHE_H */
index 2310daf..333b096 100644 (file)
@@ -46,7 +46,7 @@ DEFINE_PER_CPU(unsigned int, CURRENT_SAVE);   /* Saved current pointer */
  * ASM code. Default position is BSS section which is cleared
  * in machine_early_init().
  */
-char cmd_line[COMMAND_LINE_SIZE] __attribute__ ((section(".data")));
+char cmd_line[COMMAND_LINE_SIZE] __section(".data");
 
 void __init setup_arch(char **cmdline_p)
 {
index beec241..5acb49b 100644 (file)
                        status = "disabled";
                };
 
+               periph_pwr: power-controller@1000184c {
+                       compatible = "brcm,bcm6328-power-controller";
+                       reg = <0x1000184c 0x4>;
+                       #power-domain-cells = <1>;
+               };
+
                ehci: usb@10002500 {
                        compatible = "brcm,bcm63268-ehci", "generic-ehci";
                        reg = <0x10002500 0x100>;
index af860d0..1f9edd7 100644 (file)
                        status = "disabled";
                };
 
+               periph_pwr: power-controller@10001848 {
+                       compatible = "brcm,bcm6328-power-controller";
+                       reg = <0x10001848 0x4>;
+                       #power-domain-cells = <1>;
+               };
+
                ehci: usb@10002500 {
                        compatible = "brcm,bcm6328-ehci", "generic-ehci";
                        reg = <0x10002500 0x100>;
index 8ae6981..c98f911 100644 (file)
                        status = "disabled";
                };
 
+               periph_pwr: power-controller@10001848 {
+                       compatible = "brcm,bcm6362-power-controller";
+                       reg = <0x10001848 0x4>;
+                       #power-domain-cells = <1>;
+               };
+
                leds0: led-controller@10001900 {
                        #address-cells = <1>;
                        #size-cells = <0>;
index 9085f4d..599d560 100644 (file)
@@ -230,7 +230,6 @@ CONFIG_DSCC4_PCISYNC=y
 CONFIG_DSCC4_PCI_RST=y
 CONFIG_DLCI=m
 CONFIG_LAPBETHER=m
-CONFIG_X25_ASY=m
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
index 914af12..dc69b05 100644 (file)
@@ -380,7 +380,6 @@ CONFIG_DSCC4_PCISYNC=y
 CONFIG_DSCC4_PCI_RST=y
 CONFIG_DLCI=m
 CONFIG_LAPBETHER=m
-CONFIG_X25_ASY=m
 # CONFIG_KEYBOARD_ATKBD is not set
 CONFIG_KEYBOARD_GPIO=y
 # CONFIG_INPUT_MOUSE is not set
index 8b14c27..29187e1 100644 (file)
@@ -14,6 +14,6 @@
 #define L1_CACHE_SHIFT         CONFIG_MIPS_L1_CACHE_SHIFT
 #define L1_CACHE_BYTES         (1 << L1_CACHE_SHIFT)
 
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(".data..read_mostly")
 
 #endif /* _ASM_CACHE_H */
index 29ca344..fc64cce 100644 (file)
@@ -23,7 +23,7 @@ extern long __mips_machines_end;
 
 #define MIPS_MACHINE(name)                                             \
        static const struct mips_machine __mips_mach_##name             \
-               __used __section(.mips.machines.init)
+               __used __section(".mips.machines.init")
 
 #define for_each_mips_machine(mach)                                    \
        for ((mach) = (struct mips_machine *)&__mips_machines_start;    \
index fccdbe2..0d42532 100644 (file)
@@ -44,7 +44,7 @@
 #include <asm/prom.h>
 
 #ifdef CONFIG_MIPS_ELF_APPENDED_DTB
-const char __section(.appended_dtb) __appended_dtb[0x100000];
+const char __section(".appended_dtb") __appended_dtb[0x100000];
 #endif /* CONFIG_MIPS_ELF_APPENDED_DTB */
 
 struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
index 6c7bbfe..07e84a7 100644 (file)
@@ -569,7 +569,7 @@ unsigned long pgd_current[NR_CPUS];
  * size, and waste space.  So we place it in its own section and align
  * it in the linker script.
  */
-pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(.bss..swapper_pg_dir);
+pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(".bss..swapper_pg_dir");
 #ifndef __PAGETABLE_PUD_FOLDED
 pud_t invalid_pud_table[PTRS_PER_PUD] __page_aligned_bss;
 #endif
index e5de3f8..d53e9e2 100644 (file)
@@ -22,7 +22,7 @@
 
 #define ARCH_DMA_MINALIGN      L1_CACHE_BYTES
 
-#define __read_mostly __section(.data..read_mostly)
+#define __read_mostly __section(".data..read_mostly")
 
 void parisc_cache_init(void);  /* initializes cache-flushing */
 void disable_sr_hashing_asm(int); /* low level support for above */
index e080143..6d28b55 100644 (file)
@@ -52,7 +52,7 @@
 })
 
 #ifdef CONFIG_SMP
-# define __lock_aligned __section(.data..lock_aligned)
+# define __lock_aligned __section(".data..lock_aligned")
 #endif
 
 #endif /* __PARISC_LDCW_H */
index 4bab21c..63e3ecb 100644 (file)
@@ -21,7 +21,7 @@
 #include <asm/ftrace.h>
 #include <asm/patch.h>
 
-#define __hot __attribute__ ((__section__ (".text.hot")))
+#define __hot __section(".text.hot")
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 /*
index 5d458a4..9549496 100644 (file)
@@ -6,7 +6,7 @@
  *    Copyright (C) 1999-2003 Matthew Wilcox <willy at parisc-linux.org>
  *    Copyright (C) 2000-2003 Paul Bame <bame at parisc-linux.org>
  *    Copyright (C) 2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org>
- *    Copyright (C) 1999-2014 Helge Deller <deller@gmx.de>
+ *    Copyright (C) 1999-2020 Helge Deller <deller@gmx.de>
  */
 
 #include <linux/uaccess.h>
@@ -23,6 +23,7 @@
 #include <linux/utsname.h>
 #include <linux/personality.h>
 #include <linux/random.h>
+#include <linux/compat.h>
 
 /* we construct an artificial offset for the mapping based on the physical
  * address of the kernel mapping variable */
@@ -373,3 +374,73 @@ long parisc_personality(unsigned long personality)
 
        return err;
 }
+
+/*
+ * Up to kernel v5.9 we defined O_NONBLOCK as 000200004,
+ * since then O_NONBLOCK is defined as 000200000.
+ *
+ * The following wrapper functions mask out the old
+ * O_NDELAY bit from calls which use O_NONBLOCK.
+ *
+ * XXX: Remove those in year 2022 (or later)?
+ */
+
+#define O_NONBLOCK_OLD         000200004
+#define O_NONBLOCK_MASK_OUT    (O_NONBLOCK_OLD & ~O_NONBLOCK)
+
+static int FIX_O_NONBLOCK(int flags)
+{
+       if (flags & O_NONBLOCK_MASK_OUT) {
+               struct task_struct *tsk = current;
+               pr_warn_once("%s(%d) uses a deprecated O_NONBLOCK value.\n",
+                       tsk->comm, tsk->pid);
+       }
+       return flags & ~O_NONBLOCK_MASK_OUT;
+}
+
+asmlinkage long parisc_timerfd_create(int clockid, int flags)
+{
+       flags = FIX_O_NONBLOCK(flags);
+       return sys_timerfd_create(clockid, flags);
+}
+
+asmlinkage long parisc_signalfd4(int ufd, sigset_t __user *user_mask,
+       size_t sizemask, int flags)
+{
+       flags = FIX_O_NONBLOCK(flags);
+       return sys_signalfd4(ufd, user_mask, sizemask, flags);
+}
+
+#ifdef CONFIG_COMPAT
+asmlinkage long parisc_compat_signalfd4(int ufd,
+       compat_sigset_t __user *user_mask,
+       compat_size_t sizemask, int flags)
+{
+       flags = FIX_O_NONBLOCK(flags);
+       return compat_sys_signalfd4(ufd, user_mask, sizemask, flags);
+}
+#endif
+
+asmlinkage long parisc_eventfd2(unsigned int count, int flags)
+{
+       flags = FIX_O_NONBLOCK(flags);
+       return sys_eventfd2(count, flags);
+}
+
+asmlinkage long parisc_userfaultfd(int flags)
+{
+       flags = FIX_O_NONBLOCK(flags);
+       return sys_userfaultfd(flags);
+}
+
+asmlinkage long parisc_pipe2(int __user *fildes, int flags)
+{
+       flags = FIX_O_NONBLOCK(flags);
+       return sys_pipe2(fildes, flags);
+}
+
+asmlinkage long parisc_inotify_init1(int flags)
+{
+       flags = FIX_O_NONBLOCK(flags);
+       return sys_inotify_init1(flags);
+}
index 38c63e5..f375ea5 100644 (file)
 304    common  eventfd                 sys_eventfd
 305    32      fallocate               parisc_fallocate
 305    64      fallocate               sys_fallocate
-306    common  timerfd_create          sys_timerfd_create
+306    common  timerfd_create          parisc_timerfd_create
 307    32      timerfd_settime         sys_timerfd_settime32
 307    64      timerfd_settime         sys_timerfd_settime
 308    32      timerfd_gettime         sys_timerfd_gettime32
 308    64      timerfd_gettime         sys_timerfd_gettime
-309    common  signalfd4               sys_signalfd4                   compat_sys_signalfd4
-310    common  eventfd2                sys_eventfd2
+309    common  signalfd4               parisc_signalfd4                parisc_compat_signalfd4
+310    common  eventfd2                parisc_eventfd2
 311    common  epoll_create1           sys_epoll_create1
 312    common  dup3                    sys_dup3
-313    common  pipe2                   sys_pipe2
-314    common  inotify_init1           sys_inotify_init1
+313    common  pipe2                   parisc_pipe2
+314    common  inotify_init1           parisc_inotify_init1
 315    common  preadv  sys_preadv      compat_sys_preadv
 316    common  pwritev sys_pwritev     compat_sys_pwritev
 317    common  rt_tgsigqueueinfo       sys_rt_tgsigqueueinfo           compat_sys_rt_tgsigqueueinfo
 341    common  bpf                     sys_bpf
 342    common  execveat                sys_execveat                    compat_sys_execveat
 343    common  membarrier              sys_membarrier
-344    common  userfaultfd             sys_userfaultfd
+344    common  userfaultfd             parisc_userfaultfd
 345    common  mlock2                  sys_mlock2
 346    common  copy_file_range         sys_copy_file_range
 347    common  preadv2                 sys_preadv2                     compat_sys_preadv2
index 0450815..13d94f0 100644 (file)
@@ -180,9 +180,16 @@ static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm)
 static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm)
 {
        time64_t secs = rtc_tm_to_time64(tm);
-
-       if (pdc_tod_set(secs, 0) < 0)
+       int ret;
+
+       /* hppa has Y2K38 problem: pdc_tod_set() takes an u32 value! */
+       ret = pdc_tod_set(secs, 0);
+       if (ret != 0) {
+               pr_warn("pdc_tod_set(%lld) returned error %d\n", secs, ret);
+               if (ret == PDC_INVALID_ARG)
+                       return -EINVAL;
                return -EOPNOTSUPP;
+       }
 
        return 0;
 }
index 4381b65..3ec633b 100644 (file)
@@ -42,11 +42,11 @@ extern void parisc_kernel_start(void);      /* Kernel entry point in head.S */
  * guarantee that global objects will be laid out in memory in the same order
  * as the order of declaration, so put these in different sections and use
  * the linker script to order them. */
-pmd_t pmd0[PTRS_PER_PMD] __attribute__ ((__section__ (".data..vm0.pmd"), aligned(PAGE_SIZE)));
+pmd_t pmd0[PTRS_PER_PMD] __section(".data..vm0.pmd") __attribute__ ((aligned(PAGE_SIZE)));
 #endif
 
-pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__ ((__section__ (".data..vm0.pgd"), aligned(PAGE_SIZE)));
-pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((__section__ (".data..vm0.pte"), aligned(PAGE_SIZE)));
+pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(".data..vm0.pgd") __attribute__ ((aligned(PAGE_SIZE)));
+pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __section(".data..vm0.pte") __attribute__ ((aligned(PAGE_SIZE)));
 
 static struct resource data_resource = {
        .name   = "Kernel data",
index 082c153..0ce2368 100644 (file)
 #  define __ASM_CONST(x)       x##UL
 #  define ASM_CONST(x)         __ASM_CONST(x)
 #endif
+
+/*
+ * Inline assembly memory constraint
+ *
+ * GCC 4.9 doesn't properly handle pre update memory constraint "m<>"
+ *
+ */
+#if defined(GCC_VERSION) && GCC_VERSION < 50000
+#define UPD_CONSTR ""
+#else
+#define UPD_CONSTR "<>"
+#endif
+
 #endif /* _ASM_POWERPC_ASM_CONST_H */
index 2124b70..ae0a68a 100644 (file)
@@ -97,7 +97,7 @@ static inline u32 l1_icache_bytes(void)
 
 #endif
 
-#define __read_mostly __section(.data..read_mostly)
+#define __read_mostly __section(".data..read_mostly")
 
 #ifdef CONFIG_PPC_BOOK3S_32
 extern long _get_L2CR(void);
index 93bc70d..3d2f94a 100644 (file)
@@ -477,7 +477,7 @@ static inline void cpu_feature_keys_init(void) { }
            CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
            CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
            CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \
-           CPU_FTR_TM_COMP | CPU_FTR_ARCH_300 | CPU_FTR_ARCH_31 | \
+           CPU_FTR_ARCH_300 | CPU_FTR_ARCH_31 | \
            CPU_FTR_DAWR | CPU_FTR_DAWR1)
 #define CPU_FTRS_CELL  (CPU_FTR_LWSYNC | \
            CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
index 9508107..475687f 100644 (file)
@@ -232,7 +232,7 @@ extern void book3e_idle(void);
 extern struct machdep_calls ppc_md;
 extern struct machdep_calls *machine_id;
 
-#define __machine_desc __attribute__ ((__section__ (".machine.desc")))
+#define __machine_desc __section(".machine.desc")
 
 #define define_machine(name)                                   \
        extern struct machdep_calls mach_##name;                \
index 85ed239..567cdc5 100644 (file)
@@ -63,7 +63,7 @@ static inline void restore_user_access(unsigned long flags)
 static inline bool
 bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
 {
-       return WARN(!((regs->kuap ^ MD_APG_KUAP) & 0xf0000000),
+       return WARN(!((regs->kuap ^ MD_APG_KUAP) & 0xff000000),
                    "Bug: fault blocked by AP register !");
 }
 
index 1d9ac0f..0bd1b14 100644 (file)
  * respectively NA for All or X for Supervisor and no access for User.
  * Then we use the APG to say whether accesses are according to Page rules or
  * "all Supervisor" rules (Access to all)
- * Therefore, we define 2 APG groups. lsb is _PMD_USER
- * 0 => Kernel => 01 (all accesses performed according to page definition)
- * 1 => User => 00 (all accesses performed as supervisor iaw page definition)
- * 2-15 => Not Used
- */
-#define MI_APG_INIT    0x40000000
-
-/*
- * 0 => Kernel => 01 (all accesses performed according to page definition)
- * 1 => User => 10 (all accesses performed according to swaped page definition)
- * 2-15 => Not Used
- */
-#define MI_APG_KUEP    0x60000000
+ * _PAGE_ACCESSED is also managed via APG. When _PAGE_ACCESSED is not set, say
+ * "all User" rules, that will lead to NA for all.
+ * Therefore, we define 4 APG groups. lsb is _PAGE_ACCESSED
+ * 0 => Kernel => 11 (all accesses performed according as user iaw page definition)
+ * 1 => Kernel+Accessed => 01 (all accesses performed according to page definition)
+ * 2 => User => 11 (all accesses performed according as user iaw page definition)
+ * 3 => User+Accessed => 00 (all accesses performed as supervisor iaw page definition) for INIT
+ *                    => 10 (all accesses performed according to swaped page definition) for KUEP
+ * 4-15 => Not Used
+ */
+#define MI_APG_INIT    0xdc000000
+#define MI_APG_KUEP    0xde000000
 
 /* The effective page number register.  When read, contains the information
  * about the last instruction TLB miss.  When MI_RPN is written, bits in
 #define MD_Ks          0x80000000      /* Should not be set */
 #define MD_Kp          0x40000000      /* Should always be set */
 
-/*
- * All pages' PP data bits are set to either 000 or 011 or 001, which means
- * respectively RW for Supervisor and no access for User, or RO for
- * Supervisor and no access for user and NA for ALL.
- * Then we use the APG to say whether accesses are according to Page rules or
- * "all Supervisor" rules (Access to all)
- * Therefore, we define 2 APG groups. lsb is _PMD_USER
- * 0 => Kernel => 01 (all accesses performed according to page definition)
- * 1 => User => 00 (all accesses performed as supervisor iaw page definition)
- * 2-15 => Not Used
- */
-#define MD_APG_INIT    0x40000000
-
-/*
- * 0 => No user => 01 (all accesses performed according to page definition)
- * 1 => User => 10 (all accesses performed according to swaped page definition)
- * 2-15 => Not Used
- */
-#define MD_APG_KUAP    0x60000000
+/* See explanation above at the definition of MI_APG_INIT */
+#define MD_APG_INIT    0xdc000000
+#define MD_APG_KUAP    0xde000000
 
 /* The effective page number register.  When read, contains the information
  * about the last instruction TLB miss.  When MD_RPN is written, bits in
index 66f403a..1581204 100644 (file)
@@ -39,9 +39,9 @@
  * into the TLB.
  */
 #define _PAGE_GUARDED  0x0010  /* Copied to L1 G entry in DTLB */
-#define _PAGE_SPECIAL  0x0020  /* SW entry */
+#define _PAGE_ACCESSED 0x0020  /* Copied to L1 APG 1 entry in I/DTLB */
 #define _PAGE_EXEC     0x0040  /* Copied to PP (bit 21) in ITLB */
-#define _PAGE_ACCESSED 0x0080  /* software: page referenced */
+#define _PAGE_SPECIAL  0x0080  /* SW entry */
 
 #define _PAGE_NA       0x0200  /* Supervisor NA, User no access */
 #define _PAGE_RO       0x0600  /* Supervisor RO, User no access */
 
 #define _PMD_PRESENT   0x0001
 #define _PMD_PRESENT_MASK      _PMD_PRESENT
-#define _PMD_BAD       0x0fd0
+#define _PMD_BAD       0x0f90
 #define _PMD_PAGE_MASK 0x000c
 #define _PMD_PAGE_8M   0x000c
 #define _PMD_PAGE_512K 0x0004
-#define _PMD_USER      0x0020  /* APG 1 */
+#define _PMD_ACCESSED  0x0020  /* APG 1 */
+#define _PMD_USER      0x0040  /* APG 2 */
 
 #define _PTE_NONE_MASK 0
 
index 8728590..3beeb03 100644 (file)
@@ -6,6 +6,7 @@
 
 struct device;
 struct device_node;
+struct drmem_lmb;
 
 #ifdef CONFIG_NUMA
 
@@ -61,6 +62,9 @@ static inline int early_cpu_to_node(int cpu)
         */
        return (nid < 0) ? 0 : nid;
 }
+
+int of_drconf_to_nid_single(struct drmem_lmb *lmb);
+
 #else
 
 static inline int early_cpu_to_node(int cpu) { return 0; }
@@ -84,10 +88,12 @@ static inline int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
        return 0;
 }
 
-#endif /* CONFIG_NUMA */
+static inline int of_drconf_to_nid_single(struct drmem_lmb *lmb)
+{
+       return first_online_node;
+}
 
-struct drmem_lmb;
-int of_drconf_to_nid_single(struct drmem_lmb *lmb);
+#endif /* CONFIG_NUMA */
 
 #if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
 extern int find_and_online_cpu_nid(int cpu);
index 916daa4..501c9a7 100644 (file)
@@ -178,11 +178,11 @@ do {                                                              \
  * are no aliasing issues.
  */
 #define __put_user_asm_goto(x, addr, label, op)                        \
-       asm volatile goto(                                      \
+       asm_volatile_goto(                                      \
                "1:     " op "%U1%X1 %0,%1      # put_user\n"   \
                EX_TABLE(1b, %l2)                               \
                :                                               \
-               : "r" (x), "m<>" (*addr)                                \
+               : "r" (x), "m"UPD_CONSTR (*addr)                \
                :                                               \
                : label)
 
@@ -191,7 +191,7 @@ do {                                                                \
        __put_user_asm_goto(x, ptr, label, "std")
 #else /* __powerpc64__ */
 #define __put_user_asm2_goto(x, addr, label)                   \
-       asm volatile goto(                                      \
+       asm_volatile_goto(                                      \
                "1:     stw%X1 %0, %1\n"                        \
                "2:     stw%X1 %L0, %L1\n"                      \
                EX_TABLE(1b, %l2)                               \
@@ -253,7 +253,7 @@ extern long __get_user_bad(void);
                ".previous\n"                           \
                EX_TABLE(1b, 3b)                        \
                : "=r" (err), "=r" (x)                  \
-               : "m<>" (*addr), "i" (-EFAULT), "0" (err))
+               : "m"UPD_CONSTR (*addr), "i" (-EFAULT), "0" (err))
 
 #ifdef __powerpc64__
 #define __get_user_asm2(x, addr, err)                  \
index c22a8e0..803c2a4 100644 (file)
@@ -26,7 +26,7 @@
 static void scrollscreen(void);
 #endif
 
-#define __force_data __section(.data)
+#define __force_data __section(".data")
 
 static int g_loc_X __force_data;
 static int g_loc_Y __force_data;
index 492c0b3..29de58d 100644 (file)
@@ -121,9 +121,16 @@ extern void __restore_cpu_e6500(void);
                                 PPC_FEATURE2_DARN | \
                                 PPC_FEATURE2_SCV)
 #define COMMON_USER_POWER10    COMMON_USER_POWER9
-#define COMMON_USER2_POWER10   (COMMON_USER2_POWER9 | \
-                                PPC_FEATURE2_ARCH_3_1 | \
-                                PPC_FEATURE2_MMA)
+#define COMMON_USER2_POWER10   (PPC_FEATURE2_ARCH_3_1 | \
+                                PPC_FEATURE2_MMA | \
+                                PPC_FEATURE2_ARCH_3_00 | \
+                                PPC_FEATURE2_HAS_IEEE128 | \
+                                PPC_FEATURE2_DARN | \
+                                PPC_FEATURE2_SCV | \
+                                PPC_FEATURE2_ARCH_2_07 | \
+                                PPC_FEATURE2_DSCR | \
+                                PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | \
+                                PPC_FEATURE2_VEC_CRYPTO)
 
 #ifdef CONFIG_PPC_BOOK3E_64
 #define COMMON_USER_BOOKE      (COMMON_USER_PPC64 | PPC_FEATURE_BOOKE)
index 0e160df..813713c 100644 (file)
@@ -466,11 +466,6 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
                return 0;
        }
 
-       if (!pe->addr) {
-               eeh_stats.no_cfg_addr++;
-               return 0;
-       }
-
        /*
         * On PowerNV platform, we might already have fenced PHB
         * there and we need take care of that firstly.
index 6b50bf1..bf32704 100644 (file)
@@ -264,8 +264,9 @@ static int eeh_addr_cache_show(struct seq_file *s, void *v)
 {
        struct pci_io_addr_range *piar;
        struct rb_node *n;
+       unsigned long flags;
 
-       spin_lock(&pci_io_addr_cache_root.piar_lock);
+       spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
        for (n = rb_first(&pci_io_addr_cache_root.rb_root); n; n = rb_next(n)) {
                piar = rb_entry(n, struct pci_io_addr_range, rb_node);
 
@@ -273,7 +274,7 @@ static int eeh_addr_cache_show(struct seq_file *s, void *v)
                       (piar->flags & IORESOURCE_IO) ? "i/o" : "mem",
                       &piar->addr_lo, &piar->addr_hi, pci_name(piar->pcidev));
        }
-       spin_unlock(&pci_io_addr_cache_root.piar_lock);
+       spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
 
        return 0;
 }
index 44c9018..a1ae006 100644 (file)
@@ -284,11 +284,7 @@ _ENTRY(saved_ksp_limit)
 
        rlwimi  r11, r10, 22, 20, 29    /* Compute PTE address */
        lwz     r11, 0(r11)             /* Get Linux PTE */
-#ifdef CONFIG_SWAP
        li      r9, _PAGE_PRESENT | _PAGE_ACCESSED
-#else
-       li      r9, _PAGE_PRESENT
-#endif
        andc.   r9, r9, r11             /* Check permission */
        bne     5f
 
@@ -369,11 +365,7 @@ _ENTRY(saved_ksp_limit)
 
        rlwimi  r11, r10, 22, 20, 29    /* Compute PTE address */
        lwz     r11, 0(r11)             /* Get Linux PTE */
-#ifdef CONFIG_SWAP
        li      r9, _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
-#else
-       li      r9, _PAGE_PRESENT | _PAGE_EXEC
-#endif
        andc.   r9, r9, r11             /* Check permission */
        bne     5f
 
index 9f359d3..ee0bfeb 100644 (file)
@@ -202,9 +202,7 @@ SystemCall:
 
 InstructionTLBMiss:
        mtspr   SPRN_SPRG_SCRATCH0, r10
-#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) || defined(CONFIG_HUGETLBFS)
        mtspr   SPRN_SPRG_SCRATCH1, r11
-#endif
 
        /* If we are faulting a kernel address, we have to use the
         * kernel page tables.
@@ -224,25 +222,13 @@ InstructionTLBMiss:
 3:
        mtcr    r11
 #endif
-#if defined(CONFIG_HUGETLBFS) || !defined(CONFIG_PIN_TLB_TEXT)
        lwz     r11, (swapper_pg_dir-PAGE_OFFSET)@l(r10)        /* Get level 1 entry */
        mtspr   SPRN_MD_TWC, r11
-#else
-       lwz     r10, (swapper_pg_dir-PAGE_OFFSET)@l(r10)        /* Get level 1 entry */
-       mtspr   SPRN_MI_TWC, r10        /* Set segment attributes */
-       mtspr   SPRN_MD_TWC, r10
-#endif
        mfspr   r10, SPRN_MD_TWC
        lwz     r10, 0(r10)     /* Get the pte */
-#if defined(CONFIG_HUGETLBFS) || !defined(CONFIG_PIN_TLB_TEXT)
+       rlwimi  r11, r10, 0, _PAGE_GUARDED | _PAGE_ACCESSED
        rlwimi  r11, r10, 32 - 9, _PMD_PAGE_512K
        mtspr   SPRN_MI_TWC, r11
-#endif
-#ifdef CONFIG_SWAP
-       rlwinm  r11, r10, 32-5, _PAGE_PRESENT
-       and     r11, r11, r10
-       rlwimi  r10, r11, 0, _PAGE_PRESENT
-#endif
        /* The Linux PTE won't go exactly into the MMU TLB.
         * Software indicator bits 20 and 23 must be clear.
         * Software indicator bits 22, 24, 25, 26, and 27 must be
@@ -256,9 +242,7 @@ InstructionTLBMiss:
 
        /* Restore registers */
 0:     mfspr   r10, SPRN_SPRG_SCRATCH0
-#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) || defined(CONFIG_HUGETLBFS)
        mfspr   r11, SPRN_SPRG_SCRATCH1
-#endif
        rfi
        patch_site      0b, patch__itlbmiss_exit_1
 
@@ -268,9 +252,7 @@ InstructionTLBMiss:
        addi    r10, r10, 1
        stw     r10, (itlb_miss_counter - PAGE_OFFSET)@l(0)
        mfspr   r10, SPRN_SPRG_SCRATCH0
-#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP)
        mfspr   r11, SPRN_SPRG_SCRATCH1
-#endif
        rfi
 #endif
 
@@ -297,30 +279,16 @@ DataStoreTLBMiss:
        mfspr   r10, SPRN_MD_TWC
        lwz     r10, 0(r10)     /* Get the pte */
 
-       /* Insert the Guarded flag into the TWC from the Linux PTE.
+       /* Insert Guarded and Accessed flags into the TWC from the Linux PTE.
         * It is bit 27 of both the Linux PTE and the TWC (at least
         * I got that right :-).  It will be better when we can put
         * this into the Linux pgd/pmd and load it in the operation
         * above.
         */
-       rlwimi  r11, r10, 0, _PAGE_GUARDED
+       rlwimi  r11, r10, 0, _PAGE_GUARDED | _PAGE_ACCESSED
        rlwimi  r11, r10, 32 - 9, _PMD_PAGE_512K
        mtspr   SPRN_MD_TWC, r11
 
-       /* Both _PAGE_ACCESSED and _PAGE_PRESENT has to be set.
-        * We also need to know if the insn is a load/store, so:
-        * Clear _PAGE_PRESENT and load that which will
-        * trap into DTLB Error with store bit set accordinly.
-        */
-       /* PRESENT=0x1, ACCESSED=0x20
-        * r11 = ((r10 & PRESENT) & ((r10 & ACCESSED) >> 5));
-        * r10 = (r10 & ~PRESENT) | r11;
-        */
-#ifdef CONFIG_SWAP
-       rlwinm  r11, r10, 32-5, _PAGE_PRESENT
-       and     r11, r11, r10
-       rlwimi  r10, r11, 0, _PAGE_PRESENT
-#endif
        /* The Linux PTE won't go exactly into the MMU TLB.
         * Software indicator bits 24, 25, 26, and 27 must be
         * set.  All other Linux PTE bits control the behavior
@@ -711,7 +679,7 @@ initial_mmu:
        li      r9, 4                           /* up to 4 pages of 8M */
        mtctr   r9
        lis     r9, KERNELBASE@h                /* Create vaddr for TLB */
-       li      r10, MI_PS8MEG | MI_SVALID      /* Set 8M byte page */
+       li      r10, MI_PS8MEG | _PMD_ACCESSED | MI_SVALID
        li      r11, MI_BOOTINIT                /* Create RPN for address 0 */
 1:
        mtspr   SPRN_MI_CTR, r8 /* Set instruction MMU control */
@@ -775,7 +743,7 @@ _GLOBAL(mmu_pin_tlb)
 #ifdef CONFIG_PIN_TLB_TEXT
        LOAD_REG_IMMEDIATE(r5, 28 << 8)
        LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET)
-       LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG)
+       LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG | _PMD_ACCESSED)
        LOAD_REG_IMMEDIATE(r8, 0xf0 | _PAGE_RO | _PAGE_SPS | _PAGE_SH | _PAGE_PRESENT)
        LOAD_REG_ADDR(r9, _sinittext)
        li      r0, 4
@@ -797,7 +765,7 @@ _GLOBAL(mmu_pin_tlb)
        LOAD_REG_IMMEDIATE(r5, 28 << 8 | MD_TWAM)
 #ifdef CONFIG_PIN_TLB_DATA
        LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET)
-       LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG)
+       LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG | _PMD_ACCESSED)
 #ifdef CONFIG_PIN_TLB_IMMR
        li      r0, 3
 #else
@@ -834,7 +802,7 @@ _GLOBAL(mmu_pin_tlb)
 #endif
 #ifdef CONFIG_PIN_TLB_IMMR
        LOAD_REG_IMMEDIATE(r0, VIRT_IMMR_BASE | MD_EVALID)
-       LOAD_REG_IMMEDIATE(r7, MD_SVALID | MD_PS512K | MD_GUARDED)
+       LOAD_REG_IMMEDIATE(r7, MD_SVALID | MD_PS512K | MD_GUARDED | _PMD_ACCESSED)
        mfspr   r8, SPRN_IMMR
        rlwinm  r8, r8, 0, 0xfff80000
        ori     r8, r8, 0xf0 | _PAGE_DIRTY | _PAGE_SPS | _PAGE_SH | \
index 5eb9eed..2aa16d5 100644 (file)
@@ -457,11 +457,7 @@ InstructionTLBMiss:
        cmplw   0,r1,r3
 #endif
        mfspr   r2, SPRN_SPRG_PGDIR
-#ifdef CONFIG_SWAP
        li      r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
-#else
-       li      r1,_PAGE_PRESENT | _PAGE_EXEC
-#endif
 #if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC)
        bgt-    112f
        lis     r2, (swapper_pg_dir - PAGE_OFFSET)@ha   /* if kernel address, use */
@@ -523,11 +519,7 @@ DataLoadTLBMiss:
        lis     r1, TASK_SIZE@h         /* check if kernel address */
        cmplw   0,r1,r3
        mfspr   r2, SPRN_SPRG_PGDIR
-#ifdef CONFIG_SWAP
        li      r1, _PAGE_PRESENT | _PAGE_ACCESSED
-#else
-       li      r1, _PAGE_PRESENT
-#endif
        bgt-    112f
        lis     r2, (swapper_pg_dir - PAGE_OFFSET)@ha   /* if kernel address, use */
        addi    r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l        /* kernel page table */
@@ -603,11 +595,7 @@ DataStoreTLBMiss:
        lis     r1, TASK_SIZE@h         /* check if kernel address */
        cmplw   0,r1,r3
        mfspr   r2, SPRN_SPRG_PGDIR
-#ifdef CONFIG_SWAP
        li      r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | _PAGE_ACCESSED
-#else
-       li      r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT
-#endif
        bgt-    112f
        lis     r2, (swapper_pg_dir - PAGE_OFFSET)@ha   /* if kernel address, use */
        addi    r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l        /* kernel page table */
index ada59f6..63702c0 100644 (file)
@@ -591,12 +591,11 @@ EXPORT_SYMBOL_GPL(machine_check_print_event_info);
 long notrace machine_check_early(struct pt_regs *regs)
 {
        long handled = 0;
-       bool nested = in_nmi();
        u8 ftrace_enabled = this_cpu_get_ftrace_enabled();
 
        this_cpu_set_ftrace_enabled(0);
-
-       if (!nested)
+       /* Do not use nmi_enter/exit for pseries hpte guest */
+       if (radix_enabled() || !firmware_has_feature(FW_FEATURE_LPAR))
                nmi_enter();
 
        hv_nmi_check_nonrecoverable(regs);
@@ -607,7 +606,7 @@ long notrace machine_check_early(struct pt_regs *regs)
        if (ppc_md.machine_check_early)
                handled = ppc_md.machine_check_early(regs);
 
-       if (!nested)
+       if (radix_enabled() || !firmware_has_feature(FW_FEATURE_LPAR))
                nmi_exit();
 
        this_cpu_set_ftrace_enabled(ftrace_enabled);
index 5090a5a..38ae593 100644 (file)
@@ -45,7 +45,7 @@
 #include <linux/linux_logo.h>
 
 /* All of prom_init bss lives here */
-#define __prombss __section(.bss.prominit)
+#define __prombss __section(".bss.prominit")
 
 /*
  * Eventually bump that one up
index 0dc1b85..8c2857c 100644 (file)
@@ -1240,43 +1240,33 @@ static struct device_node *cpu_to_l2cache(int cpu)
        return cache;
 }
 
-static bool update_mask_by_l2(int cpu)
+static bool update_mask_by_l2(int cpu, cpumask_var_t *mask)
 {
        struct cpumask *(*submask_fn)(int) = cpu_sibling_mask;
        struct device_node *l2_cache, *np;
-       cpumask_var_t mask;
        int i;
 
-       l2_cache = cpu_to_l2cache(cpu);
-       if (!l2_cache) {
-               struct cpumask *(*sibling_mask)(int) = cpu_sibling_mask;
-
-               /*
-                * If no l2cache for this CPU, assume all siblings to share
-                * cache with this CPU.
-                */
-               if (has_big_cores)
-                       sibling_mask = cpu_smallcore_mask;
+       if (has_big_cores)
+               submask_fn = cpu_smallcore_mask;
 
-               for_each_cpu(i, sibling_mask(cpu))
+       l2_cache = cpu_to_l2cache(cpu);
+       if (!l2_cache || !*mask) {
+               /* Assume only core siblings share cache with this CPU */
+               for_each_cpu(i, submask_fn(cpu))
                        set_cpus_related(cpu, i, cpu_l2_cache_mask);
 
                return false;
        }
 
-       alloc_cpumask_var_node(&mask, GFP_KERNEL, cpu_to_node(cpu));
-       cpumask_and(mask, cpu_online_mask, cpu_cpu_mask(cpu));
-
-       if (has_big_cores)
-               submask_fn = cpu_smallcore_mask;
+       cpumask_and(*mask, cpu_online_mask, cpu_cpu_mask(cpu));
 
        /* Update l2-cache mask with all the CPUs that are part of submask */
        or_cpumasks_related(cpu, cpu, submask_fn, cpu_l2_cache_mask);
 
        /* Skip all CPUs already part of current CPU l2-cache mask */
-       cpumask_andnot(mask, mask, cpu_l2_cache_mask(cpu));
+       cpumask_andnot(*mask, *mask, cpu_l2_cache_mask(cpu));
 
-       for_each_cpu(i, mask) {
+       for_each_cpu(i, *mask) {
                /*
                 * when updating the marks the current CPU has not been marked
                 * online, but we need to update the cache masks
@@ -1286,15 +1276,14 @@ static bool update_mask_by_l2(int cpu)
                /* Skip all CPUs already part of current CPU l2-cache */
                if (np == l2_cache) {
                        or_cpumasks_related(cpu, i, submask_fn, cpu_l2_cache_mask);
-                       cpumask_andnot(mask, mask, submask_fn(i));
+                       cpumask_andnot(*mask, *mask, submask_fn(i));
                } else {
-                       cpumask_andnot(mask, mask, cpu_l2_cache_mask(i));
+                       cpumask_andnot(*mask, *mask, cpu_l2_cache_mask(i));
                }
 
                of_node_put(np);
        }
        of_node_put(l2_cache);
-       free_cpumask_var(mask);
 
        return true;
 }
@@ -1337,40 +1326,46 @@ static inline void add_cpu_to_smallcore_masks(int cpu)
        }
 }
 
-static void update_coregroup_mask(int cpu)
+static void update_coregroup_mask(int cpu, cpumask_var_t *mask)
 {
        struct cpumask *(*submask_fn)(int) = cpu_sibling_mask;
-       cpumask_var_t mask;
        int coregroup_id = cpu_to_coregroup_id(cpu);
        int i;
 
-       alloc_cpumask_var_node(&mask, GFP_KERNEL, cpu_to_node(cpu));
-       cpumask_and(mask, cpu_online_mask, cpu_cpu_mask(cpu));
-
        if (shared_caches)
                submask_fn = cpu_l2_cache_mask;
 
+       if (!*mask) {
+               /* Assume only siblings are part of this CPU's coregroup */
+               for_each_cpu(i, submask_fn(cpu))
+                       set_cpus_related(cpu, i, cpu_coregroup_mask);
+
+               return;
+       }
+
+       cpumask_and(*mask, cpu_online_mask, cpu_cpu_mask(cpu));
+
        /* Update coregroup mask with all the CPUs that are part of submask */
        or_cpumasks_related(cpu, cpu, submask_fn, cpu_coregroup_mask);
 
        /* Skip all CPUs already part of coregroup mask */
-       cpumask_andnot(mask, mask, cpu_coregroup_mask(cpu));
+       cpumask_andnot(*mask, *mask, cpu_coregroup_mask(cpu));
 
-       for_each_cpu(i, mask) {
+       for_each_cpu(i, *mask) {
                /* Skip all CPUs not part of this coregroup */
                if (coregroup_id == cpu_to_coregroup_id(i)) {
                        or_cpumasks_related(cpu, i, submask_fn, cpu_coregroup_mask);
-                       cpumask_andnot(mask, mask, submask_fn(i));
+                       cpumask_andnot(*mask, *mask, submask_fn(i));
                } else {
-                       cpumask_andnot(mask, mask, cpu_coregroup_mask(i));
+                       cpumask_andnot(*mask, *mask, cpu_coregroup_mask(i));
                }
        }
-       free_cpumask_var(mask);
 }
 
 static void add_cpu_to_masks(int cpu)
 {
        int first_thread = cpu_first_thread_sibling(cpu);
+       cpumask_var_t mask;
        int i;
 
        /*
@@ -1384,22 +1379,28 @@ static void add_cpu_to_masks(int cpu)
                        set_cpus_related(i, cpu, cpu_sibling_mask);
 
        add_cpu_to_smallcore_masks(cpu);
-       update_mask_by_l2(cpu);
+
+       /* In CPU-hotplug path, hence use GFP_ATOMIC */
+       alloc_cpumask_var_node(&mask, GFP_ATOMIC, cpu_to_node(cpu));
+       update_mask_by_l2(cpu, &mask);
 
        if (has_coregroup_support())
-               update_coregroup_mask(cpu);
+               update_coregroup_mask(cpu, &mask);
+
+       free_cpumask_var(mask);
 }
 
 /* Activate a secondary processor. */
 void start_secondary(void *unused)
 {
-       unsigned int cpu = smp_processor_id();
+       unsigned int cpu = raw_smp_processor_id();
 
        mmgrab(&init_mm);
        current->active_mm = &init_mm;
 
        smp_store_cpu_info(cpu);
        set_dec(tb_ticks_per_jiffy);
+       rcu_cpu_starting(cpu);
        preempt_disable();
        cpu_callin_map[cpu] = 1;
 
index c5f39f1..5006dcb 100644 (file)
@@ -885,7 +885,7 @@ static void p9_hmi_special_emu(struct pt_regs *regs)
 {
        unsigned int ra, rb, t, i, sel, instr, rc;
        const void __user *addr;
-       u8 vbuf[16], *vdst;
+       u8 vbuf[16] __aligned(16), *vdst;
        unsigned long ea, msr, msr_mask;
        bool swap;
 
index 470e7c5..083a4e0 100644 (file)
@@ -32,7 +32,7 @@
 #ifdef CONFIG_BUG
 
 #define WARN_ON_ONCE_RM(condition)     ({                      \
-       static bool __section(.data.unlikely) __warned;         \
+       static bool __section(".data.unlikely") __warned;       \
        int __ret_warn_once = !!(condition);                    \
                                                                \
        if (unlikely(__ret_warn_once && !__warned)) {           \
index 543c816..00c5a59 100644 (file)
@@ -88,9 +88,14 @@ static ssize_t dump_ack_store(struct dump_obj *dump_obj,
                              const char *buf,
                              size_t count)
 {
-       dump_send_ack(dump_obj->id);
-       sysfs_remove_file_self(&dump_obj->kobj, &attr->attr);
-       kobject_put(&dump_obj->kobj);
+       /*
+        * Try to self remove this attribute. If we are successful,
+        * delete the kobject itself.
+        */
+       if (sysfs_remove_file_self(&dump_obj->kobj, &attr->attr)) {
+               dump_send_ack(dump_obj->id);
+               kobject_put(&dump_obj->kobj);
+       }
        return count;
 }
 
@@ -318,15 +323,14 @@ static ssize_t dump_attr_read(struct file *filep, struct kobject *kobj,
        return count;
 }
 
-static struct dump_obj *create_dump_obj(uint32_t id, size_t size,
-                                       uint32_t type)
+static void create_dump_obj(uint32_t id, size_t size, uint32_t type)
 {
        struct dump_obj *dump;
        int rc;
 
        dump = kzalloc(sizeof(*dump), GFP_KERNEL);
        if (!dump)
-               return NULL;
+               return;
 
        dump->kobj.kset = dump_kset;
 
@@ -346,21 +350,39 @@ static struct dump_obj *create_dump_obj(uint32_t id, size_t size,
        rc = kobject_add(&dump->kobj, NULL, "0x%x-0x%x", type, id);
        if (rc) {
                kobject_put(&dump->kobj);
-               return NULL;
+               return;
        }
 
+       /*
+        * As soon as the sysfs file for this dump is created/activated there is
+        * a chance the opal_errd daemon (or any userspace) might read and
+        * acknowledge the dump before kobject_uevent() is called. If that
+        * happens then there is a potential race between
+        * dump_ack_store->kobject_put() and kobject_uevent() which leads to a
+        * use-after-free of a kernfs object resulting in a kernel crash.
+        *
+        * To avoid that, we need to take a reference on behalf of the bin file,
+        * so that our reference remains valid while we call kobject_uevent().
+        * We then drop our reference before exiting the function, leaving the
+        * bin file to drop the last reference (if it hasn't already).
+        */
+
+       /* Take a reference for the bin file */
+       kobject_get(&dump->kobj);
        rc = sysfs_create_bin_file(&dump->kobj, &dump->dump_attr);
-       if (rc) {
+       if (rc == 0) {
+               kobject_uevent(&dump->kobj, KOBJ_ADD);
+
+               pr_info("%s: New platform dump. ID = 0x%x Size %u\n",
+                       __func__, dump->id, dump->size);
+       } else {
+               /* Drop reference count taken for bin file */
                kobject_put(&dump->kobj);
-               return NULL;
        }
 
-       pr_info("%s: New platform dump. ID = 0x%x Size %u\n",
-               __func__, dump->id, dump->size);
-
-       kobject_uevent(&dump->kobj, KOBJ_ADD);
-
-       return dump;
+       /* Drop our reference */
+       kobject_put(&dump->kobj);
+       return;
 }
 
 static irqreturn_t process_dump(int irq, void *data)
index 5e33b1f..37b380e 100644 (file)
@@ -72,9 +72,14 @@ static ssize_t elog_ack_store(struct elog_obj *elog_obj,
                              const char *buf,
                              size_t count)
 {
-       opal_send_ack_elog(elog_obj->id);
-       sysfs_remove_file_self(&elog_obj->kobj, &attr->attr);
-       kobject_put(&elog_obj->kobj);
+       /*
+        * Try to self remove this attribute. If we are successful,
+        * delete the kobject itself.
+        */
+       if (sysfs_remove_file_self(&elog_obj->kobj, &attr->attr)) {
+               opal_send_ack_elog(elog_obj->id);
+               kobject_put(&elog_obj->kobj);
+       }
        return count;
 }
 
index 13c86a2..b2b245b 100644 (file)
@@ -521,18 +521,55 @@ int pSeries_system_reset_exception(struct pt_regs *regs)
        return 0; /* need to perform reset */
 }
 
+static int mce_handle_err_realmode(int disposition, u8 error_type)
+{
+#ifdef CONFIG_PPC_BOOK3S_64
+       if (disposition == RTAS_DISP_NOT_RECOVERED) {
+               switch (error_type) {
+               case    MC_ERROR_TYPE_SLB:
+               case    MC_ERROR_TYPE_ERAT:
+                       /*
+                        * Store the old slb content in paca before flushing.
+                        * Print this when we go to virtual mode.
+                        * There are chances that we may hit MCE again if there
+                        * is a parity error on the SLB entry we trying to read
+                        * for saving. Hence limit the slb saving to single
+                        * level of recursion.
+                        */
+                       if (local_paca->in_mce == 1)
+                               slb_save_contents(local_paca->mce_faulty_slbs);
+                       flush_and_reload_slb();
+                       disposition = RTAS_DISP_FULLY_RECOVERED;
+                       break;
+               default:
+                       break;
+               }
+       } else if (disposition == RTAS_DISP_LIMITED_RECOVERY) {
+               /* Platform corrected itself but could be degraded */
+               pr_err("MCE: limited recovery, system may be degraded\n");
+               disposition = RTAS_DISP_FULLY_RECOVERED;
+       }
+#endif
+       return disposition;
+}
 
-static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)
+static int mce_handle_err_virtmode(struct pt_regs *regs,
+                                  struct rtas_error_log *errp,
+                                  struct pseries_mc_errorlog *mce_log,
+                                  int disposition)
 {
        struct mce_error_info mce_err = { 0 };
-       unsigned long eaddr = 0, paddr = 0;
-       struct pseries_errorlog *pseries_log;
-       struct pseries_mc_errorlog *mce_log;
-       int disposition = rtas_error_disposition(errp);
        int initiator = rtas_error_initiator(errp);
        int severity = rtas_error_severity(errp);
+       unsigned long eaddr = 0, paddr = 0;
        u8 error_type, err_sub_type;
 
+       if (!mce_log)
+               goto out;
+
+       error_type = mce_log->error_type;
+       err_sub_type = rtas_mc_error_sub_type(mce_log);
+
        if (initiator == RTAS_INITIATOR_UNKNOWN)
                mce_err.initiator = MCE_INITIATOR_UNKNOWN;
        else if (initiator == RTAS_INITIATOR_CPU)
@@ -571,18 +608,7 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)
        mce_err.error_type = MCE_ERROR_TYPE_UNKNOWN;
        mce_err.error_class = MCE_ECLASS_UNKNOWN;
 
-       if (!rtas_error_extended(errp))
-               goto out;
-
-       pseries_log = get_pseries_errorlog(errp, PSERIES_ELOG_SECT_ID_MCE);
-       if (pseries_log == NULL)
-               goto out;
-
-       mce_log = (struct pseries_mc_errorlog *)pseries_log->data;
-       error_type = mce_log->error_type;
-       err_sub_type = rtas_mc_error_sub_type(mce_log);
-
-       switch (mce_log->error_type) {
+       switch (error_type) {
        case MC_ERROR_TYPE_UE:
                mce_err.error_type = MCE_ERROR_TYPE_UE;
                mce_common_process_ue(regs, &mce_err);
@@ -682,37 +708,31 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)
                mce_err.error_type = MCE_ERROR_TYPE_UNKNOWN;
                break;
        }
+out:
+       save_mce_event(regs, disposition == RTAS_DISP_FULLY_RECOVERED,
+                      &mce_err, regs->nip, eaddr, paddr);
+       return disposition;
+}
 
-#ifdef CONFIG_PPC_BOOK3S_64
-       if (disposition == RTAS_DISP_NOT_RECOVERED) {
-               switch (error_type) {
-               case    MC_ERROR_TYPE_SLB:
-               case    MC_ERROR_TYPE_ERAT:
-                       /*
-                        * Store the old slb content in paca before flushing.
-                        * Print this when we go to virtual mode.
-                        * There are chances that we may hit MCE again if there
-                        * is a parity error on the SLB entry we trying to read
-                        * for saving. Hence limit the slb saving to single
-                        * level of recursion.
-                        */
-                       if (local_paca->in_mce == 1)
-                               slb_save_contents(local_paca->mce_faulty_slbs);
-                       flush_and_reload_slb();
-                       disposition = RTAS_DISP_FULLY_RECOVERED;
-                       break;
-               default:
-                       break;
-               }
-       } else if (disposition == RTAS_DISP_LIMITED_RECOVERY) {
-               /* Platform corrected itself but could be degraded */
-               printk(KERN_ERR "MCE: limited recovery, system may "
-                      "be degraded\n");
-               disposition = RTAS_DISP_FULLY_RECOVERED;
-       }
-#endif
+static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)
+{
+       struct pseries_errorlog *pseries_log;
+       struct pseries_mc_errorlog *mce_log = NULL;
+       int disposition = rtas_error_disposition(errp);
+       u8 error_type;
+
+       if (!rtas_error_extended(errp))
+               goto out;
+
+       pseries_log = get_pseries_errorlog(errp, PSERIES_ELOG_SECT_ID_MCE);
+       if (!pseries_log)
+               goto out;
+
+       mce_log = (struct pseries_mc_errorlog *)pseries_log->data;
+       error_type = mce_log->error_type;
+
+       disposition = mce_handle_err_realmode(disposition, error_type);
 
-out:
        /*
         * Enable translation as we will be accessing per-cpu variables
         * in save_mce_event() which may fall outside RMO region, also
@@ -723,10 +743,10 @@ out:
         * Note: All the realmode handling like flushing SLB entries for
         *       SLB multihit is done by now.
         */
+out:
        mtmsr(mfmsr() | MSR_IR | MSR_DR);
-       save_mce_event(regs, disposition == RTAS_DISP_FULLY_RECOVERED,
-                       &mce_err, regs->nip, eaddr, paddr);
-
+       disposition = mce_handle_err_virtmode(regs, errp, mce_log,
+                                             disposition);
        return disposition;
 }
 
index d5e7ca0..44377fd 100644 (file)
@@ -88,7 +88,7 @@ config RISCV
        select SPARSE_IRQ
        select SYSCTL_EXCEPTION_TRACE
        select THREAD_INFO_IN_TASK
-       select SET_FS
+       select UACCESS_MEMCPY if !MMU
 
 config ARCH_MMAP_RND_BITS_MIN
        default 18 if 64BIT
index 136a442..6c8363b 100644 (file)
@@ -13,7 +13,7 @@
 
 #define SOC_EARLY_INIT_DECLARE(name, compat, fn)                       \
        static const struct of_device_id __soc_early_init__##name       \
-               __used __section(__soc_early_init_table)                \
+               __used __section("__soc_early_init_table")              \
                 = { .compatible = compat, .data = fn  }
 
 void soc_early_init(void);
@@ -46,7 +46,7 @@ struct soc_builtin_dtb {
        }                                                               \
                                                                        \
        static const struct soc_builtin_dtb __soc_builtin_dtb__##name   \
-               __used __section(__soc_builtin_dtb_table) =             \
+               __used __section("__soc_builtin_dtb_table") =           \
        {                                                               \
                .vendor_id = vendor,                                    \
                .arch_id   = arch,                                      \
index 464a2bb..a390711 100644 (file)
 #include <asm/processor.h>
 #include <asm/csr.h>
 
-typedef struct {
-       unsigned long seg;
-} mm_segment_t;
-
 /*
  * low level task data that entry.S needs immediate access to
  * - this struct should fit entirely inside of one cache line
@@ -39,7 +35,6 @@ typedef struct {
 struct thread_info {
        unsigned long           flags;          /* low level flags */
        int                     preempt_count;  /* 0=>preemptible, <0=>BUG */
-       mm_segment_t            addr_limit;
        /*
         * These stack pointers are overwritten on every system call or
         * exception.  SP is also saved to the stack it can be recovered when
@@ -59,7 +54,6 @@ struct thread_info {
 {                                              \
        .flags          = 0,                    \
        .preempt_count  = INIT_PREEMPT_COUNT,   \
-       .addr_limit     = KERNEL_DS,            \
 }
 
 #endif /* !__ASSEMBLY__ */
index f56c66b..824b2c9 100644 (file)
 /*
  * User space memory access functions
  */
-
-extern unsigned long __must_check __asm_copy_to_user(void __user *to,
-       const void *from, unsigned long n);
-extern unsigned long __must_check __asm_copy_from_user(void *to,
-       const void __user *from, unsigned long n);
-
-static inline unsigned long
-raw_copy_from_user(void *to, const void __user *from, unsigned long n)
-{
-       return __asm_copy_from_user(to, from, n);
-}
-
-static inline unsigned long
-raw_copy_to_user(void __user *to, const void *from, unsigned long n)
-{
-       return __asm_copy_to_user(to, from, n);
-}
-
 #ifdef CONFIG_MMU
 #include <linux/errno.h>
 #include <linux/compiler.h>
@@ -44,29 +26,6 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
 #define __disable_user_access()                                                        \
        __asm__ __volatile__ ("csrc sstatus, %0" : : "r" (SR_SUM) : "memory")
 
-/*
- * The fs value determines whether argument validity checking should be
- * performed or not.  If get_fs() == USER_DS, checking is performed, with
- * get_fs() == KERNEL_DS, checking is bypassed.
- *
- * For historical reasons, these macros are grossly misnamed.
- */
-
-#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
-
-#define KERNEL_DS      MAKE_MM_SEG(~0UL)
-#define USER_DS                MAKE_MM_SEG(TASK_SIZE)
-
-#define get_fs()       (current_thread_info()->addr_limit)
-
-static inline void set_fs(mm_segment_t fs)
-{
-       current_thread_info()->addr_limit = fs;
-}
-
-#define uaccess_kernel() (get_fs().seg == KERNEL_DS.seg)
-#define user_addr_max()        (get_fs().seg)
-
 /**
  * access_ok: - Checks if a user space pointer is valid
  * @addr: User space pointer to start of block to check
@@ -94,9 +53,7 @@ static inline void set_fs(mm_segment_t fs)
  */
 static inline int __access_ok(unsigned long addr, unsigned long size)
 {
-       const mm_segment_t fs = get_fs();
-
-       return size <= fs.seg && addr <= fs.seg - size;
+       return size <= TASK_SIZE && addr <= TASK_SIZE - size;
 }
 
 /*
@@ -125,7 +82,6 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
 do {                                                           \
        uintptr_t __tmp;                                        \
        __typeof__(x) __x;                                      \
-       __enable_user_access();                                 \
        __asm__ __volatile__ (                                  \
                "1:\n"                                          \
                "       " insn " %1, %3\n"                      \
@@ -143,7 +99,6 @@ do {                                                         \
                "       .previous"                              \
                : "+r" (err), "=&r" (__x), "=r" (__tmp)         \
                : "m" (*(ptr)), "i" (-EFAULT));                 \
-       __disable_user_access();                                \
        (x) = __x;                                              \
 } while (0)
 
@@ -156,7 +111,6 @@ do {                                                                \
        u32 __user *__ptr = (u32 __user *)(ptr);                \
        u32 __lo, __hi;                                         \
        uintptr_t __tmp;                                        \
-       __enable_user_access();                                 \
        __asm__ __volatile__ (                                  \
                "1:\n"                                          \
                "       lw %1, %4\n"                            \
@@ -180,12 +134,30 @@ do {                                                              \
                        "=r" (__tmp)                            \
                : "m" (__ptr[__LSW]), "m" (__ptr[__MSW]),       \
                        "i" (-EFAULT));                         \
-       __disable_user_access();                                \
        (x) = (__typeof__(x))((__typeof__((x)-(x)))(            \
                (((u64)__hi << 32) | __lo)));                   \
 } while (0)
 #endif /* CONFIG_64BIT */
 
+#define __get_user_nocheck(x, __gu_ptr, __gu_err)              \
+do {                                                           \
+       switch (sizeof(*__gu_ptr)) {                            \
+       case 1:                                                 \
+               __get_user_asm("lb", (x), __gu_ptr, __gu_err);  \
+               break;                                          \
+       case 2:                                                 \
+               __get_user_asm("lh", (x), __gu_ptr, __gu_err);  \
+               break;                                          \
+       case 4:                                                 \
+               __get_user_asm("lw", (x), __gu_ptr, __gu_err);  \
+               break;                                          \
+       case 8:                                                 \
+               __get_user_8((x), __gu_ptr, __gu_err);  \
+               break;                                          \
+       default:                                                \
+               BUILD_BUG();                                    \
+       }                                                       \
+} while (0)
 
 /**
  * __get_user: - Get a simple variable from user space, with less checking.
@@ -209,25 +181,15 @@ do {                                                              \
  */
 #define __get_user(x, ptr)                                     \
 ({                                                             \
-       register long __gu_err = 0;                             \
        const __typeof__(*(ptr)) __user *__gu_ptr = (ptr);      \
+       long __gu_err = 0;                                      \
+                                                               \
        __chk_user_ptr(__gu_ptr);                               \
-       switch (sizeof(*__gu_ptr)) {                            \
-       case 1:                                                 \
-               __get_user_asm("lb", (x), __gu_ptr, __gu_err);  \
-               break;                                          \
-       case 2:                                                 \
-               __get_user_asm("lh", (x), __gu_ptr, __gu_err);  \
-               break;                                          \
-       case 4:                                                 \
-               __get_user_asm("lw", (x), __gu_ptr, __gu_err);  \
-               break;                                          \
-       case 8:                                                 \
-               __get_user_8((x), __gu_ptr, __gu_err);  \
-               break;                                          \
-       default:                                                \
-               BUILD_BUG();                                    \
-       }                                                       \
+                                                               \
+       __enable_user_access();                                 \
+       __get_user_nocheck(x, __gu_ptr, __gu_err);              \
+       __disable_user_access();                                \
+                                                               \
        __gu_err;                                               \
 })
 
@@ -261,7 +223,6 @@ do {                                                                \
 do {                                                           \
        uintptr_t __tmp;                                        \
        __typeof__(*(ptr)) __x = x;                             \
-       __enable_user_access();                                 \
        __asm__ __volatile__ (                                  \
                "1:\n"                                          \
                "       " insn " %z3, %2\n"                     \
@@ -278,7 +239,6 @@ do {                                                                \
                "       .previous"                              \
                : "+r" (err), "=r" (__tmp), "=m" (*(ptr))       \
                : "rJ" (__x), "i" (-EFAULT));                   \
-       __disable_user_access();                                \
 } while (0)
 
 #ifdef CONFIG_64BIT
@@ -290,7 +250,6 @@ do {                                                                \
        u32 __user *__ptr = (u32 __user *)(ptr);                \
        u64 __x = (__typeof__((x)-(x)))(x);                     \
        uintptr_t __tmp;                                        \
-       __enable_user_access();                                 \
        __asm__ __volatile__ (                                  \
                "1:\n"                                          \
                "       sw %z4, %2\n"                           \
@@ -312,10 +271,28 @@ do {                                                              \
                        "=m" (__ptr[__LSW]),                    \
                        "=m" (__ptr[__MSW])                     \
                : "rJ" (__x), "rJ" (__x >> 32), "i" (-EFAULT)); \
-       __disable_user_access();                                \
 } while (0)
 #endif /* CONFIG_64BIT */
 
+#define __put_user_nocheck(x, __gu_ptr, __pu_err)                                      \
+do {                                                           \
+       switch (sizeof(*__gu_ptr)) {                            \
+       case 1:                                                 \
+               __put_user_asm("sb", (x), __gu_ptr, __pu_err);  \
+               break;                                          \
+       case 2:                                                 \
+               __put_user_asm("sh", (x), __gu_ptr, __pu_err);  \
+               break;                                          \
+       case 4:                                                 \
+               __put_user_asm("sw", (x), __gu_ptr, __pu_err);  \
+               break;                                          \
+       case 8:                                                 \
+               __put_user_8((x), __gu_ptr, __pu_err);  \
+               break;                                          \
+       default:                                                \
+               BUILD_BUG();                                    \
+       }                                                       \
+} while (0)
 
 /**
  * __put_user: - Write a simple value into user space, with less checking.
@@ -338,25 +315,15 @@ do {                                                              \
  */
 #define __put_user(x, ptr)                                     \
 ({                                                             \
-       register long __pu_err = 0;                             \
        __typeof__(*(ptr)) __user *__gu_ptr = (ptr);            \
+       long __pu_err = 0;                                      \
+                                                               \
        __chk_user_ptr(__gu_ptr);                               \
-       switch (sizeof(*__gu_ptr)) {                            \
-       case 1:                                                 \
-               __put_user_asm("sb", (x), __gu_ptr, __pu_err);  \
-               break;                                          \
-       case 2:                                                 \
-               __put_user_asm("sh", (x), __gu_ptr, __pu_err);  \
-               break;                                          \
-       case 4:                                                 \
-               __put_user_asm("sw", (x), __gu_ptr, __pu_err);  \
-               break;                                          \
-       case 8:                                                 \
-               __put_user_8((x), __gu_ptr, __pu_err);  \
-               break;                                          \
-       default:                                                \
-               BUILD_BUG();                                    \
-       }                                                       \
+                                                               \
+       __enable_user_access();                                 \
+       __put_user_nocheck(x, __gu_ptr, __pu_err);              \
+       __disable_user_access();                                \
+                                                               \
        __pu_err;                                               \
 })
 
@@ -385,6 +352,24 @@ do {                                                               \
                -EFAULT;                                        \
 })
 
+
+unsigned long __must_check __asm_copy_to_user(void __user *to,
+       const void *from, unsigned long n);
+unsigned long __must_check __asm_copy_from_user(void *to,
+       const void __user *from, unsigned long n);
+
+static inline unsigned long
+raw_copy_from_user(void *to, const void __user *from, unsigned long n)
+{
+       return __asm_copy_from_user(to, from, n);
+}
+
+static inline unsigned long
+raw_copy_to_user(void __user *to, const void *from, unsigned long n)
+{
+       return __asm_copy_to_user(to, from, n);
+}
+
 extern long strncpy_from_user(char *dest, const char __user *src, long count);
 
 extern long __must_check strlen_user(const char __user *str);
@@ -476,6 +461,26 @@ unsigned long __must_check clear_user(void __user *to, unsigned long n)
        __ret;                                                  \
 })
 
+#define HAVE_GET_KERNEL_NOFAULT
+
+#define __get_kernel_nofault(dst, src, type, err_label)                        \
+do {                                                                   \
+       long __kr_err;                                                  \
+                                                                       \
+       __get_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err);  \
+       if (unlikely(__kr_err))                                         \
+               goto err_label;                                         \
+} while (0)
+
+#define __put_kernel_nofault(dst, src, type, err_label)                        \
+do {                                                                   \
+       long __kr_err;                                                  \
+                                                                       \
+       __put_user_nocheck(*((type *)(src)), (type *)(dst), __kr_err);  \
+       if (unlikely(__kr_err))                                         \
+               goto err_label;                                         \
+} while (0)
+
 #else /* CONFIG_MMU */
 #include <asm-generic/uaccess.h>
 #endif /* CONFIG_MMU */
index 0ec2235..1985884 100644 (file)
@@ -15,8 +15,8 @@
 
 const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init;
 
-void *__cpu_up_stack_pointer[NR_CPUS] __section(.data);
-void *__cpu_up_task_pointer[NR_CPUS] __section(.data);
+void *__cpu_up_stack_pointer[NR_CPUS] __section(".data");
+void *__cpu_up_task_pointer[NR_CPUS] __section(".data");
 
 extern const struct cpu_operations cpu_ops_sbi;
 extern const struct cpu_operations cpu_ops_spinwait;
index 99e12fa..765b624 100644 (file)
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) 2013 Linaro Limited
  * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
index 11e2a4f..7e84979 100644 (file)
@@ -35,6 +35,10 @@ ENTRY(_start)
        .word 0
 #endif
        .balign 8
+#ifdef CONFIG_RISCV_M_MODE
+       /* Image load offset (0MB) from start of RAM for M-mode */
+       .dword 0
+#else
 #if __riscv_xlen == 64
        /* Image load offset(2MB) from start of RAM */
        .dword 0x200000
@@ -42,6 +46,7 @@ ENTRY(_start)
        /* Image load offset(4MB) from start of RAM */
        .dword 0x400000
 #endif
+#endif
        /* Effective size of kernel image */
        .dword _end - _start
        .dword __HEAD_FLAGS
index 2b97c49..19225ec 100644 (file)
@@ -84,7 +84,6 @@ void start_thread(struct pt_regs *regs, unsigned long pc,
        }
        regs->epc = pc;
        regs->sp = sp;
-       set_fs(USER_DS);
 }
 
 void flush_thread(void)
index 4c96ac1..c424cc6 100644 (file)
@@ -32,7 +32,7 @@
 #include "head.h"
 
 #if defined(CONFIG_DUMMY_CONSOLE) || defined(CONFIG_EFI)
-struct screen_info screen_info __section(.data) = {
+struct screen_info screen_info __section(".data") = {
        .orig_video_lines       = 30,
        .orig_video_cols        = 80,
        .orig_video_mode        = 0,
@@ -47,7 +47,7 @@ struct screen_info screen_info __section(.data) = {
  * This is used before the kernel initializes the BSS so it can't be in the
  * BSS.
  */
-atomic_t hart_lottery __section(.sdata);
+atomic_t hart_lottery __section(".sdata");
 unsigned long boot_cpu_hartid;
 static DEFINE_PER_CPU(struct cpu, cpu_devices);
 
index 11ebee9..3a19def 100644 (file)
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 vdso.lds
 *.tmp
+vdso-syms.S
index 7d6a94d..cb8f9e4 100644 (file)
@@ -43,19 +43,14 @@ $(obj)/vdso.o: $(obj)/vdso.so
 SYSCFLAGS_vdso.so.dbg = $(c_flags)
 $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE
        $(call if_changed,vdsold)
+SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
+       -Wl,--build-id -Wl,--hash-style=both
 
 # We also create a special relocatable object that should mirror the symbol
 # table and layout of the linked DSO. With ld --just-symbols we can then
 # refer to these symbols in the kernel code rather than hand-coded addresses.
-
-SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
-       -Wl,--build-id=sha1 -Wl,--hash-style=both
-$(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE
-       $(call if_changed,vdsold)
-
-LDFLAGS_vdso-syms.o := -r --just-symbols
-$(obj)/vdso-syms.o: $(obj)/vdso-dummy.o FORCE
-       $(call if_changed,ld)
+$(obj)/vdso-syms.S: $(obj)/vdso.so FORCE
+       $(call if_changed,so2s)
 
 # strip rule for the .so file
 $(obj)/%.so: OBJCOPYFLAGS := -S
@@ -73,6 +68,11 @@ quiet_cmd_vdsold = VDSOLD  $@
                            $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \
                    rm $@.tmp
 
+# Extracts symbol offsets from the VDSO, converting them into an assembly file
+# that contains the same symbols at the same offsets.
+quiet_cmd_so2s = SO2S    $@
+      cmd_so2s = $(NM) -D $< | $(srctree)/$(src)/so2s.sh > $@
+
 # install commands for the unstripped file
 quiet_cmd_vdso_install = INSTALL $@
       cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
diff --git a/arch/riscv/kernel/vdso/so2s.sh b/arch/riscv/kernel/vdso/so2s.sh
new file mode 100755 (executable)
index 0000000..e64cb6d
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2020 Palmer Dabbelt <palmerdabbelt@google.com>
+
+sed 's!\([0-9a-f]*\) T \([a-z0-9_]*\)\(@@LINUX_4.15\)*!.global \2\n.set \2,0x\1!' \
+| grep '^\.'
index 0d0db80..47e7a82 100644 (file)
@@ -2,5 +2,5 @@
 lib-y                  += delay.o
 lib-y                  += memcpy.o
 lib-y                  += memset.o
-lib-y                  += uaccess.o
+lib-$(CONFIG_MMU)      += uaccess.o
 lib-$(CONFIG_64BIT)    += tishift.o
index 1359e21..3c8b9e4 100644 (file)
@@ -86,6 +86,7 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a
        pmd_t *pmd, *pmd_k;
        pte_t *pte_k;
        int index;
+       unsigned long pfn;
 
        /* User mode accesses just cause a SIGSEGV */
        if (user_mode(regs))
@@ -100,7 +101,8 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a
         * of a task switch.
         */
        index = pgd_index(addr);
-       pgd = (pgd_t *)pfn_to_virt(csr_read(CSR_SATP)) + index;
+       pfn = csr_read(CSR_SATP) & SATP_PPN;
+       pgd = (pgd_t *)pfn_to_virt(pfn) + index;
        pgd_k = init_mm.pgd + index;
 
        if (!pgd_present(*pgd_k)) {
index ea933b7..8e577f1 100644 (file)
@@ -154,9 +154,8 @@ disable:
 
 void __init setup_bootmem(void)
 {
-       phys_addr_t mem_size = 0;
-       phys_addr_t total_mem = 0;
-       phys_addr_t mem_start, start, end = 0;
+       phys_addr_t mem_start = 0;
+       phys_addr_t start, end = 0;
        phys_addr_t vmlinux_end = __pa_symbol(&_end);
        phys_addr_t vmlinux_start = __pa_symbol(&_start);
        u64 i;
@@ -164,21 +163,18 @@ void __init setup_bootmem(void)
        /* Find the memory region containing the kernel */
        for_each_mem_range(i, &start, &end) {
                phys_addr_t size = end - start;
-               if (!total_mem)
+               if (!mem_start)
                        mem_start = start;
                if (start <= vmlinux_start && vmlinux_end <= end)
                        BUG_ON(size == 0);
-               total_mem = total_mem + size;
        }
 
        /*
-        * Remove memblock from the end of usable area to the
-        * end of region
+        * The maximal physical memory size is -PAGE_OFFSET.
+        * Make sure that any memory beyond mem_start + (-PAGE_OFFSET) is removed
+        * as it is unusable by kernel.
         */
-       mem_size = min(total_mem, (phys_addr_t)-PAGE_OFFSET);
-       if (mem_start + mem_size < end)
-               memblock_remove(mem_start + mem_size,
-                               end - mem_start - mem_size);
+       memblock_enforce_memory_limit(mem_start - PAGE_OFFSET);
 
        /* Reserve from the start of the kernel to the end of the kernel */
        memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
@@ -297,6 +293,7 @@ pmd_t fixmap_pmd[PTRS_PER_PMD] __page_aligned_bss;
 #define NUM_EARLY_PMDS         (1UL + MAX_EARLY_MAPPING_SIZE / PGDIR_SIZE)
 #endif
 pmd_t early_pmd[PTRS_PER_PMD * NUM_EARLY_PMDS] __initdata __aligned(PAGE_SIZE);
+pmd_t early_dtb_pmd[PTRS_PER_PMD] __initdata __aligned(PAGE_SIZE);
 
 static pmd_t *__init get_pmd_virt_early(phys_addr_t pa)
 {
@@ -494,6 +491,18 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
                                   load_pa + (va - PAGE_OFFSET),
                                   map_size, PAGE_KERNEL_EXEC);
 
+#ifndef __PAGETABLE_PMD_FOLDED
+       /* Setup early PMD for DTB */
+       create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA,
+                          (uintptr_t)early_dtb_pmd, PGDIR_SIZE, PAGE_TABLE);
+       /* Create two consecutive PMD mappings for FDT early scan */
+       pa = dtb_pa & ~(PMD_SIZE - 1);
+       create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA,
+                          pa, PMD_SIZE, PAGE_KERNEL);
+       create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA + PMD_SIZE,
+                          pa + PMD_SIZE, PMD_SIZE, PAGE_KERNEL);
+       dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PMD_SIZE - 1));
+#else
        /* Create two consecutive PGD mappings for FDT early scan */
        pa = dtb_pa & ~(PGDIR_SIZE - 1);
        create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA,
@@ -501,6 +510,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
        create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA + PGDIR_SIZE,
                           pa + PGDIR_SIZE, PGDIR_SIZE, PAGE_KERNEL);
        dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PGDIR_SIZE - 1));
+#endif
        dtb_early_pa = dtb_pa;
 
        /*
index 9084293..cc96b04 100644 (file)
@@ -46,7 +46,7 @@ struct diag_ops __bootdata_preserved(diag_dma_ops) = {
        .diag0c = _diag0c_dma,
        .diag308_reset = _diag308_reset_dma
 };
-static struct diag210 _diag210_tmp_dma __section(.dma.data);
+static struct diag210 _diag210_tmp_dma __section(".dma.data");
 struct diag210 *__bootdata_preserved(__diag210_tmp_dma) = &_diag210_tmp_dma;
 
 void error(char *x)
index 0784bf3..a4d3c57 100644 (file)
@@ -93,9 +93,10 @@ CONFIG_CLEANCACHE=y
 CONFIG_FRONTSWAP=y
 CONFIG_CMA_DEBUG=y
 CONFIG_CMA_DEBUGFS=y
+CONFIG_CMA_AREAS=7
 CONFIG_MEM_SOFT_DIRTY=y
 CONFIG_ZSWAP=y
-CONFIG_ZSMALLOC=m
+CONFIG_ZSMALLOC=y
 CONFIG_ZSMALLOC_STAT=y
 CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
 CONFIG_IDLE_PAGE_TRACKING=y
@@ -378,7 +379,6 @@ CONFIG_NETLINK_DIAG=m
 CONFIG_CGROUP_NET_PRIO=y
 CONFIG_BPF_JIT=y
 CONFIG_NET_PKTGEN=m
-# CONFIG_NET_DROP_MONITOR is not set
 CONFIG_PCI=y
 # CONFIG_PCIEASPM is not set
 CONFIG_PCI_DEBUG=y
@@ -386,7 +386,7 @@ CONFIG_HOTPLUG_PCI=y
 CONFIG_HOTPLUG_PCI_S390=y
 CONFIG_DEVTMPFS=y
 CONFIG_CONNECTOR=y
-CONFIG_ZRAM=m
+CONFIG_ZRAM=y
 CONFIG_BLK_DEV_LOOP=m
 CONFIG_BLK_DEV_CRYPTOLOOP=m
 CONFIG_BLK_DEV_DRBD=m
@@ -689,6 +689,7 @@ CONFIG_CRYPTO_TEST=m
 CONFIG_CRYPTO_DH=m
 CONFIG_CRYPTO_ECDH=m
 CONFIG_CRYPTO_ECRDSA=m
+CONFIG_CRYPTO_SM2=m
 CONFIG_CRYPTO_CURVE25519=m
 CONFIG_CRYPTO_GCM=y
 CONFIG_CRYPTO_CHACHA20POLY1305=m
@@ -709,7 +710,6 @@ CONFIG_CRYPTO_RMD160=m
 CONFIG_CRYPTO_RMD256=m
 CONFIG_CRYPTO_RMD320=m
 CONFIG_CRYPTO_SHA3=m
-CONFIG_CRYPTO_SM3=m
 CONFIG_CRYPTO_TGR192=m
 CONFIG_CRYPTO_WP512=m
 CONFIG_CRYPTO_AES_TI=m
@@ -753,6 +753,7 @@ CONFIG_CRYPTO_DES_S390=m
 CONFIG_CRYPTO_AES_S390=m
 CONFIG_CRYPTO_GHASH_S390=m
 CONFIG_CRYPTO_CRC32_S390=y
+CONFIG_CRYPTO_DEV_VIRTIO=m
 CONFIG_CORDIC=m
 CONFIG_CRC32_SELFTEST=y
 CONFIG_CRC4=m
@@ -829,6 +830,7 @@ CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m
 CONFIG_FAULT_INJECTION=y
 CONFIG_FAILSLAB=y
 CONFIG_FAIL_PAGE_ALLOC=y
+CONFIG_FAULT_INJECTION_USERCOPY=y
 CONFIG_FAIL_MAKE_REQUEST=y
 CONFIG_FAIL_IO_TIMEOUT=y
 CONFIG_FAIL_FUTEX=y
index 905bc8c..17d5df2 100644 (file)
@@ -87,9 +87,10 @@ CONFIG_KSM=y
 CONFIG_TRANSPARENT_HUGEPAGE=y
 CONFIG_CLEANCACHE=y
 CONFIG_FRONTSWAP=y
+CONFIG_CMA_AREAS=7
 CONFIG_MEM_SOFT_DIRTY=y
 CONFIG_ZSWAP=y
-CONFIG_ZSMALLOC=m
+CONFIG_ZSMALLOC=y
 CONFIG_ZSMALLOC_STAT=y
 CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
 CONFIG_IDLE_PAGE_TRACKING=y
@@ -371,7 +372,6 @@ CONFIG_NETLINK_DIAG=m
 CONFIG_CGROUP_NET_PRIO=y
 CONFIG_BPF_JIT=y
 CONFIG_NET_PKTGEN=m
-# CONFIG_NET_DROP_MONITOR is not set
 CONFIG_PCI=y
 # CONFIG_PCIEASPM is not set
 CONFIG_HOTPLUG_PCI=y
@@ -379,7 +379,7 @@ CONFIG_HOTPLUG_PCI_S390=y
 CONFIG_UEVENT_HELPER=y
 CONFIG_DEVTMPFS=y
 CONFIG_CONNECTOR=y
-CONFIG_ZRAM=m
+CONFIG_ZRAM=y
 CONFIG_BLK_DEV_LOOP=m
 CONFIG_BLK_DEV_CRYPTOLOOP=m
 CONFIG_BLK_DEV_DRBD=m
@@ -680,6 +680,7 @@ CONFIG_CRYPTO_TEST=m
 CONFIG_CRYPTO_DH=m
 CONFIG_CRYPTO_ECDH=m
 CONFIG_CRYPTO_ECRDSA=m
+CONFIG_CRYPTO_SM2=m
 CONFIG_CRYPTO_CURVE25519=m
 CONFIG_CRYPTO_GCM=y
 CONFIG_CRYPTO_CHACHA20POLY1305=m
@@ -701,7 +702,6 @@ CONFIG_CRYPTO_RMD160=m
 CONFIG_CRYPTO_RMD256=m
 CONFIG_CRYPTO_RMD320=m
 CONFIG_CRYPTO_SHA3=m
-CONFIG_CRYPTO_SM3=m
 CONFIG_CRYPTO_TGR192=m
 CONFIG_CRYPTO_WP512=m
 CONFIG_CRYPTO_AES_TI=m
@@ -745,6 +745,7 @@ CONFIG_CRYPTO_DES_S390=m
 CONFIG_CRYPTO_AES_S390=m
 CONFIG_CRYPTO_GHASH_S390=m
 CONFIG_CRYPTO_CRC32_S390=y
+CONFIG_CRYPTO_DEV_VIRTIO=m
 CONFIG_CORDIC=m
 CONFIG_PRIME_NUMBERS=m
 CONFIG_CRC4=m
index 8f67c55..a302630 100644 (file)
@@ -17,11 +17,11 @@ CONFIG_HZ_100=y
 # CONFIG_CHSC_SCH is not set
 # CONFIG_SCM_BUS is not set
 CONFIG_CRASH_DUMP=y
-# CONFIG_SECCOMP is not set
 # CONFIG_PFAULT is not set
 # CONFIG_S390_HYPFS_FS is not set
 # CONFIG_VIRTUALIZATION is not set
 # CONFIG_S390_GUEST is not set
+# CONFIG_SECCOMP is not set
 CONFIG_PARTITION_ADVANCED=y
 CONFIG_IBM_PARTITION=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
index d5e22e8..0012817 100644 (file)
@@ -14,6 +14,6 @@
 #define L1_CACHE_SHIFT     8
 #define NET_SKB_PAD       32
 
-#define __read_mostly __section(.data..read_mostly)
+#define __read_mostly __section(".data..read_mostly")
 
 #endif
index 6b8d8c6..b5dbae7 100644 (file)
@@ -692,16 +692,6 @@ static inline int pud_large(pud_t pud)
        return !!(pud_val(pud) & _REGION3_ENTRY_LARGE);
 }
 
-static inline unsigned long pud_pfn(pud_t pud)
-{
-       unsigned long origin_mask;
-
-       origin_mask = _REGION_ENTRY_ORIGIN;
-       if (pud_large(pud))
-               origin_mask = _REGION3_ENTRY_ORIGIN_LARGE;
-       return (pud_val(pud) & origin_mask) >> PAGE_SHIFT;
-}
-
 #define pmd_leaf       pmd_large
 static inline int pmd_large(pmd_t pmd)
 {
@@ -747,16 +737,6 @@ static inline int pmd_none(pmd_t pmd)
        return pmd_val(pmd) == _SEGMENT_ENTRY_EMPTY;
 }
 
-static inline unsigned long pmd_pfn(pmd_t pmd)
-{
-       unsigned long origin_mask;
-
-       origin_mask = _SEGMENT_ENTRY_ORIGIN;
-       if (pmd_large(pmd))
-               origin_mask = _SEGMENT_ENTRY_ORIGIN_LARGE;
-       return (pmd_val(pmd) & origin_mask) >> PAGE_SHIFT;
-}
-
 #define pmd_write pmd_write
 static inline int pmd_write(pmd_t pmd)
 {
@@ -1238,11 +1218,39 @@ static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
 #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
 #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
 
-#define pmd_deref(pmd) (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN)
-#define pud_deref(pud) (pud_val(pud) & _REGION_ENTRY_ORIGIN)
 #define p4d_deref(pud) (p4d_val(pud) & _REGION_ENTRY_ORIGIN)
 #define pgd_deref(pgd) (pgd_val(pgd) & _REGION_ENTRY_ORIGIN)
 
+static inline unsigned long pmd_deref(pmd_t pmd)
+{
+       unsigned long origin_mask;
+
+       origin_mask = _SEGMENT_ENTRY_ORIGIN;
+       if (pmd_large(pmd))
+               origin_mask = _SEGMENT_ENTRY_ORIGIN_LARGE;
+       return pmd_val(pmd) & origin_mask;
+}
+
+static inline unsigned long pmd_pfn(pmd_t pmd)
+{
+       return pmd_deref(pmd) >> PAGE_SHIFT;
+}
+
+static inline unsigned long pud_deref(pud_t pud)
+{
+       unsigned long origin_mask;
+
+       origin_mask = _REGION_ENTRY_ORIGIN;
+       if (pud_large(pud))
+               origin_mask = _REGION3_ENTRY_ORIGIN_LARGE;
+       return pud_val(pud) & origin_mask;
+}
+
+static inline unsigned long pud_pfn(pud_t pud)
+{
+       return pud_deref(pud) >> PAGE_SHIFT;
+}
+
 /*
  * The pgd_offset function *always* adds the index for the top-level
  * region/segment table. This is done to get a sequence like the
index 42de04a..0c21514 100644 (file)
@@ -26,14 +26,14 @@ static inline int arch_is_kernel_initmem_freed(unsigned long addr)
  * final .boot.data section, which should be identical in the decompressor and
  * the decompressed kernel (that is checked during the build).
  */
-#define __bootdata(var) __section(.boot.data.var) var
+#define __bootdata(var) __section(".boot.data." #var) var
 
 /*
  * .boot.preserved.data is similar to .boot.data, but it is not part of the
  * .init section and thus will be preserved for later use in the decompressed
  * kernel.
  */
-#define __bootdata_preserved(var) __section(.boot.preserved.data.var) var
+#define __bootdata_preserved(var) __section(".boot.preserved.data." #var) var
 
 extern unsigned long __sdma, __edma;
 extern unsigned long __stext_dma, __etext_dma;
diff --git a/arch/s390/include/asm/vdso/vdso.h b/arch/s390/include/asm/vdso/vdso.h
deleted file mode 100644 (file)
index e69de29..0000000
index ece58f2..2012c1c 100644 (file)
@@ -61,14 +61,6 @@ int main(void)
        BLANK();
        OFFSET(__VDSO_GETCPU_VAL, vdso_per_cpu_data, getcpu_val);
        BLANK();
-       /* constants used by the vdso */
-       DEFINE(__CLOCK_REALTIME, CLOCK_REALTIME);
-       DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC);
-       DEFINE(__CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE);
-       DEFINE(__CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC_COARSE);
-       DEFINE(__CLOCK_THREAD_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID);
-       DEFINE(__CLOCK_COARSE_RES, LOW_RES_NSEC);
-       BLANK();
        /* idle data offsets */
        OFFSET(__CLOCK_IDLE_ENTER, s390_idle_data, clock_idle_enter);
        OFFSET(__CLOCK_IDLE_EXIT, s390_idle_data, clock_idle_exit);
index ebfe86d..390d97d 100644 (file)
@@ -855,13 +855,14 @@ void __init smp_detect_cpus(void)
 
 static void smp_init_secondary(void)
 {
-       int cpu = smp_processor_id();
+       int cpu = raw_smp_processor_id();
 
        S390_lowcore.last_update_clock = get_tod_clock();
        restore_access_regs(S390_lowcore.access_regs_save_area);
        set_cpu_flag(CIF_ASCE_PRIMARY);
        set_cpu_flag(CIF_ASCE_SECONDARY);
        cpu_init();
+       rcu_cpu_starting(cpu);
        preempt_disable();
        init_cpu_timer();
        vtime_init();
index 284939f..7776785 100644 (file)
@@ -48,7 +48,7 @@
 #include <asm/uv.h>
 #include <linux/virtio_config.h>
 
-pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(.bss..swapper_pg_dir);
+pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(".bss..swapper_pg_dir");
 
 unsigned long empty_zero_page, zero_page_mask;
 EXPORT_SYMBOL(empty_zero_page);
index d33f215..9a6bae5 100644 (file)
@@ -101,6 +101,10 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
                if (ret)
                        break;
 
+               /* the PCI function will be scanned once function 0 appears */
+               if (!zdev->zbus->bus)
+                       break;
+
                pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn);
                if (!pdev)
                        break;
index d91065e..bffbe69 100644 (file)
@@ -49,7 +49,7 @@ static struct plat_smp_ops dummy_smp_ops = {
 
 extern const struct of_cpu_method __cpu_method_of_table[];
 const struct of_cpu_method __cpu_method_of_table_sentinel
-       __section(__cpu_method_of_table_end);
+       __section("__cpu_method_of_table_end");
 
 static void sh_of_smp_probe(void)
 {
index a293343..32dfa6b 100644 (file)
@@ -14,7 +14,7 @@
 
 #define L1_CACHE_BYTES         (1 << L1_CACHE_SHIFT)
 
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(".data..read_mostly")
 
 #ifndef __ASSEMBLY__
 struct cache_info {
index f7d0554..2b4b085 100644 (file)
@@ -36,6 +36,6 @@ extern struct sh_machine_vector sh_mv;
 #define get_system_type()      sh_mv.mv_name
 
 #define __initmv \
-       __used __section(.machvec.init)
+       __used __section(".machvec.init")
 
 #endif /* _ASM_SH_MACHVEC_H */
index 100bf24..199381f 100644 (file)
@@ -71,7 +71,7 @@ struct of_cpu_method {
 
 #define CPU_METHOD_OF_DECLARE(name, _method, _ops)                     \
        static const struct of_cpu_method __cpu_method_of_table_##name  \
-               __used __section(__cpu_method_of_table)                 \
+               __used __section("__cpu_method_of_table")               \
                = { .method = _method, .ops = _ops }
 
 #else
index dcfd581..e62fd0e 100644 (file)
@@ -21,6 +21,6 @@
 
 #define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT)
 
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(".data..read_mostly")
 
 #endif /* !(_SPARC_CACHE_H) */
index 5869773..e2d3f0d 100644 (file)
@@ -24,7 +24,7 @@ static void draw_byte_32(unsigned char *bits, unsigned int *base, int rb);
 static void draw_byte_16(unsigned char *bits, unsigned int *base, int rb);
 static void draw_byte_8(unsigned char *bits, unsigned int *base, int rb);
 
-#define __force_data __attribute__((__section__(".data")))
+#define __force_data __section(".data")
 
 static int g_loc_X __force_data;
 static int g_loc_Y __force_data;
index c66de43..1a659e2 100644 (file)
@@ -45,15 +45,15 @@ typedef void (*exitcall_t)(void);
 
 /* These are for everybody (although not all archs will actually
    discard it in modules) */
-#define __init         __section(.init.text)
-#define __initdata     __section(.init.data)
-#define __exitdata     __section(.exit.data)
-#define __exit_call    __used __section(.exitcall.exit)
+#define __init         __section(".init.text")
+#define __initdata     __section(".init.data")
+#define __exitdata     __section(".exit.data")
+#define __exit_call    __used __section(".exitcall.exit")
 
 #ifdef MODULE
-#define __exit         __section(.exit.text)
+#define __exit         __section(".exit.text")
 #else
-#define __exit         __used __section(.exit.text)
+#define __exit         __used __section(".exit.text")
 #endif
 
 #endif
@@ -102,10 +102,10 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
  * Mark functions and data as being only used at initialization
  * or exit time.
  */
-#define __uml_init_setup       __used __section(.uml.setup.init)
-#define __uml_setup_help       __used __section(.uml.help.init)
-#define __uml_postsetup_call   __used __section(.uml.postsetup.init)
-#define __uml_exit_call                __used __section(.uml.exitcall.exit)
+#define __uml_init_setup       __used __section(".uml.setup.init")
+#define __uml_setup_help       __used __section(".uml.help.init")
+#define __uml_postsetup_call   __used __section(".uml.postsetup.init")
+#define __uml_exit_call                __used __section(".uml.exitcall.exit")
 
 #ifdef __UM_HOST__
 
@@ -120,7 +120,7 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
 
 #define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn
 
-#define __init_call    __used __section(.initcall.init)
+#define __init_call    __used __section(".initcall.init")
 
 #endif
 
index 00141e7..76b3729 100644 (file)
@@ -52,7 +52,7 @@ struct cpuinfo_um boot_cpu_data = {
 };
 
 union thread_union cpu0_irqstack
-       __attribute__((__section__(".data..init_irqstack"))) =
+       __section(".data..init_irqstack") =
                { .thread_info = INIT_THREAD_INFO(init_task) };
 
 /* Changed in setup_arch, which is called in early boot */
index 1c80f17..017de6c 100644 (file)
@@ -544,6 +544,9 @@ SYM_FUNC_START_LOCAL_NOALIGN(.Lrelocated)
        pushq   %rsi
        call    set_sev_encryption_mask
        call    load_stage2_idt
+
+       /* Pass boot_params to initialize_identity_maps() */
+       movq    (%rsp), %rdi
        call    initialize_identity_maps
        popq    %rsi
 
index 063a60e..39b2ede 100644 (file)
 #define __PAGE_OFFSET __PAGE_OFFSET_BASE
 #include "../../mm/ident_map.c"
 
-#ifdef CONFIG_X86_5LEVEL
-unsigned int __pgtable_l5_enabled;
-unsigned int pgdir_shift = 39;
-unsigned int ptrs_per_p4d = 1;
-#endif
+#define _SETUP
+#include <asm/setup.h> /* For COMMAND_LINE_SIZE */
+#undef _SETUP
+
+extern unsigned long get_cmd_line_ptr(void);
 
 /* Used by PAGE_KERN* macros: */
 pteval_t __default_kernel_pte_mask __read_mostly = ~0;
@@ -107,8 +107,10 @@ static void add_identity_map(unsigned long start, unsigned long end)
 }
 
 /* Locates and clears a region for a new top level page table. */
-void initialize_identity_maps(void)
+void initialize_identity_maps(void *rmode)
 {
+       unsigned long cmdline;
+
        /* Exclude the encryption mask from __PHYSICAL_MASK */
        physical_mask &= ~sme_me_mask;
 
@@ -149,10 +151,20 @@ void initialize_identity_maps(void)
        }
 
        /*
-        * New page-table is set up - map the kernel image and load it
-        * into cr3.
+        * New page-table is set up - map the kernel image, boot_params and the
+        * command line. The uncompressed kernel requires boot_params and the
+        * command line to be mapped in the identity mapping. Map them
+        * explicitly here in case the compressed kernel does not touch them,
+        * or does not touch all the pages covering them.
         */
        add_identity_map((unsigned long)_head, (unsigned long)_end);
+       boot_params = rmode;
+       add_identity_map((unsigned long)boot_params, (unsigned long)(boot_params + 1));
+       cmdline = get_cmd_line_ptr();
+       add_identity_map(cmdline, cmdline + COMMAND_LINE_SIZE);
+
+       /* Load the new page-table. */
+       sev_verify_cbit(top_level_pgt);
        write_cr3(top_level_pgt);
 }
 
index b59547c..b92fffb 100644 (file)
@@ -840,14 +840,6 @@ void choose_random_location(unsigned long input,
                return;
        }
 
-#ifdef CONFIG_X86_5LEVEL
-       if (__read_cr4() & X86_CR4_LA57) {
-               __pgtable_l5_enabled = 1;
-               pgdir_shift = 48;
-               ptrs_per_p4d = 512;
-       }
-#endif
-
        boot_params->hdr.loadflags |= KASLR_FLAG;
 
        if (IS_ENABLED(CONFIG_X86_32))
index dd07e7b..aa56179 100644 (file)
@@ -68,6 +68,9 @@ SYM_FUNC_START(get_sev_encryption_bit)
 SYM_FUNC_END(get_sev_encryption_bit)
 
        .code64
+
+#include "../../kernel/sev_verify_cbit.S"
+
 SYM_FUNC_START(set_sev_encryption_mask)
 #ifdef CONFIG_AMD_MEM_ENCRYPT
        push    %rbp
@@ -81,6 +84,19 @@ SYM_FUNC_START(set_sev_encryption_mask)
 
        bts     %rax, sme_me_mask(%rip) /* Create the encryption mask */
 
+       /*
+        * Read MSR_AMD64_SEV again and store it to sev_status. Can't do this in
+        * get_sev_encryption_bit() because this function is 32-bit code and
+        * shared between 64-bit and 32-bit boot path.
+        */
+       movl    $MSR_AMD64_SEV, %ecx    /* Read the SEV MSR */
+       rdmsr
+
+       /* Store MSR value in sev_status */
+       shlq    $32, %rdx
+       orq     %rdx, %rax
+       movq    %rax, sev_status(%rip)
+
 .Lno_sev_mask:
        movq    %rbp, %rsp              /* Restore original stack pointer */
 
@@ -96,5 +112,7 @@ SYM_FUNC_END(set_sev_encryption_mask)
 
 #ifdef CONFIG_AMD_MEM_ENCRYPT
        .balign 8
-SYM_DATA(sme_me_mask, .quad 0)
+SYM_DATA(sme_me_mask,          .quad 0)
+SYM_DATA(sev_status,           .quad 0)
+SYM_DATA(sev_check_data,       .quad 0)
 #endif
index 6d31f1b..d9a631c 100644 (file)
@@ -159,4 +159,6 @@ void boot_page_fault(void);
 void boot_stage1_vc(void);
 void boot_stage2_vc(void);
 
+unsigned long sev_verify_cbit(unsigned long cr3);
+
 #endif /* BOOT_COMPRESSED_MISC_H */
index 7d0394f..2a78746 100644 (file)
@@ -8,6 +8,13 @@
 #define BIOS_START_MIN         0x20000U        /* 128K, less than this is insane */
 #define BIOS_START_MAX         0x9f000U        /* 640K, absolute maximum */
 
+#ifdef CONFIG_X86_5LEVEL
+/* __pgtable_l5_enabled needs to be in .data to avoid being cleared along with .bss */
+unsigned int __section(".data") __pgtable_l5_enabled;
+unsigned int __section(".data") pgdir_shift = 39;
+unsigned int __section(".data") ptrs_per_p4d = 1;
+#endif
+
 struct paging_config {
        unsigned long trampoline_start;
        unsigned long l5_required;
@@ -23,7 +30,7 @@ static char trampoline_save[TRAMPOLINE_32BIT_SIZE];
  * Avoid putting the pointer into .bss as it will be cleared between
  * paging_prepare() and extract_kernel().
  */
-unsigned long *trampoline_32bit __section(.data);
+unsigned long *trampoline_32bit __section(".data");
 
 extern struct boot_params *boot_params;
 int cmdline_find_option_bool(const char *option);
@@ -198,4 +205,13 @@ void cleanup_trampoline(void *pgtable)
 
        /* Restore trampoline memory */
        memcpy(trampoline_32bit, trampoline_save, TRAMPOLINE_32BIT_SIZE);
+
+       /* Initialize variables for 5-level paging */
+#ifdef CONFIG_X86_5LEVEL
+       if (__read_cr4() & X86_CR4_LA57) {
+               __pgtable_l5_enabled = 1;
+               pgdir_shift = 48;
+               ptrs_per_p4d = 512;
+       }
+#endif
 }
index 1fedabd..f7eb976 100644 (file)
@@ -25,7 +25,7 @@ int early_serial_base;
  * error during initialization.
  */
 
-static void __attribute__((section(".inittext"))) serial_putchar(int ch)
+static void __section(".inittext") serial_putchar(int ch)
 {
        unsigned timeout = 0xffff;
 
@@ -35,7 +35,7 @@ static void __attribute__((section(".inittext"))) serial_putchar(int ch)
        outb(ch, early_serial_base + TXR);
 }
 
-static void __attribute__((section(".inittext"))) bios_putchar(int ch)
+static void __section(".inittext") bios_putchar(int ch)
 {
        struct biosregs ireg;
 
@@ -47,7 +47,7 @@ static void __attribute__((section(".inittext"))) bios_putchar(int ch)
        intcall(0x10, &ireg, NULL);
 }
 
-void __attribute__((section(".inittext"))) putchar(int ch)
+void __section(".inittext") putchar(int ch)
 {
        if (ch == '\n')
                putchar('\r');  /* \n -> \r\n */
@@ -58,7 +58,7 @@ void __attribute__((section(".inittext"))) putchar(int ch)
                serial_putchar(ch);
 }
 
-void __attribute__((section(".inittext"))) puts(const char *str)
+void __section(".inittext") puts(const char *str)
 {
        while (*str)
                putchar(*str++);
index cbf7fed..04bde0b 100644 (file)
@@ -78,7 +78,7 @@ struct card_info {
        u16 xmode_n;            /* Size of unprobed mode range */
 };
 
-#define __videocard struct card_info __attribute__((used,section(".videocards")))
+#define __videocard struct card_info __section(".videocards") __attribute__((used))
 extern struct card_info video_cards[], video_cards_end[];
 
 int mode_defined(u16 mode);    /* video.c */
index e508dbd..c44aba2 100644 (file)
@@ -158,6 +158,7 @@ static unsigned int crypto_poly1305_setdctxkey(struct poly1305_desc_ctx *dctx,
                        dctx->s[1] = get_unaligned_le32(&inp[4]);
                        dctx->s[2] = get_unaligned_le32(&inp[8]);
                        dctx->s[3] = get_unaligned_le32(&inp[12]);
+                       acc += POLY1305_BLOCK_SIZE;
                        dctx->sset = true;
                }
        }
index 1f47e24..3798192 100644 (file)
 440    common  process_madvise         sys_process_madvise
 
 #
-# x32-specific system call numbers start at 512 to avoid cache impact
-# for native 64-bit operation. The __x32_compat_sys stubs are created
-# on-the-fly for compat_sys_*() compatibility system calls if X86_X32
-# is defined.
+# Due to a historical design error, certain syscalls are numbered differently
+# in x32 as compared to native x86_64.  These syscalls have numbers 512-547.
+# Do not add new syscalls to this range.  Numbers 548 and above are available
+# for non-x32 use.
 #
 512    x32     rt_sigaction            compat_sys_rt_sigaction
 513    x32     rt_sigreturn            compat_sys_x32_rt_sigreturn
 545    x32     execveat                compat_sys_execveat
 546    x32     preadv2                 compat_sys_preadv64v2
 547    x32     pwritev2                compat_sys_pwritev64v2
+# This is the end of the legacy x32 range.  Numbers 548 and above are
+# not special and are not to be used for x32-specific syscalls.
index 40e0e32..284e736 100644 (file)
@@ -273,11 +273,15 @@ void __init hv_apic_init(void)
                pr_info("Hyper-V: Using enlightened APIC (%s mode)",
                        x2apic_enabled() ? "x2apic" : "xapic");
                /*
-                * With x2apic, architectural x2apic MSRs are equivalent to the
-                * respective synthetic MSRs, so there's no need to override
-                * the apic accessors.  The only exception is
-                * hv_apic_eoi_write, because it benefits from lazy EOI when
-                * available, but it works for both xapic and x2apic modes.
+                * When in x2apic mode, don't use the Hyper-V specific APIC
+                * accessors since the field layout in the ICR register is
+                * different in x2apic mode. Furthermore, the architectural
+                * x2apic MSRs function just as well as the Hyper-V
+                * synthetic APIC MSRs, so there's no benefit in having
+                * separate Hyper-V accessors for x2apic mode. The only
+                * exception is hv_apic_eoi_write, because it benefits from
+                * lazy EOI when available, but the same accessor works for
+                * both xapic and x2apic because the field layout is the same.
                 */
                apic_set_eoi_write(hv_apic_eoi_write);
                if (!x2apic_enabled()) {
index 1c129ab..4e3099d 100644 (file)
@@ -374,12 +374,12 @@ extern struct apic *apic;
 #define apic_driver(sym)                                       \
        static const struct apic *__apicdrivers_##sym __used            \
        __aligned(sizeof(struct apic *))                        \
-       __section(.apicdrivers) = { &sym }
+       __section(".apicdrivers") = { &sym }
 
 #define apic_drivers(sym1, sym2)                                       \
        static struct apic *__apicdrivers_##sym1##sym2[2] __used        \
        __aligned(sizeof(struct apic *))                                \
-       __section(.apicdrivers) = { &sym1, &sym2 }
+       __section(".apicdrivers") = { &sym1, &sym2 }
 
 extern struct apic *__apicdrivers[], *__apicdrivers_end[];
 
index abe0869..69404ea 100644 (file)
@@ -8,7 +8,7 @@
 #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
 #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
 
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(".data..read_mostly")
 
 #define INTERNODE_CACHE_SHIFT CONFIG_X86_INTERNODE_CACHE_SHIFT
 #define INTERNODE_CACHE_BYTES (1 << INTERNODE_CACHE_SHIFT)
index de58391..cf0e25f 100644 (file)
@@ -43,7 +43,7 @@ struct devs_id {
 
 #define sfi_device(i)                                                          \
        static const struct devs_id *const __intel_mid_sfi_##i##_dev __used     \
-       __attribute__((__section__(".x86_intel_mid_dev.init"))) = &i
+       __section(".x86_intel_mid_dev.init") = &i
 
 /**
 * struct mid_sd_board_info - template for SD device creation
index 02a0cf5..2dfc8d3 100644 (file)
@@ -9,7 +9,7 @@
 #include <asm/nospec-branch.h>
 
 /* Provide __cpuidle; we can't safely include <linux/cpu.h> */
-#define __cpuidle __attribute__((__section__(".cpuidle.text")))
+#define __cpuidle __section(".cpuidle.text")
 
 /*
  * Interrupt control:
index c9f5df0..2f62bbd 100644 (file)
@@ -54,7 +54,7 @@ bool sme_active(void);
 bool sev_active(void);
 bool sev_es_active(void);
 
-#define __bss_decrypted __attribute__((__section__(".bss..decrypted")))
+#define __bss_decrypted __section(".bss..decrypted")
 
 #else  /* !CONFIG_AMD_MEM_ENCRYPT */
 
index 7d7a064..389d851 100644 (file)
@@ -119,7 +119,7 @@ void *extend_brk(size_t size, size_t align);
  * executable.)
  */
 #define RESERVE_BRK(name,sz)                                           \
-       static void __section(.discard.text) __used notrace             \
+       static void __section(".discard.text") __used notrace           \
        __brk_reservation_fn_##name##__(void) {                         \
                asm volatile (                                          \
                        ".pushsection .brk_reservation,\"aw\",@nobits;" \
index f136595..c9fa7be 100644 (file)
@@ -208,16 +208,24 @@ extern void __put_user_nocheck_2(void);
 extern void __put_user_nocheck_4(void);
 extern void __put_user_nocheck_8(void);
 
+/*
+ * ptr must be evaluated and assigned to the temporary __ptr_pu before
+ * the assignment of x to __val_pu, to avoid any function calls
+ * involved in the ptr expression (possibly implicitly generated due
+ * to KASAN) from clobbering %ax.
+ */
 #define do_put_user_call(fn,x,ptr)                                     \
 ({                                                                     \
        int __ret_pu;                                                   \
+       void __user *__ptr_pu;                                          \
        register __typeof__(*(ptr)) __val_pu asm("%"_ASM_AX);           \
        __chk_user_ptr(ptr);                                            \
+       __ptr_pu = (ptr);                                               \
        __val_pu = (x);                                                 \
        asm volatile("call __" #fn "_%P[size]"                          \
                     : "=c" (__ret_pu),                                 \
                        ASM_CALL_CONSTRAINT                             \
-                    : "0" (ptr),                                       \
+                    : "0" (__ptr_pu),                                  \
                       "r" (__val_pu),                                  \
                       [size] "i" (sizeof(*(ptr)))                      \
                     :"ebx");                                           \
index 812e9b4..950afeb 100644 (file)
@@ -32,6 +32,7 @@
 #define KVM_FEATURE_POLL_CONTROL       12
 #define KVM_FEATURE_PV_SCHED_YIELD     13
 #define KVM_FEATURE_ASYNC_PF_INT       14
+#define KVM_FEATURE_MSI_EXT_DEST_ID    15
 
 #define KVM_HINTS_REALTIME      0
 
index 04ceea8..68608bd 100644 (file)
@@ -47,6 +47,8 @@ endif
 # non-deterministic coverage.
 KCOV_INSTRUMENT                := n
 
+CFLAGS_head$(BITS).o   += -fno-stack-protector
+
 CFLAGS_irq.o := -I $(srctree)/$(src)/../include/asm/trace
 
 obj-y                  := process_$(BITS).o signal.o
index 4adbe65..2400ad6 100644 (file)
@@ -807,6 +807,15 @@ static inline temp_mm_state_t use_temporary_mm(struct mm_struct *mm)
        temp_mm_state_t temp_state;
 
        lockdep_assert_irqs_disabled();
+
+       /*
+        * Make sure not to be in TLB lazy mode, as otherwise we'll end up
+        * with a stale address space WITHOUT being in lazy mode after
+        * restoring the previous mm.
+        */
+       if (this_cpu_read(cpu_tlbstate.is_lazy))
+               leave_mm(smp_processor_id());
+
        temp_state.mm = this_cpu_read(cpu_tlbstate.loaded_mm);
        switch_mm_irqs_off(NULL, mm, current);
 
index 714233c..3115caa 100644 (file)
@@ -290,6 +290,9 @@ static void __init uv_stringify(int len, char *to, char *from)
 {
        /* Relies on 'to' being NULL chars so result will be NULL terminated */
        strncpy(to, from, len-1);
+
+       /* Trim trailing spaces */
+       (void)strim(to);
 }
 
 /* Find UV arch type entry in UVsystab */
@@ -366,7 +369,7 @@ static int __init early_get_arch_type(void)
        return ret;
 }
 
-static int __init uv_set_system_type(char *_oem_id)
+static int __init uv_set_system_type(char *_oem_id, char *_oem_table_id)
 {
        /* Save OEM_ID passed from ACPI MADT */
        uv_stringify(sizeof(oem_id), oem_id, _oem_id);
@@ -386,13 +389,23 @@ static int __init uv_set_system_type(char *_oem_id)
                        /* (Not hubless), not a UV */
                        return 0;
 
+               /* Is UV hubless system */
+               uv_hubless_system = 0x01;
+
+               /* UV5 Hubless */
+               if (strncmp(uv_archtype, "NSGI5", 5) == 0)
+                       uv_hubless_system |= 0x20;
+
                /* UV4 Hubless: CH */
-               if (strncmp(uv_archtype, "NSGI4", 5) == 0)
-                       uv_hubless_system = 0x11;
+               else if (strncmp(uv_archtype, "NSGI4", 5) == 0)
+                       uv_hubless_system |= 0x10;
 
                /* UV3 Hubless: UV300/MC990X w/o hub */
                else
-                       uv_hubless_system = 0x9;
+                       uv_hubless_system |= 0x8;
+
+               /* Copy APIC type */
+               uv_stringify(sizeof(oem_table_id), oem_table_id, _oem_table_id);
 
                pr_info("UV: OEM IDs %s/%s, SystemType %d, HUBLESS ID %x\n",
                        oem_id, oem_table_id, uv_system_type, uv_hubless_system);
@@ -456,7 +469,7 @@ static int __init uv_acpi_madt_oem_check(char *_oem_id, char *_oem_table_id)
        uv_cpu_info->p_uv_hub_info = &uv_hub_info_node0;
 
        /* If not UV, return. */
-       if (likely(uv_set_system_type(_oem_id) == 0))
+       if (uv_set_system_type(_oem_id, _oem_table_id) == 0)
                return 0;
 
        /* Save and Decode OEM Table ID */
index d3f0db4..581fb72 100644 (file)
@@ -1254,6 +1254,14 @@ static int ssb_prctl_set(struct task_struct *task, unsigned long ctrl)
        return 0;
 }
 
+static bool is_spec_ib_user_controlled(void)
+{
+       return spectre_v2_user_ibpb == SPECTRE_V2_USER_PRCTL ||
+               spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP ||
+               spectre_v2_user_stibp == SPECTRE_V2_USER_PRCTL ||
+               spectre_v2_user_stibp == SPECTRE_V2_USER_SECCOMP;
+}
+
 static int ib_prctl_set(struct task_struct *task, unsigned long ctrl)
 {
        switch (ctrl) {
@@ -1261,16 +1269,26 @@ static int ib_prctl_set(struct task_struct *task, unsigned long ctrl)
                if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE &&
                    spectre_v2_user_stibp == SPECTRE_V2_USER_NONE)
                        return 0;
+
                /*
-                * Indirect branch speculation is always disabled in strict
-                * mode. It can neither be enabled if it was force-disabled
-                * by a  previous prctl call.
+                * With strict mode for both IBPB and STIBP, the instruction
+                * code paths avoid checking this task flag and instead,
+                * unconditionally run the instruction. However, STIBP and IBPB
+                * are independent and either can be set to conditionally
+                * enabled regardless of the mode of the other.
+                *
+                * If either is set to conditional, allow the task flag to be
+                * updated, unless it was force-disabled by a previous prctl
+                * call. Currently, this is possible on an AMD CPU which has the
+                * feature X86_FEATURE_AMD_STIBP_ALWAYS_ON. In this case, if the
+                * kernel is booted with 'spectre_v2_user=seccomp', then
+                * spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP and
+                * spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED.
                 */
-               if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT ||
-                   spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT ||
-                   spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED ||
+               if (!is_spec_ib_user_controlled() ||
                    task_spec_ib_force_disable(task))
                        return -EPERM;
+
                task_clear_spec_ib_disable(task);
                task_update_spec_tif(task);
                break;
@@ -1283,10 +1301,10 @@ static int ib_prctl_set(struct task_struct *task, unsigned long ctrl)
                if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE &&
                    spectre_v2_user_stibp == SPECTRE_V2_USER_NONE)
                        return -EPERM;
-               if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT ||
-                   spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT ||
-                   spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED)
+
+               if (!is_spec_ib_user_controlled())
                        return 0;
+
                task_set_spec_ib_disable(task);
                if (ctrl == PR_SPEC_FORCE_DISABLE)
                        task_set_spec_ib_force_disable(task);
@@ -1351,20 +1369,17 @@ static int ib_prctl_get(struct task_struct *task)
        if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE &&
            spectre_v2_user_stibp == SPECTRE_V2_USER_NONE)
                return PR_SPEC_ENABLE;
-       else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT ||
-           spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT ||
-           spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED)
-               return PR_SPEC_DISABLE;
-       else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_PRCTL ||
-           spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP ||
-           spectre_v2_user_stibp == SPECTRE_V2_USER_PRCTL ||
-           spectre_v2_user_stibp == SPECTRE_V2_USER_SECCOMP) {
+       else if (is_spec_ib_user_controlled()) {
                if (task_spec_ib_force_disable(task))
                        return PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE;
                if (task_spec_ib_disable(task))
                        return PR_SPEC_PRCTL | PR_SPEC_DISABLE;
                return PR_SPEC_PRCTL | PR_SPEC_ENABLE;
-       } else
+       } else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT ||
+           spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT ||
+           spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED)
+               return PR_SPEC_DISABLE;
+       else
                return PR_SPEC_NOT_AFFECTED;
 }
 
index 9d03369..6794412 100644 (file)
@@ -38,7 +38,7 @@ struct _tlb_table {
 
 #define cpu_dev_register(cpu_devX) \
        static const struct cpu_dev *const __cpu_dev_##cpu_devX __used \
-       __attribute__((__section__(".x86_cpu_dev.init"))) = \
+       __section(".x86_cpu_dev.init") = \
        &cpu_devX;
 
 extern const struct cpu_dev *const __x86_cpu_dev_start[],
index 4199f25..05e1171 100644 (file)
@@ -84,7 +84,7 @@ static struct desc_ptr startup_gdt_descr = {
        .address = 0,
 };
 
-#define __head __section(.head.text)
+#define __head __section(".head.text")
 
 static void __head *fixup_pointer(void *ptr, unsigned long physaddr)
 {
index 7eb2a1c..3c41773 100644 (file)
@@ -161,6 +161,21 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
 
        /* Setup early boot stage 4-/5-level pagetables. */
        addq    phys_base(%rip), %rax
+
+       /*
+        * For SEV guests: Verify that the C-bit is correct. A malicious
+        * hypervisor could lie about the C-bit position to perform a ROP
+        * attack on the guest by writing to the unencrypted stack and wait for
+        * the next RET instruction.
+        * %rsi carries pointer to realmode data and is callee-clobbered. Save
+        * and restore it.
+        */
+       pushq   %rsi
+       movq    %rax, %rdi
+       call    sev_verify_cbit
+       popq    %rsi
+
+       /* Switch to new page-table */
        movq    %rax, %cr3
 
        /* Ensure I am executing from virtual addresses */
@@ -279,6 +294,7 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
 SYM_CODE_END(secondary_startup_64)
 
 #include "verify_cpu.S"
+#include "sev_verify_cbit.S"
 
 #ifdef CONFIG_HOTPLUG_CPU
 /*
index 57c2ecf..ce831f9 100644 (file)
@@ -200,8 +200,7 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
        params->hdr.hardware_subarch = boot_params.hdr.hardware_subarch;
 
        /* Copying screen_info will do? */
-       memcpy(&params->screen_info, &boot_params.screen_info,
-                               sizeof(struct screen_info));
+       memcpy(&params->screen_info, &screen_info, sizeof(struct screen_info));
 
        /* Fill in memsize later */
        params->screen_info.ext_mem_k = 0;
index 5f83cca..7d04b35 100644 (file)
@@ -178,6 +178,32 @@ void __init do_vc_no_ghcb(struct pt_regs *regs, unsigned long exit_code)
                goto fail;
        regs->dx = val >> 32;
 
+       /*
+        * This is a VC handler and the #VC is only raised when SEV-ES is
+        * active, which means SEV must be active too. Do sanity checks on the
+        * CPUID results to make sure the hypervisor does not trick the kernel
+        * into the no-sev path. This could map sensitive data unencrypted and
+        * make it accessible to the hypervisor.
+        *
+        * In particular, check for:
+        *      - Hypervisor CPUID bit
+        *      - Availability of CPUID leaf 0x8000001f
+        *      - SEV CPUID bit.
+        *
+        * The hypervisor might still report the wrong C-bit position, but this
+        * can't be checked here.
+        */
+
+       if ((fn == 1 && !(regs->cx & BIT(31))))
+               /* Hypervisor bit */
+               goto fail;
+       else if (fn == 0x80000000 && (regs->ax < 0x8000001f))
+               /* SEV leaf check */
+               goto fail;
+       else if ((fn == 0x8000001f && !(regs->ax & BIT(1))))
+               /* SEV bit */
+               goto fail;
+
        /* Skip over the CPUID two-byte opcode */
        regs->ip += 2;
 
index 4a96726..0bd1a0f 100644 (file)
@@ -374,8 +374,8 @@ fault:
        return ES_EXCEPTION;
 }
 
-static bool vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
-                                unsigned long vaddr, phys_addr_t *paddr)
+static enum es_result vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
+                                          unsigned long vaddr, phys_addr_t *paddr)
 {
        unsigned long va = (unsigned long)vaddr;
        unsigned int level;
@@ -394,15 +394,19 @@ static bool vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
                if (user_mode(ctxt->regs))
                        ctxt->fi.error_code |= X86_PF_USER;
 
-               return false;
+               return ES_EXCEPTION;
        }
 
+       if (WARN_ON_ONCE(pte_val(*pte) & _PAGE_ENC))
+               /* Emulated MMIO to/from encrypted memory not supported */
+               return ES_UNSUPPORTED;
+
        pa = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT;
        pa |= va & ~page_level_mask(level);
 
        *paddr = pa;
 
-       return true;
+       return ES_OK;
 }
 
 /* Include code shared with pre-decompression boot stage */
@@ -731,6 +735,7 @@ static enum es_result vc_do_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
 {
        u64 exit_code, exit_info_1, exit_info_2;
        unsigned long ghcb_pa = __pa(ghcb);
+       enum es_result res;
        phys_addr_t paddr;
        void __user *ref;
 
@@ -740,11 +745,12 @@ static enum es_result vc_do_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
 
        exit_code = read ? SVM_VMGEXIT_MMIO_READ : SVM_VMGEXIT_MMIO_WRITE;
 
-       if (!vc_slow_virt_to_phys(ghcb, ctxt, (unsigned long)ref, &paddr)) {
-               if (!read)
+       res = vc_slow_virt_to_phys(ghcb, ctxt, (unsigned long)ref, &paddr);
+       if (res != ES_OK) {
+               if (res == ES_EXCEPTION && !read)
                        ctxt->fi.error_code |= X86_PF_WRITE;
 
-               return ES_EXCEPTION;
+               return res;
        }
 
        exit_info_1 = paddr;
diff --git a/arch/x86/kernel/sev_verify_cbit.S b/arch/x86/kernel/sev_verify_cbit.S
new file mode 100644 (file)
index 0000000..ee04941
--- /dev/null
@@ -0,0 +1,89 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ *     sev_verify_cbit.S - Code for verification of the C-bit position reported
+ *                         by the Hypervisor when running with SEV enabled.
+ *
+ *     Copyright (c) 2020  Joerg Roedel (jroedel@suse.de)
+ *
+ * sev_verify_cbit() is called before switching to a new long-mode page-table
+ * at boot.
+ *
+ * Verify that the C-bit position is correct by writing a random value to
+ * an encrypted memory location while on the current page-table. Then it
+ * switches to the new page-table to verify the memory content is still the
+ * same. After that it switches back to the current page-table and when the
+ * check succeeded it returns. If the check failed the code invalidates the
+ * stack pointer and goes into a hlt loop. The stack-pointer is invalidated to
+ * make sure no interrupt or exception can get the CPU out of the hlt loop.
+ *
+ * New page-table pointer is expected in %rdi (first parameter)
+ *
+ */
+SYM_FUNC_START(sev_verify_cbit)
+#ifdef CONFIG_AMD_MEM_ENCRYPT
+       /* First check if a C-bit was detected */
+       movq    sme_me_mask(%rip), %rsi
+       testq   %rsi, %rsi
+       jz      3f
+
+       /* sme_me_mask != 0 could mean SME or SEV - Check also for SEV */
+       movq    sev_status(%rip), %rsi
+       testq   %rsi, %rsi
+       jz      3f
+
+       /* Save CR4 in %rsi */
+       movq    %cr4, %rsi
+
+       /* Disable Global Pages */
+       movq    %rsi, %rdx
+       andq    $(~X86_CR4_PGE), %rdx
+       movq    %rdx, %cr4
+
+       /*
+        * Verified that running under SEV - now get a random value using
+        * RDRAND. This instruction is mandatory when running as an SEV guest.
+        *
+        * Don't bail out of the loop if RDRAND returns errors. It is better to
+        * prevent forward progress than to work with a non-random value here.
+        */
+1:     rdrand  %rdx
+       jnc     1b
+
+       /* Store value to memory and keep it in %rdx */
+       movq    %rdx, sev_check_data(%rip)
+
+       /* Backup current %cr3 value to restore it later */
+       movq    %cr3, %rcx
+
+       /* Switch to new %cr3 - This might unmap the stack */
+       movq    %rdi, %cr3
+
+       /*
+        * Compare value in %rdx with memory location. If C-bit is incorrect
+        * this would read the encrypted data and make the check fail.
+        */
+       cmpq    %rdx, sev_check_data(%rip)
+
+       /* Restore old %cr3 */
+       movq    %rcx, %cr3
+
+       /* Restore previous CR4 */
+       movq    %rsi, %cr4
+
+       /* Check CMPQ result */
+       je      3f
+
+       /*
+        * The check failed, prevent any forward progress to prevent ROP
+        * attacks, invalidate the stack and go into a hlt loop.
+        */
+       xorq    %rsp, %rsp
+       subq    $0x1000, %rsp
+2:     hlt
+       jmp 2b
+3:
+#endif
+       /* Return page-table pointer */
+       movq    %rdi, %rax
+       ret
+SYM_FUNC_END(sev_verify_cbit)
index 3c70fb3..e19df6c 100644 (file)
@@ -793,19 +793,6 @@ static __always_inline unsigned long debug_read_clear_dr6(void)
        set_debugreg(DR6_RESERVED, 6);
        dr6 ^= DR6_RESERVED; /* Flip to positive polarity */
 
-       /*
-        * Clear the virtual DR6 value, ptrace routines will set bits here for
-        * things we want signals for.
-        */
-       current->thread.virtual_dr6 = 0;
-
-       /*
-        * The SDM says "The processor clears the BTF flag when it
-        * generates a debug exception."  Clear TIF_BLOCKSTEP to keep
-        * TIF_BLOCKSTEP in sync with the hardware BTF flag.
-        */
-       clear_thread_flag(TIF_BLOCKSTEP);
-
        return dr6;
 }
 
@@ -873,6 +860,20 @@ static __always_inline void exc_debug_kernel(struct pt_regs *regs,
         */
        WARN_ON_ONCE(user_mode(regs));
 
+       if (test_thread_flag(TIF_BLOCKSTEP)) {
+               /*
+                * The SDM says "The processor clears the BTF flag when it
+                * generates a debug exception." but PTRACE_BLOCKSTEP requested
+                * it for userspace, but we just took a kernel #DB, so re-set
+                * BTF.
+                */
+               unsigned long debugctl;
+
+               rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
+               debugctl |= DEBUGCTLMSR_BTF;
+               wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
+       }
+
        /*
         * Catch SYSENTER with TF set and clear DR_STEP. If this hit a
         * watchpoint at the same time then that will still be handled.
@@ -936,6 +937,22 @@ static __always_inline void exc_debug_user(struct pt_regs *regs,
        instrumentation_begin();
 
        /*
+        * Start the virtual/ptrace DR6 value with just the DR_STEP mask
+        * of the real DR6. ptrace_triggered() will set the DR_TRAPn bits.
+        *
+        * Userspace expects DR_STEP to be visible in ptrace_get_debugreg(6)
+        * even if it is not the result of PTRACE_SINGLESTEP.
+        */
+       current->thread.virtual_dr6 = (dr6 & DR_STEP);
+
+       /*
+        * The SDM says "The processor clears the BTF flag when it
+        * generates a debug exception."  Clear TIF_BLOCKSTEP to keep
+        * TIF_BLOCKSTEP in sync with the hardware BTF flag.
+        */
+       clear_thread_flag(TIF_BLOCKSTEP);
+
+       /*
         * If dr6 has no reason to give us about the origin of this trap,
         * then it's very likely the result of an icebp/int01 trap.
         * User wants a sigtrap for that.
index 6a339ce..73f8001 100644 (file)
@@ -321,19 +321,12 @@ EXPORT_SYMBOL_GPL(unwind_get_return_address);
 
 unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
 {
-       struct task_struct *task = state->task;
-
        if (unwind_done(state))
                return NULL;
 
        if (state->regs)
                return &state->regs->ip;
 
-       if (task != current && state->sp == task->thread.sp) {
-               struct inactive_task_frame *frame = (void *)task->thread.sp;
-               return &frame->ret_addr;
-       }
-
        if (state->sp)
                return (unsigned long *)state->sp - 1;
 
@@ -663,7 +656,7 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,
        } else {
                struct inactive_task_frame *frame = (void *)task->thread.sp;
 
-               state->sp = task->thread.sp;
+               state->sp = task->thread.sp + sizeof(*frame);
                state->bp = READ_ONCE_NOCHECK(frame->bp);
                state->ip = READ_ONCE_NOCHECK(frame->ret_addr);
                state->signal = (void *)state->ip == ret_from_fork;
index 06a278b..d50041f 100644 (file)
@@ -90,6 +90,20 @@ static int kvm_check_cpuid(struct kvm_cpuid_entry2 *entries, int nent)
        return 0;
 }
 
+void kvm_update_pv_runtime(struct kvm_vcpu *vcpu)
+{
+       struct kvm_cpuid_entry2 *best;
+
+       best = kvm_find_cpuid_entry(vcpu, KVM_CPUID_FEATURES, 0);
+
+       /*
+        * save the feature bitmap to avoid cpuid lookup for every PV
+        * operation
+        */
+       if (best)
+               vcpu->arch.pv_cpuid.features = best->eax;
+}
+
 void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu)
 {
        struct kvm_cpuid_entry2 *best;
@@ -124,13 +138,6 @@ void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu)
                (best->eax & (1 << KVM_FEATURE_PV_UNHALT)))
                best->eax &= ~(1 << KVM_FEATURE_PV_UNHALT);
 
-       /*
-        * save the feature bitmap to avoid cpuid lookup for every PV
-        * operation
-        */
-       if (best)
-               vcpu->arch.pv_cpuid.features = best->eax;
-
        if (!kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT)) {
                best = kvm_find_cpuid_entry(vcpu, 0x1, 0);
                if (best)
@@ -162,6 +169,8 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
                vcpu->arch.guest_supported_xcr0 =
                        (best->eax | ((u64)best->edx << 32)) & supported_xcr0;
 
+       kvm_update_pv_runtime(vcpu);
+
        vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu);
        kvm_mmu_reset_context(vcpu);
 
index bf85779..f7a6e8f 100644 (file)
@@ -11,6 +11,7 @@ extern u32 kvm_cpu_caps[NCAPINTS] __read_mostly;
 void kvm_set_cpu_caps(void);
 
 void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu);
+void kvm_update_pv_runtime(struct kvm_vcpu *vcpu);
 struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu,
                                              u32 function, u32 index);
 int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid,
index d057376..698969e 100644 (file)
@@ -197,12 +197,9 @@ static void ioapic_lazy_update_eoi(struct kvm_ioapic *ioapic, int irq)
 
                /*
                 * If no longer has pending EOI in LAPICs, update
-                * EOI for this vetor.
+                * EOI for this vector.
                 */
                rtc_irq_eoi(ioapic, vcpu, entry->fields.vector);
-               kvm_ioapic_update_eoi_one(vcpu, ioapic,
-                                         entry->fields.trig_mode,
-                                         irq);
                break;
        }
 }
index 17587f4..5bb1939 100644 (file)
@@ -225,7 +225,7 @@ static gfn_t get_mmio_spte_gfn(u64 spte)
 {
        u64 gpa = spte & shadow_nonpresent_or_rsvd_lower_gfn_mask;
 
-       gpa |= (spte >> shadow_nonpresent_or_rsvd_mask_len)
+       gpa |= (spte >> SHADOW_NONPRESENT_OR_RSVD_MASK_LEN)
               & shadow_nonpresent_or_rsvd_mask;
 
        return gpa >> PAGE_SHIFT;
@@ -591,15 +591,15 @@ static u64 mmu_spte_get_lockless(u64 *sptep)
 static u64 restore_acc_track_spte(u64 spte)
 {
        u64 new_spte = spte;
-       u64 saved_bits = (spte >> shadow_acc_track_saved_bits_shift)
-                        & shadow_acc_track_saved_bits_mask;
+       u64 saved_bits = (spte >> SHADOW_ACC_TRACK_SAVED_BITS_SHIFT)
+                        & SHADOW_ACC_TRACK_SAVED_BITS_MASK;
 
        WARN_ON_ONCE(spte_ad_enabled(spte));
        WARN_ON_ONCE(!is_access_track_spte(spte));
 
        new_spte &= ~shadow_acc_track_mask;
-       new_spte &= ~(shadow_acc_track_saved_bits_mask <<
-                     shadow_acc_track_saved_bits_shift);
+       new_spte &= ~(SHADOW_ACC_TRACK_SAVED_BITS_MASK <<
+                     SHADOW_ACC_TRACK_SAVED_BITS_SHIFT);
        new_spte |= saved_bits;
 
        return new_spte;
@@ -856,12 +856,14 @@ static int pte_list_add(struct kvm_vcpu *vcpu, u64 *spte,
        } else {
                rmap_printk("pte_list_add: %p %llx many->many\n", spte, *spte);
                desc = (struct pte_list_desc *)(rmap_head->val & ~1ul);
-               while (desc->sptes[PTE_LIST_EXT-1] && desc->more) {
-                       desc = desc->more;
+               while (desc->sptes[PTE_LIST_EXT-1]) {
                        count += PTE_LIST_EXT;
-               }
-               if (desc->sptes[PTE_LIST_EXT-1]) {
-                       desc->more = mmu_alloc_pte_list_desc(vcpu);
+
+                       if (!desc->more) {
+                               desc->more = mmu_alloc_pte_list_desc(vcpu);
+                               desc = desc->more;
+                               break;
+                       }
                        desc = desc->more;
                }
                for (i = 0; desc->sptes[i]; ++i)
index d9c5665..fcac2ca 100644 (file)
@@ -55,7 +55,7 @@ u64 make_mmio_spte(struct kvm_vcpu *vcpu, u64 gfn, unsigned int access)
        mask |= shadow_mmio_value | access;
        mask |= gpa | shadow_nonpresent_or_rsvd_mask;
        mask |= (gpa & shadow_nonpresent_or_rsvd_mask)
-               << shadow_nonpresent_or_rsvd_mask_len;
+               << SHADOW_NONPRESENT_OR_RSVD_MASK_LEN;
 
        return mask;
 }
@@ -231,12 +231,12 @@ u64 mark_spte_for_access_track(u64 spte)
                  !spte_can_locklessly_be_made_writable(spte),
                  "kvm: Writable SPTE is not locklessly dirty-trackable\n");
 
-       WARN_ONCE(spte & (shadow_acc_track_saved_bits_mask <<
-                         shadow_acc_track_saved_bits_shift),
+       WARN_ONCE(spte & (SHADOW_ACC_TRACK_SAVED_BITS_MASK <<
+                         SHADOW_ACC_TRACK_SAVED_BITS_SHIFT),
                  "kvm: Access Tracking saved bit locations are not zero\n");
 
-       spte |= (spte & shadow_acc_track_saved_bits_mask) <<
-               shadow_acc_track_saved_bits_shift;
+       spte |= (spte & SHADOW_ACC_TRACK_SAVED_BITS_MASK) <<
+               SHADOW_ACC_TRACK_SAVED_BITS_SHIFT;
        spte &= ~shadow_acc_track_mask;
 
        return spte;
@@ -245,7 +245,7 @@ u64 mark_spte_for_access_track(u64 spte)
 void kvm_mmu_set_mmio_spte_mask(u64 mmio_value, u64 access_mask)
 {
        BUG_ON((u64)(unsigned)access_mask != access_mask);
-       WARN_ON(mmio_value & (shadow_nonpresent_or_rsvd_mask << shadow_nonpresent_or_rsvd_mask_len));
+       WARN_ON(mmio_value & (shadow_nonpresent_or_rsvd_mask << SHADOW_NONPRESENT_OR_RSVD_MASK_LEN));
        WARN_ON(mmio_value & shadow_nonpresent_or_rsvd_lower_gfn_mask);
        shadow_mmio_value = mmio_value | SPTE_MMIO_MASK;
        shadow_mmio_access_mask = access_mask;
@@ -306,9 +306,9 @@ void kvm_mmu_reset_all_pte_masks(void)
        low_phys_bits = boot_cpu_data.x86_phys_bits;
        if (boot_cpu_has_bug(X86_BUG_L1TF) &&
            !WARN_ON_ONCE(boot_cpu_data.x86_cache_bits >=
-                         52 - shadow_nonpresent_or_rsvd_mask_len)) {
+                         52 - SHADOW_NONPRESENT_OR_RSVD_MASK_LEN)) {
                low_phys_bits = boot_cpu_data.x86_cache_bits
-                       - shadow_nonpresent_or_rsvd_mask_len;
+                       - SHADOW_NONPRESENT_OR_RSVD_MASK_LEN;
                shadow_nonpresent_or_rsvd_mask =
                        rsvd_bits(low_phys_bits, boot_cpu_data.x86_cache_bits - 1);
        }
index 4ecf40e..5c75a45 100644 (file)
@@ -105,19 +105,19 @@ extern u64 __read_mostly shadow_acc_track_mask;
 extern u64 __read_mostly shadow_nonpresent_or_rsvd_mask;
 
 /*
+ * The number of high-order 1 bits to use in the mask above.
+ */
+#define SHADOW_NONPRESENT_OR_RSVD_MASK_LEN 5
+
+/*
  * The mask/shift to use for saving the original R/X bits when marking the PTE
  * as not-present for access tracking purposes. We do not save the W bit as the
  * PTEs being access tracked also need to be dirty tracked, so the W bit will be
  * restored only when a write is attempted to the page.
  */
-static const u64 shadow_acc_track_saved_bits_mask = PT64_EPT_READABLE_MASK |
-                                                   PT64_EPT_EXECUTABLE_MASK;
-static const u64 shadow_acc_track_saved_bits_shift = PT64_SECOND_AVAIL_BITS_SHIFT;
-
-/*
- * The number of high-order 1 bits to use in the mask above.
- */
-static const u64 shadow_nonpresent_or_rsvd_mask_len = 5;
+#define SHADOW_ACC_TRACK_SAVED_BITS_MASK (PT64_EPT_READABLE_MASK | \
+                                         PT64_EPT_EXECUTABLE_MASK)
+#define SHADOW_ACC_TRACK_SAVED_BITS_SHIFT PT64_SECOND_AVAIL_BITS_SHIFT
 
 /*
  * In some cases, we need to preserve the GFN of a non-present or reserved
index e246d71..27e381c 100644 (file)
@@ -209,7 +209,7 @@ static void __handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn,
 
        WARN_ON(level > PT64_ROOT_MAX_LEVEL);
        WARN_ON(level < PG_LEVEL_4K);
-       WARN_ON(gfn % KVM_PAGES_PER_HPAGE(level));
+       WARN_ON(gfn & (KVM_PAGES_PER_HPAGE(level) - 1));
 
        /*
         * If this warning were to trigger it would indicate that there was a
index e5325bd..f3199bb 100644 (file)
@@ -297,14 +297,13 @@ const struct evmcs_field vmcs_field_to_evmcs_1[] = {
 };
 const unsigned int nr_evmcs_1_fields = ARRAY_SIZE(vmcs_field_to_evmcs_1);
 
-void evmcs_sanitize_exec_ctrls(struct vmcs_config *vmcs_conf)
+__init void evmcs_sanitize_exec_ctrls(struct vmcs_config *vmcs_conf)
 {
        vmcs_conf->pin_based_exec_ctrl &= ~EVMCS1_UNSUPPORTED_PINCTRL;
        vmcs_conf->cpu_based_2nd_exec_ctrl &= ~EVMCS1_UNSUPPORTED_2NDEXEC;
 
        vmcs_conf->vmexit_ctrl &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL;
        vmcs_conf->vmentry_ctrl &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL;
-
 }
 #endif
 
index e5f7a7e..bd41d94 100644 (file)
@@ -185,7 +185,7 @@ static inline void evmcs_load(u64 phys_addr)
        vp_ap->enlighten_vmentry = 1;
 }
 
-void evmcs_sanitize_exec_ctrls(struct vmcs_config *vmcs_conf);
+__init void evmcs_sanitize_exec_ctrls(struct vmcs_config *vmcs_conf);
 #else /* !IS_ENABLED(CONFIG_HYPERV) */
 static inline void evmcs_write64(unsigned long field, u64 value) {}
 static inline void evmcs_write32(unsigned long field, u32 value) {}
@@ -194,7 +194,6 @@ static inline u64 evmcs_read64(unsigned long field) { return 0; }
 static inline u32 evmcs_read32(unsigned long field) { return 0; }
 static inline u16 evmcs_read16(unsigned long field) { return 0; }
 static inline void evmcs_load(u64 phys_addr) {}
-static inline void evmcs_sanitize_exec_ctrls(struct vmcs_config *vmcs_conf) {}
 static inline void evmcs_touch_msr_bitmap(void) {}
 #endif /* IS_ENABLED(CONFIG_HYPERV) */
 
index e4e7adf..f02962d 100644 (file)
@@ -222,7 +222,7 @@ void pi_wakeup_handler(void)
        spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, cpu));
 }
 
-void __init pi_init(int cpu)
+void __init pi_init_cpu(int cpu)
 {
        INIT_LIST_HEAD(&per_cpu(blocked_vcpu_on_cpu, cpu));
        spin_lock_init(&per_cpu(blocked_vcpu_on_cpu_lock, cpu));
index e53b97f..0bdc413 100644 (file)
@@ -91,9 +91,9 @@ void vmx_vcpu_pi_put(struct kvm_vcpu *vcpu);
 int pi_pre_block(struct kvm_vcpu *vcpu);
 void pi_post_block(struct kvm_vcpu *vcpu);
 void pi_wakeup_handler(void);
-void __init pi_init(int cpu);
+void __init pi_init_cpu(int cpu);
 bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu);
 int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq,
                   bool set);
 
-#endif /* __KVM_X86_VMX_POSTED_INTR_H */
\ No newline at end of file
+#endif /* __KVM_X86_VMX_POSTED_INTR_H */
index ab6d2d1..47b8357 100644 (file)
@@ -2560,8 +2560,10 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf,
        vmcs_conf->vmexit_ctrl         = _vmexit_control;
        vmcs_conf->vmentry_ctrl        = _vmentry_control;
 
-       if (static_branch_unlikely(&enable_evmcs))
+#if IS_ENABLED(CONFIG_HYPERV)
+       if (enlightened_vmcs)
                evmcs_sanitize_exec_ctrls(vmcs_conf);
+#endif
 
        return 0;
 }
@@ -6834,7 +6836,6 @@ static void vmx_free_vcpu(struct kvm_vcpu *vcpu)
 static int vmx_create_vcpu(struct kvm_vcpu *vcpu)
 {
        struct vcpu_vmx *vmx;
-       unsigned long *msr_bitmap;
        int i, cpu, err;
 
        BUILD_BUG_ON(offsetof(struct vcpu_vmx, vcpu) != 0);
@@ -6894,7 +6895,6 @@ static int vmx_create_vcpu(struct kvm_vcpu *vcpu)
        bitmap_fill(vmx->shadow_msr_intercept.read, MAX_POSSIBLE_PASSTHROUGH_MSRS);
        bitmap_fill(vmx->shadow_msr_intercept.write, MAX_POSSIBLE_PASSTHROUGH_MSRS);
 
-       msr_bitmap = vmx->vmcs01.msr_bitmap;
        vmx_disable_intercept_for_msr(vcpu, MSR_IA32_TSC, MSR_TYPE_R);
        vmx_disable_intercept_for_msr(vcpu, MSR_FS_BASE, MSR_TYPE_RW);
        vmx_disable_intercept_for_msr(vcpu, MSR_GS_BASE, MSR_TYPE_RW);
@@ -8004,7 +8004,7 @@ static int __init vmx_init(void)
        for_each_possible_cpu(cpu) {
                INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu));
 
-               pi_init(cpu);
+               pi_init_cpu(cpu);
        }
 
 #ifdef CONFIG_KEXEC_CORE
index 397f599..447edc0 100644 (file)
@@ -255,24 +255,23 @@ static struct kmem_cache *x86_emulator_cache;
 
 /*
  * When called, it means the previous get/set msr reached an invalid msr.
- * Return 0 if we want to ignore/silent this failed msr access, or 1 if we want
- * to fail the caller.
+ * Return true if we want to ignore/silent this failed msr access.
  */
-static int kvm_msr_ignored_check(struct kvm_vcpu *vcpu, u32 msr,
-                                u64 data, bool write)
+static bool kvm_msr_ignored_check(struct kvm_vcpu *vcpu, u32 msr,
+                                 u64 data, bool write)
 {
        const char *op = write ? "wrmsr" : "rdmsr";
 
        if (ignore_msrs) {
                if (report_ignored_msrs)
-                       vcpu_unimpl(vcpu, "ignored %s: 0x%x data 0x%llx\n",
-                                   op, msr, data);
+                       kvm_pr_unimpl("ignored %s: 0x%x data 0x%llx\n",
+                                     op, msr, data);
                /* Mask the error */
-               return 0;
+               return true;
        } else {
-               vcpu_debug_ratelimited(vcpu, "unhandled %s: 0x%x data 0x%llx\n",
-                                      op, msr, data);
-               return -ENOENT;
+               kvm_debug_ratelimited("unhandled %s: 0x%x data 0x%llx\n",
+                                     op, msr, data);
+               return false;
        }
 }
 
@@ -1416,7 +1415,8 @@ static int do_get_msr_feature(struct kvm_vcpu *vcpu, unsigned index, u64 *data)
        if (r == KVM_MSR_RET_INVALID) {
                /* Unconditionally clear the output for simplicity */
                *data = 0;
-               r = kvm_msr_ignored_check(vcpu, index, 0, false);
+               if (kvm_msr_ignored_check(vcpu, index, 0, false))
+                       r = 0;
        }
 
        if (r)
@@ -1540,7 +1540,7 @@ static int __kvm_set_msr(struct kvm_vcpu *vcpu, u32 index, u64 data,
        struct msr_data msr;
 
        if (!host_initiated && !kvm_msr_allowed(vcpu, index, KVM_MSR_FILTER_WRITE))
-               return -EPERM;
+               return KVM_MSR_RET_FILTERED;
 
        switch (index) {
        case MSR_FS_BASE:
@@ -1581,7 +1581,8 @@ static int kvm_set_msr_ignored_check(struct kvm_vcpu *vcpu,
        int ret = __kvm_set_msr(vcpu, index, data, host_initiated);
 
        if (ret == KVM_MSR_RET_INVALID)
-               ret = kvm_msr_ignored_check(vcpu, index, data, true);
+               if (kvm_msr_ignored_check(vcpu, index, data, true))
+                       ret = 0;
 
        return ret;
 }
@@ -1599,7 +1600,7 @@ int __kvm_get_msr(struct kvm_vcpu *vcpu, u32 index, u64 *data,
        int ret;
 
        if (!host_initiated && !kvm_msr_allowed(vcpu, index, KVM_MSR_FILTER_READ))
-               return -EPERM;
+               return KVM_MSR_RET_FILTERED;
 
        msr.index = index;
        msr.host_initiated = host_initiated;
@@ -1618,7 +1619,8 @@ static int kvm_get_msr_ignored_check(struct kvm_vcpu *vcpu,
        if (ret == KVM_MSR_RET_INVALID) {
                /* Unconditionally clear *data for simplicity */
                *data = 0;
-               ret = kvm_msr_ignored_check(vcpu, index, 0, false);
+               if (kvm_msr_ignored_check(vcpu, index, 0, false))
+                       ret = 0;
        }
 
        return ret;
@@ -1662,9 +1664,9 @@ static int complete_emulated_wrmsr(struct kvm_vcpu *vcpu)
 static u64 kvm_msr_reason(int r)
 {
        switch (r) {
-       case -ENOENT:
+       case KVM_MSR_RET_INVALID:
                return KVM_MSR_EXIT_REASON_UNKNOWN;
-       case -EPERM:
+       case KVM_MSR_RET_FILTERED:
                return KVM_MSR_EXIT_REASON_FILTER;
        default:
                return KVM_MSR_EXIT_REASON_INVAL;
@@ -1965,7 +1967,7 @@ static void kvm_write_system_time(struct kvm_vcpu *vcpu, gpa_t system_time,
        struct kvm_arch *ka = &vcpu->kvm->arch;
 
        if (vcpu->vcpu_id == 0 && !host_initiated) {
-               if (ka->boot_vcpu_runs_old_kvmclock && old_msr)
+               if (ka->boot_vcpu_runs_old_kvmclock != old_msr)
                        kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu);
 
                ka->boot_vcpu_runs_old_kvmclock = old_msr;
@@ -3063,9 +3065,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
                        /* Values other than LBR and BTF are vendor-specific,
                           thus reserved and should throw a #GP */
                        return 1;
-               }
-               vcpu_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTLMSR 0x%llx, nop\n",
-                           __func__, data);
+               } else if (report_ignored_msrs)
+                       vcpu_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTLMSR 0x%llx, nop\n",
+                                   __func__, data);
                break;
        case 0x200 ... 0x2ff:
                return kvm_mtrr_set_msr(vcpu, msr, data);
@@ -3463,29 +3465,63 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
                msr_info->data = vcpu->arch.efer;
                break;
        case MSR_KVM_WALL_CLOCK:
+               if (!guest_pv_has(vcpu, KVM_FEATURE_CLOCKSOURCE))
+                       return 1;
+
+               msr_info->data = vcpu->kvm->arch.wall_clock;
+               break;
        case MSR_KVM_WALL_CLOCK_NEW:
+               if (!guest_pv_has(vcpu, KVM_FEATURE_CLOCKSOURCE2))
+                       return 1;
+
                msr_info->data = vcpu->kvm->arch.wall_clock;
                break;
        case MSR_KVM_SYSTEM_TIME:
+               if (!guest_pv_has(vcpu, KVM_FEATURE_CLOCKSOURCE))
+                       return 1;
+
+               msr_info->data = vcpu->arch.time;
+               break;
        case MSR_KVM_SYSTEM_TIME_NEW:
+               if (!guest_pv_has(vcpu, KVM_FEATURE_CLOCKSOURCE2))
+                       return 1;
+
                msr_info->data = vcpu->arch.time;
                break;
        case MSR_KVM_ASYNC_PF_EN:
+               if (!guest_pv_has(vcpu, KVM_FEATURE_ASYNC_PF))
+                       return 1;
+
                msr_info->data = vcpu->arch.apf.msr_en_val;
                break;
        case MSR_KVM_ASYNC_PF_INT:
+               if (!guest_pv_has(vcpu, KVM_FEATURE_ASYNC_PF_INT))
+                       return 1;
+
                msr_info->data = vcpu->arch.apf.msr_int_val;
                break;
        case MSR_KVM_ASYNC_PF_ACK:
+               if (!guest_pv_has(vcpu, KVM_FEATURE_ASYNC_PF))
+                       return 1;
+
                msr_info->data = 0;
                break;
        case MSR_KVM_STEAL_TIME:
+               if (!guest_pv_has(vcpu, KVM_FEATURE_STEAL_TIME))
+                       return 1;
+
                msr_info->data = vcpu->arch.st.msr_val;
                break;
        case MSR_KVM_PV_EOI_EN:
+               if (!guest_pv_has(vcpu, KVM_FEATURE_PV_EOI))
+                       return 1;
+
                msr_info->data = vcpu->arch.pv_eoi.msr_val;
                break;
        case MSR_KVM_POLL_CONTROL:
+               if (!guest_pv_has(vcpu, KVM_FEATURE_POLL_CONTROL))
+                       return 1;
+
                msr_info->data = vcpu->arch.msr_kvm_poll_control;
                break;
        case MSR_IA32_P5_MC_ADDR:
@@ -4575,6 +4611,8 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
 
        case KVM_CAP_ENFORCE_PV_FEATURE_CPUID:
                vcpu->arch.pv_cpuid.enforce = cap->args[0];
+               if (vcpu->arch.pv_cpuid.enforce)
+                       kvm_update_pv_runtime(vcpu);
 
                return 0;
 
index 3900ab0..e7ca622 100644 (file)
@@ -376,7 +376,13 @@ int kvm_handle_memory_failure(struct kvm_vcpu *vcpu, int r,
 int kvm_handle_invpcid(struct kvm_vcpu *vcpu, unsigned long type, gva_t gva);
 bool kvm_msr_allowed(struct kvm_vcpu *vcpu, u32 index, u32 type);
 
-#define  KVM_MSR_RET_INVALID  2
+/*
+ * Internal error codes that are used to indicate that MSR emulation encountered
+ * an error that should result in #GP in the guest, unless userspace
+ * handles it.
+ */
+#define  KVM_MSR_RET_INVALID   2       /* in-kernel MSR emulation #GP condition */
+#define  KVM_MSR_RET_FILTERED  3       /* #GP due to userspace MSR filter */
 
 #define __cr4_reserved_bits(__cpu_has, __c)             \
 ({                                                      \
index 037faac..1e299ac 100644 (file)
@@ -16,8 +16,6 @@
  * to a jmp to memcpy_erms which does the REP; MOVSB mem copy.
  */
 
-.weak memcpy
-
 /*
  * memcpy - Copy a memory block.
  *
@@ -30,7 +28,7 @@
  * rax original destination
  */
 SYM_FUNC_START_ALIAS(__memcpy)
-SYM_FUNC_START_LOCAL(memcpy)
+SYM_FUNC_START_WEAK(memcpy)
        ALTERNATIVE_2 "jmp memcpy_orig", "", X86_FEATURE_REP_GOOD, \
                      "jmp memcpy_erms", X86_FEATURE_ERMS
 
index 7ff00ea..41902fe 100644 (file)
@@ -24,9 +24,7 @@
  * Output:
  * rax: dest
  */
-.weak memmove
-
-SYM_FUNC_START_ALIAS(memmove)
+SYM_FUNC_START_WEAK(memmove)
 SYM_FUNC_START(__memmove)
 
        mov %rdi, %rax
index 9ff15ee..0bfd26e 100644 (file)
@@ -6,8 +6,6 @@
 #include <asm/alternative-asm.h>
 #include <asm/export.h>
 
-.weak memset
-
 /*
  * ISO C memset - set a memory block to a byte value. This function uses fast
  * string to get better performance than the original function. The code is
@@ -19,7 +17,7 @@
  *
  * rax   original destination
  */
-SYM_FUNC_START_ALIAS(memset)
+SYM_FUNC_START_WEAK(memset)
 SYM_FUNC_START(__memset)
        /*
         * Some CPUs support enhanced REP MOVSB/STOSB feature. It is recommended
index ebb7edc..bc08337 100644 (file)
  * reside in the .data section so as not to be zeroed out when the .bss
  * section is later cleared.
  */
-u64 sme_me_mask __section(.data) = 0;
-u64 sev_status __section(.data) = 0;
+u64 sme_me_mask __section(".data") = 0;
+u64 sev_status __section(".data") = 0;
+u64 sev_check_data __section(".data") = 0;
 EXPORT_SYMBOL(sme_me_mask);
 DEFINE_STATIC_KEY_FALSE(sev_enable_key);
 EXPORT_SYMBOL_GPL(sev_enable_key);
 
-bool sev_enabled __section(.data);
+bool sev_enabled __section(".data");
 
 /* Buffer used for early in-place encryption by BSP, no locking needed */
 static char sme_early_buffer[PAGE_SIZE] __initdata __aligned(PAGE_SIZE);
index 68d7537..733b983 100644 (file)
@@ -81,7 +81,7 @@ struct sme_populate_pgd_data {
  * section is 2MB aligned to allow for simple pagetable setup using only
  * PMD entries (see vmlinux.lds.S).
  */
-static char sme_workarea[2 * PMD_PAGE_SIZE] __section(.init.scratch);
+static char sme_workarea[2 * PMD_PAGE_SIZE] __section(".init.scratch");
 
 static char sme_cmdline_arg[] __initdata = "mem_encrypt";
 static char sme_cmdline_on[]  __initdata = "on";
index c0a502f..9ac7457 100644 (file)
@@ -19,8 +19,8 @@
  * pvh_bootparams and pvh_start_info need to live in the data segment since
  * they are used after startup_{32|64}, which clear .bss, are invoked.
  */
-struct boot_params pvh_bootparams __attribute__((section(".data")));
-struct hvm_start_info pvh_start_info __attribute__((section(".data")));
+struct boot_params pvh_bootparams __section(".data");
+struct hvm_start_info pvh_start_info __section(".data");
 
 unsigned int pvh_start_info_sz = sizeof(pvh_start_info);
 
index 2961234..7b37a41 100644 (file)
@@ -14,9 +14,9 @@
 
 #include "../boot/string.h"
 
-u8 purgatory_sha256_digest[SHA256_DIGEST_SIZE] __section(.kexec-purgatory);
+u8 purgatory_sha256_digest[SHA256_DIGEST_SIZE] __section(".kexec-purgatory");
 
-struct kexec_sha_region purgatory_sha_regions[KEXEC_SEGMENT_MAX] __section(.kexec-purgatory);
+struct kexec_sha_region purgatory_sha_regions[KEXEC_SEGMENT_MAX] __section(".kexec-purgatory");
 
 static int verify_sha256_digest(void)
 {
index 205b117..aa9f50f 100644 (file)
@@ -71,7 +71,7 @@ EXPORT_SYMBOL_GPL(xen_have_vector_callback);
  * NB: needs to live in .data because it's used by xen_prepare_pvh which runs
  * before clearing the bss.
  */
-uint32_t xen_start_flags __attribute__((section(".data"))) = 0;
+uint32_t xen_start_flags __section(".data") = 0;
 EXPORT_SYMBOL(xen_start_flags);
 
 /*
index 80a79db..0d5e34b 100644 (file)
@@ -21,7 +21,7 @@
  * The variable xen_pvh needs to live in the data segment since it is used
  * after startup_{32|64} is invoked, which will clear the .bss segment.
  */
-bool xen_pvh __attribute__((section(".data"))) = 0;
+bool xen_pvh __section(".data") = 0;
 
 void __init xen_pvh_init(struct boot_params *boot_params)
 {
index 2097fa0..c1b2f76 100644 (file)
@@ -88,14 +88,17 @@ int xen_smp_intr_init(unsigned int cpu)
        per_cpu(xen_callfunc_irq, cpu).irq = rc;
        per_cpu(xen_callfunc_irq, cpu).name = callfunc_name;
 
-       debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu);
-       rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt,
-                                    IRQF_PERCPU | IRQF_NOBALANCING,
-                                    debug_name, NULL);
-       if (rc < 0)
-               goto fail;
-       per_cpu(xen_debug_irq, cpu).irq = rc;
-       per_cpu(xen_debug_irq, cpu).name = debug_name;
+       if (!xen_fifo_events) {
+               debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu);
+               rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu,
+                                            xen_debug_interrupt,
+                                            IRQF_PERCPU | IRQF_NOBALANCING,
+                                            debug_name, NULL);
+               if (rc < 0)
+                       goto fail;
+               per_cpu(xen_debug_irq, cpu).irq = rc;
+               per_cpu(xen_debug_irq, cpu).name = debug_name;
+       }
 
        callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu);
        rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR,
index 45d556f..9546c33 100644 (file)
@@ -29,6 +29,8 @@ extern struct start_info *xen_start_info;
 extern struct shared_info xen_dummy_shared_info;
 extern struct shared_info *HYPERVISOR_shared_info;
 
+extern bool xen_fifo_events;
+
 void xen_setup_mfn_list_list(void);
 void xen_build_mfn_list_list(void);
 void xen_setup_machphys_mapping(void);
index be2c78f..ed18410 100644 (file)
@@ -93,7 +93,7 @@ typedef struct tagtable {
 } tagtable_t;
 
 #define __tagtable(tag, fn) static tagtable_t __tagtable_##fn          \
-       __attribute__((used, section(".taglist"))) = { tag, fn }
+       __section(".taglist") __attribute__((used)) = { tag, fn }
 
 /* parse current tag */
 
index c6fc83e..8731b7a 100644 (file)
@@ -89,8 +89,8 @@ static void __init free_highpages(void)
        /* set highmem page free */
        for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE,
                                &range_start, &range_end, NULL) {
-               unsigned long start = PHYS_PFN(range_start);
-               unsigned long end = PHYS_PFN(range_end);
+               unsigned long start = PFN_UP(range_start);
+               unsigned long end = PFN_DOWN(range_end);
 
                /* Ignore complete lowmem entries */
                if (end <= max_low)
index e6e26d7..fa01bef 100644 (file)
@@ -1044,6 +1044,7 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
        ssize_t size, left;
        unsigned len, i;
        size_t offset;
+       int ret = 0;
 
        if (WARN_ON_ONCE(!max_append_sectors))
                return 0;
@@ -1066,15 +1067,17 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
 
                len = min_t(size_t, PAGE_SIZE - offset, left);
                if (bio_add_hw_page(q, bio, page, len, offset,
-                               max_append_sectors, &same_page) != len)
-                       return -EINVAL;
+                               max_append_sectors, &same_page) != len) {
+                       ret = -EINVAL;
+                       break;
+               }
                if (same_page)
                        put_page(page);
                offset = 0;
        }
 
-       iov_iter_advance(iter, size);
-       return 0;
+       iov_iter_advance(iter, size - left);
+       return ret;
 }
 
 /**
index f9b5561..c68bdf5 100644 (file)
@@ -657,13 +657,20 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
                        goto fail;
                }
 
+               if (radix_tree_preload(GFP_KERNEL)) {
+                       blkg_free(new_blkg);
+                       ret = -ENOMEM;
+                       goto fail;
+               }
+
                rcu_read_lock();
                spin_lock_irq(&q->queue_lock);
 
                blkg = blkg_lookup_check(pos, pol, q);
                if (IS_ERR(blkg)) {
                        ret = PTR_ERR(blkg);
-                       goto fail_unlock;
+                       blkg_free(new_blkg);
+                       goto fail_preloaded;
                }
 
                if (blkg) {
@@ -672,10 +679,12 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
                        blkg = blkg_create(pos, q, new_blkg);
                        if (IS_ERR(blkg)) {
                                ret = PTR_ERR(blkg);
-                               goto fail_unlock;
+                               goto fail_preloaded;
                        }
                }
 
+               radix_tree_preload_end();
+
                if (pos == blkcg)
                        goto success;
        }
@@ -685,6 +694,8 @@ success:
        ctx->body = input;
        return 0;
 
+fail_preloaded:
+       radix_tree_preload_end();
 fail_unlock:
        spin_unlock_irq(&q->queue_lock);
        rcu_read_unlock();
index ac00d2f..2db8bda 100644 (file)
@@ -186,6 +186,10 @@ static const struct {
        /* device mapper special case, should not leak out: */
        [BLK_STS_DM_REQUEUE]    = { -EREMCHG, "dm internal retry" },
 
+       /* zone device specific errors */
+       [BLK_STS_ZONE_OPEN_RESOURCE]    = { -ETOOMANYREFS, "open zones exceeded" },
+       [BLK_STS_ZONE_ACTIVE_RESOURCE]  = { -EOVERFLOW, "active zones exceeded" },
+
        /* everything else not covered above: */
        [BLK_STS_IOERR]         = { -EIO,       "I/O" },
 };
index 53abb5c..e32958f 100644 (file)
@@ -225,6 +225,7 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)
        /* release the tag's ownership to the req cloned from */
        spin_lock_irqsave(&fq->mq_flush_lock, flags);
 
+       WRITE_ONCE(flush_rq->state, MQ_RQ_IDLE);
        if (!refcount_dec_and_test(&flush_rq->ref)) {
                fq->rq_status = error;
                spin_unlock_irqrestore(&fq->mq_flush_lock, flags);
index 0157f2b..3db84d3 100644 (file)
@@ -89,7 +89,7 @@ int blk_mq_hw_queue_to_node(struct blk_mq_queue_map *qmap, unsigned int index)
 
        for_each_possible_cpu(i) {
                if (index == qmap->mq_map[i])
-                       return local_memory_node(cpu_to_node(i));
+                       return cpu_to_node(i);
        }
 
        return NUMA_NO_NODE;
index 6964502..55bcee5 100644 (file)
@@ -1664,7 +1664,7 @@ void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async)
 EXPORT_SYMBOL(blk_mq_run_hw_queue);
 
 /**
- * blk_mq_run_hw_queue - Run all hardware queues in a request queue.
+ * blk_mq_run_hw_queues - Run all hardware queues in a request queue.
  * @q: Pointer to the request queue to run.
  * @async: If we want to run the queue asynchronously.
  */
@@ -2743,7 +2743,7 @@ static void blk_mq_init_cpu_queues(struct request_queue *q,
                for (j = 0; j < set->nr_maps; j++) {
                        hctx = blk_mq_map_queue_type(q, j, i);
                        if (nr_hw_queues > 1 && hctx->numa_node == NUMA_NO_NODE)
-                               hctx->numa_node = local_memory_node(cpu_to_node(i));
+                               hctx->numa_node = cpu_to_node(i);
                }
        }
 }
index 6041974..fb72903 100644 (file)
@@ -749,6 +749,9 @@ static int __init acpi_aml_init(void)
 {
        int ret;
 
+       if (acpi_disabled)
+               return -ENODEV;
+
        /* Initialize AML IO interface */
        mutex_init(&acpi_aml_io.lock);
        init_waitqueue_head(&acpi_aml_io.wait);
index 412a972..2ee5e05 100644 (file)
@@ -264,7 +264,6 @@ static int acpi_processor_get_info(struct acpi_device *device)
        } else {
                /*
                 * Declared with "Device" statement; match _UID.
-                * Note that we don't handle string _UIDs yet.
                 */
                status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID,
                                                NULL, &value);
index bc96457..a322a7b 100644 (file)
@@ -578,7 +578,7 @@ acpi_video_bqc_value_to_level(struct acpi_video_device *device,
                                ACPI_VIDEO_FIRST_LEVEL - 1 - bqc_value;
 
                level = device->brightness->levels[bqc_value +
-                                                  ACPI_VIDEO_FIRST_LEVEL];
+                                                  ACPI_VIDEO_FIRST_LEVEL];
        } else {
                level = bqc_value;
        }
@@ -990,8 +990,8 @@ set_level:
                goto out_free_levels;
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                         "found %d brightness levels\n",
-                         br->count - ACPI_VIDEO_FIRST_LEVEL));
+                         "found %d brightness levels\n",
+                         br->count - ACPI_VIDEO_FIRST_LEVEL));
        return 0;
 
 out_free_levels:
index 37bb67e..b13a4ed 100644 (file)
@@ -47,7 +47,7 @@ acpi_status acpi_hw_gpe_read(u64 *value, struct acpi_gpe_address *reg)
 
        if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
 #ifdef ACPI_GPE_USE_LOGICAL_ADDRESSES
-               *value = (u64)ACPI_GET8(reg->address);
+               *value = (u64)ACPI_GET8((unsigned long)reg->address);
                return_ACPI_STATUS(AE_OK);
 #else
                return acpi_os_read_memory((acpi_physical_address)reg->address,
@@ -82,7 +82,7 @@ acpi_status acpi_hw_gpe_write(u64 value, struct acpi_gpe_address *reg)
 {
        if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
 #ifdef ACPI_GPE_USE_LOGICAL_ADDRESSES
-               ACPI_SET8(reg->address, value);
+               ACPI_SET8((unsigned long)reg->address, value);
                return_ACPI_STATUS(AE_OK);
 #else
                return acpi_os_write_memory((acpi_physical_address)reg->address,
index cab4af5..08ee1c7 100644 (file)
@@ -987,7 +987,7 @@ static int acpi_battery_update(struct acpi_battery *battery, bool resume)
         */
        if ((battery->state & ACPI_BATTERY_STATE_CRITICAL) ||
            (test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags) &&
-            (battery->capacity_now <= battery->alarm)))
+            (battery->capacity_now <= battery->alarm)))
                acpi_pm_wakeup_event(&battery->device->dev);
 
        return result;
index da4b125..0d93a5e 100644 (file)
@@ -74,19 +74,6 @@ MODULE_DEVICE_TABLE(acpi, button_device_ids);
 /* Please keep this list sorted alphabetically by vendor and model */
 static const struct dmi_system_id dmi_lid_quirks[] = {
        {
-               /*
-                * Acer Switch 10 SW5-012. _LID method messes with home and
-                * power button GPIO IRQ settings causing an interrupt storm on
-                * both GPIOs. This is unfixable without a DSDT override, so we
-                * have to disable the lid-switch functionality altogether :|
-                */
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
-               },
-               .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_DISABLED,
-       },
-       {
                /* GP-electronic T701, _LID method points to a floating GPIO */
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
@@ -102,7 +89,18 @@ static const struct dmi_system_id dmi_lid_quirks[] = {
                 */
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "E2215T MD60198"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "E2215T"),
+               },
+               .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
+       },
+       {
+               /*
+                * Medion Akoya E2228T, notification of the LID device only
+                * happens on close, not on open and _LID always returns closed.
+                */
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "E2228T"),
                },
                .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
        },
index 45d4b7b..24e076f 100644 (file)
@@ -231,7 +231,8 @@ static void hot_remove_dock_devices(struct dock_station *ds)
         * between them).
         */
        list_for_each_entry_reverse(dd, &ds->dependent_devices, list)
-               dock_hotplug_event(dd, ACPI_NOTIFY_EJECT_REQUEST, false);
+               dock_hotplug_event(dd, ACPI_NOTIFY_EJECT_REQUEST,
+                                  DOCK_CALL_HANDLER);
 
        list_for_each_entry_reverse(dd, &ds->dependent_devices, list)
                acpi_bus_trim(dd->adev);
index 51f06f3..1e8c7ce 100644 (file)
@@ -1,8 +1,25 @@
 # SPDX-License-Identifier: GPL-2.0
-config DPTF_POWER
-       tristate "DPTF Platform Power Participant"
+
+menuconfig ACPI_DPTF
+       bool "Intel DPTF (Dynamic Platform and Thermal Framework) Support"
        depends on X86
        help
+         Intel Dynamic Platform and Thermal Framework (DPTF) is a platform
+         level hardware/software solution for power and thermal management.
+
+         As a container for multiple power/thermal technologies, DPTF provides
+         a coordinated approach for different policies to effect the hardware
+         state of a system.
+
+         For more information see:
+         <https://01.org/intel%C2%AE-dynamic-platform-and-thermal-framework-dptf-chromium-os/overview>
+
+if ACPI_DPTF
+
+config DPTF_POWER
+       tristate "Platform Power DPTF Participant"
+       default m
+       help
          This driver adds support for Dynamic Platform and Thermal Framework
          (DPTF) Platform Power Participant device (INT3407) support.
          This participant is responsible for exposing platform telemetry:
@@ -16,15 +33,17 @@ config DPTF_POWER
          the module will be called dptf_power.
 
 config DPTF_PCH_FIVR
-       tristate "DPTF PCH FIVR Participant"
-       depends on X86
+       tristate "PCH FIVR DPTF Participant"
+       default m
        help
          This driver adds support for Dynamic Platform and Thermal Framework
          (DPTF) PCH FIVR Participant device support. This driver allows to
-         switch PCH FIVR (Fully Integrated Voltage Regulator) frequency.
+         switch the PCH FIVR (Fully Integrated Voltage Regulator) frequency.
          This participant is responsible for exposing:
                freq_mhz_low_clock
                freq_mhz_high_clock
 
          To compile this driver as a module, choose M here:
          the module will be called dptf_pch_fivr.
+
+endif
index 4ab2888..5fca182 100644 (file)
@@ -106,6 +106,7 @@ static int pch_fivr_remove(struct platform_device *pdev)
 
 static const struct acpi_device_id pch_fivr_device_ids[] = {
        {"INTC1045", 0},
+       {"INTC1049", 0},
        {"", 0},
 };
 MODULE_DEVICE_TABLE(acpi, pch_fivr_device_ids);
@@ -114,7 +115,7 @@ static struct platform_driver pch_fivr_driver = {
        .probe = pch_fivr_add,
        .remove = pch_fivr_remove,
        .driver = {
-               .name = "DPTF PCH FIVR",
+               .name = "dptf_pch_fivr",
                .acpi_match_table = pch_fivr_device_ids,
        },
 };
index 92b996a..a24d5d7 100644 (file)
@@ -229,6 +229,8 @@ static const struct acpi_device_id int3407_device_ids[] = {
        {"INT3532", 0},
        {"INTC1047", 0},
        {"INTC1050", 0},
+       {"INTC1060", 0},
+       {"INTC1061", 0},
        {"", 0},
 };
 MODULE_DEVICE_TABLE(acpi, int3407_device_ids);
@@ -237,7 +239,7 @@ static struct platform_driver dptf_power_driver = {
        .probe = dptf_power_add,
        .remove = dptf_power_remove,
        .driver = {
-               .name = "DPTF Platform Power",
+               .name = "dptf_power",
                .acpi_match_table = int3407_device_ids,
        },
 };
index 8d420c7..d14025a 100644 (file)
@@ -25,10 +25,16 @@ static const struct acpi_device_id int340x_thermal_device_ids[] = {
        {"INT340A"},
        {"INT340B"},
        {"INTC1040"},
+       {"INTC1041"},
        {"INTC1043"},
        {"INTC1044"},
        {"INTC1045"},
+       {"INTC1046"},
        {"INTC1047"},
+       {"INTC1048"},
+       {"INTC1049"},
+       {"INTC1060"},
+       {"INTC1061"},
        {""},
 };
 
index 1706439..92e59f4 100644 (file)
@@ -31,7 +31,7 @@ int acpi_notifier_call_chain(struct acpi_device *dev, u32 type, u32 data)
        event.type = type;
        event.data = data;
        return (blocking_notifier_call_chain(&acpi_chain_head, 0, (void *)&event)
-                        == NOTIFY_BAD) ? -EINVAL : 0;
+                       == NOTIFY_BAD) ? -EINVAL : 0;
 }
 EXPORT_SYMBOL(acpi_notifier_call_chain);
 
index b1a7f8d..fe6b679 100644 (file)
@@ -101,7 +101,7 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
 
        switch (gsi) {
        case 0 ... 255:
-               sprintf(ev_name, "_%c%02hhX",
+               sprintf(ev_name, "_%c%02X",
                        trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi);
 
                if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle)))
index 6287338..48354f8 100644 (file)
@@ -27,6 +27,7 @@ static const struct acpi_device_id fan_device_ids[] = {
        {"PNP0C0B", 0},
        {"INT3404", 0},
        {"INTC1044", 0},
+       {"INTC1048", 0},
        {"", 0},
 };
 MODULE_DEVICE_TABLE(acpi, fan_device_ids);
index 43411a7..e3638ba 100644 (file)
@@ -134,7 +134,7 @@ int acpi_add_power_resource(acpi_handle handle);
 void acpi_power_add_remove_device(struct acpi_device *adev, bool add);
 int acpi_power_wakeup_list_init(struct list_head *list, int *system_level);
 int acpi_device_sleep_wake(struct acpi_device *dev,
-                           int enable, int sleep_state, int dev_state);
+                          int enable, int sleep_state, int dev_state);
 int acpi_power_get_inferred_state(struct acpi_device *device, int *state);
 int acpi_power_on_resources(struct acpi_device *device, int state);
 int acpi_power_transition(struct acpi_device *device, int state);
index 7562278..4426082 100644 (file)
@@ -1564,7 +1564,7 @@ static ssize_t format1_show(struct device *dev,
                                        le16_to_cpu(nfit_dcr->dcr->code));
                        break;
                }
-               if (rc != ENXIO)
+               if (rc != -ENXIO)
                        break;
        }
        mutex_unlock(&acpi_desc->init_mutex);
@@ -2175,10 +2175,10 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
  * these commands.
  */
 enum nfit_aux_cmds {
-        NFIT_CMD_TRANSLATE_SPA = 5,
-        NFIT_CMD_ARS_INJECT_SET = 7,
-        NFIT_CMD_ARS_INJECT_CLEAR = 8,
-        NFIT_CMD_ARS_INJECT_GET = 9,
+       NFIT_CMD_TRANSLATE_SPA = 5,
+       NFIT_CMD_ARS_INJECT_SET = 7,
+       NFIT_CMD_ARS_INJECT_CLEAR = 8,
+       NFIT_CMD_ARS_INJECT_GET = 9,
 };
 
 static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
@@ -2632,7 +2632,7 @@ static int acpi_nfit_blk_region_enable(struct nvdimm_bus *nvdimm_bus,
        nfit_blk->bdw_offset = nfit_mem->bdw->offset;
        mmio = &nfit_blk->mmio[BDW];
        mmio->addr.base = devm_nvdimm_memremap(dev, nfit_mem->spa_bdw->address,
-                        nfit_mem->spa_bdw->length, nd_blk_memremap_flags(ndbr));
+                       nfit_mem->spa_bdw->length, nd_blk_memremap_flags(ndbr));
        if (!mmio->addr.base) {
                dev_dbg(dev, "%s failed to map bdw\n",
                                nvdimm_name(nvdimm));
index dea8a60..14ee631 100644 (file)
@@ -175,7 +175,7 @@ static int acpi_pci_irq_check_entry(acpi_handle handle, struct pci_dev *dev,
         * configure the IRQ assigned to this slot|dev|pin.  The 'source_index'
         * indicates which resource descriptor in the resource template (of
         * the link device) this interrupt is allocated from.
-        * 
+        *
         * NOTE: Don't query the Link Device for IRQ information at this time
         *       because Link Device enumeration may not have occurred yet
         *       (e.g. exists somewhere 'below' this _PRT entry in the ACPI
index 606da5d..fb4c563 100644 (file)
@@ -6,8 +6,8 @@
  *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
  *  Copyright (C) 2002       Dominik Brodowski <devel@brodo.de>
  *
- * TBD: 
- *      1. Support more than one IRQ resource entry per link device (index).
+ * TBD:
+ *     1. Support more than one IRQ resource entry per link device (index).
  *     2. Implement start/stop mechanism and use ACPI Bus Driver facilities
  *        for IRQ management (e.g. start()->_SRS).
  */
@@ -249,8 +249,8 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link)
                }
        }
 
-       /* 
-        * Query and parse _CRS to get the current IRQ assignment. 
+       /*
+        * Query and parse _CRS to get the current IRQ assignment.
         */
 
        status = acpi_walk_resources(link->device->handle, METHOD_NAME__CRS,
@@ -396,7 +396,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
 /*
  * "acpi_irq_balance" (default in APIC mode) enables ACPI to use PIC Interrupt
  * Link Devices to move the PIRQs around to minimize sharing.
- * 
+ *
  * "acpi_irq_nobalance" (default in PIC mode) tells ACPI not to move any PIC IRQs
  * that the BIOS has already set to active.  This is necessary because
  * ACPI has no automatic means of knowing what ISA IRQs are used.  Note that
@@ -414,7 +414,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
  *
  * Note that PCI IRQ routers have a list of possible IRQs,
  * which may not include the IRQs this table says are available.
- * 
+ *
  * Since this heuristic can't tell the difference between a link
  * that no device will attach to, vs. a link which may be shared
  * by multiple active devices -- it is not optimal.
index 7ddd57a..95f23ac 100644 (file)
@@ -173,7 +173,7 @@ static int pci_mcfg_quirk_matches(struct mcfg_fixup *f, u16 segment,
 {
        if (!memcmp(f->oem_id, mcfg_oem_id, ACPI_OEM_ID_SIZE) &&
            !memcmp(f->oem_table_id, mcfg_oem_table_id,
-                   ACPI_OEM_TABLE_ID_SIZE) &&
+                   ACPI_OEM_TABLE_ID_SIZE) &&
            f->oem_revision == mcfg_oem_revision &&
            f->segment == segment &&
            resource_contains(&f->bus_range, bus_range))
index 837b875..8048da8 100644 (file)
@@ -13,7 +13,7 @@
  * 1. via "Device Specific (D-State) Control"
  * 2. via "Power Resource Control".
  * The code below deals with ACPI Power Resources control.
- * 
+ *
  * An ACPI "power resource object" represents a software controllable power
  * plane, clock plane, or other resource depended on by a device.
  *
@@ -645,7 +645,7 @@ int acpi_power_wakeup_list_init(struct list_head *list, int *system_level_p)
  * -ENODEV if the execution of either _DSW or _PSW has failed
  */
 int acpi_device_sleep_wake(struct acpi_device *dev,
-                           int enable, int sleep_state, int dev_state)
+                          int enable, int sleep_state, int dev_state)
 {
        union acpi_object in_arg[3];
        struct acpi_object_list arg_list = { 3, in_arg };
@@ -690,7 +690,7 @@ int acpi_device_sleep_wake(struct acpi_device *dev,
 
 /*
  * Prepare a wakeup device, two steps (Ref ACPI 2.0:P229):
- * 1. Power on the power resources required for the wakeup device 
+ * 1. Power on the power resources required for the wakeup device
  * 2. Execute _DSW (Device Sleep Wake) or (deprecated in ACPI 3.0) _PSW (Power
  *    State Wake) for the device, if present
  */
index 5909e8f..b04a689 100644 (file)
@@ -354,7 +354,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
                                  (u32) px->control, (u32) px->status));
 
                /*
-                * Check that ACPI's u64 MHz will be valid as u32 KHz in cpufreq
+                * Check that ACPI's u64 MHz will be valid as u32 KHz in cpufreq
                 */
                if (!px->core_frequency ||
                    ((u32)(px->core_frequency * 1000) !=
@@ -627,7 +627,7 @@ int acpi_processor_preregister_performance(
                goto err_ret;
 
        /*
-        * Now that we have _PSD data from all CPUs, lets setup P-state 
+        * Now that we have _PSD data from all CPUs, lets setup P-state
         * domain info.
         */
        for_each_possible_cpu(i) {
@@ -693,7 +693,7 @@ int acpi_processor_preregister_performance(
                        if (match_pdomain->domain != pdomain->domain)
                                continue;
 
-                       match_pr->performance->shared_type = 
+                       match_pr->performance->shared_type =
                                        pr->performance->shared_type;
                        cpumask_copy(match_pr->performance->shared_cpu_map,
                                     pr->performance->shared_cpu_map);
index ca707f5..2a61f88 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/pci.h>
 #include <linux/acpi.h>
 #include <acpi/reboot.h>
+#include <linux/delay.h>
 
 #ifdef CONFIG_PCI
 static void acpi_pci_reboot(struct acpi_generic_address *rr, u8 reset_value)
@@ -66,4 +67,14 @@ void acpi_reboot(void)
                acpi_reset();
                break;
        }
+
+       /*
+        * Some platforms do not shut down immediately after writing to the
+        * ACPI reset register, and this results in racing with the
+        * subsequent reboot mechanism.
+        *
+        * The 15ms delay has been found to be long enough for the system
+        * to reboot on the affected platforms.
+        */
+       mdelay(15);
 }
index f158b8c..e6d9f4d 100644 (file)
@@ -366,7 +366,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
                                         state_readers[i].mode,
                                         ACPI_SBS_BATTERY,
                                         state_readers[i].command,
-                                        (u8 *)battery +
+                                        (u8 *)battery +
                                                state_readers[i].offset);
                if (result)
                        goto end;
index 87b74e9..53c2862 100644 (file)
@@ -176,7 +176,7 @@ int acpi_smbus_write(struct acpi_smb_hc *hc, u8 protocol, u8 address,
 EXPORT_SYMBOL_GPL(acpi_smbus_write);
 
 int acpi_smbus_register_callback(struct acpi_smb_hc *hc,
-                                smbus_alarm_callback callback, void *context)
+                                smbus_alarm_callback callback, void *context)
 {
        mutex_lock(&hc->lock);
        hc->callback = callback;
index c3522bb..695c390 100644 (file)
@@ -24,9 +24,9 @@ enum acpi_sbs_device_addr {
 typedef void (*smbus_alarm_callback)(void *context);
 
 extern int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address,
-              u8 command, u8 * data);
+               u8 command, u8 *data);
 extern int acpi_smbus_write(struct acpi_smb_hc *hc, u8 protocol, u8 slave_address,
-               u8 command, u8 * data, u8 length);
+               u8 command, u8 *data, u8 length);
 extern int acpi_smbus_register_callback(struct acpi_smb_hc *hc,
-                                smbus_alarm_callback callback, void *context);
+               smbus_alarm_callback callback, void *context);
 extern int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc);
index a896e5e..bc6a79e 100644 (file)
@@ -1453,7 +1453,7 @@ int acpi_dma_get_range(struct device *dev, u64 *dma_addr, u64 *offset,
 }
 
 /**
- * acpi_dma_configure - Set-up DMA configuration for the device.
+ * acpi_dma_configure_id - Set-up DMA configuration for the device.
  * @dev: The pointer to the device
  * @attr: device dma attributes
  * @input_id: input device id const value pointer
index 838b719..d5411a1 100644 (file)
@@ -104,7 +104,6 @@ acpi_extract_package(union acpi_object *package,
                                              " [%c]\n",
                                              i, format_string[i]);
                                return AE_BAD_DATA;
-                               break;
                        }
                        break;
 
@@ -129,7 +128,6 @@ acpi_extract_package(union acpi_object *package,
                                              " expecting [%c]\n",
                                              i, format_string[i]);
                                return AE_BAD_DATA;
-                               break;
                        }
                        break;
                case ACPI_TYPE_LOCAL_REFERENCE:
@@ -144,7 +142,6 @@ acpi_extract_package(union acpi_object *package,
                                              " expecting [%c]\n",
                                              i, format_string[i]);
                                return AE_BAD_DATA;
-                               break;
                        }
                        break;
 
@@ -155,7 +152,6 @@ acpi_extract_package(union acpi_object *package,
                                          i));
                        /* TBD: handle nested packages... */
                        return AE_SUPPORT;
-                       break;
                }
        }
 
index 3a032af..4f5463b 100644 (file)
@@ -178,14 +178,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
                DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
                },
        },
-        {
-         .callback = video_detect_force_video,
-         .ident = "ThinkPad X201T",
-         .matches = {
-                DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-                DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201T"),
-                },
-        },
+       {
+        .callback = video_detect_force_video,
+        .ident = "ThinkPad X201T",
+        .matches = {
+               DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+               DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201T"),
+               },
+       },
 
        /* The native backlight controls do not work on some older machines */
        {
index f89dd9a..b02bf77 100644 (file)
@@ -44,7 +44,7 @@ void acpi_enable_wakeup_devices(u8 sleep_state)
                if (!dev->wakeup.flags.valid
                    || sleep_state > (u32) dev->wakeup.sleep_state
                    || !(device_may_wakeup(&dev->dev)
-                       || dev->wakeup.prepare_count))
+                        || dev->wakeup.prepare_count))
                        continue;
 
                if (device_may_wakeup(&dev->dev))
@@ -69,7 +69,7 @@ void acpi_disable_wakeup_devices(u8 sleep_state)
                if (!dev->wakeup.flags.valid
                    || sleep_state > (u32) dev->wakeup.sleep_state
                    || !(device_may_wakeup(&dev->dev)
-                       || dev->wakeup.prepare_count))
+                        || dev->wakeup.prepare_count))
                        continue;
 
                acpi_set_gpe_wake_mask(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
index f546a57..61c7629 100644 (file)
@@ -5616,7 +5616,7 @@ int ata_host_start(struct ata_host *host)
 EXPORT_SYMBOL_GPL(ata_host_start);
 
 /**
- *     ata_sas_host_init - Initialize a host struct for sas (ipr, libsas)
+ *     ata_host_init - Initialize a host struct for sas (ipr, libsas)
  *     @host:  host to initialize
  *     @dev:   device host is attached to
  *     @ops:   port_ops
index d912eaa..b6f9205 100644 (file)
@@ -1115,7 +1115,7 @@ void ata_eh_freeze_port(struct ata_port *ap)
 EXPORT_SYMBOL_GPL(ata_eh_freeze_port);
 
 /**
- *     ata_port_thaw_port - EH helper to thaw port
+ *     ata_eh_thaw_port - EH helper to thaw port
  *     @ap: ATA port to thaw
  *
  *     Thaw frozen port @ap.
index 7043191..48b8934 100644 (file)
@@ -1003,7 +1003,7 @@ void ata_scsi_sdev_config(struct scsi_device *sdev)
 }
 
 /**
- *     atapi_drain_needed - Check whether data transfer may overflow
+ *     ata_scsi_dma_need_drain - Check whether data transfer may overflow
  *     @rq: request to be checked
  *
  *     ATAPI commands which transfer variable length data to host
index 4b2ba81..1532b2e 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- *    pata_ns87415.c - NS87415 (non PARISC) PATA
+ *    pata_ns87415.c - NS87415 (and PARISC SUPERIO 87560) PATA
  *
  *     (C) 2005 Red Hat <alan@lxorguk.ukuu.org.uk>
  *
@@ -16,7 +16,6 @@
  *    systems. This has its own special mountain of errata.
  *
  *    TODO:
- *     Test PARISC SuperIO
  *     Get someone to test on SPARC
  *     Implement lazy pio/dma switching for better performance
  *     8bit shared timing.
index eb9dc14..20190f6 100644 (file)
@@ -2100,7 +2100,7 @@ static int nv_swncq_sdbfis(struct ata_port *ap)
        pp->dhfis_bits &= ~done_mask;
        pp->dmafis_bits &= ~done_mask;
        pp->sdbfis_bits |= done_mask;
-       ata_qc_complete_multiple(ap, ap->qc_active ^ done_mask);
+       ata_qc_complete_multiple(ap, ata_qc_get_active(ap) ^ done_mask);
 
        if (!ap->qc_active) {
                DPRINTK("over\n");
index 141ac60..44b0ed8 100644 (file)
 /* Descriptor table word 0 bit (when DTA32M = 1) */
 #define SATA_RCAR_DTEND                        BIT(0)
 
-#define SATA_RCAR_DMA_BOUNDARY         0x1FFFFFFEUL
+#define SATA_RCAR_DMA_BOUNDARY         0x1FFFFFFFUL
 
 /* Gen2 Physical Layer Control Registers */
 #define RCAR_GEN2_PHY_CTL1_REG         0x1704
index c852f16..d661ada 100644 (file)
@@ -773,8 +773,7 @@ static void __device_link_del(struct kref *kref)
        dev_dbg(link->consumer, "Dropping the link to %s\n",
                dev_name(link->supplier));
 
-       if (link->flags & DL_FLAG_PM_RUNTIME)
-               pm_runtime_drop_link(link->consumer);
+       pm_runtime_drop_link(link);
 
        list_del_rcu(&link->s_node);
        list_del_rcu(&link->c_node);
@@ -788,8 +787,7 @@ static void __device_link_del(struct kref *kref)
        dev_info(link->consumer, "Dropping the link to %s\n",
                 dev_name(link->supplier));
 
-       if (link->flags & DL_FLAG_PM_RUNTIME)
-               pm_runtime_drop_link(link->consumer);
+       pm_runtime_drop_link(link);
 
        list_del(&link->s_node);
        list_del(&link->c_node);
@@ -4264,6 +4262,7 @@ static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
  */
 void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
 {
+       struct device *parent = dev->parent;
        struct fwnode_handle *fn = dev->fwnode;
 
        if (fwnode) {
@@ -4278,7 +4277,8 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
        } else {
                if (fwnode_is_primary(fn)) {
                        dev->fwnode = fn->secondary;
-                       fn->secondary = NULL;
+                       if (!(parent && fn == parent->fwnode))
+                               fn->secondary = ERR_PTR(-ENODEV);
                } else {
                        dev->fwnode = NULL;
                }
index b42229b..148e819 100644 (file)
@@ -1117,6 +1117,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
 
        drv = dev->driver;
        if (drv) {
+               pm_runtime_get_sync(dev);
+
                while (device_links_busy(dev)) {
                        __device_driver_unlock(dev, parent);
 
@@ -1128,13 +1130,12 @@ static void __device_release_driver(struct device *dev, struct device *parent)
                         * have released the driver successfully while this one
                         * was waiting, so check for that.
                         */
-                       if (dev->driver != drv)
+                       if (dev->driver != drv) {
+                               pm_runtime_put(dev);
                                return;
+                       }
                }
 
-               pm_runtime_get_sync(dev);
-               pm_runtime_clean_up_links(dev);
-
                driver_sysfs_remove(dev);
 
                if (dev->bus)
index 05bb4d4..7432689 100644 (file)
@@ -415,26 +415,45 @@ static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed)
        s64 elapsed_ns;
        int ret;
 
+       /* Notify consumers that we are about to power on. */
+       ret = raw_notifier_call_chain_robust(&genpd->power_notifiers,
+                                            GENPD_NOTIFY_PRE_ON,
+                                            GENPD_NOTIFY_OFF, NULL);
+       ret = notifier_to_errno(ret);
+       if (ret)
+               return ret;
+
        if (!genpd->power_on)
-               return 0;
+               goto out;
 
-       if (!timed)
-               return genpd->power_on(genpd);
+       if (!timed) {
+               ret = genpd->power_on(genpd);
+               if (ret)
+                       goto err;
+
+               goto out;
+       }
 
        time_start = ktime_get();
        ret = genpd->power_on(genpd);
        if (ret)
-               return ret;
+               goto err;
 
        elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start));
        if (elapsed_ns <= genpd->states[state_idx].power_on_latency_ns)
-               return ret;
+               goto out;
 
        genpd->states[state_idx].power_on_latency_ns = elapsed_ns;
        genpd->max_off_time_changed = true;
        pr_debug("%s: Power-%s latency exceeded, new value %lld ns\n",
                 genpd->name, "on", elapsed_ns);
 
+out:
+       raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_ON, NULL);
+       return 0;
+err:
+       raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_OFF,
+                               NULL);
        return ret;
 }
 
@@ -445,27 +464,46 @@ static int _genpd_power_off(struct generic_pm_domain *genpd, bool timed)
        s64 elapsed_ns;
        int ret;
 
+       /* Notify consumers that we are about to power off. */
+       ret = raw_notifier_call_chain_robust(&genpd->power_notifiers,
+                                            GENPD_NOTIFY_PRE_OFF,
+                                            GENPD_NOTIFY_ON, NULL);
+       ret = notifier_to_errno(ret);
+       if (ret)
+               return ret;
+
        if (!genpd->power_off)
-               return 0;
+               goto out;
+
+       if (!timed) {
+               ret = genpd->power_off(genpd);
+               if (ret)
+                       goto busy;
 
-       if (!timed)
-               return genpd->power_off(genpd);
+               goto out;
+       }
 
        time_start = ktime_get();
        ret = genpd->power_off(genpd);
        if (ret)
-               return ret;
+               goto busy;
 
        elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start));
        if (elapsed_ns <= genpd->states[state_idx].power_off_latency_ns)
-               return 0;
+               goto out;
 
        genpd->states[state_idx].power_off_latency_ns = elapsed_ns;
        genpd->max_off_time_changed = true;
        pr_debug("%s: Power-%s latency exceeded, new value %lld ns\n",
                 genpd->name, "off", elapsed_ns);
 
+out:
+       raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_OFF,
+                               NULL);
        return 0;
+busy:
+       raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_ON, NULL);
+       return ret;
 }
 
 /**
@@ -550,11 +588,14 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
                return -EBUSY;
 
        ret = _genpd_power_off(genpd, true);
-       if (ret)
+       if (ret) {
+               genpd->states[genpd->state_idx].rejected++;
                return ret;
+       }
 
        genpd->status = GENPD_STATE_OFF;
        genpd_update_accounting(genpd);
+       genpd->states[genpd->state_idx].usage++;
 
        list_for_each_entry(link, &genpd->child_links, child_node) {
                genpd_sd_counter_dec(link->parent);
@@ -1270,13 +1311,14 @@ static int genpd_restore_noirq(struct device *dev)
         * first time for the given domain in the present cycle.
         */
        genpd_lock(genpd);
-       if (genpd->suspended_count++ == 0)
+       if (genpd->suspended_count++ == 0) {
                /*
                 * The boot kernel might put the domain into arbitrary state,
                 * so make it appear as powered off to genpd_sync_power_on(),
                 * so that it tries to power it on in case it was really off.
                 */
                genpd->status = GENPD_STATE_OFF;
+       }
 
        genpd_sync_power_on(genpd, true, 0);
        genpd_unlock(genpd);
@@ -1592,6 +1634,101 @@ int pm_genpd_remove_device(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(pm_genpd_remove_device);
 
+/**
+ * dev_pm_genpd_add_notifier - Add a genpd power on/off notifier for @dev
+ *
+ * @dev: Device that should be associated with the notifier
+ * @nb: The notifier block to register
+ *
+ * Users may call this function to add a genpd power on/off notifier for an
+ * attached @dev. Only one notifier per device is allowed. The notifier is
+ * sent when genpd is powering on/off the PM domain.
+ *
+ * It is assumed that the user guarantee that the genpd wouldn't be detached
+ * while this routine is getting called.
+ *
+ * Returns 0 on success and negative error values on failures.
+ */
+int dev_pm_genpd_add_notifier(struct device *dev, struct notifier_block *nb)
+{
+       struct generic_pm_domain *genpd;
+       struct generic_pm_domain_data *gpd_data;
+       int ret;
+
+       genpd = dev_to_genpd_safe(dev);
+       if (!genpd)
+               return -ENODEV;
+
+       if (WARN_ON(!dev->power.subsys_data ||
+                    !dev->power.subsys_data->domain_data))
+               return -EINVAL;
+
+       gpd_data = to_gpd_data(dev->power.subsys_data->domain_data);
+       if (gpd_data->power_nb)
+               return -EEXIST;
+
+       genpd_lock(genpd);
+       ret = raw_notifier_chain_register(&genpd->power_notifiers, nb);
+       genpd_unlock(genpd);
+
+       if (ret) {
+               dev_warn(dev, "failed to add notifier for PM domain %s\n",
+                        genpd->name);
+               return ret;
+       }
+
+       gpd_data->power_nb = nb;
+       return 0;
+}
+EXPORT_SYMBOL_GPL(dev_pm_genpd_add_notifier);
+
+/**
+ * dev_pm_genpd_remove_notifier - Remove a genpd power on/off notifier for @dev
+ *
+ * @dev: Device that is associated with the notifier
+ *
+ * Users may call this function to remove a genpd power on/off notifier for an
+ * attached @dev.
+ *
+ * It is assumed that the user guarantee that the genpd wouldn't be detached
+ * while this routine is getting called.
+ *
+ * Returns 0 on success and negative error values on failures.
+ */
+int dev_pm_genpd_remove_notifier(struct device *dev)
+{
+       struct generic_pm_domain *genpd;
+       struct generic_pm_domain_data *gpd_data;
+       int ret;
+
+       genpd = dev_to_genpd_safe(dev);
+       if (!genpd)
+               return -ENODEV;
+
+       if (WARN_ON(!dev->power.subsys_data ||
+                    !dev->power.subsys_data->domain_data))
+               return -EINVAL;
+
+       gpd_data = to_gpd_data(dev->power.subsys_data->domain_data);
+       if (!gpd_data->power_nb)
+               return -ENODEV;
+
+       genpd_lock(genpd);
+       ret = raw_notifier_chain_unregister(&genpd->power_notifiers,
+                                           gpd_data->power_nb);
+       genpd_unlock(genpd);
+
+       if (ret) {
+               dev_warn(dev, "failed to remove notifier for PM domain %s\n",
+                        genpd->name);
+               return ret;
+       }
+
+       gpd_data->power_nb = NULL;
+       return 0;
+}
+EXPORT_SYMBOL_GPL(dev_pm_genpd_remove_notifier);
+
 static int genpd_add_subdomain(struct generic_pm_domain *genpd,
                               struct generic_pm_domain *subdomain)
 {
@@ -1762,6 +1899,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
        INIT_LIST_HEAD(&genpd->parent_links);
        INIT_LIST_HEAD(&genpd->child_links);
        INIT_LIST_HEAD(&genpd->dev_list);
+       RAW_INIT_NOTIFIER_HEAD(&genpd->power_notifiers);
        genpd_lock_init(genpd);
        genpd->gov = gov;
        INIT_WORK(&genpd->power_off_work, genpd_power_off_work_fn);
@@ -2923,7 +3061,7 @@ static int idle_states_show(struct seq_file *s, void *data)
        if (ret)
                return -ERESTARTSYS;
 
-       seq_puts(s, "State          Time Spent(ms)\n");
+       seq_puts(s, "State          Time Spent(ms) Usage          Rejected\n");
 
        for (i = 0; i < genpd->state_count; i++) {
                ktime_t delta = 0;
@@ -2935,7 +3073,8 @@ static int idle_states_show(struct seq_file *s, void *data)
 
                msecs = ktime_to_ms(
                        ktime_add(genpd->states[i].idle_time, delta));
-               seq_printf(s, "S%-13i %lld\n", i, msecs);
+               seq_printf(s, "S%-13i %-14lld %-14llu %llu\n", i, msecs,
+                             genpd->states[i].usage, genpd->states[i].rejected);
        }
 
        genpd_unlock(genpd);
index 205a067..c7ac490 100644 (file)
@@ -363,7 +363,6 @@ static pm_callback_t pm_op(const struct dev_pm_ops *ops, pm_message_t state)
        case PM_EVENT_THAW:
        case PM_EVENT_RECOVER:
                return ops->thaw;
-               break;
        case PM_EVENT_RESTORE:
                return ops->restore;
 #endif /* CONFIG_HIBERNATE_CALLBACKS */
index 6f605f7..bfda153 100644 (file)
@@ -1643,42 +1643,6 @@ void pm_runtime_remove(struct device *dev)
 }
 
 /**
- * pm_runtime_clean_up_links - Prepare links to consumers for driver removal.
- * @dev: Device whose driver is going to be removed.
- *
- * Check links from this device to any consumers and if any of them have active
- * runtime PM references to the device, drop the usage counter of the device
- * (as many times as needed).
- *
- * Links with the DL_FLAG_MANAGED flag unset are ignored.
- *
- * Since the device is guaranteed to be runtime-active at the point this is
- * called, nothing else needs to be done here.
- *
- * Moreover, this is called after device_links_busy() has returned 'false', so
- * the status of each link is guaranteed to be DL_STATE_SUPPLIER_UNBIND and
- * therefore rpm_active can't be manipulated concurrently.
- */
-void pm_runtime_clean_up_links(struct device *dev)
-{
-       struct device_link *link;
-       int idx;
-
-       idx = device_links_read_lock();
-
-       list_for_each_entry_rcu(link, &dev->links.consumers, s_node,
-                               device_links_read_lock_held()) {
-               if (!(link->flags & DL_FLAG_MANAGED))
-                       continue;
-
-               while (refcount_dec_not_one(&link->rpm_active))
-                       pm_runtime_put_noidle(dev);
-       }
-
-       device_links_read_unlock(idx);
-}
-
-/**
  * pm_runtime_get_suppliers - Resume and reference-count supplier devices.
  * @dev: Consumer device.
  */
@@ -1729,7 +1693,7 @@ void pm_runtime_new_link(struct device *dev)
        spin_unlock_irq(&dev->power.lock);
 }
 
-void pm_runtime_drop_link(struct device *dev)
+static void pm_runtime_drop_link_count(struct device *dev)
 {
        spin_lock_irq(&dev->power.lock);
        WARN_ON(dev->power.links_count == 0);
@@ -1737,6 +1701,25 @@ void pm_runtime_drop_link(struct device *dev)
        spin_unlock_irq(&dev->power.lock);
 }
 
+/**
+ * pm_runtime_drop_link - Prepare for device link removal.
+ * @link: Device link going away.
+ *
+ * Drop the link count of the consumer end of @link and decrement the supplier
+ * device's runtime PM usage counter as many times as needed to drop all of the
+ * PM runtime reference to it from the consumer.
+ */
+void pm_runtime_drop_link(struct device_link *link)
+{
+       if (!(link->flags & DL_FLAG_PM_RUNTIME))
+               return;
+
+       pm_runtime_drop_link_count(link->consumer);
+
+       while (refcount_dec_not_one(&link->rpm_active))
+               pm_runtime_put(link->supplier);
+}
+
 static bool pm_runtime_need_not_resume(struct device *dev)
 {
        return atomic_read(&dev->power.usage_count) <= 1 &&
index 3c9485a..c4f9ccf 100644 (file)
@@ -296,7 +296,7 @@ static void nbd_size_clear(struct nbd_device *nbd)
        }
 }
 
-static void nbd_size_update(struct nbd_device *nbd)
+static void nbd_size_update(struct nbd_device *nbd, bool start)
 {
        struct nbd_config *config = nbd->config;
        struct block_device *bdev = bdget_disk(nbd->disk, 0);
@@ -313,7 +313,8 @@ static void nbd_size_update(struct nbd_device *nbd)
        if (bdev) {
                if (bdev->bd_disk) {
                        bd_set_nr_sectors(bdev, nr_sectors);
-                       set_blocksize(bdev, config->blksize);
+                       if (start)
+                               set_blocksize(bdev, config->blksize);
                } else
                        set_bit(GD_NEED_PART_SCAN, &nbd->disk->state);
                bdput(bdev);
@@ -328,7 +329,7 @@ static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize,
        config->blksize = blocksize;
        config->bytesize = blocksize * nr_blocks;
        if (nbd->task_recv != NULL)
-               nbd_size_update(nbd);
+               nbd_size_update(nbd, false);
 }
 
 static void nbd_complete_rq(struct request *req)
@@ -802,9 +803,9 @@ static void recv_work(struct work_struct *work)
                if (likely(!blk_should_fake_timeout(rq->q)))
                        blk_mq_complete_request(rq);
        }
+       nbd_config_put(nbd);
        atomic_dec(&config->recv_threads);
        wake_up(&config->recv_wq);
-       nbd_config_put(nbd);
        kfree(args);
 }
 
@@ -1308,7 +1309,7 @@ static int nbd_start_device(struct nbd_device *nbd)
                args->index = i;
                queue_work(nbd->recv_workq, &args->work);
        }
-       nbd_size_update(nbd);
+       nbd_size_update(nbd, true);
        return error;
 }
 
index d2e7db4..c24d9b5 100644 (file)
@@ -47,6 +47,8 @@ struct nullb_device {
        unsigned int nr_zones_closed;
        struct blk_zone *zones;
        sector_t zone_size_sects;
+       spinlock_t zone_lock;
+       unsigned long *zone_locks;
 
        unsigned long size; /* device size in MB */
        unsigned long completion_nsec; /* time in ns to complete a request */
index fa0cc70..beb34b4 100644 (file)
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/vmalloc.h>
+#include <linux/bitmap.h>
 #include "null_blk.h"
 
 #define CREATE_TRACE_POINTS
@@ -45,6 +46,22 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)
        if (!dev->zones)
                return -ENOMEM;
 
+       /*
+        * With memory backing, the zone_lock spinlock needs to be temporarily
+        * released to avoid scheduling in atomic context. To guarantee zone
+        * information protection, use a bitmap to lock zones with
+        * wait_on_bit_lock_io(). Sleeping on the lock is OK as memory backing
+        * implies that the queue is marked with BLK_MQ_F_BLOCKING.
+        */
+       spin_lock_init(&dev->zone_lock);
+       if (dev->memory_backed) {
+               dev->zone_locks = bitmap_zalloc(dev->nr_zones, GFP_KERNEL);
+               if (!dev->zone_locks) {
+                       kvfree(dev->zones);
+                       return -ENOMEM;
+               }
+       }
+
        if (dev->zone_nr_conv >= dev->nr_zones) {
                dev->zone_nr_conv = dev->nr_zones - 1;
                pr_info("changed the number of conventional zones to %u",
@@ -123,15 +140,31 @@ int null_register_zoned_dev(struct nullb *nullb)
 
 void null_free_zoned_dev(struct nullb_device *dev)
 {
+       bitmap_free(dev->zone_locks);
        kvfree(dev->zones);
 }
 
+static inline void null_lock_zone(struct nullb_device *dev, unsigned int zno)
+{
+       if (dev->memory_backed)
+               wait_on_bit_lock_io(dev->zone_locks, zno, TASK_UNINTERRUPTIBLE);
+       spin_lock_irq(&dev->zone_lock);
+}
+
+static inline void null_unlock_zone(struct nullb_device *dev, unsigned int zno)
+{
+       spin_unlock_irq(&dev->zone_lock);
+
+       if (dev->memory_backed)
+               clear_and_wake_up_bit(zno, dev->zone_locks);
+}
+
 int null_report_zones(struct gendisk *disk, sector_t sector,
                unsigned int nr_zones, report_zones_cb cb, void *data)
 {
        struct nullb *nullb = disk->private_data;
        struct nullb_device *dev = nullb->dev;
-       unsigned int first_zone, i;
+       unsigned int first_zone, i, zno;
        struct blk_zone zone;
        int error;
 
@@ -142,15 +175,18 @@ int null_report_zones(struct gendisk *disk, sector_t sector,
        nr_zones = min(nr_zones, dev->nr_zones - first_zone);
        trace_nullb_report_zones(nullb, nr_zones);
 
-       for (i = 0; i < nr_zones; i++) {
+       zno = first_zone;
+       for (i = 0; i < nr_zones; i++, zno++) {
                /*
                 * Stacked DM target drivers will remap the zone information by
                 * modifying the zone information passed to the report callback.
                 * So use a local copy to avoid corruption of the device zone
                 * array.
                 */
-               memcpy(&zone, &dev->zones[first_zone + i],
-                      sizeof(struct blk_zone));
+               null_lock_zone(dev, zno);
+               memcpy(&zone, &dev->zones[zno], sizeof(struct blk_zone));
+               null_unlock_zone(dev, zno);
+
                error = cb(&zone, i, data);
                if (error)
                        return error;
@@ -159,6 +195,10 @@ int null_report_zones(struct gendisk *disk, sector_t sector,
        return nr_zones;
 }
 
+/*
+ * This is called in the case of memory backing from null_process_cmd()
+ * with the target zone already locked.
+ */
 size_t null_zone_valid_read_len(struct nullb *nullb,
                                sector_t sector, unsigned int len)
 {
@@ -220,29 +260,34 @@ static void null_close_first_imp_zone(struct nullb_device *dev)
        }
 }
 
-static bool null_can_set_active(struct nullb_device *dev)
+static blk_status_t null_check_active(struct nullb_device *dev)
 {
        if (!dev->zone_max_active)
-               return true;
+               return BLK_STS_OK;
 
-       return dev->nr_zones_exp_open + dev->nr_zones_imp_open +
-              dev->nr_zones_closed < dev->zone_max_active;
+       if (dev->nr_zones_exp_open + dev->nr_zones_imp_open +
+                       dev->nr_zones_closed < dev->zone_max_active)
+               return BLK_STS_OK;
+
+       return BLK_STS_ZONE_ACTIVE_RESOURCE;
 }
 
-static bool null_can_open(struct nullb_device *dev)
+static blk_status_t null_check_open(struct nullb_device *dev)
 {
        if (!dev->zone_max_open)
-               return true;
+               return BLK_STS_OK;
 
        if (dev->nr_zones_exp_open + dev->nr_zones_imp_open < dev->zone_max_open)
-               return true;
+               return BLK_STS_OK;
 
-       if (dev->nr_zones_imp_open && null_can_set_active(dev)) {
-               null_close_first_imp_zone(dev);
-               return true;
+       if (dev->nr_zones_imp_open) {
+               if (null_check_active(dev) == BLK_STS_OK) {
+                       null_close_first_imp_zone(dev);
+                       return BLK_STS_OK;
+               }
        }
 
-       return false;
+       return BLK_STS_ZONE_OPEN_RESOURCE;
 }
 
 /*
@@ -258,19 +303,22 @@ static bool null_can_open(struct nullb_device *dev)
  * it is not certain that closing an implicit open zone will allow a new zone
  * to be opened, since we might already be at the active limit capacity.
  */
-static bool null_has_zone_resources(struct nullb_device *dev, struct blk_zone *zone)
+static blk_status_t null_check_zone_resources(struct nullb_device *dev, struct blk_zone *zone)
 {
+       blk_status_t ret;
+
        switch (zone->cond) {
        case BLK_ZONE_COND_EMPTY:
-               if (!null_can_set_active(dev))
-                       return false;
+               ret = null_check_active(dev);
+               if (ret != BLK_STS_OK)
+                       return ret;
                fallthrough;
        case BLK_ZONE_COND_CLOSED:
-               return null_can_open(dev);
+               return null_check_open(dev);
        default:
                /* Should never be called for other states */
                WARN_ON(1);
-               return false;
+               return BLK_STS_IOERR;
        }
 }
 
@@ -287,21 +335,26 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
        if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)
                return null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors);
 
+       null_lock_zone(dev, zno);
+
        switch (zone->cond) {
        case BLK_ZONE_COND_FULL:
                /* Cannot write to a full zone */
-               return BLK_STS_IOERR;
+               ret = BLK_STS_IOERR;
+               goto unlock;
        case BLK_ZONE_COND_EMPTY:
        case BLK_ZONE_COND_CLOSED:
-               if (!null_has_zone_resources(dev, zone))
-                       return BLK_STS_IOERR;
+               ret = null_check_zone_resources(dev, zone);
+               if (ret != BLK_STS_OK)
+                       goto unlock;
                break;
        case BLK_ZONE_COND_IMP_OPEN:
        case BLK_ZONE_COND_EXP_OPEN:
                break;
        default:
                /* Invalid zone condition */
-               return BLK_STS_IOERR;
+               ret = BLK_STS_IOERR;
+               goto unlock;
        }
 
        /*
@@ -317,11 +370,14 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
                else
                        cmd->rq->__sector = sector;
        } else if (sector != zone->wp) {
-               return BLK_STS_IOERR;
+               ret = BLK_STS_IOERR;
+               goto unlock;
        }
 
-       if (zone->wp + nr_sectors > zone->start + zone->capacity)
-               return BLK_STS_IOERR;
+       if (zone->wp + nr_sectors > zone->start + zone->capacity) {
+               ret = BLK_STS_IOERR;
+               goto unlock;
+       }
 
        if (zone->cond == BLK_ZONE_COND_CLOSED) {
                dev->nr_zones_closed--;
@@ -332,9 +388,19 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
        if (zone->cond != BLK_ZONE_COND_EXP_OPEN)
                zone->cond = BLK_ZONE_COND_IMP_OPEN;
 
+       /*
+        * Memory backing allocation may sleep: release the zone_lock spinlock
+        * to avoid scheduling in atomic context. Zone operation atomicity is
+        * still guaranteed through the zone_locks bitmap.
+        */
+       if (dev->memory_backed)
+               spin_unlock_irq(&dev->zone_lock);
        ret = null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors);
+       if (dev->memory_backed)
+               spin_lock_irq(&dev->zone_lock);
+
        if (ret != BLK_STS_OK)
-               return ret;
+               goto unlock;
 
        zone->wp += nr_sectors;
        if (zone->wp == zone->start + zone->capacity) {
@@ -344,11 +410,18 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
                        dev->nr_zones_imp_open--;
                zone->cond = BLK_ZONE_COND_FULL;
        }
-       return BLK_STS_OK;
+       ret = BLK_STS_OK;
+
+unlock:
+       null_unlock_zone(dev, zno);
+
+       return ret;
 }
 
 static blk_status_t null_open_zone(struct nullb_device *dev, struct blk_zone *zone)
 {
+       blk_status_t ret;
+
        if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)
                return BLK_STS_IOERR;
 
@@ -357,15 +430,17 @@ static blk_status_t null_open_zone(struct nullb_device *dev, struct blk_zone *zo
                /* open operation on exp open is not an error */
                return BLK_STS_OK;
        case BLK_ZONE_COND_EMPTY:
-               if (!null_has_zone_resources(dev, zone))
-                       return BLK_STS_IOERR;
+               ret = null_check_zone_resources(dev, zone);
+               if (ret != BLK_STS_OK)
+                       return ret;
                break;
        case BLK_ZONE_COND_IMP_OPEN:
                dev->nr_zones_imp_open--;
                break;
        case BLK_ZONE_COND_CLOSED:
-               if (!null_has_zone_resources(dev, zone))
-                       return BLK_STS_IOERR;
+               ret = null_check_zone_resources(dev, zone);
+               if (ret != BLK_STS_OK)
+                       return ret;
                dev->nr_zones_closed--;
                break;
        case BLK_ZONE_COND_FULL:
@@ -381,6 +456,8 @@ static blk_status_t null_open_zone(struct nullb_device *dev, struct blk_zone *zo
 
 static blk_status_t null_finish_zone(struct nullb_device *dev, struct blk_zone *zone)
 {
+       blk_status_t ret;
+
        if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)
                return BLK_STS_IOERR;
 
@@ -389,8 +466,9 @@ static blk_status_t null_finish_zone(struct nullb_device *dev, struct blk_zone *
                /* finish operation on full is not an error */
                return BLK_STS_OK;
        case BLK_ZONE_COND_EMPTY:
-               if (!null_has_zone_resources(dev, zone))
-                       return BLK_STS_IOERR;
+               ret = null_check_zone_resources(dev, zone);
+               if (ret != BLK_STS_OK)
+                       return ret;
                break;
        case BLK_ZONE_COND_IMP_OPEN:
                dev->nr_zones_imp_open--;
@@ -399,8 +477,9 @@ static blk_status_t null_finish_zone(struct nullb_device *dev, struct blk_zone *
                dev->nr_zones_exp_open--;
                break;
        case BLK_ZONE_COND_CLOSED:
-               if (!null_has_zone_resources(dev, zone))
-                       return BLK_STS_IOERR;
+               ret = null_check_zone_resources(dev, zone);
+               if (ret != BLK_STS_OK)
+                       return ret;
                dev->nr_zones_closed--;
                break;
        default:
@@ -447,16 +526,30 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op,
                                   sector_t sector)
 {
        struct nullb_device *dev = cmd->nq->dev;
-       unsigned int zone_no = null_zone_no(dev, sector);
-       struct blk_zone *zone = &dev->zones[zone_no];
-       blk_status_t ret = BLK_STS_OK;
+       unsigned int zone_no;
+       struct blk_zone *zone;
+       blk_status_t ret;
        size_t i;
 
+       if (op == REQ_OP_ZONE_RESET_ALL) {
+               for (i = dev->zone_nr_conv; i < dev->nr_zones; i++) {
+                       null_lock_zone(dev, i);
+                       zone = &dev->zones[i];
+                       if (zone->cond != BLK_ZONE_COND_EMPTY) {
+                               null_reset_zone(dev, zone);
+                               trace_nullb_zone_op(cmd, i, zone->cond);
+                       }
+                       null_unlock_zone(dev, i);
+               }
+               return BLK_STS_OK;
+       }
+
+       zone_no = null_zone_no(dev, sector);
+       zone = &dev->zones[zone_no];
+
+       null_lock_zone(dev, zone_no);
+
        switch (op) {
-       case REQ_OP_ZONE_RESET_ALL:
-               for (i = dev->zone_nr_conv; i < dev->nr_zones; i++)
-                       null_reset_zone(dev, &dev->zones[i]);
-               break;
        case REQ_OP_ZONE_RESET:
                ret = null_reset_zone(dev, zone);
                break;
@@ -470,30 +563,44 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op,
                ret = null_finish_zone(dev, zone);
                break;
        default:
-               return BLK_STS_NOTSUPP;
+               ret = BLK_STS_NOTSUPP;
+               break;
        }
 
        if (ret == BLK_STS_OK)
                trace_nullb_zone_op(cmd, zone_no, zone->cond);
 
+       null_unlock_zone(dev, zone_no);
+
        return ret;
 }
 
 blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, enum req_opf op,
                                    sector_t sector, sector_t nr_sectors)
 {
+       struct nullb_device *dev = cmd->nq->dev;
+       unsigned int zno = null_zone_no(dev, sector);
+       blk_status_t sts;
+
        switch (op) {
        case REQ_OP_WRITE:
-               return null_zone_write(cmd, sector, nr_sectors, false);
+               sts = null_zone_write(cmd, sector, nr_sectors, false);
+               break;
        case REQ_OP_ZONE_APPEND:
-               return null_zone_write(cmd, sector, nr_sectors, true);
+               sts = null_zone_write(cmd, sector, nr_sectors, true);
+               break;
        case REQ_OP_ZONE_RESET:
        case REQ_OP_ZONE_RESET_ALL:
        case REQ_OP_ZONE_OPEN:
        case REQ_OP_ZONE_CLOSE:
        case REQ_OP_ZONE_FINISH:
-               return null_zone_mgmt(cmd, op, sector);
+               sts = null_zone_mgmt(cmd, op, sector);
+               break;
        default:
-               return null_process_cmd(cmd, op, sector, nr_sectors);
+               null_lock_zone(dev, zno);
+               sts = null_process_cmd(cmd, op, sector, nr_sectors);
+               null_unlock_zone(dev, zno);
        }
+
+       return sts;
 }
index d7a6974..8b2411c 100644 (file)
@@ -91,11 +91,6 @@ static int rnbd_clt_set_dev_attr(struct rnbd_clt_dev *dev,
        dev->max_hw_sectors = sess->max_io_size / SECTOR_SIZE;
        dev->max_segments = BMAX_SEGMENTS;
 
-       dev->max_hw_sectors = min_t(u32, dev->max_hw_sectors,
-                                   le32_to_cpu(rsp->max_hw_sectors));
-       dev->max_segments = min_t(u16, dev->max_segments,
-                                 le16_to_cpu(rsp->max_segments));
-
        return 0;
 }
 
@@ -427,7 +422,7 @@ enum wait_type {
 };
 
 static int send_usr_msg(struct rtrs_clt *rtrs, int dir,
-                       struct rnbd_iu *iu, struct kvec *vec, size_t nr,
+                       struct rnbd_iu *iu, struct kvec *vec,
                        size_t len, struct scatterlist *sg, unsigned int sg_len,
                        void (*conf)(struct work_struct *work),
                        int *errno, enum wait_type wait)
@@ -441,7 +436,7 @@ static int send_usr_msg(struct rtrs_clt *rtrs, int dir,
                .conf_fn = msg_conf,
        };
        err = rtrs_clt_request(dir, &req_ops, rtrs, iu->permit,
-                               vec, nr, len, sg, sg_len);
+                               vec, 1, len, sg, sg_len);
        if (!err && wait) {
                wait_event(iu->comp.wait, iu->comp.errno != INT_MAX);
                *errno = iu->comp.errno;
@@ -486,7 +481,7 @@ static int send_msg_close(struct rnbd_clt_dev *dev, u32 device_id, bool wait)
        msg.device_id   = cpu_to_le32(device_id);
 
        WARN_ON(!rnbd_clt_get_dev(dev));
-       err = send_usr_msg(sess->rtrs, WRITE, iu, &vec, 1, 0, NULL, 0,
+       err = send_usr_msg(sess->rtrs, WRITE, iu, &vec, 0, NULL, 0,
                           msg_close_conf, &errno, wait);
        if (err) {
                rnbd_clt_put_dev(dev);
@@ -575,7 +570,7 @@ static int send_msg_open(struct rnbd_clt_dev *dev, bool wait)
 
        WARN_ON(!rnbd_clt_get_dev(dev));
        err = send_usr_msg(sess->rtrs, READ, iu,
-                          &vec, 1, sizeof(*rsp), iu->sglist, 1,
+                          &vec, sizeof(*rsp), iu->sglist, 1,
                           msg_open_conf, &errno, wait);
        if (err) {
                rnbd_clt_put_dev(dev);
@@ -629,7 +624,7 @@ static int send_msg_sess_info(struct rnbd_clt_session *sess, bool wait)
                goto put_iu;
        }
        err = send_usr_msg(sess->rtrs, READ, iu,
-                          &vec, 1, sizeof(*rsp), iu->sglist, 1,
+                          &vec, sizeof(*rsp), iu->sglist, 1,
                           msg_sess_info_conf, &errno, wait);
        if (err) {
                rnbd_clt_put_sess(sess);
@@ -1514,7 +1509,7 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname,
                              "map_device: Failed to configure device, err: %d\n",
                              ret);
                mutex_unlock(&dev->lock);
-               goto del_dev;
+               goto send_close;
        }
 
        rnbd_clt_info(dev,
@@ -1533,6 +1528,8 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname,
 
        return dev;
 
+send_close:
+       send_msg_close(dev, dev->device_id, WAIT);
 del_dev:
        delete_dev(dev);
 put_dev:
index ae6454c..a962b45 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/completion.h>
 #include <linux/scatterlist.h>
-#include <linux/version.h>
 #include <linux/err.h>
 #include <linux/aer.h>
 #include <linux/wait.h>
index 5e7c36d..f570556 100644 (file)
@@ -473,6 +473,12 @@ static void xen_vbd_free(struct xen_vbd *vbd)
        vbd->bdev = NULL;
 }
 
+/* Enable the persistent grants feature. */
+static bool feature_persistent = true;
+module_param(feature_persistent, bool, 0644);
+MODULE_PARM_DESC(feature_persistent,
+               "Enables the persistent grants feature");
+
 static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
                          unsigned major, unsigned minor, int readonly,
                          int cdrom)
@@ -518,6 +524,8 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
        if (q && blk_queue_secure_erase(q))
                vbd->discard_secure = true;
 
+       vbd->feature_gnt_persistent = feature_persistent;
+
        pr_debug("Successful creation of handle=%04x (dom=%u)\n",
                handle, blkif->domid);
        return 0;
@@ -905,7 +913,8 @@ again:
 
        xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support);
 
-       err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", 1);
+       err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u",
+                       be->blkif->vbd.feature_gnt_persistent);
        if (err) {
                xenbus_dev_fatal(dev, err, "writing %s/feature-persistent",
                                 dev->nodename);
@@ -1066,7 +1075,6 @@ static int connect_ring(struct backend_info *be)
 {
        struct xenbus_device *dev = be->dev;
        struct xen_blkif *blkif = be->blkif;
-       unsigned int pers_grants;
        char protocol[64] = "";
        int err, i;
        char *xspath;
@@ -1092,9 +1100,11 @@ static int connect_ring(struct backend_info *be)
                xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
                return -ENOSYS;
        }
-       pers_grants = xenbus_read_unsigned(dev->otherend, "feature-persistent",
-                                          0);
-       blkif->vbd.feature_gnt_persistent = pers_grants;
+       if (blkif->vbd.feature_gnt_persistent)
+               blkif->vbd.feature_gnt_persistent =
+                       xenbus_read_unsigned(dev->otherend,
+                                       "feature-persistent", 0);
+
        blkif->vbd.overflow_max_grants = 0;
 
        /*
@@ -1117,7 +1127,7 @@ static int connect_ring(struct backend_info *be)
 
        pr_info("%s: using %d queues, protocol %d (%s) %s\n", dev->nodename,
                 blkif->nr_rings, blkif->blk_protocol, protocol,
-                pers_grants ? "persistent grants" : "");
+                blkif->vbd.feature_gnt_persistent ? "persistent grants" : "");
 
        ring_page_order = xenbus_read_unsigned(dev->otherend,
                                               "ring-page-order", 0);
index 91de2e0..48629d3 100644 (file)
@@ -1866,8 +1866,8 @@ again:
                message = "writing protocol";
                goto abort_transaction;
        }
-       err = xenbus_printf(xbt, dev->nodename,
-                           "feature-persistent", "%u", 1);
+       err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u",
+                       info->feature_persistent);
        if (err)
                dev_warn(&dev->dev,
                         "writing persistent grants feature to xenbus");
@@ -1941,6 +1941,13 @@ static int negotiate_mq(struct blkfront_info *info)
        }
        return 0;
 }
+
+/* Enable the persistent grants feature. */
+static bool feature_persistent = true;
+module_param(feature_persistent, bool, 0644);
+MODULE_PARM_DESC(feature_persistent,
+               "Enables the persistent grants feature");
+
 /**
  * Entry point to this code when a new device is created.  Allocate the basic
  * structures and the ring buffer for communication with the backend, and
@@ -2007,6 +2014,8 @@ static int blkfront_probe(struct xenbus_device *dev,
        info->vdevice = vdevice;
        info->connected = BLKIF_STATE_DISCONNECTED;
 
+       info->feature_persistent = feature_persistent;
+
        /* Front end dir is a number, which is used as the id. */
        info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0);
        dev_set_drvdata(&dev->dev, info);
@@ -2316,9 +2325,10 @@ static void blkfront_gather_backend_features(struct blkfront_info *info)
        if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0))
                blkfront_setup_discard(info);
 
-       info->feature_persistent =
-               !!xenbus_read_unsigned(info->xbdev->otherend,
-                                      "feature-persistent", 0);
+       if (info->feature_persistent)
+               info->feature_persistent =
+                       !!xenbus_read_unsigned(info->xbdev->otherend,
+                                              "feature-persistent", 0);
 
        indirect_segments = xenbus_read_unsigned(info->xbdev->otherend,
                                        "feature-max-indirect-segments", 0);
index 8d581c7..eb8ef65 100644 (file)
@@ -443,22 +443,27 @@ static void ace_fix_driveid(u16 *id)
 #define ACE_FSM_NUM_STATES              11
 
 /* Set flag to exit FSM loop and reschedule tasklet */
-static inline void ace_fsm_yield(struct ace_device *ace)
+static inline void ace_fsm_yieldpoll(struct ace_device *ace)
 {
-       dev_dbg(ace->dev, "ace_fsm_yield()\n");
        tasklet_schedule(&ace->fsm_tasklet);
        ace->fsm_continue_flag = 0;
 }
 
+static inline void ace_fsm_yield(struct ace_device *ace)
+{
+       dev_dbg(ace->dev, "%s()\n", __func__);
+       ace_fsm_yieldpoll(ace);
+}
+
 /* Set flag to exit FSM loop and wait for IRQ to reschedule tasklet */
 static inline void ace_fsm_yieldirq(struct ace_device *ace)
 {
        dev_dbg(ace->dev, "ace_fsm_yieldirq()\n");
 
-       if (!ace->irq)
-               /* No IRQ assigned, so need to poll */
-               tasklet_schedule(&ace->fsm_tasklet);
-       ace->fsm_continue_flag = 0;
+       if (ace->irq > 0)
+               ace->fsm_continue_flag = 0;
+       else
+               ace_fsm_yieldpoll(ace);
 }
 
 static bool ace_has_next_request(struct request_queue *q)
@@ -1053,12 +1058,12 @@ static int ace_setup(struct ace_device *ace)
                ACE_CTRL_DATABUFRDYIRQ | ACE_CTRL_ERRORIRQ);
 
        /* Now we can hook up the irq handler */
-       if (ace->irq) {
+       if (ace->irq > 0) {
                rc = request_irq(ace->irq, ace_interrupt, 0, "systemace", ace);
                if (rc) {
                        /* Failure - fall back to polled mode */
                        dev_err(ace->dev, "request_irq failed\n");
-                       ace->irq = 0;
+                       ace->irq = rc;
                }
        }
 
@@ -1110,7 +1115,7 @@ static void ace_teardown(struct ace_device *ace)
 
        tasklet_kill(&ace->fsm_tasklet);
 
-       if (ace->irq)
+       if (ace->irq > 0)
                free_irq(ace->irq, ace);
 
        iounmap(ace->baseaddr);
@@ -1123,11 +1128,6 @@ static int ace_alloc(struct device *dev, int id, resource_size_t physaddr,
        int rc;
        dev_dbg(dev, "ace_alloc(%p)\n", dev);
 
-       if (!physaddr) {
-               rc = -ENODEV;
-               goto err_noreg;
-       }
-
        /* Allocate and initialize the ace device structure */
        ace = kzalloc(sizeof(struct ace_device), GFP_KERNEL);
        if (!ace) {
@@ -1153,7 +1153,6 @@ err_setup:
        dev_set_drvdata(dev, NULL);
        kfree(ace);
 err_alloc:
-err_noreg:
        dev_err(dev, "could not initialize device, err=%i\n", rc);
        return rc;
 }
@@ -1176,10 +1175,11 @@ static void ace_free(struct device *dev)
 
 static int ace_probe(struct platform_device *dev)
 {
-       resource_size_t physaddr = 0;
        int bus_width = ACE_BUS_WIDTH_16; /* FIXME: should not be hard coded */
+       resource_size_t physaddr;
+       struct resource *res;
        u32 id = dev->id;
-       int irq = 0;
+       int irq;
        int i;
 
        dev_dbg(&dev->dev, "ace_probe(%p)\n", dev);
@@ -1190,12 +1190,15 @@ static int ace_probe(struct platform_device *dev)
        if (of_find_property(dev->dev.of_node, "8-bit", NULL))
                bus_width = ACE_BUS_WIDTH_8;
 
-       for (i = 0; i < dev->num_resources; i++) {
-               if (dev->resource[i].flags & IORESOURCE_MEM)
-                       physaddr = dev->resource[i].start;
-               if (dev->resource[i].flags & IORESOURCE_IRQ)
-                       irq = dev->resource[i].start;
-       }
+       res = platform_get_resource(dev, IORESOURCE_MEM, 0);
+       if (!res)
+               return -EINVAL;
+
+       physaddr = res->start;
+       if (!physaddr)
+               return -ENODEV;
+
+       irq = platform_get_irq_optional(dev, 0);
 
        /* Call the bus-independent setup code */
        return ace_alloc(&dev->dev, id, physaddr, irq, bus_width);
index 029403c..1b69720 100644 (file)
@@ -1218,10 +1218,11 @@ out:
 static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index,
                                struct bio *bio, bool partial_io)
 {
-       int ret;
+       struct zcomp_strm *zstrm;
        unsigned long handle;
        unsigned int size;
        void *src, *dst;
+       int ret;
 
        zram_slot_lock(zram, index);
        if (zram_test_flag(zram, index, ZRAM_WB)) {
@@ -1252,6 +1253,9 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index,
 
        size = zram_get_obj_size(zram, index);
 
+       if (size != PAGE_SIZE)
+               zstrm = zcomp_stream_get(zram->comp);
+
        src = zs_map_object(zram->mem_pool, handle, ZS_MM_RO);
        if (size == PAGE_SIZE) {
                dst = kmap_atomic(page);
@@ -1259,8 +1263,6 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index,
                kunmap_atomic(dst);
                ret = 0;
        } else {
-               struct zcomp_strm *zstrm = zcomp_stream_get(zram->comp);
-
                dst = kmap_atomic(page);
                ret = zcomp_decompress(zstrm, src, size, dst);
                kunmap_atomic(dst);
index 09346ae..78cc64b 100644 (file)
@@ -47,7 +47,7 @@ enum {
 struct intel_tlv {
        u8 type;
        u8 len;
-       u8 val[0];
+       u8 val[];
 } __packed;
 
 struct intel_version_tlv {
index ec1004c..7355fa2 100644 (file)
 #define  ARB_ERR_CAP_STATUS_WRITE      (1 << 1)
 #define  ARB_ERR_CAP_STATUS_VALID      (1 << 0)
 
+#define  ARB_BP_CAP_CLEAR              (1 << 0)
+#define  ARB_BP_CAP_STATUS_PROT_SHIFT  14
+#define  ARB_BP_CAP_STATUS_TYPE                (1 << 13)
+#define  ARB_BP_CAP_STATUS_RSP_SHIFT   10
+#define  ARB_BP_CAP_STATUS_MASK                GENMASK(1, 0)
+#define  ARB_BP_CAP_STATUS_BS_SHIFT    2
+#define  ARB_BP_CAP_STATUS_WRITE       (1 << 1)
+#define  ARB_BP_CAP_STATUS_VALID       (1 << 0)
+
 enum {
        ARB_TIMER,
+       ARB_BP_CAP_CLR,
+       ARB_BP_CAP_HI_ADDR,
+       ARB_BP_CAP_ADDR,
+       ARB_BP_CAP_STATUS,
+       ARB_BP_CAP_MASTER,
        ARB_ERR_CAP_CLR,
        ARB_ERR_CAP_HI_ADDR,
        ARB_ERR_CAP_ADDR,
@@ -41,6 +55,11 @@ enum {
 
 static const int gisb_offsets_bcm7038[] = {
        [ARB_TIMER]             = 0x00c,
+       [ARB_BP_CAP_CLR]        = 0x014,
+       [ARB_BP_CAP_HI_ADDR]    = -1,
+       [ARB_BP_CAP_ADDR]       = 0x0b8,
+       [ARB_BP_CAP_STATUS]     = 0x0c0,
+       [ARB_BP_CAP_MASTER]     = -1,
        [ARB_ERR_CAP_CLR]       = 0x0c4,
        [ARB_ERR_CAP_HI_ADDR]   = -1,
        [ARB_ERR_CAP_ADDR]      = 0x0c8,
@@ -50,6 +69,11 @@ static const int gisb_offsets_bcm7038[] = {
 
 static const int gisb_offsets_bcm7278[] = {
        [ARB_TIMER]             = 0x008,
+       [ARB_BP_CAP_CLR]        = 0x01c,
+       [ARB_BP_CAP_HI_ADDR]    = -1,
+       [ARB_BP_CAP_ADDR]       = 0x220,
+       [ARB_BP_CAP_STATUS]     = 0x230,
+       [ARB_BP_CAP_MASTER]     = 0x234,
        [ARB_ERR_CAP_CLR]       = 0x7f8,
        [ARB_ERR_CAP_HI_ADDR]   = -1,
        [ARB_ERR_CAP_ADDR]      = 0x7e0,
@@ -59,6 +83,11 @@ static const int gisb_offsets_bcm7278[] = {
 
 static const int gisb_offsets_bcm7400[] = {
        [ARB_TIMER]             = 0x00c,
+       [ARB_BP_CAP_CLR]        = 0x014,
+       [ARB_BP_CAP_HI_ADDR]    = -1,
+       [ARB_BP_CAP_ADDR]       = 0x0b8,
+       [ARB_BP_CAP_STATUS]     = 0x0c0,
+       [ARB_BP_CAP_MASTER]     = 0x0c4,
        [ARB_ERR_CAP_CLR]       = 0x0c8,
        [ARB_ERR_CAP_HI_ADDR]   = -1,
        [ARB_ERR_CAP_ADDR]      = 0x0cc,
@@ -68,6 +97,11 @@ static const int gisb_offsets_bcm7400[] = {
 
 static const int gisb_offsets_bcm7435[] = {
        [ARB_TIMER]             = 0x00c,
+       [ARB_BP_CAP_CLR]        = 0x014,
+       [ARB_BP_CAP_HI_ADDR]    = -1,
+       [ARB_BP_CAP_ADDR]       = 0x158,
+       [ARB_BP_CAP_STATUS]     = 0x160,
+       [ARB_BP_CAP_MASTER]     = 0x164,
        [ARB_ERR_CAP_CLR]       = 0x168,
        [ARB_ERR_CAP_HI_ADDR]   = -1,
        [ARB_ERR_CAP_ADDR]      = 0x16c,
@@ -77,6 +111,11 @@ static const int gisb_offsets_bcm7435[] = {
 
 static const int gisb_offsets_bcm7445[] = {
        [ARB_TIMER]             = 0x008,
+       [ARB_BP_CAP_CLR]        = 0x010,
+       [ARB_BP_CAP_HI_ADDR]    = -1,
+       [ARB_BP_CAP_ADDR]       = 0x1d8,
+       [ARB_BP_CAP_STATUS]     = 0x1e0,
+       [ARB_BP_CAP_MASTER]     = 0x1e4,
        [ARB_ERR_CAP_CLR]       = 0x7e4,
        [ARB_ERR_CAP_HI_ADDR]   = 0x7e8,
        [ARB_ERR_CAP_ADDR]      = 0x7ec,
@@ -125,6 +164,16 @@ static u64 gisb_read_address(struct brcmstb_gisb_arb_device *gdev)
        return value;
 }
 
+static u64 gisb_read_bp_address(struct brcmstb_gisb_arb_device *gdev)
+{
+       u64 value;
+
+       value = gisb_read(gdev, ARB_BP_CAP_ADDR);
+       value |= (u64)gisb_read(gdev, ARB_BP_CAP_HI_ADDR) << 32;
+
+       return value;
+}
+
 static void gisb_write(struct brcmstb_gisb_arb_device *gdev, u32 val, int reg)
 {
        int offset = gdev->gisb_offsets[reg];
@@ -210,8 +259,8 @@ static int brcmstb_gisb_arb_decode_addr(struct brcmstb_gisb_arb_device *gdev,
                m_name = m_fmt;
        }
 
-       pr_crit("%s: %s at 0x%llx [%c %s], core: %s\n",
-               __func__, reason, arb_addr,
+       pr_crit("GISB: %s at 0x%llx [%c %s], core: %s\n",
+               reason, arb_addr,
                cap_status & ARB_ERR_CAP_STATUS_WRITE ? 'W' : 'R',
                cap_status & ARB_ERR_CAP_STATUS_TIMEOUT ? "timeout" : "",
                m_name);
@@ -259,6 +308,41 @@ static irqreturn_t brcmstb_gisb_tea_handler(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
+static irqreturn_t brcmstb_gisb_bp_handler(int irq, void *dev_id)
+{
+       struct brcmstb_gisb_arb_device *gdev = dev_id;
+       const char *m_name;
+       u32 bp_status;
+       u64 arb_addr;
+       u32 master;
+       char m_fmt[11];
+
+       bp_status = gisb_read(gdev, ARB_BP_CAP_STATUS);
+
+       /* Invalid captured address, bail out */
+       if (!(bp_status & ARB_BP_CAP_STATUS_VALID))
+               return IRQ_HANDLED;
+
+       /* Read the address and master */
+       arb_addr = gisb_read_bp_address(gdev);
+       master = gisb_read(gdev, ARB_BP_CAP_MASTER);
+
+       m_name = brcmstb_gisb_master_to_str(gdev, master);
+       if (!m_name) {
+               snprintf(m_fmt, sizeof(m_fmt), "0x%08x", master);
+               m_name = m_fmt;
+       }
+
+       pr_crit("GISB: breakpoint at 0x%llx [%c], core: %s\n",
+               arb_addr, bp_status & ARB_BP_CAP_STATUS_WRITE ? 'W' : 'R',
+               m_name);
+
+       /* clear the GISB error */
+       gisb_write(gdev, ARB_ERR_CAP_CLEAR, ARB_ERR_CAP_CLR);
+
+       return IRQ_HANDLED;
+}
+
 /*
  * Dump out gisb errors on die or panic.
  */
@@ -317,13 +401,14 @@ static int __init brcmstb_gisb_arb_probe(struct platform_device *pdev)
        struct brcmstb_gisb_arb_device *gdev;
        const struct of_device_id *of_id;
        struct resource *r;
-       int err, timeout_irq, tea_irq;
+       int err, timeout_irq, tea_irq, bp_irq;
        unsigned int num_masters, j = 0;
        int i, first, last;
 
        r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        timeout_irq = platform_get_irq(pdev, 0);
        tea_irq = platform_get_irq(pdev, 1);
+       bp_irq = platform_get_irq(pdev, 2);
 
        gdev = devm_kzalloc(&pdev->dev, sizeof(*gdev), GFP_KERNEL);
        if (!gdev)
@@ -356,6 +441,15 @@ static int __init brcmstb_gisb_arb_probe(struct platform_device *pdev)
        if (err < 0)
                return err;
 
+       /* Interrupt is optional */
+       if (bp_irq > 0) {
+               err = devm_request_irq(&pdev->dev, bp_irq,
+                                      brcmstb_gisb_bp_handler, 0, pdev->name,
+                                      gdev);
+               if (err < 0)
+                       return err;
+       }
+
        /* If we do not have a valid mask, assume all masters are enabled */
        if (of_property_read_u32(dn, "brcm,gisb-arb-master-mask",
                                &gdev->valid_mask))
index 2cff5dd..ba9e721 100644 (file)
@@ -1165,6 +1165,17 @@ int mhi_queue_buf(struct mhi_device *mhi_dev, enum dma_data_direction dir,
 }
 EXPORT_SYMBOL_GPL(mhi_queue_buf);
 
+bool mhi_queue_is_full(struct mhi_device *mhi_dev, enum dma_data_direction dir)
+{
+       struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl;
+       struct mhi_chan *mhi_chan = (dir == DMA_TO_DEVICE) ?
+                                       mhi_dev->ul_chan : mhi_dev->dl_chan;
+       struct mhi_ring *tre_ring = &mhi_chan->tre_ring;
+
+       return mhi_is_ring_full(mhi_cntrl, tre_ring);
+}
+EXPORT_SYMBOL_GPL(mhi_queue_is_full);
+
 int mhi_send_cmd(struct mhi_controller *mhi_cntrl,
                 struct mhi_chan *mhi_chan,
                 enum mhi_cmd_type cmd)
index d20ba1b..2a41b21 100644 (file)
@@ -1277,7 +1277,6 @@ void add_interrupt_randomness(int irq, int irq_flags)
 
        fast_mix(fast_pool);
        add_interrupt_bench(cycles);
-       this_cpu_add(net_rand_state.s1, fast_pool->pool[cycles & 3]);
 
        if (unlikely(crng_init == 0)) {
                if ((fast_pool->count >= 64) &&
index 6bb023d..35229e5 100644 (file)
@@ -41,6 +41,11 @@ int tpm_read_log_efi(struct tpm_chip *chip)
        log_size = log_tbl->size;
        memunmap(log_tbl);
 
+       if (!log_size) {
+               pr_warn("UEFI TPM log area empty\n");
+               return -EIO;
+       }
+
        log_tbl = memremap(efi.tpm_log, sizeof(*log_tbl) + log_size,
                           MEMREMAP_WB);
        if (!log_tbl) {
index 0b21496..4ed6e66 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/kernel.h>
+#include <linux/dmi.h>
 #include "tpm.h"
 #include "tpm_tis_core.h"
 
@@ -49,8 +50,8 @@ static inline struct tpm_tis_tcg_phy *to_tpm_tis_tcg_phy(struct tpm_tis_data *da
        return container_of(data, struct tpm_tis_tcg_phy, priv);
 }
 
-static bool interrupts = true;
-module_param(interrupts, bool, 0444);
+static int interrupts = -1;
+module_param(interrupts, int, 0444);
 MODULE_PARM_DESC(interrupts, "Enable interrupts");
 
 static bool itpm;
@@ -63,6 +64,28 @@ module_param(force, bool, 0444);
 MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry");
 #endif
 
+static int tpm_tis_disable_irq(const struct dmi_system_id *d)
+{
+       if (interrupts == -1) {
+               pr_notice("tpm_tis: %s detected: disabling interrupts.\n", d->ident);
+               interrupts = 0;
+       }
+
+       return 0;
+}
+
+static const struct dmi_system_id tpm_tis_dmi_table[] = {
+       {
+               .callback = tpm_tis_disable_irq,
+               .ident = "ThinkPad T490s",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+                       DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T490s"),
+               },
+       },
+       {}
+};
+
 #if defined(CONFIG_PNP) && defined(CONFIG_ACPI)
 static int has_hid(struct acpi_device *dev, const char *hid)
 {
@@ -192,6 +215,8 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info)
        int irq = -1;
        int rc;
 
+       dmi_check_system(tpm_tis_dmi_table);
+
        rc = check_acpi_tpm2(dev);
        if (rc)
                return rc;
index 0a9261a..f83dac5 100644 (file)
@@ -4363,7 +4363,7 @@ struct of_clk_provider {
 
 extern struct of_device_id __clk_of_table;
 static const struct of_device_id __clk_of_table_sentinel
-       __used __section(__clk_of_table_end);
+       __used __section("__clk_of_table_end");
 
 static LIST_HEAD(of_clk_providers);
 static DEFINE_MUTEX(of_clk_mutex);
index a375306..5585ded 100644 (file)
@@ -181,79 +181,6 @@ static void __init _mx27_clocks_init(unsigned long fref)
        imx_print_silicon_rev("i.MX27", mx27_revision());
 }
 
-int __init mx27_clocks_init(unsigned long fref)
-{
-       ccm = ioremap(MX27_CCM_BASE_ADDR, SZ_4K);
-
-       _mx27_clocks_init(fref);
-
-       clk_register_clkdev(clk[IMX27_CLK_UART1_IPG_GATE], "ipg", "imx21-uart.0");
-       clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx21-uart.0");
-       clk_register_clkdev(clk[IMX27_CLK_UART2_IPG_GATE], "ipg", "imx21-uart.1");
-       clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx21-uart.1");
-       clk_register_clkdev(clk[IMX27_CLK_UART3_IPG_GATE], "ipg", "imx21-uart.2");
-       clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx21-uart.2");
-       clk_register_clkdev(clk[IMX27_CLK_UART4_IPG_GATE], "ipg", "imx21-uart.3");
-       clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx21-uart.3");
-       clk_register_clkdev(clk[IMX27_CLK_UART5_IPG_GATE], "ipg", "imx21-uart.4");
-       clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx21-uart.4");
-       clk_register_clkdev(clk[IMX27_CLK_UART6_IPG_GATE], "ipg", "imx21-uart.5");
-       clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx21-uart.5");
-       clk_register_clkdev(clk[IMX27_CLK_GPT1_IPG_GATE], "ipg", "imx-gpt.0");
-       clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx-gpt.0");
-       clk_register_clkdev(clk[IMX27_CLK_PER2_GATE], "per", "imx21-mmc.0");
-       clk_register_clkdev(clk[IMX27_CLK_SDHC1_IPG_GATE], "ipg", "imx21-mmc.0");
-       clk_register_clkdev(clk[IMX27_CLK_PER2_GATE], "per", "imx21-mmc.1");
-       clk_register_clkdev(clk[IMX27_CLK_SDHC2_IPG_GATE], "ipg", "imx21-mmc.1");
-       clk_register_clkdev(clk[IMX27_CLK_PER2_GATE], "per", "imx21-mmc.2");
-       clk_register_clkdev(clk[IMX27_CLK_SDHC2_IPG_GATE], "ipg", "imx21-mmc.2");
-       clk_register_clkdev(clk[IMX27_CLK_PER2_GATE], "per", "imx27-cspi.0");
-       clk_register_clkdev(clk[IMX27_CLK_CSPI1_IPG_GATE], "ipg", "imx27-cspi.0");
-       clk_register_clkdev(clk[IMX27_CLK_PER2_GATE], "per", "imx27-cspi.1");
-       clk_register_clkdev(clk[IMX27_CLK_CSPI2_IPG_GATE], "ipg", "imx27-cspi.1");
-       clk_register_clkdev(clk[IMX27_CLK_PER2_GATE], "per", "imx27-cspi.2");
-       clk_register_clkdev(clk[IMX27_CLK_CSPI3_IPG_GATE], "ipg", "imx27-cspi.2");
-       clk_register_clkdev(clk[IMX27_CLK_PER3_GATE], "per", "imx21-fb.0");
-       clk_register_clkdev(clk[IMX27_CLK_LCDC_IPG_GATE], "ipg", "imx21-fb.0");
-       clk_register_clkdev(clk[IMX27_CLK_LCDC_AHB_GATE], "ahb", "imx21-fb.0");
-       clk_register_clkdev(clk[IMX27_CLK_CSI_AHB_GATE], "ahb", "imx27-camera.0");
-       clk_register_clkdev(clk[IMX27_CLK_PER4_GATE], "per", "imx27-camera.0");
-       clk_register_clkdev(clk[IMX27_CLK_USB_DIV], "per", "imx-udc-mx27");
-       clk_register_clkdev(clk[IMX27_CLK_USB_IPG_GATE], "ipg", "imx-udc-mx27");
-       clk_register_clkdev(clk[IMX27_CLK_USB_AHB_GATE], "ahb", "imx-udc-mx27");
-       clk_register_clkdev(clk[IMX27_CLK_USB_DIV], "per", "mxc-ehci.0");
-       clk_register_clkdev(clk[IMX27_CLK_USB_IPG_GATE], "ipg", "mxc-ehci.0");
-       clk_register_clkdev(clk[IMX27_CLK_USB_AHB_GATE], "ahb", "mxc-ehci.0");
-       clk_register_clkdev(clk[IMX27_CLK_USB_DIV], "per", "mxc-ehci.1");
-       clk_register_clkdev(clk[IMX27_CLK_USB_IPG_GATE], "ipg", "mxc-ehci.1");
-       clk_register_clkdev(clk[IMX27_CLK_USB_AHB_GATE], "ahb", "mxc-ehci.1");
-       clk_register_clkdev(clk[IMX27_CLK_USB_DIV], "per", "mxc-ehci.2");
-       clk_register_clkdev(clk[IMX27_CLK_USB_IPG_GATE], "ipg", "mxc-ehci.2");
-       clk_register_clkdev(clk[IMX27_CLK_USB_AHB_GATE], "ahb", "mxc-ehci.2");
-       clk_register_clkdev(clk[IMX27_CLK_SSI1_IPG_GATE], NULL, "imx-ssi.0");
-       clk_register_clkdev(clk[IMX27_CLK_SSI2_IPG_GATE], NULL, "imx-ssi.1");
-       clk_register_clkdev(clk[IMX27_CLK_NFC_BAUD_GATE], NULL, "imx27-nand.0");
-       clk_register_clkdev(clk[IMX27_CLK_VPU_BAUD_GATE], "per", "coda-imx27.0");
-       clk_register_clkdev(clk[IMX27_CLK_VPU_AHB_GATE], "ahb", "coda-imx27.0");
-       clk_register_clkdev(clk[IMX27_CLK_DMA_AHB_GATE], "ahb", "imx27-dma");
-       clk_register_clkdev(clk[IMX27_CLK_DMA_IPG_GATE], "ipg", "imx27-dma");
-       clk_register_clkdev(clk[IMX27_CLK_FEC_IPG_GATE], "ipg", "imx27-fec.0");
-       clk_register_clkdev(clk[IMX27_CLK_FEC_AHB_GATE], "ahb", "imx27-fec.0");
-       clk_register_clkdev(clk[IMX27_CLK_WDOG_IPG_GATE], NULL, "imx2-wdt.0");
-       clk_register_clkdev(clk[IMX27_CLK_I2C1_IPG_GATE], NULL, "imx21-i2c.0");
-       clk_register_clkdev(clk[IMX27_CLK_I2C2_IPG_GATE], NULL, "imx21-i2c.1");
-       clk_register_clkdev(clk[IMX27_CLK_OWIRE_IPG_GATE], NULL, "mxc_w1.0");
-       clk_register_clkdev(clk[IMX27_CLK_KPP_IPG_GATE], NULL, "imx-keypad");
-       clk_register_clkdev(clk[IMX27_CLK_EMMA_AHB_GATE], "emma-ahb", "imx27-camera.0");
-       clk_register_clkdev(clk[IMX27_CLK_EMMA_IPG_GATE], "emma-ipg", "imx27-camera.0");
-       clk_register_clkdev(clk[IMX27_CLK_EMMA_AHB_GATE], "ahb", "m2m-emmaprp.0");
-       clk_register_clkdev(clk[IMX27_CLK_EMMA_IPG_GATE], "ipg", "m2m-emmaprp.0");
-
-       mxc_timer_init(MX27_GPT1_BASE_ADDR, MX27_INT_GPT1, GPT_TYPE_IMX21);
-
-       return 0;
-}
-
 static void __init mx27_clocks_init_dt(struct device_node *np)
 {
        struct device_node *refnp;
index 4bb05e4..7b13fb5 100644 (file)
@@ -132,77 +132,6 @@ static void __init _mx31_clocks_init(void __iomem *base, unsigned long fref)
        clk_disable_unprepare(clk[iim_gate]);
 }
 
-int __init mx31_clocks_init(unsigned long fref)
-{
-       void __iomem *base;
-
-       base = ioremap(MX31_CCM_BASE_ADDR, SZ_4K);
-       if (!base)
-               panic("%s: failed to map registers\n", __func__);
-
-       _mx31_clocks_init(base, fref);
-
-       clk_register_clkdev(clk[gpt_gate], "per", "imx-gpt.0");
-       clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
-       clk_register_clkdev(clk[cspi1_gate], NULL, "imx31-cspi.0");
-       clk_register_clkdev(clk[cspi2_gate], NULL, "imx31-cspi.1");
-       clk_register_clkdev(clk[cspi3_gate], NULL, "imx31-cspi.2");
-       clk_register_clkdev(clk[pwm_gate], "pwm", NULL);
-       clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0");
-       clk_register_clkdev(clk[ckil], "ref", "imx21-rtc");
-       clk_register_clkdev(clk[rtc_gate], "ipg", "imx21-rtc");
-       clk_register_clkdev(clk[epit1_gate], "epit", NULL);
-       clk_register_clkdev(clk[epit2_gate], "epit", NULL);
-       clk_register_clkdev(clk[nfc], NULL, "imx27-nand.0");
-       clk_register_clkdev(clk[ipu_gate], NULL, "ipu-core");
-       clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb");
-       clk_register_clkdev(clk[kpp_gate], NULL, "imx-keypad");
-       clk_register_clkdev(clk[usb_div_post], "per", "mxc-ehci.0");
-       clk_register_clkdev(clk[usb_gate], "ahb", "mxc-ehci.0");
-       clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.0");
-       clk_register_clkdev(clk[usb_div_post], "per", "mxc-ehci.1");
-       clk_register_clkdev(clk[usb_gate], "ahb", "mxc-ehci.1");
-       clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.1");
-       clk_register_clkdev(clk[usb_div_post], "per", "mxc-ehci.2");
-       clk_register_clkdev(clk[usb_gate], "ahb", "mxc-ehci.2");
-       clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2");
-       clk_register_clkdev(clk[usb_div_post], "per", "imx-udc-mx27");
-       clk_register_clkdev(clk[usb_gate], "ahb", "imx-udc-mx27");
-       clk_register_clkdev(clk[ipg], "ipg", "imx-udc-mx27");
-       clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0");
-       /* i.mx31 has the i.mx21 type uart */
-       clk_register_clkdev(clk[uart1_gate], "per", "imx21-uart.0");
-       clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.0");
-       clk_register_clkdev(clk[uart2_gate], "per", "imx21-uart.1");
-       clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.1");
-       clk_register_clkdev(clk[uart3_gate], "per", "imx21-uart.2");
-       clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.2");
-       clk_register_clkdev(clk[uart4_gate], "per", "imx21-uart.3");
-       clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.3");
-       clk_register_clkdev(clk[uart5_gate], "per", "imx21-uart.4");
-       clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.4");
-       clk_register_clkdev(clk[i2c1_gate], NULL, "imx21-i2c.0");
-       clk_register_clkdev(clk[i2c2_gate], NULL, "imx21-i2c.1");
-       clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
-       clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1.0");
-       clk_register_clkdev(clk[sdhc1_gate], NULL, "imx31-mmc.0");
-       clk_register_clkdev(clk[sdhc2_gate], NULL, "imx31-mmc.1");
-       clk_register_clkdev(clk[ssi1_gate], NULL, "imx-ssi.0");
-       clk_register_clkdev(clk[ssi2_gate], NULL, "imx-ssi.1");
-       clk_register_clkdev(clk[firi_gate], "firi", NULL);
-       clk_register_clkdev(clk[ata_gate], NULL, "pata_imx");
-       clk_register_clkdev(clk[rtic_gate], "rtic", NULL);
-       clk_register_clkdev(clk[rng_gate], NULL, "mxc_rnga");
-       clk_register_clkdev(clk[sdma_gate], NULL, "imx31-sdma");
-       clk_register_clkdev(clk[iim_gate], "iim", NULL);
-
-
-       imx_register_uart_clocks(uart_clks);
-       mxc_timer_init(MX31_GPT1_BASE_ADDR, MX31_INT_GPT, GPT_TYPE_IMX31);
-
-       return 0;
-}
-
 static void __init mx31_clocks_init_dt(struct device_node *np)
 {
        struct device_node *osc_np;
index e595f55..c1df036 100644 (file)
@@ -248,74 +248,6 @@ static void __init _mx35_clocks_init(void)
        imx_print_silicon_rev("i.MX35", mx35_revision());
 }
 
-int __init mx35_clocks_init(void)
-{
-       _mx35_clocks_init();
-
-       clk_register_clkdev(clk[pata_gate], NULL, "pata_imx");
-       clk_register_clkdev(clk[can1_gate], NULL, "flexcan.0");
-       clk_register_clkdev(clk[can2_gate], NULL, "flexcan.1");
-       clk_register_clkdev(clk[cspi1_gate], "per", "imx35-cspi.0");
-       clk_register_clkdev(clk[cspi1_gate], "ipg", "imx35-cspi.0");
-       clk_register_clkdev(clk[cspi2_gate], "per", "imx35-cspi.1");
-       clk_register_clkdev(clk[cspi2_gate], "ipg", "imx35-cspi.1");
-       clk_register_clkdev(clk[epit1_gate], NULL, "imx-epit.0");
-       clk_register_clkdev(clk[epit2_gate], NULL, "imx-epit.1");
-       clk_register_clkdev(clk[esdhc1_gate], "per", "sdhci-esdhc-imx35.0");
-       clk_register_clkdev(clk[ipg], "ipg", "sdhci-esdhc-imx35.0");
-       clk_register_clkdev(clk[ahb], "ahb", "sdhci-esdhc-imx35.0");
-       clk_register_clkdev(clk[esdhc2_gate], "per", "sdhci-esdhc-imx35.1");
-       clk_register_clkdev(clk[ipg], "ipg", "sdhci-esdhc-imx35.1");
-       clk_register_clkdev(clk[ahb], "ahb", "sdhci-esdhc-imx35.1");
-       clk_register_clkdev(clk[esdhc3_gate], "per", "sdhci-esdhc-imx35.2");
-       clk_register_clkdev(clk[ipg], "ipg", "sdhci-esdhc-imx35.2");
-       clk_register_clkdev(clk[ahb], "ahb", "sdhci-esdhc-imx35.2");
-       /* i.mx35 has the i.mx27 type fec */
-       clk_register_clkdev(clk[fec_gate], NULL, "imx27-fec.0");
-       clk_register_clkdev(clk[gpt_gate], "per", "imx-gpt.0");
-       clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
-       clk_register_clkdev(clk[i2c1_gate], NULL, "imx21-i2c.0");
-       clk_register_clkdev(clk[i2c2_gate], NULL, "imx21-i2c.1");
-       clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
-       clk_register_clkdev(clk[ipu_gate], NULL, "ipu-core");
-       clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb");
-       clk_register_clkdev(clk[kpp_gate], NULL, "imx-keypad");
-       clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1");
-       clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma");
-       clk_register_clkdev(clk[ssi1_gate], NULL, "imx-ssi.0");
-       clk_register_clkdev(clk[ssi2_gate], NULL, "imx-ssi.1");
-       /* i.mx35 has the i.mx21 type uart */
-       clk_register_clkdev(clk[uart1_gate], "per", "imx21-uart.0");
-       clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.0");
-       clk_register_clkdev(clk[uart2_gate], "per", "imx21-uart.1");
-       clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.1");
-       clk_register_clkdev(clk[uart3_gate], "per", "imx21-uart.2");
-       clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.2");
-       /* i.mx35 has the i.mx21 type rtc */
-       clk_register_clkdev(clk[ckil], "ref", "imx21-rtc");
-       clk_register_clkdev(clk[rtc_gate], "ipg", "imx21-rtc");
-       clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.0");
-       clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.0");
-       clk_register_clkdev(clk[usbotg_gate], "ahb", "mxc-ehci.0");
-       clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.1");
-       clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.1");
-       clk_register_clkdev(clk[usbotg_gate], "ahb", "mxc-ehci.1");
-       clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.2");
-       clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2");
-       clk_register_clkdev(clk[usbotg_gate], "ahb", "mxc-ehci.2");
-       clk_register_clkdev(clk[usb_div], "per", "imx-udc-mx27");
-       clk_register_clkdev(clk[ipg], "ipg", "imx-udc-mx27");
-       clk_register_clkdev(clk[usbotg_gate], "ahb", "imx-udc-mx27");
-       clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0");
-       clk_register_clkdev(clk[nfc_div], NULL, "imx25-nand.0");
-       clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0");
-       clk_register_clkdev(clk[admux_gate], "audmux", NULL);
-
-       mxc_timer_init(MX35_GPT1_BASE_ADDR, MX35_INT_GPT, GPT_TYPE_IMX31);
-
-       return 0;
-}
-
 static void __init mx35_clocks_init_dt(struct device_node *ccm_node)
 {
        _mx35_clocks_init();
index 7dad909..f5e0a6b 100644 (file)
 #include <linux/clk-provider.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
+#include <linux/platform_data/clk-s3c2410.h>
 #include <linux/module.h>
 #include "clk.h"
 
-/* legacy access to misccr, until dt conversion is finished */
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-
 #define MUX_DCLK0      0
 #define MUX_DCLK1      1
 #define DIV_DCLK0      2
@@ -52,6 +49,7 @@ struct s3c24xx_clkout {
        struct clk_hw           hw;
        u32                     mask;
        u8                      shift;
+       unsigned int (*modify_misccr)(unsigned int clr, unsigned int chg);
 };
 
 #define to_s3c24xx_clkout(_hw) container_of(_hw, struct s3c24xx_clkout, hw)
@@ -62,7 +60,7 @@ static u8 s3c24xx_clkout_get_parent(struct clk_hw *hw)
        int num_parents = clk_hw_get_num_parents(hw);
        u32 val;
 
-       val = readl_relaxed(S3C24XX_MISCCR) >> clkout->shift;
+       val = clkout->modify_misccr(0, 0) >> clkout->shift;
        val >>= clkout->shift;
        val &= clkout->mask;
 
@@ -76,7 +74,7 @@ static int s3c24xx_clkout_set_parent(struct clk_hw *hw, u8 index)
 {
        struct s3c24xx_clkout *clkout = to_s3c24xx_clkout(hw);
 
-       s3c2410_modify_misccr((clkout->mask << clkout->shift),
+       clkout->modify_misccr((clkout->mask << clkout->shift),
                              (index << clkout->shift));
 
        return 0;
@@ -92,10 +90,14 @@ static struct clk_hw *s3c24xx_register_clkout(struct device *dev,
                const char *name, const char **parent_names, u8 num_parents,
                u8 shift, u32 mask)
 {
+       struct s3c2410_clk_platform_data *pdata = dev_get_platdata(dev);
        struct s3c24xx_clkout *clkout;
        struct clk_init_data init;
        int ret;
 
+       if (!pdata)
+               return ERR_PTR(-EINVAL);
+
        /* allocate the clkout */
        clkout = kzalloc(sizeof(*clkout), GFP_KERNEL);
        if (!clkout)
@@ -110,6 +112,7 @@ static struct clk_hw *s3c24xx_register_clkout(struct device *dev,
        clkout->shift = shift;
        clkout->mask = mask;
        clkout->hw.init = &init;
+       clkout->modify_misccr = pdata->modify_misccr;
 
        ret = clk_hw_register(dev, &clkout->hw);
        if (ret)
index fcf6764..5831d06 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/clk/samsung.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 
index a95ab5f..724ef64 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/clk/samsung.h>
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
index c7aba1e..a827d63 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/clk/samsung.h>
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
index b96d33e..56f95b6 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/slab.h>
 #include <linux/clk-provider.h>
+#include <linux/clk/samsung.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 
index ee9574d..b7860bc 100644 (file)
@@ -11,7 +11,7 @@
 extern struct of_device_id __timer_of_table[];
 
 static const struct of_device_id __timer_of_table_sentinel
-       __used __section(__timer_of_table_end);
+       __used __section("__timer_of_table_end");
 
 void __init timer_probe(void)
 {
index 2c7171e..85de313 100644 (file)
@@ -71,6 +71,7 @@ config CPU_FREQ_DEFAULT_GOV_USERSPACE
 
 config CPU_FREQ_DEFAULT_GOV_ONDEMAND
        bool "ondemand"
+       depends on !(X86_INTEL_PSTATE && SMP)
        select CPU_FREQ_GOV_ONDEMAND
        select CPU_FREQ_GOV_PERFORMANCE
        help
@@ -83,6 +84,7 @@ config CPU_FREQ_DEFAULT_GOV_ONDEMAND
 
 config CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
        bool "conservative"
+       depends on !(X86_INTEL_PSTATE && SMP)
        select CPU_FREQ_GOV_CONSERVATIVE
        select CPU_FREQ_GOV_PERFORMANCE
        help
index bf5830e..015ec0c 100644 (file)
@@ -196,7 +196,6 @@ config ARM_S3C24XX_CPUFREQ_DEBUGFS
 config ARM_S3C2410_CPUFREQ
        bool
        depends on ARM_S3C24XX_CPUFREQ && CPU_S3C2410
-       select S3C2410_CPUFREQ_UTILS
        help
          CPU Frequency scaling support for S3C2410
 
@@ -233,7 +232,6 @@ config ARM_S3C2416_CPUFREQ_VCORESCALE
 config ARM_S3C2440_CPUFREQ
        bool "S3C2440/S3C2442 CPU Frequency scaling support"
        depends on ARM_S3C24XX_CPUFREQ && (CPU_S3C2440 || CPU_S3C2442)
-       select S3C2410_CPUFREQ_UTILS
        default y
        help
          CPU Frequency scaling support for S3C2440 and S3C2442 SoC CPUs.
index e4ff681..1e4fbb0 100644 (file)
@@ -691,7 +691,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
                cpumask_copy(policy->cpus, topology_core_cpumask(cpu));
        }
 
-       if (check_amd_hwpstate_cpu(cpu) && !acpi_pstate_strict) {
+       if (check_amd_hwpstate_cpu(cpu) && boot_cpu_data.x86 < 0x19 &&
+           !acpi_pstate_strict) {
                cpumask_clear(policy->cpus);
                cpumask_set_cpu(cpu, policy->cpus);
                cpumask_copy(data->freqdomain_cpus,
index 1877f5e..1e7e3f2 100644 (file)
@@ -1454,14 +1454,13 @@ static int cpufreq_online(unsigned int cpu)
         */
        if ((cpufreq_driver->flags & CPUFREQ_NEED_INITIAL_FREQ_CHECK)
            && has_target()) {
+               unsigned int old_freq = policy->cur;
+
                /* Are we running at unknown frequency ? */
-               ret = cpufreq_frequency_table_get_index(policy, policy->cur);
+               ret = cpufreq_frequency_table_get_index(policy, old_freq);
                if (ret == -EINVAL) {
-                       /* Warn user and fix it */
-                       pr_warn("%s: CPU%d: Running at unlisted freq: %u KHz\n",
-                               __func__, policy->cpu, policy->cur);
-                       ret = __cpufreq_driver_target(policy, policy->cur - 1,
-                               CPUFREQ_RELATION_L);
+                       ret = __cpufreq_driver_target(policy, old_freq - 1,
+                                                     CPUFREQ_RELATION_L);
 
                        /*
                         * Reaching here after boot in a few seconds may not
@@ -1469,8 +1468,8 @@ static int cpufreq_online(unsigned int cpu)
                         * frequency for longer duration. Hence, a BUG_ON().
                         */
                        BUG_ON(ret);
-                       pr_warn("%s: CPU%d: Unlisted initial frequency changed to: %u KHz\n",
-                               __func__, policy->cpu, policy->cur);
+                       pr_info("%s: CPU%d: Running at unlisted initial frequency: %u KHz, changing to: %u KHz\n",
+                               __func__, policy->cpu, old_freq, policy->cur);
                }
        }
 
@@ -1909,6 +1908,18 @@ void cpufreq_resume(void)
 }
 
 /**
+ * cpufreq_driver_test_flags - Test cpufreq driver's flags against given ones.
+ * @flags: Flags to test against the current cpufreq driver's flags.
+ *
+ * Assumes that the driver is there, so callers must ensure that this is the
+ * case.
+ */
+bool cpufreq_driver_test_flags(u16 flags)
+{
+       return !!(cpufreq_driver->flags & flags);
+}
+
+/**
  *     cpufreq_get_current_driver - return current driver's name
  *
  *     Return the name string of the currently loaded cpufreq driver
@@ -2188,7 +2199,8 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
         * exactly same freq is called again and so we can save on few function
         * calls.
         */
-       if (target_freq == policy->cur)
+       if (target_freq == policy->cur &&
+           !(cpufreq_driver->flags & CPUFREQ_NEED_UPDATE_LIMITS))
                return 0;
 
        /* Save last value to restore later on errors */
@@ -2242,7 +2254,7 @@ static int cpufreq_init_governor(struct cpufreq_policy *policy)
                return -EINVAL;
 
        /* Platform doesn't want dynamic frequency switching ? */
-       if (policy->governor->dynamic_switching &&
+       if (policy->governor->flags & CPUFREQ_GOV_DYNAMIC_SWITCHING &&
            cpufreq_driver->flags & CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING) {
                struct cpufreq_governor *gov = cpufreq_fallback_governor();
 
@@ -2268,6 +2280,8 @@ static int cpufreq_init_governor(struct cpufreq_policy *policy)
                }
        }
 
+       policy->strict_target = !!(policy->governor->flags & CPUFREQ_GOV_STRICT_TARGET);
+
        return 0;
 }
 
index c56773c..bab8e61 100644 (file)
@@ -156,7 +156,7 @@ void cpufreq_dbs_governor_limits(struct cpufreq_policy *policy);
 #define CPUFREQ_DBS_GOVERNOR_INITIALIZER(_name_)                       \
        {                                                               \
                .name = _name_,                                         \
-               .dynamic_switching = true,                              \
+               .flags = CPUFREQ_GOV_DYNAMIC_SWITCHING,                 \
                .owner = THIS_MODULE,                                   \
                .init = cpufreq_dbs_governor_init,                      \
                .exit = cpufreq_dbs_governor_exit,                      \
index 71c1d9a..addd93f 100644 (file)
@@ -20,6 +20,7 @@ static void cpufreq_gov_performance_limits(struct cpufreq_policy *policy)
 static struct cpufreq_governor cpufreq_gov_performance = {
        .name           = "performance",
        .owner          = THIS_MODULE,
+       .flags          = CPUFREQ_GOV_STRICT_TARGET,
        .limits         = cpufreq_gov_performance_limits,
 };
 
index 7749522..8d830d8 100644 (file)
@@ -21,6 +21,7 @@ static struct cpufreq_governor cpufreq_gov_powersave = {
        .name           = "powersave",
        .limits         = cpufreq_gov_powersave_limits,
        .owner          = THIS_MODULE,
+       .flags          = CPUFREQ_GOV_STRICT_TARGET,
 };
 
 MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
index 776a58b..ab93bce 100644 (file)
@@ -223,7 +223,6 @@ static int eps_cpu_init(struct cpufreq_policy *policy)
        case EPS_BRAND_C3:
                pr_cont("C3\n");
                return -ENODEV;
-               break;
        }
        /* Enable Enhanced PowerSaver */
        rdmsrl(MSR_IA32_MISC_ENABLE, val);
index 9a515c4..36a3ccf 100644 (file)
@@ -1420,6 +1420,24 @@ static void __init intel_pstate_sysfs_expose_params(void)
        }
 }
 
+static void __init intel_pstate_sysfs_remove(void)
+{
+       if (!intel_pstate_kobject)
+               return;
+
+       sysfs_remove_group(intel_pstate_kobject, &intel_pstate_attr_group);
+
+       if (!per_cpu_limits) {
+               sysfs_remove_file(intel_pstate_kobject, &max_perf_pct.attr);
+               sysfs_remove_file(intel_pstate_kobject, &min_perf_pct.attr);
+
+               if (x86_match_cpu(intel_pstate_cpu_ee_disable_ids))
+                       sysfs_remove_file(intel_pstate_kobject, &energy_efficiency.attr);
+       }
+
+       kobject_put(intel_pstate_kobject);
+}
+
 static void intel_pstate_sysfs_expose_hwp_dynamic_boost(void)
 {
        int rc;
@@ -2509,7 +2527,7 @@ static void intel_cpufreq_trace(struct cpudata *cpu, unsigned int trace_type, in
 }
 
 static void intel_cpufreq_adjust_hwp(struct cpudata *cpu, u32 target_pstate,
-                                    bool fast_switch)
+                                    bool strict, bool fast_switch)
 {
        u64 prev = READ_ONCE(cpu->hwp_req_cached), value = prev;
 
@@ -2521,7 +2539,7 @@ static void intel_cpufreq_adjust_hwp(struct cpudata *cpu, u32 target_pstate,
         * field in it, so opportunistically update the max too if needed.
         */
        value &= ~HWP_MAX_PERF(~0L);
-       value |= HWP_MAX_PERF(cpu->max_perf_ratio);
+       value |= HWP_MAX_PERF(strict ? target_pstate : cpu->max_perf_ratio);
 
        if (value == prev)
                return;
@@ -2544,20 +2562,20 @@ static void intel_cpufreq_adjust_perf_ctl(struct cpudata *cpu,
                              pstate_funcs.get_val(cpu, target_pstate));
 }
 
-static int intel_cpufreq_update_pstate(struct cpudata *cpu, int target_pstate,
-                                      bool fast_switch)
+static int intel_cpufreq_update_pstate(struct cpufreq_policy *policy,
+                                      int target_pstate, bool fast_switch)
 {
+       struct cpudata *cpu = all_cpu_data[policy->cpu];
        int old_pstate = cpu->pstate.current_pstate;
 
        target_pstate = intel_pstate_prepare_request(cpu, target_pstate);
-       if (target_pstate != old_pstate) {
+       if (hwp_active) {
+               intel_cpufreq_adjust_hwp(cpu, target_pstate,
+                                        policy->strict_target, fast_switch);
+               cpu->pstate.current_pstate = target_pstate;
+       } else if (target_pstate != old_pstate) {
+               intel_cpufreq_adjust_perf_ctl(cpu, target_pstate, fast_switch);
                cpu->pstate.current_pstate = target_pstate;
-               if (hwp_active)
-                       intel_cpufreq_adjust_hwp(cpu, target_pstate,
-                                                fast_switch);
-               else
-                       intel_cpufreq_adjust_perf_ctl(cpu, target_pstate,
-                                                     fast_switch);
        }
 
        intel_cpufreq_trace(cpu, fast_switch ? INTEL_PSTATE_TRACE_FAST_SWITCH :
@@ -2593,7 +2611,7 @@ static int intel_cpufreq_target(struct cpufreq_policy *policy,
                break;
        }
 
-       target_pstate = intel_cpufreq_update_pstate(cpu, target_pstate, false);
+       target_pstate = intel_cpufreq_update_pstate(policy, target_pstate, false);
 
        freqs.new = target_pstate * cpu->pstate.scaling;
 
@@ -2612,7 +2630,7 @@ static unsigned int intel_cpufreq_fast_switch(struct cpufreq_policy *policy,
 
        target_pstate = DIV_ROUND_UP(target_freq, cpu->pstate.scaling);
 
-       target_pstate = intel_cpufreq_update_pstate(cpu, target_pstate, true);
+       target_pstate = intel_cpufreq_update_pstate(policy, target_pstate, true);
 
        return target_pstate * cpu->pstate.scaling;
 }
@@ -3014,6 +3032,7 @@ static int __init intel_pstate_init(void)
                        hwp_mode_bdw = id->driver_data;
                        intel_pstate.attr = hwp_cpufreq_attrs;
                        intel_cpufreq.attr = hwp_cpufreq_attrs;
+                       intel_cpufreq.flags |= CPUFREQ_NEED_UPDATE_LIMITS;
                        if (!default_driver)
                                default_driver = &intel_pstate;
 
@@ -3063,8 +3082,10 @@ hwp_cpu_matched:
        mutex_lock(&intel_pstate_driver_lock);
        rc = intel_pstate_register_driver(default_driver);
        mutex_unlock(&intel_pstate_driver_lock);
-       if (rc)
+       if (rc) {
+               intel_pstate_sysfs_remove();
                return rc;
+       }
 
        if (hwp_active) {
                const struct x86_cpu_id *id;
index 123fb00..182a4db 100644 (file)
@@ -593,7 +593,6 @@ static void longhaul_setup_voltagescaling(void)
                break;
        default:
                return;
-               break;
        }
        if (min_vid_speed >= highest_speed)
                return;
index 0c4f2cc..5dcfbf0 100644 (file)
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/regs-clock.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
+#define S3C2410_CLKDIVN_PDIVN       (1<<0)
+#define S3C2410_CLKDIVN_HDIVN       (1<<1)
 
 /* Note, 2410A has an extra mode for 1:4:4 ratio, bit 2 of CLKDIV */
 
@@ -37,7 +37,7 @@ static void s3c2410_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
        if (cfg->divs.p_divisor != cfg->divs.h_divisor)
                clkdiv |= S3C2410_CLKDIVN_PDIVN;
 
-       __raw_writel(clkdiv, S3C2410_CLKDIVN);
+       s3c24xx_write_clkdivn(clkdiv);
 }
 
 static int s3c2410_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
index 53385a9..5945945 100644 (file)
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/regs-clock.h>
-#include <mach/s3c2412.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
+#define S3C2412_CLKDIVN_PDIVN          (1<<2)
+#define S3C2412_CLKDIVN_HDIVN_MASK     (3<<0)
+#define S3C2412_CLKDIVN_ARMDIVN                (1<<3)
+#define S3C2412_CLKDIVN_DVSEN          (1<<4)
+#define S3C2412_CLKDIVN_HALFHCLK       (1<<5)
+#define S3C2412_CLKDIVN_USB48DIV       (1<<6)
+#define S3C2412_CLKDIVN_UARTDIV_MASK   (15<<8)
+#define S3C2412_CLKDIVN_UARTDIV_SHIFT  (8)
+#define S3C2412_CLKDIVN_I2SDIV_MASK    (15<<12)
+#define S3C2412_CLKDIVN_I2SDIV_SHIFT   (12)
+#define S3C2412_CLKDIVN_CAMDIV_MASK    (15<<16)
+#define S3C2412_CLKDIVN_CAMDIV_SHIFT   (16)
 
 /* our clock resources. */
 static struct clk *xtal;
@@ -117,7 +126,7 @@ static void s3c2412_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
        unsigned long clkdiv;
        unsigned long olddiv;
 
-       olddiv = clkdiv = __raw_readl(S3C2410_CLKDIVN);
+       olddiv = clkdiv = s3c24xx_read_clkdivn();
 
        /* clear off current clock info */
 
@@ -134,32 +143,11 @@ static void s3c2412_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
                clkdiv |= S3C2412_CLKDIVN_PDIVN;
 
        s3c_freq_dbg("%s: div %08lx => %08lx\n", __func__, olddiv, clkdiv);
-       __raw_writel(clkdiv, S3C2410_CLKDIVN);
+       s3c24xx_write_clkdivn(clkdiv);
 
        clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk);
 }
 
-static void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
-{
-       struct s3c_cpufreq_board *board = cfg->board;
-       unsigned long refresh;
-
-       s3c_freq_dbg("%s: refresh %u ns, hclk %lu\n", __func__,
-                    board->refresh, cfg->freq.hclk);
-
-       /* Reduce both the refresh time (in ns) and the frequency (in MHz)
-        * by 10 each to ensure that we do not overflow 32 bit numbers. This
-        * should work for HCLK up to 133MHz and refresh period up to 30usec.
-        */
-
-       refresh = (board->refresh / 10);
-       refresh *= (cfg->freq.hclk / 100);
-       refresh /= (1 * 1000 * 1000);   /* 10^6 */
-
-       s3c_freq_dbg("%s: setting refresh 0x%08lx\n", __func__, refresh);
-       __raw_writel(refresh, S3C2412_REFRESH);
-}
-
 /* set the default cpu frequency information, based on an 200MHz part
  * as we have no other way of detecting the speed rating in software.
  */
index 3f772ba..148e8ae 100644 (file)
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/regs-clock.h>
+#define S3C2440_CLKDIVN_PDIVN       (1<<0)
+#define S3C2440_CLKDIVN_HDIVN_MASK   (3<<1)
+#define S3C2440_CLKDIVN_HDIVN_1      (0<<1)
+#define S3C2440_CLKDIVN_HDIVN_2      (1<<1)
+#define S3C2440_CLKDIVN_HDIVN_4_8    (2<<1)
+#define S3C2440_CLKDIVN_HDIVN_3_6    (3<<1)
+#define S3C2440_CLKDIVN_UCLK         (1<<3)
 
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
+#define S3C2440_CAMDIVN_CAMCLK_MASK  (0xf<<0)
+#define S3C2440_CAMDIVN_CAMCLK_SEL   (1<<4)
+#define S3C2440_CAMDIVN_HCLK3_HALF   (1<<8)
+#define S3C2440_CAMDIVN_HCLK4_HALF   (1<<9)
+#define S3C2440_CAMDIVN_DVSEN        (1<<12)
+
+#define S3C2442_CAMDIVN_CAMCLK_DIV3  (1<<5)
 
 static struct clk *xtal;
 static struct clk *fclk;
@@ -143,8 +156,8 @@ static void s3c2440_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
        s3c_freq_dbg("%s: divisors: h=%d, p=%d\n", __func__,
                     cfg->divs.h_divisor, cfg->divs.p_divisor);
 
-       clkdiv = __raw_readl(S3C2410_CLKDIVN);
-       camdiv = __raw_readl(S3C2440_CAMDIVN);
+       clkdiv = s3c24xx_read_clkdivn();
+       camdiv = s3c2440_read_camdivn();
 
        clkdiv &= ~(S3C2440_CLKDIVN_HDIVN_MASK | S3C2440_CLKDIVN_PDIVN);
        camdiv &= ~CAMDIVN_HCLK_HALF;
@@ -184,11 +197,11 @@ static void s3c2440_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
         * then make a short delay and remove the hclk halving if necessary.
         */
 
-       __raw_writel(camdiv | CAMDIVN_HCLK_HALF, S3C2440_CAMDIVN);
-       __raw_writel(clkdiv, S3C2410_CLKDIVN);
+       s3c2440_write_camdivn(camdiv | CAMDIVN_HCLK_HALF);
+       s3c24xx_write_clkdivn(clkdiv);
 
        ndelay(20);
-       __raw_writel(camdiv, S3C2440_CAMDIVN);
+       s3c2440_write_camdivn(camdiv);
 
        clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk);
 }
index 290e353..93971df 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/seq_file.h>
 #include <linux/err.h>
 
-#include <plat/cpu-freq-core.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
 
 static struct dentry *dbgfs_root;
 static struct dentry *dbgfs_file_io;
index ed0e713..37efc0d 100644 (file)
 #include <linux/device.h>
 #include <linux/sysfs.h>
 #include <linux/slab.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
-
-#include <mach/regs-clock.h>
-
 /* note, cpufreq support deals in kHz, no Hz */
-
 static struct cpufreq_driver s3c24xx_driver;
 static struct s3c_cpufreq_config cpu_cur;
 static struct s3c_iotimings s3c24xx_iotiming;
@@ -68,7 +64,7 @@ static void s3c_cpufreq_getcur(struct s3c_cpufreq_config *cfg)
        cfg->freq.pclk = pclk = clk_get_rate(clk_pclk);
        cfg->freq.armclk = armclk = clk_get_rate(clk_arm);
 
-       cfg->pll.driver_data = __raw_readl(S3C2410_MPLLCON);
+       cfg->pll.driver_data = s3c24xx_read_mpllcon();
        cfg->pll.frequency = fclk;
 
        cfg->freq.hclk_tns = 1000000000 / (cfg->freq.hclk / 10);
@@ -386,7 +382,7 @@ static unsigned int suspend_freq;
 static int s3c_cpufreq_suspend(struct cpufreq_policy *policy)
 {
        suspend_pll.frequency = clk_get_rate(_clk_mpll);
-       suspend_pll.driver_data = __raw_readl(S3C2410_MPLLCON);
+       suspend_pll.driver_data = s3c24xx_read_mpllcon();
        suspend_freq = clk_get_rate(clk_arm);
 
        return 0;
@@ -547,7 +543,7 @@ static void s3c_cpufreq_update_loctkime(void)
        val |= calc_locktime(rate, cpu_cur.info->locktime_m);
 
        pr_info("%s: new locktime is 0x%08x\n", __func__, val);
-       __raw_writel(val, S3C2410_LOCKTIME);
+       s3c24xx_write_locktime(val);
 }
 
 static int s3c_cpufreq_build_freq(void)
index 6dd1311..e855e86 100644 (file)
@@ -29,7 +29,7 @@ static const struct scmi_handle *handle;
 static unsigned int scmi_cpufreq_get_rate(unsigned int cpu)
 {
        struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu);
-       struct scmi_perf_ops *perf_ops = handle->perf_ops;
+       const struct scmi_perf_ops *perf_ops = handle->perf_ops;
        struct scmi_data *priv = policy->driver_data;
        unsigned long rate;
        int ret;
@@ -49,7 +49,7 @@ static int
 scmi_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index)
 {
        struct scmi_data *priv = policy->driver_data;
-       struct scmi_perf_ops *perf_ops = handle->perf_ops;
+       const struct scmi_perf_ops *perf_ops = handle->perf_ops;
        u64 freq = policy->freq_table[index].frequency;
 
        return perf_ops->freq_set(handle, priv->domain_id, freq * 1000, false);
@@ -59,7 +59,7 @@ static unsigned int scmi_cpufreq_fast_switch(struct cpufreq_policy *policy,
                                             unsigned int target_freq)
 {
        struct scmi_data *priv = policy->driver_data;
-       struct scmi_perf_ops *perf_ops = handle->perf_ops;
+       const struct scmi_perf_ops *perf_ops = handle->perf_ops;
 
        if (!perf_ops->freq_set(handle, priv->domain_id,
                                target_freq * 1000, true))
index a13a2d1..0b66df4 100644 (file)
@@ -240,7 +240,7 @@ unsigned int speedstep_get_frequency(enum speedstep_processor processor)
                return pentium3_get_frequency(processor);
        default:
                return 0;
-       };
+       }
        return 0;
 }
 EXPORT_SYMBOL_GPL(speedstep_get_frequency);
index fa2f1b4..a94bf28 100644 (file)
@@ -7,7 +7,7 @@
  *
  * This file add support for MD5 and SHA1/SHA224/SHA256/SHA384/SHA512.
  *
- * You could find the datasheet in Documentation/arm/sunxi/README
+ * You could find the datasheet in Documentation/arm/sunxi.rst
  */
 #include <linux/dma-mapping.h>
 #include <linux/pm_runtime.h>
index 7850300..cfde9ee 100644 (file)
@@ -7,7 +7,7 @@
  *
  * This file handle the PRNG
  *
- * You could find a link for the datasheet in Documentation/arm/sunxi/README
+ * You could find a link for the datasheet in Documentation/arm/sunxi.rst
  */
 #include "sun8i-ce.h"
 #include <linux/dma-mapping.h>
index 6543281..5b7af44 100644 (file)
@@ -7,7 +7,7 @@
  *
  * This file handle the TRNG
  *
- * You could find a link for the datasheet in Documentation/arm/sunxi/README
+ * You could find a link for the datasheet in Documentation/arm/sunxi.rst
  */
 #include "sun8i-ce.h"
 #include <linux/dma-mapping.h>
index ec53528..8163f5d 100644 (file)
@@ -545,14 +545,10 @@ static void cgr_cb(struct qman_portal *qm, struct qman_cgr *cgr, int congested)
        }
 }
 
-static int caam_qi_napi_schedule(struct qman_portal *p, struct caam_napi *np)
+static int caam_qi_napi_schedule(struct qman_portal *p, struct caam_napi *np,
+                                bool sched_napi)
 {
-       /*
-        * In case of threaded ISR, for RT kernels in_irq() does not return
-        * appropriate value, so use in_serving_softirq to distinguish between
-        * softirq and irq contexts.
-        */
-       if (unlikely(in_irq() || !in_serving_softirq())) {
+       if (sched_napi) {
                /* Disable QMan IRQ source and invoke NAPI */
                qman_p_irqsource_remove(p, QM_PIRQ_DQRI);
                np->p = p;
@@ -564,7 +560,8 @@ static int caam_qi_napi_schedule(struct qman_portal *p, struct caam_napi *np)
 
 static enum qman_cb_dqrr_result caam_rsp_fq_dqrr_cb(struct qman_portal *p,
                                                    struct qman_fq *rsp_fq,
-                                                   const struct qm_dqrr_entry *dqrr)
+                                                   const struct qm_dqrr_entry *dqrr,
+                                                   bool sched_napi)
 {
        struct caam_napi *caam_napi = raw_cpu_ptr(&pcpu_qipriv.caam_napi);
        struct caam_drv_req *drv_req;
@@ -573,7 +570,7 @@ static enum qman_cb_dqrr_result caam_rsp_fq_dqrr_cb(struct qman_portal *p,
        struct caam_drv_private *priv = dev_get_drvdata(qidev);
        u32 status;
 
-       if (caam_qi_napi_schedule(p, caam_napi))
+       if (caam_qi_napi_schedule(p, caam_napi, sched_napi))
                return qman_cb_dqrr_stop;
 
        fd = &dqrr->fd;
index 518a143..90284ff 100644 (file)
@@ -318,24 +318,6 @@ config INTEL_IOP_ADMA
        help
          Enable support for the Intel(R) IOP Series RAID engines.
 
-config INTEL_MIC_X100_DMA
-       tristate "Intel MIC X100 DMA Driver"
-       depends on 64BIT && X86 && INTEL_MIC_BUS
-       select DMA_ENGINE
-       help
-         This enables DMA support for the Intel Many Integrated Core
-         (MIC) family of PCIe form factor coprocessor X100 devices that
-         run a 64 bit Linux OS. This driver will be used by both MIC
-         host and card drivers.
-
-         If you are building host kernel with a MIC device or a card
-         kernel for a MIC device, then say M (recommended) or Y, else
-         say N. If unsure say N.
-
-         More information about the Intel MIC family as well as the Linux
-         OS and tools for MIC to use with this driver are available from
-         <http://software.intel.com/en-us/mic-developer>.
-
 config K3_DMA
        tristate "Hisilicon K3 DMA support"
        depends on ARCH_HI3xxx || ARCH_HISI || COMPILE_TEST
index e60f813..948a8da 100644 (file)
@@ -44,7 +44,6 @@ obj-$(CONFIG_INTEL_IDMA64) += idma64.o
 obj-$(CONFIG_INTEL_IOATDMA) += ioat/
 obj-$(CONFIG_INTEL_IDXD) += idxd/
 obj-$(CONFIG_INTEL_IOP_ADMA) += iop-adma.o
-obj-$(CONFIG_INTEL_MIC_X100_DMA) += mic_x100_dma.o
 obj-$(CONFIG_K3_DMA) += k3dma.o
 obj-$(CONFIG_LPC18XX_DMAMUX) += lpc18xx-dmamux.o
 obj-$(CONFIG_MILBEAUT_HDMAC) += milbeaut-hdmac.o
diff --git a/drivers/dma/mic_x100_dma.c b/drivers/dma/mic_x100_dma.c
deleted file mode 100644 (file)
index fea8608..0000000
+++ /dev/null
@@ -1,770 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel MIC X100 DMA Driver.
- *
- * Adapted from IOAT dma driver.
- */
-#include <linux/module.h>
-#include <linux/io.h>
-#include <linux/seq_file.h>
-#include <linux/vmalloc.h>
-
-#include "mic_x100_dma.h"
-
-#define MIC_DMA_MAX_XFER_SIZE_CARD  (1 * 1024 * 1024 -\
-                                      MIC_DMA_ALIGN_BYTES)
-#define MIC_DMA_MAX_XFER_SIZE_HOST  (1 * 1024 * 1024 >> 1)
-#define MIC_DMA_DESC_TYPE_SHIFT        60
-#define MIC_DMA_MEMCPY_LEN_SHIFT 46
-#define MIC_DMA_STAT_INTR_SHIFT 59
-
-/* high-water mark for pushing dma descriptors */
-static int mic_dma_pending_level = 4;
-
-/* Status descriptor is used to write a 64 bit value to a memory location */
-enum mic_dma_desc_format_type {
-       MIC_DMA_MEMCPY = 1,
-       MIC_DMA_STATUS,
-};
-
-static inline u32 mic_dma_hw_ring_inc(u32 val)
-{
-       return (val + 1) % MIC_DMA_DESC_RX_SIZE;
-}
-
-static inline u32 mic_dma_hw_ring_dec(u32 val)
-{
-       return val ? val - 1 : MIC_DMA_DESC_RX_SIZE - 1;
-}
-
-static inline void mic_dma_hw_ring_inc_head(struct mic_dma_chan *ch)
-{
-       ch->head = mic_dma_hw_ring_inc(ch->head);
-}
-
-/* Prepare a memcpy desc */
-static inline void mic_dma_memcpy_desc(struct mic_dma_desc *desc,
-       dma_addr_t src_phys, dma_addr_t dst_phys, u64 size)
-{
-       u64 qw0, qw1;
-
-       qw0 = src_phys;
-       qw0 |= (size >> MIC_DMA_ALIGN_SHIFT) << MIC_DMA_MEMCPY_LEN_SHIFT;
-       qw1 = MIC_DMA_MEMCPY;
-       qw1 <<= MIC_DMA_DESC_TYPE_SHIFT;
-       qw1 |= dst_phys;
-       desc->qw0 = qw0;
-       desc->qw1 = qw1;
-}
-
-/* Prepare a status desc. with @data to be written at @dst_phys */
-static inline void mic_dma_prep_status_desc(struct mic_dma_desc *desc, u64 data,
-       dma_addr_t dst_phys, bool generate_intr)
-{
-       u64 qw0, qw1;
-
-       qw0 = data;
-       qw1 = (u64) MIC_DMA_STATUS << MIC_DMA_DESC_TYPE_SHIFT | dst_phys;
-       if (generate_intr)
-               qw1 |= (1ULL << MIC_DMA_STAT_INTR_SHIFT);
-       desc->qw0 = qw0;
-       desc->qw1 = qw1;
-}
-
-static void mic_dma_cleanup(struct mic_dma_chan *ch)
-{
-       struct dma_async_tx_descriptor *tx;
-       u32 tail;
-       u32 last_tail;
-
-       spin_lock(&ch->cleanup_lock);
-       tail = mic_dma_read_cmp_cnt(ch);
-       /*
-        * This is the barrier pair for smp_wmb() in fn.
-        * mic_dma_tx_submit_unlock. It's required so that we read the
-        * updated cookie value from tx->cookie.
-        */
-       smp_rmb();
-       for (last_tail = ch->last_tail; tail != last_tail;) {
-               tx = &ch->tx_array[last_tail];
-               if (tx->cookie) {
-                       dma_cookie_complete(tx);
-                       dmaengine_desc_get_callback_invoke(tx, NULL);
-                       tx->callback = NULL;
-               }
-               last_tail = mic_dma_hw_ring_inc(last_tail);
-       }
-       /* finish all completion callbacks before incrementing tail */
-       smp_mb();
-       ch->last_tail = last_tail;
-       spin_unlock(&ch->cleanup_lock);
-}
-
-static u32 mic_dma_ring_count(u32 head, u32 tail)
-{
-       u32 count;
-
-       if (head >= tail)
-               count = (tail - 0) + (MIC_DMA_DESC_RX_SIZE - head);
-       else
-               count = tail - head;
-       return count - 1;
-}
-
-/* Returns the num. of free descriptors on success, -ENOMEM on failure */
-static int mic_dma_avail_desc_ring_space(struct mic_dma_chan *ch, int required)
-{
-       struct device *dev = mic_dma_ch_to_device(ch);
-       u32 count;
-
-       count = mic_dma_ring_count(ch->head, ch->last_tail);
-       if (count < required) {
-               mic_dma_cleanup(ch);
-               count = mic_dma_ring_count(ch->head, ch->last_tail);
-       }
-
-       if (count < required) {
-               dev_dbg(dev, "Not enough desc space");
-               dev_dbg(dev, "%s %d required=%u, avail=%u\n",
-                       __func__, __LINE__, required, count);
-               return -ENOMEM;
-       } else {
-               return count;
-       }
-}
-
-/* Program memcpy descriptors into the descriptor ring and update s/w head ptr*/
-static int mic_dma_prog_memcpy_desc(struct mic_dma_chan *ch, dma_addr_t src,
-                                   dma_addr_t dst, size_t len)
-{
-       size_t current_transfer_len;
-       size_t max_xfer_size = to_mic_dma_dev(ch)->max_xfer_size;
-       /* 3 is added to make sure we have enough space for status desc */
-       int num_desc = len / max_xfer_size + 3;
-       int ret;
-
-       if (len % max_xfer_size)
-               num_desc++;
-
-       ret = mic_dma_avail_desc_ring_space(ch, num_desc);
-       if (ret < 0)
-               return ret;
-       do {
-               current_transfer_len = min(len, max_xfer_size);
-               mic_dma_memcpy_desc(&ch->desc_ring[ch->head],
-                                   src, dst, current_transfer_len);
-               mic_dma_hw_ring_inc_head(ch);
-               len -= current_transfer_len;
-               dst = dst + current_transfer_len;
-               src = src + current_transfer_len;
-       } while (len > 0);
-       return 0;
-}
-
-/* It's a h/w quirk and h/w needs 2 status descriptors for every status desc */
-static void mic_dma_prog_intr(struct mic_dma_chan *ch)
-{
-       mic_dma_prep_status_desc(&ch->desc_ring[ch->head], 0,
-                                ch->status_dest_micpa, false);
-       mic_dma_hw_ring_inc_head(ch);
-       mic_dma_prep_status_desc(&ch->desc_ring[ch->head], 0,
-                                ch->status_dest_micpa, true);
-       mic_dma_hw_ring_inc_head(ch);
-}
-
-/* Wrapper function to program memcpy descriptors/status descriptors */
-static int mic_dma_do_dma(struct mic_dma_chan *ch, int flags, dma_addr_t src,
-                         dma_addr_t dst, size_t len)
-{
-       if (len && -ENOMEM == mic_dma_prog_memcpy_desc(ch, src, dst, len)) {
-               return -ENOMEM;
-       } else {
-               /* 3 is the maximum number of status descriptors */
-               int ret = mic_dma_avail_desc_ring_space(ch, 3);
-
-               if (ret < 0)
-                       return ret;
-       }
-
-       /* Above mic_dma_prog_memcpy_desc() makes sure we have enough space */
-       if (flags & DMA_PREP_FENCE) {
-               mic_dma_prep_status_desc(&ch->desc_ring[ch->head], 0,
-                                        ch->status_dest_micpa, false);
-               mic_dma_hw_ring_inc_head(ch);
-       }
-
-       if (flags & DMA_PREP_INTERRUPT)
-               mic_dma_prog_intr(ch);
-
-       return 0;
-}
-
-static inline void mic_dma_issue_pending(struct dma_chan *ch)
-{
-       struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch);
-
-       spin_lock(&mic_ch->issue_lock);
-       /*
-        * Write to head triggers h/w to act on the descriptors.
-        * On MIC, writing the same head value twice causes
-        * a h/w error. On second write, h/w assumes we filled
-        * the entire ring & overwrote some of the descriptors.
-        */
-       if (mic_ch->issued == mic_ch->submitted)
-               goto out;
-       mic_ch->issued = mic_ch->submitted;
-       /*
-        * make descriptor updates visible before advancing head,
-        * this is purposefully not smp_wmb() since we are also
-        * publishing the descriptor updates to a dma device
-        */
-       wmb();
-       mic_dma_write_reg(mic_ch, MIC_DMA_REG_DHPR, mic_ch->issued);
-out:
-       spin_unlock(&mic_ch->issue_lock);
-}
-
-static inline void mic_dma_update_pending(struct mic_dma_chan *ch)
-{
-       if (mic_dma_ring_count(ch->issued, ch->submitted)
-                       > mic_dma_pending_level)
-               mic_dma_issue_pending(&ch->api_ch);
-}
-
-static dma_cookie_t mic_dma_tx_submit_unlock(struct dma_async_tx_descriptor *tx)
-{
-       struct mic_dma_chan *mic_ch = to_mic_dma_chan(tx->chan);
-       dma_cookie_t cookie;
-
-       dma_cookie_assign(tx);
-       cookie = tx->cookie;
-       /*
-        * We need an smp write barrier here because another CPU might see
-        * an update to submitted and update h/w head even before we
-        * assigned a cookie to this tx.
-        */
-       smp_wmb();
-       mic_ch->submitted = mic_ch->head;
-       spin_unlock(&mic_ch->prep_lock);
-       mic_dma_update_pending(mic_ch);
-       return cookie;
-}
-
-static inline struct dma_async_tx_descriptor *
-allocate_tx(struct mic_dma_chan *ch)
-{
-       u32 idx = mic_dma_hw_ring_dec(ch->head);
-       struct dma_async_tx_descriptor *tx = &ch->tx_array[idx];
-
-       dma_async_tx_descriptor_init(tx, &ch->api_ch);
-       tx->tx_submit = mic_dma_tx_submit_unlock;
-       return tx;
-}
-
-/* Program a status descriptor with dst as address and value to be written */
-static struct dma_async_tx_descriptor *
-mic_dma_prep_status_lock(struct dma_chan *ch, dma_addr_t dst, u64 src_val,
-                        unsigned long flags)
-{
-       struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch);
-       int result;
-
-       spin_lock(&mic_ch->prep_lock);
-       result = mic_dma_avail_desc_ring_space(mic_ch, 4);
-       if (result < 0)
-               goto error;
-       mic_dma_prep_status_desc(&mic_ch->desc_ring[mic_ch->head], src_val, dst,
-                                false);
-       mic_dma_hw_ring_inc_head(mic_ch);
-       result = mic_dma_do_dma(mic_ch, flags, 0, 0, 0);
-       if (result < 0)
-               goto error;
-
-       return allocate_tx(mic_ch);
-error:
-       dev_err(mic_dma_ch_to_device(mic_ch),
-               "Error enqueueing dma status descriptor, error=%d\n", result);
-       spin_unlock(&mic_ch->prep_lock);
-       return NULL;
-}
-
-/*
- * Prepare a memcpy descriptor to be added to the ring.
- * Note that the temporary descriptor adds an extra overhead of copying the
- * descriptor to ring. So, we copy directly to the descriptor ring
- */
-static struct dma_async_tx_descriptor *
-mic_dma_prep_memcpy_lock(struct dma_chan *ch, dma_addr_t dma_dest,
-                        dma_addr_t dma_src, size_t len, unsigned long flags)
-{
-       struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch);
-       struct device *dev = mic_dma_ch_to_device(mic_ch);
-       int result;
-
-       if (!len && !flags)
-               return NULL;
-
-       spin_lock(&mic_ch->prep_lock);
-       result = mic_dma_do_dma(mic_ch, flags, dma_src, dma_dest, len);
-       if (result >= 0)
-               return allocate_tx(mic_ch);
-       dev_err(dev, "Error enqueueing dma, error=%d\n", result);
-       spin_unlock(&mic_ch->prep_lock);
-       return NULL;
-}
-
-static struct dma_async_tx_descriptor *
-mic_dma_prep_interrupt_lock(struct dma_chan *ch, unsigned long flags)
-{
-       struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch);
-       int ret;
-
-       spin_lock(&mic_ch->prep_lock);
-       ret = mic_dma_do_dma(mic_ch, flags, 0, 0, 0);
-       if (!ret)
-               return allocate_tx(mic_ch);
-       spin_unlock(&mic_ch->prep_lock);
-       return NULL;
-}
-
-/* Return the status of the transaction */
-static enum dma_status
-mic_dma_tx_status(struct dma_chan *ch, dma_cookie_t cookie,
-                 struct dma_tx_state *txstate)
-{
-       struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch);
-
-       if (DMA_COMPLETE != dma_cookie_status(ch, cookie, txstate))
-               mic_dma_cleanup(mic_ch);
-
-       return dma_cookie_status(ch, cookie, txstate);
-}
-
-static irqreturn_t mic_dma_thread_fn(int irq, void *data)
-{
-       mic_dma_cleanup((struct mic_dma_chan *)data);
-       return IRQ_HANDLED;
-}
-
-static irqreturn_t mic_dma_intr_handler(int irq, void *data)
-{
-       struct mic_dma_chan *ch = ((struct mic_dma_chan *)data);
-
-       mic_dma_ack_interrupt(ch);
-       return IRQ_WAKE_THREAD;
-}
-
-static int mic_dma_alloc_desc_ring(struct mic_dma_chan *ch)
-{
-       u64 desc_ring_size = MIC_DMA_DESC_RX_SIZE * sizeof(*ch->desc_ring);
-       struct device *dev = &to_mbus_device(ch)->dev;
-
-       desc_ring_size = ALIGN(desc_ring_size, MIC_DMA_ALIGN_BYTES);
-       ch->desc_ring = kzalloc(desc_ring_size, GFP_KERNEL);
-
-       if (!ch->desc_ring)
-               return -ENOMEM;
-
-       ch->desc_ring_micpa = dma_map_single(dev, ch->desc_ring,
-                                            desc_ring_size, DMA_BIDIRECTIONAL);
-       if (dma_mapping_error(dev, ch->desc_ring_micpa))
-               goto map_error;
-
-       ch->tx_array = vzalloc(array_size(MIC_DMA_DESC_RX_SIZE,
-                                         sizeof(*ch->tx_array)));
-       if (!ch->tx_array)
-               goto tx_error;
-       return 0;
-tx_error:
-       dma_unmap_single(dev, ch->desc_ring_micpa, desc_ring_size,
-                        DMA_BIDIRECTIONAL);
-map_error:
-       kfree(ch->desc_ring);
-       return -ENOMEM;
-}
-
-static void mic_dma_free_desc_ring(struct mic_dma_chan *ch)
-{
-       u64 desc_ring_size = MIC_DMA_DESC_RX_SIZE * sizeof(*ch->desc_ring);
-
-       vfree(ch->tx_array);
-       desc_ring_size = ALIGN(desc_ring_size, MIC_DMA_ALIGN_BYTES);
-       dma_unmap_single(&to_mbus_device(ch)->dev, ch->desc_ring_micpa,
-                        desc_ring_size, DMA_BIDIRECTIONAL);
-       kfree(ch->desc_ring);
-       ch->desc_ring = NULL;
-}
-
-static void mic_dma_free_status_dest(struct mic_dma_chan *ch)
-{
-       dma_unmap_single(&to_mbus_device(ch)->dev, ch->status_dest_micpa,
-                        L1_CACHE_BYTES, DMA_BIDIRECTIONAL);
-       kfree(ch->status_dest);
-}
-
-static int mic_dma_alloc_status_dest(struct mic_dma_chan *ch)
-{
-       struct device *dev = &to_mbus_device(ch)->dev;
-
-       ch->status_dest = kzalloc(L1_CACHE_BYTES, GFP_KERNEL);
-       if (!ch->status_dest)
-               return -ENOMEM;
-       ch->status_dest_micpa = dma_map_single(dev, ch->status_dest,
-                                       L1_CACHE_BYTES, DMA_BIDIRECTIONAL);
-       if (dma_mapping_error(dev, ch->status_dest_micpa)) {
-               kfree(ch->status_dest);
-               ch->status_dest = NULL;
-               return -ENOMEM;
-       }
-       return 0;
-}
-
-static int mic_dma_check_chan(struct mic_dma_chan *ch)
-{
-       if (mic_dma_read_reg(ch, MIC_DMA_REG_DCHERR) ||
-           mic_dma_read_reg(ch, MIC_DMA_REG_DSTAT) & MIC_DMA_CHAN_QUIESCE) {
-               mic_dma_disable_chan(ch);
-               mic_dma_chan_mask_intr(ch);
-               dev_err(mic_dma_ch_to_device(ch),
-                       "%s %d error setting up mic dma chan %d\n",
-                       __func__, __LINE__, ch->ch_num);
-               return -EBUSY;
-       }
-       return 0;
-}
-
-static int mic_dma_chan_setup(struct mic_dma_chan *ch)
-{
-       if (MIC_DMA_CHAN_MIC == ch->owner)
-               mic_dma_chan_set_owner(ch);
-       mic_dma_disable_chan(ch);
-       mic_dma_chan_mask_intr(ch);
-       mic_dma_write_reg(ch, MIC_DMA_REG_DCHERRMSK, 0);
-       mic_dma_chan_set_desc_ring(ch);
-       ch->last_tail = mic_dma_read_reg(ch, MIC_DMA_REG_DTPR);
-       ch->head = ch->last_tail;
-       ch->issued = 0;
-       mic_dma_chan_unmask_intr(ch);
-       mic_dma_enable_chan(ch);
-       return mic_dma_check_chan(ch);
-}
-
-static void mic_dma_chan_destroy(struct mic_dma_chan *ch)
-{
-       mic_dma_disable_chan(ch);
-       mic_dma_chan_mask_intr(ch);
-}
-
-static int mic_dma_setup_irq(struct mic_dma_chan *ch)
-{
-       ch->cookie =
-               to_mbus_hw_ops(ch)->request_threaded_irq(to_mbus_device(ch),
-                       mic_dma_intr_handler, mic_dma_thread_fn,
-                       "mic dma_channel", ch, ch->ch_num);
-       return PTR_ERR_OR_ZERO(ch->cookie);
-}
-
-static inline void mic_dma_free_irq(struct mic_dma_chan *ch)
-{
-       to_mbus_hw_ops(ch)->free_irq(to_mbus_device(ch), ch->cookie, ch);
-}
-
-static int mic_dma_chan_init(struct mic_dma_chan *ch)
-{
-       int ret = mic_dma_alloc_desc_ring(ch);
-
-       if (ret)
-               goto ring_error;
-       ret = mic_dma_alloc_status_dest(ch);
-       if (ret)
-               goto status_error;
-       ret = mic_dma_chan_setup(ch);
-       if (ret)
-               goto chan_error;
-       return ret;
-chan_error:
-       mic_dma_free_status_dest(ch);
-status_error:
-       mic_dma_free_desc_ring(ch);
-ring_error:
-       return ret;
-}
-
-static int mic_dma_drain_chan(struct mic_dma_chan *ch)
-{
-       struct dma_async_tx_descriptor *tx;
-       int err = 0;
-       dma_cookie_t cookie;
-
-       tx = mic_dma_prep_memcpy_lock(&ch->api_ch, 0, 0, 0, DMA_PREP_FENCE);
-       if (!tx) {
-               err = -ENOMEM;
-               goto error;
-       }
-
-       cookie = tx->tx_submit(tx);
-       if (dma_submit_error(cookie))
-               err = -ENOMEM;
-       else
-               err = dma_sync_wait(&ch->api_ch, cookie);
-       if (err) {
-               dev_err(mic_dma_ch_to_device(ch), "%s %d TO chan 0x%x\n",
-                       __func__, __LINE__, ch->ch_num);
-               err = -EIO;
-       }
-error:
-       mic_dma_cleanup(ch);
-       return err;
-}
-
-static inline void mic_dma_chan_uninit(struct mic_dma_chan *ch)
-{
-       mic_dma_chan_destroy(ch);
-       mic_dma_cleanup(ch);
-       mic_dma_free_status_dest(ch);
-       mic_dma_free_desc_ring(ch);
-}
-
-static int mic_dma_init(struct mic_dma_device *mic_dma_dev,
-                       enum mic_dma_chan_owner owner)
-{
-       int i, first_chan = mic_dma_dev->start_ch;
-       struct mic_dma_chan *ch;
-       int ret;
-
-       for (i = first_chan; i < first_chan + MIC_DMA_NUM_CHAN; i++) {
-               ch = &mic_dma_dev->mic_ch[i];
-               ch->ch_num = i;
-               ch->owner = owner;
-               spin_lock_init(&ch->cleanup_lock);
-               spin_lock_init(&ch->prep_lock);
-               spin_lock_init(&ch->issue_lock);
-               ret = mic_dma_setup_irq(ch);
-               if (ret)
-                       goto error;
-       }
-       return 0;
-error:
-       for (i = i - 1; i >= first_chan; i--)
-               mic_dma_free_irq(ch);
-       return ret;
-}
-
-static void mic_dma_uninit(struct mic_dma_device *mic_dma_dev)
-{
-       int i, first_chan = mic_dma_dev->start_ch;
-       struct mic_dma_chan *ch;
-
-       for (i = first_chan; i < first_chan + MIC_DMA_NUM_CHAN; i++) {
-               ch = &mic_dma_dev->mic_ch[i];
-               mic_dma_free_irq(ch);
-       }
-}
-
-static int mic_dma_alloc_chan_resources(struct dma_chan *ch)
-{
-       int ret = mic_dma_chan_init(to_mic_dma_chan(ch));
-       if (ret)
-               return ret;
-       return MIC_DMA_DESC_RX_SIZE;
-}
-
-static void mic_dma_free_chan_resources(struct dma_chan *ch)
-{
-       struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch);
-       mic_dma_drain_chan(mic_ch);
-       mic_dma_chan_uninit(mic_ch);
-}
-
-/* Set the fn. handlers and register the dma device with dma api */
-static int mic_dma_register_dma_device(struct mic_dma_device *mic_dma_dev,
-                                      enum mic_dma_chan_owner owner)
-{
-       int i, first_chan = mic_dma_dev->start_ch;
-
-       dma_cap_zero(mic_dma_dev->dma_dev.cap_mask);
-       /*
-        * This dma engine is not capable of host memory to host memory
-        * transfers
-        */
-       dma_cap_set(DMA_MEMCPY, mic_dma_dev->dma_dev.cap_mask);
-
-       if (MIC_DMA_CHAN_HOST == owner)
-               dma_cap_set(DMA_PRIVATE, mic_dma_dev->dma_dev.cap_mask);
-       mic_dma_dev->dma_dev.device_alloc_chan_resources =
-               mic_dma_alloc_chan_resources;
-       mic_dma_dev->dma_dev.device_free_chan_resources =
-               mic_dma_free_chan_resources;
-       mic_dma_dev->dma_dev.device_tx_status = mic_dma_tx_status;
-       mic_dma_dev->dma_dev.device_prep_dma_memcpy = mic_dma_prep_memcpy_lock;
-       mic_dma_dev->dma_dev.device_prep_dma_imm_data =
-               mic_dma_prep_status_lock;
-       mic_dma_dev->dma_dev.device_prep_dma_interrupt =
-               mic_dma_prep_interrupt_lock;
-       mic_dma_dev->dma_dev.device_issue_pending = mic_dma_issue_pending;
-       mic_dma_dev->dma_dev.copy_align = MIC_DMA_ALIGN_SHIFT;
-       INIT_LIST_HEAD(&mic_dma_dev->dma_dev.channels);
-       for (i = first_chan; i < first_chan + MIC_DMA_NUM_CHAN; i++) {
-               mic_dma_dev->mic_ch[i].api_ch.device = &mic_dma_dev->dma_dev;
-               dma_cookie_init(&mic_dma_dev->mic_ch[i].api_ch);
-               list_add_tail(&mic_dma_dev->mic_ch[i].api_ch.device_node,
-                             &mic_dma_dev->dma_dev.channels);
-       }
-       return dmaenginem_async_device_register(&mic_dma_dev->dma_dev);
-}
-
-/*
- * Initializes dma channels and registers the dma device with the
- * dma engine api.
- */
-static struct mic_dma_device *mic_dma_dev_reg(struct mbus_device *mbdev,
-                                             enum mic_dma_chan_owner owner)
-{
-       struct mic_dma_device *mic_dma_dev;
-       int ret;
-       struct device *dev = &mbdev->dev;
-
-       mic_dma_dev = devm_kzalloc(dev, sizeof(*mic_dma_dev), GFP_KERNEL);
-       if (!mic_dma_dev) {
-               ret = -ENOMEM;
-               goto alloc_error;
-       }
-       mic_dma_dev->mbdev = mbdev;
-       mic_dma_dev->dma_dev.dev = dev;
-       mic_dma_dev->mmio = mbdev->mmio_va;
-       if (MIC_DMA_CHAN_HOST == owner) {
-               mic_dma_dev->start_ch = 0;
-               mic_dma_dev->max_xfer_size = MIC_DMA_MAX_XFER_SIZE_HOST;
-       } else {
-               mic_dma_dev->start_ch = 4;
-               mic_dma_dev->max_xfer_size = MIC_DMA_MAX_XFER_SIZE_CARD;
-       }
-       ret = mic_dma_init(mic_dma_dev, owner);
-       if (ret)
-               goto init_error;
-       ret = mic_dma_register_dma_device(mic_dma_dev, owner);
-       if (ret)
-               goto reg_error;
-       return mic_dma_dev;
-reg_error:
-       mic_dma_uninit(mic_dma_dev);
-init_error:
-       mic_dma_dev = NULL;
-alloc_error:
-       dev_err(dev, "Error at %s %d ret=%d\n", __func__, __LINE__, ret);
-       return mic_dma_dev;
-}
-
-static void mic_dma_dev_unreg(struct mic_dma_device *mic_dma_dev)
-{
-       mic_dma_uninit(mic_dma_dev);
-}
-
-/* DEBUGFS CODE */
-static int mic_dma_reg_show(struct seq_file *s, void *pos)
-{
-       struct mic_dma_device *mic_dma_dev = s->private;
-       int i, chan_num, first_chan = mic_dma_dev->start_ch;
-       struct mic_dma_chan *ch;
-
-       seq_printf(s, "SBOX_DCR: %#x\n",
-                  mic_dma_mmio_read(&mic_dma_dev->mic_ch[first_chan],
-                                    MIC_DMA_SBOX_BASE + MIC_DMA_SBOX_DCR));
-       seq_puts(s, "DMA Channel Registers\n");
-       seq_printf(s, "%-10s| %-10s %-10s %-10s %-10s %-10s",
-                  "Channel", "DCAR", "DTPR", "DHPR", "DRAR_HI", "DRAR_LO");
-       seq_printf(s, " %-11s %-14s %-10s\n", "DCHERR", "DCHERRMSK", "DSTAT");
-       for (i = first_chan; i < first_chan + MIC_DMA_NUM_CHAN; i++) {
-               ch = &mic_dma_dev->mic_ch[i];
-               chan_num = ch->ch_num;
-               seq_printf(s, "%-10i| %-#10x %-#10x %-#10x %-#10x",
-                          chan_num,
-                          mic_dma_read_reg(ch, MIC_DMA_REG_DCAR),
-                          mic_dma_read_reg(ch, MIC_DMA_REG_DTPR),
-                          mic_dma_read_reg(ch, MIC_DMA_REG_DHPR),
-                          mic_dma_read_reg(ch, MIC_DMA_REG_DRAR_HI));
-               seq_printf(s, " %-#10x %-#10x %-#14x %-#10x\n",
-                          mic_dma_read_reg(ch, MIC_DMA_REG_DRAR_LO),
-                          mic_dma_read_reg(ch, MIC_DMA_REG_DCHERR),
-                          mic_dma_read_reg(ch, MIC_DMA_REG_DCHERRMSK),
-                          mic_dma_read_reg(ch, MIC_DMA_REG_DSTAT));
-       }
-       return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(mic_dma_reg);
-
-/* Debugfs parent dir */
-static struct dentry *mic_dma_dbg;
-
-static int mic_dma_driver_probe(struct mbus_device *mbdev)
-{
-       struct mic_dma_device *mic_dma_dev;
-       enum mic_dma_chan_owner owner;
-
-       if (MBUS_DEV_DMA_MIC == mbdev->id.device)
-               owner = MIC_DMA_CHAN_MIC;
-       else
-               owner = MIC_DMA_CHAN_HOST;
-
-       mic_dma_dev = mic_dma_dev_reg(mbdev, owner);
-       dev_set_drvdata(&mbdev->dev, mic_dma_dev);
-
-       if (mic_dma_dbg) {
-               mic_dma_dev->dbg_dir = debugfs_create_dir(dev_name(&mbdev->dev),
-                                                         mic_dma_dbg);
-               debugfs_create_file("mic_dma_reg", 0444, mic_dma_dev->dbg_dir,
-                                   mic_dma_dev, &mic_dma_reg_fops);
-       }
-       return 0;
-}
-
-static void mic_dma_driver_remove(struct mbus_device *mbdev)
-{
-       struct mic_dma_device *mic_dma_dev;
-
-       mic_dma_dev = dev_get_drvdata(&mbdev->dev);
-       debugfs_remove_recursive(mic_dma_dev->dbg_dir);
-       mic_dma_dev_unreg(mic_dma_dev);
-}
-
-static struct mbus_device_id id_table[] = {
-       {MBUS_DEV_DMA_MIC, MBUS_DEV_ANY_ID},
-       {MBUS_DEV_DMA_HOST, MBUS_DEV_ANY_ID},
-       {0},
-};
-
-static struct mbus_driver mic_dma_driver = {
-       .driver.name =  KBUILD_MODNAME,
-       .driver.owner = THIS_MODULE,
-       .id_table = id_table,
-       .probe = mic_dma_driver_probe,
-       .remove = mic_dma_driver_remove,
-};
-
-static int __init mic_x100_dma_init(void)
-{
-       int rc = mbus_register_driver(&mic_dma_driver);
-       if (rc)
-               return rc;
-       mic_dma_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL);
-       return 0;
-}
-
-static void __exit mic_x100_dma_exit(void)
-{
-       debugfs_remove_recursive(mic_dma_dbg);
-       mbus_unregister_driver(&mic_dma_driver);
-}
-
-module_init(mic_x100_dma_init);
-module_exit(mic_x100_dma_exit);
-
-MODULE_DEVICE_TABLE(mbus, id_table);
-MODULE_AUTHOR("Intel Corporation");
-MODULE_DESCRIPTION("Intel(R) MIC X100 DMA Driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/dma/mic_x100_dma.h b/drivers/dma/mic_x100_dma.h
deleted file mode 100644 (file)
index 68ef43a..0000000
+++ /dev/null
@@ -1,275 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel MIC X100 DMA Driver.
- *
- * Adapted from IOAT dma driver.
- */
-#ifndef _MIC_X100_DMA_H_
-#define _MIC_X100_DMA_H_
-
-#include <linux/kernel.h>
-#include <linux/delay.h>
-#include <linux/sched.h>
-#include <linux/debugfs.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/mic_bus.h>
-
-#include "dmaengine.h"
-
-/*
- * MIC has a total of 8 dma channels.
- * Four channels are assigned for host SW use & the remaining for MIC SW.
- * MIC DMA transfer size & addresses need to be 64 byte aligned.
- */
-#define MIC_DMA_MAX_NUM_CHAN   8
-#define MIC_DMA_NUM_CHAN       4
-#define MIC_DMA_ALIGN_SHIFT    DMAENGINE_ALIGN_64_BYTES
-#define MIC_DMA_ALIGN_BYTES    (1 << MIC_DMA_ALIGN_SHIFT)
-#define MIC_DMA_DESC_RX_SIZE   (128 * 1024 - 4)
-
-/*
- * Register descriptions
- * All the registers are 32 bit registers.
- * DCR is a global register and all others are per-channel.
- * DCR - bits 0, 2, 4, 6, 8, 10, 12, 14 - enable bits for channels 0 to 7
- *      bits 1, 3, 5, 7, 9, 11, 13, 15 - owner bits for channels 0 to 7
- * DCAR - bit 24 & 25 interrupt masks for mic owned & host owned channels
- * DHPR - head of the descriptor ring updated by s/w
- * DTPR - tail of the descriptor ring updated by h/w
- * DRAR_LO - lower 32 bits of descriptor ring's mic address
- * DRAR_HI - 3:0 - remaining 4 bits of descriptor ring's mic address
- *          20:4 descriptor ring size
- *          25:21 mic smpt entry number
- * DSTAT - 16:0 h/w completion count; 31:28 dma engine status
- * DCHERR - this register is non-zero on error
- * DCHERRMSK - interrupt mask register
- */
-#define MIC_DMA_HW_CMP_CNT_MASK                0x1ffff
-#define MIC_DMA_CHAN_QUIESCE           0x20000000
-#define MIC_DMA_SBOX_BASE              0x00010000
-#define MIC_DMA_SBOX_DCR               0x0000A280
-#define MIC_DMA_SBOX_CH_BASE           0x0001A000
-#define MIC_DMA_SBOX_CHAN_OFF          0x40
-#define MIC_DMA_SBOX_DCAR_IM0          (0x1 << 24)
-#define MIC_DMA_SBOX_DCAR_IM1          (0x1 << 25)
-#define MIC_DMA_SBOX_DRARHI_SYS_MASK   (0x1 << 26)
-#define MIC_DMA_REG_DCAR               0
-#define MIC_DMA_REG_DHPR               4
-#define MIC_DMA_REG_DTPR               8
-#define MIC_DMA_REG_DRAR_LO            20
-#define MIC_DMA_REG_DRAR_HI            24
-#define MIC_DMA_REG_DSTAT              32
-#define MIC_DMA_REG_DCHERR             44
-#define MIC_DMA_REG_DCHERRMSK          48
-
-/* HW dma desc */
-struct mic_dma_desc {
-       u64 qw0;
-       u64 qw1;
-};
-
-enum mic_dma_chan_owner {
-       MIC_DMA_CHAN_MIC = 0,
-       MIC_DMA_CHAN_HOST
-};
-
-/*
- * mic_dma_chan - channel specific information
- * @ch_num: channel number
- * @owner: owner of this channel
- * @last_tail: cached value of descriptor ring tail
- * @head: index of next descriptor in desc_ring
- * @issued: hardware notification point
- * @submitted: index that will be used to submit descriptors to h/w
- * @api_ch: dma engine api channel
- * @desc_ring: dma descriptor ring
- * @desc_ring_micpa: mic physical address of desc_ring
- * @status_dest: destination for status (fence) descriptor
- * @status_dest_micpa: mic address for status_dest,
- *                    DMA controller uses this address
- * @tx_array: array of async_tx
- * @cleanup_lock: lock held when processing completed tx
- * @prep_lock: lock held in prep_memcpy & released in tx_submit
- * @issue_lock: lock used to synchronize writes to head
- * @cookie: mic_irq cookie used with mic irq request
- */
-struct mic_dma_chan {
-       int ch_num;
-       enum mic_dma_chan_owner owner;
-       u32 last_tail;
-       u32 head;
-       u32 issued;
-       u32 submitted;
-       struct dma_chan api_ch;
-       struct mic_dma_desc *desc_ring;
-       dma_addr_t desc_ring_micpa;
-       u64 *status_dest;
-       dma_addr_t status_dest_micpa;
-       struct dma_async_tx_descriptor *tx_array;
-       spinlock_t cleanup_lock;
-       spinlock_t prep_lock;
-       spinlock_t issue_lock;
-       struct mic_irq *cookie;
-};
-
-/*
- * struct mic_dma_device - per mic device
- * @mic_ch: dma channels
- * @dma_dev: underlying dma device
- * @mbdev: mic bus dma device
- * @mmio: virtual address of the mmio space
- * @dbg_dir: debugfs directory
- * @start_ch: first channel number that can be used
- * @max_xfer_size: maximum transfer size per dma descriptor
- */
-struct mic_dma_device {
-       struct mic_dma_chan mic_ch[MIC_DMA_MAX_NUM_CHAN];
-       struct dma_device dma_dev;
-       struct mbus_device *mbdev;
-       void __iomem *mmio;
-       struct dentry *dbg_dir;
-       int start_ch;
-       size_t max_xfer_size;
-};
-
-static inline struct mic_dma_chan *to_mic_dma_chan(struct dma_chan *ch)
-{
-       return container_of(ch, struct mic_dma_chan, api_ch);
-}
-
-static inline struct mic_dma_device *to_mic_dma_dev(struct mic_dma_chan *ch)
-{
-       return
-       container_of((const typeof(((struct mic_dma_device *)0)->mic_ch)*)
-                    (ch - ch->ch_num), struct mic_dma_device, mic_ch);
-}
-
-static inline struct mbus_device *to_mbus_device(struct mic_dma_chan *ch)
-{
-       return to_mic_dma_dev(ch)->mbdev;
-}
-
-static inline struct mbus_hw_ops *to_mbus_hw_ops(struct mic_dma_chan *ch)
-{
-       return to_mbus_device(ch)->hw_ops;
-}
-
-static inline struct device *mic_dma_ch_to_device(struct mic_dma_chan *ch)
-{
-       return to_mic_dma_dev(ch)->dma_dev.dev;
-}
-
-static inline void __iomem *mic_dma_chan_to_mmio(struct mic_dma_chan *ch)
-{
-       return to_mic_dma_dev(ch)->mmio;
-}
-
-static inline u32 mic_dma_read_reg(struct mic_dma_chan *ch, u32 reg)
-{
-       return ioread32(mic_dma_chan_to_mmio(ch) + MIC_DMA_SBOX_CH_BASE +
-                       ch->ch_num * MIC_DMA_SBOX_CHAN_OFF + reg);
-}
-
-static inline void mic_dma_write_reg(struct mic_dma_chan *ch, u32 reg, u32 val)
-{
-       iowrite32(val, mic_dma_chan_to_mmio(ch) + MIC_DMA_SBOX_CH_BASE +
-                 ch->ch_num * MIC_DMA_SBOX_CHAN_OFF + reg);
-}
-
-static inline u32 mic_dma_mmio_read(struct mic_dma_chan *ch, u32 offset)
-{
-       return ioread32(mic_dma_chan_to_mmio(ch) + offset);
-}
-
-static inline void mic_dma_mmio_write(struct mic_dma_chan *ch, u32 val,
-                                     u32 offset)
-{
-       iowrite32(val, mic_dma_chan_to_mmio(ch) + offset);
-}
-
-static inline u32 mic_dma_read_cmp_cnt(struct mic_dma_chan *ch)
-{
-       return mic_dma_read_reg(ch, MIC_DMA_REG_DSTAT) &
-              MIC_DMA_HW_CMP_CNT_MASK;
-}
-
-static inline void mic_dma_chan_set_owner(struct mic_dma_chan *ch)
-{
-       u32 dcr = mic_dma_mmio_read(ch, MIC_DMA_SBOX_BASE + MIC_DMA_SBOX_DCR);
-       u32 chan_num = ch->ch_num;
-
-       dcr = (dcr & ~(0x1 << (chan_num * 2))) | (ch->owner << (chan_num * 2));
-       mic_dma_mmio_write(ch, dcr, MIC_DMA_SBOX_BASE + MIC_DMA_SBOX_DCR);
-}
-
-static inline void mic_dma_enable_chan(struct mic_dma_chan *ch)
-{
-       u32 dcr = mic_dma_mmio_read(ch, MIC_DMA_SBOX_BASE + MIC_DMA_SBOX_DCR);
-
-       dcr |= 2 << (ch->ch_num << 1);
-       mic_dma_mmio_write(ch, dcr, MIC_DMA_SBOX_BASE + MIC_DMA_SBOX_DCR);
-}
-
-static inline void mic_dma_disable_chan(struct mic_dma_chan *ch)
-{
-       u32 dcr = mic_dma_mmio_read(ch, MIC_DMA_SBOX_BASE + MIC_DMA_SBOX_DCR);
-
-       dcr &= ~(2 << (ch->ch_num << 1));
-       mic_dma_mmio_write(ch, dcr, MIC_DMA_SBOX_BASE + MIC_DMA_SBOX_DCR);
-}
-
-static void mic_dma_chan_set_desc_ring(struct mic_dma_chan *ch)
-{
-       u32 drar_hi;
-       dma_addr_t desc_ring_micpa = ch->desc_ring_micpa;
-
-       drar_hi = (MIC_DMA_DESC_RX_SIZE & 0x1ffff) << 4;
-       if (MIC_DMA_CHAN_MIC == ch->owner) {
-               drar_hi |= (desc_ring_micpa >> 32) & 0xf;
-       } else {
-               drar_hi |= MIC_DMA_SBOX_DRARHI_SYS_MASK;
-               drar_hi |= ((desc_ring_micpa >> 34)
-                           & 0x1f) << 21;
-               drar_hi |= (desc_ring_micpa >> 32) & 0x3;
-       }
-       mic_dma_write_reg(ch, MIC_DMA_REG_DRAR_LO, (u32) desc_ring_micpa);
-       mic_dma_write_reg(ch, MIC_DMA_REG_DRAR_HI, drar_hi);
-}
-
-static inline void mic_dma_chan_mask_intr(struct mic_dma_chan *ch)
-{
-       u32 dcar = mic_dma_read_reg(ch, MIC_DMA_REG_DCAR);
-
-       if (MIC_DMA_CHAN_MIC == ch->owner)
-               dcar |= MIC_DMA_SBOX_DCAR_IM0;
-       else
-               dcar |= MIC_DMA_SBOX_DCAR_IM1;
-       mic_dma_write_reg(ch, MIC_DMA_REG_DCAR, dcar);
-}
-
-static inline void mic_dma_chan_unmask_intr(struct mic_dma_chan *ch)
-{
-       u32 dcar = mic_dma_read_reg(ch, MIC_DMA_REG_DCAR);
-
-       if (MIC_DMA_CHAN_MIC == ch->owner)
-               dcar &= ~MIC_DMA_SBOX_DCAR_IM0;
-       else
-               dcar &= ~MIC_DMA_SBOX_DCAR_IM1;
-       mic_dma_write_reg(ch, MIC_DMA_REG_DCAR, dcar);
-}
-
-static void mic_dma_ack_interrupt(struct mic_dma_chan *ch)
-{
-       if (MIC_DMA_CHAN_MIC == ch->owner) {
-               /* HW errata */
-               mic_dma_chan_mask_intr(ch);
-               mic_dma_chan_unmask_intr(ch);
-       }
-       to_mbus_hw_ops(ch)->ack_interrupt(to_mbus_device(ch), ch->ch_num);
-}
-#endif
index 42c8ad1..a367584 100644 (file)
@@ -573,8 +573,8 @@ static int k3_udma_glue_cfg_rx_flow(struct k3_udma_glue_rx_channel *rx_chn,
 
        /* request and cfg rings */
        ret =  k3_ringacc_request_rings_pair(rx_chn->common.ringacc,
-                                            flow_cfg->ring_rxq_id,
                                             flow_cfg->ring_rxfdq0_id,
+                                            flow_cfg->ring_rxq_id,
                                             &flow->ringrxfdq,
                                             &flow->ringrx);
        if (ret) {
index d78dd3c..3315e3c 100644 (file)
@@ -7,7 +7,7 @@
 menu "Firmware Drivers"
 
 config ARM_SCMI_PROTOCOL
-       bool "ARM System Control and Management Interface (SCMI) Message Protocol"
+       tristate "ARM System Control and Management Interface (SCMI) Message Protocol"
        depends on ARM || ARM64 || COMPILE_TEST
        depends on MAILBOX
        help
index 99510be..5e013b6 100644 (file)
@@ -22,7 +22,7 @@ obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o
 obj-$(CONFIG_TRUSTED_FOUNDATIONS) += trusted_foundations.o
 obj-$(CONFIG_TURRIS_MOX_RWTM)  += turris-mox-rwtm.o
 
-obj-$(CONFIG_ARM_SCMI_PROTOCOL)        += arm_scmi/
+obj-y                          += arm_scmi/
 obj-y                          += broadcom/
 obj-y                          += meson/
 obj-$(CONFIG_GOOGLE_FIRMWARE)  += google/
index 6f9cbc4..bc0d54f 100644 (file)
@@ -1,9 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-y  = scmi-bus.o scmi-driver.o scmi-protocols.o scmi-transport.o
 scmi-bus-y = bus.o
 scmi-driver-y = driver.o notify.o
 scmi-transport-y = shmem.o
 scmi-transport-$(CONFIG_MAILBOX) += mailbox.o
 scmi-transport-$(CONFIG_HAVE_ARM_SMCCC_DISCOVERY) += smc.o
-scmi-protocols-y = base.o clock.o perf.o power.o reset.o sensors.o
+scmi-protocols-y = base.o clock.o perf.o power.o reset.o sensors.o system.o
+scmi-module-objs := $(scmi-bus-y) $(scmi-driver-y) $(scmi-protocols-y) \
+                   $(scmi-transport-y)
+obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-module.o
 obj-$(CONFIG_ARM_SCMI_POWER_DOMAIN) += scmi_pm_domain.o
index 9853bd3..017e5d8 100644 (file)
@@ -197,6 +197,8 @@ static int scmi_base_implementation_list_get(const struct scmi_handle *handle,
                        protocols_imp[tot_num_ret + loop] = *(list + loop);
 
                tot_num_ret += loop_num_ret;
+
+               scmi_reset_rx_to_maxsz(handle, t);
        } while (loop_num_ret);
 
        scmi_xfer_put(handle, t);
index db55c43..1377ec7 100644 (file)
@@ -230,7 +230,7 @@ static void scmi_devices_unregister(void)
        bus_for_each_dev(&scmi_bus_type, NULL, NULL, __scmi_devices_unregister);
 }
 
-static int __init scmi_bus_init(void)
+int __init scmi_bus_init(void)
 {
        int retval;
 
@@ -240,12 +240,10 @@ static int __init scmi_bus_init(void)
 
        return retval;
 }
-subsys_initcall(scmi_bus_init);
 
-static void __exit scmi_bus_exit(void)
+void __exit scmi_bus_exit(void)
 {
        scmi_devices_unregister();
        bus_unregister(&scmi_bus_type);
        ida_destroy(&scmi_bus_id);
 }
-module_exit(scmi_bus_exit);
index 75e3988..4645677 100644 (file)
@@ -192,6 +192,8 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
                }
 
                tot_rate_cnt += num_returned;
+
+               scmi_reset_rx_to_maxsz(handle, t);
                /*
                 * check for both returned and remaining to avoid infinite
                 * loop due to buggy firmware
@@ -318,7 +320,7 @@ scmi_clock_info_get(const struct scmi_handle *handle, u32 clk_id)
        return clk;
 }
 
-static struct scmi_clk_ops clk_ops = {
+static const struct scmi_clk_ops clk_ops = {
        .count_get = scmi_clock_count_get,
        .info_get = scmi_clock_info_get,
        .rate_get = scmi_clock_rate_get,
@@ -364,9 +366,4 @@ static int scmi_clock_protocol_init(struct scmi_handle *handle)
        return 0;
 }
 
-static int __init scmi_clock_init(void)
-{
-       return scmi_protocol_register(SCMI_PROTOCOL_CLOCK,
-                                     &scmi_clock_protocol_init);
-}
-subsys_initcall(scmi_clock_init);
+DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_CLOCK, clock)
index c113e57..65063fa 100644 (file)
@@ -147,6 +147,8 @@ int scmi_do_xfer_with_response(const struct scmi_handle *h,
                               struct scmi_xfer *xfer);
 int scmi_xfer_get_init(const struct scmi_handle *h, u8 msg_id, u8 prot_id,
                       size_t tx_size, size_t rx_size, struct scmi_xfer **p);
+void scmi_reset_rx_to_maxsz(const struct scmi_handle *handle,
+                           struct scmi_xfer *xfer);
 int scmi_handle_put(const struct scmi_handle *handle);
 struct scmi_handle *scmi_handle_get(struct device *dev);
 void scmi_set_handle(struct scmi_device *scmi_dev);
@@ -156,6 +158,30 @@ void scmi_setup_protocol_implemented(const struct scmi_handle *handle,
 
 int scmi_base_protocol_init(struct scmi_handle *h);
 
+int __init scmi_bus_init(void);
+void __exit scmi_bus_exit(void);
+
+#define DECLARE_SCMI_REGISTER_UNREGISTER(func)         \
+       int __init scmi_##func##_register(void);        \
+       void __exit scmi_##func##_unregister(void)
+DECLARE_SCMI_REGISTER_UNREGISTER(clock);
+DECLARE_SCMI_REGISTER_UNREGISTER(perf);
+DECLARE_SCMI_REGISTER_UNREGISTER(power);
+DECLARE_SCMI_REGISTER_UNREGISTER(reset);
+DECLARE_SCMI_REGISTER_UNREGISTER(sensors);
+DECLARE_SCMI_REGISTER_UNREGISTER(system);
+
+#define DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(id, name) \
+int __init scmi_##name##_register(void) \
+{ \
+       return scmi_protocol_register((id), &scmi_##name##_protocol_init); \
+} \
+\
+void __exit scmi_##name##_unregister(void) \
+{ \
+       scmi_protocol_unregister((id)); \
+}
+
 /* SCMI Transport */
 /**
  * struct scmi_chan_info - Structure representing a SCMI channel information
@@ -210,7 +236,7 @@ struct scmi_transport_ops {
  * @max_msg_size: Maximum size of data per message that can be handled.
  */
 struct scmi_desc {
-       struct scmi_transport_ops *ops;
+       const struct scmi_transport_ops *ops;
        int max_rx_timeout_ms;
        int max_msg;
        int max_msg_size;
index 03ec742..3dfd8b6 100644 (file)
@@ -402,6 +402,14 @@ int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer)
        return ret;
 }
 
+void scmi_reset_rx_to_maxsz(const struct scmi_handle *handle,
+                           struct scmi_xfer *xfer)
+{
+       struct scmi_info *info = handle_to_scmi_info(handle);
+
+       xfer->rx.len = info->desc->max_msg_size;
+}
+
 #define SCMI_MAX_RESPONSE_TIMEOUT      (2 * MSEC_PER_SEC)
 
 /**
@@ -730,6 +738,7 @@ struct scmi_prot_devnames {
 
 static struct scmi_prot_devnames devnames[] = {
        { SCMI_PROTOCOL_POWER,  { "genpd" },},
+       { SCMI_PROTOCOL_SYSTEM, { "syspower" },},
        { SCMI_PROTOCOL_PERF,   { "cpufreq" },},
        { SCMI_PROTOCOL_CLOCK,  { "clocks" },},
        { SCMI_PROTOCOL_SENSOR, { "hwmon" },},
@@ -928,7 +937,35 @@ static struct platform_driver scmi_driver = {
        .remove = scmi_remove,
 };
 
-module_platform_driver(scmi_driver);
+static int __init scmi_driver_init(void)
+{
+       scmi_bus_init();
+
+       scmi_clock_register();
+       scmi_perf_register();
+       scmi_power_register();
+       scmi_reset_register();
+       scmi_sensors_register();
+       scmi_system_register();
+
+       return platform_driver_register(&scmi_driver);
+}
+subsys_initcall(scmi_driver_init);
+
+static void __exit scmi_driver_exit(void)
+{
+       scmi_bus_exit();
+
+       scmi_clock_unregister();
+       scmi_perf_unregister();
+       scmi_power_unregister();
+       scmi_reset_unregister();
+       scmi_sensors_unregister();
+       scmi_system_unregister();
+
+       platform_driver_unregister(&scmi_driver);
+}
+module_exit(scmi_driver_exit);
 
 MODULE_ALIAS("platform: arm-scmi");
 MODULE_AUTHOR("Sudeep Holla <sudeep.holla@arm.com>");
index 6998dc8..4626404 100644 (file)
@@ -110,7 +110,7 @@ static int mailbox_chan_free(int id, void *p, void *data)
        struct scmi_chan_info *cinfo = p;
        struct scmi_mailbox *smbox = cinfo->transport_info;
 
-       if (!IS_ERR(smbox->chan)) {
+       if (smbox && !IS_ERR(smbox->chan)) {
                mbox_free_channel(smbox->chan);
                cinfo->transport_info = NULL;
                smbox->chan = NULL;
@@ -181,7 +181,7 @@ mailbox_poll_done(struct scmi_chan_info *cinfo, struct scmi_xfer *xfer)
        return shmem_poll_done(smbox->shmem, xfer);
 }
 
-static struct scmi_transport_ops scmi_mailbox_ops = {
+static const struct scmi_transport_ops scmi_mailbox_ops = {
        .chan_available = mailbox_chan_available,
        .chan_setup = mailbox_chan_setup,
        .chan_free = mailbox_chan_free,
index 4731daa..ce33689 100644 (file)
@@ -1403,15 +1403,21 @@ static void scmi_protocols_late_init(struct work_struct *work)
                                "finalized PENDING handler - key:%X\n",
                                hndl->key);
                        ret = scmi_event_handler_enable_events(hndl);
+                       if (ret) {
+                               dev_dbg(ni->handle->dev,
+                                       "purging INVALID handler - key:%X\n",
+                                       hndl->key);
+                               scmi_put_active_handler(ni, hndl);
+                       }
                } else {
                        ret = scmi_valid_pending_handler(ni, hndl);
-               }
-               if (ret) {
-                       dev_dbg(ni->handle->dev,
-                               "purging PENDING handler - key:%X\n",
-                               hndl->key);
-                       /* this hndl can be only a pending one */
-                       scmi_put_handler_unlocked(ni, hndl);
+                       if (ret) {
+                               dev_dbg(ni->handle->dev,
+                                       "purging PENDING handler - key:%X\n",
+                                       hndl->key);
+                               /* this hndl can be only a pending one */
+                               scmi_put_handler_unlocked(ni, hndl);
+                       }
                }
        }
        mutex_unlock(&ni->pending_mtx);
@@ -1421,7 +1427,7 @@ static void scmi_protocols_late_init(struct work_struct *work)
  * notify_ops are attached to the handle so that can be accessed
  * directly from an scmi_driver to register its own notifiers.
  */
-static struct scmi_notify_ops notify_ops = {
+static const struct scmi_notify_ops notify_ops = {
        .register_event_notifier = scmi_register_notifier,
        .unregister_event_notifier = scmi_unregister_notifier,
 };
@@ -1468,7 +1474,7 @@ int scmi_notification_init(struct scmi_handle *handle)
        ni->gid = gid;
        ni->handle = handle;
 
-       ni->notify_wq = alloc_workqueue("scmi_notify",
+       ni->notify_wq = alloc_workqueue(dev_name(handle->dev),
                                        WQ_UNBOUND | WQ_FREEZABLE | WQ_SYSFS,
                                        0);
        if (!ni->notify_wq)
index 3e1e870..82fb3ba 100644 (file)
@@ -304,6 +304,8 @@ scmi_perf_describe_levels_get(const struct scmi_handle *handle, u32 domain,
                }
 
                tot_opp_cnt += num_returned;
+
+               scmi_reset_rx_to_maxsz(handle, t);
                /*
                 * check for both returned and remaining to avoid infinite
                 * loop due to buggy firmware
@@ -748,7 +750,7 @@ static bool scmi_fast_switch_possible(const struct scmi_handle *handle,
        return dom->fc_info && dom->fc_info->level_set_addr;
 }
 
-static struct scmi_perf_ops perf_ops = {
+static const struct scmi_perf_ops perf_ops = {
        .limits_set = scmi_perf_limits_set,
        .limits_get = scmi_perf_limits_get,
        .level_set = scmi_perf_level_set,
@@ -890,9 +892,4 @@ static int scmi_perf_protocol_init(struct scmi_handle *handle)
        return 0;
 }
 
-static int __init scmi_perf_init(void)
-{
-       return scmi_protocol_register(SCMI_PROTOCOL_PERF,
-                                     &scmi_perf_protocol_init);
-}
-subsys_initcall(scmi_perf_init);
+DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_PERF, perf)
index 46f2136..1f37258 100644 (file)
@@ -184,7 +184,7 @@ static char *scmi_power_name_get(const struct scmi_handle *handle, u32 domain)
        return dom->name;
 }
 
-static struct scmi_power_ops power_ops = {
+static const struct scmi_power_ops power_ops = {
        .num_domains_get = scmi_power_num_domains_get,
        .name_get = scmi_power_name_get,
        .state_set = scmi_power_state_set,
@@ -301,9 +301,4 @@ static int scmi_power_protocol_init(struct scmi_handle *handle)
        return 0;
 }
 
-static int __init scmi_power_init(void)
-{
-       return scmi_protocol_register(SCMI_PROTOCOL_POWER,
-                                     &scmi_power_protocol_init);
-}
-subsys_initcall(scmi_power_init);
+DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_POWER, power)
index 3691baf..a981a22 100644 (file)
@@ -36,9 +36,7 @@ struct scmi_msg_reset_domain_reset {
 #define EXPLICIT_RESET_ASSERT  BIT(1)
 #define ASYNCHRONOUS_RESET     BIT(2)
        __le32 reset_state;
-#define ARCH_RESET_TYPE                BIT(31)
-#define COLD_RESET_STATE       BIT(0)
-#define ARCH_COLD_RESET                (ARCH_RESET_TYPE | COLD_RESET_STATE)
+#define ARCH_COLD_RESET                0
 };
 
 struct scmi_msg_reset_notify {
@@ -194,7 +192,7 @@ scmi_reset_domain_deassert(const struct scmi_handle *handle, u32 domain)
        return scmi_domain_reset(handle, domain, 0, ARCH_COLD_RESET);
 }
 
-static struct scmi_reset_ops reset_ops = {
+static const struct scmi_reset_ops reset_ops = {
        .num_domains_get = scmi_reset_num_domains_get,
        .name_get = scmi_reset_name_get,
        .latency_get = scmi_reset_latency_get,
@@ -313,9 +311,4 @@ static int scmi_reset_protocol_init(struct scmi_handle *handle)
        return 0;
 }
 
-static int __init scmi_reset_init(void)
-{
-       return scmi_protocol_register(SCMI_PROTOCOL_RESET,
-                                     &scmi_reset_protocol_init);
-}
-subsys_initcall(scmi_reset_init);
+DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_RESET, reset)
index 1af0ad3..b4232d6 100644 (file)
@@ -166,6 +166,8 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle,
                }
 
                desc_index += num_returned;
+
+               scmi_reset_rx_to_maxsz(handle, t);
                /*
                 * check for both returned and remaining to avoid infinite
                 * loop due to buggy firmware
@@ -275,7 +277,7 @@ static int scmi_sensor_count_get(const struct scmi_handle *handle)
        return si->num_sensors;
 }
 
-static struct scmi_sensor_ops sensor_ops = {
+static const struct scmi_sensor_ops sensor_ops = {
        .count_get = scmi_sensor_count_get,
        .info_get = scmi_sensor_info_get,
        .trip_point_config = scmi_sensor_trip_point_config,
@@ -365,9 +367,4 @@ static int scmi_sensors_protocol_init(struct scmi_handle *handle)
        return 0;
 }
 
-static int __init scmi_sensors_init(void)
-{
-       return scmi_protocol_register(SCMI_PROTOCOL_SENSOR,
-                                     &scmi_sensors_protocol_init);
-}
-subsys_initcall(scmi_sensors_init);
+DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_SENSOR, sensors)
index a1537d1..82a82a5 100644 (file)
@@ -137,7 +137,7 @@ smc_poll_done(struct scmi_chan_info *cinfo, struct scmi_xfer *xfer)
        return shmem_poll_done(scmi_info->shmem, xfer);
 }
 
-static struct scmi_transport_ops scmi_smc_ops = {
+static const struct scmi_transport_ops scmi_smc_ops = {
        .chan_available = smc_chan_available,
        .chan_setup = smc_chan_setup,
        .chan_free = smc_chan_free,
@@ -149,6 +149,6 @@ static struct scmi_transport_ops scmi_smc_ops = {
 const struct scmi_desc scmi_smc_desc = {
        .ops = &scmi_smc_ops,
        .max_rx_timeout_ms = 30,
-       .max_msg = 1,
+       .max_msg = 20,
        .max_msg_size = 128,
 };
diff --git a/drivers/firmware/arm_scmi/system.c b/drivers/firmware/arm_scmi/system.c
new file mode 100644 (file)
index 0000000..283e12d
--- /dev/null
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * System Control and Management Interface (SCMI) System Power Protocol
+ *
+ * Copyright (C) 2020 ARM Ltd.
+ */
+
+#define pr_fmt(fmt) "SCMI Notifications SYSTEM - " fmt
+
+#include <linux/scmi_protocol.h>
+
+#include "common.h"
+#include "notify.h"
+
+#define SCMI_SYSTEM_NUM_SOURCES                1
+
+enum scmi_system_protocol_cmd {
+       SYSTEM_POWER_STATE_NOTIFY = 0x5,
+};
+
+struct scmi_system_power_state_notify {
+       __le32 notify_enable;
+};
+
+struct scmi_system_power_state_notifier_payld {
+       __le32 agent_id;
+       __le32 flags;
+       __le32 system_state;
+};
+
+struct scmi_system_info {
+       u32 version;
+};
+
+static int scmi_system_request_notify(const struct scmi_handle *handle,
+                                     bool enable)
+{
+       int ret;
+       struct scmi_xfer *t;
+       struct scmi_system_power_state_notify *notify;
+
+       ret = scmi_xfer_get_init(handle, SYSTEM_POWER_STATE_NOTIFY,
+                                SCMI_PROTOCOL_SYSTEM, sizeof(*notify), 0, &t);
+       if (ret)
+               return ret;
+
+       notify = t->tx.buf;
+       notify->notify_enable = enable ? cpu_to_le32(BIT(0)) : 0;
+
+       ret = scmi_do_xfer(handle, t);
+
+       scmi_xfer_put(handle, t);
+       return ret;
+}
+
+static int scmi_system_set_notify_enabled(const struct scmi_handle *handle,
+                                         u8 evt_id, u32 src_id, bool enable)
+{
+       int ret;
+
+       ret = scmi_system_request_notify(handle, enable);
+       if (ret)
+               pr_debug("FAIL_ENABLE - evt[%X] - ret:%d\n", evt_id, ret);
+
+       return ret;
+}
+
+static void *scmi_system_fill_custom_report(const struct scmi_handle *handle,
+                                           u8 evt_id, ktime_t timestamp,
+                                           const void *payld, size_t payld_sz,
+                                           void *report, u32 *src_id)
+{
+       const struct scmi_system_power_state_notifier_payld *p = payld;
+       struct scmi_system_power_state_notifier_report *r = report;
+
+       if (evt_id != SCMI_EVENT_SYSTEM_POWER_STATE_NOTIFIER ||
+           sizeof(*p) != payld_sz)
+               return NULL;
+
+       r->timestamp = timestamp;
+       r->agent_id = le32_to_cpu(p->agent_id);
+       r->flags = le32_to_cpu(p->flags);
+       r->system_state = le32_to_cpu(p->system_state);
+       *src_id = 0;
+
+       return r;
+}
+
+static const struct scmi_event system_events[] = {
+       {
+               .id = SCMI_EVENT_SYSTEM_POWER_STATE_NOTIFIER,
+               .max_payld_sz =
+                       sizeof(struct scmi_system_power_state_notifier_payld),
+               .max_report_sz =
+                       sizeof(struct scmi_system_power_state_notifier_report),
+       },
+};
+
+static const struct scmi_event_ops system_event_ops = {
+       .set_notify_enabled = scmi_system_set_notify_enabled,
+       .fill_custom_report = scmi_system_fill_custom_report,
+};
+
+static int scmi_system_protocol_init(struct scmi_handle *handle)
+{
+       u32 version;
+       struct scmi_system_info *pinfo;
+
+       scmi_version_get(handle, SCMI_PROTOCOL_SYSTEM, &version);
+
+       dev_dbg(handle->dev, "System Power Version %d.%d\n",
+               PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version));
+
+       pinfo = devm_kzalloc(handle->dev, sizeof(*pinfo), GFP_KERNEL);
+       if (!pinfo)
+               return -ENOMEM;
+
+       scmi_register_protocol_events(handle,
+                                     SCMI_PROTOCOL_SYSTEM, SCMI_PROTO_QUEUE_SZ,
+                                     &system_event_ops,
+                                     system_events,
+                                     ARRAY_SIZE(system_events),
+                                     SCMI_SYSTEM_NUM_SOURCES);
+
+       pinfo->version = version;
+       handle->system_priv = pinfo;
+
+       return 0;
+}
+
+DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_SYSTEM, system)
index af3d6d9..946eea2 100644 (file)
@@ -46,6 +46,7 @@
 
 #include <dt-bindings/firmware/imx/rsrc.h>
 #include <linux/firmware/imx/sci.h>
+#include <linux/firmware/imx/svc/rm.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -256,6 +257,9 @@ imx_scu_add_pm_domain(struct device *dev, int idx,
        struct imx_sc_pm_domain *sc_pd;
        int ret;
 
+       if (!imx_sc_rm_is_resource_owned(pm_ipc_handle, pd_ranges->rsrc + idx))
+               return NULL;
+
        sc_pd = devm_kzalloc(dev, sizeof(*sc_pd), GFP_KERNEL);
        if (!sc_pd)
                return ERR_PTR(-ENOMEM);
index 4e80921..00c88b8 100644 (file)
@@ -24,8 +24,10 @@ enum arm_smccc_conduit arm_smccc_1_1_get_conduit(void)
 
        return smccc_conduit;
 }
+EXPORT_SYMBOL_GPL(arm_smccc_1_1_get_conduit);
 
 u32 arm_smccc_get_version(void)
 {
        return smccc_version;
 }
+EXPORT_SYMBOL_GPL(arm_smccc_get_version);
index 4d93d89..0742a90 100644 (file)
@@ -856,7 +856,8 @@ static const struct tegra_bpmp_soc tegra210_soc = {
 
 static const struct of_device_id tegra_bpmp_match[] = {
 #if IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || \
-    IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC)
+    IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
+    IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC)
        { .compatible = "nvidia,tegra186-bpmp", .data = &tegra186_soc },
 #endif
 #if IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC)
index 722af9e..896f53e 100644 (file)
@@ -1106,7 +1106,8 @@ static int ti_sci_cmd_get_clock(const struct ti_sci_handle *handle, u32 dev_id,
 static int ti_sci_cmd_idle_clock(const struct ti_sci_handle *handle,
                                 u32 dev_id, u32 clk_id)
 {
-       return ti_sci_set_clock_state(handle, dev_id, clk_id, 0,
+       return ti_sci_set_clock_state(handle, dev_id, clk_id,
+                                     MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE,
                                      MSG_CLOCK_SW_STATE_UNREQ);
 }
 
@@ -1125,7 +1126,8 @@ static int ti_sci_cmd_idle_clock(const struct ti_sci_handle *handle,
 static int ti_sci_cmd_put_clock(const struct ti_sci_handle *handle,
                                u32 dev_id, u32 clk_id)
 {
-       return ti_sci_set_clock_state(handle, dev_id, clk_id, 0,
+       return ti_sci_set_clock_state(handle, dev_id, clk_id,
+                                     MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE,
                                      MSG_CLOCK_SW_STATE_AUTO);
 }
 
index e8b4175..e3783f5 100644 (file)
@@ -80,6 +80,7 @@ MODULE_FIRMWARE("amdgpu/renoir_gpu_info.bin");
 MODULE_FIRMWARE("amdgpu/navi10_gpu_info.bin");
 MODULE_FIRMWARE("amdgpu/navi14_gpu_info.bin");
 MODULE_FIRMWARE("amdgpu/navi12_gpu_info.bin");
+MODULE_FIRMWARE("amdgpu/green_sardine_gpu_info.bin");
 
 #define AMDGPU_RESUME_MS               2000
 
@@ -239,9 +240,11 @@ bool amdgpu_device_supports_baco(struct drm_device *dev)
        return amdgpu_asic_supports_baco(adev);
 }
 
+/*
+ * VRAM access helper functions
+ */
+
 /**
- * VRAM access helper functions.
- *
  * amdgpu_device_vram_access - read/write a buffer in vram
  *
  * @adev: amdgpu_device pointer
@@ -705,7 +708,7 @@ void amdgpu_device_indirect_wreg64(struct amdgpu_device *adev,
 /**
  * amdgpu_invalid_rreg - dummy reg read function
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @reg: offset of register
  *
  * Dummy register read function.  Used for register blocks
@@ -722,7 +725,7 @@ static uint32_t amdgpu_invalid_rreg(struct amdgpu_device *adev, uint32_t reg)
 /**
  * amdgpu_invalid_wreg - dummy reg write function
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @reg: offset of register
  * @v: value to write to the register
  *
@@ -739,7 +742,7 @@ static void amdgpu_invalid_wreg(struct amdgpu_device *adev, uint32_t reg, uint32
 /**
  * amdgpu_invalid_rreg64 - dummy 64 bit reg read function
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @reg: offset of register
  *
  * Dummy register read function.  Used for register blocks
@@ -756,7 +759,7 @@ static uint64_t amdgpu_invalid_rreg64(struct amdgpu_device *adev, uint32_t reg)
 /**
  * amdgpu_invalid_wreg64 - dummy reg write function
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @reg: offset of register
  * @v: value to write to the register
  *
@@ -773,7 +776,7 @@ static void amdgpu_invalid_wreg64(struct amdgpu_device *adev, uint32_t reg, uint
 /**
  * amdgpu_block_invalid_rreg - dummy reg read function
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @block: offset of instance
  * @reg: offset of register
  *
@@ -793,7 +796,7 @@ static uint32_t amdgpu_block_invalid_rreg(struct amdgpu_device *adev,
 /**
  * amdgpu_block_invalid_wreg - dummy reg write function
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @block: offset of instance
  * @reg: offset of register
  * @v: value to write to the register
@@ -813,7 +816,7 @@ static void amdgpu_block_invalid_wreg(struct amdgpu_device *adev,
 /**
  * amdgpu_device_asic_init - Wrapper for atom asic_init
  *
- * @dev: drm_device pointer
+ * @adev: amdgpu_device pointer
  *
  * Does any asic specific work and then calls atom asic init.
  */
@@ -827,7 +830,7 @@ static int amdgpu_device_asic_init(struct amdgpu_device *adev)
 /**
  * amdgpu_device_vram_scratch_init - allocate the VRAM scratch page
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  *
  * Allocates a scratch page of VRAM for use by various things in the
  * driver.
@@ -844,7 +847,7 @@ static int amdgpu_device_vram_scratch_init(struct amdgpu_device *adev)
 /**
  * amdgpu_device_vram_scratch_fini - Free the VRAM scratch page
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  *
  * Frees the VRAM scratch page.
  */
@@ -1803,7 +1806,10 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
                chip_name = "arcturus";
                break;
        case CHIP_RENOIR:
-               chip_name = "renoir";
+               if (adev->apu_flags & AMD_APU_IS_RENOIR)
+                       chip_name = "renoir";
+               else
+                       chip_name = "green_sardine";
                break;
        case CHIP_NAVI10:
                chip_name = "navi10";
@@ -3011,7 +3017,7 @@ bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type)
 /**
  * amdgpu_device_has_dc_support - check if dc is supported
  *
- * @adev: amdgpu_device_pointer
+ * @adev: amdgpu_device pointer
  *
  * Returns true for supported, false for not supported
  */
@@ -4045,7 +4051,7 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
 /**
  * amdgpu_device_reset_sriov - reset ASIC for SR-IOV vf
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @from_hypervisor: request from hypervisor
  *
  * do VF FLR and reinitialize Asic
@@ -4100,7 +4106,7 @@ error:
 /**
  * amdgpu_device_has_job_running - check if there is any job in mirror list
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  *
  * check if there is any job in mirror list
  */
@@ -4128,7 +4134,7 @@ bool amdgpu_device_has_job_running(struct amdgpu_device *adev)
 /**
  * amdgpu_device_should_recover_gpu - check if we should try GPU recovery
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  *
  * Check amdgpu_gpu_recovery and SRIOV status to see if we should try to recover
  * a hung GPU.
@@ -4477,7 +4483,7 @@ static int amdgpu_device_suspend_display_audio(struct amdgpu_device *adev)
 /**
  * amdgpu_device_gpu_recover - reset the asic and recover scheduler
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @job: which job trigger hang
  *
  * Attempt to reset the GPU if it has hung (all asics).
@@ -4497,7 +4503,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
        bool need_emergency_restart = false;
        bool audio_suspended = false;
 
-       /**
+       /*
         * Special case: RAS triggered and full reset isn't supported
         */
        need_emergency_restart = amdgpu_ras_need_emergency_restart(adev);
@@ -4625,7 +4631,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 retry: /* Rest of adevs pre asic reset from XGMI hive. */
        list_for_each_entry(tmp_adev, device_list_handle, gmc.xgmi.head) {
                r = amdgpu_device_pre_asic_reset(tmp_adev,
-                                                NULL,
+                                                (tmp_adev == adev) ? job : NULL,
                                                 &need_full_reset);
                /*TODO Should we stop ?*/
                if (r) {
index c241317..42d9748 100644 (file)
@@ -1066,6 +1066,7 @@ static const struct pci_device_id pciidlist[] = {
        {0x1002, 0x7319, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
        {0x1002, 0x731A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
        {0x1002, 0x731B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
+       {0x1002, 0x731E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
        {0x1002, 0x731F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
        /* Navi14 */
        {0x1002, 0x7340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14},
index aa7f230..7e8265d 100644 (file)
@@ -596,6 +596,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
        struct ww_acquire_ctx ticket;
        struct list_head list, duplicates;
        uint64_t va_flags;
+       uint64_t vm_size;
        int r = 0;
 
        if (args->va_address < AMDGPU_VA_RESERVED_SIZE) {
@@ -616,6 +617,15 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
 
        args->va_address &= AMDGPU_GMC_HOLE_MASK;
 
+       vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
+       vm_size -= AMDGPU_VA_RESERVED_SIZE;
+       if (args->va_address + args->map_size > vm_size) {
+               dev_dbg(&dev->pdev->dev,
+                       "va_address 0x%llx is in top reserved area 0x%llx\n",
+                       args->va_address + args->map_size, vm_size);
+               return -EINVAL;
+       }
+
        if ((args->flags & ~valid_flags) && (args->flags & ~prt_flags)) {
                dev_dbg(&dev->pdev->dev, "invalid flags combination 0x%08X\n",
                        args->flags);
index f203e4a..731f3aa 100644 (file)
@@ -81,8 +81,8 @@ static const struct ttm_resource_manager_func amdgpu_gtt_mgr_func;
 /**
  * amdgpu_gtt_mgr_init - init GTT manager and DRM MM
  *
- * @man: TTM memory type manager
- * @p_size: maximum size of GTT
+ * @adev: amdgpu_device pointer
+ * @gtt_size: maximum size of GTT
  *
  * Allocate and initialize the GTT manager.
  */
@@ -123,7 +123,7 @@ int amdgpu_gtt_mgr_init(struct amdgpu_device *adev, uint64_t gtt_size)
 /**
  * amdgpu_gtt_mgr_fini - free and destroy GTT manager
  *
- * @man: TTM memory type manager
+ * @adev: amdgpu_device pointer
  *
  * Destroy and free the GTT manager, returns -EBUSY if ranges are still
  * allocated inside it.
index 18be544..a6dbe4b 100644 (file)
@@ -208,7 +208,8 @@ static int psp_sw_fini(void *handle)
                adev->psp.ta_fw = NULL;
        }
 
-       if (adev->asic_type == CHIP_NAVI10)
+       if (adev->asic_type == CHIP_NAVI10 ||
+           adev->asic_type == CHIP_SIENNA_CICHLID)
                psp_sysfs_fini(adev);
 
        return 0;
@@ -1750,6 +1751,12 @@ static int psp_get_fw_type(struct amdgpu_firmware_info *ucode,
        case AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM:
                *type = GFX_FW_TYPE_RLC_RESTORE_LIST_SRM_MEM;
                break;
+       case AMDGPU_UCODE_ID_RLC_IRAM:
+               *type = GFX_FW_TYPE_RLC_IRAM;
+               break;
+       case AMDGPU_UCODE_ID_RLC_DRAM:
+               *type = GFX_FW_TYPE_RLC_DRAM_BOOT;
+               break;
        case AMDGPU_UCODE_ID_SMC:
                *type = GFX_FW_TYPE_SMU;
                break;
@@ -2517,6 +2524,7 @@ int parse_ta_bin_descriptor(struct psp_context *psp,
                psp->asd_feature_version   = le32_to_cpu(desc->fw_version);
                psp->asd_ucode_size        = le32_to_cpu(desc->size_bytes);
                psp->asd_start_addr        = ucode_start_addr;
+               psp->asd_fw                = psp->ta_fw;
                break;
        case TA_FW_TYPE_PSP_XGMI:
                psp->ta_xgmi_ucode_version = le32_to_cpu(desc->fw_version);
index 8bf6a7c..4e36551 100644 (file)
@@ -1986,7 +1986,8 @@ static int amdgpu_ras_check_asic_type(struct amdgpu_device *adev)
 {
        if (adev->asic_type != CHIP_VEGA10 &&
                adev->asic_type != CHIP_VEGA20 &&
-               adev->asic_type != CHIP_ARCTURUS)
+               adev->asic_type != CHIP_ARCTURUS &&
+               adev->asic_type != CHIP_SIENNA_CICHLID)
                return 1;
        else
                return 0;
@@ -2030,7 +2031,6 @@ static void amdgpu_ras_check_supported(struct amdgpu_device *adev,
 
        *supported = amdgpu_ras_enable == 0 ?
                        0 : *hw_supported & amdgpu_ras_mask;
-
        adev->ras_features = *supported;
 }
 
index 60bb3e8..aeaaae7 100644 (file)
@@ -168,12 +168,16 @@ struct amdgpu_rlc {
        u32 save_restore_list_cntl_size_bytes;
        u32 save_restore_list_gpm_size_bytes;
        u32 save_restore_list_srm_size_bytes;
+       u32 rlc_iram_ucode_size_bytes;
+       u32 rlc_dram_ucode_size_bytes;
 
        u32 *register_list_format;
        u32 *register_restore;
        u8 *save_restore_list_cntl;
        u8 *save_restore_list_gpm;
        u8 *save_restore_list_srm;
+       u8 *rlc_iram_ucode;
+       u8 *rlc_dram_ucode;
 
        bool is_rlc_v2_1;
 
index 55fe19a..b313ce4 100644 (file)
@@ -500,6 +500,8 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev,
             ucode->ucode_id != AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL &&
             ucode->ucode_id != AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM &&
             ucode->ucode_id != AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM &&
+            ucode->ucode_id != AMDGPU_UCODE_ID_RLC_IRAM &&
+            ucode->ucode_id != AMDGPU_UCODE_ID_RLC_DRAM &&
                 ucode->ucode_id != AMDGPU_UCODE_ID_DMCU_ERAM &&
                 ucode->ucode_id != AMDGPU_UCODE_ID_DMCU_INTV &&
                 ucode->ucode_id != AMDGPU_UCODE_ID_DMCUB)) {
@@ -556,6 +558,14 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev,
                ucode->ucode_size = adev->gfx.rlc.save_restore_list_srm_size_bytes;
                memcpy(ucode->kaddr, adev->gfx.rlc.save_restore_list_srm,
                       ucode->ucode_size);
+       } else if (ucode->ucode_id == AMDGPU_UCODE_ID_RLC_IRAM) {
+               ucode->ucode_size = adev->gfx.rlc.rlc_iram_ucode_size_bytes;
+               memcpy(ucode->kaddr, adev->gfx.rlc.rlc_iram_ucode,
+                      ucode->ucode_size);
+       } else if (ucode->ucode_id == AMDGPU_UCODE_ID_RLC_DRAM) {
+               ucode->ucode_size = adev->gfx.rlc.rlc_dram_ucode_size_bytes;
+               memcpy(ucode->kaddr, adev->gfx.rlc.rlc_dram_ucode,
+                      ucode->ucode_size);
        } else if (ucode->ucode_id == AMDGPU_UCODE_ID_CP_MES) {
                ucode->ucode_size = le32_to_cpu(mes_hdr->mes_ucode_size_bytes);
                memcpy(ucode->kaddr, (void *)((uint8_t *)adev->mes.fw->data +
index 3c23c62..0e43b46 100644 (file)
@@ -222,6 +222,15 @@ struct rlc_firmware_header_v2_1 {
        uint32_t save_restore_list_srm_offset_bytes;
 };
 
+/* version_major=2, version_minor=1 */
+struct rlc_firmware_header_v2_2 {
+       struct rlc_firmware_header_v2_1 v2_1;
+       uint32_t rlc_iram_ucode_size_bytes;
+       uint32_t rlc_iram_ucode_offset_bytes;
+       uint32_t rlc_dram_ucode_size_bytes;
+       uint32_t rlc_dram_ucode_offset_bytes;
+};
+
 /* version_major=1, version_minor=0 */
 struct sdma_firmware_header_v1_0 {
        struct common_firmware_header header;
@@ -339,6 +348,8 @@ enum AMDGPU_UCODE_ID {
        AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL,
        AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM,
        AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM,
+       AMDGPU_UCODE_ID_RLC_IRAM,
+       AMDGPU_UCODE_ID_RLC_DRAM,
        AMDGPU_UCODE_ID_RLC_G,
        AMDGPU_UCODE_ID_STORAGE,
        AMDGPU_UCODE_ID_SMC,
index f3b7287..a563328 100644 (file)
@@ -39,6 +39,7 @@
 #define FIRMWARE_RAVEN2                "amdgpu/raven2_vcn.bin"
 #define FIRMWARE_ARCTURUS      "amdgpu/arcturus_vcn.bin"
 #define FIRMWARE_RENOIR        "amdgpu/renoir_vcn.bin"
+#define FIRMWARE_GREEN_SARDINE         "amdgpu/green_sardine_vcn.bin"
 #define FIRMWARE_NAVI10        "amdgpu/navi10_vcn.bin"
 #define FIRMWARE_NAVI14        "amdgpu/navi14_vcn.bin"
 #define FIRMWARE_NAVI12        "amdgpu/navi12_vcn.bin"
@@ -50,6 +51,7 @@ MODULE_FIRMWARE(FIRMWARE_PICASSO);
 MODULE_FIRMWARE(FIRMWARE_RAVEN2);
 MODULE_FIRMWARE(FIRMWARE_ARCTURUS);
 MODULE_FIRMWARE(FIRMWARE_RENOIR);
+MODULE_FIRMWARE(FIRMWARE_GREEN_SARDINE);
 MODULE_FIRMWARE(FIRMWARE_NAVI10);
 MODULE_FIRMWARE(FIRMWARE_NAVI14);
 MODULE_FIRMWARE(FIRMWARE_NAVI12);
@@ -89,7 +91,11 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
                        adev->vcn.indirect_sram = true;
                break;
        case CHIP_RENOIR:
-               fw_name = FIRMWARE_RENOIR;
+               if (adev->apu_flags & AMD_APU_IS_RENOIR)
+                       fw_name = FIRMWARE_RENOIR;
+               else
+                       fw_name = FIRMWARE_GREEN_SARDINE;
+
                if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
                    (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
                        adev->vcn.indirect_sram = true;
index c6abb16..58c83a7 100644 (file)
@@ -112,8 +112,8 @@ struct amdgpu_bo_list_entry;
 #define AMDGPU_MMHUB_0                         1
 #define AMDGPU_MMHUB_1                         2
 
-/* hardcode that limit for now */
-#define AMDGPU_VA_RESERVED_SIZE                        (1ULL << 20)
+/* Reserve 2MB at top/bottom of address space for kernel use */
+#define AMDGPU_VA_RESERVED_SIZE                        (2ULL << 20)
 
 /* max vmids dedicated for process */
 #define AMDGPU_VM_MAX_RESERVED_VMID    1
index 01c1171..0c6b7c5 100644 (file)
@@ -168,8 +168,7 @@ static const struct ttm_resource_manager_func amdgpu_vram_mgr_func;
 /**
  * amdgpu_vram_mgr_init - init VRAM manager and DRM MM
  *
- * @man: TTM memory type manager
- * @p_size: maximum size of VRAM
+ * @adev: amdgpu_device pointer
  *
  * Allocate and initialize the VRAM manager.
  */
@@ -199,7 +198,7 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev)
 /**
  * amdgpu_vram_mgr_fini - free and destroy VRAM manager
  *
- * @man: TTM memory type manager
+ * @adev: amdgpu_device pointer
  *
  * Destroy and free the VRAM manager, returns -EBUSY if ranges are still
  * allocated inside it.
@@ -229,7 +228,7 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev)
 /**
  * amdgpu_vram_mgr_vis_size - Calculate visible node size
  *
- * @adev: amdgpu device structure
+ * @adev: amdgpu_device pointer
  * @node: MM node structure
  *
  * Calculate how many bytes of the MM node are inside visible VRAM
index 03ff8bd..5442df0 100644 (file)
@@ -1336,11 +1336,13 @@ cik_asic_reset_method(struct amdgpu_device *adev)
 
        switch (adev->asic_type) {
        case CHIP_BONAIRE:
-       case CHIP_HAWAII:
                /* disable baco reset until it works */
                /* smu7_asic_get_baco_capability(adev, &baco_reset); */
                baco_reset = false;
                break;
+       case CHIP_HAWAII:
+               baco_reset = cik_asic_supports_baco(adev);
+               break;
        default:
                baco_reset = false;
                break;
index 20f1088..a3c3fe9 100644 (file)
@@ -1071,22 +1071,19 @@ static int cik_sdma_soft_reset(void *handle)
 {
        u32 srbm_soft_reset = 0;
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-       u32 tmp = RREG32(mmSRBM_STATUS2);
+       u32 tmp;
 
-       if (tmp & SRBM_STATUS2__SDMA_BUSY_MASK) {
-               /* sdma0 */
-               tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
-               tmp |= SDMA0_F32_CNTL__HALT_MASK;
-               WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
-               srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
-       }
-       if (tmp & SRBM_STATUS2__SDMA1_BUSY_MASK) {
-               /* sdma1 */
-               tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
-               tmp |= SDMA0_F32_CNTL__HALT_MASK;
-               WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
-               srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
-       }
+       /* sdma0 */
+       tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET);
+       tmp |= SDMA0_F32_CNTL__HALT_MASK;
+       WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp);
+       srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK;
+
+       /* sdma1 */
+       tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET);
+       tmp |= SDMA0_F32_CNTL__HALT_MASK;
+       WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp);
+       srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK;
 
        if (srbm_soft_reset) {
                tmp = RREG32(mmSRBM_SOFT_RESET);
index 9792ec7..3579565 100644 (file)
 #define mmCP_HYP_ME_UCODE_DATA                 0x5817
 #define mmCP_HYP_ME_UCODE_DATA_BASE_IDX                1
 
+//CC_GC_SA_UNIT_DISABLE
+#define mmCC_GC_SA_UNIT_DISABLE                 0x0fe9
+#define mmCC_GC_SA_UNIT_DISABLE_BASE_IDX        0
+#define CC_GC_SA_UNIT_DISABLE__SA_DISABLE__SHIFT       0x8
+#define CC_GC_SA_UNIT_DISABLE__SA_DISABLE_MASK         0x0000FF00L
+//GC_USER_SA_UNIT_DISABLE
+#define mmGC_USER_SA_UNIT_DISABLE               0x0fea
+#define mmGC_USER_SA_UNIT_DISABLE_BASE_IDX      0
+#define GC_USER_SA_UNIT_DISABLE__SA_DISABLE__SHIFT     0x8
+#define GC_USER_SA_UNIT_DISABLE__SA_DISABLE_MASK       0x0000FF00L
+//PA_SC_ENHANCE_3
+#define mmPA_SC_ENHANCE_3                       0x1085
+#define mmPA_SC_ENHANCE_3_BASE_IDX              0
+#define PA_SC_ENHANCE_3__FORCE_PBB_WORKLOAD_MODE_TO_ZERO__SHIFT 0x3
+#define PA_SC_ENHANCE_3__FORCE_PBB_WORKLOAD_MODE_TO_ZERO_MASK   0x00000008L
+
+#define mmCGTT_SPI_CS_CLK_CTRL                 0x507c
+#define mmCGTT_SPI_CS_CLK_CTRL_BASE_IDX         1
+
 MODULE_FIRMWARE("amdgpu/navi10_ce.bin");
 MODULE_FIRMWARE("amdgpu/navi10_pfp.bin");
 MODULE_FIRMWARE("amdgpu/navi10_me.bin");
@@ -3078,6 +3097,7 @@ static const struct soc15_reg_golden golden_settings_gc_rlc_spm_10_1_2_nv12[] =
 
 static const struct soc15_reg_golden golden_settings_gc_10_3[] =
 {
+       SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CS_CLK_CTRL, 0x78000000, 0x78000100),
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_PS_CLK_CTRL, 0xff7f0fff, 0x78000100),
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_RA0_CLK_CTRL, 0xff7f0fff, 0x30000100),
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_RA1_CLK_CTRL, 0xff7f0fff, 0x7e000100),
@@ -3091,6 +3111,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_3[] =
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_ADDR_MATCH_MASK, 0xffffffff, 0xffffffcf),
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_CM_CTRL1, 0xff8fff0f, 0x580f1008),
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmGL2C_CTRL3, 0xf7ffffff, 0x10f80988),
+       SOC15_REG_GOLDEN_VALUE(GC, 0, mmLDS_CONFIG,  0x00000020, 0x00000020),
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_CL_ENHANCE, 0xf17fffff, 0x01200007),
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_BINNER_TIMEOUT_COUNTER, 0xffffffff, 0x00000800),
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_ENHANCE_2, 0xffffffbf, 0x00000820),
@@ -3188,6 +3209,8 @@ static int gfx_v10_0_wait_for_rlc_autoload_complete(struct amdgpu_device *adev);
 static void gfx_v10_0_ring_emit_ce_meta(struct amdgpu_ring *ring, bool resume);
 static void gfx_v10_0_ring_emit_de_meta(struct amdgpu_ring *ring, bool resume);
 static void gfx_v10_0_ring_emit_frame_cntl(struct amdgpu_ring *ring, bool start, bool secure);
+static u32 gfx_v10_3_get_disabled_sa(struct amdgpu_device *adev);
+static void gfx_v10_3_program_pbb_mode(struct amdgpu_device *adev);
 
 static void gfx10_kiq_set_resources(struct amdgpu_ring *kiq_ring, uint64_t queue_mask)
 {
@@ -3586,6 +3609,17 @@ static void gfx_v10_0_init_rlc_ext_microcode(struct amdgpu_device *adev)
                        le32_to_cpu(rlc_hdr->reg_list_format_direct_reg_list_length);
 }
 
+static void gfx_v10_0_init_rlc_iram_dram_microcode(struct amdgpu_device *adev)
+{
+       const struct rlc_firmware_header_v2_2 *rlc_hdr;
+
+       rlc_hdr = (const struct rlc_firmware_header_v2_2 *)adev->gfx.rlc_fw->data;
+       adev->gfx.rlc.rlc_iram_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlc_iram_ucode_size_bytes);
+       adev->gfx.rlc.rlc_iram_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlc_iram_ucode_offset_bytes);
+       adev->gfx.rlc.rlc_dram_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlc_dram_ucode_size_bytes);
+       adev->gfx.rlc.rlc_dram_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlc_dram_ucode_offset_bytes);
+}
+
 static bool gfx_v10_0_navi10_gfxoff_should_enable(struct amdgpu_device *adev)
 {
        bool ret = false;
@@ -3701,8 +3735,6 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
                rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
                version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
                version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
-               if (version_major == 2 && version_minor == 1)
-                       adev->gfx.rlc.is_rlc_v2_1 = true;
 
                adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version);
                adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version);
@@ -3744,8 +3776,12 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
                for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
                        adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
 
-               if (adev->gfx.rlc.is_rlc_v2_1)
-                       gfx_v10_0_init_rlc_ext_microcode(adev);
+               if (version_major == 2) {
+                       if (version_minor >= 1)
+                               gfx_v10_0_init_rlc_ext_microcode(adev);
+                       if (version_minor == 2)
+                               gfx_v10_0_init_rlc_iram_dram_microcode(adev);
+               }
        }
 
        snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", chip_name, wks);
@@ -3806,8 +3842,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
                        adev->firmware.fw_size +=
                                ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
                }
-               if (adev->gfx.rlc.is_rlc_v2_1 &&
-                   adev->gfx.rlc.save_restore_list_cntl_size_bytes &&
+               if (adev->gfx.rlc.save_restore_list_cntl_size_bytes &&
                    adev->gfx.rlc.save_restore_list_gpm_size_bytes &&
                    adev->gfx.rlc.save_restore_list_srm_size_bytes) {
                        info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL];
@@ -3827,6 +3862,21 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
                        info->fw = adev->gfx.rlc_fw;
                        adev->firmware.fw_size +=
                                ALIGN(adev->gfx.rlc.save_restore_list_srm_size_bytes, PAGE_SIZE);
+
+                       if (adev->gfx.rlc.rlc_iram_ucode_size_bytes &&
+                           adev->gfx.rlc.rlc_dram_ucode_size_bytes) {
+                               info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_IRAM];
+                               info->ucode_id = AMDGPU_UCODE_ID_RLC_IRAM;
+                               info->fw = adev->gfx.rlc_fw;
+                               adev->firmware.fw_size +=
+                                       ALIGN(adev->gfx.rlc.rlc_iram_ucode_size_bytes, PAGE_SIZE);
+
+                               info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_DRAM];
+                               info->ucode_id = AMDGPU_UCODE_ID_RLC_DRAM;
+                               info->fw = adev->gfx.rlc_fw;
+                               adev->firmware.fw_size +=
+                                       ALIGN(adev->gfx.rlc.rlc_dram_ucode_size_bytes, PAGE_SIZE);
+                       }
                }
 
                info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC1];
@@ -4536,12 +4586,17 @@ static void gfx_v10_0_setup_rb(struct amdgpu_device *adev)
        int i, j;
        u32 data;
        u32 active_rbs = 0;
+       u32 bitmap;
        u32 rb_bitmap_width_per_sh = adev->gfx.config.max_backends_per_se /
                                        adev->gfx.config.max_sh_per_se;
 
        mutex_lock(&adev->grbm_idx_mutex);
        for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
                for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
+                       bitmap = i * adev->gfx.config.max_sh_per_se + j;
+                       if ((adev->asic_type == CHIP_SIENNA_CICHLID) &&
+                           ((gfx_v10_3_get_disabled_sa(adev) >> bitmap) & 1))
+                               continue;
                        gfx_v10_0_select_se_sh(adev, i, j, 0xffffffff);
                        data = gfx_v10_0_get_rb_active_bitmap(adev);
                        active_rbs |= data << ((i * adev->gfx.config.max_sh_per_se + j) *
@@ -6950,6 +7005,9 @@ static int gfx_v10_0_hw_init(void *handle)
        if (r)
                return r;
 
+       if (adev->asic_type == CHIP_SIENNA_CICHLID)
+               gfx_v10_3_program_pbb_mode(adev);
+
        return r;
 }
 
@@ -8763,6 +8821,10 @@ static int gfx_v10_0_get_cu_info(struct amdgpu_device *adev,
        mutex_lock(&adev->grbm_idx_mutex);
        for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
                for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
+                       bitmap = i * adev->gfx.config.max_sh_per_se + j;
+                       if ((adev->asic_type == CHIP_SIENNA_CICHLID) &&
+                           ((gfx_v10_3_get_disabled_sa(adev) >> bitmap) & 1))
+                               continue;
                        mask = 1;
                        ao_bitmap = 0;
                        counter = 0;
@@ -8797,6 +8859,47 @@ static int gfx_v10_0_get_cu_info(struct amdgpu_device *adev,
        return 0;
 }
 
+static u32 gfx_v10_3_get_disabled_sa(struct amdgpu_device *adev)
+{
+       uint32_t efuse_setting, vbios_setting, disabled_sa, max_sa_mask;
+
+       efuse_setting = RREG32_SOC15(GC, 0, mmCC_GC_SA_UNIT_DISABLE);
+       efuse_setting &= CC_GC_SA_UNIT_DISABLE__SA_DISABLE_MASK;
+       efuse_setting >>= CC_GC_SA_UNIT_DISABLE__SA_DISABLE__SHIFT;
+
+       vbios_setting = RREG32_SOC15(GC, 0, mmGC_USER_SA_UNIT_DISABLE);
+       vbios_setting &= GC_USER_SA_UNIT_DISABLE__SA_DISABLE_MASK;
+       vbios_setting >>= GC_USER_SA_UNIT_DISABLE__SA_DISABLE__SHIFT;
+
+       max_sa_mask = amdgpu_gfx_create_bitmask(adev->gfx.config.max_sh_per_se *
+                                               adev->gfx.config.max_shader_engines);
+       disabled_sa = efuse_setting | vbios_setting;
+       disabled_sa &= max_sa_mask;
+
+       return disabled_sa;
+}
+
+static void gfx_v10_3_program_pbb_mode(struct amdgpu_device *adev)
+{
+       uint32_t max_sa_per_se, max_sa_per_se_mask, max_shader_engines;
+       uint32_t disabled_sa_mask, se_index, disabled_sa_per_se;
+
+       disabled_sa_mask = gfx_v10_3_get_disabled_sa(adev);
+
+       max_sa_per_se = adev->gfx.config.max_sh_per_se;
+       max_sa_per_se_mask = (1 << max_sa_per_se) - 1;
+       max_shader_engines = adev->gfx.config.max_shader_engines;
+
+       for (se_index = 0; max_shader_engines > se_index; se_index++) {
+               disabled_sa_per_se = disabled_sa_mask >> (se_index * max_sa_per_se);
+               disabled_sa_per_se &= max_sa_per_se_mask;
+               if (disabled_sa_per_se == max_sa_per_se_mask) {
+                       WREG32_FIELD15(GC, 0, PA_SC_ENHANCE_3, FORCE_PBB_WORKLOAD_MODE_TO_ZERO, 1);
+                       break;
+               }
+       }
+}
+
 const struct amdgpu_ip_block_version gfx_v10_0_ip_block =
 {
        .type = AMD_IP_BLOCK_TYPE_GFX,
index 6959aeb..0d8e203 100644 (file)
@@ -117,6 +117,13 @@ MODULE_FIRMWARE("amdgpu/renoir_mec.bin");
 MODULE_FIRMWARE("amdgpu/renoir_mec2.bin");
 MODULE_FIRMWARE("amdgpu/renoir_rlc.bin");
 
+MODULE_FIRMWARE("amdgpu/green_sardine_ce.bin");
+MODULE_FIRMWARE("amdgpu/green_sardine_pfp.bin");
+MODULE_FIRMWARE("amdgpu/green_sardine_me.bin");
+MODULE_FIRMWARE("amdgpu/green_sardine_mec.bin");
+MODULE_FIRMWARE("amdgpu/green_sardine_mec2.bin");
+MODULE_FIRMWARE("amdgpu/green_sardine_rlc.bin");
+
 #define mmTCP_CHAN_STEER_0_ARCT                                                                0x0b03
 #define mmTCP_CHAN_STEER_0_ARCT_BASE_IDX                                                       0
 #define mmTCP_CHAN_STEER_1_ARCT                                                                0x0b04
@@ -1630,7 +1637,10 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
                chip_name = "arcturus";
                break;
        case CHIP_RENOIR:
-               chip_name = "renoir";
+               if (adev->apu_flags & AMD_APU_IS_RENOIR)
+                       chip_name = "renoir";
+               else
+                       chip_name = "green_sardine";
                break;
        default:
                BUG();
index 1ce741a..d5715c1 100644 (file)
@@ -455,6 +455,15 @@ void nv_set_virt_ops(struct amdgpu_device *adev)
        adev->virt.ops = &xgpu_nv_virt_ops;
 }
 
+static bool nv_is_headless_sku(struct pci_dev *pdev)
+{
+       if ((pdev->device == 0x731E &&
+           (pdev->revision == 0xC6 || pdev->revision == 0xC7)) ||
+           (pdev->device == 0x7340 && pdev->revision == 0xC9))
+               return true;
+       return false;
+}
+
 int nv_set_ip_blocks(struct amdgpu_device *adev)
 {
        int r;
@@ -483,7 +492,8 @@ int nv_set_ip_blocks(struct amdgpu_device *adev)
                if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
                        amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
 #if defined(CONFIG_DRM_AMD_DC)
-               else if (amdgpu_device_has_dc_support(adev))
+               else if (amdgpu_device_has_dc_support(adev) &&
+                        !nv_is_headless_sku(adev->pdev))
                        amdgpu_device_ip_block_add(adev, &dm_ip_block);
 #endif
                amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block);
@@ -491,7 +501,8 @@ int nv_set_ip_blocks(struct amdgpu_device *adev)
                if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT &&
                    !amdgpu_sriov_vf(adev))
                        amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
-               amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block);
+               if (!nv_is_headless_sku(adev->pdev))
+                       amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block);
                amdgpu_device_ip_block_add(adev, &jpeg_v2_0_ip_block);
                if (adev->enable_mes)
                        amdgpu_device_ip_block_add(adev, &mes_v10_1_ip_block);
index 1ef2f5b..4137dc7 100644 (file)
@@ -201,7 +201,7 @@ enum psp_gfx_fw_type {
        GFX_FW_TYPE_UVD1        = 23,   /* UVD1                     VG-20   */
        GFX_FW_TYPE_TOC         = 24,   /* TOC                      NV-10   */
        GFX_FW_TYPE_RLC_P                           = 25,   /* RLC P                    NV      */
-       GFX_FW_TYPE_RLX6                            = 26,   /* RLX6                     NV      */
+       GFX_FW_TYPE_RLC_IRAM                        = 26,   /* RLC_IRAM                 NV      */
        GFX_FW_TYPE_GLOBAL_TAP_DELAYS               = 27,   /* GLOBAL TAP DELAYS        NV      */
        GFX_FW_TYPE_SE0_TAP_DELAYS                  = 28,   /* SE0 TAP DELAYS           NV      */
        GFX_FW_TYPE_SE1_TAP_DELAYS                  = 29,   /* SE1 TAP DELAYS           NV      */
@@ -223,7 +223,7 @@ enum psp_gfx_fw_type {
        GFX_FW_TYPE_ACCUM_CTRL_RAM                  = 45,   /* ACCUM CTRL RAM           NV      */
        GFX_FW_TYPE_RLCP_CAM                        = 46,   /* RLCP CAM                 NV      */
        GFX_FW_TYPE_RLC_SPP_CAM_EXT                 = 47,   /* RLC SPP CAM EXT          NV      */
-       GFX_FW_TYPE_RLX6_DRAM_BOOT                  = 48,   /* RLX6 DRAM BOOT           NV      */
+       GFX_FW_TYPE_RLC_DRAM_BOOT                   = 48,   /* RLC DRAM BOOT            NV      */
        GFX_FW_TYPE_VCN0_RAM                        = 49,   /* VCN_RAM                  NV + RN */
        GFX_FW_TYPE_VCN1_RAM                        = 50,   /* VCN_RAM                  NV + RN */
        GFX_FW_TYPE_DMUB                            = 51,   /* DMUB                          RN */
index 7548931..dff5c15 100644 (file)
@@ -39,6 +39,7 @@
 
 MODULE_FIRMWARE("amdgpu/renoir_asd.bin");
 MODULE_FIRMWARE("amdgpu/renoir_ta.bin");
+MODULE_FIRMWARE("amdgpu/green_sardine_asd.bin");
 
 /* address block */
 #define smnMP1_FIRMWARE_FLAGS          0x3010024
@@ -54,7 +55,10 @@ static int psp_v12_0_init_microcode(struct psp_context *psp)
 
        switch (adev->asic_type) {
        case CHIP_RENOIR:
-               chip_name = "renoir";
+               if (adev->apu_flags & AMD_APU_IS_RENOIR)
+                       chip_name = "renoir";
+               else
+                       chip_name = "green_sardine";
                break;
        default:
                BUG();
index 86fb1ed..e82f49f 100644 (file)
@@ -69,6 +69,7 @@ MODULE_FIRMWARE("amdgpu/picasso_sdma.bin");
 MODULE_FIRMWARE("amdgpu/raven2_sdma.bin");
 MODULE_FIRMWARE("amdgpu/arcturus_sdma.bin");
 MODULE_FIRMWARE("amdgpu/renoir_sdma.bin");
+MODULE_FIRMWARE("amdgpu/green_sardine_sdma.bin");
 
 #define SDMA0_POWER_CNTL__ON_OFF_CONDITION_HOLD_TIME_MASK  0x000000F8L
 #define SDMA0_POWER_CNTL__ON_OFF_STATUS_DURATION_TIME_MASK 0xFC000000L
@@ -619,7 +620,10 @@ static int sdma_v4_0_init_microcode(struct amdgpu_device *adev)
                chip_name = "arcturus";
                break;
        case CHIP_RENOIR:
-               chip_name = "renoir";
+               if (adev->apu_flags & AMD_APU_IS_RENOIR)
+                       chip_name = "renoir";
+               else
+                       chip_name = "green_sardine";
                break;
        default:
                BUG();
index afcccc6..f57c5f5 100644 (file)
@@ -1195,8 +1195,7 @@ static int soc15_common_early_init(void *handle)
 
                        adev->pg_flags = AMD_PG_SUPPORT_SDMA |
                                AMD_PG_SUPPORT_MMHUB |
-                               AMD_PG_SUPPORT_VCN |
-                               AMD_PG_SUPPORT_VCN_DPG;
+                               AMD_PG_SUPPORT_VCN;
                } else {
                        adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
                                AMD_CG_SUPPORT_GFX_MGLS |
@@ -1243,7 +1242,15 @@ static int soc15_common_early_init(void *handle)
                break;
        case CHIP_RENOIR:
                adev->asic_funcs = &soc15_asic_funcs;
-               adev->apu_flags |= AMD_APU_IS_RENOIR;
+               if (adev->pdev->device == 0x1636)
+                       adev->apu_flags |= AMD_APU_IS_RENOIR;
+               else
+                       adev->apu_flags |= AMD_APU_IS_GREEN_SARDINE;
+
+               if (adev->apu_flags & AMD_APU_IS_RENOIR)
+                       adev->external_rev_id = adev->rev_id + 0x91;
+               else
+                       adev->external_rev_id = adev->rev_id + 0xa1;
                adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
                                 AMD_CG_SUPPORT_GFX_MGLS |
                                 AMD_CG_SUPPORT_GFX_3D_CGCG |
@@ -1268,7 +1275,6 @@ static int soc15_common_early_init(void *handle)
                                 AMD_PG_SUPPORT_VCN |
                                 AMD_PG_SUPPORT_JPEG |
                                 AMD_PG_SUPPORT_VCN_DPG;
-               adev->external_rev_id = adev->rev_id + 0x91;
                break;
        default:
                /* FIXME: not supported yet */
index 5e2254b..3de5e14 100644 (file)
@@ -798,10 +798,10 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size)
        }
 
        pcrat_image = kvmalloc(crat_table->length, GFP_KERNEL);
-       memcpy(pcrat_image, crat_table, crat_table->length);
        if (!pcrat_image)
                return -ENOMEM;
 
+       memcpy(pcrat_image, crat_table, crat_table->length);
        *crat_image = pcrat_image;
        *size = crat_table->length;
 
index 72e4d61..ad05933 100644 (file)
@@ -58,8 +58,9 @@ static int update_qpd_v10(struct device_queue_manager *dqm,
        /* check if sh_mem_config register already configured */
        if (qpd->sh_mem_config == 0) {
                qpd->sh_mem_config =
-                               SH_MEM_ALIGNMENT_MODE_UNALIGNED <<
-                                       SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT;
+                       (SH_MEM_ALIGNMENT_MODE_UNALIGNED <<
+                               SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) |
+                       (3 << SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT);
 #if 0
                /* TODO:
                 *    This shouldn't be an issue with Navi10.  Verify.
index f24abf4..60dfdd4 100644 (file)
@@ -42,6 +42,7 @@ config DRM_AMD_DC_SI
 config DEBUG_KERNEL_DC
        bool "Enable kgdb break in DC"
        depends on DRM_AMD_DC
+       depends on KGDB
        help
          Choose this option if you want to hit kdgb_break in assert.
 
index bb1bc7f..e93e18c 100644 (file)
@@ -100,6 +100,8 @@ MODULE_FIRMWARE(FIRMWARE_SIENNA_CICHLID_DMUB);
 #define FIRMWARE_NAVY_FLOUNDER_DMUB "amdgpu/navy_flounder_dmcub.bin"
 MODULE_FIRMWARE(FIRMWARE_NAVY_FLOUNDER_DMUB);
 #endif
+#define FIRMWARE_GREEN_SARDINE_DMUB "amdgpu/green_sardine_dmcub.bin"
+MODULE_FIRMWARE(FIRMWARE_GREEN_SARDINE_DMUB);
 
 #define FIRMWARE_RAVEN_DMCU            "amdgpu/raven_dmcu.bin"
 MODULE_FIRMWARE(FIRMWARE_RAVEN_DMCU);
@@ -583,7 +585,7 @@ static void amdgpu_dm_fbc_init(struct drm_connector *connector)
 {
        struct drm_device *dev = connector->dev;
        struct amdgpu_device *adev = drm_to_adev(dev);
-       struct dm_comressor_info *compressor = &adev->dm.compressor;
+       struct dm_compressor_info *compressor = &adev->dm.compressor;
        struct amdgpu_dm_connector *aconn = to_amdgpu_dm_connector(connector);
        struct drm_display_mode *mode;
        unsigned long max_size = 0;
@@ -973,6 +975,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
        case CHIP_RAVEN:
        case CHIP_RENOIR:
                init_data.flags.gpu_vm_support = true;
+               if (ASICREV_IS_GREEN_SARDINE(adev->external_rev_id))
+                       init_data.flags.disable_dmcu = true;
                break;
        default:
                break;
@@ -1267,6 +1271,8 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev)
        case CHIP_RENOIR:
                dmub_asic = DMUB_ASIC_DCN21;
                fw_name_dmub = FIRMWARE_RENOIR_DMUB;
+               if (ASICREV_IS_GREEN_SARDINE(adev->external_rev_id))
+                       fw_name_dmub = FIRMWARE_GREEN_SARDINE_DMUB;
                break;
 #if defined(CONFIG_DRM_AMD_DC_DCN3_0)
        case CHIP_SIENNA_CICHLID:
@@ -5063,7 +5069,13 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector)
        struct amdgpu_device *adev = drm_to_adev(connector->dev);
        struct amdgpu_display_manager *dm = &adev->dm;
 
-       drm_atomic_private_obj_fini(&aconnector->mst_mgr.base);
+       /*
+        * Call only if mst_mgr was iniitalized before since it's not done
+        * for all connector types.
+        */
+       if (aconnector->mst_mgr.dev)
+               drm_dp_mst_topology_mgr_destroy(&aconnector->mst_mgr);
+
 #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\
        defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
 
index 34f6369..a8a0e8c 100644 (file)
@@ -86,7 +86,7 @@ struct irq_list_head {
  * @bo_ptr: Pointer to the buffer object
  * @gpu_addr: MMIO gpu addr
  */
-struct dm_comressor_info {
+struct dm_compressor_info {
        void *cpu_addr;
        struct amdgpu_bo *bo_ptr;
        uint64_t gpu_addr;
@@ -148,7 +148,7 @@ struct amdgpu_dm_backlight_caps {
  * @soc_bounding_box: SOC bounding box values provided by gpu_info FW
  * @cached_state: Caches device atomic state for suspend/resume
  * @cached_dc_state: Cached state of content streams
- * @compressor: Frame buffer compression buffer. See &struct dm_comressor_info
+ * @compressor: Frame buffer compression buffer. See &struct dm_compressor_info
  * @force_timing_sync: set via debugfs. When set, indicates that all connected
  *                    displays will be forced to synchronize.
  */
@@ -324,7 +324,7 @@ struct amdgpu_display_manager {
        struct drm_atomic_state *cached_state;
        struct dc_state *cached_dc_state;
 
-       struct dm_comressor_info compressor;
+       struct dm_compressor_info compressor;
 
        const struct firmware *fw_dmcu;
        uint32_t dmcu_fw_version;
index efb909e..857f156 100644 (file)
@@ -166,6 +166,11 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p
                        rn_clk_mgr_construct(ctx, clk_mgr, pp_smu, dccg);
                        break;
                }
+
+               if (ASICREV_IS_GREEN_SARDINE(asic_id.hw_internal_rev)) {
+                       rn_clk_mgr_construct(ctx, clk_mgr, pp_smu, dccg);
+                       break;
+               }
                if (ASICREV_IS_RAVEN2(asic_id.hw_internal_rev)) {
                        rv2_clk_mgr_construct(ctx, clk_mgr, pp_smu);
                        break;
index 1eb29c3..45ad05f 100644 (file)
@@ -1571,8 +1571,8 @@ static void init_state(struct dc *dc, struct dc_state *context)
 
 struct dc_state *dc_create_state(struct dc *dc)
 {
-       struct dc_state *context = kzalloc(sizeof(struct dc_state),
-                                          GFP_KERNEL);
+       struct dc_state *context = kvzalloc(sizeof(struct dc_state),
+                                           GFP_KERNEL);
 
        if (!context)
                return NULL;
index e430148..59d48cf 100644 (file)
@@ -120,6 +120,8 @@ enum dce_version resource_parse_asic_id(struct hw_asic_id asic_id)
                        dc_version = DCN_VERSION_1_01;
                if (ASICREV_IS_RENOIR(asic_id.hw_internal_rev))
                        dc_version = DCN_VERSION_2_1;
+               if (ASICREV_IS_GREEN_SARDINE(asic_id.hw_internal_rev))
+                       dc_version = DCN_VERSION_2_1;
                break;
 #endif
 
index 9cc65dc..49ae5ff 100644 (file)
@@ -1149,7 +1149,8 @@ static uint32_t dcn3_get_pix_clk_dividers(
 static const struct clock_source_funcs dcn3_clk_src_funcs = {
        .cs_power_down = dce110_clock_source_power_down,
        .program_pix_clk = dcn3_program_pix_clk,
-       .get_pix_clk_dividers = dcn3_get_pix_clk_dividers
+       .get_pix_clk_dividers = dcn3_get_pix_clk_dividers,
+       .get_pixel_clk_frequency_100hz = get_pixel_clk_frequency_100hz
 };
 #endif
 /*****************************************/
index 24fb39a..2455d21 100644 (file)
@@ -2105,12 +2105,12 @@ static bool dcn30_internal_validate_bw(
 
                if (split[i]) {
                        if (odm) {
-                               if (split[i] == 4 && old_pipe->next_odm_pipe->next_odm_pipe)
+                               if (split[i] == 4 && old_pipe->next_odm_pipe && old_pipe->next_odm_pipe->next_odm_pipe)
                                        old_index = old_pipe->next_odm_pipe->next_odm_pipe->pipe_idx;
                                else if (old_pipe->next_odm_pipe)
                                        old_index = old_pipe->next_odm_pipe->pipe_idx;
                        } else {
-                               if (split[i] == 4 && old_pipe->bottom_pipe->bottom_pipe &&
+                               if (split[i] == 4 && old_pipe->bottom_pipe && old_pipe->bottom_pipe->bottom_pipe &&
                                                old_pipe->bottom_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
                                        old_index = old_pipe->bottom_pipe->bottom_pipe->pipe_idx;
                                else if (old_pipe->bottom_pipe &&
@@ -2150,10 +2150,12 @@ static bool dcn30_internal_validate_bw(
                                goto validate_fail;
                        newly_split[pipe_4to1->pipe_idx] = true;
 
-                       if (odm && old_pipe->next_odm_pipe->next_odm_pipe->next_odm_pipe)
+                       if (odm && old_pipe->next_odm_pipe && old_pipe->next_odm_pipe->next_odm_pipe
+                                       && old_pipe->next_odm_pipe->next_odm_pipe->next_odm_pipe)
                                old_index = old_pipe->next_odm_pipe->next_odm_pipe->next_odm_pipe->pipe_idx;
-                       else if (!odm && old_pipe->bottom_pipe->bottom_pipe->bottom_pipe &&
-                                               old_pipe->bottom_pipe->bottom_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
+                       else if (!odm && old_pipe->bottom_pipe && old_pipe->bottom_pipe->bottom_pipe &&
+                                       old_pipe->bottom_pipe->bottom_pipe->bottom_pipe &&
+                                       old_pipe->bottom_pipe->bottom_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
                                old_index = old_pipe->bottom_pipe->bottom_pipe->bottom_pipe->pipe_idx;
                        else
                                old_index = -1;
index 3be2c90..2158369 100644 (file)
@@ -117,6 +117,12 @@ static const struct ddc_registers ddc_data_regs_dcn[] = {
        ddc_data_regs_dcn2(4),
        ddc_data_regs_dcn2(5),
        ddc_data_regs_dcn2(6),
+       {
+                       DDC_GPIO_VGA_REG_LIST(DATA),
+                       .ddc_setup = 0,
+                       .phy_aux_cntl = 0,
+                       .dc_gpio_aux_ctrl_5 = 0
+       }
 };
 
 static const struct ddc_registers ddc_clk_regs_dcn[] = {
@@ -126,6 +132,12 @@ static const struct ddc_registers ddc_clk_regs_dcn[] = {
        ddc_clk_regs_dcn2(4),
        ddc_clk_regs_dcn2(5),
        ddc_clk_regs_dcn2(6),
+       {
+                       DDC_GPIO_VGA_REG_LIST(CLK),
+                       .ddc_setup = 0,
+                       .phy_aux_cntl = 0,
+                       .dc_gpio_aux_ctrl_5 = 0
+       }
 };
 
 static const struct ddc_sh_mask ddc_shift[] = {
index f67c183..dac427b 100644 (file)
@@ -63,13 +63,13 @@ enum gpio_result dal_gpio_open_ex(
        enum gpio_mode mode)
 {
        if (gpio->pin) {
-               ASSERT_CRITICAL(false);
+               BREAK_TO_DEBUGGER();
                return GPIO_RESULT_ALREADY_OPENED;
        }
 
        // No action if allocation failed during gpio construct
        if (!gpio->hw_container.ddc) {
-               ASSERT_CRITICAL(false);
+               BREAK_TO_DEBUGGER();
                return GPIO_RESULT_NON_SPECIFIC_ERROR;
        }
        gpio->mode = mode;
index 330acaa..95cb569 100644 (file)
  * general debug capabilities
  *
  */
-#if defined(CONFIG_HAVE_KGDB) || defined(CONFIG_KGDB)
-#define ASSERT_CRITICAL(expr) do {     \
-       if (WARN_ON(!(expr))) { \
-               kgdb_breakpoint(); \
-       } \
-} while (0)
+#ifdef CONFIG_DEBUG_KERNEL_DC
+#define dc_breakpoint()                kgdb_breakpoint()
 #else
-#define ASSERT_CRITICAL(expr) do {     \
-       if (WARN_ON(!(expr))) { \
-               ; \
-       } \
-} while (0)
+#define dc_breakpoint()                do {} while (0)
 #endif
 
-#if defined(CONFIG_DEBUG_KERNEL_DC)
-#define ASSERT(expr) ASSERT_CRITICAL(expr)
+#define ASSERT_CRITICAL(expr) do {             \
+               if (WARN_ON(!(expr)))           \
+                       dc_breakpoint();        \
+       } while (0)
 
-#else
-#define ASSERT(expr) WARN_ON_ONCE(!(expr))
-#endif
+#define ASSERT(expr) do {                      \
+               if (WARN_ON_ONCE(!(expr)))      \
+                       dc_breakpoint();        \
+       } while (0)
 
-#if defined(CONFIG_DEBUG_KERNEL_DC) && (defined(CONFIG_HAVE_KGDB) || defined(CONFIG_KGDB))
 #define BREAK_TO_DEBUGGER() \
        do { \
                DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__); \
-               kgdb_breakpoint(); \
+               dc_breakpoint(); \
        } while (0)
-#else
-#define BREAK_TO_DEBUGGER() DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__)
-#endif
 
 #define DC_ERR(...)  do { \
        dm_error(__VA_ARGS__); \
index b267987..ffcb059 100644 (file)
@@ -205,6 +205,10 @@ enum {
 #if defined(CONFIG_DRM_AMD_DC_DCN3_0)
 #define ASICREV_IS_SIENNA_CICHLID_P(eChipRev)        ((eChipRev >= NV_SIENNA_CICHLID_P_A0))
 #endif
+#define GREEN_SARDINE_A0 0xA1
+#ifndef ASICREV_IS_GREEN_SARDINE
+#define ASICREV_IS_GREEN_SARDINE(eChipRev) ((eChipRev >= GREEN_SARDINE_A0) && (eChipRev < 0xFF))
+#endif
 
 /*
  * ASIC chip ID
index 10dc481..06c1aab 100644 (file)
@@ -45,6 +45,7 @@ enum amd_apu_flags {
        AMD_APU_IS_RAVEN2 = 0x00000002UL,
        AMD_APU_IS_PICASSO = 0x00000004UL,
        AMD_APU_IS_RENOIR = 0x00000008UL,
+       AMD_APU_IS_GREEN_SARDINE = 0x00000010UL,
 };
 
 /**
index 3898a95..518796a 100644 (file)
@@ -229,6 +229,7 @@ struct pp_smumgr_func {
        bool (*is_hw_avfs_present)(struct pp_hwmgr  *hwmgr);
        int (*update_dpm_settings)(struct pp_hwmgr *hwmgr, void *profile_setting);
        int (*smc_table_manager)(struct pp_hwmgr *hwmgr, uint8_t *table, uint16_t table_id, bool rw); /*rw: true for read, false for write */
+       int (*stop_smc)(struct pp_hwmgr *hwmgr);
 };
 
 struct pp_hwmgr_func {
index 35fc46d..cbf4a58 100644 (file)
@@ -220,6 +220,7 @@ enum smu_clk_type {
        __SMU_DUMMY_MAP(DPM_MP0CLK),                            \
        __SMU_DUMMY_MAP(DPM_LINK),                              \
        __SMU_DUMMY_MAP(DPM_DCEFCLK),                           \
+       __SMU_DUMMY_MAP(DPM_XGMI),                      \
        __SMU_DUMMY_MAP(DS_GFXCLK),                             \
        __SMU_DUMMY_MAP(DS_SOCCLK),                             \
        __SMU_DUMMY_MAP(DS_LCLK),                               \
index ad100b5..5f46f1a 100644 (file)
@@ -113,4 +113,6 @@ extern int smum_update_dpm_settings(struct pp_hwmgr *hwmgr, void *profile_settin
 
 extern int smum_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t *table, uint16_t table_id, bool rw);
 
+extern int smum_stop_smc(struct pp_hwmgr *hwmgr);
+
 #endif
index 3be4011..45f6088 100644 (file)
@@ -142,12 +142,12 @@ static const struct baco_cmd_entry exit_baco_tbl[] =
        { CMD_READMODIFYWRITE, mmBACO_CNTL, BACO_CNTL__BACO_BCLK_OFF_MASK,           BACO_CNTL__BACO_BCLK_OFF__SHIFT, 0, 0x00 },
        { CMD_READMODIFYWRITE, mmBACO_CNTL, BACO_CNTL__BACO_POWER_OFF_MASK,          BACO_CNTL__BACO_POWER_OFF__SHIFT, 0, 0x00 },
        { CMD_DELAY_MS, 0, 0, 0, 20, 0 },
-       { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__PWRGOOD_BF_MASK, 0, 0xffffffff, 0x20 },
+       { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__PWRGOOD_BF_MASK, 0, 0xffffffff, 0x200 },
        { CMD_READMODIFYWRITE, mmBACO_CNTL, BACO_CNTL__BACO_ISO_DIS_MASK, BACO_CNTL__BACO_ISO_DIS__SHIFT, 0, 0x01 },
-       { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__PWRGOOD_MASK, 0, 5, 0x1c },
+       { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__PWRGOOD_MASK, 0, 5, 0x1c00 },
        { CMD_READMODIFYWRITE, mmBACO_CNTL, BACO_CNTL__BACO_ANA_ISO_DIS_MASK, BACO_CNTL__BACO_ANA_ISO_DIS__SHIFT, 0, 0x01 },
        { CMD_READMODIFYWRITE, mmBACO_CNTL, BACO_CNTL__BACO_RESET_EN_MASK, BACO_CNTL__BACO_RESET_EN__SHIFT, 0, 0x00 },
-       { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__RCU_BIF_CONFIG_DONE_MASK, 0, 5, 0x10 },
+       { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__RCU_BIF_CONFIG_DONE_MASK, 0, 5, 0x100 },
        { CMD_READMODIFYWRITE, mmBACO_CNTL, BACO_CNTL__BACO_EN_MASK, BACO_CNTL__BACO_EN__SHIFT, 0, 0x00 },
        { CMD_WAITFOR, mmBACO_CNTL, BACO_CNTL__BACO_MODE_MASK, 0, 0xffffffff, 0x00 }
 };
@@ -155,6 +155,7 @@ static const struct baco_cmd_entry exit_baco_tbl[] =
 static const struct baco_cmd_entry clean_baco_tbl[] =
 {
        { CMD_WRITE, mmBIOS_SCRATCH_6, 0, 0, 0, 0 },
+       { CMD_WRITE, mmBIOS_SCRATCH_7, 0, 0, 0, 0 },
        { CMD_WRITE, mmCP_PFP_UCODE_ADDR, 0, 0, 0, 0 }
 };
 
index 1e8919b..3562914 100644 (file)
@@ -1541,6 +1541,10 @@ static int smu7_disable_dpm_tasks(struct pp_hwmgr *hwmgr)
        PP_ASSERT_WITH_CODE((tmp_result == 0),
                        "Failed to reset to default!", result = tmp_result);
 
+       tmp_result = smum_stop_smc(hwmgr);
+       PP_ASSERT_WITH_CODE((tmp_result == 0),
+                       "Failed to stop smc!", result = tmp_result);
+
        tmp_result = smu7_force_switch_to_arbf0(hwmgr);
        PP_ASSERT_WITH_CODE((tmp_result == 0),
                        "Failed to force to switch arbf0!", result = tmp_result);
@@ -1585,18 +1589,24 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr)
        data->current_profile_setting.sclk_down_hyst = 100;
        data->current_profile_setting.sclk_activity = SMU7_SCLK_TARGETACTIVITY_DFLT;
        data->current_profile_setting.bupdate_mclk = 1;
-       if (adev->gmc.vram_width == 256) {
-               data->current_profile_setting.mclk_up_hyst = 10;
-               data->current_profile_setting.mclk_down_hyst = 60;
-               data->current_profile_setting.mclk_activity = 25;
-       } else if (adev->gmc.vram_width == 128) {
-               data->current_profile_setting.mclk_up_hyst = 5;
-               data->current_profile_setting.mclk_down_hyst = 16;
-               data->current_profile_setting.mclk_activity = 20;
-       } else if (adev->gmc.vram_width == 64) {
-               data->current_profile_setting.mclk_up_hyst = 3;
-               data->current_profile_setting.mclk_down_hyst = 16;
-               data->current_profile_setting.mclk_activity = 20;
+       if (hwmgr->chip_id >= CHIP_POLARIS10) {
+               if (adev->gmc.vram_width == 256) {
+                       data->current_profile_setting.mclk_up_hyst = 10;
+                       data->current_profile_setting.mclk_down_hyst = 60;
+                       data->current_profile_setting.mclk_activity = 25;
+               } else if (adev->gmc.vram_width == 128) {
+                       data->current_profile_setting.mclk_up_hyst = 5;
+                       data->current_profile_setting.mclk_down_hyst = 16;
+                       data->current_profile_setting.mclk_activity = 20;
+               } else if (adev->gmc.vram_width == 64) {
+                       data->current_profile_setting.mclk_up_hyst = 3;
+                       data->current_profile_setting.mclk_down_hyst = 16;
+                       data->current_profile_setting.mclk_activity = 20;
+               }
+       } else {
+               data->current_profile_setting.mclk_up_hyst = 0;
+               data->current_profile_setting.mclk_down_hyst = 100;
+               data->current_profile_setting.mclk_activity = SMU7_MCLK_TARGETACTIVITY_DFLT;
        }
        hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D];
        hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_FULLSCREEN3D;
index e4d1f3d..329bf4d 100644 (file)
@@ -2726,10 +2726,7 @@ static int ci_initialize_mc_reg_table(struct pp_hwmgr *hwmgr)
 
 static bool ci_is_dpm_running(struct pp_hwmgr *hwmgr)
 {
-       return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device,
-                                            CGS_IND_REG__SMC, FEATURE_STATUS,
-                                            VOLTAGE_CONTROLLER_ON))
-               ? true : false;
+       return ci_is_smc_ram_running(hwmgr);
 }
 
 static int ci_smu_init(struct pp_hwmgr *hwmgr)
@@ -2939,6 +2936,29 @@ static int ci_update_smc_table(struct pp_hwmgr *hwmgr, uint32_t type)
        return 0;
 }
 
+static void ci_reset_smc(struct pp_hwmgr *hwmgr)
+{
+       PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
+                                 SMC_SYSCON_RESET_CNTL,
+                                 rst_reg, 1);
+}
+
+
+static void ci_stop_smc_clock(struct pp_hwmgr *hwmgr)
+{
+       PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
+                                 SMC_SYSCON_CLOCK_CNTL_0,
+                                 ck_disable, 1);
+}
+
+static int ci_stop_smc(struct pp_hwmgr *hwmgr)
+{
+       ci_reset_smc(hwmgr);
+       ci_stop_smc_clock(hwmgr);
+
+       return 0;
+}
+
 const struct pp_smumgr_func ci_smu_funcs = {
        .name = "ci_smu",
        .smu_init = ci_smu_init,
@@ -2964,4 +2984,5 @@ const struct pp_smumgr_func ci_smu_funcs = {
        .is_dpm_running = ci_is_dpm_running,
        .update_dpm_settings = ci_update_dpm_settings,
        .update_smc_table = ci_update_smc_table,
+       .stop_smc = ci_stop_smc,
 };
index b6fb480..b6921db 100644 (file)
@@ -245,3 +245,11 @@ int smum_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t *table, uint16_t tabl
 
        return -EINVAL;
 }
+
+int smum_stop_smc(struct pp_hwmgr *hwmgr)
+{
+       if (hwmgr->smumgr_funcs->stop_smc)
+               return hwmgr->smumgr_funcs->stop_smc(hwmgr);
+
+       return 0;
+}
index fc4f95f..b1e5ec0 100644 (file)
@@ -1029,17 +1029,6 @@ static int smu_smc_hw_setup(struct smu_context *smu)
                return ret;
        }
 
-       /*
-        * Set initialized values (get from vbios) to dpm tables context such as
-        * gfxclk, memclk, dcefclk, and etc. And enable the DPM feature for each
-        * type of clks.
-        */
-       ret = smu_set_default_dpm_table(smu);
-       if (ret) {
-               dev_err(adev->dev, "Failed to setup default dpm clock tables!\n");
-               return ret;
-       }
-
        ret = smu_notify_display_change(smu);
        if (ret)
                return ret;
index 8d8081c..ef1a62e 100644 (file)
@@ -1361,14 +1361,9 @@ static int navi10_get_fan_speed_rpm(struct smu_context *smu,
        if (!speed)
                return -EINVAL;
 
-       switch (smu_v11_0_get_fan_control_mode(smu)) {
-       case AMD_FAN_CTRL_AUTO:
-               return navi10_get_smu_metrics_data(smu,
-                                                  METRICS_CURR_FANSPEED,
-                                                  speed);
-       default:
-               return smu_v11_0_get_fan_speed_rpm(smu, speed);
-       }
+       return navi10_get_smu_metrics_data(smu,
+                                          METRICS_CURR_FANSPEED,
+                                          speed);
 }
 
 static int navi10_get_fan_parameters(struct smu_context *smu)
@@ -2534,29 +2529,6 @@ static const struct i2c_algorithm navi10_i2c_algo = {
        .functionality = navi10_i2c_func,
 };
 
-static int navi10_i2c_control_init(struct smu_context *smu, struct i2c_adapter *control)
-{
-       struct amdgpu_device *adev = to_amdgpu_device(control);
-       int res;
-
-       control->owner = THIS_MODULE;
-       control->class = I2C_CLASS_SPD;
-       control->dev.parent = &adev->pdev->dev;
-       control->algo = &navi10_i2c_algo;
-       snprintf(control->name, sizeof(control->name), "AMDGPU SMU");
-
-       res = i2c_add_adapter(control);
-       if (res)
-               DRM_ERROR("Failed to register hw i2c, err: %d\n", res);
-
-       return res;
-}
-
-static void navi10_i2c_control_fini(struct smu_context *smu, struct i2c_adapter *control)
-{
-       i2c_del_adapter(control);
-}
-
 static ssize_t navi10_get_gpu_metrics(struct smu_context *smu,
                                      void **table)
 {
@@ -2687,8 +2659,6 @@ static const struct pptable_funcs navi10_ppt_funcs = {
        .set_default_dpm_table = navi10_set_default_dpm_table,
        .dpm_set_vcn_enable = navi10_dpm_set_vcn_enable,
        .dpm_set_jpeg_enable = navi10_dpm_set_jpeg_enable,
-       .i2c_init = navi10_i2c_control_init,
-       .i2c_fini = navi10_i2c_control_fini,
        .print_clk_levels = navi10_print_clk_levels,
        .force_clk_levels = navi10_force_clk_levels,
        .populate_umd_state_clk = navi10_populate_umd_state_clk,
index c27806f..895d89b 100644 (file)
@@ -151,14 +151,17 @@ static struct cmn2asic_mapping sienna_cichlid_feature_mask_map[SMU_FEATURE_COUNT
        FEA_MAP(DPM_GFXCLK),
        FEA_MAP(DPM_GFX_GPO),
        FEA_MAP(DPM_UCLK),
+       FEA_MAP(DPM_FCLK),
        FEA_MAP(DPM_SOCCLK),
        FEA_MAP(DPM_MP0CLK),
        FEA_MAP(DPM_LINK),
        FEA_MAP(DPM_DCEFCLK),
+       FEA_MAP(DPM_XGMI),
        FEA_MAP(MEM_VDDCI_SCALING),
        FEA_MAP(MEM_MVDD_SCALING),
        FEA_MAP(DS_GFXCLK),
        FEA_MAP(DS_SOCCLK),
+       FEA_MAP(DS_FCLK),
        FEA_MAP(DS_LCLK),
        FEA_MAP(DS_DCEFCLK),
        FEA_MAP(DS_UCLK),
@@ -452,6 +455,9 @@ static int sienna_cichlid_get_smu_metrics_data(struct smu_context *smu,
        case METRICS_CURR_DCEFCLK:
                *value = metrics->CurrClock[PPCLK_DCEFCLK];
                break;
+       case METRICS_CURR_FCLK:
+               *value = metrics->CurrClock[PPCLK_FCLK];
+               break;
        case METRICS_AVERAGE_GFXCLK:
                if (metrics->AverageGfxActivity <= SMU_11_0_7_GFX_BUSY_THRESHOLD)
                        *value = metrics->AverageGfxclkFrequencyPostDs;
@@ -948,19 +954,23 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu,
                        freq_values[1] = cur_value;
                        mark_index = cur_value == freq_values[0] ? 0 :
                                     cur_value == freq_values[2] ? 2 : 1;
-                       if (mark_index != 1)
-                               freq_values[1] = (freq_values[0] + freq_values[2]) / 2;
 
-                       for (i = 0; i < 3; i++) {
+                       count = 3;
+                       if (mark_index != 1) {
+                               count = 2;
+                               freq_values[1] = freq_values[2];
+                       }
+
+                       for (i = 0; i < count; i++) {
                                size += sprintf(buf + size, "%d: %uMhz %s\n", i, freq_values[i],
-                                               i == mark_index ? "*" : "");
+                                               cur_value  == freq_values[i] ? "*" : "");
                        }
 
                }
                break;
        case SMU_PCIE:
-               gen_speed = smu_v11_0_get_current_pcie_link_speed(smu);
-               lane_width = smu_v11_0_get_current_pcie_link_width(smu);
+               gen_speed = smu_v11_0_get_current_pcie_link_speed_level(smu);
+               lane_width = smu_v11_0_get_current_pcie_link_width_level(smu);
                for (i = 0; i < NUM_LINK_LEVELS; i++)
                        size += sprintf(buf + size, "%d: %s %s %dMhz %s\n", i,
                                        (dpm_context->dpm_tables.pcie_table.pcie_gen[i] == 0) ? "2.5GT/s," :
@@ -1167,14 +1177,9 @@ static int sienna_cichlid_get_fan_speed_rpm(struct smu_context *smu,
        if (!speed)
                return -EINVAL;
 
-       switch (smu_v11_0_get_fan_control_mode(smu)) {
-       case AMD_FAN_CTRL_AUTO:
-               return sienna_cichlid_get_smu_metrics_data(smu,
-                                                          METRICS_CURR_FANSPEED,
-                                                          speed);
-       default:
-               return smu_v11_0_get_fan_speed_rpm(smu, speed);
-       }
+       return sienna_cichlid_get_smu_metrics_data(smu,
+                                               METRICS_CURR_FANSPEED,
+                                               speed);
 }
 
 static int sienna_cichlid_get_fan_parameters(struct smu_context *smu)
index c30d333..92b2ea4 100644 (file)
@@ -431,10 +431,9 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
                                   char *buf)
 {
        uint32_t feature_mask[2] = { 0 };
-       int32_t feature_index = 0;
+       int feature_index = 0;
        uint32_t count = 0;
-       uint32_t sort_feature[SMU_FEATURE_COUNT];
-       uint64_t hw_feature_count = 0;
+       int8_t sort_feature[SMU_FEATURE_COUNT];
        size_t size = 0;
        int ret = 0, i;
 
@@ -447,23 +446,31 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
        size =  sprintf(buf + size, "features high: 0x%08x low: 0x%08x\n",
                        feature_mask[1], feature_mask[0]);
 
+       memset(sort_feature, -1, sizeof(sort_feature));
+
        for (i = 0; i < SMU_FEATURE_COUNT; i++) {
                feature_index = smu_cmn_to_asic_specific_index(smu,
                                                               CMN2ASIC_MAPPING_FEATURE,
                                                               i);
                if (feature_index < 0)
                        continue;
+
                sort_feature[feature_index] = i;
-               hw_feature_count++;
        }
 
-       for (i = 0; i < hw_feature_count; i++) {
+       size += sprintf(buf + size, "%-2s. %-20s  %-3s : %-s\n",
+                       "No", "Feature", "Bit", "State");
+
+       for (i = 0; i < SMU_FEATURE_COUNT; i++) {
+               if (sort_feature[i] < 0)
+                       continue;
+
                size += sprintf(buf + size, "%02d. %-20s (%2d) : %s\n",
-                              count++,
-                              smu_get_feature_name(smu, sort_feature[i]),
-                              i,
-                              !!smu_cmn_feature_is_enabled(smu, sort_feature[i]) ?
-                              "enabled" : "disabled");
+                               count++,
+                               smu_get_feature_name(smu, sort_feature[i]),
+                               i,
+                               !!smu_cmn_feature_is_enabled(smu, sort_feature[i]) ?
+                               "enabled" : "disabled");
        }
 
        return size;
index 90807a6..deeed73 100644 (file)
@@ -374,6 +374,10 @@ static bool is_edid_digital_input_dp(const struct edid *edid)
  * drm_dp_downstream_is_type() - is the downstream facing port of certain type?
  * @dpcd: DisplayPort configuration data
  * @port_cap: port capabilities
+ * @type: port type to be checked. Can be:
+ *       %DP_DS_PORT_TYPE_DP, %DP_DS_PORT_TYPE_VGA, %DP_DS_PORT_TYPE_DVI,
+ *       %DP_DS_PORT_TYPE_HDMI, %DP_DS_PORT_TYPE_NON_EDID,
+ *       %DP_DS_PORT_TYPE_DP_DUALMODE or %DP_DS_PORT_TYPE_WIRELESS.
  *
  * Caveat: Only works with DPCD 1.1+ port caps.
  *
@@ -870,6 +874,7 @@ EXPORT_SYMBOL(drm_dp_downstream_444_to_420_conversion);
 
 /**
  * drm_dp_downstream_mode() - return a mode for downstream facing port
+ * @dev: DRM device
  * @dpcd: DisplayPort configuration data
  * @port_cap: port capabilities
  *
@@ -1028,7 +1033,8 @@ EXPORT_SYMBOL(drm_dp_downstream_debug);
 
 /**
  * drm_dp_subconnector_type() - get DP branch device type
- *
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
  */
 enum drm_mode_subconnector
 drm_dp_subconnector_type(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
@@ -1079,6 +1085,10 @@ EXPORT_SYMBOL(drm_dp_subconnector_type);
 
 /**
  * drm_mode_set_dp_subconnector_property - set subconnector for DP connector
+ * @connector: connector to set property on
+ * @status: connector status
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
  *
  * Called by a driver on every detect event.
  */
index a82f37d..631125b 100644 (file)
@@ -3741,7 +3741,7 @@ drm_add_cmdb_modes(struct drm_connector *connector, u8 svd)
 /**
  * drm_display_mode_from_cea_vic() - return a mode for CEA VIC
  * @dev: DRM device
- * @vic: CEA VIC of the mode
+ * @video_code: CEA VIC of the mode
  *
  * Creates a new mode matching the specified CEA VIC.
  *
index 19d7386..69c2c07 100644 (file)
@@ -1085,6 +1085,8 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
         */
        drm_gem_object_get(obj);
 
+       vma->vm_private_data = obj;
+
        if (obj->funcs && obj->funcs->mmap) {
                ret = obj->funcs->mmap(obj, vma);
                if (ret) {
@@ -1107,8 +1109,6 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
                vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);
        }
 
-       vma->vm_private_data = obj;
-
        return 0;
 }
 EXPORT_SYMBOL(drm_gem_mmap_obj);
index d77c9f8..e00616d 100644 (file)
@@ -593,8 +593,13 @@ int drm_gem_shmem_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
        /* Remove the fake offset */
        vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node);
 
-       if (obj->import_attach)
+       if (obj->import_attach) {
+               /* Drop the reference drm_gem_mmap_obj() acquired.*/
+               drm_gem_object_put(obj);
+               vma->vm_private_data = NULL;
+
                return dma_buf_mmap(obj->dma_buf, vma, 0);
+       }
 
        shmem = to_drm_gem_shmem_obj(obj);
 
index d6808f6..9f955f2 100644 (file)
@@ -794,6 +794,7 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
 
 /**
  * drm_prime_pages_to_sg - converts a page array into an sg list
+ * @dev: DRM device
  * @pages: pointer to the array of page pointers to convert
  * @nr_pages: length of the page vector
  *
index 1cb28c2..25cd978 100644 (file)
@@ -153,6 +153,7 @@ config DRM_I915_SELFTEST
        select DRM_EXPORT_FOR_TESTS if m
        select FAULT_INJECTION
        select PRIME_NUMBERS
+       select CRC32
        help
          Choose this option to allow the driver to perform selftests upon
          loading; also requires the i915.selftest=1 module parameter. To
index a1fba7e..31337d2 100644 (file)
@@ -3434,6 +3434,14 @@ initial_plane_vma(struct drm_i915_private *i915,
        if (IS_ERR(obj))
                return NULL;
 
+       /*
+        * Mark it WT ahead of time to avoid changing the
+        * cache_level during fbdev initialization. The
+        * unbind there would get stuck waiting for rcu.
+        */
+       i915_gem_object_set_cache_coherency(obj, HAS_WT(i915) ?
+                                           I915_CACHE_WT : I915_CACHE_NONE);
+
        switch (plane_config->tiling) {
        case I915_TILING_NONE:
                break;
@@ -10628,6 +10636,10 @@ skl_get_initial_plane_config(struct intel_crtc *crtc,
            val & PLANE_CTL_FLIP_HORIZONTAL)
                plane_config->rotation |= DRM_MODE_REFLECT_X;
 
+       /* 90/270 degree rotation would require extra work */
+       if (drm_rotation_90_or_270(plane_config->rotation))
+               goto error;
+
        base = intel_de_read(dev_priv, PLANE_SURF(pipe, plane_id)) & 0xfffff000;
        plane_config->base = base;
 
index acbd7eb..036f504 100644 (file)
@@ -52,17 +52,11 @@ static void set_aux_backlight_enable(struct intel_dp *intel_dp, bool enable)
        }
 }
 
-/*
- * Read the current backlight value from DPCD register(s) based
- * on if 8-bit(MSB) or 16-bit(MSB and LSB) values are supported
- */
-static u32 intel_dp_aux_get_backlight(struct intel_connector *connector)
+static bool intel_dp_aux_backlight_dpcd_mode(struct intel_connector *connector)
 {
        struct intel_dp *intel_dp = intel_attached_dp(connector);
        struct drm_i915_private *i915 = dp_to_i915(intel_dp);
-       u8 read_val[2] = { 0x0 };
        u8 mode_reg;
-       u16 level = 0;
 
        if (drm_dp_dpcd_readb(&intel_dp->aux,
                              DP_EDP_BACKLIGHT_MODE_SET_REGISTER,
@@ -70,15 +64,29 @@ static u32 intel_dp_aux_get_backlight(struct intel_connector *connector)
                drm_dbg_kms(&i915->drm,
                            "Failed to read the DPCD register 0x%x\n",
                            DP_EDP_BACKLIGHT_MODE_SET_REGISTER);
-               return 0;
+               return false;
        }
 
+       return (mode_reg & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) ==
+              DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD;
+}
+
+/*
+ * Read the current backlight value from DPCD register(s) based
+ * on if 8-bit(MSB) or 16-bit(MSB and LSB) values are supported
+ */
+static u32 intel_dp_aux_get_backlight(struct intel_connector *connector)
+{
+       struct intel_dp *intel_dp = intel_attached_dp(connector);
+       struct drm_i915_private *i915 = dp_to_i915(intel_dp);
+       u8 read_val[2] = { 0x0 };
+       u16 level = 0;
+
        /*
         * If we're not in DPCD control mode yet, the programmed brightness
         * value is meaningless and we should assume max brightness
         */
-       if ((mode_reg & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) !=
-           DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD)
+       if (!intel_dp_aux_backlight_dpcd_mode(connector))
                return connector->panel.backlight.max;
 
        if (drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB,
@@ -319,7 +327,8 @@ static int intel_dp_aux_setup_backlight(struct intel_connector *connector,
 
        panel->backlight.min = 0;
        panel->backlight.level = intel_dp_aux_get_backlight(connector);
-       panel->backlight.enabled = panel->backlight.level != 0;
+       panel->backlight.enabled = intel_dp_aux_backlight_dpcd_mode(connector) &&
+                                  panel->backlight.level != 0;
 
        return 0;
 }
index 8a9d0bd..40e9cb2 100644 (file)
@@ -1754,7 +1754,7 @@ void intel_psr_atomic_check(struct drm_connector *connector,
                return;
 
        intel_connector = to_intel_connector(connector);
-       dig_port = enc_to_dig_port(intel_attached_encoder(intel_connector));
+       dig_port = enc_to_dig_port(to_intel_encoder(new_state->best_encoder));
        if (dev_priv->psr.dp != &dig_port->dp)
                return;
 
index 7c90a63..fcce690 100644 (file)
@@ -509,21 +509,6 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
                return -ENOENT;
 
        /*
-        * Already in the desired write domain? Nothing for us to do!
-        *
-        * We apply a little bit of cunning here to catch a broader set of
-        * no-ops. If obj->write_domain is set, we must be in the same
-        * obj->read_domains, and only that domain. Therefore, if that
-        * obj->write_domain matches the request read_domains, we are
-        * already in the same read/write domain and can skip the operation,
-        * without having to further check the requested write_domain.
-        */
-       if (READ_ONCE(obj->write_domain) == read_domains) {
-               err = 0;
-               goto out;
-       }
-
-       /*
         * Try to flush the object off the GPU without holding the lock.
         * We will repeat the flush holding the lock in the normal manner
         * to catch cases where we are gazumped.
@@ -560,6 +545,19 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
        if (err)
                goto out;
 
+       /*
+        * Already in the desired write domain? Nothing for us to do!
+        *
+        * We apply a little bit of cunning here to catch a broader set of
+        * no-ops. If obj->write_domain is set, we must be in the same
+        * obj->read_domains, and only that domain. Therefore, if that
+        * obj->write_domain matches the request read_domains, we are
+        * already in the same read/write domain and can skip the operation,
+        * without having to further check the requested write_domain.
+        */
+       if (READ_ONCE(obj->write_domain) == read_domains)
+               goto out_unpin;
+
        err = i915_gem_object_lock_interruptible(obj, NULL);
        if (err)
                goto out_unpin;
index 4b09bcd..1904e6e 100644 (file)
@@ -287,8 +287,8 @@ struct i915_execbuffer {
        u64 invalid_flags; /** Set of execobj.flags that are invalid */
        u32 context_flags; /** Set of execobj.flags to insert from the ctx */
 
+       u64 batch_len; /** Length of batch within object */
        u32 batch_start_offset; /** Location within object of batch */
-       u32 batch_len; /** Length of batch within object */
        u32 batch_flags; /** Flags composed for emit_bb_start() */
        struct intel_gt_buffer_pool_node *batch_pool; /** pool node for batch buffer */
 
@@ -871,6 +871,10 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)
 
        if (eb->batch_len == 0)
                eb->batch_len = eb->batch->vma->size - eb->batch_start_offset;
+       if (unlikely(eb->batch_len == 0)) { /* impossible! */
+               drm_dbg(&i915->drm, "Invalid batch length\n");
+               return -EINVAL;
+       }
 
        return 0;
 
@@ -2424,7 +2428,7 @@ static int eb_parse(struct i915_execbuffer *eb)
        struct drm_i915_private *i915 = eb->i915;
        struct intel_gt_buffer_pool_node *pool = eb->batch_pool;
        struct i915_vma *shadow, *trampoline, *batch;
-       unsigned int len;
+       unsigned long len;
        int err;
 
        if (!eb_use_cmdparser(eb)) {
@@ -2449,6 +2453,8 @@ static int eb_parse(struct i915_execbuffer *eb)
        } else {
                len += I915_CMD_PARSER_TRAMPOLINE_SIZE;
        }
+       if (unlikely(len < eb->batch_len)) /* last paranoid check of overflow */
+               return -EINVAL;
 
        if (!pool) {
                pool = intel_gt_get_buffer_pool(eb->engine->gt, len);
index 0be5e86..84b2707 100644 (file)
@@ -53,8 +53,10 @@ int i915_gem_stolen_insert_node(struct drm_i915_private *i915,
                                struct drm_mm_node *node, u64 size,
                                unsigned alignment)
 {
-       return i915_gem_stolen_insert_node_in_range(i915, node, size,
-                                                   alignment, 0, U64_MAX);
+       return i915_gem_stolen_insert_node_in_range(i915, node,
+                                                   size, alignment,
+                                                   I915_GEM_STOLEN_BIAS,
+                                                   U64_MAX);
 }
 
 void i915_gem_stolen_remove_node(struct drm_i915_private *i915,
index e15c0ad..61e0280 100644 (file)
@@ -30,4 +30,6 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_i915_private *dev_priv
                                               resource_size_t stolen_offset,
                                               resource_size_t size);
 
+#define I915_GEM_STOLEN_BIAS SZ_128K
+
 #endif /* __I915_GEM_STOLEN_H__ */
index fd0d24d..c30adc0 100644 (file)
@@ -239,18 +239,24 @@ static int gen6_ppgtt_init_scratch(struct gen6_ppgtt *ppgtt)
                               I915_CACHE_NONE, PTE_READ_ONLY);
 
        vm->scratch[1] = vm->alloc_pt_dma(vm, I915_GTT_PAGE_SIZE_4K);
-       if (IS_ERR(vm->scratch[1]))
-               return PTR_ERR(vm->scratch[1]);
+       if (IS_ERR(vm->scratch[1])) {
+               ret = PTR_ERR(vm->scratch[1]);
+               goto err_scratch0;
+       }
 
        ret = pin_pt_dma(vm, vm->scratch[1]);
-       if (ret) {
-               i915_gem_object_put(vm->scratch[1]);
-               return ret;
-       }
+       if (ret)
+               goto err_scratch1;
 
        fill32_px(vm->scratch[1], vm->scratch[0]->encode);
 
        return 0;
+
+err_scratch1:
+       i915_gem_object_put(vm->scratch[1]);
+err_scratch0:
+       i915_gem_object_put(vm->scratch[0]);
+       return ret;
 }
 
 static void gen6_ppgtt_free_pd(struct gen6_ppgtt *ppgtt)
index eb64f47..38c7069 100644 (file)
@@ -604,7 +604,8 @@ static int gen8_init_scratch(struct i915_address_space *vm)
        return 0;
 
 free_scratch:
-       free_scratch(vm);
+       while (i--)
+               i915_gem_object_put(vm->scratch[i]);
        return -ENOMEM;
 }
 
index 7c3a101..760fefd 100644 (file)
@@ -245,22 +245,14 @@ static inline u32 *gen12_emit_pipe_control(u32 *batch, u32 flags0, u32 flags1, u
 }
 
 static inline u32 *
-__gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 flags1)
+__gen8_emit_write_rcs(u32 *cs, u32 value, u32 offset, u32 flags0, u32 flags1)
 {
-       /* We're using qword write, offset should be aligned to 8 bytes. */
-       GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
-
-       /* w/a for post sync ops following a GPGPU operation we
-        * need a prior CS_STALL, which is emitted by the flush
-        * following the batch.
-        */
        *cs++ = GFX_OP_PIPE_CONTROL(6) | flags0;
-       *cs++ = flags1 | PIPE_CONTROL_QW_WRITE | PIPE_CONTROL_GLOBAL_GTT_IVB;
-       *cs++ = gtt_offset;
+       *cs++ = flags1 | PIPE_CONTROL_QW_WRITE;
+       *cs++ = offset;
        *cs++ = 0;
        *cs++ = value;
-       /* We're thrashing one dword of HWS. */
-       *cs++ = 0;
+       *cs++ = 0; /* We're thrashing one extra dword. */
 
        return cs;
 }
@@ -268,13 +260,38 @@ __gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 f
 static inline u32*
 gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags)
 {
-       return __gen8_emit_ggtt_write_rcs(cs, value, gtt_offset, 0, flags);
+       /* We're using qword write, offset should be aligned to 8 bytes. */
+       GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
+
+       return __gen8_emit_write_rcs(cs,
+                                    value,
+                                    gtt_offset,
+                                    0,
+                                    flags | PIPE_CONTROL_GLOBAL_GTT_IVB);
 }
 
 static inline u32*
 gen12_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 flags1)
 {
-       return __gen8_emit_ggtt_write_rcs(cs, value, gtt_offset, flags0, flags1);
+       /* We're using qword write, offset should be aligned to 8 bytes. */
+       GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
+
+       return __gen8_emit_write_rcs(cs,
+                                    value,
+                                    gtt_offset,
+                                    flags0,
+                                    flags1 | PIPE_CONTROL_GLOBAL_GTT_IVB);
+}
+
+static inline u32 *
+__gen8_emit_flush_dw(u32 *cs, u32 value, u32 gtt_offset, u32 flags)
+{
+       *cs++ = (MI_FLUSH_DW + 1) | flags;
+       *cs++ = gtt_offset;
+       *cs++ = 0;
+       *cs++ = value;
+
+       return cs;
 }
 
 static inline u32 *
@@ -285,12 +302,10 @@ gen8_emit_ggtt_write(u32 *cs, u32 value, u32 gtt_offset, u32 flags)
        /* Offset should be aligned to 8 bytes for both (QW/DW) write types */
        GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
 
-       *cs++ = (MI_FLUSH_DW + 1) | MI_FLUSH_DW_OP_STOREDW | flags;
-       *cs++ = gtt_offset | MI_FLUSH_DW_USE_GTT;
-       *cs++ = 0;
-       *cs++ = value;
-
-       return cs;
+       return __gen8_emit_flush_dw(cs,
+                                   value,
+                                   gtt_offset | MI_FLUSH_DW_USE_GTT,
+                                   flags | MI_FLUSH_DW_OP_STOREDW);
 }
 
 static inline void __intel_engine_reset(struct intel_engine_cs *engine,
index c400aaa..ee63126 100644 (file)
@@ -278,7 +278,7 @@ struct intel_engine_execlists {
         *
         * Note these register may be either mmio or HWSP shadow.
         */
-       u32 *csb_status;
+       u64 *csb_status;
 
        /**
         * @csb_size: context status buffer FIFO size
index 0412a44..f82c6dd 100644 (file)
@@ -1140,9 +1140,8 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
 
                        /* Check in case we rollback so far we wrap [size/2] */
                        if (intel_ring_direction(rq->ring,
-                                                intel_ring_wrap(rq->ring,
-                                                                rq->tail),
-                                                rq->ring->tail) > 0)
+                                                rq->tail,
+                                                rq->ring->tail + 8) > 0)
                                rq->context->lrc.desc |= CTX_DESC_FORCE_RESTORE;
 
                        active = rq;
@@ -2464,7 +2463,7 @@ cancel_port_requests(struct intel_engine_execlists * const execlists)
 }
 
 static inline void
-invalidate_csb_entries(const u32 *first, const u32 *last)
+invalidate_csb_entries(const u64 *first, const u64 *last)
 {
        clflush((void *)first);
        clflush((void *)last);
@@ -2496,14 +2495,25 @@ invalidate_csb_entries(const u32 *first, const u32 *last)
  *     bits 47-57: sw context id of the lrc the GT switched away from
  *     bits 58-63: sw counter of the lrc the GT switched away from
  */
-static inline bool
-gen12_csb_parse(const struct intel_engine_execlists *execlists, const u32 *csb)
-{
-       u32 lower_dw = csb[0];
-       u32 upper_dw = csb[1];
-       bool ctx_to_valid = GEN12_CSB_CTX_VALID(lower_dw);
-       bool ctx_away_valid = GEN12_CSB_CTX_VALID(upper_dw);
-       bool new_queue = lower_dw & GEN12_CTX_STATUS_SWITCHED_TO_NEW_QUEUE;
+static inline bool gen12_csb_parse(const u64 *csb)
+{
+       bool ctx_away_valid;
+       bool new_queue;
+       u64 entry;
+
+       /* HSD#22011248461 */
+       entry = READ_ONCE(*csb);
+       if (unlikely(entry == -1)) {
+               preempt_disable();
+               if (wait_for_atomic_us((entry = READ_ONCE(*csb)) != -1, 50))
+                       GEM_WARN_ON("50us CSB timeout");
+               preempt_enable();
+       }
+       WRITE_ONCE(*(u64 *)csb, -1);
+
+       ctx_away_valid = GEN12_CSB_CTX_VALID(upper_32_bits(entry));
+       new_queue =
+               lower_32_bits(entry) & GEN12_CTX_STATUS_SWITCHED_TO_NEW_QUEUE;
 
        /*
         * The context switch detail is not guaranteed to be 5 when a preemption
@@ -2513,7 +2523,7 @@ gen12_csb_parse(const struct intel_engine_execlists *execlists, const u32 *csb)
         * would require some extra handling, but we don't support that.
         */
        if (!ctx_away_valid || new_queue) {
-               GEM_BUG_ON(!ctx_to_valid);
+               GEM_BUG_ON(!GEN12_CSB_CTX_VALID(lower_32_bits(entry)));
                return true;
        }
 
@@ -2522,12 +2532,11 @@ gen12_csb_parse(const struct intel_engine_execlists *execlists, const u32 *csb)
         * context switch on an unsuccessful wait instruction since we always
         * use polling mode.
         */
-       GEM_BUG_ON(GEN12_CTX_SWITCH_DETAIL(upper_dw));
+       GEM_BUG_ON(GEN12_CTX_SWITCH_DETAIL(upper_32_bits(entry)));
        return false;
 }
 
-static inline bool
-gen8_csb_parse(const struct intel_engine_execlists *execlists, const u32 *csb)
+static inline bool gen8_csb_parse(const u64 *csb)
 {
        return *csb & (GEN8_CTX_STATUS_IDLE_ACTIVE | GEN8_CTX_STATUS_PREEMPTED);
 }
@@ -2535,7 +2544,7 @@ gen8_csb_parse(const struct intel_engine_execlists *execlists, const u32 *csb)
 static void process_csb(struct intel_engine_cs *engine)
 {
        struct intel_engine_execlists * const execlists = &engine->execlists;
-       const u32 * const buf = execlists->csb_status;
+       const u64 * const buf = execlists->csb_status;
        const u8 num_entries = execlists->csb_size;
        u8 head, tail;
 
@@ -2616,12 +2625,14 @@ static void process_csb(struct intel_engine_cs *engine)
                 */
 
                ENGINE_TRACE(engine, "csb[%d]: status=0x%08x:0x%08x\n",
-                            head, buf[2 * head + 0], buf[2 * head + 1]);
+                            head,
+                            upper_32_bits(buf[head]),
+                            lower_32_bits(buf[head]));
 
                if (INTEL_GEN(engine->i915) >= 12)
-                       promote = gen12_csb_parse(execlists, buf + 2 * head);
+                       promote = gen12_csb_parse(buf + head);
                else
-                       promote = gen8_csb_parse(execlists, buf + 2 * head);
+                       promote = gen8_csb_parse(buf + head);
                if (promote) {
                        struct i915_request * const *old = execlists->active;
 
@@ -2649,6 +2660,9 @@ static void process_csb(struct intel_engine_cs *engine)
                        smp_wmb(); /* complete the seqlock */
                        WRITE_ONCE(execlists->active, execlists->inflight);
 
+                       /* XXX Magic delay for tgl */
+                       ENGINE_POSTING_READ(engine, RING_CONTEXT_STATUS_PTR);
+
                        WRITE_ONCE(execlists->pending[0], NULL);
                } else {
                        if (GEM_WARN_ON(!*execlists->active)) {
@@ -3533,6 +3547,19 @@ static const struct intel_context_ops execlists_context_ops = {
        .destroy = execlists_context_destroy,
 };
 
+static u32 hwsp_offset(const struct i915_request *rq)
+{
+       const struct intel_timeline_cacheline *cl;
+
+       /* Before the request is executed, the timeline/cachline is fixed */
+
+       cl = rcu_dereference_protected(rq->hwsp_cacheline, 1);
+       if (cl)
+               return cl->ggtt_offset;
+
+       return rcu_dereference_protected(rq->timeline, 1)->hwsp_offset;
+}
+
 static int gen8_emit_init_breadcrumb(struct i915_request *rq)
 {
        u32 *cs;
@@ -3555,7 +3582,7 @@ static int gen8_emit_init_breadcrumb(struct i915_request *rq)
        *cs++ = MI_NOOP;
 
        *cs++ = MI_STORE_DWORD_IMM_GEN4 | MI_USE_GGTT;
-       *cs++ = i915_request_timeline(rq)->hwsp_offset;
+       *cs++ = hwsp_offset(rq);
        *cs++ = 0;
        *cs++ = rq->fence.seqno - 1;
 
@@ -4005,6 +4032,8 @@ static void reset_csb_pointers(struct intel_engine_cs *engine)
        WRITE_ONCE(*execlists->csb_write, reset_value);
        wmb(); /* Make sure this is visible to HW (paranoia?) */
 
+       /* Check that the GPU does indeed update the CSB entries! */
+       memset(execlists->csb_status, -1, (reset_value + 1) * sizeof(u64));
        invalidate_csb_entries(&execlists->csb_status[0],
                               &execlists->csb_status[reset_value]);
 
@@ -4870,11 +4899,9 @@ gen8_emit_fini_breadcrumb_tail(struct i915_request *request, u32 *cs)
        return gen8_emit_wa_tail(request, cs);
 }
 
-static u32 *emit_xcs_breadcrumb(struct i915_request *request, u32 *cs)
+static u32 *emit_xcs_breadcrumb(struct i915_request *rq, u32 *cs)
 {
-       u32 addr = i915_request_active_timeline(request)->hwsp_offset;
-
-       return gen8_emit_ggtt_write(cs, request->fence.seqno, addr, 0);
+       return gen8_emit_ggtt_write(cs, rq->fence.seqno, hwsp_offset(rq), 0);
 }
 
 static u32 *gen8_emit_fini_breadcrumb(struct i915_request *rq, u32 *cs)
@@ -4893,7 +4920,7 @@ static u32 *gen8_emit_fini_breadcrumb_rcs(struct i915_request *request, u32 *cs)
        /* XXX flush+write+CS_STALL all in one upsets gem_concurrent_blt:kbl */
        cs = gen8_emit_ggtt_write_rcs(cs,
                                      request->fence.seqno,
-                                     i915_request_active_timeline(request)->hwsp_offset,
+                                     hwsp_offset(request),
                                      PIPE_CONTROL_FLUSH_ENABLE |
                                      PIPE_CONTROL_CS_STALL);
 
@@ -4905,7 +4932,7 @@ gen11_emit_fini_breadcrumb_rcs(struct i915_request *request, u32 *cs)
 {
        cs = gen8_emit_ggtt_write_rcs(cs,
                                      request->fence.seqno,
-                                     i915_request_active_timeline(request)->hwsp_offset,
+                                     hwsp_offset(request),
                                      PIPE_CONTROL_CS_STALL |
                                      PIPE_CONTROL_TILE_CACHE_FLUSH |
                                      PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH |
@@ -4967,7 +4994,9 @@ gen12_emit_fini_breadcrumb_tail(struct i915_request *request, u32 *cs)
 
 static u32 *gen12_emit_fini_breadcrumb(struct i915_request *rq, u32 *cs)
 {
-       return gen12_emit_fini_breadcrumb_tail(rq, emit_xcs_breadcrumb(rq, cs));
+       /* XXX Stalling flush before seqno write; post-sync not */
+       cs = emit_xcs_breadcrumb(rq, __gen8_emit_flush_dw(cs, 0, 0, 0));
+       return gen12_emit_fini_breadcrumb_tail(rq, cs);
 }
 
 static u32 *
@@ -4975,7 +5004,7 @@ gen12_emit_fini_breadcrumb_rcs(struct i915_request *request, u32 *cs)
 {
        cs = gen12_emit_ggtt_write_rcs(cs,
                                       request->fence.seqno,
-                                      i915_request_active_timeline(request)->hwsp_offset,
+                                      hwsp_offset(request),
                                       PIPE_CONTROL0_HDC_PIPELINE_FLUSH,
                                       PIPE_CONTROL_CS_STALL |
                                       PIPE_CONTROL_TILE_CACHE_FLUSH |
@@ -5157,7 +5186,7 @@ int intel_execlists_submission_setup(struct intel_engine_cs *engine)
        }
 
        execlists->csb_status =
-               &engine->status_page.addr[I915_HWS_CSB_BUF0_INDEX];
+               (u64 *)&engine->status_page.addr[I915_HWS_CSB_BUF0_INDEX];
 
        execlists->csb_write =
                &engine->status_page.addr[intel_hws_csb_write_index(i915)];
index 632e08a..b8f56e6 100644 (file)
@@ -234,11 +234,17 @@ static const struct drm_i915_mocs_entry broxton_mocs_table[] = {
                   L3_1_UC)
 
 static const struct drm_i915_mocs_entry tgl_mocs_table[] = {
-       /* Base - Error (Reserved for Non-Use) */
-       MOCS_ENTRY(0, 0x0, 0x0),
-       /* Base - Reserved */
-       MOCS_ENTRY(1, 0x0, 0x0),
-
+       /*
+        * NOTE:
+        * Reserved and unspecified MOCS indices have been set to (L3 + LCC).
+        * These reserved entries should never be used, they may be changed
+        * to low performant variants with better coherency in the future if
+        * more entries are needed. We are programming index I915_MOCS_PTE(1)
+        * only, __init_mocs_table() take care to program unused index with
+        * this entry.
+        */
+       MOCS_ENTRY(1, LE_3_WB | LE_TC_1_LLC | LE_LRUM(3),
+                  L3_3_WB),
        GEN11_MOCS_ENTRIES,
 
        /* Implicitly enable L1 - HDC:L1 + L3 + LLC */
index a2f74ce..7ea94d2 100644 (file)
@@ -188,10 +188,14 @@ cacheline_alloc(struct intel_timeline_hwsp *hwsp, unsigned int cacheline)
        return cl;
 }
 
-static void cacheline_acquire(struct intel_timeline_cacheline *cl)
+static void cacheline_acquire(struct intel_timeline_cacheline *cl,
+                             u32 ggtt_offset)
 {
-       if (cl)
-               i915_active_acquire(&cl->active);
+       if (!cl)
+               return;
+
+       cl->ggtt_offset = ggtt_offset;
+       i915_active_acquire(&cl->active);
 }
 
 static void cacheline_release(struct intel_timeline_cacheline *cl)
@@ -340,7 +344,7 @@ int intel_timeline_pin(struct intel_timeline *tl, struct i915_gem_ww_ctx *ww)
        GT_TRACE(tl->gt, "timeline:%llx using HWSP offset:%x\n",
                 tl->fence_context, tl->hwsp_offset);
 
-       cacheline_acquire(tl->hwsp_cacheline);
+       cacheline_acquire(tl->hwsp_cacheline, tl->hwsp_offset);
        if (atomic_fetch_inc(&tl->pin_count)) {
                cacheline_release(tl->hwsp_cacheline);
                __i915_vma_unpin(tl->hwsp_ggtt);
@@ -515,7 +519,7 @@ __intel_timeline_get_seqno(struct intel_timeline *tl,
        GT_TRACE(tl->gt, "timeline:%llx using HWSP offset:%x\n",
                 tl->fence_context, tl->hwsp_offset);
 
-       cacheline_acquire(cl);
+       cacheline_acquire(cl, tl->hwsp_offset);
        tl->hwsp_cacheline = cl;
 
        *seqno = timeline_advance(tl);
@@ -573,9 +577,7 @@ int intel_timeline_read_hwsp(struct i915_request *from,
        if (err)
                goto out;
 
-       *hwsp = i915_ggtt_offset(cl->hwsp->vma) +
-               ptr_unmask_bits(cl->vaddr, CACHELINE_BITS) * CACHELINE_BYTES;
-
+       *hwsp = cl->ggtt_offset;
 out:
        i915_active_release(&cl->active);
        return err;
index 02181c5..4474f48 100644 (file)
@@ -94,6 +94,8 @@ struct intel_timeline_cacheline {
        struct intel_timeline_hwsp *hwsp;
        void *vaddr;
 
+       u32 ggtt_offset;
+
        struct rcu_head rcu;
 };
 
index 35406ec..ef5aeeb 100644 (file)
@@ -3,9 +3,203 @@
  * Copyright © 2018 Intel Corporation
  */
 
+#include <linux/crc32.h>
+
+#include "gem/i915_gem_stolen.h"
+
+#include "i915_memcpy.h"
 #include "i915_selftest.h"
 #include "selftests/igt_reset.h"
 #include "selftests/igt_atomic.h"
+#include "selftests/igt_spinner.h"
+
+static int
+__igt_reset_stolen(struct intel_gt *gt,
+                  intel_engine_mask_t mask,
+                  const char *msg)
+{
+       struct i915_ggtt *ggtt = &gt->i915->ggtt;
+       const struct resource *dsm = &gt->i915->dsm;
+       resource_size_t num_pages, page;
+       struct intel_engine_cs *engine;
+       intel_wakeref_t wakeref;
+       enum intel_engine_id id;
+       struct igt_spinner spin;
+       long max, count;
+       void *tmp;
+       u32 *crc;
+       int err;
+
+       if (!drm_mm_node_allocated(&ggtt->error_capture))
+               return 0;
+
+       num_pages = resource_size(dsm) >> PAGE_SHIFT;
+       if (!num_pages)
+               return 0;
+
+       crc = kmalloc_array(num_pages, sizeof(u32), GFP_KERNEL);
+       if (!crc)
+               return -ENOMEM;
+
+       tmp = kmalloc(PAGE_SIZE, GFP_KERNEL);
+       if (!tmp) {
+               err = -ENOMEM;
+               goto err_crc;
+       }
+
+       igt_global_reset_lock(gt);
+       wakeref = intel_runtime_pm_get(gt->uncore->rpm);
+
+       err = igt_spinner_init(&spin, gt);
+       if (err)
+               goto err_lock;
+
+       for_each_engine(engine, gt, id) {
+               struct intel_context *ce;
+               struct i915_request *rq;
+
+               if (!(mask & engine->mask))
+                       continue;
+
+               if (!intel_engine_can_store_dword(engine))
+                       continue;
+
+               ce = intel_context_create(engine);
+               if (IS_ERR(ce)) {
+                       err = PTR_ERR(ce);
+                       goto err_spin;
+               }
+               rq = igt_spinner_create_request(&spin, ce, MI_ARB_CHECK);
+               intel_context_put(ce);
+               if (IS_ERR(rq)) {
+                       err = PTR_ERR(rq);
+                       goto err_spin;
+               }
+               i915_request_add(rq);
+       }
+
+       for (page = 0; page < num_pages; page++) {
+               dma_addr_t dma = (dma_addr_t)dsm->start + (page << PAGE_SHIFT);
+               void __iomem *s;
+               void *in;
+
+               ggtt->vm.insert_page(&ggtt->vm, dma,
+                                    ggtt->error_capture.start,
+                                    I915_CACHE_NONE, 0);
+               mb();
+
+               s = io_mapping_map_wc(&ggtt->iomap,
+                                     ggtt->error_capture.start,
+                                     PAGE_SIZE);
+
+               if (!__drm_mm_interval_first(&gt->i915->mm.stolen,
+                                            page << PAGE_SHIFT,
+                                            ((page + 1) << PAGE_SHIFT) - 1))
+                       memset32(s, STACK_MAGIC, PAGE_SIZE / sizeof(u32));
+
+               in = s;
+               if (i915_memcpy_from_wc(tmp, s, PAGE_SIZE))
+                       in = tmp;
+               crc[page] = crc32_le(0, in, PAGE_SIZE);
+
+               io_mapping_unmap(s);
+       }
+       mb();
+       ggtt->vm.clear_range(&ggtt->vm, ggtt->error_capture.start, PAGE_SIZE);
+
+       if (mask == ALL_ENGINES) {
+               intel_gt_reset(gt, mask, NULL);
+       } else {
+               for_each_engine(engine, gt, id) {
+                       if (mask & engine->mask)
+                               intel_engine_reset(engine, NULL);
+               }
+       }
+
+       max = -1;
+       count = 0;
+       for (page = 0; page < num_pages; page++) {
+               dma_addr_t dma = (dma_addr_t)dsm->start + (page << PAGE_SHIFT);
+               void __iomem *s;
+               void *in;
+               u32 x;
+
+               ggtt->vm.insert_page(&ggtt->vm, dma,
+                                    ggtt->error_capture.start,
+                                    I915_CACHE_NONE, 0);
+               mb();
+
+               s = io_mapping_map_wc(&ggtt->iomap,
+                                     ggtt->error_capture.start,
+                                     PAGE_SIZE);
+
+               in = s;
+               if (i915_memcpy_from_wc(tmp, s, PAGE_SIZE))
+                       in = tmp;
+               x = crc32_le(0, in, PAGE_SIZE);
+
+               if (x != crc[page] &&
+                   !__drm_mm_interval_first(&gt->i915->mm.stolen,
+                                            page << PAGE_SHIFT,
+                                            ((page + 1) << PAGE_SHIFT) - 1)) {
+                       pr_debug("unused stolen page %pa modified by GPU reset\n",
+                                &page);
+                       if (count++ == 0)
+                               igt_hexdump(in, PAGE_SIZE);
+                       max = page;
+               }
+
+               io_mapping_unmap(s);
+       }
+       mb();
+       ggtt->vm.clear_range(&ggtt->vm, ggtt->error_capture.start, PAGE_SIZE);
+
+       if (count > 0) {
+               pr_info("%s reset clobbered %ld pages of stolen, last clobber at page %ld\n",
+                       msg, count, max);
+       }
+       if (max >= I915_GEM_STOLEN_BIAS >> PAGE_SHIFT) {
+               pr_err("%s reset clobbered unreserved area [above %x] of stolen; may cause severe faults\n",
+                      msg, I915_GEM_STOLEN_BIAS);
+               err = -EINVAL;
+       }
+
+err_spin:
+       igt_spinner_fini(&spin);
+
+err_lock:
+       intel_runtime_pm_put(gt->uncore->rpm, wakeref);
+       igt_global_reset_unlock(gt);
+
+       kfree(tmp);
+err_crc:
+       kfree(crc);
+       return err;
+}
+
+static int igt_reset_device_stolen(void *arg)
+{
+       return __igt_reset_stolen(arg, ALL_ENGINES, "device");
+}
+
+static int igt_reset_engines_stolen(void *arg)
+{
+       struct intel_gt *gt = arg;
+       struct intel_engine_cs *engine;
+       enum intel_engine_id id;
+       int err;
+
+       if (!intel_has_reset_engine(gt))
+               return 0;
+
+       for_each_engine(engine, gt, id) {
+               err = __igt_reset_stolen(gt, engine->mask, engine->name);
+               if (err)
+                       return err;
+       }
+
+       return 0;
+}
 
 static int igt_global_reset(void *arg)
 {
@@ -164,6 +358,8 @@ int intel_reset_live_selftests(struct drm_i915_private *i915)
 {
        static const struct i915_subtest tests[] = {
                SUBTEST(igt_global_reset), /* attempt to recover GPU first */
+               SUBTEST(igt_reset_device_stolen),
+               SUBTEST(igt_reset_engines_stolen),
                SUBTEST(igt_wedged_reset),
                SUBTEST(igt_atomic_reset),
                SUBTEST(igt_atomic_engine_reset),
index 3be37e6..eb342a7 100644 (file)
@@ -1489,7 +1489,8 @@ static int hws_pga_write(struct intel_vgpu *vgpu, unsigned int offset,
        const struct intel_engine_cs *engine =
                intel_gvt_render_mmio_to_engine(vgpu->gvt, offset);
 
-       if (!intel_gvt_ggtt_validate_range(vgpu, value, I915_GTT_PAGE_SIZE)) {
+       if (value != 0 &&
+           !intel_gvt_ggtt_validate_range(vgpu, value, I915_GTT_PAGE_SIZE)) {
                gvt_vgpu_err("write invalid HWSP address, reg:0x%x, value:0x%x\n",
                              offset, value);
                return -EINVAL;
@@ -1650,6 +1651,34 @@ static int edp_psr_imr_iir_write(struct intel_vgpu *vgpu,
        return 0;
 }
 
+/**
+ * FixMe:
+ * If guest fills non-priv batch buffer on ApolloLake/Broxton as Mesa i965 did:
+ * 717e7539124d (i965: Use a WC map and memcpy for the batch instead of pwrite.)
+ * Due to the missing flush of bb filled by VM vCPU, host GPU hangs on executing
+ * these MI_BATCH_BUFFER.
+ * Temporarily workaround this by setting SNOOP bit for PAT3 used by PPGTT
+ * PML4 PTE: PAT(0) PCD(1) PWT(1).
+ * The performance is still expected to be low, will need further improvement.
+ */
+static int bxt_ppat_low_write(struct intel_vgpu *vgpu, unsigned int offset,
+                             void *p_data, unsigned int bytes)
+{
+       u64 pat =
+               GEN8_PPAT(0, CHV_PPAT_SNOOP) |
+               GEN8_PPAT(1, 0) |
+               GEN8_PPAT(2, 0) |
+               GEN8_PPAT(3, CHV_PPAT_SNOOP) |
+               GEN8_PPAT(4, CHV_PPAT_SNOOP) |
+               GEN8_PPAT(5, CHV_PPAT_SNOOP) |
+               GEN8_PPAT(6, CHV_PPAT_SNOOP) |
+               GEN8_PPAT(7, CHV_PPAT_SNOOP);
+
+       vgpu_vreg(vgpu, offset) = lower_32_bits(pat);
+
+       return 0;
+}
+
 static int guc_status_read(struct intel_vgpu *vgpu,
                           unsigned int offset, void *p_data,
                           unsigned int bytes)
@@ -2812,7 +2841,7 @@ static int init_bdw_mmio_info(struct intel_gvt *gvt)
 
        MMIO_DH(GEN6_PCODE_MAILBOX, D_BDW_PLUS, NULL, mailbox_write);
 
-       MMIO_D(GEN8_PRIVATE_PAT_LO, D_BDW_PLUS);
+       MMIO_D(GEN8_PRIVATE_PAT_LO, D_BDW_PLUS & ~D_BXT);
        MMIO_D(GEN8_PRIVATE_PAT_HI, D_BDW_PLUS);
 
        MMIO_D(GAMTARBMODE, D_BDW_PLUS);
@@ -3139,7 +3168,7 @@ static int init_skl_mmio_info(struct intel_gvt *gvt)
                 NULL, NULL);
 
        MMIO_DFH(GAMT_CHKN_BIT_REG, D_KBL | D_CFL, F_CMD_ACCESS, NULL, NULL);
-       MMIO_D(GEN9_CTX_PREEMPT_REG, D_SKL_PLUS);
+       MMIO_D(GEN9_CTX_PREEMPT_REG, D_SKL_PLUS & ~D_BXT);
 
        return 0;
 }
@@ -3313,9 +3342,21 @@ static int init_bxt_mmio_info(struct intel_gvt *gvt)
        MMIO_D(GEN8_PUSHBUS_SHIFT, D_BXT);
        MMIO_D(GEN6_GFXPAUSE, D_BXT);
        MMIO_DFH(GEN8_L3SQCREG1, D_BXT, F_CMD_ACCESS, NULL, NULL);
+       MMIO_DFH(GEN8_L3CNTLREG, D_BXT, F_CMD_ACCESS, NULL, NULL);
+       MMIO_DFH(_MMIO(0x20D8), D_BXT, F_CMD_ACCESS, NULL, NULL);
+       MMIO_F(GEN8_RING_CS_GPR(RENDER_RING_BASE, 0), 0x40, F_CMD_ACCESS,
+              0, 0, D_BXT, NULL, NULL);
+       MMIO_F(GEN8_RING_CS_GPR(GEN6_BSD_RING_BASE, 0), 0x40, F_CMD_ACCESS,
+              0, 0, D_BXT, NULL, NULL);
+       MMIO_F(GEN8_RING_CS_GPR(BLT_RING_BASE, 0), 0x40, F_CMD_ACCESS,
+              0, 0, D_BXT, NULL, NULL);
+       MMIO_F(GEN8_RING_CS_GPR(VEBOX_RING_BASE, 0), 0x40, F_CMD_ACCESS,
+              0, 0, D_BXT, NULL, NULL);
 
        MMIO_DFH(GEN9_CTX_PREEMPT_REG, D_BXT, F_CMD_ACCESS, NULL, NULL);
 
+       MMIO_DH(GEN8_PRIVATE_PAT_LO, D_BXT, NULL, bxt_ppat_low_write);
+
        return 0;
 }
 
index 1570eb8..aed2ef6 100644 (file)
@@ -1277,7 +1277,7 @@ void intel_vgpu_clean_submission(struct intel_vgpu *vgpu)
 
        i915_context_ppgtt_root_restore(s, i915_vm_to_ppgtt(s->shadow[0]->vm));
        for_each_engine(engine, vgpu->gvt->gt, id)
-               intel_context_unpin(s->shadow[id]);
+               intel_context_put(s->shadow[id]);
 
        kmem_cache_destroy(s->workloads);
 }
@@ -1369,11 +1369,6 @@ int intel_vgpu_setup_submission(struct intel_vgpu *vgpu)
                        ce->ring = __intel_context_ring_size(ring_size);
                }
 
-               ret = intel_context_pin(ce);
-               intel_context_put(ce);
-               if (ret)
-                       goto out_shadow_ctx;
-
                s->shadow[i] = ce;
        }
 
@@ -1405,7 +1400,6 @@ out_shadow_ctx:
                if (IS_ERR(s->shadow[i]))
                        break;
 
-               intel_context_unpin(s->shadow[i]);
                intel_context_put(s->shadow[i]);
        }
        i915_vm_put(&ppgtt->vm);
@@ -1479,6 +1473,7 @@ void intel_vgpu_destroy_workload(struct intel_vgpu_workload *workload)
 {
        struct intel_vgpu_submission *s = &workload->vgpu->submission;
 
+       intel_context_unpin(s->shadow[workload->engine->id]);
        release_shadow_batch_buffer(workload);
        release_shadow_wa_ctx(&workload->wa_ctx);
 
@@ -1724,6 +1719,12 @@ intel_vgpu_create_workload(struct intel_vgpu *vgpu,
                return ERR_PTR(ret);
        }
 
+       ret = intel_context_pin(s->shadow[engine->id]);
+       if (ret) {
+               intel_vgpu_destroy_workload(workload);
+               return ERR_PTR(ret);
+       }
+
        return workload;
 }
 
index eef9a82..8426d59 100644 (file)
@@ -33,6 +33,8 @@
 #include <uapi/drm/i915_drm.h>
 #include <uapi/drm/drm_fourcc.h>
 
+#include <asm/hypervisor.h>
+
 #include <linux/io-mapping.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
@@ -1760,7 +1762,9 @@ static inline bool intel_vtd_active(void)
        if (intel_iommu_gfx_mapped)
                return true;
 #endif
-       return false;
+
+       /* Running as a guest, we assume the host is enforcing VT'd */
+       return !hypervisor_is_type(X86_HYPER_NATIVE);
 }
 
 static inline bool intel_scanout_needs_vtd_wa(struct drm_i915_private *dev_priv)
index a635ec8..cf6e47a 100644 (file)
@@ -1312,7 +1312,7 @@ capture_vma(struct intel_engine_capture_vma *next,
        }
 
        strcpy(c->name, name);
-       c->vma = i915_vma_get(vma);
+       c->vma = vma; /* reference held while active */
 
        c->next = next;
        return c;
@@ -1402,7 +1402,6 @@ intel_engine_coredump_add_vma(struct intel_engine_coredump *ee,
                                                 compress));
 
                i915_active_release(&vma->active);
-               i915_vma_put(vma);
 
                capture = this->next;
                kfree(this);
index 366ddfc..fb5e30d 100644 (file)
@@ -389,6 +389,7 @@ static const struct intel_device_info ilk_m_info = {
        GEN5_FEATURES,
        PLATFORM(INTEL_IRONLAKE),
        .is_mobile = 1,
+       .has_rps = true,
        .display.has_fbc = 1,
 };
 
index ffb5287..caa9b04 100644 (file)
@@ -314,8 +314,10 @@ static void __vma_release(struct dma_fence_work *work)
 {
        struct i915_vma_work *vw = container_of(work, typeof(*vw), base);
 
-       if (vw->pinned)
+       if (vw->pinned) {
                __i915_gem_object_unpin_pages(vw->pinned);
+               i915_gem_object_put(vw->pinned);
+       }
 
        i915_vm_free_pt_stash(vw->vm, &vw->stash);
        i915_vm_put(vw->vm);
@@ -431,7 +433,7 @@ int i915_vma_bind(struct i915_vma *vma,
 
                if (vma->obj) {
                        __i915_gem_object_pin_pages(vma->obj);
-                       work->pinned = vma->obj;
+                       work->pinned = i915_gem_object_get(vma->obj);
                }
        } else {
                vma->ops->bind_vma(vma->vm, NULL, vma, cache_level, bind_flags);
index 6b5e9d8..180e107 100644 (file)
@@ -87,7 +87,7 @@ __intel_memory_region_get_pages_buddy(struct intel_memory_region *mem,
                min_order = ilog2(size) - ilog2(mem->mm.chunk_size);
        }
 
-       if (size > BIT(mem->mm.max_order) * mem->mm.chunk_size)
+       if (size > mem->mm.size)
                return -E2BIG;
 
        n_pages = size >> ilog2(mem->mm.chunk_size);
index 263ffcb..97ded2a 100644 (file)
@@ -1209,6 +1209,18 @@ unclaimed_reg_debug(struct intel_uncore *uncore,
                spin_unlock(&uncore->debug->lock);
 }
 
+#define __vgpu_read(x) \
+static u##x \
+vgpu_read##x(struct intel_uncore *uncore, i915_reg_t reg, bool trace) { \
+       u##x val = __raw_uncore_read##x(uncore, reg); \
+       trace_i915_reg_rw(false, reg, val, sizeof(val), trace); \
+       return val; \
+}
+__vgpu_read(8)
+__vgpu_read(16)
+__vgpu_read(32)
+__vgpu_read(64)
+
 #define GEN2_READ_HEADER(x) \
        u##x val = 0; \
        assert_rpm_wakelock_held(uncore->rpm);
@@ -1414,6 +1426,16 @@ __gen_reg_write_funcs(gen8);
 #undef GEN6_WRITE_FOOTER
 #undef GEN6_WRITE_HEADER
 
+#define __vgpu_write(x) \
+static void \
+vgpu_write##x(struct intel_uncore *uncore, i915_reg_t reg, u##x val, bool trace) { \
+       trace_i915_reg_rw(true, reg, val, sizeof(val), trace); \
+       __raw_uncore_write##x(uncore, reg, val); \
+}
+__vgpu_write(8)
+__vgpu_write(16)
+__vgpu_write(32)
+
 #define ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, x) \
 do { \
        (uncore)->funcs.mmio_writeb = x##_write8; \
@@ -1735,7 +1757,10 @@ static void uncore_raw_init(struct intel_uncore *uncore)
 {
        GEM_BUG_ON(intel_uncore_has_forcewake(uncore));
 
-       if (IS_GEN(uncore->i915, 5)) {
+       if (intel_vgpu_active(uncore->i915)) {
+               ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, vgpu);
+               ASSIGN_RAW_READ_MMIO_VFUNCS(uncore, vgpu);
+       } else if (IS_GEN(uncore->i915, 5)) {
                ASSIGN_RAW_WRITE_MMIO_VFUNCS(uncore, gen5);
                ASSIGN_RAW_READ_MMIO_VFUNCS(uncore, gen5);
        } else {
index 334b064..0aeba8e 100644 (file)
@@ -261,6 +261,82 @@ err_close_objects:
        return err;
 }
 
+static int igt_mock_splintered_region(void *arg)
+{
+       struct intel_memory_region *mem = arg;
+       struct drm_i915_private *i915 = mem->i915;
+       struct drm_i915_gem_object *obj;
+       unsigned int expected_order;
+       LIST_HEAD(objects);
+       u64 size;
+       int err = 0;
+
+       /*
+        * Sanity check we can still allocate everything even if the
+        * mm.max_order != mm.size. i.e our starting address space size is not a
+        * power-of-two.
+        */
+
+       size = (SZ_4G - 1) & PAGE_MASK;
+       mem = mock_region_create(i915, 0, size, PAGE_SIZE, 0);
+       if (IS_ERR(mem))
+               return PTR_ERR(mem);
+
+       if (mem->mm.size != size) {
+               pr_err("%s size mismatch(%llu != %llu)\n",
+                      __func__, mem->mm.size, size);
+               err = -EINVAL;
+               goto out_put;
+       }
+
+       expected_order = get_order(rounddown_pow_of_two(size));
+       if (mem->mm.max_order != expected_order) {
+               pr_err("%s order mismatch(%u != %u)\n",
+                      __func__, mem->mm.max_order, expected_order);
+               err = -EINVAL;
+               goto out_put;
+       }
+
+       obj = igt_object_create(mem, &objects, size, 0);
+       if (IS_ERR(obj)) {
+               err = PTR_ERR(obj);
+               goto out_close;
+       }
+
+       close_objects(mem, &objects);
+
+       /*
+        * While we should be able allocate everything without any flag
+        * restrictions, if we consider I915_BO_ALLOC_CONTIGUOUS then we are
+        * actually limited to the largest power-of-two for the region size i.e
+        * max_order, due to the inner workings of the buddy allocator. So make
+        * sure that does indeed hold true.
+        */
+
+       obj = igt_object_create(mem, &objects, size, I915_BO_ALLOC_CONTIGUOUS);
+       if (!IS_ERR(obj)) {
+               pr_err("%s too large contiguous allocation was not rejected\n",
+                      __func__);
+               err = -EINVAL;
+               goto out_close;
+       }
+
+       obj = igt_object_create(mem, &objects, rounddown_pow_of_two(size),
+                               I915_BO_ALLOC_CONTIGUOUS);
+       if (IS_ERR(obj)) {
+               pr_err("%s largest possible contiguous allocation failed\n",
+                      __func__);
+               err = PTR_ERR(obj);
+               goto out_close;
+       }
+
+out_close:
+       close_objects(mem, &objects);
+out_put:
+       intel_memory_region_put(mem);
+       return err;
+}
+
 static int igt_gpu_write_dw(struct intel_context *ce,
                            struct i915_vma *vma,
                            u32 dword,
@@ -771,6 +847,7 @@ int intel_memory_region_mock_selftests(void)
        static const struct i915_subtest tests[] = {
                SUBTEST(igt_mock_fill),
                SUBTEST(igt_mock_contiguous),
+               SUBTEST(igt_mock_splintered_region),
        };
        struct intel_memory_region *mem;
        struct drm_i915_private *i915;
index 09660f5..979d96f 100644 (file)
@@ -24,7 +24,7 @@ mock_object_create(struct intel_memory_region *mem,
        struct drm_i915_private *i915 = mem->i915;
        struct drm_i915_gem_object *obj;
 
-       if (size > BIT(mem->mm.max_order) * mem->mm.chunk_size)
+       if (size > mem->mm.size)
                return ERR_PTR(-E2BIG);
 
        obj = i915_gem_object_alloc();
index 71d84c7..d07b39b 100644 (file)
@@ -111,10 +111,6 @@ static int dw_hdmi_imx_parse_dt(struct imx_hdmi *hdmi)
        return 0;
 }
 
-static void dw_hdmi_imx_encoder_disable(struct drm_encoder *encoder)
-{
-}
-
 static void dw_hdmi_imx_encoder_enable(struct drm_encoder *encoder)
 {
        struct imx_hdmi *hdmi = enc_to_imx_hdmi(encoder);
@@ -140,7 +136,6 @@ static int dw_hdmi_imx_atomic_check(struct drm_encoder *encoder,
 
 static const struct drm_encoder_helper_funcs dw_hdmi_imx_encoder_helper_funcs = {
        .enable     = dw_hdmi_imx_encoder_enable,
-       .disable    = dw_hdmi_imx_encoder_disable,
        .atomic_check = dw_hdmi_imx_atomic_check,
 };
 
@@ -219,15 +214,9 @@ static int dw_hdmi_imx_bind(struct device *dev, struct device *master,
        hdmi->dev = &pdev->dev;
        encoder = &hdmi->encoder;
 
-       encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
-       /*
-        * If we failed to find the CRTC(s) which this encoder is
-        * supposed to be connected to, it's because the CRTC has
-        * not been registered yet.  Defer probing, and hope that
-        * the required CRTC is added later.
-        */
-       if (encoder->possible_crtcs == 0)
-               return -EPROBE_DEFER;
+       ret = imx_drm_encoder_parse_of(drm, encoder, dev->of_node);
+       if (ret)
+               return ret;
 
        ret = dw_hdmi_imx_parse_dt(hdmi);
        if (ret < 0)
index 7d00c49..9bf5ad6 100644 (file)
@@ -20,6 +20,7 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_managed.h>
 #include <drm/drm_of.h>
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
@@ -212,7 +213,9 @@ static int imx_drm_bind(struct device *dev)
        drm->mode_config.allow_fb_modifiers = true;
        drm->mode_config.normalize_zpos = true;
 
-       drm_mode_config_init(drm);
+       ret = drmm_mode_config_init(drm);
+       if (ret)
+               return ret;
 
        ret = drm_vblank_init(drm, MAX_CRTC);
        if (ret)
@@ -251,7 +254,6 @@ err_poll_fini:
        drm_kms_helper_poll_fini(drm);
        component_unbind_all(drm->dev, drm);
 err_kms:
-       drm_mode_config_cleanup(drm);
        drm_dev_put(drm);
 
        return ret;
@@ -267,11 +269,9 @@ static void imx_drm_unbind(struct device *dev)
 
        component_unbind_all(drm->dev, drm);
 
-       drm_mode_config_cleanup(drm);
+       drm_dev_put(drm);
 
        dev_set_drvdata(dev, NULL);
-
-       drm_dev_put(drm);
 }
 
 static const struct component_master_ops imx_drm_ops = {
index af757d1..41e2978 100644 (file)
@@ -62,7 +62,6 @@ struct imx_ldb_channel {
        struct i2c_adapter *ddc;
        int chno;
        void *edid;
-       int edid_len;
        struct drm_display_mode mode;
        int mode_valid;
        u32 bus_format;
@@ -536,15 +535,14 @@ static int imx_ldb_panel_ddc(struct device *dev,
        }
 
        if (!channel->ddc) {
+               int edid_len;
+
                /* if no DDC available, fallback to hardcoded EDID */
                dev_dbg(dev, "no ddc available\n");
 
-               edidp = of_get_property(child, "edid",
-                                       &channel->edid_len);
+               edidp = of_get_property(child, "edid", &edid_len);
                if (edidp) {
-                       channel->edid = kmemdup(edidp,
-                                               channel->edid_len,
-                                               GFP_KERNEL);
+                       channel->edid = kmemdup(edidp, edid_len, GFP_KERNEL);
                } else if (!channel->panel) {
                        /* fallback to display-timings node */
                        ret = of_get_drm_display_mode(child,
index 813bb61..2a8d2e3 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/regulator/consumer.h>
-#include <linux/spinlock.h>
 #include <linux/videodev2.h>
 
 #include <video/imx-ipu-v3.h>
@@ -104,8 +103,6 @@ struct imx_tve {
        struct drm_connector connector;
        struct drm_encoder encoder;
        struct device *dev;
-       spinlock_t lock;        /* register lock */
-       bool enabled;
        int mode;
        int di_hsync_pin;
        int di_vsync_pin;
@@ -129,30 +126,10 @@ static inline struct imx_tve *enc_to_tve(struct drm_encoder *e)
        return container_of(e, struct imx_tve, encoder);
 }
 
-static void tve_lock(void *__tve)
-__acquires(&tve->lock)
-{
-       struct imx_tve *tve = __tve;
-
-       spin_lock(&tve->lock);
-}
-
-static void tve_unlock(void *__tve)
-__releases(&tve->lock)
-{
-       struct imx_tve *tve = __tve;
-
-       spin_unlock(&tve->lock);
-}
-
 static void tve_enable(struct imx_tve *tve)
 {
-       if (!tve->enabled) {
-               tve->enabled = true;
-               clk_prepare_enable(tve->clk);
-               regmap_update_bits(tve->regmap, TVE_COM_CONF_REG,
-                                  TVE_EN, TVE_EN);
-       }
+       clk_prepare_enable(tve->clk);
+       regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, TVE_EN, TVE_EN);
 
        /* clear interrupt status register */
        regmap_write(tve->regmap, TVE_STAT_REG, 0xffffffff);
@@ -169,11 +146,8 @@ static void tve_enable(struct imx_tve *tve)
 
 static void tve_disable(struct imx_tve *tve)
 {
-       if (tve->enabled) {
-               tve->enabled = false;
-               regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, TVE_EN, 0);
-               clk_disable_unprepare(tve->clk);
-       }
+       regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, TVE_EN, 0);
+       clk_disable_unprepare(tve->clk);
 }
 
 static int tve_setup_tvout(struct imx_tve *tve)
@@ -500,8 +474,7 @@ static struct regmap_config tve_regmap_config = {
 
        .readable_reg = imx_tve_readable_reg,
 
-       .lock = tve_lock,
-       .unlock = tve_unlock,
+       .fast_io = true,
 
        .max_register = 0xdc,
 };
@@ -511,7 +484,7 @@ static const char * const imx_tve_modes[] = {
        [TVE_MODE_VGA] = "vga",
 };
 
-static const int of_get_tve_mode(struct device_node *np)
+static int of_get_tve_mode(struct device_node *np)
 {
        const char *bm;
        int ret, i;
@@ -544,7 +517,6 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)
        memset(tve, 0, sizeof(*tve));
 
        tve->dev = dev;
-       spin_lock_init(&tve->lock);
 
        ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
        if (ddc_node) {
index 8232f51..2eb8df4 100644 (file)
@@ -28,7 +28,6 @@ struct imx_parallel_display {
        struct drm_bridge bridge;
        struct device *dev;
        void *edid;
-       int edid_len;
        u32 bus_format;
        u32 bus_flags;
        struct drm_display_mode mode;
@@ -41,11 +40,6 @@ static inline struct imx_parallel_display *con_to_imxpd(struct drm_connector *c)
        return container_of(c, struct imx_parallel_display, connector);
 }
 
-static inline struct imx_parallel_display *enc_to_imxpd(struct drm_encoder *e)
-{
-       return container_of(e, struct imx_parallel_display, encoder);
-}
-
 static inline struct imx_parallel_display *bridge_to_imxpd(struct drm_bridge *b)
 {
        return container_of(b, struct imx_parallel_display, bridge);
@@ -310,6 +304,7 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
        struct device_node *np = dev->of_node;
        const u8 *edidp;
        struct imx_parallel_display *imxpd;
+       int edid_len;
        int ret;
        u32 bus_format = 0;
        const char *fmt;
@@ -323,9 +318,9 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
        if (ret && ret != -ENODEV)
                return ret;
 
-       edidp = of_get_property(np, "edid", &imxpd->edid_len);
+       edidp = of_get_property(np, "edid", &edid_len);
        if (edidp)
-               imxpd->edid = kmemdup(edidp, imxpd->edid_len, GFP_KERNEL);
+               imxpd->edid = devm_kmemdup(dev, edidp, edid_len, GFP_KERNEL);
 
        ret = of_property_read_string(np, "interface-pix-fmt", &fmt);
        if (!ret) {
@@ -349,17 +344,8 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
        return 0;
 }
 
-static void imx_pd_unbind(struct device *dev, struct device *master,
-       void *data)
-{
-       struct imx_parallel_display *imxpd = dev_get_drvdata(dev);
-
-       kfree(imxpd->edid);
-}
-
 static const struct component_ops imx_pd_ops = {
        .bind   = imx_pd_bind,
-       .unbind = imx_pd_unbind,
 };
 
 static int imx_pd_probe(struct platform_device *pdev)
index 4d29568..ac03857 100644 (file)
@@ -481,7 +481,7 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)
                mbox_flush(mtk_crtc->cmdq_client->chan, 2000);
                cmdq_handle = cmdq_pkt_create(mtk_crtc->cmdq_client, PAGE_SIZE);
                cmdq_pkt_clear_event(cmdq_handle, mtk_crtc->cmdq_event);
-               cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event);
+               cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event, false);
                mtk_crtc_ddp_config(crtc, cmdq_handle);
                cmdq_pkt_finalize(cmdq_handle);
                cmdq_pkt_flush_async(cmdq_handle, ddp_cmdq_cb, cmdq_handle);
index 498622c..f750881 100644 (file)
@@ -44,6 +44,7 @@ int core507d_new_(const struct nv50_core_func *, struct nouveau_drm *, s32,
                  struct nv50_core **);
 int core507d_init(struct nv50_core *);
 void core507d_ntfy_init(struct nouveau_bo *, u32);
+int core507d_read_caps(struct nv50_disp *disp);
 int core507d_caps_init(struct nouveau_drm *, struct nv50_disp *);
 int core507d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *);
 int core507d_update(struct nv50_core *, u32 *, bool);
@@ -55,6 +56,7 @@ extern const struct nv50_outp_func pior507d;
 int core827d_new(struct nouveau_drm *, s32, struct nv50_core **);
 
 int core907d_new(struct nouveau_drm *, s32, struct nv50_core **);
+int core907d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp);
 extern const struct nv50_outp_func dac907d;
 extern const struct nv50_outp_func sor907d;
 
index 248edf6..e6f16a7 100644 (file)
@@ -78,19 +78,56 @@ core507d_ntfy_init(struct nouveau_bo *bo, u32 offset)
 }
 
 int
-core507d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp)
+core507d_read_caps(struct nv50_disp *disp)
 {
        struct nvif_push *push = disp->core->chan.push;
        int ret;
 
-       if ((ret = PUSH_WAIT(push, 2)))
+       ret = PUSH_WAIT(push, 6);
+       if (ret)
                return ret;
 
+       PUSH_MTHD(push, NV507D, SET_NOTIFIER_CONTROL,
+                 NVDEF(NV507D, SET_NOTIFIER_CONTROL, MODE, WRITE) |
+                 NVVAL(NV507D, SET_NOTIFIER_CONTROL, OFFSET, NV50_DISP_CORE_NTFY >> 2) |
+                 NVDEF(NV507D, SET_NOTIFIER_CONTROL, NOTIFY, ENABLE));
+
        PUSH_MTHD(push, NV507D, GET_CAPABILITIES, 0x00000000);
+
+       PUSH_MTHD(push, NV507D, SET_NOTIFIER_CONTROL,
+                 NVDEF(NV507D, SET_NOTIFIER_CONTROL, NOTIFY, DISABLE));
+
        return PUSH_KICK(push);
 }
 
 int
+core507d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp)
+{
+       struct nv50_core *core = disp->core;
+       struct nouveau_bo *bo = disp->sync;
+       s64 time;
+       int ret;
+
+       NVBO_WR32(bo, NV50_DISP_CORE_NTFY, NV_DISP_CORE_NOTIFIER_1, CAPABILITIES_1,
+                                    NVDEF(NV_DISP_CORE_NOTIFIER_1, CAPABILITIES_1, DONE, FALSE));
+
+       ret = core507d_read_caps(disp);
+       if (ret < 0)
+               return ret;
+
+       time = nvif_msec(core->chan.base.device, 2000ULL,
+                        if (NVBO_TD32(bo, NV50_DISP_CORE_NTFY,
+                                      NV_DISP_CORE_NOTIFIER_1, CAPABILITIES_1, DONE, ==, TRUE))
+                                break;
+                        usleep_range(1, 2);
+                        );
+       if (time < 0)
+               NV_ERROR(drm, "core caps notifier timeout\n");
+
+       return 0;
+}
+
+int
 core507d_init(struct nv50_core *core)
 {
        struct nvif_push *push = core->chan.push;
index b17c035..8564d4d 100644 (file)
 #include "core.h"
 #include "head.h"
 
+#include <nvif/push507c.h>
+#include <nvif/timer.h>
+
+#include <nvhw/class/cl907d.h>
+
+#include "nouveau_bo.h"
+
+int
+core907d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp)
+{
+       struct nv50_core *core = disp->core;
+       struct nouveau_bo *bo = disp->sync;
+       s64 time;
+       int ret;
+
+       NVBO_WR32(bo, NV50_DISP_CORE_NTFY, NV907D_CORE_NOTIFIER_3, CAPABILITIES_4,
+                                    NVDEF(NV907D_CORE_NOTIFIER_3, CAPABILITIES_4, DONE, FALSE));
+
+       ret = core507d_read_caps(disp);
+       if (ret < 0)
+               return ret;
+
+       time = nvif_msec(core->chan.base.device, 2000ULL,
+                        if (NVBO_TD32(bo, NV50_DISP_CORE_NTFY,
+                                      NV907D_CORE_NOTIFIER_3, CAPABILITIES_4, DONE, ==, TRUE))
+                                break;
+                        usleep_range(1, 2);
+                        );
+       if (time < 0)
+               NV_ERROR(drm, "core caps notifier timeout\n");
+
+       return 0;
+}
+
 static const struct nv50_core_func
 core907d = {
        .init = core507d_init,
        .ntfy_init = core507d_ntfy_init,
-       .caps_init = core507d_caps_init,
+       .caps_init = core907d_caps_init,
        .ntfy_wait_done = core507d_ntfy_wait_done,
        .update = core507d_update,
        .head = &head907d,
index 66846f3..1cd3a2a 100644 (file)
@@ -26,7 +26,7 @@ static const struct nv50_core_func
 core917d = {
        .init = core507d_init,
        .ntfy_init = core507d_ntfy_init,
-       .caps_init = core507d_caps_init,
+       .caps_init = core907d_caps_init,
        .ntfy_wait_done = core507d_ntfy_wait_done,
        .update = core507d_update,
        .head = &head917d,
index 2e444ba..6a463f3 100644 (file)
 #define NV_DISP_CORE_NOTIFIER_1_COMPLETION_0_DONE_TRUE                               0x00000001
 #define NV_DISP_CORE_NOTIFIER_1_COMPLETION_0_R0                                      15:1
 #define NV_DISP_CORE_NOTIFIER_1_COMPLETION_0_TIMESTAMP                               29:16
-
+#define NV_DISP_CORE_NOTIFIER_1_CAPABILITIES_1                                       0x00000001
+#define NV_DISP_CORE_NOTIFIER_1_CAPABILITIES_1_DONE                                  0:0
+#define NV_DISP_CORE_NOTIFIER_1_CAPABILITIES_1_DONE_FALSE                            0x00000000
+#define NV_DISP_CORE_NOTIFIER_1_CAPABILITIES_1_DONE_TRUE                             0x00000001
 
 // class methods
 #define NV507D_UPDATE                                                           (0x00000080)
index 34bc3ea..79aff6f 100644 (file)
 #ifndef _cl907d_h_
 #define _cl907d_h_
 
+#define NV907D_CORE_NOTIFIER_3_CAPABILITIES_4                                       0x00000004
+#define NV907D_CORE_NOTIFIER_3_CAPABILITIES_4_DONE                                  0:0
+#define NV907D_CORE_NOTIFIER_3_CAPABILITIES_4_DONE_FALSE                            0x00000000
+#define NV907D_CORE_NOTIFIER_3_CAPABILITIES_4_DONE_TRUE                             0x00000001
 #define NV907D_CORE_NOTIFIER_3_CAPABILITIES_CAP_SOR0_20                             0x00000014
 #define NV907D_CORE_NOTIFIER_3_CAPABILITIES_CAP_SOR0_20_SINGLE_LVDS18               0:0
 #define NV907D_CORE_NOTIFIER_3_CAPABILITIES_CAP_SOR0_20_SINGLE_LVDS18_FALSE         0x00000000
index 49dd0cb..6f21f36 100644 (file)
@@ -1023,29 +1023,6 @@ get_tmds_link_bandwidth(struct drm_connector *connector)
                return 112000 * duallink_scale;
 }
 
-enum drm_mode_status
-nouveau_conn_mode_clock_valid(const struct drm_display_mode *mode,
-                             const unsigned min_clock,
-                             const unsigned max_clock,
-                             unsigned int *clock_out)
-{
-       unsigned int clock = mode->clock;
-
-       if ((mode->flags & DRM_MODE_FLAG_3D_MASK) ==
-           DRM_MODE_FLAG_3D_FRAME_PACKING)
-               clock *= 2;
-
-       if (clock < min_clock)
-               return MODE_CLOCK_LOW;
-       if (clock > max_clock)
-               return MODE_CLOCK_HIGH;
-
-       if (clock_out)
-               *clock_out = clock;
-
-       return MODE_OK;
-}
-
 static enum drm_mode_status
 nouveau_connector_mode_valid(struct drm_connector *connector,
                             struct drm_display_mode *mode)
@@ -1053,7 +1030,7 @@ nouveau_connector_mode_valid(struct drm_connector *connector,
        struct nouveau_connector *nv_connector = nouveau_connector(connector);
        struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
        struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
-       unsigned min_clock = 25000, max_clock = min_clock;
+       unsigned int min_clock = 25000, max_clock = min_clock, clock = mode->clock;
 
        switch (nv_encoder->dcb->type) {
        case DCB_OUTPUT_LVDS:
@@ -1082,8 +1059,15 @@ nouveau_connector_mode_valid(struct drm_connector *connector,
                return MODE_BAD;
        }
 
-       return nouveau_conn_mode_clock_valid(mode, min_clock, max_clock,
-                                            NULL);
+       if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
+               clock *= 2;
+
+       if (clock < min_clock)
+               return MODE_CLOCK_LOW;
+       if (clock > max_clock)
+               return MODE_CLOCK_HIGH;
+
+       return MODE_OK;
 }
 
 static struct drm_encoder *
index 7b640e0..040ed88 100644 (file)
@@ -231,23 +231,30 @@ nv50_dp_mode_valid(struct drm_connector *connector,
                   const struct drm_display_mode *mode,
                   unsigned *out_clock)
 {
-       const unsigned min_clock = 25000;
-       unsigned max_clock, ds_clock, clock;
-       enum drm_mode_status ret;
+       const unsigned int min_clock = 25000;
+       unsigned int max_rate, mode_rate, ds_max_dotclock, clock = mode->clock;
+       const u8 bpp = connector->display_info.bpc * 3;
 
        if (mode->flags & DRM_MODE_FLAG_INTERLACE && !outp->caps.dp_interlace)
                return MODE_NO_INTERLACE;
 
-       max_clock = outp->dp.link_nr * outp->dp.link_bw;
-       ds_clock = drm_dp_downstream_max_dotclock(outp->dp.dpcd,
-                                                 outp->dp.downstream_ports);
-       if (ds_clock)
-               max_clock = min(max_clock, ds_clock);
+       if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
+               clock *= 2;
+
+       max_rate = outp->dp.link_nr * outp->dp.link_bw;
+       mode_rate = DIV_ROUND_UP(clock * bpp, 8);
+       if (mode_rate > max_rate)
+               return MODE_CLOCK_HIGH;
+
+       ds_max_dotclock = drm_dp_downstream_max_dotclock(outp->dp.dpcd, outp->dp.downstream_ports);
+       if (ds_max_dotclock && clock > ds_max_dotclock)
+               return MODE_CLOCK_HIGH;
+
+       if (clock < min_clock)
+               return MODE_CLOCK_LOW;
 
-       clock = mode->clock * (connector->display_info.bpc * 3) / 10;
-       ret = nouveau_conn_mode_clock_valid(mode, min_clock, max_clock,
-                                           &clock);
        if (out_clock)
                *out_clock = clock;
-       return ret;
+
+       return MODE_OK;
 }
index 89adadf..549bc67 100644 (file)
@@ -190,7 +190,8 @@ nouveau_gem_new(struct nouveau_cli *cli, u64 size, int align, uint32_t domain,
         * to the caller, instead of a normal nouveau_bo ttm reference. */
        ret = drm_gem_object_init(drm->dev, &nvbo->bo.base, size);
        if (ret) {
-               nouveau_bo_ref(NULL, &nvbo);
+               drm_gem_object_release(&nvbo->bo.base);
+               kfree(nvbo);
                return ret;
        }
 
index 2df1c04..4f69e4c 100644 (file)
@@ -105,11 +105,11 @@ nouveau_svmm_bind(struct drm_device *dev, void *data,
        struct nouveau_cli *cli = nouveau_cli(file_priv);
        struct drm_nouveau_svm_bind *args = data;
        unsigned target, cmd, priority;
-       unsigned long addr, end, size;
+       unsigned long addr, end;
        struct mm_struct *mm;
 
        args->va_start &= PAGE_MASK;
-       args->va_end &= PAGE_MASK;
+       args->va_end = ALIGN(args->va_end, PAGE_SIZE);
 
        /* Sanity check arguments */
        if (args->reserved0 || args->reserved1)
@@ -118,8 +118,6 @@ nouveau_svmm_bind(struct drm_device *dev, void *data,
                return -EINVAL;
        if (args->va_start >= args->va_end)
                return -EINVAL;
-       if (!args->npages)
-               return -EINVAL;
 
        cmd = args->header >> NOUVEAU_SVM_BIND_COMMAND_SHIFT;
        cmd &= NOUVEAU_SVM_BIND_COMMAND_MASK;
@@ -151,12 +149,6 @@ nouveau_svmm_bind(struct drm_device *dev, void *data,
        if (args->stride)
                return -EINVAL;
 
-       size = ((unsigned long)args->npages) << PAGE_SHIFT;
-       if ((args->va_start + size) <= args->va_start)
-               return -EINVAL;
-       if ((args->va_start + size) > args->va_end)
-               return -EINVAL;
-
        /*
         * Ok we are ask to do something sane, for now we only support migrate
         * commands but we will add things like memory policy (what to do on
@@ -171,7 +163,7 @@ nouveau_svmm_bind(struct drm_device *dev, void *data,
                return -EINVAL;
        }
 
-       for (addr = args->va_start, end = args->va_start + size; addr < end;) {
+       for (addr = args->va_start, end = args->va_end; addr < end;) {
                struct vm_area_struct *vma;
                unsigned long next;
 
index dcb7067..7851bec 100644 (file)
@@ -2924,17 +2924,34 @@ nvkm_device_del(struct nvkm_device **pdevice)
        }
 }
 
+/* returns true if the GPU is in the CPU native byte order */
 static inline bool
 nvkm_device_endianness(struct nvkm_device *device)
 {
-       u32 boot1 = nvkm_rd32(device, 0x000004) & 0x01000001;
 #ifdef __BIG_ENDIAN
-       if (!boot1)
-               return false;
+       const bool big_endian = true;
 #else
-       if (boot1)
-               return false;
+       const bool big_endian = false;
 #endif
+
+       /* Read NV_PMC_BOOT_1, and assume non-functional endian switch if it
+        * doesn't contain the expected values.
+        */
+       u32 pmc_boot_1 = nvkm_rd32(device, 0x000004);
+       if (pmc_boot_1 && pmc_boot_1 != 0x01000001)
+               return !big_endian; /* Assume GPU is LE in this case. */
+
+       /* 0 means LE and 0x01000001 means BE GPU. Condition is true when
+        * GPU/CPU endianness don't match.
+        */
+       if (big_endian == !pmc_boot_1) {
+               nvkm_wr32(device, 0x000004, 0x01000001);
+               nvkm_rd32(device, 0x000000);
+               if (nvkm_rd32(device, 0x000004) != (big_endian ? 0x01000001 : 0x00000000))
+                       return !big_endian; /* Assume GPU is LE on any unexpected read-back. */
+       }
+
+       /* CPU/GPU endianness should (hopefully) match. */
        return true;
 }
 
@@ -2987,14 +3004,10 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
        if (detect) {
                /* switch mmio to cpu's native endianness */
                if (!nvkm_device_endianness(device)) {
-                       nvkm_wr32(device, 0x000004, 0x01000001);
-                       nvkm_rd32(device, 0x000000);
-                       if (!nvkm_device_endianness(device)) {
-                               nvdev_error(device,
-                                           "GPU not supported on big-endian\n");
-                               ret = -ENOSYS;
-                               goto done;
-                       }
+                       nvdev_error(device,
+                                   "Couldn't switch GPU to CPUs endianess\n");
+                       ret = -ENOSYS;
+                       goto done;
                }
 
                boot0 = nvkm_rd32(device, 0x000000);
index 3482e28..0c5f22e 100644 (file)
@@ -26,7 +26,9 @@
 struct mantix {
        struct device *dev;
        struct drm_panel panel;
+
        struct gpio_desc *reset_gpio;
+       struct gpio_desc *tp_rstn_gpio;
 
        struct regulator *avdd;
        struct regulator *avee;
@@ -124,6 +126,10 @@ static int mantix_unprepare(struct drm_panel *panel)
 {
        struct mantix *ctx = panel_to_mantix(panel);
 
+       gpiod_set_value_cansleep(ctx->tp_rstn_gpio, 1);
+       usleep_range(5000, 6000);
+       gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+
        regulator_disable(ctx->avee);
        regulator_disable(ctx->avdd);
        /* T11 */
@@ -165,13 +171,10 @@ static int mantix_prepare(struct drm_panel *panel)
                return ret;
        }
 
-       /* T3+T5 */
-       usleep_range(10000, 12000);
-
-       gpiod_set_value_cansleep(ctx->reset_gpio, 1);
-       usleep_range(5150, 7000);
-
+       /* T3 + T4 + time for voltage to become stable: */
+       usleep_range(6000, 7000);
        gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+       gpiod_set_value_cansleep(ctx->tp_rstn_gpio, 0);
 
        /* T6 */
        msleep(50);
@@ -204,7 +207,7 @@ static int mantix_get_modes(struct drm_panel *panel,
        if (!mode) {
                dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n",
                        default_mode.hdisplay, default_mode.vdisplay,
-                       drm_mode_vrefresh(mode));
+                       drm_mode_vrefresh(&default_mode));
                return -ENOMEM;
        }
 
@@ -236,12 +239,18 @@ static int mantix_probe(struct mipi_dsi_device *dsi)
        if (!ctx)
                return -ENOMEM;
 
-       ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
+       ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
        if (IS_ERR(ctx->reset_gpio)) {
                dev_err(dev, "cannot get reset gpio\n");
                return PTR_ERR(ctx->reset_gpio);
        }
 
+       ctx->tp_rstn_gpio = devm_gpiod_get(dev, "mantix,tp-rstn", GPIOD_OUT_HIGH);
+       if (IS_ERR(ctx->tp_rstn_gpio)) {
+               dev_err(dev, "cannot get tp-rstn gpio\n");
+               return PTR_ERR(ctx->tp_rstn_gpio);
+       }
+
        mipi_dsi_set_drvdata(dsi, ctx);
        ctx->dev = dev;
 
index 37d4cb7..0fc0841 100644 (file)
@@ -626,6 +626,7 @@ static int panfrost_probe(struct platform_device *pdev)
 err_out1:
        pm_runtime_disable(pfdev->dev);
        panfrost_device_fini(pfdev);
+       pm_runtime_set_suspended(pfdev->dev);
 err_out0:
        drm_dev_put(ddev);
        return err;
@@ -640,9 +641,9 @@ static int panfrost_remove(struct platform_device *pdev)
        panfrost_gem_shrinker_cleanup(ddev);
 
        pm_runtime_get_sync(pfdev->dev);
-       panfrost_device_fini(pfdev);
-       pm_runtime_put_sync_suspend(pfdev->dev);
        pm_runtime_disable(pfdev->dev);
+       panfrost_device_fini(pfdev);
+       pm_runtime_set_suspended(pfdev->dev);
 
        drm_dev_put(ddev);
        return 0;
index 1a6cea0..62d4d71 100644 (file)
@@ -105,14 +105,12 @@ void panfrost_gem_mapping_put(struct panfrost_gem_mapping *mapping)
        kref_put(&mapping->refcount, panfrost_gem_mapping_release);
 }
 
-void panfrost_gem_teardown_mappings(struct panfrost_gem_object *bo)
+void panfrost_gem_teardown_mappings_locked(struct panfrost_gem_object *bo)
 {
        struct panfrost_gem_mapping *mapping;
 
-       mutex_lock(&bo->mappings.lock);
        list_for_each_entry(mapping, &bo->mappings.list, node)
                panfrost_gem_teardown_mapping(mapping);
-       mutex_unlock(&bo->mappings.lock);
 }
 
 int panfrost_gem_open(struct drm_gem_object *obj, struct drm_file *file_priv)
index b3517ff..8088d5f 100644 (file)
@@ -82,7 +82,7 @@ struct panfrost_gem_mapping *
 panfrost_gem_mapping_get(struct panfrost_gem_object *bo,
                         struct panfrost_file_priv *priv);
 void panfrost_gem_mapping_put(struct panfrost_gem_mapping *mapping);
-void panfrost_gem_teardown_mappings(struct panfrost_gem_object *bo);
+void panfrost_gem_teardown_mappings_locked(struct panfrost_gem_object *bo);
 
 void panfrost_gem_shrinker_init(struct drm_device *dev);
 void panfrost_gem_shrinker_cleanup(struct drm_device *dev);
index 288e46c..1b9f68d 100644 (file)
@@ -40,18 +40,26 @@ static bool panfrost_gem_purge(struct drm_gem_object *obj)
 {
        struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
        struct panfrost_gem_object *bo = to_panfrost_bo(obj);
+       bool ret = false;
 
        if (atomic_read(&bo->gpu_usecount))
                return false;
 
-       if (!mutex_trylock(&shmem->pages_lock))
+       if (!mutex_trylock(&bo->mappings.lock))
                return false;
 
-       panfrost_gem_teardown_mappings(bo);
+       if (!mutex_trylock(&shmem->pages_lock))
+               goto unlock_mappings;
+
+       panfrost_gem_teardown_mappings_locked(bo);
        drm_gem_shmem_purge_locked(obj);
+       ret = true;
 
        mutex_unlock(&shmem->pages_lock);
-       return true;
+
+unlock_mappings:
+       mutex_unlock(&bo->mappings.lock);
+       return ret;
 }
 
 static unsigned long
index b51cc68..edb60ae 100644 (file)
@@ -407,6 +407,7 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
        struct drm_framebuffer *fb = state->fb;
        const struct drm_format_info *format = fb->format;
        uint64_t modifier = fb->modifier;
+       unsigned int ch1_phase_idx;
        u32 out_fmt_val;
        u32 in_fmt_val, in_mod_val, in_ps_val;
        unsigned int i;
@@ -442,18 +443,19 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
         * I have no idea what this does exactly, but it seems to be
         * related to the scaler FIR filter phase parameters.
         */
+       ch1_phase_idx = (format->num_planes > 1) ? 1 : 0;
        regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_HORZPHASE_REG,
-                    frontend->data->ch_phase[0].horzphase);
+                    frontend->data->ch_phase[0]);
        regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_HORZPHASE_REG,
-                    frontend->data->ch_phase[1].horzphase);
+                    frontend->data->ch_phase[ch1_phase_idx]);
        regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_VERTPHASE0_REG,
-                    frontend->data->ch_phase[0].vertphase[0]);
+                    frontend->data->ch_phase[0]);
        regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_VERTPHASE0_REG,
-                    frontend->data->ch_phase[1].vertphase[0]);
+                    frontend->data->ch_phase[ch1_phase_idx]);
        regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_VERTPHASE1_REG,
-                    frontend->data->ch_phase[0].vertphase[1]);
+                    frontend->data->ch_phase[0]);
        regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_VERTPHASE1_REG,
-                    frontend->data->ch_phase[1].vertphase[1]);
+                    frontend->data->ch_phase[ch1_phase_idx]);
 
        /*
         * Checking the input format is sufficient since we currently only
@@ -687,30 +689,12 @@ static const struct dev_pm_ops sun4i_frontend_pm_ops = {
 };
 
 static const struct sun4i_frontend_data sun4i_a10_frontend = {
-       .ch_phase               = {
-               {
-                       .horzphase = 0,
-                       .vertphase = { 0, 0 },
-               },
-               {
-                       .horzphase = 0xfc000,
-                       .vertphase = { 0xfc000, 0xfc000 },
-               },
-       },
+       .ch_phase               = { 0x000, 0xfc000 },
        .has_coef_rdy           = true,
 };
 
 static const struct sun4i_frontend_data sun8i_a33_frontend = {
-       .ch_phase               = {
-               {
-                       .horzphase = 0x400,
-                       .vertphase = { 0x400, 0x400 },
-               },
-               {
-                       .horzphase = 0x400,
-                       .vertphase = { 0x400, 0x400 },
-               },
-       },
+       .ch_phase               = { 0x400, 0xfc400 },
        .has_coef_access_ctrl   = true,
 };
 
index 0c382c1..2e7b76e 100644 (file)
@@ -115,11 +115,7 @@ struct reset_control;
 struct sun4i_frontend_data {
        bool    has_coef_access_ctrl;
        bool    has_coef_rdy;
-
-       struct {
-               u32     horzphase;
-               u32     vertphase[2];
-       } ch_phase[2];
+       u32     ch_phase[2];
 };
 
 struct sun4i_frontend {
index 70b3bee..eb4b7df 100644 (file)
@@ -647,7 +647,7 @@ bool ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
        /* Don't evict this BO if it's outside of the
         * requested placement range
         */
-       if (place->fpfn >= (bo->mem.start + bo->mem.size) ||
+       if (place->fpfn >= (bo->mem.start + bo->mem.num_pages) ||
            (place->lpfn && place->lpfn <= bo->mem.start))
                return false;
 
index 915f8bf..182c586 100644 (file)
@@ -568,7 +568,6 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
                ret = v3d_job_init(v3d, file_priv, &bin->base,
                                   v3d_job_free, args->in_sync_bcl);
                if (ret) {
-                       kfree(bin);
                        v3d_job_put(&render->base);
                        kfree(bin);
                        return ret;
index 74ceebd..cc74a3f 100644 (file)
@@ -449,7 +449,7 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size,
        }
 
        if (IS_ERR(cma_obj)) {
-               struct drm_printer p = drm_info_printer(vc4->dev->dev);
+               struct drm_printer p = drm_info_printer(vc4->base.dev);
                DRM_ERROR("Failed to allocate from CMA:\n");
                vc4_bo_stats_print(&p, vc4);
                return ERR_PTR(-ENOMEM);
@@ -590,7 +590,7 @@ static void vc4_bo_cache_time_work(struct work_struct *work)
 {
        struct vc4_dev *vc4 =
                container_of(work, struct vc4_dev, bo_cache.time_work);
-       struct drm_device *dev = vc4->dev;
+       struct drm_device *dev = &vc4->base;
 
        mutex_lock(&vc4->bo_lock);
        vc4_bo_cache_free_old(dev);
@@ -1005,6 +1005,7 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data,
        return 0;
 }
 
+static void vc4_bo_cache_destroy(struct drm_device *dev, void *unused);
 int vc4_bo_cache_init(struct drm_device *dev)
 {
        struct vc4_dev *vc4 = to_vc4_dev(dev);
@@ -1033,10 +1034,10 @@ int vc4_bo_cache_init(struct drm_device *dev)
        INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work);
        timer_setup(&vc4->bo_cache.time_timer, vc4_bo_cache_time_timer, 0);
 
-       return 0;
+       return drmm_add_action_or_reset(dev, vc4_bo_cache_destroy, NULL);
 }
 
-void vc4_bo_cache_destroy(struct drm_device *dev)
+static void vc4_bo_cache_destroy(struct drm_device *dev, void *unused)
 {
        struct vc4_dev *vc4 = to_vc4_dev(dev);
        int i;
index f1a5fd5..839610f 100644 (file)
@@ -257,37 +257,37 @@ static int vc4_drm_bind(struct device *dev)
 
        dev->coherent_dma_mask = DMA_BIT_MASK(32);
 
-       vc4 = devm_kzalloc(dev, sizeof(*vc4), GFP_KERNEL);
-       if (!vc4)
-               return -ENOMEM;
-
        /* If VC4 V3D is missing, don't advertise render nodes. */
        node = of_find_matching_node_and_match(NULL, vc4_v3d_dt_match, NULL);
        if (!node || !of_device_is_available(node))
                vc4_drm_driver.driver_features &= ~DRIVER_RENDER;
        of_node_put(node);
 
-       drm = drm_dev_alloc(&vc4_drm_driver, dev);
-       if (IS_ERR(drm))
-               return PTR_ERR(drm);
+       vc4 = devm_drm_dev_alloc(dev, &vc4_drm_driver, struct vc4_dev, base);
+       if (IS_ERR(vc4))
+               return PTR_ERR(vc4);
+
+       drm = &vc4->base;
        platform_set_drvdata(pdev, drm);
-       vc4->dev = drm;
-       drm->dev_private = vc4;
        INIT_LIST_HEAD(&vc4->debugfs_list);
 
        mutex_init(&vc4->bin_bo_lock);
 
        ret = vc4_bo_cache_init(drm);
        if (ret)
-               goto dev_put;
+               return ret;
 
-       drm_mode_config_init(drm);
+       ret = drmm_mode_config_init(drm);
+       if (ret)
+               return ret;
 
-       vc4_gem_init(drm);
+       ret = vc4_gem_init(drm);
+       if (ret)
+               return ret;
 
        ret = component_bind_all(dev, drm);
        if (ret)
-               goto gem_destroy;
+               return ret;
 
        ret = vc4_plane_create_additional_planes(drm);
        if (ret)
@@ -312,29 +312,17 @@ static int vc4_drm_bind(struct device *dev)
 
 unbind_all:
        component_unbind_all(dev, drm);
-gem_destroy:
-       vc4_gem_destroy(drm);
-       vc4_bo_cache_destroy(drm);
-dev_put:
-       drm_dev_put(drm);
+
        return ret;
 }
 
 static void vc4_drm_unbind(struct device *dev)
 {
        struct drm_device *drm = dev_get_drvdata(dev);
-       struct vc4_dev *vc4 = to_vc4_dev(drm);
 
        drm_dev_unregister(drm);
 
        drm_atomic_helper_shutdown(drm);
-
-       drm_mode_config_cleanup(drm);
-
-       drm_atomic_private_obj_fini(&vc4->load_tracker);
-       drm_atomic_private_obj_fini(&vc4->ctm_manager);
-
-       drm_dev_put(drm);
 }
 
 static const struct component_master_ops vc4_drm_ops = {
index 90b911f..19b75be 100644 (file)
@@ -14,6 +14,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_encoder.h>
 #include <drm/drm_gem_cma_helper.h>
+#include <drm/drm_managed.h>
 #include <drm/drm_mm.h>
 #include <drm/drm_modeset_lock.h>
 
@@ -71,7 +72,7 @@ struct vc4_perfmon {
 };
 
 struct vc4_dev {
-       struct drm_device *dev;
+       struct drm_device base;
 
        struct vc4_hvs *hvs;
        struct vc4_v3d *v3d;
@@ -234,7 +235,7 @@ struct vc4_dev {
 static inline struct vc4_dev *
 to_vc4_dev(struct drm_device *dev)
 {
-       return (struct vc4_dev *)dev->dev_private;
+       return container_of(dev, struct vc4_dev, base);
 }
 
 struct vc4_bo {
@@ -287,7 +288,7 @@ struct vc4_bo {
 static inline struct vc4_bo *
 to_vc4_bo(struct drm_gem_object *bo)
 {
-       return (struct vc4_bo *)bo;
+       return container_of(to_drm_gem_cma_obj(bo), struct vc4_bo, base);
 }
 
 struct vc4_fence {
@@ -300,7 +301,7 @@ struct vc4_fence {
 static inline struct vc4_fence *
 to_vc4_fence(struct dma_fence *fence)
 {
-       return (struct vc4_fence *)fence;
+       return container_of(fence, struct vc4_fence, base);
 }
 
 struct vc4_seqno_cb {
@@ -347,7 +348,7 @@ struct vc4_plane {
 static inline struct vc4_plane *
 to_vc4_plane(struct drm_plane *plane)
 {
-       return (struct vc4_plane *)plane;
+       return container_of(plane, struct vc4_plane, base);
 }
 
 enum vc4_scaling_mode {
@@ -423,7 +424,7 @@ struct vc4_plane_state {
 static inline struct vc4_plane_state *
 to_vc4_plane_state(struct drm_plane_state *state)
 {
-       return (struct vc4_plane_state *)state;
+       return container_of(state, struct vc4_plane_state, base);
 }
 
 enum vc4_encoder_type {
@@ -499,7 +500,7 @@ struct vc4_crtc {
 static inline struct vc4_crtc *
 to_vc4_crtc(struct drm_crtc *crtc)
 {
-       return (struct vc4_crtc *)crtc;
+       return container_of(crtc, struct vc4_crtc, base);
 }
 
 static inline const struct vc4_crtc_data *
@@ -537,7 +538,7 @@ struct vc4_crtc_state {
 static inline struct vc4_crtc_state *
 to_vc4_crtc_state(struct drm_crtc_state *crtc_state)
 {
-       return (struct vc4_crtc_state *)crtc_state;
+       return container_of(crtc_state, struct vc4_crtc_state, base);
 }
 
 #define V3D_READ(offset) readl(vc4->v3d->regs + offset)
@@ -809,7 +810,6 @@ struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev,
                                                 struct sg_table *sgt);
 void *vc4_prime_vmap(struct drm_gem_object *obj);
 int vc4_bo_cache_init(struct drm_device *dev);
-void vc4_bo_cache_destroy(struct drm_device *dev);
 int vc4_bo_inc_usecnt(struct vc4_bo *bo);
 void vc4_bo_dec_usecnt(struct vc4_bo *bo);
 void vc4_bo_add_to_purgeable_pool(struct vc4_bo *bo);
@@ -874,8 +874,7 @@ extern struct platform_driver vc4_dsi_driver;
 extern const struct dma_fence_ops vc4_fence_ops;
 
 /* vc4_gem.c */
-void vc4_gem_init(struct drm_device *dev);
-void vc4_gem_destroy(struct drm_device *dev);
+int vc4_gem_init(struct drm_device *dev);
 int vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
                        struct drm_file *file_priv);
 int vc4_wait_seqno_ioctl(struct drm_device *dev, void *data,
index 9f01ddd..b641252 100644 (file)
@@ -314,16 +314,16 @@ vc4_reset_work(struct work_struct *work)
        struct vc4_dev *vc4 =
                container_of(work, struct vc4_dev, hangcheck.reset_work);
 
-       vc4_save_hang_state(vc4->dev);
+       vc4_save_hang_state(&vc4->base);
 
-       vc4_reset(vc4->dev);
+       vc4_reset(&vc4->base);
 }
 
 static void
 vc4_hangcheck_elapsed(struct timer_list *t)
 {
        struct vc4_dev *vc4 = from_timer(vc4, t, hangcheck.timer);
-       struct drm_device *dev = vc4->dev;
+       struct drm_device *dev = &vc4->base;
        uint32_t ct0ca, ct1ca;
        unsigned long irqflags;
        struct vc4_exec_info *bin_exec, *render_exec;
@@ -1000,7 +1000,7 @@ vc4_job_handle_completed(struct vc4_dev *vc4)
                list_del(&exec->head);
 
                spin_unlock_irqrestore(&vc4->job_lock, irqflags);
-               vc4_complete_exec(vc4->dev, exec);
+               vc4_complete_exec(&vc4->base, exec);
                spin_lock_irqsave(&vc4->job_lock, irqflags);
        }
 
@@ -1258,13 +1258,13 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
        return 0;
 
 fail:
-       vc4_complete_exec(vc4->dev, exec);
+       vc4_complete_exec(&vc4->base, exec);
 
        return ret;
 }
 
-void
-vc4_gem_init(struct drm_device *dev)
+static void vc4_gem_destroy(struct drm_device *dev, void *unused);
+int vc4_gem_init(struct drm_device *dev)
 {
        struct vc4_dev *vc4 = to_vc4_dev(dev);
 
@@ -1285,10 +1285,11 @@ vc4_gem_init(struct drm_device *dev)
 
        INIT_LIST_HEAD(&vc4->purgeable.list);
        mutex_init(&vc4->purgeable.lock);
+
+       return drmm_add_action_or_reset(dev, vc4_gem_destroy, NULL);
 }
 
-void
-vc4_gem_destroy(struct drm_device *dev)
+static void vc4_gem_destroy(struct drm_device *dev, void *unused)
 {
        struct vc4_dev *vc4 = to_vc4_dev(dev);
 
index e8f99e2..95779d5 100644 (file)
@@ -922,6 +922,7 @@ static int vc4_hdmi_audio_hw_params(struct snd_pcm_substream *substream,
                                    struct snd_soc_dai *dai)
 {
        struct vc4_hdmi *vc4_hdmi = dai_to_hdmi(dai);
+       struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
        struct device *dev = &vc4_hdmi->pdev->dev;
        u32 audio_packet_config, channel_mask;
        u32 channel_map;
@@ -981,6 +982,8 @@ static int vc4_hdmi_audio_hw_params(struct snd_pcm_substream *substream,
        HDMI_WRITE(HDMI_AUDIO_PACKET_CONFIG, audio_packet_config);
        vc4_hdmi_set_n_cts(vc4_hdmi);
 
+       vc4_hdmi_set_audio_infoframe(encoder);
+
        return 0;
 }
 
@@ -988,11 +991,9 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd,
                                  struct snd_soc_dai *dai)
 {
        struct vc4_hdmi *vc4_hdmi = dai_to_hdmi(dai);
-       struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
 
        switch (cmd) {
        case SNDRV_PCM_TRIGGER_START:
-               vc4_hdmi_set_audio_infoframe(encoder);
                vc4_hdmi->audio.streaming = true;
 
                if (vc4_hdmi->variant->phy_rng_enable)
@@ -1076,6 +1077,7 @@ static const struct snd_soc_dapm_route vc4_hdmi_audio_routes[] = {
 };
 
 static const struct snd_soc_component_driver vc4_hdmi_audio_component_drv = {
+       .name                   = "vc4-hdmi-codec-dai-component",
        .controls               = vc4_hdmi_audio_controls,
        .num_controls           = ARRAY_SIZE(vc4_hdmi_audio_controls),
        .dapm_widgets           = vc4_hdmi_audio_widgets,
index 4d0a833..b72b2bd 100644 (file)
@@ -560,7 +560,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct drm_device *drm = dev_get_drvdata(master);
-       struct vc4_dev *vc4 = drm->dev_private;
+       struct vc4_dev *vc4 = to_vc4_dev(drm);
        struct vc4_hvs *hvs = NULL;
        int ret;
        u32 dispctrl;
@@ -679,7 +679,7 @@ static void vc4_hvs_unbind(struct device *dev, struct device *master,
                           void *data)
 {
        struct drm_device *drm = dev_get_drvdata(master);
-       struct vc4_dev *vc4 = drm->dev_private;
+       struct vc4_dev *vc4 = to_vc4_dev(drm);
        struct vc4_hvs *hvs = vc4->hvs;
 
        if (drm_mm_node_allocated(&vc4->hvs->mitchell_netravali_filter))
index 149825f..2b951ca 100644 (file)
@@ -51,7 +51,7 @@ static struct vc4_ctm_state *vc4_get_ctm_state(struct drm_atomic_state *state,
                                               struct drm_private_obj *manager)
 {
        struct drm_device *dev = state->dev;
-       struct vc4_dev *vc4 = dev->dev_private;
+       struct vc4_dev *vc4 = to_vc4_dev(dev);
        struct drm_private_state *priv_state;
        int ret;
 
@@ -93,6 +93,29 @@ static const struct drm_private_state_funcs vc4_ctm_state_funcs = {
        .atomic_destroy_state = vc4_ctm_destroy_state,
 };
 
+static void vc4_ctm_obj_fini(struct drm_device *dev, void *unused)
+{
+       struct vc4_dev *vc4 = to_vc4_dev(dev);
+
+       drm_atomic_private_obj_fini(&vc4->ctm_manager);
+}
+
+static int vc4_ctm_obj_init(struct vc4_dev *vc4)
+{
+       struct vc4_ctm_state *ctm_state;
+
+       drm_modeset_lock_init(&vc4->ctm_state_lock);
+
+       ctm_state = kzalloc(sizeof(*ctm_state), GFP_KERNEL);
+       if (!ctm_state)
+               return -ENOMEM;
+
+       drm_atomic_private_obj_init(&vc4->base, &vc4->ctm_manager, &ctm_state->base,
+                                   &vc4_ctm_state_funcs);
+
+       return drmm_add_action(&vc4->base, vc4_ctm_obj_fini, NULL);
+}
+
 /* Converts a DRM S31.32 value to the HW S0.9 format. */
 static u16 vc4_ctm_s31_32_to_s0_9(u64 in)
 {
@@ -609,6 +632,34 @@ static const struct drm_private_state_funcs vc4_load_tracker_state_funcs = {
        .atomic_destroy_state = vc4_load_tracker_destroy_state,
 };
 
+static void vc4_load_tracker_obj_fini(struct drm_device *dev, void *unused)
+{
+       struct vc4_dev *vc4 = to_vc4_dev(dev);
+
+       if (!vc4->load_tracker_available)
+               return;
+
+       drm_atomic_private_obj_fini(&vc4->load_tracker);
+}
+
+static int vc4_load_tracker_obj_init(struct vc4_dev *vc4)
+{
+       struct vc4_load_tracker_state *load_state;
+
+       if (!vc4->load_tracker_available)
+               return 0;
+
+       load_state = kzalloc(sizeof(*load_state), GFP_KERNEL);
+       if (!load_state)
+               return -ENOMEM;
+
+       drm_atomic_private_obj_init(&vc4->base, &vc4->load_tracker,
+                                   &load_state->base,
+                                   &vc4_load_tracker_state_funcs);
+
+       return drmm_add_action(&vc4->base, vc4_load_tracker_obj_fini, NULL);
+}
+
 #define NUM_OUTPUTS  6
 #define NUM_CHANNELS 3
 
@@ -711,8 +762,6 @@ static const struct drm_mode_config_funcs vc4_mode_funcs = {
 int vc4_kms_load(struct drm_device *dev)
 {
        struct vc4_dev *vc4 = to_vc4_dev(dev);
-       struct vc4_ctm_state *ctm_state;
-       struct vc4_load_tracker_state *load_state;
        bool is_vc5 = of_device_is_compatible(dev->dev->of_node,
                                              "brcm,bcm2711-vc5");
        int ret;
@@ -751,26 +800,13 @@ int vc4_kms_load(struct drm_device *dev)
        dev->mode_config.async_page_flip = true;
        dev->mode_config.allow_fb_modifiers = true;
 
-       drm_modeset_lock_init(&vc4->ctm_state_lock);
-
-       ctm_state = kzalloc(sizeof(*ctm_state), GFP_KERNEL);
-       if (!ctm_state)
-               return -ENOMEM;
-
-       drm_atomic_private_obj_init(dev, &vc4->ctm_manager, &ctm_state->base,
-                                   &vc4_ctm_state_funcs);
-
-       if (vc4->load_tracker_available) {
-               load_state = kzalloc(sizeof(*load_state), GFP_KERNEL);
-               if (!load_state) {
-                       drm_atomic_private_obj_fini(&vc4->ctm_manager);
-                       return -ENOMEM;
-               }
+       ret = vc4_ctm_obj_init(vc4);
+       if (ret)
+               return ret;
 
-               drm_atomic_private_obj_init(dev, &vc4->load_tracker,
-                                           &load_state->base,
-                                           &vc4_load_tracker_state_funcs);
-       }
+       ret = vc4_load_tracker_obj_init(vc4);
+       if (ret)
+               return ret;
 
        drm_mode_config_reset(dev);
 
index f7ab979..65d0dac 100644 (file)
@@ -168,7 +168,7 @@ static void vc4_v3d_init_hw(struct drm_device *dev)
 
 int vc4_v3d_get_bin_slot(struct vc4_dev *vc4)
 {
-       struct drm_device *dev = vc4->dev;
+       struct drm_device *dev = &vc4->base;
        unsigned long irqflags;
        int slot;
        uint64_t seqno = 0;
@@ -246,7 +246,7 @@ static int bin_bo_alloc(struct vc4_dev *vc4)
        INIT_LIST_HEAD(&list);
 
        while (true) {
-               struct vc4_bo *bo = vc4_bo_create(vc4->dev, size, true,
+               struct vc4_bo *bo = vc4_bo_create(&vc4->base, size, true,
                                                  VC4_BO_TYPE_BIN);
 
                if (IS_ERR(bo)) {
@@ -361,7 +361,7 @@ static int vc4_v3d_runtime_suspend(struct device *dev)
        struct vc4_v3d *v3d = dev_get_drvdata(dev);
        struct vc4_dev *vc4 = v3d->vc4;
 
-       vc4_irq_uninstall(vc4->dev);
+       vc4_irq_uninstall(&vc4->base);
 
        clk_disable_unprepare(v3d->clk);
 
@@ -378,11 +378,11 @@ static int vc4_v3d_runtime_resume(struct device *dev)
        if (ret != 0)
                return ret;
 
-       vc4_v3d_init_hw(vc4->dev);
+       vc4_v3d_init_hw(&vc4->base);
 
        /* We disabled the IRQ as part of vc4_irq_uninstall in suspend. */
-       enable_irq(vc4->dev->irq);
-       vc4_irq_postinstall(vc4->dev);
+       enable_irq(vc4->base.irq);
+       vc4_irq_postinstall(&vc4->base);
 
        return 0;
 }
index b3dae9e..d166ee2 100644 (file)
@@ -133,73 +133,6 @@ enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat)
 }
 EXPORT_SYMBOL_GPL(ipu_pixelformat_to_colorspace);
 
-bool ipu_pixelformat_is_planar(u32 pixelformat)
-{
-       switch (pixelformat) {
-       case V4L2_PIX_FMT_YUV420:
-       case V4L2_PIX_FMT_YVU420:
-       case V4L2_PIX_FMT_YUV422P:
-       case V4L2_PIX_FMT_NV12:
-       case V4L2_PIX_FMT_NV21:
-       case V4L2_PIX_FMT_NV16:
-       case V4L2_PIX_FMT_NV61:
-               return true;
-       }
-
-       return false;
-}
-EXPORT_SYMBOL_GPL(ipu_pixelformat_is_planar);
-
-enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code)
-{
-       switch (mbus_code & 0xf000) {
-       case 0x1000:
-               return IPUV3_COLORSPACE_RGB;
-       case 0x2000:
-               return IPUV3_COLORSPACE_YUV;
-       default:
-               return IPUV3_COLORSPACE_UNKNOWN;
-       }
-}
-EXPORT_SYMBOL_GPL(ipu_mbus_code_to_colorspace);
-
-int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat)
-{
-       switch (pixelformat) {
-       case V4L2_PIX_FMT_YUV420:
-       case V4L2_PIX_FMT_YVU420:
-       case V4L2_PIX_FMT_YUV422P:
-       case V4L2_PIX_FMT_NV12:
-       case V4L2_PIX_FMT_NV21:
-       case V4L2_PIX_FMT_NV16:
-       case V4L2_PIX_FMT_NV61:
-               /*
-                * for the planar YUV formats, the stride passed to
-                * cpmem must be the stride in bytes of the Y plane.
-                * And all the planar YUV formats have an 8-bit
-                * Y component.
-                */
-               return (8 * pixel_stride) >> 3;
-       case V4L2_PIX_FMT_RGB565:
-       case V4L2_PIX_FMT_YUYV:
-       case V4L2_PIX_FMT_UYVY:
-               return (16 * pixel_stride) >> 3;
-       case V4L2_PIX_FMT_BGR24:
-       case V4L2_PIX_FMT_RGB24:
-               return (24 * pixel_stride) >> 3;
-       case V4L2_PIX_FMT_BGR32:
-       case V4L2_PIX_FMT_RGB32:
-       case V4L2_PIX_FMT_XBGR32:
-       case V4L2_PIX_FMT_XRGB32:
-               return (32 * pixel_stride) >> 3;
-       default:
-               break;
-       }
-
-       return -EINVAL;
-}
-EXPORT_SYMBOL_GPL(ipu_stride_to_bytes);
-
 int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees,
                            bool hflip, bool vflip)
 {
index 7f41213..311eee5 100644 (file)
@@ -720,7 +720,7 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
        }
 
        if (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS)
-               rmi_hid_pdata.f30_data.disable = true;
+               rmi_hid_pdata.gpio_data.disable = true;
 
        data->xport.dev = hdev->dev.parent;
        data->xport.pdata = rmi_hid_pdata;
index b64d2ef..eb56e09 100644 (file)
@@ -1275,7 +1275,7 @@ static void balloon_up(struct work_struct *dummy)
 
        /* Refuse to balloon below the floor. */
        if (avail_pages < num_pages || avail_pages - num_pages < floor) {
-               pr_warn("Balloon request will be partially fulfilled. %s\n",
+               pr_info("Balloon request will be partially fulfilled. %s\n",
                        avail_pages < num_pages ? "Not enough memory." :
                        "Balloon floor reached.");
 
index b490fe3..f2703c5 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
 
-#include <plat/adc.h>
+#include <linux/soc/samsung/s3c-adc.h>
 #include <linux/platform_data/hwmon-s3c.h>
 
 struct s3c_hwmon_attr {
index 6994c13..cc9e802 100644 (file)
@@ -1689,6 +1689,7 @@ static void __exit coresight_exit(void)
 module_init(coresight_init);
 module_exit(coresight_exit);
 
+MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Pratik Patel <pratikp@codeaurora.org>");
 MODULE_AUTHOR("Mathieu Poirier <mathieu.poirier@linaro.org>");
 MODULE_DESCRIPTION("Arm CoreSight tracer driver");
index 392757f..7ff7e77 100644 (file)
@@ -1065,6 +1065,13 @@ static int cti_create_con_sysfs_attr(struct device *dev,
        }
        eattr->var = con;
        con->con_attrs[attr_idx] = &eattr->attr.attr;
+       /*
+        * Initialize the dynamically allocated attribute
+        * to avoid LOCKDEP splat. See include/linux/sysfs.h
+        * for more details.
+        */
+       sysfs_attr_init(con->con_attrs[attr_idx]);
+
        return 0;
 }
 
index c2c9b12..bdc34ca 100644 (file)
@@ -210,7 +210,7 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
        u32 id;
        int cpu = event->cpu;
        cpumask_t *mask;
-       struct coresight_device *sink;
+       struct coresight_device *sink = NULL;
        struct etm_event_data *event_data = NULL;
 
        event_data = alloc_event_data(cpu);
index a4f473e..a97a9d0 100644 (file)
@@ -733,7 +733,7 @@ config I2C_LPC2K
 
 config I2C_MLXBF
         tristate "Mellanox BlueField I2C controller"
-        depends on ARM64
+        depends on MELLANOX_PLATFORM && ARM64
         help
           Enabling this option will add I2C SMBus support for Mellanox BlueField
           system.
index 44974b5..0d15f4c 100644 (file)
@@ -159,7 +159,6 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev)
        u32 raw_stat, stat, enabled, tmp;
        u8 val = 0, slave_activity;
 
-       regmap_read(dev->map, DW_IC_INTR_STAT, &stat);
        regmap_read(dev->map, DW_IC_ENABLE, &enabled);
        regmap_read(dev->map, DW_IC_RAW_INTR_STAT, &raw_stat);
        regmap_read(dev->map, DW_IC_STATUS, &tmp);
@@ -168,32 +167,30 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev)
        if (!enabled || !(raw_stat & ~DW_IC_INTR_ACTIVITY) || !dev->slave)
                return 0;
 
+       stat = i2c_dw_read_clear_intrbits_slave(dev);
        dev_dbg(dev->dev,
                "%#x STATUS SLAVE_ACTIVITY=%#x : RAW_INTR_STAT=%#x : INTR_STAT=%#x\n",
                enabled, slave_activity, raw_stat, stat);
 
-       if ((stat & DW_IC_INTR_RX_FULL) && (stat & DW_IC_INTR_STOP_DET))
-               i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_REQUESTED, &val);
+       if (stat & DW_IC_INTR_RX_FULL) {
+               if (dev->status != STATUS_WRITE_IN_PROGRESS) {
+                       dev->status = STATUS_WRITE_IN_PROGRESS;
+                       i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_REQUESTED,
+                                       &val);
+               }
+
+               regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
+               val = tmp;
+               if (!i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_RECEIVED,
+                                    &val))
+                       dev_vdbg(dev->dev, "Byte %X acked!", val);
+       }
 
        if (stat & DW_IC_INTR_RD_REQ) {
                if (slave_activity) {
-                       if (stat & DW_IC_INTR_RX_FULL) {
-                               regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
-                               val = tmp;
-
-                               if (!i2c_slave_event(dev->slave,
-                                                    I2C_SLAVE_WRITE_RECEIVED,
-                                                    &val)) {
-                                       dev_vdbg(dev->dev, "Byte %X acked!",
-                                                val);
-                               }
-                               regmap_read(dev->map, DW_IC_CLR_RD_REQ, &tmp);
-                               stat = i2c_dw_read_clear_intrbits_slave(dev);
-                       } else {
-                               regmap_read(dev->map, DW_IC_CLR_RD_REQ, &tmp);
-                               regmap_read(dev->map, DW_IC_CLR_RX_UNDER, &tmp);
-                               stat = i2c_dw_read_clear_intrbits_slave(dev);
-                       }
+                       regmap_read(dev->map, DW_IC_CLR_RD_REQ, &tmp);
+
+                       dev->status = STATUS_READ_IN_PROGRESS;
                        if (!i2c_slave_event(dev->slave,
                                             I2C_SLAVE_READ_REQUESTED,
                                             &val))
@@ -205,21 +202,11 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev)
                if (!i2c_slave_event(dev->slave, I2C_SLAVE_READ_PROCESSED,
                                     &val))
                        regmap_read(dev->map, DW_IC_CLR_RX_DONE, &tmp);
-
-               i2c_slave_event(dev->slave, I2C_SLAVE_STOP, &val);
-               stat = i2c_dw_read_clear_intrbits_slave(dev);
-               return 1;
        }
 
-       if (stat & DW_IC_INTR_RX_FULL) {
-               regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
-               val = tmp;
-               if (!i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_RECEIVED,
-                                    &val))
-                       dev_vdbg(dev->dev, "Byte %X acked!", val);
-       } else {
+       if (stat & DW_IC_INTR_STOP_DET) {
+               dev->status = STATUS_IDLE;
                i2c_slave_event(dev->slave, I2C_SLAVE_STOP, &val);
-               stat = i2c_dw_read_clear_intrbits_slave(dev);
        }
 
        return 1;
@@ -230,7 +217,6 @@ static irqreturn_t i2c_dw_isr_slave(int this_irq, void *dev_id)
        struct dw_i2c_dev *dev = dev_id;
        int ret;
 
-       i2c_dw_read_clear_intrbits_slave(dev);
        ret = i2c_dw_irq_handler_slave(dev);
        if (ret > 0)
                complete(&dev->cmd_complete);
index ee59e0d..33574d4 100644 (file)
  * Master. Default value is set to 400MHz.
  */
 #define MLXBF_I2C_TYU_PLL_OUT_FREQ  (400 * 1000 * 1000)
-/* Reference clock for Bluefield 1 - 156 MHz. */
-#define MLXBF_I2C_TYU_PLL_IN_FREQ   (156 * 1000 * 1000)
-/* Reference clock for BlueField 2 - 200 MHz. */
-#define MLXBF_I2C_YU_PLL_IN_FREQ    (200 * 1000 * 1000)
+/* Reference clock for Bluefield - 156 MHz. */
+#define MLXBF_I2C_PLL_IN_FREQ       (156 * 1000 * 1000)
 
 /* Constant used to determine the PLL frequency. */
 #define MLNXBF_I2C_COREPLL_CONST    16384
@@ -489,44 +487,6 @@ static struct mutex mlxbf_i2c_bus_lock;
 
 #define MLXBF_I2C_FREQUENCY_1GHZ  1000000000
 
-static void mlxbf_i2c_write(void __iomem *io, int reg, u32 val)
-{
-       writel(val, io + reg);
-}
-
-static u32 mlxbf_i2c_read(void __iomem *io, int reg)
-{
-       return readl(io + reg);
-}
-
-/*
- * This function is used to read data from Master GW Data Descriptor.
- * Data bytes in the Master GW Data Descriptor are shifted left so the
- * data starts at the MSB of the descriptor registers as set by the
- * underlying hardware. TYU_READ_DATA enables byte swapping while
- * reading data bytes, and MUST be called by the SMBus read routines
- * to copy data from the 32 * 32-bit HW Data registers a.k.a Master GW
- * Data Descriptor.
- */
-static u32 mlxbf_i2c_read_data(void __iomem *io, int reg)
-{
-       return (u32)be32_to_cpu(mlxbf_i2c_read(io, reg));
-}
-
-/*
- * This function is used to write data to the Master GW Data Descriptor.
- * Data copied to the Master GW Data Descriptor MUST be shifted left so
- * the data starts at the MSB of the descriptor registers as required by
- * the underlying hardware. TYU_WRITE_DATA enables byte swapping when
- * writing data bytes, and MUST be called by the SMBus write routines to
- * copy data to the 32 * 32-bit HW Data registers a.k.a Master GW Data
- * Descriptor.
- */
-static void mlxbf_i2c_write_data(void __iomem *io, int reg, u32 val)
-{
-       mlxbf_i2c_write(io, reg, (u32)cpu_to_be32(val));
-}
-
 /*
  * Function to poll a set of bits at a specific address; it checks whether
  * the bits are equal to zero when eq_zero is set to 'true', and not equal
@@ -541,7 +501,7 @@ static u32 mlxbf_smbus_poll(void __iomem *io, u32 addr, u32 mask,
        timeout = (timeout / MLXBF_I2C_POLL_FREQ_IN_USEC) + 1;
 
        do {
-               bits = mlxbf_i2c_read(io, addr) & mask;
+               bits = readl(io + addr) & mask;
                if (eq_zero ? bits == 0 : bits != 0)
                        return eq_zero ? 1 : bits;
                udelay(MLXBF_I2C_POLL_FREQ_IN_USEC);
@@ -609,16 +569,16 @@ static int mlxbf_i2c_smbus_check_status(struct mlxbf_i2c_priv *priv)
                         MLXBF_I2C_SMBUS_TIMEOUT);
 
        /* Read cause status bits. */
-       cause_status_bits = mlxbf_i2c_read(priv->mst_cause->io,
-                                          MLXBF_I2C_CAUSE_ARBITER);
+       cause_status_bits = readl(priv->mst_cause->io +
+                                       MLXBF_I2C_CAUSE_ARBITER);
        cause_status_bits &= MLXBF_I2C_CAUSE_MASTER_ARBITER_BITS_MASK;
 
        /*
         * Parse both Cause and Master GW bits, then return transaction status.
         */
 
-       master_status_bits = mlxbf_i2c_read(priv->smbus->io,
-                                           MLXBF_I2C_SMBUS_MASTER_STATUS);
+       master_status_bits = readl(priv->smbus->io +
+                                       MLXBF_I2C_SMBUS_MASTER_STATUS);
        master_status_bits &= MLXBF_I2C_SMBUS_MASTER_STATUS_MASK;
 
        if (mlxbf_i2c_smbus_transaction_success(master_status_bits,
@@ -649,10 +609,17 @@ static void mlxbf_i2c_smbus_write_data(struct mlxbf_i2c_priv *priv,
 
        aligned_length = round_up(length, 4);
 
-       /* Copy data bytes from 4-byte aligned source buffer. */
+       /*
+        * Copy data bytes from 4-byte aligned source buffer.
+        * Data copied to the Master GW Data Descriptor MUST be shifted
+        * left so the data starts at the MSB of the descriptor registers
+        * as required by the underlying hardware. Enable byte swapping
+        * when writing data bytes to the 32 * 32-bit HW Data registers
+        * a.k.a Master GW Data Descriptor.
+        */
        for (offset = 0; offset < aligned_length; offset += sizeof(u32)) {
                data32 = *((u32 *)(data + offset));
-               mlxbf_i2c_write_data(priv->smbus->io, addr + offset, data32);
+               iowrite32be(data32, priv->smbus->io + addr + offset);
        }
 }
 
@@ -664,15 +631,23 @@ static void mlxbf_i2c_smbus_read_data(struct mlxbf_i2c_priv *priv,
 
        mask = sizeof(u32) - 1;
 
+       /*
+        * Data bytes in the Master GW Data Descriptor are shifted left
+        * so the data starts at the MSB of the descriptor registers as
+        * set by the underlying hardware. Enable byte swapping while
+        * reading data bytes from the 32 * 32-bit HW Data registers
+        * a.k.a Master GW Data Descriptor.
+        */
+
        for (offset = 0; offset < (length & ~mask); offset += sizeof(u32)) {
-               data32 = mlxbf_i2c_read_data(priv->smbus->io, addr + offset);
+               data32 = ioread32be(priv->smbus->io + addr + offset);
                *((u32 *)(data + offset)) = data32;
        }
 
        if (!(length & mask))
                return;
 
-       data32 = mlxbf_i2c_read_data(priv->smbus->io, addr + offset);
+       data32 = ioread32be(priv->smbus->io + addr + offset);
 
        for (byte = 0; byte < (length & mask); byte++) {
                data[offset + byte] = data32 & GENMASK(7, 0);
@@ -698,16 +673,16 @@ static int mlxbf_i2c_smbus_enable(struct mlxbf_i2c_priv *priv, u8 slave,
        command |= rol32(pec_en, MLXBF_I2C_MASTER_SEND_PEC_SHIFT);
 
        /* Clear status bits. */
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_STATUS, 0x0);
+       writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_STATUS);
        /* Set the cause data. */
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_CAUSE_OR_CLEAR, ~0x0);
+       writel(~0x0, priv->smbus->io + MLXBF_I2C_CAUSE_OR_CLEAR);
        /* Zero PEC byte. */
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_PEC, 0x0);
+       writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_PEC);
        /* Zero byte count. */
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_RS_BYTES, 0x0);
+       writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_RS_BYTES);
 
        /* GW activation. */
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_GW, command);
+       writel(command, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_GW);
 
        /*
         * Poll master status and check status bits. An ACK is sent when
@@ -823,8 +798,8 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv,
                 * needs to be 'manually' reset. This should be removed in
                 * next tag integration.
                 */
-               mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_FSM,
-                               MLXBF_I2C_SMBUS_MASTER_FSM_PS_STATE_MASK);
+               writel(MLXBF_I2C_SMBUS_MASTER_FSM_PS_STATE_MASK,
+                       priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_FSM);
        }
 
        return ret;
@@ -1113,8 +1088,8 @@ static void mlxbf_i2c_set_timings(struct mlxbf_i2c_priv *priv,
        timer |= mlxbf_i2c_set_timer(priv, timings->scl_low,
                                     false, MLXBF_I2C_MASK_16,
                                     MLXBF_I2C_SHIFT_16);
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_TIMER_SCL_LOW_SCL_HIGH,
-                         timer);
+       writel(timer, priv->smbus->io +
+               MLXBF_I2C_SMBUS_TIMER_SCL_LOW_SCL_HIGH);
 
        timer = mlxbf_i2c_set_timer(priv, timings->sda_rise, false,
                                    MLXBF_I2C_MASK_8, MLXBF_I2C_SHIFT_0);
@@ -1124,37 +1099,34 @@ static void mlxbf_i2c_set_timings(struct mlxbf_i2c_priv *priv,
                                     MLXBF_I2C_MASK_8, MLXBF_I2C_SHIFT_16);
        timer |= mlxbf_i2c_set_timer(priv, timings->scl_fall, false,
                                     MLXBF_I2C_MASK_8, MLXBF_I2C_SHIFT_24);
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_TIMER_FALL_RISE_SPIKE,
-                         timer);
+       writel(timer, priv->smbus->io +
+               MLXBF_I2C_SMBUS_TIMER_FALL_RISE_SPIKE);
 
        timer = mlxbf_i2c_set_timer(priv, timings->hold_start, true,
                                    MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0);
        timer |= mlxbf_i2c_set_timer(priv, timings->hold_data, true,
                                     MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_16);
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_TIMER_THOLD, timer);
+       writel(timer, priv->smbus->io + MLXBF_I2C_SMBUS_TIMER_THOLD);
 
        timer = mlxbf_i2c_set_timer(priv, timings->setup_start, true,
                                    MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0);
        timer |= mlxbf_i2c_set_timer(priv, timings->setup_stop, true,
                                     MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_16);
-       mlxbf_i2c_write(priv->smbus->io,
-                       MLXBF_I2C_SMBUS_TIMER_TSETUP_START_STOP, timer);
+       writel(timer, priv->smbus->io +
+               MLXBF_I2C_SMBUS_TIMER_TSETUP_START_STOP);
 
        timer = mlxbf_i2c_set_timer(priv, timings->setup_data, true,
                                    MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0);
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_TIMER_TSETUP_DATA,
-                         timer);
+       writel(timer, priv->smbus->io + MLXBF_I2C_SMBUS_TIMER_TSETUP_DATA);
 
        timer = mlxbf_i2c_set_timer(priv, timings->buf, false,
                                    MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0);
        timer |= mlxbf_i2c_set_timer(priv, timings->thigh_max, false,
                                     MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_16);
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_THIGH_MAX_TBUF,
-                       timer);
+       writel(timer, priv->smbus->io + MLXBF_I2C_SMBUS_THIGH_MAX_TBUF);
 
        timer = timings->timeout;
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SCL_LOW_TIMEOUT,
-                       timer);
+       writel(timer, priv->smbus->io + MLXBF_I2C_SMBUS_SCL_LOW_TIMEOUT);
 }
 
 enum mlxbf_i2c_timings_config {
@@ -1426,19 +1398,15 @@ static int mlxbf_i2c_init_master(struct platform_device *pdev,
         * platform firmware; disabling the bus might compromise the system
         * functionality.
         */
-       config_reg = mlxbf_i2c_read(gpio_res->io,
-                                   MLXBF_I2C_GPIO_0_FUNC_EN_0);
+       config_reg = readl(gpio_res->io + MLXBF_I2C_GPIO_0_FUNC_EN_0);
        config_reg = MLXBF_I2C_GPIO_SMBUS_GW_ASSERT_PINS(priv->bus,
                                                         config_reg);
-       mlxbf_i2c_write(gpio_res->io, MLXBF_I2C_GPIO_0_FUNC_EN_0,
-                       config_reg);
+       writel(config_reg, gpio_res->io + MLXBF_I2C_GPIO_0_FUNC_EN_0);
 
-       config_reg = mlxbf_i2c_read(gpio_res->io,
-                                   MLXBF_I2C_GPIO_0_FORCE_OE_EN);
+       config_reg = readl(gpio_res->io + MLXBF_I2C_GPIO_0_FORCE_OE_EN);
        config_reg = MLXBF_I2C_GPIO_SMBUS_GW_RESET_PINS(priv->bus,
                                                        config_reg);
-       mlxbf_i2c_write(gpio_res->io, MLXBF_I2C_GPIO_0_FORCE_OE_EN,
-                       config_reg);
+       writel(config_reg, gpio_res->io + MLXBF_I2C_GPIO_0_FORCE_OE_EN);
 
        mutex_unlock(gpio_res->lock);
 
@@ -1452,10 +1420,9 @@ static u64 mlxbf_calculate_freq_from_tyu(struct mlxbf_i2c_resource *corepll_res)
        u32 corepll_val;
        u16 core_f;
 
-       pad_frequency = MLXBF_I2C_TYU_PLL_IN_FREQ;
+       pad_frequency = MLXBF_I2C_PLL_IN_FREQ;
 
-       corepll_val = mlxbf_i2c_read(corepll_res->io,
-                                    MLXBF_I2C_CORE_PLL_REG1);
+       corepll_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG1);
 
        /* Get Core PLL configuration bits. */
        core_f = rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_F_TYU_SHIFT) &
@@ -1488,12 +1455,10 @@ static u64 mlxbf_calculate_freq_from_yu(struct mlxbf_i2c_resource *corepll_res)
        u8 core_od, core_r;
        u32 core_f;
 
-       pad_frequency = MLXBF_I2C_YU_PLL_IN_FREQ;
+       pad_frequency = MLXBF_I2C_PLL_IN_FREQ;
 
-       corepll_reg1_val = mlxbf_i2c_read(corepll_res->io,
-                                         MLXBF_I2C_CORE_PLL_REG1);
-       corepll_reg2_val = mlxbf_i2c_read(corepll_res->io,
-                                         MLXBF_I2C_CORE_PLL_REG2);
+       corepll_reg1_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG1);
+       corepll_reg2_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG2);
 
        /* Get Core PLL configuration bits */
        core_f = rol32(corepll_reg1_val, MLXBF_I2C_COREPLL_CORE_F_YU_SHIFT) &
@@ -1585,7 +1550,7 @@ static int mlxbf_slave_enable(struct mlxbf_i2c_priv *priv, u8 addr)
         * (7-bit address, 1 status bit (1 if enabled, 0 if not)).
         */
        for (reg = 0; reg < reg_cnt; reg++) {
-               slave_reg = mlxbf_i2c_read(priv->smbus->io,
+               slave_reg = readl(priv->smbus->io +
                                MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4);
                /*
                 * Each register holds 4 slave addresses. So, we have to keep
@@ -1643,8 +1608,8 @@ static int mlxbf_slave_enable(struct mlxbf_i2c_priv *priv, u8 addr)
 
        /* Enable the slave address and update the register. */
        slave_reg |= (1 << MLXBF_I2C_SMBUS_SLAVE_ADDR_EN_BIT) << (byte * 8);
-       mlxbf_i2c_write(priv->smbus->io,
-                       MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4, slave_reg);
+       writel(slave_reg, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG +
+               reg * 0x4);
 
        return 0;
 }
@@ -1668,7 +1633,7 @@ static int mlxbf_slave_disable(struct mlxbf_i2c_priv *priv)
         * (7-bit address, 1 status bit (1 if enabled, 0 if not)).
         */
        for (reg = 0; reg < reg_cnt; reg++) {
-               slave_reg = mlxbf_i2c_read(priv->smbus->io,
+               slave_reg = readl(priv->smbus->io +
                                MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4);
 
                /* Check whether the address slots are empty. */
@@ -1708,8 +1673,8 @@ static int mlxbf_slave_disable(struct mlxbf_i2c_priv *priv)
 
        /* Cleanup the slave address slot. */
        slave_reg &= ~(GENMASK(7, 0) << (slave_byte * 8));
-       mlxbf_i2c_write(priv->smbus->io,
-                       MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4, slave_reg);
+       writel(slave_reg, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG +
+               reg * 0x4);
 
        return 0;
 }
@@ -1801,7 +1766,7 @@ static int mlxbf_i2c_init_slave(struct platform_device *pdev,
        int ret;
 
        /* Reset FSM. */
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_FSM, 0);
+       writel(0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_FSM);
 
        /*
         * Enable slave cause interrupt bits. Drive
@@ -1810,15 +1775,13 @@ static int mlxbf_i2c_init_slave(struct platform_device *pdev,
         * masters issue a Read and Write, respectively. But, clear all
         * interrupts first.
         */
-       mlxbf_i2c_write(priv->slv_cause->io,
-                         MLXBF_I2C_CAUSE_OR_CLEAR, ~0);
+       writel(~0, priv->slv_cause->io + MLXBF_I2C_CAUSE_OR_CLEAR);
        int_reg = MLXBF_I2C_CAUSE_READ_WAIT_FW_RESPONSE;
        int_reg |= MLXBF_I2C_CAUSE_WRITE_SUCCESS;
-       mlxbf_i2c_write(priv->slv_cause->io,
-                         MLXBF_I2C_CAUSE_OR_EVTEN0, int_reg);
+       writel(int_reg, priv->slv_cause->io + MLXBF_I2C_CAUSE_OR_EVTEN0);
 
        /* Finally, set the 'ready' bit to start handling transactions. */
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_READY, 0x1);
+       writel(0x1, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_READY);
 
        /* Initialize the cause coalesce resource. */
        ret = mlxbf_i2c_init_coalesce(pdev, priv);
@@ -1844,23 +1807,21 @@ static bool mlxbf_i2c_has_coalesce(struct mlxbf_i2c_priv *priv, bool *read,
                                MLXBF_I2C_CAUSE_YU_SLAVE_BIT :
                                priv->bus + MLXBF_I2C_CAUSE_TYU_SLAVE_BIT;
 
-       coalesce0_reg = mlxbf_i2c_read(priv->coalesce->io,
-                                      MLXBF_I2C_CAUSE_COALESCE_0);
+       coalesce0_reg = readl(priv->coalesce->io + MLXBF_I2C_CAUSE_COALESCE_0);
        is_set = coalesce0_reg & (1 << slave_shift);
 
        if (!is_set)
                return false;
 
        /* Check the source of the interrupt, i.e. whether a Read or Write. */
-       cause_reg = mlxbf_i2c_read(priv->slv_cause->io,
-                                    MLXBF_I2C_CAUSE_ARBITER);
+       cause_reg = readl(priv->slv_cause->io + MLXBF_I2C_CAUSE_ARBITER);
        if (cause_reg & MLXBF_I2C_CAUSE_READ_WAIT_FW_RESPONSE)
                *read = true;
        else if (cause_reg & MLXBF_I2C_CAUSE_WRITE_SUCCESS)
                *write = true;
 
        /* Clear cause bits. */
-       mlxbf_i2c_write(priv->slv_cause->io, MLXBF_I2C_CAUSE_OR_CLEAR, ~0x0);
+       writel(~0x0, priv->slv_cause->io + MLXBF_I2C_CAUSE_OR_CLEAR);
 
        return true;
 }
@@ -1900,8 +1861,8 @@ static int mlxbf_smbus_irq_send(struct mlxbf_i2c_priv *priv, u8 recv_bytes)
         * address, if supplied.
         */
        if (recv_bytes > 0) {
-               data32 = mlxbf_i2c_read_data(priv->smbus->io,
-                                            MLXBF_I2C_SLAVE_DATA_DESC_ADDR);
+               data32 = ioread32be(priv->smbus->io +
+                                       MLXBF_I2C_SLAVE_DATA_DESC_ADDR);
 
                /* Parse the received bytes. */
                switch (recv_bytes) {
@@ -1966,7 +1927,7 @@ static int mlxbf_smbus_irq_send(struct mlxbf_i2c_priv *priv, u8 recv_bytes)
        control32 |= rol32(write_size, MLXBF_I2C_SLAVE_WRITE_BYTES_SHIFT);
        control32 |= rol32(pec_en, MLXBF_I2C_SLAVE_SEND_PEC_SHIFT);
 
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_GW, control32);
+       writel(control32, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_GW);
 
        /*
         * Wait until the transfer is completed; the driver will wait
@@ -1975,10 +1936,9 @@ static int mlxbf_smbus_irq_send(struct mlxbf_i2c_priv *priv, u8 recv_bytes)
        mlxbf_smbus_slave_wait_for_idle(priv, MLXBF_I2C_SMBUS_TIMEOUT);
 
        /* Release the Slave GW. */
-       mlxbf_i2c_write(priv->smbus->io,
-                       MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES, 0x0);
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_PEC, 0x0);
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_READY, 0x1);
+       writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES);
+       writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_PEC);
+       writel(0x1, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_READY);
 
        return 0;
 }
@@ -2023,10 +1983,9 @@ static int mlxbf_smbus_irq_recv(struct mlxbf_i2c_priv *priv, u8 recv_bytes)
        i2c_slave_event(slave, I2C_SLAVE_STOP, &value);
 
        /* Release the Slave GW. */
-       mlxbf_i2c_write(priv->smbus->io,
-                       MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES, 0x0);
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_PEC, 0x0);
-       mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_READY, 0x1);
+       writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES);
+       writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_PEC);
+       writel(0x1, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_READY);
 
        return ret;
 }
@@ -2061,8 +2020,8 @@ static irqreturn_t mlxbf_smbus_irq(int irq, void *ptr)
         * slave, if the higher 8 bits are sent then the slave expect N bytes
         * from the master.
         */
-       rw_bytes_reg = mlxbf_i2c_read(priv->smbus->io,
-                                     MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES);
+       rw_bytes_reg = readl(priv->smbus->io +
+                               MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES);
        recv_bytes = (rw_bytes_reg >> 8) & GENMASK(7, 0);
 
        /*
@@ -2264,6 +2223,7 @@ static const struct of_device_id mlxbf_i2c_dt_ids[] = {
 
 MODULE_DEVICE_TABLE(of, mlxbf_i2c_dt_ids);
 
+#ifdef CONFIG_ACPI
 static const struct acpi_device_id mlxbf_i2c_acpi_ids[] = {
        { "MLNXBF03", (kernel_ulong_t)&mlxbf_i2c_chip[MLXBF_I2C_CHIP_TYPE_1] },
        { "MLNXBF23", (kernel_ulong_t)&mlxbf_i2c_chip[MLXBF_I2C_CHIP_TYPE_2] },
@@ -2305,6 +2265,12 @@ static int mlxbf_i2c_acpi_probe(struct device *dev, struct mlxbf_i2c_priv *priv)
 
        return ret;
 }
+#else
+static int mlxbf_i2c_acpi_probe(struct device *dev, struct mlxbf_i2c_priv *priv)
+{
+       return -ENOENT;
+}
+#endif /* CONFIG_ACPI */
 
 static int mlxbf_i2c_of_probe(struct device *dev, struct mlxbf_i2c_priv *priv)
 {
@@ -2473,7 +2439,9 @@ static struct platform_driver mlxbf_i2c_driver = {
        .driver = {
                .name = "i2c-mlxbf",
                .of_match_table = mlxbf_i2c_dt_ids,
+#ifdef CONFIG_ACPI
                .acpi_match_table = ACPI_PTR(mlxbf_i2c_acpi_ids),
+#endif /* CONFIG_ACPI  */
        },
 };
 
@@ -2502,5 +2470,5 @@ static void __exit mlxbf_i2c_exit(void)
 module_exit(mlxbf_i2c_exit);
 
 MODULE_DESCRIPTION("Mellanox BlueField I2C bus driver");
-MODULE_AUTHOR("Khalil Blaiech <kblaiech@mellanox.com>");
+MODULE_AUTHOR("Khalil Blaiech <kblaiech@nvidia.com>");
 MODULE_LICENSE("GPL v2");
index 0cbdfbe..33de99b 100644 (file)
@@ -475,6 +475,10 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c)
 {
        u16 control_reg;
 
+       writel(I2C_DMA_HARD_RST, i2c->pdmabase + OFFSET_RST);
+       udelay(50);
+       writel(I2C_DMA_CLR_FLAG, i2c->pdmabase + OFFSET_RST);
+
        mtk_i2c_writew(i2c, I2C_SOFT_RST, OFFSET_SOFTRESET);
 
        /* Set ioconfig */
@@ -529,10 +533,6 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c)
 
        mtk_i2c_writew(i2c, control_reg, OFFSET_CONTROL);
        mtk_i2c_writew(i2c, I2C_DELAY_LEN, OFFSET_DELAY_LEN);
-
-       writel(I2C_DMA_HARD_RST, i2c->pdmabase + OFFSET_RST);
-       udelay(50);
-       writel(I2C_DMA_CLR_FLAG, i2c->pdmabase + OFFSET_RST);
 }
 
 static const struct i2c_spec_values *mtk_i2c_get_spec(unsigned int speed)
index cab7255..bdd6077 100644 (file)
@@ -129,6 +129,7 @@ struct sh_mobile_i2c_data {
        int sr;
        bool send_stop;
        bool stop_after_dma;
+       bool atomic_xfer;
 
        struct resource *res;
        struct dma_chan *dma_tx;
@@ -330,13 +331,15 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd, enum sh_mobile_i2c_op
                ret = iic_rd(pd, ICDR);
                break;
        case OP_RX_STOP: /* enable DTE interrupt, issue stop */
-               iic_wr(pd, ICIC,
-                      ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
+               if (!pd->atomic_xfer)
+                       iic_wr(pd, ICIC,
+                              ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
                iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK);
                break;
        case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */
-               iic_wr(pd, ICIC,
-                      ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
+               if (!pd->atomic_xfer)
+                       iic_wr(pd, ICIC,
+                              ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
                ret = iic_rd(pd, ICDR);
                iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK);
                break;
@@ -429,7 +432,8 @@ static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id)
 
        if (wakeup) {
                pd->sr |= SW_DONE;
-               wake_up(&pd->wait);
+               if (!pd->atomic_xfer)
+                       wake_up(&pd->wait);
        }
 
        /* defeat write posting to avoid spurious WAIT interrupts */
@@ -581,6 +585,9 @@ static void start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg,
        pd->pos = -1;
        pd->sr = 0;
 
+       if (pd->atomic_xfer)
+               return;
+
        pd->dma_buf = i2c_get_dma_safe_msg_buf(pd->msg, 8);
        if (pd->dma_buf)
                sh_mobile_i2c_xfer_dma(pd);
@@ -637,15 +644,13 @@ static int poll_busy(struct sh_mobile_i2c_data *pd)
        return i ? 0 : -ETIMEDOUT;
 }
 
-static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
-                             struct i2c_msg *msgs,
-                             int num)
+static int sh_mobile_xfer(struct sh_mobile_i2c_data *pd,
+                        struct i2c_msg *msgs, int num)
 {
-       struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter);
        struct i2c_msg  *msg;
        int err = 0;
        int i;
-       long timeout;
+       long time_left;
 
        /* Wake up device and enable clock */
        pm_runtime_get_sync(pd->dev);
@@ -662,15 +667,35 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
                if (do_start)
                        i2c_op(pd, OP_START);
 
-               /* The interrupt handler takes care of the rest... */
-               timeout = wait_event_timeout(pd->wait,
-                                      pd->sr & (ICSR_TACK | SW_DONE),
-                                      adapter->timeout);
-
-               /* 'stop_after_dma' tells if DMA transfer was complete */
-               i2c_put_dma_safe_msg_buf(pd->dma_buf, pd->msg, pd->stop_after_dma);
+               if (pd->atomic_xfer) {
+                       unsigned long j = jiffies + pd->adap.timeout;
+
+                       time_left = time_before_eq(jiffies, j);
+                       while (time_left &&
+                              !(pd->sr & (ICSR_TACK | SW_DONE))) {
+                               unsigned char sr = iic_rd(pd, ICSR);
+
+                               if (sr & (ICSR_AL   | ICSR_TACK |
+                                         ICSR_WAIT | ICSR_DTE)) {
+                                       sh_mobile_i2c_isr(0, pd);
+                                       udelay(150);
+                               } else {
+                                       cpu_relax();
+                               }
+                               time_left = time_before_eq(jiffies, j);
+                       }
+               } else {
+                       /* The interrupt handler takes care of the rest... */
+                       time_left = wait_event_timeout(pd->wait,
+                                       pd->sr & (ICSR_TACK | SW_DONE),
+                                       pd->adap.timeout);
+
+                       /* 'stop_after_dma' tells if DMA xfer was complete */
+                       i2c_put_dma_safe_msg_buf(pd->dma_buf, pd->msg,
+                                                pd->stop_after_dma);
+               }
 
-               if (!timeout) {
+               if (!time_left) {
                        dev_err(pd->dev, "Transfer request timed out\n");
                        if (pd->dma_direction != DMA_NONE)
                                sh_mobile_i2c_cleanup_dma(pd);
@@ -696,14 +721,35 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
        return err ?: num;
 }
 
+static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
+                             struct i2c_msg *msgs,
+                             int num)
+{
+       struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter);
+
+       pd->atomic_xfer = false;
+       return sh_mobile_xfer(pd, msgs, num);
+}
+
+static int sh_mobile_i2c_xfer_atomic(struct i2c_adapter *adapter,
+                                    struct i2c_msg *msgs,
+                                    int num)
+{
+       struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter);
+
+       pd->atomic_xfer = true;
+       return sh_mobile_xfer(pd, msgs, num);
+}
+
 static u32 sh_mobile_i2c_func(struct i2c_adapter *adapter)
 {
        return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING;
 }
 
 static const struct i2c_algorithm sh_mobile_i2c_algorithm = {
-       .functionality  = sh_mobile_i2c_func,
-       .master_xfer    = sh_mobile_i2c_xfer,
+       .functionality = sh_mobile_i2c_func,
+       .master_xfer = sh_mobile_i2c_xfer,
+       .master_xfer_atomic = sh_mobile_i2c_xfer_atomic,
 };
 
 static const struct i2c_adapter_quirks sh_mobile_i2c_quirks = {
index e627d7b..37c510d 100644 (file)
@@ -264,6 +264,7 @@ static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,
 void i2c_acpi_register_devices(struct i2c_adapter *adap)
 {
        acpi_status status;
+       acpi_handle handle;
 
        if (!has_acpi_companion(&adap->dev))
                return;
@@ -274,6 +275,15 @@ void i2c_acpi_register_devices(struct i2c_adapter *adap)
                                     adap, NULL);
        if (ACPI_FAILURE(status))
                dev_warn(&adap->dev, "failed to enumerate I2C slaves\n");
+
+       if (!adap->dev.parent)
+               return;
+
+       handle = ACPI_HANDLE(adap->dev.parent);
+       if (!handle)
+               return;
+
+       acpi_walk_dep_device_list(handle);
 }
 
 static const struct acpi_device_id i2c_acpi_force_400khz_device_ids[] = {
@@ -719,7 +729,6 @@ int i2c_acpi_install_space_handler(struct i2c_adapter *adapter)
                return -ENOMEM;
        }
 
-       acpi_walk_dep_device_list(handle);
        return 0;
 }
 
index 9a810e4..01bace4 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 /*
- * intel_idle is a cpuidle driver that loads on specific Intel processors
+ * intel_idle is a cpuidle driver that loads on all Intel CPUs with MWAIT
  * in lieu of the legacy ACPI processor_idle driver.  The intent is to
  * make Linux more efficient on these processors, as intel_idle knows
  * more than ACPI, as well as make Linux more immune to ACPI BIOS bugs.
  * All CPUs have same idle states as boot CPU
  *
  * Chipset BM_STS (bus master status) bit is a NOP
- *     for preventing entry into deep C-stats
+ *     for preventing entry into deep C-states
+ *
+ * CPU will flush caches as needed when entering a C-state via MWAIT
+ *     (in contrast to entering ACPI C3, in which case the WBINVD
+ *     instruction needs to be executed to flush the caches)
  */
 
 /*
@@ -1212,14 +1216,13 @@ static bool __init intel_idle_acpi_cst_extract(void)
                if (!intel_idle_cst_usable())
                        continue;
 
-               if (!acpi_processor_claim_cst_control()) {
-                       acpi_state_table.count = 0;
-                       return false;
-               }
+               if (!acpi_processor_claim_cst_control())
+                       break;
 
                return true;
        }
 
+       acpi_state_table.count = 0;
        pr_debug("ACPI _CST not found or not usable\n");
        return false;
 }
@@ -1236,7 +1239,7 @@ static void __init intel_idle_init_cstates_acpi(struct cpuidle_driver *drv)
                struct acpi_processor_cx *cx;
                struct cpuidle_state *state;
 
-               if (intel_idle_max_cstate_reached(cstate))
+               if (intel_idle_max_cstate_reached(cstate - 1))
                        break;
 
                cx = &acpi_state_table.states[cstate];
index 7c2ab1f..a77750b 100644 (file)
@@ -405,10 +405,10 @@ static int cma_comp_exch(struct rdma_id_private *id_priv,
        /*
         * The FSM uses a funny double locking where state is protected by both
         * the handler_mutex and the spinlock. State is not allowed to change
-        * away from a handler_mutex protected value without also holding
+        * to/from a handler_mutex protected value without also holding
         * handler_mutex.
         */
-       if (comp == RDMA_CM_CONNECT)
+       if (comp == RDMA_CM_CONNECT || exch == RDMA_CM_CONNECT)
                lockdep_assert_held(&id_priv->handler_mutex);
 
        spin_lock_irqsave(&id_priv->lock, flags);
@@ -4038,17 +4038,23 @@ out:
        return ret;
 }
 
-int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
+/**
+ * rdma_connect_locked - Initiate an active connection request.
+ * @id: Connection identifier to connect.
+ * @conn_param: Connection information used for connected QPs.
+ *
+ * Same as rdma_connect() but can only be called from the
+ * RDMA_CM_EVENT_ROUTE_RESOLVED handler callback.
+ */
+int rdma_connect_locked(struct rdma_cm_id *id,
+                       struct rdma_conn_param *conn_param)
 {
        struct rdma_id_private *id_priv =
                container_of(id, struct rdma_id_private, id);
        int ret;
 
-       mutex_lock(&id_priv->handler_mutex);
-       if (!cma_comp_exch(id_priv, RDMA_CM_ROUTE_RESOLVED, RDMA_CM_CONNECT)) {
-               ret = -EINVAL;
-               goto err_unlock;
-       }
+       if (!cma_comp_exch(id_priv, RDMA_CM_ROUTE_RESOLVED, RDMA_CM_CONNECT))
+               return -EINVAL;
 
        if (!id->qp) {
                id_priv->qp_num = conn_param->qp_num;
@@ -4066,11 +4072,33 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
                ret = -ENOSYS;
        if (ret)
                goto err_state;
-       mutex_unlock(&id_priv->handler_mutex);
        return 0;
 err_state:
        cma_comp_exch(id_priv, RDMA_CM_CONNECT, RDMA_CM_ROUTE_RESOLVED);
-err_unlock:
+       return ret;
+}
+EXPORT_SYMBOL(rdma_connect_locked);
+
+/**
+ * rdma_connect - Initiate an active connection request.
+ * @id: Connection identifier to connect.
+ * @conn_param: Connection information used for connected QPs.
+ *
+ * Users must have resolved a route for the rdma_cm_id to connect with by having
+ * called rdma_resolve_route before calling this routine.
+ *
+ * This call will either connect to a remote QP or obtain remote QP information
+ * for unconnected rdma_cm_id's.  The actual operation is based on the
+ * rdma_cm_id's port space.
+ */
+int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
+{
+       struct rdma_id_private *id_priv =
+               container_of(id, struct rdma_id_private, id);
+       int ret;
+
+       mutex_lock(&id_priv->handler_mutex);
+       ret = rdma_connect_locked(id, conn_param);
        mutex_unlock(&id_priv->handler_mutex);
        return ret;
 }
index f367d52..302f898 100644 (file)
@@ -401,9 +401,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_GID_ENTRY)(
        if (!rdma_is_port_valid(ib_dev, port_num))
                return -EINVAL;
 
-       if (!rdma_ib_or_roce(ib_dev, port_num))
-               return -EOPNOTSUPP;
-
        gid_attr = rdma_get_gid_attr(ib_dev, port_num, gid_index);
        if (IS_ERR(gid_attr))
                return PTR_ERR(gid_attr);
index a40701a..0b64aa8 100644 (file)
@@ -1686,7 +1686,6 @@ static void hfi1_ipoib_ib_rcv(struct hfi1_packet *packet)
        u32 extra_bytes;
        u32 tlen, qpnum;
        bool do_work, do_cnp;
-       struct hfi1_ipoib_dev_priv *priv;
 
        trace_hfi1_rcvhdr(packet);
 
@@ -1734,8 +1733,7 @@ static void hfi1_ipoib_ib_rcv(struct hfi1_packet *packet)
        if (unlikely(!skb))
                goto drop;
 
-       priv = hfi1_ipoib_priv(netdev);
-       hfi1_ipoib_update_rx_netstats(priv, 1, skb->len);
+       dev_sw_netstats_rx_add(netdev, skb->len);
 
        skb->dev = netdev;
        skb->pkt_type = PACKET_HOST;
index b8c9d0a..f650cac 100644 (file)
@@ -110,7 +110,6 @@ struct hfi1_ipoib_dev_priv {
 
        const struct net_device_ops *netdev_ops;
        struct rvt_qp *qp;
-       struct pcpu_sw_netstats __percpu *netstats;
 };
 
 /* hfi1 ipoib rdma netdev's private data structure */
@@ -126,32 +125,6 @@ hfi1_ipoib_priv(const struct net_device *dev)
        return &((struct hfi1_ipoib_rdma_netdev *)netdev_priv(dev))->dev_priv;
 }
 
-static inline void
-hfi1_ipoib_update_rx_netstats(struct hfi1_ipoib_dev_priv *priv,
-                             u64 packets,
-                             u64 bytes)
-{
-       struct pcpu_sw_netstats *netstats = this_cpu_ptr(priv->netstats);
-
-       u64_stats_update_begin(&netstats->syncp);
-       netstats->rx_packets += packets;
-       netstats->rx_bytes += bytes;
-       u64_stats_update_end(&netstats->syncp);
-}
-
-static inline void
-hfi1_ipoib_update_tx_netstats(struct hfi1_ipoib_dev_priv *priv,
-                             u64 packets,
-                             u64 bytes)
-{
-       struct pcpu_sw_netstats *netstats = this_cpu_ptr(priv->netstats);
-
-       u64_stats_update_begin(&netstats->syncp);
-       netstats->tx_packets += packets;
-       netstats->tx_bytes += bytes;
-       u64_stats_update_end(&netstats->syncp);
-}
-
 int hfi1_ipoib_send_dma(struct net_device *dev,
                        struct sk_buff *skb,
                        struct ib_ah *address,
index 9f71b9d..3242290 100644 (file)
@@ -21,7 +21,7 @@ static int hfi1_ipoib_dev_init(struct net_device *dev)
        struct hfi1_ipoib_dev_priv *priv = hfi1_ipoib_priv(dev);
        int ret;
 
-       priv->netstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
+       dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
 
        ret = priv->netdev_ops->ndo_init(dev);
        if (ret)
@@ -93,21 +93,12 @@ static int hfi1_ipoib_dev_stop(struct net_device *dev)
        return priv->netdev_ops->ndo_stop(dev);
 }
 
-static void hfi1_ipoib_dev_get_stats64(struct net_device *dev,
-                                      struct rtnl_link_stats64 *storage)
-{
-       struct hfi1_ipoib_dev_priv *priv = hfi1_ipoib_priv(dev);
-
-       netdev_stats_to_stats64(storage, &dev->stats);
-       dev_fetch_sw_netstats(storage, priv->netstats);
-}
-
 static const struct net_device_ops hfi1_ipoib_netdev_ops = {
        .ndo_init         = hfi1_ipoib_dev_init,
        .ndo_uninit       = hfi1_ipoib_dev_uninit,
        .ndo_open         = hfi1_ipoib_dev_open,
        .ndo_stop         = hfi1_ipoib_dev_stop,
-       .ndo_get_stats64  = hfi1_ipoib_dev_get_stats64,
+       .ndo_get_stats64  = dev_get_tstats64,
 };
 
 static int hfi1_ipoib_send(struct net_device *dev,
@@ -182,7 +173,7 @@ static void hfi1_ipoib_netdev_dtor(struct net_device *dev)
        hfi1_ipoib_txreq_deinit(priv);
        hfi1_ipoib_rxq_deinit(priv->netdev);
 
-       free_percpu(priv->netstats);
+       free_percpu(dev->tstats);
 }
 
 static void hfi1_ipoib_free_rdma_netdev(struct net_device *dev)
index 9df292b..edd4eea 100644 (file)
@@ -121,7 +121,7 @@ static void hfi1_ipoib_free_tx(struct ipoib_txreq *tx, int budget)
        struct hfi1_ipoib_dev_priv *priv = tx->priv;
 
        if (likely(!tx->sdma_status)) {
-               hfi1_ipoib_update_tx_netstats(priv, 1, tx->skb->len);
+               dev_sw_netstats_tx_add(priv->netdev, 1, tx->skb->len);
        } else {
                ++priv->netdev->stats.tx_errors;
                dd_dev_warn(priv->dd,
index 89e04ca..246e3cb 100644 (file)
@@ -3305,7 +3305,8 @@ static int mlx5_add_netdev_notifier(struct mlx5_ib_dev *dev, u8 port_num)
        int err;
 
        dev->port[port_num].roce.nb.notifier_call = mlx5_netdev_event;
-       err = register_netdevice_notifier(&dev->port[port_num].roce.nb);
+       err = register_netdevice_notifier_net(mlx5_core_net(dev->mdev),
+                                             &dev->port[port_num].roce.nb);
        if (err) {
                dev->port[port_num].roce.nb.notifier_call = NULL;
                return err;
@@ -3317,7 +3318,8 @@ static int mlx5_add_netdev_notifier(struct mlx5_ib_dev *dev, u8 port_num)
 static void mlx5_remove_netdev_notifier(struct mlx5_ib_dev *dev, u8 port_num)
 {
        if (dev->port[port_num].roce.nb.notifier_call) {
-               unregister_netdevice_notifier(&dev->port[port_num].roce.nb);
+               unregister_netdevice_notifier_net(mlx5_core_net(dev->mdev),
+                                                 &dev->port[port_num].roce.nb);
                dev->port[port_num].roce.nb.notifier_call = NULL;
        }
 }
index c7169d2..c4bc587 100644 (file)
@@ -727,6 +727,7 @@ int qedr_iw_destroy_listen(struct iw_cm_id *cm_id)
                                                    listener->qed_handle);
 
        cm_id->rem_ref(cm_id);
+       kfree(listener);
        return rc;
 }
 
index f0e5ffb..97ed8f9 100644 (file)
@@ -176,7 +176,7 @@ struct pvrdma_port_attr {
        u8                      subnet_timeout;
        u8                      init_type_reply;
        u8                      active_width;
-       u16                     active_speed;
+       u                     active_speed;
        u8                      phys_state;
        u8                      reserved[2];
 };
index 5221868..670a962 100644 (file)
@@ -524,6 +524,7 @@ static noinline int check_support(struct rvt_dev_info *rdi, int verb)
 int rvt_register_device(struct rvt_dev_info *rdi)
 {
        int ret = 0, i;
+       u64 dma_mask;
 
        if (!rdi)
                return -EINVAL;
@@ -580,8 +581,10 @@ int rvt_register_device(struct rvt_dev_info *rdi)
 
        /* DMA Operations */
        rdi->ibdev.dev.dma_parms = rdi->ibdev.dev.parent->dma_parms;
-       dma_set_coherent_mask(&rdi->ibdev.dev,
-                             rdi->ibdev.dev.parent->coherent_dma_mask);
+       dma_mask = IS_ENABLED(CONFIG_64BIT) ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32);
+       ret = dma_coerce_mask_and_coherent(&rdi->ibdev.dev, dma_mask);
+       if (ret)
+               goto bail_wss;
 
        /* Protection Domain */
        spin_lock_init(&rdi->n_pds_lock);
index 38021e2..df0d173 100644 (file)
@@ -16,15 +16,24 @@ void rxe_init_av(struct rdma_ah_attr *attr, struct rxe_av *av)
 
 int rxe_av_chk_attr(struct rxe_dev *rxe, struct rdma_ah_attr *attr)
 {
+       const struct ib_global_route *grh = rdma_ah_read_grh(attr);
        struct rxe_port *port;
+       int type;
 
        port = &rxe->port;
 
        if (rdma_ah_get_ah_flags(attr) & IB_AH_GRH) {
-               u8 sgid_index = rdma_ah_read_grh(attr)->sgid_index;
+               if (grh->sgid_index > port->attr.gid_tbl_len) {
+                       pr_warn("invalid sgid index = %d\n",
+                                       grh->sgid_index);
+                       return -EINVAL;
+               }
 
-               if (sgid_index > port->attr.gid_tbl_len) {
-                       pr_warn("invalid sgid index = %d\n", sgid_index);
+               type = rdma_gid_attr_network_type(grh->sgid_attr);
+               if (type < RDMA_NETWORK_IPV4 ||
+                   type > RDMA_NETWORK_IPV6) {
+                       pr_warn("invalid network type for rdma_rxe = %d\n",
+                                       type);
                        return -EINVAL;
                }
        }
@@ -65,11 +74,29 @@ void rxe_av_to_attr(struct rxe_av *av, struct rdma_ah_attr *attr)
 void rxe_av_fill_ip_info(struct rxe_av *av, struct rdma_ah_attr *attr)
 {
        const struct ib_gid_attr *sgid_attr = attr->grh.sgid_attr;
+       int ibtype;
+       int type;
 
        rdma_gid2ip((struct sockaddr *)&av->sgid_addr, &sgid_attr->gid);
        rdma_gid2ip((struct sockaddr *)&av->dgid_addr,
                    &rdma_ah_read_grh(attr)->dgid);
-       av->network_type = rdma_gid_attr_network_type(sgid_attr);
+
+       ibtype = rdma_gid_attr_network_type(sgid_attr);
+
+       switch (ibtype) {
+       case RDMA_NETWORK_IPV4:
+               type = RXE_NETWORK_TYPE_IPV4;
+               break;
+       case RDMA_NETWORK_IPV6:
+               type = RXE_NETWORK_TYPE_IPV4;
+               break;
+       default:
+               /* not reached - checked in rxe_av_chk_attr */
+               type = 0;
+               break;
+       }
+
+       av->network_type = type;
 }
 
 struct rxe_av *rxe_get_av(struct rxe_pkt_info *pkt)
index 575e1a4..34bef7d 100644 (file)
@@ -442,7 +442,7 @@ struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
        if (IS_ERR(attr))
                return NULL;
 
-       if (av->network_type == RXE_NETWORK_TYPE_IPV6)
+       if (av->network_type == RXE_NETWORK_TYPE_IPV4)
                hdr_len = ETH_HLEN + sizeof(struct udphdr) +
                        sizeof(struct iphdr);
        else
index 1fc0223..f9c832e 100644 (file)
@@ -1118,6 +1118,7 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
        int err;
        struct ib_device *dev = &rxe->ib_dev;
        struct crypto_shash *tfm;
+       u64 dma_mask;
 
        strlcpy(dev->node_desc, "rxe", sizeof(dev->node_desc));
 
@@ -1130,7 +1131,10 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
                            rxe->ndev->dev_addr);
        dev->dev.dma_parms = &rxe->dma_parms;
        dma_set_max_seg_size(&dev->dev, UINT_MAX);
-       dma_set_coherent_mask(&dev->dev, dma_get_required_mask(&dev->dev));
+       dma_mask = IS_ENABLED(CONFIG_64BIT) ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32);
+       err = dma_coerce_mask_and_coherent(&dev->dev, dma_mask);
+       if (err)
+               return err;
 
        dev->uverbs_cmd_mask = BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT)
            | BIT_ULL(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL)
index ca8bc72..181e06c 100644 (file)
@@ -306,6 +306,7 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
        struct siw_device *sdev = NULL;
        struct ib_device *base_dev;
        struct device *parent = netdev->dev.parent;
+       u64 dma_mask;
        int rv;
 
        if (!parent) {
@@ -384,8 +385,10 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
        base_dev->dev.parent = parent;
        base_dev->dev.dma_parms = &sdev->dma_parms;
        dma_set_max_seg_size(&base_dev->dev, UINT_MAX);
-       dma_set_coherent_mask(&base_dev->dev,
-                             dma_get_required_mask(&base_dev->dev));
+       dma_mask = IS_ENABLED(CONFIG_64BIT) ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32);
+       if (dma_coerce_mask_and_coherent(&base_dev->dev, dma_mask))
+               goto error;
+
        base_dev->num_comp_vectors = num_possible_cpus();
 
        xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1);
index 2f3ebc0..2bd18b0 100644 (file)
@@ -620,7 +620,7 @@ static void iser_route_handler(struct rdma_cm_id *cma_id)
        conn_param.private_data = (void *)&req_hdr;
        conn_param.private_data_len = sizeof(struct iser_cm_hdr);
 
-       ret = rdma_connect(cma_id, &conn_param);
+       ret = rdma_connect_locked(cma_id, &conn_param);
        if (ret) {
                iser_err("failure connecting: %d\n", ret);
                goto failure;
index 776e892..f298adc 100644 (file)
@@ -1674,9 +1674,9 @@ static int rtrs_rdma_route_resolved(struct rtrs_clt_con *con)
        uuid_copy(&msg.sess_uuid, &sess->s.uuid);
        uuid_copy(&msg.paths_uuid, &clt->paths_uuid);
 
-       err = rdma_connect(con->c.cm_id, &param);
+       err = rdma_connect_locked(con->c.cm_id, &param);
        if (err)
-               rtrs_err(clt, "rdma_connect(): %d\n", err);
+               rtrs_err(clt, "rdma_connect_locked(): %d\n", err);
 
        return err;
 }
index 0065eb1..53a8bec 100644 (file)
@@ -622,10 +622,11 @@ static int srpt_refresh_port(struct srpt_port *sport)
 /**
  * srpt_unregister_mad_agent - unregister MAD callback functions
  * @sdev: SRPT HCA pointer.
+ * @port_cnt: number of ports with registered MAD
  *
  * Note: It is safe to call this function more than once for the same device.
  */
-static void srpt_unregister_mad_agent(struct srpt_device *sdev)
+static void srpt_unregister_mad_agent(struct srpt_device *sdev, int port_cnt)
 {
        struct ib_port_modify port_modify = {
                .clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP,
@@ -633,7 +634,7 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev)
        struct srpt_port *sport;
        int i;
 
-       for (i = 1; i <= sdev->device->phys_port_cnt; i++) {
+       for (i = 1; i <= port_cnt; i++) {
                sport = &sdev->port[i - 1];
                WARN_ON(sport->port != i);
                if (sport->mad_agent) {
@@ -3185,7 +3186,8 @@ static int srpt_add_one(struct ib_device *device)
                if (ret) {
                        pr_err("MAD registration failed for %s-%d.\n",
                               dev_name(&sdev->device->dev), i);
-                       goto err_event;
+                       i--;
+                       goto err_port;
                }
        }
 
@@ -3197,7 +3199,8 @@ static int srpt_add_one(struct ib_device *device)
        pr_debug("added %s.\n", dev_name(&device->dev));
        return 0;
 
-err_event:
+err_port:
+       srpt_unregister_mad_agent(sdev, i);
        ib_unregister_event_handler(&sdev->event_handler);
 err_cm:
        if (sdev->cm_id)
@@ -3221,7 +3224,7 @@ static void srpt_remove_one(struct ib_device *device, void *client_data)
        struct srpt_device *sdev = client_data;
        int i;
 
-       srpt_unregister_mad_agent(sdev);
+       srpt_unregister_mad_agent(sdev, sdev->device->phys_port_cnt);
 
        ib_unregister_event_handler(&sdev->event_handler);
 
index 41435a6..bdeb010 100644 (file)
@@ -256,6 +256,7 @@ enum rdma_ch_state {
  * @rdma_cm:      See below.
  * @rdma_cm.cm_id: RDMA CM ID associated with the channel.
  * @cq:            IB completion queue for this channel.
+ * @cq_size:      Number of CQEs in @cq.
  * @zw_cqe:       Zero-length write CQE.
  * @rcu:           RCU head.
  * @kref:         kref for this channel.
index e494295..95f9069 100644 (file)
@@ -28,7 +28,6 @@
 struct evdev {
        int open;
        struct input_handle handle;
-       wait_queue_head_t wait;
        struct evdev_client __rcu *grab;
        struct list_head client_list;
        spinlock_t client_lock; /* protects client_list */
@@ -43,6 +42,7 @@ struct evdev_client {
        unsigned int tail;
        unsigned int packet_head; /* [future] position of the first element of next packet */
        spinlock_t buffer_lock; /* protects access to buffer, head and tail */
+       wait_queue_head_t wait;
        struct fasync_struct *fasync;
        struct evdev *evdev;
        struct list_head node;
@@ -245,7 +245,6 @@ static void evdev_pass_values(struct evdev_client *client,
                        const struct input_value *vals, unsigned int count,
                        ktime_t *ev_time)
 {
-       struct evdev *evdev = client->evdev;
        const struct input_value *v;
        struct input_event event;
        struct timespec64 ts;
@@ -282,7 +281,7 @@ static void evdev_pass_values(struct evdev_client *client,
        spin_unlock(&client->buffer_lock);
 
        if (wakeup)
-               wake_up_interruptible_poll(&evdev->wait,
+               wake_up_interruptible_poll(&client->wait,
                        EPOLLIN | EPOLLOUT | EPOLLRDNORM | EPOLLWRNORM);
 }
 
@@ -426,11 +425,11 @@ static void evdev_hangup(struct evdev *evdev)
        struct evdev_client *client;
 
        spin_lock(&evdev->client_lock);
-       list_for_each_entry(client, &evdev->client_list, node)
+       list_for_each_entry(client, &evdev->client_list, node) {
                kill_fasync(&client->fasync, SIGIO, POLL_HUP);
+               wake_up_interruptible_poll(&client->wait, EPOLLHUP | EPOLLERR);
+       }
        spin_unlock(&evdev->client_lock);
-
-       wake_up_interruptible_poll(&evdev->wait, EPOLLHUP | EPOLLERR);
 }
 
 static int evdev_release(struct inode *inode, struct file *file)
@@ -479,6 +478,7 @@ static int evdev_open(struct inode *inode, struct file *file)
        if (!client)
                return -ENOMEM;
 
+       init_waitqueue_head(&client->wait);
        client->bufsize = bufsize;
        spin_lock_init(&client->buffer_lock);
        client->evdev = evdev;
@@ -595,7 +595,7 @@ static ssize_t evdev_read(struct file *file, char __user *buffer,
                        break;
 
                if (!(file->f_flags & O_NONBLOCK)) {
-                       error = wait_event_interruptible(evdev->wait,
+                       error = wait_event_interruptible(client->wait,
                                        client->packet_head != client->tail ||
                                        !evdev->exist || client->revoked);
                        if (error)
@@ -613,7 +613,7 @@ static __poll_t evdev_poll(struct file *file, poll_table *wait)
        struct evdev *evdev = client->evdev;
        __poll_t mask;
 
-       poll_wait(file, &evdev->wait, wait);
+       poll_wait(file, &client->wait, wait);
 
        if (evdev->exist && !client->revoked)
                mask = EPOLLOUT | EPOLLWRNORM;
@@ -946,7 +946,7 @@ static int evdev_revoke(struct evdev *evdev, struct evdev_client *client,
        client->revoked = true;
        evdev_ungrab(evdev, client);
        input_flush_device(&evdev->handle, file);
-       wake_up_interruptible_poll(&evdev->wait, EPOLLHUP | EPOLLERR);
+       wake_up_interruptible_poll(&client->wait, EPOLLHUP | EPOLLERR);
 
        return 0;
 }
@@ -1358,7 +1358,6 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
        INIT_LIST_HEAD(&evdev->client_list);
        spin_lock_init(&evdev->client_lock);
        mutex_init(&evdev->mutex);
-       init_waitqueue_head(&evdev->wait);
        evdev->exist = true;
 
        dev_no = minor;
index f699538..44fe6f2 100644 (file)
@@ -323,11 +323,14 @@ static int adjust_dual(int *begin, int step, int *end, int eq, int mu)
        p = begin + step;
        s = p == end ? f + 1 : *p;
 
-       for (; p != end; p += step)
-               if (*p < f)
-                       s = f, f = *p;
-               else if (*p < s)
+       for (; p != end; p += step) {
+               if (*p < f) {
+                       s = f;
+                       f = *p;
+               } else if (*p < s) {
                        s = *p;
+               }
+       }
 
        c = (f + s + 1) / 2;
        if (c == 0 || (c > mu && (!eq || mu > 0)))
index eb031b7..b080f0c 100644 (file)
@@ -42,6 +42,16 @@ config JOYSTICK_A3D
          To compile this driver as a module, choose M here: the
          module will be called a3d.
 
+config JOYSTICK_ADC
+       tristate "Simple joystick connected over ADC"
+       depends on IIO
+       select IIO_BUFFER_CB
+       help
+         Say Y here if you have a simple joystick connected over ADC.
+
+         To compile this driver as a module, choose M here: the
+         module will be called adc-joystick.
+
 config JOYSTICK_ADI
        tristate "Logitech ADI digital joysticks and gamepads"
        select GAMEPORT
index 8656023..58232b3 100644 (file)
@@ -6,6 +6,7 @@
 # Each configuration option enables a list of files.
 
 obj-$(CONFIG_JOYSTICK_A3D)             += a3d.o
+obj-$(CONFIG_JOYSTICK_ADC)             += adc-joystick.o
 obj-$(CONFIG_JOYSTICK_ADI)             += adi.o
 obj-$(CONFIG_JOYSTICK_AMIGA)           += amijoy.o
 obj-$(CONFIG_JOYSTICK_AS5011)          += as5011.o
diff --git a/drivers/input/joystick/adc-joystick.c b/drivers/input/joystick/adc-joystick.c
new file mode 100644 (file)
index 0000000..78ebca7
--- /dev/null
@@ -0,0 +1,264 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Input driver for joysticks connected over ADC.
+ * Copyright (c) 2019-2020 Artur Rojek <contact@artur-rojek.eu>
+ */
+#include <linux/ctype.h>
+#include <linux/input.h>
+#include <linux/iio/iio.h>
+#include <linux/iio/consumer.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
+
+#include <asm/unaligned.h>
+
+struct adc_joystick_axis {
+       u32 code;
+       s32 range[2];
+       s32 fuzz;
+       s32 flat;
+};
+
+struct adc_joystick {
+       struct input_dev *input;
+       struct iio_cb_buffer *buffer;
+       struct adc_joystick_axis *axes;
+       struct iio_channel *chans;
+       int num_chans;
+};
+
+static int adc_joystick_handle(const void *data, void *private)
+{
+       struct adc_joystick *joy = private;
+       enum iio_endian endianness;
+       int bytes, msb, val, idx, i;
+       const u16 *data_u16;
+       bool sign;
+
+       bytes = joy->chans[0].channel->scan_type.storagebits >> 3;
+
+       for (i = 0; i < joy->num_chans; ++i) {
+               idx = joy->chans[i].channel->scan_index;
+               endianness = joy->chans[i].channel->scan_type.endianness;
+               msb = joy->chans[i].channel->scan_type.realbits - 1;
+               sign = tolower(joy->chans[i].channel->scan_type.sign) == 's';
+
+               switch (bytes) {
+               case 1:
+                       val = ((const u8 *)data)[idx];
+                       break;
+               case 2:
+                       data_u16 = (const u16 *)data + idx;
+
+                       /*
+                        * Data is aligned to the sample size by IIO core.
+                        * Call `get_unaligned_xe16` to hide type casting.
+                        */
+                       if (endianness == IIO_BE)
+                               val = get_unaligned_be16(data_u16);
+                       else if (endianness == IIO_LE)
+                               val = get_unaligned_le16(data_u16);
+                       else /* IIO_CPU */
+                               val = *data_u16;
+                       break;
+               default:
+                       return -EINVAL;
+               }
+
+               val >>= joy->chans[i].channel->scan_type.shift;
+               if (sign)
+                       val = sign_extend32(val, msb);
+               else
+                       val &= GENMASK(msb, 0);
+               input_report_abs(joy->input, joy->axes[i].code, val);
+       }
+
+       input_sync(joy->input);
+
+       return 0;
+}
+
+static int adc_joystick_open(struct input_dev *dev)
+{
+       struct adc_joystick *joy = input_get_drvdata(dev);
+       struct device *devp = &dev->dev;
+       int ret;
+
+       ret = iio_channel_start_all_cb(joy->buffer);
+       if (ret)
+               dev_err(devp, "Unable to start callback buffer: %d\n", ret);
+
+       return ret;
+}
+
+static void adc_joystick_close(struct input_dev *dev)
+{
+       struct adc_joystick *joy = input_get_drvdata(dev);
+
+       iio_channel_stop_all_cb(joy->buffer);
+}
+
+static void adc_joystick_cleanup(void *data)
+{
+       iio_channel_release_all_cb(data);
+}
+
+static int adc_joystick_set_axes(struct device *dev, struct adc_joystick *joy)
+{
+       struct adc_joystick_axis *axes;
+       struct fwnode_handle *child;
+       int num_axes, error, i;
+
+       num_axes = device_get_child_node_count(dev);
+       if (!num_axes) {
+               dev_err(dev, "Unable to find child nodes\n");
+               return -EINVAL;
+       }
+
+       if (num_axes != joy->num_chans) {
+               dev_err(dev, "Got %d child nodes for %d channels\n",
+                       num_axes, joy->num_chans);
+               return -EINVAL;
+       }
+
+       axes = devm_kmalloc_array(dev, num_axes, sizeof(*axes), GFP_KERNEL);
+       if (!axes)
+               return -ENOMEM;
+
+       device_for_each_child_node(dev, child) {
+               error = fwnode_property_read_u32(child, "reg", &i);
+               if (error) {
+                       dev_err(dev, "reg invalid or missing\n");
+                       goto err_fwnode_put;
+               }
+
+               if (i >= num_axes) {
+                       error = -EINVAL;
+                       dev_err(dev, "No matching axis for reg %d\n", i);
+                       goto err_fwnode_put;
+               }
+
+               error = fwnode_property_read_u32(child, "linux,code",
+                                                &axes[i].code);
+               if (error) {
+                       dev_err(dev, "linux,code invalid or missing\n");
+                       goto err_fwnode_put;
+               }
+
+               error = fwnode_property_read_u32_array(child, "abs-range",
+                                                      axes[i].range, 2);
+               if (error) {
+                       dev_err(dev, "abs-range invalid or missing\n");
+                       goto err_fwnode_put;
+               }
+
+               fwnode_property_read_u32(child, "abs-fuzz", &axes[i].fuzz);
+               fwnode_property_read_u32(child, "abs-flat", &axes[i].flat);
+
+               input_set_abs_params(joy->input, axes[i].code,
+                                    axes[i].range[0], axes[i].range[1],
+                                    axes[i].fuzz, axes[i].flat);
+               input_set_capability(joy->input, EV_ABS, axes[i].code);
+       }
+
+       joy->axes = axes;
+
+       return 0;
+
+err_fwnode_put:
+       fwnode_handle_put(child);
+       return error;
+}
+
+static int adc_joystick_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct adc_joystick *joy;
+       struct input_dev *input;
+       int error;
+       int bits;
+       int i;
+
+       joy = devm_kzalloc(dev, sizeof(*joy), GFP_KERNEL);
+       if (!joy)
+               return -ENOMEM;
+
+       joy->chans = devm_iio_channel_get_all(dev);
+       if (IS_ERR(joy->chans)) {
+               error = PTR_ERR(joy->chans);
+               if (error != -EPROBE_DEFER)
+                       dev_err(dev, "Unable to get IIO channels");
+               return error;
+       }
+
+       /* Count how many channels we got. NULL terminated. */
+       for (i = 0; joy->chans[i].indio_dev; i++) {
+               bits = joy->chans[i].channel->scan_type.storagebits;
+               if (!bits || bits > 16) {
+                       dev_err(dev, "Unsupported channel storage size\n");
+                       return -EINVAL;
+               }
+               if (bits != joy->chans[0].channel->scan_type.storagebits) {
+                       dev_err(dev, "Channels must have equal storage size\n");
+                       return -EINVAL;
+               }
+       }
+       joy->num_chans = i;
+
+       input = devm_input_allocate_device(dev);
+       if (!input) {
+               dev_err(dev, "Unable to allocate input device\n");
+               return -ENOMEM;
+       }
+
+       joy->input = input;
+       input->name = pdev->name;
+       input->id.bustype = BUS_HOST;
+       input->open = adc_joystick_open;
+       input->close = adc_joystick_close;
+
+       error = adc_joystick_set_axes(dev, joy);
+       if (error)
+               return error;
+
+       input_set_drvdata(input, joy);
+       error = input_register_device(input);
+       if (error) {
+               dev_err(dev, "Unable to register input device\n");
+               return error;
+       }
+
+       joy->buffer = iio_channel_get_all_cb(dev, adc_joystick_handle, joy);
+       if (IS_ERR(joy->buffer)) {
+               dev_err(dev, "Unable to allocate callback buffer\n");
+               return PTR_ERR(joy->buffer);
+       }
+
+       error = devm_add_action_or_reset(dev, adc_joystick_cleanup, joy->buffer);
+       if (error)  {
+               dev_err(dev, "Unable to add action\n");
+               return error;
+       }
+
+       return 0;
+}
+
+static const struct of_device_id adc_joystick_of_match[] = {
+       { .compatible = "adc-joystick", },
+       { }
+};
+MODULE_DEVICE_TABLE(of, adc_joystick_of_match);
+
+static struct platform_driver adc_joystick_driver = {
+       .driver = {
+               .name = "adc-joystick",
+               .of_match_table = adc_joystick_of_match,
+       },
+       .probe = adc_joystick_probe,
+};
+module_platform_driver(adc_joystick_driver);
+
+MODULE_DESCRIPTION("Input driver for joysticks connected over ADC");
+MODULE_AUTHOR("Artur Rojek <contact@artur-rojek.eu>");
+MODULE_LICENSE("GPL");
index 7c70492..f831f01 100644 (file)
@@ -250,8 +250,8 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
        }
 
        keypad->irq = platform_get_irq(pdev, 0);
-       if (!keypad->irq) {
-               err = -ENXIO;
+       if (keypad->irq < 0) {
+               err = keypad->irq;
                goto failed_free;
        }
 
index 94c94d7..d6c9240 100644 (file)
@@ -240,10 +240,8 @@ static int omap4_keypad_probe(struct platform_device *pdev)
        }
 
        irq = platform_get_irq(pdev, 0);
-       if (!irq) {
-               dev_err(&pdev->dev, "no keyboard irq assigned\n");
-               return -EINVAL;
-       }
+       if (irq < 0)
+               return irq;
 
        keypad_data = kzalloc(sizeof(struct omap4_keypad), GFP_KERNEL);
        if (!keypad_data) {
index af3a682..77e0743 100644 (file)
@@ -50,7 +50,7 @@ struct twl4030_keypad {
        bool            autorepeat;
        unsigned int    n_rows;
        unsigned int    n_cols;
-       unsigned int    irq;
+       int             irq;
 
        struct device *dbg_dev;
        struct input_dev *input;
@@ -376,10 +376,8 @@ static int twl4030_kp_probe(struct platform_device *pdev)
        }
 
        kp->irq = platform_get_irq(pdev, 0);
-       if (!kp->irq) {
-               dev_err(&pdev->dev, "no keyboard irq assigned\n");
-               return -EINVAL;
-       }
+       if (kp->irq < 0)
+               return kp->irq;
 
        error = matrix_keypad_build_keymap(keymap_data, NULL,
                                           TWL4030_MAX_ROWS,
index 08520b3..cae1a3f 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/acpi.h>
+#include <linux/dmi.h>
 #include <linux/gpio/consumer.h>
 #include <linux/gpio_keys.h>
 #include <linux/gpio.h>
@@ -23,6 +24,7 @@ struct soc_button_info {
        unsigned int event_code;
        bool autorepeat;
        bool wakeup;
+       bool active_low;
 };
 
 struct soc_device_data {
@@ -42,22 +44,65 @@ struct soc_button_data {
 };
 
 /*
+ * Some 2-in-1s which use the soc_button_array driver have this ugly issue in
+ * their DSDT where the _LID method modifies the irq-type settings of the GPIOs
+ * used for the power and home buttons. The intend of this AML code is to
+ * disable these buttons when the lid is closed.
+ * The AML does this by directly poking the GPIO controllers registers. This is
+ * problematic because when re-enabling the irq, which happens whenever _LID
+ * gets called with the lid open (e.g. on boot and on resume), it sets the
+ * irq-type to IRQ_TYPE_LEVEL_LOW. Where as the gpio-keys driver programs the
+ * type to, and expects it to be, IRQ_TYPE_EDGE_BOTH.
+ * To work around this we don't set gpio_keys_button.gpio on these 2-in-1s,
+ * instead we get the irq for the GPIO ourselves, configure it as
+ * IRQ_TYPE_LEVEL_LOW (to match how the _LID AML code configures it) and pass
+ * the irq in gpio_keys_button.irq. Below is a list of affected devices.
+ */
+static const struct dmi_system_id dmi_use_low_level_irq[] = {
+       {
+               /*
+                * Acer Switch 10 SW5-012. _LID method messes with home- and
+                * power-button GPIO IRQ settings. When (re-)enabling the irq
+                * it ors in its own flags without clearing the previous set
+                * ones, leading to an irq-type of IRQ_TYPE_LEVEL_LOW |
+                * IRQ_TYPE_LEVEL_HIGH causing a continuous interrupt storm.
+                */
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
+               },
+       },
+       {
+               /*
+                * Acer One S1003. _LID method messes with power-button GPIO
+                * IRQ settings, leading to a non working power-button.
+                */
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "One S1003"),
+               },
+       },
+       {} /* Terminating entry */
+};
+
+/*
  * Get the Nth GPIO number from the ACPI object.
  */
-static int soc_button_lookup_gpio(struct device *dev, int acpi_index)
+static int soc_button_lookup_gpio(struct device *dev, int acpi_index,
+                                 int *gpio_ret, int *irq_ret)
 {
        struct gpio_desc *desc;
-       int gpio;
 
        desc = gpiod_get_index(dev, NULL, acpi_index, GPIOD_ASIS);
        if (IS_ERR(desc))
                return PTR_ERR(desc);
 
-       gpio = desc_to_gpio(desc);
+       *gpio_ret = desc_to_gpio(desc);
+       *irq_ret = gpiod_to_irq(desc);
 
        gpiod_put(desc);
 
-       return gpio;
+       return 0;
 }
 
 static struct platform_device *
@@ -69,9 +114,8 @@ soc_button_device_create(struct platform_device *pdev,
        struct platform_device *pd;
        struct gpio_keys_button *gpio_keys;
        struct gpio_keys_platform_data *gpio_keys_pdata;
+       int error, gpio, irq;
        int n_buttons = 0;
-       int gpio;
-       int error;
 
        for (info = button_info; info->name; info++)
                if (info->autorepeat == autorepeat)
@@ -91,8 +135,8 @@ soc_button_device_create(struct platform_device *pdev,
                if (info->autorepeat != autorepeat)
                        continue;
 
-               gpio = soc_button_lookup_gpio(&pdev->dev, info->acpi_index);
-               if (!gpio_is_valid(gpio)) {
+               error = soc_button_lookup_gpio(&pdev->dev, info->acpi_index, &gpio, &irq);
+               if (error || irq < 0) {
                        /*
                         * Skip GPIO if not present. Note we deliberately
                         * ignore -EPROBE_DEFER errors here. On some devices
@@ -107,10 +151,18 @@ soc_button_device_create(struct platform_device *pdev,
                        continue;
                }
 
+               /* See dmi_use_low_level_irq[] comment */
+               if (!autorepeat && dmi_check_system(dmi_use_low_level_irq)) {
+                       irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW);
+                       gpio_keys[n_buttons].irq = irq;
+                       gpio_keys[n_buttons].gpio = -ENOENT;
+               } else {
+                       gpio_keys[n_buttons].gpio = gpio;
+               }
+
                gpio_keys[n_buttons].type = info->event_type;
                gpio_keys[n_buttons].code = info->event_code;
-               gpio_keys[n_buttons].gpio = gpio;
-               gpio_keys[n_buttons].active_low = 1;
+               gpio_keys[n_buttons].active_low = info->active_low;
                gpio_keys[n_buttons].desc = info->name;
                gpio_keys[n_buttons].wakeup = info->wakeup;
                /* These devices often use cheap buttons, use 50 ms debounce */
@@ -173,6 +225,7 @@ static int soc_button_parse_btn_desc(struct device *dev,
        }
 
        info->event_type = EV_KEY;
+       info->active_low = true;
        info->acpi_index =
                soc_button_get_acpi_object_int(&desc->package.elements[1]);
        upage = soc_button_get_acpi_object_int(&desc->package.elements[3]);
@@ -383,11 +436,11 @@ static int soc_button_probe(struct platform_device *pdev)
  * Platforms"
  */
 static const struct soc_button_info soc_button_PNP0C40[] = {
-       { "power", 0, EV_KEY, KEY_POWER, false, true },
-       { "home", 1, EV_KEY, KEY_LEFTMETA, false, true },
-       { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false },
-       { "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false },
-       { "rotation_lock", 4, EV_KEY, KEY_ROTATE_LOCK_TOGGLE, false, false },
+       { "power", 0, EV_KEY, KEY_POWER, false, true, true },
+       { "home", 1, EV_KEY, KEY_LEFTMETA, false, true, true },
+       { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false, true },
+       { "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false, true },
+       { "rotation_lock", 4, EV_KEY, KEY_ROTATE_LOCK_TOGGLE, false, false, true },
        { }
 };
 
@@ -395,6 +448,15 @@ static const struct soc_device_data soc_device_PNP0C40 = {
        .button_info = soc_button_PNP0C40,
 };
 
+static const struct soc_button_info soc_button_INT33D3[] = {
+       { "tablet_mode", 0, EV_SW, SW_TABLET_MODE, false, false, false },
+       { }
+};
+
+static const struct soc_device_data soc_device_INT33D3 = {
+       .button_info = soc_button_INT33D3,
+};
+
 /*
  * Special device check for Surface Book 2 and Surface Pro (2017).
  * Both, the Surface Pro 4 (surfacepro3_button.c) and the above mentioned
@@ -444,9 +506,9 @@ static int soc_device_check_MSHW0040(struct device *dev)
  * Obtained from DSDT/testing.
  */
 static const struct soc_button_info soc_button_MSHW0040[] = {
-       { "power", 0, EV_KEY, KEY_POWER, false, true },
-       { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false },
-       { "volume_down", 4, EV_KEY, KEY_VOLUMEDOWN, true, false },
+       { "power", 0, EV_KEY, KEY_POWER, false, true, true },
+       { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false, true },
+       { "volume_down", 4, EV_KEY, KEY_VOLUMEDOWN, true, false, true },
        { }
 };
 
@@ -457,6 +519,8 @@ static const struct soc_device_data soc_device_MSHW0040 = {
 
 static const struct acpi_device_id soc_button_acpi_match[] = {
        { "PNP0C40", (unsigned long)&soc_device_PNP0C40 },
+       { "INT33D3", (unsigned long)&soc_device_INT33D3 },
+       { "ID9001", (unsigned long)&soc_device_INT33D3 },
        { "ACPI0011", 0 },
 
        /* Microsoft Surface Devices (5th and 6th generation) */
index 4b81b2d..8257709 100644 (file)
@@ -179,12 +179,14 @@ static const char * const smbus_pnp_ids[] = {
        "LEN0093", /* T480 */
        "LEN0096", /* X280 */
        "LEN0097", /* X280 -> ALPS trackpoint */
-       "LEN0099", /* X1 Extreme 1st */
+       "LEN0099", /* X1 Extreme Gen 1 / P1 Gen 1 */
        "LEN009b", /* T580 */
+       "LEN0402", /* X1 Extreme Gen 2 / P1 Gen 2 */
        "LEN200f", /* T450s */
        "LEN2044", /* L470  */
        "LEN2054", /* E480 */
        "LEN2055", /* E580 */
+       "LEN2068", /* T14 Gen 1 */
        "SYN3052", /* HP EliteBook 840 G4 */
        "SYN3221", /* HP 15-ay000 */
        "SYN323d", /* HP Spectre X360 13-w013dx */
@@ -1752,7 +1754,7 @@ static int synaptics_create_intertouch(struct psmouse *psmouse,
                        .kernel_tracking = false,
                        .topbuttonpad = topbuttonpad,
                },
-               .f30_data = {
+               .gpio_data = {
                        .buttonpad = SYN_CAP_CLICKPAD(info->ext_cap_0c),
                        .trackstick_buttons =
                                !!SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10),
index a212ff7..16119f7 100644 (file)
@@ -100,6 +100,14 @@ config RMI4_F34
          device via the firmware loader interface. This is triggered using a
          sysfs attribute.
 
+config RMI4_F3A
+       bool "RMI4 Function 3A (GPIO)"
+       help
+         Say Y here if you want to add support for RMI4 function 3A.
+
+         Function 3A provides GPIO support for RMI4 devices. This includes
+         support for buttons on TouchPads and ClickPads.
+
 config RMI4_F54
        bool "RMI4 Function 54 (Analog diagnostics)"
        depends on VIDEO_V4L2=y || (RMI4_CORE=m && VIDEO_V4L2=m)
index f176316..02f14c8 100644 (file)
@@ -10,6 +10,7 @@ rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o
 rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o
 rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o
 rmi_core-$(CONFIG_RMI4_F34) += rmi_f34.o rmi_f34v7.o
+rmi_core-$(CONFIG_RMI4_F3A) += rmi_f3a.o
 rmi_core-$(CONFIG_RMI4_F54) += rmi_f54.o
 rmi_core-$(CONFIG_RMI4_F55) += rmi_f55.o
 
index af706a5..47d1b97 100644 (file)
@@ -365,6 +365,9 @@ static struct rmi_function_handler *fn_handlers[] = {
 #ifdef CONFIG_RMI4_F34
        &rmi_f34_handler,
 #endif
+#ifdef CONFIG_RMI4_F3A
+       &rmi_f3a_handler,
+#endif
 #ifdef CONFIG_RMI4_F54
        &rmi_f54_handler,
 #endif
index 65bfaa9..1c6c608 100644 (file)
@@ -135,6 +135,7 @@ extern struct rmi_function_handler rmi_f11_handler;
 extern struct rmi_function_handler rmi_f12_handler;
 extern struct rmi_function_handler rmi_f30_handler;
 extern struct rmi_function_handler rmi_f34_handler;
+extern struct rmi_function_handler rmi_f3a_handler;
 extern struct rmi_function_handler rmi_f54_handler;
 extern struct rmi_function_handler rmi_f55_handler;
 #endif
index a90dad1..35045f1 100644 (file)
@@ -168,17 +168,17 @@ static int rmi_f30_config(struct rmi_function *fn)
                                rmi_get_platform_data(fn->rmi_dev);
        int error;
 
-       /* can happen if f30_data.disable is set */
+       /* can happen if gpio_data.disable is set */
        if (!f30)
                return 0;
 
-       if (pdata->f30_data.trackstick_buttons) {
+       if (pdata->gpio_data.trackstick_buttons) {
                /* Try [re-]establish link to F03. */
                f30->f03 = rmi_find_function(fn->rmi_dev, 0x03);
                f30->trackstick_buttons = f30->f03 != NULL;
        }
 
-       if (pdata->f30_data.disable) {
+       if (pdata->gpio_data.disable) {
                drv->clear_irq_bits(fn->rmi_dev, fn->irq_mask);
        } else {
                /* Write Control Register values back to device */
@@ -245,10 +245,10 @@ static int rmi_f30_map_gpios(struct rmi_function *fn,
                if (!rmi_f30_is_valid_button(i, f30->ctrl))
                        continue;
 
-               if (pdata->f30_data.trackstick_buttons &&
+               if (pdata->gpio_data.trackstick_buttons &&
                    i >= TRACKSTICK_RANGE_START && i < TRACKSTICK_RANGE_END) {
                        f30->gpioled_key_map[i] = trackstick_button++;
-               } else if (!pdata->f30_data.buttonpad || !button_mapped) {
+               } else if (!pdata->gpio_data.buttonpad || !button_mapped) {
                        f30->gpioled_key_map[i] = button;
                        input_set_capability(input, EV_KEY, button++);
                        button_mapped = true;
@@ -264,7 +264,7 @@ static int rmi_f30_map_gpios(struct rmi_function *fn,
         * but I am not sure, so use only the pdata info and the number of
         * mapped buttons.
         */
-       if (pdata->f30_data.buttonpad || (button - BTN_LEFT == 1))
+       if (pdata->gpio_data.buttonpad || (button - BTN_LEFT == 1))
                __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
 
        return 0;
@@ -372,7 +372,7 @@ static int rmi_f30_probe(struct rmi_function *fn)
        struct f30_data *f30;
        int error;
 
-       if (pdata->f30_data.disable)
+       if (pdata->gpio_data.disable)
                return 0;
 
        if (!drv_data->input) {
index 74f7c6f..8d7ec9d 100644 (file)
@@ -1364,9 +1364,14 @@ int rmi_f34v7_probe(struct f34_data *f34)
                f34->bl_version = 6;
        } else if (f34->bootloader_id[1] == 7) {
                f34->bl_version = 7;
+       } else if (f34->bootloader_id[1] == 8) {
+               f34->bl_version = 8;
        } else {
-               dev_err(&f34->fn->dev, "%s: Unrecognized bootloader version\n",
-                               __func__);
+               dev_err(&f34->fn->dev,
+                       "%s: Unrecognized bootloader version: %d (%c) %d (%c)\n",
+                       __func__,
+                       f34->bootloader_id[0], f34->bootloader_id[0],
+                       f34->bootloader_id[1], f34->bootloader_id[1]);
                return -EINVAL;
        }
 
diff --git a/drivers/input/rmi4/rmi_f3a.c b/drivers/input/rmi4/rmi_f3a.c
new file mode 100644 (file)
index 0000000..0e8baed
--- /dev/null
@@ -0,0 +1,241 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2012-2020 Synaptics Incorporated
+ */
+
+#include <linux/kernel.h>
+#include <linux/rmi.h>
+#include <linux/input.h>
+#include <linux/slab.h>
+#include "rmi_driver.h"
+
+#define RMI_F3A_MAX_GPIO_COUNT         128
+#define RMI_F3A_MAX_REG_SIZE           DIV_ROUND_UP(RMI_F3A_MAX_GPIO_COUNT, 8)
+
+/* Defs for Query 0 */
+#define RMI_F3A_GPIO_COUNT             0x7F
+
+#define RMI_F3A_DATA_REGS_MAX_SIZE     RMI_F3A_MAX_REG_SIZE
+
+#define TRACKSTICK_RANGE_START         3
+#define TRACKSTICK_RANGE_END           6
+
+struct f3a_data {
+       /* Query Data */
+       u8 gpio_count;
+
+       u8 register_count;
+
+       u8 data_regs[RMI_F3A_DATA_REGS_MAX_SIZE];
+       u16 *gpio_key_map;
+
+       struct input_dev *input;
+
+       struct rmi_function *f03;
+       bool trackstick_buttons;
+};
+
+static void rmi_f3a_report_button(struct rmi_function *fn,
+                                 struct f3a_data *f3a, unsigned int button)
+{
+       u16 key_code = f3a->gpio_key_map[button];
+       bool key_down = !(f3a->data_regs[0] & BIT(button));
+
+       if (f3a->trackstick_buttons &&
+               button >= TRACKSTICK_RANGE_START &&
+               button <= TRACKSTICK_RANGE_END) {
+               rmi_f03_overwrite_button(f3a->f03, key_code, key_down);
+       } else {
+               rmi_dbg(RMI_DEBUG_FN, &fn->dev,
+                       "%s: call input report key (0x%04x) value (0x%02x)",
+                       __func__, key_code, key_down);
+               input_report_key(f3a->input, key_code, key_down);
+       }
+}
+
+static irqreturn_t rmi_f3a_attention(int irq, void *ctx)
+{
+       struct rmi_function *fn = ctx;
+       struct f3a_data *f3a = dev_get_drvdata(&fn->dev);
+       struct rmi_driver_data *drvdata = dev_get_drvdata(&fn->rmi_dev->dev);
+       int error;
+       int i;
+
+       if (drvdata->attn_data.data) {
+               if (drvdata->attn_data.size < f3a->register_count) {
+                       dev_warn(&fn->dev,
+                                "F3A interrupted, but data is missing\n");
+                       return IRQ_HANDLED;
+               }
+               memcpy(f3a->data_regs, drvdata->attn_data.data,
+                       f3a->register_count);
+               drvdata->attn_data.data += f3a->register_count;
+               drvdata->attn_data.size -= f3a->register_count;
+       } else {
+               error = rmi_read_block(fn->rmi_dev, fn->fd.data_base_addr,
+                                       f3a->data_regs, f3a->register_count);
+               if (error) {
+                       dev_err(&fn->dev,
+                               "%s: Failed to read F3a data registers: %d\n",
+                               __func__, error);
+                       return IRQ_RETVAL(error);
+               }
+       }
+
+       for (i = 0; i < f3a->gpio_count; i++)
+               if (f3a->gpio_key_map[i] != KEY_RESERVED)
+                       rmi_f3a_report_button(fn, f3a, i);
+       if (f3a->trackstick_buttons)
+               rmi_f03_commit_buttons(f3a->f03);
+
+       return IRQ_HANDLED;
+}
+
+static int rmi_f3a_config(struct rmi_function *fn)
+{
+       struct f3a_data *f3a = dev_get_drvdata(&fn->dev);
+       struct rmi_driver *drv = fn->rmi_dev->driver;
+       const struct rmi_device_platform_data *pdata =
+                       rmi_get_platform_data(fn->rmi_dev);
+
+       if (!f3a)
+               return 0;
+
+       if (pdata->gpio_data.trackstick_buttons) {
+               /* Try [re-]establish link to F03. */
+               f3a->f03 = rmi_find_function(fn->rmi_dev, 0x03);
+               f3a->trackstick_buttons = f3a->f03 != NULL;
+       }
+
+       drv->set_irq_bits(fn->rmi_dev, fn->irq_mask);
+
+       return 0;
+}
+
+static bool rmi_f3a_is_valid_button(int button, struct f3a_data *f3a,
+                                       u8 *query1_regs, u8 *ctrl1_regs)
+{
+       /* gpio exist && direction input */
+       return (query1_regs[0] & BIT(button)) && !(ctrl1_regs[0] & BIT(button));
+}
+
+static int rmi_f3a_map_gpios(struct rmi_function *fn, struct f3a_data *f3a,
+                               u8 *query1_regs, u8 *ctrl1_regs)
+{
+       const struct rmi_device_platform_data *pdata =
+                       rmi_get_platform_data(fn->rmi_dev);
+       struct input_dev *input = f3a->input;
+       unsigned int button = BTN_LEFT;
+       unsigned int trackstick_button = BTN_LEFT;
+       bool button_mapped = false;
+       int i;
+       int button_count = min_t(u8, f3a->gpio_count, TRACKSTICK_RANGE_END);
+
+       f3a->gpio_key_map = devm_kcalloc(&fn->dev,
+                                               button_count,
+                                               sizeof(f3a->gpio_key_map[0]),
+                                               GFP_KERNEL);
+       if (!f3a->gpio_key_map) {
+               dev_err(&fn->dev, "Failed to allocate gpio map memory.\n");
+               return -ENOMEM;
+       }
+
+       for (i = 0; i < button_count; i++) {
+               if (!rmi_f3a_is_valid_button(i, f3a, query1_regs, ctrl1_regs))
+                       continue;
+
+               if (pdata->gpio_data.trackstick_buttons &&
+                       i >= TRACKSTICK_RANGE_START &&
+                       i < TRACKSTICK_RANGE_END) {
+                       f3a->gpio_key_map[i] = trackstick_button++;
+               } else if (!pdata->gpio_data.buttonpad || !button_mapped) {
+                       f3a->gpio_key_map[i] = button;
+                       input_set_capability(input, EV_KEY, button++);
+                       button_mapped = true;
+               }
+       }
+       input->keycode = f3a->gpio_key_map;
+       input->keycodesize = sizeof(f3a->gpio_key_map[0]);
+       input->keycodemax = f3a->gpio_count;
+
+       if (pdata->gpio_data.buttonpad || (button - BTN_LEFT == 1))
+               __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
+
+       return 0;
+}
+
+static int rmi_f3a_initialize(struct rmi_function *fn, struct f3a_data *f3a)
+{
+       u8 query1[RMI_F3A_MAX_REG_SIZE];
+       u8 ctrl1[RMI_F3A_MAX_REG_SIZE];
+       u8 buf;
+       int error;
+
+       error = rmi_read(fn->rmi_dev, fn->fd.query_base_addr, &buf);
+       if (error < 0) {
+               dev_err(&fn->dev, "Failed to read general info register: %d\n",
+                       error);
+               return -ENODEV;
+       }
+
+       f3a->gpio_count = buf & RMI_F3A_GPIO_COUNT;
+       f3a->register_count = DIV_ROUND_UP(f3a->gpio_count, 8);
+
+       /* Query1 -> gpio exist */
+       error = rmi_read_block(fn->rmi_dev, fn->fd.query_base_addr + 1,
+                               query1, f3a->register_count);
+       if (error) {
+               dev_err(&fn->dev, "Failed to read query1 register\n");
+               return error;
+       }
+
+       /* Ctrl1 -> gpio direction */
+       error = rmi_read_block(fn->rmi_dev, fn->fd.control_base_addr + 1,
+                               ctrl1, f3a->register_count);
+       if (error) {
+               dev_err(&fn->dev, "Failed to read control1 register\n");
+               return error;
+       }
+
+       error = rmi_f3a_map_gpios(fn, f3a, query1, ctrl1);
+       if (error)
+               return error;
+
+       return 0;
+}
+
+static int rmi_f3a_probe(struct rmi_function *fn)
+{
+       struct rmi_device *rmi_dev = fn->rmi_dev;
+       struct rmi_driver_data *drv_data = dev_get_drvdata(&rmi_dev->dev);
+       struct f3a_data *f3a;
+       int error;
+
+       if (!drv_data->input) {
+               dev_info(&fn->dev, "F3A: no input device found, ignoring\n");
+               return -ENXIO;
+       }
+
+       f3a = devm_kzalloc(&fn->dev, sizeof(*f3a), GFP_KERNEL);
+       if (!f3a)
+               return -ENOMEM;
+
+       f3a->input = drv_data->input;
+
+       error = rmi_f3a_initialize(fn, f3a);
+       if (error)
+               return error;
+
+       dev_set_drvdata(&fn->dev, f3a);
+       return 0;
+}
+
+struct rmi_function_handler rmi_f3a_handler = {
+       .driver = {
+               .name = "rmi4_f3a",
+       },
+       .func = 0x3a,
+       .probe = rmi_f3a_probe,
+       .config = rmi_f3a_config,
+       .attention = rmi_f3a_attention,
+};
index 65f4e9d..d36e89d 100644 (file)
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(hil_mlc_unregister);
 static LIST_HEAD(hil_mlcs);
 static DEFINE_RWLOCK(hil_mlcs_lock);
 static struct timer_list       hil_mlcs_kicker;
-static int                     hil_mlcs_probe;
+static int                     hil_mlcs_probe, hil_mlc_stop;
 
 static void hil_mlcs_process(unsigned long unused);
 static DECLARE_TASKLET_DISABLED_OLD(hil_mlcs_tasklet, hil_mlcs_process);
@@ -702,9 +702,13 @@ static int hilse_donode(hil_mlc *mlc)
                if (!mlc->ostarted) {
                        mlc->ostarted = 1;
                        mlc->opacket = pack;
-                       mlc->out(mlc);
+                       rc = mlc->out(mlc);
                        nextidx = HILSEN_DOZE;
                        write_unlock_irqrestore(&mlc->lock, flags);
+                       if (rc) {
+                               hil_mlc_stop = 1;
+                               return 1;
+                       }
                        break;
                }
                mlc->ostarted = 0;
@@ -715,8 +719,13 @@ static int hilse_donode(hil_mlc *mlc)
 
        case HILSE_CTS:
                write_lock_irqsave(&mlc->lock, flags);
-               nextidx = mlc->cts(mlc) ? node->bad : node->good;
+               rc = mlc->cts(mlc);
+               nextidx = rc ? node->bad : node->good;
                write_unlock_irqrestore(&mlc->lock, flags);
+               if (rc) {
+                       hil_mlc_stop = 1;
+                       return 1;
+               }
                break;
 
        default:
@@ -780,6 +789,12 @@ static void hil_mlcs_process(unsigned long unused)
 
 static void hil_mlcs_timer(struct timer_list *unused)
 {
+       if (hil_mlc_stop) {
+               /* could not send packet - stop immediately. */
+               pr_warn(PREFIX "HIL seems stuck - Disabling HIL MLC.\n");
+               return;
+       }
+
        hil_mlcs_probe = 1;
        tasklet_schedule(&hil_mlcs_tasklet);
        /* Re-insert the periodic task. */
index 232d30c..3e85e90 100644 (file)
@@ -210,7 +210,7 @@ static int hp_sdc_mlc_cts(hil_mlc *mlc)
        priv->tseq[2] = 1;
        priv->tseq[3] = 0;
        priv->tseq[4] = 0;
-       __hp_sdc_enqueue_transaction(&priv->trans);
+       return __hp_sdc_enqueue_transaction(&priv->trans);
  busy:
        return 1;
  done:
@@ -219,7 +219,7 @@ static int hp_sdc_mlc_cts(hil_mlc *mlc)
        return 0;
 }
 
-static void hp_sdc_mlc_out(hil_mlc *mlc)
+static int hp_sdc_mlc_out(hil_mlc *mlc)
 {
        struct hp_sdc_mlc_priv_s *priv;
 
@@ -234,7 +234,7 @@ static void hp_sdc_mlc_out(hil_mlc *mlc)
  do_data:
        if (priv->emtestmode) {
                up(&mlc->osem);
-               return;
+               return 0;
        }
        /* Shouldn't be sending commands when loop may be busy */
        BUG_ON(down_trylock(&mlc->csem));
@@ -296,7 +296,7 @@ static void hp_sdc_mlc_out(hil_mlc *mlc)
                BUG_ON(down_trylock(&mlc->csem));
        }
  enqueue:
-       hp_sdc_enqueue_transaction(&priv->trans);
+       return hp_sdc_enqueue_transaction(&priv->trans);
 }
 
 static int __init hp_sdc_mlc_init(void)
index a681a2c..f15ed3d 100644 (file)
@@ -211,7 +211,6 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
        struct sun4i_ps2data *drvdata;
        struct serio *serio;
        struct device *dev = &pdev->dev;
-       unsigned int irq;
        int error;
 
        drvdata = kzalloc(sizeof(struct sun4i_ps2data), GFP_KERNEL);
@@ -264,14 +263,12 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
        writel(0, drvdata->reg_base + PS2_REG_GCTL);
 
        /* Get IRQ for the device */
-       irq = platform_get_irq(pdev, 0);
-       if (!irq) {
-               dev_err(dev, "no IRQ found\n");
-               error = -ENXIO;
+       drvdata->irq = platform_get_irq(pdev, 0);
+       if (drvdata->irq < 0) {
+               error = drvdata->irq;
                goto err_disable_clk;
        }
 
-       drvdata->irq = irq;
        drvdata->serio = serio;
        drvdata->dev = dev;
 
index 35c867b..f012fe7 100644 (file)
@@ -1322,4 +1322,16 @@ config TOUCHSCREEN_IQS5XX
          To compile this driver as a module, choose M here: the
          module will be called iqs5xx.
 
+config TOUCHSCREEN_ZINITIX
+       tristate "Zinitix touchscreen support"
+       depends on I2C
+       help
+         Say Y here if you have a touchscreen using Zinitix bt541,
+         or something similar enough.
+
+         If unsure, say N.
+
+         To compile this driver as a module, choose M here: the
+         module will be called zinitix.
+
 endif
index 30d1e1b..6233541 100644 (file)
@@ -111,3 +111,4 @@ obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50)      += colibri-vf50-ts.o
 obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o
 obj-$(CONFIG_TOUCHSCREEN_RASPBERRYPI_FW)       += raspberrypi-ts.o
 obj-$(CONFIG_TOUCHSCREEN_IQS5XX)       += iqs5xx.o
+obj-$(CONFIG_TOUCHSCREEN_ZINITIX)      += zinitix.o
index b0bd5bb..50c3482 100644 (file)
@@ -90,7 +90,7 @@
 /* FW read command, 0x53 0x?? 0x0, 0x01 */
 #define E_ELAN_INFO_FW_VER     0x00
 #define E_ELAN_INFO_BC_VER     0x10
-#define E_ELAN_INFO_REK                0xE0
+#define E_ELAN_INFO_REK                0xD0
 #define E_ELAN_INFO_TEST_VER   0xE0
 #define E_ELAN_INFO_FW_ID      0xF0
 #define E_INFO_OSR             0xD6
@@ -134,6 +134,7 @@ struct elants_data {
        u8 bc_version;
        u8 iap_version;
        u16 hw_version;
+       u8 major_res;
        unsigned int x_res;     /* resolution in units/mm */
        unsigned int y_res;
        unsigned int x_max;
@@ -459,6 +460,9 @@ static int elants_i2c_query_ts_info(struct elants_data *ts)
        rows = resp[2] + resp[6] + resp[10];
        cols = resp[3] + resp[7] + resp[11];
 
+       /* Get report resolution value of ABS_MT_TOUCH_MAJOR */
+       ts->major_res = resp[16];
+
        /* Process mm_to_pixel information */
        error = elants_i2c_execute_command(client,
                                           get_osr_cmd, sizeof(get_osr_cmd),
@@ -1325,6 +1329,8 @@ static int elants_i2c_probe(struct i2c_client *client,
                             0, MT_TOOL_PALM, 0, 0);
        input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
        input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
+       if (ts->major_res > 0)
+               input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, ts->major_res);
 
        touchscreen_parse_properties(ts->input, true, &ts->prop);
 
index 9ed2588..cd369f9 100644 (file)
@@ -315,9 +315,8 @@ static irqreturn_t adc_irq_fn(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static int imx6ul_tsc_open(struct input_dev *input_dev)
+static int imx6ul_tsc_start(struct imx6ul_tsc *tsc)
 {
-       struct imx6ul_tsc *tsc = input_get_drvdata(input_dev);
        int err;
 
        err = clk_prepare_enable(tsc->adc_clk);
@@ -349,16 +348,29 @@ disable_adc_clk:
        return err;
 }
 
-static void imx6ul_tsc_close(struct input_dev *input_dev)
+static void imx6ul_tsc_stop(struct imx6ul_tsc *tsc)
 {
-       struct imx6ul_tsc *tsc = input_get_drvdata(input_dev);
-
        imx6ul_tsc_disable(tsc);
 
        clk_disable_unprepare(tsc->tsc_clk);
        clk_disable_unprepare(tsc->adc_clk);
 }
 
+
+static int imx6ul_tsc_open(struct input_dev *input_dev)
+{
+       struct imx6ul_tsc *tsc = input_get_drvdata(input_dev);
+
+       return imx6ul_tsc_start(tsc);
+}
+
+static void imx6ul_tsc_close(struct input_dev *input_dev)
+{
+       struct imx6ul_tsc *tsc = input_get_drvdata(input_dev);
+
+       imx6ul_tsc_stop(tsc);
+}
+
 static int imx6ul_tsc_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
@@ -509,12 +521,8 @@ static int __maybe_unused imx6ul_tsc_suspend(struct device *dev)
 
        mutex_lock(&input_dev->mutex);
 
-       if (input_dev->users) {
-               imx6ul_tsc_disable(tsc);
-
-               clk_disable_unprepare(tsc->tsc_clk);
-               clk_disable_unprepare(tsc->adc_clk);
-       }
+       if (input_dev->users)
+               imx6ul_tsc_stop(tsc);
 
        mutex_unlock(&input_dev->mutex);
 
@@ -530,22 +538,11 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev)
 
        mutex_lock(&input_dev->mutex);
 
-       if (input_dev->users) {
-               retval = clk_prepare_enable(tsc->adc_clk);
-               if (retval)
-                       goto out;
-
-               retval = clk_prepare_enable(tsc->tsc_clk);
-               if (retval) {
-                       clk_disable_unprepare(tsc->adc_clk);
-                       goto out;
-               }
-
-               retval = imx6ul_tsc_init(tsc);
-       }
+       if (input_dev->users)
+               retval = imx6ul_tsc_start(tsc);
 
-out:
        mutex_unlock(&input_dev->mutex);
+
        return retval;
 }
 
index fe24543..e694a9b 100644 (file)
@@ -51,6 +51,7 @@
 
 /* Touch relative info */
 #define RM_MAX_RETRIES         3
+#define RM_RETRY_DELAY_MS      20
 #define RM_MAX_TOUCH_NUM       10
 #define RM_BOOT_DELAY_MS       100
 
@@ -136,83 +137,82 @@ struct raydium_data {
        bool wake_irq_enabled;
 };
 
-static int raydium_i2c_send(struct i2c_client *client,
-                           u8 addr, const void *data, size_t len)
+static int raydium_i2c_xfer(struct i2c_client *client,
+                           u32 addr, void *data, size_t len, bool is_read)
 {
-       u8 *buf;
-       int tries = 0;
-       int ret;
-
-       buf = kmalloc(len + 1, GFP_KERNEL);
-       if (!buf)
-               return -ENOMEM;
-
-       buf[0] = addr;
-       memcpy(buf + 1, data, len);
-
-       do {
-               ret = i2c_master_send(client, buf, len + 1);
-               if (likely(ret == len + 1))
-                       break;
-
-               msleep(20);
-       } while (++tries < RM_MAX_RETRIES);
-
-       kfree(buf);
-
-       if (unlikely(ret != len + 1)) {
-               if (ret >= 0)
-                       ret = -EIO;
-               dev_err(&client->dev, "%s failed: %d\n", __func__, ret);
-               return ret;
-       }
+       struct raydium_bank_switch_header {
+               u8 cmd;
+               __be32 be_addr;
+       } __packed header = {
+               .cmd = RM_CMD_BANK_SWITCH,
+               .be_addr = cpu_to_be32(addr),
+       };
 
-       return 0;
-}
+       u8 reg_addr = addr & 0xff;
 
-static int raydium_i2c_read(struct i2c_client *client,
-                           u8 addr, void *data, size_t len)
-{
        struct i2c_msg xfer[] = {
                {
                        .addr = client->addr,
+                       .len = sizeof(header),
+                       .buf = (u8 *)&header,
+               },
+               {
+                       .addr = client->addr,
                        .len = 1,
-                       .buf = &addr,
+                       .buf = &reg_addr,
                },
                {
                        .addr = client->addr,
-                       .flags = I2C_M_RD,
                        .len = len,
                        .buf = data,
+                       .flags = is_read ? I2C_M_RD : 0,
                }
        };
+
+       /*
+        * If address is greater than 255, then RM_CMD_BANK_SWITCH needs to be
+        * sent first. Else, skip the header i.e. xfer[0].
+        */
+       int xfer_start_idx = (addr > 0xff) ? 0 : 1;
+       size_t xfer_count = ARRAY_SIZE(xfer) - xfer_start_idx;
        int ret;
 
-       ret = i2c_transfer(client->adapter, xfer, ARRAY_SIZE(xfer));
-       if (unlikely(ret != ARRAY_SIZE(xfer)))
-               return ret < 0 ? ret : -EIO;
+       ret = i2c_transfer(client->adapter, &xfer[xfer_start_idx], xfer_count);
+       if (likely(ret == xfer_count))
+               return 0;
+
+       return ret < 0 ? ret : -EIO;
+}
 
-       return 0;
+static int raydium_i2c_send(struct i2c_client *client,
+                           u32 addr, const void *data, size_t len)
+{
+       int tries = 0;
+       int error;
+
+       do {
+               error = raydium_i2c_xfer(client, addr, (void *)data, len,
+                                        false);
+               if (likely(!error))
+                       return 0;
+
+               msleep(RM_RETRY_DELAY_MS);
+       } while (++tries < RM_MAX_RETRIES);
+
+       dev_err(&client->dev, "%s failed: %d\n", __func__, error);
+       return error;
 }
 
-static int raydium_i2c_read_message(struct i2c_client *client,
-                                   u32 addr, void *data, size_t len)
+static int raydium_i2c_read(struct i2c_client *client,
+                           u32 addr, void *data, size_t len)
 {
-       __be32 be_addr;
        size_t xfer_len;
        int error;
 
        while (len) {
                xfer_len = min_t(size_t, len, RM_MAX_READ_SIZE);
-
-               be_addr = cpu_to_be32(addr);
-
-               error = raydium_i2c_send(client, RM_CMD_BANK_SWITCH,
-                                        &be_addr, sizeof(be_addr));
-               if (!error)
-                       error = raydium_i2c_read(client, addr & 0xff,
-                                                data, xfer_len);
-               if (error)
+               error = raydium_i2c_xfer(client, addr, data, xfer_len, true);
+               if (unlikely(error))
                        return error;
 
                len -= xfer_len;
@@ -223,27 +223,13 @@ static int raydium_i2c_read_message(struct i2c_client *client,
        return 0;
 }
 
-static int raydium_i2c_send_message(struct i2c_client *client,
-                                   u32 addr, const void *data, size_t len)
-{
-       __be32 be_addr = cpu_to_be32(addr);
-       int error;
-
-       error = raydium_i2c_send(client, RM_CMD_BANK_SWITCH,
-                                &be_addr, sizeof(be_addr));
-       if (!error)
-               error = raydium_i2c_send(client, addr & 0xff, data, len);
-
-       return error;
-}
-
 static int raydium_i2c_sw_reset(struct i2c_client *client)
 {
        const u8 soft_rst_cmd = 0x01;
        int error;
 
-       error = raydium_i2c_send_message(client, RM_RESET_MSG_ADDR,
-                                        &soft_rst_cmd, sizeof(soft_rst_cmd));
+       error = raydium_i2c_send(client, RM_RESET_MSG_ADDR, &soft_rst_cmd,
+                                sizeof(soft_rst_cmd));
        if (error) {
                dev_err(&client->dev, "software reset failed: %d\n", error);
                return error;
@@ -295,9 +281,8 @@ static int raydium_i2c_query_ts_info(struct raydium_data *ts)
                if (error)
                        continue;
 
-               error = raydium_i2c_read_message(client,
-                                                le32_to_cpu(query_bank_addr),
-                                                &ts->info, sizeof(ts->info));
+               error = raydium_i2c_read(client, le32_to_cpu(query_bank_addr),
+                                        &ts->info, sizeof(ts->info));
                if (error)
                        continue;
 
@@ -834,8 +819,8 @@ static irqreturn_t raydium_i2c_irq(int irq, void *_dev)
        if (ts->boot_mode != RAYDIUM_TS_MAIN)
                goto out;
 
-       error = raydium_i2c_read_message(ts->client, ts->data_bank_addr,
-                                        ts->report_data, ts->pkg_size);
+       error = raydium_i2c_read(ts->client, ts->data_bank_addr,
+                                ts->report_data, ts->pkg_size);
        if (error)
                goto out;
 
index 82920ff..2e70c0b 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/adc.h>
-#include <plat/regs-adc.h>
+#include <linux/soc/samsung/s3c-adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
 
+#define        S3C2410_ADCCON                  (0x00)
+#define        S3C2410_ADCTSC                  (0x04)
+#define        S3C2410_ADCDLY                  (0x08)
+#define        S3C2410_ADCDAT0                 (0x0C)
+#define        S3C2410_ADCDAT1                 (0x10)
+#define        S3C64XX_ADCUPDN                 (0x14)
+#define        S3C2443_ADCMUX                  (0x18)
+#define        S3C64XX_ADCCLRINT               (0x18)
+#define        S5P_ADCMUX                      (0x1C)
+#define        S3C64XX_ADCCLRINTPNDNUP         (0x20)
+
+/* ADCTSC Register Bits */
+#define S3C2443_ADCTSC_UD_SEN          (1 << 8)
+#define S3C2410_ADCTSC_YM_SEN          (1<<7)
+#define S3C2410_ADCTSC_YP_SEN          (1<<6)
+#define S3C2410_ADCTSC_XM_SEN          (1<<5)
+#define S3C2410_ADCTSC_XP_SEN          (1<<4)
+#define S3C2410_ADCTSC_PULL_UP_DISABLE (1<<3)
+#define S3C2410_ADCTSC_AUTO_PST                (1<<2)
+#define S3C2410_ADCTSC_XY_PST(x)       (((x)&0x3)<<0)
+
+/* ADCDAT0 Bits */
+#define S3C2410_ADCDAT0_UPDOWN         (1<<15)
+#define S3C2410_ADCDAT0_AUTO_PST       (1<<14)
+#define S3C2410_ADCDAT0_XY_PST         (0x3<<12)
+#define S3C2410_ADCDAT0_XPDATA_MASK    (0x03FF)
+
+/* ADCDAT1 Bits */
+#define S3C2410_ADCDAT1_UPDOWN         (1<<15)
+#define S3C2410_ADCDAT1_AUTO_PST       (1<<14)
+#define S3C2410_ADCDAT1_XY_PST         (0x3<<12)
+#define S3C2410_ADCDAT1_YPDATA_MASK    (0x03FF)
+
+
 #define TSC_SLEEP  (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0))
 
 #define INT_DOWN       (0)
index df94686..9a64e1d 100644 (file)
@@ -479,7 +479,7 @@ static ssize_t stmfts_sysfs_hover_enable_write(struct device *dev,
 
        mutex_lock(&sdata->mutex);
 
-       if (value & sdata->hover_enabled)
+       if (value && sdata->hover_enabled)
                goto out;
 
        if (sdata->running)
diff --git a/drivers/input/touchscreen/zinitix.c b/drivers/input/touchscreen/zinitix.c
new file mode 100644 (file)
index 0000000..1acc2eb
--- /dev/null
@@ -0,0 +1,581 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/input/mt.h>
+#include <linux/input/touchscreen.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/regulator/consumer.h>
+#include <linux/slab.h>
+
+/* Register Map */
+
+#define BT541_SWRESET_CMD                      0x0000
+#define BT541_WAKEUP_CMD                       0x0001
+
+#define BT541_IDLE_CMD                         0x0004
+#define BT541_SLEEP_CMD                                0x0005
+
+#define BT541_CLEAR_INT_STATUS_CMD             0x0003
+#define BT541_CALIBRATE_CMD                    0x0006
+#define BT541_SAVE_STATUS_CMD                  0x0007
+#define BT541_SAVE_CALIBRATION_CMD             0x0008
+#define BT541_RECALL_FACTORY_CMD               0x000f
+
+#define BT541_THRESHOLD                                0x0020
+
+#define BT541_LARGE_PALM_REJECT_AREA_TH                0x003F
+
+#define BT541_DEBUG_REG                                0x0115 /* 0~7 */
+
+#define BT541_TOUCH_MODE                       0x0010
+#define BT541_CHIP_REVISION                    0x0011
+#define BT541_FIRMWARE_VERSION                 0x0012
+
+#define ZINITIX_USB_DETECT                     0x116
+
+#define BT541_MINOR_FW_VERSION                 0x0121
+
+#define BT541_VENDOR_ID                                0x001C
+#define BT541_HW_ID                            0x0014
+
+#define BT541_DATA_VERSION_REG                 0x0013
+#define BT541_SUPPORTED_FINGER_NUM             0x0015
+#define BT541_EEPROM_INFO                      0x0018
+#define BT541_INITIAL_TOUCH_MODE               0x0019
+
+#define BT541_TOTAL_NUMBER_OF_X                        0x0060
+#define BT541_TOTAL_NUMBER_OF_Y                        0x0061
+
+#define BT541_DELAY_RAW_FOR_HOST               0x007f
+
+#define BT541_BUTTON_SUPPORTED_NUM             0x00B0
+#define BT541_BUTTON_SENSITIVITY               0x00B2
+#define BT541_DUMMY_BUTTON_SENSITIVITY         0X00C8
+
+#define BT541_X_RESOLUTION                     0x00C0
+#define BT541_Y_RESOLUTION                     0x00C1
+
+#define BT541_POINT_STATUS_REG                 0x0080
+#define BT541_ICON_STATUS_REG                  0x00AA
+
+#define BT541_POINT_COORD_REG                  (BT541_POINT_STATUS_REG + 2)
+
+#define BT541_AFE_FREQUENCY                    0x0100
+#define BT541_DND_N_COUNT                      0x0122
+#define BT541_DND_U_COUNT                      0x0135
+
+#define BT541_RAWDATA_REG                      0x0200
+
+#define BT541_EEPROM_INFO_REG                  0x0018
+
+#define BT541_INT_ENABLE_FLAG                  0x00f0
+#define BT541_PERIODICAL_INTERRUPT_INTERVAL    0x00f1
+
+#define BT541_BTN_WIDTH                                0x016d
+
+#define BT541_CHECKSUM_RESULT                  0x012c
+
+#define BT541_INIT_FLASH                       0x01d0
+#define BT541_WRITE_FLASH                      0x01d1
+#define BT541_READ_FLASH                       0x01d2
+
+#define ZINITIX_INTERNAL_FLAG_02               0x011e
+#define ZINITIX_INTERNAL_FLAG_03               0x011f
+
+#define ZINITIX_I2C_CHECKSUM_WCNT              0x016a
+#define ZINITIX_I2C_CHECKSUM_RESULT            0x016c
+
+/* Interrupt & status register flags */
+
+#define BIT_PT_CNT_CHANGE                      BIT(0)
+#define BIT_DOWN                               BIT(1)
+#define BIT_MOVE                               BIT(2)
+#define BIT_UP                                 BIT(3)
+#define BIT_PALM                               BIT(4)
+#define BIT_PALM_REJECT                                BIT(5)
+#define BIT_RESERVED_0                         BIT(6)
+#define BIT_RESERVED_1                         BIT(7)
+#define BIT_WEIGHT_CHANGE                      BIT(8)
+#define BIT_PT_NO_CHANGE                       BIT(9)
+#define BIT_REJECT                             BIT(10)
+#define BIT_PT_EXIST                           BIT(11)
+#define BIT_RESERVED_2                         BIT(12)
+#define BIT_ERROR                              BIT(13)
+#define BIT_DEBUG                              BIT(14)
+#define BIT_ICON_EVENT                         BIT(15)
+
+#define SUB_BIT_EXIST                          BIT(0)
+#define SUB_BIT_DOWN                           BIT(1)
+#define SUB_BIT_MOVE                           BIT(2)
+#define SUB_BIT_UP                             BIT(3)
+#define SUB_BIT_UPDATE                         BIT(4)
+#define SUB_BIT_WAIT                           BIT(5)
+
+#define DEFAULT_TOUCH_POINT_MODE               2
+#define MAX_SUPPORTED_FINGER_NUM               5
+
+#define CHIP_ON_DELAY                          15 // ms
+#define FIRMWARE_ON_DELAY                      40 // ms
+
+struct point_coord {
+       __le16  x;
+       __le16  y;
+       u8      width;
+       u8      sub_status;
+       // currently unused, but needed as padding:
+       u8      minor_width;
+       u8      angle;
+};
+
+struct touch_event {
+       __le16  status;
+       u8      finger_cnt;
+       u8      time_stamp;
+       struct point_coord point_coord[MAX_SUPPORTED_FINGER_NUM];
+};
+
+struct bt541_ts_data {
+       struct i2c_client *client;
+       struct input_dev *input_dev;
+       struct touchscreen_properties prop;
+       struct regulator_bulk_data supplies[2];
+       u32 zinitix_mode;
+};
+
+static int zinitix_read_data(struct i2c_client *client,
+                            u16 reg, void *values, size_t length)
+{
+       __le16 reg_le = cpu_to_le16(reg);
+       int ret;
+
+       /* A single i2c_transfer() transaction does not work here. */
+       ret = i2c_master_send(client, (u8 *)&reg_le, sizeof(reg_le));
+       if (ret != sizeof(reg_le))
+               return ret < 0 ? ret : -EIO;
+
+       ret = i2c_master_recv(client, (u8 *)values, length);
+       if (ret != length)
+               return ret < 0 ? ret : -EIO; ;
+
+       return 0;
+}
+
+static int zinitix_write_u16(struct i2c_client *client, u16 reg, u16 value)
+{
+       __le16 packet[2] = {cpu_to_le16(reg), cpu_to_le16(value)};
+       int ret;
+
+       ret = i2c_master_send(client, (u8 *)packet, sizeof(packet));
+       if (ret != sizeof(packet))
+               return ret < 0 ? ret : -EIO;
+
+       return 0;
+}
+
+static int zinitix_write_cmd(struct i2c_client *client, u16 reg)
+{
+       __le16 reg_le = cpu_to_le16(reg);
+       int ret;
+
+       ret = i2c_master_send(client, (u8 *)&reg_le, sizeof(reg_le));
+       if (ret != sizeof(reg_le))
+               return ret < 0 ? ret : -EIO;
+
+       return 0;
+}
+
+static bool zinitix_init_touch(struct bt541_ts_data *bt541)
+{
+       struct i2c_client *client = bt541->client;
+       int i;
+       int error;
+
+       error = zinitix_write_cmd(client, BT541_SWRESET_CMD);
+       if (error) {
+               dev_err(&client->dev, "Failed to write reset command\n");
+               return error;
+       }
+
+       error = zinitix_write_u16(client, BT541_INT_ENABLE_FLAG, 0x0);
+       if (error) {
+               dev_err(&client->dev,
+                       "Failed to reset interrupt enable flag\n");
+               return error;
+       }
+
+       /* initialize */
+       error = zinitix_write_u16(client, BT541_X_RESOLUTION,
+                                 bt541->prop.max_x);
+       if (error)
+               return error;
+
+       error = zinitix_write_u16(client, BT541_Y_RESOLUTION,
+                                 bt541->prop.max_y);
+       if (error)
+               return error;
+
+       error = zinitix_write_u16(client, BT541_SUPPORTED_FINGER_NUM,
+                                 MAX_SUPPORTED_FINGER_NUM);
+       if (error)
+               return error;
+
+       error = zinitix_write_u16(client, BT541_INITIAL_TOUCH_MODE,
+                                 bt541->zinitix_mode);
+       if (error)
+               return error;
+
+       error = zinitix_write_u16(client, BT541_TOUCH_MODE,
+                                 bt541->zinitix_mode);
+       if (error)
+               return error;
+
+       error = zinitix_write_u16(client, BT541_INT_ENABLE_FLAG,
+                                 BIT_PT_CNT_CHANGE | BIT_DOWN | BIT_MOVE |
+                                       BIT_UP);
+       if (error)
+               return error;
+
+       /* clear queue */
+       for (i = 0; i < 10; i++) {
+               zinitix_write_cmd(client, BT541_CLEAR_INT_STATUS_CMD);
+               udelay(10);
+       }
+
+       return 0;
+}
+
+static int zinitix_init_regulators(struct bt541_ts_data *bt541)
+{
+       struct i2c_client *client = bt541->client;
+       int error;
+
+       bt541->supplies[0].supply = "vdd";
+       bt541->supplies[1].supply = "vddo";
+       error = devm_regulator_bulk_get(&client->dev,
+                                       ARRAY_SIZE(bt541->supplies),
+                                       bt541->supplies);
+       if (error < 0) {
+               dev_err(&client->dev, "Failed to get regulators: %d\n", error);
+               return error;
+       }
+
+       return 0;
+}
+
+static int zinitix_send_power_on_sequence(struct bt541_ts_data *bt541)
+{
+       int error;
+       struct i2c_client *client = bt541->client;
+
+       error = zinitix_write_u16(client, 0xc000, 0x0001);
+       if (error) {
+               dev_err(&client->dev,
+                       "Failed to send power sequence(vendor cmd enable)\n");
+               return error;
+       }
+       udelay(10);
+
+       error = zinitix_write_cmd(client, 0xc004);
+       if (error) {
+               dev_err(&client->dev,
+                       "Failed to send power sequence (intn clear)\n");
+               return error;
+       }
+       udelay(10);
+
+       error = zinitix_write_u16(client, 0xc002, 0x0001);
+       if (error) {
+               dev_err(&client->dev,
+                       "Failed to send power sequence (nvm init)\n");
+               return error;
+       }
+       mdelay(2);
+
+       error = zinitix_write_u16(client, 0xc001, 0x0001);
+       if (error) {
+               dev_err(&client->dev,
+                       "Failed to send power sequence (program start)\n");
+               return error;
+       }
+       msleep(FIRMWARE_ON_DELAY);
+
+       return 0;
+}
+
+static void zinitix_report_finger(struct bt541_ts_data *bt541, int slot,
+                                 const struct point_coord *p)
+{
+       input_mt_slot(bt541->input_dev, slot);
+       input_mt_report_slot_state(bt541->input_dev, MT_TOOL_FINGER, true);
+       touchscreen_report_pos(bt541->input_dev, &bt541->prop,
+                              le16_to_cpu(p->x), le16_to_cpu(p->y), true);
+       input_report_abs(bt541->input_dev, ABS_MT_TOUCH_MAJOR, p->width);
+}
+
+static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler)
+{
+       struct bt541_ts_data *bt541 = bt541_handler;
+       struct i2c_client *client = bt541->client;
+       struct touch_event touch_event;
+       int error;
+       int i;
+
+       memset(&touch_event, 0, sizeof(struct touch_event));
+
+       error = zinitix_read_data(bt541->client, BT541_POINT_STATUS_REG,
+                                 &touch_event, sizeof(struct touch_event));
+       if (error) {
+               dev_err(&client->dev, "Failed to read in touchpoint struct\n");
+               goto out;
+       }
+
+       for (i = 0; i < MAX_SUPPORTED_FINGER_NUM; i++)
+               if (touch_event.point_coord[i].sub_status & SUB_BIT_EXIST)
+                       zinitix_report_finger(bt541, i,
+                                             &touch_event.point_coord[i]);
+
+       input_mt_sync_frame(bt541->input_dev);
+       input_sync(bt541->input_dev);
+
+out:
+       zinitix_write_cmd(bt541->client, BT541_CLEAR_INT_STATUS_CMD);
+       return IRQ_HANDLED;
+}
+
+static int zinitix_start(struct bt541_ts_data *bt541)
+{
+       int error;
+
+       error = regulator_bulk_enable(ARRAY_SIZE(bt541->supplies),
+                                     bt541->supplies);
+       if (error) {
+               dev_err(&bt541->client->dev,
+                       "Failed to enable regulators: %d\n", error);
+               return error;
+       }
+
+       msleep(CHIP_ON_DELAY);
+
+       error = zinitix_send_power_on_sequence(bt541);
+       if (error) {
+               dev_err(&bt541->client->dev,
+                       "Error while sending power-on sequence: %d\n", error);
+               return error;
+       }
+
+       error = zinitix_init_touch(bt541);
+       if (error) {
+               dev_err(&bt541->client->dev,
+                       "Error while configuring touch IC\n");
+               return error;
+       }
+
+       enable_irq(bt541->client->irq);
+
+       return 0;
+}
+
+static int zinitix_stop(struct bt541_ts_data *bt541)
+{
+       int error;
+
+       disable_irq(bt541->client->irq);
+
+       error = regulator_bulk_disable(ARRAY_SIZE(bt541->supplies),
+                                      bt541->supplies);
+       if (error) {
+               dev_err(&bt541->client->dev,
+                       "Failed to disable regulators: %d\n", error);
+               return error;
+       }
+
+       return 0;
+}
+
+static int zinitix_input_open(struct input_dev *dev)
+{
+       struct bt541_ts_data *bt541 = input_get_drvdata(dev);
+
+       return zinitix_start(bt541);
+}
+
+static void zinitix_input_close(struct input_dev *dev)
+{
+       struct bt541_ts_data *bt541 = input_get_drvdata(dev);
+
+       zinitix_stop(bt541);
+}
+
+static int zinitix_init_input_dev(struct bt541_ts_data *bt541)
+{
+       struct input_dev *input_dev;
+       int error;
+
+       input_dev = devm_input_allocate_device(&bt541->client->dev);
+       if (!input_dev) {
+               dev_err(&bt541->client->dev,
+                       "Failed to allocate input device.");
+               return -ENOMEM;
+       }
+
+       input_set_drvdata(input_dev, bt541);
+       bt541->input_dev = input_dev;
+
+       input_dev->name = "Zinitix Capacitive TouchScreen";
+       input_dev->phys = "input/ts";
+       input_dev->id.bustype = BUS_I2C;
+       input_dev->open = zinitix_input_open;
+       input_dev->close = zinitix_input_close;
+
+       input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_X);
+       input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_Y);
+       input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0);
+       input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
+
+       touchscreen_parse_properties(input_dev, true, &bt541->prop);
+       if (!bt541->prop.max_x || !bt541->prop.max_y) {
+               dev_err(&bt541->client->dev,
+                       "Touchscreen-size-x and/or touchscreen-size-y not set in dts\n");
+               return -EINVAL;
+       }
+
+       error = input_mt_init_slots(input_dev, MAX_SUPPORTED_FINGER_NUM,
+                                   INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
+       if (error) {
+               dev_err(&bt541->client->dev,
+                       "Failed to initialize MT slots: %d", error);
+               return error;
+       }
+
+       error = input_register_device(input_dev);
+       if (error) {
+               dev_err(&bt541->client->dev,
+                       "Failed to register input device: %d", error);
+               return error;
+       }
+
+       return 0;
+}
+
+static int zinitix_ts_probe(struct i2c_client *client)
+{
+       struct bt541_ts_data *bt541;
+       int error;
+
+       if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+               dev_err(&client->dev,
+                       "Failed to assert adapter's support for plain I2C.\n");
+               return -ENXIO;
+       }
+
+       bt541 = devm_kzalloc(&client->dev, sizeof(*bt541), GFP_KERNEL);
+       if (!bt541)
+               return -ENOMEM;
+
+       bt541->client = client;
+       i2c_set_clientdata(client, bt541);
+
+       error = zinitix_init_regulators(bt541);
+       if (error) {
+               dev_err(&client->dev,
+                       "Failed to initialize regulators: %d\n", error);
+               return error;
+       }
+
+       error = zinitix_init_input_dev(bt541);
+       if (error) {
+               dev_err(&client->dev,
+                       "Failed to initialize input device: %d\n", error);
+               return error;
+       }
+
+       error = device_property_read_u32(&client->dev, "zinitix,mode",
+                                        &bt541->zinitix_mode);
+       if (error < 0) {
+               /* fall back to mode 2 */
+               bt541->zinitix_mode = DEFAULT_TOUCH_POINT_MODE;
+       }
+
+       if (bt541->zinitix_mode != 2) {
+               /*
+                * If there are devices that don't support mode 2, support
+                * for other modes (0, 1) will be needed.
+                */
+               dev_err(&client->dev,
+                       "Malformed zinitix,mode property, must be 2 (supplied: %d)\n",
+                       bt541->zinitix_mode);
+               return -EINVAL;
+       }
+
+       irq_set_status_flags(client->irq, IRQ_NOAUTOEN);
+       error = devm_request_threaded_irq(&client->dev, client->irq,
+                                         NULL, zinitix_ts_irq_handler,
+                                         IRQF_ONESHOT, client->name, bt541);
+       if (error) {
+               dev_err(&client->dev, "Failed to request IRQ: %d\n", error);
+               return error;
+       }
+
+       return 0;
+}
+
+static int __maybe_unused zinitix_suspend(struct device *dev)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct bt541_ts_data *bt541 = i2c_get_clientdata(client);
+
+       mutex_lock(&bt541->input_dev->mutex);
+
+       if (bt541->input_dev->users)
+               zinitix_stop(bt541);
+
+       mutex_unlock(&bt541->input_dev->mutex);
+
+       return 0;
+}
+
+static int __maybe_unused zinitix_resume(struct device *dev)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct bt541_ts_data *bt541 = i2c_get_clientdata(client);
+       int ret = 0;
+
+       mutex_lock(&bt541->input_dev->mutex);
+
+       if (bt541->input_dev->users)
+               ret = zinitix_start(bt541);
+
+       mutex_unlock(&bt541->input_dev->mutex);
+
+       return ret;
+}
+
+static SIMPLE_DEV_PM_OPS(zinitix_pm_ops, zinitix_suspend, zinitix_resume);
+
+#ifdef CONFIG_OF
+static const struct of_device_id zinitix_of_match[] = {
+       { .compatible = "zinitix,bt541" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, zinitix_of_match);
+#endif
+
+static struct i2c_driver zinitix_ts_driver = {
+       .probe_new = zinitix_ts_probe,
+       .driver = {
+               .name = "Zinitix-TS",
+               .pm = &zinitix_pm_ops,
+               .of_match_table = of_match_ptr(zinitix_of_match),
+       },
+};
+module_i2c_driver(zinitix_ts_driver);
+
+MODULE_AUTHOR("Michael Srba <Michael.Srba@seznam.cz>");
+MODULE_DESCRIPTION("Zinitix touchscreen driver");
+MODULE_LICENSE("GPL v2");
index eea47b4..974a667 100644 (file)
@@ -971,6 +971,9 @@ void icc_node_add(struct icc_node *node, struct icc_provider *provider)
        }
        node->avg_bw = node->init_avg;
        node->peak_bw = node->init_peak;
+       if (provider->aggregate)
+               provider->aggregate(node, 0, node->init_avg, node->init_peak,
+                                   &node->avg_bw, &node->peak_bw);
        provider->set(node, node);
        node->avg_bw = 0;
        node->peak_bw = 0;
index cf10a4b..bf01d09 100644 (file)
@@ -79,6 +79,7 @@ EXPORT_SYMBOL_GPL(qcom_icc_aggregate);
 int qcom_icc_set(struct icc_node *src, struct icc_node *dst)
 {
        struct qcom_icc_provider *qp;
+       struct qcom_icc_node *qn;
        struct icc_node *node;
 
        if (!src)
@@ -87,6 +88,12 @@ int qcom_icc_set(struct icc_node *src, struct icc_node *dst)
                node = src;
 
        qp = to_qcom_provider(node->provider);
+       qn = node->data;
+
+       qn->sum_avg[QCOM_ICC_BUCKET_AMC] = max_t(u64, qn->sum_avg[QCOM_ICC_BUCKET_AMC],
+                                                node->avg_bw);
+       qn->max_peak[QCOM_ICC_BUCKET_AMC] = max_t(u64, qn->max_peak[QCOM_ICC_BUCKET_AMC],
+                                                 node->peak_bw);
 
        qcom_icc_bcm_voter_commit(qp->voter);
 
index bf11b82..8d9044e 100644 (file)
@@ -553,6 +553,9 @@ static int qnoc_probe(struct platform_device *pdev)
                return ret;
        }
 
+       for (i = 0; i < qp->num_bcms; i++)
+               qcom_icc_bcm_init(qp->bcms[i], &pdev->dev);
+
        for (i = 0; i < num_nodes; i++) {
                size_t j;
 
@@ -576,9 +579,6 @@ static int qnoc_probe(struct platform_device *pdev)
        }
        data->num_nodes = num_nodes;
 
-       for (i = 0; i < qp->num_bcms; i++)
-               qcom_icc_bcm_init(qp->bcms[i], &pdev->dev);
-
        platform_set_drvdata(pdev, qp);
 
        return 0;
index d79e316..5304aea 100644 (file)
@@ -151,7 +151,7 @@ DEFINE_QBCM(bcm_mc0, "MC0", true, &ebi);
 DEFINE_QBCM(bcm_sh0, "SH0", true, &qns_llcc);
 DEFINE_QBCM(bcm_mm0, "MM0", false, &qns_mem_noc_hf);
 DEFINE_QBCM(bcm_sh1, "SH1", false, &qns_apps_io);
-DEFINE_QBCM(bcm_mm1, "MM1", false, &qxm_camnoc_hf0_uncomp, &qxm_camnoc_hf1_uncomp, &qxm_camnoc_sf_uncomp, &qxm_camnoc_hf0, &qxm_camnoc_hf1, &qxm_mdp0, &qxm_mdp1);
+DEFINE_QBCM(bcm_mm1, "MM1", true, &qxm_camnoc_hf0_uncomp, &qxm_camnoc_hf1_uncomp, &qxm_camnoc_sf_uncomp, &qxm_camnoc_hf0, &qxm_camnoc_hf1, &qxm_mdp0, &qxm_mdp1);
 DEFINE_QBCM(bcm_sh2, "SH2", false, &qns_memnoc_snoc);
 DEFINE_QBCM(bcm_mm2, "MM2", false, &qns2_mem_noc);
 DEFINE_QBCM(bcm_sh3, "SH3", false, &acm_tcu);
@@ -489,6 +489,9 @@ static int qnoc_probe(struct platform_device *pdev)
                return ret;
        }
 
+       for (i = 0; i < qp->num_bcms; i++)
+               qcom_icc_bcm_init(qp->bcms[i], &pdev->dev);
+
        for (i = 0; i < num_nodes; i++) {
                size_t j;
 
@@ -512,9 +515,6 @@ static int qnoc_probe(struct platform_device *pdev)
        }
        data->num_nodes = num_nodes;
 
-       for (i = 0; i < qp->num_bcms; i++)
-               qcom_icc_bcm_init(qp->bcms[i], &pdev->dev);
-
        platform_set_drvdata(pdev, qp);
 
        return 0;
index 9218efe..c76b2c7 100644 (file)
@@ -551,6 +551,9 @@ static int qnoc_probe(struct platform_device *pdev)
                return ret;
        }
 
+       for (i = 0; i < qp->num_bcms; i++)
+               qcom_icc_bcm_init(qp->bcms[i], &pdev->dev);
+
        for (i = 0; i < num_nodes; i++) {
                size_t j;
 
@@ -574,9 +577,6 @@ static int qnoc_probe(struct platform_device *pdev)
        }
        data->num_nodes = num_nodes;
 
-       for (i = 0; i < qp->num_bcms; i++)
-               qcom_icc_bcm_init(qp->bcms[i], &pdev->dev);
-
        platform_set_drvdata(pdev, qp);
 
        return 0;
@@ -627,6 +627,7 @@ static struct platform_driver qnoc_driver = {
        .driver = {
                .name = "qnoc-sm8150",
                .of_match_table = qnoc_of_match,
+               .sync_state = icc_sync_state,
        },
 };
 module_platform_driver(qnoc_driver);
index 9b58946..cc558fe 100644 (file)
@@ -567,6 +567,9 @@ static int qnoc_probe(struct platform_device *pdev)
                return ret;
        }
 
+       for (i = 0; i < qp->num_bcms; i++)
+               qcom_icc_bcm_init(qp->bcms[i], &pdev->dev);
+
        for (i = 0; i < num_nodes; i++) {
                size_t j;
 
@@ -590,9 +593,6 @@ static int qnoc_probe(struct platform_device *pdev)
        }
        data->num_nodes = num_nodes;
 
-       for (i = 0; i < qp->num_bcms; i++)
-               qcom_icc_bcm_init(qp->bcms[i], &pdev->dev);
-
        platform_set_drvdata(pdev, qp);
 
        return 0;
@@ -643,6 +643,7 @@ static struct platform_driver qnoc_driver = {
        .driver = {
                .name = "qnoc-sm8250",
                .of_match_table = qnoc_of_match,
+               .sync_state = icc_sync_state,
        },
 };
 module_platform_driver(qnoc_driver);
index f696ac7..8964770 100644 (file)
@@ -409,7 +409,11 @@ extern bool amd_iommu_np_cache;
 /* Only true if all IOMMUs support device IOTLBs */
 extern bool amd_iommu_iotlb_sup;
 
-#define MAX_IRQS_PER_TABLE     256
+/*
+ * AMD IOMMU hardware only support 512 IRTEs despite
+ * the architectural limitation of 2048 entries.
+ */
+#define MAX_IRQS_PER_TABLE     512
 #define IRQ_TABLE_ALIGNMENT    128
 
 struct irq_remap_table {
index 8651f6d..c662201 100644 (file)
@@ -2525,6 +2525,9 @@ struct dmar_domain *find_domain(struct device *dev)
 {
        struct device_domain_info *info;
 
+       if (unlikely(!dev || !dev->iommu))
+               return NULL;
+
        if (unlikely(attach_deferred(dev)))
                return NULL;
 
@@ -3815,9 +3818,8 @@ bounce_map_single(struct device *dev, phys_addr_t paddr, size_t size,
         * page aligned, we don't need to use a bounce page.
         */
        if (!IS_ALIGNED(paddr | size, VTD_PAGE_SIZE)) {
-               tlb_addr = swiotlb_tbl_map_single(dev,
-                               phys_to_dma_unencrypted(dev, io_tlb_start),
-                               paddr, size, aligned_size, dir, attrs);
+               tlb_addr = swiotlb_tbl_map_single(dev, paddr, size,
+                               aligned_size, dir, attrs);
                if (tlb_addr == DMA_MAPPING_ERROR) {
                        goto swiotlb_error;
                } else {
index f1861fa..3242ebd 100644 (file)
@@ -279,6 +279,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
        struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
        struct intel_svm_dev *sdev = NULL;
        struct dmar_domain *dmar_domain;
+       struct device_domain_info *info;
        struct intel_svm *svm = NULL;
        int ret = 0;
 
@@ -310,6 +311,10 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
        if (data->hpasid <= 0 || data->hpasid >= PASID_MAX)
                return -EINVAL;
 
+       info = get_domain_info(dev);
+       if (!info)
+               return -EINVAL;
+
        dmar_domain = to_dmar_domain(domain);
 
        mutex_lock(&pasid_mutex);
@@ -357,6 +362,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
                goto out;
        }
        sdev->dev = dev;
+       sdev->sid = PCI_DEVID(info->bus, info->devfn);
 
        /* Only count users if device has aux domains */
        if (iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX))
@@ -1029,7 +1035,7 @@ no_pasid:
                        resp.qw0 = QI_PGRP_PASID(req->pasid) |
                                QI_PGRP_DID(req->rid) |
                                QI_PGRP_PASID_P(req->pasid_present) |
-                               QI_PGRP_PDP(req->pasid_present) |
+                               QI_PGRP_PDP(req->priv_data_present) |
                                QI_PGRP_RESP_CODE(result) |
                                QI_PGRP_RESP_TYPE;
                        resp.qw1 = QI_PGRP_IDX(req->prg_index) |
index 8c470f4..b53446b 100644 (file)
@@ -2071,7 +2071,7 @@ EXPORT_SYMBOL_GPL(iommu_uapi_cache_invalidate);
 
 static int iommu_check_bind_data(struct iommu_gpasid_bind_data *data)
 {
-       u32 mask;
+       u64 mask;
        int i;
 
        if (data->version != IOMMU_GPASID_BIND_VERSION_1)
index c6098ee..2aa79c3 100644 (file)
@@ -180,7 +180,6 @@ config IRQ_MIPS_CPU
        select GENERIC_IRQ_CHIP
        select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING
        select IRQ_DOMAIN
-       select IRQ_DOMAIN_HIERARCHY if GENERIC_IRQ_IPI
        select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 
 config CLPS711X_IRQCHIP
@@ -315,7 +314,6 @@ config KEYSTONE_IRQ
 config MIPS_GIC
        bool
        select GENERIC_IRQ_IPI
-       select IRQ_DOMAIN_HIERARCHY
        select MIPS_CM
 
 config INGENIC_IRQ
@@ -591,6 +589,7 @@ config LOONGSON_PCH_MSI
 
 config MST_IRQ
        bool "MStar Interrupt Controller"
+       depends on ARCH_MEDIATEK || ARCH_MSTARV7 || COMPILE_TEST
        default ARCH_MEDIATEK
        select IRQ_DOMAIN
        select IRQ_DOMAIN_HIERARCHY
index 80e3a84..94c2885 100644 (file)
@@ -17,7 +17,6 @@ obj-$(CONFIG_ARCH_LPC32XX)            += irq-lpc32xx.o
 obj-$(CONFIG_ARCH_MMP)                 += irq-mmp.o
 obj-$(CONFIG_IRQ_MXS)                  += irq-mxs.o
 obj-$(CONFIG_ARCH_TEGRA)               += irq-tegra.o
-obj-$(CONFIG_ARCH_S3C24XX)             += irq-s3c24xx.o
 obj-$(CONFIG_DW_APB_ICTL)              += irq-dw-apb-ictl.o
 obj-$(CONFIG_CLPS711X_IRQCHIP)         += irq-clps711x.o
 obj-$(CONFIG_OMPIC)                    += irq-ompic.o
index 97838eb..cbc7c74 100644 (file)
@@ -244,7 +244,7 @@ static int bcm2836_cpu_dying(unsigned int cpu)
 
 #define BITS_PER_MBOX  32
 
-static void bcm2836_arm_irqchip_smp_init(void)
+static void __init bcm2836_arm_irqchip_smp_init(void)
 {
        struct irq_fwspec ipi_fwspec = {
                .fwnode         = intc.domain->fwnode,
index 4be0775..143657b 100644 (file)
@@ -154,8 +154,8 @@ static const struct irq_domain_ops mst_intc_domain_ops = {
        .free           = irq_domain_free_irqs_common,
 };
 
-int __init
-mst_intc_of_init(struct device_node *dn, struct device_node *parent)
+static int __init mst_intc_of_init(struct device_node *dn,
+                                  struct device_node *parent)
 {
        struct irq_domain *domain, *domain_parent;
        struct mst_intc_chip_data *cd;
index 3819185..cb7f60b 100644 (file)
@@ -71,8 +71,7 @@ struct intc_irqpin_priv {
 };
 
 struct intc_irqpin_config {
-       unsigned int irlm_bit;
-       unsigned needs_irlm:1;
+       int irlm_bit;           /* -1 if non-existent */
 };
 
 static unsigned long intc_irqpin_read32(void __iomem *iomem)
@@ -349,11 +348,10 @@ static const struct irq_domain_ops intc_irqpin_irq_domain_ops = {
 
 static const struct intc_irqpin_config intc_irqpin_irlm_r8a777x = {
        .irlm_bit = 23, /* ICR0.IRLM0 */
-       .needs_irlm = 1,
 };
 
 static const struct intc_irqpin_config intc_irqpin_rmobile = {
-       .needs_irlm = 0,
+       .irlm_bit = -1,
 };
 
 static const struct of_device_id intc_irqpin_dt_ids[] = {
@@ -470,7 +468,7 @@ static int intc_irqpin_probe(struct platform_device *pdev)
        }
 
        /* configure "individual IRQ mode" where needed */
-       if (config && config->needs_irlm) {
+       if (config && config->irlm_bit >= 0) {
                if (io[INTC_IRQPIN_REG_IRLM])
                        intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_IRLM,
                                                      config->irlm_bit, 1, 1);
index eaa3e9f..6f432d2 100644 (file)
@@ -99,7 +99,7 @@ static inline void plic_irq_toggle(const struct cpumask *mask,
                                   struct irq_data *d, int enable)
 {
        int cpu;
-       struct plic_priv *priv = irq_get_chip_data(d->irq);
+       struct plic_priv *priv = irq_data_get_irq_chip_data(d);
 
        writel(enable, priv->regs + PRIORITY_BASE + d->hwirq * PRIORITY_PER_ID);
        for_each_cpu(cpu, mask) {
@@ -115,7 +115,7 @@ static void plic_irq_unmask(struct irq_data *d)
 {
        struct cpumask amask;
        unsigned int cpu;
-       struct plic_priv *priv = irq_get_chip_data(d->irq);
+       struct plic_priv *priv = irq_data_get_irq_chip_data(d);
 
        cpumask_and(&amask, &priv->lmask, cpu_online_mask);
        cpu = cpumask_any_and(irq_data_get_affinity_mask(d),
@@ -127,7 +127,7 @@ static void plic_irq_unmask(struct irq_data *d)
 
 static void plic_irq_mask(struct irq_data *d)
 {
-       struct plic_priv *priv = irq_get_chip_data(d->irq);
+       struct plic_priv *priv = irq_data_get_irq_chip_data(d);
 
        plic_irq_toggle(&priv->lmask, d, 0);
 }
@@ -138,7 +138,7 @@ static int plic_set_affinity(struct irq_data *d,
 {
        unsigned int cpu;
        struct cpumask amask;
-       struct plic_priv *priv = irq_get_chip_data(d->irq);
+       struct plic_priv *priv = irq_data_get_irq_chip_data(d);
 
        cpumask_and(&amask, &priv->lmask, mask_val);
 
@@ -151,7 +151,7 @@ static int plic_set_affinity(struct irq_data *d,
                return -EINVAL;
 
        plic_irq_toggle(&priv->lmask, d, 0);
-       plic_irq_toggle(cpumask_of(cpu), d, 1);
+       plic_irq_toggle(cpumask_of(cpu), d, !irqd_irq_masked(d));
 
        irq_data_update_effective_affinity(d, cpumask_of(cpu));
 
index 0c2c61d..8662d7b 100644 (file)
@@ -195,6 +195,10 @@ static const struct stm32_desc_irq stm32mp1_desc_irq[] = {
        { .exti = 25, .irq_parent = 107, .chip = &stm32_exti_h_chip_direct },
        { .exti = 30, .irq_parent = 52, .chip = &stm32_exti_h_chip_direct },
        { .exti = 47, .irq_parent = 93, .chip = &stm32_exti_h_chip_direct },
+       { .exti = 48, .irq_parent = 138, .chip = &stm32_exti_h_chip_direct },
+       { .exti = 50, .irq_parent = 139, .chip = &stm32_exti_h_chip_direct },
+       { .exti = 52, .irq_parent = 140, .chip = &stm32_exti_h_chip_direct },
+       { .exti = 53, .irq_parent = 141, .chip = &stm32_exti_h_chip_direct },
        { .exti = 54, .irq_parent = 135, .chip = &stm32_exti_h_chip_direct },
        { .exti = 61, .irq_parent = 100, .chip = &stm32_exti_h_chip_direct },
        { .exti = 65, .irq_parent = 144, .chip = &stm32_exti_h_chip },
index e0cceb8..b2ab8db 100644 (file)
@@ -85,6 +85,17 @@ struct ti_sci_inta_vint_desc {
  * @base:              Base address of the memory mapped IO registers
  * @pdev:              Pointer to platform device.
  * @ti_sci_id:         TI-SCI device identifier
+ * @unmapped_cnt:      Number of @unmapped_dev_ids entries
+ * @unmapped_dev_ids:  Pointer to an array of TI-SCI device identifiers of
+ *                     unmapped event sources.
+ *                     Unmapped Events are not part of the Global Event Map and
+ *                     they are converted to Global event within INTA to be
+ *                     received by the same INTA to generate an interrupt.
+ *                     In case an interrupt request comes for a device which is
+ *                     generating Unmapped Event, we must use the INTA's TI-SCI
+ *                     device identifier in place of the source device
+ *                     identifier to let sysfw know where it has to program the
+ *                     Global Event number.
  */
 struct ti_sci_inta_irq_domain {
        const struct ti_sci_handle *sci;
@@ -96,11 +107,37 @@ struct ti_sci_inta_irq_domain {
        void __iomem *base;
        struct platform_device *pdev;
        u32 ti_sci_id;
+
+       int unmapped_cnt;
+       u16 *unmapped_dev_ids;
 };
 
 #define to_vint_desc(e, i) container_of(e, struct ti_sci_inta_vint_desc, \
                                        events[i])
 
+static u16 ti_sci_inta_get_dev_id(struct ti_sci_inta_irq_domain *inta, u32 hwirq)
+{
+       u16 dev_id = HWIRQ_TO_DEVID(hwirq);
+       int i;
+
+       if (inta->unmapped_cnt == 0)
+               return dev_id;
+
+       /*
+        * For devices sending Unmapped Events we must use the INTA's TI-SCI
+        * device identifier number to be able to convert it to a Global Event
+        * and map it to an interrupt.
+        */
+       for (i = 0; i < inta->unmapped_cnt; i++) {
+               if (dev_id == inta->unmapped_dev_ids[i]) {
+                       dev_id = inta->ti_sci_id;
+                       break;
+               }
+       }
+
+       return dev_id;
+}
+
 /**
  * ti_sci_inta_irq_handler() - Chained IRQ handler for the vint irqs
  * @desc:      Pointer to irq_desc corresponding to the irq
@@ -251,7 +288,7 @@ static struct ti_sci_inta_event_desc *ti_sci_inta_alloc_event(struct ti_sci_inta
        u16 dev_id, dev_index;
        int err;
 
-       dev_id = HWIRQ_TO_DEVID(hwirq);
+       dev_id = ti_sci_inta_get_dev_id(inta, hwirq);
        dev_index = HWIRQ_TO_IRQID(hwirq);
 
        event_desc = &vint_desc->events[free_bit];
@@ -352,14 +389,15 @@ static void ti_sci_inta_free_irq(struct ti_sci_inta_event_desc *event_desc,
 {
        struct ti_sci_inta_vint_desc *vint_desc;
        struct ti_sci_inta_irq_domain *inta;
+       u16 dev_id;
 
        vint_desc = to_vint_desc(event_desc, event_desc->vint_bit);
        inta = vint_desc->domain->host_data;
+       dev_id = ti_sci_inta_get_dev_id(inta, hwirq);
        /* free event irq */
        mutex_lock(&inta->vint_mutex);
        inta->sci->ops.rm_irq_ops.free_event_map(inta->sci,
-                                                HWIRQ_TO_DEVID(hwirq),
-                                                HWIRQ_TO_IRQID(hwirq),
+                                                dev_id, HWIRQ_TO_IRQID(hwirq),
                                                 inta->ti_sci_id,
                                                 vint_desc->vint_id,
                                                 event_desc->global_event,
@@ -574,6 +612,41 @@ static struct msi_domain_info ti_sci_inta_msi_domain_info = {
        .chip   = &ti_sci_inta_msi_irq_chip,
 };
 
+static int ti_sci_inta_get_unmapped_sources(struct ti_sci_inta_irq_domain *inta)
+{
+       struct device *dev = &inta->pdev->dev;
+       struct device_node *node = dev_of_node(dev);
+       struct of_phandle_iterator it;
+       int count, err, ret, i;
+
+       count = of_count_phandle_with_args(node, "ti,unmapped-event-sources", NULL);
+       if (count <= 0)
+               return 0;
+
+       inta->unmapped_dev_ids = devm_kcalloc(dev, count,
+                                             sizeof(*inta->unmapped_dev_ids),
+                                             GFP_KERNEL);
+       if (!inta->unmapped_dev_ids)
+               return -ENOMEM;
+
+       i = 0;
+       of_for_each_phandle(&it, err, node, "ti,unmapped-event-sources", NULL, 0) {
+               u32 dev_id;
+
+               ret = of_property_read_u32(it.node, "ti,sci-dev-id", &dev_id);
+               if (ret) {
+                       dev_err(dev, "ti,sci-dev-id read failure for %pOFf\n", it.node);
+                       of_node_put(it.node);
+                       return ret;
+               }
+               inta->unmapped_dev_ids[i++] = dev_id;
+       }
+
+       inta->unmapped_cnt = count;
+
+       return 0;
+}
+
 static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
 {
        struct irq_domain *parent_domain, *domain, *msi_domain;
@@ -629,6 +702,10 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
        if (IS_ERR(inta->base))
                return PTR_ERR(inta->base);
 
+       ret = ti_sci_inta_get_unmapped_sources(inta);
+       if (ret)
+               return ret;
+
        domain = irq_domain_add_linear(dev_of_node(dev),
                                       ti_sci_get_num_resources(inta->vint),
                                       &ti_sci_inta_irq_domain_ops, inta);
index d234115..3570f0a 100644 (file)
@@ -22,7 +22,7 @@
  * special section.
  */
 static const struct of_device_id
-irqchip_of_match_end __used __section(__irqchip_of_table_end);
+irqchip_of_match_end __used __section("__irqchip_of_table_end");
 
 extern struct of_device_id __irqchip_of_table[];
 
index fe78bf0..c1bcac7 100644 (file)
@@ -1311,8 +1311,9 @@ static long nvm_ioctl_get_devices(struct file *file, void __user *arg)
                strlcpy(info->bmname, "gennvm", sizeof(info->bmname));
                i++;
 
-               if (i > 31) {
-                       pr_err("max 31 devices can be reported.\n");
+               if (i >= ARRAY_SIZE(devices->info)) {
+                       pr_err("max %zd devices can be reported.\n",
+                              ARRAY_SIZE(devices->info));
                        break;
                }
        }
index 834b35d..e07091d 100644 (file)
@@ -13,6 +13,8 @@
 #include <linux/pm.h>
 #include <linux/slab.h>
 
+#include <soc/tegra/fuse.h>
+
 #include <dt-bindings/mailbox/tegra186-hsp.h>
 
 #include "mailbox.h"
@@ -322,7 +324,12 @@ static int tegra_hsp_doorbell_startup(struct mbox_chan *chan)
        if (!ccplex)
                return -ENODEV;
 
-       if (!tegra_hsp_doorbell_can_ring(db))
+       /*
+        * On simulation platforms the BPMP hasn't had a chance yet to mark
+        * the doorbell as ringable by the CCPLEX, so we want to skip extra
+        * checks here.
+        */
+       if (tegra_is_silicon() && !tegra_hsp_doorbell_can_ring(db))
                return -ENODEV;
 
        spin_lock_irqsave(&hsp->lock, flags);
index 2c79e95..00e013b 100644 (file)
@@ -32,8 +32,9 @@ config ARM_PL172_MPMC
 
 config ATMEL_SDRAMC
        bool "Atmel (Multi-port DDR-)SDRAM Controller"
-       default y
-       depends on ARCH_AT91 && OF
+       default y if ARCH_AT91
+       depends on ARCH_AT91 || COMPILE_TEST
+       depends on OF
        help
          This driver is for Atmel SDRAM Controller or Atmel Multi-port
          DDR-SDRAM Controller available on Atmel AT91SAM9 and SAMA5 SoCs.
@@ -42,8 +43,9 @@ config ATMEL_SDRAMC
 
 config ATMEL_EBI
        bool "Atmel EBI driver"
-       default y
-       depends on ARCH_AT91 && OF
+       default y if ARCH_AT91
+       depends on ARCH_AT91 || COMPILE_TEST
+       depends on OF
        select MFD_SYSCON
        select MFD_ATMEL_SMC
        help
@@ -52,6 +54,18 @@ config ATMEL_EBI
          tree is used. This bus supports NANDs, external ethernet controller,
          SRAMs, ATA devices, etc.
 
+config BRCMSTB_DPFE
+       bool "Broadcom STB DPFE driver" if COMPILE_TEST
+       default y if ARCH_BRCMSTB
+       depends on ARCH_BRCMSTB || COMPILE_TEST
+       help
+         This driver provides access to the DPFE interface of Broadcom
+         STB SoCs. The firmware running on the DCPU inside the DDR PHY can
+         provide current information about the system's RAM, for instance
+         the DRAM refresh rate. This can be used as an indirect indicator
+         for the DRAM's temperature. Slower refresh rate means cooler RAM,
+         higher refresh rate means hotter RAM.
+
 config BT1_L2_CTL
        bool "Baikal-T1 CM2 L2-RAM Cache Control Block"
        depends on MIPS_BAIKAL_T1 || COMPILE_TEST
@@ -65,7 +79,8 @@ config BT1_L2_CTL
 
 config TI_AEMIF
        tristate "Texas Instruments AEMIF driver"
-       depends on (ARCH_DAVINCI || ARCH_KEYSTONE) && OF
+       depends on ARCH_DAVINCI || ARCH_KEYSTONE || COMPILE_TEST
+       depends on OF
        help
          This driver is for the AEMIF module available in Texas Instruments
          SoCs. AEMIF stands for Asynchronous External Memory Interface and
@@ -76,7 +91,7 @@ config TI_AEMIF
 
 config TI_EMIF
        tristate "Texas Instruments EMIF driver"
-       depends on ARCH_OMAP2PLUS
+       depends on ARCH_OMAP2PLUS || COMPILE_TEST
        select DDR
        help
          This driver is for the EMIF module available in Texas Instruments
@@ -88,7 +103,8 @@ config TI_EMIF
          temperature changes
 
 config OMAP_GPMC
-       bool
+       bool "Texas Instruments OMAP SoC GPMC driver" if COMPILE_TEST
+       depends on OF_ADDRESS
        select GPIOLIB
        help
          This driver is for the General Purpose Memory Controller (GPMC)
@@ -112,7 +128,8 @@ config OMAP_GPMC_DEBUG
 
 config TI_EMIF_SRAM
        tristate "Texas Instruments EMIF SRAM driver"
-       depends on (SOC_AM33XX || SOC_AM43XX) && SRAM
+       depends on SOC_AM33XX || SOC_AM43XX || (ARM && COMPILE_TEST)
+       depends on SRAM
        help
          This driver is for the EMIF module available on Texas Instruments
          AM33XX and AM43XX SoCs and is required for PM. Certain parts of
@@ -122,8 +139,9 @@ config TI_EMIF_SRAM
 
 config MVEBU_DEVBUS
        bool "Marvell EBU Device Bus Controller"
-       default y
-       depends on PLAT_ORION && OF
+       default y if PLAT_ORION
+       depends on PLAT_ORION || COMPILE_TEST
+       depends on OF
        help
          This driver is for the Device Bus controller available in some
          Marvell EBU SoCs such as Discovery (mv78xx0), Orion (88f5xxx) and
@@ -132,7 +150,7 @@ config MVEBU_DEVBUS
 
 config FSL_CORENET_CF
        tristate "Freescale CoreNet Error Reporting"
-       depends on FSL_SOC_BOOKE
+       depends on FSL_SOC_BOOKE || COMPILE_TEST
        help
          Say Y for reporting of errors from the Freescale CoreNet
          Coherency Fabric.  Errors reported include accesses to
@@ -141,7 +159,7 @@ config FSL_CORENET_CF
          represents a coherency violation.
 
 config FSL_IFC
-       bool
+       bool "Freescale IFC driver" if COMPILE_TEST
        depends on FSL_SOC || ARCH_LAYERSCAPE || SOC_LS1021A || COMPILE_TEST
        depends on HAS_IOMEM
 
@@ -155,7 +173,7 @@ config JZ4780_NEMC
          memory devices such as NAND and SRAM.
 
 config MTK_SMI
-       bool
+       bool "Mediatek SoC Memory Controller driver" if COMPILE_TEST
        depends on ARCH_MEDIATEK || COMPILE_TEST
        help
          This driver is for the Memory Controller module in MediaTek SoCs,
@@ -164,7 +182,7 @@ config MTK_SMI
 
 config DA8XX_DDRCTL
        bool "Texas Instruments da8xx DDR2/mDDR driver"
-       depends on ARCH_DAVINCI_DA8XX
+       depends on ARCH_DAVINCI_DA8XX || COMPILE_TEST
        help
          This driver is for the DDR2/mDDR Memory Controller present on
          Texas Instruments da8xx SoCs. It's used to tweak various memory
@@ -172,16 +190,16 @@ config DA8XX_DDRCTL
 
 config PL353_SMC
        tristate "ARM PL35X Static Memory Controller(SMC) driver"
-       default y
+       default y if ARM
        depends on ARM
-       depends on ARM_AMBA
+       depends on ARM_AMBA || COMPILE_TEST
        help
          This driver is for the ARM PL351/PL353 Static Memory
          Controller(SMC) module.
 
 config RENESAS_RPCIF
        tristate "Renesas RPC-IF driver"
-       depends on ARCH_RENESAS
+       depends on ARCH_RENESAS || COMPILE_TEST
        select REGMAP_MMIO
        help
          This supports Renesas R-Car Gen3 RPC-IF which provides either SPI
index b4533ff..e71cf7b 100644 (file)
@@ -10,7 +10,7 @@ endif
 obj-$(CONFIG_ARM_PL172_MPMC)   += pl172.o
 obj-$(CONFIG_ATMEL_SDRAMC)     += atmel-sdramc.o
 obj-$(CONFIG_ATMEL_EBI)                += atmel-ebi.o
-obj-$(CONFIG_ARCH_BRCMSTB)     += brcmstb_dpfe.o
+obj-$(CONFIG_BRCMSTB_DPFE)     += brcmstb_dpfe.o
 obj-$(CONFIG_BT1_L2_CTL)       += bt1-l2-ctl.o
 obj-$(CONFIG_TI_AEMIF)         += ti-aemif.o
 obj-$(CONFIG_TI_EMIF)          += emif.o
index 60e8633..f43ba69 100644 (file)
@@ -188,11 +188,6 @@ struct brcmstb_dpfe_priv {
        struct mutex lock;
 };
 
-static const char * const error_text[] = {
-       "Success", "Header code incorrect", "Unknown command or argument",
-       "Incorrect checksum", "Malformed command", "Timed out",
-};
-
 /*
  * Forward declaration of our sysfs attribute functions, so we can declare the
  * attribute data structures early.
@@ -307,6 +302,20 @@ static const struct dpfe_api dpfe_api_v3 = {
        },
 };
 
+static const char *get_error_text(unsigned int i)
+{
+       static const char * const error_text[] = {
+               "Success", "Header code incorrect",
+               "Unknown command or argument", "Incorrect checksum",
+               "Malformed command", "Timed out", "Unknown error",
+       };
+
+       if (unlikely(i >= ARRAY_SIZE(error_text)))
+               i = ARRAY_SIZE(error_text) - 1;
+
+       return error_text[i];
+}
+
 static bool is_dcpu_enabled(struct brcmstb_dpfe_priv *priv)
 {
        u32 val;
@@ -445,7 +454,7 @@ static int __send_command(struct brcmstb_dpfe_priv *priv, unsigned int cmd,
        }
        if (resp != 0) {
                mutex_unlock(&priv->lock);
-               return -ETIMEDOUT;
+               return -ffs(DCPU_RET_ERR_TIMEDOUT);
        }
 
        /* Compute checksum over the message */
@@ -647,8 +656,10 @@ static int brcmstb_dpfe_download_firmware(struct brcmstb_dpfe_priv *priv)
                return (ret == -ENOENT) ? -EPROBE_DEFER : ret;
 
        ret = __verify_firmware(&init, fw);
-       if (ret)
-               return -EFAULT;
+       if (ret) {
+               ret = -EFAULT;
+               goto release_fw;
+       }
 
        __disable_dcpu(priv);
 
@@ -667,18 +678,20 @@ static int brcmstb_dpfe_download_firmware(struct brcmstb_dpfe_priv *priv)
 
        ret = __write_firmware(priv->dmem, dmem, dmem_size, is_big_endian);
        if (ret)
-               return ret;
+               goto release_fw;
        ret = __write_firmware(priv->imem, imem, imem_size, is_big_endian);
        if (ret)
-               return ret;
+               goto release_fw;
 
        ret = __verify_fw_checksum(&init, priv, header, init.chksum);
        if (ret)
-               return ret;
+               goto release_fw;
 
        __enable_dcpu(priv);
 
-       return 0;
+release_fw:
+       release_firmware(fw);
+       return ret;
 }
 
 static ssize_t generic_show(unsigned int command, u32 response[],
@@ -691,7 +704,7 @@ static ssize_t generic_show(unsigned int command, u32 response[],
 
        ret = __send_command(priv, command, response);
        if (ret < 0)
-               return sprintf(buf, "ERROR: %s\n", error_text[-ret]);
+               return sprintf(buf, "ERROR: %s\n", get_error_text(-ret));
 
        return 0;
 }
@@ -888,11 +901,8 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev)
        }
 
        ret = brcmstb_dpfe_download_firmware(priv);
-       if (ret) {
-               if (ret != -EPROBE_DEFER)
-                       dev_err(dev, "Couldn't download firmware -- %d\n", ret);
-               return ret;
-       }
+       if (ret)
+               return dev_err_probe(dev, ret, "Couldn't download firmware\n");
 
        ret = sysfs_create_groups(&pdev->dev.kobj, priv->dpfe_api->sysfs_attrs);
        if (!ret)
index bb6a71d..ddb1879 100644 (file)
@@ -131,16 +131,7 @@ static int emif_regdump_show(struct seq_file *s, void *unused)
        return 0;
 }
 
-static int emif_regdump_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, emif_regdump_show, inode->i_private);
-}
-
-static const struct file_operations emif_regdump_fops = {
-       .open                   = emif_regdump_open,
-       .read                   = seq_read,
-       .release                = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(emif_regdump);
 
 static int emif_mr4_show(struct seq_file *s, void *unused)
 {
@@ -150,48 +141,16 @@ static int emif_mr4_show(struct seq_file *s, void *unused)
        return 0;
 }
 
-static int emif_mr4_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, emif_mr4_show, inode->i_private);
-}
-
-static const struct file_operations emif_mr4_fops = {
-       .open                   = emif_mr4_open,
-       .read                   = seq_read,
-       .release                = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(emif_mr4);
 
 static int __init_or_module emif_debugfs_init(struct emif_data *emif)
 {
-       struct dentry   *dentry;
-       int             ret;
-
-       dentry = debugfs_create_dir(dev_name(emif->dev), NULL);
-       if (!dentry) {
-               ret = -ENOMEM;
-               goto err0;
-       }
-       emif->debugfs_root = dentry;
-
-       dentry = debugfs_create_file("regcache_dump", S_IRUGO,
-                       emif->debugfs_root, emif, &emif_regdump_fops);
-       if (!dentry) {
-               ret = -ENOMEM;
-               goto err1;
-       }
-
-       dentry = debugfs_create_file("mr4", S_IRUGO,
-                       emif->debugfs_root, emif, &emif_mr4_fops);
-       if (!dentry) {
-               ret = -ENOMEM;
-               goto err1;
-       }
-
+       emif->debugfs_root = debugfs_create_dir(dev_name(emif->dev), NULL);
+       debugfs_create_file("regcache_dump", S_IRUGO, emif->debugfs_root, emif,
+                           &emif_regdump_fops);
+       debugfs_create_file("mr4", S_IRUGO, emif->debugfs_root, emif,
+                           &emif_mr4_fops);
        return 0;
-err1:
-       debugfs_remove_recursive(emif->debugfs_root);
-err0:
-       return ret;
 }
 
 static void __exit emif_debugfs_exit(struct emif_data *emif)
index 0b0ed72..0309bd5 100644 (file)
@@ -211,10 +211,8 @@ static int ccf_probe(struct platform_device *pdev)
        dev_set_drvdata(&pdev->dev, ccf);
 
        irq = platform_get_irq(pdev, 0);
-       if (!irq) {
-               dev_err(&pdev->dev, "%s: no irq\n", __func__);
-               return -ENXIO;
-       }
+       if (irq < 0)
+               return irq;
 
        ret = devm_request_irq(&pdev->dev, irq, ccf_irq, 0, pdev->name, ccf);
        if (ret) {
index c212625..691e4c3 100644 (file)
@@ -19,6 +19,9 @@
 /* mt8173 */
 #define SMI_LARB_MMU_EN                0xf00
 
+/* mt8167 */
+#define MT8167_SMI_LARB_MMU_EN 0xfc0
+
 /* mt2701 */
 #define REG_SMI_SECUR_CON_BASE         0x5c0
 
@@ -179,6 +182,13 @@ static void mtk_smi_larb_config_port_mt8173(struct device *dev)
        writel(*larb->mmu, larb->base + SMI_LARB_MMU_EN);
 }
 
+static void mtk_smi_larb_config_port_mt8167(struct device *dev)
+{
+       struct mtk_smi_larb *larb = dev_get_drvdata(dev);
+
+       writel(*larb->mmu, larb->base + MT8167_SMI_LARB_MMU_EN);
+}
+
 static void mtk_smi_larb_config_port_gen1(struct device *dev)
 {
        struct mtk_smi_larb *larb = dev_get_drvdata(dev);
@@ -226,6 +236,11 @@ static const struct mtk_smi_larb_gen mtk_smi_larb_mt8173 = {
        .config_port = mtk_smi_larb_config_port_mt8173,
 };
 
+static const struct mtk_smi_larb_gen mtk_smi_larb_mt8167 = {
+       /* mt8167 do not need the port in larb */
+       .config_port = mtk_smi_larb_config_port_mt8167,
+};
+
 static const struct mtk_smi_larb_gen mtk_smi_larb_mt2701 = {
        .port_in_larb = {
                LARB0_PORT_OFFSET, LARB1_PORT_OFFSET,
@@ -255,6 +270,10 @@ static const struct mtk_smi_larb_gen mtk_smi_larb_mt8183 = {
 
 static const struct of_device_id mtk_smi_larb_of_ids[] = {
        {
+               .compatible = "mediatek,mt8167-smi-larb",
+               .data = &mtk_smi_larb_mt8167
+       },
+       {
                .compatible = "mediatek,mt8173-smi-larb",
                .data = &mtk_smi_larb_mt8173
        },
@@ -419,6 +438,10 @@ static const struct of_device_id mtk_smi_common_of_ids[] = {
                .data = &mtk_smi_common_gen2,
        },
        {
+               .compatible = "mediatek,mt8167-smi-common",
+               .data = &mtk_smi_common_gen2,
+       },
+       {
                .compatible = "mediatek,mt2701-smi-common",
                .data = &mtk_smi_common_gen1,
        },
index ca00976..cfa730c 100644 (file)
@@ -33,8 +33,6 @@
 
 #include <linux/platform_data/mtd-nand-omap2.h>
 
-#include <asm/mach-types.h>
-
 #define        DEVICE_NAME             "omap-gpmc"
 
 /* GPMC register offsets */
@@ -245,7 +243,6 @@ static DEFINE_SPINLOCK(gpmc_mem_lock);
 /* Define chip-selects as reserved by default until probe completes */
 static unsigned int gpmc_cs_num = GPMC_CS_NUM;
 static unsigned int gpmc_nr_waitpins;
-static resource_size_t phys_base, mem_size;
 static unsigned int gpmc_capability;
 static void __iomem *gpmc_base;
 
@@ -634,14 +631,6 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, int max
        return 0;
 }
 
-#define GPMC_SET_ONE_CD_MAX(reg, st, end, max, field, cd)  \
-       if (set_gpmc_timing_reg(cs, (reg), (st), (end), (max), \
-           t->field, (cd), #field) < 0)                       \
-               return -1
-
-#define GPMC_SET_ONE(reg, st, end, field) \
-       GPMC_SET_ONE_CD_MAX(reg, st, end, 0, field, GPMC_CD_FCLK)
-
 /**
  * gpmc_calc_waitmonitoring_divider - calculate proper GPMCFCLKDIVIDER based on WAITMONITORINGTIME
  * WAITMONITORINGTIME will be _at least_ as long as desired, i.e.
@@ -700,12 +689,12 @@ int gpmc_calc_divider(unsigned int sync_clk)
 int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t,
                        const struct gpmc_settings *s)
 {
-       int div;
+       int div, ret;
        u32 l;
 
        div = gpmc_calc_divider(t->sync_clk);
        if (div < 0)
-               return div;
+               return -EINVAL;
 
        /*
         * See if we need to change the divider for waitmonitoringtime.
@@ -729,57 +718,114 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t,
                               __func__,
                               t->wait_monitoring
                               );
-                       return -1;
+                       return -ENXIO;
                }
        }
 
-       GPMC_SET_ONE(GPMC_CS_CONFIG2,  0,  3, cs_on);
-       GPMC_SET_ONE(GPMC_CS_CONFIG2,  8, 12, cs_rd_off);
-       GPMC_SET_ONE(GPMC_CS_CONFIG2, 16, 20, cs_wr_off);
+       ret = 0;
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG2, 0, 3, 0, t->cs_on,
+                                  GPMC_CD_FCLK, "cs_on");
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG2, 8, 12, 0, t->cs_rd_off,
+                                  GPMC_CD_FCLK, "cs_rd_off");
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG2, 16, 20, 0, t->cs_wr_off,
+                                  GPMC_CD_FCLK, "cs_wr_off");
+       if (ret)
+               return -ENXIO;
+
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 0, 3, 0, t->adv_on,
+                                  GPMC_CD_FCLK, "adv_on");
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 8, 12, 0, t->adv_rd_off,
+                                  GPMC_CD_FCLK, "adv_rd_off");
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 16, 20, 0, t->adv_wr_off,
+                                  GPMC_CD_FCLK, "adv_wr_off");
+       if (ret)
+               return -ENXIO;
 
-       GPMC_SET_ONE(GPMC_CS_CONFIG3,  0,  3, adv_on);
-       GPMC_SET_ONE(GPMC_CS_CONFIG3,  8, 12, adv_rd_off);
-       GPMC_SET_ONE(GPMC_CS_CONFIG3, 16, 20, adv_wr_off);
        if (gpmc_capability & GPMC_HAS_MUX_AAD) {
-               GPMC_SET_ONE(GPMC_CS_CONFIG3,  4,  6, adv_aad_mux_on);
-               GPMC_SET_ONE(GPMC_CS_CONFIG3, 24, 26, adv_aad_mux_rd_off);
-               GPMC_SET_ONE(GPMC_CS_CONFIG3, 28, 30, adv_aad_mux_wr_off);
+               ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 4, 6, 0,
+                                          t->adv_aad_mux_on, GPMC_CD_FCLK,
+                                          "adv_aad_mux_on");
+               ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 24, 26, 0,
+                                          t->adv_aad_mux_rd_off, GPMC_CD_FCLK,
+                                          "adv_aad_mux_rd_off");
+               ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 28, 30, 0,
+                                          t->adv_aad_mux_wr_off, GPMC_CD_FCLK,
+                                          "adv_aad_mux_wr_off");
+               if (ret)
+                       return -ENXIO;
        }
 
-       GPMC_SET_ONE(GPMC_CS_CONFIG4,  0,  3, oe_on);
-       GPMC_SET_ONE(GPMC_CS_CONFIG4,  8, 12, oe_off);
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 0, 3, 0, t->oe_on,
+                                  GPMC_CD_FCLK, "oe_on");
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 8, 12, 0, t->oe_off,
+                                  GPMC_CD_FCLK, "oe_off");
        if (gpmc_capability & GPMC_HAS_MUX_AAD) {
-               GPMC_SET_ONE(GPMC_CS_CONFIG4,  4,  6, oe_aad_mux_on);
-               GPMC_SET_ONE(GPMC_CS_CONFIG4, 13, 15, oe_aad_mux_off);
+               ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 4, 6, 0,
+                                          t->oe_aad_mux_on, GPMC_CD_FCLK,
+                                          "oe_aad_mux_on");
+               ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 13, 15, 0,
+                                          t->oe_aad_mux_off, GPMC_CD_FCLK,
+                                          "oe_aad_mux_off");
+       }
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 16, 19, 0, t->we_on,
+                                  GPMC_CD_FCLK, "we_on");
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 24, 28, 0, t->we_off,
+                                  GPMC_CD_FCLK, "we_off");
+       if (ret)
+               return -ENXIO;
+
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG5, 0, 4, 0, t->rd_cycle,
+                                  GPMC_CD_FCLK, "rd_cycle");
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG5, 8, 12, 0, t->wr_cycle,
+                                  GPMC_CD_FCLK, "wr_cycle");
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG5, 16, 20, 0, t->access,
+                                  GPMC_CD_FCLK, "access");
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG5, 24, 27, 0,
+                                  t->page_burst_access, GPMC_CD_FCLK,
+                                  "page_burst_access");
+       if (ret)
+               return -ENXIO;
+
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG6, 0, 3, 0,
+                                  t->bus_turnaround, GPMC_CD_FCLK,
+                                  "bus_turnaround");
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG6, 8, 11, 0,
+                                  t->cycle2cycle_delay, GPMC_CD_FCLK,
+                                  "cycle2cycle_delay");
+       if (ret)
+               return -ENXIO;
+
+       if (gpmc_capability & GPMC_HAS_WR_DATA_MUX_BUS) {
+               ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG6, 16, 19, 0,
+                                          t->wr_data_mux_bus, GPMC_CD_FCLK,
+                                          "wr_data_mux_bus");
+               if (ret)
+                       return -ENXIO;
+       }
+       if (gpmc_capability & GPMC_HAS_WR_ACCESS) {
+               ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG6, 24, 28, 0,
+                                          t->wr_access, GPMC_CD_FCLK,
+                                          "wr_access");
+               if (ret)
+                       return -ENXIO;
        }
-       GPMC_SET_ONE(GPMC_CS_CONFIG4, 16, 19, we_on);
-       GPMC_SET_ONE(GPMC_CS_CONFIG4, 24, 28, we_off);
-
-       GPMC_SET_ONE(GPMC_CS_CONFIG5,  0,  4, rd_cycle);
-       GPMC_SET_ONE(GPMC_CS_CONFIG5,  8, 12, wr_cycle);
-       GPMC_SET_ONE(GPMC_CS_CONFIG5, 16, 20, access);
-
-       GPMC_SET_ONE(GPMC_CS_CONFIG5, 24, 27, page_burst_access);
-
-       GPMC_SET_ONE(GPMC_CS_CONFIG6, 0, 3, bus_turnaround);
-       GPMC_SET_ONE(GPMC_CS_CONFIG6, 8, 11, cycle2cycle_delay);
-
-       if (gpmc_capability & GPMC_HAS_WR_DATA_MUX_BUS)
-               GPMC_SET_ONE(GPMC_CS_CONFIG6, 16, 19, wr_data_mux_bus);
-       if (gpmc_capability & GPMC_HAS_WR_ACCESS)
-               GPMC_SET_ONE(GPMC_CS_CONFIG6, 24, 28, wr_access);
 
        l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
        l &= ~0x03;
        l |= (div - 1);
        gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, l);
 
-       GPMC_SET_ONE_CD_MAX(GPMC_CS_CONFIG1, 18, 19,
-                           GPMC_CONFIG1_WAITMONITORINGTIME_MAX,
-                           wait_monitoring, GPMC_CD_CLK);
-       GPMC_SET_ONE_CD_MAX(GPMC_CS_CONFIG1, 25, 26,
-                           GPMC_CONFIG1_CLKACTIVATIONTIME_MAX,
-                           clk_activation, GPMC_CD_FCLK);
+       ret = 0;
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG1, 18, 19,
+                                  GPMC_CONFIG1_WAITMONITORINGTIME_MAX,
+                                  t->wait_monitoring, GPMC_CD_CLK,
+                                  "wait_monitoring");
+       ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG1, 25, 26,
+                                  GPMC_CONFIG1_CLKACTIVATIONTIME_MAX,
+                                  t->clk_activation, GPMC_CD_FCLK,
+                                  "clk_activation");
+       if (ret)
+               return -ENXIO;
 
 #ifdef CONFIG_OMAP_GPMC_DEBUG
        pr_info("GPMC CS%d CLK period is %lu ns (div %d)\n",
@@ -870,20 +916,6 @@ static bool gpmc_cs_reserved(int cs)
        return gpmc->flags & GPMC_CS_RESERVED;
 }
 
-static void gpmc_cs_set_name(int cs, const char *name)
-{
-       struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
-
-       gpmc->name = name;
-}
-
-static const char *gpmc_cs_get_name(int cs)
-{
-       struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
-
-       return gpmc->name;
-}
-
 static unsigned long gpmc_mem_align(unsigned long size)
 {
        int order;
@@ -929,56 +961,13 @@ static int gpmc_cs_delete_mem(int cs)
        return r;
 }
 
-/**
- * gpmc_cs_remap - remaps a chip-select physical base address
- * @cs:                chip-select to remap
- * @base:      physical base address to re-map chip-select to
- *
- * Re-maps a chip-select to a new physical base address specified by
- * "base". Returns 0 on success and appropriate negative error code
- * on failure.
- */
-static int gpmc_cs_remap(int cs, u32 base)
-{
-       int ret;
-       u32 old_base, size;
-
-       if (cs > gpmc_cs_num) {
-               pr_err("%s: requested chip-select is disabled\n", __func__);
-               return -ENODEV;
-       }
-
-       /*
-        * Make sure we ignore any device offsets from the GPMC partition
-        * allocated for the chip select and that the new base confirms
-        * to the GPMC 16MB minimum granularity.
-        */
-       base &= ~(SZ_16M - 1);
-
-       gpmc_cs_get_memconf(cs, &old_base, &size);
-       if (base == old_base)
-               return 0;
-
-       ret = gpmc_cs_delete_mem(cs);
-       if (ret < 0)
-               return ret;
-
-       ret = gpmc_cs_insert_mem(cs, base, size);
-       if (ret < 0)
-               return ret;
-
-       ret = gpmc_cs_set_memconf(cs, base, size);
-
-       return ret;
-}
-
 int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
 {
        struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
        struct resource *res = &gpmc->mem;
        int r = -1;
 
-       if (cs > gpmc_cs_num) {
+       if (cs >= gpmc_cs_num) {
                pr_err("%s: requested chip-select is disabled\n", __func__);
                return -ENODEV;
        }
@@ -1025,8 +1014,7 @@ void gpmc_cs_free(int cs)
 
        spin_lock(&gpmc_mem_lock);
        if (cs >= gpmc_cs_num || cs < 0 || !gpmc_cs_reserved(cs)) {
-               printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs);
-               BUG();
+               WARN(1, "Trying to free non-reserved GPMC CS%d\n", cs);
                spin_unlock(&gpmc_mem_lock);
                return;
        }
@@ -1896,6 +1884,63 @@ static const struct of_device_id gpmc_dt_ids[] = {
        { }
 };
 
+static void gpmc_cs_set_name(int cs, const char *name)
+{
+       struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
+
+       gpmc->name = name;
+}
+
+static const char *gpmc_cs_get_name(int cs)
+{
+       struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
+
+       return gpmc->name;
+}
+
+/**
+ * gpmc_cs_remap - remaps a chip-select physical base address
+ * @cs:                chip-select to remap
+ * @base:      physical base address to re-map chip-select to
+ *
+ * Re-maps a chip-select to a new physical base address specified by
+ * "base". Returns 0 on success and appropriate negative error code
+ * on failure.
+ */
+static int gpmc_cs_remap(int cs, u32 base)
+{
+       int ret;
+       u32 old_base, size;
+
+       if (cs >= gpmc_cs_num) {
+               pr_err("%s: requested chip-select is disabled\n", __func__);
+               return -ENODEV;
+       }
+
+       /*
+        * Make sure we ignore any device offsets from the GPMC partition
+        * allocated for the chip select and that the new base confirms
+        * to the GPMC 16MB minimum granularity.
+        */
+       base &= ~(SZ_16M - 1);
+
+       gpmc_cs_get_memconf(cs, &old_base, &size);
+       if (base == old_base)
+               return 0;
+
+       ret = gpmc_cs_delete_mem(cs);
+       if (ret < 0)
+               return ret;
+
+       ret = gpmc_cs_insert_mem(cs, base, size);
+       if (ret < 0)
+               return ret;
+
+       ret = gpmc_cs_set_memconf(cs, base, size);
+
+       return ret;
+}
+
 /**
  * gpmc_read_settings_dt - read gpmc settings from device-tree
  * @np:                pointer to device-tree node for a gpmc child device
@@ -2265,6 +2310,10 @@ static void gpmc_probe_dt_children(struct platform_device *pdev)
        }
 }
 #else
+void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p)
+{
+       memset(p, 0, sizeof(*p));
+}
 static int gpmc_probe_dt(struct platform_device *pdev)
 {
        return 0;
@@ -2347,12 +2396,9 @@ static int gpmc_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, gpmc);
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (res == NULL)
+       if (!res)
                return -ENOENT;
 
-       phys_base = res->start;
-       mem_size = resource_size(res);
-
        gpmc_base = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(gpmc_base))
                return PTR_ERR(gpmc_base);
index 88f51ec..f2a33a1 100644 (file)
@@ -199,10 +199,8 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
                rpc->dirmap = NULL;
 
        rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
-       if (IS_ERR(rpc->rstc))
-               return PTR_ERR(rpc->rstc);
 
-       return 0;
+       return PTR_ERR_OR_ZERO(rpc->rstc);
 }
 EXPORT_SYMBOL(rpcif_sw_init);
 
index 714d1f6..c5ee412 100644 (file)
@@ -98,6 +98,8 @@ MODULE_PARM_DESC(irqmode, "Enable IRQ mode (0=off [default], 1=on)");
 
 /**
  * struct dmc_opp_table - Operating level desciption
+ * @freq_hz:           target frequency in Hz
+ * @volt_uv:           target voltage in uV
  *
  * Covers frequency and voltage settings of the DMC operating mode.
  */
@@ -108,6 +110,41 @@ struct dmc_opp_table {
 
 /**
  * struct exynos5_dmc - main structure describing DMC device
+ * @dev:               DMC device
+ * @df:                        devfreq device structure returned by devfreq framework
+ * @gov_data:          configuration of devfreq governor
+ * @base_drexi0:       DREX0 registers mapping
+ * @base_drexi1:       DREX1 registers mapping
+ * @clk_regmap:                regmap for clock controller registers
+ * @lock:              protects curr_rate and frequency/voltage setting section
+ * @curr_rate:         current frequency
+ * @curr_volt:         current voltage
+ * @opp:               OPP table
+ * @opp_count:         number of 'opp' elements
+ * @timings_arr_size:  number of 'timings' elements
+ * @timing_row:                values for timing row register, for each OPP
+ * @timing_data:       values for timing data register, for each OPP
+ * @timing_power:      balues for timing power register, for each OPP
+ * @timings:           DDR memory timings, from device tree
+ * @min_tck:           DDR memory minimum timing values, from device tree
+ * @bypass_timing_row: value for timing row register for bypass timings
+ * @bypass_timing_data:        value for timing data register for bypass timings
+ * @bypass_timing_power:       value for timing power register for bypass
+ *                             timings
+ * @vdd_mif:           Memory interface regulator
+ * @fout_spll:         clock: SPLL
+ * @fout_bpll:         clock: BPLL
+ * @mout_spll:         clock: mux SPLL
+ * @mout_bpll:         clock: mux BPLL
+ * @mout_mclk_cdrex:   clock: mux mclk_cdrex
+ * @mout_mx_mspll_ccore:       clock: mux mx_mspll_ccore
+ * @counter:           devfreq events
+ * @num_counters:      number of 'counter' elements
+ * @last_overflow_ts:  time (in ns) of last overflow of each DREX
+ * @load:              utilization in percents
+ * @total:             total time between devfreq events
+ * @in_irq_mode:       whether running in interrupt mode (true)
+ *                     or polling (false)
  *
  * The main structure for the Dynamic Memory Controller which covers clocks,
  * memory regions, HW information, parameters and current operating mode.
@@ -119,12 +156,11 @@ struct exynos5_dmc {
        void __iomem *base_drexi0;
        void __iomem *base_drexi1;
        struct regmap *clk_regmap;
+       /* Protects curr_rate and frequency/voltage setting section */
        struct mutex lock;
        unsigned long curr_rate;
        unsigned long curr_volt;
-       unsigned long bypass_rate;
        struct dmc_opp_table *opp;
-       struct dmc_opp_table opp_bypass;
        int opp_count;
        u32 timings_arr_size;
        u32 *timing_row;
@@ -142,8 +178,6 @@ struct exynos5_dmc {
        struct clk *mout_bpll;
        struct clk *mout_mclk_cdrex;
        struct clk *mout_mx_mspll_ccore;
-       struct clk *mx_mspll_ccore_phy;
-       struct clk *mout_mx_mspll_ccore_phy;
        struct devfreq_event_dev **counter;
        int num_counters;
        u64 last_overflow_ts[2];
@@ -169,7 +203,7 @@ struct timing_reg {
        unsigned int val;
 };
 
-static const struct timing_reg timing_row[] = {
+static const struct timing_reg timing_row_reg_fields[] = {
        TIMING_FIELD("tRFC", 24, 31),
        TIMING_FIELD("tRRD", 20, 23),
        TIMING_FIELD("tRP", 16, 19),
@@ -178,7 +212,7 @@ static const struct timing_reg timing_row[] = {
        TIMING_FIELD("tRAS", 0, 5),
 };
 
-static const struct timing_reg timing_data[] = {
+static const struct timing_reg timing_data_reg_fields[] = {
        TIMING_FIELD("tWTR", 28, 31),
        TIMING_FIELD("tWR", 24, 27),
        TIMING_FIELD("tRTP", 20, 23),
@@ -189,7 +223,7 @@ static const struct timing_reg timing_data[] = {
        TIMING_FIELD("RL", 0, 3),
 };
 
-static const struct timing_reg timing_power[] = {
+static const struct timing_reg timing_power_reg_fields[] = {
        TIMING_FIELD("tFAW", 26, 31),
        TIMING_FIELD("tXSR", 16, 25),
        TIMING_FIELD("tXP", 8, 15),
@@ -197,8 +231,9 @@ static const struct timing_reg timing_power[] = {
        TIMING_FIELD("tMRD", 0, 3),
 };
 
-#define TIMING_COUNT (ARRAY_SIZE(timing_row) + ARRAY_SIZE(timing_data) + \
-                     ARRAY_SIZE(timing_power))
+#define TIMING_COUNT (ARRAY_SIZE(timing_row_reg_fields) + \
+                     ARRAY_SIZE(timing_data_reg_fields) + \
+                     ARRAY_SIZE(timing_power_reg_fields))
 
 static int exynos5_counters_set_event(struct exynos5_dmc *dmc)
 {
@@ -346,7 +381,6 @@ err_opp:
 /**
  * exynos5_set_bypass_dram_timings() - Low-level changes of the DRAM timings
  * @dmc:       device for which the new settings is going to be applied
- * @param:     DRAM parameters which passes timing data
  *
  * Low-level function for changing timings for DRAM memory clocking from
  * 'bypass' clock source (fixed frequency @400MHz).
@@ -453,9 +487,6 @@ static int exynos5_dmc_align_bypass_voltage(struct exynos5_dmc *dmc,
                                            unsigned long target_volt)
 {
        int ret = 0;
-       unsigned long bypass_volt = dmc->opp_bypass.volt_uv;
-
-       target_volt = max(bypass_volt, target_volt);
 
        if (dmc->curr_volt >= target_volt)
                return 0;
@@ -617,6 +648,7 @@ disable_clocks:
  *                     requested
  * @target_volt:       returned voltage which corresponds to the returned
  *                     frequency
+ * @flags:     devfreq flags provided for this frequency change request
  *
  * Function gets requested frequency and checks OPP framework for needed
  * frequency and voltage. It populates the values 'target_rate' and
@@ -908,7 +940,10 @@ static int exynos5_dmc_get_status(struct device *dev,
        int ret;
 
        if (dmc->in_irq_mode) {
+               mutex_lock(&dmc->lock);
                stat->current_frequency = dmc->curr_rate;
+               mutex_unlock(&dmc->lock);
+
                stat->busy_time = dmc->load;
                stat->total_time = dmc->total;
        } else {
@@ -950,7 +985,7 @@ static int exynos5_dmc_get_cur_freq(struct device *dev, unsigned long *freq)
        return 0;
 }
 
-/**
+/*
  * exynos5_dmc_df_profile - Devfreq governor's profile structure
  *
  * It provides to the devfreq framework needed functions and polling period.
@@ -993,7 +1028,9 @@ exynos5_dmc_align_init_freq(struct exynos5_dmc *dmc,
 /**
  * create_timings_aligned() - Create register values and align with standard
  * @dmc:       device for which the frequency is going to be set
- * @idx:       speed bin in the OPP table
+ * @reg_timing_row:    array to fill with values for timing row register
+ * @reg_timing_data:   array to fill with values for timing data register
+ * @reg_timing_power:  array to fill with values for timing power register
  * @clk_period_ps:     the period of the clock, known as tCK
  *
  * The function calculates timings and creates a register value ready for
@@ -1018,117 +1055,117 @@ static int create_timings_aligned(struct exynos5_dmc *dmc, u32 *reg_timing_row,
        val = dmc->timings->tRFC / clk_period_ps;
        val += dmc->timings->tRFC % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tRFC);
-       reg = &timing_row[0];
+       reg = &timing_row_reg_fields[0];
        *reg_timing_row |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tRRD / clk_period_ps;
        val += dmc->timings->tRRD % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tRRD);
-       reg = &timing_row[1];
+       reg = &timing_row_reg_fields[1];
        *reg_timing_row |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tRPab / clk_period_ps;
        val += dmc->timings->tRPab % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tRPab);
-       reg = &timing_row[2];
+       reg = &timing_row_reg_fields[2];
        *reg_timing_row |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tRCD / clk_period_ps;
        val += dmc->timings->tRCD % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tRCD);
-       reg = &timing_row[3];
+       reg = &timing_row_reg_fields[3];
        *reg_timing_row |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tRC / clk_period_ps;
        val += dmc->timings->tRC % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tRC);
-       reg = &timing_row[4];
+       reg = &timing_row_reg_fields[4];
        *reg_timing_row |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tRAS / clk_period_ps;
        val += dmc->timings->tRAS % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tRAS);
-       reg = &timing_row[5];
+       reg = &timing_row_reg_fields[5];
        *reg_timing_row |= TIMING_VAL2REG(reg, val);
 
        /* data related timings */
        val = dmc->timings->tWTR / clk_period_ps;
        val += dmc->timings->tWTR % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tWTR);
-       reg = &timing_data[0];
+       reg = &timing_data_reg_fields[0];
        *reg_timing_data |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tWR / clk_period_ps;
        val += dmc->timings->tWR % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tWR);
-       reg = &timing_data[1];
+       reg = &timing_data_reg_fields[1];
        *reg_timing_data |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tRTP / clk_period_ps;
        val += dmc->timings->tRTP % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tRTP);
-       reg = &timing_data[2];
+       reg = &timing_data_reg_fields[2];
        *reg_timing_data |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tW2W_C2C / clk_period_ps;
        val += dmc->timings->tW2W_C2C % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tW2W_C2C);
-       reg = &timing_data[3];
+       reg = &timing_data_reg_fields[3];
        *reg_timing_data |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tR2R_C2C / clk_period_ps;
        val += dmc->timings->tR2R_C2C % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tR2R_C2C);
-       reg = &timing_data[4];
+       reg = &timing_data_reg_fields[4];
        *reg_timing_data |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tWL / clk_period_ps;
        val += dmc->timings->tWL % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tWL);
-       reg = &timing_data[5];
+       reg = &timing_data_reg_fields[5];
        *reg_timing_data |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tDQSCK / clk_period_ps;
        val += dmc->timings->tDQSCK % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tDQSCK);
-       reg = &timing_data[6];
+       reg = &timing_data_reg_fields[6];
        *reg_timing_data |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tRL / clk_period_ps;
        val += dmc->timings->tRL % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tRL);
-       reg = &timing_data[7];
+       reg = &timing_data_reg_fields[7];
        *reg_timing_data |= TIMING_VAL2REG(reg, val);
 
        /* power related timings */
        val = dmc->timings->tFAW / clk_period_ps;
        val += dmc->timings->tFAW % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tFAW);
-       reg = &timing_power[0];
+       reg = &timing_power_reg_fields[0];
        *reg_timing_power |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tXSR / clk_period_ps;
        val += dmc->timings->tXSR % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tXSR);
-       reg = &timing_power[1];
+       reg = &timing_power_reg_fields[1];
        *reg_timing_power |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tXP / clk_period_ps;
        val += dmc->timings->tXP % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tXP);
-       reg = &timing_power[2];
+       reg = &timing_power_reg_fields[2];
        *reg_timing_power |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tCKE / clk_period_ps;
        val += dmc->timings->tCKE % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tCKE);
-       reg = &timing_power[3];
+       reg = &timing_power_reg_fields[3];
        *reg_timing_power |= TIMING_VAL2REG(reg, val);
 
        val = dmc->timings->tMRD / clk_period_ps;
        val += dmc->timings->tMRD % clk_period_ps ? 1 : 0;
        val = max(val, dmc->min_tck->tMRD);
-       reg = &timing_power[4];
+       reg = &timing_power_reg_fields[4];
        *reg_timing_power |= TIMING_VAL2REG(reg, val);
 
        return 0;
@@ -1263,8 +1300,6 @@ static int exynos5_dmc_init_clks(struct exynos5_dmc *dmc)
 
        clk_set_parent(dmc->mout_mx_mspll_ccore, dmc->mout_spll);
 
-       dmc->bypass_rate = clk_get_rate(dmc->mout_mx_mspll_ccore);
-
        clk_prepare_enable(dmc->fout_bpll);
        clk_prepare_enable(dmc->mout_bpll);
 
@@ -1332,7 +1367,6 @@ static int exynos5_performance_counters_init(struct exynos5_dmc *dmc)
 /**
  * exynos5_dmc_set_pause_on_switching() - Controls a pause feature in DMC
  * @dmc:       device which is used for changing this feature
- * @set:       a boolean state passing enable/disable request
  *
  * There is a need of pausing DREX DMC when divider or MUX in clock tree
  * changes its configuration. In such situation access to the memory is blocked
index ba5cb1f..76ace42 100644 (file)
@@ -1060,19 +1060,7 @@ static int tegra_emc_debug_available_rates_show(struct seq_file *s,
        return 0;
 }
 
-static int tegra_emc_debug_available_rates_open(struct inode *inode,
-                                               struct file *file)
-{
-       return single_open(file, tegra_emc_debug_available_rates_show,
-                          inode->i_private);
-}
-
-static const struct file_operations tegra_emc_debug_available_rates_fops = {
-       .open = tegra_emc_debug_available_rates_open,
-       .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(tegra_emc_debug_available_rates);
 
 static int tegra_emc_debug_min_rate_get(void *data, u64 *rate)
 {
index 493b5dc..0cede24 100644 (file)
@@ -957,7 +957,6 @@ static const struct tegra_smmu_swgroup tegra124_swgroups[] = {
 static const unsigned int tegra124_group_drm[] = {
        TEGRA_SWGROUP_DC,
        TEGRA_SWGROUP_DCB,
-       TEGRA_SWGROUP_GPU,
        TEGRA_SWGROUP_VIC,
 };
 
index 8478f59..fa8af17 100644 (file)
@@ -172,14 +172,8 @@ static int tegra186_emc_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        emc->bpmp = tegra_bpmp_get(&pdev->dev);
-       if (IS_ERR(emc->bpmp)) {
-               err = PTR_ERR(emc->bpmp);
-
-               if (err != -EPROBE_DEFER)
-                       dev_err(&pdev->dev, "failed to get BPMP: %d\n", err);
-
-               return err;
-       }
+       if (IS_ERR(emc->bpmp))
+               return dev_err_probe(&pdev->dev, PTR_ERR(emc->bpmp), "failed to get BPMP\n");
 
        emc->clk = devm_clk_get(&pdev->dev, "emc");
        if (IS_ERR(emc->clk)) {
index ff55a17..0ebfa8e 100644 (file)
@@ -501,7 +501,6 @@ static u32 tegra210_emc_r21021_periodic_compensation(struct tegra210_emc *emc)
                emc_cfg_o = emc_readl(emc, EMC_CFG);
                emc_cfg = emc_cfg_o & ~(EMC_CFG_DYN_SELF_REF |
                                        EMC_CFG_DRAM_ACPD |
-                                       EMC_CFG_DRAM_CLKSTOP_PD |
                                        EMC_CFG_DRAM_CLKSTOP_PD);
 
 
@@ -1044,7 +1043,7 @@ static void tegra210_emc_r21021_set_clock(struct tegra210_emc *emc, u32 clksrc)
                           !opt_cc_short_zcal && opt_short_zcal) {
                        value = (value & ~(EMC_ZCAL_WAIT_CNT_ZCAL_WAIT_CNT_MASK <<
                                           EMC_ZCAL_WAIT_CNT_ZCAL_WAIT_CNT_SHIFT)) |
-                               ((zq_wait_long & EMC_ZCAL_WAIT_CNT_ZCAL_WAIT_CNT_MASK) <<
+                               ((zq_wait_long & EMC_ZCAL_WAIT_CNT_ZCAL_WAIT_CNT_MASK) <<
                                                 EMC_MRS_WAIT_CNT_SHORT_WAIT_SHIFT);
                } else if (offset == EMC_ZCAL_INTERVAL && opt_zcal_en_cc) {
                        value = 0; /* EMC_ZCAL_INTERVAL reset value. */
index 7212d1d..7fb8b54 100644 (file)
@@ -842,7 +842,7 @@ static const struct tegra_mc_client tegra210_mc_clients[] = {
                },
                .la = {
                        .reg = 0x3dc,
-                       .shift = 0,
+                       .shift = 16,
                        .mask = 0xff,
                        .def = 0x80,
                },
index a5ef9fa..e7f0d4a 100644 (file)
@@ -1176,8 +1176,10 @@ mptscsih_remove(struct pci_dev *pdev)
        MPT_SCSI_HOST           *hd;
        int sz1;
 
-       if((hd = shost_priv(host)) == NULL)
-               return;
+       if (host == NULL)
+               hd = NULL;
+       else
+               hd = shost_priv(host);
 
        mptscsih_shutdown(pdev);
 
@@ -1193,14 +1195,15 @@ mptscsih_remove(struct pci_dev *pdev)
            "Free'd ScsiLookup (%d) memory\n",
            ioc->name, sz1));
 
-       kfree(hd->info_kbuf);
+       if (hd)
+               kfree(hd->info_kbuf);
 
        /* NULL the Scsi_Host pointer
         */
        ioc->sh = NULL;
 
-       scsi_host_put(host);
-
+       if (host)
+               scsi_host_put(host);
        mpt_detach(pdev);
 
 }
index d5ce808..fafa8b0 100644 (file)
@@ -474,7 +474,6 @@ source "drivers/misc/lis3lv02d/Kconfig"
 source "drivers/misc/altera-stapl/Kconfig"
 source "drivers/misc/mei/Kconfig"
 source "drivers/misc/vmw_vmci/Kconfig"
-source "drivers/misc/mic/Kconfig"
 source "drivers/misc/genwqe/Kconfig"
 source "drivers/misc/echo/Kconfig"
 source "drivers/misc/cxl/Kconfig"
index 2521359..d23231e 100644 (file)
@@ -46,7 +46,6 @@ obj-$(CONFIG_VMWARE_VMCI)     += vmw_vmci/
 obj-$(CONFIG_LATTICE_ECP3_CONFIG)      += lattice-ecp3-config.o
 obj-$(CONFIG_SRAM)             += sram.o
 obj-$(CONFIG_SRAM_EXEC)                += sram-exec.o
-obj-y                          += mic/
 obj-$(CONFIG_GENWQE)           += genwqe/
 obj-$(CONFIG_ECHO)             += echo/
 obj-$(CONFIG_CXL_BASE)         += cxl/
index 8bac86c..df2fb95 100644 (file)
@@ -224,7 +224,7 @@ struct mei_ext_hdr {
        u8 type;
        u8 length;
        u8 ext_payload[2];
-       u8 hdr[0];
+       u8 hdr[];
 };
 
 /**
@@ -238,7 +238,7 @@ struct mei_ext_meta_hdr {
        u8 count;
        u8 size;
        u8 reserved[2];
-       struct mei_ext_hdr hdrs[0];
+       struct mei_ext_hdr hdrs[];
 };
 
 /*
@@ -308,7 +308,7 @@ struct mei_msg_hdr {
        u32 dma_ring:1;
        u32 internal:1;
        u32 msg_complete:1;
-       u32 extension[0];
+       u32 extension[];
 } __packed;
 
 /* The length is up to 9 bits */
diff --git a/drivers/misc/mic/Kconfig b/drivers/misc/mic/Kconfig
deleted file mode 100644 (file)
index 8a7c2c5..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-menu "Intel MIC & related support"
-
-config INTEL_MIC_BUS
-       tristate "Intel MIC Bus Driver"
-       depends on 64BIT && PCI && X86
-       select DMA_OPS
-       help
-         This option is selected by any driver which registers a
-         device or driver on the MIC Bus, such as CONFIG_INTEL_MIC_HOST,
-         CONFIG_INTEL_MIC_CARD, CONFIG_INTEL_MIC_X100_DMA etc.
-
-         If you are building a host/card kernel with an Intel MIC device
-         then say M (recommended) or Y, else say N. If unsure say N.
-
-         More information about the Intel MIC family as well as the Linux
-         OS and tools for MIC to use with this driver are available from
-         <http://software.intel.com/en-us/mic-developer>.
-
-config SCIF_BUS
-       tristate "SCIF Bus Driver"
-       depends on 64BIT && PCI && X86
-       select DMA_OPS
-       help
-         This option is selected by any driver which registers a
-         device or driver on the SCIF Bus, such as CONFIG_INTEL_MIC_HOST
-         and CONFIG_INTEL_MIC_CARD.
-
-         If you are building a host/card kernel with an Intel MIC device
-         then say M (recommended) or Y, else say N. If unsure say N.
-
-         More information about the Intel MIC family as well as the Linux
-         OS and tools for MIC to use with this driver are available from
-         <http://software.intel.com/en-us/mic-developer>.
-
-config VOP_BUS
-       tristate "VOP Bus Driver"
-       depends on HAS_DMA
-       select DMA_OPS
-       help
-         This option is selected by any driver which registers a
-         device or driver on the VOP Bus, such as CONFIG_INTEL_MIC_HOST
-         and CONFIG_INTEL_MIC_CARD.
-
-         If you are building a host/card kernel with an Intel MIC device
-         then say M (recommended) or Y, else say N. If unsure say N.
-
-         More information about the Intel MIC family as well as the Linux
-         OS and tools for MIC to use with this driver are available from
-         <http://software.intel.com/en-us/mic-developer>.
-
-config INTEL_MIC_HOST
-       tristate "Intel MIC Host Driver"
-       depends on 64BIT && PCI && X86
-       depends on INTEL_MIC_BUS && SCIF_BUS && MIC_COSM && VOP_BUS
-       select DMA_OPS
-       help
-         This enables Host Driver support for the Intel Many Integrated
-         Core (MIC) family of PCIe form factor coprocessor devices that
-         run a 64 bit Linux OS. The driver manages card OS state and
-         enables communication between host and card. Intel MIC X100
-         devices are currently supported.
-
-         If you are building a host kernel with an Intel MIC device then
-         say M (recommended) or Y, else say N. If unsure say N.
-
-         More information about the Intel MIC family as well as the Linux
-         OS and tools for MIC to use with this driver are available from
-         <http://software.intel.com/en-us/mic-developer>.
-
-config INTEL_MIC_CARD
-       tristate "Intel MIC Card Driver"
-       depends on 64BIT && X86
-       depends on INTEL_MIC_BUS && SCIF_BUS && MIC_COSM && VOP_BUS
-       select VIRTIO
-       help
-         This enables card driver support for the Intel Many Integrated
-         Core (MIC) device family. The card driver communicates shutdown/
-         crash events to the host and allows registration/configuration of
-         virtio devices. Intel MIC X100 devices are currently supported.
-
-         If you are building a card kernel for an Intel MIC device then
-         say M (recommended) or Y, else say N. If unsure say N.
-
-         For more information see
-         <http://software.intel.com/en-us/mic-developer>.
-
-config SCIF
-       tristate "SCIF Driver"
-       depends on 64BIT && PCI && X86 && SCIF_BUS && IOMMU_SUPPORT
-       select IOMMU_IOVA
-       help
-         This enables SCIF Driver support for the Intel Many Integrated
-         Core (MIC) family of PCIe form factor coprocessor devices that
-         run a 64 bit Linux OS. The Symmetric Communication Interface
-         (SCIF (pronounced as skiff)) is a low level communications API
-         across PCIe currently implemented for MIC.
-
-         If you are building a host kernel with an Intel MIC device then
-         say M (recommended) or Y, else say N. If unsure say N.
-
-         More information about the Intel MIC family as well as the Linux
-         OS and tools for MIC to use with this driver are available from
-         <http://software.intel.com/en-us/mic-developer>.
-
-config MIC_COSM
-       tristate "Intel MIC Coprocessor State Management (COSM) Drivers"
-       depends on 64BIT && PCI && X86 && SCIF
-       help
-         This enables COSM driver support for the Intel Many
-         Integrated Core (MIC) family of PCIe form factor coprocessor
-         devices. COSM drivers implement functions such as boot,
-         shutdown, reset and reboot of MIC devices.
-
-         If you are building a host kernel with an Intel MIC device then
-         say M (recommended) or Y, else say N. If unsure say N.
-
-         More information about the Intel MIC family as well as the Linux
-         OS and tools for MIC to use with this driver are available from
-         <http://software.intel.com/en-us/mic-developer>.
-
-config VOP
-       tristate "VOP Driver"
-       depends on VOP_BUS
-       select VHOST_RING
-       select VIRTIO
-       help
-         This enables VOP (Virtio over PCIe) Driver support for the Intel
-         Many Integrated Core (MIC) family of PCIe form factor coprocessor
-         devices. The VOP driver allows virtio drivers, e.g. net, console
-         and block drivers, on the card connect to user space virtio
-         devices on the host.
-
-         If you are building a host kernel with an Intel MIC device then
-         say M (recommended) or Y, else say N. If unsure say N.
-
-         More information about the Intel MIC family as well as the Linux
-         OS and tools for MIC to use with this driver are available from
-         <http://software.intel.com/en-us/mic-developer>.
-
-endmenu
diff --git a/drivers/misc/mic/Makefile b/drivers/misc/mic/Makefile
deleted file mode 100644 (file)
index 1a43622..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Makefile - Intel MIC Linux driver.
-# Copyright(c) 2013, Intel Corporation.
-#
-obj-$(CONFIG_INTEL_MIC_HOST) += host/
-obj-$(CONFIG_INTEL_MIC_CARD) += card/
-obj-y += bus/
-obj-$(CONFIG_SCIF) += scif/
-obj-$(CONFIG_MIC_COSM) += cosm/
-obj-$(CONFIG_MIC_COSM) += cosm_client/
-obj-$(CONFIG_VOP) += vop/
diff --git a/drivers/misc/mic/bus/Makefile b/drivers/misc/mic/bus/Makefile
deleted file mode 100644 (file)
index 0a6aa21..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile - Intel MIC Linux driver.
-# Copyright(c) 2014, Intel Corporation.
-#
-obj-$(CONFIG_INTEL_MIC_BUS) += mic_bus.o
-obj-$(CONFIG_SCIF_BUS) += scif_bus.o
-obj-$(CONFIG_MIC_COSM) += cosm_bus.o
-obj-$(CONFIG_VOP_BUS) += vop_bus.o
diff --git a/drivers/misc/mic/bus/cosm_bus.c b/drivers/misc/mic/bus/cosm_bus.c
deleted file mode 100644 (file)
index 5f2141c..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel MIC COSM Bus Driver
- */
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/idr.h>
-#include "cosm_bus.h"
-
-/* Unique numbering for cosm devices. */
-static DEFINE_IDA(cosm_index_ida);
-
-static int cosm_dev_probe(struct device *d)
-{
-       struct cosm_device *dev = dev_to_cosm(d);
-       struct cosm_driver *drv = drv_to_cosm(dev->dev.driver);
-
-       return drv->probe(dev);
-}
-
-static int cosm_dev_remove(struct device *d)
-{
-       struct cosm_device *dev = dev_to_cosm(d);
-       struct cosm_driver *drv = drv_to_cosm(dev->dev.driver);
-
-       drv->remove(dev);
-       return 0;
-}
-
-static struct bus_type cosm_bus = {
-       .name  = "cosm_bus",
-       .probe = cosm_dev_probe,
-       .remove = cosm_dev_remove,
-};
-
-int cosm_register_driver(struct cosm_driver *driver)
-{
-       driver->driver.bus = &cosm_bus;
-       return driver_register(&driver->driver);
-}
-EXPORT_SYMBOL_GPL(cosm_register_driver);
-
-void cosm_unregister_driver(struct cosm_driver *driver)
-{
-       driver_unregister(&driver->driver);
-}
-EXPORT_SYMBOL_GPL(cosm_unregister_driver);
-
-static inline void cosm_release_dev(struct device *d)
-{
-       struct cosm_device *cdev = dev_to_cosm(d);
-
-       kfree(cdev);
-}
-
-struct cosm_device *
-cosm_register_device(struct device *pdev, struct cosm_hw_ops *hw_ops)
-{
-       struct cosm_device *cdev;
-       int ret;
-
-       cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
-       if (!cdev)
-               return ERR_PTR(-ENOMEM);
-
-       cdev->dev.parent = pdev;
-       cdev->dev.release = cosm_release_dev;
-       cdev->hw_ops = hw_ops;
-       dev_set_drvdata(&cdev->dev, cdev);
-       cdev->dev.bus = &cosm_bus;
-
-       /* Assign a unique device index and hence name */
-       ret = ida_simple_get(&cosm_index_ida, 0, 0, GFP_KERNEL);
-       if (ret < 0)
-               goto free_cdev;
-
-       cdev->index = ret;
-       cdev->dev.id = ret;
-       dev_set_name(&cdev->dev, "cosm-dev%u", cdev->index);
-
-       ret = device_register(&cdev->dev);
-       if (ret)
-               goto ida_remove;
-       return cdev;
-ida_remove:
-       ida_simple_remove(&cosm_index_ida, cdev->index);
-free_cdev:
-       put_device(&cdev->dev);
-       return ERR_PTR(ret);
-}
-EXPORT_SYMBOL_GPL(cosm_register_device);
-
-void cosm_unregister_device(struct cosm_device *dev)
-{
-       int index = dev->index; /* save for after device release */
-
-       device_unregister(&dev->dev);
-       ida_simple_remove(&cosm_index_ida, index);
-}
-EXPORT_SYMBOL_GPL(cosm_unregister_device);
-
-struct cosm_device *cosm_find_cdev_by_id(int id)
-{
-       struct device *dev = subsys_find_device_by_id(&cosm_bus, id, NULL);
-
-       return dev ? container_of(dev, struct cosm_device, dev) : NULL;
-}
-EXPORT_SYMBOL_GPL(cosm_find_cdev_by_id);
-
-static int __init cosm_init(void)
-{
-       return bus_register(&cosm_bus);
-}
-
-static void __exit cosm_exit(void)
-{
-       bus_unregister(&cosm_bus);
-       ida_destroy(&cosm_index_ida);
-}
-
-core_initcall(cosm_init);
-module_exit(cosm_exit);
-
-MODULE_AUTHOR("Intel Corporation");
-MODULE_DESCRIPTION("Intel(R) MIC card OS state management bus driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/misc/mic/bus/cosm_bus.h b/drivers/misc/mic/bus/cosm_bus.h
deleted file mode 100644 (file)
index d50d7ae..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel MIC COSM Bus Driver
- */
-#ifndef _COSM_BUS_H_
-#define _COSM_BUS_H_
-
-#include <linux/scif.h>
-#include <linux/mic_common.h>
-#include "../common/mic_dev.h"
-
-/**
- * cosm_device - representation of a cosm device
- *
- * @attr_group: Pointer to list of sysfs attribute groups.
- * @sdev: Device for sysfs entries.
- * @state: MIC state.
- * @prev_state: MIC state previous to MIC_RESETTING
- * @shutdown_status: MIC status reported by card for shutdown/crashes.
- * @shutdown_status_int: Internal shutdown status maintained by the driver
- * @cosm_mutex: Mutex for synchronizing access to data structures.
- * @reset_trigger_work: Work for triggering reset requests.
- * @scif_work: Work for handling per device SCIF connections
- * @cmdline: Kernel command line.
- * @firmware: Firmware file name.
- * @ramdisk: Ramdisk file name.
- * @bootmode: Boot mode i.e. "linux" or "elf" for flash updates.
- * @log_buf_addr: Log buffer address for MIC.
- * @log_buf_len: Log buffer length address for MIC.
- * @state_sysfs: Sysfs dirent for notifying ring 3 about MIC state changes.
- * @hw_ops: the hardware bus ops for this device.
- * @dev: underlying device.
- * @index: unique position on the cosm bus
- * @dbg_dir: debug fs directory
- * @newepd: new endpoint from scif accept to be assigned to this cdev
- * @epd: SCIF endpoint for this cdev
- * @heartbeat_watchdog_enable: if heartbeat watchdog is enabled for this cdev
- * @sysfs_heartbeat_enable: sysfs setting for disabling heartbeat notification
- */
-struct cosm_device {
-       const struct attribute_group **attr_group;
-       struct device *sdev;
-       u8 state;
-       u8 prev_state;
-       u8 shutdown_status;
-       u8 shutdown_status_int;
-       struct mutex cosm_mutex;
-       struct work_struct reset_trigger_work;
-       struct work_struct scif_work;
-       char *cmdline;
-       char *firmware;
-       char *ramdisk;
-       char *bootmode;
-       void *log_buf_addr;
-       int *log_buf_len;
-       struct kernfs_node *state_sysfs;
-       struct cosm_hw_ops *hw_ops;
-       struct device dev;
-       int index;
-       struct dentry *dbg_dir;
-       scif_epd_t newepd;
-       scif_epd_t epd;
-       bool heartbeat_watchdog_enable;
-       bool sysfs_heartbeat_enable;
-};
-
-/**
- * cosm_driver - operations for a cosm driver
- *
- * @driver: underlying device driver (populate name and owner).
- * @probe: the function to call when a device is found.  Returns 0 or -errno.
- * @remove: the function to call when a device is removed.
- */
-struct cosm_driver {
-       struct device_driver driver;
-       int (*probe)(struct cosm_device *dev);
-       void (*remove)(struct cosm_device *dev);
-};
-
-/**
- * cosm_hw_ops - cosm bus ops
- *
- * @reset: trigger MIC reset
- * @force_reset: force MIC reset
- * @post_reset: inform MIC reset is complete
- * @ready: is MIC ready for OS download
- * @start: boot MIC
- * @stop: prepare MIC for reset
- * @family: return MIC HW family string
- * @stepping: return MIC HW stepping string
- * @aper: return MIC PCIe aperture
- */
-struct cosm_hw_ops {
-       void (*reset)(struct cosm_device *cdev);
-       void (*force_reset)(struct cosm_device *cdev);
-       void (*post_reset)(struct cosm_device *cdev, enum mic_states state);
-       bool (*ready)(struct cosm_device *cdev);
-       int (*start)(struct cosm_device *cdev, int id);
-       void (*stop)(struct cosm_device *cdev, bool force);
-       ssize_t (*family)(struct cosm_device *cdev, char *buf);
-       ssize_t (*stepping)(struct cosm_device *cdev, char *buf);
-       struct mic_mw *(*aper)(struct cosm_device *cdev);
-};
-
-struct cosm_device *
-cosm_register_device(struct device *pdev, struct cosm_hw_ops *hw_ops);
-void cosm_unregister_device(struct cosm_device *dev);
-int cosm_register_driver(struct cosm_driver *drv);
-void cosm_unregister_driver(struct cosm_driver *drv);
-struct cosm_device *cosm_find_cdev_by_id(int id);
-
-static inline struct cosm_device *dev_to_cosm(struct device *dev)
-{
-       return container_of(dev, struct cosm_device, dev);
-}
-
-static inline struct cosm_driver *drv_to_cosm(struct device_driver *drv)
-{
-       return container_of(drv, struct cosm_driver, driver);
-}
-#endif /* _COSM_BUS_H */
diff --git a/drivers/misc/mic/bus/mic_bus.c b/drivers/misc/mic/bus/mic_bus.c
deleted file mode 100644 (file)
index a08cb29..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel MIC Bus driver.
- *
- * This implementation is very similar to the the virtio bus driver
- * implementation @ drivers/virtio/virtio.c
- */
-#include <linux/dma-map-ops.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/idr.h>
-#include <linux/mic_bus.h>
-
-static ssize_t device_show(struct device *d,
-                          struct device_attribute *attr, char *buf)
-{
-       struct mbus_device *dev = dev_to_mbus(d);
-       return sprintf(buf, "0x%04x\n", dev->id.device);
-}
-static DEVICE_ATTR_RO(device);
-
-static ssize_t vendor_show(struct device *d,
-                          struct device_attribute *attr, char *buf)
-{
-       struct mbus_device *dev = dev_to_mbus(d);
-       return sprintf(buf, "0x%04x\n", dev->id.vendor);
-}
-static DEVICE_ATTR_RO(vendor);
-
-static ssize_t modalias_show(struct device *d,
-                            struct device_attribute *attr, char *buf)
-{
-       struct mbus_device *dev = dev_to_mbus(d);
-       return sprintf(buf, "mbus:d%08Xv%08X\n",
-                      dev->id.device, dev->id.vendor);
-}
-static DEVICE_ATTR_RO(modalias);
-
-static struct attribute *mbus_dev_attrs[] = {
-       &dev_attr_device.attr,
-       &dev_attr_vendor.attr,
-       &dev_attr_modalias.attr,
-       NULL,
-};
-ATTRIBUTE_GROUPS(mbus_dev);
-
-static inline int mbus_id_match(const struct mbus_device *dev,
-                               const struct mbus_device_id *id)
-{
-       if (id->device != dev->id.device && id->device != MBUS_DEV_ANY_ID)
-               return 0;
-
-       return id->vendor == MBUS_DEV_ANY_ID || id->vendor == dev->id.vendor;
-}
-
-/*
- * This looks through all the IDs a driver claims to support.  If any of them
- * match, we return 1 and the kernel will call mbus_dev_probe().
- */
-static int mbus_dev_match(struct device *dv, struct device_driver *dr)
-{
-       unsigned int i;
-       struct mbus_device *dev = dev_to_mbus(dv);
-       const struct mbus_device_id *ids;
-
-       ids = drv_to_mbus(dr)->id_table;
-       for (i = 0; ids[i].device; i++)
-               if (mbus_id_match(dev, &ids[i]))
-                       return 1;
-       return 0;
-}
-
-static int mbus_uevent(struct device *dv, struct kobj_uevent_env *env)
-{
-       struct mbus_device *dev = dev_to_mbus(dv);
-
-       return add_uevent_var(env, "MODALIAS=mbus:d%08Xv%08X",
-                             dev->id.device, dev->id.vendor);
-}
-
-static int mbus_dev_probe(struct device *d)
-{
-       int err;
-       struct mbus_device *dev = dev_to_mbus(d);
-       struct mbus_driver *drv = drv_to_mbus(dev->dev.driver);
-
-       err = drv->probe(dev);
-       if (!err)
-               if (drv->scan)
-                       drv->scan(dev);
-       return err;
-}
-
-static int mbus_dev_remove(struct device *d)
-{
-       struct mbus_device *dev = dev_to_mbus(d);
-       struct mbus_driver *drv = drv_to_mbus(dev->dev.driver);
-
-       drv->remove(dev);
-       return 0;
-}
-
-static struct bus_type mic_bus = {
-       .name  = "mic_bus",
-       .match = mbus_dev_match,
-       .dev_groups = mbus_dev_groups,
-       .uevent = mbus_uevent,
-       .probe = mbus_dev_probe,
-       .remove = mbus_dev_remove,
-};
-
-int mbus_register_driver(struct mbus_driver *driver)
-{
-       driver->driver.bus = &mic_bus;
-       return driver_register(&driver->driver);
-}
-EXPORT_SYMBOL_GPL(mbus_register_driver);
-
-void mbus_unregister_driver(struct mbus_driver *driver)
-{
-       driver_unregister(&driver->driver);
-}
-EXPORT_SYMBOL_GPL(mbus_unregister_driver);
-
-static void mbus_release_dev(struct device *d)
-{
-       struct mbus_device *mbdev = dev_to_mbus(d);
-       kfree(mbdev);
-}
-
-struct mbus_device *
-mbus_register_device(struct device *pdev, int id, const struct dma_map_ops *dma_ops,
-                    struct mbus_hw_ops *hw_ops, int index,
-                    void __iomem *mmio_va)
-{
-       int ret;
-       struct mbus_device *mbdev;
-
-       mbdev = kzalloc(sizeof(*mbdev), GFP_KERNEL);
-       if (!mbdev)
-               return ERR_PTR(-ENOMEM);
-
-       mbdev->mmio_va = mmio_va;
-       mbdev->dev.parent = pdev;
-       mbdev->id.device = id;
-       mbdev->id.vendor = MBUS_DEV_ANY_ID;
-       mbdev->dev.dma_ops = dma_ops;
-       mbdev->dev.dma_mask = &mbdev->dev.coherent_dma_mask;
-       dma_set_mask(&mbdev->dev, DMA_BIT_MASK(64));
-       mbdev->dev.release = mbus_release_dev;
-       mbdev->hw_ops = hw_ops;
-       mbdev->dev.bus = &mic_bus;
-       mbdev->index = index;
-       dev_set_name(&mbdev->dev, "mbus-dev%u", mbdev->index);
-       /*
-        * device_register() causes the bus infrastructure to look for a
-        * matching driver.
-        */
-       ret = device_register(&mbdev->dev);
-       if (ret)
-               goto free_mbdev;
-       return mbdev;
-free_mbdev:
-       put_device(&mbdev->dev);
-       return ERR_PTR(ret);
-}
-EXPORT_SYMBOL_GPL(mbus_register_device);
-
-void mbus_unregister_device(struct mbus_device *mbdev)
-{
-       device_unregister(&mbdev->dev);
-}
-EXPORT_SYMBOL_GPL(mbus_unregister_device);
-
-static int __init mbus_init(void)
-{
-       return bus_register(&mic_bus);
-}
-
-static void __exit mbus_exit(void)
-{
-       bus_unregister(&mic_bus);
-}
-
-core_initcall(mbus_init);
-module_exit(mbus_exit);
-
-MODULE_AUTHOR("Intel Corporation");
-MODULE_DESCRIPTION("Intel(R) MIC Bus driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/misc/mic/bus/scif_bus.c b/drivers/misc/mic/bus/scif_bus.c
deleted file mode 100644 (file)
index ad7c360..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel Symmetric Communications Interface Bus driver.
- */
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/idr.h>
-#include <linux/dma-map-ops.h>
-
-#include "scif_bus.h"
-
-static ssize_t device_show(struct device *d,
-                          struct device_attribute *attr, char *buf)
-{
-       struct scif_hw_dev *dev = dev_to_scif(d);
-
-       return sprintf(buf, "0x%04x\n", dev->id.device);
-}
-static DEVICE_ATTR_RO(device);
-
-static ssize_t vendor_show(struct device *d,
-                          struct device_attribute *attr, char *buf)
-{
-       struct scif_hw_dev *dev = dev_to_scif(d);
-
-       return sprintf(buf, "0x%04x\n", dev->id.vendor);
-}
-static DEVICE_ATTR_RO(vendor);
-
-static ssize_t modalias_show(struct device *d,
-                            struct device_attribute *attr, char *buf)
-{
-       struct scif_hw_dev *dev = dev_to_scif(d);
-
-       return sprintf(buf, "scif:d%08Xv%08X\n",
-                      dev->id.device, dev->id.vendor);
-}
-static DEVICE_ATTR_RO(modalias);
-
-static struct attribute *scif_dev_attrs[] = {
-       &dev_attr_device.attr,
-       &dev_attr_vendor.attr,
-       &dev_attr_modalias.attr,
-       NULL,
-};
-ATTRIBUTE_GROUPS(scif_dev);
-
-static inline int scif_id_match(const struct scif_hw_dev *dev,
-                               const struct scif_hw_dev_id *id)
-{
-       if (id->device != dev->id.device && id->device != SCIF_DEV_ANY_ID)
-               return 0;
-
-       return id->vendor == SCIF_DEV_ANY_ID || id->vendor == dev->id.vendor;
-}
-
-/*
- * This looks through all the IDs a driver claims to support.  If any of them
- * match, we return 1 and the kernel will call scif_dev_probe().
- */
-static int scif_dev_match(struct device *dv, struct device_driver *dr)
-{
-       unsigned int i;
-       struct scif_hw_dev *dev = dev_to_scif(dv);
-       const struct scif_hw_dev_id *ids;
-
-       ids = drv_to_scif(dr)->id_table;
-       for (i = 0; ids[i].device; i++)
-               if (scif_id_match(dev, &ids[i]))
-                       return 1;
-       return 0;
-}
-
-static int scif_uevent(struct device *dv, struct kobj_uevent_env *env)
-{
-       struct scif_hw_dev *dev = dev_to_scif(dv);
-
-       return add_uevent_var(env, "MODALIAS=scif:d%08Xv%08X",
-                             dev->id.device, dev->id.vendor);
-}
-
-static int scif_dev_probe(struct device *d)
-{
-       struct scif_hw_dev *dev = dev_to_scif(d);
-       struct scif_driver *drv = drv_to_scif(dev->dev.driver);
-
-       return drv->probe(dev);
-}
-
-static int scif_dev_remove(struct device *d)
-{
-       struct scif_hw_dev *dev = dev_to_scif(d);
-       struct scif_driver *drv = drv_to_scif(dev->dev.driver);
-
-       drv->remove(dev);
-       return 0;
-}
-
-static struct bus_type scif_bus = {
-       .name  = "scif_bus",
-       .match = scif_dev_match,
-       .dev_groups = scif_dev_groups,
-       .uevent = scif_uevent,
-       .probe = scif_dev_probe,
-       .remove = scif_dev_remove,
-};
-
-int scif_register_driver(struct scif_driver *driver)
-{
-       driver->driver.bus = &scif_bus;
-       return driver_register(&driver->driver);
-}
-EXPORT_SYMBOL_GPL(scif_register_driver);
-
-void scif_unregister_driver(struct scif_driver *driver)
-{
-       driver_unregister(&driver->driver);
-}
-EXPORT_SYMBOL_GPL(scif_unregister_driver);
-
-static void scif_release_dev(struct device *d)
-{
-       struct scif_hw_dev *sdev = dev_to_scif(d);
-
-       kfree(sdev);
-}
-
-struct scif_hw_dev *
-scif_register_device(struct device *pdev, int id, const struct dma_map_ops *dma_ops,
-                    struct scif_hw_ops *hw_ops, u8 dnode, u8 snode,
-                    struct mic_mw *mmio, struct mic_mw *aper, void *dp,
-                    void __iomem *rdp, struct dma_chan **chan, int num_chan,
-                    bool card_rel_da)
-{
-       int ret;
-       struct scif_hw_dev *sdev;
-
-       sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
-       if (!sdev)
-               return ERR_PTR(-ENOMEM);
-
-       sdev->dev.parent = pdev;
-       sdev->id.device = id;
-       sdev->id.vendor = SCIF_DEV_ANY_ID;
-       sdev->dev.dma_ops = dma_ops;
-       sdev->dev.release = scif_release_dev;
-       sdev->hw_ops = hw_ops;
-       sdev->dnode = dnode;
-       sdev->snode = snode;
-       dev_set_drvdata(&sdev->dev, sdev);
-       sdev->dev.bus = &scif_bus;
-       sdev->mmio = mmio;
-       sdev->aper = aper;
-       sdev->dp = dp;
-       sdev->rdp = rdp;
-       sdev->dev.dma_mask = &sdev->dev.coherent_dma_mask;
-       dma_set_mask(&sdev->dev, DMA_BIT_MASK(64));
-       sdev->dma_ch = chan;
-       sdev->num_dma_ch = num_chan;
-       sdev->card_rel_da = card_rel_da;
-       dev_set_name(&sdev->dev, "scif-dev%u", sdev->dnode);
-       /*
-        * device_register() causes the bus infrastructure to look for a
-        * matching driver.
-        */
-       ret = device_register(&sdev->dev);
-       if (ret)
-               goto free_sdev;
-       return sdev;
-free_sdev:
-       put_device(&sdev->dev);
-       return ERR_PTR(ret);
-}
-EXPORT_SYMBOL_GPL(scif_register_device);
-
-void scif_unregister_device(struct scif_hw_dev *sdev)
-{
-       device_unregister(&sdev->dev);
-}
-EXPORT_SYMBOL_GPL(scif_unregister_device);
-
-static int __init scif_init(void)
-{
-       return bus_register(&scif_bus);
-}
-
-static void __exit scif_exit(void)
-{
-       bus_unregister(&scif_bus);
-}
-
-core_initcall(scif_init);
-module_exit(scif_exit);
-
-MODULE_AUTHOR("Intel Corporation");
-MODULE_DESCRIPTION("Intel(R) SCIF Bus driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/misc/mic/bus/scif_bus.h b/drivers/misc/mic/bus/scif_bus.h
deleted file mode 100644 (file)
index 4981eb5..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel Symmetric Communications Interface Bus driver.
- */
-#ifndef _SCIF_BUS_H_
-#define _SCIF_BUS_H_
-/*
- * Everything a scif driver needs to work with any particular scif
- * hardware abstraction layer.
- */
-#include <linux/dma-map-ops.h>
-
-#include <linux/mic_common.h>
-#include "../common/mic_dev.h"
-
-struct scif_hw_dev_id {
-       u32 device;
-       u32 vendor;
-};
-
-#define MIC_SCIF_DEV 1
-#define SCIF_DEV_ANY_ID 0xffffffff
-
-/**
- * scif_hw_dev - representation of a hardware device abstracted for scif
- * @hw_ops: the hardware ops supported by this device
- * @id: the device type identification (used to match it with a driver)
- * @mmio: MMIO memory window
- * @aper: Aperture memory window
- * @dev: underlying device
- * @dnode - The destination node which this device will communicate with.
- * @snode - The source node for this device.
- * @dp - Self device page
- * @rdp - Remote device page
- * @dma_ch - Array of DMA channels
- * @num_dma_ch - Number of DMA channels available
- * @card_rel_da - Set to true if DMA addresses programmed in the DMA engine
- *             are relative to the card point of view
- */
-struct scif_hw_dev {
-       struct scif_hw_ops *hw_ops;
-       struct scif_hw_dev_id id;
-       struct mic_mw *mmio;
-       struct mic_mw *aper;
-       struct device dev;
-       u8 dnode;
-       u8 snode;
-       void *dp;
-       void __iomem *rdp;
-       struct dma_chan **dma_ch;
-       int num_dma_ch;
-       bool card_rel_da;
-};
-
-/**
- * scif_driver - operations for a scif I/O driver
- * @driver: underlying device driver (populate name and owner).
- * @id_table: the ids serviced by this driver.
- * @probe: the function to call when a device is found.  Returns 0 or -errno.
- * @remove: the function to call when a device is removed.
- */
-struct scif_driver {
-       struct device_driver driver;
-       const struct scif_hw_dev_id *id_table;
-       int (*probe)(struct scif_hw_dev *dev);
-       void (*remove)(struct scif_hw_dev *dev);
-};
-
-/**
- * scif_hw_ops - Hardware operations for accessing a SCIF device on the SCIF bus.
- *
- * @next_db: Obtain the next available doorbell.
- * @request_irq: Request an interrupt on a particular doorbell.
- * @free_irq: Free an interrupt requested previously.
- * @ack_interrupt: acknowledge an interrupt in the ISR.
- * @send_intr: Send an interrupt to the remote node on a specified doorbell.
- * @send_p2p_intr: Send an interrupt to the peer node on a specified doorbell
- * which is specifically targeted for a peer to peer node.
- * @remap: Map a buffer with the specified physical address and length.
- * @unmap: Unmap a buffer previously mapped.
- */
-struct scif_hw_ops {
-       int (*next_db)(struct scif_hw_dev *sdev);
-       struct mic_irq * (*request_irq)(struct scif_hw_dev *sdev,
-                                       irqreturn_t (*func)(int irq,
-                                                           void *data),
-                                       const char *name, void *data,
-                                       int db);
-       void (*free_irq)(struct scif_hw_dev *sdev,
-                        struct mic_irq *cookie, void *data);
-       void (*ack_interrupt)(struct scif_hw_dev *sdev, int num);
-       void (*send_intr)(struct scif_hw_dev *sdev, int db);
-       void (*send_p2p_intr)(struct scif_hw_dev *sdev, int db,
-                             struct mic_mw *mw);
-       void __iomem * (*remap)(struct scif_hw_dev *sdev,
-                                 phys_addr_t pa, size_t len);
-       void (*unmap)(struct scif_hw_dev *sdev, void __iomem *va);
-};
-
-int scif_register_driver(struct scif_driver *driver);
-void scif_unregister_driver(struct scif_driver *driver);
-struct scif_hw_dev *
-scif_register_device(struct device *pdev, int id,
-                    const struct dma_map_ops *dma_ops,
-                    struct scif_hw_ops *hw_ops, u8 dnode, u8 snode,
-                    struct mic_mw *mmio, struct mic_mw *aper,
-                    void *dp, void __iomem *rdp,
-                    struct dma_chan **chan, int num_chan,
-                    bool card_rel_da);
-void scif_unregister_device(struct scif_hw_dev *sdev);
-
-static inline struct scif_hw_dev *dev_to_scif(struct device *dev)
-{
-       return container_of(dev, struct scif_hw_dev, dev);
-}
-
-static inline struct scif_driver *drv_to_scif(struct device_driver *drv)
-{
-       return container_of(drv, struct scif_driver, driver);
-}
-#endif /* _SCIF_BUS_H */
diff --git a/drivers/misc/mic/bus/vop_bus.c b/drivers/misc/mic/bus/vop_bus.c
deleted file mode 100644 (file)
index 6935ddc..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2016 Intel Corporation.
- *
- * Intel Virtio Over PCIe (VOP) Bus driver.
- */
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/idr.h>
-#include <linux/dma-map-ops.h>
-
-#include "vop_bus.h"
-
-static ssize_t device_show(struct device *d,
-                          struct device_attribute *attr, char *buf)
-{
-       struct vop_device *dev = dev_to_vop(d);
-
-       return sprintf(buf, "0x%04x\n", dev->id.device);
-}
-static DEVICE_ATTR_RO(device);
-
-static ssize_t vendor_show(struct device *d,
-                          struct device_attribute *attr, char *buf)
-{
-       struct vop_device *dev = dev_to_vop(d);
-
-       return sprintf(buf, "0x%04x\n", dev->id.vendor);
-}
-static DEVICE_ATTR_RO(vendor);
-
-static ssize_t modalias_show(struct device *d,
-                            struct device_attribute *attr, char *buf)
-{
-       struct vop_device *dev = dev_to_vop(d);
-
-       return sprintf(buf, "vop:d%08Xv%08X\n",
-                      dev->id.device, dev->id.vendor);
-}
-static DEVICE_ATTR_RO(modalias);
-
-static struct attribute *vop_dev_attrs[] = {
-       &dev_attr_device.attr,
-       &dev_attr_vendor.attr,
-       &dev_attr_modalias.attr,
-       NULL,
-};
-ATTRIBUTE_GROUPS(vop_dev);
-
-static inline int vop_id_match(const struct vop_device *dev,
-                              const struct vop_device_id *id)
-{
-       if (id->device != dev->id.device && id->device != VOP_DEV_ANY_ID)
-               return 0;
-
-       return id->vendor == VOP_DEV_ANY_ID || id->vendor == dev->id.vendor;
-}
-
-/*
- * This looks through all the IDs a driver claims to support.  If any of them
- * match, we return 1 and the kernel will call vop_dev_probe().
- */
-static int vop_dev_match(struct device *dv, struct device_driver *dr)
-{
-       unsigned int i;
-       struct vop_device *dev = dev_to_vop(dv);
-       const struct vop_device_id *ids;
-
-       ids = drv_to_vop(dr)->id_table;
-       for (i = 0; ids[i].device; i++)
-               if (vop_id_match(dev, &ids[i]))
-                       return 1;
-       return 0;
-}
-
-static int vop_uevent(struct device *dv, struct kobj_uevent_env *env)
-{
-       struct vop_device *dev = dev_to_vop(dv);
-
-       return add_uevent_var(env, "MODALIAS=vop:d%08Xv%08X",
-                             dev->id.device, dev->id.vendor);
-}
-
-static int vop_dev_probe(struct device *d)
-{
-       struct vop_device *dev = dev_to_vop(d);
-       struct vop_driver *drv = drv_to_vop(dev->dev.driver);
-
-       return drv->probe(dev);
-}
-
-static int vop_dev_remove(struct device *d)
-{
-       struct vop_device *dev = dev_to_vop(d);
-       struct vop_driver *drv = drv_to_vop(dev->dev.driver);
-
-       drv->remove(dev);
-       return 0;
-}
-
-static struct bus_type vop_bus = {
-       .name  = "vop_bus",
-       .match = vop_dev_match,
-       .dev_groups = vop_dev_groups,
-       .uevent = vop_uevent,
-       .probe = vop_dev_probe,
-       .remove = vop_dev_remove,
-};
-
-int vop_register_driver(struct vop_driver *driver)
-{
-       driver->driver.bus = &vop_bus;
-       return driver_register(&driver->driver);
-}
-EXPORT_SYMBOL_GPL(vop_register_driver);
-
-void vop_unregister_driver(struct vop_driver *driver)
-{
-       driver_unregister(&driver->driver);
-}
-EXPORT_SYMBOL_GPL(vop_unregister_driver);
-
-static void vop_release_dev(struct device *d)
-{
-       struct vop_device *dev = dev_to_vop(d);
-
-       kfree(dev);
-}
-
-struct vop_device *
-vop_register_device(struct device *pdev, int id,
-                   const struct dma_map_ops *dma_ops,
-                   struct vop_hw_ops *hw_ops, u8 dnode, struct mic_mw *aper,
-                   struct dma_chan *chan)
-{
-       int ret;
-       struct vop_device *vdev;
-
-       vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
-       if (!vdev)
-               return ERR_PTR(-ENOMEM);
-
-       vdev->dev.parent = pdev;
-       vdev->id.device = id;
-       vdev->id.vendor = VOP_DEV_ANY_ID;
-       vdev->dev.dma_ops = dma_ops;
-       vdev->dev.dma_mask = &vdev->dev.coherent_dma_mask;
-       dma_set_mask(&vdev->dev, DMA_BIT_MASK(64));
-       vdev->dev.release = vop_release_dev;
-       vdev->hw_ops = hw_ops;
-       vdev->dev.bus = &vop_bus;
-       vdev->dnode = dnode;
-       vdev->aper = aper;
-       vdev->dma_ch = chan;
-       vdev->index = dnode - 1;
-       dev_set_name(&vdev->dev, "vop-dev%u", vdev->index);
-       /*
-        * device_register() causes the bus infrastructure to look for a
-        * matching driver.
-        */
-       ret = device_register(&vdev->dev);
-       if (ret)
-               goto free_vdev;
-       return vdev;
-free_vdev:
-       put_device(&vdev->dev);
-       return ERR_PTR(ret);
-}
-EXPORT_SYMBOL_GPL(vop_register_device);
-
-void vop_unregister_device(struct vop_device *dev)
-{
-       device_unregister(&dev->dev);
-}
-EXPORT_SYMBOL_GPL(vop_unregister_device);
-
-static int __init vop_init(void)
-{
-       return bus_register(&vop_bus);
-}
-
-static void __exit vop_exit(void)
-{
-       bus_unregister(&vop_bus);
-}
-
-core_initcall(vop_init);
-module_exit(vop_exit);
-
-MODULE_AUTHOR("Intel Corporation");
-MODULE_DESCRIPTION("Intel(R) VOP Bus driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/misc/mic/bus/vop_bus.h b/drivers/misc/mic/bus/vop_bus.h
deleted file mode 100644 (file)
index 4fa0280..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2016 Intel Corporation.
- *
- * Intel Virtio over PCIe Bus driver.
- */
-#ifndef _VOP_BUS_H_
-#define _VOP_BUS_H_
-/*
- * Everything a vop driver needs to work with any particular vop
- * implementation.
- */
-#include <linux/dmaengine.h>
-#include <linux/interrupt.h>
-
-#include "../common/mic_dev.h"
-
-struct vop_device_id {
-       u32 device;
-       u32 vendor;
-};
-
-#define VOP_DEV_TRNSP 1
-#define VOP_DEV_ANY_ID 0xffffffff
-/*
- * Size of the internal buffer used during DMA's as an intermediate buffer
- * for copy to/from user. Must be an integral number of pages.
- */
-#define VOP_INT_DMA_BUF_SIZE PAGE_ALIGN(64 * 1024ULL)
-
-/**
- * vop_device - representation of a device using vop
- * @hw_ops: the hardware ops supported by this device.
- * @id: the device type identification (used to match it with a driver).
- * @dev: underlying device.
- * @dnode - The destination node which this device will communicate with.
- * @aper: Aperture memory window
- * @dma_ch - DMA channel
- * @index: unique position on the vop bus
- */
-struct vop_device {
-       struct vop_hw_ops *hw_ops;
-       struct vop_device_id id;
-       struct device dev;
-       u8 dnode;
-       struct mic_mw *aper;
-       struct dma_chan *dma_ch;
-       int index;
-};
-
-/**
- * vop_driver - operations for a vop I/O driver
- * @driver: underlying device driver (populate name and owner).
- * @id_table: the ids serviced by this driver.
- * @probe: the function to call when a device is found.  Returns 0 or -errno.
- * @remove: the function to call when a device is removed.
- */
-struct vop_driver {
-       struct device_driver driver;
-       const struct vop_device_id *id_table;
-       int (*probe)(struct vop_device *dev);
-       void (*remove)(struct vop_device *dev);
-};
-
-/**
- * vop_hw_ops - Hardware operations for accessing a VOP device on the VOP bus.
- *
- * @next_db: Obtain the next available doorbell.
- * @request_irq: Request an interrupt on a particular doorbell.
- * @free_irq: Free an interrupt requested previously.
- * @ack_interrupt: acknowledge an interrupt in the ISR.
- * @get_remote_dp: Get access to the virtio device page used by the remote
- *                 node to add/remove/configure virtio devices.
- * @get_dp: Get access to the virtio device page used by the self
- *          node to add/remove/configure virtio devices.
- * @send_intr: Send an interrupt to the peer node on a specified doorbell.
- * @remap: Map a buffer with the specified DMA address and length.
- * @unmap: Unmap a buffer previously mapped.
- * @dma_filter: The DMA filter function to use for obtaining access to
- *             a DMA channel on the peer node.
- */
-struct vop_hw_ops {
-       int (*next_db)(struct vop_device *vpdev);
-       struct mic_irq *(*request_irq)(struct vop_device *vpdev,
-                                      irqreturn_t (*func)(int irq, void *data),
-                                      const char *name, void *data,
-                                      int intr_src);
-       void (*free_irq)(struct vop_device *vpdev,
-                        struct mic_irq *cookie, void *data);
-       void (*ack_interrupt)(struct vop_device *vpdev, int num);
-       void __iomem * (*get_remote_dp)(struct vop_device *vpdev);
-       void * (*get_dp)(struct vop_device *vpdev);
-       void (*send_intr)(struct vop_device *vpdev, int db);
-       void __iomem * (*remap)(struct vop_device *vpdev,
-                                 dma_addr_t pa, size_t len);
-       void (*unmap)(struct vop_device *vpdev, void __iomem *va);
-};
-
-struct vop_device *
-vop_register_device(struct device *pdev, int id,
-                   const struct dma_map_ops *dma_ops,
-                   struct vop_hw_ops *hw_ops, u8 dnode, struct mic_mw *aper,
-                   struct dma_chan *chan);
-void vop_unregister_device(struct vop_device *dev);
-int vop_register_driver(struct vop_driver *drv);
-void vop_unregister_driver(struct vop_driver *drv);
-
-/*
- * module_vop_driver() - Helper macro for drivers that don't do
- * anything special in module init/exit.  This eliminates a lot of
- * boilerplate.  Each module may only use this macro once, and
- * calling it replaces module_init() and module_exit()
- */
-#define module_vop_driver(__vop_driver) \
-       module_driver(__vop_driver, vop_register_driver, \
-                       vop_unregister_driver)
-
-static inline struct vop_device *dev_to_vop(struct device *dev)
-{
-       return container_of(dev, struct vop_device, dev);
-}
-
-static inline struct vop_driver *drv_to_vop(struct device_driver *drv)
-{
-       return container_of(drv, struct vop_driver, driver);
-}
-#endif /* _VOP_BUS_H */
diff --git a/drivers/misc/mic/card/Makefile b/drivers/misc/mic/card/Makefile
deleted file mode 100644 (file)
index 921a7e7..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Makefile - Intel MIC Linux driver.
-# Copyright(c) 2013, Intel Corporation.
-#
-ccflags-y += -DINTEL_MIC_CARD
-
-obj-$(CONFIG_INTEL_MIC_CARD) += mic_card.o
-mic_card-y += mic_x100.o
-mic_card-y += mic_device.o
-mic_card-y += mic_debugfs.o
diff --git a/drivers/misc/mic/card/mic_debugfs.c b/drivers/misc/mic/card/mic_debugfs.c
deleted file mode 100644 (file)
index 4c326e8..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Disclaimer: The codes contained in these modules may be specific to
- * the Intel Software Development Platform codenamed: Knights Ferry, and
- * the Intel product codenamed: Knights Corner, and are not backward
- * compatible with other Intel products. Additionally, Intel will NOT
- * support the codes or instruction set in future products.
- *
- * Intel MIC Card driver.
- */
-#include <linux/debugfs.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/interrupt.h>
-#include <linux/device.h>
-
-#include "../common/mic_dev.h"
-#include "mic_device.h"
-
-/* Debugfs parent dir */
-static struct dentry *mic_dbg;
-
-/*
- * mic_intr_show - Send interrupts to host.
- */
-static int mic_intr_show(struct seq_file *s, void *unused)
-{
-       struct mic_driver *mdrv = s->private;
-       struct mic_device *mdev = &mdrv->mdev;
-
-       mic_send_intr(mdev, 0);
-       msleep(1000);
-       mic_send_intr(mdev, 1);
-       msleep(1000);
-       mic_send_intr(mdev, 2);
-       msleep(1000);
-       mic_send_intr(mdev, 3);
-       msleep(1000);
-
-       return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(mic_intr);
-
-/*
- * mic_create_card_debug_dir - Initialize MIC debugfs entries.
- */
-void __init mic_create_card_debug_dir(struct mic_driver *mdrv)
-{
-       if (!mic_dbg)
-               return;
-
-       mdrv->dbg_dir = debugfs_create_dir(mdrv->name, mic_dbg);
-
-       debugfs_create_file("intr_test", 0444, mdrv->dbg_dir, mdrv,
-                           &mic_intr_fops);
-}
-
-/*
- * mic_delete_card_debug_dir - Uninitialize MIC debugfs entries.
- */
-void mic_delete_card_debug_dir(struct mic_driver *mdrv)
-{
-       debugfs_remove_recursive(mdrv->dbg_dir);
-}
-
-/*
- * mic_init_card_debugfs - Initialize global debugfs entry.
- */
-void __init mic_init_card_debugfs(void)
-{
-       mic_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL);
-}
-
-/*
- * mic_exit_card_debugfs - Uninitialize global debugfs entry
- */
-void mic_exit_card_debugfs(void)
-{
-       debugfs_remove(mic_dbg);
-}
diff --git a/drivers/misc/mic/card/mic_device.c b/drivers/misc/mic/card/mic_device.c
deleted file mode 100644 (file)
index a156062..0000000
+++ /dev/null
@@ -1,417 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Disclaimer: The codes contained in these modules may be specific to
- * the Intel Software Development Platform codenamed: Knights Ferry, and
- * the Intel product codenamed: Knights Corner, and are not backward
- * compatible with other Intel products. Additionally, Intel will NOT
- * support the codes or instruction set in future products.
- *
- * Intel MIC Card driver.
- */
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/interrupt.h>
-#include <linux/reboot.h>
-#include <linux/dmaengine.h>
-#include <linux/kmod.h>
-
-#include <linux/mic_common.h>
-#include "../common/mic_dev.h"
-#include "mic_device.h"
-
-static struct mic_driver *g_drv;
-
-static int __init mic_dp_init(void)
-{
-       struct mic_driver *mdrv = g_drv;
-       struct mic_device *mdev = &mdrv->mdev;
-       struct mic_bootparam __iomem *bootparam;
-       u64 lo, hi, dp_dma_addr;
-       u32 magic;
-
-       lo = mic_read_spad(&mdrv->mdev, MIC_DPLO_SPAD);
-       hi = mic_read_spad(&mdrv->mdev, MIC_DPHI_SPAD);
-
-       dp_dma_addr = lo | (hi << 32);
-       mdrv->dp = mic_card_map(mdev, dp_dma_addr, MIC_DP_SIZE);
-       if (!mdrv->dp) {
-               dev_err(mdrv->dev, "Cannot remap Aperture BAR\n");
-               return -ENOMEM;
-       }
-       bootparam = mdrv->dp;
-       magic = ioread32(&bootparam->magic);
-       if (MIC_MAGIC != magic) {
-               dev_err(mdrv->dev, "bootparam magic mismatch 0x%x\n", magic);
-               return -EIO;
-       }
-       return 0;
-}
-
-/* Uninitialize the device page */
-static void mic_dp_uninit(void)
-{
-       mic_card_unmap(&g_drv->mdev, g_drv->dp);
-}
-
-/**
- * mic_request_card_irq - request an irq.
- *
- * @handler: interrupt handler passed to request_threaded_irq.
- * @thread_fn: thread fn. passed to request_threaded_irq.
- * @name: The ASCII name of the callee requesting the irq.
- * @data: private data that is returned back when calling the
- * function handler.
- * @index: The doorbell index of the requester.
- *
- * returns: The cookie that is transparent to the caller. Passed
- * back when calling mic_free_irq. An appropriate error code
- * is returned on failure. Caller needs to use IS_ERR(return_val)
- * to check for failure and PTR_ERR(return_val) to obtained the
- * error code.
- *
- */
-struct mic_irq *
-mic_request_card_irq(irq_handler_t handler,
-                    irq_handler_t thread_fn, const char *name,
-                    void *data, int index)
-{
-       int rc = 0;
-       unsigned long cookie;
-       struct mic_driver *mdrv = g_drv;
-
-       rc  = request_threaded_irq(mic_db_to_irq(mdrv, index), handler,
-                                  thread_fn, 0, name, data);
-       if (rc) {
-               dev_err(mdrv->dev, "request_threaded_irq failed rc = %d\n", rc);
-               goto err;
-       }
-       mdrv->irq_info.irq_usage_count[index]++;
-       cookie = index;
-       return (struct mic_irq *)cookie;
-err:
-       return ERR_PTR(rc);
-}
-
-/**
- * mic_free_card_irq - free irq.
- *
- * @cookie: cookie obtained during a successful call to mic_request_threaded_irq
- * @data: private data specified by the calling function during the
- * mic_request_threaded_irq
- *
- * returns: none.
- */
-void mic_free_card_irq(struct mic_irq *cookie, void *data)
-{
-       int index;
-       struct mic_driver *mdrv = g_drv;
-
-       index = (unsigned long)cookie & 0xFFFFU;
-       free_irq(mic_db_to_irq(mdrv, index), data);
-       mdrv->irq_info.irq_usage_count[index]--;
-}
-
-/**
- * mic_next_card_db - Get the doorbell with minimum usage count.
- *
- * Returns the irq index.
- */
-int mic_next_card_db(void)
-{
-       int i;
-       int index = 0;
-       struct mic_driver *mdrv = g_drv;
-
-       for (i = 0; i < mdrv->intr_info.num_intr; i++) {
-               if (mdrv->irq_info.irq_usage_count[i] <
-                       mdrv->irq_info.irq_usage_count[index])
-                       index = i;
-       }
-
-       return index;
-}
-
-/**
- * mic_init_irq - Initialize irq information.
- *
- * Returns 0 in success. Appropriate error code on failure.
- */
-static int mic_init_irq(void)
-{
-       struct mic_driver *mdrv = g_drv;
-
-       mdrv->irq_info.irq_usage_count = kzalloc((sizeof(u32) *
-                       mdrv->intr_info.num_intr),
-                       GFP_KERNEL);
-       if (!mdrv->irq_info.irq_usage_count)
-               return -ENOMEM;
-       return 0;
-}
-
-/**
- * mic_uninit_irq - Uninitialize irq information.
- *
- * None.
- */
-static void mic_uninit_irq(void)
-{
-       struct mic_driver *mdrv = g_drv;
-
-       kfree(mdrv->irq_info.irq_usage_count);
-}
-
-static inline struct mic_driver *scdev_to_mdrv(struct scif_hw_dev *scdev)
-{
-       return dev_get_drvdata(scdev->dev.parent);
-}
-
-static struct mic_irq *
-___mic_request_irq(struct scif_hw_dev *scdev,
-                  irqreturn_t (*func)(int irq, void *data),
-                                      const char *name, void *data,
-                                      int db)
-{
-       return mic_request_card_irq(func, NULL, name, data, db);
-}
-
-static void
-___mic_free_irq(struct scif_hw_dev *scdev,
-               struct mic_irq *cookie, void *data)
-{
-       return mic_free_card_irq(cookie, data);
-}
-
-static void ___mic_ack_interrupt(struct scif_hw_dev *scdev, int num)
-{
-       struct mic_driver *mdrv = scdev_to_mdrv(scdev);
-
-       mic_ack_interrupt(&mdrv->mdev);
-}
-
-static int ___mic_next_db(struct scif_hw_dev *scdev)
-{
-       return mic_next_card_db();
-}
-
-static void ___mic_send_intr(struct scif_hw_dev *scdev, int db)
-{
-       struct mic_driver *mdrv = scdev_to_mdrv(scdev);
-
-       mic_send_intr(&mdrv->mdev, db);
-}
-
-static void ___mic_send_p2p_intr(struct scif_hw_dev *scdev, int db,
-                                struct mic_mw *mw)
-{
-       mic_send_p2p_intr(db, mw);
-}
-
-static void __iomem *
-___mic_ioremap(struct scif_hw_dev *scdev,
-              phys_addr_t pa, size_t len)
-{
-       struct mic_driver *mdrv = scdev_to_mdrv(scdev);
-
-       return mic_card_map(&mdrv->mdev, pa, len);
-}
-
-static void ___mic_iounmap(struct scif_hw_dev *scdev, void __iomem *va)
-{
-       struct mic_driver *mdrv = scdev_to_mdrv(scdev);
-
-       mic_card_unmap(&mdrv->mdev, va);
-}
-
-static struct scif_hw_ops scif_hw_ops = {
-       .request_irq = ___mic_request_irq,
-       .free_irq = ___mic_free_irq,
-       .ack_interrupt = ___mic_ack_interrupt,
-       .next_db = ___mic_next_db,
-       .send_intr = ___mic_send_intr,
-       .send_p2p_intr = ___mic_send_p2p_intr,
-       .remap = ___mic_ioremap,
-       .unmap = ___mic_iounmap,
-};
-
-static inline struct mic_driver *vpdev_to_mdrv(struct vop_device *vpdev)
-{
-       return dev_get_drvdata(vpdev->dev.parent);
-}
-
-static struct mic_irq *
-__mic_request_irq(struct vop_device *vpdev,
-                 irqreturn_t (*func)(int irq, void *data),
-                  const char *name, void *data, int intr_src)
-{
-       return mic_request_card_irq(func, NULL, name, data, intr_src);
-}
-
-static void __mic_free_irq(struct vop_device *vpdev,
-                          struct mic_irq *cookie, void *data)
-{
-       return mic_free_card_irq(cookie, data);
-}
-
-static void __mic_ack_interrupt(struct vop_device *vpdev, int num)
-{
-       struct mic_driver *mdrv = vpdev_to_mdrv(vpdev);
-
-       mic_ack_interrupt(&mdrv->mdev);
-}
-
-static int __mic_next_db(struct vop_device *vpdev)
-{
-       return mic_next_card_db();
-}
-
-static void __iomem *__mic_get_remote_dp(struct vop_device *vpdev)
-{
-       struct mic_driver *mdrv = vpdev_to_mdrv(vpdev);
-
-       return mdrv->dp;
-}
-
-static void __mic_send_intr(struct vop_device *vpdev, int db)
-{
-       struct mic_driver *mdrv = vpdev_to_mdrv(vpdev);
-
-       mic_send_intr(&mdrv->mdev, db);
-}
-
-static void __iomem *__mic_ioremap(struct vop_device *vpdev,
-                                  dma_addr_t pa, size_t len)
-{
-       struct mic_driver *mdrv = vpdev_to_mdrv(vpdev);
-
-       return mic_card_map(&mdrv->mdev, pa, len);
-}
-
-static void __mic_iounmap(struct vop_device *vpdev, void __iomem *va)
-{
-       struct mic_driver *mdrv = vpdev_to_mdrv(vpdev);
-
-       mic_card_unmap(&mdrv->mdev, va);
-}
-
-static struct vop_hw_ops vop_hw_ops = {
-       .request_irq = __mic_request_irq,
-       .free_irq = __mic_free_irq,
-       .ack_interrupt = __mic_ack_interrupt,
-       .next_db = __mic_next_db,
-       .get_remote_dp = __mic_get_remote_dp,
-       .send_intr = __mic_send_intr,
-       .remap = __mic_ioremap,
-       .unmap = __mic_iounmap,
-};
-
-static int mic_request_dma_chans(struct mic_driver *mdrv)
-{
-       dma_cap_mask_t mask;
-       struct dma_chan *chan;
-
-       dma_cap_zero(mask);
-       dma_cap_set(DMA_MEMCPY, mask);
-
-       do {
-               chan = dma_request_channel(mask, NULL, NULL);
-               if (chan) {
-                       mdrv->dma_ch[mdrv->num_dma_ch++] = chan;
-                       if (mdrv->num_dma_ch >= MIC_MAX_DMA_CHAN)
-                               break;
-               }
-       } while (chan);
-       dev_info(mdrv->dev, "DMA channels # %d\n", mdrv->num_dma_ch);
-       return mdrv->num_dma_ch;
-}
-
-static void mic_free_dma_chans(struct mic_driver *mdrv)
-{
-       int i = 0;
-
-       for (i = 0; i < mdrv->num_dma_ch; i++) {
-               dma_release_channel(mdrv->dma_ch[i]);
-               mdrv->dma_ch[i] = NULL;
-       }
-       mdrv->num_dma_ch = 0;
-}
-
-/*
- * mic_driver_init - MIC driver initialization tasks.
- *
- * Returns 0 in success. Appropriate error code on failure.
- */
-int __init mic_driver_init(struct mic_driver *mdrv)
-{
-       int rc;
-       struct mic_bootparam __iomem *bootparam;
-       u8 node_id;
-
-       g_drv = mdrv;
-       /* Unloading the card module is not supported. */
-       if (!try_module_get(mdrv->dev->driver->owner)) {
-               rc = -ENODEV;
-               goto done;
-       }
-       rc = mic_dp_init();
-       if (rc)
-               goto put;
-       rc = mic_init_irq();
-       if (rc)
-               goto dp_uninit;
-       if (!mic_request_dma_chans(mdrv)) {
-               rc = -ENODEV;
-               goto irq_uninit;
-       }
-       mdrv->vpdev = vop_register_device(mdrv->dev, VOP_DEV_TRNSP,
-                                         NULL, &vop_hw_ops, 0,
-                                         NULL, mdrv->dma_ch[0]);
-       if (IS_ERR(mdrv->vpdev)) {
-               rc = PTR_ERR(mdrv->vpdev);
-               goto dma_free;
-       }
-       bootparam = mdrv->dp;
-       node_id = ioread8(&bootparam->node_id);
-       mdrv->scdev = scif_register_device(mdrv->dev, MIC_SCIF_DEV,
-                                          NULL, &scif_hw_ops,
-                                          0, node_id, &mdrv->mdev.mmio, NULL,
-                                          NULL, mdrv->dp, mdrv->dma_ch,
-                                          mdrv->num_dma_ch, true);
-       if (IS_ERR(mdrv->scdev)) {
-               rc = PTR_ERR(mdrv->scdev);
-               goto vop_remove;
-       }
-       mic_create_card_debug_dir(mdrv);
-done:
-       return rc;
-vop_remove:
-       vop_unregister_device(mdrv->vpdev);
-dma_free:
-       mic_free_dma_chans(mdrv);
-irq_uninit:
-       mic_uninit_irq();
-dp_uninit:
-       mic_dp_uninit();
-put:
-       module_put(mdrv->dev->driver->owner);
-       return rc;
-}
-
-/*
- * mic_driver_uninit - MIC driver uninitialization tasks.
- *
- * Returns None
- */
-void mic_driver_uninit(struct mic_driver *mdrv)
-{
-       mic_delete_card_debug_dir(mdrv);
-       scif_unregister_device(mdrv->scdev);
-       vop_unregister_device(mdrv->vpdev);
-       mic_free_dma_chans(mdrv);
-       mic_uninit_irq();
-       mic_dp_uninit();
-       module_put(mdrv->dev->driver->owner);
-}
diff --git a/drivers/misc/mic/card/mic_device.h b/drivers/misc/mic/card/mic_device.h
deleted file mode 100644 (file)
index d6cc69a..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Disclaimer: The codes contained in these modules may be specific to
- * the Intel Software Development Platform codenamed: Knights Ferry, and
- * the Intel product codenamed: Knights Corner, and are not backward
- * compatible with other Intel products. Additionally, Intel will NOT
- * support the codes or instruction set in future products.
- *
- * Intel MIC Card driver.
- */
-#ifndef _MIC_CARD_DEVICE_H_
-#define _MIC_CARD_DEVICE_H_
-
-#include <linux/workqueue.h>
-#include <linux/io.h>
-#include <linux/interrupt.h>
-#include <linux/mic_bus.h>
-#include "../bus/scif_bus.h"
-#include "../bus/vop_bus.h"
-
-/**
- * struct mic_intr_info - Contains h/w specific interrupt sources info
- *
- * @num_intr: The number of irqs available
- */
-struct mic_intr_info {
-       u32 num_intr;
-};
-
-/**
- * struct mic_irq_info - OS specific irq information
- *
- * @irq_usage_count: usage count array tracking the number of sources
- * assigned for each irq.
- */
-struct mic_irq_info {
-       int *irq_usage_count;
-};
-
-/**
- * struct mic_device -  MIC device information.
- *
- * @mmio: MMIO bar information.
- */
-struct mic_device {
-       struct mic_mw mmio;
-};
-
-/**
- * struct mic_driver - MIC card driver information.
- *
- * @name: Name for MIC driver.
- * @dbg_dir: debugfs directory of this MIC device.
- * @dev: The device backing this MIC.
- * @dp: The pointer to the virtio device page.
- * @mdev: MIC device information for the host.
- * @hotplug_work: Hot plug work for adding/removing virtio devices.
- * @irq_info: The OS specific irq information
- * @intr_info: H/W specific interrupt information.
- * @dma_mbdev: dma device on the MIC virtual bus.
- * @dma_ch - Array of DMA channels
- * @num_dma_ch - Number of DMA channels available
- * @scdev: SCIF device on the SCIF virtual bus.
- * @vpdev: Virtio over PCIe device on the VOP virtual bus.
- */
-struct mic_driver {
-       char name[20];
-       struct dentry *dbg_dir;
-       struct device *dev;
-       void __iomem *dp;
-       struct mic_device mdev;
-       struct work_struct hotplug_work;
-       struct mic_irq_info irq_info;
-       struct mic_intr_info intr_info;
-       struct mbus_device *dma_mbdev;
-       struct dma_chan *dma_ch[MIC_MAX_DMA_CHAN];
-       int num_dma_ch;
-       struct scif_hw_dev *scdev;
-       struct vop_device *vpdev;
-};
-
-/**
- * struct mic_irq - opaque pointer used as cookie
- */
-struct mic_irq;
-
-/**
- * mic_mmio_read - read from an MMIO register.
- * @mw: MMIO register base virtual address.
- * @offset: register offset.
- *
- * RETURNS: register value.
- */
-static inline u32 mic_mmio_read(struct mic_mw *mw, u32 offset)
-{
-       return ioread32(mw->va + offset);
-}
-
-/**
- * mic_mmio_write - write to an MMIO register.
- * @mw: MMIO register base virtual address.
- * @val: the data value to put into the register
- * @offset: register offset.
- *
- * RETURNS: none.
- */
-static inline void
-mic_mmio_write(struct mic_mw *mw, u32 val, u32 offset)
-{
-       iowrite32(val, mw->va + offset);
-}
-
-int mic_driver_init(struct mic_driver *mdrv);
-void mic_driver_uninit(struct mic_driver *mdrv);
-int mic_next_card_db(void);
-struct mic_irq *
-mic_request_card_irq(irq_handler_t handler, irq_handler_t thread_fn,
-                    const char *name, void *data, int db);
-void mic_free_card_irq(struct mic_irq *cookie, void *data);
-u32 mic_read_spad(struct mic_device *mdev, unsigned int idx);
-void mic_send_intr(struct mic_device *mdev, int doorbell);
-void mic_send_p2p_intr(int doorbell, struct mic_mw *mw);
-int mic_db_to_irq(struct mic_driver *mdrv, int db);
-u32 mic_ack_interrupt(struct mic_device *mdev);
-void mic_hw_intr_init(struct mic_driver *mdrv);
-void __iomem *
-mic_card_map(struct mic_device *mdev, dma_addr_t addr, size_t size);
-void mic_card_unmap(struct mic_device *mdev, void __iomem *addr);
-void __init mic_create_card_debug_dir(struct mic_driver *mdrv);
-void mic_delete_card_debug_dir(struct mic_driver *mdrv);
-void __init mic_init_card_debugfs(void);
-void mic_exit_card_debugfs(void);
-#endif
diff --git a/drivers/misc/mic/card/mic_x100.c b/drivers/misc/mic/card/mic_x100.c
deleted file mode 100644 (file)
index c8bff29..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Disclaimer: The codes contained in these modules may be specific to
- * the Intel Software Development Platform codenamed: Knights Ferry, and
- * the Intel product codenamed: Knights Corner, and are not backward
- * compatible with other Intel products. Additionally, Intel will NOT
- * support the codes or instruction set in future products.
- *
- * Intel MIC Card driver.
- */
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/platform_device.h>
-
-#include "../common/mic_dev.h"
-#include "mic_device.h"
-#include "mic_x100.h"
-
-static const char mic_driver_name[] = "mic";
-
-static struct mic_driver g_drv;
-
-/**
- * mic_read_spad - read from the scratchpad register
- * @mdev: pointer to mic_device instance
- * @idx: index to scratchpad register, 0 based
- *
- * This function allows reading of the 32bit scratchpad register.
- *
- * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
- */
-u32 mic_read_spad(struct mic_device *mdev, unsigned int idx)
-{
-       return mic_mmio_read(&mdev->mmio,
-               MIC_X100_SBOX_BASE_ADDRESS +
-               MIC_X100_SBOX_SPAD0 + idx * 4);
-}
-
-/**
- * __mic_send_intr - Send interrupt to Host.
- * @mdev: pointer to mic_device instance
- * @doorbell: Doorbell number.
- */
-void mic_send_intr(struct mic_device *mdev, int doorbell)
-{
-       struct mic_mw *mw = &mdev->mmio;
-
-       if (doorbell > MIC_X100_MAX_DOORBELL_IDX)
-               return;
-       /* Ensure that the interrupt is ordered w.r.t previous stores. */
-       wmb();
-       mic_mmio_write(mw, MIC_X100_SBOX_SDBIC0_DBREQ_BIT,
-                      MIC_X100_SBOX_BASE_ADDRESS +
-                      (MIC_X100_SBOX_SDBIC0 + (4 * doorbell)));
-}
-
-/*
- * mic_x100_send_sbox_intr - Send an MIC_X100_SBOX interrupt to MIC.
- */
-static void mic_x100_send_sbox_intr(struct mic_mw *mw, int doorbell)
-{
-       u64 apic_icr_offset = MIC_X100_SBOX_APICICR0 + doorbell * 8;
-       u32 apicicr_low = mic_mmio_read(mw, MIC_X100_SBOX_BASE_ADDRESS +
-                                       apic_icr_offset);
-
-       /* for MIC we need to make sure we "hit" the send_icr bit (13) */
-       apicicr_low = (apicicr_low | (1 << 13));
-       /*
-        * Ensure that the interrupt is ordered w.r.t. previous stores
-        * to main memory. Fence instructions are not implemented in X100
-        * since execution is in order but a compiler barrier is still
-        * required.
-        */
-       wmb();
-       mic_mmio_write(mw, apicicr_low,
-                      MIC_X100_SBOX_BASE_ADDRESS + apic_icr_offset);
-}
-
-static void mic_x100_send_rdmasr_intr(struct mic_mw *mw, int doorbell)
-{
-       int rdmasr_offset = MIC_X100_SBOX_RDMASR0 + (doorbell << 2);
-       /*
-        * Ensure that the interrupt is ordered w.r.t. previous stores
-        * to main memory. Fence instructions are not implemented in X100
-        * since execution is in order but a compiler barrier is still
-        * required.
-        */
-       wmb();
-       mic_mmio_write(mw, 0, MIC_X100_SBOX_BASE_ADDRESS + rdmasr_offset);
-}
-
-/**
- * mic_ack_interrupt - Device specific interrupt handling.
- * @mdev: pointer to mic_device instance
- *
- * Returns: bitmask of doorbell events triggered.
- */
-u32 mic_ack_interrupt(struct mic_device *mdev)
-{
-       return 0;
-}
-
-static inline int mic_get_sbox_irq(int db)
-{
-       return MIC_X100_IRQ_BASE + db;
-}
-
-static inline int mic_get_rdmasr_irq(int index)
-{
-       return  MIC_X100_RDMASR_IRQ_BASE + index;
-}
-
-void mic_send_p2p_intr(int db, struct mic_mw *mw)
-{
-       int rdmasr_index;
-
-       if (db < MIC_X100_NUM_SBOX_IRQ) {
-               mic_x100_send_sbox_intr(mw, db);
-       } else {
-               rdmasr_index = db - MIC_X100_NUM_SBOX_IRQ;
-               mic_x100_send_rdmasr_intr(mw, rdmasr_index);
-       }
-}
-
-/**
- * mic_hw_intr_init - Initialize h/w specific interrupt
- * information.
- * @mdrv: pointer to mic_driver
- */
-void mic_hw_intr_init(struct mic_driver *mdrv)
-{
-       mdrv->intr_info.num_intr = MIC_X100_NUM_SBOX_IRQ +
-                               MIC_X100_NUM_RDMASR_IRQ;
-}
-
-/**
- * mic_db_to_irq - Retrieve irq number corresponding to a doorbell.
- * @mdrv: pointer to mic_driver
- * @db: The doorbell obtained for which the irq is needed. Doorbell
- * may correspond to an sbox doorbell or an rdmasr index.
- *
- * Returns the irq corresponding to the doorbell.
- */
-int mic_db_to_irq(struct mic_driver *mdrv, int db)
-{
-       int rdmasr_index;
-
-       /*
-        * The total number of doorbell interrupts on the card are 16. Indices
-        * 0-8 falls in the SBOX category and 8-15 fall in the RDMASR category.
-        */
-       if (db < MIC_X100_NUM_SBOX_IRQ) {
-               return mic_get_sbox_irq(db);
-       } else {
-               rdmasr_index = db - MIC_X100_NUM_SBOX_IRQ;
-               return mic_get_rdmasr_irq(rdmasr_index);
-       }
-}
-
-/*
- * mic_card_map - Allocate virtual address for a remote memory region.
- * @mdev: pointer to mic_device instance.
- * @addr: Remote DMA address.
- * @size: Size of the region.
- *
- * Returns: Virtual address backing the remote memory region.
- */
-void __iomem *
-mic_card_map(struct mic_device *mdev, dma_addr_t addr, size_t size)
-{
-       return ioremap(addr, size);
-}
-
-/*
- * mic_card_unmap - Unmap the virtual address for a remote memory region.
- * @mdev: pointer to mic_device instance.
- * @addr: Virtual address for remote memory region.
- *
- * Returns: None.
- */
-void mic_card_unmap(struct mic_device *mdev, void __iomem *addr)
-{
-       iounmap(addr);
-}
-
-static inline struct mic_driver *mbdev_to_mdrv(struct mbus_device *mbdev)
-{
-       return dev_get_drvdata(mbdev->dev.parent);
-}
-
-static struct mic_irq *
-_mic_request_threaded_irq(struct mbus_device *mbdev,
-                         irq_handler_t handler, irq_handler_t thread_fn,
-                         const char *name, void *data, int intr_src)
-{
-       int rc = 0;
-       unsigned int irq = intr_src;
-       unsigned long cookie = irq;
-
-       rc  = request_threaded_irq(irq, handler, thread_fn, 0, name, data);
-       if (rc) {
-               dev_err(mbdev_to_mdrv(mbdev)->dev,
-                       "request_threaded_irq failed rc = %d\n", rc);
-               return ERR_PTR(rc);
-       }
-       return (struct mic_irq *)cookie;
-}
-
-static void _mic_free_irq(struct mbus_device *mbdev,
-                         struct mic_irq *cookie, void *data)
-{
-       unsigned long irq = (unsigned long)cookie;
-       free_irq(irq, data);
-}
-
-static void _mic_ack_interrupt(struct mbus_device *mbdev, int num)
-{
-       mic_ack_interrupt(&mbdev_to_mdrv(mbdev)->mdev);
-}
-
-static struct mbus_hw_ops mbus_hw_ops = {
-       .request_threaded_irq = _mic_request_threaded_irq,
-       .free_irq = _mic_free_irq,
-       .ack_interrupt = _mic_ack_interrupt,
-};
-
-static int __init mic_probe(struct platform_device *pdev)
-{
-       struct mic_driver *mdrv = &g_drv;
-       struct mic_device *mdev = &mdrv->mdev;
-       int rc = 0;
-
-       mdrv->dev = &pdev->dev;
-       snprintf(mdrv->name, sizeof(mic_driver_name), mic_driver_name);
-
-       /* FIXME: use dma_set_mask_and_coherent() and check result */
-       dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
-
-       mdev->mmio.pa = MIC_X100_MMIO_BASE;
-       mdev->mmio.len = MIC_X100_MMIO_LEN;
-       mdev->mmio.va = devm_ioremap(&pdev->dev, MIC_X100_MMIO_BASE,
-                                    MIC_X100_MMIO_LEN);
-       if (!mdev->mmio.va) {
-               dev_err(&pdev->dev, "Cannot remap MMIO BAR\n");
-               rc = -EIO;
-               goto done;
-       }
-       mic_hw_intr_init(mdrv);
-       platform_set_drvdata(pdev, mdrv);
-       mdrv->dma_mbdev = mbus_register_device(mdrv->dev, MBUS_DEV_DMA_MIC,
-                                              NULL, &mbus_hw_ops, 0,
-                                              mdrv->mdev.mmio.va);
-       if (IS_ERR(mdrv->dma_mbdev)) {
-               rc = PTR_ERR(mdrv->dma_mbdev);
-               dev_err(&pdev->dev, "mbus_add_device failed rc %d\n", rc);
-               goto done;
-       }
-       rc = mic_driver_init(mdrv);
-       if (rc) {
-               dev_err(&pdev->dev, "mic_driver_init failed rc %d\n", rc);
-               goto remove_dma;
-       }
-done:
-       return rc;
-remove_dma:
-       mbus_unregister_device(mdrv->dma_mbdev);
-       return rc;
-}
-
-static int mic_remove(struct platform_device *pdev)
-{
-       struct mic_driver *mdrv = &g_drv;
-
-       mic_driver_uninit(mdrv);
-       mbus_unregister_device(mdrv->dma_mbdev);
-       return 0;
-}
-
-static void mic_platform_shutdown(struct platform_device *pdev)
-{
-       mic_remove(pdev);
-}
-
-static struct platform_driver __refdata mic_platform_driver = {
-       .probe = mic_probe,
-       .remove = mic_remove,
-       .shutdown = mic_platform_shutdown,
-       .driver         = {
-               .name   = mic_driver_name,
-       },
-};
-
-static struct platform_device *mic_platform_dev;
-
-static int __init mic_init(void)
-{
-       int ret;
-       struct cpuinfo_x86 *c = &cpu_data(0);
-
-       if (!(c->x86 == 11 && c->x86_model == 1)) {
-               ret = -ENODEV;
-               pr_err("%s not running on X100 ret %d\n", __func__, ret);
-               goto done;
-       }
-
-       request_module("mic_x100_dma");
-       mic_init_card_debugfs();
-
-       mic_platform_dev = platform_device_register_simple(mic_driver_name,
-                                                          0, NULL, 0);
-       ret = PTR_ERR_OR_ZERO(mic_platform_dev);
-       if (ret) {
-               pr_err("platform_device_register_full ret %d\n", ret);
-               goto cleanup_debugfs;
-       }
-       ret = platform_driver_register(&mic_platform_driver);
-       if (ret) {
-               pr_err("platform_driver_register ret %d\n", ret);
-               goto device_unregister;
-       }
-       return ret;
-
-device_unregister:
-       platform_device_unregister(mic_platform_dev);
-cleanup_debugfs:
-       mic_exit_card_debugfs();
-done:
-       return ret;
-}
-
-static void __exit mic_exit(void)
-{
-       platform_driver_unregister(&mic_platform_driver);
-       platform_device_unregister(mic_platform_dev);
-       mic_exit_card_debugfs();
-}
-
-module_init(mic_init);
-module_exit(mic_exit);
-
-MODULE_AUTHOR("Intel Corporation");
-MODULE_DESCRIPTION("Intel(R) MIC X100 Card driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/misc/mic/card/mic_x100.h b/drivers/misc/mic/card/mic_x100.h
deleted file mode 100644 (file)
index 46644dd..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Disclaimer: The codes contained in these modules may be specific to
- * the Intel Software Development Platform codenamed: Knights Ferry, and
- * the Intel product codenamed: Knights Corner, and are not backward
- * compatible with other Intel products. Additionally, Intel will NOT
- * support the codes or instruction set in future products.
- *
- * Intel MIC Card driver.
- */
-#ifndef _MIC_X100_CARD_H_
-#define _MIC_X100_CARD_H_
-
-#define MIC_X100_MMIO_BASE 0x08007C0000ULL
-#define MIC_X100_MMIO_LEN 0x00020000ULL
-#define MIC_X100_SBOX_BASE_ADDRESS 0x00010000ULL
-
-#define MIC_X100_SBOX_SPAD0 0x0000AB20
-#define MIC_X100_SBOX_SDBIC0 0x0000CC90
-#define MIC_X100_SBOX_SDBIC0_DBREQ_BIT 0x80000000
-#define MIC_X100_SBOX_RDMASR0  0x0000B180
-#define MIC_X100_SBOX_APICICR0 0x0000A9D0
-
-#define MIC_X100_MAX_DOORBELL_IDX 8
-
-#define MIC_X100_NUM_SBOX_IRQ 8
-#define MIC_X100_NUM_RDMASR_IRQ 8
-#define MIC_X100_SBOX_IRQ_BASE 0
-#define MIC_X100_RDMASR_IRQ_BASE 17
-
-#define MIC_X100_IRQ_BASE 26
-
-#endif
diff --git a/drivers/misc/mic/common/mic_dev.h b/drivers/misc/mic/common/mic_dev.h
deleted file mode 100644 (file)
index f94f08d..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC driver.
- */
-#ifndef __MIC_DEV_H__
-#define __MIC_DEV_H__
-
-/* The maximum number of MIC devices supported in a single host system. */
-#define MIC_MAX_NUM_DEVS 128
-
-/**
- * enum mic_hw_family - The hardware family to which a device belongs.
- */
-enum mic_hw_family {
-       MIC_FAMILY_X100 = 0,
-       MIC_FAMILY_X200,
-       MIC_FAMILY_UNKNOWN,
-       MIC_FAMILY_LAST
-};
-
-/**
- * struct mic_mw - MIC memory window
- *
- * @pa: Base physical address.
- * @va: Base ioremap'd virtual address.
- * @len: Size of the memory window.
- */
-struct mic_mw {
-       phys_addr_t pa;
-       void __iomem *va;
-       resource_size_t len;
-};
-
-/*
- * Scratch pad register offsets used by the host to communicate
- * device page DMA address to the card.
- */
-#define MIC_DPLO_SPAD 14
-#define MIC_DPHI_SPAD 15
-
-/*
- * These values are supposed to be in the config_change field of the
- * device page when the host sends a config change interrupt to the card.
- */
-#define MIC_VIRTIO_PARAM_DEV_REMOVE 0x1
-#define MIC_VIRTIO_PARAM_CONFIG_CHANGED 0x2
-
-/* Maximum number of DMA channels */
-#define MIC_MAX_DMA_CHAN 4
-
-#endif
diff --git a/drivers/misc/mic/cosm/Makefile b/drivers/misc/mic/cosm/Makefile
deleted file mode 100644 (file)
index 97d74cb..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Makefile - Intel MIC Coprocessor State Management (COSM) Driver
-# Copyright(c) 2015, Intel Corporation.
-#
-obj-$(CONFIG_MIC_COSM) += mic_cosm.o
-
-mic_cosm-objs := cosm_main.o
-mic_cosm-objs += cosm_debugfs.o
-mic_cosm-objs += cosm_sysfs.o
-mic_cosm-objs += cosm_scif_server.o
diff --git a/drivers/misc/mic/cosm/cosm_debugfs.c b/drivers/misc/mic/cosm/cosm_debugfs.c
deleted file mode 100644 (file)
index cb55653..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel MIC Coprocessor State Management (COSM) Driver
- */
-
-#include <linux/debugfs.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include "cosm_main.h"
-
-/* Debugfs parent dir */
-static struct dentry *cosm_dbg;
-
-/*
- * log_buf_show - Display MIC kernel log buffer
- *
- * log_buf addr/len is read from System.map by user space
- * and populated in sysfs entries.
- */
-static int log_buf_show(struct seq_file *s, void *unused)
-{
-       void __iomem *log_buf_va;
-       int __iomem *log_buf_len_va;
-       struct cosm_device *cdev = s->private;
-       void *kva;
-       int size;
-       u64 aper_offset;
-
-       if (!cdev || !cdev->log_buf_addr || !cdev->log_buf_len)
-               goto done;
-
-       mutex_lock(&cdev->cosm_mutex);
-       switch (cdev->state) {
-       case MIC_BOOTING:
-       case MIC_ONLINE:
-       case MIC_SHUTTING_DOWN:
-               break;
-       default:
-               goto unlock;
-       }
-
-       /*
-        * Card kernel will never be relocated and any kernel text/data mapping
-        * can be translated to phys address by subtracting __START_KERNEL_map.
-        */
-       aper_offset = (u64)cdev->log_buf_len - __START_KERNEL_map;
-       log_buf_len_va = cdev->hw_ops->aper(cdev)->va + aper_offset;
-       aper_offset = (u64)cdev->log_buf_addr - __START_KERNEL_map;
-       log_buf_va = cdev->hw_ops->aper(cdev)->va + aper_offset;
-
-       size = ioread32(log_buf_len_va);
-       kva = kmalloc(size, GFP_KERNEL);
-       if (!kva)
-               goto unlock;
-
-       memcpy_fromio(kva, log_buf_va, size);
-       seq_write(s, kva, size);
-       kfree(kva);
-unlock:
-       mutex_unlock(&cdev->cosm_mutex);
-done:
-       return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(log_buf);
-
-/*
- * force_reset_show - Force MIC reset
- *
- * Invokes the force_reset COSM bus op instead of the standard reset
- * op in case a force reset of the MIC device is required
- */
-static int force_reset_show(struct seq_file *s, void *pos)
-{
-       struct cosm_device *cdev = s->private;
-
-       cosm_stop(cdev, true);
-       return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(force_reset);
-
-void cosm_create_debug_dir(struct cosm_device *cdev)
-{
-       char name[16];
-
-       if (!cosm_dbg)
-               return;
-
-       scnprintf(name, sizeof(name), "mic%d", cdev->index);
-       cdev->dbg_dir = debugfs_create_dir(name, cosm_dbg);
-
-       debugfs_create_file("log_buf", 0444, cdev->dbg_dir, cdev,
-                           &log_buf_fops);
-       debugfs_create_file("force_reset", 0444, cdev->dbg_dir, cdev,
-                           &force_reset_fops);
-}
-
-void cosm_delete_debug_dir(struct cosm_device *cdev)
-{
-       debugfs_remove_recursive(cdev->dbg_dir);
-}
-
-void cosm_init_debugfs(void)
-{
-       cosm_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL);
-}
-
-void cosm_exit_debugfs(void)
-{
-       debugfs_remove(cosm_dbg);
-}
diff --git a/drivers/misc/mic/cosm/cosm_main.c b/drivers/misc/mic/cosm/cosm_main.c
deleted file mode 100644 (file)
index ebb0eac..0000000
+++ /dev/null
@@ -1,382 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel MIC Coprocessor State Management (COSM) Driver
- */
-
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/idr.h>
-#include <linux/slab.h>
-#include <linux/cred.h>
-#include "cosm_main.h"
-
-static const char cosm_driver_name[] = "mic";
-
-/* COSM ID allocator */
-static struct ida g_cosm_ida;
-/* Class of MIC devices for sysfs accessibility. */
-static struct class *g_cosm_class;
-/* Number of MIC devices */
-static atomic_t g_num_dev;
-
-/**
- * cosm_hw_reset - Issue a HW reset for the MIC device
- * @cdev: pointer to cosm_device instance
- * @force: force a MIC to reset even if it is already reset and ready
- */
-static void cosm_hw_reset(struct cosm_device *cdev, bool force)
-{
-       int i;
-
-#define MIC_RESET_TO (45)
-       if (force && cdev->hw_ops->force_reset)
-               cdev->hw_ops->force_reset(cdev);
-       else
-               cdev->hw_ops->reset(cdev);
-
-       for (i = 0; i < MIC_RESET_TO; i++) {
-               if (cdev->hw_ops->ready(cdev)) {
-                       cosm_set_state(cdev, MIC_READY);
-                       return;
-               }
-               /*
-                * Resets typically take 10s of seconds to complete.
-                * Since an MMIO read is required to check if the
-                * firmware is ready or not, a 1 second delay works nicely.
-                */
-               msleep(1000);
-       }
-       cosm_set_state(cdev, MIC_RESET_FAILED);
-}
-
-/**
- * cosm_start - Start the MIC
- * @cdev: pointer to cosm_device instance
- *
- * This function prepares an MIC for boot and initiates boot.
- * RETURNS: An appropriate -ERRNO error value on error, or 0 for success.
- */
-int cosm_start(struct cosm_device *cdev)
-{
-       const struct cred *orig_cred;
-       struct cred *override_cred;
-       int rc;
-
-       mutex_lock(&cdev->cosm_mutex);
-       if (!cdev->bootmode) {
-               dev_err(&cdev->dev, "%s %d bootmode not set\n",
-                       __func__, __LINE__);
-               rc = -EINVAL;
-               goto unlock_ret;
-       }
-retry:
-       if (cdev->state != MIC_READY) {
-               dev_err(&cdev->dev, "%s %d MIC state not READY\n",
-                       __func__, __LINE__);
-               rc = -EINVAL;
-               goto unlock_ret;
-       }
-       if (!cdev->hw_ops->ready(cdev)) {
-               cosm_hw_reset(cdev, false);
-               /*
-                * The state will either be MIC_READY if the reset succeeded
-                * or MIC_RESET_FAILED if the firmware reset failed.
-                */
-               goto retry;
-       }
-
-       /*
-        * Set credentials to root to allow non-root user to download initramsfs
-        * with 600 permissions
-        */
-       override_cred = prepare_creds();
-       if (!override_cred) {
-               dev_err(&cdev->dev, "%s %d prepare_creds failed\n",
-                       __func__, __LINE__);
-               rc = -ENOMEM;
-               goto unlock_ret;
-       }
-       override_cred->fsuid = GLOBAL_ROOT_UID;
-       orig_cred = override_creds(override_cred);
-
-       rc = cdev->hw_ops->start(cdev, cdev->index);
-
-       revert_creds(orig_cred);
-       put_cred(override_cred);
-       if (rc)
-               goto unlock_ret;
-
-       /*
-        * If linux is being booted, card is treated 'online' only
-        * when the scif interface in the card is up. If anything else
-        * is booted, we set card to 'online' immediately.
-        */
-       if (!strcmp(cdev->bootmode, "linux"))
-               cosm_set_state(cdev, MIC_BOOTING);
-       else
-               cosm_set_state(cdev, MIC_ONLINE);
-unlock_ret:
-       mutex_unlock(&cdev->cosm_mutex);
-       if (rc)
-               dev_err(&cdev->dev, "cosm_start failed rc %d\n", rc);
-       return rc;
-}
-
-/**
- * cosm_stop - Prepare the MIC for reset and trigger reset
- * @cdev: pointer to cosm_device instance
- * @force: force a MIC to reset even if it is already reset and ready.
- *
- * RETURNS: None
- */
-void cosm_stop(struct cosm_device *cdev, bool force)
-{
-       mutex_lock(&cdev->cosm_mutex);
-       if (cdev->state != MIC_READY || force) {
-               /*
-                * Don't call hw_ops if they have been called previously.
-                * stop(..) calls device_unregister and will crash the system if
-                * called multiple times.
-                */
-               u8 state = cdev->state == MIC_RESETTING ?
-                                       cdev->prev_state : cdev->state;
-               bool call_hw_ops = state != MIC_RESET_FAILED &&
-                                       state != MIC_READY;
-
-               if (cdev->state != MIC_RESETTING)
-                       cosm_set_state(cdev, MIC_RESETTING);
-               cdev->heartbeat_watchdog_enable = false;
-               if (call_hw_ops)
-                       cdev->hw_ops->stop(cdev, force);
-               cosm_hw_reset(cdev, force);
-               cosm_set_shutdown_status(cdev, MIC_NOP);
-               if (call_hw_ops && cdev->hw_ops->post_reset)
-                       cdev->hw_ops->post_reset(cdev, cdev->state);
-       }
-       mutex_unlock(&cdev->cosm_mutex);
-       flush_work(&cdev->scif_work);
-}
-
-/**
- * cosm_reset_trigger_work - Trigger MIC reset
- * @work: The work structure
- *
- * This work is scheduled whenever the host wants to reset the MIC.
- */
-static void cosm_reset_trigger_work(struct work_struct *work)
-{
-       struct cosm_device *cdev = container_of(work, struct cosm_device,
-                                               reset_trigger_work);
-       cosm_stop(cdev, false);
-}
-
-/**
- * cosm_reset - Schedule MIC reset
- * @cdev: pointer to cosm_device instance
- *
- * RETURNS: An -EINVAL if the card is already READY or 0 for success.
- */
-int cosm_reset(struct cosm_device *cdev)
-{
-       int rc = 0;
-
-       mutex_lock(&cdev->cosm_mutex);
-       if (cdev->state != MIC_READY) {
-               if (cdev->state != MIC_RESETTING) {
-                       cdev->prev_state = cdev->state;
-                       cosm_set_state(cdev, MIC_RESETTING);
-                       schedule_work(&cdev->reset_trigger_work);
-               }
-       } else {
-               dev_err(&cdev->dev, "%s %d MIC is READY\n", __func__, __LINE__);
-               rc = -EINVAL;
-       }
-       mutex_unlock(&cdev->cosm_mutex);
-       return rc;
-}
-
-/**
- * cosm_shutdown - Initiate MIC shutdown.
- * @cdev: pointer to cosm_device instance
- *
- * RETURNS: None
- */
-int cosm_shutdown(struct cosm_device *cdev)
-{
-       struct cosm_msg msg = { .id = COSM_MSG_SHUTDOWN };
-       int rc = 0;
-
-       mutex_lock(&cdev->cosm_mutex);
-       if (cdev->state != MIC_ONLINE) {
-               rc = -EINVAL;
-               dev_err(&cdev->dev, "%s %d skipping shutdown in state: %s\n",
-                       __func__, __LINE__, cosm_state_string[cdev->state]);
-               goto err;
-       }
-
-       if (!cdev->epd) {
-               rc = -ENOTCONN;
-               dev_err(&cdev->dev, "%s %d scif endpoint not connected rc %d\n",
-                       __func__, __LINE__, rc);
-               goto err;
-       }
-
-       rc = scif_send(cdev->epd, &msg, sizeof(msg), SCIF_SEND_BLOCK);
-       if (rc < 0) {
-               dev_err(&cdev->dev, "%s %d scif_send failed rc %d\n",
-                       __func__, __LINE__, rc);
-               goto err;
-       }
-       cdev->heartbeat_watchdog_enable = false;
-       cosm_set_state(cdev, MIC_SHUTTING_DOWN);
-       rc = 0;
-err:
-       mutex_unlock(&cdev->cosm_mutex);
-       return rc;
-}
-
-static int cosm_driver_probe(struct cosm_device *cdev)
-{
-       int rc;
-
-       /* Initialize SCIF server at first probe */
-       if (atomic_add_return(1, &g_num_dev) == 1) {
-               rc = cosm_scif_init();
-               if (rc)
-                       goto scif_exit;
-       }
-       mutex_init(&cdev->cosm_mutex);
-       INIT_WORK(&cdev->reset_trigger_work, cosm_reset_trigger_work);
-       INIT_WORK(&cdev->scif_work, cosm_scif_work);
-       cdev->sysfs_heartbeat_enable = true;
-       cosm_sysfs_init(cdev);
-       cdev->sdev = device_create_with_groups(g_cosm_class, cdev->dev.parent,
-                              MKDEV(0, cdev->index), cdev, cdev->attr_group,
-                              "mic%d", cdev->index);
-       if (IS_ERR(cdev->sdev)) {
-               rc = PTR_ERR(cdev->sdev);
-               dev_err(&cdev->dev, "device_create_with_groups failed rc %d\n",
-                       rc);
-               goto scif_exit;
-       }
-
-       cdev->state_sysfs = sysfs_get_dirent(cdev->sdev->kobj.sd,
-               "state");
-       if (!cdev->state_sysfs) {
-               rc = -ENODEV;
-               dev_err(&cdev->dev, "sysfs_get_dirent failed rc %d\n", rc);
-               goto destroy_device;
-       }
-       cosm_create_debug_dir(cdev);
-       return 0;
-destroy_device:
-       device_destroy(g_cosm_class, MKDEV(0, cdev->index));
-scif_exit:
-       if (atomic_dec_and_test(&g_num_dev))
-               cosm_scif_exit();
-       return rc;
-}
-
-static void cosm_driver_remove(struct cosm_device *cdev)
-{
-       cosm_delete_debug_dir(cdev);
-       sysfs_put(cdev->state_sysfs);
-       device_destroy(g_cosm_class, MKDEV(0, cdev->index));
-       flush_work(&cdev->reset_trigger_work);
-       cosm_stop(cdev, false);
-       if (atomic_dec_and_test(&g_num_dev))
-               cosm_scif_exit();
-
-       /* These sysfs entries might have allocated */
-       kfree(cdev->cmdline);
-       kfree(cdev->firmware);
-       kfree(cdev->ramdisk);
-       kfree(cdev->bootmode);
-}
-
-static int cosm_suspend(struct device *dev)
-{
-       struct cosm_device *cdev = dev_to_cosm(dev);
-
-       mutex_lock(&cdev->cosm_mutex);
-       switch (cdev->state) {
-       /**
-        * Suspend/freeze hooks in userspace have already shutdown the card.
-        * Card should be 'ready' in most cases. It is however possible that
-        * some userspace application initiated a boot. In those cases, we
-        * simply reset the card.
-        */
-       case MIC_ONLINE:
-       case MIC_BOOTING:
-       case MIC_SHUTTING_DOWN:
-               mutex_unlock(&cdev->cosm_mutex);
-               cosm_stop(cdev, false);
-               break;
-       default:
-               mutex_unlock(&cdev->cosm_mutex);
-               break;
-       }
-       return 0;
-}
-
-static const struct dev_pm_ops cosm_pm_ops = {
-       .suspend = cosm_suspend,
-       .freeze = cosm_suspend
-};
-
-static struct cosm_driver cosm_driver = {
-       .driver = {
-               .name =  KBUILD_MODNAME,
-               .owner = THIS_MODULE,
-               .pm = &cosm_pm_ops,
-       },
-       .probe = cosm_driver_probe,
-       .remove = cosm_driver_remove
-};
-
-static int __init cosm_init(void)
-{
-       int ret;
-
-       cosm_init_debugfs();
-
-       g_cosm_class = class_create(THIS_MODULE, cosm_driver_name);
-       if (IS_ERR(g_cosm_class)) {
-               ret = PTR_ERR(g_cosm_class);
-               pr_err("class_create failed ret %d\n", ret);
-               goto cleanup_debugfs;
-       }
-
-       ida_init(&g_cosm_ida);
-       ret = cosm_register_driver(&cosm_driver);
-       if (ret) {
-               pr_err("cosm_register_driver failed ret %d\n", ret);
-               goto ida_destroy;
-       }
-       return 0;
-ida_destroy:
-       ida_destroy(&g_cosm_ida);
-       class_destroy(g_cosm_class);
-cleanup_debugfs:
-       cosm_exit_debugfs();
-       return ret;
-}
-
-static void __exit cosm_exit(void)
-{
-       cosm_unregister_driver(&cosm_driver);
-       ida_destroy(&g_cosm_ida);
-       class_destroy(g_cosm_class);
-       cosm_exit_debugfs();
-}
-
-module_init(cosm_init);
-module_exit(cosm_exit);
-
-MODULE_AUTHOR("Intel Corporation");
-MODULE_DESCRIPTION("Intel(R) MIC Coprocessor State Management (COSM) Driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/misc/mic/cosm/cosm_main.h b/drivers/misc/mic/cosm/cosm_main.h
deleted file mode 100644 (file)
index 5188ad2..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel MIC Coprocessor State Management (COSM) Driver
- */
-#ifndef _COSM_COSM_H_
-#define _COSM_COSM_H_
-
-#include <linux/scif.h>
-#include "../bus/cosm_bus.h"
-
-#define COSM_HEARTBEAT_SEND_SEC 30
-#define SCIF_COSM_LISTEN_PORT  201
-
-/**
- * enum COSM msg id's
- * @COSM_MSG_SHUTDOWN: host->card trigger shutdown
- * @COSM_MSG_SYNC_TIME: host->card send host time to card to sync time
- * @COSM_MSG_HEARTBEAT: card->host heartbeat
- * @COSM_MSG_SHUTDOWN_STATUS: card->host with shutdown status as payload
- */
-enum cosm_msg_id {
-       COSM_MSG_SHUTDOWN,
-       COSM_MSG_SYNC_TIME,
-       COSM_MSG_HEARTBEAT,
-       COSM_MSG_SHUTDOWN_STATUS,
-};
-
-struct cosm_msg {
-       u64 id;
-       union {
-               u64 shutdown_status;
-               struct {
-                       u64 tv_sec;
-                       u64 tv_nsec;
-               } timespec;
-       };
-};
-
-extern const char * const cosm_state_string[];
-extern const char * const cosm_shutdown_status_string[];
-
-void cosm_sysfs_init(struct cosm_device *cdev);
-int cosm_start(struct cosm_device *cdev);
-void cosm_stop(struct cosm_device *cdev, bool force);
-int cosm_reset(struct cosm_device *cdev);
-int cosm_shutdown(struct cosm_device *cdev);
-void cosm_set_state(struct cosm_device *cdev, u8 state);
-void cosm_set_shutdown_status(struct cosm_device *cdev, u8 status);
-void cosm_init_debugfs(void);
-void cosm_exit_debugfs(void);
-void cosm_create_debug_dir(struct cosm_device *cdev);
-void cosm_delete_debug_dir(struct cosm_device *cdev);
-int cosm_scif_init(void);
-void cosm_scif_exit(void);
-void cosm_scif_work(struct work_struct *work);
-
-#endif
diff --git a/drivers/misc/mic/cosm/cosm_scif_server.c b/drivers/misc/mic/cosm/cosm_scif_server.c
deleted file mode 100644 (file)
index 7baec9f..0000000
+++ /dev/null
@@ -1,399 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel MIC Coprocessor State Management (COSM) Driver
- */
-#include <linux/kthread.h>
-#include <linux/sched/signal.h>
-
-#include "cosm_main.h"
-
-/*
- * The COSM driver uses SCIF to communicate between the management node and the
- * MIC cards. SCIF is used to (a) Send a shutdown command to the card (b)
- * receive a shutdown status back from the card upon completion of shutdown and
- * (c) receive periodic heartbeat messages from the card used to deduce if the
- * card has crashed.
- *
- * A COSM server consisting of a SCIF listening endpoint waits for incoming
- * connections from the card. Upon acceptance of the connection, a separate
- * work-item is scheduled to handle SCIF message processing for that card. The
- * life-time of this work-item is therefore the time from which the connection
- * from a card is accepted to the time at which the connection is closed. A new
- * work-item starts each time the card boots and is alive till the card (a)
- * shuts down (b) is reset (c) crashes (d) cosm_client driver on the card is
- * unloaded.
- *
- * From the point of view of COSM interactions with SCIF during card
- * shutdown, reset and crash are as follows:
- *
- * Card shutdown
- * -------------
- * 1. COSM client on the card invokes orderly_poweroff() in response to SHUTDOWN
- *    message from the host.
- * 2. Card driver shutdown callback invokes scif_unregister_device(..) resulting
- *    in scif_remove(..) getting called on the card
- * 3. scif_remove -> scif_stop -> scif_handle_remove_node ->
- *    scif_peer_unregister_device -> device_unregister for the host peer device
- * 4. During device_unregister remove(..) method of cosm_client is invoked which
- *    closes the COSM SCIF endpoint on the card. This results in a SCIF_DISCNCT
- *    message being sent to host SCIF. SCIF_DISCNCT message processing on the
- *    host SCIF sets the host COSM SCIF endpoint state to DISCONNECTED and wakes
- *    up the host COSM thread blocked in scif_poll(..) resulting in
- *    scif_poll(..)  returning EPOLLHUP.
- * 5. On the card, scif_peer_release_dev is next called which results in an
- *    SCIF_EXIT message being sent to the host and after receiving the
- *    SCIF_EXIT_ACK from the host the peer device teardown on the card is
- *    complete.
- * 6. As part of the SCIF_EXIT message processing on the host, host sends a
- *    SCIF_REMOVE_NODE to itself corresponding to the card being removed. This
- *    starts a similar SCIF peer device teardown sequence on the host
- *    corresponding to the card being shut down.
- *
- * Card reset
- * ----------
- * The case of interest here is when the card has not been previously shut down
- * since most of the steps below are skipped in that case:
-
- * 1. cosm_stop(..) invokes hw_ops->stop(..) method of the base PCIe driver
- *    which unregisters the SCIF HW device resulting in scif_remove(..) being
- *    called on the host.
- * 2. scif_remove(..) calls scif_disconnect_node(..) which results in a
- *    SCIF_EXIT message being sent to the card.
- * 3. The card executes scif_stop() as part of SCIF_EXIT message
- *    processing. This results in the COSM endpoint on the card being closed and
- *    the SCIF host peer device on the card getting unregistered similar to
- *    steps 3, 4 and 5 for the card shutdown case above. scif_poll(..) on the
- *    host returns EPOLLHUP as a result.
- * 4. On the host, card peer device unregister and SCIF HW remove(..) also
- *    subsequently complete.
- *
- * Card crash
- * ----------
- * If a reset is issued after the card has crashed, there is no SCIF_DISCNT
- * message from the card which would result in scif_poll(..) returning
- * EPOLLHUP. In this case when the host SCIF driver sends a SCIF_REMOVE_NODE
- * message to itself resulting in the card SCIF peer device being unregistered,
- * this results in a scif_peer_release_dev -> scif_cleanup_scifdev->
- * scif_invalidate_ep call sequence which sets the endpoint state to
- * DISCONNECTED and results in scif_poll(..) returning EPOLLHUP.
- */
-
-#define COSM_SCIF_BACKLOG 16
-#define COSM_HEARTBEAT_CHECK_DELTA_SEC 10
-#define COSM_HEARTBEAT_TIMEOUT_SEC \
-               (COSM_HEARTBEAT_SEND_SEC + COSM_HEARTBEAT_CHECK_DELTA_SEC)
-#define COSM_HEARTBEAT_TIMEOUT_MSEC (COSM_HEARTBEAT_TIMEOUT_SEC * MSEC_PER_SEC)
-
-static struct task_struct *server_thread;
-static scif_epd_t listen_epd;
-
-/* Publish MIC card's shutdown status to user space MIC daemon */
-static void cosm_update_mic_status(struct cosm_device *cdev)
-{
-       if (cdev->shutdown_status_int != MIC_NOP) {
-               cosm_set_shutdown_status(cdev, cdev->shutdown_status_int);
-               cdev->shutdown_status_int = MIC_NOP;
-       }
-}
-
-/* Store MIC card's shutdown status internally when it is received */
-static void cosm_shutdown_status_int(struct cosm_device *cdev,
-                                    enum mic_status shutdown_status)
-{
-       switch (shutdown_status) {
-       case MIC_HALTED:
-       case MIC_POWER_OFF:
-       case MIC_RESTART:
-       case MIC_CRASHED:
-               break;
-       default:
-               dev_err(&cdev->dev, "%s %d Unexpected shutdown_status %d\n",
-                       __func__, __LINE__, shutdown_status);
-               return;
-       };
-       cdev->shutdown_status_int = shutdown_status;
-       cdev->heartbeat_watchdog_enable = false;
-
-       if (cdev->state != MIC_SHUTTING_DOWN)
-               cosm_set_state(cdev, MIC_SHUTTING_DOWN);
-}
-
-/* Non-blocking recv. Read and process all available messages */
-static void cosm_scif_recv(struct cosm_device *cdev)
-{
-       struct cosm_msg msg;
-       int rc;
-
-       while (1) {
-               rc = scif_recv(cdev->epd, &msg, sizeof(msg), 0);
-               if (!rc) {
-                       break;
-               } else if (rc < 0) {
-                       dev_dbg(&cdev->dev, "%s: %d rc %d\n",
-                               __func__, __LINE__, rc);
-                       break;
-               }
-               dev_dbg(&cdev->dev, "%s: %d rc %d id 0x%llx\n",
-                       __func__, __LINE__, rc, msg.id);
-
-               switch (msg.id) {
-               case COSM_MSG_SHUTDOWN_STATUS:
-                       cosm_shutdown_status_int(cdev, msg.shutdown_status);
-                       break;
-               case COSM_MSG_HEARTBEAT:
-                       /* Nothing to do, heartbeat only unblocks scif_poll */
-                       break;
-               default:
-                       dev_err(&cdev->dev, "%s: %d unknown msg.id %lld\n",
-                               __func__, __LINE__, msg.id);
-                       break;
-               }
-       }
-}
-
-/* Publish crashed status for this MIC card */
-static void cosm_set_crashed(struct cosm_device *cdev)
-{
-       dev_err(&cdev->dev, "node alive timeout\n");
-       cosm_shutdown_status_int(cdev, MIC_CRASHED);
-       cosm_update_mic_status(cdev);
-}
-
-/* Send host time to the MIC card to sync system time between host and MIC */
-static void cosm_send_time(struct cosm_device *cdev)
-{
-       struct cosm_msg msg = { .id = COSM_MSG_SYNC_TIME };
-       struct timespec64 ts;
-       int rc;
-
-       ktime_get_real_ts64(&ts);
-       msg.timespec.tv_sec = ts.tv_sec;
-       msg.timespec.tv_nsec = ts.tv_nsec;
-
-       rc = scif_send(cdev->epd, &msg, sizeof(msg), SCIF_SEND_BLOCK);
-       if (rc < 0)
-               dev_err(&cdev->dev, "%s %d scif_send failed rc %d\n",
-                       __func__, __LINE__, rc);
-}
-
-/*
- * Close this cosm_device's endpoint after its peer endpoint on the card has
- * been closed. In all cases except MIC card crash EPOLLHUP on the host is
- * triggered by the client's endpoint being closed.
- */
-static void cosm_scif_close(struct cosm_device *cdev)
-{
-       /*
-        * Because SHUTDOWN_STATUS message is sent by the MIC cards in the
-        * reboot notifier when shutdown is still not complete, we notify mpssd
-        * to reset the card when SCIF endpoint is closed.
-        */
-       cosm_update_mic_status(cdev);
-       scif_close(cdev->epd);
-       cdev->epd = NULL;
-       dev_dbg(&cdev->dev, "%s %d\n", __func__, __LINE__);
-}
-
-/*
- * Set card state to ONLINE when a new SCIF connection from a MIC card is
- * received. Normally the state is BOOTING when the connection comes in, but can
- * be ONLINE if cosm_client driver on the card was unloaded and then reloaded.
- */
-static int cosm_set_online(struct cosm_device *cdev)
-{
-       int rc = 0;
-
-       if (MIC_BOOTING == cdev->state || MIC_ONLINE == cdev->state) {
-               cdev->heartbeat_watchdog_enable = cdev->sysfs_heartbeat_enable;
-               cdev->epd = cdev->newepd;
-               if (cdev->state == MIC_BOOTING)
-                       cosm_set_state(cdev, MIC_ONLINE);
-               cosm_send_time(cdev);
-               dev_dbg(&cdev->dev, "%s %d\n", __func__, __LINE__);
-       } else {
-               dev_warn(&cdev->dev, "%s %d not going online in state: %s\n",
-                        __func__, __LINE__, cosm_state_string[cdev->state]);
-               rc = -EINVAL;
-       }
-       /* Drop reference acquired by bus_find_device in the server thread */
-       put_device(&cdev->dev);
-       return rc;
-}
-
-/*
- * Work function for handling work for a SCIF connection from a particular MIC
- * card. It first sets the card state to ONLINE and then calls scif_poll to
- * block on activity such as incoming messages on the SCIF endpoint. When the
- * endpoint is closed, the work function exits, completing its life cycle, from
- * MIC card boot to card shutdown/reset/crash.
- */
-void cosm_scif_work(struct work_struct *work)
-{
-       struct cosm_device *cdev = container_of(work, struct cosm_device,
-                                               scif_work);
-       struct scif_pollepd pollepd;
-       int rc;
-
-       mutex_lock(&cdev->cosm_mutex);
-       if (cosm_set_online(cdev))
-               goto exit;
-
-       while (1) {
-               pollepd.epd = cdev->epd;
-               pollepd.events = EPOLLIN;
-
-               /* Drop the mutex before blocking in scif_poll(..) */
-               mutex_unlock(&cdev->cosm_mutex);
-               /* poll(..) with timeout on our endpoint */
-               rc = scif_poll(&pollepd, 1, COSM_HEARTBEAT_TIMEOUT_MSEC);
-               mutex_lock(&cdev->cosm_mutex);
-               if (rc < 0) {
-                       dev_err(&cdev->dev, "%s %d scif_poll rc %d\n",
-                               __func__, __LINE__, rc);
-                       continue;
-               }
-
-               /* There is a message from the card */
-               if (pollepd.revents & EPOLLIN)
-                       cosm_scif_recv(cdev);
-
-               /* The peer endpoint is closed or this endpoint disconnected */
-               if (pollepd.revents & EPOLLHUP) {
-                       cosm_scif_close(cdev);
-                       break;
-               }
-
-               /* Did we timeout from poll? */
-               if (!rc && cdev->heartbeat_watchdog_enable)
-                       cosm_set_crashed(cdev);
-       }
-exit:
-       dev_dbg(&cdev->dev, "%s %d exiting\n", __func__, __LINE__);
-       mutex_unlock(&cdev->cosm_mutex);
-}
-
-/*
- * COSM SCIF server thread function. Accepts incoming SCIF connections from MIC
- * cards, finds the correct cosm_device to associate that connection with and
- * schedules individual work items for each MIC card.
- */
-static int cosm_scif_server(void *unused)
-{
-       struct cosm_device *cdev;
-       scif_epd_t newepd;
-       struct scif_port_id port_id;
-       int rc;
-
-       allow_signal(SIGKILL);
-
-       while (!kthread_should_stop()) {
-               rc = scif_accept(listen_epd, &port_id, &newepd,
-                                SCIF_ACCEPT_SYNC);
-               if (rc < 0) {
-                       if (-ERESTARTSYS != rc)
-                               pr_err("%s %d rc %d\n", __func__, __LINE__, rc);
-                       continue;
-               }
-
-               /*
-                * Associate the incoming connection with a particular
-                * cosm_device, COSM device ID == SCIF node ID - 1
-                */
-               cdev = cosm_find_cdev_by_id(port_id.node - 1);
-               if (!cdev)
-                       continue;
-               cdev->newepd = newepd;
-               schedule_work(&cdev->scif_work);
-       }
-
-       pr_debug("%s %d Server thread stopped\n", __func__, __LINE__);
-       return 0;
-}
-
-static int cosm_scif_listen(void)
-{
-       int rc;
-
-       listen_epd = scif_open();
-       if (!listen_epd) {
-               pr_err("%s %d scif_open failed\n", __func__, __LINE__);
-               return -ENOMEM;
-       }
-
-       rc = scif_bind(listen_epd, SCIF_COSM_LISTEN_PORT);
-       if (rc < 0) {
-               pr_err("%s %d scif_bind failed rc %d\n",
-                      __func__, __LINE__, rc);
-               goto err;
-       }
-
-       rc = scif_listen(listen_epd, COSM_SCIF_BACKLOG);
-       if (rc < 0) {
-               pr_err("%s %d scif_listen rc %d\n", __func__, __LINE__, rc);
-               goto err;
-       }
-       pr_debug("%s %d listen_epd set up\n", __func__, __LINE__);
-       return 0;
-err:
-       scif_close(listen_epd);
-       listen_epd = NULL;
-       return rc;
-}
-
-static void cosm_scif_listen_exit(void)
-{
-       pr_debug("%s %d closing listen_epd\n", __func__, __LINE__);
-       if (listen_epd) {
-               scif_close(listen_epd);
-               listen_epd = NULL;
-       }
-}
-
-/*
- * Create a listening SCIF endpoint and a server kthread which accepts incoming
- * SCIF connections from MIC cards
- */
-int cosm_scif_init(void)
-{
-       int rc = cosm_scif_listen();
-
-       if (rc) {
-               pr_err("%s %d cosm_scif_listen rc %d\n",
-                      __func__, __LINE__, rc);
-               goto err;
-       }
-
-       server_thread = kthread_run(cosm_scif_server, NULL, "cosm_server");
-       if (IS_ERR(server_thread)) {
-               rc = PTR_ERR(server_thread);
-               pr_err("%s %d kthread_run rc %d\n", __func__, __LINE__, rc);
-               goto listen_exit;
-       }
-       return 0;
-listen_exit:
-       cosm_scif_listen_exit();
-err:
-       return rc;
-}
-
-/* Stop the running server thread and close the listening SCIF endpoint */
-void cosm_scif_exit(void)
-{
-       int rc;
-
-       if (!IS_ERR_OR_NULL(server_thread)) {
-               rc = send_sig(SIGKILL, server_thread, 0);
-               if (rc) {
-                       pr_err("%s %d send_sig rc %d\n",
-                              __func__, __LINE__, rc);
-                       return;
-               }
-               kthread_stop(server_thread);
-       }
-
-       cosm_scif_listen_exit();
-}
diff --git a/drivers/misc/mic/cosm/cosm_sysfs.c b/drivers/misc/mic/cosm/cosm_sysfs.c
deleted file mode 100644 (file)
index e6dac96..0000000
+++ /dev/null
@@ -1,449 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel MIC Coprocessor State Management (COSM) Driver
- */
-#include <linux/slab.h>
-#include "cosm_main.h"
-
-/*
- * A state-to-string lookup table, for exposing a human readable state
- * via sysfs. Always keep in sync with enum cosm_states
- */
-const char * const cosm_state_string[] = {
-       [MIC_READY] = "ready",
-       [MIC_BOOTING] = "booting",
-       [MIC_ONLINE] = "online",
-       [MIC_SHUTTING_DOWN] = "shutting_down",
-       [MIC_RESETTING] = "resetting",
-       [MIC_RESET_FAILED] = "reset_failed",
-};
-
-/*
- * A shutdown-status-to-string lookup table, for exposing a human
- * readable state via sysfs. Always keep in sync with enum cosm_shutdown_status
- */
-const char * const cosm_shutdown_status_string[] = {
-       [MIC_NOP] = "nop",
-       [MIC_CRASHED] = "crashed",
-       [MIC_HALTED] = "halted",
-       [MIC_POWER_OFF] = "poweroff",
-       [MIC_RESTART] = "restart",
-};
-
-void cosm_set_shutdown_status(struct cosm_device *cdev, u8 shutdown_status)
-{
-       dev_dbg(&cdev->dev, "Shutdown Status %s -> %s\n",
-               cosm_shutdown_status_string[cdev->shutdown_status],
-               cosm_shutdown_status_string[shutdown_status]);
-       cdev->shutdown_status = shutdown_status;
-}
-
-void cosm_set_state(struct cosm_device *cdev, u8 state)
-{
-       dev_dbg(&cdev->dev, "State %s -> %s\n",
-               cosm_state_string[cdev->state],
-               cosm_state_string[state]);
-       cdev->state = state;
-       sysfs_notify_dirent(cdev->state_sysfs);
-}
-
-static ssize_t
-family_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-
-       if (!cdev)
-               return -EINVAL;
-
-       return cdev->hw_ops->family(cdev, buf);
-}
-static DEVICE_ATTR_RO(family);
-
-static ssize_t
-stepping_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-
-       if (!cdev)
-               return -EINVAL;
-
-       return cdev->hw_ops->stepping(cdev, buf);
-}
-static DEVICE_ATTR_RO(stepping);
-
-static ssize_t
-state_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-
-       if (!cdev || cdev->state >= MIC_LAST)
-               return -EINVAL;
-
-       return scnprintf(buf, PAGE_SIZE, "%s\n",
-               cosm_state_string[cdev->state]);
-}
-
-static ssize_t
-state_store(struct device *dev, struct device_attribute *attr,
-           const char *buf, size_t count)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-       int rc;
-
-       if (!cdev)
-               return -EINVAL;
-
-       if (sysfs_streq(buf, "boot")) {
-               rc = cosm_start(cdev);
-               goto done;
-       }
-       if (sysfs_streq(buf, "reset")) {
-               rc = cosm_reset(cdev);
-               goto done;
-       }
-
-       if (sysfs_streq(buf, "shutdown")) {
-               rc = cosm_shutdown(cdev);
-               goto done;
-       }
-       rc = -EINVAL;
-done:
-       if (rc)
-               count = rc;
-       return count;
-}
-static DEVICE_ATTR_RW(state);
-
-static ssize_t shutdown_status_show(struct device *dev,
-                                   struct device_attribute *attr, char *buf)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-
-       if (!cdev || cdev->shutdown_status >= MIC_STATUS_LAST)
-               return -EINVAL;
-
-       return scnprintf(buf, PAGE_SIZE, "%s\n",
-               cosm_shutdown_status_string[cdev->shutdown_status]);
-}
-static DEVICE_ATTR_RO(shutdown_status);
-
-static ssize_t
-heartbeat_enable_show(struct device *dev,
-                     struct device_attribute *attr, char *buf)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-
-       if (!cdev)
-               return -EINVAL;
-
-       return scnprintf(buf, PAGE_SIZE, "%d\n", cdev->sysfs_heartbeat_enable);
-}
-
-static ssize_t
-heartbeat_enable_store(struct device *dev,
-                      struct device_attribute *attr,
-                      const char *buf, size_t count)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-       int enable;
-       int ret;
-
-       if (!cdev)
-               return -EINVAL;
-
-       mutex_lock(&cdev->cosm_mutex);
-       ret = kstrtoint(buf, 10, &enable);
-       if (ret)
-               goto unlock;
-
-       cdev->sysfs_heartbeat_enable = enable;
-       /* if state is not online, cdev->heartbeat_watchdog_enable is 0 */
-       if (cdev->state == MIC_ONLINE)
-               cdev->heartbeat_watchdog_enable = enable;
-       ret = count;
-unlock:
-       mutex_unlock(&cdev->cosm_mutex);
-       return ret;
-}
-static DEVICE_ATTR_RW(heartbeat_enable);
-
-static ssize_t
-cmdline_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-       char *cmdline;
-
-       if (!cdev)
-               return -EINVAL;
-
-       cmdline = cdev->cmdline;
-
-       if (cmdline)
-               return scnprintf(buf, PAGE_SIZE, "%s\n", cmdline);
-       return 0;
-}
-
-static ssize_t
-cmdline_store(struct device *dev, struct device_attribute *attr,
-             const char *buf, size_t count)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-
-       if (!cdev)
-               return -EINVAL;
-
-       mutex_lock(&cdev->cosm_mutex);
-       kfree(cdev->cmdline);
-
-       cdev->cmdline = kmalloc(count + 1, GFP_KERNEL);
-       if (!cdev->cmdline) {
-               count = -ENOMEM;
-               goto unlock;
-       }
-
-       strncpy(cdev->cmdline, buf, count);
-
-       if (cdev->cmdline[count - 1] == '\n')
-               cdev->cmdline[count - 1] = '\0';
-       else
-               cdev->cmdline[count] = '\0';
-unlock:
-       mutex_unlock(&cdev->cosm_mutex);
-       return count;
-}
-static DEVICE_ATTR_RW(cmdline);
-
-static ssize_t
-firmware_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-       char *firmware;
-
-       if (!cdev)
-               return -EINVAL;
-
-       firmware = cdev->firmware;
-
-       if (firmware)
-               return scnprintf(buf, PAGE_SIZE, "%s\n", firmware);
-       return 0;
-}
-
-static ssize_t
-firmware_store(struct device *dev, struct device_attribute *attr,
-              const char *buf, size_t count)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-
-       if (!cdev)
-               return -EINVAL;
-
-       mutex_lock(&cdev->cosm_mutex);
-       kfree(cdev->firmware);
-
-       cdev->firmware = kmalloc(count + 1, GFP_KERNEL);
-       if (!cdev->firmware) {
-               count = -ENOMEM;
-               goto unlock;
-       }
-       strncpy(cdev->firmware, buf, count);
-
-       if (cdev->firmware[count - 1] == '\n')
-               cdev->firmware[count - 1] = '\0';
-       else
-               cdev->firmware[count] = '\0';
-unlock:
-       mutex_unlock(&cdev->cosm_mutex);
-       return count;
-}
-static DEVICE_ATTR_RW(firmware);
-
-static ssize_t
-ramdisk_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-       char *ramdisk;
-
-       if (!cdev)
-               return -EINVAL;
-
-       ramdisk = cdev->ramdisk;
-
-       if (ramdisk)
-               return scnprintf(buf, PAGE_SIZE, "%s\n", ramdisk);
-       return 0;
-}
-
-static ssize_t
-ramdisk_store(struct device *dev, struct device_attribute *attr,
-             const char *buf, size_t count)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-
-       if (!cdev)
-               return -EINVAL;
-
-       mutex_lock(&cdev->cosm_mutex);
-       kfree(cdev->ramdisk);
-
-       cdev->ramdisk = kmalloc(count + 1, GFP_KERNEL);
-       if (!cdev->ramdisk) {
-               count = -ENOMEM;
-               goto unlock;
-       }
-
-       strncpy(cdev->ramdisk, buf, count);
-
-       if (cdev->ramdisk[count - 1] == '\n')
-               cdev->ramdisk[count - 1] = '\0';
-       else
-               cdev->ramdisk[count] = '\0';
-unlock:
-       mutex_unlock(&cdev->cosm_mutex);
-       return count;
-}
-static DEVICE_ATTR_RW(ramdisk);
-
-static ssize_t
-bootmode_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-       char *bootmode;
-
-       if (!cdev)
-               return -EINVAL;
-
-       bootmode = cdev->bootmode;
-
-       if (bootmode)
-               return scnprintf(buf, PAGE_SIZE, "%s\n", bootmode);
-       return 0;
-}
-
-static ssize_t
-bootmode_store(struct device *dev, struct device_attribute *attr,
-              const char *buf, size_t count)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-
-       if (!cdev)
-               return -EINVAL;
-
-       if (!sysfs_streq(buf, "linux") && !sysfs_streq(buf, "flash"))
-               return -EINVAL;
-
-       mutex_lock(&cdev->cosm_mutex);
-       kfree(cdev->bootmode);
-
-       cdev->bootmode = kmalloc(count + 1, GFP_KERNEL);
-       if (!cdev->bootmode) {
-               count = -ENOMEM;
-               goto unlock;
-       }
-
-       strncpy(cdev->bootmode, buf, count);
-
-       if (cdev->bootmode[count - 1] == '\n')
-               cdev->bootmode[count - 1] = '\0';
-       else
-               cdev->bootmode[count] = '\0';
-unlock:
-       mutex_unlock(&cdev->cosm_mutex);
-       return count;
-}
-static DEVICE_ATTR_RW(bootmode);
-
-static ssize_t
-log_buf_addr_show(struct device *dev, struct device_attribute *attr,
-                 char *buf)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-
-       if (!cdev)
-               return -EINVAL;
-
-       return scnprintf(buf, PAGE_SIZE, "%p\n", cdev->log_buf_addr);
-}
-
-static ssize_t
-log_buf_addr_store(struct device *dev, struct device_attribute *attr,
-                  const char *buf, size_t count)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-       int ret;
-       unsigned long addr;
-
-       if (!cdev)
-               return -EINVAL;
-
-       ret = kstrtoul(buf, 16, &addr);
-       if (ret)
-               goto exit;
-
-       cdev->log_buf_addr = (void *)addr;
-       ret = count;
-exit:
-       return ret;
-}
-static DEVICE_ATTR_RW(log_buf_addr);
-
-static ssize_t
-log_buf_len_show(struct device *dev, struct device_attribute *attr,
-                char *buf)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-
-       if (!cdev)
-               return -EINVAL;
-
-       return scnprintf(buf, PAGE_SIZE, "%p\n", cdev->log_buf_len);
-}
-
-static ssize_t
-log_buf_len_store(struct device *dev, struct device_attribute *attr,
-                 const char *buf, size_t count)
-{
-       struct cosm_device *cdev = dev_get_drvdata(dev);
-       int ret;
-       unsigned long addr;
-
-       if (!cdev)
-               return -EINVAL;
-
-       ret = kstrtoul(buf, 16, &addr);
-       if (ret)
-               goto exit;
-
-       cdev->log_buf_len = (int *)addr;
-       ret = count;
-exit:
-       return ret;
-}
-static DEVICE_ATTR_RW(log_buf_len);
-
-static struct attribute *cosm_default_attrs[] = {
-       &dev_attr_family.attr,
-       &dev_attr_stepping.attr,
-       &dev_attr_state.attr,
-       &dev_attr_shutdown_status.attr,
-       &dev_attr_heartbeat_enable.attr,
-       &dev_attr_cmdline.attr,
-       &dev_attr_firmware.attr,
-       &dev_attr_ramdisk.attr,
-       &dev_attr_bootmode.attr,
-       &dev_attr_log_buf_addr.attr,
-       &dev_attr_log_buf_len.attr,
-
-       NULL
-};
-
-ATTRIBUTE_GROUPS(cosm_default);
-
-void cosm_sysfs_init(struct cosm_device *cdev)
-{
-       cdev->attr_group = cosm_default_groups;
-}
diff --git a/drivers/misc/mic/cosm_client/Makefile b/drivers/misc/mic/cosm_client/Makefile
deleted file mode 100644 (file)
index 5b62270..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile - Intel MIC COSM Client Driver
-# Copyright(c) 2015, Intel Corporation.
-#
-obj-$(CONFIG_MIC_COSM) += cosm_client.o
-
-cosm_client-objs += cosm_scif_client.o
diff --git a/drivers/misc/mic/cosm_client/cosm_scif_client.c b/drivers/misc/mic/cosm_client/cosm_scif_client.c
deleted file mode 100644 (file)
index a03213d..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel MIC COSM Client Driver
- */
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/reboot.h>
-#include <linux/kthread.h>
-#include <linux/sched/signal.h>
-
-#include "../cosm/cosm_main.h"
-
-#define COSM_SCIF_MAX_RETRIES 10
-#define COSM_HEARTBEAT_SEND_MSEC (COSM_HEARTBEAT_SEND_SEC * MSEC_PER_SEC)
-
-static struct task_struct *client_thread;
-static scif_epd_t client_epd;
-static struct scif_peer_dev *client_spdev;
-
-/*
- * Reboot notifier: receives shutdown status from the OS and communicates it
- * back to the COSM process on the host
- */
-static int cosm_reboot_event(struct notifier_block *this, unsigned long event,
-                            void *ptr)
-{
-       struct cosm_msg msg = { .id = COSM_MSG_SHUTDOWN_STATUS };
-       int rc;
-
-       event = (event == SYS_RESTART) ? SYSTEM_RESTART : event;
-       dev_info(&client_spdev->dev, "%s %d received event %ld\n",
-                __func__, __LINE__, event);
-
-       msg.shutdown_status = event;
-       rc = scif_send(client_epd, &msg, sizeof(msg), SCIF_SEND_BLOCK);
-       if (rc < 0)
-               dev_err(&client_spdev->dev, "%s %d scif_send rc %d\n",
-                       __func__, __LINE__, rc);
-
-       return NOTIFY_DONE;
-}
-
-static struct notifier_block cosm_reboot = {
-       .notifier_call  = cosm_reboot_event,
-};
-
-/* Set system time from timespec value received from the host */
-static void cosm_set_time(struct cosm_msg *msg)
-{
-       struct timespec64 ts = {
-               .tv_sec = msg->timespec.tv_sec,
-               .tv_nsec = msg->timespec.tv_nsec,
-       };
-       int rc = do_settimeofday64(&ts);
-
-       if (rc)
-               dev_err(&client_spdev->dev, "%s: %d settimeofday rc %d\n",
-                       __func__, __LINE__, rc);
-}
-
-/* COSM client receive message processing */
-static void cosm_client_recv(void)
-{
-       struct cosm_msg msg;
-       int rc;
-
-       while (1) {
-               rc = scif_recv(client_epd, &msg, sizeof(msg), 0);
-               if (!rc) {
-                       return;
-               } else if (rc < 0) {
-                       dev_err(&client_spdev->dev, "%s: %d rc %d\n",
-                               __func__, __LINE__, rc);
-                       return;
-               }
-
-               dev_dbg(&client_spdev->dev, "%s: %d rc %d id 0x%llx\n",
-                       __func__, __LINE__, rc, msg.id);
-
-               switch (msg.id) {
-               case COSM_MSG_SYNC_TIME:
-                       cosm_set_time(&msg);
-                       break;
-               case COSM_MSG_SHUTDOWN:
-                       orderly_poweroff(true);
-                       break;
-               default:
-                       dev_err(&client_spdev->dev, "%s: %d unknown id %lld\n",
-                               __func__, __LINE__, msg.id);
-                       break;
-               }
-       }
-}
-
-/* Initiate connection to the COSM server on the host */
-static int cosm_scif_connect(void)
-{
-       struct scif_port_id port_id;
-       int i, rc;
-
-       client_epd = scif_open();
-       if (!client_epd) {
-               dev_err(&client_spdev->dev, "%s %d scif_open failed\n",
-                       __func__, __LINE__);
-               return -ENOMEM;
-       }
-
-       port_id.node = 0;
-       port_id.port = SCIF_COSM_LISTEN_PORT;
-
-       for (i = 0; i < COSM_SCIF_MAX_RETRIES; i++) {
-               rc = scif_connect(client_epd, &port_id);
-               if (rc < 0)
-                       msleep(1000);
-               else
-                       break;
-       }
-
-       if (rc < 0) {
-               dev_err(&client_spdev->dev, "%s %d scif_connect rc %d\n",
-                       __func__, __LINE__, rc);
-               scif_close(client_epd);
-               client_epd = NULL;
-       }
-       return rc < 0 ? rc : 0;
-}
-
-/* Close host SCIF connection */
-static void cosm_scif_connect_exit(void)
-{
-       if (client_epd) {
-               scif_close(client_epd);
-               client_epd = NULL;
-       }
-}
-
-/*
- * COSM SCIF client thread function: waits for messages from the host and sends
- * a heartbeat to the host
- */
-static int cosm_scif_client(void *unused)
-{
-       struct cosm_msg msg = { .id = COSM_MSG_HEARTBEAT };
-       struct scif_pollepd pollepd;
-       int rc;
-
-       allow_signal(SIGKILL);
-
-       while (!kthread_should_stop()) {
-               pollepd.epd = client_epd;
-               pollepd.events = EPOLLIN;
-
-               rc = scif_poll(&pollepd, 1, COSM_HEARTBEAT_SEND_MSEC);
-               if (rc < 0) {
-                       if (-EINTR != rc)
-                               dev_err(&client_spdev->dev,
-                                       "%s %d scif_poll rc %d\n",
-                                       __func__, __LINE__, rc);
-                       continue;
-               }
-
-               if (pollepd.revents & EPOLLIN)
-                       cosm_client_recv();
-
-               msg.id = COSM_MSG_HEARTBEAT;
-               rc = scif_send(client_epd, &msg, sizeof(msg), SCIF_SEND_BLOCK);
-               if (rc < 0)
-                       dev_err(&client_spdev->dev, "%s %d scif_send rc %d\n",
-                               __func__, __LINE__, rc);
-       }
-
-       dev_dbg(&client_spdev->dev, "%s %d Client thread stopped\n",
-               __func__, __LINE__);
-       return 0;
-}
-
-static void cosm_scif_probe(struct scif_peer_dev *spdev)
-{
-       int rc;
-
-       dev_dbg(&spdev->dev, "%s %d: dnode %d\n",
-               __func__, __LINE__, spdev->dnode);
-
-       /* We are only interested in the host with spdev->dnode == 0 */
-       if (spdev->dnode)
-               return;
-
-       client_spdev = spdev;
-       rc = cosm_scif_connect();
-       if (rc)
-               goto exit;
-
-       rc = register_reboot_notifier(&cosm_reboot);
-       if (rc) {
-               dev_err(&spdev->dev,
-                       "reboot notifier registration failed rc %d\n", rc);
-               goto connect_exit;
-       }
-
-       client_thread = kthread_run(cosm_scif_client, NULL, "cosm_client");
-       if (IS_ERR(client_thread)) {
-               rc = PTR_ERR(client_thread);
-               dev_err(&spdev->dev, "%s %d kthread_run rc %d\n",
-                       __func__, __LINE__, rc);
-               goto unreg_reboot;
-       }
-       return;
-unreg_reboot:
-       unregister_reboot_notifier(&cosm_reboot);
-connect_exit:
-       cosm_scif_connect_exit();
-exit:
-       client_spdev = NULL;
-}
-
-static void cosm_scif_remove(struct scif_peer_dev *spdev)
-{
-       int rc;
-
-       dev_dbg(&spdev->dev, "%s %d: dnode %d\n",
-               __func__, __LINE__, spdev->dnode);
-
-       if (spdev->dnode)
-               return;
-
-       if (!IS_ERR_OR_NULL(client_thread)) {
-               rc = send_sig(SIGKILL, client_thread, 0);
-               if (rc) {
-                       pr_err("%s %d send_sig rc %d\n",
-                              __func__, __LINE__, rc);
-                       return;
-               }
-               kthread_stop(client_thread);
-       }
-       unregister_reboot_notifier(&cosm_reboot);
-       cosm_scif_connect_exit();
-       client_spdev = NULL;
-}
-
-static struct scif_client scif_client_cosm = {
-       .name = KBUILD_MODNAME,
-       .probe = cosm_scif_probe,
-       .remove = cosm_scif_remove,
-};
-
-static int __init cosm_client_init(void)
-{
-       int rc = scif_client_register(&scif_client_cosm);
-
-       if (rc)
-               pr_err("scif_client_register failed rc %d\n", rc);
-       return rc;
-}
-
-static void __exit cosm_client_exit(void)
-{
-       scif_client_unregister(&scif_client_cosm);
-}
-
-module_init(cosm_client_init);
-module_exit(cosm_client_exit);
-
-MODULE_AUTHOR("Intel Corporation");
-MODULE_DESCRIPTION("Intel(R) MIC card OS state management client driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/misc/mic/host/Makefile b/drivers/misc/mic/host/Makefile
deleted file mode 100644 (file)
index 25f1533..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Makefile - Intel MIC Linux driver.
-# Copyright(c) 2013, Intel Corporation.
-#
-obj-$(CONFIG_INTEL_MIC_HOST) += mic_host.o
-mic_host-objs := mic_main.o
-mic_host-objs += mic_x100.o
-mic_host-objs += mic_smpt.o
-mic_host-objs += mic_intr.o
-mic_host-objs += mic_boot.o
-mic_host-objs += mic_debugfs.o
diff --git a/drivers/misc/mic/host/mic_boot.c b/drivers/misc/mic/host/mic_boot.c
deleted file mode 100644 (file)
index 8cb85b8..0000000
+++ /dev/null
@@ -1,588 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC Host driver.
- */
-#include <linux/delay.h>
-#include <linux/firmware.h>
-#include <linux/pci.h>
-#include <linux/kmod.h>
-#include <linux/dma-map-ops.h>
-#include <linux/mic_common.h>
-#include <linux/mic_bus.h>
-#include "../bus/scif_bus.h"
-#include "../bus/vop_bus.h"
-#include "../common/mic_dev.h"
-#include "mic_device.h"
-#include "mic_smpt.h"
-
-static inline struct mic_device *vpdev_to_mdev(struct device *dev)
-{
-       return dev_get_drvdata(dev->parent);
-}
-
-static dma_addr_t
-_mic_dma_map_page(struct device *dev, struct page *page,
-                 unsigned long offset, size_t size,
-                 enum dma_data_direction dir, unsigned long attrs)
-{
-       void *va = phys_to_virt(page_to_phys(page)) + offset;
-       struct mic_device *mdev = vpdev_to_mdev(dev);
-
-       return mic_map_single(mdev, va, size);
-}
-
-static void _mic_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
-                               size_t size, enum dma_data_direction dir,
-                               unsigned long attrs)
-{
-       struct mic_device *mdev = vpdev_to_mdev(dev);
-
-       mic_unmap_single(mdev, dma_addr, size);
-}
-
-static const struct dma_map_ops _mic_dma_ops = {
-       .map_page = _mic_dma_map_page,
-       .unmap_page = _mic_dma_unmap_page,
-};
-
-static struct mic_irq *
-__mic_request_irq(struct vop_device *vpdev,
-                 irqreturn_t (*func)(int irq, void *data),
-                 const char *name, void *data, int intr_src)
-{
-       struct mic_device *mdev = vpdev_to_mdev(&vpdev->dev);
-
-       return mic_request_threaded_irq(mdev, func, NULL, name, data,
-                                       intr_src, MIC_INTR_DB);
-}
-
-static void __mic_free_irq(struct vop_device *vpdev,
-                          struct mic_irq *cookie, void *data)
-{
-       struct mic_device *mdev = vpdev_to_mdev(&vpdev->dev);
-
-       mic_free_irq(mdev, cookie, data);
-}
-
-static void __mic_ack_interrupt(struct vop_device *vpdev, int num)
-{
-       struct mic_device *mdev = vpdev_to_mdev(&vpdev->dev);
-
-       mdev->ops->intr_workarounds(mdev);
-}
-
-static int __mic_next_db(struct vop_device *vpdev)
-{
-       struct mic_device *mdev = vpdev_to_mdev(&vpdev->dev);
-
-       return mic_next_db(mdev);
-}
-
-static void *__mic_get_dp(struct vop_device *vpdev)
-{
-       struct mic_device *mdev = vpdev_to_mdev(&vpdev->dev);
-
-       return mdev->dp;
-}
-
-static void __iomem *__mic_get_remote_dp(struct vop_device *vpdev)
-{
-       return NULL;
-}
-
-static void __mic_send_intr(struct vop_device *vpdev, int db)
-{
-       struct mic_device *mdev = vpdev_to_mdev(&vpdev->dev);
-
-       mdev->ops->send_intr(mdev, db);
-}
-
-static void __iomem *__mic_ioremap(struct vop_device *vpdev,
-                                  dma_addr_t pa, size_t len)
-{
-       struct mic_device *mdev = vpdev_to_mdev(&vpdev->dev);
-
-       return mdev->aper.va + pa;
-}
-
-static void __mic_iounmap(struct vop_device *vpdev, void __iomem *va)
-{
-       /* nothing to do */
-}
-
-static struct vop_hw_ops vop_hw_ops = {
-       .request_irq = __mic_request_irq,
-       .free_irq = __mic_free_irq,
-       .ack_interrupt = __mic_ack_interrupt,
-       .next_db = __mic_next_db,
-       .get_dp = __mic_get_dp,
-       .get_remote_dp = __mic_get_remote_dp,
-       .send_intr = __mic_send_intr,
-       .remap = __mic_ioremap,
-       .unmap = __mic_iounmap,
-};
-
-static inline struct mic_device *scdev_to_mdev(struct scif_hw_dev *scdev)
-{
-       return dev_get_drvdata(scdev->dev.parent);
-}
-
-static void *__mic_dma_alloc(struct device *dev, size_t size,
-                            dma_addr_t *dma_handle, gfp_t gfp,
-                            unsigned long attrs)
-{
-       struct scif_hw_dev *scdev = dev_get_drvdata(dev);
-       struct mic_device *mdev = scdev_to_mdev(scdev);
-       dma_addr_t tmp;
-       void *va = kzalloc(size, gfp);
-
-       if (va) {
-               tmp = mic_map_single(mdev, va, size);
-               if (dma_mapping_error(dev, tmp)) {
-                       kfree(va);
-                       va = NULL;
-               } else {
-                       *dma_handle = tmp;
-               }
-       }
-       return va;
-}
-
-static void __mic_dma_free(struct device *dev, size_t size, void *vaddr,
-                          dma_addr_t dma_handle, unsigned long attrs)
-{
-       struct scif_hw_dev *scdev = dev_get_drvdata(dev);
-       struct mic_device *mdev = scdev_to_mdev(scdev);
-
-       mic_unmap_single(mdev, dma_handle, size);
-       kfree(vaddr);
-}
-
-static dma_addr_t
-__mic_dma_map_page(struct device *dev, struct page *page, unsigned long offset,
-                  size_t size, enum dma_data_direction dir,
-                  unsigned long attrs)
-{
-       void *va = phys_to_virt(page_to_phys(page)) + offset;
-       struct scif_hw_dev *scdev = dev_get_drvdata(dev);
-       struct mic_device *mdev = scdev_to_mdev(scdev);
-
-       return mic_map_single(mdev, va, size);
-}
-
-static void
-__mic_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
-                    size_t size, enum dma_data_direction dir,
-                    unsigned long attrs)
-{
-       struct scif_hw_dev *scdev = dev_get_drvdata(dev);
-       struct mic_device *mdev = scdev_to_mdev(scdev);
-
-       mic_unmap_single(mdev, dma_addr, size);
-}
-
-static int __mic_dma_map_sg(struct device *dev, struct scatterlist *sg,
-                           int nents, enum dma_data_direction dir,
-                           unsigned long attrs)
-{
-       struct scif_hw_dev *scdev = dev_get_drvdata(dev);
-       struct mic_device *mdev = scdev_to_mdev(scdev);
-       struct scatterlist *s;
-       int i, j, ret;
-       dma_addr_t da;
-
-       ret = dma_map_sg(&mdev->pdev->dev, sg, nents, dir);
-       if (ret <= 0)
-               return 0;
-
-       for_each_sg(sg, s, nents, i) {
-               da = mic_map(mdev, sg_dma_address(s) + s->offset, s->length);
-               if (!da)
-                       goto err;
-               sg_dma_address(s) = da;
-       }
-       return nents;
-err:
-       for_each_sg(sg, s, i, j) {
-               mic_unmap(mdev, sg_dma_address(s), s->length);
-               sg_dma_address(s) = mic_to_dma_addr(mdev, sg_dma_address(s));
-       }
-       dma_unmap_sg(&mdev->pdev->dev, sg, nents, dir);
-       return 0;
-}
-
-static void __mic_dma_unmap_sg(struct device *dev,
-                              struct scatterlist *sg, int nents,
-                              enum dma_data_direction dir,
-                              unsigned long attrs)
-{
-       struct scif_hw_dev *scdev = dev_get_drvdata(dev);
-       struct mic_device *mdev = scdev_to_mdev(scdev);
-       struct scatterlist *s;
-       dma_addr_t da;
-       int i;
-
-       for_each_sg(sg, s, nents, i) {
-               da = mic_to_dma_addr(mdev, sg_dma_address(s));
-               mic_unmap(mdev, sg_dma_address(s), s->length);
-               sg_dma_address(s) = da;
-       }
-       dma_unmap_sg(&mdev->pdev->dev, sg, nents, dir);
-}
-
-static const struct dma_map_ops __mic_dma_ops = {
-       .alloc = __mic_dma_alloc,
-       .free = __mic_dma_free,
-       .map_page = __mic_dma_map_page,
-       .unmap_page = __mic_dma_unmap_page,
-       .map_sg = __mic_dma_map_sg,
-       .unmap_sg = __mic_dma_unmap_sg,
-};
-
-static struct mic_irq *
-___mic_request_irq(struct scif_hw_dev *scdev,
-                  irqreturn_t (*func)(int irq, void *data),
-                                      const char *name,
-                                      void *data, int db)
-{
-       struct mic_device *mdev = scdev_to_mdev(scdev);
-
-       return mic_request_threaded_irq(mdev, func, NULL, name, data,
-                                       db, MIC_INTR_DB);
-}
-
-static void
-___mic_free_irq(struct scif_hw_dev *scdev,
-               struct mic_irq *cookie, void *data)
-{
-       struct mic_device *mdev = scdev_to_mdev(scdev);
-
-       mic_free_irq(mdev, cookie, data);
-}
-
-static void ___mic_ack_interrupt(struct scif_hw_dev *scdev, int num)
-{
-       struct mic_device *mdev = scdev_to_mdev(scdev);
-
-       mdev->ops->intr_workarounds(mdev);
-}
-
-static int ___mic_next_db(struct scif_hw_dev *scdev)
-{
-       struct mic_device *mdev = scdev_to_mdev(scdev);
-
-       return mic_next_db(mdev);
-}
-
-static void ___mic_send_intr(struct scif_hw_dev *scdev, int db)
-{
-       struct mic_device *mdev = scdev_to_mdev(scdev);
-
-       mdev->ops->send_intr(mdev, db);
-}
-
-static void __iomem *___mic_ioremap(struct scif_hw_dev *scdev,
-                                   phys_addr_t pa, size_t len)
-{
-       struct mic_device *mdev = scdev_to_mdev(scdev);
-
-       return mdev->aper.va + pa;
-}
-
-static void ___mic_iounmap(struct scif_hw_dev *scdev, void __iomem *va)
-{
-       /* nothing to do */
-}
-
-static struct scif_hw_ops scif_hw_ops = {
-       .request_irq = ___mic_request_irq,
-       .free_irq = ___mic_free_irq,
-       .ack_interrupt = ___mic_ack_interrupt,
-       .next_db = ___mic_next_db,
-       .send_intr = ___mic_send_intr,
-       .remap = ___mic_ioremap,
-       .unmap = ___mic_iounmap,
-};
-
-static inline struct mic_device *mbdev_to_mdev(struct mbus_device *mbdev)
-{
-       return dev_get_drvdata(mbdev->dev.parent);
-}
-
-static dma_addr_t
-mic_dma_map_page(struct device *dev, struct page *page,
-                unsigned long offset, size_t size, enum dma_data_direction dir,
-                unsigned long attrs)
-{
-       void *va = phys_to_virt(page_to_phys(page)) + offset;
-       struct mic_device *mdev = dev_get_drvdata(dev->parent);
-
-       return mic_map_single(mdev, va, size);
-}
-
-static void
-mic_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
-                  size_t size, enum dma_data_direction dir,
-                  unsigned long attrs)
-{
-       struct mic_device *mdev = dev_get_drvdata(dev->parent);
-       mic_unmap_single(mdev, dma_addr, size);
-}
-
-static const struct dma_map_ops mic_dma_ops = {
-       .map_page = mic_dma_map_page,
-       .unmap_page = mic_dma_unmap_page,
-};
-
-static struct mic_irq *
-_mic_request_threaded_irq(struct mbus_device *mbdev,
-                         irq_handler_t handler, irq_handler_t thread_fn,
-                         const char *name, void *data, int intr_src)
-{
-       return mic_request_threaded_irq(mbdev_to_mdev(mbdev), handler,
-                                       thread_fn, name, data,
-                                       intr_src, MIC_INTR_DMA);
-}
-
-static void _mic_free_irq(struct mbus_device *mbdev,
-                         struct mic_irq *cookie, void *data)
-{
-       mic_free_irq(mbdev_to_mdev(mbdev), cookie, data);
-}
-
-static void _mic_ack_interrupt(struct mbus_device *mbdev, int num)
-{
-       struct mic_device *mdev = mbdev_to_mdev(mbdev);
-       mdev->ops->intr_workarounds(mdev);
-}
-
-static struct mbus_hw_ops mbus_hw_ops = {
-       .request_threaded_irq = _mic_request_threaded_irq,
-       .free_irq = _mic_free_irq,
-       .ack_interrupt = _mic_ack_interrupt,
-};
-
-/* Initialize the MIC bootparams */
-void mic_bootparam_init(struct mic_device *mdev)
-{
-       struct mic_bootparam *bootparam = mdev->dp;
-
-       bootparam->magic = cpu_to_le32(MIC_MAGIC);
-       bootparam->h2c_config_db = -1;
-       bootparam->node_id = mdev->id + 1;
-       bootparam->scif_host_dma_addr = 0x0;
-       bootparam->scif_card_dma_addr = 0x0;
-       bootparam->c2h_scif_db = -1;
-       bootparam->h2c_scif_db = -1;
-}
-
-static inline struct mic_device *cosmdev_to_mdev(struct cosm_device *cdev)
-{
-       return dev_get_drvdata(cdev->dev.parent);
-}
-
-static void _mic_reset(struct cosm_device *cdev)
-{
-       struct mic_device *mdev = cosmdev_to_mdev(cdev);
-
-       mdev->ops->reset_fw_ready(mdev);
-       mdev->ops->reset(mdev);
-}
-
-static bool _mic_ready(struct cosm_device *cdev)
-{
-       struct mic_device *mdev = cosmdev_to_mdev(cdev);
-
-       return mdev->ops->is_fw_ready(mdev);
-}
-
-/**
- * mic_request_dma_chans - Request DMA channels
- * @mdev: pointer to mic_device instance
- *
- * returns number of DMA channels acquired
- */
-static int mic_request_dma_chans(struct mic_device *mdev)
-{
-       dma_cap_mask_t mask;
-       struct dma_chan *chan;
-
-       dma_cap_zero(mask);
-       dma_cap_set(DMA_MEMCPY, mask);
-
-       do {
-               chan = dma_request_channel(mask, mdev->ops->dma_filter,
-                                          &mdev->pdev->dev);
-               if (chan) {
-                       mdev->dma_ch[mdev->num_dma_ch++] = chan;
-                       if (mdev->num_dma_ch >= MIC_MAX_DMA_CHAN)
-                               break;
-               }
-       } while (chan);
-       dev_info(&mdev->pdev->dev, "DMA channels # %d\n", mdev->num_dma_ch);
-       return mdev->num_dma_ch;
-}
-
-/**
- * mic_free_dma_chans - release DMA channels
- * @mdev: pointer to mic_device instance
- *
- * returns none
- */
-static void mic_free_dma_chans(struct mic_device *mdev)
-{
-       int i = 0;
-
-       for (i = 0; i < mdev->num_dma_ch; i++) {
-               dma_release_channel(mdev->dma_ch[i]);
-               mdev->dma_ch[i] = NULL;
-       }
-       mdev->num_dma_ch = 0;
-}
-
-/**
- * _mic_start - Start the MIC.
- * @cdev: pointer to cosm_device instance
- * @id: MIC device id/index provided by COSM used in other drivers like SCIF
- *
- * This function prepares an MIC for boot and initiates boot.
- * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
- *
- * For all cosm_hw_ops the caller holds a mutex to ensure serialization.
- */
-static int _mic_start(struct cosm_device *cdev, int id)
-{
-       struct mic_device *mdev = cosmdev_to_mdev(cdev);
-       int rc;
-
-       mic_bootparam_init(mdev);
-       mdev->dma_mbdev = mbus_register_device(&mdev->pdev->dev,
-                                              MBUS_DEV_DMA_HOST, &mic_dma_ops,
-                                              &mbus_hw_ops, id, mdev->mmio.va);
-       if (IS_ERR(mdev->dma_mbdev)) {
-               rc = PTR_ERR(mdev->dma_mbdev);
-               goto unlock_ret;
-       }
-       if (!mic_request_dma_chans(mdev)) {
-               rc = -ENODEV;
-               goto dma_remove;
-       }
-       mdev->scdev = scif_register_device(&mdev->pdev->dev, MIC_SCIF_DEV,
-                                          &__mic_dma_ops, &scif_hw_ops,
-                                          id + 1, 0, &mdev->mmio,
-                                          &mdev->aper, mdev->dp, NULL,
-                                          mdev->dma_ch, mdev->num_dma_ch,
-                                          true);
-       if (IS_ERR(mdev->scdev)) {
-               rc = PTR_ERR(mdev->scdev);
-               goto dma_free;
-       }
-
-       mdev->vpdev = vop_register_device(&mdev->pdev->dev,
-                                         VOP_DEV_TRNSP, &_mic_dma_ops,
-                                         &vop_hw_ops, id + 1, &mdev->aper,
-                                         mdev->dma_ch[0]);
-       if (IS_ERR(mdev->vpdev)) {
-               rc = PTR_ERR(mdev->vpdev);
-               goto scif_remove;
-       }
-
-       rc = mdev->ops->load_mic_fw(mdev, NULL);
-       if (rc)
-               goto vop_remove;
-       mic_smpt_restore(mdev);
-       mic_intr_restore(mdev);
-       mdev->intr_ops->enable_interrupts(mdev);
-       mdev->ops->write_spad(mdev, MIC_DPLO_SPAD, mdev->dp_dma_addr);
-       mdev->ops->write_spad(mdev, MIC_DPHI_SPAD, mdev->dp_dma_addr >> 32);
-       mdev->ops->send_firmware_intr(mdev);
-       goto unlock_ret;
-vop_remove:
-       vop_unregister_device(mdev->vpdev);
-scif_remove:
-       scif_unregister_device(mdev->scdev);
-dma_free:
-       mic_free_dma_chans(mdev);
-dma_remove:
-       mbus_unregister_device(mdev->dma_mbdev);
-unlock_ret:
-       return rc;
-}
-
-/**
- * _mic_stop - Prepare the MIC for reset and trigger reset.
- * @cdev: pointer to cosm_device instance
- * @force: force a MIC to reset even if it is already offline.
- *
- * RETURNS: None.
- */
-static void _mic_stop(struct cosm_device *cdev, bool force)
-{
-       struct mic_device *mdev = cosmdev_to_mdev(cdev);
-
-       /*
-        * Since SCIF handles card shutdown and reset (using COSM), it will
-        * will be the first to be registered and the last to be
-        * unregistered.
-        */
-       vop_unregister_device(mdev->vpdev);
-       scif_unregister_device(mdev->scdev);
-       mic_free_dma_chans(mdev);
-       mbus_unregister_device(mdev->dma_mbdev);
-       mic_bootparam_init(mdev);
-}
-
-static ssize_t _mic_family(struct cosm_device *cdev, char *buf)
-{
-       struct mic_device *mdev = cosmdev_to_mdev(cdev);
-       static const char *family[MIC_FAMILY_LAST] = { "x100", "Unknown" };
-
-       return scnprintf(buf, PAGE_SIZE, "%s\n", family[mdev->family]);
-}
-
-static ssize_t _mic_stepping(struct cosm_device *cdev, char *buf)
-{
-       struct mic_device *mdev = cosmdev_to_mdev(cdev);
-       const char *string = "??";
-
-       switch (mdev->stepping) {
-       case MIC_A0_STEP:
-               string = "A0";
-               break;
-       case MIC_B0_STEP:
-               string = "B0";
-               break;
-       case MIC_B1_STEP:
-               string = "B1";
-               break;
-       case MIC_C0_STEP:
-               string = "C0";
-               break;
-       default:
-               break;
-       }
-       return scnprintf(buf, PAGE_SIZE, "%s\n", string);
-}
-
-static struct mic_mw *_mic_aper(struct cosm_device *cdev)
-{
-       struct mic_device *mdev = cosmdev_to_mdev(cdev);
-
-       return &mdev->aper;
-}
-
-struct cosm_hw_ops cosm_hw_ops = {
-       .reset = _mic_reset,
-       .force_reset = _mic_reset,
-       .post_reset = NULL,
-       .ready = _mic_ready,
-       .start = _mic_start,
-       .stop = _mic_stop,
-       .family = _mic_family,
-       .stepping = _mic_stepping,
-       .aper = _mic_aper,
-};
diff --git a/drivers/misc/mic/host/mic_debugfs.c b/drivers/misc/mic/host/mic_debugfs.c
deleted file mode 100644 (file)
index ffda740..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC Host driver.
- */
-#include <linux/debugfs.h>
-#include <linux/pci.h>
-#include <linux/seq_file.h>
-
-#include <linux/mic_common.h>
-#include "../common/mic_dev.h"
-#include "mic_device.h"
-#include "mic_smpt.h"
-
-/* Debugfs parent dir */
-static struct dentry *mic_dbg;
-
-static int mic_smpt_show(struct seq_file *s, void *pos)
-{
-       int i;
-       struct mic_device *mdev = s->private;
-       unsigned long flags;
-
-       seq_printf(s, "MIC %-2d |%-10s| %-14s %-10s\n",
-                  mdev->id, "SMPT entry", "SW DMA addr", "RefCount");
-       seq_puts(s, "====================================================\n");
-
-       if (mdev->smpt) {
-               struct mic_smpt_info *smpt_info = mdev->smpt;
-               spin_lock_irqsave(&smpt_info->smpt_lock, flags);
-               for (i = 0; i < smpt_info->info.num_reg; i++) {
-                       seq_printf(s, "%9s|%-10d| %-#14llx %-10lld\n",
-                                  " ",  i, smpt_info->entry[i].dma_addr,
-                                  smpt_info->entry[i].ref_count);
-               }
-               spin_unlock_irqrestore(&smpt_info->smpt_lock, flags);
-       }
-       seq_puts(s, "====================================================\n");
-       return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(mic_smpt);
-
-static int mic_post_code_show(struct seq_file *s, void *pos)
-{
-       struct mic_device *mdev = s->private;
-       u32 reg = mdev->ops->get_postcode(mdev);
-
-       seq_printf(s, "%c%c", reg & 0xff, (reg >> 8) & 0xff);
-       return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(mic_post_code);
-
-static int mic_msi_irq_info_show(struct seq_file *s, void *pos)
-{
-       struct mic_device *mdev  = s->private;
-       int reg;
-       int i, j;
-       u16 entry;
-       u16 vector;
-       struct pci_dev *pdev = mdev->pdev;
-
-       if (pci_dev_msi_enabled(pdev)) {
-               for (i = 0; i < mdev->irq_info.num_vectors; i++) {
-                       if (pdev->msix_enabled) {
-                               entry = mdev->irq_info.msix_entries[i].entry;
-                               vector = mdev->irq_info.msix_entries[i].vector;
-                       } else {
-                               entry = 0;
-                               vector = pdev->irq;
-                       }
-
-                       reg = mdev->intr_ops->read_msi_to_src_map(mdev, entry);
-
-                       seq_printf(s, "%s %-10d %s %-10d MXAR[%d]: %08X\n",
-                                  "IRQ:", vector, "Entry:", entry, i, reg);
-
-                       seq_printf(s, "%-10s", "offset:");
-                       for (j = (MIC_NUM_OFFSETS - 1); j >= 0; j--)
-                               seq_printf(s, "%4d ", j);
-                       seq_puts(s, "\n");
-
-
-                       seq_printf(s, "%-10s", "count:");
-                       for (j = (MIC_NUM_OFFSETS - 1); j >= 0; j--)
-                               seq_printf(s, "%4d ",
-                                          (mdev->irq_info.mic_msi_map[i] &
-                                          BIT(j)) ? 1 : 0);
-                       seq_puts(s, "\n\n");
-               }
-       } else {
-               seq_puts(s, "MSI/MSIx interrupts not enabled\n");
-       }
-
-       return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(mic_msi_irq_info);
-
-/*
- * mic_create_debug_dir - Initialize MIC debugfs entries.
- */
-void mic_create_debug_dir(struct mic_device *mdev)
-{
-       char name[16];
-
-       if (!mic_dbg)
-               return;
-
-       scnprintf(name, sizeof(name), "mic%d", mdev->id);
-       mdev->dbg_dir = debugfs_create_dir(name, mic_dbg);
-
-       debugfs_create_file("smpt", 0444, mdev->dbg_dir, mdev,
-                           &mic_smpt_fops);
-
-       debugfs_create_file("post_code", 0444, mdev->dbg_dir, mdev,
-                           &mic_post_code_fops);
-
-       debugfs_create_file("msi_irq_info", 0444, mdev->dbg_dir, mdev,
-                           &mic_msi_irq_info_fops);
-}
-
-/*
- * mic_delete_debug_dir - Uninitialize MIC debugfs entries.
- */
-void mic_delete_debug_dir(struct mic_device *mdev)
-{
-       debugfs_remove_recursive(mdev->dbg_dir);
-}
-
-/*
- * mic_init_debugfs - Initialize global debugfs entry.
- */
-void __init mic_init_debugfs(void)
-{
-       mic_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL);
-}
-
-/*
- * mic_exit_debugfs - Uninitialize global debugfs entry
- */
-void mic_exit_debugfs(void)
-{
-       debugfs_remove(mic_dbg);
-}
diff --git a/drivers/misc/mic/host/mic_device.h b/drivers/misc/mic/host/mic_device.h
deleted file mode 100644 (file)
index 41bcd30..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC Host driver.
- */
-#ifndef _MIC_DEVICE_H_
-#define _MIC_DEVICE_H_
-
-#include <linux/cdev.h>
-#include <linux/idr.h>
-#include <linux/notifier.h>
-#include <linux/irqreturn.h>
-#include <linux/dmaengine.h>
-#include <linux/miscdevice.h>
-#include <linux/mic_bus.h>
-#include "../bus/scif_bus.h"
-#include "../bus/vop_bus.h"
-#include "../bus/cosm_bus.h"
-#include "mic_intr.h"
-
-/**
- * enum mic_stepping - MIC stepping ids.
- */
-enum mic_stepping {
-       MIC_A0_STEP = 0x0,
-       MIC_B0_STEP = 0x10,
-       MIC_B1_STEP = 0x11,
-       MIC_C0_STEP = 0x20,
-};
-
-extern struct cosm_hw_ops cosm_hw_ops;
-
-/**
- * struct mic_device -  MIC device information for each card.
- *
- * @mmio: MMIO bar information.
- * @aper: Aperture bar information.
- * @family: The MIC family to which this device belongs.
- * @ops: MIC HW specific operations.
- * @id: The unique device id for this MIC device.
- * @stepping: Stepping ID.
- * @pdev: Underlying PCI device.
- * @mic_mutex: Mutex for synchronizing access to mic_device.
- * @intr_ops: HW specific interrupt operations.
- * @smpt_ops: Hardware specific SMPT operations.
- * @smpt: MIC SMPT information.
- * @intr_info: H/W specific interrupt information.
- * @irq_info: The OS specific irq information
- * @dbg_dir: debugfs directory of this MIC device.
- * @bootaddr: MIC boot address.
- * @dp: virtio device page
- * @dp_dma_addr: virtio device page DMA address.
- * @dma_mbdev: MIC BUS DMA device.
- * @dma_ch - Array of DMA channels
- * @num_dma_ch - Number of DMA channels available
- * @scdev: SCIF device on the SCIF virtual bus.
- * @vpdev: Virtio over PCIe device on the VOP virtual bus.
- * @cosm_dev: COSM device
- */
-struct mic_device {
-       struct mic_mw mmio;
-       struct mic_mw aper;
-       enum mic_hw_family family;
-       struct mic_hw_ops *ops;
-       int id;
-       enum mic_stepping stepping;
-       struct pci_dev *pdev;
-       struct mutex mic_mutex;
-       struct mic_hw_intr_ops *intr_ops;
-       struct mic_smpt_ops *smpt_ops;
-       struct mic_smpt_info *smpt;
-       struct mic_intr_info *intr_info;
-       struct mic_irq_info irq_info;
-       struct dentry *dbg_dir;
-       u32 bootaddr;
-       void *dp;
-       dma_addr_t dp_dma_addr;
-       struct mbus_device *dma_mbdev;
-       struct dma_chan *dma_ch[MIC_MAX_DMA_CHAN];
-       int num_dma_ch;
-       struct scif_hw_dev *scdev;
-       struct vop_device *vpdev;
-       struct cosm_device *cosm_dev;
-};
-
-/**
- * struct mic_hw_ops - MIC HW specific operations.
- * @aper_bar: Aperture bar resource number.
- * @mmio_bar: MMIO bar resource number.
- * @read_spad: Read from scratch pad register.
- * @write_spad: Write to scratch pad register.
- * @send_intr: Send an interrupt for a particular doorbell on the card.
- * @ack_interrupt: Hardware specific operations to ack the h/w on
- * receipt of an interrupt.
- * @intr_workarounds: Hardware specific workarounds needed after
- * handling an interrupt.
- * @reset: Reset the remote processor.
- * @reset_fw_ready: Reset firmware ready field.
- * @is_fw_ready: Check if firmware is ready for OS download.
- * @send_firmware_intr: Send an interrupt to the card firmware.
- * @load_mic_fw: Load firmware segments required to boot the card
- * into card memory. This includes the kernel, command line, ramdisk etc.
- * @get_postcode: Get post code status from firmware.
- * @dma_filter: DMA filter function to be used.
- */
-struct mic_hw_ops {
-       u8 aper_bar;
-       u8 mmio_bar;
-       u32 (*read_spad)(struct mic_device *mdev, unsigned int idx);
-       void (*write_spad)(struct mic_device *mdev, unsigned int idx, u32 val);
-       void (*send_intr)(struct mic_device *mdev, int doorbell);
-       u32 (*ack_interrupt)(struct mic_device *mdev);
-       void (*intr_workarounds)(struct mic_device *mdev);
-       void (*reset)(struct mic_device *mdev);
-       void (*reset_fw_ready)(struct mic_device *mdev);
-       bool (*is_fw_ready)(struct mic_device *mdev);
-       void (*send_firmware_intr)(struct mic_device *mdev);
-       int (*load_mic_fw)(struct mic_device *mdev, const char *buf);
-       u32 (*get_postcode)(struct mic_device *mdev);
-       bool (*dma_filter)(struct dma_chan *chan, void *param);
-};
-
-/**
- * mic_mmio_read - read from an MMIO register.
- * @mw: MMIO register base virtual address.
- * @offset: register offset.
- *
- * RETURNS: register value.
- */
-static inline u32 mic_mmio_read(struct mic_mw *mw, u32 offset)
-{
-       return ioread32(mw->va + offset);
-}
-
-/**
- * mic_mmio_write - write to an MMIO register.
- * @mw: MMIO register base virtual address.
- * @val: the data value to put into the register
- * @offset: register offset.
- *
- * RETURNS: none.
- */
-static inline void
-mic_mmio_write(struct mic_mw *mw, u32 val, u32 offset)
-{
-       iowrite32(val, mw->va + offset);
-}
-
-void mic_bootparam_init(struct mic_device *mdev);
-void mic_create_debug_dir(struct mic_device *dev);
-void mic_delete_debug_dir(struct mic_device *dev);
-void __init mic_init_debugfs(void);
-void mic_exit_debugfs(void);
-#endif
diff --git a/drivers/misc/mic/host/mic_intr.c b/drivers/misc/mic/host/mic_intr.c
deleted file mode 100644 (file)
index 85b3221..0000000
+++ /dev/null
@@ -1,635 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC Host driver.
- */
-#include <linux/pci.h>
-#include <linux/interrupt.h>
-
-#include "../common/mic_dev.h"
-#include "mic_device.h"
-
-static irqreturn_t mic_thread_fn(int irq, void *dev)
-{
-       struct mic_device *mdev = dev;
-       struct mic_intr_info *intr_info = mdev->intr_info;
-       struct mic_irq_info *irq_info = &mdev->irq_info;
-       struct mic_intr_cb *intr_cb;
-       struct pci_dev *pdev = mdev->pdev;
-       int i;
-
-       spin_lock(&irq_info->mic_thread_lock);
-       for (i = intr_info->intr_start_idx[MIC_INTR_DB];
-                       i < intr_info->intr_len[MIC_INTR_DB]; i++)
-               if (test_and_clear_bit(i, &irq_info->mask)) {
-                       list_for_each_entry(intr_cb, &irq_info->cb_list[i],
-                                           list)
-                               if (intr_cb->thread_fn)
-                                       intr_cb->thread_fn(pdev->irq,
-                                                        intr_cb->data);
-               }
-       spin_unlock(&irq_info->mic_thread_lock);
-       return IRQ_HANDLED;
-}
-/**
- * mic_interrupt - Generic interrupt handler for
- * MSI and INTx based interrupts.
- * @irq:  interrupt to handle (unused)
- * @dev: pointer to the mic_device instance
- */
-static irqreturn_t mic_interrupt(int irq, void *dev)
-{
-       struct mic_device *mdev = dev;
-       struct mic_intr_info *intr_info = mdev->intr_info;
-       struct mic_irq_info *irq_info = &mdev->irq_info;
-       struct mic_intr_cb *intr_cb;
-       struct pci_dev *pdev = mdev->pdev;
-       u32 mask;
-       int i;
-
-       mask = mdev->ops->ack_interrupt(mdev);
-       if (!mask)
-               return IRQ_NONE;
-
-       spin_lock(&irq_info->mic_intr_lock);
-       for (i = intr_info->intr_start_idx[MIC_INTR_DB];
-                       i < intr_info->intr_len[MIC_INTR_DB]; i++)
-               if (mask & BIT(i)) {
-                       list_for_each_entry(intr_cb, &irq_info->cb_list[i],
-                                           list)
-                               if (intr_cb->handler)
-                                       intr_cb->handler(pdev->irq,
-                                                        intr_cb->data);
-                       set_bit(i, &irq_info->mask);
-               }
-       spin_unlock(&irq_info->mic_intr_lock);
-       return IRQ_WAKE_THREAD;
-}
-
-/* Return the interrupt offset from the index. Index is 0 based. */
-static u16 mic_map_src_to_offset(struct mic_device *mdev,
-                                int intr_src, enum mic_intr_type type)
-{
-       if (type >= MIC_NUM_INTR_TYPES)
-               return MIC_NUM_OFFSETS;
-       if (intr_src >= mdev->intr_info->intr_len[type])
-               return MIC_NUM_OFFSETS;
-
-       return mdev->intr_info->intr_start_idx[type] + intr_src;
-}
-
-/* Return next available msix_entry. */
-static struct msix_entry *mic_get_available_vector(struct mic_device *mdev)
-{
-       int i;
-       struct mic_irq_info *info = &mdev->irq_info;
-
-       for (i = 0; i < info->num_vectors; i++)
-               if (!info->mic_msi_map[i])
-                       return &info->msix_entries[i];
-       return NULL;
-}
-
-/**
- * mic_register_intr_callback - Register a callback handler for the
- * given source id.
- *
- * @mdev: pointer to the mic_device instance
- * @idx: The source id to be registered.
- * @handler: The function to be called when the source id receives
- * the interrupt.
- * @thread_fn: thread fn. corresponding to the handler
- * @data: Private data of the requester.
- * Return the callback structure that was registered or an
- * appropriate error on failure.
- */
-static struct mic_intr_cb *mic_register_intr_callback(struct mic_device *mdev,
-                       u8 idx, irq_handler_t handler, irq_handler_t thread_fn,
-                       void *data)
-{
-       struct mic_intr_cb *intr_cb;
-       unsigned long flags;
-       int rc;
-       intr_cb = kmalloc(sizeof(*intr_cb), GFP_KERNEL);
-
-       if (!intr_cb)
-               return ERR_PTR(-ENOMEM);
-
-       intr_cb->handler = handler;
-       intr_cb->thread_fn = thread_fn;
-       intr_cb->data = data;
-       intr_cb->cb_id = ida_simple_get(&mdev->irq_info.cb_ida,
-               0, 0, GFP_KERNEL);
-       if (intr_cb->cb_id < 0) {
-               rc = intr_cb->cb_id;
-               goto ida_fail;
-       }
-
-       spin_lock(&mdev->irq_info.mic_thread_lock);
-       spin_lock_irqsave(&mdev->irq_info.mic_intr_lock, flags);
-       list_add_tail(&intr_cb->list, &mdev->irq_info.cb_list[idx]);
-       spin_unlock_irqrestore(&mdev->irq_info.mic_intr_lock, flags);
-       spin_unlock(&mdev->irq_info.mic_thread_lock);
-
-       return intr_cb;
-ida_fail:
-       kfree(intr_cb);
-       return ERR_PTR(rc);
-}
-
-/**
- * mic_unregister_intr_callback - Unregister the callback handler
- * identified by its callback id.
- *
- * @mdev: pointer to the mic_device instance
- * @idx: The callback structure id to be unregistered.
- * Return the source id that was unregistered or MIC_NUM_OFFSETS if no
- * such callback handler was found.
- */
-static u8 mic_unregister_intr_callback(struct mic_device *mdev, u32 idx)
-{
-       struct list_head *pos, *tmp;
-       struct mic_intr_cb *intr_cb;
-       unsigned long flags;
-       int i;
-
-       spin_lock(&mdev->irq_info.mic_thread_lock);
-       spin_lock_irqsave(&mdev->irq_info.mic_intr_lock, flags);
-       for (i = 0;  i < MIC_NUM_OFFSETS; i++) {
-               list_for_each_safe(pos, tmp, &mdev->irq_info.cb_list[i]) {
-                       intr_cb = list_entry(pos, struct mic_intr_cb, list);
-                       if (intr_cb->cb_id == idx) {
-                               list_del(pos);
-                               ida_simple_remove(&mdev->irq_info.cb_ida,
-                                                 intr_cb->cb_id);
-                               kfree(intr_cb);
-                               spin_unlock_irqrestore(
-                                       &mdev->irq_info.mic_intr_lock, flags);
-                               spin_unlock(&mdev->irq_info.mic_thread_lock);
-                               return i;
-                       }
-               }
-       }
-       spin_unlock_irqrestore(&mdev->irq_info.mic_intr_lock, flags);
-       spin_unlock(&mdev->irq_info.mic_thread_lock);
-       return MIC_NUM_OFFSETS;
-}
-
-/**
- * mic_setup_msix - Initializes MSIx interrupts.
- *
- * @mdev: pointer to mic_device instance
- * @pdev: PCI device structure
- *
- * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
- */
-static int mic_setup_msix(struct mic_device *mdev, struct pci_dev *pdev)
-{
-       int rc, i;
-       int entry_size = sizeof(*mdev->irq_info.msix_entries);
-
-       mdev->irq_info.msix_entries = kmalloc_array(MIC_MIN_MSIX,
-                                                   entry_size, GFP_KERNEL);
-       if (!mdev->irq_info.msix_entries) {
-               rc = -ENOMEM;
-               goto err_nomem1;
-       }
-
-       for (i = 0; i < MIC_MIN_MSIX; i++)
-               mdev->irq_info.msix_entries[i].entry = i;
-
-       rc = pci_enable_msix_exact(pdev, mdev->irq_info.msix_entries,
-                                  MIC_MIN_MSIX);
-       if (rc) {
-               dev_dbg(&pdev->dev, "Error enabling MSIx. rc = %d\n", rc);
-               goto err_enable_msix;
-       }
-
-       mdev->irq_info.num_vectors = MIC_MIN_MSIX;
-       mdev->irq_info.mic_msi_map = kzalloc((sizeof(u32) *
-               mdev->irq_info.num_vectors), GFP_KERNEL);
-
-       if (!mdev->irq_info.mic_msi_map) {
-               rc = -ENOMEM;
-               goto err_nomem2;
-       }
-
-       dev_dbg(&mdev->pdev->dev,
-               "%d MSIx irqs setup\n", mdev->irq_info.num_vectors);
-       return 0;
-err_nomem2:
-       pci_disable_msix(pdev);
-err_enable_msix:
-       kfree(mdev->irq_info.msix_entries);
-err_nomem1:
-       mdev->irq_info.num_vectors = 0;
-       return rc;
-}
-
-/**
- * mic_setup_callbacks - Initialize data structures needed
- * to handle callbacks.
- *
- * @mdev: pointer to mic_device instance
- */
-static int mic_setup_callbacks(struct mic_device *mdev)
-{
-       int i;
-
-       mdev->irq_info.cb_list = kmalloc_array(MIC_NUM_OFFSETS,
-                                              sizeof(*mdev->irq_info.cb_list),
-                                              GFP_KERNEL);
-       if (!mdev->irq_info.cb_list)
-               return -ENOMEM;
-
-       for (i = 0; i < MIC_NUM_OFFSETS; i++)
-               INIT_LIST_HEAD(&mdev->irq_info.cb_list[i]);
-       ida_init(&mdev->irq_info.cb_ida);
-       spin_lock_init(&mdev->irq_info.mic_intr_lock);
-       spin_lock_init(&mdev->irq_info.mic_thread_lock);
-       return 0;
-}
-
-/**
- * mic_release_callbacks - Uninitialize data structures needed
- * to handle callbacks.
- *
- * @mdev: pointer to mic_device instance
- */
-static void mic_release_callbacks(struct mic_device *mdev)
-{
-       unsigned long flags;
-       struct list_head *pos, *tmp;
-       struct mic_intr_cb *intr_cb;
-       int i;
-
-       spin_lock(&mdev->irq_info.mic_thread_lock);
-       spin_lock_irqsave(&mdev->irq_info.mic_intr_lock, flags);
-       for (i = 0; i < MIC_NUM_OFFSETS; i++) {
-               if (list_empty(&mdev->irq_info.cb_list[i]))
-                       break;
-
-               list_for_each_safe(pos, tmp, &mdev->irq_info.cb_list[i]) {
-                       intr_cb = list_entry(pos, struct mic_intr_cb, list);
-                       list_del(pos);
-                       ida_simple_remove(&mdev->irq_info.cb_ida,
-                                         intr_cb->cb_id);
-                       kfree(intr_cb);
-               }
-       }
-       spin_unlock_irqrestore(&mdev->irq_info.mic_intr_lock, flags);
-       spin_unlock(&mdev->irq_info.mic_thread_lock);
-       ida_destroy(&mdev->irq_info.cb_ida);
-       kfree(mdev->irq_info.cb_list);
-}
-
-/**
- * mic_setup_msi - Initializes MSI interrupts.
- *
- * @mdev: pointer to mic_device instance
- * @pdev: PCI device structure
- *
- * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
- */
-static int mic_setup_msi(struct mic_device *mdev, struct pci_dev *pdev)
-{
-       int rc;
-
-       rc = pci_enable_msi(pdev);
-       if (rc) {
-               dev_dbg(&pdev->dev, "Error enabling MSI. rc = %d\n", rc);
-               return rc;
-       }
-
-       mdev->irq_info.num_vectors = 1;
-       mdev->irq_info.mic_msi_map = kzalloc((sizeof(u32) *
-               mdev->irq_info.num_vectors), GFP_KERNEL);
-
-       if (!mdev->irq_info.mic_msi_map) {
-               rc = -ENOMEM;
-               goto err_nomem1;
-       }
-
-       rc = mic_setup_callbacks(mdev);
-       if (rc) {
-               dev_err(&pdev->dev, "Error setting up callbacks\n");
-               goto err_nomem2;
-       }
-
-       rc = request_threaded_irq(pdev->irq, mic_interrupt, mic_thread_fn,
-                                 0, "mic-msi", mdev);
-       if (rc) {
-               dev_err(&pdev->dev, "Error allocating MSI interrupt\n");
-               goto err_irq_req_fail;
-       }
-
-       dev_dbg(&pdev->dev, "%d MSI irqs setup\n", mdev->irq_info.num_vectors);
-       return 0;
-err_irq_req_fail:
-       mic_release_callbacks(mdev);
-err_nomem2:
-       kfree(mdev->irq_info.mic_msi_map);
-err_nomem1:
-       pci_disable_msi(pdev);
-       mdev->irq_info.num_vectors = 0;
-       return rc;
-}
-
-/**
- * mic_setup_intx - Initializes legacy interrupts.
- *
- * @mdev: pointer to mic_device instance
- * @pdev: PCI device structure
- *
- * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
- */
-static int mic_setup_intx(struct mic_device *mdev, struct pci_dev *pdev)
-{
-       int rc;
-
-       /* Enable intx */
-       pci_intx(pdev, 1);
-       rc = mic_setup_callbacks(mdev);
-       if (rc) {
-               dev_err(&pdev->dev, "Error setting up callbacks\n");
-               goto err_nomem;
-       }
-
-       rc = request_threaded_irq(pdev->irq, mic_interrupt, mic_thread_fn,
-                                 IRQF_SHARED, "mic-intx", mdev);
-       if (rc)
-               goto err;
-
-       dev_dbg(&pdev->dev, "intx irq setup\n");
-       return 0;
-err:
-       mic_release_callbacks(mdev);
-err_nomem:
-       return rc;
-}
-
-/**
- * mic_next_db - Retrieve the next doorbell interrupt source id.
- * The id is picked sequentially from the available pool of
- * doorlbell ids.
- *
- * @mdev: pointer to the mic_device instance.
- *
- * Returns the next doorbell interrupt source.
- */
-int mic_next_db(struct mic_device *mdev)
-{
-       int next_db;
-
-       next_db = mdev->irq_info.next_avail_src %
-               mdev->intr_info->intr_len[MIC_INTR_DB];
-       mdev->irq_info.next_avail_src++;
-       return next_db;
-}
-
-#define COOKIE_ID_SHIFT 16
-#define GET_ENTRY(cookie) ((cookie) & 0xFFFF)
-#define GET_OFFSET(cookie) ((cookie) >> COOKIE_ID_SHIFT)
-#define MK_COOKIE(x, y) ((x) | (y) << COOKIE_ID_SHIFT)
-
-/**
- * mic_request_threaded_irq - request an irq. mic_mutex needs
- * to be held before calling this function.
- *
- * @mdev: pointer to mic_device instance
- * @handler: The callback function that handles the interrupt.
- * The function needs to call ack_interrupts
- * (mdev->ops->ack_interrupt(mdev)) when handling the interrupts.
- * @thread_fn: thread fn required by request_threaded_irq.
- * @name: The ASCII name of the callee requesting the irq.
- * @data: private data that is returned back when calling the
- * function handler.
- * @intr_src: The source id of the requester. Its the doorbell id
- * for Doorbell interrupts and DMA channel id for DMA interrupts.
- * @type: The type of interrupt. Values defined in mic_intr_type
- *
- * returns: The cookie that is transparent to the caller. Passed
- * back when calling mic_free_irq. An appropriate error code
- * is returned on failure. Caller needs to use IS_ERR(return_val)
- * to check for failure and PTR_ERR(return_val) to obtained the
- * error code.
- *
- */
-struct mic_irq *
-mic_request_threaded_irq(struct mic_device *mdev,
-                        irq_handler_t handler, irq_handler_t thread_fn,
-                        const char *name, void *data, int intr_src,
-                        enum mic_intr_type type)
-{
-       u16 offset;
-       int rc = 0;
-       struct msix_entry *msix = NULL;
-       unsigned long cookie = 0;
-       u16 entry;
-       struct mic_intr_cb *intr_cb;
-       struct pci_dev *pdev = mdev->pdev;
-
-       offset = mic_map_src_to_offset(mdev, intr_src, type);
-       if (offset >= MIC_NUM_OFFSETS) {
-               dev_err(&mdev->pdev->dev,
-                       "Error mapping index %d to a valid source id.\n",
-                       intr_src);
-               rc = -EINVAL;
-               goto err;
-       }
-
-       if (mdev->irq_info.num_vectors > 1) {
-               msix = mic_get_available_vector(mdev);
-               if (!msix) {
-                       dev_err(&mdev->pdev->dev,
-                               "No MSIx vectors available for use.\n");
-                       rc = -ENOSPC;
-                       goto err;
-               }
-
-               rc = request_threaded_irq(msix->vector, handler, thread_fn,
-                                         0, name, data);
-               if (rc) {
-                       dev_dbg(&mdev->pdev->dev,
-                               "request irq failed rc = %d\n", rc);
-                       goto err;
-               }
-               entry = msix->entry;
-               mdev->irq_info.mic_msi_map[entry] |= BIT(offset);
-               mdev->intr_ops->program_msi_to_src_map(mdev,
-                               entry, offset, true);
-               cookie = MK_COOKIE(entry, offset);
-               dev_dbg(&mdev->pdev->dev, "irq: %d assigned for src: %d\n",
-                       msix->vector, intr_src);
-       } else {
-               intr_cb = mic_register_intr_callback(mdev, offset, handler,
-                                                    thread_fn, data);
-               if (IS_ERR(intr_cb)) {
-                       dev_err(&mdev->pdev->dev,
-                               "No available callback entries for use\n");
-                       rc = PTR_ERR(intr_cb);
-                       goto err;
-               }
-
-               entry = 0;
-               if (pci_dev_msi_enabled(pdev)) {
-                       mdev->irq_info.mic_msi_map[entry] |= (1 << offset);
-                       mdev->intr_ops->program_msi_to_src_map(mdev,
-                               entry, offset, true);
-               }
-               cookie = MK_COOKIE(entry, intr_cb->cb_id);
-               dev_dbg(&mdev->pdev->dev, "callback %d registered for src: %d\n",
-                       intr_cb->cb_id, intr_src);
-       }
-       return (struct mic_irq *)cookie;
-err:
-       return ERR_PTR(rc);
-}
-
-/**
- * mic_free_irq - free irq. mic_mutex
- *  needs to be held before calling this function.
- *
- * @mdev: pointer to mic_device instance
- * @cookie: cookie obtained during a successful call to mic_request_threaded_irq
- * @data: private data specified by the calling function during the
- * mic_request_threaded_irq
- *
- * returns: none.
- */
-void mic_free_irq(struct mic_device *mdev,
-                 struct mic_irq *cookie, void *data)
-{
-       u32 offset;
-       u32 entry;
-       u8 src_id;
-       unsigned int irq;
-       struct pci_dev *pdev = mdev->pdev;
-
-       entry = GET_ENTRY((unsigned long)cookie);
-       offset = GET_OFFSET((unsigned long)cookie);
-       if (mdev->irq_info.num_vectors > 1) {
-               if (entry >= mdev->irq_info.num_vectors) {
-                       dev_warn(&mdev->pdev->dev,
-                                "entry %d should be < num_irq %d\n",
-                               entry, mdev->irq_info.num_vectors);
-                       return;
-               }
-               irq = mdev->irq_info.msix_entries[entry].vector;
-               free_irq(irq, data);
-               mdev->irq_info.mic_msi_map[entry] &= ~(BIT(offset));
-               mdev->intr_ops->program_msi_to_src_map(mdev,
-                       entry, offset, false);
-
-               dev_dbg(&mdev->pdev->dev, "irq: %d freed\n", irq);
-       } else {
-               irq = pdev->irq;
-               src_id = mic_unregister_intr_callback(mdev, offset);
-               if (src_id >= MIC_NUM_OFFSETS) {
-                       dev_warn(&mdev->pdev->dev, "Error unregistering callback\n");
-                       return;
-               }
-               if (pci_dev_msi_enabled(pdev)) {
-                       mdev->irq_info.mic_msi_map[entry] &= ~(BIT(src_id));
-                       mdev->intr_ops->program_msi_to_src_map(mdev,
-                               entry, src_id, false);
-               }
-               dev_dbg(&mdev->pdev->dev, "callback %d unregistered for src: %d\n",
-                       offset, src_id);
-       }
-}
-
-/**
- * mic_setup_interrupts - Initializes interrupts.
- *
- * @mdev: pointer to mic_device instance
- * @pdev: PCI device structure
- *
- * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
- */
-int mic_setup_interrupts(struct mic_device *mdev, struct pci_dev *pdev)
-{
-       int rc;
-
-       rc = mic_setup_msix(mdev, pdev);
-       if (!rc)
-               goto done;
-
-       rc = mic_setup_msi(mdev, pdev);
-       if (!rc)
-               goto done;
-
-       rc = mic_setup_intx(mdev, pdev);
-       if (rc) {
-               dev_err(&mdev->pdev->dev, "no usable interrupts\n");
-               return rc;
-       }
-done:
-       mdev->intr_ops->enable_interrupts(mdev);
-       return 0;
-}
-
-/**
- * mic_free_interrupts - Frees interrupts setup by mic_setup_interrupts
- *
- * @mdev: pointer to mic_device instance
- * @pdev: PCI device structure
- *
- * returns none.
- */
-void mic_free_interrupts(struct mic_device *mdev, struct pci_dev *pdev)
-{
-       int i;
-
-       mdev->intr_ops->disable_interrupts(mdev);
-       if (mdev->irq_info.num_vectors > 1) {
-               for (i = 0; i < mdev->irq_info.num_vectors; i++) {
-                       if (mdev->irq_info.mic_msi_map[i])
-                               dev_warn(&pdev->dev, "irq %d may still be in use.\n",
-                                        mdev->irq_info.msix_entries[i].vector);
-               }
-               kfree(mdev->irq_info.mic_msi_map);
-               kfree(mdev->irq_info.msix_entries);
-               pci_disable_msix(pdev);
-       } else {
-               if (pci_dev_msi_enabled(pdev)) {
-                       free_irq(pdev->irq, mdev);
-                       kfree(mdev->irq_info.mic_msi_map);
-                       pci_disable_msi(pdev);
-               } else {
-                       free_irq(pdev->irq, mdev);
-               }
-               mic_release_callbacks(mdev);
-       }
-}
-
-/**
- * mic_intr_restore - Restore MIC interrupt registers.
- *
- * @mdev: pointer to mic_device instance.
- *
- * Restore the interrupt registers to values previously
- * stored in the SW data structures. mic_mutex needs to
- * be held before calling this function.
- *
- * returns None.
- */
-void mic_intr_restore(struct mic_device *mdev)
-{
-       int entry, offset;
-       struct pci_dev *pdev = mdev->pdev;
-
-       if (!pci_dev_msi_enabled(pdev))
-               return;
-
-       for (entry = 0; entry < mdev->irq_info.num_vectors; entry++) {
-               for (offset = 0; offset < MIC_NUM_OFFSETS; offset++) {
-                       if (mdev->irq_info.mic_msi_map[entry] & BIT(offset))
-                               mdev->intr_ops->program_msi_to_src_map(mdev,
-                                       entry, offset, true);
-               }
-       }
-}
diff --git a/drivers/misc/mic/host/mic_intr.h b/drivers/misc/mic/host/mic_intr.h
deleted file mode 100644 (file)
index b14ba81..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC Host driver.
- */
-#ifndef _MIC_INTR_H_
-#define _MIC_INTR_H_
-
-#include <linux/bitops.h>
-#include <linux/interrupt.h>
-/*
- * The minimum number of msix vectors required for normal operation.
- * 3 for virtio network, console and block devices.
- * 1 for card shutdown notifications.
- * 4 for host owned DMA channels.
- * 1 for SCIF
- */
-#define MIC_MIN_MSIX 9
-#define MIC_NUM_OFFSETS 32
-
-/**
- * mic_intr_source - The type of source that will generate
- * the interrupt.The number of types needs to be in sync with
- * MIC_NUM_INTR_TYPES
- *
- * MIC_INTR_DB: The source is a doorbell
- * MIC_INTR_DMA: The source is a DMA channel
- * MIC_INTR_ERR: The source is an error interrupt e.g. SBOX ERR
- * MIC_NUM_INTR_TYPES: Total number of interrupt sources.
- */
-enum mic_intr_type {
-       MIC_INTR_DB = 0,
-       MIC_INTR_DMA,
-       MIC_INTR_ERR,
-       MIC_NUM_INTR_TYPES
-};
-
-/**
- * struct mic_intr_info - Contains h/w specific interrupt sources
- * information.
- *
- * @intr_start_idx: Contains the starting indexes of the
- * interrupt types.
- * @intr_len: Contains the length of the interrupt types.
- */
-struct mic_intr_info {
-       u16 intr_start_idx[MIC_NUM_INTR_TYPES];
-       u16 intr_len[MIC_NUM_INTR_TYPES];
-};
-
-/**
- * struct mic_irq_info - OS specific irq information
- *
- * @next_avail_src: next available doorbell that can be assigned.
- * @msix_entries: msix entries allocated while setting up MSI-x
- * @mic_msi_map: The MSI/MSI-x mapping information.
- * @num_vectors: The number of MSI/MSI-x vectors that have been allocated.
- * @cb_ida: callback ID allocator to track the callbacks registered.
- * @mic_intr_lock: spinlock to protect the interrupt callback list.
- * @mic_thread_lock: spinlock to protect the thread callback list.
- *                This lock is used to protect against thread_fn while
- *                mic_intr_lock is used to protect against interrupt handler.
- * @cb_list: Array of callback lists one for each source.
- * @mask: Mask used by the main thread fn to call the underlying thread fns.
- */
-struct mic_irq_info {
-       int next_avail_src;
-       struct msix_entry *msix_entries;
-       u32 *mic_msi_map;
-       u16 num_vectors;
-       struct ida cb_ida;
-       spinlock_t mic_intr_lock;
-       spinlock_t mic_thread_lock;
-       struct list_head *cb_list;
-       unsigned long mask;
-};
-
-/**
- * struct mic_intr_cb - Interrupt callback structure.
- *
- * @handler: The callback function
- * @thread_fn: The thread_fn.
- * @data: Private data of the requester.
- * @cb_id: The callback id. Identifies this callback.
- * @list: list head pointing to the next callback structure.
- */
-struct mic_intr_cb {
-       irq_handler_t handler;
-       irq_handler_t thread_fn;
-       void *data;
-       int cb_id;
-       struct list_head list;
-};
-
-/**
- * struct mic_irq - opaque pointer used as cookie
- */
-struct mic_irq;
-
-/* Forward declaration */
-struct mic_device;
-
-/**
- * struct mic_hw_intr_ops: MIC HW specific interrupt operations
- * @intr_init: Initialize H/W specific interrupt information.
- * @enable_interrupts: Enable interrupts from the hardware.
- * @disable_interrupts: Disable interrupts from the hardware.
- * @program_msi_to_src_map: Update MSI mapping registers with
- * irq information.
- * @read_msi_to_src_map: Read MSI mapping registers containing
- * irq information.
- */
-struct mic_hw_intr_ops {
-       void (*intr_init)(struct mic_device *mdev);
-       void (*enable_interrupts)(struct mic_device *mdev);
-       void (*disable_interrupts)(struct mic_device *mdev);
-       void (*program_msi_to_src_map) (struct mic_device *mdev,
-                       int idx, int intr_src, bool set);
-       u32 (*read_msi_to_src_map) (struct mic_device *mdev,
-                       int idx);
-};
-
-int mic_next_db(struct mic_device *mdev);
-struct mic_irq *
-mic_request_threaded_irq(struct mic_device *mdev,
-                        irq_handler_t handler, irq_handler_t thread_fn,
-                        const char *name, void *data, int intr_src,
-                        enum mic_intr_type type);
-void mic_free_irq(struct mic_device *mdev,
-               struct mic_irq *cookie, void *data);
-int mic_setup_interrupts(struct mic_device *mdev, struct pci_dev *pdev);
-void mic_free_interrupts(struct mic_device *mdev, struct pci_dev *pdev);
-void mic_intr_restore(struct mic_device *mdev);
-#endif
diff --git a/drivers/misc/mic/host/mic_main.c b/drivers/misc/mic/host/mic_main.c
deleted file mode 100644 (file)
index ea46085..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC Host driver.
- */
-#include <linux/fs.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/poll.h>
-
-#include <linux/mic_common.h>
-#include "../common/mic_dev.h"
-#include "mic_device.h"
-#include "mic_x100.h"
-#include "mic_smpt.h"
-
-static const char mic_driver_name[] = "mic";
-
-static const struct pci_device_id mic_pci_tbl[] = {
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2250)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2251)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2252)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2253)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2254)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2255)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2256)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2257)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2258)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_2259)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_225a)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_225b)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_225c)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_225d)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MIC_X100_PCI_DEVICE_225e)},
-
-       /* required last entry */
-       { 0, }
-};
-
-MODULE_DEVICE_TABLE(pci, mic_pci_tbl);
-
-/* ID allocator for MIC devices */
-static struct ida g_mic_ida;
-
-/* Initialize the device page */
-static int mic_dp_init(struct mic_device *mdev)
-{
-       mdev->dp = kzalloc(MIC_DP_SIZE, GFP_KERNEL);
-       if (!mdev->dp)
-               return -ENOMEM;
-
-       mdev->dp_dma_addr = mic_map_single(mdev,
-               mdev->dp, MIC_DP_SIZE);
-       if (mic_map_error(mdev->dp_dma_addr)) {
-               kfree(mdev->dp);
-               dev_err(&mdev->pdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, -ENOMEM);
-               return -ENOMEM;
-       }
-       mdev->ops->write_spad(mdev, MIC_DPLO_SPAD, mdev->dp_dma_addr);
-       mdev->ops->write_spad(mdev, MIC_DPHI_SPAD, mdev->dp_dma_addr >> 32);
-       return 0;
-}
-
-/* Uninitialize the device page */
-static void mic_dp_uninit(struct mic_device *mdev)
-{
-       mic_unmap_single(mdev, mdev->dp_dma_addr, MIC_DP_SIZE);
-       kfree(mdev->dp);
-}
-
-/**
- * mic_ops_init: Initialize HW specific operation tables.
- *
- * @mdev: pointer to mic_device instance
- *
- * returns none.
- */
-static void mic_ops_init(struct mic_device *mdev)
-{
-       switch (mdev->family) {
-       case MIC_FAMILY_X100:
-               mdev->ops = &mic_x100_ops;
-               mdev->intr_ops = &mic_x100_intr_ops;
-               mdev->smpt_ops = &mic_x100_smpt_ops;
-               break;
-       default:
-               break;
-       }
-}
-
-/**
- * mic_get_family - Determine hardware family to which this MIC belongs.
- *
- * @pdev: The pci device structure
- *
- * returns family.
- */
-static enum mic_hw_family mic_get_family(struct pci_dev *pdev)
-{
-       enum mic_hw_family family;
-
-       switch (pdev->device) {
-       case MIC_X100_PCI_DEVICE_2250:
-       case MIC_X100_PCI_DEVICE_2251:
-       case MIC_X100_PCI_DEVICE_2252:
-       case MIC_X100_PCI_DEVICE_2253:
-       case MIC_X100_PCI_DEVICE_2254:
-       case MIC_X100_PCI_DEVICE_2255:
-       case MIC_X100_PCI_DEVICE_2256:
-       case MIC_X100_PCI_DEVICE_2257:
-       case MIC_X100_PCI_DEVICE_2258:
-       case MIC_X100_PCI_DEVICE_2259:
-       case MIC_X100_PCI_DEVICE_225a:
-       case MIC_X100_PCI_DEVICE_225b:
-       case MIC_X100_PCI_DEVICE_225c:
-       case MIC_X100_PCI_DEVICE_225d:
-       case MIC_X100_PCI_DEVICE_225e:
-               family = MIC_FAMILY_X100;
-               break;
-       default:
-               family = MIC_FAMILY_UNKNOWN;
-               break;
-       }
-       return family;
-}
-
-/**
- * mic_device_init - Allocates and initializes the MIC device structure
- *
- * @mdev: pointer to mic_device instance
- * @pdev: The pci device structure
- *
- * returns none.
- */
-static void
-mic_device_init(struct mic_device *mdev, struct pci_dev *pdev)
-{
-       mdev->pdev = pdev;
-       mdev->family = mic_get_family(pdev);
-       mdev->stepping = pdev->revision;
-       mic_ops_init(mdev);
-       mutex_init(&mdev->mic_mutex);
-       mdev->irq_info.next_avail_src = 0;
-}
-
-/**
- * mic_probe - Device Initialization Routine
- *
- * @pdev: PCI device structure
- * @ent: entry in mic_pci_tbl
- *
- * returns 0 on success, < 0 on failure.
- */
-static int mic_probe(struct pci_dev *pdev,
-                    const struct pci_device_id *ent)
-{
-       int rc;
-       struct mic_device *mdev;
-
-       mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
-       if (!mdev) {
-               rc = -ENOMEM;
-               goto mdev_alloc_fail;
-       }
-       mdev->id = ida_simple_get(&g_mic_ida, 0, MIC_MAX_NUM_DEVS, GFP_KERNEL);
-       if (mdev->id < 0) {
-               rc = mdev->id;
-               dev_err(&pdev->dev, "ida_simple_get failed rc %d\n", rc);
-               goto ida_fail;
-       }
-
-       mic_device_init(mdev, pdev);
-
-       rc = pci_enable_device(pdev);
-       if (rc) {
-               dev_err(&pdev->dev, "failed to enable pci device.\n");
-               goto ida_remove;
-       }
-
-       pci_set_master(pdev);
-
-       rc = pci_request_regions(pdev, mic_driver_name);
-       if (rc) {
-               dev_err(&pdev->dev, "failed to get pci regions.\n");
-               goto disable_device;
-       }
-
-       rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
-       if (rc) {
-               dev_err(&pdev->dev, "Cannot set DMA mask\n");
-               goto release_regions;
-       }
-
-       mdev->mmio.pa = pci_resource_start(pdev, mdev->ops->mmio_bar);
-       mdev->mmio.len = pci_resource_len(pdev, mdev->ops->mmio_bar);
-       mdev->mmio.va = pci_ioremap_bar(pdev, mdev->ops->mmio_bar);
-       if (!mdev->mmio.va) {
-               dev_err(&pdev->dev, "Cannot remap MMIO BAR\n");
-               rc = -EIO;
-               goto release_regions;
-       }
-
-       mdev->aper.pa = pci_resource_start(pdev, mdev->ops->aper_bar);
-       mdev->aper.len = pci_resource_len(pdev, mdev->ops->aper_bar);
-       mdev->aper.va = ioremap_wc(mdev->aper.pa, mdev->aper.len);
-       if (!mdev->aper.va) {
-               dev_err(&pdev->dev, "Cannot remap Aperture BAR\n");
-               rc = -EIO;
-               goto unmap_mmio;
-       }
-
-       mdev->intr_ops->intr_init(mdev);
-       rc = mic_setup_interrupts(mdev, pdev);
-       if (rc) {
-               dev_err(&pdev->dev, "mic_setup_interrupts failed %d\n", rc);
-               goto unmap_aper;
-       }
-       rc = mic_smpt_init(mdev);
-       if (rc) {
-               dev_err(&pdev->dev, "smpt_init failed %d\n", rc);
-               goto free_interrupts;
-       }
-
-       pci_set_drvdata(pdev, mdev);
-
-       rc = mic_dp_init(mdev);
-       if (rc) {
-               dev_err(&pdev->dev, "mic_dp_init failed rc %d\n", rc);
-               goto smpt_uninit;
-       }
-       mic_bootparam_init(mdev);
-       mic_create_debug_dir(mdev);
-
-       mdev->cosm_dev = cosm_register_device(&mdev->pdev->dev, &cosm_hw_ops);
-       if (IS_ERR(mdev->cosm_dev)) {
-               rc = PTR_ERR(mdev->cosm_dev);
-               dev_err(&pdev->dev, "cosm_add_device failed rc %d\n", rc);
-               goto cleanup_debug_dir;
-       }
-       return 0;
-cleanup_debug_dir:
-       mic_delete_debug_dir(mdev);
-       mic_dp_uninit(mdev);
-smpt_uninit:
-       mic_smpt_uninit(mdev);
-free_interrupts:
-       mic_free_interrupts(mdev, pdev);
-unmap_aper:
-       iounmap(mdev->aper.va);
-unmap_mmio:
-       iounmap(mdev->mmio.va);
-release_regions:
-       pci_release_regions(pdev);
-disable_device:
-       pci_disable_device(pdev);
-ida_remove:
-       ida_simple_remove(&g_mic_ida, mdev->id);
-ida_fail:
-       kfree(mdev);
-mdev_alloc_fail:
-       dev_err(&pdev->dev, "Probe failed rc %d\n", rc);
-       return rc;
-}
-
-/**
- * mic_remove - Device Removal Routine
- * mic_remove is called by the PCI subsystem to alert the driver
- * that it should release a PCI device.
- *
- * @pdev: PCI device structure
- */
-static void mic_remove(struct pci_dev *pdev)
-{
-       struct mic_device *mdev;
-
-       mdev = pci_get_drvdata(pdev);
-       if (!mdev)
-               return;
-
-       cosm_unregister_device(mdev->cosm_dev);
-       mic_delete_debug_dir(mdev);
-       mic_dp_uninit(mdev);
-       mic_smpt_uninit(mdev);
-       mic_free_interrupts(mdev, pdev);
-       iounmap(mdev->aper.va);
-       iounmap(mdev->mmio.va);
-       pci_release_regions(pdev);
-       pci_disable_device(pdev);
-       ida_simple_remove(&g_mic_ida, mdev->id);
-       kfree(mdev);
-}
-
-static struct pci_driver mic_driver = {
-       .name = mic_driver_name,
-       .id_table = mic_pci_tbl,
-       .probe = mic_probe,
-       .remove = mic_remove
-};
-
-static int __init mic_init(void)
-{
-       int ret;
-
-       request_module("mic_x100_dma");
-       mic_init_debugfs();
-       ida_init(&g_mic_ida);
-       ret = pci_register_driver(&mic_driver);
-       if (ret) {
-               pr_err("pci_register_driver failed ret %d\n", ret);
-               goto cleanup_debugfs;
-       }
-       return 0;
-cleanup_debugfs:
-       ida_destroy(&g_mic_ida);
-       mic_exit_debugfs();
-       return ret;
-}
-
-static void __exit mic_exit(void)
-{
-       pci_unregister_driver(&mic_driver);
-       ida_destroy(&g_mic_ida);
-       mic_exit_debugfs();
-}
-
-module_init(mic_init);
-module_exit(mic_exit);
-
-MODULE_AUTHOR("Intel Corporation");
-MODULE_DESCRIPTION("Intel(R) MIC X100 Host driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/misc/mic/host/mic_smpt.c b/drivers/misc/mic/host/mic_smpt.c
deleted file mode 100644 (file)
index 50d1beb..0000000
+++ /dev/null
@@ -1,427 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC Host driver.
- */
-#include <linux/pci.h>
-
-#include "../common/mic_dev.h"
-#include "mic_device.h"
-#include "mic_smpt.h"
-
-static inline u64 mic_system_page_mask(struct mic_device *mdev)
-{
-       return (1ULL << mdev->smpt->info.page_shift) - 1ULL;
-}
-
-static inline u8 mic_sys_addr_to_smpt(struct mic_device *mdev, dma_addr_t pa)
-{
-       return (pa - mdev->smpt->info.base) >> mdev->smpt->info.page_shift;
-}
-
-static inline u64 mic_smpt_to_pa(struct mic_device *mdev, u8 index)
-{
-       return mdev->smpt->info.base + (index * mdev->smpt->info.page_size);
-}
-
-static inline u64 mic_smpt_offset(struct mic_device *mdev, dma_addr_t pa)
-{
-       return pa & mic_system_page_mask(mdev);
-}
-
-static inline u64 mic_smpt_align_low(struct mic_device *mdev, dma_addr_t pa)
-{
-       return ALIGN(pa - mic_system_page_mask(mdev),
-               mdev->smpt->info.page_size);
-}
-
-static inline u64 mic_smpt_align_high(struct mic_device *mdev, dma_addr_t pa)
-{
-       return ALIGN(pa, mdev->smpt->info.page_size);
-}
-
-/* Total Cumulative system memory accessible by MIC across all SMPT entries */
-static inline u64 mic_max_system_memory(struct mic_device *mdev)
-{
-       return mdev->smpt->info.num_reg * mdev->smpt->info.page_size;
-}
-
-/* Maximum system memory address accessible by MIC */
-static inline u64 mic_max_system_addr(struct mic_device *mdev)
-{
-       return mdev->smpt->info.base + mic_max_system_memory(mdev) - 1ULL;
-}
-
-/* Check if the DMA address is a MIC system memory address */
-static inline bool
-mic_is_system_addr(struct mic_device *mdev, dma_addr_t pa)
-{
-       return pa >= mdev->smpt->info.base && pa <= mic_max_system_addr(mdev);
-}
-
-/* Populate an SMPT entry and update the reference counts. */
-static void mic_add_smpt_entry(int spt, s64 *ref, u64 addr,
-                              int entries, struct mic_device *mdev)
-{
-       struct mic_smpt_info *smpt_info = mdev->smpt;
-       int i;
-
-       for (i = spt; i < spt + entries; i++,
-               addr += smpt_info->info.page_size) {
-               if (!smpt_info->entry[i].ref_count &&
-                   (smpt_info->entry[i].dma_addr != addr)) {
-                       mdev->smpt_ops->set(mdev, addr, i);
-                       smpt_info->entry[i].dma_addr = addr;
-               }
-               smpt_info->entry[i].ref_count += ref[i - spt];
-       }
-}
-
-/*
- * Find an available MIC address in MIC SMPT address space
- * for a given DMA address and size.
- */
-static dma_addr_t mic_smpt_op(struct mic_device *mdev, u64 dma_addr,
-                             int entries, s64 *ref, size_t size)
-{
-       int spt;
-       int ae = 0;
-       int i;
-       unsigned long flags;
-       dma_addr_t mic_addr = 0;
-       dma_addr_t addr = dma_addr;
-       struct mic_smpt_info *smpt_info = mdev->smpt;
-
-       spin_lock_irqsave(&smpt_info->smpt_lock, flags);
-
-       /* find existing entries */
-       for (i = 0; i < smpt_info->info.num_reg; i++) {
-               if (smpt_info->entry[i].dma_addr == addr) {
-                       ae++;
-                       addr += smpt_info->info.page_size;
-               } else if (ae) /* cannot find contiguous entries */
-                       goto not_found;
-
-               if (ae == entries)
-                       goto found;
-       }
-
-       /* find free entry */
-       for (ae = 0, i = 0; i < smpt_info->info.num_reg; i++) {
-               ae = (smpt_info->entry[i].ref_count == 0) ? ae + 1 : 0;
-               if (ae == entries)
-                       goto found;
-       }
-
-not_found:
-       spin_unlock_irqrestore(&smpt_info->smpt_lock, flags);
-       return mic_addr;
-
-found:
-       spt = i - entries + 1;
-       mic_addr = mic_smpt_to_pa(mdev, spt);
-       mic_add_smpt_entry(spt, ref, dma_addr, entries, mdev);
-       smpt_info->map_count++;
-       smpt_info->ref_count += (s64)size;
-       spin_unlock_irqrestore(&smpt_info->smpt_lock, flags);
-       return mic_addr;
-}
-
-/*
- * Returns number of smpt entries needed for dma_addr to dma_addr + size
- * also returns the reference count array for each of those entries
- * and the starting smpt address
- */
-static int mic_get_smpt_ref_count(struct mic_device *mdev, dma_addr_t dma_addr,
-                                 size_t size, s64 *ref,  u64 *smpt_start)
-{
-       u64 start =  dma_addr;
-       u64 end = dma_addr + size;
-       int i = 0;
-
-       while (start < end) {
-               ref[i++] = min(mic_smpt_align_high(mdev, start + 1),
-                       end) - start;
-               start = mic_smpt_align_high(mdev, start + 1);
-       }
-
-       if (smpt_start)
-               *smpt_start = mic_smpt_align_low(mdev, dma_addr);
-
-       return i;
-}
-
-/*
- * mic_to_dma_addr - Converts a MIC address to a DMA address.
- *
- * @mdev: pointer to mic_device instance.
- * @mic_addr: MIC address.
- *
- * returns a DMA address.
- */
-dma_addr_t mic_to_dma_addr(struct mic_device *mdev, dma_addr_t mic_addr)
-{
-       struct mic_smpt_info *smpt_info = mdev->smpt;
-       int spt;
-       dma_addr_t dma_addr;
-
-       if (!mic_is_system_addr(mdev, mic_addr)) {
-               dev_err(&mdev->pdev->dev,
-                       "mic_addr is invalid. mic_addr = 0x%llx\n", mic_addr);
-               return -EINVAL;
-       }
-       spt = mic_sys_addr_to_smpt(mdev, mic_addr);
-       dma_addr = smpt_info->entry[spt].dma_addr +
-               mic_smpt_offset(mdev, mic_addr);
-       return dma_addr;
-}
-
-/**
- * mic_map - Maps a DMA address to a MIC physical address.
- *
- * @mdev: pointer to mic_device instance.
- * @dma_addr: DMA address.
- * @size: Size of the region to be mapped.
- *
- * This API converts the DMA address provided to a DMA address understood
- * by MIC. Caller should check for errors by calling mic_map_error(..).
- *
- * returns DMA address as required by MIC.
- */
-dma_addr_t mic_map(struct mic_device *mdev, dma_addr_t dma_addr, size_t size)
-{
-       dma_addr_t mic_addr = 0;
-       int num_entries;
-       s64 *ref;
-       u64 smpt_start;
-
-       if (!size || size > mic_max_system_memory(mdev))
-               return mic_addr;
-
-       ref = kmalloc_array(mdev->smpt->info.num_reg, sizeof(s64), GFP_ATOMIC);
-       if (!ref)
-               return mic_addr;
-
-       num_entries = mic_get_smpt_ref_count(mdev, dma_addr, size,
-                                            ref, &smpt_start);
-
-       /* Set the smpt table appropriately and get 16G aligned mic address */
-       mic_addr = mic_smpt_op(mdev, smpt_start, num_entries, ref, size);
-
-       kfree(ref);
-
-       /*
-        * If mic_addr is zero then its an error case
-        * since mic_addr can never be zero.
-        * else generate mic_addr by adding the 16G offset in dma_addr
-        */
-       if (!mic_addr && MIC_FAMILY_X100 == mdev->family) {
-               dev_err(&mdev->pdev->dev,
-                       "mic_map failed dma_addr 0x%llx size 0x%lx\n",
-                       dma_addr, size);
-               return mic_addr;
-       } else {
-               return mic_addr + mic_smpt_offset(mdev, dma_addr);
-       }
-}
-
-/**
- * mic_unmap - Unmaps a MIC physical address.
- *
- * @mdev: pointer to mic_device instance.
- * @mic_addr: MIC physical address.
- * @size: Size of the region to be unmapped.
- *
- * This API unmaps the mappings created by mic_map(..).
- *
- * returns None.
- */
-void mic_unmap(struct mic_device *mdev, dma_addr_t mic_addr, size_t size)
-{
-       struct mic_smpt_info *smpt_info = mdev->smpt;
-       s64 *ref;
-       int num_smpt;
-       int spt;
-       int i;
-       unsigned long flags;
-
-       if (!size)
-               return;
-
-       if (!mic_is_system_addr(mdev, mic_addr)) {
-               dev_err(&mdev->pdev->dev,
-                       "invalid address: 0x%llx\n", mic_addr);
-               return;
-       }
-
-       spt = mic_sys_addr_to_smpt(mdev, mic_addr);
-       ref = kmalloc_array(mdev->smpt->info.num_reg, sizeof(s64), GFP_ATOMIC);
-       if (!ref)
-               return;
-
-       /* Get number of smpt entries to be mapped, ref count array */
-       num_smpt = mic_get_smpt_ref_count(mdev, mic_addr, size, ref, NULL);
-
-       spin_lock_irqsave(&smpt_info->smpt_lock, flags);
-       smpt_info->unmap_count++;
-       smpt_info->ref_count -= (s64)size;
-
-       for (i = spt; i < spt + num_smpt; i++) {
-               smpt_info->entry[i].ref_count -= ref[i - spt];
-               if (smpt_info->entry[i].ref_count < 0)
-                       dev_warn(&mdev->pdev->dev,
-                                "ref count for entry %d is negative\n", i);
-       }
-       spin_unlock_irqrestore(&smpt_info->smpt_lock, flags);
-       kfree(ref);
-}
-
-/**
- * mic_map_single - Maps a virtual address to a MIC physical address.
- *
- * @mdev: pointer to mic_device instance.
- * @va: Kernel direct mapped virtual address.
- * @size: Size of the region to be mapped.
- *
- * This API calls pci_map_single(..) for the direct mapped virtual address
- * and then converts the DMA address provided to a DMA address understood
- * by MIC. Caller should check for errors by calling mic_map_error(..).
- *
- * returns DMA address as required by MIC.
- */
-dma_addr_t mic_map_single(struct mic_device *mdev, void *va, size_t size)
-{
-       dma_addr_t mic_addr = 0;
-       struct pci_dev *pdev = mdev->pdev;
-       dma_addr_t dma_addr =
-               pci_map_single(pdev, va, size, PCI_DMA_BIDIRECTIONAL);
-
-       if (!pci_dma_mapping_error(pdev, dma_addr)) {
-               mic_addr = mic_map(mdev, dma_addr, size);
-               if (!mic_addr) {
-                       dev_err(&mdev->pdev->dev,
-                               "mic_map failed dma_addr 0x%llx size 0x%lx\n",
-                               dma_addr, size);
-                       pci_unmap_single(pdev, dma_addr,
-                                        size, PCI_DMA_BIDIRECTIONAL);
-               }
-       }
-       return mic_addr;
-}
-
-/**
- * mic_unmap_single - Unmaps a MIC physical address.
- *
- * @mdev: pointer to mic_device instance.
- * @mic_addr: MIC physical address.
- * @size: Size of the region to be unmapped.
- *
- * This API unmaps the mappings created by mic_map_single(..).
- *
- * returns None.
- */
-void
-mic_unmap_single(struct mic_device *mdev, dma_addr_t mic_addr, size_t size)
-{
-       struct pci_dev *pdev = mdev->pdev;
-       dma_addr_t dma_addr = mic_to_dma_addr(mdev, mic_addr);
-       mic_unmap(mdev, mic_addr, size);
-       pci_unmap_single(pdev, dma_addr, size, PCI_DMA_BIDIRECTIONAL);
-}
-
-/**
- * mic_smpt_init - Initialize MIC System Memory Page Tables.
- *
- * @mdev: pointer to mic_device instance.
- *
- * returns 0 for success and -errno for error.
- */
-int mic_smpt_init(struct mic_device *mdev)
-{
-       int i, err = 0;
-       dma_addr_t dma_addr;
-       struct mic_smpt_info *smpt_info;
-
-       mdev->smpt = kmalloc(sizeof(*mdev->smpt), GFP_KERNEL);
-       if (!mdev->smpt)
-               return -ENOMEM;
-
-       smpt_info = mdev->smpt;
-       mdev->smpt_ops->init(mdev);
-       smpt_info->entry = kmalloc_array(smpt_info->info.num_reg,
-                                        sizeof(*smpt_info->entry), GFP_KERNEL);
-       if (!smpt_info->entry) {
-               err = -ENOMEM;
-               goto free_smpt;
-       }
-       spin_lock_init(&smpt_info->smpt_lock);
-       for (i = 0; i < smpt_info->info.num_reg; i++) {
-               dma_addr = i * smpt_info->info.page_size;
-               smpt_info->entry[i].dma_addr = dma_addr;
-               smpt_info->entry[i].ref_count = 0;
-               mdev->smpt_ops->set(mdev, dma_addr, i);
-       }
-       smpt_info->ref_count = 0;
-       smpt_info->map_count = 0;
-       smpt_info->unmap_count = 0;
-       return 0;
-free_smpt:
-       kfree(smpt_info);
-       return err;
-}
-
-/**
- * mic_smpt_uninit - UnInitialize MIC System Memory Page Tables.
- *
- * @mdev: pointer to mic_device instance.
- *
- * returns None.
- */
-void mic_smpt_uninit(struct mic_device *mdev)
-{
-       struct mic_smpt_info *smpt_info = mdev->smpt;
-       int i;
-
-       dev_dbg(&mdev->pdev->dev,
-               "nodeid %d SMPT ref count %lld map %lld unmap %lld\n",
-               mdev->id, smpt_info->ref_count,
-               smpt_info->map_count, smpt_info->unmap_count);
-
-       for (i = 0; i < smpt_info->info.num_reg; i++) {
-               dev_dbg(&mdev->pdev->dev,
-                       "SMPT entry[%d] dma_addr = 0x%llx ref_count = %lld\n",
-                       i, smpt_info->entry[i].dma_addr,
-                       smpt_info->entry[i].ref_count);
-               if (smpt_info->entry[i].ref_count)
-                       dev_warn(&mdev->pdev->dev,
-                                "ref count for entry %d is not zero\n", i);
-       }
-       kfree(smpt_info->entry);
-       kfree(smpt_info);
-}
-
-/**
- * mic_smpt_restore - Restore MIC System Memory Page Tables.
- *
- * @mdev: pointer to mic_device instance.
- *
- * Restore the SMPT registers to values previously stored in the
- * SW data structures. Some MIC steppings lose register state
- * across resets and this API should be called for performing
- * a restore operation if required.
- *
- * returns None.
- */
-void mic_smpt_restore(struct mic_device *mdev)
-{
-       int i;
-       dma_addr_t dma_addr;
-
-       for (i = 0; i < mdev->smpt->info.num_reg; i++) {
-               dma_addr = mdev->smpt->entry[i].dma_addr;
-               mdev->smpt_ops->set(mdev, dma_addr, i);
-       }
-}
diff --git a/drivers/misc/mic/host/mic_smpt.h b/drivers/misc/mic/host/mic_smpt.h
deleted file mode 100644 (file)
index 3b1ec14..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC Host driver.
- */
-#ifndef MIC_SMPT_H
-#define MIC_SMPT_H
-/**
- * struct mic_smpt_ops - MIC HW specific SMPT operations.
- * @init: Initialize hardware specific SMPT information in mic_smpt_hw_info.
- * @set: Set the value for a particular SMPT entry.
- */
-struct mic_smpt_ops {
-       void (*init)(struct mic_device *mdev);
-       void (*set)(struct mic_device *mdev, dma_addr_t dma_addr, u8 index);
-};
-
-/**
- * struct mic_smpt - MIC SMPT entry information.
- * @dma_addr: Base DMA address for this SMPT entry.
- * @ref_count: Number of active mappings for this SMPT entry in bytes.
- */
-struct mic_smpt {
-       dma_addr_t dma_addr;
-       s64 ref_count;
-};
-
-/**
- * struct mic_smpt_hw_info - MIC SMPT hardware specific information.
- * @num_reg: Number of SMPT registers.
- * @page_shift: System memory page shift.
- * @page_size: System memory page size.
- * @base: System address base.
- */
-struct mic_smpt_hw_info {
-       u8 num_reg;
-       u8 page_shift;
-       u64 page_size;
-       u64 base;
-};
-
-/**
- * struct mic_smpt_info - MIC SMPT information.
- * @entry: Array of SMPT entries.
- * @smpt_lock: Spin lock protecting access to SMPT data structures.
- * @info: Hardware specific SMPT information.
- * @ref_count: Number of active SMPT mappings (for debug).
- * @map_count: Number of SMPT mappings created (for debug).
- * @unmap_count: Number of SMPT mappings destroyed (for debug).
- */
-struct mic_smpt_info {
-       struct mic_smpt *entry;
-       spinlock_t smpt_lock;
-       struct mic_smpt_hw_info info;
-       s64 ref_count;
-       s64 map_count;
-       s64 unmap_count;
-};
-
-dma_addr_t mic_map_single(struct mic_device *mdev, void *va, size_t size);
-void mic_unmap_single(struct mic_device *mdev,
-       dma_addr_t mic_addr, size_t size);
-dma_addr_t mic_map(struct mic_device *mdev,
-       dma_addr_t dma_addr, size_t size);
-void mic_unmap(struct mic_device *mdev, dma_addr_t mic_addr, size_t size);
-dma_addr_t mic_to_dma_addr(struct mic_device *mdev, dma_addr_t mic_addr);
-
-/**
- * mic_map_error - Check a MIC address for errors.
- *
- * @mdev: pointer to mic_device instance.
- *
- * returns Whether there was an error during mic_map..(..) APIs.
- */
-static inline bool mic_map_error(dma_addr_t mic_addr)
-{
-       return !mic_addr;
-}
-
-int mic_smpt_init(struct mic_device *mdev);
-void mic_smpt_uninit(struct mic_device *mdev);
-void mic_smpt_restore(struct mic_device *mdev);
-
-#endif
diff --git a/drivers/misc/mic/host/mic_x100.c b/drivers/misc/mic/host/mic_x100.c
deleted file mode 100644 (file)
index f5536c1..0000000
+++ /dev/null
@@ -1,585 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC Host driver.
- */
-#include <linux/fs.h>
-#include <linux/pci.h>
-#include <linux/sched.h>
-#include <linux/firmware.h>
-#include <linux/delay.h>
-
-#include "../common/mic_dev.h"
-#include "mic_device.h"
-#include "mic_x100.h"
-#include "mic_smpt.h"
-
-static const u16 mic_x100_intr_init[] = {
-               MIC_X100_DOORBELL_IDX_START,
-               MIC_X100_DMA_IDX_START,
-               MIC_X100_ERR_IDX_START,
-               MIC_X100_NUM_DOORBELL,
-               MIC_X100_NUM_DMA,
-               MIC_X100_NUM_ERR,
-};
-
-/**
- * mic_x100_write_spad - write to the scratchpad register
- * @mdev: pointer to mic_device instance
- * @idx: index to the scratchpad register, 0 based
- * @val: the data value to put into the register
- *
- * This function allows writing of a 32bit value to the indexed scratchpad
- * register.
- *
- * RETURNS: none.
- */
-static void
-mic_x100_write_spad(struct mic_device *mdev, unsigned int idx, u32 val)
-{
-       dev_dbg(&mdev->pdev->dev, "Writing 0x%x to scratch pad index %d\n",
-               val, idx);
-       mic_mmio_write(&mdev->mmio, val,
-                      MIC_X100_SBOX_BASE_ADDRESS +
-                      MIC_X100_SBOX_SPAD0 + idx * 4);
-}
-
-/**
- * mic_x100_read_spad - read from the scratchpad register
- * @mdev: pointer to mic_device instance
- * @idx: index to scratchpad register, 0 based
- *
- * This function allows reading of the 32bit scratchpad register.
- *
- * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
- */
-static u32
-mic_x100_read_spad(struct mic_device *mdev, unsigned int idx)
-{
-       u32 val = mic_mmio_read(&mdev->mmio,
-               MIC_X100_SBOX_BASE_ADDRESS +
-               MIC_X100_SBOX_SPAD0 + idx * 4);
-
-       dev_dbg(&mdev->pdev->dev,
-               "Reading 0x%x from scratch pad index %d\n", val, idx);
-       return val;
-}
-
-/**
- * mic_x100_enable_interrupts - Enable interrupts.
- * @mdev: pointer to mic_device instance
- */
-static void mic_x100_enable_interrupts(struct mic_device *mdev)
-{
-       u32 reg;
-       struct mic_mw *mw = &mdev->mmio;
-       u32 sice0 = MIC_X100_SBOX_BASE_ADDRESS + MIC_X100_SBOX_SICE0;
-       u32 siac0 = MIC_X100_SBOX_BASE_ADDRESS + MIC_X100_SBOX_SIAC0;
-
-       reg = mic_mmio_read(mw, sice0);
-       reg |= MIC_X100_SBOX_DBR_BITS(0xf) | MIC_X100_SBOX_DMA_BITS(0xff);
-       mic_mmio_write(mw, reg, sice0);
-
-       /*
-        * Enable auto-clear when enabling interrupts. Applicable only for
-        * MSI-x. Legacy and MSI mode cannot have auto-clear enabled.
-        */
-       if (mdev->irq_info.num_vectors > 1) {
-               reg = mic_mmio_read(mw, siac0);
-               reg |= MIC_X100_SBOX_DBR_BITS(0xf) |
-                       MIC_X100_SBOX_DMA_BITS(0xff);
-               mic_mmio_write(mw, reg, siac0);
-       }
-}
-
-/**
- * mic_x100_disable_interrupts - Disable interrupts.
- * @mdev: pointer to mic_device instance
- */
-static void mic_x100_disable_interrupts(struct mic_device *mdev)
-{
-       u32 reg;
-       struct mic_mw *mw = &mdev->mmio;
-       u32 sice0 = MIC_X100_SBOX_BASE_ADDRESS + MIC_X100_SBOX_SICE0;
-       u32 siac0 = MIC_X100_SBOX_BASE_ADDRESS + MIC_X100_SBOX_SIAC0;
-       u32 sicc0 = MIC_X100_SBOX_BASE_ADDRESS + MIC_X100_SBOX_SICC0;
-
-       reg = mic_mmio_read(mw, sice0);
-       mic_mmio_write(mw, reg, sicc0);
-
-       if (mdev->irq_info.num_vectors > 1) {
-               reg = mic_mmio_read(mw, siac0);
-               reg &= ~(MIC_X100_SBOX_DBR_BITS(0xf) |
-                       MIC_X100_SBOX_DMA_BITS(0xff));
-               mic_mmio_write(mw, reg, siac0);
-       }
-}
-
-/**
- * mic_x100_send_sbox_intr - Send an MIC_X100_SBOX interrupt to MIC.
- * @mdev: pointer to mic_device instance
- * @doorbell: doorbell number
- */
-static void mic_x100_send_sbox_intr(struct mic_device *mdev,
-                                   int doorbell)
-{
-       struct mic_mw *mw = &mdev->mmio;
-       u64 apic_icr_offset = MIC_X100_SBOX_APICICR0 + doorbell * 8;
-       u32 apicicr_low = mic_mmio_read(mw, MIC_X100_SBOX_BASE_ADDRESS +
-                                       apic_icr_offset);
-
-       /* for MIC we need to make sure we "hit" the send_icr bit (13) */
-       apicicr_low = (apicicr_low | (1 << 13));
-
-       /* Ensure that the interrupt is ordered w.r.t. previous stores. */
-       wmb();
-       mic_mmio_write(mw, apicicr_low,
-                      MIC_X100_SBOX_BASE_ADDRESS + apic_icr_offset);
-}
-
-/**
- * mic_x100_send_rdmasr_intr - Send an RDMASR interrupt to MIC.
- * @mdev: pointer to mic_device instance
- * @doorbell: doorbell number
- */
-static void mic_x100_send_rdmasr_intr(struct mic_device *mdev,
-                                     int doorbell)
-{
-       int rdmasr_offset = MIC_X100_SBOX_RDMASR0 + (doorbell << 2);
-       /* Ensure that the interrupt is ordered w.r.t. previous stores. */
-       wmb();
-       mic_mmio_write(&mdev->mmio, 0,
-                      MIC_X100_SBOX_BASE_ADDRESS + rdmasr_offset);
-}
-
-/**
- * __mic_x100_send_intr - Send interrupt to MIC.
- * @mdev: pointer to mic_device instance
- * @doorbell: doorbell number.
- */
-static void mic_x100_send_intr(struct mic_device *mdev, int doorbell)
-{
-       int rdmasr_db;
-       if (doorbell < MIC_X100_NUM_SBOX_IRQ) {
-               mic_x100_send_sbox_intr(mdev, doorbell);
-       } else {
-               rdmasr_db = doorbell - MIC_X100_NUM_SBOX_IRQ;
-               mic_x100_send_rdmasr_intr(mdev, rdmasr_db);
-       }
-}
-
-/**
- * mic_x100_ack_interrupt - Read the interrupt sources register and
- * clear it. This function will be called in the MSI/INTx case.
- * @mdev: Pointer to mic_device instance.
- *
- * Returns: bitmask of interrupt sources triggered.
- */
-static u32 mic_x100_ack_interrupt(struct mic_device *mdev)
-{
-       u32 sicr0 = MIC_X100_SBOX_BASE_ADDRESS + MIC_X100_SBOX_SICR0;
-       u32 reg = mic_mmio_read(&mdev->mmio, sicr0);
-       mic_mmio_write(&mdev->mmio, reg, sicr0);
-       return reg;
-}
-
-/**
- * mic_x100_intr_workarounds - These hardware specific workarounds are
- * to be invoked everytime an interrupt is handled.
- * @mdev: Pointer to mic_device instance.
- *
- * Returns: none
- */
-static void mic_x100_intr_workarounds(struct mic_device *mdev)
-{
-       struct mic_mw *mw = &mdev->mmio;
-
-       /* Clear pending bit array. */
-       if (MIC_A0_STEP == mdev->stepping)
-               mic_mmio_write(mw, 1, MIC_X100_SBOX_BASE_ADDRESS +
-                       MIC_X100_SBOX_MSIXPBACR);
-
-       if (mdev->stepping >= MIC_B0_STEP)
-               mdev->intr_ops->enable_interrupts(mdev);
-}
-
-/**
- * mic_x100_hw_intr_init - Initialize h/w specific interrupt
- * information.
- * @mdev: pointer to mic_device instance
- */
-static void mic_x100_hw_intr_init(struct mic_device *mdev)
-{
-       mdev->intr_info = (struct mic_intr_info *)mic_x100_intr_init;
-}
-
-/**
- * mic_x100_read_msi_to_src_map - read from the MSI mapping registers
- * @mdev: pointer to mic_device instance
- * @idx: index to the mapping register, 0 based
- *
- * This function allows reading of the 32bit MSI mapping register.
- *
- * RETURNS: The value in the register.
- */
-static u32
-mic_x100_read_msi_to_src_map(struct mic_device *mdev, int idx)
-{
-       return mic_mmio_read(&mdev->mmio,
-               MIC_X100_SBOX_BASE_ADDRESS +
-               MIC_X100_SBOX_MXAR0 + idx * 4);
-}
-
-/**
- * mic_x100_program_msi_to_src_map - program the MSI mapping registers
- * @mdev: pointer to mic_device instance
- * @idx: index to the mapping register, 0 based
- * @offset: The bit offset in the register that needs to be updated.
- * @set: boolean specifying if the bit in the specified offset needs
- * to be set or cleared.
- *
- * RETURNS: None.
- */
-static void
-mic_x100_program_msi_to_src_map(struct mic_device *mdev,
-                               int idx, int offset, bool set)
-{
-       unsigned long reg;
-       struct mic_mw *mw = &mdev->mmio;
-       u32 mxar = MIC_X100_SBOX_BASE_ADDRESS +
-               MIC_X100_SBOX_MXAR0 + idx * 4;
-
-       reg = mic_mmio_read(mw, mxar);
-       if (set)
-               __set_bit(offset, &reg);
-       else
-               __clear_bit(offset, &reg);
-       mic_mmio_write(mw, reg, mxar);
-}
-
-/*
- * mic_x100_reset_fw_ready - Reset Firmware ready status field.
- * @mdev: pointer to mic_device instance
- */
-static void mic_x100_reset_fw_ready(struct mic_device *mdev)
-{
-       mdev->ops->write_spad(mdev, MIC_X100_DOWNLOAD_INFO, 0);
-}
-
-/*
- * mic_x100_is_fw_ready - Check if firmware is ready.
- * @mdev: pointer to mic_device instance
- */
-static bool mic_x100_is_fw_ready(struct mic_device *mdev)
-{
-       u32 scratch2 = mdev->ops->read_spad(mdev, MIC_X100_DOWNLOAD_INFO);
-       return MIC_X100_SPAD2_DOWNLOAD_STATUS(scratch2) ? true : false;
-}
-
-/**
- * mic_x100_get_apic_id - Get bootstrap APIC ID.
- * @mdev: pointer to mic_device instance
- */
-static u32 mic_x100_get_apic_id(struct mic_device *mdev)
-{
-       u32 scratch2 = 0;
-
-       scratch2 = mdev->ops->read_spad(mdev, MIC_X100_DOWNLOAD_INFO);
-       return MIC_X100_SPAD2_APIC_ID(scratch2);
-}
-
-/**
- * mic_x100_send_firmware_intr - Send an interrupt to the firmware on MIC.
- * @mdev: pointer to mic_device instance
- */
-static void mic_x100_send_firmware_intr(struct mic_device *mdev)
-{
-       u32 apicicr_low;
-       u64 apic_icr_offset = MIC_X100_SBOX_APICICR7;
-       int vector = MIC_X100_BSP_INTERRUPT_VECTOR;
-       struct mic_mw *mw = &mdev->mmio;
-
-       /*
-        * For MIC we need to make sure we "hit"
-        * the send_icr bit (13).
-        */
-       apicicr_low = (vector | (1 << 13));
-
-       mic_mmio_write(mw, mic_x100_get_apic_id(mdev),
-                      MIC_X100_SBOX_BASE_ADDRESS + apic_icr_offset + 4);
-
-       /* Ensure that the interrupt is ordered w.r.t. previous stores. */
-       wmb();
-       mic_mmio_write(mw, apicicr_low,
-                      MIC_X100_SBOX_BASE_ADDRESS + apic_icr_offset);
-}
-
-/**
- * mic_x100_hw_reset - Reset the MIC device.
- * @mdev: pointer to mic_device instance
- */
-static void mic_x100_hw_reset(struct mic_device *mdev)
-{
-       u32 reset_reg;
-       u32 rgcr = MIC_X100_SBOX_BASE_ADDRESS + MIC_X100_SBOX_RGCR;
-       struct mic_mw *mw = &mdev->mmio;
-
-       /* Ensure that the reset is ordered w.r.t. previous loads and stores */
-       mb();
-       /* Trigger reset */
-       reset_reg = mic_mmio_read(mw, rgcr);
-       reset_reg |= 0x1;
-       mic_mmio_write(mw, reset_reg, rgcr);
-       /*
-        * It seems we really want to delay at least 1 second
-        * after touching reset to prevent a lot of problems.
-        */
-       msleep(1000);
-}
-
-/**
- * mic_x100_load_command_line - Load command line to MIC.
- * @mdev: pointer to mic_device instance
- * @fw: the firmware image
- *
- * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
- */
-static int
-mic_x100_load_command_line(struct mic_device *mdev, const struct firmware *fw)
-{
-       u32 len = 0;
-       u32 boot_mem;
-       char *buf;
-       void __iomem *cmd_line_va = mdev->aper.va + mdev->bootaddr + fw->size;
-#define CMDLINE_SIZE 2048
-
-       boot_mem = mdev->aper.len >> 20;
-       buf = kzalloc(CMDLINE_SIZE, GFP_KERNEL);
-       if (!buf)
-               return -ENOMEM;
-
-       len += scnprintf(buf, CMDLINE_SIZE - len,
-               " mem=%dM", boot_mem);
-       if (mdev->cosm_dev->cmdline)
-               scnprintf(buf + len, CMDLINE_SIZE - len, " %s",
-                        mdev->cosm_dev->cmdline);
-       memcpy_toio(cmd_line_va, buf, strlen(buf) + 1);
-       kfree(buf);
-       return 0;
-}
-
-/**
- * mic_x100_load_ramdisk - Load ramdisk to MIC.
- * @mdev: pointer to mic_device instance
- *
- * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
- */
-static int
-mic_x100_load_ramdisk(struct mic_device *mdev)
-{
-       const struct firmware *fw;
-       int rc;
-       struct boot_params __iomem *bp = mdev->aper.va + mdev->bootaddr;
-
-       rc = request_firmware(&fw, mdev->cosm_dev->ramdisk, &mdev->pdev->dev);
-       if (rc < 0) {
-               dev_err(&mdev->pdev->dev,
-                       "ramdisk request_firmware failed: %d %s\n",
-                       rc, mdev->cosm_dev->ramdisk);
-               goto error;
-       }
-       /*
-        * Typically the bootaddr for card OS is 64M
-        * so copy over the ramdisk @ 128M.
-        */
-       memcpy_toio(mdev->aper.va + (mdev->bootaddr << 1), fw->data, fw->size);
-       iowrite32(mdev->bootaddr << 1, &bp->hdr.ramdisk_image);
-       iowrite32(fw->size, &bp->hdr.ramdisk_size);
-       release_firmware(fw);
-error:
-       return rc;
-}
-
-/**
- * mic_x100_get_boot_addr - Get MIC boot address.
- * @mdev: pointer to mic_device instance
- *
- * This function is called during firmware load to determine
- * the address at which the OS should be downloaded in card
- * memory i.e. GDDR.
- * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
- */
-static int
-mic_x100_get_boot_addr(struct mic_device *mdev)
-{
-       u32 scratch2, boot_addr;
-       int rc = 0;
-
-       scratch2 = mdev->ops->read_spad(mdev, MIC_X100_DOWNLOAD_INFO);
-       boot_addr = MIC_X100_SPAD2_DOWNLOAD_ADDR(scratch2);
-       dev_dbg(&mdev->pdev->dev, "%s %d boot_addr 0x%x\n",
-               __func__, __LINE__, boot_addr);
-       if (boot_addr > (1 << 31)) {
-               dev_err(&mdev->pdev->dev,
-                       "incorrect bootaddr 0x%x\n",
-                       boot_addr);
-               rc = -EINVAL;
-               goto error;
-       }
-       mdev->bootaddr = boot_addr;
-error:
-       return rc;
-}
-
-/**
- * mic_x100_load_firmware - Load firmware to MIC.
- * @mdev: pointer to mic_device instance
- * @buf: buffer containing boot string including firmware/ramdisk path.
- *
- * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
- */
-static int
-mic_x100_load_firmware(struct mic_device *mdev, const char *buf)
-{
-       int rc;
-       const struct firmware *fw;
-
-       rc = mic_x100_get_boot_addr(mdev);
-       if (rc)
-               return rc;
-       /* load OS */
-       rc = request_firmware(&fw, mdev->cosm_dev->firmware, &mdev->pdev->dev);
-       if (rc < 0) {
-               dev_err(&mdev->pdev->dev,
-                       "ramdisk request_firmware failed: %d %s\n",
-                       rc, mdev->cosm_dev->firmware);
-               return rc;
-       }
-       if (mdev->bootaddr > mdev->aper.len - fw->size) {
-               rc = -EINVAL;
-               dev_err(&mdev->pdev->dev, "%s %d rc %d bootaddr 0x%x\n",
-                       __func__, __LINE__, rc, mdev->bootaddr);
-               goto error;
-       }
-       memcpy_toio(mdev->aper.va + mdev->bootaddr, fw->data, fw->size);
-       mdev->ops->write_spad(mdev, MIC_X100_FW_SIZE, fw->size);
-       if (!strcmp(mdev->cosm_dev->bootmode, "flash")) {
-               rc = -EINVAL;
-               dev_err(&mdev->pdev->dev, "%s %d rc %d\n",
-                       __func__, __LINE__, rc);
-               goto error;
-       }
-       /* load command line */
-       rc = mic_x100_load_command_line(mdev, fw);
-       if (rc) {
-               dev_err(&mdev->pdev->dev, "%s %d rc %d\n",
-                       __func__, __LINE__, rc);
-               goto error;
-       }
-       release_firmware(fw);
-       /* load ramdisk */
-       if (mdev->cosm_dev->ramdisk)
-               rc = mic_x100_load_ramdisk(mdev);
-
-       return rc;
-
-error:
-       release_firmware(fw);
-       return rc;
-}
-
-/**
- * mic_x100_get_postcode - Get postcode status from firmware.
- * @mdev: pointer to mic_device instance
- *
- * RETURNS: postcode.
- */
-static u32 mic_x100_get_postcode(struct mic_device *mdev)
-{
-       return mic_mmio_read(&mdev->mmio, MIC_X100_POSTCODE);
-}
-
-/**
- * mic_x100_smpt_set - Update an SMPT entry with a DMA address.
- * @mdev: pointer to mic_device instance
- * @dma_addr: DMA address to use
- * @index: entry to write to
- *
- * RETURNS: none.
- */
-static void
-mic_x100_smpt_set(struct mic_device *mdev, dma_addr_t dma_addr, u8 index)
-{
-#define SNOOP_ON       (0 << 0)
-#define SNOOP_OFF      (1 << 0)
-/*
- * Sbox Smpt Reg Bits:
- * Bits        31:2    Host address
- * Bits        1       RSVD
- * Bits        0       No snoop
- */
-#define BUILD_SMPT(NO_SNOOP, HOST_ADDR)  \
-       (u32)(((HOST_ADDR) << 2) | ((NO_SNOOP) & 0x01))
-
-       uint32_t smpt_reg_val = BUILD_SMPT(SNOOP_ON,
-                       dma_addr >> mdev->smpt->info.page_shift);
-       mic_mmio_write(&mdev->mmio, smpt_reg_val,
-                      MIC_X100_SBOX_BASE_ADDRESS +
-                      MIC_X100_SBOX_SMPT00 + (4 * index));
-}
-
-/**
- * mic_x100_smpt_hw_init - Initialize SMPT X100 specific fields.
- * @mdev: pointer to mic_device instance
- *
- * RETURNS: none.
- */
-static void mic_x100_smpt_hw_init(struct mic_device *mdev)
-{
-       struct mic_smpt_hw_info *info = &mdev->smpt->info;
-
-       info->num_reg = 32;
-       info->page_shift = 34;
-       info->page_size = (1ULL << info->page_shift);
-       info->base = 0x8000000000ULL;
-}
-
-struct mic_smpt_ops mic_x100_smpt_ops = {
-       .init = mic_x100_smpt_hw_init,
-       .set = mic_x100_smpt_set,
-};
-
-static bool mic_x100_dma_filter(struct dma_chan *chan, void *param)
-{
-       if (chan->device->dev->parent == (struct device *)param)
-               return true;
-       return false;
-}
-
-struct mic_hw_ops mic_x100_ops = {
-       .aper_bar = MIC_X100_APER_BAR,
-       .mmio_bar = MIC_X100_MMIO_BAR,
-       .read_spad = mic_x100_read_spad,
-       .write_spad = mic_x100_write_spad,
-       .send_intr = mic_x100_send_intr,
-       .ack_interrupt = mic_x100_ack_interrupt,
-       .intr_workarounds = mic_x100_intr_workarounds,
-       .reset = mic_x100_hw_reset,
-       .reset_fw_ready = mic_x100_reset_fw_ready,
-       .is_fw_ready = mic_x100_is_fw_ready,
-       .send_firmware_intr = mic_x100_send_firmware_intr,
-       .load_mic_fw = mic_x100_load_firmware,
-       .get_postcode = mic_x100_get_postcode,
-       .dma_filter = mic_x100_dma_filter,
-};
-
-struct mic_hw_intr_ops mic_x100_intr_ops = {
-       .intr_init = mic_x100_hw_intr_init,
-       .enable_interrupts = mic_x100_enable_interrupts,
-       .disable_interrupts = mic_x100_disable_interrupts,
-       .program_msi_to_src_map = mic_x100_program_msi_to_src_map,
-       .read_msi_to_src_map = mic_x100_read_msi_to_src_map,
-};
diff --git a/drivers/misc/mic/host/mic_x100.h b/drivers/misc/mic/host/mic_x100.h
deleted file mode 100644 (file)
index aebcaed..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC Host driver.
- */
-#ifndef _MIC_X100_HW_H_
-#define _MIC_X100_HW_H_
-
-#define MIC_X100_PCI_DEVICE_2250 0x2250
-#define MIC_X100_PCI_DEVICE_2251 0x2251
-#define MIC_X100_PCI_DEVICE_2252 0x2252
-#define MIC_X100_PCI_DEVICE_2253 0x2253
-#define MIC_X100_PCI_DEVICE_2254 0x2254
-#define MIC_X100_PCI_DEVICE_2255 0x2255
-#define MIC_X100_PCI_DEVICE_2256 0x2256
-#define MIC_X100_PCI_DEVICE_2257 0x2257
-#define MIC_X100_PCI_DEVICE_2258 0x2258
-#define MIC_X100_PCI_DEVICE_2259 0x2259
-#define MIC_X100_PCI_DEVICE_225a 0x225a
-#define MIC_X100_PCI_DEVICE_225b 0x225b
-#define MIC_X100_PCI_DEVICE_225c 0x225c
-#define MIC_X100_PCI_DEVICE_225d 0x225d
-#define MIC_X100_PCI_DEVICE_225e 0x225e
-
-#define MIC_X100_APER_BAR 0
-#define MIC_X100_MMIO_BAR 4
-
-#define MIC_X100_SBOX_BASE_ADDRESS 0x00010000
-#define MIC_X100_SBOX_SPAD0 0x0000AB20
-#define MIC_X100_SBOX_SICR0_DBR(x) ((x) & 0xf)
-#define MIC_X100_SBOX_SICR0_DMA(x) (((x) >> 8) & 0xff)
-#define MIC_X100_SBOX_SICE0_DBR(x) ((x) & 0xf)
-#define MIC_X100_SBOX_DBR_BITS(x) ((x) & 0xf)
-#define MIC_X100_SBOX_SICE0_DMA(x) (((x) >> 8) & 0xff)
-#define MIC_X100_SBOX_DMA_BITS(x) (((x) & 0xff) << 8)
-
-#define MIC_X100_SBOX_APICICR0 0x0000A9D0
-#define MIC_X100_SBOX_SICR0 0x00009004
-#define MIC_X100_SBOX_SICE0 0x0000900C
-#define MIC_X100_SBOX_SICC0 0x00009010
-#define MIC_X100_SBOX_SIAC0 0x00009014
-#define MIC_X100_SBOX_MSIXPBACR 0x00009084
-#define MIC_X100_SBOX_MXAR0 0x00009044
-#define MIC_X100_SBOX_SMPT00 0x00003100
-#define MIC_X100_SBOX_RDMASR0 0x0000B180
-
-#define MIC_X100_DOORBELL_IDX_START 0
-#define MIC_X100_NUM_DOORBELL 4
-#define MIC_X100_DMA_IDX_START 8
-#define MIC_X100_NUM_DMA 8
-#define MIC_X100_ERR_IDX_START 30
-#define MIC_X100_NUM_ERR 1
-
-#define MIC_X100_NUM_SBOX_IRQ 8
-#define MIC_X100_NUM_RDMASR_IRQ 8
-#define MIC_X100_RDMASR_IRQ_BASE 17
-#define MIC_X100_SPAD2_DOWNLOAD_STATUS(x) ((x) & 0x1)
-#define MIC_X100_SPAD2_APIC_ID(x)      (((x) >> 1) & 0x1ff)
-#define MIC_X100_SPAD2_DOWNLOAD_ADDR(x) ((x) & 0xfffff000)
-#define MIC_X100_SBOX_APICICR7 0x0000AA08
-#define MIC_X100_SBOX_RGCR 0x00004010
-#define MIC_X100_SBOX_SDBIC0 0x0000CC90
-#define MIC_X100_DOWNLOAD_INFO 2
-#define MIC_X100_FW_SIZE 5
-#define MIC_X100_POSTCODE 0x242c
-
-/* Host->Card(bootstrap) Interrupt Vector */
-#define MIC_X100_BSP_INTERRUPT_VECTOR 229
-
-extern struct mic_hw_ops mic_x100_ops;
-extern struct mic_smpt_ops mic_x100_smpt_ops;
-extern struct mic_hw_intr_ops mic_x100_intr_ops;
-
-#endif
diff --git a/drivers/misc/mic/scif/Makefile b/drivers/misc/mic/scif/Makefile
deleted file mode 100644 (file)
index ff37255..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Makefile - SCIF driver.
-# Copyright(c) 2014, Intel Corporation.
-#
-obj-$(CONFIG_SCIF) += scif.o
-scif-objs := scif_main.o
-scif-objs += scif_peer_bus.o
-scif-objs += scif_ports.o
-scif-objs += scif_debugfs.o
-scif-objs += scif_fd.o
-scif-objs += scif_api.o
-scif-objs += scif_epd.o
-scif-objs += scif_rb.o
-scif-objs += scif_nodeqp.o
-scif-objs += scif_nm.o
-scif-objs += scif_dma.o
-scif-objs += scif_fence.o
-scif-objs += scif_mmap.o
-scif-objs += scif_rma.o
-scif-objs += scif_rma_list.o
diff --git a/drivers/misc/mic/scif/scif_api.c b/drivers/misc/mic/scif/scif_api.c
deleted file mode 100644 (file)
index 304d6c8..0000000
+++ /dev/null
@@ -1,1485 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include <linux/scif.h>
-#include "scif_main.h"
-#include "scif_map.h"
-
-static const char * const scif_ep_states[] = {
-       "Unbound",
-       "Bound",
-       "Listening",
-       "Connected",
-       "Connecting",
-       "Mapping",
-       "Closing",
-       "Close Listening",
-       "Disconnected",
-       "Zombie"};
-
-enum conn_async_state {
-       ASYNC_CONN_IDLE = 1,    /* ep setup for async connect */
-       ASYNC_CONN_INPROGRESS,  /* async connect in progress */
-       ASYNC_CONN_FLUSH_WORK   /* async work flush in progress  */
-};
-
-/*
- * File operations for anonymous inode file associated with a SCIF endpoint,
- * used in kernel mode SCIF poll. Kernel mode SCIF poll calls portions of the
- * poll API in the kernel and these take in a struct file *. Since a struct
- * file is not available to kernel mode SCIF, it uses an anonymous file for
- * this purpose.
- */
-const struct file_operations scif_anon_fops = {
-       .owner = THIS_MODULE,
-};
-
-scif_epd_t scif_open(void)
-{
-       struct scif_endpt *ep;
-       int err;
-
-       might_sleep();
-       ep = kzalloc(sizeof(*ep), GFP_KERNEL);
-       if (!ep)
-               goto err_ep_alloc;
-
-       ep->qp_info.qp = kzalloc(sizeof(*ep->qp_info.qp), GFP_KERNEL);
-       if (!ep->qp_info.qp)
-               goto err_qp_alloc;
-
-       err = scif_anon_inode_getfile(ep);
-       if (err)
-               goto err_anon_inode;
-
-       spin_lock_init(&ep->lock);
-       mutex_init(&ep->sendlock);
-       mutex_init(&ep->recvlock);
-
-       scif_rma_ep_init(ep);
-       ep->state = SCIFEP_UNBOUND;
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI open: ep %p success\n", ep);
-       return ep;
-
-err_anon_inode:
-       kfree(ep->qp_info.qp);
-err_qp_alloc:
-       kfree(ep);
-err_ep_alloc:
-       return NULL;
-}
-EXPORT_SYMBOL_GPL(scif_open);
-
-/*
- * scif_disconnect_ep - Disconnects the endpoint if found
- * @epd: The end point returned from scif_open()
- */
-static struct scif_endpt *scif_disconnect_ep(struct scif_endpt *ep)
-{
-       struct scifmsg msg;
-       struct scif_endpt *fep = NULL;
-       struct scif_endpt *tmpep;
-       struct list_head *pos, *tmpq;
-       int err;
-
-       /*
-        * Wake up any threads blocked in send()/recv() before closing
-        * out the connection. Grabbing and releasing the send/recv lock
-        * will ensure that any blocked senders/receivers have exited for
-        * Ring 0 endpoints. It is a Ring 0 bug to call send/recv after
-        * close. Ring 3 endpoints are not affected since close will not
-        * be called while there are IOCTLs executing.
-        */
-       wake_up_interruptible(&ep->sendwq);
-       wake_up_interruptible(&ep->recvwq);
-       mutex_lock(&ep->sendlock);
-       mutex_unlock(&ep->sendlock);
-       mutex_lock(&ep->recvlock);
-       mutex_unlock(&ep->recvlock);
-
-       /* Remove from the connected list */
-       mutex_lock(&scif_info.connlock);
-       list_for_each_safe(pos, tmpq, &scif_info.connected) {
-               tmpep = list_entry(pos, struct scif_endpt, list);
-               if (tmpep == ep) {
-                       list_del(pos);
-                       fep = tmpep;
-                       spin_lock(&ep->lock);
-                       break;
-               }
-       }
-
-       if (!fep) {
-               /*
-                * The other side has completed the disconnect before
-                * the end point can be removed from the list. Therefore
-                * the ep lock is not locked, traverse the disconnected
-                * list to find the endpoint and release the conn lock.
-                */
-               list_for_each_safe(pos, tmpq, &scif_info.disconnected) {
-                       tmpep = list_entry(pos, struct scif_endpt, list);
-                       if (tmpep == ep) {
-                               list_del(pos);
-                               break;
-                       }
-               }
-               mutex_unlock(&scif_info.connlock);
-               return NULL;
-       }
-
-       init_completion(&ep->discon);
-       msg.uop = SCIF_DISCNCT;
-       msg.src = ep->port;
-       msg.dst = ep->peer;
-       msg.payload[0] = (u64)ep;
-       msg.payload[1] = ep->remote_ep;
-
-       err = scif_nodeqp_send(ep->remote_dev, &msg);
-       spin_unlock(&ep->lock);
-       mutex_unlock(&scif_info.connlock);
-
-       if (!err)
-               /* Wait for the remote node to respond with SCIF_DISCNT_ACK */
-               wait_for_completion_timeout(&ep->discon,
-                                           SCIF_NODE_ALIVE_TIMEOUT);
-       return ep;
-}
-
-int scif_close(scif_epd_t epd)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       struct scif_endpt *tmpep;
-       struct list_head *pos, *tmpq;
-       enum scif_epd_state oldstate;
-       bool flush_conn;
-
-       dev_dbg(scif_info.mdev.this_device, "SCIFAPI close: ep %p %s\n",
-               ep, scif_ep_states[ep->state]);
-       might_sleep();
-       spin_lock(&ep->lock);
-       flush_conn = (ep->conn_async_state == ASYNC_CONN_INPROGRESS);
-       spin_unlock(&ep->lock);
-
-       if (flush_conn)
-               flush_work(&scif_info.conn_work);
-
-       spin_lock(&ep->lock);
-       oldstate = ep->state;
-
-       ep->state = SCIFEP_CLOSING;
-
-       switch (oldstate) {
-       case SCIFEP_ZOMBIE:
-               dev_err(scif_info.mdev.this_device,
-                       "SCIFAPI close: zombie state unexpected\n");
-               fallthrough;
-       case SCIFEP_DISCONNECTED:
-               spin_unlock(&ep->lock);
-               scif_unregister_all_windows(epd);
-               /* Remove from the disconnected list */
-               mutex_lock(&scif_info.connlock);
-               list_for_each_safe(pos, tmpq, &scif_info.disconnected) {
-                       tmpep = list_entry(pos, struct scif_endpt, list);
-                       if (tmpep == ep) {
-                               list_del(pos);
-                               break;
-                       }
-               }
-               mutex_unlock(&scif_info.connlock);
-               break;
-       case SCIFEP_UNBOUND:
-       case SCIFEP_BOUND:
-       case SCIFEP_CONNECTING:
-               spin_unlock(&ep->lock);
-               break;
-       case SCIFEP_MAPPING:
-       case SCIFEP_CONNECTED:
-       case SCIFEP_CLOSING:
-       {
-               spin_unlock(&ep->lock);
-               scif_unregister_all_windows(epd);
-               scif_disconnect_ep(ep);
-               break;
-       }
-       case SCIFEP_LISTENING:
-       case SCIFEP_CLLISTEN:
-       {
-               struct scif_conreq *conreq;
-               struct scifmsg msg;
-               struct scif_endpt *aep;
-
-               spin_unlock(&ep->lock);
-               mutex_lock(&scif_info.eplock);
-
-               /* remove from listen list */
-               list_for_each_safe(pos, tmpq, &scif_info.listen) {
-                       tmpep = list_entry(pos, struct scif_endpt, list);
-                       if (tmpep == ep)
-                               list_del(pos);
-               }
-               /* Remove any dangling accepts */
-               while (ep->acceptcnt) {
-                       aep = list_first_entry(&ep->li_accept,
-                                              struct scif_endpt, liacceptlist);
-                       list_del(&aep->liacceptlist);
-                       scif_put_port(aep->port.port);
-                       list_for_each_safe(pos, tmpq, &scif_info.uaccept) {
-                               tmpep = list_entry(pos, struct scif_endpt,
-                                                  miacceptlist);
-                               if (tmpep == aep) {
-                                       list_del(pos);
-                                       break;
-                               }
-                       }
-                       mutex_unlock(&scif_info.eplock);
-                       mutex_lock(&scif_info.connlock);
-                       list_for_each_safe(pos, tmpq, &scif_info.connected) {
-                               tmpep = list_entry(pos,
-                                                  struct scif_endpt, list);
-                               if (tmpep == aep) {
-                                       list_del(pos);
-                                       break;
-                               }
-                       }
-                       list_for_each_safe(pos, tmpq, &scif_info.disconnected) {
-                               tmpep = list_entry(pos,
-                                                  struct scif_endpt, list);
-                               if (tmpep == aep) {
-                                       list_del(pos);
-                                       break;
-                               }
-                       }
-                       mutex_unlock(&scif_info.connlock);
-                       scif_teardown_ep(aep);
-                       mutex_lock(&scif_info.eplock);
-                       scif_add_epd_to_zombie_list(aep, SCIF_EPLOCK_HELD);
-                       ep->acceptcnt--;
-               }
-
-               spin_lock(&ep->lock);
-               mutex_unlock(&scif_info.eplock);
-
-               /* Remove and reject any pending connection requests. */
-               while (ep->conreqcnt) {
-                       conreq = list_first_entry(&ep->conlist,
-                                                 struct scif_conreq, list);
-                       list_del(&conreq->list);
-
-                       msg.uop = SCIF_CNCT_REJ;
-                       msg.dst.node = conreq->msg.src.node;
-                       msg.dst.port = conreq->msg.src.port;
-                       msg.payload[0] = conreq->msg.payload[0];
-                       msg.payload[1] = conreq->msg.payload[1];
-                       /*
-                        * No Error Handling on purpose for scif_nodeqp_send().
-                        * If the remote node is lost we still want free the
-                        * connection requests on the self node.
-                        */
-                       scif_nodeqp_send(&scif_dev[conreq->msg.src.node],
-                                        &msg);
-                       ep->conreqcnt--;
-                       kfree(conreq);
-               }
-
-               spin_unlock(&ep->lock);
-               /* If a kSCIF accept is waiting wake it up */
-               wake_up_interruptible(&ep->conwq);
-               break;
-       }
-       }
-       scif_put_port(ep->port.port);
-       scif_anon_inode_fput(ep);
-       scif_teardown_ep(ep);
-       scif_add_epd_to_zombie_list(ep, !SCIF_EPLOCK_HELD);
-       return 0;
-}
-EXPORT_SYMBOL_GPL(scif_close);
-
-/**
- * scif_flush() - Wakes up any blocking accepts. The endpoint will no longer
- *                     accept new connections.
- * @epd: The end point returned from scif_open()
- */
-int __scif_flush(scif_epd_t epd)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-
-       switch (ep->state) {
-       case SCIFEP_LISTENING:
-       {
-               ep->state = SCIFEP_CLLISTEN;
-
-               /* If an accept is waiting wake it up */
-               wake_up_interruptible(&ep->conwq);
-               break;
-       }
-       default:
-               break;
-       }
-       return 0;
-}
-
-int scif_bind(scif_epd_t epd, u16 pn)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       int ret = 0;
-       int tmp;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI bind: ep %p %s requested port number %d\n",
-               ep, scif_ep_states[ep->state], pn);
-       if (pn) {
-               /*
-                * Similar to IETF RFC 1700, SCIF ports below
-                * SCIF_ADMIN_PORT_END can only be bound by system (or root)
-                * processes or by processes executed by privileged users.
-                */
-               if (pn < SCIF_ADMIN_PORT_END && !capable(CAP_SYS_ADMIN)) {
-                       ret = -EACCES;
-                       goto scif_bind_admin_exit;
-               }
-       }
-
-       spin_lock(&ep->lock);
-       if (ep->state == SCIFEP_BOUND) {
-               ret = -EINVAL;
-               goto scif_bind_exit;
-       } else if (ep->state != SCIFEP_UNBOUND) {
-               ret = -EISCONN;
-               goto scif_bind_exit;
-       }
-
-       if (pn) {
-               tmp = scif_rsrv_port(pn);
-               if (tmp != pn) {
-                       ret = -EINVAL;
-                       goto scif_bind_exit;
-               }
-       } else {
-               ret = scif_get_new_port();
-               if (ret < 0)
-                       goto scif_bind_exit;
-               pn = ret;
-       }
-
-       ep->state = SCIFEP_BOUND;
-       ep->port.node = scif_info.nodeid;
-       ep->port.port = pn;
-       ep->conn_async_state = ASYNC_CONN_IDLE;
-       ret = pn;
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI bind: bound to port number %d\n", pn);
-scif_bind_exit:
-       spin_unlock(&ep->lock);
-scif_bind_admin_exit:
-       return ret;
-}
-EXPORT_SYMBOL_GPL(scif_bind);
-
-int scif_listen(scif_epd_t epd, int backlog)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI listen: ep %p %s\n", ep, scif_ep_states[ep->state]);
-       spin_lock(&ep->lock);
-       switch (ep->state) {
-       case SCIFEP_ZOMBIE:
-       case SCIFEP_CLOSING:
-       case SCIFEP_CLLISTEN:
-       case SCIFEP_UNBOUND:
-       case SCIFEP_DISCONNECTED:
-               spin_unlock(&ep->lock);
-               return -EINVAL;
-       case SCIFEP_LISTENING:
-       case SCIFEP_CONNECTED:
-       case SCIFEP_CONNECTING:
-       case SCIFEP_MAPPING:
-               spin_unlock(&ep->lock);
-               return -EISCONN;
-       case SCIFEP_BOUND:
-               break;
-       }
-
-       ep->state = SCIFEP_LISTENING;
-       ep->backlog = backlog;
-
-       ep->conreqcnt = 0;
-       ep->acceptcnt = 0;
-       INIT_LIST_HEAD(&ep->conlist);
-       init_waitqueue_head(&ep->conwq);
-       INIT_LIST_HEAD(&ep->li_accept);
-       spin_unlock(&ep->lock);
-
-       /*
-        * Listen status is complete so delete the qp information not needed
-        * on a listen before placing on the list of listening ep's
-        */
-       scif_teardown_ep(ep);
-       ep->qp_info.qp = NULL;
-
-       mutex_lock(&scif_info.eplock);
-       list_add_tail(&ep->list, &scif_info.listen);
-       mutex_unlock(&scif_info.eplock);
-       return 0;
-}
-EXPORT_SYMBOL_GPL(scif_listen);
-
-/*
- ************************************************************************
- * SCIF connection flow:
- *
- * 1) A SCIF listening endpoint can call scif_accept(..) to wait for SCIF
- *     connections via a SCIF_CNCT_REQ message
- * 2) A SCIF endpoint can initiate a SCIF connection by calling
- *     scif_connect(..) which calls scif_setup_qp_connect(..) which
- *     allocates the local qp for the endpoint ring buffer and then sends
- *     a SCIF_CNCT_REQ to the remote node and waits for a SCIF_CNCT_GNT or
- *     a SCIF_CNCT_REJ message
- * 3) The peer node handles a SCIF_CNCT_REQ via scif_cnctreq_resp(..) which
- *     wakes up any threads blocked in step 1 or sends a SCIF_CNCT_REJ
- *     message otherwise
- * 4) A thread blocked waiting for incoming connections allocates its local
- *     endpoint QP and ring buffer following which it sends a SCIF_CNCT_GNT
- *     and waits for a SCIF_CNCT_GNT(N)ACK. If the allocation fails then
- *     the node sends a SCIF_CNCT_REJ message
- * 5) Upon receipt of a SCIF_CNCT_GNT or a SCIF_CNCT_REJ message the
- *     connecting endpoint is woken up as part of handling
- *     scif_cnctgnt_resp(..) following which it maps the remote endpoints'
- *     QP, updates its outbound QP and sends a SCIF_CNCT_GNTACK message on
- *     success or a SCIF_CNCT_GNTNACK message on failure and completes
- *     the scif_connect(..) API
- * 6) Upon receipt of a SCIF_CNCT_GNT(N)ACK the accepting endpoint blocked
- *     in step 4 is woken up and completes the scif_accept(..) API
- * 7) The SCIF connection is now established between the two SCIF endpoints.
- */
-static int scif_conn_func(struct scif_endpt *ep)
-{
-       int err = 0;
-       struct scifmsg msg;
-       struct device *spdev;
-
-       err = scif_reserve_dma_chan(ep);
-       if (err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-               ep->state = SCIFEP_BOUND;
-               goto connect_error_simple;
-       }
-       /* Initiate the first part of the endpoint QP setup */
-       err = scif_setup_qp_connect(ep->qp_info.qp, &ep->qp_info.qp_offset,
-                                   SCIF_ENDPT_QP_SIZE, ep->remote_dev);
-       if (err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s err %d qp_offset 0x%llx\n",
-                       __func__, err, ep->qp_info.qp_offset);
-               ep->state = SCIFEP_BOUND;
-               goto connect_error_simple;
-       }
-
-       spdev = scif_get_peer_dev(ep->remote_dev);
-       if (IS_ERR(spdev)) {
-               err = PTR_ERR(spdev);
-               goto cleanup_qp;
-       }
-       /* Format connect message and send it */
-       msg.src = ep->port;
-       msg.dst = ep->conn_port;
-       msg.uop = SCIF_CNCT_REQ;
-       msg.payload[0] = (u64)ep;
-       msg.payload[1] = ep->qp_info.qp_offset;
-       err = _scif_nodeqp_send(ep->remote_dev, &msg);
-       if (err)
-               goto connect_error_dec;
-       scif_put_peer_dev(spdev);
-       /*
-        * Wait for the remote node to respond with SCIF_CNCT_GNT or
-        * SCIF_CNCT_REJ message.
-        */
-       err = wait_event_timeout(ep->conwq, ep->state != SCIFEP_CONNECTING,
-                                SCIF_NODE_ALIVE_TIMEOUT);
-       if (!err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d timeout\n", __func__, __LINE__);
-               ep->state = SCIFEP_BOUND;
-       }
-       spdev = scif_get_peer_dev(ep->remote_dev);
-       if (IS_ERR(spdev)) {
-               err = PTR_ERR(spdev);
-               goto cleanup_qp;
-       }
-       if (ep->state == SCIFEP_MAPPING) {
-               err = scif_setup_qp_connect_response(ep->remote_dev,
-                                                    ep->qp_info.qp,
-                                                    ep->qp_info.gnt_pld);
-               /*
-                * If the resource to map the queue are not available then
-                * we need to tell the other side to terminate the accept
-                */
-               if (err) {
-                       dev_err(&ep->remote_dev->sdev->dev,
-                               "%s %d err %d\n", __func__, __LINE__, err);
-                       msg.uop = SCIF_CNCT_GNTNACK;
-                       msg.payload[0] = ep->remote_ep;
-                       _scif_nodeqp_send(ep->remote_dev, &msg);
-                       ep->state = SCIFEP_BOUND;
-                       goto connect_error_dec;
-               }
-
-               msg.uop = SCIF_CNCT_GNTACK;
-               msg.payload[0] = ep->remote_ep;
-               err = _scif_nodeqp_send(ep->remote_dev, &msg);
-               if (err) {
-                       ep->state = SCIFEP_BOUND;
-                       goto connect_error_dec;
-               }
-               ep->state = SCIFEP_CONNECTED;
-               mutex_lock(&scif_info.connlock);
-               list_add_tail(&ep->list, &scif_info.connected);
-               mutex_unlock(&scif_info.connlock);
-               dev_dbg(&ep->remote_dev->sdev->dev,
-                       "SCIFAPI connect: ep %p connected\n", ep);
-       } else if (ep->state == SCIFEP_BOUND) {
-               dev_dbg(&ep->remote_dev->sdev->dev,
-                       "SCIFAPI connect: ep %p connection refused\n", ep);
-               err = -ECONNREFUSED;
-               goto connect_error_dec;
-       }
-       scif_put_peer_dev(spdev);
-       return err;
-connect_error_dec:
-       scif_put_peer_dev(spdev);
-cleanup_qp:
-       scif_cleanup_ep_qp(ep);
-connect_error_simple:
-       return err;
-}
-
-/*
- * scif_conn_handler:
- *
- * Workqueue handler for servicing non-blocking SCIF connect
- *
- */
-void scif_conn_handler(struct work_struct *work)
-{
-       struct scif_endpt *ep;
-
-       do {
-               ep = NULL;
-               spin_lock(&scif_info.nb_connect_lock);
-               if (!list_empty(&scif_info.nb_connect_list)) {
-                       ep = list_first_entry(&scif_info.nb_connect_list,
-                                             struct scif_endpt, conn_list);
-                       list_del(&ep->conn_list);
-               }
-               spin_unlock(&scif_info.nb_connect_lock);
-               if (ep) {
-                       ep->conn_err = scif_conn_func(ep);
-                       wake_up_interruptible(&ep->conn_pend_wq);
-               }
-       } while (ep);
-}
-
-int __scif_connect(scif_epd_t epd, struct scif_port_id *dst, bool non_block)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       int err = 0;
-       struct scif_dev *remote_dev;
-       struct device *spdev;
-
-       dev_dbg(scif_info.mdev.this_device, "SCIFAPI connect: ep %p %s\n", ep,
-               scif_ep_states[ep->state]);
-
-       if (!scif_dev || dst->node > scif_info.maxid)
-               return -ENODEV;
-
-       might_sleep();
-
-       remote_dev = &scif_dev[dst->node];
-       spdev = scif_get_peer_dev(remote_dev);
-       if (IS_ERR(spdev)) {
-               err = PTR_ERR(spdev);
-               return err;
-       }
-
-       spin_lock(&ep->lock);
-       switch (ep->state) {
-       case SCIFEP_ZOMBIE:
-       case SCIFEP_CLOSING:
-               err = -EINVAL;
-               break;
-       case SCIFEP_DISCONNECTED:
-               if (ep->conn_async_state == ASYNC_CONN_INPROGRESS)
-                       ep->conn_async_state = ASYNC_CONN_FLUSH_WORK;
-               else
-                       err = -EINVAL;
-               break;
-       case SCIFEP_LISTENING:
-       case SCIFEP_CLLISTEN:
-               err = -EOPNOTSUPP;
-               break;
-       case SCIFEP_CONNECTING:
-       case SCIFEP_MAPPING:
-               if (ep->conn_async_state == ASYNC_CONN_INPROGRESS)
-                       err = -EINPROGRESS;
-               else
-                       err = -EISCONN;
-               break;
-       case SCIFEP_CONNECTED:
-               if (ep->conn_async_state == ASYNC_CONN_INPROGRESS)
-                       ep->conn_async_state = ASYNC_CONN_FLUSH_WORK;
-               else
-                       err = -EISCONN;
-               break;
-       case SCIFEP_UNBOUND:
-               err = scif_get_new_port();
-               if (err < 0)
-                       break;
-               ep->port.port = err;
-               ep->port.node = scif_info.nodeid;
-               ep->conn_async_state = ASYNC_CONN_IDLE;
-               fallthrough;
-       case SCIFEP_BOUND:
-               /*
-                * If a non-blocking connect has been already initiated
-                * (conn_async_state is either ASYNC_CONN_INPROGRESS or
-                * ASYNC_CONN_FLUSH_WORK), the end point could end up in
-                * SCIF_BOUND due an error in the connection process
-                * (e.g., connection refused) If conn_async_state is
-                * ASYNC_CONN_INPROGRESS - transition to ASYNC_CONN_FLUSH_WORK
-                * so that the error status can be collected. If the state is
-                * already ASYNC_CONN_FLUSH_WORK - then set the error to
-                * EINPROGRESS since some other thread is waiting to collect
-                * error status.
-                */
-               if (ep->conn_async_state == ASYNC_CONN_INPROGRESS) {
-                       ep->conn_async_state = ASYNC_CONN_FLUSH_WORK;
-               } else if (ep->conn_async_state == ASYNC_CONN_FLUSH_WORK) {
-                       err = -EINPROGRESS;
-               } else {
-                       ep->conn_port = *dst;
-                       init_waitqueue_head(&ep->sendwq);
-                       init_waitqueue_head(&ep->recvwq);
-                       init_waitqueue_head(&ep->conwq);
-                       ep->conn_async_state = 0;
-
-                       if (unlikely(non_block))
-                               ep->conn_async_state = ASYNC_CONN_INPROGRESS;
-               }
-               break;
-       }
-
-       if (err || ep->conn_async_state == ASYNC_CONN_FLUSH_WORK)
-                       goto connect_simple_unlock1;
-
-       ep->state = SCIFEP_CONNECTING;
-       ep->remote_dev = &scif_dev[dst->node];
-       ep->qp_info.qp->magic = SCIFEP_MAGIC;
-       if (ep->conn_async_state == ASYNC_CONN_INPROGRESS) {
-               init_waitqueue_head(&ep->conn_pend_wq);
-               spin_lock(&scif_info.nb_connect_lock);
-               list_add_tail(&ep->conn_list, &scif_info.nb_connect_list);
-               spin_unlock(&scif_info.nb_connect_lock);
-               err = -EINPROGRESS;
-               schedule_work(&scif_info.conn_work);
-       }
-connect_simple_unlock1:
-       spin_unlock(&ep->lock);
-       scif_put_peer_dev(spdev);
-       if (err) {
-               return err;
-       } else if (ep->conn_async_state == ASYNC_CONN_FLUSH_WORK) {
-               flush_work(&scif_info.conn_work);
-               err = ep->conn_err;
-               spin_lock(&ep->lock);
-               ep->conn_async_state = ASYNC_CONN_IDLE;
-               spin_unlock(&ep->lock);
-       } else {
-               err = scif_conn_func(ep);
-       }
-       return err;
-}
-
-int scif_connect(scif_epd_t epd, struct scif_port_id *dst)
-{
-       return __scif_connect(epd, dst, false);
-}
-EXPORT_SYMBOL_GPL(scif_connect);
-
-/*
- * scif_accept() - Accept a connection request from the remote node
- *
- * The function accepts a connection request from the remote node.  Successful
- * complete is indicate by a new end point being created and passed back
- * to the caller for future reference.
- *
- * Upon successful complete a zero will be returned and the peer information
- * will be filled in.
- *
- * If the end point is not in the listening state -EINVAL will be returned.
- *
- * If during the connection sequence resource allocation fails the -ENOMEM
- * will be returned.
- *
- * If the function is called with the ASYNC flag set and no connection requests
- * are pending it will return -EAGAIN.
- *
- * If the remote side is not sending any connection requests the caller may
- * terminate this function with a signal.  If so a -EINTR will be returned.
- */
-int scif_accept(scif_epd_t epd, struct scif_port_id *peer,
-               scif_epd_t *newepd, int flags)
-{
-       struct scif_endpt *lep = (struct scif_endpt *)epd;
-       struct scif_endpt *cep;
-       struct scif_conreq *conreq;
-       struct scifmsg msg;
-       int err;
-       struct device *spdev;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI accept: ep %p %s\n", lep, scif_ep_states[lep->state]);
-
-       if (flags & ~SCIF_ACCEPT_SYNC)
-               return -EINVAL;
-
-       if (!peer || !newepd)
-               return -EINVAL;
-
-       might_sleep();
-       spin_lock(&lep->lock);
-       if (lep->state != SCIFEP_LISTENING) {
-               spin_unlock(&lep->lock);
-               return -EINVAL;
-       }
-
-       if (!lep->conreqcnt && !(flags & SCIF_ACCEPT_SYNC)) {
-               /* No connection request present and we do not want to wait */
-               spin_unlock(&lep->lock);
-               return -EAGAIN;
-       }
-
-       lep->files = current->files;
-retry_connection:
-       spin_unlock(&lep->lock);
-       /* Wait for the remote node to send us a SCIF_CNCT_REQ */
-       err = wait_event_interruptible(lep->conwq,
-                                      (lep->conreqcnt ||
-                                      (lep->state != SCIFEP_LISTENING)));
-       if (err)
-               return err;
-
-       if (lep->state != SCIFEP_LISTENING)
-               return -EINTR;
-
-       spin_lock(&lep->lock);
-
-       if (!lep->conreqcnt)
-               goto retry_connection;
-
-       /* Get the first connect request off the list */
-       conreq = list_first_entry(&lep->conlist, struct scif_conreq, list);
-       list_del(&conreq->list);
-       lep->conreqcnt--;
-       spin_unlock(&lep->lock);
-
-       /* Fill in the peer information */
-       peer->node = conreq->msg.src.node;
-       peer->port = conreq->msg.src.port;
-
-       cep = kzalloc(sizeof(*cep), GFP_KERNEL);
-       if (!cep) {
-               err = -ENOMEM;
-               goto scif_accept_error_epalloc;
-       }
-       spin_lock_init(&cep->lock);
-       mutex_init(&cep->sendlock);
-       mutex_init(&cep->recvlock);
-       cep->state = SCIFEP_CONNECTING;
-       cep->remote_dev = &scif_dev[peer->node];
-       cep->remote_ep = conreq->msg.payload[0];
-
-       scif_rma_ep_init(cep);
-
-       err = scif_reserve_dma_chan(cep);
-       if (err) {
-               dev_err(scif_info.mdev.this_device,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-               goto scif_accept_error_qpalloc;
-       }
-
-       cep->qp_info.qp = kzalloc(sizeof(*cep->qp_info.qp), GFP_KERNEL);
-       if (!cep->qp_info.qp) {
-               err = -ENOMEM;
-               goto scif_accept_error_qpalloc;
-       }
-
-       err = scif_anon_inode_getfile(cep);
-       if (err)
-               goto scif_accept_error_anon_inode;
-
-       cep->qp_info.qp->magic = SCIFEP_MAGIC;
-       spdev = scif_get_peer_dev(cep->remote_dev);
-       if (IS_ERR(spdev)) {
-               err = PTR_ERR(spdev);
-               goto scif_accept_error_map;
-       }
-       err = scif_setup_qp_accept(cep->qp_info.qp, &cep->qp_info.qp_offset,
-                                  conreq->msg.payload[1], SCIF_ENDPT_QP_SIZE,
-                                  cep->remote_dev);
-       if (err) {
-               dev_dbg(&cep->remote_dev->sdev->dev,
-                       "SCIFAPI accept: ep %p new %p scif_setup_qp_accept %d qp_offset 0x%llx\n",
-                       lep, cep, err, cep->qp_info.qp_offset);
-               scif_put_peer_dev(spdev);
-               goto scif_accept_error_map;
-       }
-
-       cep->port.node = lep->port.node;
-       cep->port.port = lep->port.port;
-       cep->peer.node = peer->node;
-       cep->peer.port = peer->port;
-       init_waitqueue_head(&cep->sendwq);
-       init_waitqueue_head(&cep->recvwq);
-       init_waitqueue_head(&cep->conwq);
-
-       msg.uop = SCIF_CNCT_GNT;
-       msg.src = cep->port;
-       msg.payload[0] = cep->remote_ep;
-       msg.payload[1] = cep->qp_info.qp_offset;
-       msg.payload[2] = (u64)cep;
-
-       err = _scif_nodeqp_send(cep->remote_dev, &msg);
-       scif_put_peer_dev(spdev);
-       if (err)
-               goto scif_accept_error_map;
-retry:
-       /* Wait for the remote node to respond with SCIF_CNCT_GNT(N)ACK */
-       err = wait_event_timeout(cep->conwq, cep->state != SCIFEP_CONNECTING,
-                                SCIF_NODE_ACCEPT_TIMEOUT);
-       if (!err && scifdev_alive(cep))
-               goto retry;
-       err = !err ? -ENODEV : 0;
-       if (err)
-               goto scif_accept_error_map;
-       kfree(conreq);
-
-       spin_lock(&cep->lock);
-
-       if (cep->state == SCIFEP_CLOSING) {
-               /*
-                * Remote failed to allocate resources and NAKed the grant.
-                * There is at this point nothing referencing the new end point.
-                */
-               spin_unlock(&cep->lock);
-               scif_teardown_ep(cep);
-               kfree(cep);
-
-               /* If call with sync flag then go back and wait. */
-               if (flags & SCIF_ACCEPT_SYNC) {
-                       spin_lock(&lep->lock);
-                       goto retry_connection;
-               }
-               return -EAGAIN;
-       }
-
-       scif_get_port(cep->port.port);
-       *newepd = (scif_epd_t)cep;
-       spin_unlock(&cep->lock);
-       return 0;
-scif_accept_error_map:
-       scif_anon_inode_fput(cep);
-scif_accept_error_anon_inode:
-       scif_teardown_ep(cep);
-scif_accept_error_qpalloc:
-       kfree(cep);
-scif_accept_error_epalloc:
-       msg.uop = SCIF_CNCT_REJ;
-       msg.dst.node = conreq->msg.src.node;
-       msg.dst.port = conreq->msg.src.port;
-       msg.payload[0] = conreq->msg.payload[0];
-       msg.payload[1] = conreq->msg.payload[1];
-       scif_nodeqp_send(&scif_dev[conreq->msg.src.node], &msg);
-       kfree(conreq);
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_accept);
-
-/*
- * scif_msg_param_check:
- * @epd: The end point returned from scif_open()
- * @len: Length to receive
- * @flags: blocking or non blocking
- *
- * Validate parameters for messaging APIs scif_send(..)/scif_recv(..).
- */
-static inline int scif_msg_param_check(scif_epd_t epd, int len, int flags)
-{
-       int ret = -EINVAL;
-
-       if (len < 0)
-               goto err_ret;
-       if (flags && (!(flags & SCIF_RECV_BLOCK)))
-               goto err_ret;
-       ret = 0;
-err_ret:
-       return ret;
-}
-
-static int _scif_send(scif_epd_t epd, void *msg, int len, int flags)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       struct scifmsg notif_msg;
-       int curr_xfer_len = 0, sent_len = 0, write_count;
-       int ret = 0;
-       struct scif_qp *qp = ep->qp_info.qp;
-
-       if (flags & SCIF_SEND_BLOCK)
-               might_sleep();
-
-       spin_lock(&ep->lock);
-       while (sent_len != len && SCIFEP_CONNECTED == ep->state) {
-               write_count = scif_rb_space(&qp->outbound_q);
-               if (write_count) {
-                       /* Best effort to send as much data as possible */
-                       curr_xfer_len = min(len - sent_len, write_count);
-                       ret = scif_rb_write(&qp->outbound_q, msg,
-                                           curr_xfer_len);
-                       if (ret < 0)
-                               break;
-                       /* Success. Update write pointer */
-                       scif_rb_commit(&qp->outbound_q);
-                       /*
-                        * Send a notification to the peer about the
-                        * produced data message.
-                        */
-                       notif_msg.src = ep->port;
-                       notif_msg.uop = SCIF_CLIENT_SENT;
-                       notif_msg.payload[0] = ep->remote_ep;
-                       ret = _scif_nodeqp_send(ep->remote_dev, &notif_msg);
-                       if (ret)
-                               break;
-                       sent_len += curr_xfer_len;
-                       msg = msg + curr_xfer_len;
-                       continue;
-               }
-               curr_xfer_len = min(len - sent_len, SCIF_ENDPT_QP_SIZE - 1);
-               /* Not enough RB space. return for the Non Blocking case */
-               if (!(flags & SCIF_SEND_BLOCK))
-                       break;
-
-               spin_unlock(&ep->lock);
-               /* Wait for a SCIF_CLIENT_RCVD message in the Blocking case */
-               ret =
-               wait_event_interruptible(ep->sendwq,
-                                        (SCIFEP_CONNECTED != ep->state) ||
-                                        (scif_rb_space(&qp->outbound_q) >=
-                                        curr_xfer_len));
-               spin_lock(&ep->lock);
-               if (ret)
-                       break;
-       }
-       if (sent_len)
-               ret = sent_len;
-       else if (!ret && SCIFEP_CONNECTED != ep->state)
-               ret = SCIFEP_DISCONNECTED == ep->state ?
-                       -ECONNRESET : -ENOTCONN;
-       spin_unlock(&ep->lock);
-       return ret;
-}
-
-static int _scif_recv(scif_epd_t epd, void *msg, int len, int flags)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       struct scifmsg notif_msg;
-       int curr_recv_len = 0, remaining_len = len, read_count;
-       int ret = 0;
-       struct scif_qp *qp = ep->qp_info.qp;
-
-       if (flags & SCIF_RECV_BLOCK)
-               might_sleep();
-       spin_lock(&ep->lock);
-       while (remaining_len && (SCIFEP_CONNECTED == ep->state ||
-                                SCIFEP_DISCONNECTED == ep->state)) {
-               read_count = scif_rb_count(&qp->inbound_q, remaining_len);
-               if (read_count) {
-                       /*
-                        * Best effort to recv as much data as there
-                        * are bytes to read in the RB particularly
-                        * important for the Non Blocking case.
-                        */
-                       curr_recv_len = min(remaining_len, read_count);
-                       scif_rb_get_next(&qp->inbound_q, msg, curr_recv_len);
-                       if (ep->state == SCIFEP_CONNECTED) {
-                               /*
-                                * Update the read pointer only if the endpoint
-                                * is still connected else the read pointer
-                                * might no longer exist since the peer has
-                                * freed resources!
-                                */
-                               scif_rb_update_read_ptr(&qp->inbound_q);
-                               /*
-                                * Send a notification to the peer about the
-                                * consumed data message only if the EP is in
-                                * SCIFEP_CONNECTED state.
-                                */
-                               notif_msg.src = ep->port;
-                               notif_msg.uop = SCIF_CLIENT_RCVD;
-                               notif_msg.payload[0] = ep->remote_ep;
-                               ret = _scif_nodeqp_send(ep->remote_dev,
-                                                       &notif_msg);
-                               if (ret)
-                                       break;
-                       }
-                       remaining_len -= curr_recv_len;
-                       msg = msg + curr_recv_len;
-                       continue;
-               }
-               /*
-                * Bail out now if the EP is in SCIFEP_DISCONNECTED state else
-                * we will keep looping forever.
-                */
-               if (ep->state == SCIFEP_DISCONNECTED)
-                       break;
-               /*
-                * Return in the Non Blocking case if there is no data
-                * to read in this iteration.
-                */
-               if (!(flags & SCIF_RECV_BLOCK))
-                       break;
-               curr_recv_len = min(remaining_len, SCIF_ENDPT_QP_SIZE - 1);
-               spin_unlock(&ep->lock);
-               /*
-                * Wait for a SCIF_CLIENT_SEND message in the blocking case
-                * or until other side disconnects.
-                */
-               ret =
-               wait_event_interruptible(ep->recvwq,
-                                        SCIFEP_CONNECTED != ep->state ||
-                                        scif_rb_count(&qp->inbound_q,
-                                                      curr_recv_len)
-                                        >= curr_recv_len);
-               spin_lock(&ep->lock);
-               if (ret)
-                       break;
-       }
-       if (len - remaining_len)
-               ret = len - remaining_len;
-       else if (!ret && ep->state != SCIFEP_CONNECTED)
-               ret = ep->state == SCIFEP_DISCONNECTED ?
-                       -ECONNRESET : -ENOTCONN;
-       spin_unlock(&ep->lock);
-       return ret;
-}
-
-/**
- * scif_user_send() - Send data to connection queue
- * @epd: The end point returned from scif_open()
- * @msg: Address to place data
- * @len: Length to receive
- * @flags: blocking or non blocking
- *
- * This function is called from the driver IOCTL entry point
- * only and is a wrapper for _scif_send().
- */
-int scif_user_send(scif_epd_t epd, void __user *msg, int len, int flags)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       int err = 0;
-       int sent_len = 0;
-       char *tmp;
-       int loop_len;
-       int chunk_len = min(len, (1 << (MAX_ORDER + PAGE_SHIFT - 1)));
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI send (U): ep %p %s\n", ep, scif_ep_states[ep->state]);
-       if (!len)
-               return 0;
-
-       err = scif_msg_param_check(epd, len, flags);
-       if (err)
-               goto send_err;
-
-       tmp = kmalloc(chunk_len, GFP_KERNEL);
-       if (!tmp) {
-               err = -ENOMEM;
-               goto send_err;
-       }
-       /*
-        * Grabbing the lock before breaking up the transfer in
-        * multiple chunks is required to ensure that messages do
-        * not get fragmented and reordered.
-        */
-       mutex_lock(&ep->sendlock);
-       while (sent_len != len) {
-               loop_len = len - sent_len;
-               loop_len = min(chunk_len, loop_len);
-               if (copy_from_user(tmp, msg, loop_len)) {
-                       err = -EFAULT;
-                       goto send_free_err;
-               }
-               err = _scif_send(epd, tmp, loop_len, flags);
-               if (err < 0)
-                       goto send_free_err;
-               sent_len += err;
-               msg += err;
-               if (err != loop_len)
-                       goto send_free_err;
-       }
-send_free_err:
-       mutex_unlock(&ep->sendlock);
-       kfree(tmp);
-send_err:
-       return err < 0 ? err : sent_len;
-}
-
-/**
- * scif_user_recv() - Receive data from connection queue
- * @epd: The end point returned from scif_open()
- * @msg: Address to place data
- * @len: Length to receive
- * @flags: blocking or non blocking
- *
- * This function is called from the driver IOCTL entry point
- * only and is a wrapper for _scif_recv().
- */
-int scif_user_recv(scif_epd_t epd, void __user *msg, int len, int flags)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       int err = 0;
-       int recv_len = 0;
-       char *tmp;
-       int loop_len;
-       int chunk_len = min(len, (1 << (MAX_ORDER + PAGE_SHIFT - 1)));
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI recv (U): ep %p %s\n", ep, scif_ep_states[ep->state]);
-       if (!len)
-               return 0;
-
-       err = scif_msg_param_check(epd, len, flags);
-       if (err)
-               goto recv_err;
-
-       tmp = kmalloc(chunk_len, GFP_KERNEL);
-       if (!tmp) {
-               err = -ENOMEM;
-               goto recv_err;
-       }
-       /*
-        * Grabbing the lock before breaking up the transfer in
-        * multiple chunks is required to ensure that messages do
-        * not get fragmented and reordered.
-        */
-       mutex_lock(&ep->recvlock);
-       while (recv_len != len) {
-               loop_len = len - recv_len;
-               loop_len = min(chunk_len, loop_len);
-               err = _scif_recv(epd, tmp, loop_len, flags);
-               if (err < 0)
-                       goto recv_free_err;
-               if (copy_to_user(msg, tmp, err)) {
-                       err = -EFAULT;
-                       goto recv_free_err;
-               }
-               recv_len += err;
-               msg += err;
-               if (err != loop_len)
-                       goto recv_free_err;
-       }
-recv_free_err:
-       mutex_unlock(&ep->recvlock);
-       kfree(tmp);
-recv_err:
-       return err < 0 ? err : recv_len;
-}
-
-/**
- * scif_send() - Send data to connection queue
- * @epd: The end point returned from scif_open()
- * @msg: Address to place data
- * @len: Length to receive
- * @flags: blocking or non blocking
- *
- * This function is called from the kernel mode only and is
- * a wrapper for _scif_send().
- */
-int scif_send(scif_epd_t epd, void *msg, int len, int flags)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       int ret;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI send (K): ep %p %s\n", ep, scif_ep_states[ep->state]);
-       if (!len)
-               return 0;
-
-       ret = scif_msg_param_check(epd, len, flags);
-       if (ret)
-               return ret;
-       if (!ep->remote_dev)
-               return -ENOTCONN;
-       /*
-        * Grab the mutex lock in the blocking case only
-        * to ensure messages do not get fragmented/reordered.
-        * The non blocking mode is protected using spin locks
-        * in _scif_send().
-        */
-       if (flags & SCIF_SEND_BLOCK)
-               mutex_lock(&ep->sendlock);
-
-       ret = _scif_send(epd, msg, len, flags);
-
-       if (flags & SCIF_SEND_BLOCK)
-               mutex_unlock(&ep->sendlock);
-       return ret;
-}
-EXPORT_SYMBOL_GPL(scif_send);
-
-/**
- * scif_recv() - Receive data from connection queue
- * @epd: The end point returned from scif_open()
- * @msg: Address to place data
- * @len: Length to receive
- * @flags: blocking or non blocking
- *
- * This function is called from the kernel mode only and is
- * a wrapper for _scif_recv().
- */
-int scif_recv(scif_epd_t epd, void *msg, int len, int flags)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       int ret;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI recv (K): ep %p %s\n", ep, scif_ep_states[ep->state]);
-       if (!len)
-               return 0;
-
-       ret = scif_msg_param_check(epd, len, flags);
-       if (ret)
-               return ret;
-       /*
-        * Grab the mutex lock in the blocking case only
-        * to ensure messages do not get fragmented/reordered.
-        * The non blocking mode is protected using spin locks
-        * in _scif_send().
-        */
-       if (flags & SCIF_RECV_BLOCK)
-               mutex_lock(&ep->recvlock);
-
-       ret = _scif_recv(epd, msg, len, flags);
-
-       if (flags & SCIF_RECV_BLOCK)
-               mutex_unlock(&ep->recvlock);
-
-       return ret;
-}
-EXPORT_SYMBOL_GPL(scif_recv);
-
-static inline void _scif_poll_wait(struct file *f, wait_queue_head_t *wq,
-                                  poll_table *p, struct scif_endpt *ep)
-{
-       /*
-        * Because poll_wait makes a GFP_KERNEL allocation, give up the lock
-        * and regrab it afterwards. Because the endpoint state might have
-        * changed while the lock was given up, the state must be checked
-        * again after re-acquiring the lock. The code in __scif_pollfd(..)
-        * does this.
-        */
-       spin_unlock(&ep->lock);
-       poll_wait(f, wq, p);
-       spin_lock(&ep->lock);
-}
-
-__poll_t
-__scif_pollfd(struct file *f, poll_table *wait, struct scif_endpt *ep)
-{
-       __poll_t mask = 0;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI pollfd: ep %p %s\n", ep, scif_ep_states[ep->state]);
-
-       spin_lock(&ep->lock);
-
-       /* Endpoint is waiting for a non-blocking connect to complete */
-       if (ep->conn_async_state == ASYNC_CONN_INPROGRESS) {
-               _scif_poll_wait(f, &ep->conn_pend_wq, wait, ep);
-               if (ep->conn_async_state == ASYNC_CONN_INPROGRESS) {
-                       if (ep->state == SCIFEP_CONNECTED ||
-                           ep->state == SCIFEP_DISCONNECTED ||
-                           ep->conn_err)
-                               mask |= EPOLLOUT;
-                       goto exit;
-               }
-       }
-
-       /* Endpoint is listening for incoming connection requests */
-       if (ep->state == SCIFEP_LISTENING) {
-               _scif_poll_wait(f, &ep->conwq, wait, ep);
-               if (ep->state == SCIFEP_LISTENING) {
-                       if (ep->conreqcnt)
-                               mask |= EPOLLIN;
-                       goto exit;
-               }
-       }
-
-       /* Endpoint is connected or disconnected */
-       if (ep->state == SCIFEP_CONNECTED || ep->state == SCIFEP_DISCONNECTED) {
-               if (poll_requested_events(wait) & EPOLLIN)
-                       _scif_poll_wait(f, &ep->recvwq, wait, ep);
-               if (poll_requested_events(wait) & EPOLLOUT)
-                       _scif_poll_wait(f, &ep->sendwq, wait, ep);
-               if (ep->state == SCIFEP_CONNECTED ||
-                   ep->state == SCIFEP_DISCONNECTED) {
-                       /* Data can be read without blocking */
-                       if (scif_rb_count(&ep->qp_info.qp->inbound_q, 1))
-                               mask |= EPOLLIN;
-                       /* Data can be written without blocking */
-                       if (scif_rb_space(&ep->qp_info.qp->outbound_q))
-                               mask |= EPOLLOUT;
-                       /* Return EPOLLHUP if endpoint is disconnected */
-                       if (ep->state == SCIFEP_DISCONNECTED)
-                               mask |= EPOLLHUP;
-                       goto exit;
-               }
-       }
-
-       /* Return EPOLLERR if the endpoint is in none of the above states */
-       mask |= EPOLLERR;
-exit:
-       spin_unlock(&ep->lock);
-       return mask;
-}
-
-/**
- * scif_poll() - Kernel mode SCIF poll
- * @ufds: Array of scif_pollepd structures containing the end points
- *       and events to poll on
- * @nfds: Size of the ufds array
- * @timeout_msecs: Timeout in msecs, -ve implies infinite timeout
- *
- * The code flow in this function is based on do_poll(..) in select.c
- *
- * Returns the number of endpoints which have pending events or 0 in
- * the event of a timeout. If a signal is used for wake up, -EINTR is
- * returned.
- */
-int
-scif_poll(struct scif_pollepd *ufds, unsigned int nfds, long timeout_msecs)
-{
-       struct poll_wqueues table;
-       poll_table *pt;
-       int i, count = 0, timed_out = timeout_msecs == 0;
-       __poll_t mask;
-       u64 timeout = timeout_msecs < 0 ? MAX_SCHEDULE_TIMEOUT
-               : msecs_to_jiffies(timeout_msecs);
-
-       poll_initwait(&table);
-       pt = &table.pt;
-       while (1) {
-               for (i = 0; i < nfds; i++) {
-                       pt->_key = ufds[i].events | EPOLLERR | EPOLLHUP;
-                       mask = __scif_pollfd(ufds[i].epd->anon,
-                                            pt, ufds[i].epd);
-                       mask &= ufds[i].events | EPOLLERR | EPOLLHUP;
-                       if (mask) {
-                               count++;
-                               pt->_qproc = NULL;
-                       }
-                       ufds[i].revents = mask;
-               }
-               pt->_qproc = NULL;
-               if (!count) {
-                       count = table.error;
-                       if (signal_pending(current))
-                               count = -EINTR;
-               }
-               if (count || timed_out)
-                       break;
-
-               if (!schedule_timeout_interruptible(timeout))
-                       timed_out = 1;
-       }
-       poll_freewait(&table);
-       return count;
-}
-EXPORT_SYMBOL_GPL(scif_poll);
-
-int scif_get_node_ids(u16 *nodes, int len, u16 *self)
-{
-       int online = 0;
-       int offset = 0;
-       int node;
-
-       if (!scif_is_mgmt_node())
-               scif_get_node_info();
-
-       *self = scif_info.nodeid;
-       mutex_lock(&scif_info.conflock);
-       len = min_t(int, len, scif_info.total);
-       for (node = 0; node <= scif_info.maxid; node++) {
-               if (_scifdev_alive(&scif_dev[node])) {
-                       online++;
-                       if (offset < len)
-                               nodes[offset++] = node;
-               }
-       }
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI get_node_ids total %d online %d filled in %d nodes\n",
-               scif_info.total, online, offset);
-       mutex_unlock(&scif_info.conflock);
-
-       return online;
-}
-EXPORT_SYMBOL_GPL(scif_get_node_ids);
-
-static int scif_add_client_dev(struct device *dev, struct subsys_interface *si)
-{
-       struct scif_client *client =
-               container_of(si, struct scif_client, si);
-       struct scif_peer_dev *spdev =
-               container_of(dev, struct scif_peer_dev, dev);
-
-       if (client->probe)
-               client->probe(spdev);
-       return 0;
-}
-
-static void scif_remove_client_dev(struct device *dev,
-                                  struct subsys_interface *si)
-{
-       struct scif_client *client =
-               container_of(si, struct scif_client, si);
-       struct scif_peer_dev *spdev =
-               container_of(dev, struct scif_peer_dev, dev);
-
-       if (client->remove)
-               client->remove(spdev);
-}
-
-void scif_client_unregister(struct scif_client *client)
-{
-       subsys_interface_unregister(&client->si);
-}
-EXPORT_SYMBOL_GPL(scif_client_unregister);
-
-int scif_client_register(struct scif_client *client)
-{
-       struct subsys_interface *si = &client->si;
-
-       si->name = client->name;
-       si->subsys = &scif_peer_bus;
-       si->add_dev = scif_add_client_dev;
-       si->remove_dev = scif_remove_client_dev;
-
-       return subsys_interface_register(&client->si);
-}
-EXPORT_SYMBOL_GPL(scif_client_register);
diff --git a/drivers/misc/mic/scif/scif_debugfs.c b/drivers/misc/mic/scif/scif_debugfs.c
deleted file mode 100644 (file)
index 8fe38e7..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include <linux/debugfs.h>
-#include <linux/seq_file.h>
-
-#include "../common/mic_dev.h"
-#include "scif_main.h"
-
-/* Debugfs parent dir */
-static struct dentry *scif_dbg;
-
-static int scif_dev_show(struct seq_file *s, void *unused)
-{
-       int node;
-
-       seq_printf(s, "Total Nodes %d Self Node Id %d Maxid %d\n",
-                  scif_info.total, scif_info.nodeid,
-                  scif_info.maxid);
-
-       if (!scif_dev)
-               return 0;
-
-       seq_printf(s, "%-16s\t%-16s\n", "node_id", "state");
-
-       for (node = 0; node <= scif_info.maxid; node++)
-               seq_printf(s, "%-16d\t%-16s\n", scif_dev[node].node,
-                          _scifdev_alive(&scif_dev[node]) ?
-                          "Running" : "Offline");
-       return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(scif_dev);
-
-static void scif_display_window(struct scif_window *window, struct seq_file *s)
-{
-       int j;
-       struct scatterlist *sg;
-       scif_pinned_pages_t pin = window->pinned_pages;
-
-       seq_printf(s, "window %p type %d temp %d offset 0x%llx ",
-                  window, window->type, window->temp, window->offset);
-       seq_printf(s, "nr_pages 0x%llx nr_contig_chunks 0x%x prot %d ",
-                  window->nr_pages, window->nr_contig_chunks, window->prot);
-       seq_printf(s, "ref_count %d magic 0x%llx peer_window 0x%llx ",
-                  window->ref_count, window->magic, window->peer_window);
-       seq_printf(s, "unreg_state 0x%x va_for_temp 0x%lx\n",
-                  window->unreg_state, window->va_for_temp);
-
-       for (j = 0; j < window->nr_contig_chunks; j++)
-               seq_printf(s, "page[%d] dma_addr 0x%llx num_pages 0x%llx\n", j,
-                          window->dma_addr[j], window->num_pages[j]);
-
-       if (window->type == SCIF_WINDOW_SELF && pin)
-               for (j = 0; j < window->nr_pages; j++)
-                       seq_printf(s, "page[%d] = pinned_pages %p address %p\n",
-                                  j, pin->pages[j],
-                                  page_address(pin->pages[j]));
-
-       if (window->st)
-               for_each_sg(window->st->sgl, sg, window->st->nents, j)
-                       seq_printf(s, "sg[%d] dma addr 0x%llx length 0x%x\n",
-                                  j, sg_dma_address(sg), sg_dma_len(sg));
-}
-
-static void scif_display_all_windows(struct list_head *head, struct seq_file *s)
-{
-       struct list_head *item;
-       struct scif_window *window;
-
-       list_for_each(item, head) {
-               window = list_entry(item, struct scif_window, list);
-               scif_display_window(window, s);
-       }
-}
-
-static int scif_rma_show(struct seq_file *s, void *unused)
-{
-       struct scif_endpt *ep;
-       struct list_head *pos;
-
-       mutex_lock(&scif_info.connlock);
-       list_for_each(pos, &scif_info.connected) {
-               ep = list_entry(pos, struct scif_endpt, list);
-               seq_printf(s, "ep %p self windows\n", ep);
-               mutex_lock(&ep->rma_info.rma_lock);
-               scif_display_all_windows(&ep->rma_info.reg_list, s);
-               seq_printf(s, "ep %p remote windows\n", ep);
-               scif_display_all_windows(&ep->rma_info.remote_reg_list, s);
-               mutex_unlock(&ep->rma_info.rma_lock);
-       }
-       mutex_unlock(&scif_info.connlock);
-       return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(scif_rma);
-
-void __init scif_init_debugfs(void)
-{
-       scif_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL);
-
-       debugfs_create_file("scif_dev", 0444, scif_dbg, NULL, &scif_dev_fops);
-       debugfs_create_file("scif_rma", 0444, scif_dbg, NULL, &scif_rma_fops);
-       debugfs_create_u8("en_msg_log", 0666, scif_dbg, &scif_info.en_msg_log);
-       debugfs_create_u8("p2p_enable", 0666, scif_dbg, &scif_info.p2p_enable);
-}
-
-void scif_exit_debugfs(void)
-{
-       debugfs_remove_recursive(scif_dbg);
-}
diff --git a/drivers/misc/mic/scif/scif_dma.c b/drivers/misc/mic/scif/scif_dma.c
deleted file mode 100644 (file)
index 401b98e..0000000
+++ /dev/null
@@ -1,1940 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include "scif_main.h"
-#include "scif_map.h"
-
-/*
- * struct scif_dma_comp_cb - SCIF DMA completion callback
- *
- * @dma_completion_func: DMA completion callback
- * @cb_cookie: DMA completion callback cookie
- * @temp_buf: Temporary buffer
- * @temp_buf_to_free: Temporary buffer to be freed
- * @is_cache: Is a kmem_cache allocated buffer
- * @dst_offset: Destination registration offset
- * @dst_window: Destination registration window
- * @len: Length of the temp buffer
- * @temp_phys: DMA address of the temp buffer
- * @sdev: The SCIF device
- * @header_padding: padding for cache line alignment
- */
-struct scif_dma_comp_cb {
-       void (*dma_completion_func)(void *cookie);
-       void *cb_cookie;
-       u8 *temp_buf;
-       u8 *temp_buf_to_free;
-       bool is_cache;
-       s64 dst_offset;
-       struct scif_window *dst_window;
-       size_t len;
-       dma_addr_t temp_phys;
-       struct scif_dev *sdev;
-       int header_padding;
-};
-
-/**
- * struct scif_copy_work - Work for DMA copy
- *
- * @src_offset: Starting source offset
- * @dst_offset: Starting destination offset
- * @src_window: Starting src registered window
- * @dst_window: Starting dst registered window
- * @loopback: true if this is a loopback DMA transfer
- * @len: Length of the transfer
- * @comp_cb: DMA copy completion callback
- * @remote_dev: The remote SCIF peer device
- * @fence_type: polling or interrupt based
- * @ordered: is this a tail byte ordered DMA transfer
- */
-struct scif_copy_work {
-       s64 src_offset;
-       s64 dst_offset;
-       struct scif_window *src_window;
-       struct scif_window *dst_window;
-       int loopback;
-       size_t len;
-       struct scif_dma_comp_cb   *comp_cb;
-       struct scif_dev *remote_dev;
-       int fence_type;
-       bool ordered;
-};
-
-/**
- * scif_reserve_dma_chan:
- * @ep: Endpoint Descriptor.
- *
- * This routine reserves a DMA channel for a particular
- * endpoint. All DMA transfers for an endpoint are always
- * programmed on the same DMA channel.
- */
-int scif_reserve_dma_chan(struct scif_endpt *ep)
-{
-       int err = 0;
-       struct scif_dev *scifdev;
-       struct scif_hw_dev *sdev;
-       struct dma_chan *chan;
-
-       /* Loopback DMAs are not supported on the management node */
-       if (!scif_info.nodeid && scifdev_self(ep->remote_dev))
-               return 0;
-       if (scif_info.nodeid)
-               scifdev = &scif_dev[0];
-       else
-               scifdev = ep->remote_dev;
-       sdev = scifdev->sdev;
-       if (!sdev->num_dma_ch)
-               return -ENODEV;
-       chan = sdev->dma_ch[scifdev->dma_ch_idx];
-       scifdev->dma_ch_idx = (scifdev->dma_ch_idx + 1) % sdev->num_dma_ch;
-       mutex_lock(&ep->rma_info.rma_lock);
-       ep->rma_info.dma_chan = chan;
-       mutex_unlock(&ep->rma_info.rma_lock);
-       return err;
-}
-
-#ifdef CONFIG_MMU_NOTIFIER
-/*
- * scif_rma_destroy_tcw:
- *
- * This routine destroys temporary cached windows
- */
-static
-void __scif_rma_destroy_tcw(struct scif_mmu_notif *mmn,
-                           u64 start, u64 len)
-{
-       struct list_head *item, *tmp;
-       struct scif_window *window;
-       u64 start_va, end_va;
-       u64 end = start + len;
-
-       if (end <= start)
-               return;
-
-       list_for_each_safe(item, tmp, &mmn->tc_reg_list) {
-               window = list_entry(item, struct scif_window, list);
-               if (!len)
-                       break;
-               start_va = window->va_for_temp;
-               end_va = start_va + (window->nr_pages << PAGE_SHIFT);
-               if (start < start_va && end <= start_va)
-                       break;
-               if (start >= end_va)
-                       continue;
-               __scif_rma_destroy_tcw_helper(window);
-       }
-}
-
-static void scif_rma_destroy_tcw(struct scif_mmu_notif *mmn, u64 start, u64 len)
-{
-       struct scif_endpt *ep = mmn->ep;
-
-       spin_lock(&ep->rma_info.tc_lock);
-       __scif_rma_destroy_tcw(mmn, start, len);
-       spin_unlock(&ep->rma_info.tc_lock);
-}
-
-static void scif_rma_destroy_tcw_ep(struct scif_endpt *ep)
-{
-       struct list_head *item, *tmp;
-       struct scif_mmu_notif *mmn;
-
-       list_for_each_safe(item, tmp, &ep->rma_info.mmn_list) {
-               mmn = list_entry(item, struct scif_mmu_notif, list);
-               scif_rma_destroy_tcw(mmn, 0, ULONG_MAX);
-       }
-}
-
-static void __scif_rma_destroy_tcw_ep(struct scif_endpt *ep)
-{
-       struct list_head *item, *tmp;
-       struct scif_mmu_notif *mmn;
-
-       spin_lock(&ep->rma_info.tc_lock);
-       list_for_each_safe(item, tmp, &ep->rma_info.mmn_list) {
-               mmn = list_entry(item, struct scif_mmu_notif, list);
-               __scif_rma_destroy_tcw(mmn, 0, ULONG_MAX);
-       }
-       spin_unlock(&ep->rma_info.tc_lock);
-}
-
-static bool scif_rma_tc_can_cache(struct scif_endpt *ep, size_t cur_bytes)
-{
-       if ((cur_bytes >> PAGE_SHIFT) > scif_info.rma_tc_limit)
-               return false;
-       if ((atomic_read(&ep->rma_info.tcw_total_pages)
-                       + (cur_bytes >> PAGE_SHIFT)) >
-                       scif_info.rma_tc_limit) {
-               dev_info(scif_info.mdev.this_device,
-                        "%s %d total=%d, current=%zu reached max\n",
-                        __func__, __LINE__,
-                        atomic_read(&ep->rma_info.tcw_total_pages),
-                        (1 + (cur_bytes >> PAGE_SHIFT)));
-               scif_rma_destroy_tcw_invalid();
-               __scif_rma_destroy_tcw_ep(ep);
-       }
-       return true;
-}
-
-static void scif_mmu_notifier_release(struct mmu_notifier *mn,
-                                     struct mm_struct *mm)
-{
-       struct scif_mmu_notif   *mmn;
-
-       mmn = container_of(mn, struct scif_mmu_notif, ep_mmu_notifier);
-       scif_rma_destroy_tcw(mmn, 0, ULONG_MAX);
-       schedule_work(&scif_info.misc_work);
-}
-
-static int scif_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
-                                       const struct mmu_notifier_range *range)
-{
-       struct scif_mmu_notif   *mmn;
-
-       mmn = container_of(mn, struct scif_mmu_notif, ep_mmu_notifier);
-       scif_rma_destroy_tcw(mmn, range->start, range->end - range->start);
-
-       return 0;
-}
-
-static void scif_mmu_notifier_invalidate_range_end(struct mmu_notifier *mn,
-                       const struct mmu_notifier_range *range)
-{
-       /*
-        * Nothing to do here, everything needed was done in
-        * invalidate_range_start.
-        */
-}
-
-static const struct mmu_notifier_ops scif_mmu_notifier_ops = {
-       .release = scif_mmu_notifier_release,
-       .clear_flush_young = NULL,
-       .invalidate_range_start = scif_mmu_notifier_invalidate_range_start,
-       .invalidate_range_end = scif_mmu_notifier_invalidate_range_end};
-
-static void scif_ep_unregister_mmu_notifier(struct scif_endpt *ep)
-{
-       struct scif_endpt_rma_info *rma = &ep->rma_info;
-       struct scif_mmu_notif *mmn = NULL;
-       struct list_head *item, *tmp;
-
-       mutex_lock(&ep->rma_info.mmn_lock);
-       list_for_each_safe(item, tmp, &rma->mmn_list) {
-               mmn = list_entry(item, struct scif_mmu_notif, list);
-               mmu_notifier_unregister(&mmn->ep_mmu_notifier, mmn->mm);
-               list_del(item);
-               kfree(mmn);
-       }
-       mutex_unlock(&ep->rma_info.mmn_lock);
-}
-
-static void scif_init_mmu_notifier(struct scif_mmu_notif *mmn,
-                                  struct mm_struct *mm, struct scif_endpt *ep)
-{
-       mmn->ep = ep;
-       mmn->mm = mm;
-       mmn->ep_mmu_notifier.ops = &scif_mmu_notifier_ops;
-       INIT_LIST_HEAD(&mmn->list);
-       INIT_LIST_HEAD(&mmn->tc_reg_list);
-}
-
-static struct scif_mmu_notif *
-scif_find_mmu_notifier(struct mm_struct *mm, struct scif_endpt_rma_info *rma)
-{
-       struct scif_mmu_notif *mmn;
-
-       list_for_each_entry(mmn, &rma->mmn_list, list)
-               if (mmn->mm == mm)
-                       return mmn;
-       return NULL;
-}
-
-static struct scif_mmu_notif *
-scif_add_mmu_notifier(struct mm_struct *mm, struct scif_endpt *ep)
-{
-       struct scif_mmu_notif *mmn
-                = kzalloc(sizeof(*mmn), GFP_KERNEL);
-
-       if (!mmn)
-               return ERR_PTR(-ENOMEM);
-
-       scif_init_mmu_notifier(mmn, current->mm, ep);
-       if (mmu_notifier_register(&mmn->ep_mmu_notifier, current->mm)) {
-               kfree(mmn);
-               return ERR_PTR(-EBUSY);
-       }
-       list_add(&mmn->list, &ep->rma_info.mmn_list);
-       return mmn;
-}
-
-/*
- * Called from the misc thread to destroy temporary cached windows and
- * unregister the MMU notifier for the SCIF endpoint.
- */
-void scif_mmu_notif_handler(struct work_struct *work)
-{
-       struct list_head *pos, *tmpq;
-       struct scif_endpt *ep;
-restart:
-       scif_rma_destroy_tcw_invalid();
-       spin_lock(&scif_info.rmalock);
-       list_for_each_safe(pos, tmpq, &scif_info.mmu_notif_cleanup) {
-               ep = list_entry(pos, struct scif_endpt, mmu_list);
-               list_del(&ep->mmu_list);
-               spin_unlock(&scif_info.rmalock);
-               scif_rma_destroy_tcw_ep(ep);
-               scif_ep_unregister_mmu_notifier(ep);
-               goto restart;
-       }
-       spin_unlock(&scif_info.rmalock);
-}
-
-static bool scif_is_set_reg_cache(int flags)
-{
-       return !!(flags & SCIF_RMA_USECACHE);
-}
-#else
-static struct scif_mmu_notif *
-scif_find_mmu_notifier(struct mm_struct *mm,
-                      struct scif_endpt_rma_info *rma)
-{
-       return NULL;
-}
-
-static struct scif_mmu_notif *
-scif_add_mmu_notifier(struct mm_struct *mm, struct scif_endpt *ep)
-{
-       return NULL;
-}
-
-void scif_mmu_notif_handler(struct work_struct *work)
-{
-}
-
-static bool scif_is_set_reg_cache(int flags)
-{
-       return false;
-}
-
-static bool scif_rma_tc_can_cache(struct scif_endpt *ep, size_t cur_bytes)
-{
-       return false;
-}
-#endif
-
-/**
- * scif_register_temp:
- * @epd: End Point Descriptor.
- * @addr: virtual address to/from which to copy
- * @len: length of range to copy
- * @prot: read/write protection
- * @out_offset: computed offset returned by reference.
- * @out_window: allocated registered window returned by reference.
- *
- * Create a temporary registered window. The peer will not know about this
- * window. This API is used for scif_vreadfrom()/scif_vwriteto() API's.
- */
-static int
-scif_register_temp(scif_epd_t epd, unsigned long addr, size_t len, int prot,
-                  off_t *out_offset, struct scif_window **out_window)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       int err;
-       scif_pinned_pages_t pinned_pages;
-       size_t aligned_len;
-
-       aligned_len = ALIGN(len, PAGE_SIZE);
-
-       err = __scif_pin_pages((void *)(addr & PAGE_MASK),
-                              aligned_len, &prot, 0, &pinned_pages);
-       if (err)
-               return err;
-
-       pinned_pages->prot = prot;
-
-       /* Compute the offset for this registration */
-       err = scif_get_window_offset(ep, 0, 0,
-                                    aligned_len >> PAGE_SHIFT,
-                                    (s64 *)out_offset);
-       if (err)
-               goto error_unpin;
-
-       /* Allocate and prepare self registration window */
-       *out_window = scif_create_window(ep, aligned_len >> PAGE_SHIFT,
-                                       *out_offset, true);
-       if (!*out_window) {
-               scif_free_window_offset(ep, NULL, *out_offset);
-               err = -ENOMEM;
-               goto error_unpin;
-       }
-
-       (*out_window)->pinned_pages = pinned_pages;
-       (*out_window)->nr_pages = pinned_pages->nr_pages;
-       (*out_window)->prot = pinned_pages->prot;
-
-       (*out_window)->va_for_temp = addr & PAGE_MASK;
-       err = scif_map_window(ep->remote_dev, *out_window);
-       if (err) {
-               /* Something went wrong! Rollback */
-               scif_destroy_window(ep, *out_window);
-               *out_window = NULL;
-       } else {
-               *out_offset |= (addr - (*out_window)->va_for_temp);
-       }
-       return err;
-error_unpin:
-       if (err)
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-       scif_unpin_pages(pinned_pages);
-       return err;
-}
-
-#define SCIF_DMA_TO (3 * HZ)
-
-/*
- * scif_sync_dma - Program a DMA without an interrupt descriptor
- *
- * @dev - The address of the pointer to the device instance used
- * for DMA registration.
- * @chan - DMA channel to be used.
- * @sync_wait: Wait for DMA to complete?
- *
- * Return 0 on success and -errno on error.
- */
-static int scif_sync_dma(struct scif_hw_dev *sdev, struct dma_chan *chan,
-                        bool sync_wait)
-{
-       int err = 0;
-       struct dma_async_tx_descriptor *tx = NULL;
-       enum dma_ctrl_flags flags = DMA_PREP_FENCE;
-       dma_cookie_t cookie;
-       struct dma_device *ddev;
-
-       if (!chan) {
-               err = -EIO;
-               dev_err(&sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               return err;
-       }
-       ddev = chan->device;
-
-       tx = ddev->device_prep_dma_memcpy(chan, 0, 0, 0, flags);
-       if (!tx) {
-               err = -ENOMEM;
-               dev_err(&sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto release;
-       }
-       cookie = tx->tx_submit(tx);
-
-       if (dma_submit_error(cookie)) {
-               err = -ENOMEM;
-               dev_err(&sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto release;
-       }
-       if (!sync_wait) {
-               dma_async_issue_pending(chan);
-       } else {
-               if (dma_sync_wait(chan, cookie) == DMA_COMPLETE) {
-                       err = 0;
-               } else {
-                       err = -EIO;
-                       dev_err(&sdev->dev, "%s %d err %d\n",
-                               __func__, __LINE__, err);
-               }
-       }
-release:
-       return err;
-}
-
-static void scif_dma_callback(void *arg)
-{
-       struct completion *done = (struct completion *)arg;
-
-       complete(done);
-}
-
-#define SCIF_DMA_SYNC_WAIT true
-#define SCIF_DMA_POLL BIT(0)
-#define SCIF_DMA_INTR BIT(1)
-
-/*
- * scif_async_dma - Program a DMA with an interrupt descriptor
- *
- * @dev - The address of the pointer to the device instance used
- * for DMA registration.
- * @chan - DMA channel to be used.
- * Return 0 on success and -errno on error.
- */
-static int scif_async_dma(struct scif_hw_dev *sdev, struct dma_chan *chan)
-{
-       int err = 0;
-       struct dma_device *ddev;
-       struct dma_async_tx_descriptor *tx = NULL;
-       enum dma_ctrl_flags flags = DMA_PREP_INTERRUPT | DMA_PREP_FENCE;
-       DECLARE_COMPLETION_ONSTACK(done_wait);
-       dma_cookie_t cookie;
-       enum dma_status status;
-
-       if (!chan) {
-               err = -EIO;
-               dev_err(&sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               return err;
-       }
-       ddev = chan->device;
-
-       tx = ddev->device_prep_dma_memcpy(chan, 0, 0, 0, flags);
-       if (!tx) {
-               err = -ENOMEM;
-               dev_err(&sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto release;
-       }
-       reinit_completion(&done_wait);
-       tx->callback = scif_dma_callback;
-       tx->callback_param = &done_wait;
-       cookie = tx->tx_submit(tx);
-
-       if (dma_submit_error(cookie)) {
-               err = -ENOMEM;
-               dev_err(&sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto release;
-       }
-       dma_async_issue_pending(chan);
-
-       err = wait_for_completion_timeout(&done_wait, SCIF_DMA_TO);
-       if (!err) {
-               err = -EIO;
-               dev_err(&sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto release;
-       }
-       err = 0;
-       status = dma_async_is_tx_complete(chan, cookie, NULL, NULL);
-       if (status != DMA_COMPLETE) {
-               err = -EIO;
-               dev_err(&sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto release;
-       }
-release:
-       return err;
-}
-
-/*
- * scif_drain_dma_poll - Drain all outstanding DMA operations for a particular
- * DMA channel via polling.
- *
- * @sdev - The SCIF device
- * @chan - DMA channel
- * Return 0 on success and -errno on error.
- */
-static int scif_drain_dma_poll(struct scif_hw_dev *sdev, struct dma_chan *chan)
-{
-       if (!chan)
-               return -EINVAL;
-       return scif_sync_dma(sdev, chan, SCIF_DMA_SYNC_WAIT);
-}
-
-/*
- * scif_drain_dma_intr - Drain all outstanding DMA operations for a particular
- * DMA channel via interrupt based blocking wait.
- *
- * @sdev - The SCIF device
- * @chan - DMA channel
- * Return 0 on success and -errno on error.
- */
-int scif_drain_dma_intr(struct scif_hw_dev *sdev, struct dma_chan *chan)
-{
-       if (!chan)
-               return -EINVAL;
-       return scif_async_dma(sdev, chan);
-}
-
-/**
- * scif_rma_destroy_windows:
- *
- * This routine destroys all windows queued for cleanup
- */
-void scif_rma_destroy_windows(void)
-{
-       struct list_head *item, *tmp;
-       struct scif_window *window;
-       struct scif_endpt *ep;
-       struct dma_chan *chan;
-
-       might_sleep();
-restart:
-       spin_lock(&scif_info.rmalock);
-       list_for_each_safe(item, tmp, &scif_info.rma) {
-               window = list_entry(item, struct scif_window,
-                                   list);
-               ep = (struct scif_endpt *)window->ep;
-               chan = ep->rma_info.dma_chan;
-
-               list_del_init(&window->list);
-               spin_unlock(&scif_info.rmalock);
-               if (!chan || !scifdev_alive(ep) ||
-                   !scif_drain_dma_intr(ep->remote_dev->sdev,
-                                        ep->rma_info.dma_chan))
-                       /* Remove window from global list */
-                       window->unreg_state = OP_COMPLETED;
-               else
-                       dev_warn(&ep->remote_dev->sdev->dev,
-                                "DMA engine hung?\n");
-               if (window->unreg_state == OP_COMPLETED) {
-                       if (window->type == SCIF_WINDOW_SELF)
-                               scif_destroy_window(ep, window);
-                       else
-                               scif_destroy_remote_window(window);
-                       atomic_dec(&ep->rma_info.tw_refcount);
-               }
-               goto restart;
-       }
-       spin_unlock(&scif_info.rmalock);
-}
-
-/**
- * scif_rma_destroy_tcw:
- *
- * This routine destroys temporary cached registered windows
- * which have been queued for cleanup.
- */
-void scif_rma_destroy_tcw_invalid(void)
-{
-       struct list_head *item, *tmp;
-       struct scif_window *window;
-       struct scif_endpt *ep;
-       struct dma_chan *chan;
-
-       might_sleep();
-restart:
-       spin_lock(&scif_info.rmalock);
-       list_for_each_safe(item, tmp, &scif_info.rma_tc) {
-               window = list_entry(item, struct scif_window, list);
-               ep = (struct scif_endpt *)window->ep;
-               chan = ep->rma_info.dma_chan;
-               list_del_init(&window->list);
-               spin_unlock(&scif_info.rmalock);
-               mutex_lock(&ep->rma_info.rma_lock);
-               if (!chan || !scifdev_alive(ep) ||
-                   !scif_drain_dma_intr(ep->remote_dev->sdev,
-                                        ep->rma_info.dma_chan)) {
-                       atomic_sub(window->nr_pages,
-                                  &ep->rma_info.tcw_total_pages);
-                       scif_destroy_window(ep, window);
-                       atomic_dec(&ep->rma_info.tcw_refcount);
-               } else {
-                       dev_warn(&ep->remote_dev->sdev->dev,
-                                "DMA engine hung?\n");
-               }
-               mutex_unlock(&ep->rma_info.rma_lock);
-               goto restart;
-       }
-       spin_unlock(&scif_info.rmalock);
-}
-
-static inline
-void *_get_local_va(off_t off, struct scif_window *window, size_t len)
-{
-       int page_nr = (off - window->offset) >> PAGE_SHIFT;
-       off_t page_off = off & ~PAGE_MASK;
-       void *va = NULL;
-
-       if (window->type == SCIF_WINDOW_SELF) {
-               struct page **pages = window->pinned_pages->pages;
-
-               va = page_address(pages[page_nr]) + page_off;
-       }
-       return va;
-}
-
-static inline
-void *ioremap_remote(off_t off, struct scif_window *window,
-                    size_t len, struct scif_dev *dev,
-                    struct scif_window_iter *iter)
-{
-       dma_addr_t phys = scif_off_to_dma_addr(window, off, NULL, iter);
-
-       /*
-        * If the DMA address is not card relative then we need the DMA
-        * addresses to be an offset into the bar. The aperture base was already
-        * added so subtract it here since scif_ioremap is going to add it again
-        */
-       if (!scifdev_self(dev) && window->type == SCIF_WINDOW_PEER &&
-           dev->sdev->aper && !dev->sdev->card_rel_da)
-               phys = phys - dev->sdev->aper->pa;
-       return scif_ioremap(phys, len, dev);
-}
-
-static inline void
-iounmap_remote(void *virt, size_t size, struct scif_copy_work *work)
-{
-       scif_iounmap(virt, size, work->remote_dev);
-}
-
-/*
- * Takes care of ordering issue caused by
- * 1. Hardware:  Only in the case of cpu copy from mgmt node to card
- * because of WC memory.
- * 2. Software: If memcpy reorders copy instructions for optimization.
- * This could happen at both mgmt node and card.
- */
-static inline void
-scif_ordered_memcpy_toio(char *dst, const char *src, size_t count)
-{
-       if (!count)
-               return;
-
-       memcpy_toio((void __iomem __force *)dst, src, --count);
-       /* Order the last byte with the previous stores */
-       wmb();
-       *(dst + count) = *(src + count);
-}
-
-static inline void scif_unaligned_cpy_toio(char *dst, const char *src,
-                                          size_t count, bool ordered)
-{
-       if (ordered)
-               scif_ordered_memcpy_toio(dst, src, count);
-       else
-               memcpy_toio((void __iomem __force *)dst, src, count);
-}
-
-static inline
-void scif_ordered_memcpy_fromio(char *dst, const char *src, size_t count)
-{
-       if (!count)
-               return;
-
-       memcpy_fromio(dst, (void __iomem __force *)src, --count);
-       /* Order the last byte with the previous loads */
-       rmb();
-       *(dst + count) = *(src + count);
-}
-
-static inline void scif_unaligned_cpy_fromio(char *dst, const char *src,
-                                            size_t count, bool ordered)
-{
-       if (ordered)
-               scif_ordered_memcpy_fromio(dst, src, count);
-       else
-               memcpy_fromio(dst, (void __iomem __force *)src, count);
-}
-
-#define SCIF_RMA_ERROR_CODE (~(dma_addr_t)0x0)
-
-/*
- * scif_off_to_dma_addr:
- * Obtain the dma_addr given the window and the offset.
- * @window: Registered window.
- * @off: Window offset.
- * @nr_bytes: Return the number of contiguous bytes till next DMA addr index.
- * @index: Return the index of the dma_addr array found.
- * @start_off: start offset of index of the dma addr array found.
- * The nr_bytes provides the callee an estimate of the maximum possible
- * DMA xfer possible while the index/start_off provide faster lookups
- * for the next iteration.
- */
-dma_addr_t scif_off_to_dma_addr(struct scif_window *window, s64 off,
-                               size_t *nr_bytes, struct scif_window_iter *iter)
-{
-       int i, page_nr;
-       s64 start, end;
-       off_t page_off;
-
-       if (window->nr_pages == window->nr_contig_chunks) {
-               page_nr = (off - window->offset) >> PAGE_SHIFT;
-               page_off = off & ~PAGE_MASK;
-
-               if (nr_bytes)
-                       *nr_bytes = PAGE_SIZE - page_off;
-               return window->dma_addr[page_nr] | page_off;
-       }
-       if (iter) {
-               i = iter->index;
-               start = iter->offset;
-       } else {
-               i =  0;
-               start =  window->offset;
-       }
-       for (; i < window->nr_contig_chunks; i++) {
-               end = start + (window->num_pages[i] << PAGE_SHIFT);
-               if (off >= start && off < end) {
-                       if (iter) {
-                               iter->index = i;
-                               iter->offset = start;
-                       }
-                       if (nr_bytes)
-                               *nr_bytes = end - off;
-                       return (window->dma_addr[i] + (off - start));
-               }
-               start += (window->num_pages[i] << PAGE_SHIFT);
-       }
-       dev_err(scif_info.mdev.this_device,
-               "%s %d BUG. Addr not found? window %p off 0x%llx\n",
-               __func__, __LINE__, window, off);
-       return SCIF_RMA_ERROR_CODE;
-}
-
-/*
- * Copy between rma window and temporary buffer
- */
-static void scif_rma_local_cpu_copy(s64 offset, struct scif_window *window,
-                                   u8 *temp, size_t rem_len, bool to_temp)
-{
-       void *window_virt;
-       size_t loop_len;
-       int offset_in_page;
-       s64 end_offset;
-
-       offset_in_page = offset & ~PAGE_MASK;
-       loop_len = PAGE_SIZE - offset_in_page;
-
-       if (rem_len < loop_len)
-               loop_len = rem_len;
-
-       window_virt = _get_local_va(offset, window, loop_len);
-       if (!window_virt)
-               return;
-       if (to_temp)
-               memcpy(temp, window_virt, loop_len);
-       else
-               memcpy(window_virt, temp, loop_len);
-
-       offset += loop_len;
-       temp += loop_len;
-       rem_len -= loop_len;
-
-       end_offset = window->offset +
-               (window->nr_pages << PAGE_SHIFT);
-       while (rem_len) {
-               if (offset == end_offset) {
-                       window = list_next_entry(window, list);
-                       end_offset = window->offset +
-                               (window->nr_pages << PAGE_SHIFT);
-               }
-               loop_len = min(PAGE_SIZE, rem_len);
-               window_virt = _get_local_va(offset, window, loop_len);
-               if (!window_virt)
-                       return;
-               if (to_temp)
-                       memcpy(temp, window_virt, loop_len);
-               else
-                       memcpy(window_virt, temp, loop_len);
-               offset  += loop_len;
-               temp    += loop_len;
-               rem_len -= loop_len;
-       }
-}
-
-/**
- * scif_rma_completion_cb:
- * @data: RMA cookie
- *
- * RMA interrupt completion callback.
- */
-static void scif_rma_completion_cb(void *data)
-{
-       struct scif_dma_comp_cb *comp_cb = data;
-
-       /* Free DMA Completion CB. */
-       if (comp_cb->dst_window)
-               scif_rma_local_cpu_copy(comp_cb->dst_offset,
-                                       comp_cb->dst_window,
-                                       comp_cb->temp_buf +
-                                       comp_cb->header_padding,
-                                       comp_cb->len, false);
-       scif_unmap_single(comp_cb->temp_phys, comp_cb->sdev,
-                         SCIF_KMEM_UNALIGNED_BUF_SIZE);
-       if (comp_cb->is_cache)
-               kmem_cache_free(unaligned_cache,
-                               comp_cb->temp_buf_to_free);
-       else
-               kfree(comp_cb->temp_buf_to_free);
-}
-
-/* Copies between temporary buffer and offsets provided in work */
-static int
-scif_rma_list_dma_copy_unaligned(struct scif_copy_work *work,
-                                u8 *temp, struct dma_chan *chan,
-                                bool src_local)
-{
-       struct scif_dma_comp_cb *comp_cb = work->comp_cb;
-       dma_addr_t window_dma_addr, temp_dma_addr;
-       dma_addr_t temp_phys = comp_cb->temp_phys;
-       size_t loop_len, nr_contig_bytes = 0, remaining_len = work->len;
-       int offset_in_ca, ret = 0;
-       s64 end_offset, offset;
-       struct scif_window *window;
-       void *window_virt_addr;
-       size_t tail_len;
-       struct dma_async_tx_descriptor *tx;
-       struct dma_device *dev = chan->device;
-       dma_cookie_t cookie;
-
-       if (src_local) {
-               offset = work->dst_offset;
-               window = work->dst_window;
-       } else {
-               offset = work->src_offset;
-               window = work->src_window;
-       }
-
-       offset_in_ca = offset & (L1_CACHE_BYTES - 1);
-       if (offset_in_ca) {
-               loop_len = L1_CACHE_BYTES - offset_in_ca;
-               loop_len = min(loop_len, remaining_len);
-               window_virt_addr = ioremap_remote(offset, window,
-                                                 loop_len,
-                                                 work->remote_dev,
-                                                 NULL);
-               if (!window_virt_addr)
-                       return -ENOMEM;
-               if (src_local)
-                       scif_unaligned_cpy_toio(window_virt_addr, temp,
-                                               loop_len,
-                                               work->ordered &&
-                                               !(remaining_len - loop_len));
-               else
-                       scif_unaligned_cpy_fromio(temp, window_virt_addr,
-                                                 loop_len, work->ordered &&
-                                                 !(remaining_len - loop_len));
-               iounmap_remote(window_virt_addr, loop_len, work);
-
-               offset += loop_len;
-               temp += loop_len;
-               temp_phys += loop_len;
-               remaining_len -= loop_len;
-       }
-
-       offset_in_ca = offset & ~PAGE_MASK;
-       end_offset = window->offset +
-               (window->nr_pages << PAGE_SHIFT);
-
-       tail_len = remaining_len & (L1_CACHE_BYTES - 1);
-       remaining_len -= tail_len;
-       while (remaining_len) {
-               if (offset == end_offset) {
-                       window = list_next_entry(window, list);
-                       end_offset = window->offset +
-                               (window->nr_pages << PAGE_SHIFT);
-               }
-               if (scif_is_mgmt_node())
-                       temp_dma_addr = temp_phys;
-               else
-                       /* Fix if we ever enable IOMMU on the card */
-                       temp_dma_addr = (dma_addr_t)virt_to_phys(temp);
-               window_dma_addr = scif_off_to_dma_addr(window, offset,
-                                                      &nr_contig_bytes,
-                                                      NULL);
-               loop_len = min(nr_contig_bytes, remaining_len);
-               if (src_local) {
-                       if (work->ordered && !tail_len &&
-                           !(remaining_len - loop_len) &&
-                           loop_len != L1_CACHE_BYTES) {
-                               /*
-                                * Break up the last chunk of the transfer into
-                                * two steps. if there is no tail to guarantee
-                                * DMA ordering. SCIF_DMA_POLLING inserts
-                                * a status update descriptor in step 1 which
-                                * acts as a double sided synchronization fence
-                                * for the DMA engine to ensure that the last
-                                * cache line in step 2 is updated last.
-                                */
-                               /* Step 1) DMA: Body Length - L1_CACHE_BYTES. */
-                               tx =
-                               dev->device_prep_dma_memcpy(chan,
-                                                           window_dma_addr,
-                                                           temp_dma_addr,
-                                                           loop_len -
-                                                           L1_CACHE_BYTES,
-                                                           DMA_PREP_FENCE);
-                               if (!tx) {
-                                       ret = -ENOMEM;
-                                       goto err;
-                               }
-                               cookie = tx->tx_submit(tx);
-                               if (dma_submit_error(cookie)) {
-                                       ret = -ENOMEM;
-                                       goto err;
-                               }
-                               dma_async_issue_pending(chan);
-                               offset += (loop_len - L1_CACHE_BYTES);
-                               temp_dma_addr += (loop_len - L1_CACHE_BYTES);
-                               window_dma_addr += (loop_len - L1_CACHE_BYTES);
-                               remaining_len -= (loop_len - L1_CACHE_BYTES);
-                               loop_len = remaining_len;
-
-                               /* Step 2) DMA: L1_CACHE_BYTES */
-                               tx =
-                               dev->device_prep_dma_memcpy(chan,
-                                                           window_dma_addr,
-                                                           temp_dma_addr,
-                                                           loop_len, 0);
-                               if (!tx) {
-                                       ret = -ENOMEM;
-                                       goto err;
-                               }
-                               cookie = tx->tx_submit(tx);
-                               if (dma_submit_error(cookie)) {
-                                       ret = -ENOMEM;
-                                       goto err;
-                               }
-                               dma_async_issue_pending(chan);
-                       } else {
-                               tx =
-                               dev->device_prep_dma_memcpy(chan,
-                                                           window_dma_addr,
-                                                           temp_dma_addr,
-                                                           loop_len, 0);
-                               if (!tx) {
-                                       ret = -ENOMEM;
-                                       goto err;
-                               }
-                               cookie = tx->tx_submit(tx);
-                               if (dma_submit_error(cookie)) {
-                                       ret = -ENOMEM;
-                                       goto err;
-                               }
-                               dma_async_issue_pending(chan);
-                       }
-               } else {
-                       tx = dev->device_prep_dma_memcpy(chan, temp_dma_addr,
-                                       window_dma_addr, loop_len, 0);
-                       if (!tx) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       cookie = tx->tx_submit(tx);
-                       if (dma_submit_error(cookie)) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       dma_async_issue_pending(chan);
-               }
-               offset += loop_len;
-               temp += loop_len;
-               temp_phys += loop_len;
-               remaining_len -= loop_len;
-               offset_in_ca = 0;
-       }
-       if (tail_len) {
-               if (offset == end_offset) {
-                       window = list_next_entry(window, list);
-                       end_offset = window->offset +
-                               (window->nr_pages << PAGE_SHIFT);
-               }
-               window_virt_addr = ioremap_remote(offset, window, tail_len,
-                                                 work->remote_dev,
-                                                 NULL);
-               if (!window_virt_addr)
-                       return -ENOMEM;
-               /*
-                * The CPU copy for the tail bytes must be initiated only once
-                * previous DMA transfers for this endpoint have completed
-                * to guarantee ordering.
-                */
-               if (work->ordered) {
-                       struct scif_dev *rdev = work->remote_dev;
-
-                       ret = scif_drain_dma_intr(rdev->sdev, chan);
-                       if (ret)
-                               return ret;
-               }
-               if (src_local)
-                       scif_unaligned_cpy_toio(window_virt_addr, temp,
-                                               tail_len, work->ordered);
-               else
-                       scif_unaligned_cpy_fromio(temp, window_virt_addr,
-                                                 tail_len, work->ordered);
-               iounmap_remote(window_virt_addr, tail_len, work);
-       }
-       tx = dev->device_prep_dma_memcpy(chan, 0, 0, 0, DMA_PREP_INTERRUPT);
-       if (!tx) {
-               ret = -ENOMEM;
-               return ret;
-       }
-       tx->callback = &scif_rma_completion_cb;
-       tx->callback_param = comp_cb;
-       cookie = tx->tx_submit(tx);
-
-       if (dma_submit_error(cookie)) {
-               ret = -ENOMEM;
-               return ret;
-       }
-       dma_async_issue_pending(chan);
-       return 0;
-err:
-       dev_err(scif_info.mdev.this_device,
-               "%s %d Desc Prog Failed ret %d\n",
-               __func__, __LINE__, ret);
-       return ret;
-}
-
-/*
- * _scif_rma_list_dma_copy_aligned:
- *
- * Traverse all the windows and perform DMA copy.
- */
-static int _scif_rma_list_dma_copy_aligned(struct scif_copy_work *work,
-                                          struct dma_chan *chan)
-{
-       dma_addr_t src_dma_addr, dst_dma_addr;
-       size_t loop_len, remaining_len, src_contig_bytes = 0;
-       size_t dst_contig_bytes = 0;
-       struct scif_window_iter src_win_iter;
-       struct scif_window_iter dst_win_iter;
-       s64 end_src_offset, end_dst_offset;
-       struct scif_window *src_window = work->src_window;
-       struct scif_window *dst_window = work->dst_window;
-       s64 src_offset = work->src_offset, dst_offset = work->dst_offset;
-       int ret = 0;
-       struct dma_async_tx_descriptor *tx;
-       struct dma_device *dev = chan->device;
-       dma_cookie_t cookie;
-
-       remaining_len = work->len;
-
-       scif_init_window_iter(src_window, &src_win_iter);
-       scif_init_window_iter(dst_window, &dst_win_iter);
-       end_src_offset = src_window->offset +
-               (src_window->nr_pages << PAGE_SHIFT);
-       end_dst_offset = dst_window->offset +
-               (dst_window->nr_pages << PAGE_SHIFT);
-       while (remaining_len) {
-               if (src_offset == end_src_offset) {
-                       src_window = list_next_entry(src_window, list);
-                       end_src_offset = src_window->offset +
-                               (src_window->nr_pages << PAGE_SHIFT);
-                       scif_init_window_iter(src_window, &src_win_iter);
-               }
-               if (dst_offset == end_dst_offset) {
-                       dst_window = list_next_entry(dst_window, list);
-                       end_dst_offset = dst_window->offset +
-                               (dst_window->nr_pages << PAGE_SHIFT);
-                       scif_init_window_iter(dst_window, &dst_win_iter);
-               }
-
-               /* compute dma addresses for transfer */
-               src_dma_addr = scif_off_to_dma_addr(src_window, src_offset,
-                                                   &src_contig_bytes,
-                                                   &src_win_iter);
-               dst_dma_addr = scif_off_to_dma_addr(dst_window, dst_offset,
-                                                   &dst_contig_bytes,
-                                                   &dst_win_iter);
-               loop_len = min(src_contig_bytes, dst_contig_bytes);
-               loop_len = min(loop_len, remaining_len);
-               if (work->ordered && !(remaining_len - loop_len)) {
-                       /*
-                        * Break up the last chunk of the transfer into two
-                        * steps to ensure that the last byte in step 2 is
-                        * updated last.
-                        */
-                       /* Step 1) DMA: Body Length - 1 */
-                       tx = dev->device_prep_dma_memcpy(chan, dst_dma_addr,
-                                                        src_dma_addr,
-                                                        loop_len - 1,
-                                                        DMA_PREP_FENCE);
-                       if (!tx) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       cookie = tx->tx_submit(tx);
-                       if (dma_submit_error(cookie)) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       src_offset += (loop_len - 1);
-                       dst_offset += (loop_len - 1);
-                       src_dma_addr += (loop_len - 1);
-                       dst_dma_addr += (loop_len - 1);
-                       remaining_len -= (loop_len - 1);
-                       loop_len = remaining_len;
-
-                       /* Step 2) DMA: 1 BYTES */
-                       tx = dev->device_prep_dma_memcpy(chan, dst_dma_addr,
-                                       src_dma_addr, loop_len, 0);
-                       if (!tx) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       cookie = tx->tx_submit(tx);
-                       if (dma_submit_error(cookie)) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       dma_async_issue_pending(chan);
-               } else {
-                       tx = dev->device_prep_dma_memcpy(chan, dst_dma_addr,
-                                       src_dma_addr, loop_len, 0);
-                       if (!tx) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       cookie = tx->tx_submit(tx);
-                       if (dma_submit_error(cookie)) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-               }
-               src_offset += loop_len;
-               dst_offset += loop_len;
-               remaining_len -= loop_len;
-       }
-       return ret;
-err:
-       dev_err(scif_info.mdev.this_device,
-               "%s %d Desc Prog Failed ret %d\n",
-               __func__, __LINE__, ret);
-       return ret;
-}
-
-/*
- * scif_rma_list_dma_copy_aligned:
- *
- * Traverse all the windows and perform DMA copy.
- */
-static int scif_rma_list_dma_copy_aligned(struct scif_copy_work *work,
-                                         struct dma_chan *chan)
-{
-       dma_addr_t src_dma_addr, dst_dma_addr;
-       size_t loop_len, remaining_len, tail_len, src_contig_bytes = 0;
-       size_t dst_contig_bytes = 0;
-       int src_cache_off;
-       s64 end_src_offset, end_dst_offset;
-       struct scif_window_iter src_win_iter;
-       struct scif_window_iter dst_win_iter;
-       void *src_virt, *dst_virt;
-       struct scif_window *src_window = work->src_window;
-       struct scif_window *dst_window = work->dst_window;
-       s64 src_offset = work->src_offset, dst_offset = work->dst_offset;
-       int ret = 0;
-       struct dma_async_tx_descriptor *tx;
-       struct dma_device *dev = chan->device;
-       dma_cookie_t cookie;
-
-       remaining_len = work->len;
-       scif_init_window_iter(src_window, &src_win_iter);
-       scif_init_window_iter(dst_window, &dst_win_iter);
-
-       src_cache_off = src_offset & (L1_CACHE_BYTES - 1);
-       if (src_cache_off != 0) {
-               /* Head */
-               loop_len = L1_CACHE_BYTES - src_cache_off;
-               loop_len = min(loop_len, remaining_len);
-               src_dma_addr = __scif_off_to_dma_addr(src_window, src_offset);
-               dst_dma_addr = __scif_off_to_dma_addr(dst_window, dst_offset);
-               if (src_window->type == SCIF_WINDOW_SELF)
-                       src_virt = _get_local_va(src_offset, src_window,
-                                                loop_len);
-               else
-                       src_virt = ioremap_remote(src_offset, src_window,
-                                                 loop_len,
-                                                 work->remote_dev, NULL);
-               if (!src_virt)
-                       return -ENOMEM;
-               if (dst_window->type == SCIF_WINDOW_SELF)
-                       dst_virt = _get_local_va(dst_offset, dst_window,
-                                                loop_len);
-               else
-                       dst_virt = ioremap_remote(dst_offset, dst_window,
-                                                 loop_len,
-                                                 work->remote_dev, NULL);
-               if (!dst_virt) {
-                       if (src_window->type != SCIF_WINDOW_SELF)
-                               iounmap_remote(src_virt, loop_len, work);
-                       return -ENOMEM;
-               }
-               if (src_window->type == SCIF_WINDOW_SELF)
-                       scif_unaligned_cpy_toio(dst_virt, src_virt, loop_len,
-                                               remaining_len == loop_len ?
-                                               work->ordered : false);
-               else
-                       scif_unaligned_cpy_fromio(dst_virt, src_virt, loop_len,
-                                                 remaining_len == loop_len ?
-                                                 work->ordered : false);
-               if (src_window->type != SCIF_WINDOW_SELF)
-                       iounmap_remote(src_virt, loop_len, work);
-               if (dst_window->type != SCIF_WINDOW_SELF)
-                       iounmap_remote(dst_virt, loop_len, work);
-               src_offset += loop_len;
-               dst_offset += loop_len;
-               remaining_len -= loop_len;
-       }
-
-       end_src_offset = src_window->offset +
-               (src_window->nr_pages << PAGE_SHIFT);
-       end_dst_offset = dst_window->offset +
-               (dst_window->nr_pages << PAGE_SHIFT);
-       tail_len = remaining_len & (L1_CACHE_BYTES - 1);
-       remaining_len -= tail_len;
-       while (remaining_len) {
-               if (src_offset == end_src_offset) {
-                       src_window = list_next_entry(src_window, list);
-                       end_src_offset = src_window->offset +
-                               (src_window->nr_pages << PAGE_SHIFT);
-                       scif_init_window_iter(src_window, &src_win_iter);
-               }
-               if (dst_offset == end_dst_offset) {
-                       dst_window = list_next_entry(dst_window, list);
-                       end_dst_offset = dst_window->offset +
-                               (dst_window->nr_pages << PAGE_SHIFT);
-                       scif_init_window_iter(dst_window, &dst_win_iter);
-               }
-
-               /* compute dma addresses for transfer */
-               src_dma_addr = scif_off_to_dma_addr(src_window, src_offset,
-                                                   &src_contig_bytes,
-                                                   &src_win_iter);
-               dst_dma_addr = scif_off_to_dma_addr(dst_window, dst_offset,
-                                                   &dst_contig_bytes,
-                                                   &dst_win_iter);
-               loop_len = min(src_contig_bytes, dst_contig_bytes);
-               loop_len = min(loop_len, remaining_len);
-               if (work->ordered && !tail_len &&
-                   !(remaining_len - loop_len)) {
-                       /*
-                        * Break up the last chunk of the transfer into two
-                        * steps. if there is no tail to gurantee DMA ordering.
-                        * Passing SCIF_DMA_POLLING inserts a status update
-                        * descriptor in step 1 which acts as a double sided
-                        * synchronization fence for the DMA engine to ensure
-                        * that the last cache line in step 2 is updated last.
-                        */
-                       /* Step 1) DMA: Body Length - L1_CACHE_BYTES. */
-                       tx = dev->device_prep_dma_memcpy(chan, dst_dma_addr,
-                                                        src_dma_addr,
-                                                        loop_len -
-                                                        L1_CACHE_BYTES,
-                                                        DMA_PREP_FENCE);
-                       if (!tx) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       cookie = tx->tx_submit(tx);
-                       if (dma_submit_error(cookie)) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       dma_async_issue_pending(chan);
-                       src_offset += (loop_len - L1_CACHE_BYTES);
-                       dst_offset += (loop_len - L1_CACHE_BYTES);
-                       src_dma_addr += (loop_len - L1_CACHE_BYTES);
-                       dst_dma_addr += (loop_len - L1_CACHE_BYTES);
-                       remaining_len -= (loop_len - L1_CACHE_BYTES);
-                       loop_len = remaining_len;
-
-                       /* Step 2) DMA: L1_CACHE_BYTES */
-                       tx = dev->device_prep_dma_memcpy(chan, dst_dma_addr,
-                                                        src_dma_addr,
-                                                        loop_len, 0);
-                       if (!tx) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       cookie = tx->tx_submit(tx);
-                       if (dma_submit_error(cookie)) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       dma_async_issue_pending(chan);
-               } else {
-                       tx = dev->device_prep_dma_memcpy(chan, dst_dma_addr,
-                                                        src_dma_addr,
-                                                        loop_len, 0);
-                       if (!tx) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       cookie = tx->tx_submit(tx);
-                       if (dma_submit_error(cookie)) {
-                               ret = -ENOMEM;
-                               goto err;
-                       }
-                       dma_async_issue_pending(chan);
-               }
-               src_offset += loop_len;
-               dst_offset += loop_len;
-               remaining_len -= loop_len;
-       }
-       remaining_len = tail_len;
-       if (remaining_len) {
-               loop_len = remaining_len;
-               if (src_offset == end_src_offset)
-                       src_window = list_next_entry(src_window, list);
-               if (dst_offset == end_dst_offset)
-                       dst_window = list_next_entry(dst_window, list);
-
-               src_dma_addr = __scif_off_to_dma_addr(src_window, src_offset);
-               dst_dma_addr = __scif_off_to_dma_addr(dst_window, dst_offset);
-               /*
-                * The CPU copy for the tail bytes must be initiated only once
-                * previous DMA transfers for this endpoint have completed to
-                * guarantee ordering.
-                */
-               if (work->ordered) {
-                       struct scif_dev *rdev = work->remote_dev;
-
-                       ret = scif_drain_dma_poll(rdev->sdev, chan);
-                       if (ret)
-                               return ret;
-               }
-               if (src_window->type == SCIF_WINDOW_SELF)
-                       src_virt = _get_local_va(src_offset, src_window,
-                                                loop_len);
-               else
-                       src_virt = ioremap_remote(src_offset, src_window,
-                                                 loop_len,
-                                                 work->remote_dev, NULL);
-               if (!src_virt)
-                       return -ENOMEM;
-
-               if (dst_window->type == SCIF_WINDOW_SELF)
-                       dst_virt = _get_local_va(dst_offset, dst_window,
-                                                loop_len);
-               else
-                       dst_virt = ioremap_remote(dst_offset, dst_window,
-                                                 loop_len,
-                                                 work->remote_dev, NULL);
-               if (!dst_virt) {
-                       if (src_window->type != SCIF_WINDOW_SELF)
-                               iounmap_remote(src_virt, loop_len, work);
-                       return -ENOMEM;
-               }
-
-               if (src_window->type == SCIF_WINDOW_SELF)
-                       scif_unaligned_cpy_toio(dst_virt, src_virt, loop_len,
-                                               work->ordered);
-               else
-                       scif_unaligned_cpy_fromio(dst_virt, src_virt,
-                                                 loop_len, work->ordered);
-               if (src_window->type != SCIF_WINDOW_SELF)
-                       iounmap_remote(src_virt, loop_len, work);
-
-               if (dst_window->type != SCIF_WINDOW_SELF)
-                       iounmap_remote(dst_virt, loop_len, work);
-               remaining_len -= loop_len;
-       }
-       return ret;
-err:
-       dev_err(scif_info.mdev.this_device,
-               "%s %d Desc Prog Failed ret %d\n",
-               __func__, __LINE__, ret);
-       return ret;
-}
-
-/*
- * scif_rma_list_cpu_copy:
- *
- * Traverse all the windows and perform CPU copy.
- */
-static int scif_rma_list_cpu_copy(struct scif_copy_work *work)
-{
-       void *src_virt, *dst_virt;
-       size_t loop_len, remaining_len;
-       int src_page_off, dst_page_off;
-       s64 src_offset = work->src_offset, dst_offset = work->dst_offset;
-       struct scif_window *src_window = work->src_window;
-       struct scif_window *dst_window = work->dst_window;
-       s64 end_src_offset, end_dst_offset;
-       int ret = 0;
-       struct scif_window_iter src_win_iter;
-       struct scif_window_iter dst_win_iter;
-
-       remaining_len = work->len;
-
-       scif_init_window_iter(src_window, &src_win_iter);
-       scif_init_window_iter(dst_window, &dst_win_iter);
-       while (remaining_len) {
-               src_page_off = src_offset & ~PAGE_MASK;
-               dst_page_off = dst_offset & ~PAGE_MASK;
-               loop_len = min(PAGE_SIZE -
-                              max(src_page_off, dst_page_off),
-                              remaining_len);
-
-               if (src_window->type == SCIF_WINDOW_SELF)
-                       src_virt = _get_local_va(src_offset, src_window,
-                                                loop_len);
-               else
-                       src_virt = ioremap_remote(src_offset, src_window,
-                                                 loop_len,
-                                                 work->remote_dev,
-                                                 &src_win_iter);
-               if (!src_virt) {
-                       ret = -ENOMEM;
-                       goto error;
-               }
-
-               if (dst_window->type == SCIF_WINDOW_SELF)
-                       dst_virt = _get_local_va(dst_offset, dst_window,
-                                                loop_len);
-               else
-                       dst_virt = ioremap_remote(dst_offset, dst_window,
-                                                 loop_len,
-                                                 work->remote_dev,
-                                                 &dst_win_iter);
-               if (!dst_virt) {
-                       if (src_window->type == SCIF_WINDOW_PEER)
-                               iounmap_remote(src_virt, loop_len, work);
-                       ret = -ENOMEM;
-                       goto error;
-               }
-
-               if (work->loopback) {
-                       memcpy(dst_virt, src_virt, loop_len);
-               } else {
-                       if (src_window->type == SCIF_WINDOW_SELF)
-                               memcpy_toio((void __iomem __force *)dst_virt,
-                                           src_virt, loop_len);
-                       else
-                               memcpy_fromio(dst_virt,
-                                             (void __iomem __force *)src_virt,
-                                             loop_len);
-               }
-               if (src_window->type == SCIF_WINDOW_PEER)
-                       iounmap_remote(src_virt, loop_len, work);
-
-               if (dst_window->type == SCIF_WINDOW_PEER)
-                       iounmap_remote(dst_virt, loop_len, work);
-
-               src_offset += loop_len;
-               dst_offset += loop_len;
-               remaining_len -= loop_len;
-               if (remaining_len) {
-                       end_src_offset = src_window->offset +
-                               (src_window->nr_pages << PAGE_SHIFT);
-                       end_dst_offset = dst_window->offset +
-                               (dst_window->nr_pages << PAGE_SHIFT);
-                       if (src_offset == end_src_offset) {
-                               src_window = list_next_entry(src_window, list);
-                               scif_init_window_iter(src_window,
-                                                     &src_win_iter);
-                       }
-                       if (dst_offset == end_dst_offset) {
-                               dst_window = list_next_entry(dst_window, list);
-                               scif_init_window_iter(dst_window,
-                                                     &dst_win_iter);
-                       }
-               }
-       }
-error:
-       return ret;
-}
-
-static int scif_rma_list_dma_copy_wrapper(struct scif_endpt *epd,
-                                         struct scif_copy_work *work,
-                                         struct dma_chan *chan, off_t loffset)
-{
-       int src_cache_off, dst_cache_off;
-       s64 src_offset = work->src_offset, dst_offset = work->dst_offset;
-       u8 *temp = NULL;
-       bool src_local = true;
-       struct scif_dma_comp_cb *comp_cb;
-       int err;
-
-       if (is_dma_copy_aligned(chan->device, 1, 1, 1))
-               return _scif_rma_list_dma_copy_aligned(work, chan);
-
-       src_cache_off = src_offset & (L1_CACHE_BYTES - 1);
-       dst_cache_off = dst_offset & (L1_CACHE_BYTES - 1);
-
-       if (dst_cache_off == src_cache_off)
-               return scif_rma_list_dma_copy_aligned(work, chan);
-
-       if (work->loopback)
-               return scif_rma_list_cpu_copy(work);
-       src_local = work->src_window->type == SCIF_WINDOW_SELF;
-
-       /* Allocate dma_completion cb */
-       comp_cb = kzalloc(sizeof(*comp_cb), GFP_KERNEL);
-       if (!comp_cb)
-               goto error;
-
-       work->comp_cb = comp_cb;
-       comp_cb->cb_cookie = comp_cb;
-       comp_cb->dma_completion_func = &scif_rma_completion_cb;
-
-       if (work->len + (L1_CACHE_BYTES << 1) < SCIF_KMEM_UNALIGNED_BUF_SIZE) {
-               comp_cb->is_cache = false;
-               /* Allocate padding bytes to align to a cache line */
-               temp = kmalloc(work->len + (L1_CACHE_BYTES << 1),
-                              GFP_KERNEL);
-               if (!temp)
-                       goto free_comp_cb;
-               comp_cb->temp_buf_to_free = temp;
-               /* kmalloc(..) does not guarantee cache line alignment */
-               if (!IS_ALIGNED((u64)temp, L1_CACHE_BYTES))
-                       temp = PTR_ALIGN(temp, L1_CACHE_BYTES);
-       } else {
-               comp_cb->is_cache = true;
-               temp = kmem_cache_alloc(unaligned_cache, GFP_KERNEL);
-               if (!temp)
-                       goto free_comp_cb;
-               comp_cb->temp_buf_to_free = temp;
-       }
-
-       if (src_local) {
-               temp += dst_cache_off;
-               scif_rma_local_cpu_copy(work->src_offset, work->src_window,
-                                       temp, work->len, true);
-       } else {
-               comp_cb->dst_window = work->dst_window;
-               comp_cb->dst_offset = work->dst_offset;
-               work->src_offset = work->src_offset - src_cache_off;
-               comp_cb->len = work->len;
-               work->len = ALIGN(work->len + src_cache_off, L1_CACHE_BYTES);
-               comp_cb->header_padding = src_cache_off;
-       }
-       comp_cb->temp_buf = temp;
-
-       err = scif_map_single(&comp_cb->temp_phys, temp,
-                             work->remote_dev, SCIF_KMEM_UNALIGNED_BUF_SIZE);
-       if (err)
-               goto free_temp_buf;
-       comp_cb->sdev = work->remote_dev;
-       if (scif_rma_list_dma_copy_unaligned(work, temp, chan, src_local) < 0)
-               goto free_temp_buf;
-       if (!src_local)
-               work->fence_type = SCIF_DMA_INTR;
-       return 0;
-free_temp_buf:
-       if (comp_cb->is_cache)
-               kmem_cache_free(unaligned_cache, comp_cb->temp_buf_to_free);
-       else
-               kfree(comp_cb->temp_buf_to_free);
-free_comp_cb:
-       kfree(comp_cb);
-error:
-       return -ENOMEM;
-}
-
-/**
- * scif_rma_copy:
- * @epd: end point descriptor.
- * @loffset: offset in local registered address space to/from which to copy
- * @addr: user virtual address to/from which to copy
- * @len: length of range to copy
- * @roffset: offset in remote registered address space to/from which to copy
- * @flags: flags
- * @dir: LOCAL->REMOTE or vice versa.
- * @last_chunk: true if this is the last chunk of a larger transfer
- *
- * Validate parameters, check if src/dst registered ranges requested for copy
- * are valid and initiate either CPU or DMA copy.
- */
-static int scif_rma_copy(scif_epd_t epd, off_t loffset, unsigned long addr,
-                        size_t len, off_t roffset, int flags,
-                        enum scif_rma_dir dir, bool last_chunk)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       struct scif_rma_req remote_req;
-       struct scif_rma_req req;
-       struct scif_window *local_window = NULL;
-       struct scif_window *remote_window = NULL;
-       struct scif_copy_work copy_work;
-       bool loopback;
-       int err = 0;
-       struct dma_chan *chan;
-       struct scif_mmu_notif *mmn = NULL;
-       bool cache = false;
-       struct device *spdev;
-
-       err = scif_verify_epd(ep);
-       if (err)
-               return err;
-
-       if (flags && !(flags & (SCIF_RMA_USECPU | SCIF_RMA_USECACHE |
-                               SCIF_RMA_SYNC | SCIF_RMA_ORDERED)))
-               return -EINVAL;
-
-       loopback = scifdev_self(ep->remote_dev) ? true : false;
-       copy_work.fence_type = ((flags & SCIF_RMA_SYNC) && last_chunk) ?
-                               SCIF_DMA_POLL : 0;
-       copy_work.ordered = !!((flags & SCIF_RMA_ORDERED) && last_chunk);
-
-       /* Use CPU for Mgmt node <-> Mgmt node copies */
-       if (loopback && scif_is_mgmt_node()) {
-               flags |= SCIF_RMA_USECPU;
-               copy_work.fence_type = 0x0;
-       }
-
-       cache = scif_is_set_reg_cache(flags);
-
-       remote_req.out_window = &remote_window;
-       remote_req.offset = roffset;
-       remote_req.nr_bytes = len;
-       /*
-        * If transfer is from local to remote then the remote window
-        * must be writeable and vice versa.
-        */
-       remote_req.prot = dir == SCIF_LOCAL_TO_REMOTE ? VM_WRITE : VM_READ;
-       remote_req.type = SCIF_WINDOW_PARTIAL;
-       remote_req.head = &ep->rma_info.remote_reg_list;
-
-       spdev = scif_get_peer_dev(ep->remote_dev);
-       if (IS_ERR(spdev)) {
-               err = PTR_ERR(spdev);
-               return err;
-       }
-
-       if (addr && cache) {
-               mutex_lock(&ep->rma_info.mmn_lock);
-               mmn = scif_find_mmu_notifier(current->mm, &ep->rma_info);
-               if (!mmn)
-                       mmn = scif_add_mmu_notifier(current->mm, ep);
-               mutex_unlock(&ep->rma_info.mmn_lock);
-               if (IS_ERR(mmn)) {
-                       scif_put_peer_dev(spdev);
-                       return PTR_ERR(mmn);
-               }
-               cache = cache && !scif_rma_tc_can_cache(ep, len);
-       }
-       mutex_lock(&ep->rma_info.rma_lock);
-       if (addr) {
-               req.out_window = &local_window;
-               req.nr_bytes = ALIGN(len + (addr & ~PAGE_MASK),
-                                    PAGE_SIZE);
-               req.va_for_temp = addr & PAGE_MASK;
-               req.prot = (dir == SCIF_LOCAL_TO_REMOTE ?
-                           VM_READ : VM_WRITE | VM_READ);
-               /* Does a valid local window exist? */
-               if (mmn) {
-                       spin_lock(&ep->rma_info.tc_lock);
-                       req.head = &mmn->tc_reg_list;
-                       err = scif_query_tcw(ep, &req);
-                       spin_unlock(&ep->rma_info.tc_lock);
-               }
-               if (!mmn || err) {
-                       err = scif_register_temp(epd, req.va_for_temp,
-                                                req.nr_bytes, req.prot,
-                                                &loffset, &local_window);
-                       if (err) {
-                               mutex_unlock(&ep->rma_info.rma_lock);
-                               goto error;
-                       }
-                       if (!cache)
-                               goto skip_cache;
-                       atomic_inc(&ep->rma_info.tcw_refcount);
-                       atomic_add_return(local_window->nr_pages,
-                                         &ep->rma_info.tcw_total_pages);
-                       if (mmn) {
-                               spin_lock(&ep->rma_info.tc_lock);
-                               scif_insert_tcw(local_window,
-                                               &mmn->tc_reg_list);
-                               spin_unlock(&ep->rma_info.tc_lock);
-                       }
-               }
-skip_cache:
-               loffset = local_window->offset +
-                               (addr - local_window->va_for_temp);
-       } else {
-               req.out_window = &local_window;
-               req.offset = loffset;
-               /*
-                * If transfer is from local to remote then the self window
-                * must be readable and vice versa.
-                */
-               req.prot = dir == SCIF_LOCAL_TO_REMOTE ? VM_READ : VM_WRITE;
-               req.nr_bytes = len;
-               req.type = SCIF_WINDOW_PARTIAL;
-               req.head = &ep->rma_info.reg_list;
-               /* Does a valid local window exist? */
-               err = scif_query_window(&req);
-               if (err) {
-                       mutex_unlock(&ep->rma_info.rma_lock);
-                       goto error;
-               }
-       }
-
-       /* Does a valid remote window exist? */
-       err = scif_query_window(&remote_req);
-       if (err) {
-               mutex_unlock(&ep->rma_info.rma_lock);
-               goto error;
-       }
-
-       /*
-        * Prepare copy_work for submitting work to the DMA kernel thread
-        * or CPU copy routine.
-        */
-       copy_work.len = len;
-       copy_work.loopback = loopback;
-       copy_work.remote_dev = ep->remote_dev;
-       if (dir == SCIF_LOCAL_TO_REMOTE) {
-               copy_work.src_offset = loffset;
-               copy_work.src_window = local_window;
-               copy_work.dst_offset = roffset;
-               copy_work.dst_window = remote_window;
-       } else {
-               copy_work.src_offset = roffset;
-               copy_work.src_window = remote_window;
-               copy_work.dst_offset = loffset;
-               copy_work.dst_window = local_window;
-       }
-
-       if (flags & SCIF_RMA_USECPU) {
-               scif_rma_list_cpu_copy(&copy_work);
-       } else {
-               chan = ep->rma_info.dma_chan;
-               err = scif_rma_list_dma_copy_wrapper(epd, &copy_work,
-                                                    chan, loffset);
-       }
-       if (addr && !cache)
-               atomic_inc(&ep->rma_info.tw_refcount);
-
-       mutex_unlock(&ep->rma_info.rma_lock);
-
-       if (last_chunk) {
-               struct scif_dev *rdev = ep->remote_dev;
-
-               if (copy_work.fence_type == SCIF_DMA_POLL)
-                       err = scif_drain_dma_poll(rdev->sdev,
-                                                 ep->rma_info.dma_chan);
-               else if (copy_work.fence_type == SCIF_DMA_INTR)
-                       err = scif_drain_dma_intr(rdev->sdev,
-                                                 ep->rma_info.dma_chan);
-       }
-
-       if (addr && !cache)
-               scif_queue_for_cleanup(local_window, &scif_info.rma);
-       scif_put_peer_dev(spdev);
-       return err;
-error:
-       if (err) {
-               if (addr && local_window && !cache)
-                       scif_destroy_window(ep, local_window);
-               dev_err(scif_info.mdev.this_device,
-                       "%s %d err %d len 0x%lx\n",
-                       __func__, __LINE__, err, len);
-       }
-       scif_put_peer_dev(spdev);
-       return err;
-}
-
-int scif_readfrom(scif_epd_t epd, off_t loffset, size_t len,
-                 off_t roffset, int flags)
-{
-       int err;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI readfrom: ep %p loffset 0x%lx len 0x%lx offset 0x%lx flags 0x%x\n",
-               epd, loffset, len, roffset, flags);
-       if (scif_unaligned(loffset, roffset)) {
-               while (len > SCIF_MAX_UNALIGNED_BUF_SIZE) {
-                       err = scif_rma_copy(epd, loffset, 0x0,
-                                           SCIF_MAX_UNALIGNED_BUF_SIZE,
-                                           roffset, flags,
-                                           SCIF_REMOTE_TO_LOCAL, false);
-                       if (err)
-                               goto readfrom_err;
-                       loffset += SCIF_MAX_UNALIGNED_BUF_SIZE;
-                       roffset += SCIF_MAX_UNALIGNED_BUF_SIZE;
-                       len -= SCIF_MAX_UNALIGNED_BUF_SIZE;
-               }
-       }
-       err = scif_rma_copy(epd, loffset, 0x0, len,
-                           roffset, flags, SCIF_REMOTE_TO_LOCAL, true);
-readfrom_err:
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_readfrom);
-
-int scif_writeto(scif_epd_t epd, off_t loffset, size_t len,
-                off_t roffset, int flags)
-{
-       int err;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI writeto: ep %p loffset 0x%lx len 0x%lx roffset 0x%lx flags 0x%x\n",
-               epd, loffset, len, roffset, flags);
-       if (scif_unaligned(loffset, roffset)) {
-               while (len > SCIF_MAX_UNALIGNED_BUF_SIZE) {
-                       err = scif_rma_copy(epd, loffset, 0x0,
-                                           SCIF_MAX_UNALIGNED_BUF_SIZE,
-                                           roffset, flags,
-                                           SCIF_LOCAL_TO_REMOTE, false);
-                       if (err)
-                               goto writeto_err;
-                       loffset += SCIF_MAX_UNALIGNED_BUF_SIZE;
-                       roffset += SCIF_MAX_UNALIGNED_BUF_SIZE;
-                       len -= SCIF_MAX_UNALIGNED_BUF_SIZE;
-               }
-       }
-       err = scif_rma_copy(epd, loffset, 0x0, len,
-                           roffset, flags, SCIF_LOCAL_TO_REMOTE, true);
-writeto_err:
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_writeto);
-
-int scif_vreadfrom(scif_epd_t epd, void *addr, size_t len,
-                  off_t roffset, int flags)
-{
-       int err;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI vreadfrom: ep %p addr %p len 0x%lx roffset 0x%lx flags 0x%x\n",
-               epd, addr, len, roffset, flags);
-       if (scif_unaligned((off_t __force)addr, roffset)) {
-               if (len > SCIF_MAX_UNALIGNED_BUF_SIZE)
-                       flags &= ~SCIF_RMA_USECACHE;
-
-               while (len > SCIF_MAX_UNALIGNED_BUF_SIZE) {
-                       err = scif_rma_copy(epd, 0, (u64)addr,
-                                           SCIF_MAX_UNALIGNED_BUF_SIZE,
-                                           roffset, flags,
-                                           SCIF_REMOTE_TO_LOCAL, false);
-                       if (err)
-                               goto vreadfrom_err;
-                       addr += SCIF_MAX_UNALIGNED_BUF_SIZE;
-                       roffset += SCIF_MAX_UNALIGNED_BUF_SIZE;
-                       len -= SCIF_MAX_UNALIGNED_BUF_SIZE;
-               }
-       }
-       err = scif_rma_copy(epd, 0, (u64)addr, len,
-                           roffset, flags, SCIF_REMOTE_TO_LOCAL, true);
-vreadfrom_err:
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_vreadfrom);
-
-int scif_vwriteto(scif_epd_t epd, void *addr, size_t len,
-                 off_t roffset, int flags)
-{
-       int err;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI vwriteto: ep %p addr %p len 0x%lx roffset 0x%lx flags 0x%x\n",
-               epd, addr, len, roffset, flags);
-       if (scif_unaligned((off_t __force)addr, roffset)) {
-               if (len > SCIF_MAX_UNALIGNED_BUF_SIZE)
-                       flags &= ~SCIF_RMA_USECACHE;
-
-               while (len > SCIF_MAX_UNALIGNED_BUF_SIZE) {
-                       err = scif_rma_copy(epd, 0, (u64)addr,
-                                           SCIF_MAX_UNALIGNED_BUF_SIZE,
-                                           roffset, flags,
-                                           SCIF_LOCAL_TO_REMOTE, false);
-                       if (err)
-                               goto vwriteto_err;
-                       addr += SCIF_MAX_UNALIGNED_BUF_SIZE;
-                       roffset += SCIF_MAX_UNALIGNED_BUF_SIZE;
-                       len -= SCIF_MAX_UNALIGNED_BUF_SIZE;
-               }
-       }
-       err = scif_rma_copy(epd, 0, (u64)addr, len,
-                           roffset, flags, SCIF_LOCAL_TO_REMOTE, true);
-vwriteto_err:
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_vwriteto);
diff --git a/drivers/misc/mic/scif/scif_epd.c b/drivers/misc/mic/scif/scif_epd.c
deleted file mode 100644 (file)
index 426687f..0000000
+++ /dev/null
@@ -1,357 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include "scif_main.h"
-#include "scif_map.h"
-
-void scif_cleanup_ep_qp(struct scif_endpt *ep)
-{
-       struct scif_qp *qp = ep->qp_info.qp;
-
-       if (qp->outbound_q.rb_base) {
-               scif_iounmap((void *)qp->outbound_q.rb_base,
-                            qp->outbound_q.size, ep->remote_dev);
-               qp->outbound_q.rb_base = NULL;
-       }
-       if (qp->remote_qp) {
-               scif_iounmap((void *)qp->remote_qp,
-                            sizeof(struct scif_qp), ep->remote_dev);
-               qp->remote_qp = NULL;
-       }
-       if (qp->local_qp) {
-               scif_unmap_single(qp->local_qp, ep->remote_dev,
-                                 sizeof(struct scif_qp));
-               qp->local_qp = 0x0;
-       }
-       if (qp->local_buf) {
-               scif_unmap_single(qp->local_buf, ep->remote_dev,
-                                 SCIF_ENDPT_QP_SIZE);
-               qp->local_buf = 0;
-       }
-}
-
-void scif_teardown_ep(void *endpt)
-{
-       struct scif_endpt *ep = endpt;
-       struct scif_qp *qp = ep->qp_info.qp;
-
-       if (qp) {
-               spin_lock(&ep->lock);
-               scif_cleanup_ep_qp(ep);
-               spin_unlock(&ep->lock);
-               kfree(qp->inbound_q.rb_base);
-               kfree(qp);
-       }
-}
-
-/*
- * Enqueue the endpoint to the zombie list for cleanup.
- * The endpoint should not be accessed once this API returns.
- */
-void scif_add_epd_to_zombie_list(struct scif_endpt *ep, bool eplock_held)
-{
-       if (!eplock_held)
-               mutex_lock(&scif_info.eplock);
-       spin_lock(&ep->lock);
-       ep->state = SCIFEP_ZOMBIE;
-       spin_unlock(&ep->lock);
-       list_add_tail(&ep->list, &scif_info.zombie);
-       scif_info.nr_zombies++;
-       if (!eplock_held)
-               mutex_unlock(&scif_info.eplock);
-       schedule_work(&scif_info.misc_work);
-}
-
-static struct scif_endpt *scif_find_listen_ep(u16 port)
-{
-       struct scif_endpt *ep = NULL;
-       struct list_head *pos, *tmpq;
-
-       mutex_lock(&scif_info.eplock);
-       list_for_each_safe(pos, tmpq, &scif_info.listen) {
-               ep = list_entry(pos, struct scif_endpt, list);
-               if (ep->port.port == port) {
-                       mutex_unlock(&scif_info.eplock);
-                       return ep;
-               }
-       }
-       mutex_unlock(&scif_info.eplock);
-       return NULL;
-}
-
-void scif_cleanup_zombie_epd(void)
-{
-       struct list_head *pos, *tmpq;
-       struct scif_endpt *ep;
-
-       mutex_lock(&scif_info.eplock);
-       list_for_each_safe(pos, tmpq, &scif_info.zombie) {
-               ep = list_entry(pos, struct scif_endpt, list);
-               if (scif_rma_ep_can_uninit(ep)) {
-                       list_del(pos);
-                       scif_info.nr_zombies--;
-                       put_iova_domain(&ep->rma_info.iovad);
-                       kfree(ep);
-               }
-       }
-       mutex_unlock(&scif_info.eplock);
-}
-
-/**
- * scif_cnctreq() - Respond to SCIF_CNCT_REQ interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * This message is initiated by the remote node to request a connection
- * to the local node.  This function looks for an end point in the
- * listen state on the requested port id.
- *
- * If it finds a listening port it places the connect request on the
- * listening end points queue and wakes up any pending accept calls.
- *
- * If it does not find a listening end point it sends a connection
- * reject message to the remote node.
- */
-void scif_cnctreq(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = NULL;
-       struct scif_conreq *conreq;
-
-       conreq = kmalloc(sizeof(*conreq), GFP_KERNEL);
-       if (!conreq)
-               /* Lack of resources so reject the request. */
-               goto conreq_sendrej;
-
-       ep = scif_find_listen_ep(msg->dst.port);
-       if (!ep)
-               /*  Send reject due to no listening ports */
-               goto conreq_sendrej_free;
-       else
-               spin_lock(&ep->lock);
-
-       if (ep->backlog <= ep->conreqcnt) {
-               /*  Send reject due to too many pending requests */
-               spin_unlock(&ep->lock);
-               goto conreq_sendrej_free;
-       }
-
-       conreq->msg = *msg;
-       list_add_tail(&conreq->list, &ep->conlist);
-       ep->conreqcnt++;
-       wake_up_interruptible(&ep->conwq);
-       spin_unlock(&ep->lock);
-       return;
-
-conreq_sendrej_free:
-       kfree(conreq);
-conreq_sendrej:
-       msg->uop = SCIF_CNCT_REJ;
-       scif_nodeqp_send(&scif_dev[msg->src.node], msg);
-}
-
-/**
- * scif_cnctgnt() - Respond to SCIF_CNCT_GNT interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * An accept() on the remote node has occurred and sent this message
- * to indicate success.  Place the end point in the MAPPING state and
- * save the remote nodes memory information.  Then wake up the connect
- * request so it can finish.
- */
-void scif_cnctgnt(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-
-       spin_lock(&ep->lock);
-       if (SCIFEP_CONNECTING == ep->state) {
-               ep->peer.node = msg->src.node;
-               ep->peer.port = msg->src.port;
-               ep->qp_info.gnt_pld = msg->payload[1];
-               ep->remote_ep = msg->payload[2];
-               ep->state = SCIFEP_MAPPING;
-
-               wake_up(&ep->conwq);
-       }
-       spin_unlock(&ep->lock);
-}
-
-/**
- * scif_cnctgnt_ack() - Respond to SCIF_CNCT_GNTACK interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * The remote connection request has finished mapping the local memory.
- * Place the connection in the connected state and wake up the pending
- * accept() call.
- */
-void scif_cnctgnt_ack(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-
-       mutex_lock(&scif_info.connlock);
-       spin_lock(&ep->lock);
-       /* New ep is now connected with all resources set. */
-       ep->state = SCIFEP_CONNECTED;
-       list_add_tail(&ep->list, &scif_info.connected);
-       wake_up(&ep->conwq);
-       spin_unlock(&ep->lock);
-       mutex_unlock(&scif_info.connlock);
-}
-
-/**
- * scif_cnctgnt_nack() - Respond to SCIF_CNCT_GNTNACK interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * The remote connection request failed to map the local memory it was sent.
- * Place the end point in the CLOSING state to indicate it and wake up
- * the pending accept();
- */
-void scif_cnctgnt_nack(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-
-       spin_lock(&ep->lock);
-       ep->state = SCIFEP_CLOSING;
-       wake_up(&ep->conwq);
-       spin_unlock(&ep->lock);
-}
-
-/**
- * scif_cnctrej() - Respond to SCIF_CNCT_REJ interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * The remote end has rejected the connection request.  Set the end
- * point back to the bound state and wake up the pending connect().
- */
-void scif_cnctrej(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-
-       spin_lock(&ep->lock);
-       if (SCIFEP_CONNECTING == ep->state) {
-               ep->state = SCIFEP_BOUND;
-               wake_up(&ep->conwq);
-       }
-       spin_unlock(&ep->lock);
-}
-
-/**
- * scif_discnct() - Respond to SCIF_DISCNCT interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * The remote node has indicated close() has been called on its end
- * point.  Remove the local end point from the connected list, set its
- * state to disconnected and ensure accesses to the remote node are
- * shutdown.
- *
- * When all accesses to the remote end have completed then send a
- * DISCNT_ACK to indicate it can remove its resources and complete
- * the close routine.
- */
-void scif_discnct(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = NULL;
-       struct scif_endpt *tmpep;
-       struct list_head *pos, *tmpq;
-
-       mutex_lock(&scif_info.connlock);
-       list_for_each_safe(pos, tmpq, &scif_info.connected) {
-               tmpep = list_entry(pos, struct scif_endpt, list);
-               /*
-                * The local ep may have sent a disconnect and and been closed
-                * due to a message response time out. It may have been
-                * allocated again and formed a new connection so we want to
-                * check if the remote ep matches
-                */
-               if (((u64)tmpep == msg->payload[1]) &&
-                   ((u64)tmpep->remote_ep == msg->payload[0])) {
-                       list_del(pos);
-                       ep = tmpep;
-                       spin_lock(&ep->lock);
-                       break;
-               }
-       }
-
-       /*
-        * If the terminated end is not found then this side started closing
-        * before the other side sent the disconnect.  If so the ep will no
-        * longer be on the connected list.  Regardless the other side
-        * needs to be acked to let it know close is complete.
-        */
-       if (!ep) {
-               mutex_unlock(&scif_info.connlock);
-               goto discnct_ack;
-       }
-
-       ep->state = SCIFEP_DISCONNECTED;
-       list_add_tail(&ep->list, &scif_info.disconnected);
-
-       wake_up_interruptible(&ep->sendwq);
-       wake_up_interruptible(&ep->recvwq);
-       spin_unlock(&ep->lock);
-       mutex_unlock(&scif_info.connlock);
-
-discnct_ack:
-       msg->uop = SCIF_DISCNT_ACK;
-       scif_nodeqp_send(&scif_dev[msg->src.node], msg);
-}
-
-/**
- * scif_discnct_ack() - Respond to SCIF_DISCNT_ACK interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * Remote side has indicated it has not more references to local resources
- */
-void scif_discnt_ack(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-
-       spin_lock(&ep->lock);
-       ep->state = SCIFEP_DISCONNECTED;
-       spin_unlock(&ep->lock);
-       complete(&ep->discon);
-}
-
-/**
- * scif_clientsend() - Respond to SCIF_CLIENT_SEND interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * Remote side is confirming send or receive interrupt handling is complete.
- */
-void scif_clientsend(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-
-       spin_lock(&ep->lock);
-       if (SCIFEP_CONNECTED == ep->state)
-               wake_up_interruptible(&ep->recvwq);
-       spin_unlock(&ep->lock);
-}
-
-/**
- * scif_clientrcvd() - Respond to SCIF_CLIENT_RCVD interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * Remote side is confirming send or receive interrupt handling is complete.
- */
-void scif_clientrcvd(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-
-       spin_lock(&ep->lock);
-       if (SCIFEP_CONNECTED == ep->state)
-               wake_up_interruptible(&ep->sendwq);
-       spin_unlock(&ep->lock);
-}
diff --git a/drivers/misc/mic/scif/scif_epd.h b/drivers/misc/mic/scif/scif_epd.h
deleted file mode 100644 (file)
index 0b9dfe1..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#ifndef SCIF_EPD_H
-#define SCIF_EPD_H
-
-#include <linux/delay.h>
-#include <linux/scif.h>
-#include <linux/scif_ioctl.h>
-
-#define SCIF_EPLOCK_HELD true
-
-enum scif_epd_state {
-       SCIFEP_UNBOUND,
-       SCIFEP_BOUND,
-       SCIFEP_LISTENING,
-       SCIFEP_CONNECTED,
-       SCIFEP_CONNECTING,
-       SCIFEP_MAPPING,
-       SCIFEP_CLOSING,
-       SCIFEP_CLLISTEN,
-       SCIFEP_DISCONNECTED,
-       SCIFEP_ZOMBIE
-};
-
-/*
- * struct scif_conreq - Data structure added to the connection list.
- *
- * @msg: connection request message received
- * @list: link to list of connection requests
- */
-struct scif_conreq {
-       struct scifmsg msg;
-       struct list_head list;
-};
-
-/* Size of the RB for the Endpoint QP */
-#define SCIF_ENDPT_QP_SIZE 0x1000
-
-/*
- * scif_endpt_qp_info - SCIF endpoint queue pair
- *
- * @qp - Qpair for this endpoint
- * @qp_offset - DMA address of the QP
- * @gnt_pld - Payload in a SCIF_CNCT_GNT message containing the
- * physical address of the remote_qp.
- */
-struct scif_endpt_qp_info {
-       struct scif_qp *qp;
-       dma_addr_t qp_offset;
-       dma_addr_t gnt_pld;
-};
-
-/*
- * struct scif_endpt - The SCIF endpoint data structure
- *
- * @state: end point state
- * @lock: lock synchronizing access to endpoint fields like state etc
- * @port: self port information
- * @peer: peer port information
- * @backlog: maximum pending connection requests
- * @qp_info: Endpoint QP information for SCIF messaging
- * @remote_dev: scifdev used by this endpt to communicate with remote node.
- * @remote_ep: remote endpoint
- * @conreqcnt: Keep track of number of connection requests.
- * @files: Open file information used to match the id passed in with
- *         the flush routine.
- * @conlist: list of connection requests
- * @conwq: waitqueue for connection processing
- * @discon: completion used during disconnection
- * @sendwq: waitqueue used during sending messages
- * @recvwq: waitqueue used during message receipt
- * @sendlock: Synchronize ordering of messages sent
- * @recvlock: Synchronize ordering of messages received
- * @list: link to list of various endpoints like connected, listening etc
- * @li_accept: pending ACCEPTREG
- * @acceptcnt: pending ACCEPTREG cnt
- * @liacceptlist: link to listen accept
- * @miacceptlist: link to uaccept
- * @listenep: associated listen ep
- * @conn_work: Non blocking connect work
- * @conn_port: Connection port
- * @conn_err: Errors during connection
- * @conn_async_state: Async connection
- * @conn_pend_wq: Used by poll while waiting for incoming connections
- * @conn_list: List of async connection requests
- * @rma_info: Information for triggering SCIF RMA and DMA operations
- * @mmu_list: link to list of MMU notifier cleanup work
- * @anon: anonymous file for use in kernel mode scif poll
- */
-struct scif_endpt {
-       enum scif_epd_state state;
-       spinlock_t lock;
-       struct scif_port_id port;
-       struct scif_port_id peer;
-       int backlog;
-       struct scif_endpt_qp_info qp_info;
-       struct scif_dev *remote_dev;
-       u64 remote_ep;
-       int conreqcnt;
-       struct files_struct *files;
-       struct list_head conlist;
-       wait_queue_head_t conwq;
-       struct completion discon;
-       wait_queue_head_t sendwq;
-       wait_queue_head_t recvwq;
-       struct mutex sendlock;
-       struct mutex recvlock;
-       struct list_head list;
-       struct list_head li_accept;
-       int acceptcnt;
-       struct list_head liacceptlist;
-       struct list_head miacceptlist;
-       struct scif_endpt *listenep;
-       struct scif_port_id conn_port;
-       int conn_err;
-       int conn_async_state;
-       wait_queue_head_t conn_pend_wq;
-       struct list_head conn_list;
-       struct scif_endpt_rma_info rma_info;
-       struct list_head mmu_list;
-       struct file *anon;
-};
-
-static inline int scifdev_alive(struct scif_endpt *ep)
-{
-       return _scifdev_alive(ep->remote_dev);
-}
-
-/*
- * scif_verify_epd:
- * ep: SCIF endpoint
- *
- * Checks several generic error conditions and returns the
- * appropriate error.
- */
-static inline int scif_verify_epd(struct scif_endpt *ep)
-{
-       if (ep->state == SCIFEP_DISCONNECTED)
-               return -ECONNRESET;
-
-       if (ep->state != SCIFEP_CONNECTED)
-               return -ENOTCONN;
-
-       if (!scifdev_alive(ep))
-               return -ENODEV;
-
-       return 0;
-}
-
-static inline int scif_anon_inode_getfile(scif_epd_t epd)
-{
-       epd->anon = anon_inode_getfile("scif", &scif_anon_fops, NULL, 0);
-
-       return PTR_ERR_OR_ZERO(epd->anon);
-}
-
-static inline void scif_anon_inode_fput(scif_epd_t epd)
-{
-       if (epd->anon) {
-               fput(epd->anon);
-               epd->anon = NULL;
-       }
-}
-
-void scif_cleanup_zombie_epd(void);
-void scif_teardown_ep(void *endpt);
-void scif_cleanup_ep_qp(struct scif_endpt *ep);
-void scif_add_epd_to_zombie_list(struct scif_endpt *ep, bool eplock_held);
-void scif_get_node_info(void);
-void scif_send_acks(struct scif_dev *dev);
-void scif_conn_handler(struct work_struct *work);
-int scif_rsrv_port(u16 port);
-void scif_get_port(u16 port);
-int scif_get_new_port(void);
-void scif_put_port(u16 port);
-int scif_user_send(scif_epd_t epd, void __user *msg, int len, int flags);
-int scif_user_recv(scif_epd_t epd, void __user *msg, int len, int flags);
-void scif_cnctreq(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_cnctgnt(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_cnctgnt_ack(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_cnctgnt_nack(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_cnctrej(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_discnct(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_discnt_ack(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_clientsend(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_clientrcvd(struct scif_dev *scifdev, struct scifmsg *msg);
-int __scif_connect(scif_epd_t epd, struct scif_port_id *dst, bool non_block);
-int __scif_flush(scif_epd_t epd);
-int scif_mmap(struct vm_area_struct *vma, scif_epd_t epd);
-__poll_t __scif_pollfd(struct file *f, poll_table *wait,
-                          struct scif_endpt *ep);
-int __scif_pin_pages(void *addr, size_t len, int *out_prot,
-                    int map_flags, scif_pinned_pages_t *pages);
-#endif /* SCIF_EPD_H */
diff --git a/drivers/misc/mic/scif/scif_fd.c b/drivers/misc/mic/scif/scif_fd.c
deleted file mode 100644 (file)
index 3f08646..0000000
+++ /dev/null
@@ -1,462 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include "scif_main.h"
-
-static int scif_fdopen(struct inode *inode, struct file *f)
-{
-       struct scif_endpt *priv = scif_open();
-
-       if (!priv)
-               return -ENOMEM;
-       f->private_data = priv;
-       return 0;
-}
-
-static int scif_fdclose(struct inode *inode, struct file *f)
-{
-       struct scif_endpt *priv = f->private_data;
-
-       return scif_close(priv);
-}
-
-static int scif_fdmmap(struct file *f, struct vm_area_struct *vma)
-{
-       struct scif_endpt *priv = f->private_data;
-
-       return scif_mmap(vma, priv);
-}
-
-static __poll_t scif_fdpoll(struct file *f, poll_table *wait)
-{
-       struct scif_endpt *priv = f->private_data;
-
-       return __scif_pollfd(f, wait, priv);
-}
-
-static int scif_fdflush(struct file *f, fl_owner_t id)
-{
-       struct scif_endpt *ep = f->private_data;
-
-       spin_lock(&ep->lock);
-       /*
-        * The listening endpoint stashes the open file information before
-        * waiting for incoming connections. The release callback would never be
-        * called if the application closed the endpoint, while waiting for
-        * incoming connections from a separate thread since the file descriptor
-        * reference count is bumped up in the accept IOCTL. Call the flush
-        * routine if the id matches the endpoint open file information so that
-        * the listening endpoint can be woken up and the fd released.
-        */
-       if (ep->files == id)
-               __scif_flush(ep);
-       spin_unlock(&ep->lock);
-       return 0;
-}
-
-static __always_inline void scif_err_debug(int err, const char *str)
-{
-       /*
-        * ENOTCONN is a common uninteresting error which is
-        * flooding debug messages to the console unnecessarily.
-        */
-       if (err < 0 && err != -ENOTCONN)
-               dev_dbg(scif_info.mdev.this_device, "%s err %d\n", str, err);
-}
-
-static long scif_fdioctl(struct file *f, unsigned int cmd, unsigned long arg)
-{
-       struct scif_endpt *priv = f->private_data;
-       void __user *argp = (void __user *)arg;
-       int err = 0;
-       struct scifioctl_msg request;
-       bool non_block = false;
-
-       non_block = !!(f->f_flags & O_NONBLOCK);
-
-       switch (cmd) {
-       case SCIF_BIND:
-       {
-               int pn;
-
-               if (copy_from_user(&pn, argp, sizeof(pn)))
-                       return -EFAULT;
-
-               pn = scif_bind(priv, pn);
-               if (pn < 0)
-                       return pn;
-
-               if (copy_to_user(argp, &pn, sizeof(pn)))
-                       return -EFAULT;
-
-               return 0;
-       }
-       case SCIF_LISTEN:
-               return scif_listen(priv, arg);
-       case SCIF_CONNECT:
-       {
-               struct scifioctl_connect req;
-               struct scif_endpt *ep = (struct scif_endpt *)priv;
-
-               if (copy_from_user(&req, argp, sizeof(req)))
-                       return -EFAULT;
-
-               err = __scif_connect(priv, &req.peer, non_block);
-               if (err < 0)
-                       return err;
-
-               req.self.node = ep->port.node;
-               req.self.port = ep->port.port;
-
-               if (copy_to_user(argp, &req, sizeof(req)))
-                       return -EFAULT;
-
-               return 0;
-       }
-       /*
-        * Accept is done in two halves.  The request ioctl does the basic
-        * functionality of accepting the request and returning the information
-        * about it including the internal ID of the end point.  The register
-        * is done with the internal ID on a new file descriptor opened by the
-        * requesting process.
-        */
-       case SCIF_ACCEPTREQ:
-       {
-               struct scifioctl_accept request;
-               scif_epd_t *ep = (scif_epd_t *)&request.endpt;
-
-               if (copy_from_user(&request, argp, sizeof(request)))
-                       return -EFAULT;
-
-               err = scif_accept(priv, &request.peer, ep, request.flags);
-               if (err < 0)
-                       return err;
-
-               if (copy_to_user(argp, &request, sizeof(request))) {
-                       scif_close(*ep);
-                       return -EFAULT;
-               }
-               /*
-                * Add to the list of user mode eps where the second half
-                * of the accept is not yet completed.
-                */
-               mutex_lock(&scif_info.eplock);
-               list_add_tail(&((*ep)->miacceptlist), &scif_info.uaccept);
-               list_add_tail(&((*ep)->liacceptlist), &priv->li_accept);
-               (*ep)->listenep = priv;
-               priv->acceptcnt++;
-               mutex_unlock(&scif_info.eplock);
-
-               return 0;
-       }
-       case SCIF_ACCEPTREG:
-       {
-               struct scif_endpt *priv = f->private_data;
-               struct scif_endpt *newep;
-               struct scif_endpt *lisep;
-               struct scif_endpt *fep = NULL;
-               struct scif_endpt *tmpep;
-               struct list_head *pos, *tmpq;
-
-               /* Finally replace the pointer to the accepted endpoint */
-               if (copy_from_user(&newep, argp, sizeof(void *)))
-                       return -EFAULT;
-
-               /* Remove form the user accept queue */
-               mutex_lock(&scif_info.eplock);
-               list_for_each_safe(pos, tmpq, &scif_info.uaccept) {
-                       tmpep = list_entry(pos,
-                                          struct scif_endpt, miacceptlist);
-                       if (tmpep == newep) {
-                               list_del(pos);
-                               fep = tmpep;
-                               break;
-                       }
-               }
-
-               if (!fep) {
-                       mutex_unlock(&scif_info.eplock);
-                       return -ENOENT;
-               }
-
-               lisep = newep->listenep;
-               list_for_each_safe(pos, tmpq, &lisep->li_accept) {
-                       tmpep = list_entry(pos,
-                                          struct scif_endpt, liacceptlist);
-                       if (tmpep == newep) {
-                               list_del(pos);
-                               lisep->acceptcnt--;
-                               break;
-                       }
-               }
-
-               mutex_unlock(&scif_info.eplock);
-
-               /* Free the resources automatically created from the open. */
-               scif_anon_inode_fput(priv);
-               scif_teardown_ep(priv);
-               scif_add_epd_to_zombie_list(priv, !SCIF_EPLOCK_HELD);
-               f->private_data = newep;
-               return 0;
-       }
-       case SCIF_SEND:
-       {
-               struct scif_endpt *priv = f->private_data;
-
-               if (copy_from_user(&request, argp,
-                                  sizeof(struct scifioctl_msg))) {
-                       err = -EFAULT;
-                       goto send_err;
-               }
-               err = scif_user_send(priv, (void __user *)request.msg,
-                                    request.len, request.flags);
-               if (err < 0)
-                       goto send_err;
-               if (copy_to_user(&
-                                ((struct scifioctl_msg __user *)argp)->out_len,
-                                &err, sizeof(err))) {
-                       err = -EFAULT;
-                       goto send_err;
-               }
-               err = 0;
-send_err:
-               scif_err_debug(err, "scif_send");
-               return err;
-       }
-       case SCIF_RECV:
-       {
-               struct scif_endpt *priv = f->private_data;
-
-               if (copy_from_user(&request, argp,
-                                  sizeof(struct scifioctl_msg))) {
-                       err = -EFAULT;
-                       goto recv_err;
-               }
-
-               err = scif_user_recv(priv, (void __user *)request.msg,
-                                    request.len, request.flags);
-               if (err < 0)
-                       goto recv_err;
-
-               if (copy_to_user(&
-                                ((struct scifioctl_msg __user *)argp)->out_len,
-                       &err, sizeof(err))) {
-                       err = -EFAULT;
-                       goto recv_err;
-               }
-               err = 0;
-recv_err:
-               scif_err_debug(err, "scif_recv");
-               return err;
-       }
-       case SCIF_GET_NODEIDS:
-       {
-               struct scifioctl_node_ids node_ids;
-               int entries;
-               u16 *nodes;
-               void __user *unodes, *uself;
-               u16 self;
-
-               if (copy_from_user(&node_ids, argp, sizeof(node_ids))) {
-                       err = -EFAULT;
-                       goto getnodes_err2;
-               }
-
-               entries = min_t(int, scif_info.maxid, node_ids.len);
-               nodes = kmalloc_array(entries, sizeof(u16), GFP_KERNEL);
-               if (entries && !nodes) {
-                       err = -ENOMEM;
-                       goto getnodes_err2;
-               }
-               node_ids.len = scif_get_node_ids(nodes, entries, &self);
-
-               unodes = (void __user *)node_ids.nodes;
-               if (copy_to_user(unodes, nodes, sizeof(u16) * entries)) {
-                       err = -EFAULT;
-                       goto getnodes_err1;
-               }
-
-               uself = (void __user *)node_ids.self;
-               if (copy_to_user(uself, &self, sizeof(u16))) {
-                       err = -EFAULT;
-                       goto getnodes_err1;
-               }
-
-               if (copy_to_user(argp, &node_ids, sizeof(node_ids))) {
-                       err = -EFAULT;
-                       goto getnodes_err1;
-               }
-getnodes_err1:
-               kfree(nodes);
-getnodes_err2:
-               return err;
-       }
-       case SCIF_REG:
-       {
-               struct scif_endpt *priv = f->private_data;
-               struct scifioctl_reg reg;
-               off_t ret;
-
-               if (copy_from_user(&reg, argp, sizeof(reg))) {
-                       err = -EFAULT;
-                       goto reg_err;
-               }
-               if (reg.flags & SCIF_MAP_KERNEL) {
-                       err = -EINVAL;
-                       goto reg_err;
-               }
-               ret = scif_register(priv, (void *)reg.addr, reg.len,
-                                   reg.offset, reg.prot, reg.flags);
-               if (ret < 0) {
-                       err = (int)ret;
-                       goto reg_err;
-               }
-
-               if (copy_to_user(&((struct scifioctl_reg __user *)argp)
-                                ->out_offset, &ret, sizeof(reg.out_offset))) {
-                       err = -EFAULT;
-                       goto reg_err;
-               }
-               err = 0;
-reg_err:
-               scif_err_debug(err, "scif_register");
-               return err;
-       }
-       case SCIF_UNREG:
-       {
-               struct scif_endpt *priv = f->private_data;
-               struct scifioctl_unreg unreg;
-
-               if (copy_from_user(&unreg, argp, sizeof(unreg))) {
-                       err = -EFAULT;
-                       goto unreg_err;
-               }
-               err = scif_unregister(priv, unreg.offset, unreg.len);
-unreg_err:
-               scif_err_debug(err, "scif_unregister");
-               return err;
-       }
-       case SCIF_READFROM:
-       {
-               struct scif_endpt *priv = f->private_data;
-               struct scifioctl_copy copy;
-
-               if (copy_from_user(&copy, argp, sizeof(copy))) {
-                       err = -EFAULT;
-                       goto readfrom_err;
-               }
-               err = scif_readfrom(priv, copy.loffset, copy.len, copy.roffset,
-                                   copy.flags);
-readfrom_err:
-               scif_err_debug(err, "scif_readfrom");
-               return err;
-       }
-       case SCIF_WRITETO:
-       {
-               struct scif_endpt *priv = f->private_data;
-               struct scifioctl_copy copy;
-
-               if (copy_from_user(&copy, argp, sizeof(copy))) {
-                       err = -EFAULT;
-                       goto writeto_err;
-               }
-               err = scif_writeto(priv, copy.loffset, copy.len, copy.roffset,
-                                  copy.flags);
-writeto_err:
-               scif_err_debug(err, "scif_writeto");
-               return err;
-       }
-       case SCIF_VREADFROM:
-       {
-               struct scif_endpt *priv = f->private_data;
-               struct scifioctl_copy copy;
-
-               if (copy_from_user(&copy, argp, sizeof(copy))) {
-                       err = -EFAULT;
-                       goto vreadfrom_err;
-               }
-               err = scif_vreadfrom(priv, (void __force *)copy.addr, copy.len,
-                                    copy.roffset, copy.flags);
-vreadfrom_err:
-               scif_err_debug(err, "scif_vreadfrom");
-               return err;
-       }
-       case SCIF_VWRITETO:
-       {
-               struct scif_endpt *priv = f->private_data;
-               struct scifioctl_copy copy;
-
-               if (copy_from_user(&copy, argp, sizeof(copy))) {
-                       err = -EFAULT;
-                       goto vwriteto_err;
-               }
-               err = scif_vwriteto(priv, (void __force *)copy.addr, copy.len,
-                                   copy.roffset, copy.flags);
-vwriteto_err:
-               scif_err_debug(err, "scif_vwriteto");
-               return err;
-       }
-       case SCIF_FENCE_MARK:
-       {
-               struct scif_endpt *priv = f->private_data;
-               struct scifioctl_fence_mark mark;
-               int tmp_mark = 0;
-
-               if (copy_from_user(&mark, argp, sizeof(mark))) {
-                       err = -EFAULT;
-                       goto fence_mark_err;
-               }
-               err = scif_fence_mark(priv, mark.flags, &tmp_mark);
-               if (err)
-                       goto fence_mark_err;
-               if (copy_to_user((void __user *)mark.mark, &tmp_mark,
-                                sizeof(tmp_mark))) {
-                       err = -EFAULT;
-                       goto fence_mark_err;
-               }
-fence_mark_err:
-               scif_err_debug(err, "scif_fence_mark");
-               return err;
-       }
-       case SCIF_FENCE_WAIT:
-       {
-               struct scif_endpt *priv = f->private_data;
-
-               err = scif_fence_wait(priv, arg);
-               scif_err_debug(err, "scif_fence_wait");
-               return err;
-       }
-       case SCIF_FENCE_SIGNAL:
-       {
-               struct scif_endpt *priv = f->private_data;
-               struct scifioctl_fence_signal signal;
-
-               if (copy_from_user(&signal, argp, sizeof(signal))) {
-                       err = -EFAULT;
-                       goto fence_signal_err;
-               }
-
-               err = scif_fence_signal(priv, signal.loff, signal.lval,
-                                       signal.roff, signal.rval, signal.flags);
-fence_signal_err:
-               scif_err_debug(err, "scif_fence_signal");
-               return err;
-       }
-       }
-       return -EINVAL;
-}
-
-const struct file_operations scif_fops = {
-       .open = scif_fdopen,
-       .release = scif_fdclose,
-       .unlocked_ioctl = scif_fdioctl,
-       .mmap = scif_fdmmap,
-       .poll = scif_fdpoll,
-       .flush = scif_fdflush,
-       .owner = THIS_MODULE,
-};
diff --git a/drivers/misc/mic/scif/scif_fence.c b/drivers/misc/mic/scif/scif_fence.c
deleted file mode 100644 (file)
index 4fedf61..0000000
+++ /dev/null
@@ -1,783 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-
-#include "scif_main.h"
-
-/**
- * scif_recv_mark: Handle SCIF_MARK request
- * @scifdev:   SCIF device
- * @msg:       Interrupt message
- *
- * The peer has requested a mark.
- */
-void scif_recv_mark(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-       int mark = 0;
-       int err;
-
-       err = _scif_fence_mark(ep, &mark);
-       if (err)
-               msg->uop = SCIF_MARK_NACK;
-       else
-               msg->uop = SCIF_MARK_ACK;
-       msg->payload[0] = ep->remote_ep;
-       msg->payload[2] = mark;
-       scif_nodeqp_send(ep->remote_dev, msg);
-}
-
-/**
- * scif_recv_mark_resp: Handle SCIF_MARK_(N)ACK messages.
- * @scifdev:   SCIF device
- * @msg:       Interrupt message
- *
- * The peer has responded to a SCIF_MARK message.
- */
-void scif_recv_mark_resp(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-       struct scif_fence_info *fence_req =
-               (struct scif_fence_info *)msg->payload[1];
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       if (msg->uop == SCIF_MARK_ACK) {
-               fence_req->state = OP_COMPLETED;
-               fence_req->dma_mark = (int)msg->payload[2];
-       } else {
-               fence_req->state = OP_FAILED;
-       }
-       mutex_unlock(&ep->rma_info.rma_lock);
-       complete(&fence_req->comp);
-}
-
-/**
- * scif_recv_wait: Handle SCIF_WAIT request
- * @scifdev:   SCIF device
- * @msg:       Interrupt message
- *
- * The peer has requested waiting on a fence.
- */
-void scif_recv_wait(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-       struct scif_remote_fence_info *fence;
-
-       /*
-        * Allocate structure for remote fence information and
-        * send a NACK if the allocation failed. The peer will
-        * return ENOMEM upon receiving a NACK.
-        */
-       fence = kmalloc(sizeof(*fence), GFP_KERNEL);
-       if (!fence) {
-               msg->payload[0] = ep->remote_ep;
-               msg->uop = SCIF_WAIT_NACK;
-               scif_nodeqp_send(ep->remote_dev, msg);
-               return;
-       }
-
-       /* Prepare the fence request */
-       memcpy(&fence->msg, msg, sizeof(struct scifmsg));
-       INIT_LIST_HEAD(&fence->list);
-
-       /* Insert to the global remote fence request list */
-       mutex_lock(&scif_info.fencelock);
-       atomic_inc(&ep->rma_info.fence_refcount);
-       list_add_tail(&fence->list, &scif_info.fence);
-       mutex_unlock(&scif_info.fencelock);
-
-       schedule_work(&scif_info.misc_work);
-}
-
-/**
- * scif_recv_wait_resp: Handle SCIF_WAIT_(N)ACK messages.
- * @scifdev:   SCIF device
- * @msg:       Interrupt message
- *
- * The peer has responded to a SCIF_WAIT message.
- */
-void scif_recv_wait_resp(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-       struct scif_fence_info *fence_req =
-               (struct scif_fence_info *)msg->payload[1];
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       if (msg->uop == SCIF_WAIT_ACK)
-               fence_req->state = OP_COMPLETED;
-       else
-               fence_req->state = OP_FAILED;
-       mutex_unlock(&ep->rma_info.rma_lock);
-       complete(&fence_req->comp);
-}
-
-/**
- * scif_recv_sig_local: Handle SCIF_SIG_LOCAL request
- * @scifdev:   SCIF device
- * @msg:       Interrupt message
- *
- * The peer has requested a signal on a local offset.
- */
-void scif_recv_sig_local(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-       int err;
-
-       err = scif_prog_signal(ep, msg->payload[1], msg->payload[2],
-                              SCIF_WINDOW_SELF);
-       if (err)
-               msg->uop = SCIF_SIG_NACK;
-       else
-               msg->uop = SCIF_SIG_ACK;
-       msg->payload[0] = ep->remote_ep;
-       scif_nodeqp_send(ep->remote_dev, msg);
-}
-
-/**
- * scif_recv_sig_remote: Handle SCIF_SIGNAL_REMOTE request
- * @scifdev:   SCIF device
- * @msg:       Interrupt message
- *
- * The peer has requested a signal on a remote offset.
- */
-void scif_recv_sig_remote(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-       int err;
-
-       err = scif_prog_signal(ep, msg->payload[1], msg->payload[2],
-                              SCIF_WINDOW_PEER);
-       if (err)
-               msg->uop = SCIF_SIG_NACK;
-       else
-               msg->uop = SCIF_SIG_ACK;
-       msg->payload[0] = ep->remote_ep;
-       scif_nodeqp_send(ep->remote_dev, msg);
-}
-
-/**
- * scif_recv_sig_resp: Handle SCIF_SIG_(N)ACK messages.
- * @scifdev:   SCIF device
- * @msg:       Interrupt message
- *
- * The peer has responded to a signal request.
- */
-void scif_recv_sig_resp(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-       struct scif_fence_info *fence_req =
-               (struct scif_fence_info *)msg->payload[3];
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       if (msg->uop == SCIF_SIG_ACK)
-               fence_req->state = OP_COMPLETED;
-       else
-               fence_req->state = OP_FAILED;
-       mutex_unlock(&ep->rma_info.rma_lock);
-       complete(&fence_req->comp);
-}
-
-static inline void *scif_get_local_va(off_t off, struct scif_window *window)
-{
-       struct page **pages = window->pinned_pages->pages;
-       int page_nr = (off - window->offset) >> PAGE_SHIFT;
-       off_t page_off = off & ~PAGE_MASK;
-
-       return page_address(pages[page_nr]) + page_off;
-}
-
-static void scif_prog_signal_cb(void *arg)
-{
-       struct scif_cb_arg *cb_arg = arg;
-
-       dma_pool_free(cb_arg->ep->remote_dev->signal_pool, cb_arg->status,
-                     cb_arg->src_dma_addr);
-       kfree(cb_arg);
-}
-
-static int _scif_prog_signal(scif_epd_t epd, dma_addr_t dst, u64 val)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       struct dma_chan *chan = ep->rma_info.dma_chan;
-       struct dma_device *ddev = chan->device;
-       bool x100 = !is_dma_copy_aligned(chan->device, 1, 1, 1);
-       struct dma_async_tx_descriptor *tx;
-       struct scif_status *status = NULL;
-       struct scif_cb_arg *cb_arg = NULL;
-       dma_addr_t src;
-       dma_cookie_t cookie;
-       int err;
-
-       tx = ddev->device_prep_dma_memcpy(chan, 0, 0, 0, DMA_PREP_FENCE);
-       if (!tx) {
-               err = -ENOMEM;
-               dev_err(&ep->remote_dev->sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto alloc_fail;
-       }
-       cookie = tx->tx_submit(tx);
-       if (dma_submit_error(cookie)) {
-               err = (int)cookie;
-               dev_err(&ep->remote_dev->sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto alloc_fail;
-       }
-       dma_async_issue_pending(chan);
-       if (x100) {
-               /*
-                * For X100 use the status descriptor to write the value to
-                * the destination.
-                */
-               tx = ddev->device_prep_dma_imm_data(chan, dst, val, 0);
-       } else {
-               status = dma_pool_alloc(ep->remote_dev->signal_pool, GFP_KERNEL,
-                                       &src);
-               if (!status) {
-                       err = -ENOMEM;
-                       dev_err(&ep->remote_dev->sdev->dev, "%s %d err %d\n",
-                               __func__, __LINE__, err);
-                       goto alloc_fail;
-               }
-               status->val = val;
-               status->src_dma_addr = src;
-               status->ep = ep;
-               src += offsetof(struct scif_status, val);
-               tx = ddev->device_prep_dma_memcpy(chan, dst, src, sizeof(val),
-                                                 DMA_PREP_INTERRUPT);
-       }
-       if (!tx) {
-               err = -ENOMEM;
-               dev_err(&ep->remote_dev->sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto dma_fail;
-       }
-       if (!x100) {
-               cb_arg = kmalloc(sizeof(*cb_arg), GFP_KERNEL);
-               if (!cb_arg) {
-                       err = -ENOMEM;
-                       goto dma_fail;
-               }
-               cb_arg->src_dma_addr = src;
-               cb_arg->status = status;
-               cb_arg->ep = ep;
-               tx->callback = scif_prog_signal_cb;
-               tx->callback_param = cb_arg;
-       }
-       cookie = tx->tx_submit(tx);
-       if (dma_submit_error(cookie)) {
-               err = -EIO;
-               dev_err(&ep->remote_dev->sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto dma_fail;
-       }
-       dma_async_issue_pending(chan);
-       return 0;
-dma_fail:
-       if (!x100) {
-               dma_pool_free(ep->remote_dev->signal_pool, status,
-                             src - offsetof(struct scif_status, val));
-               kfree(cb_arg);
-       }
-alloc_fail:
-       return err;
-}
-
-/**
- * scif_prog_signal:
- * @epd: Endpoint Descriptor
- * @offset: registered address to write @val to
- * @val: Value to be written at @offset
- * @type: Type of the window.
- *
- * Arrange to write a value to the registered offset after ensuring that the
- * offset provided is indeed valid.
- */
-int scif_prog_signal(scif_epd_t epd, off_t offset, u64 val,
-                    enum scif_window_type type)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       struct scif_window *window = NULL;
-       struct scif_rma_req req;
-       dma_addr_t dst_dma_addr;
-       int err;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       req.out_window = &window;
-       req.offset = offset;
-       req.nr_bytes = sizeof(u64);
-       req.prot = SCIF_PROT_WRITE;
-       req.type = SCIF_WINDOW_SINGLE;
-       if (type == SCIF_WINDOW_SELF)
-               req.head = &ep->rma_info.reg_list;
-       else
-               req.head = &ep->rma_info.remote_reg_list;
-       /* Does a valid window exist? */
-       err = scif_query_window(&req);
-       if (err) {
-               dev_err(scif_info.mdev.this_device,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-               goto unlock_ret;
-       }
-
-       if (scif_is_mgmt_node() && scifdev_self(ep->remote_dev)) {
-               u64 *dst_virt;
-
-               if (type == SCIF_WINDOW_SELF)
-                       dst_virt = scif_get_local_va(offset, window);
-               else
-                       dst_virt =
-                       scif_get_local_va(offset, (struct scif_window *)
-                                         window->peer_window);
-               *dst_virt = val;
-       } else {
-               dst_dma_addr = __scif_off_to_dma_addr(window, offset);
-               err = _scif_prog_signal(epd, dst_dma_addr, val);
-       }
-unlock_ret:
-       mutex_unlock(&ep->rma_info.rma_lock);
-       return err;
-}
-
-static int _scif_fence_wait(scif_epd_t epd, int mark)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       dma_cookie_t cookie = mark & ~SCIF_REMOTE_FENCE;
-       int err;
-
-       /* Wait for DMA callback in scif_fence_mark_cb(..) */
-       err = wait_event_interruptible_timeout(ep->rma_info.markwq,
-                                              dma_async_is_tx_complete(
-                                              ep->rma_info.dma_chan,
-                                              cookie, NULL, NULL) ==
-                                              DMA_COMPLETE,
-                                              SCIF_NODE_ALIVE_TIMEOUT);
-       if (!err)
-               err = -ETIMEDOUT;
-       else if (err > 0)
-               err = 0;
-       return err;
-}
-
-/**
- * scif_rma_handle_remote_fences:
- *
- * This routine services remote fence requests.
- */
-void scif_rma_handle_remote_fences(void)
-{
-       struct list_head *item, *tmp;
-       struct scif_remote_fence_info *fence;
-       struct scif_endpt *ep;
-       int mark, err;
-
-       might_sleep();
-       mutex_lock(&scif_info.fencelock);
-       list_for_each_safe(item, tmp, &scif_info.fence) {
-               fence = list_entry(item, struct scif_remote_fence_info,
-                                  list);
-               /* Remove fence from global list */
-               list_del(&fence->list);
-
-               /* Initiate the fence operation */
-               ep = (struct scif_endpt *)fence->msg.payload[0];
-               mark = fence->msg.payload[2];
-               err = _scif_fence_wait(ep, mark);
-               if (err)
-                       fence->msg.uop = SCIF_WAIT_NACK;
-               else
-                       fence->msg.uop = SCIF_WAIT_ACK;
-               fence->msg.payload[0] = ep->remote_ep;
-               scif_nodeqp_send(ep->remote_dev, &fence->msg);
-               kfree(fence);
-               if (!atomic_sub_return(1, &ep->rma_info.fence_refcount))
-                       schedule_work(&scif_info.misc_work);
-       }
-       mutex_unlock(&scif_info.fencelock);
-}
-
-static int _scif_send_fence(scif_epd_t epd, int uop, int mark, int *out_mark)
-{
-       int err;
-       struct scifmsg msg;
-       struct scif_fence_info *fence_req;
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-
-       fence_req = kmalloc(sizeof(*fence_req), GFP_KERNEL);
-       if (!fence_req) {
-               err = -ENOMEM;
-               goto error;
-       }
-
-       fence_req->state = OP_IN_PROGRESS;
-       init_completion(&fence_req->comp);
-
-       msg.src = ep->port;
-       msg.uop = uop;
-       msg.payload[0] = ep->remote_ep;
-       msg.payload[1] = (u64)fence_req;
-       if (uop == SCIF_WAIT)
-               msg.payload[2] = mark;
-       spin_lock(&ep->lock);
-       if (ep->state == SCIFEP_CONNECTED)
-               err = scif_nodeqp_send(ep->remote_dev, &msg);
-       else
-               err = -ENOTCONN;
-       spin_unlock(&ep->lock);
-       if (err)
-               goto error_free;
-retry:
-       /* Wait for a SCIF_WAIT_(N)ACK message */
-       err = wait_for_completion_timeout(&fence_req->comp,
-                                         SCIF_NODE_ALIVE_TIMEOUT);
-       if (!err && scifdev_alive(ep))
-               goto retry;
-       if (!err)
-               err = -ENODEV;
-       if (err > 0)
-               err = 0;
-       mutex_lock(&ep->rma_info.rma_lock);
-       if (err < 0) {
-               if (fence_req->state == OP_IN_PROGRESS)
-                       fence_req->state = OP_FAILED;
-       }
-       if (fence_req->state == OP_FAILED && !err)
-               err = -ENOMEM;
-       if (uop == SCIF_MARK && fence_req->state == OP_COMPLETED)
-               *out_mark = SCIF_REMOTE_FENCE | fence_req->dma_mark;
-       mutex_unlock(&ep->rma_info.rma_lock);
-error_free:
-       kfree(fence_req);
-error:
-       return err;
-}
-
-/**
- * scif_send_fence_mark:
- * @epd: end point descriptor.
- * @out_mark: Output DMA mark reported by peer.
- *
- * Send a remote fence mark request.
- */
-static int scif_send_fence_mark(scif_epd_t epd, int *out_mark)
-{
-       return _scif_send_fence(epd, SCIF_MARK, 0, out_mark);
-}
-
-/**
- * scif_send_fence_wait:
- * @epd: end point descriptor.
- * @mark: DMA mark to wait for.
- *
- * Send a remote fence wait request.
- */
-static int scif_send_fence_wait(scif_epd_t epd, int mark)
-{
-       return _scif_send_fence(epd, SCIF_WAIT, mark, NULL);
-}
-
-static int _scif_send_fence_signal_wait(struct scif_endpt *ep,
-                                       struct scif_fence_info *fence_req)
-{
-       int err;
-
-retry:
-       /* Wait for a SCIF_SIG_(N)ACK message */
-       err = wait_for_completion_timeout(&fence_req->comp,
-                                         SCIF_NODE_ALIVE_TIMEOUT);
-       if (!err && scifdev_alive(ep))
-               goto retry;
-       if (!err)
-               err = -ENODEV;
-       if (err > 0)
-               err = 0;
-       if (err < 0) {
-               mutex_lock(&ep->rma_info.rma_lock);
-               if (fence_req->state == OP_IN_PROGRESS)
-                       fence_req->state = OP_FAILED;
-               mutex_unlock(&ep->rma_info.rma_lock);
-       }
-       if (fence_req->state == OP_FAILED && !err)
-               err = -ENXIO;
-       return err;
-}
-
-/**
- * scif_send_fence_signal:
- * @epd: endpoint descriptor
- * @loff: local offset
- * @lval: local value to write to loffset
- * @roff: remote offset
- * @rval: remote value to write to roffset
- * @flags: flags
- *
- * Sends a remote fence signal request
- */
-static int scif_send_fence_signal(scif_epd_t epd, off_t roff, u64 rval,
-                                 off_t loff, u64 lval, int flags)
-{
-       int err = 0;
-       struct scifmsg msg;
-       struct scif_fence_info *fence_req;
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-
-       fence_req = kmalloc(sizeof(*fence_req), GFP_KERNEL);
-       if (!fence_req) {
-               err = -ENOMEM;
-               goto error;
-       }
-
-       fence_req->state = OP_IN_PROGRESS;
-       init_completion(&fence_req->comp);
-       msg.src = ep->port;
-       if (flags & SCIF_SIGNAL_LOCAL) {
-               msg.uop = SCIF_SIG_LOCAL;
-               msg.payload[0] = ep->remote_ep;
-               msg.payload[1] = roff;
-               msg.payload[2] = rval;
-               msg.payload[3] = (u64)fence_req;
-               spin_lock(&ep->lock);
-               if (ep->state == SCIFEP_CONNECTED)
-                       err = scif_nodeqp_send(ep->remote_dev, &msg);
-               else
-                       err = -ENOTCONN;
-               spin_unlock(&ep->lock);
-               if (err)
-                       goto error_free;
-               err = _scif_send_fence_signal_wait(ep, fence_req);
-               if (err)
-                       goto error_free;
-       }
-       fence_req->state = OP_IN_PROGRESS;
-
-       if (flags & SCIF_SIGNAL_REMOTE) {
-               msg.uop = SCIF_SIG_REMOTE;
-               msg.payload[0] = ep->remote_ep;
-               msg.payload[1] = loff;
-               msg.payload[2] = lval;
-               msg.payload[3] = (u64)fence_req;
-               spin_lock(&ep->lock);
-               if (ep->state == SCIFEP_CONNECTED)
-                       err = scif_nodeqp_send(ep->remote_dev, &msg);
-               else
-                       err = -ENOTCONN;
-               spin_unlock(&ep->lock);
-               if (err)
-                       goto error_free;
-               err = _scif_send_fence_signal_wait(ep, fence_req);
-       }
-error_free:
-       kfree(fence_req);
-error:
-       return err;
-}
-
-static void scif_fence_mark_cb(void *arg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)arg;
-
-       wake_up_interruptible(&ep->rma_info.markwq);
-       atomic_dec(&ep->rma_info.fence_refcount);
-}
-
-/**
- * _scif_fence_mark:
- * @epd: endpoint descriptor
- * @mark: DMA mark to set-up
- *
- * Set up a mark for this endpoint and return the value of the mark.
- */
-int _scif_fence_mark(scif_epd_t epd, int *mark)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       struct dma_chan *chan = ep->rma_info.dma_chan;
-       struct dma_device *ddev = chan->device;
-       struct dma_async_tx_descriptor *tx;
-       dma_cookie_t cookie;
-       int err;
-
-       tx = ddev->device_prep_dma_memcpy(chan, 0, 0, 0, DMA_PREP_FENCE);
-       if (!tx) {
-               err = -ENOMEM;
-               dev_err(&ep->remote_dev->sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               return err;
-       }
-       cookie = tx->tx_submit(tx);
-       if (dma_submit_error(cookie)) {
-               err = (int)cookie;
-               dev_err(&ep->remote_dev->sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               return err;
-       }
-       dma_async_issue_pending(chan);
-       tx = ddev->device_prep_dma_interrupt(chan, DMA_PREP_INTERRUPT);
-       if (!tx) {
-               err = -ENOMEM;
-               dev_err(&ep->remote_dev->sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               return err;
-       }
-       tx->callback = scif_fence_mark_cb;
-       tx->callback_param = ep;
-       *mark = cookie = tx->tx_submit(tx);
-       if (dma_submit_error(cookie)) {
-               err = (int)cookie;
-               dev_err(&ep->remote_dev->sdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               return err;
-       }
-       atomic_inc(&ep->rma_info.fence_refcount);
-       dma_async_issue_pending(chan);
-       return 0;
-}
-
-#define SCIF_LOOPB_MAGIC_MARK 0xdead
-
-int scif_fence_mark(scif_epd_t epd, int flags, int *mark)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       int err = 0;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI fence_mark: ep %p flags 0x%x mark 0x%x\n",
-               ep, flags, *mark);
-       err = scif_verify_epd(ep);
-       if (err)
-               return err;
-
-       /* Invalid flags? */
-       if (flags & ~(SCIF_FENCE_INIT_SELF | SCIF_FENCE_INIT_PEER))
-               return -EINVAL;
-
-       /* At least one of init self or peer RMA should be set */
-       if (!(flags & (SCIF_FENCE_INIT_SELF | SCIF_FENCE_INIT_PEER)))
-               return -EINVAL;
-
-       /* Exactly one of init self or peer RMA should be set but not both */
-       if ((flags & SCIF_FENCE_INIT_SELF) && (flags & SCIF_FENCE_INIT_PEER))
-               return -EINVAL;
-
-       /*
-        * Management node loopback does not need to use DMA.
-        * Return a valid mark to be symmetric.
-        */
-       if (scifdev_self(ep->remote_dev) && scif_is_mgmt_node()) {
-               *mark = SCIF_LOOPB_MAGIC_MARK;
-               return 0;
-       }
-
-       if (flags & SCIF_FENCE_INIT_SELF)
-               err = _scif_fence_mark(epd, mark);
-       else
-               err = scif_send_fence_mark(ep, mark);
-
-       if (err)
-               dev_err(scif_info.mdev.this_device,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI fence_mark: ep %p flags 0x%x mark 0x%x err %d\n",
-               ep, flags, *mark, err);
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_fence_mark);
-
-int scif_fence_wait(scif_epd_t epd, int mark)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       int err = 0;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI fence_wait: ep %p mark 0x%x\n",
-               ep, mark);
-       err = scif_verify_epd(ep);
-       if (err)
-               return err;
-       /*
-        * Management node loopback does not need to use DMA.
-        * The only valid mark provided is 0 so simply
-        * return success if the mark is valid.
-        */
-       if (scifdev_self(ep->remote_dev) && scif_is_mgmt_node()) {
-               if (mark == SCIF_LOOPB_MAGIC_MARK)
-                       return 0;
-               else
-                       return -EINVAL;
-       }
-       if (mark & SCIF_REMOTE_FENCE)
-               err = scif_send_fence_wait(epd, mark);
-       else
-               err = _scif_fence_wait(epd, mark);
-       if (err < 0)
-               dev_err(scif_info.mdev.this_device,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_fence_wait);
-
-int scif_fence_signal(scif_epd_t epd, off_t loff, u64 lval,
-                     off_t roff, u64 rval, int flags)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       int err = 0;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI fence_signal: ep %p loff 0x%lx lval 0x%llx roff 0x%lx rval 0x%llx flags 0x%x\n",
-               ep, loff, lval, roff, rval, flags);
-       err = scif_verify_epd(ep);
-       if (err)
-               return err;
-
-       /* Invalid flags? */
-       if (flags & ~(SCIF_FENCE_INIT_SELF | SCIF_FENCE_INIT_PEER |
-                       SCIF_SIGNAL_LOCAL | SCIF_SIGNAL_REMOTE))
-               return -EINVAL;
-
-       /* At least one of init self or peer RMA should be set */
-       if (!(flags & (SCIF_FENCE_INIT_SELF | SCIF_FENCE_INIT_PEER)))
-               return -EINVAL;
-
-       /* Exactly one of init self or peer RMA should be set but not both */
-       if ((flags & SCIF_FENCE_INIT_SELF) && (flags & SCIF_FENCE_INIT_PEER))
-               return -EINVAL;
-
-       /* At least one of SCIF_SIGNAL_LOCAL or SCIF_SIGNAL_REMOTE required */
-       if (!(flags & (SCIF_SIGNAL_LOCAL | SCIF_SIGNAL_REMOTE)))
-               return -EINVAL;
-
-       /* Only Dword offsets allowed */
-       if ((flags & SCIF_SIGNAL_LOCAL) && (loff & (sizeof(u32) - 1)))
-               return -EINVAL;
-
-       /* Only Dword aligned offsets allowed */
-       if ((flags & SCIF_SIGNAL_REMOTE) && (roff & (sizeof(u32) - 1)))
-               return -EINVAL;
-
-       if (flags & SCIF_FENCE_INIT_PEER) {
-               err = scif_send_fence_signal(epd, roff, rval, loff,
-                                            lval, flags);
-       } else {
-               /* Local Signal in Local RAS */
-               if (flags & SCIF_SIGNAL_LOCAL) {
-                       err = scif_prog_signal(epd, loff, lval,
-                                              SCIF_WINDOW_SELF);
-                       if (err)
-                               goto error_ret;
-               }
-
-               /* Signal in Remote RAS */
-               if (flags & SCIF_SIGNAL_REMOTE)
-                       err = scif_prog_signal(epd, roff,
-                                              rval, SCIF_WINDOW_PEER);
-       }
-error_ret:
-       if (err)
-               dev_err(scif_info.mdev.this_device,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_fence_signal);
diff --git a/drivers/misc/mic/scif/scif_main.c b/drivers/misc/mic/scif/scif_main.c
deleted file mode 100644 (file)
index e2278bf..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include <linux/module.h>
-#include <linux/idr.h>
-
-#include <linux/mic_common.h>
-#include "../common/mic_dev.h"
-#include "../bus/scif_bus.h"
-#include "scif_peer_bus.h"
-#include "scif_main.h"
-#include "scif_map.h"
-
-struct scif_info scif_info = {
-       .mdev = {
-               .minor = MISC_DYNAMIC_MINOR,
-               .name = "scif",
-               .fops = &scif_fops,
-       }
-};
-
-struct scif_dev *scif_dev;
-struct kmem_cache *unaligned_cache;
-static atomic_t g_loopb_cnt;
-
-/* Runs in the context of intr_wq */
-static void scif_intr_bh_handler(struct work_struct *work)
-{
-       struct scif_dev *scifdev =
-                       container_of(work, struct scif_dev, intr_bh);
-
-       if (scifdev_self(scifdev))
-               scif_loopb_msg_handler(scifdev, scifdev->qpairs);
-       else
-               scif_nodeqp_intrhandler(scifdev, scifdev->qpairs);
-}
-
-int scif_setup_intr_wq(struct scif_dev *scifdev)
-{
-       if (!scifdev->intr_wq) {
-               snprintf(scifdev->intr_wqname, sizeof(scifdev->intr_wqname),
-                        "SCIF INTR %d", scifdev->node);
-               scifdev->intr_wq =
-                       alloc_ordered_workqueue(scifdev->intr_wqname, 0);
-               if (!scifdev->intr_wq)
-                       return -ENOMEM;
-               INIT_WORK(&scifdev->intr_bh, scif_intr_bh_handler);
-       }
-       return 0;
-}
-
-void scif_destroy_intr_wq(struct scif_dev *scifdev)
-{
-       if (scifdev->intr_wq) {
-               destroy_workqueue(scifdev->intr_wq);
-               scifdev->intr_wq = NULL;
-       }
-}
-
-irqreturn_t scif_intr_handler(int irq, void *data)
-{
-       struct scif_dev *scifdev = data;
-       struct scif_hw_dev *sdev = scifdev->sdev;
-
-       sdev->hw_ops->ack_interrupt(sdev, scifdev->db);
-       queue_work(scifdev->intr_wq, &scifdev->intr_bh);
-       return IRQ_HANDLED;
-}
-
-static void scif_qp_setup_handler(struct work_struct *work)
-{
-       struct scif_dev *scifdev = container_of(work, struct scif_dev,
-                                               qp_dwork.work);
-       struct scif_hw_dev *sdev = scifdev->sdev;
-       dma_addr_t da = 0;
-       int err;
-
-       if (scif_is_mgmt_node()) {
-               struct mic_bootparam *bp = sdev->dp;
-
-               da = bp->scif_card_dma_addr;
-               scifdev->rdb = bp->h2c_scif_db;
-       } else {
-               struct mic_bootparam __iomem *bp = sdev->rdp;
-
-               da = readq(&bp->scif_host_dma_addr);
-               scifdev->rdb = ioread8(&bp->c2h_scif_db);
-       }
-       if (da) {
-               err = scif_qp_response(da, scifdev);
-               if (err)
-                       dev_err(&scifdev->sdev->dev,
-                               "scif_qp_response err %d\n", err);
-       } else {
-               schedule_delayed_work(&scifdev->qp_dwork,
-                                     msecs_to_jiffies(1000));
-       }
-}
-
-static int scif_setup_scifdev(void)
-{
-       /* We support a maximum of 129 SCIF nodes including the mgmt node */
-#define MAX_SCIF_NODES 129
-       int i;
-       u8 num_nodes = MAX_SCIF_NODES;
-
-       scif_dev = kcalloc(num_nodes, sizeof(*scif_dev), GFP_KERNEL);
-       if (!scif_dev)
-               return -ENOMEM;
-       for (i = 0; i < num_nodes; i++) {
-               struct scif_dev *scifdev = &scif_dev[i];
-
-               scifdev->node = i;
-               scifdev->exit = OP_IDLE;
-               init_waitqueue_head(&scifdev->disconn_wq);
-               mutex_init(&scifdev->lock);
-               INIT_WORK(&scifdev->peer_add_work, scif_add_peer_device);
-               INIT_DELAYED_WORK(&scifdev->p2p_dwork,
-                                 scif_poll_qp_state);
-               INIT_DELAYED_WORK(&scifdev->qp_dwork,
-                                 scif_qp_setup_handler);
-               INIT_LIST_HEAD(&scifdev->p2p);
-               RCU_INIT_POINTER(scifdev->spdev, NULL);
-       }
-       return 0;
-}
-
-static void scif_destroy_scifdev(void)
-{
-       kfree(scif_dev);
-       scif_dev = NULL;
-}
-
-static int scif_probe(struct scif_hw_dev *sdev)
-{
-       struct scif_dev *scifdev = &scif_dev[sdev->dnode];
-       int rc;
-
-       dev_set_drvdata(&sdev->dev, sdev);
-       scifdev->sdev = sdev;
-
-       if (1 == atomic_add_return(1, &g_loopb_cnt)) {
-               struct scif_dev *loopb_dev = &scif_dev[sdev->snode];
-
-               loopb_dev->sdev = sdev;
-               rc = scif_setup_loopback_qp(loopb_dev);
-               if (rc)
-                       goto exit;
-       }
-
-       rc = scif_setup_intr_wq(scifdev);
-       if (rc)
-               goto destroy_loopb;
-       rc = scif_setup_qp(scifdev);
-       if (rc)
-               goto destroy_intr;
-       scifdev->db = sdev->hw_ops->next_db(sdev);
-       scifdev->cookie = sdev->hw_ops->request_irq(sdev, scif_intr_handler,
-                                                   "SCIF_INTR", scifdev,
-                                                   scifdev->db);
-       if (IS_ERR(scifdev->cookie)) {
-               rc = PTR_ERR(scifdev->cookie);
-               goto free_qp;
-       }
-       if (scif_is_mgmt_node()) {
-               struct mic_bootparam *bp = sdev->dp;
-
-               bp->c2h_scif_db = scifdev->db;
-               bp->scif_host_dma_addr = scifdev->qp_dma_addr;
-       } else {
-               struct mic_bootparam __iomem *bp = sdev->rdp;
-
-               iowrite8(scifdev->db, &bp->h2c_scif_db);
-               writeq(scifdev->qp_dma_addr, &bp->scif_card_dma_addr);
-       }
-       schedule_delayed_work(&scifdev->qp_dwork,
-                             msecs_to_jiffies(1000));
-       return rc;
-free_qp:
-       scif_free_qp(scifdev);
-destroy_intr:
-       scif_destroy_intr_wq(scifdev);
-destroy_loopb:
-       if (atomic_dec_and_test(&g_loopb_cnt))
-               scif_destroy_loopback_qp(&scif_dev[sdev->snode]);
-exit:
-       return rc;
-}
-
-void scif_stop(struct scif_dev *scifdev)
-{
-       struct scif_dev *dev;
-       int i;
-
-       for (i = scif_info.maxid; i >= 0; i--) {
-               dev = &scif_dev[i];
-               if (scifdev_self(dev))
-                       continue;
-               scif_handle_remove_node(i);
-       }
-}
-
-static void scif_remove(struct scif_hw_dev *sdev)
-{
-       struct scif_dev *scifdev = &scif_dev[sdev->dnode];
-
-       if (scif_is_mgmt_node()) {
-               struct mic_bootparam *bp = sdev->dp;
-
-               bp->c2h_scif_db = -1;
-               bp->scif_host_dma_addr = 0x0;
-       } else {
-               struct mic_bootparam __iomem *bp = sdev->rdp;
-
-               iowrite8(-1, &bp->h2c_scif_db);
-               writeq(0x0, &bp->scif_card_dma_addr);
-       }
-       if (scif_is_mgmt_node()) {
-               scif_disconnect_node(scifdev->node, true);
-       } else {
-               scif_info.card_initiated_exit = true;
-               scif_stop(scifdev);
-       }
-       if (atomic_dec_and_test(&g_loopb_cnt))
-               scif_destroy_loopback_qp(&scif_dev[sdev->snode]);
-       if (scifdev->cookie) {
-               sdev->hw_ops->free_irq(sdev, scifdev->cookie, scifdev);
-               scifdev->cookie = NULL;
-       }
-       scif_destroy_intr_wq(scifdev);
-       cancel_delayed_work(&scifdev->qp_dwork);
-       scif_free_qp(scifdev);
-       scifdev->rdb = -1;
-       scifdev->sdev = NULL;
-}
-
-static struct scif_hw_dev_id id_table[] = {
-       { MIC_SCIF_DEV, SCIF_DEV_ANY_ID },
-       { 0 },
-};
-
-static struct scif_driver scif_driver = {
-       .driver.name =  KBUILD_MODNAME,
-       .driver.owner = THIS_MODULE,
-       .id_table = id_table,
-       .probe = scif_probe,
-       .remove = scif_remove,
-};
-
-static int _scif_init(void)
-{
-       int rc;
-
-       mutex_init(&scif_info.eplock);
-       spin_lock_init(&scif_info.rmalock);
-       spin_lock_init(&scif_info.nb_connect_lock);
-       spin_lock_init(&scif_info.port_lock);
-       mutex_init(&scif_info.conflock);
-       mutex_init(&scif_info.connlock);
-       mutex_init(&scif_info.fencelock);
-       INIT_LIST_HEAD(&scif_info.uaccept);
-       INIT_LIST_HEAD(&scif_info.listen);
-       INIT_LIST_HEAD(&scif_info.zombie);
-       INIT_LIST_HEAD(&scif_info.connected);
-       INIT_LIST_HEAD(&scif_info.disconnected);
-       INIT_LIST_HEAD(&scif_info.rma);
-       INIT_LIST_HEAD(&scif_info.rma_tc);
-       INIT_LIST_HEAD(&scif_info.mmu_notif_cleanup);
-       INIT_LIST_HEAD(&scif_info.fence);
-       INIT_LIST_HEAD(&scif_info.nb_connect_list);
-       init_waitqueue_head(&scif_info.exitwq);
-       scif_info.rma_tc_limit = SCIF_RMA_TEMP_CACHE_LIMIT;
-       scif_info.en_msg_log = 0;
-       scif_info.p2p_enable = 1;
-       rc = scif_setup_scifdev();
-       if (rc)
-               goto error;
-       unaligned_cache = kmem_cache_create("Unaligned_DMA",
-                                           SCIF_KMEM_UNALIGNED_BUF_SIZE,
-                                           0, SLAB_HWCACHE_ALIGN, NULL);
-       if (!unaligned_cache) {
-               rc = -ENOMEM;
-               goto free_sdev;
-       }
-       INIT_WORK(&scif_info.misc_work, scif_misc_handler);
-       INIT_WORK(&scif_info.mmu_notif_work, scif_mmu_notif_handler);
-       INIT_WORK(&scif_info.conn_work, scif_conn_handler);
-       idr_init(&scif_ports);
-       return 0;
-free_sdev:
-       scif_destroy_scifdev();
-error:
-       return rc;
-}
-
-static void _scif_exit(void)
-{
-       idr_destroy(&scif_ports);
-       kmem_cache_destroy(unaligned_cache);
-       scif_destroy_scifdev();
-}
-
-static int __init scif_init(void)
-{
-       struct miscdevice *mdev = &scif_info.mdev;
-       int rc;
-
-       _scif_init();
-       iova_cache_get();
-       rc = scif_peer_bus_init();
-       if (rc)
-               goto exit;
-       rc = scif_register_driver(&scif_driver);
-       if (rc)
-               goto peer_bus_exit;
-       rc = misc_register(mdev);
-       if (rc)
-               goto unreg_scif;
-       scif_init_debugfs();
-       return 0;
-unreg_scif:
-       scif_unregister_driver(&scif_driver);
-peer_bus_exit:
-       scif_peer_bus_exit();
-exit:
-       _scif_exit();
-       return rc;
-}
-
-static void __exit scif_exit(void)
-{
-       scif_exit_debugfs();
-       misc_deregister(&scif_info.mdev);
-       scif_unregister_driver(&scif_driver);
-       scif_peer_bus_exit();
-       iova_cache_put();
-       _scif_exit();
-}
-
-module_init(scif_init);
-module_exit(scif_exit);
-
-MODULE_DEVICE_TABLE(scif, id_table);
-MODULE_AUTHOR("Intel Corporation");
-MODULE_DESCRIPTION("Intel(R) SCIF driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/misc/mic/scif/scif_main.h b/drivers/misc/mic/scif/scif_main.h
deleted file mode 100644 (file)
index bb3ab97..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#ifndef SCIF_MAIN_H
-#define SCIF_MAIN_H
-
-#include <linux/sched/signal.h>
-#include <linux/pci.h>
-#include <linux/miscdevice.h>
-#include <linux/dmaengine.h>
-#include <linux/iova.h>
-#include <linux/anon_inodes.h>
-#include <linux/file.h>
-#include <linux/vmalloc.h>
-#include <linux/scif.h>
-#include "../common/mic_dev.h"
-
-#define SCIF_MGMT_NODE 0
-#define SCIF_DEFAULT_WATCHDOG_TO 30
-#define SCIF_NODE_ACCEPT_TIMEOUT (3 * HZ)
-#define SCIF_NODE_ALIVE_TIMEOUT (SCIF_DEFAULT_WATCHDOG_TO * HZ)
-#define SCIF_RMA_TEMP_CACHE_LIMIT 0x20000
-
-/*
- * Generic state used for certain node QP message exchanges
- * like Unregister, Alloc etc.
- */
-enum scif_msg_state {
-       OP_IDLE = 1,
-       OP_IN_PROGRESS,
-       OP_COMPLETED,
-       OP_FAILED
-};
-
-/*
- * struct scif_info - Global SCIF information
- *
- * @nodeid: Node ID this node is to others
- * @maxid: Max known node ID
- * @total: Total number of SCIF nodes
- * @nr_zombies: number of zombie endpoints
- * @eplock: Lock to synchronize listening, zombie endpoint lists
- * @connlock: Lock to synchronize connected and disconnected lists
- * @nb_connect_lock: Synchronize non blocking connect operations
- * @port_lock: Synchronize access to SCIF ports
- * @uaccept: List of user acceptreq waiting for acceptreg
- * @listen: List of listening end points
- * @zombie: List of zombie end points with pending RMA's
- * @connected: List of end points in connected state
- * @disconnected: List of end points in disconnected state
- * @nb_connect_list: List for non blocking connections
- * @misc_work: miscellaneous SCIF tasks
- * @conflock: Lock to synchronize SCIF node configuration changes
- * @en_msg_log: Enable debug message logging
- * @p2p_enable: Enable P2P SCIF network
- * @mdev: The MISC device
- * @conn_work: Work for workqueue handling all connections
- * @exitwq: Wait queue for waiting for an EXIT node QP message response
- * @loopb_dev: Dummy SCIF device used for loopback
- * @loopb_wq: Workqueue used for handling loopback messages
- * @loopb_wqname[16]: Name of loopback workqueue
- * @loopb_work: Used for submitting work to loopb_wq
- * @loopb_recv_q: List of messages received on the loopb_wq
- * @card_initiated_exit: set when the card has initiated the exit
- * @rmalock: Synchronize access to RMA operations
- * @fencelock: Synchronize access to list of remote fences requested.
- * @rma: List of temporary registered windows to be destroyed.
- * @rma_tc: List of temporary registered & cached Windows to be destroyed
- * @fence: List of remote fence requests
- * @mmu_notif_work: Work for registration caching MMU notifier workqueue
- * @mmu_notif_cleanup: List of temporary cached windows for reg cache
- * @rma_tc_limit: RMA temporary cache limit
- */
-struct scif_info {
-       u8 nodeid;
-       u8 maxid;
-       u8 total;
-       u32 nr_zombies;
-       struct mutex eplock;
-       struct mutex connlock;
-       spinlock_t nb_connect_lock;
-       spinlock_t port_lock;
-       struct list_head uaccept;
-       struct list_head listen;
-       struct list_head zombie;
-       struct list_head connected;
-       struct list_head disconnected;
-       struct list_head nb_connect_list;
-       struct work_struct misc_work;
-       struct mutex conflock;
-       u8 en_msg_log;
-       u8 p2p_enable;
-       struct miscdevice mdev;
-       struct work_struct conn_work;
-       wait_queue_head_t exitwq;
-       struct scif_dev *loopb_dev;
-       struct workqueue_struct *loopb_wq;
-       char loopb_wqname[16];
-       struct work_struct loopb_work;
-       struct list_head loopb_recv_q;
-       bool card_initiated_exit;
-       spinlock_t rmalock;
-       struct mutex fencelock;
-       struct list_head rma;
-       struct list_head rma_tc;
-       struct list_head fence;
-       struct work_struct mmu_notif_work;
-       struct list_head mmu_notif_cleanup;
-       unsigned long rma_tc_limit;
-};
-
-/*
- * struct scif_p2p_info - SCIF mapping information used for P2P
- *
- * @ppi_peer_id - SCIF peer node id
- * @ppi_sg - Scatter list for bar information (One for mmio and one for aper)
- * @sg_nentries - Number of entries in the scatterlist
- * @ppi_da: DMA address for MMIO and APER bars
- * @ppi_len: Length of MMIO and APER bars
- * @ppi_list: Link in list of mapping information
- */
-struct scif_p2p_info {
-       u8 ppi_peer_id;
-       struct scatterlist *ppi_sg[2];
-       u64 sg_nentries[2];
-       dma_addr_t ppi_da[2];
-       u64 ppi_len[2];
-#define SCIF_PPI_MMIO 0
-#define SCIF_PPI_APER 1
-       struct list_head ppi_list;
-};
-
-/*
- * struct scif_dev - SCIF remote device specific fields
- *
- * @node: Node id
- * @p2p: List of P2P mapping information
- * @qpairs: The node queue pair for exchanging control messages
- * @intr_wq: Workqueue for handling Node QP messages
- * @intr_wqname: Name of node QP workqueue for handling interrupts
- * @intr_bh: Used for submitting work to intr_wq
- * @lock: Lock used for synchronizing access to the scif device
- * @sdev: SCIF hardware device on the SCIF hardware bus
- * @db: doorbell the peer will trigger to generate an interrupt on self
- * @rdb: Doorbell to trigger on the peer to generate an interrupt on the peer
- * @cookie: Cookie received while registering the interrupt handler
- * @peer_add_work: Work for handling device_add for peer devices
- * @p2p_dwork: Delayed work to enable polling for P2P state
- * @qp_dwork: Delayed work for enabling polling for remote QP information
- * @p2p_retry: Number of times to retry polling of P2P state
- * @base_addr: P2P aperture bar base address
- * @mic_mw mmio: The peer MMIO information used for P2P
- * @spdev: SCIF peer device on the SCIF peer bus
- * @node_remove_ack_pending: True if a node_remove_ack is pending
- * @exit_ack_pending: true if an exit_ack is pending
- * @disconn_wq: Used while waiting for a node remove response
- * @disconn_rescnt: Keeps track of number of node remove requests sent
- * @exit: Status of exit message
- * @qp_dma_addr: Queue pair DMA address passed to the peer
- * @dma_ch_idx: Round robin index for DMA channels
- * @signal_pool: DMA pool used for scheduling scif_fence_signal DMA's
-*/
-struct scif_dev {
-       u8 node;
-       struct list_head p2p;
-       struct scif_qp *qpairs;
-       struct workqueue_struct *intr_wq;
-       char intr_wqname[16];
-       struct work_struct intr_bh;
-       struct mutex lock;
-       struct scif_hw_dev *sdev;
-       int db;
-       int rdb;
-       struct mic_irq *cookie;
-       struct work_struct peer_add_work;
-       struct delayed_work p2p_dwork;
-       struct delayed_work qp_dwork;
-       int p2p_retry;
-       dma_addr_t base_addr;
-       struct mic_mw mmio;
-       struct scif_peer_dev __rcu *spdev;
-       bool node_remove_ack_pending;
-       bool exit_ack_pending;
-       wait_queue_head_t disconn_wq;
-       atomic_t disconn_rescnt;
-       enum scif_msg_state exit;
-       dma_addr_t qp_dma_addr;
-       int dma_ch_idx;
-       struct dma_pool *signal_pool;
-};
-
-extern bool scif_reg_cache_enable;
-extern bool scif_ulimit_check;
-extern struct scif_info scif_info;
-extern struct idr scif_ports;
-extern struct bus_type scif_peer_bus;
-extern struct scif_dev *scif_dev;
-extern const struct file_operations scif_fops;
-extern const struct file_operations scif_anon_fops;
-
-/* Size of the RB for the Node QP */
-#define SCIF_NODE_QP_SIZE 0x10000
-
-#include "scif_nodeqp.h"
-#include "scif_rma.h"
-#include "scif_rma_list.h"
-
-/*
- * scifdev_self:
- * @dev: The remote SCIF Device
- *
- * Returns true if the SCIF Device passed is the self aka Loopback SCIF device.
- */
-static inline int scifdev_self(struct scif_dev *dev)
-{
-       return dev->node == scif_info.nodeid;
-}
-
-static inline bool scif_is_mgmt_node(void)
-{
-       return !scif_info.nodeid;
-}
-
-/*
- * scifdev_is_p2p:
- * @dev: The remote SCIF Device
- *
- * Returns true if the SCIF Device is a MIC Peer to Peer SCIF device.
- */
-static inline bool scifdev_is_p2p(struct scif_dev *dev)
-{
-       if (scif_is_mgmt_node())
-               return false;
-       else
-               return dev != &scif_dev[SCIF_MGMT_NODE] &&
-                       !scifdev_self(dev);
-}
-
-/*
- * scifdev_alive:
- * @scifdev: The remote SCIF Device
- *
- * Returns true if the remote SCIF Device is running or sleeping for
- * this endpoint.
- */
-static inline int _scifdev_alive(struct scif_dev *scifdev)
-{
-       struct scif_peer_dev *spdev;
-
-       rcu_read_lock();
-       spdev = rcu_dereference(scifdev->spdev);
-       rcu_read_unlock();
-       return !!spdev;
-}
-
-#include "scif_epd.h"
-
-void __init scif_init_debugfs(void);
-void scif_exit_debugfs(void);
-int scif_setup_intr_wq(struct scif_dev *scifdev);
-void scif_destroy_intr_wq(struct scif_dev *scifdev);
-void scif_cleanup_scifdev(struct scif_dev *dev);
-void scif_handle_remove_node(int node);
-void scif_disconnect_node(u32 node_id, bool mgmt_initiated);
-void scif_free_qp(struct scif_dev *dev);
-void scif_misc_handler(struct work_struct *work);
-void scif_stop(struct scif_dev *scifdev);
-irqreturn_t scif_intr_handler(int irq, void *data);
-#endif /* SCIF_MAIN_H */
diff --git a/drivers/misc/mic/scif/scif_map.h b/drivers/misc/mic/scif/scif_map.h
deleted file mode 100644 (file)
index 96b7608..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#ifndef SCIF_MAP_H
-#define SCIF_MAP_H
-
-#include "../bus/scif_bus.h"
-
-static __always_inline void *
-scif_alloc_coherent(dma_addr_t *dma_handle,
-                   struct scif_dev *scifdev, size_t size,
-                   gfp_t gfp)
-{
-       void *va;
-
-       if (scifdev_self(scifdev)) {
-               va = kmalloc(size, gfp);
-               if (va)
-                       *dma_handle = virt_to_phys(va);
-       } else {
-               va = dma_alloc_coherent(&scifdev->sdev->dev,
-                                       size, dma_handle, gfp);
-               if (va && scifdev_is_p2p(scifdev))
-                       *dma_handle = *dma_handle + scifdev->base_addr;
-       }
-       return va;
-}
-
-static __always_inline void
-scif_free_coherent(void *va, dma_addr_t local,
-                  struct scif_dev *scifdev, size_t size)
-{
-       if (scifdev_self(scifdev)) {
-               kfree(va);
-       } else {
-               if (scifdev_is_p2p(scifdev) && local > scifdev->base_addr)
-                       local = local - scifdev->base_addr;
-               dma_free_coherent(&scifdev->sdev->dev,
-                                 size, va, local);
-       }
-}
-
-static __always_inline int
-scif_map_single(dma_addr_t *dma_handle,
-               void *local, struct scif_dev *scifdev, size_t size)
-{
-       int err = 0;
-
-       if (scifdev_self(scifdev)) {
-               *dma_handle = virt_to_phys((local));
-       } else {
-               *dma_handle = dma_map_single(&scifdev->sdev->dev,
-                                            local, size, DMA_BIDIRECTIONAL);
-               if (dma_mapping_error(&scifdev->sdev->dev, *dma_handle))
-                       err = -ENOMEM;
-               else if (scifdev_is_p2p(scifdev))
-                       *dma_handle = *dma_handle + scifdev->base_addr;
-       }
-       if (err)
-               *dma_handle = 0;
-       return err;
-}
-
-static __always_inline void
-scif_unmap_single(dma_addr_t local, struct scif_dev *scifdev,
-                 size_t size)
-{
-       if (!scifdev_self(scifdev)) {
-               if (scifdev_is_p2p(scifdev))
-                       local = local - scifdev->base_addr;
-               dma_unmap_single(&scifdev->sdev->dev, local,
-                                size, DMA_BIDIRECTIONAL);
-       }
-}
-
-static __always_inline void *
-scif_ioremap(dma_addr_t phys, size_t size, struct scif_dev *scifdev)
-{
-       void *out_virt;
-       struct scif_hw_dev *sdev = scifdev->sdev;
-
-       if (scifdev_self(scifdev))
-               out_virt = phys_to_virt(phys);
-       else
-               out_virt = (void __force *)
-                          sdev->hw_ops->remap(sdev, phys, size);
-       return out_virt;
-}
-
-static __always_inline void
-scif_iounmap(void *virt, size_t len, struct scif_dev *scifdev)
-{
-       if (!scifdev_self(scifdev)) {
-               struct scif_hw_dev *sdev = scifdev->sdev;
-
-               sdev->hw_ops->unmap(sdev, (void __force __iomem *)virt);
-       }
-}
-
-static __always_inline int
-scif_map_page(dma_addr_t *dma_handle, struct page *page,
-             struct scif_dev *scifdev)
-{
-       int err = 0;
-
-       if (scifdev_self(scifdev)) {
-               *dma_handle = page_to_phys(page);
-       } else {
-               struct scif_hw_dev *sdev = scifdev->sdev;
-               *dma_handle = dma_map_page(&sdev->dev,
-                                          page, 0x0, PAGE_SIZE,
-                                          DMA_BIDIRECTIONAL);
-               if (dma_mapping_error(&sdev->dev, *dma_handle))
-                       err = -ENOMEM;
-               else if (scifdev_is_p2p(scifdev))
-                       *dma_handle = *dma_handle + scifdev->base_addr;
-       }
-       if (err)
-               *dma_handle = 0;
-       return err;
-}
-#endif  /* SCIF_MAP_H */
diff --git a/drivers/misc/mic/scif/scif_mmap.c b/drivers/misc/mic/scif/scif_mmap.c
deleted file mode 100644 (file)
index a151d41..0000000
+++ /dev/null
@@ -1,690 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include "scif_main.h"
-
-/*
- * struct scif_vma_info - Information about a remote memory mapping
- *                       created via scif_mmap(..)
- * @vma: VM area struct
- * @list: link to list of active vmas
- */
-struct scif_vma_info {
-       struct vm_area_struct *vma;
-       struct list_head list;
-};
-
-void scif_recv_munmap(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_rma_req req;
-       struct scif_window *window = NULL;
-       struct scif_window *recv_window =
-               (struct scif_window *)msg->payload[0];
-       struct scif_endpt *ep;
-
-       ep = (struct scif_endpt *)recv_window->ep;
-       req.out_window = &window;
-       req.offset = recv_window->offset;
-       req.prot = recv_window->prot;
-       req.nr_bytes = recv_window->nr_pages << PAGE_SHIFT;
-       req.type = SCIF_WINDOW_FULL;
-       req.head = &ep->rma_info.reg_list;
-       msg->payload[0] = ep->remote_ep;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       /* Does a valid window exist? */
-       if (scif_query_window(&req)) {
-               dev_err(&scifdev->sdev->dev,
-                       "%s %d -ENXIO\n", __func__, __LINE__);
-               msg->uop = SCIF_UNREGISTER_ACK;
-               goto error;
-       }
-
-       scif_put_window(window, window->nr_pages);
-
-       if (!window->ref_count) {
-               atomic_inc(&ep->rma_info.tw_refcount);
-               ep->rma_info.async_list_del = 1;
-               list_del_init(&window->list);
-               scif_free_window_offset(ep, window, window->offset);
-       }
-error:
-       mutex_unlock(&ep->rma_info.rma_lock);
-       if (window && !window->ref_count)
-               scif_queue_for_cleanup(window, &scif_info.rma);
-}
-
-/*
- * Remove valid remote memory mappings created via scif_mmap(..) from the
- * process address space since the remote node is lost
- */
-static void __scif_zap_mmaps(struct scif_endpt *ep)
-{
-       struct list_head *item;
-       struct scif_vma_info *info;
-       struct vm_area_struct *vma;
-       unsigned long size;
-
-       spin_lock(&ep->lock);
-       list_for_each(item, &ep->rma_info.vma_list) {
-               info = list_entry(item, struct scif_vma_info, list);
-               vma = info->vma;
-               size = vma->vm_end - vma->vm_start;
-               zap_vma_ptes(vma, vma->vm_start, size);
-               dev_dbg(scif_info.mdev.this_device,
-                       "%s ep %p zap vma %p size 0x%lx\n",
-                       __func__, ep, info->vma, size);
-       }
-       spin_unlock(&ep->lock);
-}
-
-/*
- * Traverse the list of endpoints for a particular remote node and
- * zap valid remote memory mappings since the remote node is lost
- */
-static void _scif_zap_mmaps(int node, struct list_head *head)
-{
-       struct scif_endpt *ep;
-       struct list_head *item;
-
-       mutex_lock(&scif_info.connlock);
-       list_for_each(item, head) {
-               ep = list_entry(item, struct scif_endpt, list);
-               if (ep->remote_dev->node == node)
-                       __scif_zap_mmaps(ep);
-       }
-       mutex_unlock(&scif_info.connlock);
-}
-
-/*
- * Wrapper for removing remote memory mappings for a particular node. This API
- * is called by peer nodes as part of handling a lost node.
- */
-void scif_zap_mmaps(int node)
-{
-       _scif_zap_mmaps(node, &scif_info.connected);
-       _scif_zap_mmaps(node, &scif_info.disconnected);
-}
-
-/*
- * This API is only called while handling a lost node:
- * a) Remote node is dead.
- * b) Remote memory mappings have been zapped
- * So we can traverse the remote_reg_list without any locks. Since
- * the window has not yet been unregistered we can drop the ref count
- * and queue it to the cleanup thread.
- */
-static void __scif_cleanup_rma_for_zombies(struct scif_endpt *ep)
-{
-       struct list_head *pos, *tmp;
-       struct scif_window *window;
-
-       list_for_each_safe(pos, tmp, &ep->rma_info.remote_reg_list) {
-               window = list_entry(pos, struct scif_window, list);
-               if (window->ref_count)
-                       scif_put_window(window, window->nr_pages);
-               else
-                       dev_err(scif_info.mdev.this_device,
-                               "%s %d unexpected\n",
-                               __func__, __LINE__);
-               if (!window->ref_count) {
-                       atomic_inc(&ep->rma_info.tw_refcount);
-                       list_del_init(&window->list);
-                       scif_queue_for_cleanup(window, &scif_info.rma);
-               }
-       }
-}
-
-/* Cleanup remote registration lists for zombie endpoints */
-void scif_cleanup_rma_for_zombies(int node)
-{
-       struct scif_endpt *ep;
-       struct list_head *item;
-
-       mutex_lock(&scif_info.eplock);
-       list_for_each(item, &scif_info.zombie) {
-               ep = list_entry(item, struct scif_endpt, list);
-               if (ep->remote_dev && ep->remote_dev->node == node)
-                       __scif_cleanup_rma_for_zombies(ep);
-       }
-       mutex_unlock(&scif_info.eplock);
-       flush_work(&scif_info.misc_work);
-}
-
-/* Insert the VMA into the per endpoint VMA list */
-static int scif_insert_vma(struct scif_endpt *ep, struct vm_area_struct *vma)
-{
-       struct scif_vma_info *info;
-       int err = 0;
-
-       info = kzalloc(sizeof(*info), GFP_KERNEL);
-       if (!info) {
-               err = -ENOMEM;
-               goto done;
-       }
-       info->vma = vma;
-       spin_lock(&ep->lock);
-       list_add_tail(&info->list, &ep->rma_info.vma_list);
-       spin_unlock(&ep->lock);
-done:
-       return err;
-}
-
-/* Delete the VMA from the per endpoint VMA list */
-static void scif_delete_vma(struct scif_endpt *ep, struct vm_area_struct *vma)
-{
-       struct list_head *item;
-       struct scif_vma_info *info;
-
-       spin_lock(&ep->lock);
-       list_for_each(item, &ep->rma_info.vma_list) {
-               info = list_entry(item, struct scif_vma_info, list);
-               if (info->vma == vma) {
-                       list_del(&info->list);
-                       kfree(info);
-                       break;
-               }
-       }
-       spin_unlock(&ep->lock);
-}
-
-static phys_addr_t scif_get_phys(phys_addr_t phys, struct scif_endpt *ep)
-{
-       struct scif_dev *scifdev = (struct scif_dev *)ep->remote_dev;
-       struct scif_hw_dev *sdev = scifdev->sdev;
-       phys_addr_t out_phys, apt_base = 0;
-
-       /*
-        * If the DMA address is card relative then we need to add the
-        * aperture base for mmap to work correctly
-        */
-       if (!scifdev_self(scifdev) && sdev->aper && sdev->card_rel_da)
-               apt_base = sdev->aper->pa;
-       out_phys = apt_base + phys;
-       return out_phys;
-}
-
-int scif_get_pages(scif_epd_t epd, off_t offset, size_t len,
-                  struct scif_range **pages)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       struct scif_rma_req req;
-       struct scif_window *window = NULL;
-       int nr_pages, err, i;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI get_pinned_pages: ep %p offset 0x%lx len 0x%lx\n",
-               ep, offset, len);
-       err = scif_verify_epd(ep);
-       if (err)
-               return err;
-
-       if (!len || (offset < 0) ||
-           (offset + len < offset) ||
-           (ALIGN(offset, PAGE_SIZE) != offset) ||
-           (ALIGN(len, PAGE_SIZE) != len))
-               return -EINVAL;
-
-       nr_pages = len >> PAGE_SHIFT;
-
-       req.out_window = &window;
-       req.offset = offset;
-       req.prot = 0;
-       req.nr_bytes = len;
-       req.type = SCIF_WINDOW_SINGLE;
-       req.head = &ep->rma_info.remote_reg_list;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       /* Does a valid window exist? */
-       err = scif_query_window(&req);
-       if (err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-               goto error;
-       }
-
-       /* Allocate scif_range */
-       *pages = kzalloc(sizeof(**pages), GFP_KERNEL);
-       if (!*pages) {
-               err = -ENOMEM;
-               goto error;
-       }
-
-       /* Allocate phys addr array */
-       (*pages)->phys_addr = scif_zalloc(nr_pages * sizeof(dma_addr_t));
-       if (!((*pages)->phys_addr)) {
-               err = -ENOMEM;
-               goto error;
-       }
-
-       if (scif_is_mgmt_node() && !scifdev_self(ep->remote_dev)) {
-               /* Allocate virtual address array */
-               ((*pages)->va = scif_zalloc(nr_pages * sizeof(void *)));
-               if (!(*pages)->va) {
-                       err = -ENOMEM;
-                       goto error;
-               }
-       }
-       /* Populate the values */
-       (*pages)->cookie = window;
-       (*pages)->nr_pages = nr_pages;
-       (*pages)->prot_flags = window->prot;
-
-       for (i = 0; i < nr_pages; i++) {
-               (*pages)->phys_addr[i] =
-                       __scif_off_to_dma_addr(window, offset +
-                                              (i * PAGE_SIZE));
-               (*pages)->phys_addr[i] = scif_get_phys((*pages)->phys_addr[i],
-                                                       ep);
-               if (scif_is_mgmt_node() && !scifdev_self(ep->remote_dev))
-                       (*pages)->va[i] =
-                               ep->remote_dev->sdev->aper->va +
-                               (*pages)->phys_addr[i] -
-                               ep->remote_dev->sdev->aper->pa;
-       }
-
-       scif_get_window(window, nr_pages);
-error:
-       mutex_unlock(&ep->rma_info.rma_lock);
-       if (err) {
-               if (*pages) {
-                       scif_free((*pages)->phys_addr,
-                                 nr_pages * sizeof(dma_addr_t));
-                       scif_free((*pages)->va,
-                                 nr_pages * sizeof(void *));
-                       kfree(*pages);
-                       *pages = NULL;
-               }
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-       }
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_get_pages);
-
-int scif_put_pages(struct scif_range *pages)
-{
-       struct scif_endpt *ep;
-       struct scif_window *window;
-       struct scifmsg msg;
-
-       if (!pages || !pages->cookie)
-               return -EINVAL;
-
-       window = pages->cookie;
-
-       if (!window || window->magic != SCIFEP_MAGIC)
-               return -EINVAL;
-
-       ep = (struct scif_endpt *)window->ep;
-       /*
-        * If the state is SCIFEP_CONNECTED or SCIFEP_DISCONNECTED then the
-        * callee should be allowed to release references to the pages,
-        * else the endpoint was not connected in the first place,
-        * hence the ENOTCONN.
-        */
-       if (ep->state != SCIFEP_CONNECTED && ep->state != SCIFEP_DISCONNECTED)
-               return -ENOTCONN;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-
-       scif_put_window(window, pages->nr_pages);
-
-       /* Initiate window destruction if ref count is zero */
-       if (!window->ref_count) {
-               list_del(&window->list);
-               mutex_unlock(&ep->rma_info.rma_lock);
-               scif_drain_dma_intr(ep->remote_dev->sdev,
-                                   ep->rma_info.dma_chan);
-               /* Inform the peer about this window being destroyed. */
-               msg.uop = SCIF_MUNMAP;
-               msg.src = ep->port;
-               msg.payload[0] = window->peer_window;
-               /* No error handling for notification messages */
-               scif_nodeqp_send(ep->remote_dev, &msg);
-               /* Destroy this window from the peer's registered AS */
-               scif_destroy_remote_window(window);
-       } else {
-               mutex_unlock(&ep->rma_info.rma_lock);
-       }
-
-       scif_free(pages->phys_addr, pages->nr_pages * sizeof(dma_addr_t));
-       scif_free(pages->va, pages->nr_pages * sizeof(void *));
-       kfree(pages);
-       return 0;
-}
-EXPORT_SYMBOL_GPL(scif_put_pages);
-
-/*
- * scif_rma_list_mmap:
- *
- * Traverse the remote registration list starting from start_window:
- * 1) Create VtoP mappings via remap_pfn_range(..)
- * 2) Once step 1) and 2) complete successfully then traverse the range of
- *    windows again and bump the reference count.
- * RMA lock must be held.
- */
-static int scif_rma_list_mmap(struct scif_window *start_window, s64 offset,
-                             int nr_pages, struct vm_area_struct *vma)
-{
-       s64 end_offset, loop_offset = offset;
-       struct scif_window *window = start_window;
-       int loop_nr_pages, nr_pages_left = nr_pages;
-       struct scif_endpt *ep = (struct scif_endpt *)start_window->ep;
-       struct list_head *head = &ep->rma_info.remote_reg_list;
-       int i, err = 0;
-       dma_addr_t phys_addr;
-       struct scif_window_iter src_win_iter;
-       size_t contig_bytes = 0;
-
-       might_sleep();
-       list_for_each_entry_from(window, head, list) {
-               end_offset = window->offset +
-                       (window->nr_pages << PAGE_SHIFT);
-               loop_nr_pages = min_t(int,
-                                     (end_offset - loop_offset) >> PAGE_SHIFT,
-                                     nr_pages_left);
-               scif_init_window_iter(window, &src_win_iter);
-               for (i = 0; i < loop_nr_pages; i++) {
-                       phys_addr = scif_off_to_dma_addr(window, loop_offset,
-                                                        &contig_bytes,
-                                                        &src_win_iter);
-                       phys_addr = scif_get_phys(phys_addr, ep);
-                       err = remap_pfn_range(vma,
-                                             vma->vm_start +
-                                             loop_offset - offset,
-                                             phys_addr >> PAGE_SHIFT,
-                                             PAGE_SIZE,
-                                             vma->vm_page_prot);
-                       if (err)
-                               goto error;
-                       loop_offset += PAGE_SIZE;
-               }
-               nr_pages_left -= loop_nr_pages;
-               if (!nr_pages_left)
-                       break;
-       }
-       /*
-        * No more failures expected. Bump up the ref count for all
-        * the windows. Another traversal from start_window required
-        * for handling errors encountered across windows during
-        * remap_pfn_range(..).
-        */
-       loop_offset = offset;
-       nr_pages_left = nr_pages;
-       window = start_window;
-       head = &ep->rma_info.remote_reg_list;
-       list_for_each_entry_from(window, head, list) {
-               end_offset = window->offset +
-                       (window->nr_pages << PAGE_SHIFT);
-               loop_nr_pages = min_t(int,
-                                     (end_offset - loop_offset) >> PAGE_SHIFT,
-                                     nr_pages_left);
-               scif_get_window(window, loop_nr_pages);
-               nr_pages_left -= loop_nr_pages;
-               loop_offset += (loop_nr_pages << PAGE_SHIFT);
-               if (!nr_pages_left)
-                       break;
-       }
-error:
-       if (err)
-               dev_err(scif_info.mdev.this_device,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-       return err;
-}
-
-/*
- * scif_rma_list_munmap:
- *
- * Traverse the remote registration list starting from window:
- * 1) Decrement ref count.
- * 2) If the ref count drops to zero then send a SCIF_MUNMAP message to peer.
- * RMA lock must be held.
- */
-static void scif_rma_list_munmap(struct scif_window *start_window,
-                                s64 offset, int nr_pages)
-{
-       struct scifmsg msg;
-       s64 loop_offset = offset, end_offset;
-       int loop_nr_pages, nr_pages_left = nr_pages;
-       struct scif_endpt *ep = (struct scif_endpt *)start_window->ep;
-       struct list_head *head = &ep->rma_info.remote_reg_list;
-       struct scif_window *window = start_window, *_window;
-
-       msg.uop = SCIF_MUNMAP;
-       msg.src = ep->port;
-       loop_offset = offset;
-       nr_pages_left = nr_pages;
-       list_for_each_entry_safe_from(window, _window, head, list) {
-               end_offset = window->offset +
-                       (window->nr_pages << PAGE_SHIFT);
-               loop_nr_pages = min_t(int,
-                                     (end_offset - loop_offset) >> PAGE_SHIFT,
-                                     nr_pages_left);
-               scif_put_window(window, loop_nr_pages);
-               if (!window->ref_count) {
-                       struct scif_dev *rdev = ep->remote_dev;
-
-                       scif_drain_dma_intr(rdev->sdev,
-                                           ep->rma_info.dma_chan);
-                       /* Inform the peer about this munmap */
-                       msg.payload[0] = window->peer_window;
-                       /* No error handling for Notification messages. */
-                       scif_nodeqp_send(ep->remote_dev, &msg);
-                       list_del(&window->list);
-                       /* Destroy this window from the peer's registered AS */
-                       scif_destroy_remote_window(window);
-               }
-               nr_pages_left -= loop_nr_pages;
-               loop_offset += (loop_nr_pages << PAGE_SHIFT);
-               if (!nr_pages_left)
-                       break;
-       }
-}
-
-/*
- * The private data field of each VMA used to mmap a remote window
- * points to an instance of struct vma_pvt
- */
-struct vma_pvt {
-       struct scif_endpt *ep;  /* End point for remote window */
-       s64 offset;             /* offset within remote window */
-       bool valid_offset;      /* offset is valid only if the original
-                                * mmap request was for a single page
-                                * else the offset within the vma is
-                                * the correct offset
-                                */
-       struct kref ref;
-};
-
-static void vma_pvt_release(struct kref *ref)
-{
-       struct vma_pvt *vmapvt = container_of(ref, struct vma_pvt, ref);
-
-       kfree(vmapvt);
-}
-
-/**
- * scif_vma_open - VMA open driver callback
- * @vma: VMM memory area.
- * The open method is called by the kernel to allow the subsystem implementing
- * the VMA to initialize the area. This method is invoked any time a new
- * reference to the VMA is made (when a process forks, for example).
- * The one exception happens when the VMA is first created by mmap;
- * in this case, the driver's mmap method is called instead.
- * This function is also invoked when an existing VMA is split by the kernel
- * due to a call to munmap on a subset of the VMA resulting in two VMAs.
- * The kernel invokes this function only on one of the two VMAs.
- */
-static void scif_vma_open(struct vm_area_struct *vma)
-{
-       struct vma_pvt *vmapvt = vma->vm_private_data;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI vma open: vma_start 0x%lx vma_end 0x%lx\n",
-               vma->vm_start, vma->vm_end);
-       scif_insert_vma(vmapvt->ep, vma);
-       kref_get(&vmapvt->ref);
-}
-
-/**
- * scif_munmap - VMA close driver callback.
- * @vma: VMM memory area.
- * When an area is destroyed, the kernel calls its close operation.
- * Note that there's no usage count associated with VMA's; the area
- * is opened and closed exactly once by each process that uses it.
- */
-static void scif_munmap(struct vm_area_struct *vma)
-{
-       struct scif_endpt *ep;
-       struct vma_pvt *vmapvt = vma->vm_private_data;
-       int nr_pages = vma_pages(vma);
-       s64 offset;
-       struct scif_rma_req req;
-       struct scif_window *window = NULL;
-       int err;
-
-       might_sleep();
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI munmap: vma_start 0x%lx vma_end 0x%lx\n",
-               vma->vm_start, vma->vm_end);
-       ep = vmapvt->ep;
-       offset = vmapvt->valid_offset ? vmapvt->offset :
-               (vma->vm_pgoff) << PAGE_SHIFT;
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI munmap: ep %p nr_pages 0x%x offset 0x%llx\n",
-               ep, nr_pages, offset);
-       req.out_window = &window;
-       req.offset = offset;
-       req.nr_bytes = vma->vm_end - vma->vm_start;
-       req.prot = vma->vm_flags & (VM_READ | VM_WRITE);
-       req.type = SCIF_WINDOW_PARTIAL;
-       req.head = &ep->rma_info.remote_reg_list;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-
-       err = scif_query_window(&req);
-       if (err)
-               dev_err(scif_info.mdev.this_device,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-       else
-               scif_rma_list_munmap(window, offset, nr_pages);
-
-       mutex_unlock(&ep->rma_info.rma_lock);
-       /*
-        * The kernel probably zeroes these out but we still want
-        * to clean up our own mess just in case.
-        */
-       vma->vm_ops = NULL;
-       vma->vm_private_data = NULL;
-       kref_put(&vmapvt->ref, vma_pvt_release);
-       scif_delete_vma(ep, vma);
-}
-
-static const struct vm_operations_struct scif_vm_ops = {
-       .open = scif_vma_open,
-       .close = scif_munmap,
-};
-
-/**
- * scif_mmap - Map pages in virtual address space to a remote window.
- * @vma: VMM memory area.
- * @epd: endpoint descriptor
- *
- * Return: Upon successful completion, scif_mmap() returns zero
- * else an apt error is returned as documented in scif.h
- */
-int scif_mmap(struct vm_area_struct *vma, scif_epd_t epd)
-{
-       struct scif_rma_req req;
-       struct scif_window *window = NULL;
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       s64 start_offset = vma->vm_pgoff << PAGE_SHIFT;
-       int nr_pages = vma_pages(vma);
-       int err;
-       struct vma_pvt *vmapvt;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI mmap: ep %p start_offset 0x%llx nr_pages 0x%x\n",
-               ep, start_offset, nr_pages);
-       err = scif_verify_epd(ep);
-       if (err)
-               return err;
-
-       might_sleep();
-
-       err = scif_insert_vma(ep, vma);
-       if (err)
-               return err;
-
-       vmapvt = kzalloc(sizeof(*vmapvt), GFP_KERNEL);
-       if (!vmapvt) {
-               scif_delete_vma(ep, vma);
-               return -ENOMEM;
-       }
-
-       vmapvt->ep = ep;
-       kref_init(&vmapvt->ref);
-
-       req.out_window = &window;
-       req.offset = start_offset;
-       req.nr_bytes = vma->vm_end - vma->vm_start;
-       req.prot = vma->vm_flags & (VM_READ | VM_WRITE);
-       req.type = SCIF_WINDOW_PARTIAL;
-       req.head = &ep->rma_info.remote_reg_list;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       /* Does a valid window exist? */
-       err = scif_query_window(&req);
-       if (err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-               goto error_unlock;
-       }
-
-       /* Default prot for loopback */
-       if (!scifdev_self(ep->remote_dev))
-               vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-
-       /*
-        * VM_DONTCOPY - Do not copy this vma on fork
-        * VM_DONTEXPAND - Cannot expand with mremap()
-        * VM_RESERVED - Count as reserved_vm like IO
-        * VM_PFNMAP - Page-ranges managed without "struct page"
-        * VM_IO - Memory mapped I/O or similar
-        *
-        * We do not want to copy this VMA automatically on a fork(),
-        * expand this VMA due to mremap() or swap out these pages since
-        * the VMA is actually backed by physical pages in the remote
-        * node's physical memory and not via a struct page.
-        */
-       vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND | VM_DONTDUMP;
-
-       if (!scifdev_self(ep->remote_dev))
-               vma->vm_flags |= VM_IO | VM_PFNMAP;
-
-       /* Map this range of windows */
-       err = scif_rma_list_mmap(window, start_offset, nr_pages, vma);
-       if (err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-               goto error_unlock;
-       }
-       /* Set up the driver call back */
-       vma->vm_ops = &scif_vm_ops;
-       vma->vm_private_data = vmapvt;
-error_unlock:
-       mutex_unlock(&ep->rma_info.rma_lock);
-       if (err) {
-               kfree(vmapvt);
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-               scif_delete_vma(ep, vma);
-       }
-       return err;
-}
diff --git a/drivers/misc/mic/scif/scif_nm.c b/drivers/misc/mic/scif/scif_nm.c
deleted file mode 100644 (file)
index c4d9422..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include "scif_peer_bus.h"
-
-#include "scif_main.h"
-#include "scif_map.h"
-
-/**
- * scif_invalidate_ep() - Set state for all connected endpoints
- * to disconnected and wake up all send/recv waitqueues
- *
- * @node: Node to invalidate
- */
-static void scif_invalidate_ep(int node)
-{
-       struct scif_endpt *ep;
-       struct list_head *pos, *tmpq;
-
-       flush_work(&scif_info.conn_work);
-       mutex_lock(&scif_info.connlock);
-       list_for_each_safe(pos, tmpq, &scif_info.disconnected) {
-               ep = list_entry(pos, struct scif_endpt, list);
-               if (ep->remote_dev->node == node) {
-                       scif_unmap_all_windows(ep);
-                       spin_lock(&ep->lock);
-                       scif_cleanup_ep_qp(ep);
-                       spin_unlock(&ep->lock);
-               }
-       }
-       list_for_each_safe(pos, tmpq, &scif_info.connected) {
-               ep = list_entry(pos, struct scif_endpt, list);
-               if (ep->remote_dev->node == node) {
-                       list_del(pos);
-                       spin_lock(&ep->lock);
-                       ep->state = SCIFEP_DISCONNECTED;
-                       list_add_tail(&ep->list, &scif_info.disconnected);
-                       scif_cleanup_ep_qp(ep);
-                       wake_up_interruptible(&ep->sendwq);
-                       wake_up_interruptible(&ep->recvwq);
-                       spin_unlock(&ep->lock);
-                       scif_unmap_all_windows(ep);
-               }
-       }
-       mutex_unlock(&scif_info.connlock);
-}
-
-void scif_free_qp(struct scif_dev *scifdev)
-{
-       struct scif_qp *qp = scifdev->qpairs;
-
-       if (!qp)
-               return;
-       scif_unmap_single(qp->local_buf, scifdev, qp->inbound_q.size);
-       kfree(qp->inbound_q.rb_base);
-       scif_unmap_single(qp->local_qp, scifdev, sizeof(struct scif_qp));
-       kfree(scifdev->qpairs);
-       scifdev->qpairs = NULL;
-}
-
-static void scif_cleanup_qp(struct scif_dev *dev)
-{
-       struct scif_qp *qp = &dev->qpairs[0];
-
-       if (!qp)
-               return;
-       scif_iounmap((void *)qp->remote_qp, sizeof(struct scif_qp), dev);
-       scif_iounmap((void *)qp->outbound_q.rb_base,
-                    sizeof(struct scif_qp), dev);
-       qp->remote_qp = NULL;
-       qp->local_write = 0;
-       qp->inbound_q.current_write_offset = 0;
-       qp->inbound_q.current_read_offset = 0;
-       if (scifdev_is_p2p(dev))
-               scif_free_qp(dev);
-}
-
-void scif_send_acks(struct scif_dev *dev)
-{
-       struct scifmsg msg;
-
-       if (dev->node_remove_ack_pending) {
-               msg.uop = SCIF_NODE_REMOVE_ACK;
-               msg.src.node = scif_info.nodeid;
-               msg.dst.node = SCIF_MGMT_NODE;
-               msg.payload[0] = dev->node;
-               scif_nodeqp_send(&scif_dev[SCIF_MGMT_NODE], &msg);
-               dev->node_remove_ack_pending = false;
-       }
-       if (dev->exit_ack_pending) {
-               msg.uop = SCIF_EXIT_ACK;
-               msg.src.node = scif_info.nodeid;
-               msg.dst.node = dev->node;
-               scif_nodeqp_send(dev, &msg);
-               dev->exit_ack_pending = false;
-       }
-}
-
-/**
- * scif_cleanup_scifdev - Uninitialize SCIF data structures for remote
- *                        SCIF device.
- * @dev: Remote SCIF device.
- */
-void scif_cleanup_scifdev(struct scif_dev *dev)
-{
-       struct scif_hw_dev *sdev = dev->sdev;
-
-       if (!dev->sdev)
-               return;
-       if (scifdev_is_p2p(dev)) {
-               if (dev->cookie) {
-                       sdev->hw_ops->free_irq(sdev, dev->cookie, dev);
-                       dev->cookie = NULL;
-               }
-               scif_destroy_intr_wq(dev);
-       }
-       flush_work(&scif_info.misc_work);
-       scif_destroy_p2p(dev);
-       scif_invalidate_ep(dev->node);
-       scif_zap_mmaps(dev->node);
-       scif_cleanup_rma_for_zombies(dev->node);
-       flush_work(&scif_info.misc_work);
-       scif_send_acks(dev);
-       if (!dev->node && scif_info.card_initiated_exit) {
-               /*
-                * Send an SCIF_EXIT message which is the last message from MIC
-                * to the Host and wait for a SCIF_EXIT_ACK
-                */
-               scif_send_exit(dev);
-               scif_info.card_initiated_exit = false;
-       }
-       scif_cleanup_qp(dev);
-}
-
-/**
- * scif_remove_node
- *
- * @node: Node to remove
- */
-void scif_handle_remove_node(int node)
-{
-       struct scif_dev *scifdev = &scif_dev[node];
-
-       if (scif_peer_unregister_device(scifdev))
-               scif_send_acks(scifdev);
-}
-
-static int scif_send_rmnode_msg(int node, int remove_node)
-{
-       struct scifmsg notif_msg;
-       struct scif_dev *dev = &scif_dev[node];
-
-       notif_msg.uop = SCIF_NODE_REMOVE;
-       notif_msg.src.node = scif_info.nodeid;
-       notif_msg.dst.node = node;
-       notif_msg.payload[0] = remove_node;
-       return scif_nodeqp_send(dev, &notif_msg);
-}
-
-/**
- * scif_node_disconnect
- *
- * @node_id: source node id [in]
- * @mgmt_initiated: Disconnection initiated from the mgmt node
- *
- * Disconnect a node from the scif network.
- */
-void scif_disconnect_node(u32 node_id, bool mgmt_initiated)
-{
-       int ret;
-       int msg_cnt = 0;
-       u32 i = 0;
-       struct scif_dev *scifdev = &scif_dev[node_id];
-
-       if (!node_id)
-               return;
-
-       atomic_set(&scifdev->disconn_rescnt, 0);
-
-       /* Destroy p2p network */
-       for (i = 1; i <= scif_info.maxid; i++) {
-               if (i == node_id)
-                       continue;
-               ret = scif_send_rmnode_msg(i, node_id);
-               if (!ret)
-                       msg_cnt++;
-       }
-       /* Wait for the remote nodes to respond with SCIF_NODE_REMOVE_ACK */
-       ret = wait_event_timeout(scifdev->disconn_wq,
-                                (atomic_read(&scifdev->disconn_rescnt)
-                                == msg_cnt), SCIF_NODE_ALIVE_TIMEOUT);
-       /* Tell the card to clean up */
-       if (mgmt_initiated && _scifdev_alive(scifdev))
-               /*
-                * Send an SCIF_EXIT message which is the last message from Host
-                * to the MIC and wait for a SCIF_EXIT_ACK
-                */
-               scif_send_exit(scifdev);
-       atomic_set(&scifdev->disconn_rescnt, 0);
-       /* Tell the mgmt node to clean up */
-       ret = scif_send_rmnode_msg(SCIF_MGMT_NODE, node_id);
-       if (!ret)
-               /* Wait for mgmt node to respond with SCIF_NODE_REMOVE_ACK */
-               wait_event_timeout(scifdev->disconn_wq,
-                                  (atomic_read(&scifdev->disconn_rescnt) == 1),
-                                  SCIF_NODE_ALIVE_TIMEOUT);
-}
-
-void scif_get_node_info(void)
-{
-       struct scifmsg msg;
-       DECLARE_COMPLETION_ONSTACK(node_info);
-
-       msg.uop = SCIF_GET_NODE_INFO;
-       msg.src.node = scif_info.nodeid;
-       msg.dst.node = SCIF_MGMT_NODE;
-       msg.payload[3] = (u64)&node_info;
-
-       if ((scif_nodeqp_send(&scif_dev[SCIF_MGMT_NODE], &msg)))
-               return;
-
-       /* Wait for a response with SCIF_GET_NODE_INFO */
-       wait_for_completion(&node_info);
-}
diff --git a/drivers/misc/mic/scif/scif_nodeqp.c b/drivers/misc/mic/scif/scif_nodeqp.c
deleted file mode 100644 (file)
index 384ce08..0000000
+++ /dev/null
@@ -1,1349 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include "../bus/scif_bus.h"
-#include "scif_peer_bus.h"
-#include "scif_main.h"
-#include "scif_nodeqp.h"
-#include "scif_map.h"
-
-/*
- ************************************************************************
- * SCIF node Queue Pair (QP) setup flow:
- *
- * 1) SCIF driver gets probed with a scif_hw_dev via the scif_hw_bus
- * 2) scif_setup_qp(..) allocates the local qp and calls
- *     scif_setup_qp_connect(..) which allocates and maps the local
- *     buffer for the inbound QP
- * 3) The local node updates the device page with the DMA address of the QP
- * 4) A delayed work is scheduled (qp_dwork) which periodically reads if
- *     the peer node has updated its QP DMA address
- * 5) Once a valid non zero address is found in the QP DMA address field
- *     in the device page, the local node maps the remote node's QP,
- *     updates its outbound QP and sends a SCIF_INIT message to the peer
- * 6) The SCIF_INIT message is received by the peer node QP interrupt bottom
- *     half handler by calling scif_init(..)
- * 7) scif_init(..) registers a new SCIF peer node by calling
- *     scif_peer_register_device(..) which signifies the addition of a new
- *     SCIF node
- * 8) On the mgmt node, P2P network setup/teardown is initiated if all the
- *     remote nodes are online via scif_p2p_setup(..)
- * 9) For P2P setup, the host maps the remote nodes' aperture and memory
- *     bars and sends a SCIF_NODE_ADD message to both nodes
- * 10) As part of scif_nodeadd, both nodes set up their local inbound
- *     QPs and send a SCIF_NODE_ADD_ACK to the mgmt node
- * 11) As part of scif_node_add_ack(..) the mgmt node forwards the
- *     SCIF_NODE_ADD_ACK to the remote nodes
- * 12) As part of scif_node_add_ack(..) the remote nodes update their
- *     outbound QPs, make sure they can access memory on the remote node
- *     and then add a new SCIF peer node by calling
- *     scif_peer_register_device(..) which signifies the addition of a new
- *     SCIF node.
- * 13) The SCIF network is now established across all nodes.
- *
- ************************************************************************
- * SCIF node QP teardown flow (initiated by non mgmt node):
- *
- * 1) SCIF driver gets a remove callback with a scif_hw_dev via the scif_hw_bus
- * 2) The device page QP DMA address field is updated with 0x0
- * 3) A non mgmt node now cleans up all local data structures and sends a
- *     SCIF_EXIT message to the peer and waits for a SCIF_EXIT_ACK
- * 4) As part of scif_exit(..) handling scif_disconnect_node(..) is called
- * 5) scif_disconnect_node(..) sends a SCIF_NODE_REMOVE message to all the
- *     peers and waits for a SCIF_NODE_REMOVE_ACK
- * 6) As part of scif_node_remove(..) a remote node unregisters the peer
- *     node from the SCIF network and sends a SCIF_NODE_REMOVE_ACK
- * 7) When the mgmt node has received all the SCIF_NODE_REMOVE_ACKs
- *     it sends itself a node remove message whose handling cleans up local
- *     data structures and unregisters the peer node from the SCIF network
- * 8) The mgmt node sends a SCIF_EXIT_ACK
- * 9) Upon receipt of the SCIF_EXIT_ACK the node initiating the teardown
- *     completes the SCIF remove routine
- * 10) The SCIF network is now torn down for the node initiating the
- *     teardown sequence
- *
- ************************************************************************
- * SCIF node QP teardown flow (initiated by mgmt node):
- *
- * 1) SCIF driver gets a remove callback with a scif_hw_dev via the scif_hw_bus
- * 2) The device page QP DMA address field is updated with 0x0
- * 3) The mgmt node calls scif_disconnect_node(..)
- * 4) scif_disconnect_node(..) sends a SCIF_NODE_REMOVE message to all the peers
- *     and waits for a SCIF_NODE_REMOVE_ACK
- * 5) As part of scif_node_remove(..) a remote node unregisters the peer
- *     node from the SCIF network and sends a SCIF_NODE_REMOVE_ACK
- * 6) When the mgmt node has received all the SCIF_NODE_REMOVE_ACKs
- *     it unregisters the peer node from the SCIF network
- * 7) The mgmt node sends a SCIF_EXIT message and waits for a SCIF_EXIT_ACK.
- * 8) A non mgmt node upon receipt of a SCIF_EXIT message calls scif_stop(..)
- *     which would clean up local data structures for all SCIF nodes and
- *     then send a SCIF_EXIT_ACK back to the mgmt node
- * 9) Upon receipt of the SCIF_EXIT_ACK the the mgmt node sends itself a node
- *     remove message whose handling cleans up local data structures and
- *     destroys any P2P mappings.
- * 10) The SCIF hardware device for which a remove callback was received is now
- *     disconnected from the SCIF network.
- */
-/*
- * Initializes "local" data structures for the QP. Allocates the QP
- * ring buffer (rb) and initializes the "in bound" queue.
- */
-int scif_setup_qp_connect(struct scif_qp *qp, dma_addr_t *qp_offset,
-                         int local_size, struct scif_dev *scifdev)
-{
-       void *local_q = qp->inbound_q.rb_base;
-       int err = 0;
-       u32 tmp_rd = 0;
-
-       spin_lock_init(&qp->send_lock);
-       spin_lock_init(&qp->recv_lock);
-
-       /* Allocate rb only if not already allocated */
-       if (!local_q) {
-               local_q = kzalloc(local_size, GFP_KERNEL);
-               if (!local_q) {
-                       err = -ENOMEM;
-                       return err;
-               }
-       }
-
-       err = scif_map_single(&qp->local_buf, local_q, scifdev, local_size);
-       if (err)
-               goto kfree;
-       /*
-        * To setup the inbound_q, the buffer lives locally, the read pointer
-        * is remote and the write pointer is local.
-        */
-       scif_rb_init(&qp->inbound_q,
-                    &tmp_rd,
-                    &qp->local_write,
-                    local_q, get_count_order(local_size));
-       /*
-        * The read pointer is NULL initially and it is unsafe to use the ring
-        * buffer til this changes!
-        */
-       qp->inbound_q.read_ptr = NULL;
-       err = scif_map_single(qp_offset, qp,
-                             scifdev, sizeof(struct scif_qp));
-       if (err)
-               goto unmap;
-       qp->local_qp = *qp_offset;
-       return err;
-unmap:
-       scif_unmap_single(qp->local_buf, scifdev, local_size);
-       qp->local_buf = 0;
-kfree:
-       kfree(local_q);
-       return err;
-}
-
-/* When the other side has already done it's allocation, this is called */
-int scif_setup_qp_accept(struct scif_qp *qp, dma_addr_t *qp_offset,
-                        dma_addr_t phys, int local_size,
-                        struct scif_dev *scifdev)
-{
-       void *local_q;
-       void *remote_q;
-       struct scif_qp *remote_qp;
-       int remote_size;
-       int err = 0;
-
-       spin_lock_init(&qp->send_lock);
-       spin_lock_init(&qp->recv_lock);
-       /* Start by figuring out where we need to point */
-       remote_qp = scif_ioremap(phys, sizeof(struct scif_qp), scifdev);
-       if (!remote_qp)
-               return -EIO;
-       qp->remote_qp = remote_qp;
-       if (qp->remote_qp->magic != SCIFEP_MAGIC) {
-               err = -EIO;
-               goto iounmap;
-       }
-       qp->remote_buf = remote_qp->local_buf;
-       remote_size = qp->remote_qp->inbound_q.size;
-       remote_q = scif_ioremap(qp->remote_buf, remote_size, scifdev);
-       if (!remote_q) {
-               err = -EIO;
-               goto iounmap;
-       }
-       qp->remote_qp->local_write = 0;
-       /*
-        * To setup the outbound_q, the buffer lives in remote memory,
-        * the read pointer is local, the write pointer is remote
-        */
-       scif_rb_init(&qp->outbound_q,
-                    &qp->local_read,
-                    &qp->remote_qp->local_write,
-                    remote_q,
-                    get_count_order(remote_size));
-       local_q = kzalloc(local_size, GFP_KERNEL);
-       if (!local_q) {
-               err = -ENOMEM;
-               goto iounmap_1;
-       }
-       err = scif_map_single(&qp->local_buf, local_q, scifdev, local_size);
-       if (err)
-               goto kfree;
-       qp->remote_qp->local_read = 0;
-       /*
-        * To setup the inbound_q, the buffer lives locally, the read pointer
-        * is remote and the write pointer is local
-        */
-       scif_rb_init(&qp->inbound_q,
-                    &qp->remote_qp->local_read,
-                    &qp->local_write,
-                    local_q, get_count_order(local_size));
-       err = scif_map_single(qp_offset, qp, scifdev,
-                             sizeof(struct scif_qp));
-       if (err)
-               goto unmap;
-       qp->local_qp = *qp_offset;
-       return err;
-unmap:
-       scif_unmap_single(qp->local_buf, scifdev, local_size);
-       qp->local_buf = 0;
-kfree:
-       kfree(local_q);
-iounmap_1:
-       scif_iounmap(remote_q, remote_size, scifdev);
-       qp->outbound_q.rb_base = NULL;
-iounmap:
-       scif_iounmap(qp->remote_qp, sizeof(struct scif_qp), scifdev);
-       qp->remote_qp = NULL;
-       return err;
-}
-
-int scif_setup_qp_connect_response(struct scif_dev *scifdev,
-                                  struct scif_qp *qp, u64 payload)
-{
-       int err = 0;
-       void *r_buf;
-       int remote_size;
-       phys_addr_t tmp_phys;
-
-       qp->remote_qp = scif_ioremap(payload, sizeof(struct scif_qp), scifdev);
-
-       if (!qp->remote_qp) {
-               err = -ENOMEM;
-               goto error;
-       }
-
-       if (qp->remote_qp->magic != SCIFEP_MAGIC) {
-               dev_err(&scifdev->sdev->dev,
-                       "SCIFEP_MAGIC mismatch between self %d remote %d\n",
-                       scif_dev[scif_info.nodeid].node, scifdev->node);
-               err = -ENODEV;
-               goto error;
-       }
-
-       tmp_phys = qp->remote_qp->local_buf;
-       remote_size = qp->remote_qp->inbound_q.size;
-       r_buf = scif_ioremap(tmp_phys, remote_size, scifdev);
-
-       if (!r_buf)
-               return -EIO;
-
-       qp->local_read = 0;
-       scif_rb_init(&qp->outbound_q,
-                    &qp->local_read,
-                    &qp->remote_qp->local_write,
-                    r_buf,
-                    get_count_order(remote_size));
-       /*
-        * Because the node QP may already be processing an INIT message, set
-        * the read pointer so the cached read offset isn't lost
-        */
-       qp->remote_qp->local_read = qp->inbound_q.current_read_offset;
-       /*
-        * resetup the inbound_q now that we know where the
-        * inbound_read really is.
-        */
-       scif_rb_init(&qp->inbound_q,
-                    &qp->remote_qp->local_read,
-                    &qp->local_write,
-                    qp->inbound_q.rb_base,
-                    get_count_order(qp->inbound_q.size));
-error:
-       return err;
-}
-
-static __always_inline void
-scif_send_msg_intr(struct scif_dev *scifdev)
-{
-       struct scif_hw_dev *sdev = scifdev->sdev;
-
-       if (scifdev_is_p2p(scifdev))
-               sdev->hw_ops->send_p2p_intr(sdev, scifdev->rdb, &scifdev->mmio);
-       else
-               sdev->hw_ops->send_intr(sdev, scifdev->rdb);
-}
-
-int scif_qp_response(phys_addr_t phys, struct scif_dev *scifdev)
-{
-       int err = 0;
-       struct scifmsg msg;
-
-       err = scif_setup_qp_connect_response(scifdev, scifdev->qpairs, phys);
-       if (!err) {
-               /*
-                * Now that everything is setup and mapped, we're ready
-                * to tell the peer about our queue's location
-                */
-               msg.uop = SCIF_INIT;
-               msg.dst.node = scifdev->node;
-               err = scif_nodeqp_send(scifdev, &msg);
-       }
-       return err;
-}
-
-void scif_send_exit(struct scif_dev *scifdev)
-{
-       struct scifmsg msg;
-       int ret;
-
-       scifdev->exit = OP_IN_PROGRESS;
-       msg.uop = SCIF_EXIT;
-       msg.src.node = scif_info.nodeid;
-       msg.dst.node = scifdev->node;
-       ret = scif_nodeqp_send(scifdev, &msg);
-       if (ret)
-               goto done;
-       /* Wait for a SCIF_EXIT_ACK message */
-       wait_event_timeout(scif_info.exitwq, scifdev->exit == OP_COMPLETED,
-                          SCIF_NODE_ALIVE_TIMEOUT);
-done:
-       scifdev->exit = OP_IDLE;
-}
-
-int scif_setup_qp(struct scif_dev *scifdev)
-{
-       int err = 0;
-       int local_size;
-       struct scif_qp *qp;
-
-       local_size = SCIF_NODE_QP_SIZE;
-
-       qp = kzalloc(sizeof(*qp), GFP_KERNEL);
-       if (!qp) {
-               err = -ENOMEM;
-               return err;
-       }
-       qp->magic = SCIFEP_MAGIC;
-       scifdev->qpairs = qp;
-       err = scif_setup_qp_connect(qp, &scifdev->qp_dma_addr,
-                                   local_size, scifdev);
-       if (err)
-               goto free_qp;
-       /*
-        * We're as setup as we can be. The inbound_q is setup, w/o a usable
-        * outbound q.  When we get a message, the read_ptr will be updated,
-        * and we will pull the message.
-        */
-       return err;
-free_qp:
-       kfree(scifdev->qpairs);
-       scifdev->qpairs = NULL;
-       return err;
-}
-
-static void scif_p2p_freesg(struct scatterlist *sg)
-{
-       kfree(sg);
-}
-
-static struct scatterlist *
-scif_p2p_setsg(phys_addr_t pa, int page_size, int page_cnt)
-{
-       struct scatterlist *sg;
-       struct page *page;
-       int i;
-
-       sg = kmalloc_array(page_cnt, sizeof(struct scatterlist), GFP_KERNEL);
-       if (!sg)
-               return NULL;
-       sg_init_table(sg, page_cnt);
-       for (i = 0; i < page_cnt; i++) {
-               page = pfn_to_page(pa >> PAGE_SHIFT);
-               sg_set_page(&sg[i], page, page_size, 0);
-               pa += page_size;
-       }
-       return sg;
-}
-
-/* Init p2p mappings required to access peerdev from scifdev */
-static struct scif_p2p_info *
-scif_init_p2p_info(struct scif_dev *scifdev, struct scif_dev *peerdev)
-{
-       struct scif_p2p_info *p2p;
-       int num_mmio_pages, num_aper_pages, sg_page_shift, err, num_aper_chunks;
-       struct scif_hw_dev *psdev = peerdev->sdev;
-       struct scif_hw_dev *sdev = scifdev->sdev;
-
-       num_mmio_pages = psdev->mmio->len >> PAGE_SHIFT;
-       num_aper_pages = psdev->aper->len >> PAGE_SHIFT;
-
-       p2p = kzalloc(sizeof(*p2p), GFP_KERNEL);
-       if (!p2p)
-               return NULL;
-       p2p->ppi_sg[SCIF_PPI_MMIO] = scif_p2p_setsg(psdev->mmio->pa,
-                                                   PAGE_SIZE, num_mmio_pages);
-       if (!p2p->ppi_sg[SCIF_PPI_MMIO])
-               goto free_p2p;
-       p2p->sg_nentries[SCIF_PPI_MMIO] = num_mmio_pages;
-       sg_page_shift = get_order(min(psdev->aper->len, (u64)(1 << 30)));
-       num_aper_chunks = num_aper_pages >> (sg_page_shift - PAGE_SHIFT);
-       p2p->ppi_sg[SCIF_PPI_APER] = scif_p2p_setsg(psdev->aper->pa,
-                                                   1 << sg_page_shift,
-                                                   num_aper_chunks);
-       p2p->sg_nentries[SCIF_PPI_APER] = num_aper_chunks;
-       err = dma_map_sg(&sdev->dev, p2p->ppi_sg[SCIF_PPI_MMIO],
-                        num_mmio_pages, PCI_DMA_BIDIRECTIONAL);
-       if (err != num_mmio_pages)
-               goto scif_p2p_free;
-       err = dma_map_sg(&sdev->dev, p2p->ppi_sg[SCIF_PPI_APER],
-                        num_aper_chunks, PCI_DMA_BIDIRECTIONAL);
-       if (err != num_aper_chunks)
-               goto dma_unmap;
-       p2p->ppi_da[SCIF_PPI_MMIO] = sg_dma_address(p2p->ppi_sg[SCIF_PPI_MMIO]);
-       p2p->ppi_da[SCIF_PPI_APER] = sg_dma_address(p2p->ppi_sg[SCIF_PPI_APER]);
-       p2p->ppi_len[SCIF_PPI_MMIO] = num_mmio_pages;
-       p2p->ppi_len[SCIF_PPI_APER] = num_aper_pages;
-       p2p->ppi_peer_id = peerdev->node;
-       return p2p;
-dma_unmap:
-       dma_unmap_sg(&sdev->dev, p2p->ppi_sg[SCIF_PPI_MMIO],
-                    p2p->sg_nentries[SCIF_PPI_MMIO], DMA_BIDIRECTIONAL);
-scif_p2p_free:
-       scif_p2p_freesg(p2p->ppi_sg[SCIF_PPI_MMIO]);
-       scif_p2p_freesg(p2p->ppi_sg[SCIF_PPI_APER]);
-free_p2p:
-       kfree(p2p);
-       return NULL;
-}
-
-/* Uninitialize and release resources from a p2p mapping */
-static void scif_deinit_p2p_info(struct scif_dev *scifdev,
-                                struct scif_p2p_info *p2p)
-{
-       struct scif_hw_dev *sdev = scifdev->sdev;
-
-       dma_unmap_sg(&sdev->dev, p2p->ppi_sg[SCIF_PPI_MMIO],
-                    p2p->sg_nentries[SCIF_PPI_MMIO], DMA_BIDIRECTIONAL);
-       dma_unmap_sg(&sdev->dev, p2p->ppi_sg[SCIF_PPI_APER],
-                    p2p->sg_nentries[SCIF_PPI_APER], DMA_BIDIRECTIONAL);
-       scif_p2p_freesg(p2p->ppi_sg[SCIF_PPI_MMIO]);
-       scif_p2p_freesg(p2p->ppi_sg[SCIF_PPI_APER]);
-       kfree(p2p);
-}
-
-/**
- * scif_node_connect: Respond to SCIF_NODE_CONNECT interrupt message
- * @scifdev: SCIF device
- * @dst: Destination node
- *
- * Connect the src and dst node by setting up the p2p connection
- * between them. Management node here acts like a proxy.
- */
-static void scif_node_connect(struct scif_dev *scifdev, int dst)
-{
-       struct scif_dev *dev_j = scifdev;
-       struct scif_dev *dev_i = NULL;
-       struct scif_p2p_info *p2p_ij = NULL;    /* bus addr for j from i */
-       struct scif_p2p_info *p2p_ji = NULL;    /* bus addr for i from j */
-       struct scif_p2p_info *p2p;
-       struct list_head *pos, *tmp;
-       struct scifmsg msg;
-       int err;
-       u64 tmppayload;
-
-       if (dst < 1 || dst > scif_info.maxid)
-               return;
-
-       dev_i = &scif_dev[dst];
-
-       if (!_scifdev_alive(dev_i))
-               return;
-       /*
-        * If the p2p connection is already setup or in the process of setting
-        * up then just ignore this request. The requested node will get
-        * informed by SCIF_NODE_ADD_ACK or SCIF_NODE_ADD_NACK
-        */
-       if (!list_empty(&dev_i->p2p)) {
-               list_for_each_safe(pos, tmp, &dev_i->p2p) {
-                       p2p = list_entry(pos, struct scif_p2p_info, ppi_list);
-                       if (p2p->ppi_peer_id == dev_j->node)
-                               return;
-               }
-       }
-       p2p_ij = scif_init_p2p_info(dev_i, dev_j);
-       if (!p2p_ij)
-               return;
-       p2p_ji = scif_init_p2p_info(dev_j, dev_i);
-       if (!p2p_ji) {
-               scif_deinit_p2p_info(dev_i, p2p_ij);
-               return;
-       }
-       list_add_tail(&p2p_ij->ppi_list, &dev_i->p2p);
-       list_add_tail(&p2p_ji->ppi_list, &dev_j->p2p);
-
-       /*
-        * Send a SCIF_NODE_ADD to dev_i, pass it its bus address
-        * as seen from dev_j
-        */
-       msg.uop = SCIF_NODE_ADD;
-       msg.src.node = dev_j->node;
-       msg.dst.node = dev_i->node;
-
-       msg.payload[0] = p2p_ji->ppi_da[SCIF_PPI_APER];
-       msg.payload[1] = p2p_ij->ppi_da[SCIF_PPI_MMIO];
-       msg.payload[2] = p2p_ij->ppi_da[SCIF_PPI_APER];
-       msg.payload[3] = p2p_ij->ppi_len[SCIF_PPI_APER] << PAGE_SHIFT;
-
-       err = scif_nodeqp_send(dev_i,  &msg);
-       if (err) {
-               dev_err(&scifdev->sdev->dev,
-                       "%s %d error %d\n", __func__, __LINE__, err);
-               return;
-       }
-
-       /* Same as above but to dev_j */
-       msg.uop = SCIF_NODE_ADD;
-       msg.src.node = dev_i->node;
-       msg.dst.node = dev_j->node;
-
-       tmppayload = msg.payload[0];
-       msg.payload[0] = msg.payload[2];
-       msg.payload[2] = tmppayload;
-       msg.payload[1] = p2p_ji->ppi_da[SCIF_PPI_MMIO];
-       msg.payload[3] = p2p_ji->ppi_len[SCIF_PPI_APER] << PAGE_SHIFT;
-
-       scif_nodeqp_send(dev_j, &msg);
-}
-
-static void scif_p2p_setup(void)
-{
-       int i, j;
-
-       if (!scif_info.p2p_enable)
-               return;
-
-       for (i = 1; i <= scif_info.maxid; i++)
-               if (!_scifdev_alive(&scif_dev[i]))
-                       return;
-
-       for (i = 1; i <= scif_info.maxid; i++) {
-               for (j = 1; j <= scif_info.maxid; j++) {
-                       struct scif_dev *scifdev = &scif_dev[i];
-
-                       if (i == j)
-                               continue;
-                       scif_node_connect(scifdev, j);
-               }
-       }
-}
-
-static char *message_types[] = {"BAD",
-                               "INIT",
-                               "EXIT",
-                               "SCIF_EXIT_ACK",
-                               "SCIF_NODE_ADD",
-                               "SCIF_NODE_ADD_ACK",
-                               "SCIF_NODE_ADD_NACK",
-                               "REMOVE_NODE",
-                               "REMOVE_NODE_ACK",
-                               "CNCT_REQ",
-                               "CNCT_GNT",
-                               "CNCT_GNTACK",
-                               "CNCT_GNTNACK",
-                               "CNCT_REJ",
-                               "DISCNCT",
-                               "DISCNT_ACK",
-                               "CLIENT_SENT",
-                               "CLIENT_RCVD",
-                               "SCIF_GET_NODE_INFO",
-                               "REGISTER",
-                               "REGISTER_ACK",
-                               "REGISTER_NACK",
-                               "UNREGISTER",
-                               "UNREGISTER_ACK",
-                               "UNREGISTER_NACK",
-                               "ALLOC_REQ",
-                               "ALLOC_GNT",
-                               "ALLOC_REJ",
-                               "FREE_PHYS",
-                               "FREE_VIRT",
-                               "MUNMAP",
-                               "MARK",
-                               "MARK_ACK",
-                               "MARK_NACK",
-                               "WAIT",
-                               "WAIT_ACK",
-                               "WAIT_NACK",
-                               "SIGNAL_LOCAL",
-                               "SIGNAL_REMOTE",
-                               "SIG_ACK",
-                               "SIG_NACK"};
-
-static void
-scif_display_message(struct scif_dev *scifdev, struct scifmsg *msg,
-                    const char *label)
-{
-       if (!scif_info.en_msg_log)
-               return;
-       if (msg->uop > SCIF_MAX_MSG) {
-               dev_err(&scifdev->sdev->dev,
-                       "%s: unknown msg type %d\n", label, msg->uop);
-               return;
-       }
-       dev_info(&scifdev->sdev->dev,
-                "%s: msg type %s, src %d:%d, dest %d:%d payload 0x%llx:0x%llx:0x%llx:0x%llx\n",
-                label, message_types[msg->uop], msg->src.node, msg->src.port,
-                msg->dst.node, msg->dst.port, msg->payload[0], msg->payload[1],
-                msg->payload[2], msg->payload[3]);
-}
-
-int _scif_nodeqp_send(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_qp *qp = scifdev->qpairs;
-       int err = -ENOMEM, loop_cnt = 0;
-
-       scif_display_message(scifdev, msg, "Sent");
-       if (!qp) {
-               err = -EINVAL;
-               goto error;
-       }
-       spin_lock(&qp->send_lock);
-
-       while ((err = scif_rb_write(&qp->outbound_q,
-                                   msg, sizeof(struct scifmsg)))) {
-               mdelay(1);
-#define SCIF_NODEQP_SEND_TO_MSEC (3 * 1000)
-               if (loop_cnt++ > (SCIF_NODEQP_SEND_TO_MSEC)) {
-                       err = -ENODEV;
-                       break;
-               }
-       }
-       if (!err)
-               scif_rb_commit(&qp->outbound_q);
-       spin_unlock(&qp->send_lock);
-       if (!err) {
-               if (scifdev_self(scifdev))
-                       /*
-                        * For loopback we need to emulate an interrupt by
-                        * queuing work for the queue handling real node
-                        * Qp interrupts.
-                        */
-                       queue_work(scifdev->intr_wq, &scifdev->intr_bh);
-               else
-                       scif_send_msg_intr(scifdev);
-       }
-error:
-       if (err)
-               dev_dbg(&scifdev->sdev->dev,
-                       "%s %d error %d uop %d\n",
-                        __func__, __LINE__, err, msg->uop);
-       return err;
-}
-
-/**
- * scif_nodeqp_send - Send a message on the node queue pair
- * @scifdev: Scif Device.
- * @msg: The message to be sent.
- */
-int scif_nodeqp_send(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       int err;
-       struct device *spdev = NULL;
-
-       if (msg->uop > SCIF_EXIT_ACK) {
-               /* Don't send messages once the exit flow has begun */
-               if (OP_IDLE != scifdev->exit)
-                       return -ENODEV;
-               spdev = scif_get_peer_dev(scifdev);
-               if (IS_ERR(spdev)) {
-                       err = PTR_ERR(spdev);
-                       return err;
-               }
-       }
-       err = _scif_nodeqp_send(scifdev, msg);
-       if (msg->uop > SCIF_EXIT_ACK)
-               scif_put_peer_dev(spdev);
-       return err;
-}
-
-/*
- * scif_misc_handler:
- *
- * Work queue handler for servicing miscellaneous SCIF tasks.
- * Examples include:
- * 1) Remote fence requests.
- * 2) Destruction of temporary registered windows
- *    created during scif_vreadfrom()/scif_vwriteto().
- * 3) Cleanup of zombie endpoints.
- */
-void scif_misc_handler(struct work_struct *work)
-{
-       scif_rma_handle_remote_fences();
-       scif_rma_destroy_windows();
-       scif_rma_destroy_tcw_invalid();
-       scif_cleanup_zombie_epd();
-}
-
-/**
- * scif_init() - Respond to SCIF_INIT interrupt message
- * @scifdev:    Remote SCIF device node
- * @msg:        Interrupt message
- */
-static __always_inline void
-scif_init(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       /*
-        * Allow the thread waiting for device page updates for the peer QP DMA
-        * address to complete initializing the inbound_q.
-        */
-       flush_delayed_work(&scifdev->qp_dwork);
-
-       scif_peer_register_device(scifdev);
-
-       if (scif_is_mgmt_node()) {
-               mutex_lock(&scif_info.conflock);
-               scif_p2p_setup();
-               mutex_unlock(&scif_info.conflock);
-       }
-}
-
-/**
- * scif_exit() - Respond to SCIF_EXIT interrupt message
- * @scifdev:    Remote SCIF device node
- * @unused:     Interrupt message (unused)
- *
- * This function stops the SCIF interface for the node which sent
- * the SCIF_EXIT message and starts waiting for that node to
- * resetup the queue pair again.
- */
-static __always_inline void
-scif_exit(struct scif_dev *scifdev, struct scifmsg *unused)
-{
-       scifdev->exit_ack_pending = true;
-       if (scif_is_mgmt_node())
-               scif_disconnect_node(scifdev->node, false);
-       else
-               scif_stop(scifdev);
-       schedule_delayed_work(&scifdev->qp_dwork,
-                             msecs_to_jiffies(1000));
-}
-
-/**
- * scif_exitack() - Respond to SCIF_EXIT_ACK interrupt message
- * @scifdev:    Remote SCIF device node
- * @unused:     Interrupt message (unused)
- *
- */
-static __always_inline void
-scif_exit_ack(struct scif_dev *scifdev, struct scifmsg *unused)
-{
-       scifdev->exit = OP_COMPLETED;
-       wake_up(&scif_info.exitwq);
-}
-
-/**
- * scif_node_add() - Respond to SCIF_NODE_ADD interrupt message
- * @scifdev:    Remote SCIF device node
- * @msg:        Interrupt message
- *
- * When the mgmt node driver has finished initializing a MIC node queue pair it
- * marks the node as online. It then looks for all currently online MIC cards
- * and send a SCIF_NODE_ADD message to identify the ID of the new card for
- * peer to peer initialization
- *
- * The local node allocates its incoming queue and sends its address in the
- * SCIF_NODE_ADD_ACK message back to the mgmt node, the mgmt node "reflects"
- * this message to the new node
- */
-static __always_inline void
-scif_node_add(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_dev *newdev;
-       dma_addr_t qp_offset;
-       int qp_connect;
-       struct scif_hw_dev *sdev;
-
-       dev_dbg(&scifdev->sdev->dev,
-               "Scifdev %d:%d received NODE_ADD msg for node %d\n",
-               scifdev->node, msg->dst.node, msg->src.node);
-       dev_dbg(&scifdev->sdev->dev,
-               "Remote address for this node's aperture %llx\n",
-               msg->payload[0]);
-       newdev = &scif_dev[msg->src.node];
-       newdev->node = msg->src.node;
-       newdev->sdev = scif_dev[SCIF_MGMT_NODE].sdev;
-       sdev = newdev->sdev;
-
-       if (scif_setup_intr_wq(newdev)) {
-               dev_err(&scifdev->sdev->dev,
-                       "failed to setup interrupts for %d\n", msg->src.node);
-               goto interrupt_setup_error;
-       }
-       newdev->mmio.va = ioremap(msg->payload[1], sdev->mmio->len);
-       if (!newdev->mmio.va) {
-               dev_err(&scifdev->sdev->dev,
-                       "failed to map mmio for %d\n", msg->src.node);
-               goto mmio_map_error;
-       }
-       newdev->qpairs = kzalloc(sizeof(*newdev->qpairs), GFP_KERNEL);
-       if (!newdev->qpairs)
-               goto qp_alloc_error;
-       /*
-        * Set the base address of the remote node's memory since it gets
-        * added to qp_offset
-        */
-       newdev->base_addr = msg->payload[0];
-
-       qp_connect = scif_setup_qp_connect(newdev->qpairs, &qp_offset,
-                                          SCIF_NODE_QP_SIZE, newdev);
-       if (qp_connect) {
-               dev_err(&scifdev->sdev->dev,
-                       "failed to setup qp_connect %d\n", qp_connect);
-               goto qp_connect_error;
-       }
-
-       newdev->db = sdev->hw_ops->next_db(sdev);
-       newdev->cookie = sdev->hw_ops->request_irq(sdev, scif_intr_handler,
-                                                  "SCIF_INTR", newdev,
-                                                  newdev->db);
-       if (IS_ERR(newdev->cookie))
-               goto qp_connect_error;
-       newdev->qpairs->magic = SCIFEP_MAGIC;
-       newdev->qpairs->qp_state = SCIF_QP_OFFLINE;
-
-       msg->uop = SCIF_NODE_ADD_ACK;
-       msg->dst.node = msg->src.node;
-       msg->src.node = scif_info.nodeid;
-       msg->payload[0] = qp_offset;
-       msg->payload[2] = newdev->db;
-       scif_nodeqp_send(&scif_dev[SCIF_MGMT_NODE], msg);
-       return;
-qp_connect_error:
-       kfree(newdev->qpairs);
-       newdev->qpairs = NULL;
-qp_alloc_error:
-       iounmap(newdev->mmio.va);
-       newdev->mmio.va = NULL;
-mmio_map_error:
-interrupt_setup_error:
-       dev_err(&scifdev->sdev->dev,
-               "node add failed for node %d\n", msg->src.node);
-       msg->uop = SCIF_NODE_ADD_NACK;
-       msg->dst.node = msg->src.node;
-       msg->src.node = scif_info.nodeid;
-       scif_nodeqp_send(&scif_dev[SCIF_MGMT_NODE], msg);
-}
-
-void scif_poll_qp_state(struct work_struct *work)
-{
-#define SCIF_NODE_QP_RETRY 100
-#define SCIF_NODE_QP_TIMEOUT 100
-       struct scif_dev *peerdev = container_of(work, struct scif_dev,
-                                                       p2p_dwork.work);
-       struct scif_qp *qp = &peerdev->qpairs[0];
-
-       if (qp->qp_state != SCIF_QP_ONLINE ||
-           qp->remote_qp->qp_state != SCIF_QP_ONLINE) {
-               if (peerdev->p2p_retry++ == SCIF_NODE_QP_RETRY) {
-                       dev_err(&peerdev->sdev->dev,
-                               "Warning: QP check timeout with state %d\n",
-                               qp->qp_state);
-                       goto timeout;
-               }
-               schedule_delayed_work(&peerdev->p2p_dwork,
-                                     msecs_to_jiffies(SCIF_NODE_QP_TIMEOUT));
-               return;
-       }
-       return;
-timeout:
-       dev_err(&peerdev->sdev->dev,
-               "%s %d remote node %d offline,  state = 0x%x\n",
-               __func__, __LINE__, peerdev->node, qp->qp_state);
-       qp->remote_qp->qp_state = SCIF_QP_OFFLINE;
-       scif_peer_unregister_device(peerdev);
-       scif_cleanup_scifdev(peerdev);
-}
-
-/**
- * scif_node_add_ack() - Respond to SCIF_NODE_ADD_ACK interrupt message
- * @scifdev:    Remote SCIF device node
- * @msg:        Interrupt message
- *
- * After a MIC node receives the SCIF_NODE_ADD_ACK message it send this
- * message to the mgmt node to confirm the sequence is finished.
- *
- */
-static __always_inline void
-scif_node_add_ack(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_dev *peerdev;
-       struct scif_qp *qp;
-       struct scif_dev *dst_dev = &scif_dev[msg->dst.node];
-
-       dev_dbg(&scifdev->sdev->dev,
-               "Scifdev %d received SCIF_NODE_ADD_ACK msg src %d dst %d\n",
-               scifdev->node, msg->src.node, msg->dst.node);
-       dev_dbg(&scifdev->sdev->dev,
-               "payload %llx %llx %llx %llx\n", msg->payload[0],
-               msg->payload[1], msg->payload[2], msg->payload[3]);
-       if (scif_is_mgmt_node()) {
-               /*
-                * the lock serializes with scif_qp_response_ack. The mgmt node
-                * is forwarding the NODE_ADD_ACK message from src to dst we
-                * need to make sure that the dst has already received a
-                * NODE_ADD for src and setup its end of the qp to dst
-                */
-               mutex_lock(&scif_info.conflock);
-               msg->payload[1] = scif_info.maxid;
-               scif_nodeqp_send(dst_dev, msg);
-               mutex_unlock(&scif_info.conflock);
-               return;
-       }
-       peerdev = &scif_dev[msg->src.node];
-       peerdev->sdev = scif_dev[SCIF_MGMT_NODE].sdev;
-       peerdev->node = msg->src.node;
-
-       qp = &peerdev->qpairs[0];
-
-       if ((scif_setup_qp_connect_response(peerdev, &peerdev->qpairs[0],
-                                           msg->payload[0])))
-               goto local_error;
-       peerdev->rdb = msg->payload[2];
-       qp->remote_qp->qp_state = SCIF_QP_ONLINE;
-
-       scif_peer_register_device(peerdev);
-
-       schedule_delayed_work(&peerdev->p2p_dwork, 0);
-       return;
-local_error:
-       scif_cleanup_scifdev(peerdev);
-}
-
-/**
- * scif_node_add_nack: Respond to SCIF_NODE_ADD_NACK interrupt message
- * @scifdev:    Remote SCIF device node
- * @msg:        Interrupt message
- *
- * SCIF_NODE_ADD failed, so inform the waiting wq.
- */
-static __always_inline void
-scif_node_add_nack(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       if (scif_is_mgmt_node()) {
-               struct scif_dev *dst_dev = &scif_dev[msg->dst.node];
-
-               dev_dbg(&scifdev->sdev->dev,
-                       "SCIF_NODE_ADD_NACK received from %d\n", scifdev->node);
-               scif_nodeqp_send(dst_dev, msg);
-       }
-}
-
-/**
- * scif_node_remove: Handle SCIF_NODE_REMOVE message
- * @scifdev:    Remote SCIF device node
- * @msg: Interrupt message
- *
- * Handle node removal.
- */
-static __always_inline void
-scif_node_remove(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       int node = msg->payload[0];
-       struct scif_dev *scdev = &scif_dev[node];
-
-       scdev->node_remove_ack_pending = true;
-       scif_handle_remove_node(node);
-}
-
-/**
- * scif_node_remove_ack: Handle SCIF_NODE_REMOVE_ACK message
- * @scifdev:    Remote SCIF device node
- * @msg: Interrupt message
- *
- * The peer has acked a SCIF_NODE_REMOVE message.
- */
-static __always_inline void
-scif_node_remove_ack(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_dev *sdev = &scif_dev[msg->payload[0]];
-
-       atomic_inc(&sdev->disconn_rescnt);
-       wake_up(&sdev->disconn_wq);
-}
-
-/**
- * scif_get_node_info: Respond to SCIF_GET_NODE_INFO interrupt message
- * @scifdev:    Remote SCIF device node
- * @msg:        Interrupt message
- *
- * Retrieve node info i.e maxid and total from the mgmt node.
- */
-static __always_inline void
-scif_get_node_info_resp(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       if (scif_is_mgmt_node()) {
-               swap(msg->dst.node, msg->src.node);
-               mutex_lock(&scif_info.conflock);
-               msg->payload[1] = scif_info.maxid;
-               msg->payload[2] = scif_info.total;
-               mutex_unlock(&scif_info.conflock);
-               scif_nodeqp_send(scifdev, msg);
-       } else {
-               struct completion *node_info =
-                       (struct completion *)msg->payload[3];
-
-               mutex_lock(&scif_info.conflock);
-               scif_info.maxid = msg->payload[1];
-               scif_info.total = msg->payload[2];
-               complete_all(node_info);
-               mutex_unlock(&scif_info.conflock);
-       }
-}
-
-static void
-scif_msg_unknown(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       /* Bogus Node Qp Message? */
-       dev_err(&scifdev->sdev->dev,
-               "Unknown message 0x%xn scifdev->node 0x%x\n",
-               msg->uop, scifdev->node);
-}
-
-static void (*scif_intr_func[SCIF_MAX_MSG + 1])
-           (struct scif_dev *, struct scifmsg *msg) = {
-       scif_msg_unknown,       /* Error */
-       scif_init,              /* SCIF_INIT */
-       scif_exit,              /* SCIF_EXIT */
-       scif_exit_ack,          /* SCIF_EXIT_ACK */
-       scif_node_add,          /* SCIF_NODE_ADD */
-       scif_node_add_ack,      /* SCIF_NODE_ADD_ACK */
-       scif_node_add_nack,     /* SCIF_NODE_ADD_NACK */
-       scif_node_remove,       /* SCIF_NODE_REMOVE */
-       scif_node_remove_ack,   /* SCIF_NODE_REMOVE_ACK */
-       scif_cnctreq,           /* SCIF_CNCT_REQ */
-       scif_cnctgnt,           /* SCIF_CNCT_GNT */
-       scif_cnctgnt_ack,       /* SCIF_CNCT_GNTACK */
-       scif_cnctgnt_nack,      /* SCIF_CNCT_GNTNACK */
-       scif_cnctrej,           /* SCIF_CNCT_REJ */
-       scif_discnct,           /* SCIF_DISCNCT */
-       scif_discnt_ack,        /* SCIF_DISCNT_ACK */
-       scif_clientsend,        /* SCIF_CLIENT_SENT */
-       scif_clientrcvd,        /* SCIF_CLIENT_RCVD */
-       scif_get_node_info_resp,/* SCIF_GET_NODE_INFO */
-       scif_recv_reg,          /* SCIF_REGISTER */
-       scif_recv_reg_ack,      /* SCIF_REGISTER_ACK */
-       scif_recv_reg_nack,     /* SCIF_REGISTER_NACK */
-       scif_recv_unreg,        /* SCIF_UNREGISTER */
-       scif_recv_unreg_ack,    /* SCIF_UNREGISTER_ACK */
-       scif_recv_unreg_nack,   /* SCIF_UNREGISTER_NACK */
-       scif_alloc_req,         /* SCIF_ALLOC_REQ */
-       scif_alloc_gnt_rej,     /* SCIF_ALLOC_GNT */
-       scif_alloc_gnt_rej,     /* SCIF_ALLOC_REJ */
-       scif_free_virt,         /* SCIF_FREE_VIRT */
-       scif_recv_munmap,       /* SCIF_MUNMAP */
-       scif_recv_mark,         /* SCIF_MARK */
-       scif_recv_mark_resp,    /* SCIF_MARK_ACK */
-       scif_recv_mark_resp,    /* SCIF_MARK_NACK */
-       scif_recv_wait,         /* SCIF_WAIT */
-       scif_recv_wait_resp,    /* SCIF_WAIT_ACK */
-       scif_recv_wait_resp,    /* SCIF_WAIT_NACK */
-       scif_recv_sig_local,    /* SCIF_SIG_LOCAL */
-       scif_recv_sig_remote,   /* SCIF_SIG_REMOTE */
-       scif_recv_sig_resp,     /* SCIF_SIG_ACK */
-       scif_recv_sig_resp,     /* SCIF_SIG_NACK */
-};
-
-static int scif_max_msg_id = SCIF_MAX_MSG;
-/**
- * scif_nodeqp_msg_handler() - Common handler for node messages
- * @scifdev: Remote device to respond to
- * @qp: Remote memory pointer
- * @msg: The message to be handled.
- *
- * This routine calls the appropriate routine to handle a Node Qp
- * message receipt
- */
-static void
-scif_nodeqp_msg_handler(struct scif_dev *scifdev,
-                       struct scif_qp *qp, struct scifmsg *msg)
-{
-       scif_display_message(scifdev, msg, "Rcvd");
-
-       if (msg->uop > (u32)scif_max_msg_id) {
-               /* Bogus Node Qp Message? */
-               dev_err(&scifdev->sdev->dev,
-                       "Unknown message 0x%xn scifdev->node 0x%x\n",
-                       msg->uop, scifdev->node);
-               return;
-       }
-
-       scif_intr_func[msg->uop](scifdev, msg);
-}
-
-/**
- * scif_nodeqp_intrhandler() - Interrupt handler for node messages
- * @scifdev:    Remote device to respond to
- * @qp:         Remote memory pointer
- *
- * This routine is triggered by the interrupt mechanism.  It reads
- * messages from the node queue RB and calls the Node QP Message handling
- * routine.
- */
-void scif_nodeqp_intrhandler(struct scif_dev *scifdev, struct scif_qp *qp)
-{
-       struct scifmsg msg;
-       int read_size;
-
-       do {
-               read_size = scif_rb_get_next(&qp->inbound_q, &msg, sizeof(msg));
-               if (!read_size)
-                       break;
-               scif_nodeqp_msg_handler(scifdev, qp, &msg);
-               /*
-                * The node queue pair is unmapped so skip the read pointer
-                * update after receipt of a SCIF_EXIT_ACK
-                */
-               if (SCIF_EXIT_ACK == msg.uop)
-                       break;
-               scif_rb_update_read_ptr(&qp->inbound_q);
-       } while (1);
-}
-
-/**
- * scif_loopb_wq_handler - Loopback Workqueue Handler.
- * @unused: loop back work (unused)
- *
- * This work queue routine is invoked by the loopback work queue handler.
- * It grabs the recv lock, dequeues any available messages from the head
- * of the loopback message list, calls the node QP message handler,
- * waits for it to return, then frees up this message and dequeues more
- * elements of the list if available.
- */
-static void scif_loopb_wq_handler(struct work_struct *unused)
-{
-       struct scif_dev *scifdev = scif_info.loopb_dev;
-       struct scif_qp *qp = scifdev->qpairs;
-       struct scif_loopb_msg *msg;
-
-       do {
-               msg = NULL;
-               spin_lock(&qp->recv_lock);
-               if (!list_empty(&scif_info.loopb_recv_q)) {
-                       msg = list_first_entry(&scif_info.loopb_recv_q,
-                                              struct scif_loopb_msg,
-                                              list);
-                       list_del(&msg->list);
-               }
-               spin_unlock(&qp->recv_lock);
-
-               if (msg) {
-                       scif_nodeqp_msg_handler(scifdev, qp, &msg->msg);
-                       kfree(msg);
-               }
-       } while (msg);
-}
-
-/**
- * scif_loopb_msg_handler() - Workqueue handler for loopback messages.
- * @scifdev: SCIF device
- * @qp: Queue pair.
- *
- * This work queue routine is triggered when a loopback message is received.
- *
- * We need special handling for receiving Node Qp messages on a loopback SCIF
- * device via two workqueues for receiving messages.
- *
- * The reason we need the extra workqueue which is not required with *normal*
- * non-loopback SCIF devices is the potential classic deadlock described below:
- *
- * Thread A tries to send a message on a loopback SCIF device and blocks since
- * there is no space in the RB while it has the send_lock held or another
- * lock called lock X for example.
- *
- * Thread B: The Loopback Node QP message receive workqueue receives the message
- * and tries to send a message (eg an ACK) to the loopback SCIF device. It tries
- * to grab the send lock again or lock X and deadlocks with Thread A. The RB
- * cannot be drained any further due to this classic deadlock.
- *
- * In order to avoid deadlocks as mentioned above we have an extra level of
- * indirection achieved by having two workqueues.
- * 1) The first workqueue whose handler is scif_loopb_msg_handler reads
- * messages from the Node QP RB, adds them to a list and queues work for the
- * second workqueue.
- *
- * 2) The second workqueue whose handler is scif_loopb_wq_handler dequeues
- * messages from the list, handles them, frees up the memory and dequeues
- * more elements from the list if possible.
- */
-int
-scif_loopb_msg_handler(struct scif_dev *scifdev, struct scif_qp *qp)
-{
-       int read_size;
-       struct scif_loopb_msg *msg;
-
-       do {
-               msg = kmalloc(sizeof(*msg), GFP_KERNEL);
-               if (!msg)
-                       return -ENOMEM;
-               read_size = scif_rb_get_next(&qp->inbound_q, &msg->msg,
-                                            sizeof(struct scifmsg));
-               if (read_size != sizeof(struct scifmsg)) {
-                       kfree(msg);
-                       scif_rb_update_read_ptr(&qp->inbound_q);
-                       break;
-               }
-               spin_lock(&qp->recv_lock);
-               list_add_tail(&msg->list, &scif_info.loopb_recv_q);
-               spin_unlock(&qp->recv_lock);
-               queue_work(scif_info.loopb_wq, &scif_info.loopb_work);
-               scif_rb_update_read_ptr(&qp->inbound_q);
-       } while (read_size == sizeof(struct scifmsg));
-       return read_size;
-}
-
-/**
- * scif_setup_loopback_qp - One time setup work for Loopback Node Qp.
- * @scifdev: SCIF device
- *
- * Sets up the required loopback workqueues, queue pairs and ring buffers
- */
-int scif_setup_loopback_qp(struct scif_dev *scifdev)
-{
-       int err = 0;
-       void *local_q;
-       struct scif_qp *qp;
-
-       err = scif_setup_intr_wq(scifdev);
-       if (err)
-               goto exit;
-       INIT_LIST_HEAD(&scif_info.loopb_recv_q);
-       snprintf(scif_info.loopb_wqname, sizeof(scif_info.loopb_wqname),
-                "SCIF LOOPB %d", scifdev->node);
-       scif_info.loopb_wq =
-               alloc_ordered_workqueue(scif_info.loopb_wqname, 0);
-       if (!scif_info.loopb_wq) {
-               err = -ENOMEM;
-               goto destroy_intr;
-       }
-       INIT_WORK(&scif_info.loopb_work, scif_loopb_wq_handler);
-       /* Allocate Self Qpair */
-       scifdev->qpairs = kzalloc(sizeof(*scifdev->qpairs), GFP_KERNEL);
-       if (!scifdev->qpairs) {
-               err = -ENOMEM;
-               goto destroy_loopb_wq;
-       }
-
-       qp = scifdev->qpairs;
-       qp->magic = SCIFEP_MAGIC;
-       spin_lock_init(&qp->send_lock);
-       spin_lock_init(&qp->recv_lock);
-
-       local_q = kzalloc(SCIF_NODE_QP_SIZE, GFP_KERNEL);
-       if (!local_q) {
-               err = -ENOMEM;
-               goto free_qpairs;
-       }
-       /*
-        * For loopback the inbound_q and outbound_q are essentially the same
-        * since the Node sends a message on the loopback interface to the
-        * outbound_q which is then received on the inbound_q.
-        */
-       scif_rb_init(&qp->outbound_q,
-                    &qp->local_read,
-                    &qp->local_write,
-                    local_q, get_count_order(SCIF_NODE_QP_SIZE));
-
-       scif_rb_init(&qp->inbound_q,
-                    &qp->local_read,
-                    &qp->local_write,
-                    local_q, get_count_order(SCIF_NODE_QP_SIZE));
-       scif_info.nodeid = scifdev->node;
-
-       scif_peer_register_device(scifdev);
-
-       scif_info.loopb_dev = scifdev;
-       return err;
-free_qpairs:
-       kfree(scifdev->qpairs);
-destroy_loopb_wq:
-       destroy_workqueue(scif_info.loopb_wq);
-destroy_intr:
-       scif_destroy_intr_wq(scifdev);
-exit:
-       return err;
-}
-
-/**
- * scif_destroy_loopback_qp - One time uninit work for Loopback Node Qp
- * @scifdev: SCIF device
- *
- * Destroys the workqueues and frees up the Ring Buffer and Queue Pair memory.
- */
-int scif_destroy_loopback_qp(struct scif_dev *scifdev)
-{
-       scif_peer_unregister_device(scifdev);
-       destroy_workqueue(scif_info.loopb_wq);
-       scif_destroy_intr_wq(scifdev);
-       kfree(scifdev->qpairs->outbound_q.rb_base);
-       kfree(scifdev->qpairs);
-       scifdev->sdev = NULL;
-       scif_info.loopb_dev = NULL;
-       return 0;
-}
-
-void scif_destroy_p2p(struct scif_dev *scifdev)
-{
-       struct scif_dev *peer_dev;
-       struct scif_p2p_info *p2p;
-       struct list_head *pos, *tmp;
-       int bd;
-
-       mutex_lock(&scif_info.conflock);
-       /* Free P2P mappings in the given node for all its peer nodes */
-       list_for_each_safe(pos, tmp, &scifdev->p2p) {
-               p2p = list_entry(pos, struct scif_p2p_info, ppi_list);
-               dma_unmap_sg(&scifdev->sdev->dev, p2p->ppi_sg[SCIF_PPI_MMIO],
-                            p2p->sg_nentries[SCIF_PPI_MMIO],
-                            DMA_BIDIRECTIONAL);
-               dma_unmap_sg(&scifdev->sdev->dev, p2p->ppi_sg[SCIF_PPI_APER],
-                            p2p->sg_nentries[SCIF_PPI_APER],
-                            DMA_BIDIRECTIONAL);
-               scif_p2p_freesg(p2p->ppi_sg[SCIF_PPI_MMIO]);
-               scif_p2p_freesg(p2p->ppi_sg[SCIF_PPI_APER]);
-               list_del(pos);
-               kfree(p2p);
-       }
-
-       /* Free P2P mapping created in the peer nodes for the given node */
-       for (bd = SCIF_MGMT_NODE + 1; bd <= scif_info.maxid; bd++) {
-               peer_dev = &scif_dev[bd];
-               list_for_each_safe(pos, tmp, &peer_dev->p2p) {
-                       p2p = list_entry(pos, struct scif_p2p_info, ppi_list);
-                       if (p2p->ppi_peer_id == scifdev->node) {
-                               dma_unmap_sg(&peer_dev->sdev->dev,
-                                            p2p->ppi_sg[SCIF_PPI_MMIO],
-                                            p2p->sg_nentries[SCIF_PPI_MMIO],
-                                            DMA_BIDIRECTIONAL);
-                               dma_unmap_sg(&peer_dev->sdev->dev,
-                                            p2p->ppi_sg[SCIF_PPI_APER],
-                                            p2p->sg_nentries[SCIF_PPI_APER],
-                                            DMA_BIDIRECTIONAL);
-                               scif_p2p_freesg(p2p->ppi_sg[SCIF_PPI_MMIO]);
-                               scif_p2p_freesg(p2p->ppi_sg[SCIF_PPI_APER]);
-                               list_del(pos);
-                               kfree(p2p);
-                       }
-               }
-       }
-       mutex_unlock(&scif_info.conflock);
-}
diff --git a/drivers/misc/mic/scif/scif_nodeqp.h b/drivers/misc/mic/scif/scif_nodeqp.h
deleted file mode 100644 (file)
index 9589627..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License 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.
- *
- * BSD LICENSE
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * 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 Intel 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.
- *
- * Intel SCIF driver.
- *
- */
-#ifndef SCIF_NODEQP
-#define SCIF_NODEQP
-
-#include "scif_rb.h"
-#include "scif_peer_bus.h"
-
-#define SCIF_INIT 1  /* First message sent to the peer node for discovery */
-#define SCIF_EXIT 2  /* Last message from the peer informing intent to exit */
-#define SCIF_EXIT_ACK 3 /* Response to SCIF_EXIT message */
-#define SCIF_NODE_ADD 4  /* Tell Online nodes a new node exits */
-#define SCIF_NODE_ADD_ACK 5  /* Confirm to mgmt node sequence is finished */
-#define SCIF_NODE_ADD_NACK 6 /* SCIF_NODE_ADD failed */
-#define SCIF_NODE_REMOVE 7 /* Request to deactivate a SCIF node */
-#define SCIF_NODE_REMOVE_ACK 8 /* Response to a SCIF_NODE_REMOVE message */
-#define SCIF_CNCT_REQ 9  /* Phys addr of Request connection to a port */
-#define SCIF_CNCT_GNT 10  /* Phys addr of new Grant connection request */
-#define SCIF_CNCT_GNTACK 11  /* Error type Reject a connection request */
-#define SCIF_CNCT_GNTNACK 12  /* Error type Reject a connection request */
-#define SCIF_CNCT_REJ 13  /* Error type Reject a connection request */
-#define SCIF_DISCNCT 14 /* Notify peer that connection is being terminated */
-#define SCIF_DISCNT_ACK 15 /* Notify peer that connection is being terminated */
-#define SCIF_CLIENT_SENT 16 /* Notify the peer that data has been written */
-#define SCIF_CLIENT_RCVD 17 /* Notify the peer that data has been read */
-#define SCIF_GET_NODE_INFO 18 /* Get current node mask from the mgmt node*/
-#define SCIF_REGISTER 19 /* Tell peer about a new registered window */
-#define SCIF_REGISTER_ACK 20 /* Notify peer about unregistration success */
-#define SCIF_REGISTER_NACK 21 /* Notify peer about registration success */
-#define SCIF_UNREGISTER 22 /* Tell peer about unregistering a window */
-#define SCIF_UNREGISTER_ACK 23 /* Notify peer about registration failure */
-#define SCIF_UNREGISTER_NACK 24 /* Notify peer about unregistration failure */
-#define SCIF_ALLOC_REQ 25 /* Request a mapped buffer */
-#define SCIF_ALLOC_GNT 26 /* Notify peer about allocation success */
-#define SCIF_ALLOC_REJ 27 /* Notify peer about allocation failure */
-#define SCIF_FREE_VIRT 28 /* Free previously allocated virtual memory */
-#define SCIF_MUNMAP 29 /* Acknowledgment for a SCIF_MMAP request */
-#define SCIF_MARK 30 /* SCIF Remote Fence Mark Request */
-#define SCIF_MARK_ACK 31 /* SCIF Remote Fence Mark Success */
-#define SCIF_MARK_NACK 32 /* SCIF Remote Fence Mark Failure */
-#define SCIF_WAIT 33 /* SCIF Remote Fence Wait Request */
-#define SCIF_WAIT_ACK 34 /* SCIF Remote Fence Wait Success */
-#define SCIF_WAIT_NACK 35 /* SCIF Remote Fence Wait Failure */
-#define SCIF_SIG_LOCAL 36 /* SCIF Remote Fence Local Signal Request */
-#define SCIF_SIG_REMOTE 37 /* SCIF Remote Fence Remote Signal Request */
-#define SCIF_SIG_ACK 38 /* SCIF Remote Fence Remote Signal Success */
-#define SCIF_SIG_NACK 39 /* SCIF Remote Fence Remote Signal Failure */
-#define SCIF_MAX_MSG SCIF_SIG_NACK
-
-/*
- * struct scifmsg - Node QP message format
- *
- * @src: Source information
- * @dst: Destination information
- * @uop: The message opcode
- * @payload: Unique payload format for each message
- */
-struct scifmsg {
-       struct scif_port_id src;
-       struct scif_port_id dst;
-       u32 uop;
-       u64 payload[4];
-} __packed;
-
-/*
- * struct scif_allocmsg - Used with SCIF_ALLOC_REQ to request
- * the remote note to allocate memory
- *
- * phys_addr: Physical address of the buffer
- * vaddr: Virtual address of the buffer
- * size: Size of the buffer
- * state: Current state
- * allocwq: wait queue for status
- */
-struct scif_allocmsg {
-       dma_addr_t phys_addr;
-       unsigned long vaddr;
-       size_t size;
-       enum scif_msg_state state;
-       wait_queue_head_t allocwq;
-};
-
-/*
- * struct scif_qp - Node Queue Pair
- *
- * Interesting structure -- a little difficult because we can only
- * write across the PCIe, so any r/w pointer we need to read is
- * local. We only need to read the read pointer on the inbound_q
- * and read the write pointer in the outbound_q
- *
- * @magic: Magic value to ensure the peer sees the QP correctly
- * @outbound_q: The outbound ring buffer for sending messages
- * @inbound_q: The inbound ring buffer for receiving messages
- * @local_write: Local write index
- * @local_read: Local read index
- * @remote_qp: The remote queue pair
- * @local_buf: DMA address of local ring buffer
- * @local_qp: DMA address of the local queue pair data structure
- * @remote_buf: DMA address of remote ring buffer
- * @qp_state: QP state i.e. online or offline used for P2P
- * @send_lock: synchronize access to outbound queue
- * @recv_lock: Synchronize access to inbound queue
- */
-struct scif_qp {
-       u64 magic;
-#define SCIFEP_MAGIC 0x5c1f000000005c1fULL
-       struct scif_rb outbound_q;
-       struct scif_rb inbound_q;
-
-       u32 local_write __aligned(64);
-       u32 local_read __aligned(64);
-       struct scif_qp *remote_qp;
-       dma_addr_t local_buf;
-       dma_addr_t local_qp;
-       dma_addr_t remote_buf;
-       u32 qp_state;
-#define SCIF_QP_OFFLINE 0xdead
-#define SCIF_QP_ONLINE 0xc0de
-       spinlock_t send_lock;
-       spinlock_t recv_lock;
-};
-
-/*
- * struct scif_loopb_msg - An element in the loopback Node QP message list.
- *
- * @msg - The SCIF node QP message
- * @list - link in the list of messages
- */
-struct scif_loopb_msg {
-       struct scifmsg msg;
-       struct list_head list;
-};
-
-int scif_nodeqp_send(struct scif_dev *scifdev, struct scifmsg *msg);
-int _scif_nodeqp_send(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_nodeqp_intrhandler(struct scif_dev *scifdev, struct scif_qp *qp);
-int scif_loopb_msg_handler(struct scif_dev *scifdev, struct scif_qp *qp);
-int scif_setup_qp(struct scif_dev *scifdev);
-int scif_qp_response(phys_addr_t phys, struct scif_dev *dev);
-int scif_setup_qp_connect(struct scif_qp *qp, dma_addr_t *qp_offset,
-                         int local_size, struct scif_dev *scifdev);
-int scif_setup_qp_accept(struct scif_qp *qp, dma_addr_t *qp_offset,
-                        dma_addr_t phys, int local_size,
-                        struct scif_dev *scifdev);
-int scif_setup_qp_connect_response(struct scif_dev *scifdev,
-                                  struct scif_qp *qp, u64 payload);
-int scif_setup_loopback_qp(struct scif_dev *scifdev);
-int scif_destroy_loopback_qp(struct scif_dev *scifdev);
-void scif_poll_qp_state(struct work_struct *work);
-void scif_destroy_p2p(struct scif_dev *scifdev);
-void scif_send_exit(struct scif_dev *scifdev);
-static inline struct device *scif_get_peer_dev(struct scif_dev *scifdev)
-{
-       struct scif_peer_dev *spdev;
-       struct device *spdev_ret;
-
-       rcu_read_lock();
-       spdev = rcu_dereference(scifdev->spdev);
-       if (spdev)
-               spdev_ret = get_device(&spdev->dev);
-       else
-               spdev_ret = ERR_PTR(-ENODEV);
-       rcu_read_unlock();
-       return spdev_ret;
-}
-
-static inline void scif_put_peer_dev(struct device *dev)
-{
-       put_device(dev);
-}
-#endif  /* SCIF_NODEQP */
diff --git a/drivers/misc/mic/scif/scif_peer_bus.c b/drivers/misc/mic/scif/scif_peer_bus.c
deleted file mode 100644 (file)
index 6d60830..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include "scif_main.h"
-#include "../bus/scif_bus.h"
-#include "scif_peer_bus.h"
-
-static inline struct scif_peer_dev *
-dev_to_scif_peer(struct device *dev)
-{
-       return container_of(dev, struct scif_peer_dev, dev);
-}
-
-struct bus_type scif_peer_bus = {
-       .name  = "scif_peer_bus",
-};
-
-static void scif_peer_release_dev(struct device *d)
-{
-       struct scif_peer_dev *sdev = dev_to_scif_peer(d);
-       struct scif_dev *scifdev = &scif_dev[sdev->dnode];
-
-       scif_cleanup_scifdev(scifdev);
-       kfree(sdev);
-}
-
-static int scif_peer_initialize_device(struct scif_dev *scifdev)
-{
-       struct scif_peer_dev *spdev;
-       int ret;
-
-       spdev = kzalloc(sizeof(*spdev), GFP_KERNEL);
-       if (!spdev) {
-               ret = -ENOMEM;
-               goto err;
-       }
-
-       spdev->dev.parent = scifdev->sdev->dev.parent;
-       spdev->dev.release = scif_peer_release_dev;
-       spdev->dnode = scifdev->node;
-       spdev->dev.bus = &scif_peer_bus;
-       dev_set_name(&spdev->dev, "scif_peer-dev%u", spdev->dnode);
-
-       device_initialize(&spdev->dev);
-       get_device(&spdev->dev);
-       rcu_assign_pointer(scifdev->spdev, spdev);
-
-       mutex_lock(&scif_info.conflock);
-       scif_info.total++;
-       scif_info.maxid = max_t(u32, spdev->dnode, scif_info.maxid);
-       mutex_unlock(&scif_info.conflock);
-       return 0;
-err:
-       dev_err(&scifdev->sdev->dev,
-               "dnode %d: initialize_device rc %d\n", scifdev->node, ret);
-       return ret;
-}
-
-static int scif_peer_add_device(struct scif_dev *scifdev)
-{
-       struct scif_peer_dev *spdev = rcu_dereference(scifdev->spdev);
-       char pool_name[16];
-       int ret;
-
-       ret = device_add(&spdev->dev);
-       put_device(&spdev->dev);
-       if (ret) {
-               dev_err(&scifdev->sdev->dev,
-                       "dnode %d: peer device_add failed\n", scifdev->node);
-               goto put_spdev;
-       }
-
-       scnprintf(pool_name, sizeof(pool_name), "scif-%d", spdev->dnode);
-       scifdev->signal_pool = dmam_pool_create(pool_name, &scifdev->sdev->dev,
-                                               sizeof(struct scif_status), 1,
-                                               0);
-       if (!scifdev->signal_pool) {
-               dev_err(&scifdev->sdev->dev,
-                       "dnode %d: dmam_pool_create failed\n", scifdev->node);
-               ret = -ENOMEM;
-               goto del_spdev;
-       }
-       dev_dbg(&spdev->dev, "Added peer dnode %d\n", spdev->dnode);
-       return 0;
-del_spdev:
-       device_del(&spdev->dev);
-put_spdev:
-       RCU_INIT_POINTER(scifdev->spdev, NULL);
-       synchronize_rcu();
-       put_device(&spdev->dev);
-
-       mutex_lock(&scif_info.conflock);
-       scif_info.total--;
-       mutex_unlock(&scif_info.conflock);
-       return ret;
-}
-
-void scif_add_peer_device(struct work_struct *work)
-{
-       struct scif_dev *scifdev = container_of(work, struct scif_dev,
-                                               peer_add_work);
-
-       scif_peer_add_device(scifdev);
-}
-
-/*
- * Peer device registration is split into a device_initialize and a device_add.
- * The reason for doing this is as follows: First, peer device registration
- * itself cannot be done in the message processing thread and must be delegated
- * to another workqueue, otherwise if SCIF client probe, called during peer
- * device registration, calls scif_connect(..), it will block the message
- * processing thread causing a deadlock. Next, device_initialize is done in the
- * "top-half" message processing thread and device_add in the "bottom-half"
- * workqueue. If this is not done, SCIF_CNCT_REQ message processing executing
- * concurrently with SCIF_INIT message processing is unable to get a reference
- * on the peer device, thereby failing the connect request.
- */
-void scif_peer_register_device(struct scif_dev *scifdev)
-{
-       int ret;
-
-       mutex_lock(&scifdev->lock);
-       ret = scif_peer_initialize_device(scifdev);
-       if (ret)
-               goto exit;
-       schedule_work(&scifdev->peer_add_work);
-exit:
-       mutex_unlock(&scifdev->lock);
-}
-
-int scif_peer_unregister_device(struct scif_dev *scifdev)
-{
-       struct scif_peer_dev *spdev;
-
-       mutex_lock(&scifdev->lock);
-       /* Flush work to ensure device register is complete */
-       flush_work(&scifdev->peer_add_work);
-
-       /*
-        * Continue holding scifdev->lock since theoretically unregister_device
-        * can be called simultaneously from multiple threads
-        */
-       spdev = rcu_dereference(scifdev->spdev);
-       if (!spdev) {
-               mutex_unlock(&scifdev->lock);
-               return -ENODEV;
-       }
-
-       RCU_INIT_POINTER(scifdev->spdev, NULL);
-       synchronize_rcu();
-       mutex_unlock(&scifdev->lock);
-
-       dev_dbg(&spdev->dev, "Removing peer dnode %d\n", spdev->dnode);
-       device_unregister(&spdev->dev);
-
-       mutex_lock(&scif_info.conflock);
-       scif_info.total--;
-       mutex_unlock(&scif_info.conflock);
-       return 0;
-}
-
-int scif_peer_bus_init(void)
-{
-       return bus_register(&scif_peer_bus);
-}
-
-void scif_peer_bus_exit(void)
-{
-       bus_unregister(&scif_peer_bus);
-}
diff --git a/drivers/misc/mic/scif/scif_peer_bus.h b/drivers/misc/mic/scif/scif_peer_bus.h
deleted file mode 100644 (file)
index 2ea4c51..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#ifndef _SCIF_PEER_BUS_H_
-#define _SCIF_PEER_BUS_H_
-
-#include <linux/device.h>
-#include <linux/mic_common.h>
-#include <linux/scif.h>
-
-struct scif_dev;
-
-void scif_add_peer_device(struct work_struct *work);
-void scif_peer_register_device(struct scif_dev *sdev);
-int scif_peer_unregister_device(struct scif_dev *scifdev);
-int scif_peer_bus_init(void);
-void scif_peer_bus_exit(void);
-#endif /* _SCIF_PEER_BUS_H */
diff --git a/drivers/misc/mic/scif/scif_ports.c b/drivers/misc/mic/scif/scif_ports.c
deleted file mode 100644 (file)
index 4bdb5ef..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include <linux/idr.h>
-
-#include "scif_main.h"
-
-#define SCIF_PORT_COUNT        0x10000 /* Ports available */
-
-struct idr scif_ports;
-
-/**
- * struct scif_port - SCIF port information
- *
- * @ref_cnt:  Reference count since there can be multiple endpoints
- *           created via scif_accept(..) simultaneously using a port.
- */
-struct scif_port {
-       int ref_cnt;
-};
-
-/**
- * __scif_get_port - Reserve a specified port # for SCIF and add it
- * to the global list.
- * @start: lowest port # to be reserved (inclusive).
- * @end:   highest port # to be reserved (exclusive).
- *
- * @return : Allocated SCIF port #, or -ENOSPC if port unavailable.
- *             On memory allocation failure, returns -ENOMEM.
- */
-static int __scif_get_port(int start, int end)
-{
-       int id;
-       struct scif_port *port = kzalloc(sizeof(*port), GFP_ATOMIC);
-
-       if (!port)
-               return -ENOMEM;
-       spin_lock(&scif_info.port_lock);
-       id = idr_alloc(&scif_ports, port, start, end, GFP_ATOMIC);
-       if (id >= 0)
-               port->ref_cnt++;
-       spin_unlock(&scif_info.port_lock);
-       return id;
-}
-
-/**
- * scif_rsrv_port - Reserve a specified port # for SCIF.
- * @port : port # to be reserved.
- *
- * @return : Allocated SCIF port #, or -ENOSPC if port unavailable.
- *             On memory allocation failure, returns -ENOMEM.
- */
-int scif_rsrv_port(u16 port)
-{
-       return __scif_get_port(port, port + 1);
-}
-
-/**
- * scif_get_new_port - Get and reserve any port # for SCIF in the range
- *                     SCIF_PORT_RSVD + 1 to SCIF_PORT_COUNT - 1.
- *
- * @return : Allocated SCIF port #, or -ENOSPC if no ports available.
- *             On memory allocation failure, returns -ENOMEM.
- */
-int scif_get_new_port(void)
-{
-       return __scif_get_port(SCIF_PORT_RSVD + 1, SCIF_PORT_COUNT);
-}
-
-/**
- * scif_get_port - Increment the reference count for a SCIF port
- * @id : SCIF port
- *
- * @return : None
- */
-void scif_get_port(u16 id)
-{
-       struct scif_port *port;
-
-       if (!id)
-               return;
-       spin_lock(&scif_info.port_lock);
-       port = idr_find(&scif_ports, id);
-       if (port)
-               port->ref_cnt++;
-       spin_unlock(&scif_info.port_lock);
-}
-
-/**
- * scif_put_port - Release a reserved SCIF port
- * @id : SCIF port to be released.
- *
- * @return : None
- */
-void scif_put_port(u16 id)
-{
-       struct scif_port *port;
-
-       if (!id)
-               return;
-       spin_lock(&scif_info.port_lock);
-       port = idr_find(&scif_ports, id);
-       if (port) {
-               port->ref_cnt--;
-               if (!port->ref_cnt) {
-                       idr_remove(&scif_ports, id);
-                       kfree(port);
-               }
-       }
-       spin_unlock(&scif_info.port_lock);
-}
diff --git a/drivers/misc/mic/scif/scif_rb.c b/drivers/misc/mic/scif/scif_rb.c
deleted file mode 100644 (file)
index e425882..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include <linux/circ_buf.h>
-#include <linux/types.h>
-#include <linux/io.h>
-#include <linux/errno.h>
-
-#include "scif_rb.h"
-
-#define scif_rb_ring_cnt(head, tail, size) CIRC_CNT(head, tail, size)
-#define scif_rb_ring_space(head, tail, size) CIRC_SPACE(head, tail, size)
-
-/**
- * scif_rb_init - Initializes the ring buffer
- * @rb: ring buffer
- * @read_ptr: A pointer to the read offset
- * @write_ptr: A pointer to the write offset
- * @rb_base: A pointer to the base of the ring buffer
- * @size: The size of the ring buffer in powers of two
- */
-void scif_rb_init(struct scif_rb *rb, u32 *read_ptr, u32 *write_ptr,
-                 void *rb_base, u8 size)
-{
-       rb->rb_base = rb_base;
-       rb->size = (1 << size);
-       rb->read_ptr = read_ptr;
-       rb->write_ptr = write_ptr;
-       rb->current_read_offset = *read_ptr;
-       rb->current_write_offset = *write_ptr;
-}
-
-/* Copies a message to the ring buffer -- handles the wrap around case */
-static void memcpy_torb(struct scif_rb *rb, void *header,
-                       void *msg, u32 size)
-{
-       u32 size1, size2;
-
-       if (header + size >= rb->rb_base + rb->size) {
-               /* Need to call two copies if it wraps around */
-               size1 = (u32)(rb->rb_base + rb->size - header);
-               size2 = size - size1;
-               memcpy_toio((void __iomem __force *)header, msg, size1);
-               memcpy_toio((void __iomem __force *)rb->rb_base,
-                           msg + size1, size2);
-       } else {
-               memcpy_toio((void __iomem __force *)header, msg, size);
-       }
-}
-
-/* Copies a message from the ring buffer -- handles the wrap around case */
-static void memcpy_fromrb(struct scif_rb *rb, void *header,
-                         void *msg, u32 size)
-{
-       u32 size1, size2;
-
-       if (header + size >= rb->rb_base + rb->size) {
-               /* Need to call two copies if it wraps around */
-               size1 = (u32)(rb->rb_base + rb->size - header);
-               size2 = size - size1;
-               memcpy_fromio(msg, (void __iomem __force *)header, size1);
-               memcpy_fromio(msg + size1,
-                             (void __iomem __force *)rb->rb_base, size2);
-       } else {
-               memcpy_fromio(msg, (void __iomem __force *)header, size);
-       }
-}
-
-/**
- * scif_rb_space - Query space available for writing to the RB
- * @rb: ring buffer
- *
- * Return: size available for writing to RB in bytes.
- */
-u32 scif_rb_space(struct scif_rb *rb)
-{
-       rb->current_read_offset = *rb->read_ptr;
-       /*
-        * Update from the HW read pointer only once the peer has exposed the
-        * new empty slot. This barrier is paired with the memory barrier
-        * scif_rb_update_read_ptr()
-        */
-       mb();
-       return scif_rb_ring_space(rb->current_write_offset,
-                                 rb->current_read_offset, rb->size);
-}
-
-/**
- * scif_rb_write - Write a message to the RB
- * @rb: ring buffer
- * @msg: buffer to send the message.  Must be at least size bytes long
- * @size: the size (in bytes) to be copied to the RB
- *
- * This API does not block if there isn't enough space in the RB.
- * Returns: 0 on success or -ENOMEM on failure
- */
-int scif_rb_write(struct scif_rb *rb, void *msg, u32 size)
-{
-       void *header;
-
-       if (scif_rb_space(rb) < size)
-               return -ENOMEM;
-       header = rb->rb_base + rb->current_write_offset;
-       memcpy_torb(rb, header, msg, size);
-       /*
-        * Wait until scif_rb_commit(). Update the local ring
-        * buffer data, not the shared data until commit.
-        */
-       rb->current_write_offset =
-               (rb->current_write_offset + size) & (rb->size - 1);
-       return 0;
-}
-
-/**
- * scif_rb_commit - To submit the message to let the peer fetch it
- * @rb: ring buffer
- */
-void scif_rb_commit(struct scif_rb *rb)
-{
-       /*
-        * We must ensure ordering between the all the data committed
-        * previously before we expose the new message to the peer by
-        * updating the write_ptr. This write barrier is paired with
-        * the read barrier in scif_rb_count(..)
-        */
-       wmb();
-       WRITE_ONCE(*rb->write_ptr, rb->current_write_offset);
-#ifdef CONFIG_INTEL_MIC_CARD
-       /*
-        * X100 Si bug: For the case where a Core is performing an EXT_WR
-        * followed by a Doorbell Write, the Core must perform two EXT_WR to the
-        * same address with the same data before it does the Doorbell Write.
-        * This way, if ordering is violated for the Interrupt Message, it will
-        * fall just behind the first Posted associated with the first EXT_WR.
-        */
-       WRITE_ONCE(*rb->write_ptr, rb->current_write_offset);
-#endif
-}
-
-/**
- * scif_rb_get - To get next message from the ring buffer
- * @rb: ring buffer
- * @size: Number of bytes to be read
- *
- * Return: NULL if no bytes to be read from the ring buffer, otherwise the
- *     pointer to the next byte
- */
-static void *scif_rb_get(struct scif_rb *rb, u32 size)
-{
-       void *header = NULL;
-
-       if (scif_rb_count(rb, size) >= size)
-               header = rb->rb_base + rb->current_read_offset;
-       return header;
-}
-
-/*
- * scif_rb_get_next - Read from ring buffer.
- * @rb: ring buffer
- * @msg: buffer to hold the message.  Must be at least size bytes long
- * @size: Number of bytes to be read
- *
- * Return: number of bytes read if available bytes are >= size, otherwise
- * returns zero.
- */
-u32 scif_rb_get_next(struct scif_rb *rb, void *msg, u32 size)
-{
-       void *header = NULL;
-       int read_size = 0;
-
-       header = scif_rb_get(rb, size);
-       if (header) {
-               u32 next_cmd_offset =
-                       (rb->current_read_offset + size) & (rb->size - 1);
-
-               read_size = size;
-               rb->current_read_offset = next_cmd_offset;
-               memcpy_fromrb(rb, header, msg, size);
-       }
-       return read_size;
-}
-
-/**
- * scif_rb_update_read_ptr
- * @rb: ring buffer
- */
-void scif_rb_update_read_ptr(struct scif_rb *rb)
-{
-       u32 new_offset;
-
-       new_offset = rb->current_read_offset;
-       /*
-        * We must ensure ordering between the all the data committed or read
-        * previously before we expose the empty slot to the peer by updating
-        * the read_ptr. This barrier is paired with the memory barrier in
-        * scif_rb_space(..)
-        */
-       mb();
-       WRITE_ONCE(*rb->read_ptr, new_offset);
-#ifdef CONFIG_INTEL_MIC_CARD
-       /*
-        * X100 Si Bug: For the case where a Core is performing an EXT_WR
-        * followed by a Doorbell Write, the Core must perform two EXT_WR to the
-        * same address with the same data before it does the Doorbell Write.
-        * This way, if ordering is violated for the Interrupt Message, it will
-        * fall just behind the first Posted associated with the first EXT_WR.
-        */
-       WRITE_ONCE(*rb->read_ptr, new_offset);
-#endif
-}
-
-/**
- * scif_rb_count
- * @rb: ring buffer
- * @size: Number of bytes expected to be read
- *
- * Return: number of bytes that can be read from the RB
- */
-u32 scif_rb_count(struct scif_rb *rb, u32 size)
-{
-       if (scif_rb_ring_cnt(rb->current_write_offset,
-                            rb->current_read_offset,
-                            rb->size) < size) {
-               rb->current_write_offset = *rb->write_ptr;
-               /*
-                * Update from the HW write pointer if empty only once the peer
-                * has exposed the new message. This read barrier is paired
-                * with the write barrier in scif_rb_commit(..)
-                */
-               smp_rmb();
-       }
-       return scif_rb_ring_cnt(rb->current_write_offset,
-                               rb->current_read_offset,
-                               rb->size);
-}
diff --git a/drivers/misc/mic/scif/scif_rb.h b/drivers/misc/mic/scif/scif_rb.h
deleted file mode 100644 (file)
index 166dffe..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License 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.
- *
- * BSD LICENSE
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * 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 Intel 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.
- *
- * Intel SCIF driver.
- */
-#ifndef SCIF_RB_H
-#define SCIF_RB_H
-/*
- * This file describes a general purpose, byte based ring buffer. Writers to the
- * ring buffer need to synchronize using a lock. The same is true for readers,
- * although in practice, the ring buffer has a single reader. It is lockless
- * between producer and consumer so it can handle being used across the PCIe
- * bus. The ring buffer ensures that there are no reads across the PCIe bus for
- * performance reasons. Two of these are used to form a single bidirectional
- * queue-pair across PCIe.
- */
-/*
- * struct scif_rb - SCIF Ring Buffer
- *
- * @rb_base: The base of the memory used for storing RB messages
- * @read_ptr: Pointer to the read offset
- * @write_ptr: Pointer to the write offset
- * @size: Size of the memory in rb_base
- * @current_read_offset: Cached read offset for performance
- * @current_write_offset: Cached write offset for performance
- */
-struct scif_rb {
-       void *rb_base;
-       u32 *read_ptr;
-       u32 *write_ptr;
-       u32 size;
-       u32 current_read_offset;
-       u32 current_write_offset;
-};
-
-/* methods used by both */
-void scif_rb_init(struct scif_rb *rb, u32 *read_ptr, u32 *write_ptr,
-                 void *rb_base, u8 size);
-/* writer only methods */
-/* write a new command, then scif_rb_commit() */
-int scif_rb_write(struct scif_rb *rb, void *msg, u32 size);
-/* after write(), then scif_rb_commit() */
-void scif_rb_commit(struct scif_rb *rb);
-/* query space available for writing to a RB. */
-u32 scif_rb_space(struct scif_rb *rb);
-
-/* reader only methods */
-/* read a new message from the ring buffer of size bytes */
-u32 scif_rb_get_next(struct scif_rb *rb, void *msg, u32 size);
-/* update the read pointer so that the space can be reused */
-void scif_rb_update_read_ptr(struct scif_rb *rb);
-/* count the number of bytes that can be read */
-u32 scif_rb_count(struct scif_rb *rb, u32 size);
-#endif
diff --git a/drivers/misc/mic/scif/scif_rma.c b/drivers/misc/mic/scif/scif_rma.c
deleted file mode 100644 (file)
index 18fb9d8..0000000
+++ /dev/null
@@ -1,1760 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include <linux/intel-iommu.h>
-#include <linux/pagemap.h>
-#include <linux/sched/mm.h>
-#include <linux/sched/signal.h>
-
-#include "scif_main.h"
-#include "scif_map.h"
-
-/* Used to skip ulimit checks for registrations with SCIF_MAP_KERNEL flag */
-#define SCIF_MAP_ULIMIT 0x40
-
-bool scif_ulimit_check = 1;
-
-/**
- * scif_rma_ep_init:
- * @ep: end point
- *
- * Initialize RMA per EP data structures.
- */
-void scif_rma_ep_init(struct scif_endpt *ep)
-{
-       struct scif_endpt_rma_info *rma = &ep->rma_info;
-
-       mutex_init(&rma->rma_lock);
-       init_iova_domain(&rma->iovad, PAGE_SIZE, SCIF_IOVA_START_PFN);
-       spin_lock_init(&rma->tc_lock);
-       mutex_init(&rma->mmn_lock);
-       INIT_LIST_HEAD(&rma->reg_list);
-       INIT_LIST_HEAD(&rma->remote_reg_list);
-       atomic_set(&rma->tw_refcount, 0);
-       atomic_set(&rma->tcw_refcount, 0);
-       atomic_set(&rma->tcw_total_pages, 0);
-       atomic_set(&rma->fence_refcount, 0);
-
-       rma->async_list_del = 0;
-       rma->dma_chan = NULL;
-       INIT_LIST_HEAD(&rma->mmn_list);
-       INIT_LIST_HEAD(&rma->vma_list);
-       init_waitqueue_head(&rma->markwq);
-}
-
-/**
- * scif_rma_ep_can_uninit:
- * @ep: end point
- *
- * Returns 1 if an endpoint can be uninitialized and 0 otherwise.
- */
-int scif_rma_ep_can_uninit(struct scif_endpt *ep)
-{
-       int ret = 0;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       /* Destroy RMA Info only if both lists are empty */
-       if (list_empty(&ep->rma_info.reg_list) &&
-           list_empty(&ep->rma_info.remote_reg_list) &&
-           list_empty(&ep->rma_info.mmn_list) &&
-           !atomic_read(&ep->rma_info.tw_refcount) &&
-           !atomic_read(&ep->rma_info.tcw_refcount) &&
-           !atomic_read(&ep->rma_info.fence_refcount))
-               ret = 1;
-       mutex_unlock(&ep->rma_info.rma_lock);
-       return ret;
-}
-
-/**
- * scif_create_pinned_pages:
- * @nr_pages: number of pages in window
- * @prot: read/write protection
- *
- * Allocate and prepare a set of pinned pages.
- */
-static struct scif_pinned_pages *
-scif_create_pinned_pages(int nr_pages, int prot)
-{
-       struct scif_pinned_pages *pin;
-
-       might_sleep();
-       pin = scif_zalloc(sizeof(*pin));
-       if (!pin)
-               goto error;
-
-       pin->pages = scif_zalloc(nr_pages * sizeof(*pin->pages));
-       if (!pin->pages)
-               goto error_free_pinned_pages;
-
-       pin->prot = prot;
-       pin->magic = SCIFEP_MAGIC;
-       return pin;
-
-error_free_pinned_pages:
-       scif_free(pin, sizeof(*pin));
-error:
-       return NULL;
-}
-
-/**
- * scif_destroy_pinned_pages:
- * @pin: A set of pinned pages.
- *
- * Deallocate resources for pinned pages.
- */
-static int scif_destroy_pinned_pages(struct scif_pinned_pages *pin)
-{
-       int j;
-       int writeable = pin->prot & SCIF_PROT_WRITE;
-       int kernel = SCIF_MAP_KERNEL & pin->map_flags;
-
-       if (kernel) {
-               for (j = 0; j < pin->nr_pages; j++) {
-                       if (pin->pages[j] && !kernel) {
-                               if (writeable)
-                                       set_page_dirty_lock(pin->pages[j]);
-                               put_page(pin->pages[j]);
-                       }
-               }
-       } else
-               unpin_user_pages_dirty_lock(pin->pages, pin->nr_pages,
-                                           writeable);
-       scif_free(pin->pages,
-                 pin->nr_pages * sizeof(*pin->pages));
-       scif_free(pin, sizeof(*pin));
-       return 0;
-}
-
-/*
- * scif_create_window:
- * @ep: end point
- * @nr_pages: number of pages
- * @offset: registration offset
- * @temp: true if a temporary window is being created
- *
- * Allocate and prepare a self registration window.
- */
-struct scif_window *scif_create_window(struct scif_endpt *ep, int nr_pages,
-                                      s64 offset, bool temp)
-{
-       struct scif_window *window;
-
-       might_sleep();
-       window = scif_zalloc(sizeof(*window));
-       if (!window)
-               goto error;
-
-       window->dma_addr = scif_zalloc(nr_pages * sizeof(*window->dma_addr));
-       if (!window->dma_addr)
-               goto error_free_window;
-
-       window->num_pages = scif_zalloc(nr_pages * sizeof(*window->num_pages));
-       if (!window->num_pages)
-               goto error_free_window;
-
-       window->offset = offset;
-       window->ep = (u64)ep;
-       window->magic = SCIFEP_MAGIC;
-       window->reg_state = OP_IDLE;
-       init_waitqueue_head(&window->regwq);
-       window->unreg_state = OP_IDLE;
-       init_waitqueue_head(&window->unregwq);
-       INIT_LIST_HEAD(&window->list);
-       window->type = SCIF_WINDOW_SELF;
-       window->temp = temp;
-       return window;
-
-error_free_window:
-       scif_free(window->dma_addr,
-                 nr_pages * sizeof(*window->dma_addr));
-       scif_free(window, sizeof(*window));
-error:
-       return NULL;
-}
-
-/**
- * scif_destroy_incomplete_window:
- * @ep: end point
- * @window: registration window
- *
- * Deallocate resources for self window.
- */
-static void scif_destroy_incomplete_window(struct scif_endpt *ep,
-                                          struct scif_window *window)
-{
-       int err;
-       int nr_pages = window->nr_pages;
-       struct scif_allocmsg *alloc = &window->alloc_handle;
-       struct scifmsg msg;
-
-retry:
-       /* Wait for a SCIF_ALLOC_GNT/REJ message */
-       err = wait_event_timeout(alloc->allocwq,
-                                alloc->state != OP_IN_PROGRESS,
-                                SCIF_NODE_ALIVE_TIMEOUT);
-       if (!err && scifdev_alive(ep))
-               goto retry;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       if (alloc->state == OP_COMPLETED) {
-               msg.uop = SCIF_FREE_VIRT;
-               msg.src = ep->port;
-               msg.payload[0] = ep->remote_ep;
-               msg.payload[1] = window->alloc_handle.vaddr;
-               msg.payload[2] = (u64)window;
-               msg.payload[3] = SCIF_REGISTER;
-               _scif_nodeqp_send(ep->remote_dev, &msg);
-       }
-       mutex_unlock(&ep->rma_info.rma_lock);
-
-       scif_free_window_offset(ep, window, window->offset);
-       scif_free(window->dma_addr, nr_pages * sizeof(*window->dma_addr));
-       scif_free(window->num_pages, nr_pages * sizeof(*window->num_pages));
-       scif_free(window, sizeof(*window));
-}
-
-/**
- * scif_unmap_window:
- * @remote_dev: SCIF remote device
- * @window: registration window
- *
- * Delete any DMA mappings created for a registered self window
- */
-void scif_unmap_window(struct scif_dev *remote_dev, struct scif_window *window)
-{
-       int j;
-
-       if (scif_is_iommu_enabled() && !scifdev_self(remote_dev)) {
-               if (window->st) {
-                       dma_unmap_sg(&remote_dev->sdev->dev,
-                                    window->st->sgl, window->st->nents,
-                                    DMA_BIDIRECTIONAL);
-                       sg_free_table(window->st);
-                       kfree(window->st);
-                       window->st = NULL;
-               }
-       } else {
-               for (j = 0; j < window->nr_contig_chunks; j++) {
-                       if (window->dma_addr[j]) {
-                               scif_unmap_single(window->dma_addr[j],
-                                                 remote_dev,
-                                                 window->num_pages[j] <<
-                                                 PAGE_SHIFT);
-                               window->dma_addr[j] = 0x0;
-                       }
-               }
-       }
-}
-
-static inline struct mm_struct *__scif_acquire_mm(void)
-{
-       if (scif_ulimit_check)
-               return get_task_mm(current);
-       return NULL;
-}
-
-static inline void __scif_release_mm(struct mm_struct *mm)
-{
-       if (mm)
-               mmput(mm);
-}
-
-static inline int
-__scif_dec_pinned_vm_lock(struct mm_struct *mm,
-                         int nr_pages)
-{
-       if (!mm || !nr_pages || !scif_ulimit_check)
-               return 0;
-
-       atomic64_sub(nr_pages, &mm->pinned_vm);
-       return 0;
-}
-
-static inline int __scif_check_inc_pinned_vm(struct mm_struct *mm,
-                                            int nr_pages)
-{
-       unsigned long locked, lock_limit;
-
-       if (!mm || !nr_pages || !scif_ulimit_check)
-               return 0;
-
-       lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
-       locked = atomic64_add_return(nr_pages, &mm->pinned_vm);
-
-       if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) {
-               atomic64_sub(nr_pages, &mm->pinned_vm);
-               dev_err(scif_info.mdev.this_device,
-                       "locked(%lu) > lock_limit(%lu)\n",
-                       locked, lock_limit);
-               return -ENOMEM;
-       }
-       return 0;
-}
-
-/**
- * scif_destroy_window:
- * @ep: end point
- * @window: registration window
- *
- * Deallocate resources for self window.
- */
-int scif_destroy_window(struct scif_endpt *ep, struct scif_window *window)
-{
-       int j;
-       struct scif_pinned_pages *pinned_pages = window->pinned_pages;
-       int nr_pages = window->nr_pages;
-
-       might_sleep();
-       if (!window->temp && window->mm) {
-               __scif_dec_pinned_vm_lock(window->mm, window->nr_pages);
-               __scif_release_mm(window->mm);
-               window->mm = NULL;
-       }
-
-       scif_free_window_offset(ep, window, window->offset);
-       scif_unmap_window(ep->remote_dev, window);
-       /*
-        * Decrement references for this set of pinned pages from
-        * this window.
-        */
-       j = atomic_sub_return(1, &pinned_pages->ref_count);
-       if (j < 0)
-               dev_err(scif_info.mdev.this_device,
-                       "%s %d incorrect ref count %d\n",
-                       __func__, __LINE__, j);
-       /*
-        * If the ref count for pinned_pages is zero then someone
-        * has already called scif_unpin_pages() for it and we should
-        * destroy the page cache.
-        */
-       if (!j)
-               scif_destroy_pinned_pages(window->pinned_pages);
-       scif_free(window->dma_addr, nr_pages * sizeof(*window->dma_addr));
-       scif_free(window->num_pages, nr_pages * sizeof(*window->num_pages));
-       window->magic = 0;
-       scif_free(window, sizeof(*window));
-       return 0;
-}
-
-/**
- * scif_create_remote_lookup:
- * @remote_dev: SCIF remote device
- * @window: remote window
- *
- * Allocate and prepare lookup entries for the remote
- * end to copy over the physical addresses.
- * Returns 0 on success and appropriate errno on failure.
- */
-static int scif_create_remote_lookup(struct scif_dev *remote_dev,
-                                    struct scif_window *window)
-{
-       int i, j, err = 0;
-       int nr_pages = window->nr_pages;
-       bool vmalloc_dma_phys, vmalloc_num_pages;
-
-       might_sleep();
-       /* Map window */
-       err = scif_map_single(&window->mapped_offset,
-                             window, remote_dev, sizeof(*window));
-       if (err)
-               goto error_window;
-
-       /* Compute the number of lookup entries. 21 == 2MB Shift */
-       window->nr_lookup = ALIGN(nr_pages * PAGE_SIZE,
-                                       ((2) * 1024 * 1024)) >> 21;
-
-       window->dma_addr_lookup.lookup =
-               scif_alloc_coherent(&window->dma_addr_lookup.offset,
-                                   remote_dev, window->nr_lookup *
-                                   sizeof(*window->dma_addr_lookup.lookup),
-                                   GFP_KERNEL | __GFP_ZERO);
-       if (!window->dma_addr_lookup.lookup) {
-               err = -ENOMEM;
-               goto error_window;
-       }
-
-       window->num_pages_lookup.lookup =
-               scif_alloc_coherent(&window->num_pages_lookup.offset,
-                                   remote_dev, window->nr_lookup *
-                                   sizeof(*window->num_pages_lookup.lookup),
-                                   GFP_KERNEL | __GFP_ZERO);
-       if (!window->num_pages_lookup.lookup) {
-               err = -ENOMEM;
-               goto error_window;
-       }
-
-       vmalloc_dma_phys = is_vmalloc_addr(&window->dma_addr[0]);
-       vmalloc_num_pages = is_vmalloc_addr(&window->num_pages[0]);
-
-       /* Now map each of the pages containing physical addresses */
-       for (i = 0, j = 0; i < nr_pages; i += SCIF_NR_ADDR_IN_PAGE, j++) {
-               err = scif_map_page(&window->dma_addr_lookup.lookup[j],
-                                   vmalloc_dma_phys ?
-                                   vmalloc_to_page(&window->dma_addr[i]) :
-                                   virt_to_page(&window->dma_addr[i]),
-                                   remote_dev);
-               if (err)
-                       goto error_window;
-               err = scif_map_page(&window->num_pages_lookup.lookup[j],
-                                   vmalloc_num_pages ?
-                                   vmalloc_to_page(&window->num_pages[i]) :
-                                   virt_to_page(&window->num_pages[i]),
-                                   remote_dev);
-               if (err)
-                       goto error_window;
-       }
-       return 0;
-error_window:
-       return err;
-}
-
-/**
- * scif_destroy_remote_lookup:
- * @remote_dev: SCIF remote device
- * @window: remote window
- *
- * Destroy lookup entries used for the remote
- * end to copy over the physical addresses.
- */
-static void scif_destroy_remote_lookup(struct scif_dev *remote_dev,
-                                      struct scif_window *window)
-{
-       int i, j;
-
-       if (window->nr_lookup) {
-               struct scif_rma_lookup *lup = &window->dma_addr_lookup;
-               struct scif_rma_lookup *npup = &window->num_pages_lookup;
-
-               for (i = 0, j = 0; i < window->nr_pages;
-                       i += SCIF_NR_ADDR_IN_PAGE, j++) {
-                       if (lup->lookup && lup->lookup[j])
-                               scif_unmap_single(lup->lookup[j],
-                                                 remote_dev,
-                                                 PAGE_SIZE);
-                       if (npup->lookup && npup->lookup[j])
-                               scif_unmap_single(npup->lookup[j],
-                                                 remote_dev,
-                                                 PAGE_SIZE);
-               }
-               if (lup->lookup)
-                       scif_free_coherent(lup->lookup, lup->offset,
-                                          remote_dev, window->nr_lookup *
-                                          sizeof(*lup->lookup));
-               if (npup->lookup)
-                       scif_free_coherent(npup->lookup, npup->offset,
-                                          remote_dev, window->nr_lookup *
-                                          sizeof(*npup->lookup));
-               if (window->mapped_offset)
-                       scif_unmap_single(window->mapped_offset,
-                                         remote_dev, sizeof(*window));
-               window->nr_lookup = 0;
-       }
-}
-
-/**
- * scif_create_remote_window:
- * @scifdev:  SCIF device
- * @nr_pages: number of pages in window
- *
- * Allocate and prepare a remote registration window.
- */
-static struct scif_window *
-scif_create_remote_window(struct scif_dev *scifdev, int nr_pages)
-{
-       struct scif_window *window;
-
-       might_sleep();
-       window = scif_zalloc(sizeof(*window));
-       if (!window)
-               goto error_ret;
-
-       window->magic = SCIFEP_MAGIC;
-       window->nr_pages = nr_pages;
-
-       window->dma_addr = scif_zalloc(nr_pages * sizeof(*window->dma_addr));
-       if (!window->dma_addr)
-               goto error_window;
-
-       window->num_pages = scif_zalloc(nr_pages *
-                                       sizeof(*window->num_pages));
-       if (!window->num_pages)
-               goto error_window;
-
-       if (scif_create_remote_lookup(scifdev, window))
-               goto error_window;
-
-       window->type = SCIF_WINDOW_PEER;
-       window->unreg_state = OP_IDLE;
-       INIT_LIST_HEAD(&window->list);
-       return window;
-error_window:
-       scif_destroy_remote_window(window);
-error_ret:
-       return NULL;
-}
-
-/**
- * scif_destroy_remote_window:
- * @window: remote registration window
- *
- * Deallocate resources for remote window.
- */
-void
-scif_destroy_remote_window(struct scif_window *window)
-{
-       scif_free(window->dma_addr, window->nr_pages *
-                 sizeof(*window->dma_addr));
-       scif_free(window->num_pages, window->nr_pages *
-                 sizeof(*window->num_pages));
-       window->magic = 0;
-       scif_free(window, sizeof(*window));
-}
-
-/**
- * scif_iommu_map: create DMA mappings if the IOMMU is enabled
- * @remote_dev: SCIF remote device
- * @window: remote registration window
- *
- * Map the physical pages using dma_map_sg(..) and then detect the number
- * of contiguous DMA mappings allocated
- */
-static int scif_iommu_map(struct scif_dev *remote_dev,
-                         struct scif_window *window)
-{
-       struct scatterlist *sg;
-       int i, err;
-       scif_pinned_pages_t pin = window->pinned_pages;
-
-       window->st = kzalloc(sizeof(*window->st), GFP_KERNEL);
-       if (!window->st)
-               return -ENOMEM;
-
-       err = sg_alloc_table(window->st, window->nr_pages, GFP_KERNEL);
-       if (err)
-               return err;
-
-       for_each_sg(window->st->sgl, sg, window->st->nents, i)
-               sg_set_page(sg, pin->pages[i], PAGE_SIZE, 0x0);
-
-       err = dma_map_sg(&remote_dev->sdev->dev, window->st->sgl,
-                        window->st->nents, DMA_BIDIRECTIONAL);
-       if (!err)
-               return -ENOMEM;
-       /* Detect contiguous ranges of DMA mappings */
-       sg = window->st->sgl;
-       for (i = 0; sg; i++) {
-               dma_addr_t last_da;
-
-               window->dma_addr[i] = sg_dma_address(sg);
-               window->num_pages[i] = sg_dma_len(sg) >> PAGE_SHIFT;
-               last_da = sg_dma_address(sg) + sg_dma_len(sg);
-               while ((sg = sg_next(sg)) && sg_dma_address(sg) == last_da) {
-                       window->num_pages[i] +=
-                               (sg_dma_len(sg) >> PAGE_SHIFT);
-                       last_da = window->dma_addr[i] +
-                               sg_dma_len(sg);
-               }
-               window->nr_contig_chunks++;
-       }
-       return 0;
-}
-
-/**
- * scif_map_window:
- * @remote_dev: SCIF remote device
- * @window: self registration window
- *
- * Map pages of a window into the aperture/PCI.
- * Also determine addresses required for DMA.
- */
-int
-scif_map_window(struct scif_dev *remote_dev, struct scif_window *window)
-{
-       int i, j, k, err = 0, nr_contig_pages;
-       scif_pinned_pages_t pin;
-       phys_addr_t phys_prev, phys_curr;
-
-       might_sleep();
-
-       pin = window->pinned_pages;
-
-       if (intel_iommu_enabled && !scifdev_self(remote_dev))
-               return scif_iommu_map(remote_dev, window);
-
-       for (i = 0, j = 0; i < window->nr_pages; i += nr_contig_pages, j++) {
-               phys_prev = page_to_phys(pin->pages[i]);
-               nr_contig_pages = 1;
-
-               /* Detect physically contiguous chunks */
-               for (k = i + 1; k < window->nr_pages; k++) {
-                       phys_curr = page_to_phys(pin->pages[k]);
-                       if (phys_curr != (phys_prev + PAGE_SIZE))
-                               break;
-                       phys_prev = phys_curr;
-                       nr_contig_pages++;
-               }
-               window->num_pages[j] = nr_contig_pages;
-               window->nr_contig_chunks++;
-               if (scif_is_mgmt_node()) {
-                       /*
-                        * Management node has to deal with SMPT on X100 and
-                        * hence the DMA mapping is required
-                        */
-                       err = scif_map_single(&window->dma_addr[j],
-                                             phys_to_virt(page_to_phys(
-                                                          pin->pages[i])),
-                                             remote_dev,
-                                             nr_contig_pages << PAGE_SHIFT);
-                       if (err)
-                               return err;
-               } else {
-                       window->dma_addr[j] = page_to_phys(pin->pages[i]);
-               }
-       }
-       return err;
-}
-
-/**
- * scif_send_scif_unregister:
- * @ep: end point
- * @window: self registration window
- *
- * Send a SCIF_UNREGISTER message.
- */
-static int scif_send_scif_unregister(struct scif_endpt *ep,
-                                    struct scif_window *window)
-{
-       struct scifmsg msg;
-
-       msg.uop = SCIF_UNREGISTER;
-       msg.src = ep->port;
-       msg.payload[0] = window->alloc_handle.vaddr;
-       msg.payload[1] = (u64)window;
-       return scif_nodeqp_send(ep->remote_dev, &msg);
-}
-
-/**
- * scif_unregister_window:
- * @window: self registration window
- *
- * Send an unregistration request and wait for a response.
- */
-int scif_unregister_window(struct scif_window *window)
-{
-       int err = 0;
-       struct scif_endpt *ep = (struct scif_endpt *)window->ep;
-       bool send_msg = false;
-
-       might_sleep();
-       switch (window->unreg_state) {
-       case OP_IDLE:
-       {
-               window->unreg_state = OP_IN_PROGRESS;
-               send_msg = true;
-       }
-               fallthrough;
-       case OP_IN_PROGRESS:
-       {
-               scif_get_window(window, 1);
-               mutex_unlock(&ep->rma_info.rma_lock);
-               if (send_msg) {
-                       err = scif_send_scif_unregister(ep, window);
-                       if (err) {
-                               window->unreg_state = OP_COMPLETED;
-                               goto done;
-                       }
-               } else {
-                       /* Return ENXIO since unregistration is in progress */
-                       mutex_lock(&ep->rma_info.rma_lock);
-                       return -ENXIO;
-               }
-retry:
-               /* Wait for a SCIF_UNREGISTER_(N)ACK message */
-               err = wait_event_timeout(window->unregwq,
-                                        window->unreg_state != OP_IN_PROGRESS,
-                                        SCIF_NODE_ALIVE_TIMEOUT);
-               if (!err && scifdev_alive(ep))
-                       goto retry;
-               if (!err) {
-                       err = -ENODEV;
-                       window->unreg_state = OP_COMPLETED;
-                       dev_err(scif_info.mdev.this_device,
-                               "%s %d err %d\n", __func__, __LINE__, err);
-               }
-               if (err > 0)
-                       err = 0;
-done:
-               mutex_lock(&ep->rma_info.rma_lock);
-               scif_put_window(window, 1);
-               break;
-       }
-       case OP_FAILED:
-       {
-               if (!scifdev_alive(ep)) {
-                       err = -ENODEV;
-                       window->unreg_state = OP_COMPLETED;
-               }
-               break;
-       }
-       case OP_COMPLETED:
-               break;
-       default:
-               err = -ENODEV;
-       }
-
-       if (window->unreg_state == OP_COMPLETED && window->ref_count)
-               scif_put_window(window, window->nr_pages);
-
-       if (!window->ref_count) {
-               atomic_inc(&ep->rma_info.tw_refcount);
-               list_del_init(&window->list);
-               scif_free_window_offset(ep, window, window->offset);
-               mutex_unlock(&ep->rma_info.rma_lock);
-               if ((!!(window->pinned_pages->map_flags & SCIF_MAP_KERNEL)) &&
-                   scifdev_alive(ep)) {
-                       scif_drain_dma_intr(ep->remote_dev->sdev,
-                                           ep->rma_info.dma_chan);
-               } else {
-                       if (!__scif_dec_pinned_vm_lock(window->mm,
-                                                      window->nr_pages)) {
-                               __scif_release_mm(window->mm);
-                               window->mm = NULL;
-                       }
-               }
-               scif_queue_for_cleanup(window, &scif_info.rma);
-               mutex_lock(&ep->rma_info.rma_lock);
-       }
-       return err;
-}
-
-/**
- * scif_send_alloc_request:
- * @ep: end point
- * @window: self registration window
- *
- * Send a remote window allocation request
- */
-static int scif_send_alloc_request(struct scif_endpt *ep,
-                                  struct scif_window *window)
-{
-       struct scifmsg msg;
-       struct scif_allocmsg *alloc = &window->alloc_handle;
-
-       /* Set up the Alloc Handle */
-       alloc->state = OP_IN_PROGRESS;
-       init_waitqueue_head(&alloc->allocwq);
-
-       /* Send out an allocation request */
-       msg.uop = SCIF_ALLOC_REQ;
-       msg.payload[1] = window->nr_pages;
-       msg.payload[2] = (u64)&window->alloc_handle;
-       return _scif_nodeqp_send(ep->remote_dev, &msg);
-}
-
-/**
- * scif_prep_remote_window:
- * @ep: end point
- * @window: self registration window
- *
- * Send a remote window allocation request, wait for an allocation response,
- * and prepares the remote window by copying over the page lists
- */
-static int scif_prep_remote_window(struct scif_endpt *ep,
-                                  struct scif_window *window)
-{
-       struct scifmsg msg;
-       struct scif_window *remote_window;
-       struct scif_allocmsg *alloc = &window->alloc_handle;
-       dma_addr_t *dma_phys_lookup, *tmp, *num_pages_lookup, *tmp1;
-       int i = 0, j = 0;
-       int nr_contig_chunks, loop_nr_contig_chunks;
-       int remaining_nr_contig_chunks, nr_lookup;
-       int err, map_err;
-
-       map_err = scif_map_window(ep->remote_dev, window);
-       if (map_err)
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d map_err %d\n", __func__, __LINE__, map_err);
-       remaining_nr_contig_chunks = window->nr_contig_chunks;
-       nr_contig_chunks = window->nr_contig_chunks;
-retry:
-       /* Wait for a SCIF_ALLOC_GNT/REJ message */
-       err = wait_event_timeout(alloc->allocwq,
-                                alloc->state != OP_IN_PROGRESS,
-                                SCIF_NODE_ALIVE_TIMEOUT);
-       mutex_lock(&ep->rma_info.rma_lock);
-       /* Synchronize with the thread waking up allocwq */
-       mutex_unlock(&ep->rma_info.rma_lock);
-       if (!err && scifdev_alive(ep))
-               goto retry;
-
-       if (!err)
-               err = -ENODEV;
-
-       if (err > 0)
-               err = 0;
-       else
-               return err;
-
-       /* Bail out. The remote end rejected this request */
-       if (alloc->state == OP_FAILED)
-               return -ENOMEM;
-
-       if (map_err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, map_err);
-               msg.uop = SCIF_FREE_VIRT;
-               msg.src = ep->port;
-               msg.payload[0] = ep->remote_ep;
-               msg.payload[1] = window->alloc_handle.vaddr;
-               msg.payload[2] = (u64)window;
-               msg.payload[3] = SCIF_REGISTER;
-               spin_lock(&ep->lock);
-               if (ep->state == SCIFEP_CONNECTED)
-                       err = _scif_nodeqp_send(ep->remote_dev, &msg);
-               else
-                       err = -ENOTCONN;
-               spin_unlock(&ep->lock);
-               return err;
-       }
-
-       remote_window = scif_ioremap(alloc->phys_addr, sizeof(*window),
-                                    ep->remote_dev);
-
-       /* Compute the number of lookup entries. 21 == 2MB Shift */
-       nr_lookup = ALIGN(nr_contig_chunks, SCIF_NR_ADDR_IN_PAGE)
-                         >> ilog2(SCIF_NR_ADDR_IN_PAGE);
-
-       dma_phys_lookup =
-               scif_ioremap(remote_window->dma_addr_lookup.offset,
-                            nr_lookup *
-                            sizeof(*remote_window->dma_addr_lookup.lookup),
-                            ep->remote_dev);
-       num_pages_lookup =
-               scif_ioremap(remote_window->num_pages_lookup.offset,
-                            nr_lookup *
-                            sizeof(*remote_window->num_pages_lookup.lookup),
-                            ep->remote_dev);
-
-       while (remaining_nr_contig_chunks) {
-               loop_nr_contig_chunks = min_t(int, remaining_nr_contig_chunks,
-                                             (int)SCIF_NR_ADDR_IN_PAGE);
-               /* #1/2 - Copy  physical addresses over to the remote side */
-
-               /* #2/2 - Copy DMA addresses (addresses that are fed into the
-                * DMA engine) We transfer bus addresses which are then
-                * converted into a MIC physical address on the remote
-                * side if it is a MIC, if the remote node is a mgmt node we
-                * transfer the MIC physical address
-                */
-               tmp = scif_ioremap(dma_phys_lookup[j],
-                                  loop_nr_contig_chunks *
-                                  sizeof(*window->dma_addr),
-                                  ep->remote_dev);
-               tmp1 = scif_ioremap(num_pages_lookup[j],
-                                   loop_nr_contig_chunks *
-                                   sizeof(*window->num_pages),
-                                   ep->remote_dev);
-               if (scif_is_mgmt_node()) {
-                       memcpy_toio((void __force __iomem *)tmp,
-                                   &window->dma_addr[i], loop_nr_contig_chunks
-                                   * sizeof(*window->dma_addr));
-                       memcpy_toio((void __force __iomem *)tmp1,
-                                   &window->num_pages[i], loop_nr_contig_chunks
-                                   * sizeof(*window->num_pages));
-               } else {
-                       if (scifdev_is_p2p(ep->remote_dev)) {
-                               /*
-                                * add remote node's base address for this node
-                                * to convert it into a MIC address
-                                */
-                               int m;
-                               dma_addr_t dma_addr;
-
-                               for (m = 0; m < loop_nr_contig_chunks; m++) {
-                                       dma_addr = window->dma_addr[i + m] +
-                                               ep->remote_dev->base_addr;
-                                       writeq(dma_addr,
-                                              (void __force __iomem *)&tmp[m]);
-                               }
-                               memcpy_toio((void __force __iomem *)tmp1,
-                                           &window->num_pages[i],
-                                           loop_nr_contig_chunks
-                                           * sizeof(*window->num_pages));
-                       } else {
-                               /* Mgmt node or loopback - transfer DMA
-                                * addresses as is, this is the same as a
-                                * MIC physical address (we use the dma_addr
-                                * and not the phys_addr array since the
-                                * phys_addr is only setup if there is a mmap()
-                                * request from the mgmt node)
-                                */
-                               memcpy_toio((void __force __iomem *)tmp,
-                                           &window->dma_addr[i],
-                                           loop_nr_contig_chunks *
-                                           sizeof(*window->dma_addr));
-                               memcpy_toio((void __force __iomem *)tmp1,
-                                           &window->num_pages[i],
-                                           loop_nr_contig_chunks *
-                                           sizeof(*window->num_pages));
-                       }
-               }
-               remaining_nr_contig_chunks -= loop_nr_contig_chunks;
-               i += loop_nr_contig_chunks;
-               j++;
-               scif_iounmap(tmp, loop_nr_contig_chunks *
-                            sizeof(*window->dma_addr), ep->remote_dev);
-               scif_iounmap(tmp1, loop_nr_contig_chunks *
-                            sizeof(*window->num_pages), ep->remote_dev);
-       }
-
-       /* Prepare the remote window for the peer */
-       remote_window->peer_window = (u64)window;
-       remote_window->offset = window->offset;
-       remote_window->prot = window->prot;
-       remote_window->nr_contig_chunks = nr_contig_chunks;
-       remote_window->ep = ep->remote_ep;
-       scif_iounmap(num_pages_lookup,
-                    nr_lookup *
-                    sizeof(*remote_window->num_pages_lookup.lookup),
-                    ep->remote_dev);
-       scif_iounmap(dma_phys_lookup,
-                    nr_lookup *
-                    sizeof(*remote_window->dma_addr_lookup.lookup),
-                    ep->remote_dev);
-       scif_iounmap(remote_window, sizeof(*remote_window), ep->remote_dev);
-       window->peer_window = alloc->vaddr;
-       return err;
-}
-
-/**
- * scif_send_scif_register:
- * @ep: end point
- * @window: self registration window
- *
- * Send a SCIF_REGISTER message if EP is connected and wait for a
- * SCIF_REGISTER_(N)ACK message else send a SCIF_FREE_VIRT
- * message so that the peer can free its remote window allocated earlier.
- */
-static int scif_send_scif_register(struct scif_endpt *ep,
-                                  struct scif_window *window)
-{
-       int err = 0;
-       struct scifmsg msg;
-
-       msg.src = ep->port;
-       msg.payload[0] = ep->remote_ep;
-       msg.payload[1] = window->alloc_handle.vaddr;
-       msg.payload[2] = (u64)window;
-       spin_lock(&ep->lock);
-       if (ep->state == SCIFEP_CONNECTED) {
-               msg.uop = SCIF_REGISTER;
-               window->reg_state = OP_IN_PROGRESS;
-               err = _scif_nodeqp_send(ep->remote_dev, &msg);
-               spin_unlock(&ep->lock);
-               if (!err) {
-retry:
-                       /* Wait for a SCIF_REGISTER_(N)ACK message */
-                       err = wait_event_timeout(window->regwq,
-                                                window->reg_state !=
-                                                OP_IN_PROGRESS,
-                                                SCIF_NODE_ALIVE_TIMEOUT);
-                       if (!err && scifdev_alive(ep))
-                               goto retry;
-                       err = !err ? -ENODEV : 0;
-                       if (window->reg_state == OP_FAILED)
-                               err = -ENOTCONN;
-               }
-       } else {
-               msg.uop = SCIF_FREE_VIRT;
-               msg.payload[3] = SCIF_REGISTER;
-               err = _scif_nodeqp_send(ep->remote_dev, &msg);
-               spin_unlock(&ep->lock);
-               if (!err)
-                       err = -ENOTCONN;
-       }
-       return err;
-}
-
-/**
- * scif_get_window_offset:
- * @ep: end point descriptor
- * @flags: flags
- * @offset: offset hint
- * @num_pages: number of pages
- * @out_offset: computed offset returned by reference.
- *
- * Compute/Claim a new offset for this EP.
- */
-int scif_get_window_offset(struct scif_endpt *ep, int flags, s64 offset,
-                          int num_pages, s64 *out_offset)
-{
-       s64 page_index;
-       struct iova *iova_ptr;
-       int err = 0;
-
-       if (flags & SCIF_MAP_FIXED) {
-               page_index = SCIF_IOVA_PFN(offset);
-               iova_ptr = reserve_iova(&ep->rma_info.iovad, page_index,
-                                       page_index + num_pages - 1);
-               if (!iova_ptr)
-                       err = -EADDRINUSE;
-       } else {
-               iova_ptr = alloc_iova(&ep->rma_info.iovad, num_pages,
-                                     SCIF_DMA_63BIT_PFN - 1, 0);
-               if (!iova_ptr)
-                       err = -ENOMEM;
-       }
-       if (!err)
-               *out_offset = (iova_ptr->pfn_lo) << PAGE_SHIFT;
-       return err;
-}
-
-/**
- * scif_free_window_offset:
- * @ep: end point descriptor
- * @window: registration window
- * @offset: Offset to be freed
- *
- * Free offset for this EP. The callee is supposed to grab
- * the RMA mutex before calling this API.
- */
-void scif_free_window_offset(struct scif_endpt *ep,
-                            struct scif_window *window, s64 offset)
-{
-       if ((window && !window->offset_freed) || !window) {
-               free_iova(&ep->rma_info.iovad, offset >> PAGE_SHIFT);
-               if (window)
-                       window->offset_freed = true;
-       }
-}
-
-/**
- * scif_alloc_req: Respond to SCIF_ALLOC_REQ interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * Remote side is requesting a memory allocation.
- */
-void scif_alloc_req(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       int err;
-       struct scif_window *window = NULL;
-       int nr_pages = msg->payload[1];
-
-       window = scif_create_remote_window(scifdev, nr_pages);
-       if (!window) {
-               err = -ENOMEM;
-               goto error;
-       }
-
-       /* The peer's allocation request is granted */
-       msg->uop = SCIF_ALLOC_GNT;
-       msg->payload[0] = (u64)window;
-       msg->payload[1] = window->mapped_offset;
-       err = scif_nodeqp_send(scifdev, msg);
-       if (err)
-               scif_destroy_remote_window(window);
-       return;
-error:
-       /* The peer's allocation request is rejected */
-       dev_err(&scifdev->sdev->dev,
-               "%s %d error %d alloc_ptr %p nr_pages 0x%x\n",
-               __func__, __LINE__, err, window, nr_pages);
-       msg->uop = SCIF_ALLOC_REJ;
-       scif_nodeqp_send(scifdev, msg);
-}
-
-/**
- * scif_alloc_gnt_rej: Respond to SCIF_ALLOC_GNT/REJ interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * Remote side responded to a memory allocation.
- */
-void scif_alloc_gnt_rej(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_allocmsg *handle = (struct scif_allocmsg *)msg->payload[2];
-       struct scif_window *window = container_of(handle, struct scif_window,
-                                                 alloc_handle);
-       struct scif_endpt *ep = (struct scif_endpt *)window->ep;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       handle->vaddr = msg->payload[0];
-       handle->phys_addr = msg->payload[1];
-       if (msg->uop == SCIF_ALLOC_GNT)
-               handle->state = OP_COMPLETED;
-       else
-               handle->state = OP_FAILED;
-       wake_up(&handle->allocwq);
-       mutex_unlock(&ep->rma_info.rma_lock);
-}
-
-/**
- * scif_free_virt: Respond to SCIF_FREE_VIRT interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * Free up memory kmalloc'd earlier.
- */
-void scif_free_virt(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_window *window = (struct scif_window *)msg->payload[1];
-
-       scif_destroy_remote_window(window);
-}
-
-static void
-scif_fixup_aper_base(struct scif_dev *dev, struct scif_window *window)
-{
-       int j;
-       struct scif_hw_dev *sdev = dev->sdev;
-       phys_addr_t apt_base = 0;
-
-       /*
-        * Add the aperture base if the DMA address is not card relative
-        * since the DMA addresses need to be an offset into the bar
-        */
-       if (!scifdev_self(dev) && window->type == SCIF_WINDOW_PEER &&
-           sdev->aper && !sdev->card_rel_da)
-               apt_base = sdev->aper->pa;
-       else
-               return;
-
-       for (j = 0; j < window->nr_contig_chunks; j++) {
-               if (window->num_pages[j])
-                       window->dma_addr[j] += apt_base;
-               else
-                       break;
-       }
-}
-
-/**
- * scif_recv_reg: Respond to SCIF_REGISTER interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * Update remote window list with a new registered window.
- */
-void scif_recv_reg(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)msg->payload[0];
-       struct scif_window *window =
-               (struct scif_window *)msg->payload[1];
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       spin_lock(&ep->lock);
-       if (ep->state == SCIFEP_CONNECTED) {
-               msg->uop = SCIF_REGISTER_ACK;
-               scif_nodeqp_send(ep->remote_dev, msg);
-               scif_fixup_aper_base(ep->remote_dev, window);
-               /* No further failures expected. Insert new window */
-               scif_insert_window(window, &ep->rma_info.remote_reg_list);
-       } else {
-               msg->uop = SCIF_REGISTER_NACK;
-               scif_nodeqp_send(ep->remote_dev, msg);
-       }
-       spin_unlock(&ep->lock);
-       mutex_unlock(&ep->rma_info.rma_lock);
-       /* free up any lookup resources now that page lists are transferred */
-       scif_destroy_remote_lookup(ep->remote_dev, window);
-       /*
-        * We could not insert the window but we need to
-        * destroy the window.
-        */
-       if (msg->uop == SCIF_REGISTER_NACK)
-               scif_destroy_remote_window(window);
-}
-
-/**
- * scif_recv_unreg: Respond to SCIF_UNREGISTER interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * Remove window from remote registration list;
- */
-void scif_recv_unreg(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_rma_req req;
-       struct scif_window *window = NULL;
-       struct scif_window *recv_window =
-               (struct scif_window *)msg->payload[0];
-       struct scif_endpt *ep;
-       int del_window = 0;
-
-       ep = (struct scif_endpt *)recv_window->ep;
-       req.out_window = &window;
-       req.offset = recv_window->offset;
-       req.prot = 0;
-       req.nr_bytes = recv_window->nr_pages << PAGE_SHIFT;
-       req.type = SCIF_WINDOW_FULL;
-       req.head = &ep->rma_info.remote_reg_list;
-       msg->payload[0] = ep->remote_ep;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       /* Does a valid window exist? */
-       if (scif_query_window(&req)) {
-               dev_err(&scifdev->sdev->dev,
-                       "%s %d -ENXIO\n", __func__, __LINE__);
-               msg->uop = SCIF_UNREGISTER_ACK;
-               goto error;
-       }
-       if (window) {
-               if (window->ref_count)
-                       scif_put_window(window, window->nr_pages);
-               else
-                       dev_err(&scifdev->sdev->dev,
-                               "%s %d ref count should be +ve\n",
-                               __func__, __LINE__);
-               window->unreg_state = OP_COMPLETED;
-               if (!window->ref_count) {
-                       msg->uop = SCIF_UNREGISTER_ACK;
-                       atomic_inc(&ep->rma_info.tw_refcount);
-                       ep->rma_info.async_list_del = 1;
-                       list_del_init(&window->list);
-                       del_window = 1;
-               } else {
-                       /* NACK! There are valid references to this window */
-                       msg->uop = SCIF_UNREGISTER_NACK;
-               }
-       } else {
-               /* The window did not make its way to the list at all. ACK */
-               msg->uop = SCIF_UNREGISTER_ACK;
-               scif_destroy_remote_window(recv_window);
-       }
-error:
-       mutex_unlock(&ep->rma_info.rma_lock);
-       if (del_window)
-               scif_drain_dma_intr(ep->remote_dev->sdev,
-                                   ep->rma_info.dma_chan);
-       scif_nodeqp_send(ep->remote_dev, msg);
-       if (del_window)
-               scif_queue_for_cleanup(window, &scif_info.rma);
-}
-
-/**
- * scif_recv_reg_ack: Respond to SCIF_REGISTER_ACK interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * Wake up the window waiting to complete registration.
- */
-void scif_recv_reg_ack(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_window *window =
-               (struct scif_window *)msg->payload[2];
-       struct scif_endpt *ep = (struct scif_endpt *)window->ep;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       window->reg_state = OP_COMPLETED;
-       wake_up(&window->regwq);
-       mutex_unlock(&ep->rma_info.rma_lock);
-}
-
-/**
- * scif_recv_reg_nack: Respond to SCIF_REGISTER_NACK interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * Wake up the window waiting to inform it that registration
- * cannot be completed.
- */
-void scif_recv_reg_nack(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_window *window =
-               (struct scif_window *)msg->payload[2];
-       struct scif_endpt *ep = (struct scif_endpt *)window->ep;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       window->reg_state = OP_FAILED;
-       wake_up(&window->regwq);
-       mutex_unlock(&ep->rma_info.rma_lock);
-}
-
-/**
- * scif_recv_unreg_ack: Respond to SCIF_UNREGISTER_ACK interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * Wake up the window waiting to complete unregistration.
- */
-void scif_recv_unreg_ack(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_window *window =
-               (struct scif_window *)msg->payload[1];
-       struct scif_endpt *ep = (struct scif_endpt *)window->ep;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       window->unreg_state = OP_COMPLETED;
-       wake_up(&window->unregwq);
-       mutex_unlock(&ep->rma_info.rma_lock);
-}
-
-/**
- * scif_recv_unreg_nack: Respond to SCIF_UNREGISTER_NACK interrupt message
- * @scifdev:    SCIF device
- * @msg:        Interrupt message
- *
- * Wake up the window waiting to inform it that unregistration
- * cannot be completed immediately.
- */
-void scif_recv_unreg_nack(struct scif_dev *scifdev, struct scifmsg *msg)
-{
-       struct scif_window *window =
-               (struct scif_window *)msg->payload[1];
-       struct scif_endpt *ep = (struct scif_endpt *)window->ep;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       window->unreg_state = OP_FAILED;
-       wake_up(&window->unregwq);
-       mutex_unlock(&ep->rma_info.rma_lock);
-}
-
-int __scif_pin_pages(void *addr, size_t len, int *out_prot,
-                    int map_flags, scif_pinned_pages_t *pages)
-{
-       struct scif_pinned_pages *pinned_pages;
-       int nr_pages, err = 0, i;
-       bool vmalloc_addr = false;
-       bool try_upgrade = false;
-       int prot = *out_prot;
-       int ulimit = 0;
-       struct mm_struct *mm = NULL;
-
-       /* Unsupported flags */
-       if (map_flags & ~(SCIF_MAP_KERNEL | SCIF_MAP_ULIMIT))
-               return -EINVAL;
-       ulimit = !!(map_flags & SCIF_MAP_ULIMIT);
-
-       /* Unsupported protection requested */
-       if (prot & ~(SCIF_PROT_READ | SCIF_PROT_WRITE))
-               return -EINVAL;
-
-       /* addr/len must be page aligned. len should be non zero */
-       if (!len ||
-           (ALIGN((u64)addr, PAGE_SIZE) != (u64)addr) ||
-           (ALIGN((u64)len, PAGE_SIZE) != (u64)len))
-               return -EINVAL;
-
-       might_sleep();
-
-       nr_pages = len >> PAGE_SHIFT;
-
-       /* Allocate a set of pinned pages */
-       pinned_pages = scif_create_pinned_pages(nr_pages, prot);
-       if (!pinned_pages)
-               return -ENOMEM;
-
-       if (map_flags & SCIF_MAP_KERNEL) {
-               if (is_vmalloc_addr(addr))
-                       vmalloc_addr = true;
-
-               for (i = 0; i < nr_pages; i++) {
-                       if (vmalloc_addr)
-                               pinned_pages->pages[i] =
-                                       vmalloc_to_page(addr + (i * PAGE_SIZE));
-                       else
-                               pinned_pages->pages[i] =
-                                       virt_to_page(addr + (i * PAGE_SIZE));
-               }
-               pinned_pages->nr_pages = nr_pages;
-               pinned_pages->map_flags = SCIF_MAP_KERNEL;
-       } else {
-               /*
-                * SCIF supports registration caching. If a registration has
-                * been requested with read only permissions, then we try
-                * to pin the pages with RW permissions so that a subsequent
-                * transfer with RW permission can hit the cache instead of
-                * invalidating it. If the upgrade fails with RW then we
-                * revert back to R permission and retry
-                */
-               if (prot == SCIF_PROT_READ)
-                       try_upgrade = true;
-               prot |= SCIF_PROT_WRITE;
-retry:
-               mm = current->mm;
-               if (ulimit) {
-                       err = __scif_check_inc_pinned_vm(mm, nr_pages);
-                       if (err) {
-                               pinned_pages->nr_pages = 0;
-                               goto error_unmap;
-                       }
-               }
-
-               pinned_pages->nr_pages = pin_user_pages_fast(
-                               (u64)addr,
-                               nr_pages,
-                               (prot & SCIF_PROT_WRITE) ? FOLL_WRITE : 0,
-                               pinned_pages->pages);
-               if (nr_pages != pinned_pages->nr_pages) {
-                       if (pinned_pages->nr_pages < 0)
-                               pinned_pages->nr_pages = 0;
-                       if (try_upgrade) {
-                               if (ulimit)
-                                       __scif_dec_pinned_vm_lock(mm, nr_pages);
-                               /* Roll back any pinned pages */
-                               unpin_user_pages(pinned_pages->pages,
-                                                pinned_pages->nr_pages);
-                               prot &= ~SCIF_PROT_WRITE;
-                               try_upgrade = false;
-                               goto retry;
-                       }
-               }
-               pinned_pages->map_flags = 0;
-       }
-
-       if (pinned_pages->nr_pages < nr_pages) {
-               err = -EFAULT;
-               goto dec_pinned;
-       }
-
-       *out_prot = prot;
-       atomic_set(&pinned_pages->ref_count, 1);
-       *pages = pinned_pages;
-       return err;
-dec_pinned:
-       if (ulimit)
-               __scif_dec_pinned_vm_lock(mm, nr_pages);
-       /* Something went wrong! Rollback */
-error_unmap:
-       scif_destroy_pinned_pages(pinned_pages);
-       *pages = NULL;
-       dev_dbg(scif_info.mdev.this_device,
-               "%s %d err %d len 0x%lx\n", __func__, __LINE__, err, len);
-       return err;
-}
-
-int scif_pin_pages(void *addr, size_t len, int prot,
-                  int map_flags, scif_pinned_pages_t *pages)
-{
-       return __scif_pin_pages(addr, len, &prot, map_flags, pages);
-}
-EXPORT_SYMBOL_GPL(scif_pin_pages);
-
-int scif_unpin_pages(scif_pinned_pages_t pinned_pages)
-{
-       int err = 0, ret;
-
-       if (!pinned_pages || SCIFEP_MAGIC != pinned_pages->magic)
-               return -EINVAL;
-
-       ret = atomic_sub_return(1, &pinned_pages->ref_count);
-       if (ret < 0) {
-               dev_err(scif_info.mdev.this_device,
-                       "%s %d scif_unpin_pages called without pinning? rc %d\n",
-                       __func__, __LINE__, ret);
-               return -EINVAL;
-       }
-       /*
-        * Destroy the window if the ref count for this set of pinned
-        * pages has dropped to zero. If it is positive then there is
-        * a valid registered window which is backed by these pages and
-        * it will be destroyed once all such windows are unregistered.
-        */
-       if (!ret)
-               err = scif_destroy_pinned_pages(pinned_pages);
-
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_unpin_pages);
-
-static inline void
-scif_insert_local_window(struct scif_window *window, struct scif_endpt *ep)
-{
-       mutex_lock(&ep->rma_info.rma_lock);
-       scif_insert_window(window, &ep->rma_info.reg_list);
-       mutex_unlock(&ep->rma_info.rma_lock);
-}
-
-off_t scif_register_pinned_pages(scif_epd_t epd,
-                                scif_pinned_pages_t pinned_pages,
-                                off_t offset, int map_flags)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       s64 computed_offset;
-       struct scif_window *window;
-       int err;
-       size_t len;
-       struct device *spdev;
-
-       /* Unsupported flags */
-       if (map_flags & ~SCIF_MAP_FIXED)
-               return -EINVAL;
-
-       len = pinned_pages->nr_pages << PAGE_SHIFT;
-
-       /*
-        * Offset is not page aligned/negative or offset+len
-        * wraps around with SCIF_MAP_FIXED.
-        */
-       if ((map_flags & SCIF_MAP_FIXED) &&
-           ((ALIGN(offset, PAGE_SIZE) != offset) ||
-           (offset < 0) ||
-           (len > LONG_MAX - offset)))
-               return -EINVAL;
-
-       might_sleep();
-
-       err = scif_verify_epd(ep);
-       if (err)
-               return err;
-       /*
-        * It is an error to pass pinned_pages to scif_register_pinned_pages()
-        * after calling scif_unpin_pages().
-        */
-       if (!atomic_add_unless(&pinned_pages->ref_count, 1, 0))
-               return -EINVAL;
-
-       /* Compute the offset for this registration */
-       err = scif_get_window_offset(ep, map_flags, offset,
-                                    len, &computed_offset);
-       if (err) {
-               atomic_sub(1, &pinned_pages->ref_count);
-               return err;
-       }
-
-       /* Allocate and prepare self registration window */
-       window = scif_create_window(ep, pinned_pages->nr_pages,
-                                   computed_offset, false);
-       if (!window) {
-               atomic_sub(1, &pinned_pages->ref_count);
-               scif_free_window_offset(ep, NULL, computed_offset);
-               return -ENOMEM;
-       }
-
-       window->pinned_pages = pinned_pages;
-       window->nr_pages = pinned_pages->nr_pages;
-       window->prot = pinned_pages->prot;
-
-       spdev = scif_get_peer_dev(ep->remote_dev);
-       if (IS_ERR(spdev)) {
-               err = PTR_ERR(spdev);
-               scif_destroy_window(ep, window);
-               return err;
-       }
-       err = scif_send_alloc_request(ep, window);
-       if (err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-               goto error_unmap;
-       }
-
-       /* Prepare the remote registration window */
-       err = scif_prep_remote_window(ep, window);
-       if (err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-               goto error_unmap;
-       }
-
-       /* Tell the peer about the new window */
-       err = scif_send_scif_register(ep, window);
-       if (err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-               goto error_unmap;
-       }
-
-       scif_put_peer_dev(spdev);
-       /* No further failures expected. Insert new window */
-       scif_insert_local_window(window, ep);
-       return computed_offset;
-error_unmap:
-       scif_destroy_window(ep, window);
-       scif_put_peer_dev(spdev);
-       dev_err(&ep->remote_dev->sdev->dev,
-               "%s %d err %d\n", __func__, __LINE__, err);
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_register_pinned_pages);
-
-off_t scif_register(scif_epd_t epd, void *addr, size_t len, off_t offset,
-                   int prot, int map_flags)
-{
-       scif_pinned_pages_t pinned_pages;
-       off_t err;
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       s64 computed_offset;
-       struct scif_window *window;
-       struct mm_struct *mm = NULL;
-       struct device *spdev;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI register: ep %p addr %p len 0x%lx offset 0x%lx prot 0x%x map_flags 0x%x\n",
-               epd, addr, len, offset, prot, map_flags);
-       /* Unsupported flags */
-       if (map_flags & ~(SCIF_MAP_FIXED | SCIF_MAP_KERNEL))
-               return -EINVAL;
-
-       /*
-        * Offset is not page aligned/negative or offset+len
-        * wraps around with SCIF_MAP_FIXED.
-        */
-       if ((map_flags & SCIF_MAP_FIXED) &&
-           ((ALIGN(offset, PAGE_SIZE) != offset) ||
-           (offset < 0) ||
-           (len > LONG_MAX - offset)))
-               return -EINVAL;
-
-       /* Unsupported protection requested */
-       if (prot & ~(SCIF_PROT_READ | SCIF_PROT_WRITE))
-               return -EINVAL;
-
-       /* addr/len must be page aligned. len should be non zero */
-       if (!len || (ALIGN((u64)addr, PAGE_SIZE) != (u64)addr) ||
-           (ALIGN(len, PAGE_SIZE) != len))
-               return -EINVAL;
-
-       might_sleep();
-
-       err = scif_verify_epd(ep);
-       if (err)
-               return err;
-
-       /* Compute the offset for this registration */
-       err = scif_get_window_offset(ep, map_flags, offset,
-                                    len >> PAGE_SHIFT, &computed_offset);
-       if (err)
-               return err;
-
-       spdev = scif_get_peer_dev(ep->remote_dev);
-       if (IS_ERR(spdev)) {
-               err = PTR_ERR(spdev);
-               scif_free_window_offset(ep, NULL, computed_offset);
-               return err;
-       }
-       /* Allocate and prepare self registration window */
-       window = scif_create_window(ep, len >> PAGE_SHIFT,
-                                   computed_offset, false);
-       if (!window) {
-               scif_free_window_offset(ep, NULL, computed_offset);
-               scif_put_peer_dev(spdev);
-               return -ENOMEM;
-       }
-
-       window->nr_pages = len >> PAGE_SHIFT;
-
-       err = scif_send_alloc_request(ep, window);
-       if (err) {
-               scif_destroy_incomplete_window(ep, window);
-               scif_put_peer_dev(spdev);
-               return err;
-       }
-
-       if (!(map_flags & SCIF_MAP_KERNEL)) {
-               mm = __scif_acquire_mm();
-               map_flags |= SCIF_MAP_ULIMIT;
-       }
-       /* Pin down the pages */
-       err = __scif_pin_pages(addr, len, &prot,
-                              map_flags & (SCIF_MAP_KERNEL | SCIF_MAP_ULIMIT),
-                              &pinned_pages);
-       if (err) {
-               scif_destroy_incomplete_window(ep, window);
-               __scif_release_mm(mm);
-               goto error;
-       }
-
-       window->pinned_pages = pinned_pages;
-       window->prot = pinned_pages->prot;
-       window->mm = mm;
-
-       /* Prepare the remote registration window */
-       err = scif_prep_remote_window(ep, window);
-       if (err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %ld\n", __func__, __LINE__, err);
-               goto error_unmap;
-       }
-
-       /* Tell the peer about the new window */
-       err = scif_send_scif_register(ep, window);
-       if (err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %ld\n", __func__, __LINE__, err);
-               goto error_unmap;
-       }
-
-       scif_put_peer_dev(spdev);
-       /* No further failures expected. Insert new window */
-       scif_insert_local_window(window, ep);
-       dev_dbg(&ep->remote_dev->sdev->dev,
-               "SCIFAPI register: ep %p addr %p len 0x%lx computed_offset 0x%llx\n",
-               epd, addr, len, computed_offset);
-       return computed_offset;
-error_unmap:
-       scif_destroy_window(ep, window);
-error:
-       scif_put_peer_dev(spdev);
-       dev_err(&ep->remote_dev->sdev->dev,
-               "%s %d err %ld\n", __func__, __LINE__, err);
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_register);
-
-int
-scif_unregister(scif_epd_t epd, off_t offset, size_t len)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       struct scif_window *window = NULL;
-       struct scif_rma_req req;
-       int nr_pages, err;
-       struct device *spdev;
-
-       dev_dbg(scif_info.mdev.this_device,
-               "SCIFAPI unregister: ep %p offset 0x%lx len 0x%lx\n",
-               ep, offset, len);
-       /* len must be page aligned. len should be non zero */
-       if (!len ||
-           (ALIGN((u64)len, PAGE_SIZE) != (u64)len))
-               return -EINVAL;
-
-       /* Offset is not page aligned or offset+len wraps around */
-       if ((ALIGN(offset, PAGE_SIZE) != offset) ||
-           (offset < 0) ||
-           (len > LONG_MAX - offset))
-               return -EINVAL;
-
-       err = scif_verify_epd(ep);
-       if (err)
-               return err;
-
-       might_sleep();
-       nr_pages = len >> PAGE_SHIFT;
-
-       req.out_window = &window;
-       req.offset = offset;
-       req.prot = 0;
-       req.nr_bytes = len;
-       req.type = SCIF_WINDOW_FULL;
-       req.head = &ep->rma_info.reg_list;
-
-       spdev = scif_get_peer_dev(ep->remote_dev);
-       if (IS_ERR(spdev)) {
-               err = PTR_ERR(spdev);
-               return err;
-       }
-       mutex_lock(&ep->rma_info.rma_lock);
-       /* Does a valid window exist? */
-       err = scif_query_window(&req);
-       if (err) {
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-               goto error;
-       }
-       /* Unregister all the windows in this range */
-       err = scif_rma_list_unregister(window, offset, nr_pages);
-       if (err)
-               dev_err(&ep->remote_dev->sdev->dev,
-                       "%s %d err %d\n", __func__, __LINE__, err);
-error:
-       mutex_unlock(&ep->rma_info.rma_lock);
-       scif_put_peer_dev(spdev);
-       return err;
-}
-EXPORT_SYMBOL_GPL(scif_unregister);
diff --git a/drivers/misc/mic/scif/scif_rma.h b/drivers/misc/mic/scif/scif_rma.h
deleted file mode 100644 (file)
index 964dd0f..0000000
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License 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.
- *
- * BSD LICENSE
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * 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 Intel 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.
- *
- * Intel SCIF driver.
- *
- */
-#ifndef SCIF_RMA_H
-#define SCIF_RMA_H
-
-#include <linux/intel-iommu.h>
-#include <linux/mmu_notifier.h>
-
-#include "../bus/scif_bus.h"
-
-/* If this bit is set then the mark is a remote fence mark */
-#define SCIF_REMOTE_FENCE_BIT          31
-/* Magic value used to indicate a remote fence request */
-#define SCIF_REMOTE_FENCE BIT_ULL(SCIF_REMOTE_FENCE_BIT)
-
-#define SCIF_MAX_UNALIGNED_BUF_SIZE (1024 * 1024ULL)
-#define SCIF_KMEM_UNALIGNED_BUF_SIZE (SCIF_MAX_UNALIGNED_BUF_SIZE + \
-                                     (L1_CACHE_BYTES << 1))
-
-#define SCIF_IOVA_START_PFN            (1)
-#define SCIF_IOVA_PFN(addr) ((addr) >> PAGE_SHIFT)
-#define SCIF_DMA_64BIT_PFN SCIF_IOVA_PFN(DMA_BIT_MASK(64))
-#define SCIF_DMA_63BIT_PFN SCIF_IOVA_PFN(DMA_BIT_MASK(63))
-
-/*
- * struct scif_endpt_rma_info - Per Endpoint Remote Memory Access Information
- *
- * @reg_list: List of registration windows for self
- * @remote_reg_list: List of registration windows for peer
- * @iovad: Offset generator
- * @rma_lock: Synchronizes access to self/remote list and also protects the
- *           window from being destroyed while RMAs are in progress.
- * @tc_lock: Synchronizes access to temporary cached windows list
- *          for SCIF Registration Caching.
- * @mmn_lock: Synchronizes access to the list of MMU notifiers registered
- * @tw_refcount: Keeps track of number of outstanding temporary registered
- *              windows created by scif_vreadfrom/scif_vwriteto which have
- *              not been destroyed.
- * @tcw_refcount: Same as tw_refcount but for temporary cached windows
- * @tcw_total_pages: Same as tcw_refcount but in terms of pages pinned
- * @mmn_list: MMU notifier so that we can destroy the windows when required
- * @fence_refcount: Keeps track of number of outstanding remote fence
- *                 requests which have been received by the peer.
- * @dma_chan: DMA channel used for all DMA transfers for this endpoint.
- * @async_list_del: Detect asynchronous list entry deletion
- * @vma_list: List of vmas with remote memory mappings
- * @markwq: Wait queue used for scif_fence_mark/scif_fence_wait
-*/
-struct scif_endpt_rma_info {
-       struct list_head reg_list;
-       struct list_head remote_reg_list;
-       struct iova_domain iovad;
-       struct mutex rma_lock;
-       spinlock_t tc_lock;
-       struct mutex mmn_lock;
-       atomic_t tw_refcount;
-       atomic_t tcw_refcount;
-       atomic_t tcw_total_pages;
-       struct list_head mmn_list;
-       atomic_t fence_refcount;
-       struct dma_chan *dma_chan;
-       int async_list_del;
-       struct list_head vma_list;
-       wait_queue_head_t markwq;
-};
-
-/*
- * struct scif_fence_info - used for tracking fence requests
- *
- * @state: State of this transfer
- * @wq: Fences wait on this queue
- * @dma_mark: Used for storing the DMA mark
- */
-struct scif_fence_info {
-       enum scif_msg_state state;
-       struct completion comp;
-       int dma_mark;
-};
-
-/*
- * struct scif_remote_fence_info - used for tracking remote fence requests
- *
- * @msg: List of SCIF node QP fence messages
- * @list: Link to list of remote fence requests
- */
-struct scif_remote_fence_info {
-       struct scifmsg msg;
-       struct list_head list;
-};
-
-/*
- * Specifies whether an RMA operation can span across partial windows, a single
- * window or multiple contiguous windows. Mmaps can span across partial windows.
- * Unregistration can span across complete windows. scif_get_pages() can span a
- * single window. A window can also be of type self or peer.
- */
-enum scif_window_type {
-       SCIF_WINDOW_PARTIAL,
-       SCIF_WINDOW_SINGLE,
-       SCIF_WINDOW_FULL,
-       SCIF_WINDOW_SELF,
-       SCIF_WINDOW_PEER
-};
-
-/* The number of physical addresses that can be stored in a PAGE. */
-#define SCIF_NR_ADDR_IN_PAGE   (0x1000 >> 3)
-
-/*
- * struct scif_rma_lookup - RMA lookup data structure for page list transfers
- *
- * Store an array of lookup offsets. Each offset in this array maps
- * one 4K page containing 512 physical addresses i.e. 2MB. 512 such
- * offsets in a 4K page will correspond to 1GB of registered address space.
-
- * @lookup: Array of offsets
- * @offset: DMA offset of lookup array
- */
-struct scif_rma_lookup {
-       dma_addr_t *lookup;
-       dma_addr_t offset;
-};
-
-/*
- * struct scif_pinned_pages - A set of pinned pages obtained with
- * scif_pin_pages() which could be part of multiple registered
- * windows across different end points.
- *
- * @nr_pages: Number of pages which is defined as a s64 instead of an int
- * to avoid sign extension with buffers >= 2GB
- * @prot: read/write protections
- * @map_flags: Flags specified during the pin operation
- * @ref_count: Reference count bumped in terms of number of pages
- * @magic: A magic value
- * @pages: Array of pointers to struct pages populated with get_user_pages(..)
- */
-struct scif_pinned_pages {
-       s64 nr_pages;
-       int prot;
-       int map_flags;
-       atomic_t ref_count;
-       u64 magic;
-       struct page **pages;
-};
-
-/*
- * struct scif_status - Stores DMA status update information
- *
- * @src_dma_addr: Source buffer DMA address
- * @val: src location for value to be written to the destination
- * @ep: SCIF endpoint
- */
-struct scif_status {
-       dma_addr_t src_dma_addr;
-       u64 val;
-       struct scif_endpt *ep;
-};
-
-/*
- * struct scif_cb_arg - Stores the argument of the callback func
- *
- * @src_dma_addr: Source buffer DMA address
- * @status: DMA status
- * @ep: SCIF endpoint
- */
-struct scif_cb_arg {
-       dma_addr_t src_dma_addr;
-       struct scif_status *status;
-       struct scif_endpt *ep;
-};
-
-/*
- * struct scif_window - Registration Window for Self and Remote
- *
- * @nr_pages: Number of pages which is defined as a s64 instead of an int
- * to avoid sign extension with buffers >= 2GB
- * @nr_contig_chunks: Number of contiguous physical chunks
- * @prot: read/write protections
- * @ref_count: reference count in terms of number of pages
- * @magic: Cookie to detect corruption
- * @offset: registered offset
- * @va_for_temp: va address that this window represents
- * @dma_mark: Used to determine if all DMAs against the window are done
- * @ep: Pointer to EP. Useful for passing EP around with messages to
-       avoid expensive list traversals.
- * @list: link to list of windows for the endpoint
- * @type: self or peer window
- * @peer_window: Pointer to peer window. Useful for sending messages to peer
- *              without requiring an extra list traversal
- * @unreg_state: unregistration state
- * @offset_freed: True if the offset has been freed
- * @temp: True for temporary windows created via scif_vreadfrom/scif_vwriteto
- * @mm: memory descriptor for the task_struct which initiated the RMA
- * @st: scatter gather table for DMA mappings with IOMMU enabled
- * @pinned_pages: The set of pinned_pages backing this window
- * @alloc_handle: Handle for sending ALLOC_REQ
- * @regwq: Wait Queue for an registration (N)ACK
- * @reg_state: Registration state
- * @unregwq: Wait Queue for an unregistration (N)ACK
- * @dma_addr_lookup: Lookup for physical addresses used for DMA
- * @nr_lookup: Number of entries in lookup
- * @mapped_offset: Offset used to map the window by the peer
- * @dma_addr: Array of physical addresses used for Mgmt node & MIC initiated DMA
- * @num_pages: Array specifying number of pages for each physical address
- */
-struct scif_window {
-       s64 nr_pages;
-       int nr_contig_chunks;
-       int prot;
-       int ref_count;
-       u64 magic;
-       s64 offset;
-       unsigned long va_for_temp;
-       int dma_mark;
-       u64 ep;
-       struct list_head list;
-       enum scif_window_type type;
-       u64 peer_window;
-       enum scif_msg_state unreg_state;
-       bool offset_freed;
-       bool temp;
-       struct mm_struct *mm;
-       struct sg_table *st;
-       union {
-               struct {
-                       struct scif_pinned_pages *pinned_pages;
-                       struct scif_allocmsg alloc_handle;
-                       wait_queue_head_t regwq;
-                       enum scif_msg_state reg_state;
-                       wait_queue_head_t unregwq;
-               };
-               struct {
-                       struct scif_rma_lookup dma_addr_lookup;
-                       struct scif_rma_lookup num_pages_lookup;
-                       int nr_lookup;
-                       dma_addr_t mapped_offset;
-               };
-       };
-       dma_addr_t *dma_addr;
-       u64 *num_pages;
-} __packed;
-
-/*
- * scif_mmu_notif - SCIF mmu notifier information
- *
- * @mmu_notifier ep_mmu_notifier: MMU notifier operations
- * @tc_reg_list: List of temp registration windows for self
- * @mm: memory descriptor for the task_struct which initiated the RMA
- * @ep: SCIF endpoint
- * @list: link to list of MMU notifier information
- */
-struct scif_mmu_notif {
-#ifdef CONFIG_MMU_NOTIFIER
-       struct mmu_notifier ep_mmu_notifier;
-#endif
-       struct list_head tc_reg_list;
-       struct mm_struct *mm;
-       struct scif_endpt *ep;
-       struct list_head list;
-};
-
-enum scif_rma_dir {
-       SCIF_LOCAL_TO_REMOTE,
-       SCIF_REMOTE_TO_LOCAL
-};
-
-extern struct kmem_cache *unaligned_cache;
-/* Initialize RMA for this EP */
-void scif_rma_ep_init(struct scif_endpt *ep);
-/* Check if epd can be uninitialized */
-int scif_rma_ep_can_uninit(struct scif_endpt *ep);
-/* Obtain a new offset. Callee must grab RMA lock */
-int scif_get_window_offset(struct scif_endpt *ep, int flags,
-                          s64 offset, int nr_pages, s64 *out_offset);
-/* Free offset. Callee must grab RMA lock */
-void scif_free_window_offset(struct scif_endpt *ep,
-                            struct scif_window *window, s64 offset);
-/* Create self registration window */
-struct scif_window *scif_create_window(struct scif_endpt *ep, int nr_pages,
-                                      s64 offset, bool temp);
-/* Destroy self registration window.*/
-int scif_destroy_window(struct scif_endpt *ep, struct scif_window *window);
-void scif_unmap_window(struct scif_dev *remote_dev, struct scif_window *window);
-/* Map pages of self window to Aperture/PCI */
-int scif_map_window(struct scif_dev *remote_dev,
-                   struct scif_window *window);
-/* Unregister a self window */
-int scif_unregister_window(struct scif_window *window);
-/* Destroy remote registration window */
-void
-scif_destroy_remote_window(struct scif_window *window);
-/* remove valid remote memory mappings from process address space */
-void scif_zap_mmaps(int node);
-/* Query if any applications have remote memory mappings */
-bool scif_rma_do_apps_have_mmaps(int node);
-/* Cleanup remote registration lists for zombie endpoints */
-void scif_cleanup_rma_for_zombies(int node);
-/* Reserve a DMA channel for a particular endpoint */
-int scif_reserve_dma_chan(struct scif_endpt *ep);
-/* Setup a DMA mark for an endpoint */
-int _scif_fence_mark(scif_epd_t epd, int *mark);
-int scif_prog_signal(scif_epd_t epd, off_t offset, u64 val,
-                    enum scif_window_type type);
-void scif_alloc_req(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_alloc_gnt_rej(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_free_virt(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_reg(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_unreg(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_reg_ack(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_reg_nack(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_unreg_ack(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_unreg_nack(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_munmap(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_mark(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_mark_resp(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_wait(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_wait_resp(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_sig_local(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_sig_remote(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_recv_sig_resp(struct scif_dev *scifdev, struct scifmsg *msg);
-void scif_mmu_notif_handler(struct work_struct *work);
-void scif_rma_handle_remote_fences(void);
-void scif_rma_destroy_windows(void);
-void scif_rma_destroy_tcw_invalid(void);
-int scif_drain_dma_intr(struct scif_hw_dev *sdev, struct dma_chan *chan);
-
-struct scif_window_iter {
-       s64 offset;
-       int index;
-};
-
-static inline void
-scif_init_window_iter(struct scif_window *window, struct scif_window_iter *iter)
-{
-       iter->offset = window->offset;
-       iter->index = 0;
-}
-
-dma_addr_t scif_off_to_dma_addr(struct scif_window *window, s64 off,
-                               size_t *nr_bytes,
-                               struct scif_window_iter *iter);
-static inline
-dma_addr_t __scif_off_to_dma_addr(struct scif_window *window, s64 off)
-{
-       return scif_off_to_dma_addr(window, off, NULL, NULL);
-}
-
-static inline bool scif_unaligned(off_t src_offset, off_t dst_offset)
-{
-       src_offset = src_offset & (L1_CACHE_BYTES - 1);
-       dst_offset = dst_offset & (L1_CACHE_BYTES - 1);
-       return !(src_offset == dst_offset);
-}
-
-/*
- * scif_zalloc:
- * @size: Size of the allocation request.
- *
- * Helper API which attempts to allocate zeroed pages via
- * __get_free_pages(..) first and then falls back on
- * vzalloc(..) if that fails.
- */
-static inline void *scif_zalloc(size_t size)
-{
-       void *ret = NULL;
-       size_t align = ALIGN(size, PAGE_SIZE);
-
-       if (align && get_order(align) < MAX_ORDER)
-               ret = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
-                                              get_order(align));
-       return ret ? ret : vzalloc(align);
-}
-
-/*
- * scif_free:
- * @addr: Address to be freed.
- * @size: Size of the allocation.
- * Helper API which frees memory allocated via scif_zalloc().
- */
-static inline void scif_free(void *addr, size_t size)
-{
-       size_t align = ALIGN(size, PAGE_SIZE);
-
-       if (is_vmalloc_addr(addr))
-               vfree(addr);
-       else
-               free_pages((unsigned long)addr, get_order(align));
-}
-
-static inline void scif_get_window(struct scif_window *window, int nr_pages)
-{
-       window->ref_count += nr_pages;
-}
-
-static inline void scif_put_window(struct scif_window *window, int nr_pages)
-{
-       window->ref_count -= nr_pages;
-}
-
-static inline void scif_set_window_ref(struct scif_window *window, int nr_pages)
-{
-       window->ref_count = nr_pages;
-}
-
-static inline void
-scif_queue_for_cleanup(struct scif_window *window, struct list_head *list)
-{
-       spin_lock(&scif_info.rmalock);
-       list_add_tail(&window->list, list);
-       spin_unlock(&scif_info.rmalock);
-       schedule_work(&scif_info.misc_work);
-}
-
-static inline void __scif_rma_destroy_tcw_helper(struct scif_window *window)
-{
-       list_del_init(&window->list);
-       scif_queue_for_cleanup(window, &scif_info.rma_tc);
-}
-
-static inline bool scif_is_iommu_enabled(void)
-{
-#ifdef CONFIG_INTEL_IOMMU
-       return intel_iommu_enabled;
-#else
-       return false;
-#endif
-}
-#endif /* SCIF_RMA_H */
diff --git a/drivers/misc/mic/scif/scif_rma_list.c b/drivers/misc/mic/scif/scif_rma_list.c
deleted file mode 100644 (file)
index ef923ba..0000000
+++ /dev/null
@@ -1,282 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#include "scif_main.h"
-#include <linux/mmu_notifier.h>
-#include <linux/highmem.h>
-
-/*
- * scif_insert_tcw:
- *
- * Insert a temp window to the temp registration list sorted by va_for_temp.
- * RMA lock must be held.
- */
-void scif_insert_tcw(struct scif_window *window, struct list_head *head)
-{
-       struct scif_window *curr = NULL;
-       struct scif_window *prev = list_entry(head, struct scif_window, list);
-       struct list_head *item;
-
-       INIT_LIST_HEAD(&window->list);
-       /* Compare with tail and if the entry is new tail add it to the end */
-       if (!list_empty(head)) {
-               curr = list_entry(head->prev, struct scif_window, list);
-               if (curr->va_for_temp < window->va_for_temp) {
-                       list_add_tail(&window->list, head);
-                       return;
-               }
-       }
-       list_for_each(item, head) {
-               curr = list_entry(item, struct scif_window, list);
-               if (curr->va_for_temp > window->va_for_temp)
-                       break;
-               prev = curr;
-       }
-       list_add(&window->list, &prev->list);
-}
-
-/*
- * scif_insert_window:
- *
- * Insert a window to the self registration list sorted by offset.
- * RMA lock must be held.
- */
-void scif_insert_window(struct scif_window *window, struct list_head *head)
-{
-       struct scif_window *curr = NULL, *prev = NULL;
-       struct list_head *item;
-
-       INIT_LIST_HEAD(&window->list);
-       list_for_each(item, head) {
-               curr = list_entry(item, struct scif_window, list);
-               if (curr->offset > window->offset)
-                       break;
-               prev = curr;
-       }
-       if (!prev)
-               list_add(&window->list, head);
-       else
-               list_add(&window->list, &prev->list);
-       scif_set_window_ref(window, window->nr_pages);
-}
-
-/*
- * scif_query_tcw:
- *
- * Query the temp cached registration list of ep for an overlapping window
- * in case of permission mismatch, destroy the previous window. if permissions
- * match and overlap is partial, destroy the window but return the new range
- * RMA lock must be held.
- */
-int scif_query_tcw(struct scif_endpt *ep, struct scif_rma_req *req)
-{
-       struct list_head *item, *temp, *head = req->head;
-       struct scif_window *window;
-       u64 start_va_window, start_va_req = req->va_for_temp;
-       u64 end_va_window, end_va_req = start_va_req + req->nr_bytes;
-
-       if (!req->nr_bytes)
-               return -EINVAL;
-       /*
-        * Avoid traversing the entire list to find out that there
-        * is no entry that matches
-        */
-       if (!list_empty(head)) {
-               window = list_last_entry(head, struct scif_window, list);
-               end_va_window = window->va_for_temp +
-                       (window->nr_pages << PAGE_SHIFT);
-               if (start_va_req > end_va_window)
-                       return -ENXIO;
-       }
-       list_for_each_safe(item, temp, head) {
-               window = list_entry(item, struct scif_window, list);
-               start_va_window = window->va_for_temp;
-               end_va_window = window->va_for_temp +
-                       (window->nr_pages << PAGE_SHIFT);
-               if (start_va_req < start_va_window &&
-                   end_va_req < start_va_window)
-                       break;
-               if (start_va_req >= end_va_window)
-                       continue;
-               if ((window->prot & req->prot) == req->prot) {
-                       if (start_va_req >= start_va_window &&
-                           end_va_req <= end_va_window) {
-                               *req->out_window = window;
-                               return 0;
-                       }
-                       /* expand window */
-                       if (start_va_req < start_va_window) {
-                               req->nr_bytes +=
-                                       start_va_window - start_va_req;
-                               req->va_for_temp = start_va_window;
-                       }
-                       if (end_va_req >= end_va_window)
-                               req->nr_bytes += end_va_window - end_va_req;
-               }
-               /* Destroy the old window to create a new one */
-               __scif_rma_destroy_tcw_helper(window);
-               break;
-       }
-       return -ENXIO;
-}
-
-/*
- * scif_query_window:
- *
- * Query the registration list and check if a valid contiguous
- * range of windows exist.
- * RMA lock must be held.
- */
-int scif_query_window(struct scif_rma_req *req)
-{
-       struct list_head *item;
-       struct scif_window *window;
-       s64 end_offset, offset = req->offset;
-       u64 tmp_min, nr_bytes_left = req->nr_bytes;
-
-       if (!req->nr_bytes)
-               return -EINVAL;
-
-       list_for_each(item, req->head) {
-               window = list_entry(item, struct scif_window, list);
-               end_offset = window->offset +
-                       (window->nr_pages << PAGE_SHIFT);
-               if (offset < window->offset)
-                       /* Offset not found! */
-                       return -ENXIO;
-               if (offset >= end_offset)
-                       continue;
-               /* Check read/write protections. */
-               if ((window->prot & req->prot) != req->prot)
-                       return -EPERM;
-               if (nr_bytes_left == req->nr_bytes)
-                       /* Store the first window */
-                       *req->out_window = window;
-               tmp_min = min((u64)end_offset - offset, nr_bytes_left);
-               nr_bytes_left -= tmp_min;
-               offset += tmp_min;
-               /*
-                * Range requested encompasses
-                * multiple windows contiguously.
-                */
-               if (!nr_bytes_left) {
-                       /* Done for partial window */
-                       if (req->type == SCIF_WINDOW_PARTIAL ||
-                           req->type == SCIF_WINDOW_SINGLE)
-                               return 0;
-                       /* Extra logic for full windows */
-                       if (offset == end_offset)
-                               /* Spanning multiple whole windows */
-                               return 0;
-                               /* Not spanning multiple whole windows */
-                       return -ENXIO;
-               }
-               if (req->type == SCIF_WINDOW_SINGLE)
-                       break;
-       }
-       dev_err(scif_info.mdev.this_device,
-               "%s %d ENXIO\n", __func__, __LINE__);
-       return -ENXIO;
-}
-
-/*
- * scif_rma_list_unregister:
- *
- * Traverse the self registration list starting from window:
- * 1) Call scif_unregister_window(..)
- * RMA lock must be held.
- */
-int scif_rma_list_unregister(struct scif_window *window,
-                            s64 offset, int nr_pages)
-{
-       struct scif_endpt *ep = (struct scif_endpt *)window->ep;
-       struct list_head *head = &ep->rma_info.reg_list;
-       s64 end_offset;
-       int err = 0;
-       int loop_nr_pages;
-       struct scif_window *_window;
-
-       list_for_each_entry_safe_from(window, _window, head, list) {
-               end_offset = window->offset + (window->nr_pages << PAGE_SHIFT);
-               loop_nr_pages = min((int)((end_offset - offset) >> PAGE_SHIFT),
-                                   nr_pages);
-               err = scif_unregister_window(window);
-               if (err)
-                       return err;
-               nr_pages -= loop_nr_pages;
-               offset += (loop_nr_pages << PAGE_SHIFT);
-               if (!nr_pages)
-                       break;
-       }
-       return 0;
-}
-
-/*
- * scif_unmap_all_window:
- *
- * Traverse all the windows in the self registration list and:
- * 1) Delete any DMA mappings created
- */
-void scif_unmap_all_windows(scif_epd_t epd)
-{
-       struct list_head *item, *tmp;
-       struct scif_window *window;
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       struct list_head *head = &ep->rma_info.reg_list;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-       list_for_each_safe(item, tmp, head) {
-               window = list_entry(item, struct scif_window, list);
-               scif_unmap_window(ep->remote_dev, window);
-       }
-       mutex_unlock(&ep->rma_info.rma_lock);
-}
-
-/*
- * scif_unregister_all_window:
- *
- * Traverse all the windows in the self registration list and:
- * 1) Call scif_unregister_window(..)
- * RMA lock must be held.
- */
-int scif_unregister_all_windows(scif_epd_t epd)
-{
-       struct list_head *item, *tmp;
-       struct scif_window *window;
-       struct scif_endpt *ep = (struct scif_endpt *)epd;
-       struct list_head *head = &ep->rma_info.reg_list;
-       int err = 0;
-
-       mutex_lock(&ep->rma_info.rma_lock);
-retry:
-       item = NULL;
-       tmp = NULL;
-       list_for_each_safe(item, tmp, head) {
-               window = list_entry(item, struct scif_window, list);
-               ep->rma_info.async_list_del = 0;
-               err = scif_unregister_window(window);
-               if (err)
-                       dev_err(scif_info.mdev.this_device,
-                               "%s %d err %d\n",
-                               __func__, __LINE__, err);
-               /*
-                * Need to restart list traversal if there has been
-                * an asynchronous list entry deletion.
-                */
-               if (READ_ONCE(ep->rma_info.async_list_del))
-                       goto retry;
-       }
-       mutex_unlock(&ep->rma_info.rma_lock);
-       if (!list_empty(&ep->rma_info.mmn_list)) {
-               spin_lock(&scif_info.rmalock);
-               list_add_tail(&ep->mmu_list, &scif_info.mmu_notif_cleanup);
-               spin_unlock(&scif_info.rmalock);
-               schedule_work(&scif_info.mmu_notif_work);
-       }
-       return err;
-}
diff --git a/drivers/misc/mic/scif/scif_rma_list.h b/drivers/misc/mic/scif/scif_rma_list.h
deleted file mode 100644 (file)
index 0f8e0ed..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2015 Intel Corporation.
- *
- * Intel SCIF driver.
- */
-#ifndef SCIF_RMA_LIST_H
-#define SCIF_RMA_LIST_H
-
-/*
- * struct scif_rma_req - Self Registration list RMA Request query
- *
- * @out_window - Returns the window if found
- * @offset: Starting offset
- * @nr_bytes: number of bytes
- * @prot: protection requested i.e. read or write or both
- * @type: Specify single, partial or multiple windows
- * @head: Head of list on which to search
- * @va_for_temp: VA for searching temporary cached windows
- */
-struct scif_rma_req {
-       struct scif_window **out_window;
-       union {
-               s64 offset;
-               unsigned long va_for_temp;
-       };
-       size_t nr_bytes;
-       int prot;
-       enum scif_window_type type;
-       struct list_head *head;
-};
-
-/* Insert */
-void scif_insert_window(struct scif_window *window, struct list_head *head);
-void scif_insert_tcw(struct scif_window *window,
-                    struct list_head *head);
-/* Query */
-int scif_query_window(struct scif_rma_req *request);
-int scif_query_tcw(struct scif_endpt *ep, struct scif_rma_req *request);
-/* Called from close to unregister all self windows */
-int scif_unregister_all_windows(scif_epd_t epd);
-void scif_unmap_all_windows(scif_epd_t epd);
-/* Traverse list and unregister */
-int scif_rma_list_unregister(struct scif_window *window, s64 offset,
-                            int nr_pages);
-#endif /* SCIF_RMA_LIST_H */
diff --git a/drivers/misc/mic/vop/Makefile b/drivers/misc/mic/vop/Makefile
deleted file mode 100644 (file)
index 51b9b00..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile - Intel MIC Linux driver.
-# Copyright(c) 2016, Intel Corporation.
-#
-obj-$(CONFIG_VOP) := vop.o
-
-vop-objs += vop_main.o
-vop-objs += vop_debugfs.o
-vop-objs += vop_vringh.o
diff --git a/drivers/misc/mic/vop/vop_debugfs.c b/drivers/misc/mic/vop/vop_debugfs.c
deleted file mode 100644 (file)
index 9d4f175..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2016 Intel Corporation.
- *
- * Intel Virtio Over PCIe (VOP) driver.
- */
-#include <linux/debugfs.h>
-#include <linux/seq_file.h>
-
-#include "vop_main.h"
-
-static int vop_dp_show(struct seq_file *s, void *pos)
-{
-       struct mic_device_desc *d;
-       struct mic_device_ctrl *dc;
-       struct mic_vqconfig *vqconfig;
-       __u32 *features;
-       __u8 *config;
-       struct vop_info *vi = s->private;
-       struct vop_device *vpdev = vi->vpdev;
-       struct mic_bootparam *bootparam = vpdev->hw_ops->get_dp(vpdev);
-       int j, k;
-
-       seq_printf(s, "Bootparam: magic 0x%x\n",
-                  bootparam->magic);
-       seq_printf(s, "Bootparam: h2c_config_db %d\n",
-                  bootparam->h2c_config_db);
-       seq_printf(s, "Bootparam: node_id %d\n",
-                  bootparam->node_id);
-       seq_printf(s, "Bootparam: c2h_scif_db %d\n",
-                  bootparam->c2h_scif_db);
-       seq_printf(s, "Bootparam: h2c_scif_db %d\n",
-                  bootparam->h2c_scif_db);
-       seq_printf(s, "Bootparam: scif_host_dma_addr 0x%llx\n",
-                  bootparam->scif_host_dma_addr);
-       seq_printf(s, "Bootparam: scif_card_dma_addr 0x%llx\n",
-                  bootparam->scif_card_dma_addr);
-
-       for (j = sizeof(*bootparam);
-               j < MIC_DP_SIZE; j += mic_total_desc_size(d)) {
-               d = (void *)bootparam + j;
-               dc = (void *)d + mic_aligned_desc_size(d);
-
-               /* end of list */
-               if (d->type == 0)
-                       break;
-
-               if (d->type == -1)
-                       continue;
-
-               seq_printf(s, "Type %d ", d->type);
-               seq_printf(s, "Num VQ %d ", d->num_vq);
-               seq_printf(s, "Feature Len %d\n", d->feature_len);
-               seq_printf(s, "Config Len %d ", d->config_len);
-               seq_printf(s, "Shutdown Status %d\n", d->status);
-
-               for (k = 0; k < d->num_vq; k++) {
-                       vqconfig = mic_vq_config(d) + k;
-                       seq_printf(s, "vqconfig[%d]: ", k);
-                       seq_printf(s, "address 0x%llx ",
-                                  vqconfig->address);
-                       seq_printf(s, "num %d ", vqconfig->num);
-                       seq_printf(s, "used address 0x%llx\n",
-                                  vqconfig->used_address);
-               }
-
-               features = (__u32 *)mic_vq_features(d);
-               seq_printf(s, "Features: Host 0x%x ", features[0]);
-               seq_printf(s, "Guest 0x%x\n", features[1]);
-
-               config = mic_vq_configspace(d);
-               for (k = 0; k < d->config_len; k++)
-                       seq_printf(s, "config[%d]=%d\n", k, config[k]);
-
-               seq_puts(s, "Device control:\n");
-               seq_printf(s, "Config Change %d ", dc->config_change);
-               seq_printf(s, "Vdev reset %d\n", dc->vdev_reset);
-               seq_printf(s, "Guest Ack %d ", dc->guest_ack);
-               seq_printf(s, "Host ack %d\n", dc->host_ack);
-               seq_printf(s, "Used address updated %d ",
-                          dc->used_address_updated);
-               seq_printf(s, "Vdev 0x%llx\n", dc->vdev);
-               seq_printf(s, "c2h doorbell %d ", dc->c2h_vdev_db);
-               seq_printf(s, "h2c doorbell %d\n", dc->h2c_vdev_db);
-       }
-       schedule_work(&vi->hotplug_work);
-       return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(vop_dp);
-
-static int vop_vdev_info_show(struct seq_file *s, void *unused)
-{
-       struct vop_info *vi = s->private;
-       struct list_head *pos, *tmp;
-       struct vop_vdev *vdev;
-       int i, j;
-
-       mutex_lock(&vi->vop_mutex);
-       list_for_each_safe(pos, tmp, &vi->vdev_list) {
-               vdev = list_entry(pos, struct vop_vdev, list);
-               seq_printf(s, "VDEV type %d state %s in %ld out %ld in_dma %ld out_dma %ld\n",
-                          vdev->virtio_id,
-                          vop_vdevup(vdev) ? "UP" : "DOWN",
-                          vdev->in_bytes,
-                          vdev->out_bytes,
-                          vdev->in_bytes_dma,
-                          vdev->out_bytes_dma);
-               for (i = 0; i < MIC_MAX_VRINGS; i++) {
-                       struct vring_desc *desc;
-                       struct vring_avail *avail;
-                       struct vring_used *used;
-                       struct vop_vringh *vvr = &vdev->vvr[i];
-                       struct vringh *vrh = &vvr->vrh;
-                       int num = vrh->vring.num;
-
-                       if (!num)
-                               continue;
-                       desc = vrh->vring.desc;
-                       seq_printf(s, "vring i %d avail_idx %d",
-                                  i, vvr->vring.info->avail_idx & (num - 1));
-                       seq_printf(s, " vring i %d avail_idx %d\n",
-                                  i, vvr->vring.info->avail_idx);
-                       seq_printf(s, "vrh i %d weak_barriers %d",
-                                  i, vrh->weak_barriers);
-                       seq_printf(s, " last_avail_idx %d last_used_idx %d",
-                                  vrh->last_avail_idx, vrh->last_used_idx);
-                       seq_printf(s, " completed %d\n", vrh->completed);
-                       for (j = 0; j < num; j++) {
-                               seq_printf(s, "desc[%d] addr 0x%llx len %d",
-                                          j, desc->addr, desc->len);
-                               seq_printf(s, " flags 0x%x next %d\n",
-                                          desc->flags, desc->next);
-                               desc++;
-                       }
-                       avail = vrh->vring.avail;
-                       seq_printf(s, "avail flags 0x%x idx %d\n",
-                                  vringh16_to_cpu(vrh, avail->flags),
-                                  vringh16_to_cpu(vrh,
-                                                  avail->idx) & (num - 1));
-                       seq_printf(s, "avail flags 0x%x idx %d\n",
-                                  vringh16_to_cpu(vrh, avail->flags),
-                                  vringh16_to_cpu(vrh, avail->idx));
-                       for (j = 0; j < num; j++)
-                               seq_printf(s, "avail ring[%d] %d\n",
-                                          j, avail->ring[j]);
-                       used = vrh->vring.used;
-                       seq_printf(s, "used flags 0x%x idx %d\n",
-                                  vringh16_to_cpu(vrh, used->flags),
-                                  vringh16_to_cpu(vrh, used->idx) & (num - 1));
-                       seq_printf(s, "used flags 0x%x idx %d\n",
-                                  vringh16_to_cpu(vrh, used->flags),
-                                  vringh16_to_cpu(vrh, used->idx));
-                       for (j = 0; j < num; j++)
-                               seq_printf(s, "used ring[%d] id %d len %d\n",
-                                          j, vringh32_to_cpu(vrh,
-                                                             used->ring[j].id),
-                                          vringh32_to_cpu(vrh,
-                                                          used->ring[j].len));
-               }
-       }
-       mutex_unlock(&vi->vop_mutex);
-
-       return 0;
-}
-
-DEFINE_SHOW_ATTRIBUTE(vop_vdev_info);
-
-void vop_init_debugfs(struct vop_info *vi)
-{
-       char name[16];
-
-       snprintf(name, sizeof(name), "%s%d", KBUILD_MODNAME, vi->vpdev->dnode);
-       vi->dbg = debugfs_create_dir(name, NULL);
-       debugfs_create_file("dp", 0444, vi->dbg, vi, &vop_dp_fops);
-       debugfs_create_file("vdev_info", 0444, vi->dbg, vi, &vop_vdev_info_fops);
-}
-
-void vop_exit_debugfs(struct vop_info *vi)
-{
-       debugfs_remove_recursive(vi->dbg);
-}
diff --git a/drivers/misc/mic/vop/vop_main.c b/drivers/misc/mic/vop/vop_main.c
deleted file mode 100644 (file)
index 714b94f..0000000
+++ /dev/null
@@ -1,784 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2016 Intel Corporation.
- *
- * Adapted from:
- *
- * virtio for kvm on s390
- *
- * Copyright IBM Corp. 2008
- *
- *    Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
- *
- * Intel Virtio Over PCIe (VOP) driver.
- */
-#include <linux/delay.h>
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/dma-mapping.h>
-#include <linux/io-64-nonatomic-lo-hi.h>
-
-#include "vop_main.h"
-
-#define VOP_MAX_VRINGS 4
-
-/*
- * _vop_vdev - Allocated per virtio device instance injected by the peer.
- *
- * @vdev: Virtio device
- * @desc: Virtio device page descriptor
- * @dc: Virtio device control
- * @vpdev: VOP device which is the parent for this virtio device
- * @vr: Buffer for accessing the VRING
- * @used_virt: Virtual address of used ring
- * @used: DMA address of used ring
- * @used_size: Size of the used buffer
- * @reset_done: Track whether VOP reset is complete
- * @virtio_cookie: Cookie returned upon requesting a interrupt
- * @c2h_vdev_db: The doorbell used by the guest to interrupt the host
- * @h2c_vdev_db: The doorbell used by the host to interrupt the guest
- * @dnode: The destination node
- */
-struct _vop_vdev {
-       struct virtio_device vdev;
-       struct mic_device_desc __iomem *desc;
-       struct mic_device_ctrl __iomem *dc;
-       struct vop_device *vpdev;
-       void __iomem *vr[VOP_MAX_VRINGS];
-       void *used_virt[VOP_MAX_VRINGS];
-       dma_addr_t used[VOP_MAX_VRINGS];
-       int used_size[VOP_MAX_VRINGS];
-       struct completion reset_done;
-       struct mic_irq *virtio_cookie;
-       int c2h_vdev_db;
-       int h2c_vdev_db;
-       int dnode;
-};
-
-#define to_vopvdev(vd) container_of(vd, struct _vop_vdev, vdev)
-
-#define _vop_aligned_desc_size(d) __mic_align(_vop_desc_size(d), 8)
-
-/* Helper API to obtain the parent of the virtio device */
-static inline struct device *_vop_dev(struct _vop_vdev *vdev)
-{
-       return vdev->vdev.dev.parent;
-}
-
-static inline unsigned _vop_desc_size(struct mic_device_desc __iomem *desc)
-{
-       return sizeof(*desc)
-               + ioread8(&desc->num_vq) * sizeof(struct mic_vqconfig)
-               + ioread8(&desc->feature_len) * 2
-               + ioread8(&desc->config_len);
-}
-
-static inline struct mic_vqconfig __iomem *
-_vop_vq_config(struct mic_device_desc __iomem *desc)
-{
-       return (struct mic_vqconfig __iomem *)(desc + 1);
-}
-
-static inline u8 __iomem *
-_vop_vq_features(struct mic_device_desc __iomem *desc)
-{
-       return (u8 __iomem *)(_vop_vq_config(desc) + ioread8(&desc->num_vq));
-}
-
-static inline u8 __iomem *
-_vop_vq_configspace(struct mic_device_desc __iomem *desc)
-{
-       return _vop_vq_features(desc) + ioread8(&desc->feature_len) * 2;
-}
-
-static inline unsigned
-_vop_total_desc_size(struct mic_device_desc __iomem *desc)
-{
-       return _vop_aligned_desc_size(desc) + sizeof(struct mic_device_ctrl);
-}
-
-/* This gets the device's feature bits. */
-static u64 vop_get_features(struct virtio_device *vdev)
-{
-       unsigned int i, bits;
-       u64 features = 0;
-       struct mic_device_desc __iomem *desc = to_vopvdev(vdev)->desc;
-       u8 __iomem *in_features = _vop_vq_features(desc);
-       int feature_len = ioread8(&desc->feature_len);
-
-       bits = min_t(unsigned, feature_len, sizeof(vdev->features)) * 8;
-       for (i = 0; i < bits; i++)
-               if (ioread8(&in_features[i / 8]) & (BIT(i % 8)))
-                       features |= BIT_ULL(i);
-
-       return features;
-}
-
-static void vop_transport_features(struct virtio_device *vdev)
-{
-       /*
-        * Packed ring isn't enabled on virtio_vop for now,
-        * because virtio_vop uses vring_new_virtqueue() which
-        * creates virtio rings on preallocated memory.
-        */
-       __virtio_clear_bit(vdev, VIRTIO_F_RING_PACKED);
-       __virtio_set_bit(vdev, VIRTIO_F_ACCESS_PLATFORM);
-}
-
-static int vop_finalize_features(struct virtio_device *vdev)
-{
-       unsigned int i, bits;
-       struct mic_device_desc __iomem *desc = to_vopvdev(vdev)->desc;
-       u8 feature_len = ioread8(&desc->feature_len);
-       /* Second half of bitmap is features we accept. */
-       u8 __iomem *out_features =
-               _vop_vq_features(desc) + feature_len;
-
-       /* Give virtio_ring a chance to accept features. */
-       vring_transport_features(vdev);
-
-       /* Give virtio_vop a chance to accept features. */
-       vop_transport_features(vdev);
-
-       memset_io(out_features, 0, feature_len);
-       bits = min_t(unsigned, feature_len,
-                    sizeof(vdev->features)) * 8;
-       for (i = 0; i < bits; i++) {
-               if (__virtio_test_bit(vdev, i))
-                       iowrite8(ioread8(&out_features[i / 8]) | (1 << (i % 8)),
-                                &out_features[i / 8]);
-       }
-       return 0;
-}
-
-/*
- * Reading and writing elements in config space
- */
-static void vop_get(struct virtio_device *vdev, unsigned int offset,
-                   void *buf, unsigned len)
-{
-       struct mic_device_desc __iomem *desc = to_vopvdev(vdev)->desc;
-
-       if (offset + len > ioread8(&desc->config_len))
-               return;
-       memcpy_fromio(buf, _vop_vq_configspace(desc) + offset, len);
-}
-
-static void vop_set(struct virtio_device *vdev, unsigned int offset,
-                   const void *buf, unsigned len)
-{
-       struct mic_device_desc __iomem *desc = to_vopvdev(vdev)->desc;
-
-       if (offset + len > ioread8(&desc->config_len))
-               return;
-       memcpy_toio(_vop_vq_configspace(desc) + offset, buf, len);
-}
-
-/*
- * The operations to get and set the status word just access the status
- * field of the device descriptor. set_status also interrupts the host
- * to tell about status changes.
- */
-static u8 vop_get_status(struct virtio_device *vdev)
-{
-       return ioread8(&to_vopvdev(vdev)->desc->status);
-}
-
-static void vop_set_status(struct virtio_device *dev, u8 status)
-{
-       struct _vop_vdev *vdev = to_vopvdev(dev);
-       struct vop_device *vpdev = vdev->vpdev;
-
-       if (!status)
-               return;
-       iowrite8(status, &vdev->desc->status);
-       vpdev->hw_ops->send_intr(vpdev, vdev->c2h_vdev_db);
-}
-
-/* Inform host on a virtio device reset and wait for ack from host */
-static void vop_reset_inform_host(struct virtio_device *dev)
-{
-       struct _vop_vdev *vdev = to_vopvdev(dev);
-       struct mic_device_ctrl __iomem *dc = vdev->dc;
-       struct vop_device *vpdev = vdev->vpdev;
-       int retry;
-
-       iowrite8(0, &dc->host_ack);
-       iowrite8(1, &dc->vdev_reset);
-       vpdev->hw_ops->send_intr(vpdev, vdev->c2h_vdev_db);
-
-       /* Wait till host completes all card accesses and acks the reset */
-       for (retry = 100; retry--;) {
-               if (ioread8(&dc->host_ack))
-                       break;
-               msleep(100);
-       }
-
-       dev_dbg(_vop_dev(vdev), "%s: retry: %d\n", __func__, retry);
-
-       /* Reset status to 0 in case we timed out */
-       iowrite8(0, &vdev->desc->status);
-}
-
-static void vop_reset(struct virtio_device *dev)
-{
-       struct _vop_vdev *vdev = to_vopvdev(dev);
-
-       dev_dbg(_vop_dev(vdev), "%s: virtio id %d\n",
-               __func__, dev->id.device);
-
-       vop_reset_inform_host(dev);
-       complete_all(&vdev->reset_done);
-}
-
-/*
- * The virtio_ring code calls this API when it wants to notify the Host.
- */
-static bool vop_notify(struct virtqueue *vq)
-{
-       struct _vop_vdev *vdev = vq->priv;
-       struct vop_device *vpdev = vdev->vpdev;
-
-       vpdev->hw_ops->send_intr(vpdev, vdev->c2h_vdev_db);
-       return true;
-}
-
-static void vop_del_vq(struct virtqueue *vq, int n)
-{
-       struct _vop_vdev *vdev = to_vopvdev(vq->vdev);
-       struct vop_device *vpdev = vdev->vpdev;
-
-       dma_unmap_single(&vpdev->dev, vdev->used[n],
-                        vdev->used_size[n], DMA_BIDIRECTIONAL);
-       free_pages((unsigned long)vdev->used_virt[n],
-                  get_order(vdev->used_size[n]));
-       vring_del_virtqueue(vq);
-       vpdev->hw_ops->unmap(vpdev, vdev->vr[n]);
-       vdev->vr[n] = NULL;
-}
-
-static void vop_del_vqs(struct virtio_device *dev)
-{
-       struct _vop_vdev *vdev = to_vopvdev(dev);
-       struct virtqueue *vq, *n;
-       int idx = 0;
-
-       dev_dbg(_vop_dev(vdev), "%s\n", __func__);
-
-       list_for_each_entry_safe(vq, n, &dev->vqs, list)
-               vop_del_vq(vq, idx++);
-}
-
-static struct virtqueue *vop_new_virtqueue(unsigned int index,
-                                     unsigned int num,
-                                     struct virtio_device *vdev,
-                                     bool context,
-                                     void *pages,
-                                     bool (*notify)(struct virtqueue *vq),
-                                     void (*callback)(struct virtqueue *vq),
-                                     const char *name,
-                                     void *used)
-{
-       bool weak_barriers = false;
-       struct vring vring;
-
-       vring_init(&vring, num, pages, MIC_VIRTIO_RING_ALIGN);
-       vring.used = used;
-
-       return __vring_new_virtqueue(index, vring, vdev, weak_barriers, context,
-                                    notify, callback, name);
-}
-
-/*
- * This routine will assign vring's allocated in host/io memory. Code in
- * virtio_ring.c however continues to access this io memory as if it were local
- * memory without io accessors.
- */
-static struct virtqueue *vop_find_vq(struct virtio_device *dev,
-                                    unsigned index,
-                                    void (*callback)(struct virtqueue *vq),
-                                    const char *name, bool ctx)
-{
-       struct _vop_vdev *vdev = to_vopvdev(dev);
-       struct vop_device *vpdev = vdev->vpdev;
-       struct mic_vqconfig __iomem *vqconfig;
-       struct mic_vqconfig config;
-       struct virtqueue *vq;
-       void __iomem *va;
-       struct _mic_vring_info __iomem *info;
-       void *used;
-       int vr_size, _vr_size, err, magic;
-       u8 type = ioread8(&vdev->desc->type);
-
-       if (index >= ioread8(&vdev->desc->num_vq))
-               return ERR_PTR(-ENOENT);
-
-       if (!name)
-               return ERR_PTR(-ENOENT);
-
-       /* First assign the vring's allocated in host memory */
-       vqconfig = _vop_vq_config(vdev->desc) + index;
-       memcpy_fromio(&config, vqconfig, sizeof(config));
-       _vr_size = round_up(vring_size(le16_to_cpu(config.num), MIC_VIRTIO_RING_ALIGN), 4);
-       vr_size = PAGE_ALIGN(_vr_size + sizeof(struct _mic_vring_info));
-       va = vpdev->hw_ops->remap(vpdev, le64_to_cpu(config.address), vr_size);
-       if (!va)
-               return ERR_PTR(-ENOMEM);
-       vdev->vr[index] = va;
-       memset_io(va, 0x0, _vr_size);
-
-       info = va + _vr_size;
-       magic = ioread32(&info->magic);
-
-       if (WARN(magic != MIC_MAGIC + type + index, "magic mismatch")) {
-               err = -EIO;
-               goto unmap;
-       }
-
-       vdev->used_size[index] = PAGE_ALIGN(sizeof(__u16) * 3 +
-                                            sizeof(struct vring_used_elem) *
-                                            le16_to_cpu(config.num));
-       used = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
-                                       get_order(vdev->used_size[index]));
-       vdev->used_virt[index] = used;
-       if (!used) {
-               err = -ENOMEM;
-               dev_err(_vop_dev(vdev), "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto unmap;
-       }
-
-       vq = vop_new_virtqueue(index, le16_to_cpu(config.num), dev, ctx,
-                              (void __force *)va, vop_notify, callback,
-                              name, used);
-       if (!vq) {
-               err = -ENOMEM;
-               goto free_used;
-       }
-
-       vdev->used[index] = dma_map_single(&vpdev->dev, used,
-                                           vdev->used_size[index],
-                                           DMA_BIDIRECTIONAL);
-       if (dma_mapping_error(&vpdev->dev, vdev->used[index])) {
-               err = -ENOMEM;
-               dev_err(_vop_dev(vdev), "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto del_vq;
-       }
-       writeq(vdev->used[index], &vqconfig->used_address);
-
-       vq->priv = vdev;
-       return vq;
-del_vq:
-       vring_del_virtqueue(vq);
-free_used:
-       free_pages((unsigned long)used,
-                  get_order(vdev->used_size[index]));
-unmap:
-       vpdev->hw_ops->unmap(vpdev, vdev->vr[index]);
-       return ERR_PTR(err);
-}
-
-static int vop_find_vqs(struct virtio_device *dev, unsigned nvqs,
-                       struct virtqueue *vqs[],
-                       vq_callback_t *callbacks[],
-                       const char * const names[], const bool *ctx,
-                       struct irq_affinity *desc)
-{
-       struct _vop_vdev *vdev = to_vopvdev(dev);
-       struct vop_device *vpdev = vdev->vpdev;
-       struct mic_device_ctrl __iomem *dc = vdev->dc;
-       int i, err, retry, queue_idx = 0;
-
-       /* We must have this many virtqueues. */
-       if (nvqs > ioread8(&vdev->desc->num_vq))
-               return -ENOENT;
-
-       for (i = 0; i < nvqs; ++i) {
-               if (!names[i]) {
-                       vqs[i] = NULL;
-                       continue;
-               }
-
-               dev_dbg(_vop_dev(vdev), "%s: %d: %s\n",
-                       __func__, i, names[i]);
-               vqs[i] = vop_find_vq(dev, queue_idx++, callbacks[i], names[i],
-                                    ctx ? ctx[i] : false);
-               if (IS_ERR(vqs[i])) {
-                       err = PTR_ERR(vqs[i]);
-                       goto error;
-               }
-       }
-
-       iowrite8(1, &dc->used_address_updated);
-       /*
-        * Send an interrupt to the host to inform it that used
-        * rings have been re-assigned.
-        */
-       vpdev->hw_ops->send_intr(vpdev, vdev->c2h_vdev_db);
-       for (retry = 100; --retry;) {
-               if (!ioread8(&dc->used_address_updated))
-                       break;
-               msleep(100);
-       }
-
-       dev_dbg(_vop_dev(vdev), "%s: retry: %d\n", __func__, retry);
-       if (!retry) {
-               err = -ENODEV;
-               goto error;
-       }
-
-       return 0;
-error:
-       vop_del_vqs(dev);
-       return err;
-}
-
-/*
- * The config ops structure as defined by virtio config
- */
-static const struct virtio_config_ops vop_vq_config_ops = {
-       .get_features = vop_get_features,
-       .finalize_features = vop_finalize_features,
-       .get = vop_get,
-       .set = vop_set,
-       .get_status = vop_get_status,
-       .set_status = vop_set_status,
-       .reset = vop_reset,
-       .find_vqs = vop_find_vqs,
-       .del_vqs = vop_del_vqs,
-};
-
-static irqreturn_t vop_virtio_intr_handler(int irq, void *data)
-{
-       struct _vop_vdev *vdev = data;
-       struct vop_device *vpdev = vdev->vpdev;
-       struct virtqueue *vq;
-
-       vpdev->hw_ops->ack_interrupt(vpdev, vdev->h2c_vdev_db);
-       list_for_each_entry(vq, &vdev->vdev.vqs, list)
-               vring_interrupt(0, vq);
-
-       return IRQ_HANDLED;
-}
-
-static void vop_virtio_release_dev(struct device *_d)
-{
-       struct virtio_device *vdev =
-                       container_of(_d, struct virtio_device, dev);
-       struct _vop_vdev *vop_vdev =
-                       container_of(vdev, struct _vop_vdev, vdev);
-
-       kfree(vop_vdev);
-}
-
-/*
- * adds a new device and register it with virtio
- * appropriate drivers are loaded by the device model
- */
-static int _vop_add_device(struct mic_device_desc __iomem *d,
-                          unsigned int offset, struct vop_device *vpdev,
-                          int dnode)
-{
-       struct _vop_vdev *vdev, *reg_dev = NULL;
-       int ret;
-       u8 type = ioread8(&d->type);
-
-       vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
-       if (!vdev)
-               return -ENOMEM;
-
-       vdev->vpdev = vpdev;
-       vdev->vdev.dev.parent = &vpdev->dev;
-       vdev->vdev.dev.release = vop_virtio_release_dev;
-       vdev->vdev.id.device = type;
-       vdev->vdev.config = &vop_vq_config_ops;
-       vdev->desc = d;
-       vdev->dc = (void __iomem *)d + _vop_aligned_desc_size(d);
-       vdev->dnode = dnode;
-       vdev->vdev.priv = (void *)(unsigned long)dnode;
-       init_completion(&vdev->reset_done);
-
-       vdev->h2c_vdev_db = vpdev->hw_ops->next_db(vpdev);
-       vdev->virtio_cookie = vpdev->hw_ops->request_irq(vpdev,
-                       vop_virtio_intr_handler, "virtio intr",
-                       vdev, vdev->h2c_vdev_db);
-       if (IS_ERR(vdev->virtio_cookie)) {
-               ret = PTR_ERR(vdev->virtio_cookie);
-               goto kfree;
-       }
-       iowrite8((u8)vdev->h2c_vdev_db, &vdev->dc->h2c_vdev_db);
-       vdev->c2h_vdev_db = ioread8(&vdev->dc->c2h_vdev_db);
-
-       ret = register_virtio_device(&vdev->vdev);
-       reg_dev = vdev;
-       if (ret) {
-               dev_err(_vop_dev(vdev),
-                       "Failed to register vop device %u type %u\n",
-                       offset, type);
-               goto free_irq;
-       }
-       writeq((unsigned long)vdev, &vdev->dc->vdev);
-       dev_dbg(_vop_dev(vdev), "%s: registered vop device %u type %u vdev %p\n",
-               __func__, offset, type, vdev);
-
-       return 0;
-
-free_irq:
-       vpdev->hw_ops->free_irq(vpdev, vdev->virtio_cookie, vdev);
-kfree:
-       if (reg_dev)
-               put_device(&vdev->vdev.dev);
-       else
-               kfree(vdev);
-       return ret;
-}
-
-/*
- * match for a vop device with a specific desc pointer
- */
-static int vop_match_desc(struct device *dev, void *data)
-{
-       struct virtio_device *_dev = dev_to_virtio(dev);
-       struct _vop_vdev *vdev = to_vopvdev(_dev);
-
-       return vdev->desc == (void __iomem *)data;
-}
-
-static struct _vop_vdev *vop_dc_to_vdev(struct mic_device_ctrl __iomem *dc)
-{
-       return (struct _vop_vdev *)(unsigned long)readq(&dc->vdev);
-}
-
-static void _vop_handle_config_change(struct mic_device_desc __iomem *d,
-                                     unsigned int offset,
-                                     struct vop_device *vpdev)
-{
-       struct mic_device_ctrl __iomem *dc
-               = (void __iomem *)d + _vop_aligned_desc_size(d);
-       struct _vop_vdev *vdev = vop_dc_to_vdev(dc);
-
-       if (ioread8(&dc->config_change) != MIC_VIRTIO_PARAM_CONFIG_CHANGED)
-               return;
-
-       dev_dbg(&vpdev->dev, "%s %d\n", __func__, __LINE__);
-       virtio_config_changed(&vdev->vdev);
-       iowrite8(1, &dc->guest_ack);
-}
-
-/*
- * removes a virtio device if a hot remove event has been
- * requested by the host.
- */
-static int _vop_remove_device(struct mic_device_desc __iomem *d,
-                             unsigned int offset, struct vop_device *vpdev)
-{
-       struct mic_device_ctrl __iomem *dc
-               = (void __iomem *)d + _vop_aligned_desc_size(d);
-       struct _vop_vdev *vdev = vop_dc_to_vdev(dc);
-       u8 status;
-       int ret = -1;
-
-       if (ioread8(&dc->config_change) == MIC_VIRTIO_PARAM_DEV_REMOVE) {
-               struct device *dev = get_device(&vdev->vdev.dev);
-
-               dev_dbg(&vpdev->dev,
-                       "%s %d config_change %d type %d vdev %p\n",
-                       __func__, __LINE__,
-                       ioread8(&dc->config_change), ioread8(&d->type), vdev);
-               status = ioread8(&d->status);
-               reinit_completion(&vdev->reset_done);
-               unregister_virtio_device(&vdev->vdev);
-               vpdev->hw_ops->free_irq(vpdev, vdev->virtio_cookie, vdev);
-               iowrite8(-1, &dc->h2c_vdev_db);
-               if (status & VIRTIO_CONFIG_S_DRIVER_OK)
-                       wait_for_completion(&vdev->reset_done);
-               put_device(dev);
-               iowrite8(1, &dc->guest_ack);
-               dev_dbg(&vpdev->dev, "%s %d guest_ack %d\n",
-                       __func__, __LINE__, ioread8(&dc->guest_ack));
-               iowrite8(-1, &d->type);
-               ret = 0;
-       }
-       return ret;
-}
-
-#define REMOVE_DEVICES true
-
-static void _vop_scan_devices(void __iomem *dp, struct vop_device *vpdev,
-                             bool remove, int dnode)
-{
-       s8 type;
-       unsigned int i;
-       struct mic_device_desc __iomem *d;
-       struct mic_device_ctrl __iomem *dc;
-       struct device *dev;
-
-       for (i = sizeof(struct mic_bootparam);
-                       i < MIC_DP_SIZE; i += _vop_total_desc_size(d)) {
-               d = dp + i;
-               dc = (void __iomem *)d + _vop_aligned_desc_size(d);
-               /*
-                * This read barrier is paired with the corresponding write
-                * barrier on the host which is inserted before adding or
-                * removing a virtio device descriptor, by updating the type.
-                */
-               rmb();
-               type = ioread8(&d->type);
-
-               /* end of list */
-               if (type == 0)
-                       break;
-
-               if (type == -1)
-                       continue;
-
-               /* device already exists */
-               dev = device_find_child(&vpdev->dev, (void __force *)d,
-                                       vop_match_desc);
-               if (dev) {
-                       if (remove)
-                               iowrite8(MIC_VIRTIO_PARAM_DEV_REMOVE,
-                                        &dc->config_change);
-                       put_device(dev);
-                       _vop_handle_config_change(d, i, vpdev);
-                       _vop_remove_device(d, i, vpdev);
-                       if (remove) {
-                               iowrite8(0, &dc->config_change);
-                               iowrite8(0, &dc->guest_ack);
-                       }
-                       continue;
-               }
-
-               /* new device */
-               dev_dbg(&vpdev->dev, "%s %d Adding new virtio device %p\n",
-                       __func__, __LINE__, d);
-               if (!remove)
-                       _vop_add_device(d, i, vpdev, dnode);
-       }
-}
-
-static void vop_scan_devices(struct vop_info *vi,
-                            struct vop_device *vpdev, bool remove)
-{
-       void __iomem *dp = vpdev->hw_ops->get_remote_dp(vpdev);
-
-       if (!dp)
-               return;
-       mutex_lock(&vi->vop_mutex);
-       _vop_scan_devices(dp, vpdev, remove, vpdev->dnode);
-       mutex_unlock(&vi->vop_mutex);
-}
-
-/*
- * vop_hotplug_device tries to find changes in the device page.
- */
-static void vop_hotplug_devices(struct work_struct *work)
-{
-       struct vop_info *vi = container_of(work, struct vop_info,
-                                            hotplug_work);
-
-       vop_scan_devices(vi, vi->vpdev, !REMOVE_DEVICES);
-}
-
-/*
- * Interrupt handler for hot plug/config changes etc.
- */
-static irqreturn_t vop_extint_handler(int irq, void *data)
-{
-       struct vop_info *vi = data;
-       struct mic_bootparam __iomem *bp;
-       struct vop_device *vpdev = vi->vpdev;
-
-       bp = vpdev->hw_ops->get_remote_dp(vpdev);
-       dev_dbg(&vpdev->dev, "%s %d hotplug work\n",
-               __func__, __LINE__);
-       vpdev->hw_ops->ack_interrupt(vpdev, ioread8(&bp->h2c_config_db));
-       schedule_work(&vi->hotplug_work);
-       return IRQ_HANDLED;
-}
-
-static int vop_driver_probe(struct vop_device *vpdev)
-{
-       struct vop_info *vi;
-       int rc;
-
-       vi = kzalloc(sizeof(*vi), GFP_KERNEL);
-       if (!vi) {
-               rc = -ENOMEM;
-               goto exit;
-       }
-       dev_set_drvdata(&vpdev->dev, vi);
-       vi->vpdev = vpdev;
-
-       mutex_init(&vi->vop_mutex);
-       INIT_WORK(&vi->hotplug_work, vop_hotplug_devices);
-       if (vpdev->dnode) {
-               rc = vop_host_init(vi);
-               if (rc < 0)
-                       goto free;
-       } else {
-               struct mic_bootparam __iomem *bootparam;
-
-               vop_scan_devices(vi, vpdev, !REMOVE_DEVICES);
-
-               vi->h2c_config_db = vpdev->hw_ops->next_db(vpdev);
-               vi->cookie = vpdev->hw_ops->request_irq(vpdev,
-                                                       vop_extint_handler,
-                                                       "virtio_config_intr",
-                                                       vi, vi->h2c_config_db);
-               if (IS_ERR(vi->cookie)) {
-                       rc = PTR_ERR(vi->cookie);
-                       goto free;
-               }
-               bootparam = vpdev->hw_ops->get_remote_dp(vpdev);
-               iowrite8(vi->h2c_config_db, &bootparam->h2c_config_db);
-       }
-       vop_init_debugfs(vi);
-       return 0;
-free:
-       kfree(vi);
-exit:
-       return rc;
-}
-
-static void vop_driver_remove(struct vop_device *vpdev)
-{
-       struct vop_info *vi = dev_get_drvdata(&vpdev->dev);
-
-       if (vpdev->dnode) {
-               vop_host_uninit(vi);
-       } else {
-               struct mic_bootparam __iomem *bootparam =
-                       vpdev->hw_ops->get_remote_dp(vpdev);
-               if (bootparam)
-                       iowrite8(-1, &bootparam->h2c_config_db);
-               vpdev->hw_ops->free_irq(vpdev, vi->cookie, vi);
-               flush_work(&vi->hotplug_work);
-               vop_scan_devices(vi, vpdev, REMOVE_DEVICES);
-       }
-       vop_exit_debugfs(vi);
-       kfree(vi);
-}
-
-static const struct vop_device_id id_table[] = {
-       { VOP_DEV_TRNSP, VOP_DEV_ANY_ID },
-       { 0 },
-};
-
-static struct vop_driver vop_driver = {
-       .driver.name =  KBUILD_MODNAME,
-       .driver.owner = THIS_MODULE,
-       .id_table = id_table,
-       .probe = vop_driver_probe,
-       .remove = vop_driver_remove,
-};
-
-module_vop_driver(vop_driver);
-
-MODULE_DEVICE_TABLE(mbus, id_table);
-MODULE_AUTHOR("Intel Corporation");
-MODULE_DESCRIPTION("Intel(R) Virtio Over PCIe (VOP) driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/misc/mic/vop/vop_main.h b/drivers/misc/mic/vop/vop_main.h
deleted file mode 100644 (file)
index 2451d92..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2016 Intel Corporation.
- *
- * Intel Virtio Over PCIe (VOP) driver.
- */
-#ifndef _VOP_MAIN_H_
-#define _VOP_MAIN_H_
-
-#include <linux/vringh.h>
-#include <linux/virtio_config.h>
-#include <linux/virtio.h>
-#include <linux/miscdevice.h>
-
-#include <linux/mic_common.h>
-#include "../common/mic_dev.h"
-
-#include "../bus/vop_bus.h"
-
-/*
- * Note on endianness.
- * 1. Host can be both BE or LE
- * 2. Guest/card is LE. Host uses le_to_cpu to access desc/avail
- *    rings and ioreadXX/iowriteXX to access used ring.
- * 3. Device page exposed by host to guest contains LE values. Guest
- *    accesses these using ioreadXX/iowriteXX etc. This way in general we
- *    obey the virtio spec according to which guest works with native
- *    endianness and host is aware of guest endianness and does all
- *    required endianness conversion.
- * 4. Data provided from user space to guest (in ADD_DEVICE and
- *    CONFIG_CHANGE ioctl's) is not interpreted by the driver and should be
- *    in guest endianness.
- */
-
-/*
- * vop_info - Allocated per invocation of VOP probe
- *
- * @vpdev: VOP device
- * @hotplug_work: Handle virtio device creation, deletion and configuration
- * @cookie: Cookie received upon requesting a virtio configuration interrupt
- * @h2c_config_db: The doorbell used by the peer to indicate a config change
- * @vdev_list: List of "active" virtio devices injected in the peer node
- * @vop_mutex: Synchronize access to the device page as well as serialize
- *             creation/deletion of virtio devices on the peer node
- * @dp: Peer device page information
- * @dbg: Debugfs entry
- * @dma_ch: The DMA channel used by this transport for data transfers.
- * @name: Name for this transport used in misc device creation.
- * @miscdev: The misc device registered.
- */
-struct vop_info {
-       struct vop_device *vpdev;
-       struct work_struct hotplug_work;
-       struct mic_irq *cookie;
-       int h2c_config_db;
-       struct list_head vdev_list;
-       struct mutex vop_mutex;
-       void __iomem *dp;
-       struct dentry *dbg;
-       struct dma_chan *dma_ch;
-       char name[16];
-       struct miscdevice miscdev;
-};
-
-/**
- * struct vop_vringh - Virtio ring host information.
- *
- * @vring: The VOP vring used for setting up user space mappings.
- * @vrh: The host VRINGH used for accessing the card vrings.
- * @riov: The VRINGH read kernel IOV.
- * @wiov: The VRINGH write kernel IOV.
- * @head: The VRINGH head index address passed to vringh_getdesc_kern(..).
- * @vr_mutex: Mutex for synchronizing access to the VRING.
- * @buf: Temporary kernel buffer used to copy in/out data
- * from/to the card via DMA.
- * @buf_da: dma address of buf.
- * @vdev: Back pointer to VOP virtio device for vringh_notify(..).
- */
-struct vop_vringh {
-       struct mic_vring vring;
-       struct vringh vrh;
-       struct vringh_kiov riov;
-       struct vringh_kiov wiov;
-       u16 head;
-       struct mutex vr_mutex;
-       void *buf;
-       dma_addr_t buf_da;
-       struct vop_vdev *vdev;
-};
-
-/**
- * struct vop_vdev - Host information for a card Virtio device.
- *
- * @virtio_id - Virtio device id.
- * @waitq - Waitqueue to allow ring3 apps to poll.
- * @vpdev - pointer to VOP bus device.
- * @poll_wake - Used for waking up threads blocked in poll.
- * @out_bytes - Debug stats for number of bytes copied from host to card.
- * @in_bytes - Debug stats for number of bytes copied from card to host.
- * @out_bytes_dma - Debug stats for number of bytes copied from host to card
- * using DMA.
- * @in_bytes_dma - Debug stats for number of bytes copied from card to host
- * using DMA.
- * @tx_len_unaligned - Debug stats for number of bytes copied to the card where
- * the transfer length did not have the required DMA alignment.
- * @tx_dst_unaligned - Debug stats for number of bytes copied where the
- * destination address on the card did not have the required DMA alignment.
- * @vvr - Store per VRING data structures.
- * @virtio_bh_work - Work struct used to schedule virtio bottom half handling.
- * @dd - Virtio device descriptor.
- * @dc - Virtio device control fields.
- * @list - List of Virtio devices.
- * @virtio_db - The doorbell used by the card to interrupt the host.
- * @virtio_cookie - The cookie returned while requesting interrupts.
- * @vi: Transport information.
- * @vdev_mutex: Mutex synchronizing virtio device injection,
- *              removal and data transfers.
- * @destroy: Track if a virtio device is being destroyed.
- * @deleted: The virtio device has been deleted.
- */
-struct vop_vdev {
-       int virtio_id;
-       wait_queue_head_t waitq;
-       struct vop_device *vpdev;
-       int poll_wake;
-       unsigned long out_bytes;
-       unsigned long in_bytes;
-       unsigned long out_bytes_dma;
-       unsigned long in_bytes_dma;
-       unsigned long tx_len_unaligned;
-       unsigned long tx_dst_unaligned;
-       unsigned long rx_dst_unaligned;
-       struct vop_vringh vvr[MIC_MAX_VRINGS];
-       struct work_struct virtio_bh_work;
-       struct mic_device_desc *dd;
-       struct mic_device_ctrl *dc;
-       struct list_head list;
-       int virtio_db;
-       struct mic_irq *virtio_cookie;
-       struct vop_info *vi;
-       struct mutex vdev_mutex;
-       struct completion destroy;
-       bool deleted;
-};
-
-/* Helper API to check if a virtio device is running */
-static inline bool vop_vdevup(struct vop_vdev *vdev)
-{
-       return !!vdev->dd->status;
-}
-
-void vop_init_debugfs(struct vop_info *vi);
-void vop_exit_debugfs(struct vop_info *vi);
-int vop_host_init(struct vop_info *vi);
-void vop_host_uninit(struct vop_info *vi);
-#endif
diff --git a/drivers/misc/mic/vop/vop_vringh.c b/drivers/misc/mic/vop/vop_vringh.c
deleted file mode 100644 (file)
index 7014ffe..0000000
+++ /dev/null
@@ -1,1166 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2016 Intel Corporation.
- *
- * Intel Virtio Over PCIe (VOP) driver.
- */
-#include <linux/sched.h>
-#include <linux/poll.h>
-#include <linux/dma-mapping.h>
-
-#include <linux/mic_common.h>
-#include "../common/mic_dev.h"
-
-#include <linux/mic_ioctl.h>
-#include "vop_main.h"
-
-/* Helper API to obtain the VOP PCIe device */
-static inline struct device *vop_dev(struct vop_vdev *vdev)
-{
-       return vdev->vpdev->dev.parent;
-}
-
-/* Helper API to check if a virtio device is initialized */
-static inline int vop_vdev_inited(struct vop_vdev *vdev)
-{
-       if (!vdev)
-               return -EINVAL;
-       /* Device has not been created yet */
-       if (!vdev->dd || !vdev->dd->type) {
-               dev_err(vop_dev(vdev), "%s %d err %d\n",
-                       __func__, __LINE__, -EINVAL);
-               return -EINVAL;
-       }
-       /* Device has been removed/deleted */
-       if (vdev->dd->type == -1) {
-               dev_dbg(vop_dev(vdev), "%s %d err %d\n",
-                       __func__, __LINE__, -ENODEV);
-               return -ENODEV;
-       }
-       return 0;
-}
-
-static void _vop_notify(struct vringh *vrh)
-{
-       struct vop_vringh *vvrh = container_of(vrh, struct vop_vringh, vrh);
-       struct vop_vdev *vdev = vvrh->vdev;
-       struct vop_device *vpdev = vdev->vpdev;
-       s8 db = vdev->dc->h2c_vdev_db;
-
-       if (db != -1)
-               vpdev->hw_ops->send_intr(vpdev, db);
-}
-
-static void vop_virtio_init_post(struct vop_vdev *vdev)
-{
-       struct mic_vqconfig *vqconfig = mic_vq_config(vdev->dd);
-       struct vop_device *vpdev = vdev->vpdev;
-       int i, used_size;
-
-       for (i = 0; i < vdev->dd->num_vq; i++) {
-               used_size = PAGE_ALIGN(sizeof(u16) * 3 +
-                               sizeof(struct vring_used_elem) *
-                               le16_to_cpu(vqconfig->num));
-               if (!le64_to_cpu(vqconfig[i].used_address)) {
-                       dev_warn(vop_dev(vdev), "used_address zero??\n");
-                       continue;
-               }
-               vdev->vvr[i].vrh.vring.used =
-                       (void __force *)vpdev->hw_ops->remap(
-                       vpdev,
-                       le64_to_cpu(vqconfig[i].used_address),
-                       used_size);
-       }
-
-       vdev->dc->used_address_updated = 0;
-
-       dev_info(vop_dev(vdev), "%s: device type %d LINKUP\n",
-                __func__, vdev->virtio_id);
-}
-
-static inline void vop_virtio_device_reset(struct vop_vdev *vdev)
-{
-       int i;
-
-       dev_dbg(vop_dev(vdev), "%s: status %d device type %d RESET\n",
-               __func__, vdev->dd->status, vdev->virtio_id);
-
-       for (i = 0; i < vdev->dd->num_vq; i++)
-               /*
-                * Avoid lockdep false positive. The + 1 is for the vop
-                * mutex which is held in the reset devices code path.
-                */
-               mutex_lock_nested(&vdev->vvr[i].vr_mutex, i + 1);
-
-       /* 0 status means "reset" */
-       vdev->dd->status = 0;
-       vdev->dc->vdev_reset = 0;
-       vdev->dc->host_ack = 1;
-
-       for (i = 0; i < vdev->dd->num_vq; i++) {
-               struct vringh *vrh = &vdev->vvr[i].vrh;
-
-               vdev->vvr[i].vring.info->avail_idx = 0;
-               vrh->completed = 0;
-               vrh->last_avail_idx = 0;
-               vrh->last_used_idx = 0;
-       }
-
-       for (i = 0; i < vdev->dd->num_vq; i++)
-               mutex_unlock(&vdev->vvr[i].vr_mutex);
-}
-
-static void vop_virtio_reset_devices(struct vop_info *vi)
-{
-       struct list_head *pos, *tmp;
-       struct vop_vdev *vdev;
-
-       list_for_each_safe(pos, tmp, &vi->vdev_list) {
-               vdev = list_entry(pos, struct vop_vdev, list);
-               vop_virtio_device_reset(vdev);
-               vdev->poll_wake = 1;
-               wake_up(&vdev->waitq);
-       }
-}
-
-static void vop_bh_handler(struct work_struct *work)
-{
-       struct vop_vdev *vdev = container_of(work, struct vop_vdev,
-                       virtio_bh_work);
-
-       if (vdev->dc->used_address_updated)
-               vop_virtio_init_post(vdev);
-
-       if (vdev->dc->vdev_reset)
-               vop_virtio_device_reset(vdev);
-
-       vdev->poll_wake = 1;
-       wake_up(&vdev->waitq);
-}
-
-static irqreturn_t _vop_virtio_intr_handler(int irq, void *data)
-{
-       struct vop_vdev *vdev = data;
-       struct vop_device *vpdev = vdev->vpdev;
-
-       vpdev->hw_ops->ack_interrupt(vpdev, vdev->virtio_db);
-       schedule_work(&vdev->virtio_bh_work);
-       return IRQ_HANDLED;
-}
-
-static int vop_virtio_config_change(struct vop_vdev *vdev, void *argp)
-{
-       DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake);
-       int ret = 0, retry, i;
-       struct vop_device *vpdev = vdev->vpdev;
-       struct vop_info *vi = dev_get_drvdata(&vpdev->dev);
-       struct mic_bootparam *bootparam = vpdev->hw_ops->get_dp(vpdev);
-       s8 db = bootparam->h2c_config_db;
-
-       mutex_lock(&vi->vop_mutex);
-       for (i = 0; i < vdev->dd->num_vq; i++)
-               mutex_lock_nested(&vdev->vvr[i].vr_mutex, i + 1);
-
-       if (db == -1 || vdev->dd->type == -1) {
-               ret = -EIO;
-               goto exit;
-       }
-
-       memcpy(mic_vq_configspace(vdev->dd), argp, vdev->dd->config_len);
-       vdev->dc->config_change = MIC_VIRTIO_PARAM_CONFIG_CHANGED;
-       vpdev->hw_ops->send_intr(vpdev, db);
-
-       for (retry = 100; retry--;) {
-               ret = wait_event_timeout(wake, vdev->dc->guest_ack,
-                                        msecs_to_jiffies(100));
-               if (ret)
-                       break;
-       }
-
-       dev_dbg(vop_dev(vdev),
-               "%s %d retry: %d\n", __func__, __LINE__, retry);
-       vdev->dc->config_change = 0;
-       vdev->dc->guest_ack = 0;
-exit:
-       for (i = 0; i < vdev->dd->num_vq; i++)
-               mutex_unlock(&vdev->vvr[i].vr_mutex);
-       mutex_unlock(&vi->vop_mutex);
-       return ret;
-}
-
-static int vop_copy_dp_entry(struct vop_vdev *vdev,
-                            struct mic_device_desc *argp, __u8 *type,
-                            struct mic_device_desc **devpage)
-{
-       struct vop_device *vpdev = vdev->vpdev;
-       struct mic_device_desc *devp;
-       struct mic_vqconfig *vqconfig;
-       int ret = 0, i;
-       bool slot_found = false;
-
-       vqconfig = mic_vq_config(argp);
-       for (i = 0; i < argp->num_vq; i++) {
-               if (le16_to_cpu(vqconfig[i].num) > MIC_MAX_VRING_ENTRIES) {
-                       ret =  -EINVAL;
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, ret);
-                       goto exit;
-               }
-       }
-
-       /* Find the first free device page entry */
-       for (i = sizeof(struct mic_bootparam);
-               i < MIC_DP_SIZE - mic_total_desc_size(argp);
-               i += mic_total_desc_size(devp)) {
-               devp = vpdev->hw_ops->get_dp(vpdev) + i;
-               if (devp->type == 0 || devp->type == -1) {
-                       slot_found = true;
-                       break;
-               }
-       }
-       if (!slot_found) {
-               ret =  -EINVAL;
-               dev_err(vop_dev(vdev), "%s %d err %d\n",
-                       __func__, __LINE__, ret);
-               goto exit;
-       }
-       /*
-        * Save off the type before doing the memcpy. Type will be set in the
-        * end after completing all initialization for the new device.
-        */
-       *type = argp->type;
-       argp->type = 0;
-       memcpy(devp, argp, mic_desc_size(argp));
-
-       *devpage = devp;
-exit:
-       return ret;
-}
-
-static void vop_init_device_ctrl(struct vop_vdev *vdev,
-                                struct mic_device_desc *devpage)
-{
-       struct mic_device_ctrl *dc;
-
-       dc = (void *)devpage + mic_aligned_desc_size(devpage);
-
-       dc->config_change = 0;
-       dc->guest_ack = 0;
-       dc->vdev_reset = 0;
-       dc->host_ack = 0;
-       dc->used_address_updated = 0;
-       dc->c2h_vdev_db = -1;
-       dc->h2c_vdev_db = -1;
-       vdev->dc = dc;
-}
-
-static int vop_virtio_add_device(struct vop_vdev *vdev,
-                                struct mic_device_desc *argp)
-{
-       struct vop_info *vi = vdev->vi;
-       struct vop_device *vpdev = vi->vpdev;
-       struct mic_device_desc *dd = NULL;
-       struct mic_vqconfig *vqconfig;
-       int vr_size, i, j, ret;
-       u8 type = 0;
-       s8 db = -1;
-       char irqname[16];
-       struct mic_bootparam *bootparam;
-       u16 num;
-       dma_addr_t vr_addr;
-
-       bootparam = vpdev->hw_ops->get_dp(vpdev);
-       init_waitqueue_head(&vdev->waitq);
-       INIT_LIST_HEAD(&vdev->list);
-       vdev->vpdev = vpdev;
-
-       ret = vop_copy_dp_entry(vdev, argp, &type, &dd);
-       if (ret) {
-               dev_err(vop_dev(vdev), "%s %d err %d\n",
-                       __func__, __LINE__, ret);
-               return ret;
-       }
-
-       vop_init_device_ctrl(vdev, dd);
-
-       vdev->dd = dd;
-       vdev->virtio_id = type;
-       vqconfig = mic_vq_config(dd);
-       INIT_WORK(&vdev->virtio_bh_work, vop_bh_handler);
-
-       for (i = 0; i < dd->num_vq; i++) {
-               struct vop_vringh *vvr = &vdev->vvr[i];
-               struct mic_vring *vr = &vdev->vvr[i].vring;
-
-               num = le16_to_cpu(vqconfig[i].num);
-               mutex_init(&vvr->vr_mutex);
-               vr_size = PAGE_ALIGN(round_up(vring_size(num, MIC_VIRTIO_RING_ALIGN), 4) +
-                       sizeof(struct _mic_vring_info));
-               vr->va = (void *)
-                       __get_free_pages(GFP_KERNEL | __GFP_ZERO,
-                                        get_order(vr_size));
-               if (!vr->va) {
-                       ret = -ENOMEM;
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, ret);
-                       goto err;
-               }
-               vr->len = vr_size;
-               vr->info = vr->va + round_up(vring_size(num, MIC_VIRTIO_RING_ALIGN), 4);
-               vr->info->magic = cpu_to_le32(MIC_MAGIC + vdev->virtio_id + i);
-               vr_addr = dma_map_single(&vpdev->dev, vr->va, vr_size,
-                                        DMA_BIDIRECTIONAL);
-               if (dma_mapping_error(&vpdev->dev, vr_addr)) {
-                       free_pages((unsigned long)vr->va, get_order(vr_size));
-                       ret = -ENOMEM;
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, ret);
-                       goto err;
-               }
-               vqconfig[i].address = cpu_to_le64(vr_addr);
-
-               vring_init(&vr->vr, num, vr->va, MIC_VIRTIO_RING_ALIGN);
-               ret = vringh_init_kern(&vvr->vrh,
-                                      *(u32 *)mic_vq_features(vdev->dd),
-                                      num, false, vr->vr.desc, vr->vr.avail,
-                                      vr->vr.used);
-               if (ret) {
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, ret);
-                       goto err;
-               }
-               vringh_kiov_init(&vvr->riov, NULL, 0);
-               vringh_kiov_init(&vvr->wiov, NULL, 0);
-               vvr->head = USHRT_MAX;
-               vvr->vdev = vdev;
-               vvr->vrh.notify = _vop_notify;
-               dev_dbg(&vpdev->dev,
-                       "%s %d index %d va %p info %p vr_size 0x%x\n",
-                       __func__, __LINE__, i, vr->va, vr->info, vr_size);
-               vvr->buf = (void *)__get_free_pages(GFP_KERNEL,
-                                       get_order(VOP_INT_DMA_BUF_SIZE));
-               vvr->buf_da = dma_map_single(&vpdev->dev,
-                                         vvr->buf, VOP_INT_DMA_BUF_SIZE,
-                                         DMA_BIDIRECTIONAL);
-       }
-
-       snprintf(irqname, sizeof(irqname), "vop%dvirtio%d", vpdev->index,
-                vdev->virtio_id);
-       vdev->virtio_db = vpdev->hw_ops->next_db(vpdev);
-       vdev->virtio_cookie = vpdev->hw_ops->request_irq(vpdev,
-                       _vop_virtio_intr_handler, irqname, vdev,
-                       vdev->virtio_db);
-       if (IS_ERR(vdev->virtio_cookie)) {
-               ret = PTR_ERR(vdev->virtio_cookie);
-               dev_dbg(&vpdev->dev, "request irq failed\n");
-               goto err;
-       }
-
-       vdev->dc->c2h_vdev_db = vdev->virtio_db;
-
-       /*
-        * Order the type update with previous stores. This write barrier
-        * is paired with the corresponding read barrier before the uncached
-        * system memory read of the type, on the card while scanning the
-        * device page.
-        */
-       smp_wmb();
-       dd->type = type;
-       argp->type = type;
-
-       if (bootparam) {
-               db = bootparam->h2c_config_db;
-               if (db != -1)
-                       vpdev->hw_ops->send_intr(vpdev, db);
-       }
-       dev_dbg(&vpdev->dev, "Added virtio id %d db %d\n", dd->type, db);
-       return 0;
-err:
-       vqconfig = mic_vq_config(dd);
-       for (j = 0; j < i; j++) {
-               struct vop_vringh *vvr = &vdev->vvr[j];
-
-               dma_unmap_single(&vpdev->dev, le64_to_cpu(vqconfig[j].address),
-                                vvr->vring.len, DMA_BIDIRECTIONAL);
-               free_pages((unsigned long)vvr->vring.va,
-                          get_order(vvr->vring.len));
-       }
-       return ret;
-}
-
-static void vop_dev_remove(struct vop_info *pvi, struct mic_device_ctrl *devp,
-                          struct vop_device *vpdev)
-{
-       struct mic_bootparam *bootparam = vpdev->hw_ops->get_dp(vpdev);
-       s8 db;
-       int ret, retry;
-       DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake);
-
-       devp->config_change = MIC_VIRTIO_PARAM_DEV_REMOVE;
-       db = bootparam->h2c_config_db;
-       if (db != -1)
-               vpdev->hw_ops->send_intr(vpdev, db);
-       else
-               goto done;
-       for (retry = 15; retry--;) {
-               ret = wait_event_timeout(wake, devp->guest_ack,
-                                        msecs_to_jiffies(1000));
-               if (ret)
-                       break;
-       }
-done:
-       devp->config_change = 0;
-       devp->guest_ack = 0;
-}
-
-static void vop_virtio_del_device(struct vop_vdev *vdev)
-{
-       struct vop_info *vi = vdev->vi;
-       struct vop_device *vpdev = vdev->vpdev;
-       int i;
-       struct mic_vqconfig *vqconfig;
-       struct mic_bootparam *bootparam = vpdev->hw_ops->get_dp(vpdev);
-
-       if (!bootparam)
-               goto skip_hot_remove;
-       vop_dev_remove(vi, vdev->dc, vpdev);
-skip_hot_remove:
-       vpdev->hw_ops->free_irq(vpdev, vdev->virtio_cookie, vdev);
-       flush_work(&vdev->virtio_bh_work);
-       vqconfig = mic_vq_config(vdev->dd);
-       for (i = 0; i < vdev->dd->num_vq; i++) {
-               struct vop_vringh *vvr = &vdev->vvr[i];
-
-               dma_unmap_single(&vpdev->dev,
-                                vvr->buf_da, VOP_INT_DMA_BUF_SIZE,
-                                DMA_BIDIRECTIONAL);
-               free_pages((unsigned long)vvr->buf,
-                          get_order(VOP_INT_DMA_BUF_SIZE));
-               vringh_kiov_cleanup(&vvr->riov);
-               vringh_kiov_cleanup(&vvr->wiov);
-               dma_unmap_single(&vpdev->dev, le64_to_cpu(vqconfig[i].address),
-                                vvr->vring.len, DMA_BIDIRECTIONAL);
-               free_pages((unsigned long)vvr->vring.va,
-                          get_order(vvr->vring.len));
-       }
-       /*
-        * Order the type update with previous stores. This write barrier
-        * is paired with the corresponding read barrier before the uncached
-        * system memory read of the type, on the card while scanning the
-        * device page.
-        */
-       smp_wmb();
-       vdev->dd->type = -1;
-}
-
-/*
- * vop_sync_dma - Wrapper for synchronous DMAs.
- *
- * @dev - The address of the pointer to the device instance used
- * for DMA registration.
- * @dst - destination DMA address.
- * @src - source DMA address.
- * @len - size of the transfer.
- *
- * Return DMA_SUCCESS on success
- */
-static int vop_sync_dma(struct vop_vdev *vdev, dma_addr_t dst, dma_addr_t src,
-                       size_t len)
-{
-       int err = 0;
-       struct dma_device *ddev;
-       struct dma_async_tx_descriptor *tx;
-       struct vop_info *vi = dev_get_drvdata(&vdev->vpdev->dev);
-       struct dma_chan *vop_ch = vi->dma_ch;
-
-       if (!vop_ch) {
-               err = -EBUSY;
-               goto error;
-       }
-       ddev = vop_ch->device;
-       tx = ddev->device_prep_dma_memcpy(vop_ch, dst, src, len,
-               DMA_PREP_FENCE);
-       if (!tx) {
-               err = -ENOMEM;
-               goto error;
-       } else {
-               dma_cookie_t cookie;
-
-               cookie = tx->tx_submit(tx);
-               if (dma_submit_error(cookie)) {
-                       err = -ENOMEM;
-                       goto error;
-               }
-               dma_async_issue_pending(vop_ch);
-               err = dma_sync_wait(vop_ch, cookie);
-       }
-error:
-       if (err)
-               dev_err(&vi->vpdev->dev, "%s %d err %d\n",
-                       __func__, __LINE__, err);
-       return err;
-}
-
-#define VOP_USE_DMA true
-
-/*
- * Initiates the copies across the PCIe bus from card memory to a user
- * space buffer. When transfers are done using DMA, source/destination
- * addresses and transfer length must follow the alignment requirements of
- * the MIC DMA engine.
- */
-static int vop_virtio_copy_to_user(struct vop_vdev *vdev, void __user *ubuf,
-                                  size_t len, u64 daddr, size_t dlen,
-                                  int vr_idx)
-{
-       struct vop_device *vpdev = vdev->vpdev;
-       void __iomem *dbuf = vpdev->hw_ops->remap(vpdev, daddr, len);
-       struct vop_vringh *vvr = &vdev->vvr[vr_idx];
-       struct vop_info *vi = dev_get_drvdata(&vpdev->dev);
-       size_t dma_alignment;
-       bool x200;
-       size_t dma_offset, partlen;
-       int err;
-
-       if (!VOP_USE_DMA || !vi->dma_ch) {
-               if (copy_to_user(ubuf, (void __force *)dbuf, len)) {
-                       err = -EFAULT;
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, err);
-                       goto err;
-               }
-               vdev->in_bytes += len;
-               err = 0;
-               goto err;
-       }
-
-       dma_alignment = 1 << vi->dma_ch->device->copy_align;
-       x200 = is_dma_copy_aligned(vi->dma_ch->device, 1, 1, 1);
-
-       dma_offset = daddr - round_down(daddr, dma_alignment);
-       daddr -= dma_offset;
-       len += dma_offset;
-       /*
-        * X100 uses DMA addresses as seen by the card so adding
-        * the aperture base is not required for DMA. However x200
-        * requires DMA addresses to be an offset into the bar so
-        * add the aperture base for x200.
-        */
-       if (x200)
-               daddr += vpdev->aper->pa;
-       while (len) {
-               partlen = min_t(size_t, len, VOP_INT_DMA_BUF_SIZE);
-               err = vop_sync_dma(vdev, vvr->buf_da, daddr,
-                                  ALIGN(partlen, dma_alignment));
-               if (err) {
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, err);
-                       goto err;
-               }
-               if (copy_to_user(ubuf, vvr->buf + dma_offset,
-                                partlen - dma_offset)) {
-                       err = -EFAULT;
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, err);
-                       goto err;
-               }
-               daddr += partlen;
-               ubuf += partlen;
-               dbuf += partlen;
-               vdev->in_bytes_dma += partlen;
-               vdev->in_bytes += partlen;
-               len -= partlen;
-               dma_offset = 0;
-       }
-       err = 0;
-err:
-       vpdev->hw_ops->unmap(vpdev, dbuf);
-       dev_dbg(vop_dev(vdev),
-               "%s: ubuf %p dbuf %p len 0x%zx vr_idx 0x%x\n",
-               __func__, ubuf, dbuf, len, vr_idx);
-       return err;
-}
-
-/*
- * Initiates copies across the PCIe bus from a user space buffer to card
- * memory. When transfers are done using DMA, source/destination addresses
- * and transfer length must follow the alignment requirements of the MIC
- * DMA engine.
- */
-static int vop_virtio_copy_from_user(struct vop_vdev *vdev, void __user *ubuf,
-                                    size_t len, u64 daddr, size_t dlen,
-                                    int vr_idx)
-{
-       struct vop_device *vpdev = vdev->vpdev;
-       void __iomem *dbuf = vpdev->hw_ops->remap(vpdev, daddr, len);
-       struct vop_vringh *vvr = &vdev->vvr[vr_idx];
-       struct vop_info *vi = dev_get_drvdata(&vdev->vpdev->dev);
-       size_t dma_alignment;
-       bool x200;
-       size_t partlen;
-       bool dma = VOP_USE_DMA && vi->dma_ch;
-       int err = 0;
-       size_t offset = 0;
-
-       if (dma) {
-               dma_alignment = 1 << vi->dma_ch->device->copy_align;
-               x200 = is_dma_copy_aligned(vi->dma_ch->device, 1, 1, 1);
-
-               if (daddr & (dma_alignment - 1)) {
-                       vdev->tx_dst_unaligned += len;
-                       dma = false;
-               } else if (ALIGN(len, dma_alignment) > dlen) {
-                       vdev->tx_len_unaligned += len;
-                       dma = false;
-               }
-       }
-
-       if (!dma)
-               goto memcpy;
-
-       /*
-        * X100 uses DMA addresses as seen by the card so adding
-        * the aperture base is not required for DMA. However x200
-        * requires DMA addresses to be an offset into the bar so
-        * add the aperture base for x200.
-        */
-       if (x200)
-               daddr += vpdev->aper->pa;
-       while (len) {
-               partlen = min_t(size_t, len, VOP_INT_DMA_BUF_SIZE);
-
-               if (copy_from_user(vvr->buf, ubuf, partlen)) {
-                       err = -EFAULT;
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, err);
-                       goto err;
-               }
-               err = vop_sync_dma(vdev, daddr, vvr->buf_da,
-                                  ALIGN(partlen, dma_alignment));
-               if (err) {
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, err);
-                       goto err;
-               }
-               daddr += partlen;
-               ubuf += partlen;
-               dbuf += partlen;
-               vdev->out_bytes_dma += partlen;
-               vdev->out_bytes += partlen;
-               len -= partlen;
-       }
-memcpy:
-       /*
-        * We are copying to IO below and should ideally use something
-        * like copy_from_user_toio(..) if it existed.
-        */
-       while (len) {
-               partlen = min_t(size_t, len, VOP_INT_DMA_BUF_SIZE);
-
-               if (copy_from_user(vvr->buf, ubuf + offset, partlen)) {
-                       err = -EFAULT;
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, err);
-                       goto err;
-               }
-               memcpy_toio(dbuf + offset, vvr->buf, partlen);
-               offset += partlen;
-               vdev->out_bytes += partlen;
-               len -= partlen;
-       }
-       err = 0;
-err:
-       vpdev->hw_ops->unmap(vpdev, dbuf);
-       dev_dbg(vop_dev(vdev),
-               "%s: ubuf %p dbuf %p len 0x%zx vr_idx 0x%x\n",
-               __func__, ubuf, dbuf, len, vr_idx);
-       return err;
-}
-
-#define MIC_VRINGH_READ true
-
-/* Determine the total number of bytes consumed in a VRINGH KIOV */
-static inline u32 vop_vringh_iov_consumed(struct vringh_kiov *iov)
-{
-       int i;
-       u32 total = iov->consumed;
-
-       for (i = 0; i < iov->i; i++)
-               total += iov->iov[i].iov_len;
-       return total;
-}
-
-/*
- * Traverse the VRINGH KIOV and issue the APIs to trigger the copies.
- * This API is heavily based on the vringh_iov_xfer(..) implementation
- * in vringh.c. The reason we cannot reuse vringh_iov_pull_kern(..)
- * and vringh_iov_push_kern(..) directly is because there is no
- * way to override the VRINGH xfer(..) routines as of v3.10.
- */
-static int vop_vringh_copy(struct vop_vdev *vdev, struct vringh_kiov *iov,
-                          void __user *ubuf, size_t len, bool read, int vr_idx,
-                          size_t *out_len)
-{
-       int ret = 0;
-       size_t partlen, tot_len = 0;
-
-       while (len && iov->i < iov->used) {
-               struct kvec *kiov = &iov->iov[iov->i];
-               unsigned long daddr = (unsigned long)kiov->iov_base;
-
-               partlen = min(kiov->iov_len, len);
-               if (read)
-                       ret = vop_virtio_copy_to_user(vdev, ubuf, partlen,
-                                                     daddr,
-                                                     kiov->iov_len,
-                                                     vr_idx);
-               else
-                       ret = vop_virtio_copy_from_user(vdev, ubuf, partlen,
-                                                       daddr,
-                                                       kiov->iov_len,
-                                                       vr_idx);
-               if (ret) {
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, ret);
-                       break;
-               }
-               len -= partlen;
-               ubuf += partlen;
-               tot_len += partlen;
-               iov->consumed += partlen;
-               kiov->iov_len -= partlen;
-               kiov->iov_base += partlen;
-               if (!kiov->iov_len) {
-                       /* Fix up old iov element then increment. */
-                       kiov->iov_len = iov->consumed;
-                       kiov->iov_base -= iov->consumed;
-
-                       iov->consumed = 0;
-                       iov->i++;
-               }
-       }
-       *out_len = tot_len;
-       return ret;
-}
-
-/*
- * Use the standard VRINGH infrastructure in the kernel to fetch new
- * descriptors, initiate the copies and update the used ring.
- */
-static int _vop_virtio_copy(struct vop_vdev *vdev, struct mic_copy_desc *copy)
-{
-       int ret = 0;
-       u32 iovcnt = copy->iovcnt;
-       struct iovec iov;
-       struct iovec __user *u_iov = copy->iov;
-       void __user *ubuf = NULL;
-       struct vop_vringh *vvr = &vdev->vvr[copy->vr_idx];
-       struct vringh_kiov *riov = &vvr->riov;
-       struct vringh_kiov *wiov = &vvr->wiov;
-       struct vringh *vrh = &vvr->vrh;
-       u16 *head = &vvr->head;
-       struct mic_vring *vr = &vvr->vring;
-       size_t len = 0, out_len;
-
-       copy->out_len = 0;
-       /* Fetch a new IOVEC if all previous elements have been processed */
-       if (riov->i == riov->used && wiov->i == wiov->used) {
-               ret = vringh_getdesc_kern(vrh, riov, wiov,
-                                         head, GFP_KERNEL);
-               /* Check if there are available descriptors */
-               if (ret <= 0)
-                       return ret;
-       }
-       while (iovcnt) {
-               if (!len) {
-                       /* Copy over a new iovec from user space. */
-                       ret = copy_from_user(&iov, u_iov, sizeof(*u_iov));
-                       if (ret) {
-                               ret = -EINVAL;
-                               dev_err(vop_dev(vdev), "%s %d err %d\n",
-                                       __func__, __LINE__, ret);
-                               break;
-                       }
-                       len = iov.iov_len;
-                       ubuf = iov.iov_base;
-               }
-               /* Issue all the read descriptors first */
-               ret = vop_vringh_copy(vdev, riov, ubuf, len,
-                                     MIC_VRINGH_READ, copy->vr_idx, &out_len);
-               if (ret) {
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, ret);
-                       break;
-               }
-               len -= out_len;
-               ubuf += out_len;
-               copy->out_len += out_len;
-               /* Issue the write descriptors next */
-               ret = vop_vringh_copy(vdev, wiov, ubuf, len,
-                                     !MIC_VRINGH_READ, copy->vr_idx, &out_len);
-               if (ret) {
-                       dev_err(vop_dev(vdev), "%s %d err %d\n",
-                               __func__, __LINE__, ret);
-                       break;
-               }
-               len -= out_len;
-               ubuf += out_len;
-               copy->out_len += out_len;
-               if (!len) {
-                       /* One user space iovec is now completed */
-                       iovcnt--;
-                       u_iov++;
-               }
-               /* Exit loop if all elements in KIOVs have been processed. */
-               if (riov->i == riov->used && wiov->i == wiov->used)
-                       break;
-       }
-       /*
-        * Update the used ring if a descriptor was available and some data was
-        * copied in/out and the user asked for a used ring update.
-        */
-       if (*head != USHRT_MAX && copy->out_len && copy->update_used) {
-               u32 total = 0;
-
-               /* Determine the total data consumed */
-               total += vop_vringh_iov_consumed(riov);
-               total += vop_vringh_iov_consumed(wiov);
-               vringh_complete_kern(vrh, *head, total);
-               *head = USHRT_MAX;
-               if (vringh_need_notify_kern(vrh) > 0)
-                       vringh_notify(vrh);
-               vringh_kiov_cleanup(riov);
-               vringh_kiov_cleanup(wiov);
-               /* Update avail idx for user space */
-               vr->info->avail_idx = vrh->last_avail_idx;
-       }
-       return ret;
-}
-
-static inline int vop_verify_copy_args(struct vop_vdev *vdev,
-                                      struct mic_copy_desc *copy)
-{
-       if (!vdev || copy->vr_idx >= vdev->dd->num_vq)
-               return -EINVAL;
-       return 0;
-}
-
-/* Copy a specified number of virtio descriptors in a chain */
-static int vop_virtio_copy_desc(struct vop_vdev *vdev,
-                               struct mic_copy_desc *copy)
-{
-       int err;
-       struct vop_vringh *vvr;
-
-       err = vop_verify_copy_args(vdev, copy);
-       if (err)
-               return err;
-
-       vvr = &vdev->vvr[copy->vr_idx];
-       mutex_lock(&vvr->vr_mutex);
-       if (!vop_vdevup(vdev)) {
-               err = -ENODEV;
-               dev_err(vop_dev(vdev), "%s %d err %d\n",
-                       __func__, __LINE__, err);
-               goto err;
-       }
-       err = _vop_virtio_copy(vdev, copy);
-       if (err) {
-               dev_err(vop_dev(vdev), "%s %d err %d\n",
-                       __func__, __LINE__, err);
-       }
-err:
-       mutex_unlock(&vvr->vr_mutex);
-       return err;
-}
-
-static int vop_open(struct inode *inode, struct file *f)
-{
-       struct vop_vdev *vdev;
-       struct vop_info *vi = container_of(f->private_data,
-               struct vop_info, miscdev);
-
-       vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
-       if (!vdev)
-               return -ENOMEM;
-       vdev->vi = vi;
-       mutex_init(&vdev->vdev_mutex);
-       f->private_data = vdev;
-       init_completion(&vdev->destroy);
-       complete(&vdev->destroy);
-       return 0;
-}
-
-static int vop_release(struct inode *inode, struct file *f)
-{
-       struct vop_vdev *vdev = f->private_data, *vdev_tmp;
-       struct vop_info *vi = vdev->vi;
-       struct list_head *pos, *tmp;
-       bool found = false;
-
-       mutex_lock(&vdev->vdev_mutex);
-       if (vdev->deleted)
-               goto unlock;
-       mutex_lock(&vi->vop_mutex);
-       list_for_each_safe(pos, tmp, &vi->vdev_list) {
-               vdev_tmp = list_entry(pos, struct vop_vdev, list);
-               if (vdev == vdev_tmp) {
-                       vop_virtio_del_device(vdev);
-                       list_del(pos);
-                       found = true;
-                       break;
-               }
-       }
-       mutex_unlock(&vi->vop_mutex);
-unlock:
-       mutex_unlock(&vdev->vdev_mutex);
-       if (!found)
-               wait_for_completion(&vdev->destroy);
-       f->private_data = NULL;
-       kfree(vdev);
-       return 0;
-}
-
-static long vop_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
-{
-       struct vop_vdev *vdev = f->private_data;
-       struct vop_info *vi = vdev->vi;
-       void __user *argp = (void __user *)arg;
-       int ret;
-
-       switch (cmd) {
-       case MIC_VIRTIO_ADD_DEVICE:
-       {
-               struct mic_device_desc dd, *dd_config;
-
-               if (copy_from_user(&dd, argp, sizeof(dd)))
-                       return -EFAULT;
-
-               if (mic_aligned_desc_size(&dd) > MIC_MAX_DESC_BLK_SIZE ||
-                   dd.num_vq > MIC_MAX_VRINGS)
-                       return -EINVAL;
-
-               dd_config = memdup_user(argp, mic_desc_size(&dd));
-               if (IS_ERR(dd_config))
-                       return PTR_ERR(dd_config);
-
-               /* Ensure desc has not changed between the two reads */
-               if (memcmp(&dd, dd_config, sizeof(dd))) {
-                       ret = -EINVAL;
-                       goto free_ret;
-               }
-               mutex_lock(&vdev->vdev_mutex);
-               mutex_lock(&vi->vop_mutex);
-               ret = vop_virtio_add_device(vdev, dd_config);
-               if (ret)
-                       goto unlock_ret;
-               list_add_tail(&vdev->list, &vi->vdev_list);
-unlock_ret:
-               mutex_unlock(&vi->vop_mutex);
-               mutex_unlock(&vdev->vdev_mutex);
-free_ret:
-               kfree(dd_config);
-               return ret;
-       }
-       case MIC_VIRTIO_COPY_DESC:
-       {
-               struct mic_copy_desc copy;
-
-               mutex_lock(&vdev->vdev_mutex);
-               ret = vop_vdev_inited(vdev);
-               if (ret)
-                       goto _unlock_ret;
-
-               if (copy_from_user(&copy, argp, sizeof(copy))) {
-                       ret = -EFAULT;
-                       goto _unlock_ret;
-               }
-
-               ret = vop_virtio_copy_desc(vdev, &copy);
-               if (ret < 0)
-                       goto _unlock_ret;
-               if (copy_to_user(
-                       &((struct mic_copy_desc __user *)argp)->out_len,
-                       &copy.out_len, sizeof(copy.out_len)))
-                       ret = -EFAULT;
-_unlock_ret:
-               mutex_unlock(&vdev->vdev_mutex);
-               return ret;
-       }
-       case MIC_VIRTIO_CONFIG_CHANGE:
-       {
-               void *buf;
-
-               mutex_lock(&vdev->vdev_mutex);
-               ret = vop_vdev_inited(vdev);
-               if (ret)
-                       goto __unlock_ret;
-               buf = memdup_user(argp, vdev->dd->config_len);
-               if (IS_ERR(buf)) {
-                       ret = PTR_ERR(buf);
-                       goto __unlock_ret;
-               }
-               ret = vop_virtio_config_change(vdev, buf);
-               kfree(buf);
-__unlock_ret:
-               mutex_unlock(&vdev->vdev_mutex);
-               return ret;
-       }
-       default:
-               return -ENOIOCTLCMD;
-       };
-       return 0;
-}
-
-/*
- * We return EPOLLIN | EPOLLOUT from poll when new buffers are enqueued, and
- * not when previously enqueued buffers may be available. This means that
- * in the card->host (TX) path, when userspace is unblocked by poll it
- * must drain all available descriptors or it can stall.
- */
-static __poll_t vop_poll(struct file *f, poll_table *wait)
-{
-       struct vop_vdev *vdev = f->private_data;
-       __poll_t mask = 0;
-
-       mutex_lock(&vdev->vdev_mutex);
-       if (vop_vdev_inited(vdev)) {
-               mask = EPOLLERR;
-               goto done;
-       }
-       poll_wait(f, &vdev->waitq, wait);
-       if (vop_vdev_inited(vdev)) {
-               mask = EPOLLERR;
-       } else if (vdev->poll_wake) {
-               vdev->poll_wake = 0;
-               mask = EPOLLIN | EPOLLOUT;
-       }
-done:
-       mutex_unlock(&vdev->vdev_mutex);
-       return mask;
-}
-
-static inline int
-vop_query_offset(struct vop_vdev *vdev, unsigned long offset,
-                unsigned long *size, unsigned long *pa)
-{
-       struct vop_device *vpdev = vdev->vpdev;
-       unsigned long start = MIC_DP_SIZE;
-       int i;
-
-       /*
-        * MMAP interface is as follows:
-        * offset                               region
-        * 0x0                                  virtio device_page
-        * 0x1000                               first vring
-        * 0x1000 + size of 1st vring           second vring
-        * ....
-        */
-       if (!offset) {
-               *pa = virt_to_phys(vpdev->hw_ops->get_dp(vpdev));
-               *size = MIC_DP_SIZE;
-               return 0;
-       }
-
-       for (i = 0; i < vdev->dd->num_vq; i++) {
-               struct vop_vringh *vvr = &vdev->vvr[i];
-
-               if (offset == start) {
-                       *pa = virt_to_phys(vvr->vring.va);
-                       *size = vvr->vring.len;
-                       return 0;
-               }
-               start += vvr->vring.len;
-       }
-       return -1;
-}
-
-/*
- * Maps the device page and virtio rings to user space for readonly access.
- */
-static int vop_mmap(struct file *f, struct vm_area_struct *vma)
-{
-       struct vop_vdev *vdev = f->private_data;
-       unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
-       unsigned long pa, size = vma->vm_end - vma->vm_start, size_rem = size;
-       int i, err;
-
-       err = vop_vdev_inited(vdev);
-       if (err)
-               goto ret;
-       if (vma->vm_flags & VM_WRITE) {
-               err = -EACCES;
-               goto ret;
-       }
-       while (size_rem) {
-               i = vop_query_offset(vdev, offset, &size, &pa);
-               if (i < 0) {
-                       err = -EINVAL;
-                       goto ret;
-               }
-               err = remap_pfn_range(vma, vma->vm_start + offset,
-                                     pa >> PAGE_SHIFT, size,
-                                     vma->vm_page_prot);
-               if (err)
-                       goto ret;
-               size_rem -= size;
-               offset += size;
-       }
-ret:
-       return err;
-}
-
-static const struct file_operations vop_fops = {
-       .open = vop_open,
-       .release = vop_release,
-       .unlocked_ioctl = vop_ioctl,
-       .poll = vop_poll,
-       .mmap = vop_mmap,
-       .owner = THIS_MODULE,
-};
-
-int vop_host_init(struct vop_info *vi)
-{
-       int rc;
-       struct miscdevice *mdev;
-       struct vop_device *vpdev = vi->vpdev;
-
-       INIT_LIST_HEAD(&vi->vdev_list);
-       vi->dma_ch = vpdev->dma_ch;
-       mdev = &vi->miscdev;
-       mdev->minor = MISC_DYNAMIC_MINOR;
-       snprintf(vi->name, sizeof(vi->name), "vop_virtio%d", vpdev->index);
-       mdev->name = vi->name;
-       mdev->fops = &vop_fops;
-       mdev->parent = &vpdev->dev;
-
-       rc = misc_register(mdev);
-       if (rc)
-               dev_err(&vpdev->dev, "%s failed rc %d\n", __func__, rc);
-       return rc;
-}
-
-void vop_host_uninit(struct vop_info *vi)
-{
-       struct list_head *pos, *tmp;
-       struct vop_vdev *vdev;
-
-       mutex_lock(&vi->vop_mutex);
-       vop_virtio_reset_devices(vi);
-       list_for_each_safe(pos, tmp, &vi->vdev_list) {
-               vdev = list_entry(pos, struct vop_vdev, list);
-               list_del(pos);
-               reinit_completion(&vdev->destroy);
-               mutex_unlock(&vi->vop_mutex);
-               mutex_lock(&vdev->vdev_mutex);
-               vop_virtio_del_device(vdev);
-               vdev->deleted = true;
-               mutex_unlock(&vdev->vdev_mutex);
-               complete(&vdev->destroy);
-               mutex_lock(&vi->vop_mutex);
-       }
-       mutex_unlock(&vi->vop_mutex);
-       misc_deregister(&vi->miscdev);
-}
index f0cb7ae..31481c9 100644 (file)
@@ -302,7 +302,7 @@ config MMC_SDHCI_TEGRA
 config MMC_SDHCI_S3C
        tristate "SDHCI support on Samsung S3C SoC"
        depends on MMC_SDHCI
-       depends on PLAT_SAMSUNG || COMPILE_TEST
+       depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
        help
          This selects the Secure Digital Host Controller Interface (SDHCI)
          often referrered to as the HSMMC block in some of the Samsung S3C
index e3698ab..643d54e 100644 (file)
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/mmc/slot-gpio.h>
-
-#include <plat/gpio-cfg.h>
-#include <mach/dma.h>
-#include <mach/gpio-samsung.h>
-
 #include <linux/platform_data/mmc-s3cmci.h>
 
 #include "s3cmci.h"
@@ -305,7 +300,8 @@ static inline void clear_imask(struct s3cmci_host *host)
 static void s3cmci_check_sdio_irq(struct s3cmci_host *host)
 {
        if (host->sdio_irqen) {
-               if (gpio_get_value(S3C2410_GPE(8)) == 0) {
+               if (host->pdata->bus[3] &&
+                   gpiod_get_value(host->pdata->bus[3]) == 0) {
                        pr_debug("%s: signalling irq\n", __func__);
                        mmc_signal_sdio_irq(host->mmc);
                }
@@ -1201,33 +1197,20 @@ static void s3cmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        switch (ios->power_mode) {
        case MMC_POWER_ON:
        case MMC_POWER_UP:
-               /* Configure GPE5...GPE10 pins in SD mode */
-               if (!host->pdev->dev.of_node)
-                       s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2),
-                                             S3C_GPIO_PULL_NONE);
-
-               if (host->pdata->set_power)
-                       host->pdata->set_power(ios->power_mode, ios->vdd);
-
                if (!host->is2440)
                        mci_con |= S3C2410_SDICON_FIFORESET;
-
                break;
 
        case MMC_POWER_OFF:
        default:
-               if (!host->pdev->dev.of_node)
-                       gpio_direction_output(S3C2410_GPE(5), 0);
-
                if (host->is2440)
                        mci_con |= S3C2440_SDICON_SDRESET;
-
-               if (host->pdata->set_power)
-                       host->pdata->set_power(ios->power_mode, ios->vdd);
-
                break;
        }
 
+       if (host->pdata->set_power)
+               host->pdata->set_power(ios->power_mode, ios->vdd);
+
        s3cmci_set_clk(host, ios);
 
        /* Set CLOCK_ENABLE */
@@ -1305,13 +1288,6 @@ static const struct mmc_host_ops s3cmci_ops = {
        .enable_sdio_irq = s3cmci_enable_sdio_irq,
 };
 
-static struct s3c24xx_mci_pdata s3cmci_def_pdata = {
-       /* This is currently here to avoid a number of if (host->pdata)
-        * checks. Any zero fields to ensure reasonable defaults are picked. */
-        .no_wprotect = 1,
-        .no_detect = 1,
-};
-
 #ifdef CONFIG_ARM_S3C24XX_CPUFREQ
 
 static int s3cmci_cpufreq_transition(struct notifier_block *nb,
@@ -1465,24 +1441,21 @@ static int s3cmci_probe_pdata(struct s3cmci_host *host)
        int i, ret;
 
        host->is2440 = platform_get_device_id(pdev)->driver_data;
+       pdata = pdev->dev.platform_data;
+       if (!pdata) {
+               dev_err(&pdev->dev, "need platform data");
+               return -ENXIO;
+       }
 
-       for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) {
-               ret = gpio_request(i, dev_name(&pdev->dev));
-               if (ret) {
+       for (i = 0; i < 6; i++) {
+               pdata->bus[i] = devm_gpiod_get_index(&pdev->dev, "bus", i,
+                                                    GPIOD_OUT_LOW);
+               if (IS_ERR(pdata->bus[i])) {
                        dev_err(&pdev->dev, "failed to get gpio %d\n", i);
-
-                       for (i--; i >= S3C2410_GPE(5); i--)
-                               gpio_free(i);
-
-                       return ret;
+                       return PTR_ERR(pdata->bus[i]);
                }
        }
 
-       if (!pdev->dev.platform_data)
-               pdev->dev.platform_data = &s3cmci_def_pdata;
-
-       pdata = pdev->dev.platform_data;
-
        if (pdata->no_wprotect)
                mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
 
@@ -1537,7 +1510,6 @@ static int s3cmci_probe(struct platform_device *pdev)
        struct s3cmci_host *host;
        struct mmc_host *mmc;
        int ret;
-       int i;
 
        mmc = mmc_alloc_host(sizeof(struct s3cmci_host), &pdev->dev);
        if (!mmc) {
@@ -1581,7 +1553,7 @@ static int s3cmci_probe(struct platform_device *pdev)
                        "failed to get io memory region resource.\n");
 
                ret = -ENOENT;
-               goto probe_free_gpio;
+               goto probe_free_host;
        }
 
        host->mem = request_mem_region(host->mem->start,
@@ -1590,7 +1562,7 @@ static int s3cmci_probe(struct platform_device *pdev)
        if (!host->mem) {
                dev_err(&pdev->dev, "failed to request io memory region.\n");
                ret = -ENOENT;
-               goto probe_free_gpio;
+               goto probe_free_host;
        }
 
        host->base = ioremap(host->mem->start, resource_size(host->mem));
@@ -1714,11 +1686,6 @@ static int s3cmci_probe(struct platform_device *pdev)
  probe_free_mem_region:
        release_mem_region(host->mem->start, resource_size(host->mem));
 
- probe_free_gpio:
-       if (!pdev->dev.of_node)
-               for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++)
-                       gpio_free(i);
-
  probe_free_host:
        mmc_free_host(mmc);
 
@@ -1744,7 +1711,6 @@ static int s3cmci_remove(struct platform_device *pdev)
 {
        struct mmc_host         *mmc  = platform_get_drvdata(pdev);
        struct s3cmci_host      *host = mmc_priv(mmc);
-       int i;
 
        s3cmci_shutdown(pdev);
 
@@ -1757,10 +1723,6 @@ static int s3cmci_remove(struct platform_device *pdev)
 
        free_irq(host->irq, host);
 
-       if (!pdev->dev.of_node)
-               for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++)
-                       gpio_free(i);
-
        iounmap(host->base);
        release_mem_region(host->mem->start, resource_size(host->mem));
 
index a30796e..6de02f0 100644 (file)
@@ -5,6 +5,7 @@
  * Copyright (c) 2007 Freescale Semiconductor, Inc.
  * Copyright (c) 2009 MontaVista Software, Inc.
  * Copyright (c) 2010 Pengutronix e.K.
+ * Copyright 2020 NXP
  *   Author: Wolfram Sang <kernel@pengutronix.de>
  */
 
@@ -88,6 +89,7 @@
 /* DLL Config 0 Register */
 #define ESDHC_DLLCFG0                  0x160
 #define ESDHC_DLL_ENABLE               0x80000000
+#define ESDHC_DLL_RESET                        0x40000000
 #define ESDHC_DLL_FREQ_SEL             0x08000000
 
 /* DLL Config 1 Register */
index 0b45eff..bb09445 100644 (file)
@@ -4,6 +4,7 @@
  *
  * Copyright (c) 2007, 2010, 2012 Freescale Semiconductor, Inc.
  * Copyright (c) 2009 MontaVista Software, Inc.
+ * Copyright 2020 NXP
  *
  * Authors: Xiaobo Xie <X.Xie@freescale.com>
  *         Anton Vorontsov <avorontsov@ru.mvista.com>
@@ -19,6 +20,7 @@
 #include <linux/clk.h>
 #include <linux/ktime.h>
 #include <linux/dma-mapping.h>
+#include <linux/iopoll.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/mmc.h>
 #include "sdhci-pltfm.h"
@@ -743,6 +745,21 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
                if (host->mmc->actual_clock == MMC_HS200_MAX_DTR)
                        temp |= ESDHC_DLL_FREQ_SEL;
                sdhci_writel(host, temp, ESDHC_DLLCFG0);
+
+               temp |= ESDHC_DLL_RESET;
+               sdhci_writel(host, temp, ESDHC_DLLCFG0);
+               udelay(1);
+               temp &= ~ESDHC_DLL_RESET;
+               sdhci_writel(host, temp, ESDHC_DLLCFG0);
+
+               /* Wait max 20 ms */
+               if (read_poll_timeout(sdhci_readl, temp,
+                                     temp & ESDHC_DLL_STS_SLV_LOCK,
+                                     10, 20000, false,
+                                     host, ESDHC_DLLSTAT0))
+                       pr_err("%s: timeout for delay chain lock.\n",
+                              mmc_hostname(host->mmc));
+
                temp = sdhci_readl(host, ESDHC_TBCTL);
                sdhci_writel(host, temp | ESDHC_HS400_WNDW_ADJUST, ESDHC_TBCTL);
 
@@ -1052,6 +1069,17 @@ static int esdhc_execute_tuning(struct mmc_host *mmc, u32 opcode)
 
        esdhc_tuning_block_enable(host, true);
 
+       /*
+        * The eSDHC controller takes the data timeout value into account
+        * during tuning. If the SD card is too slow sending the response, the
+        * timer will expire and a "Buffer Read Ready" interrupt without data
+        * is triggered. This leads to tuning errors.
+        *
+        * Just set the timeout to the maximum value because the core will
+        * already take care of it in sdhci_send_tuning().
+        */
+       sdhci_writeb(host, 0xe, SDHCI_TIMEOUT_CONTROL);
+
        hs400_tuning = host->flags & SDHCI_HS400_TUNING;
 
        do {
index 592a55a..3561ae8 100644 (file)
@@ -1384,9 +1384,11 @@ static inline void sdhci_auto_cmd_select(struct sdhci_host *host,
        /*
         * In case of Version 4.10 or later, use of 'Auto CMD Auto
         * Select' is recommended rather than use of 'Auto CMD12
-        * Enable' or 'Auto CMD23 Enable'.
+        * Enable' or 'Auto CMD23 Enable'. We require Version 4 Mode
+        * here because some controllers (e.g sdhci-of-dwmshc) expect it.
         */
-       if (host->version >= SDHCI_SPEC_410 && (use_cmd12 || use_cmd23)) {
+       if (host->version >= SDHCI_SPEC_410 && host->v4_mode &&
+           (use_cmd12 || use_cmd23)) {
                *mode |= SDHCI_TRNS_AUTO_SEL;
 
                ctrl2 = sdhci_readw(host, SDHCI_HOST_CONTROL2);
index 0e7a9b6..e345f9d 100644 (file)
@@ -707,6 +707,30 @@ static int fsl_ifc_attach_chip(struct nand_chip *chip)
 {
        struct mtd_info *mtd = nand_to_mtd(chip);
        struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
+       struct fsl_ifc_ctrl *ctrl = priv->ctrl;
+       struct fsl_ifc_global __iomem *ifc_global = ctrl->gregs;
+       u32 csor;
+
+       csor = ifc_in32(&ifc_global->csor_cs[priv->bank].csor);
+
+       /* Must also set CSOR_NAND_ECC_ENC_EN if DEC_EN set */
+       if (csor & CSOR_NAND_ECC_DEC_EN) {
+               chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
+               mtd_set_ooblayout(mtd, &fsl_ifc_ooblayout_ops);
+
+               /* Hardware generates ECC per 512 Bytes */
+               chip->ecc.size = 512;
+               if ((csor & CSOR_NAND_ECC_MODE_MASK) == CSOR_NAND_ECC_MODE_4) {
+                       chip->ecc.bytes = 8;
+                       chip->ecc.strength = 4;
+               } else {
+                       chip->ecc.bytes = 16;
+                       chip->ecc.strength = 8;
+               }
+       } else {
+               chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
+               chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
+       }
 
        dev_dbg(priv->dev, "%s: nand->numchips = %d\n", __func__,
                nanddev_ntargets(&chip->base));
@@ -910,25 +934,6 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
                return -ENODEV;
        }
 
-       /* Must also set CSOR_NAND_ECC_ENC_EN if DEC_EN set */
-       if (csor & CSOR_NAND_ECC_DEC_EN) {
-               chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
-               mtd_set_ooblayout(mtd, &fsl_ifc_ooblayout_ops);
-
-               /* Hardware generates ECC per 512 Bytes */
-               chip->ecc.size = 512;
-               if ((csor & CSOR_NAND_ECC_MODE_MASK) == CSOR_NAND_ECC_MODE_4) {
-                       chip->ecc.bytes = 8;
-                       chip->ecc.strength = 4;
-               } else {
-                       chip->ecc.bytes = 16;
-                       chip->ecc.strength = 8;
-               }
-       } else {
-               chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
-               chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
-       }
-
        ret = fsl_ifc_sram_init(priv);
        if (ret)
                return ret;
index d4200eb..684c51e 100644 (file)
@@ -1681,6 +1681,11 @@ static int mxcnd_attach_chip(struct nand_chip *chip)
        struct mxc_nand_host *host = nand_get_controller_data(chip);
        struct device *dev = mtd->dev.parent;
 
+       chip->ecc.bytes = host->devtype_data->eccbytes;
+       host->eccsize = host->devtype_data->eccsize;
+       chip->ecc.size = 512;
+       mtd_set_ooblayout(mtd, host->devtype_data->ooblayout);
+
        switch (chip->ecc.engine_type) {
        case NAND_ECC_ENGINE_TYPE_ON_HOST:
                chip->ecc.read_page = mxc_nand_read_page;
@@ -1836,19 +1841,7 @@ static int mxcnd_probe(struct platform_device *pdev)
        if (host->devtype_data->axi_offset)
                host->regs_axi = host->base + host->devtype_data->axi_offset;
 
-       this->ecc.bytes = host->devtype_data->eccbytes;
-       host->eccsize = host->devtype_data->eccsize;
-
        this->legacy.select_chip = host->devtype_data->select_chip;
-       this->ecc.size = 512;
-       mtd_set_ooblayout(mtd, host->devtype_data->ooblayout);
-
-       if (host->pdata.hw_ecc) {
-               this->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
-       } else {
-               this->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
-               this->ecc.algo = NAND_ECC_ALGO_HAMMING;
-       }
 
        /* NAND bus width determines access functions used by upper layer */
        if (host->pdata.width == 2)
index b31a581..550bda4 100644 (file)
@@ -1708,6 +1708,13 @@ static int stm32_fmc2_nfc_attach_chip(struct nand_chip *chip)
                return -EINVAL;
        }
 
+       /* Default ECC settings in case they are not set in the device tree */
+       if (!chip->ecc.size)
+               chip->ecc.size = FMC2_ECC_STEP_SIZE;
+
+       if (!chip->ecc.strength)
+               chip->ecc.strength = FMC2_ECC_BCH8;
+
        ret = nand_ecc_choose_conf(chip, &stm32_fmc2_nfc_ecc_caps,
                                   mtd->oobsize - FMC2_BBM_LEN);
        if (ret) {
@@ -1727,8 +1734,7 @@ static int stm32_fmc2_nfc_attach_chip(struct nand_chip *chip)
 
        mtd_set_ooblayout(mtd, &stm32_fmc2_nfc_ooblayout_ops);
 
-       if (chip->options & NAND_BUSWIDTH_16)
-               stm32_fmc2_nfc_set_buswidth_16(nfc, true);
+       stm32_fmc2_nfc_setup(chip);
 
        return 0;
 }
@@ -1952,11 +1958,6 @@ static int stm32_fmc2_nfc_probe(struct platform_device *pdev)
        chip->options |= NAND_BUSWIDTH_AUTO | NAND_NO_SUBPAGE_WRITE |
                         NAND_USES_DMA;
 
-       /* Default ECC settings */
-       chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
-       chip->ecc.size = FMC2_ECC_STEP_SIZE;
-       chip->ecc.strength = FMC2_ECC_BCH8;
-
        /* Scan to find existence of the device */
        ret = nand_scan(chip, nand->ncs);
        if (ret)
index 0369d98..f0ae7a0 100644 (file)
@@ -2701,11 +2701,10 @@ static void spi_nor_sfdp_init_params(struct spi_nor *nor)
 
        memcpy(&sfdp_params, nor->params, sizeof(sfdp_params));
 
-       if (spi_nor_parse_sfdp(nor, &sfdp_params)) {
+       if (spi_nor_parse_sfdp(nor, nor->params)) {
+               memcpy(nor->params, &sfdp_params, sizeof(*nor->params));
                nor->addr_width = 0;
                nor->flags &= ~SNOR_F_4B_OPCODES;
-       } else {
-               memcpy(nor->params, &sfdp_params, sizeof(*nor->params));
        }
 }
 
@@ -3009,13 +3008,15 @@ static int spi_nor_set_addr_width(struct spi_nor *nor)
                /* already configured from SFDP */
        } else if (nor->info->addr_width) {
                nor->addr_width = nor->info->addr_width;
-       } else if (nor->mtd.size > 0x1000000) {
-               /* enable 4-byte addressing if the device exceeds 16MiB */
-               nor->addr_width = 4;
        } else {
                nor->addr_width = 3;
        }
 
+       if (nor->addr_width == 3 && nor->mtd.size > 0x1000000) {
+               /* enable 4-byte addressing if the device exceeds 16MiB */
+               nor->addr_width = 4;
+       }
+
        if (nor->addr_width > SPI_NOR_MAX_ADDR_WIDTH) {
                dev_dbg(nor->dev, "address width is too large: %u\n",
                        nor->addr_width);
index c3dbe64..4ee4192 100644 (file)
@@ -426,6 +426,13 @@ config VSOCKMON
          mostly intended for developers or support to debug vsock issues. If
          unsure, say N.
 
+config MHI_NET
+       tristate "MHI network driver"
+       depends on MHI_BUS
+       help
+         This is the network driver for MHI bus.  It can be used with
+         QCOM based WWAN modems (like SDX55).  Say Y or M.
+
 endif # NET_CORE
 
 config SUNGEM_PHY
@@ -489,8 +496,6 @@ source "drivers/net/usb/Kconfig"
 
 source "drivers/net/wireless/Kconfig"
 
-source "drivers/net/wimax/Kconfig"
-
 source "drivers/net/wan/Kconfig"
 
 source "drivers/net/ieee802154/Kconfig"
index 72e18d5..36e2e41 100644 (file)
@@ -36,6 +36,7 @@ obj-$(CONFIG_GTP) += gtp.o
 obj-$(CONFIG_NLMON) += nlmon.o
 obj-$(CONFIG_NET_VRF) += vrf.o
 obj-$(CONFIG_VSOCKMON) += vsockmon.o
+obj-$(CONFIG_MHI_NET) += mhi_net.o
 
 #
 # Networking Drivers
@@ -66,7 +67,6 @@ obj-$(CONFIG_NET_SB1000) += sb1000.o
 obj-$(CONFIG_SUNGEM_PHY) += sungem_phy.o
 obj-$(CONFIG_WAN) += wan/
 obj-$(CONFIG_WLAN) += wireless/
-obj-$(CONFIG_WIMAX) += wimax/
 obj-$(CONFIG_IEEE802154) += ieee802154/
 
 obj-$(CONFIG_VMXNET3) += vmxnet3/
index ff0bea1..28257bc 100644 (file)
@@ -510,7 +510,7 @@ static const struct net_device_ops bareudp_netdev_ops = {
        .ndo_open               = bareudp_open,
        .ndo_stop               = bareudp_stop,
        .ndo_start_xmit         = bareudp_xmit,
-       .ndo_get_stats64        = ip_tunnel_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_fill_metadata_dst  = bareudp_fill_metadata_dst,
 };
 
index 84ecbc6..71c9677 100644 (file)
@@ -1228,14 +1228,14 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
 }
 
 #define BOND_VLAN_FEATURES     (NETIF_F_HW_CSUM | NETIF_F_SG | \
-                                NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
+                                NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | \
                                 NETIF_F_HIGHDMA | NETIF_F_LRO)
 
 #define BOND_ENC_FEATURES      (NETIF_F_HW_CSUM | NETIF_F_SG | \
-                                NETIF_F_RXCSUM | NETIF_F_ALL_TSO)
+                                NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE)
 
 #define BOND_MPLS_FEATURES     (NETIF_F_HW_CSUM | NETIF_F_SG | \
-                                NETIF_F_ALL_TSO)
+                                NETIF_F_GSO_SOFTWARE)
 
 
 static void bond_compute_features(struct bonding *bond)
@@ -1291,8 +1291,7 @@ done:
        bond_dev->vlan_features = vlan_features;
        bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |
                                    NETIF_F_HW_VLAN_CTAG_TX |
-                                   NETIF_F_HW_VLAN_STAG_TX |
-                                   NETIF_F_GSO_UDP_L4;
+                                   NETIF_F_HW_VLAN_STAG_TX;
 #ifdef CONFIG_XFRM_OFFLOAD
        bond_dev->hw_enc_features |= xfrm_features;
 #endif /* CONFIG_XFRM_OFFLOAD */
@@ -4721,7 +4720,7 @@ void bond_setup(struct net_device *bond_dev)
                                NETIF_F_HW_VLAN_CTAG_RX |
                                NETIF_F_HW_VLAN_CTAG_FILTER;
 
-       bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4;
+       bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
 #ifdef CONFIG_XFRM_OFFLOAD
        bond_dev->hw_features |= BOND_XFRM_FEATURES;
 #endif /* CONFIG_XFRM_OFFLOAD */
index b70ded3..6dee4f8 100644 (file)
@@ -512,9 +512,13 @@ __can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr)
                 */
                struct sk_buff *skb = priv->echo_skb[idx];
                struct canfd_frame *cf = (struct canfd_frame *)skb->data;
-               u8 len = cf->len;
 
-               *len_ptr = len;
+               /* get the real payload length for netdev statistics */
+               if (cf->can_id & CAN_RTR_FLAG)
+                       *len_ptr = 0;
+               else
+                       *len_ptr = cf->len;
+
                priv->echo_skb[idx] = NULL;
 
                return skb;
@@ -538,7 +542,11 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx)
        if (!skb)
                return 0;
 
-       netif_rx(skb);
+       skb_get(skb);
+       if (netif_rx(skb) == NET_RX_SUCCESS)
+               dev_consume_skb_any(skb);
+       else
+               dev_kfree_skb_any(skb);
 
        return len;
 }
index 4d594e9..881799b 100644 (file)
  *   MX8MP FlexCAN3  03.00.17.01    yes       yes        no      yes       yes          yes
  *   VF610 FlexCAN3  ?               no       yes        no      yes       yes?          no
  * LS1021A FlexCAN2  03.00.04.00     no       yes        no       no       yes           no
- * LX2160A FlexCAN3  03.00.23.00     no       yes        no       no       yes          yes
+ * LX2160A FlexCAN3  03.00.23.00     no       yes        no      yes       yes          yes
  *
  * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected.
  */
@@ -400,19 +400,19 @@ static struct flexcan_devtype_data fsl_imx8mp_devtype_data = {
 static const struct flexcan_devtype_data fsl_vf610_devtype_data = {
        .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
                FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP |
-               FLEXCAN_QUIRK_BROKEN_PERR_STATE,
+               FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SUPPORT_ECC,
 };
 
 static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data = {
        .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
-               FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE |
-               FLEXCAN_QUIRK_USE_OFF_TIMESTAMP,
+               FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP,
 };
 
 static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = {
        .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
                FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE |
-               FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_SUPPORT_FD,
+               FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_SUPPORT_FD |
+               FLEXCAN_QUIRK_SUPPORT_ECC,
 };
 
 static const struct can_bittiming_const flexcan_bittiming_const = {
@@ -2062,6 +2062,8 @@ static int flexcan_remove(struct platform_device *pdev)
 {
        struct net_device *dev = platform_get_drvdata(pdev);
 
+       device_set_wakeup_enable(&pdev->dev, false);
+       device_set_wakeup_capable(&pdev->dev, false);
        unregister_flexcandev(dev);
        pm_runtime_disable(&pdev->dev);
        free_candev(dev);
index 10aa3e4..40c33b8 100644 (file)
@@ -262,8 +262,7 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv,
                cf_len = get_can_dlc(pucan_msg_get_dlc(msg));
 
        /* if this frame is an echo, */
-       if ((rx_msg_flags & PUCAN_MSG_LOOPED_BACK) &&
-           !(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) {
+       if (rx_msg_flags & PUCAN_MSG_LOOPED_BACK) {
                unsigned long flags;
 
                spin_lock_irqsave(&priv->echo_lock, flags);
@@ -277,7 +276,13 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv,
                netif_wake_queue(priv->ndev);
 
                spin_unlock_irqrestore(&priv->echo_lock, flags);
-               return 0;
+
+               /* if this frame is only an echo, stop here. Otherwise,
+                * continue to push this application self-received frame into
+                * its own rx queue.
+                */
+               if (!(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE))
+                       return 0;
        }
 
        /* otherwise, it should be pushed into rx fifo */
index 3b18026..6e95193 100644 (file)
@@ -245,7 +245,7 @@ int can_rx_offload_queue_sorted(struct can_rx_offload *offload,
 
        if (skb_queue_len(&offload->skb_queue) >
            offload->skb_queue_len_max) {
-               kfree_skb(skb);
+               dev_kfree_skb_any(skb);
                return -ENOBUFS;
        }
 
@@ -290,7 +290,7 @@ int can_rx_offload_queue_tail(struct can_rx_offload *offload,
 {
        if (skb_queue_len(&offload->skb_queue) >
            offload->skb_queue_len_max) {
-               kfree_skb(skb);
+               dev_kfree_skb_any(skb);
                return -ENOBUFS;
        }
 
index c3f4954..9c215f7 100644 (file)
@@ -75,11 +75,11 @@ static const char *__mcp251xfd_get_model_str(enum mcp251xfd_model model)
 {
        switch (model) {
        case MCP251XFD_MODEL_MCP2517FD:
-               return "MCP2517FD"; break;
+               return "MCP2517FD";
        case MCP251XFD_MODEL_MCP2518FD:
-               return "MCP2518FD"; break;
+               return "MCP2518FD";
        case MCP251XFD_MODEL_MCP251XFD:
-               return "MCP251xFD"; break;
+               return "MCP251xFD";
        }
 
        return "<unknown>";
@@ -95,21 +95,21 @@ static const char *mcp251xfd_get_mode_str(const u8 mode)
 {
        switch (mode) {
        case MCP251XFD_REG_CON_MODE_MIXED:
-               return "Mixed (CAN FD/CAN 2.0)"; break;
+               return "Mixed (CAN FD/CAN 2.0)";
        case MCP251XFD_REG_CON_MODE_SLEEP:
-               return "Sleep"; break;
+               return "Sleep";
        case MCP251XFD_REG_CON_MODE_INT_LOOPBACK:
-               return "Internal Loopback"; break;
+               return "Internal Loopback";
        case MCP251XFD_REG_CON_MODE_LISTENONLY:
-               return "Listen Only"; break;
+               return "Listen Only";
        case MCP251XFD_REG_CON_MODE_CONFIG:
-               return "Configuration"; break;
+               return "Configuration";
        case MCP251XFD_REG_CON_MODE_EXT_LOOPBACK:
-               return "External Loopback"; break;
+               return "External Loopback";
        case MCP251XFD_REG_CON_MODE_CAN2_0:
-               return "CAN 2.0"; break;
+               return "CAN 2.0";
        case MCP251XFD_REG_CON_MODE_RESTRICTED:
-               return "Restricted Operation"; break;
+               return "Restricted Operation";
        }
 
        return "<unknown>";
index ba25902..314f868 100644 (file)
@@ -173,7 +173,7 @@ mcp251xfd_regmap_nocrc_read(void *context,
                memcpy(&buf_tx->cmd, reg, sizeof(buf_tx->cmd));
                if (MCP251XFD_SANITIZE_SPI)
                        memset(buf_tx->data, 0x0, val_len);
-       };
+       }
 
        err = spi_sync(spi, &msg);
        if (err)
@@ -330,17 +330,17 @@ mcp251xfd_regmap_crc_read(void *context,
                        goto out;
                }
 
-               netdev_dbg(priv->ndev,
-                          "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x) retrying.\n",
-                          reg, val_len, (int)val_len, buf_rx->data,
-                          get_unaligned_be16(buf_rx->data + val_len));
-       }
-
-       if (err) {
                netdev_info(priv->ndev,
-                           "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x).\n",
+                           "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x) retrying.\n",
                            reg, val_len, (int)val_len, buf_rx->data,
                            get_unaligned_be16(buf_rx->data + val_len));
+       }
+
+       if (err) {
+               netdev_err(priv->ndev,
+                          "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x).\n",
+                          reg, val_len, (int)val_len, buf_rx->data,
+                          get_unaligned_be16(buf_rx->data + val_len));
 
                return err;
        }
index 1d63006..9913f54 100644 (file)
@@ -933,7 +933,7 @@ static int ti_hecc_probe(struct platform_device *pdev)
        err = clk_prepare_enable(priv->clk);
        if (err) {
                dev_err(&pdev->dev, "clk_prepare_enable() failed\n");
-               goto probe_exit_clk;
+               goto probe_exit_release_clk;
        }
 
        priv->offload.mailbox_read = ti_hecc_mailbox_read;
@@ -942,7 +942,7 @@ static int ti_hecc_probe(struct platform_device *pdev)
        err = can_rx_offload_add_timestamp(ndev, &priv->offload);
        if (err) {
                dev_err(&pdev->dev, "can_rx_offload_add_timestamp() failed\n");
-               goto probe_exit_clk;
+               goto probe_exit_disable_clk;
        }
 
        err = register_candev(ndev);
@@ -960,7 +960,9 @@ static int ti_hecc_probe(struct platform_device *pdev)
 
 probe_exit_offload:
        can_rx_offload_del(&priv->offload);
-probe_exit_clk:
+probe_exit_disable_clk:
+       clk_disable_unprepare(priv->clk);
+probe_exit_release_clk:
        clk_put(priv->clk);
 probe_exit_candev:
        free_candev(ndev);
index d91df34..c276479 100644 (file)
@@ -130,14 +130,55 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time)
        /* protect from getting time before setting now */
        if (ktime_to_ns(time_ref->tv_host)) {
                u64 delta_us;
+               s64 delta_ts = 0;
+
+               /* General case: dev_ts_1 < dev_ts_2 < ts, with:
+                *
+                * - dev_ts_1 = previous sync timestamp
+                * - dev_ts_2 = last sync timestamp
+                * - ts = event timestamp
+                * - ts_period = known sync period (theoretical)
+                *             ~ dev_ts2 - dev_ts1
+                * *but*:
+                *
+                * - time counters wrap (see adapter->ts_used_bits)
+                * - sometimes, dev_ts_1 < ts < dev_ts2
+                *
+                * "normal" case (sync time counters increase):
+                * must take into account case when ts wraps (tsw)
+                *
+                *      < ts_period > <          >
+                *     |             |            |
+                *  ---+--------+----+-------0-+--+-->
+                *     ts_dev_1 |    ts_dev_2  |
+                *              ts             tsw
+                */
+               if (time_ref->ts_dev_1 < time_ref->ts_dev_2) {
+                       /* case when event time (tsw) wraps */
+                       if (ts < time_ref->ts_dev_1)
+                               delta_ts = 1 << time_ref->adapter->ts_used_bits;
+
+               /* Otherwise, sync time counter (ts_dev_2) has wrapped:
+                * handle case when event time (tsn) hasn't.
+                *
+                *      < ts_period > <          >
+                *     |             |            |
+                *  ---+--------+--0-+---------+--+-->
+                *     ts_dev_1 |    ts_dev_2  |
+                *              tsn            ts
+                */
+               } else if (time_ref->ts_dev_1 < ts) {
+                       delta_ts = -(1 << time_ref->adapter->ts_used_bits);
+               }
 
-               delta_us = ts - time_ref->ts_dev_2;
-               if (ts < time_ref->ts_dev_2)
-                       delta_us &= (1 << time_ref->adapter->ts_used_bits) - 1;
+               /* add delay between last sync and event timestamps */
+               delta_ts += (signed int)(ts - time_ref->ts_dev_2);
 
-               delta_us += time_ref->ts_total;
+               /* add time from beginning to last sync */
+               delta_ts += time_ref->ts_total;
 
-               delta_us *= time_ref->adapter->us_per_ts_scale;
+               /* convert ticks number into microseconds */
+               delta_us = delta_ts * time_ref->adapter->us_per_ts_scale;
                delta_us >>= time_ref->adapter->us_per_ts_shift;
 
                *time = ktime_add_us(time_ref->tv_host_0, delta_us);
index ab63fd9..d29d205 100644 (file)
@@ -468,12 +468,18 @@ static int pcan_usb_fd_decode_canmsg(struct pcan_usb_fd_if *usb_if,
                                     struct pucan_msg *rx_msg)
 {
        struct pucan_rx_msg *rm = (struct pucan_rx_msg *)rx_msg;
-       struct peak_usb_device *dev = usb_if->dev[pucan_msg_get_channel(rm)];
-       struct net_device *netdev = dev->netdev;
+       struct peak_usb_device *dev;
+       struct net_device *netdev;
        struct canfd_frame *cfd;
        struct sk_buff *skb;
        const u16 rx_msg_flags = le16_to_cpu(rm->flags);
 
+       if (pucan_msg_get_channel(rm) >= ARRAY_SIZE(usb_if->dev))
+               return -ENOMEM;
+
+       dev = usb_if->dev[pucan_msg_get_channel(rm)];
+       netdev = dev->netdev;
+
        if (rx_msg_flags & PUCAN_MSG_EXT_DATA_LEN) {
                /* CANFD frame case */
                skb = alloc_canfd_skb(netdev, &cfd);
@@ -519,15 +525,21 @@ static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if,
                                     struct pucan_msg *rx_msg)
 {
        struct pucan_status_msg *sm = (struct pucan_status_msg *)rx_msg;
-       struct peak_usb_device *dev = usb_if->dev[pucan_stmsg_get_channel(sm)];
-       struct pcan_usb_fd_device *pdev =
-                       container_of(dev, struct pcan_usb_fd_device, dev);
+       struct pcan_usb_fd_device *pdev;
        enum can_state new_state = CAN_STATE_ERROR_ACTIVE;
        enum can_state rx_state, tx_state;
-       struct net_device *netdev = dev->netdev;
+       struct peak_usb_device *dev;
+       struct net_device *netdev;
        struct can_frame *cf;
        struct sk_buff *skb;
 
+       if (pucan_stmsg_get_channel(sm) >= ARRAY_SIZE(usb_if->dev))
+               return -ENOMEM;
+
+       dev = usb_if->dev[pucan_stmsg_get_channel(sm)];
+       pdev = container_of(dev, struct pcan_usb_fd_device, dev);
+       netdev = dev->netdev;
+
        /* nothing should be sent while in BUS_OFF state */
        if (dev->can.state == CAN_STATE_BUS_OFF)
                return 0;
@@ -579,9 +591,14 @@ static int pcan_usb_fd_decode_error(struct pcan_usb_fd_if *usb_if,
                                    struct pucan_msg *rx_msg)
 {
        struct pucan_error_msg *er = (struct pucan_error_msg *)rx_msg;
-       struct peak_usb_device *dev = usb_if->dev[pucan_ermsg_get_channel(er)];
-       struct pcan_usb_fd_device *pdev =
-                       container_of(dev, struct pcan_usb_fd_device, dev);
+       struct pcan_usb_fd_device *pdev;
+       struct peak_usb_device *dev;
+
+       if (pucan_ermsg_get_channel(er) >= ARRAY_SIZE(usb_if->dev))
+               return -EINVAL;
+
+       dev = usb_if->dev[pucan_ermsg_get_channel(er)];
+       pdev = container_of(dev, struct pcan_usb_fd_device, dev);
 
        /* keep a trace of tx and rx error counters for later use */
        pdev->bec.txerr = er->tx_err_cnt;
@@ -595,11 +612,17 @@ static int pcan_usb_fd_decode_overrun(struct pcan_usb_fd_if *usb_if,
                                      struct pucan_msg *rx_msg)
 {
        struct pcan_ufd_ovr_msg *ov = (struct pcan_ufd_ovr_msg *)rx_msg;
-       struct peak_usb_device *dev = usb_if->dev[pufd_omsg_get_channel(ov)];
-       struct net_device *netdev = dev->netdev;
+       struct peak_usb_device *dev;
+       struct net_device *netdev;
        struct can_frame *cf;
        struct sk_buff *skb;
 
+       if (pufd_omsg_get_channel(ov) >= ARRAY_SIZE(usb_if->dev))
+               return -EINVAL;
+
+       dev = usb_if->dev[pufd_omsg_get_channel(ov)];
+       netdev = dev->netdev;
+
        /* allocate an skb to store the error frame */
        skb = alloc_can_err_skb(netdev, &cf);
        if (!skb)
@@ -716,6 +739,9 @@ static int pcan_usb_fd_encode_msg(struct peak_usb_device *dev,
        u16 tx_msg_size, tx_msg_flags;
        u8 can_dlc;
 
+       if (cfd->len > CANFD_MAX_DLEN)
+               return -EINVAL;
+
        tx_msg_size = ALIGN(sizeof(struct pucan_tx_msg) + cfd->len, 4);
        tx_msg->size = cpu_to_le16(tx_msg_size);
        tx_msg->type = cpu_to_le16(PUCAN_MSG_CAN_TX);
index 6c4d00d..48d746e 100644 (file)
@@ -1395,7 +1395,7 @@ static int xcan_open(struct net_device *ndev)
        if (ret < 0) {
                netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
                           __func__, ret);
-               return ret;
+               goto err;
        }
 
        ret = request_irq(ndev->irq, xcan_interrupt, priv->irq_flags,
@@ -1479,6 +1479,7 @@ static int xcan_get_berr_counter(const struct net_device *ndev,
        if (ret < 0) {
                netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
                           __func__, ret);
+               pm_runtime_put(priv->dev);
                return ret;
        }
 
@@ -1793,7 +1794,7 @@ static int xcan_probe(struct platform_device *pdev)
        if (ret < 0) {
                netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
                           __func__, ret);
-               goto err_pmdisable;
+               goto err_disableclks;
        }
 
        if (priv->read_reg(priv, XCAN_SR_OFFSET) != XCAN_SR_CONFIG_MASK) {
@@ -1828,7 +1829,6 @@ static int xcan_probe(struct platform_device *pdev)
 
 err_disableclks:
        pm_runtime_put(priv->dev);
-err_pmdisable:
        pm_runtime_disable(&pdev->dev);
 err_free:
        free_candev(ndev);
index 2451f61..f6a0488 100644 (file)
@@ -24,6 +24,8 @@ config NET_DSA_LOOP
          This enables support for a fake mock-up switch chip which
          exercises the DSA APIs.
 
+source "drivers/net/dsa/hirschmann/Kconfig"
+
 config NET_DSA_LANTIQ_GSWIP
        tristate "Lantiq / Intel GSWIP"
        depends on HAS_IOMEM && NET_DSA
index 4a943cc..a84adb1 100644 (file)
@@ -18,6 +18,7 @@ obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX) += vitesse-vsc73xx-core.o
 obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM) += vitesse-vsc73xx-platform.o
 obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_SPI) += vitesse-vsc73xx-spi.o
 obj-y                          += b53/
+obj-y                          += hirschmann/
 obj-y                          += microchip/
 obj-y                          += mv88e6xxx/
 obj-y                          += ocelot/
diff --git a/drivers/net/dsa/hirschmann/Kconfig b/drivers/net/dsa/hirschmann/Kconfig
new file mode 100644 (file)
index 0000000..222dd35
--- /dev/null
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+config NET_DSA_HIRSCHMANN_HELLCREEK
+       tristate "Hirschmann Hellcreek TSN Switch support"
+       depends on HAS_IOMEM
+       depends on NET_DSA
+       depends on PTP_1588_CLOCK
+       select NET_DSA_TAG_HELLCREEK
+       help
+         This driver adds support for Hirschmann Hellcreek TSN switches.
diff --git a/drivers/net/dsa/hirschmann/Makefile b/drivers/net/dsa/hirschmann/Makefile
new file mode 100644 (file)
index 0000000..f4075c2
--- /dev/null
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_NET_DSA_HIRSCHMANN_HELLCREEK)     += hellcreek_sw.o
+hellcreek_sw-objs := hellcreek.o
+hellcreek_sw-objs += hellcreek_ptp.o
+hellcreek_sw-objs += hellcreek_hwtstamp.o
diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c
new file mode 100644 (file)
index 0000000..d42f40c
--- /dev/null
@@ -0,0 +1,1339 @@
+// SPDX-License-Identifier: (GPL-2.0 or MIT)
+/*
+ * DSA driver for:
+ * Hirschmann Hellcreek TSN switch.
+ *
+ * Copyright (C) 2019,2020 Linutronix GmbH
+ * Author Kurt Kanzenbach <kurt@linutronix.de>
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_mdio.h>
+#include <linux/platform_device.h>
+#include <linux/bitops.h>
+#include <linux/if_bridge.h>
+#include <linux/if_vlan.h>
+#include <linux/etherdevice.h>
+#include <linux/random.h>
+#include <linux/iopoll.h>
+#include <linux/mutex.h>
+#include <linux/delay.h>
+#include <net/dsa.h>
+
+#include "hellcreek.h"
+#include "hellcreek_ptp.h"
+#include "hellcreek_hwtstamp.h"
+
+static const struct hellcreek_counter hellcreek_counter[] = {
+       { 0x00, "RxFiltered", },
+       { 0x01, "RxOctets1k", },
+       { 0x02, "RxVTAG", },
+       { 0x03, "RxL2BAD", },
+       { 0x04, "RxOverloadDrop", },
+       { 0x05, "RxUC", },
+       { 0x06, "RxMC", },
+       { 0x07, "RxBC", },
+       { 0x08, "RxRS<64", },
+       { 0x09, "RxRS64", },
+       { 0x0a, "RxRS65_127", },
+       { 0x0b, "RxRS128_255", },
+       { 0x0c, "RxRS256_511", },
+       { 0x0d, "RxRS512_1023", },
+       { 0x0e, "RxRS1024_1518", },
+       { 0x0f, "RxRS>1518", },
+       { 0x10, "TxTailDropQueue0", },
+       { 0x11, "TxTailDropQueue1", },
+       { 0x12, "TxTailDropQueue2", },
+       { 0x13, "TxTailDropQueue3", },
+       { 0x14, "TxTailDropQueue4", },
+       { 0x15, "TxTailDropQueue5", },
+       { 0x16, "TxTailDropQueue6", },
+       { 0x17, "TxTailDropQueue7", },
+       { 0x18, "RxTrafficClass0", },
+       { 0x19, "RxTrafficClass1", },
+       { 0x1a, "RxTrafficClass2", },
+       { 0x1b, "RxTrafficClass3", },
+       { 0x1c, "RxTrafficClass4", },
+       { 0x1d, "RxTrafficClass5", },
+       { 0x1e, "RxTrafficClass6", },
+       { 0x1f, "RxTrafficClass7", },
+       { 0x21, "TxOctets1k", },
+       { 0x22, "TxVTAG", },
+       { 0x23, "TxL2BAD", },
+       { 0x25, "TxUC", },
+       { 0x26, "TxMC", },
+       { 0x27, "TxBC", },
+       { 0x28, "TxTS<64", },
+       { 0x29, "TxTS64", },
+       { 0x2a, "TxTS65_127", },
+       { 0x2b, "TxTS128_255", },
+       { 0x2c, "TxTS256_511", },
+       { 0x2d, "TxTS512_1023", },
+       { 0x2e, "TxTS1024_1518", },
+       { 0x2f, "TxTS>1518", },
+       { 0x30, "TxTrafficClassOverrun0", },
+       { 0x31, "TxTrafficClassOverrun1", },
+       { 0x32, "TxTrafficClassOverrun2", },
+       { 0x33, "TxTrafficClassOverrun3", },
+       { 0x34, "TxTrafficClassOverrun4", },
+       { 0x35, "TxTrafficClassOverrun5", },
+       { 0x36, "TxTrafficClassOverrun6", },
+       { 0x37, "TxTrafficClassOverrun7", },
+       { 0x38, "TxTrafficClass0", },
+       { 0x39, "TxTrafficClass1", },
+       { 0x3a, "TxTrafficClass2", },
+       { 0x3b, "TxTrafficClass3", },
+       { 0x3c, "TxTrafficClass4", },
+       { 0x3d, "TxTrafficClass5", },
+       { 0x3e, "TxTrafficClass6", },
+       { 0x3f, "TxTrafficClass7", },
+};
+
+static u16 hellcreek_read(struct hellcreek *hellcreek, unsigned int offset)
+{
+       return readw(hellcreek->base + offset);
+}
+
+static u16 hellcreek_read_ctrl(struct hellcreek *hellcreek)
+{
+       return readw(hellcreek->base + HR_CTRL_C);
+}
+
+static u16 hellcreek_read_stat(struct hellcreek *hellcreek)
+{
+       return readw(hellcreek->base + HR_SWSTAT);
+}
+
+static void hellcreek_write(struct hellcreek *hellcreek, u16 data,
+                           unsigned int offset)
+{
+       writew(data, hellcreek->base + offset);
+}
+
+static void hellcreek_select_port(struct hellcreek *hellcreek, int port)
+{
+       u16 val = port << HR_PSEL_PTWSEL_SHIFT;
+
+       hellcreek_write(hellcreek, val, HR_PSEL);
+}
+
+static void hellcreek_select_prio(struct hellcreek *hellcreek, int prio)
+{
+       u16 val = prio << HR_PSEL_PRTCWSEL_SHIFT;
+
+       hellcreek_write(hellcreek, val, HR_PSEL);
+}
+
+static void hellcreek_select_counter(struct hellcreek *hellcreek, int counter)
+{
+       u16 val = counter << HR_CSEL_SHIFT;
+
+       hellcreek_write(hellcreek, val, HR_CSEL);
+
+       /* Data sheet states to wait at least 20 internal clock cycles */
+       ndelay(200);
+}
+
+static void hellcreek_select_vlan(struct hellcreek *hellcreek, int vid,
+                                 bool pvid)
+{
+       u16 val = 0;
+
+       /* Set pvid bit first */
+       if (pvid)
+               val |= HR_VIDCFG_PVID;
+       hellcreek_write(hellcreek, val, HR_VIDCFG);
+
+       /* Set vlan */
+       val |= vid << HR_VIDCFG_VID_SHIFT;
+       hellcreek_write(hellcreek, val, HR_VIDCFG);
+}
+
+static int hellcreek_wait_until_ready(struct hellcreek *hellcreek)
+{
+       u16 val;
+
+       /* Wait up to 1ms, although 3 us should be enough */
+       return readx_poll_timeout(hellcreek_read_ctrl, hellcreek,
+                                 val, val & HR_CTRL_C_READY,
+                                 3, 1000);
+}
+
+static int hellcreek_wait_until_transitioned(struct hellcreek *hellcreek)
+{
+       u16 val;
+
+       return readx_poll_timeout_atomic(hellcreek_read_ctrl, hellcreek,
+                                        val, !(val & HR_CTRL_C_TRANSITION),
+                                        1, 1000);
+}
+
+static int hellcreek_wait_fdb_ready(struct hellcreek *hellcreek)
+{
+       u16 val;
+
+       return readx_poll_timeout_atomic(hellcreek_read_stat, hellcreek,
+                                        val, !(val & HR_SWSTAT_BUSY),
+                                        1, 1000);
+}
+
+static int hellcreek_detect(struct hellcreek *hellcreek)
+{
+       u16 id, rel_low, rel_high, date_low, date_high, tgd_ver;
+       u8 tgd_maj, tgd_min;
+       u32 rel, date;
+
+       id        = hellcreek_read(hellcreek, HR_MODID_C);
+       rel_low   = hellcreek_read(hellcreek, HR_REL_L_C);
+       rel_high  = hellcreek_read(hellcreek, HR_REL_H_C);
+       date_low  = hellcreek_read(hellcreek, HR_BLD_L_C);
+       date_high = hellcreek_read(hellcreek, HR_BLD_H_C);
+       tgd_ver   = hellcreek_read(hellcreek, TR_TGDVER);
+
+       if (id != hellcreek->pdata->module_id)
+               return -ENODEV;
+
+       rel     = rel_low | (rel_high << 16);
+       date    = date_low | (date_high << 16);
+       tgd_maj = (tgd_ver & TR_TGDVER_REV_MAJ_MASK) >> TR_TGDVER_REV_MAJ_SHIFT;
+       tgd_min = (tgd_ver & TR_TGDVER_REV_MIN_MASK) >> TR_TGDVER_REV_MIN_SHIFT;
+
+       dev_info(hellcreek->dev, "Module ID=%02x Release=%04x Date=%04x TGD Version=%02x.%02x\n",
+                id, rel, date, tgd_maj, tgd_min);
+
+       return 0;
+}
+
+static void hellcreek_feature_detect(struct hellcreek *hellcreek)
+{
+       u16 features;
+
+       features = hellcreek_read(hellcreek, HR_FEABITS0);
+
+       /* Currently we only detect the size of the FDB table */
+       hellcreek->fdb_entries = ((features & HR_FEABITS0_FDBBINS_MASK) >>
+                              HR_FEABITS0_FDBBINS_SHIFT) * 32;
+
+       dev_info(hellcreek->dev, "Feature detect: FDB entries=%zu\n",
+                hellcreek->fdb_entries);
+}
+
+static enum dsa_tag_protocol hellcreek_get_tag_protocol(struct dsa_switch *ds,
+                                                       int port,
+                                                       enum dsa_tag_protocol mp)
+{
+       return DSA_TAG_PROTO_HELLCREEK;
+}
+
+static int hellcreek_port_enable(struct dsa_switch *ds, int port,
+                                struct phy_device *phy)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       struct hellcreek_port *hellcreek_port;
+       u16 val;
+
+       hellcreek_port = &hellcreek->ports[port];
+
+       dev_dbg(hellcreek->dev, "Enable port %d\n", port);
+
+       mutex_lock(&hellcreek->reg_lock);
+
+       hellcreek_select_port(hellcreek, port);
+       val = hellcreek_port->ptcfg;
+       val |= HR_PTCFG_ADMIN_EN;
+       hellcreek_write(hellcreek, val, HR_PTCFG);
+       hellcreek_port->ptcfg = val;
+
+       mutex_unlock(&hellcreek->reg_lock);
+
+       return 0;
+}
+
+static void hellcreek_port_disable(struct dsa_switch *ds, int port)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       struct hellcreek_port *hellcreek_port;
+       u16 val;
+
+       hellcreek_port = &hellcreek->ports[port];
+
+       dev_dbg(hellcreek->dev, "Disable port %d\n", port);
+
+       mutex_lock(&hellcreek->reg_lock);
+
+       hellcreek_select_port(hellcreek, port);
+       val = hellcreek_port->ptcfg;
+       val &= ~HR_PTCFG_ADMIN_EN;
+       hellcreek_write(hellcreek, val, HR_PTCFG);
+       hellcreek_port->ptcfg = val;
+
+       mutex_unlock(&hellcreek->reg_lock);
+}
+
+static void hellcreek_get_strings(struct dsa_switch *ds, int port,
+                                 u32 stringset, uint8_t *data)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(hellcreek_counter); ++i) {
+               const struct hellcreek_counter *counter = &hellcreek_counter[i];
+
+               strlcpy(data + i * ETH_GSTRING_LEN,
+                       counter->name, ETH_GSTRING_LEN);
+       }
+}
+
+static int hellcreek_get_sset_count(struct dsa_switch *ds, int port, int sset)
+{
+       if (sset != ETH_SS_STATS)
+               return 0;
+
+       return ARRAY_SIZE(hellcreek_counter);
+}
+
+static void hellcreek_get_ethtool_stats(struct dsa_switch *ds, int port,
+                                       uint64_t *data)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       struct hellcreek_port *hellcreek_port;
+       int i;
+
+       hellcreek_port = &hellcreek->ports[port];
+
+       for (i = 0; i < ARRAY_SIZE(hellcreek_counter); ++i) {
+               const struct hellcreek_counter *counter = &hellcreek_counter[i];
+               u8 offset = counter->offset + port * 64;
+               u16 high, low;
+               u64 value;
+
+               mutex_lock(&hellcreek->reg_lock);
+
+               hellcreek_select_counter(hellcreek, offset);
+
+               /* The registers are locked internally by selecting the
+                * counter. So low and high can be read without reading high
+                * again.
+                */
+               high  = hellcreek_read(hellcreek, HR_CRDH);
+               low   = hellcreek_read(hellcreek, HR_CRDL);
+               value = ((u64)high << 16) | low;
+
+               hellcreek_port->counter_values[i] += value;
+               data[i] = hellcreek_port->counter_values[i];
+
+               mutex_unlock(&hellcreek->reg_lock);
+       }
+}
+
+static u16 hellcreek_private_vid(int port)
+{
+       return VLAN_N_VID - port + 1;
+}
+
+static int hellcreek_vlan_prepare(struct dsa_switch *ds, int port,
+                                 const struct switchdev_obj_port_vlan *vlan)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       int i;
+
+       dev_dbg(hellcreek->dev, "VLAN prepare for port %d\n", port);
+
+       /* Restriction: Make sure that nobody uses the "private" VLANs. These
+        * VLANs are internally used by the driver to ensure port
+        * separation. Thus, they cannot be used by someone else.
+        */
+       for (i = 0; i < hellcreek->pdata->num_ports; ++i) {
+               const u16 restricted_vid = hellcreek_private_vid(i);
+               u16 vid;
+
+               if (!dsa_is_user_port(ds, i))
+                       continue;
+
+               for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid)
+                       if (vid == restricted_vid)
+                               return -EBUSY;
+       }
+
+       return 0;
+}
+
+static void hellcreek_select_vlan_params(struct hellcreek *hellcreek, int port,
+                                        int *shift, int *mask)
+{
+       switch (port) {
+       case 0:
+               *shift = HR_VIDMBRCFG_P0MBR_SHIFT;
+               *mask  = HR_VIDMBRCFG_P0MBR_MASK;
+               break;
+       case 1:
+               *shift = HR_VIDMBRCFG_P1MBR_SHIFT;
+               *mask  = HR_VIDMBRCFG_P1MBR_MASK;
+               break;
+       case 2:
+               *shift = HR_VIDMBRCFG_P2MBR_SHIFT;
+               *mask  = HR_VIDMBRCFG_P2MBR_MASK;
+               break;
+       case 3:
+               *shift = HR_VIDMBRCFG_P3MBR_SHIFT;
+               *mask  = HR_VIDMBRCFG_P3MBR_MASK;
+               break;
+       default:
+               *shift = *mask = 0;
+               dev_err(hellcreek->dev, "Unknown port %d selected!\n", port);
+       }
+}
+
+static void hellcreek_apply_vlan(struct hellcreek *hellcreek, int port, u16 vid,
+                                bool pvid, bool untagged)
+{
+       int shift, mask;
+       u16 val;
+
+       dev_dbg(hellcreek->dev, "Apply VLAN: port=%d vid=%u pvid=%d untagged=%d",
+               port, vid, pvid, untagged);
+
+       mutex_lock(&hellcreek->reg_lock);
+
+       hellcreek_select_port(hellcreek, port);
+       hellcreek_select_vlan(hellcreek, vid, pvid);
+
+       /* Setup port vlan membership */
+       hellcreek_select_vlan_params(hellcreek, port, &shift, &mask);
+       val = hellcreek->vidmbrcfg[vid];
+       val &= ~mask;
+       if (untagged)
+               val |= HELLCREEK_VLAN_UNTAGGED_MEMBER << shift;
+       else
+               val |= HELLCREEK_VLAN_TAGGED_MEMBER << shift;
+
+       hellcreek_write(hellcreek, val, HR_VIDMBRCFG);
+       hellcreek->vidmbrcfg[vid] = val;
+
+       mutex_unlock(&hellcreek->reg_lock);
+}
+
+static void hellcreek_unapply_vlan(struct hellcreek *hellcreek, int port,
+                                  u16 vid)
+{
+       int shift, mask;
+       u16 val;
+
+       dev_dbg(hellcreek->dev, "Unapply VLAN: port=%d vid=%u\n", port, vid);
+
+       mutex_lock(&hellcreek->reg_lock);
+
+       hellcreek_select_vlan(hellcreek, vid, 0);
+
+       /* Setup port vlan membership */
+       hellcreek_select_vlan_params(hellcreek, port, &shift, &mask);
+       val = hellcreek->vidmbrcfg[vid];
+       val &= ~mask;
+       val |= HELLCREEK_VLAN_NO_MEMBER << shift;
+
+       hellcreek_write(hellcreek, val, HR_VIDMBRCFG);
+       hellcreek->vidmbrcfg[vid] = val;
+
+       mutex_unlock(&hellcreek->reg_lock);
+}
+
+static void hellcreek_vlan_add(struct dsa_switch *ds, int port,
+                              const struct switchdev_obj_port_vlan *vlan)
+{
+       bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
+       bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID;
+       struct hellcreek *hellcreek = ds->priv;
+       u16 vid;
+
+       dev_dbg(hellcreek->dev, "Add VLANs (%d -- %d) on port %d, %s, %s\n",
+               vlan->vid_begin, vlan->vid_end, port,
+               untagged ? "untagged" : "tagged",
+               pvid ? "PVID" : "no PVID");
+
+       for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid)
+               hellcreek_apply_vlan(hellcreek, port, vid, pvid, untagged);
+}
+
+static int hellcreek_vlan_del(struct dsa_switch *ds, int port,
+                             const struct switchdev_obj_port_vlan *vlan)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       u16 vid;
+
+       dev_dbg(hellcreek->dev, "Remove VLANs (%d -- %d) on port %d\n",
+               vlan->vid_begin, vlan->vid_end, port);
+
+       for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid)
+               hellcreek_unapply_vlan(hellcreek, port, vid);
+
+       return 0;
+}
+
+static void hellcreek_port_stp_state_set(struct dsa_switch *ds, int port,
+                                        u8 state)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       struct hellcreek_port *hellcreek_port;
+       const char *new_state;
+       u16 val;
+
+       mutex_lock(&hellcreek->reg_lock);
+
+       hellcreek_port = &hellcreek->ports[port];
+       val = hellcreek_port->ptcfg;
+
+       switch (state) {
+       case BR_STATE_DISABLED:
+               new_state = "DISABLED";
+               val |= HR_PTCFG_BLOCKED;
+               val &= ~HR_PTCFG_LEARNING_EN;
+               break;
+       case BR_STATE_BLOCKING:
+               new_state = "BLOCKING";
+               val |= HR_PTCFG_BLOCKED;
+               val &= ~HR_PTCFG_LEARNING_EN;
+               break;
+       case BR_STATE_LISTENING:
+               new_state = "LISTENING";
+               val |= HR_PTCFG_BLOCKED;
+               val &= ~HR_PTCFG_LEARNING_EN;
+               break;
+       case BR_STATE_LEARNING:
+               new_state = "LEARNING";
+               val |= HR_PTCFG_BLOCKED;
+               val |= HR_PTCFG_LEARNING_EN;
+               break;
+       case BR_STATE_FORWARDING:
+               new_state = "FORWARDING";
+               val &= ~HR_PTCFG_BLOCKED;
+               val |= HR_PTCFG_LEARNING_EN;
+               break;
+       default:
+               new_state = "UNKNOWN";
+       }
+
+       hellcreek_select_port(hellcreek, port);
+       hellcreek_write(hellcreek, val, HR_PTCFG);
+       hellcreek_port->ptcfg = val;
+
+       mutex_unlock(&hellcreek->reg_lock);
+
+       dev_dbg(hellcreek->dev, "Configured STP state for port %d: %s\n",
+               port, new_state);
+}
+
+static void hellcreek_setup_ingressflt(struct hellcreek *hellcreek, int port,
+                                      bool enable)
+{
+       struct hellcreek_port *hellcreek_port = &hellcreek->ports[port];
+       u16 ptcfg;
+
+       mutex_lock(&hellcreek->reg_lock);
+
+       ptcfg = hellcreek_port->ptcfg;
+
+       if (enable)
+               ptcfg |= HR_PTCFG_INGRESSFLT;
+       else
+               ptcfg &= ~HR_PTCFG_INGRESSFLT;
+
+       hellcreek_select_port(hellcreek, port);
+       hellcreek_write(hellcreek, ptcfg, HR_PTCFG);
+       hellcreek_port->ptcfg = ptcfg;
+
+       mutex_unlock(&hellcreek->reg_lock);
+}
+
+static void hellcreek_setup_vlan_awareness(struct hellcreek *hellcreek,
+                                          bool enable)
+{
+       u16 swcfg;
+
+       mutex_lock(&hellcreek->reg_lock);
+
+       swcfg = hellcreek->swcfg;
+
+       if (enable)
+               swcfg |= HR_SWCFG_VLAN_UNAWARE;
+       else
+               swcfg &= ~HR_SWCFG_VLAN_UNAWARE;
+
+       hellcreek_write(hellcreek, swcfg, HR_SWCFG);
+
+       mutex_unlock(&hellcreek->reg_lock);
+}
+
+/* Default setup for DSA: VLAN <X>: CPU and Port <X> egress untagged. */
+static void hellcreek_setup_vlan_membership(struct dsa_switch *ds, int port,
+                                           bool enabled)
+{
+       const u16 vid = hellcreek_private_vid(port);
+       int upstream = dsa_upstream_port(ds, port);
+       struct hellcreek *hellcreek = ds->priv;
+
+       /* Apply vid to port as egress untagged and port vlan id */
+       if (enabled)
+               hellcreek_apply_vlan(hellcreek, port, vid, true, true);
+       else
+               hellcreek_unapply_vlan(hellcreek, port, vid);
+
+       /* Apply vid to cpu port as well */
+       if (enabled)
+               hellcreek_apply_vlan(hellcreek, upstream, vid, false, true);
+       else
+               hellcreek_unapply_vlan(hellcreek, upstream, vid);
+}
+
+static int hellcreek_port_bridge_join(struct dsa_switch *ds, int port,
+                                     struct net_device *br)
+{
+       struct hellcreek *hellcreek = ds->priv;
+
+       dev_dbg(hellcreek->dev, "Port %d joins a bridge\n", port);
+
+       /* When joining a vlan_filtering bridge, keep the switch VLAN aware */
+       if (!ds->vlan_filtering)
+               hellcreek_setup_vlan_awareness(hellcreek, false);
+
+       /* Drop private vlans */
+       hellcreek_setup_vlan_membership(ds, port, false);
+
+       return 0;
+}
+
+static void hellcreek_port_bridge_leave(struct dsa_switch *ds, int port,
+                                       struct net_device *br)
+{
+       struct hellcreek *hellcreek = ds->priv;
+
+       dev_dbg(hellcreek->dev, "Port %d leaves a bridge\n", port);
+
+       /* Enable VLAN awareness */
+       hellcreek_setup_vlan_awareness(hellcreek, true);
+
+       /* Enable private vlans */
+       hellcreek_setup_vlan_membership(ds, port, true);
+}
+
+static int __hellcreek_fdb_add(struct hellcreek *hellcreek,
+                              const struct hellcreek_fdb_entry *entry)
+{
+       u16 meta = 0;
+
+       dev_dbg(hellcreek->dev, "Add static FDB entry: MAC=%pM, MASK=0x%02x, "
+               "OBT=%d, REPRIO_EN=%d, PRIO=%d\n", entry->mac, entry->portmask,
+               entry->is_obt, entry->reprio_en, entry->reprio_tc);
+
+       /* Add mac address */
+       hellcreek_write(hellcreek, entry->mac[1] | (entry->mac[0] << 8), HR_FDBWDH);
+       hellcreek_write(hellcreek, entry->mac[3] | (entry->mac[2] << 8), HR_FDBWDM);
+       hellcreek_write(hellcreek, entry->mac[5] | (entry->mac[4] << 8), HR_FDBWDL);
+
+       /* Meta data */
+       meta |= entry->portmask << HR_FDBWRM0_PORTMASK_SHIFT;
+       if (entry->is_obt)
+               meta |= HR_FDBWRM0_OBT;
+       if (entry->reprio_en) {
+               meta |= HR_FDBWRM0_REPRIO_EN;
+               meta |= entry->reprio_tc << HR_FDBWRM0_REPRIO_TC_SHIFT;
+       }
+       hellcreek_write(hellcreek, meta, HR_FDBWRM0);
+
+       /* Commit */
+       hellcreek_write(hellcreek, 0x00, HR_FDBWRCMD);
+
+       /* Wait until done */
+       return hellcreek_wait_fdb_ready(hellcreek);
+}
+
+static int __hellcreek_fdb_del(struct hellcreek *hellcreek,
+                              const struct hellcreek_fdb_entry *entry)
+{
+       dev_dbg(hellcreek->dev, "Delete FDB entry: MAC=%pM!\n", entry->mac);
+
+       /* Delete by matching idx */
+       hellcreek_write(hellcreek, entry->idx | HR_FDBWRCMD_FDBDEL, HR_FDBWRCMD);
+
+       /* Wait until done */
+       return hellcreek_wait_fdb_ready(hellcreek);
+}
+
+/* Retrieve the index of a FDB entry by mac address. Currently we search through
+ * the complete table in hardware. If that's too slow, we might have to cache
+ * the complete FDB table in software.
+ */
+static int hellcreek_fdb_get(struct hellcreek *hellcreek,
+                            const unsigned char *dest,
+                            struct hellcreek_fdb_entry *entry)
+{
+       size_t i;
+
+       /* Set read pointer to zero: The read of HR_FDBMAX (read-only register)
+        * should reset the internal pointer. But, that doesn't work. The vendor
+        * suggested a subsequent write as workaround. Same for HR_FDBRDH below.
+        */
+       hellcreek_read(hellcreek, HR_FDBMAX);
+       hellcreek_write(hellcreek, 0x00, HR_FDBMAX);
+
+       /* We have to read the complete table, because the switch/driver might
+        * enter new entries anywhere.
+        */
+       for (i = 0; i < hellcreek->fdb_entries; ++i) {
+               unsigned char addr[ETH_ALEN];
+               u16 meta, mac;
+
+               meta    = hellcreek_read(hellcreek, HR_FDBMDRD);
+               mac     = hellcreek_read(hellcreek, HR_FDBRDL);
+               addr[5] = mac & 0xff;
+               addr[4] = (mac & 0xff00) >> 8;
+               mac     = hellcreek_read(hellcreek, HR_FDBRDM);
+               addr[3] = mac & 0xff;
+               addr[2] = (mac & 0xff00) >> 8;
+               mac     = hellcreek_read(hellcreek, HR_FDBRDH);
+               addr[1] = mac & 0xff;
+               addr[0] = (mac & 0xff00) >> 8;
+
+               /* Force next entry */
+               hellcreek_write(hellcreek, 0x00, HR_FDBRDH);
+
+               if (memcmp(addr, dest, ETH_ALEN))
+                       continue;
+
+               /* Match found */
+               entry->idx          = i;
+               entry->portmask     = (meta & HR_FDBMDRD_PORTMASK_MASK) >>
+                       HR_FDBMDRD_PORTMASK_SHIFT;
+               entry->age          = (meta & HR_FDBMDRD_AGE_MASK) >>
+                       HR_FDBMDRD_AGE_SHIFT;
+               entry->is_obt       = !!(meta & HR_FDBMDRD_OBT);
+               entry->pass_blocked = !!(meta & HR_FDBMDRD_PASS_BLOCKED);
+               entry->is_static    = !!(meta & HR_FDBMDRD_STATIC);
+               entry->reprio_tc    = (meta & HR_FDBMDRD_REPRIO_TC_MASK) >>
+                       HR_FDBMDRD_REPRIO_TC_SHIFT;
+               entry->reprio_en    = !!(meta & HR_FDBMDRD_REPRIO_EN);
+               memcpy(entry->mac, addr, sizeof(addr));
+
+               return 0;
+       }
+
+       return -ENOENT;
+}
+
+static int hellcreek_fdb_add(struct dsa_switch *ds, int port,
+                            const unsigned char *addr, u16 vid)
+{
+       struct hellcreek_fdb_entry entry = { 0 };
+       struct hellcreek *hellcreek = ds->priv;
+       int ret;
+
+       dev_dbg(hellcreek->dev, "Add FDB entry for MAC=%pM\n", addr);
+
+       mutex_lock(&hellcreek->reg_lock);
+
+       ret = hellcreek_fdb_get(hellcreek, addr, &entry);
+       if (ret) {
+               /* Not found */
+               memcpy(entry.mac, addr, sizeof(entry.mac));
+               entry.portmask = BIT(port);
+
+               ret = __hellcreek_fdb_add(hellcreek, &entry);
+               if (ret) {
+                       dev_err(hellcreek->dev, "Failed to add FDB entry!\n");
+                       goto out;
+               }
+       } else {
+               /* Found */
+               ret = __hellcreek_fdb_del(hellcreek, &entry);
+               if (ret) {
+                       dev_err(hellcreek->dev, "Failed to delete FDB entry!\n");
+                       goto out;
+               }
+
+               entry.portmask |= BIT(port);
+
+               ret = __hellcreek_fdb_add(hellcreek, &entry);
+               if (ret) {
+                       dev_err(hellcreek->dev, "Failed to add FDB entry!\n");
+                       goto out;
+               }
+       }
+
+out:
+       mutex_unlock(&hellcreek->reg_lock);
+
+       return ret;
+}
+
+static int hellcreek_fdb_del(struct dsa_switch *ds, int port,
+                            const unsigned char *addr, u16 vid)
+{
+       struct hellcreek_fdb_entry entry = { 0 };
+       struct hellcreek *hellcreek = ds->priv;
+       int ret;
+
+       dev_dbg(hellcreek->dev, "Delete FDB entry for MAC=%pM\n", addr);
+
+       mutex_lock(&hellcreek->reg_lock);
+
+       ret = hellcreek_fdb_get(hellcreek, addr, &entry);
+       if (ret) {
+               /* Not found */
+               dev_err(hellcreek->dev, "FDB entry for deletion not found!\n");
+       } else {
+               /* Found */
+               ret = __hellcreek_fdb_del(hellcreek, &entry);
+               if (ret) {
+                       dev_err(hellcreek->dev, "Failed to delete FDB entry!\n");
+                       goto out;
+               }
+
+               entry.portmask &= ~BIT(port);
+
+               if (entry.portmask != 0x00) {
+                       ret = __hellcreek_fdb_add(hellcreek, &entry);
+                       if (ret) {
+                               dev_err(hellcreek->dev, "Failed to add FDB entry!\n");
+                               goto out;
+                       }
+               }
+       }
+
+out:
+       mutex_unlock(&hellcreek->reg_lock);
+
+       return ret;
+}
+
+static int hellcreek_fdb_dump(struct dsa_switch *ds, int port,
+                             dsa_fdb_dump_cb_t *cb, void *data)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       u16 entries;
+       size_t i;
+
+       mutex_lock(&hellcreek->reg_lock);
+
+       /* Set read pointer to zero: The read of HR_FDBMAX (read-only register)
+        * should reset the internal pointer. But, that doesn't work. The vendor
+        * suggested a subsequent write as workaround. Same for HR_FDBRDH below.
+        */
+       entries = hellcreek_read(hellcreek, HR_FDBMAX);
+       hellcreek_write(hellcreek, 0x00, HR_FDBMAX);
+
+       dev_dbg(hellcreek->dev, "FDB dump for port %d, entries=%d!\n", port, entries);
+
+       /* Read table */
+       for (i = 0; i < hellcreek->fdb_entries; ++i) {
+               unsigned char null_addr[ETH_ALEN] = { 0 };
+               struct hellcreek_fdb_entry entry = { 0 };
+               u16 meta, mac;
+
+               meta    = hellcreek_read(hellcreek, HR_FDBMDRD);
+               mac     = hellcreek_read(hellcreek, HR_FDBRDL);
+               entry.mac[5] = mac & 0xff;
+               entry.mac[4] = (mac & 0xff00) >> 8;
+               mac     = hellcreek_read(hellcreek, HR_FDBRDM);
+               entry.mac[3] = mac & 0xff;
+               entry.mac[2] = (mac & 0xff00) >> 8;
+               mac     = hellcreek_read(hellcreek, HR_FDBRDH);
+               entry.mac[1] = mac & 0xff;
+               entry.mac[0] = (mac & 0xff00) >> 8;
+
+               /* Force next entry */
+               hellcreek_write(hellcreek, 0x00, HR_FDBRDH);
+
+               /* Check valid */
+               if (!memcmp(entry.mac, null_addr, ETH_ALEN))
+                       continue;
+
+               entry.portmask  = (meta & HR_FDBMDRD_PORTMASK_MASK) >>
+                       HR_FDBMDRD_PORTMASK_SHIFT;
+               entry.is_static = !!(meta & HR_FDBMDRD_STATIC);
+
+               /* Check port mask */
+               if (!(entry.portmask & BIT(port)))
+                       continue;
+
+               cb(entry.mac, 0, entry.is_static, data);
+       }
+
+       mutex_unlock(&hellcreek->reg_lock);
+
+       return 0;
+}
+
+static int hellcreek_vlan_filtering(struct dsa_switch *ds, int port,
+                                   bool vlan_filtering,
+                                   struct switchdev_trans *trans)
+{
+       struct hellcreek *hellcreek = ds->priv;
+
+       if (switchdev_trans_ph_prepare(trans))
+               return 0;
+
+       dev_dbg(hellcreek->dev, "%s VLAN filtering on port %d\n",
+               vlan_filtering ? "Enable" : "Disable", port);
+
+       /* Configure port to drop packages with not known vids */
+       hellcreek_setup_ingressflt(hellcreek, port, vlan_filtering);
+
+       /* Enable VLAN awareness on the switch. This save due to
+        * ds->vlan_filtering_is_global.
+        */
+       hellcreek_setup_vlan_awareness(hellcreek, vlan_filtering);
+
+       return 0;
+}
+
+static int hellcreek_enable_ip_core(struct hellcreek *hellcreek)
+{
+       int ret;
+       u16 val;
+
+       mutex_lock(&hellcreek->reg_lock);
+
+       val = hellcreek_read(hellcreek, HR_CTRL_C);
+       val |= HR_CTRL_C_ENABLE;
+       hellcreek_write(hellcreek, val, HR_CTRL_C);
+       ret = hellcreek_wait_until_transitioned(hellcreek);
+
+       mutex_unlock(&hellcreek->reg_lock);
+
+       return ret;
+}
+
+static void hellcreek_setup_cpu_and_tunnel_port(struct hellcreek *hellcreek)
+{
+       struct hellcreek_port *tunnel_port = &hellcreek->ports[TUNNEL_PORT];
+       struct hellcreek_port *cpu_port = &hellcreek->ports[CPU_PORT];
+       u16 ptcfg = 0;
+
+       ptcfg |= HR_PTCFG_LEARNING_EN | HR_PTCFG_ADMIN_EN;
+
+       mutex_lock(&hellcreek->reg_lock);
+
+       hellcreek_select_port(hellcreek, CPU_PORT);
+       hellcreek_write(hellcreek, ptcfg, HR_PTCFG);
+
+       hellcreek_select_port(hellcreek, TUNNEL_PORT);
+       hellcreek_write(hellcreek, ptcfg, HR_PTCFG);
+
+       cpu_port->ptcfg    = ptcfg;
+       tunnel_port->ptcfg = ptcfg;
+
+       mutex_unlock(&hellcreek->reg_lock);
+}
+
+static void hellcreek_setup_tc_identity_mapping(struct hellcreek *hellcreek)
+{
+       int i;
+
+       /* The switch has multiple egress queues per port. The queue is selected
+        * via the PCP field in the VLAN header. The switch internally deals
+        * with traffic classes instead of PCP values and this mapping is
+        * configurable.
+        *
+        * The default mapping is (PCP - TC):
+        *  7 - 7
+        *  6 - 6
+        *  5 - 5
+        *  4 - 4
+        *  3 - 3
+        *  2 - 1
+        *  1 - 0
+        *  0 - 2
+        *
+        * The default should be an identity mapping.
+        */
+
+       for (i = 0; i < 8; ++i) {
+               mutex_lock(&hellcreek->reg_lock);
+
+               hellcreek_select_prio(hellcreek, i);
+               hellcreek_write(hellcreek,
+                               i << HR_PRTCCFG_PCP_TC_MAP_SHIFT,
+                               HR_PRTCCFG);
+
+               mutex_unlock(&hellcreek->reg_lock);
+       }
+}
+
+static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
+{
+       static struct hellcreek_fdb_entry ptp = {
+               /* MAC: 01-1B-19-00-00-00 */
+               .mac          = { 0x01, 0x1b, 0x19, 0x00, 0x00, 0x00 },
+               .portmask     = 0x03,   /* Management ports */
+               .age          = 0,
+               .is_obt       = 0,
+               .pass_blocked = 0,
+               .is_static    = 1,
+               .reprio_tc    = 6,      /* TC: 6 as per IEEE 802.1AS */
+               .reprio_en    = 1,
+       };
+       static struct hellcreek_fdb_entry p2p = {
+               /* MAC: 01-80-C2-00-00-0E */
+               .mac          = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e },
+               .portmask     = 0x03,   /* Management ports */
+               .age          = 0,
+               .is_obt       = 0,
+               .pass_blocked = 0,
+               .is_static    = 1,
+               .reprio_tc    = 6,      /* TC: 6 as per IEEE 802.1AS */
+               .reprio_en    = 1,
+       };
+       int ret;
+
+       mutex_lock(&hellcreek->reg_lock);
+       ret = __hellcreek_fdb_add(hellcreek, &ptp);
+       if (ret)
+               goto out;
+       ret = __hellcreek_fdb_add(hellcreek, &p2p);
+out:
+       mutex_unlock(&hellcreek->reg_lock);
+
+       return ret;
+}
+
+static int hellcreek_setup(struct dsa_switch *ds)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       u16 swcfg = 0;
+       int ret, i;
+
+       dev_dbg(hellcreek->dev, "Set up the switch\n");
+
+       /* Let's go */
+       ret = hellcreek_enable_ip_core(hellcreek);
+       if (ret) {
+               dev_err(hellcreek->dev, "Failed to enable IP core!\n");
+               return ret;
+       }
+
+       /* Enable CPU/Tunnel ports */
+       hellcreek_setup_cpu_and_tunnel_port(hellcreek);
+
+       /* Switch config: Keep defaults, enable FDB aging and learning and tag
+        * each frame from/to cpu port for DSA tagging.  Also enable the length
+        * aware shaping mode. This eliminates the need for Qbv guard bands.
+        */
+       swcfg |= HR_SWCFG_FDBAGE_EN |
+               HR_SWCFG_FDBLRN_EN  |
+               HR_SWCFG_ALWAYS_OBT |
+               (HR_SWCFG_LAS_ON << HR_SWCFG_LAS_MODE_SHIFT);
+       hellcreek->swcfg = swcfg;
+       hellcreek_write(hellcreek, swcfg, HR_SWCFG);
+
+       /* Initial vlan membership to reflect port separation */
+       for (i = 0; i < ds->num_ports; ++i) {
+               if (!dsa_is_user_port(ds, i))
+                       continue;
+
+               hellcreek_setup_vlan_membership(ds, i, true);
+       }
+
+       /* Configure PCP <-> TC mapping */
+       hellcreek_setup_tc_identity_mapping(hellcreek);
+
+       /* Allow VLAN configurations while not filtering which is the default
+        * for new DSA drivers.
+        */
+       ds->configure_vlan_while_not_filtering = true;
+
+       /* The VLAN awareness is a global switch setting. Therefore, mixed vlan
+        * filtering setups are not supported.
+        */
+       ds->vlan_filtering_is_global = true;
+
+       /* Intercept _all_ PTP multicast traffic */
+       ret = hellcreek_setup_fdb(hellcreek);
+       if (ret) {
+               dev_err(hellcreek->dev,
+                       "Failed to insert static PTP FDB entries\n");
+               return ret;
+       }
+
+       return 0;
+}
+
+static void hellcreek_phylink_validate(struct dsa_switch *ds, int port,
+                                      unsigned long *supported,
+                                      struct phylink_link_state *state)
+{
+       __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
+       struct hellcreek *hellcreek = ds->priv;
+
+       dev_dbg(hellcreek->dev, "Phylink validate for port %d\n", port);
+
+       /* The MAC settings are a hardware configuration option and cannot be
+        * changed at run time or by strapping. Therefore the attached PHYs
+        * should be programmed to only advertise settings which are supported
+        * by the hardware.
+        */
+       if (hellcreek->pdata->is_100_mbits)
+               phylink_set(mask, 100baseT_Full);
+       else
+               phylink_set(mask, 1000baseT_Full);
+
+       bitmap_and(supported, supported, mask,
+                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       bitmap_and(state->advertising, state->advertising, mask,
+                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+}
+
+static int
+hellcreek_port_prechangeupper(struct dsa_switch *ds, int port,
+                             struct netdev_notifier_changeupper_info *info)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       bool used = true;
+       int ret = -EBUSY;
+       u16 vid;
+       int i;
+
+       dev_dbg(hellcreek->dev, "Pre change upper for port %d\n", port);
+
+       /*
+        * Deny VLAN devices on top of lan ports with the same VLAN ids, because
+        * it breaks the port separation due to the private VLANs. Example:
+        *
+        * lan0.100 *and* lan1.100 cannot be used in parallel. However, lan0.99
+        * and lan1.100 works.
+        */
+
+       if (!is_vlan_dev(info->upper_dev))
+               return 0;
+
+       vid = vlan_dev_vlan_id(info->upper_dev);
+
+       /* For all ports, check bitmaps */
+       mutex_lock(&hellcreek->vlan_lock);
+       for (i = 0; i < hellcreek->pdata->num_ports; ++i) {
+               if (!dsa_is_user_port(ds, i))
+                       continue;
+
+               if (port == i)
+                       continue;
+
+               used = used && test_bit(vid, hellcreek->ports[i].vlan_dev_bitmap);
+       }
+
+       if (used)
+               goto out;
+
+       /* Update bitmap */
+       set_bit(vid, hellcreek->ports[port].vlan_dev_bitmap);
+
+       ret = 0;
+
+out:
+       mutex_unlock(&hellcreek->vlan_lock);
+
+       return ret;
+}
+
+static const struct dsa_switch_ops hellcreek_ds_ops = {
+       .get_ethtool_stats   = hellcreek_get_ethtool_stats,
+       .get_sset_count      = hellcreek_get_sset_count,
+       .get_strings         = hellcreek_get_strings,
+       .get_tag_protocol    = hellcreek_get_tag_protocol,
+       .get_ts_info         = hellcreek_get_ts_info,
+       .phylink_validate    = hellcreek_phylink_validate,
+       .port_bridge_join    = hellcreek_port_bridge_join,
+       .port_bridge_leave   = hellcreek_port_bridge_leave,
+       .port_disable        = hellcreek_port_disable,
+       .port_enable         = hellcreek_port_enable,
+       .port_fdb_add        = hellcreek_fdb_add,
+       .port_fdb_del        = hellcreek_fdb_del,
+       .port_fdb_dump       = hellcreek_fdb_dump,
+       .port_hwtstamp_set   = hellcreek_port_hwtstamp_set,
+       .port_hwtstamp_get   = hellcreek_port_hwtstamp_get,
+       .port_prechangeupper = hellcreek_port_prechangeupper,
+       .port_rxtstamp       = hellcreek_port_rxtstamp,
+       .port_stp_state_set  = hellcreek_port_stp_state_set,
+       .port_txtstamp       = hellcreek_port_txtstamp,
+       .port_vlan_add       = hellcreek_vlan_add,
+       .port_vlan_del       = hellcreek_vlan_del,
+       .port_vlan_filtering = hellcreek_vlan_filtering,
+       .port_vlan_prepare   = hellcreek_vlan_prepare,
+       .setup               = hellcreek_setup,
+};
+
+static int hellcreek_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct hellcreek *hellcreek;
+       struct resource *res;
+       int ret, i;
+
+       hellcreek = devm_kzalloc(dev, sizeof(*hellcreek), GFP_KERNEL);
+       if (!hellcreek)
+               return -ENOMEM;
+
+       hellcreek->vidmbrcfg = devm_kcalloc(dev, VLAN_N_VID,
+                                           sizeof(*hellcreek->vidmbrcfg),
+                                           GFP_KERNEL);
+       if (!hellcreek->vidmbrcfg)
+               return -ENOMEM;
+
+       hellcreek->pdata = of_device_get_match_data(dev);
+
+       hellcreek->ports = devm_kcalloc(dev, hellcreek->pdata->num_ports,
+                                       sizeof(*hellcreek->ports),
+                                       GFP_KERNEL);
+       if (!hellcreek->ports)
+               return -ENOMEM;
+
+       for (i = 0; i < hellcreek->pdata->num_ports; ++i) {
+               struct hellcreek_port *port = &hellcreek->ports[i];
+
+               port->counter_values =
+                       devm_kcalloc(dev,
+                                    ARRAY_SIZE(hellcreek_counter),
+                                    sizeof(*port->counter_values),
+                                    GFP_KERNEL);
+               if (!port->counter_values)
+                       return -ENOMEM;
+
+               port->vlan_dev_bitmap =
+                       devm_kcalloc(dev,
+                                    BITS_TO_LONGS(VLAN_N_VID),
+                                    sizeof(unsigned long),
+                                    GFP_KERNEL);
+               if (!port->vlan_dev_bitmap)
+                       return -ENOMEM;
+
+               port->hellcreek = hellcreek;
+               port->port      = i;
+       }
+
+       mutex_init(&hellcreek->reg_lock);
+       mutex_init(&hellcreek->vlan_lock);
+       mutex_init(&hellcreek->ptp_lock);
+
+       hellcreek->dev = dev;
+
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tsn");
+       if (!res) {
+               dev_err(dev, "No memory region provided!\n");
+               return -ENODEV;
+       }
+
+       hellcreek->base = devm_ioremap_resource(dev, res);
+       if (IS_ERR(hellcreek->base)) {
+               dev_err(dev, "No memory available!\n");
+               return PTR_ERR(hellcreek->base);
+       }
+
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ptp");
+       if (!res) {
+               dev_err(dev, "No PTP memory region provided!\n");
+               return -ENODEV;
+       }
+
+       hellcreek->ptp_base = devm_ioremap_resource(dev, res);
+       if (IS_ERR(hellcreek->ptp_base)) {
+               dev_err(dev, "No memory available!\n");
+               return PTR_ERR(hellcreek->ptp_base);
+       }
+
+       ret = hellcreek_detect(hellcreek);
+       if (ret) {
+               dev_err(dev, "No (known) chip found!\n");
+               return ret;
+       }
+
+       ret = hellcreek_wait_until_ready(hellcreek);
+       if (ret) {
+               dev_err(dev, "Switch didn't become ready!\n");
+               return ret;
+       }
+
+       hellcreek_feature_detect(hellcreek);
+
+       hellcreek->ds = devm_kzalloc(dev, sizeof(*hellcreek->ds), GFP_KERNEL);
+       if (!hellcreek->ds)
+               return -ENOMEM;
+
+       hellcreek->ds->dev           = dev;
+       hellcreek->ds->priv          = hellcreek;
+       hellcreek->ds->ops           = &hellcreek_ds_ops;
+       hellcreek->ds->num_ports     = hellcreek->pdata->num_ports;
+       hellcreek->ds->num_tx_queues = HELLCREEK_NUM_EGRESS_QUEUES;
+
+       ret = dsa_register_switch(hellcreek->ds);
+       if (ret) {
+               dev_err(dev, "Unable to register switch\n");
+               return ret;
+       }
+
+       ret = hellcreek_ptp_setup(hellcreek);
+       if (ret) {
+               dev_err(dev, "Failed to setup PTP!\n");
+               goto err_ptp_setup;
+       }
+
+       ret = hellcreek_hwtstamp_setup(hellcreek);
+       if (ret) {
+               dev_err(dev, "Failed to setup hardware timestamping!\n");
+               goto err_tstamp_setup;
+       }
+
+       platform_set_drvdata(pdev, hellcreek);
+
+       return 0;
+
+err_tstamp_setup:
+       hellcreek_ptp_free(hellcreek);
+err_ptp_setup:
+       dsa_unregister_switch(hellcreek->ds);
+
+       return ret;
+}
+
+static int hellcreek_remove(struct platform_device *pdev)
+{
+       struct hellcreek *hellcreek = platform_get_drvdata(pdev);
+
+       hellcreek_hwtstamp_free(hellcreek);
+       hellcreek_ptp_free(hellcreek);
+       dsa_unregister_switch(hellcreek->ds);
+       platform_set_drvdata(pdev, NULL);
+
+       return 0;
+}
+
+static const struct hellcreek_platform_data de1soc_r1_pdata = {
+       .num_ports       = 4,
+       .is_100_mbits    = 1,
+       .qbv_support     = 1,
+       .qbv_on_cpu_port = 1,
+       .qbu_support     = 0,
+       .module_id       = 0x4c30,
+};
+
+static const struct of_device_id hellcreek_of_match[] = {
+       {
+               .compatible = "hirschmann,hellcreek-de1soc-r1",
+               .data       = &de1soc_r1_pdata,
+       },
+       { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, hellcreek_of_match);
+
+static struct platform_driver hellcreek_driver = {
+       .probe  = hellcreek_probe,
+       .remove = hellcreek_remove,
+       .driver = {
+               .name = "hellcreek",
+               .of_match_table = hellcreek_of_match,
+       },
+};
+module_platform_driver(hellcreek_driver);
+
+MODULE_AUTHOR("Kurt Kanzenbach <kurt@linutronix.de>");
+MODULE_DESCRIPTION("Hirschmann Hellcreek driver");
+MODULE_LICENSE("Dual MIT/GPL");
diff --git a/drivers/net/dsa/hirschmann/hellcreek.h b/drivers/net/dsa/hirschmann/hellcreek.h
new file mode 100644 (file)
index 0000000..e81781e
--- /dev/null
@@ -0,0 +1,286 @@
+/* SPDX-License-Identifier: (GPL-2.0 or MIT) */
+/*
+ * DSA driver for:
+ * Hirschmann Hellcreek TSN switch.
+ *
+ * Copyright (C) 2019,2020 Linutronix GmbH
+ * Author Kurt Kanzenbach <kurt@linutronix.de>
+ */
+
+#ifndef _HELLCREEK_H_
+#define _HELLCREEK_H_
+
+#include <linux/bitmap.h>
+#include <linux/bitops.h>
+#include <linux/device.h>
+#include <linux/kernel.h>
+#include <linux/mutex.h>
+#include <linux/workqueue.h>
+#include <linux/leds.h>
+#include <linux/platform_data/hirschmann-hellcreek.h>
+#include <linux/ptp_clock_kernel.h>
+#include <linux/timecounter.h>
+#include <net/dsa.h>
+
+/* Ports:
+ *  - 0: CPU
+ *  - 1: Tunnel
+ *  - 2: TSN front port 1
+ *  - 3: TSN front port 2
+ *  - ...
+ */
+#define CPU_PORT                       0
+#define TUNNEL_PORT                    1
+
+#define HELLCREEK_VLAN_NO_MEMBER       0x0
+#define HELLCREEK_VLAN_UNTAGGED_MEMBER 0x1
+#define HELLCREEK_VLAN_TAGGED_MEMBER   0x3
+#define HELLCREEK_NUM_EGRESS_QUEUES    8
+
+/* Register definitions */
+#define HR_MODID_C                     (0 * 2)
+#define HR_REL_L_C                     (1 * 2)
+#define HR_REL_H_C                     (2 * 2)
+#define HR_BLD_L_C                     (3 * 2)
+#define HR_BLD_H_C                     (4 * 2)
+#define HR_CTRL_C                      (5 * 2)
+#define HR_CTRL_C_READY                        BIT(14)
+#define HR_CTRL_C_TRANSITION           BIT(13)
+#define HR_CTRL_C_ENABLE               BIT(0)
+
+#define HR_PSEL                                (0xa6 * 2)
+#define HR_PSEL_PTWSEL_SHIFT           4
+#define HR_PSEL_PTWSEL_MASK            GENMASK(5, 4)
+#define HR_PSEL_PRTCWSEL_SHIFT         0
+#define HR_PSEL_PRTCWSEL_MASK          GENMASK(2, 0)
+
+#define HR_PTCFG                       (0xa7 * 2)
+#define HR_PTCFG_MLIMIT_EN             BIT(13)
+#define HR_PTCFG_UMC_FLT               BIT(10)
+#define HR_PTCFG_UUC_FLT               BIT(9)
+#define HR_PTCFG_UNTRUST               BIT(8)
+#define HR_PTCFG_TAG_REQUIRED          BIT(7)
+#define HR_PTCFG_PPRIO_SHIFT           4
+#define HR_PTCFG_PPRIO_MASK            GENMASK(6, 4)
+#define HR_PTCFG_INGRESSFLT            BIT(3)
+#define HR_PTCFG_BLOCKED               BIT(2)
+#define HR_PTCFG_LEARNING_EN           BIT(1)
+#define HR_PTCFG_ADMIN_EN              BIT(0)
+
+#define HR_PRTCCFG                     (0xa8 * 2)
+#define HR_PRTCCFG_PCP_TC_MAP_SHIFT    0
+#define HR_PRTCCFG_PCP_TC_MAP_MASK     GENMASK(2, 0)
+
+#define HR_CSEL                                (0x8d * 2)
+#define HR_CSEL_SHIFT                  0
+#define HR_CSEL_MASK                   GENMASK(7, 0)
+#define HR_CRDL                                (0x8e * 2)
+#define HR_CRDH                                (0x8f * 2)
+
+#define HR_SWTRC_CFG                   (0x90 * 2)
+#define HR_SWTRC0                      (0x91 * 2)
+#define HR_SWTRC1                      (0x92 * 2)
+#define HR_PFREE                       (0x93 * 2)
+#define HR_MFREE                       (0x94 * 2)
+
+#define HR_FDBAGE                      (0x97 * 2)
+#define HR_FDBMAX                      (0x98 * 2)
+#define HR_FDBRDL                      (0x99 * 2)
+#define HR_FDBRDM                      (0x9a * 2)
+#define HR_FDBRDH                      (0x9b * 2)
+
+#define HR_FDBMDRD                     (0x9c * 2)
+#define HR_FDBMDRD_PORTMASK_SHIFT      0
+#define HR_FDBMDRD_PORTMASK_MASK       GENMASK(3, 0)
+#define HR_FDBMDRD_AGE_SHIFT           4
+#define HR_FDBMDRD_AGE_MASK            GENMASK(7, 4)
+#define HR_FDBMDRD_OBT                 BIT(8)
+#define HR_FDBMDRD_PASS_BLOCKED                BIT(9)
+#define HR_FDBMDRD_STATIC              BIT(11)
+#define HR_FDBMDRD_REPRIO_TC_SHIFT     12
+#define HR_FDBMDRD_REPRIO_TC_MASK      GENMASK(14, 12)
+#define HR_FDBMDRD_REPRIO_EN           BIT(15)
+
+#define HR_FDBWDL                      (0x9d * 2)
+#define HR_FDBWDM                      (0x9e * 2)
+#define HR_FDBWDH                      (0x9f * 2)
+#define HR_FDBWRM0                     (0xa0 * 2)
+#define HR_FDBWRM0_PORTMASK_SHIFT      0
+#define HR_FDBWRM0_PORTMASK_MASK       GENMASK(3, 0)
+#define HR_FDBWRM0_OBT                 BIT(8)
+#define HR_FDBWRM0_PASS_BLOCKED                BIT(9)
+#define HR_FDBWRM0_REPRIO_TC_SHIFT     12
+#define HR_FDBWRM0_REPRIO_TC_MASK      GENMASK(14, 12)
+#define HR_FDBWRM0_REPRIO_EN           BIT(15)
+#define HR_FDBWRM1                     (0xa1 * 2)
+
+#define HR_FDBWRCMD                    (0xa2 * 2)
+#define HR_FDBWRCMD_FDBDEL             BIT(9)
+
+#define HR_SWCFG                       (0xa3 * 2)
+#define HR_SWCFG_GM_STATEMD            BIT(15)
+#define HR_SWCFG_LAS_MODE_SHIFT                12
+#define HR_SWCFG_LAS_MODE_MASK         GENMASK(13, 12)
+#define HR_SWCFG_LAS_OFF               (0x00)
+#define HR_SWCFG_LAS_ON                        (0x01)
+#define HR_SWCFG_LAS_STATIC            (0x10)
+#define HR_SWCFG_CT_EN                 BIT(11)
+#define HR_SWCFG_VLAN_UNAWARE          BIT(10)
+#define HR_SWCFG_ALWAYS_OBT            BIT(9)
+#define HR_SWCFG_FDBAGE_EN             BIT(5)
+#define HR_SWCFG_FDBLRN_EN             BIT(4)
+
+#define HR_SWSTAT                      (0xa4 * 2)
+#define HR_SWSTAT_FAIL                 BIT(4)
+#define HR_SWSTAT_BUSY                 BIT(0)
+
+#define HR_SWCMD                       (0xa5 * 2)
+#define HW_SWCMD_FLUSH                 BIT(0)
+
+#define HR_VIDCFG                      (0xaa * 2)
+#define HR_VIDCFG_VID_SHIFT            0
+#define HR_VIDCFG_VID_MASK             GENMASK(11, 0)
+#define HR_VIDCFG_PVID                 BIT(12)
+
+#define HR_VIDMBRCFG                   (0xab * 2)
+#define HR_VIDMBRCFG_P0MBR_SHIFT       0
+#define HR_VIDMBRCFG_P0MBR_MASK                GENMASK(1, 0)
+#define HR_VIDMBRCFG_P1MBR_SHIFT       2
+#define HR_VIDMBRCFG_P1MBR_MASK                GENMASK(3, 2)
+#define HR_VIDMBRCFG_P2MBR_SHIFT       4
+#define HR_VIDMBRCFG_P2MBR_MASK                GENMASK(5, 4)
+#define HR_VIDMBRCFG_P3MBR_SHIFT       6
+#define HR_VIDMBRCFG_P3MBR_MASK                GENMASK(7, 6)
+
+#define HR_FEABITS0                    (0xac * 2)
+#define HR_FEABITS0_FDBBINS_SHIFT      4
+#define HR_FEABITS0_FDBBINS_MASK       GENMASK(7, 4)
+#define HR_FEABITS0_PCNT_SHIFT         8
+#define HR_FEABITS0_PCNT_MASK          GENMASK(11, 8)
+#define HR_FEABITS0_MCNT_SHIFT         12
+#define HR_FEABITS0_MCNT_MASK          GENMASK(15, 12)
+
+#define TR_QTRACK                      (0xb1 * 2)
+#define TR_TGDVER                      (0xb3 * 2)
+#define TR_TGDVER_REV_MIN_MASK         GENMASK(7, 0)
+#define TR_TGDVER_REV_MIN_SHIFT                0
+#define TR_TGDVER_REV_MAJ_MASK         GENMASK(15, 8)
+#define TR_TGDVER_REV_MAJ_SHIFT                8
+#define TR_TGDSEL                      (0xb4 * 2)
+#define TR_TGDSEL_TDGSEL_MASK          GENMASK(1, 0)
+#define TR_TGDSEL_TDGSEL_SHIFT         0
+#define TR_TGDCTRL                     (0xb5 * 2)
+#define TR_TGDCTRL_GATE_EN             BIT(0)
+#define TR_TGDCTRL_CYC_SNAP            BIT(4)
+#define TR_TGDCTRL_SNAP_EST            BIT(5)
+#define TR_TGDCTRL_ADMINGATESTATES_MASK        GENMASK(15, 8)
+#define TR_TGDCTRL_ADMINGATESTATES_SHIFT       8
+#define TR_TGDSTAT0                    (0xb6 * 2)
+#define TR_TGDSTAT1                    (0xb7 * 2)
+#define TR_ESTWRL                      (0xb8 * 2)
+#define TR_ESTWRH                      (0xb9 * 2)
+#define TR_ESTCMD                      (0xba * 2)
+#define TR_ESTCMD_ESTSEC_MASK          GENMASK(2, 0)
+#define TR_ESTCMD_ESTSEC_SHIFT         0
+#define TR_ESTCMD_ESTARM               BIT(4)
+#define TR_ESTCMD_ESTSWCFG             BIT(5)
+#define TR_EETWRL                      (0xbb * 2)
+#define TR_EETWRH                      (0xbc * 2)
+#define TR_EETCMD                      (0xbd * 2)
+#define TR_EETCMD_EETSEC_MASK          GEMASK(2, 0)
+#define TR_EETCMD_EETSEC_SHIFT         0
+#define TR_EETCMD_EETARM               BIT(4)
+#define TR_CTWRL                       (0xbe * 2)
+#define TR_CTWRH                       (0xbf * 2)
+#define TR_LCNSL                       (0xc1 * 2)
+#define TR_LCNSH                       (0xc2 * 2)
+#define TR_LCS                         (0xc3 * 2)
+#define TR_GCLDAT                      (0xc4 * 2)
+#define TR_GCLDAT_GCLWRGATES_MASK      GENMASK(7, 0)
+#define TR_GCLDAT_GCLWRGATES_SHIFT     0
+#define TR_GCLDAT_GCLWRLAST            BIT(8)
+#define TR_GCLDAT_GCLOVRI              BIT(9)
+#define TR_GCLTIL                      (0xc5 * 2)
+#define TR_GCLTIH                      (0xc6 * 2)
+#define TR_GCLCMD                      (0xc7 * 2)
+#define TR_GCLCMD_GCLWRADR_MASK                GENMASK(7, 0)
+#define TR_GCLCMD_GCLWRADR_SHIFT       0
+#define TR_GCLCMD_INIT_GATE_STATES_MASK        GENMASK(15, 8)
+#define TR_GCLCMD_INIT_GATE_STATES_SHIFT       8
+
+struct hellcreek_counter {
+       u8 offset;
+       const char *name;
+};
+
+struct hellcreek;
+
+/* State flags for hellcreek_port_hwtstamp::state */
+enum {
+       HELLCREEK_HWTSTAMP_ENABLED,
+       HELLCREEK_HWTSTAMP_TX_IN_PROGRESS,
+};
+
+/* A structure to hold hardware timestamping information per port */
+struct hellcreek_port_hwtstamp {
+       /* Timestamping state */
+       unsigned long state;
+
+       /* Resources for receive timestamping */
+       struct sk_buff_head rx_queue; /* For synchronization messages */
+
+       /* Resources for transmit timestamping */
+       unsigned long tx_tstamp_start;
+       struct sk_buff *tx_skb;
+
+       /* Current timestamp configuration */
+       struct hwtstamp_config tstamp_config;
+};
+
+struct hellcreek_port {
+       struct hellcreek *hellcreek;
+       unsigned long *vlan_dev_bitmap;
+       int port;
+       u16 ptcfg;              /* ptcfg shadow */
+       u64 *counter_values;
+
+       /* Per-port timestamping resources */
+       struct hellcreek_port_hwtstamp port_hwtstamp;
+};
+
+struct hellcreek_fdb_entry {
+       size_t idx;
+       unsigned char mac[ETH_ALEN];
+       u8 portmask;
+       u8 age;
+       u8 is_obt;
+       u8 pass_blocked;
+       u8 is_static;
+       u8 reprio_tc;
+       u8 reprio_en;
+};
+
+struct hellcreek {
+       const struct hellcreek_platform_data *pdata;
+       struct device *dev;
+       struct dsa_switch *ds;
+       struct ptp_clock *ptp_clock;
+       struct ptp_clock_info ptp_clock_info;
+       struct hellcreek_port *ports;
+       struct delayed_work overflow_work;
+       struct led_classdev led_is_gm;
+       struct led_classdev led_sync_good;
+       struct mutex reg_lock;  /* Switch IP register lock */
+       struct mutex vlan_lock; /* VLAN bitmaps lock */
+       struct mutex ptp_lock;  /* PTP IP register lock */
+       void __iomem *base;
+       void __iomem *ptp_base;
+       u16 swcfg;              /* swcfg shadow */
+       u8 *vidmbrcfg;          /* vidmbrcfg shadow */
+       u64 seconds;            /* PTP seconds */
+       u64 last_ts;            /* Used for overflow detection */
+       u16 status_out;         /* ptp.status_out shadow */
+       size_t fdb_entries;
+};
+
+#endif /* _HELLCREEK_H_ */
diff --git a/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c b/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c
new file mode 100644 (file)
index 0000000..69dd9a2
--- /dev/null
@@ -0,0 +1,479 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * DSA driver for:
+ * Hirschmann Hellcreek TSN switch.
+ *
+ * Copyright (C) 2019,2020 Hochschule Offenburg
+ * Copyright (C) 2019,2020 Linutronix GmbH
+ * Authors: Kamil Alkhouri <kamil.alkhouri@hs-offenburg.de>
+ *         Kurt Kanzenbach <kurt@linutronix.de>
+ */
+
+#include <linux/ptp_classify.h>
+
+#include "hellcreek.h"
+#include "hellcreek_hwtstamp.h"
+#include "hellcreek_ptp.h"
+
+int hellcreek_get_ts_info(struct dsa_switch *ds, int port,
+                         struct ethtool_ts_info *info)
+{
+       struct hellcreek *hellcreek = ds->priv;
+
+       info->phc_index = hellcreek->ptp_clock ?
+               ptp_clock_index(hellcreek->ptp_clock) : -1;
+       info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE |
+               SOF_TIMESTAMPING_RX_HARDWARE |
+               SOF_TIMESTAMPING_RAW_HARDWARE;
+
+       /* enabled tx timestamping */
+       info->tx_types = BIT(HWTSTAMP_TX_ON);
+
+       /* L2 & L4 PTPv2 event rx messages are timestamped */
+       info->rx_filters = BIT(HWTSTAMP_FILTER_PTP_V2_EVENT);
+
+       return 0;
+}
+
+/* Enabling/disabling TX and RX HW timestamping for different PTP messages is
+ * not available in the switch. Thus, this function only serves as a check if
+ * the user requested what is actually available or not
+ */
+static int hellcreek_set_hwtstamp_config(struct hellcreek *hellcreek, int port,
+                                        struct hwtstamp_config *config)
+{
+       struct hellcreek_port_hwtstamp *ps =
+               &hellcreek->ports[port].port_hwtstamp;
+       bool tx_tstamp_enable = false;
+       bool rx_tstamp_enable = false;
+
+       /* Interaction with the timestamp hardware is prevented here.  It is
+        * enabled when this config function ends successfully
+        */
+       clear_bit_unlock(HELLCREEK_HWTSTAMP_ENABLED, &ps->state);
+
+       /* Reserved for future extensions */
+       if (config->flags)
+               return -EINVAL;
+
+       switch (config->tx_type) {
+       case HWTSTAMP_TX_ON:
+               tx_tstamp_enable = true;
+               break;
+
+       /* TX HW timestamping can't be disabled on the switch */
+       case HWTSTAMP_TX_OFF:
+               config->tx_type = HWTSTAMP_TX_ON;
+               break;
+
+       default:
+               return -ERANGE;
+       }
+
+       switch (config->rx_filter) {
+       /* RX HW timestamping can't be disabled on the switch */
+       case HWTSTAMP_FILTER_NONE:
+               config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
+               break;
+
+       case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
+       case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
+       case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
+       case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
+       case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
+       case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
+       case HWTSTAMP_FILTER_PTP_V2_EVENT:
+       case HWTSTAMP_FILTER_PTP_V2_SYNC:
+       case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
+               config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
+               rx_tstamp_enable = true;
+               break;
+
+       /* RX HW timestamping can't be enabled for all messages on the switch */
+       case HWTSTAMP_FILTER_ALL:
+               config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
+               break;
+
+       default:
+               return -ERANGE;
+       }
+
+       if (!tx_tstamp_enable)
+               return -ERANGE;
+
+       if (!rx_tstamp_enable)
+               return -ERANGE;
+
+       /* If this point is reached, then the requested hwtstamp config is
+        * compatible with the hwtstamp offered by the switch.  Therefore,
+        * enable the interaction with the HW timestamping
+        */
+       set_bit(HELLCREEK_HWTSTAMP_ENABLED, &ps->state);
+
+       return 0;
+}
+
+int hellcreek_port_hwtstamp_set(struct dsa_switch *ds, int port,
+                               struct ifreq *ifr)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       struct hellcreek_port_hwtstamp *ps;
+       struct hwtstamp_config config;
+       int err;
+
+       ps = &hellcreek->ports[port].port_hwtstamp;
+
+       if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
+               return -EFAULT;
+
+       err = hellcreek_set_hwtstamp_config(hellcreek, port, &config);
+       if (err)
+               return err;
+
+       /* Save the chosen configuration to be returned later */
+       memcpy(&ps->tstamp_config, &config, sizeof(config));
+
+       return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
+               -EFAULT : 0;
+}
+
+int hellcreek_port_hwtstamp_get(struct dsa_switch *ds, int port,
+                               struct ifreq *ifr)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       struct hellcreek_port_hwtstamp *ps;
+       struct hwtstamp_config *config;
+
+       ps = &hellcreek->ports[port].port_hwtstamp;
+       config = &ps->tstamp_config;
+
+       return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ?
+               -EFAULT : 0;
+}
+
+/* Returns a pointer to the PTP header if the caller should time stamp, or NULL
+ * if the caller should not.
+ */
+static struct ptp_header *hellcreek_should_tstamp(struct hellcreek *hellcreek,
+                                                 int port, struct sk_buff *skb,
+                                                 unsigned int type)
+{
+       struct hellcreek_port_hwtstamp *ps =
+               &hellcreek->ports[port].port_hwtstamp;
+       struct ptp_header *hdr;
+
+       hdr = ptp_parse_header(skb, type);
+       if (!hdr)
+               return NULL;
+
+       if (!test_bit(HELLCREEK_HWTSTAMP_ENABLED, &ps->state))
+               return NULL;
+
+       return hdr;
+}
+
+static u64 hellcreek_get_reserved_field(const struct ptp_header *hdr)
+{
+       return be32_to_cpu(hdr->reserved2);
+}
+
+static void hellcreek_clear_reserved_field(struct ptp_header *hdr)
+{
+       hdr->reserved2 = 0;
+}
+
+static int hellcreek_ptp_hwtstamp_available(struct hellcreek *hellcreek,
+                                           unsigned int ts_reg)
+{
+       u16 status;
+
+       status = hellcreek_ptp_read(hellcreek, ts_reg);
+
+       if (status & PR_TS_STATUS_TS_LOST)
+               dev_err(hellcreek->dev,
+                       "Tx time stamp lost! This should never happen!\n");
+
+       /* If hwtstamp is not available, this means the previous hwtstamp was
+        * successfully read, and the one we need is not yet available
+        */
+       return (status & PR_TS_STATUS_TS_AVAIL) ? 1 : 0;
+}
+
+/* Get nanoseconds timestamp from timestamping unit */
+static u64 hellcreek_ptp_hwtstamp_read(struct hellcreek *hellcreek,
+                                      unsigned int ts_reg)
+{
+       u16 nsl, nsh;
+
+       nsh = hellcreek_ptp_read(hellcreek, ts_reg);
+       nsh = hellcreek_ptp_read(hellcreek, ts_reg);
+       nsh = hellcreek_ptp_read(hellcreek, ts_reg);
+       nsh = hellcreek_ptp_read(hellcreek, ts_reg);
+       nsl = hellcreek_ptp_read(hellcreek, ts_reg);
+
+       return (u64)nsl | ((u64)nsh << 16);
+}
+
+static int hellcreek_txtstamp_work(struct hellcreek *hellcreek,
+                                  struct hellcreek_port_hwtstamp *ps, int port)
+{
+       struct skb_shared_hwtstamps shhwtstamps;
+       unsigned int status_reg, data_reg;
+       struct sk_buff *tmp_skb;
+       int ts_status;
+       u64 ns = 0;
+
+       if (!ps->tx_skb)
+               return 0;
+
+       switch (port) {
+       case 2:
+               status_reg = PR_TS_TX_P1_STATUS_C;
+               data_reg   = PR_TS_TX_P1_DATA_C;
+               break;
+       case 3:
+               status_reg = PR_TS_TX_P2_STATUS_C;
+               data_reg   = PR_TS_TX_P2_DATA_C;
+               break;
+       default:
+               dev_err(hellcreek->dev, "Wrong port for timestamping!\n");
+               return 0;
+       }
+
+       ts_status = hellcreek_ptp_hwtstamp_available(hellcreek, status_reg);
+
+       /* Not available yet? */
+       if (ts_status == 0) {
+               /* Check whether the operation of reading the tx timestamp has
+                * exceeded its allowed period
+                */
+               if (time_is_before_jiffies(ps->tx_tstamp_start +
+                                          TX_TSTAMP_TIMEOUT)) {
+                       dev_err(hellcreek->dev,
+                               "Timeout while waiting for Tx timestamp!\n");
+                       goto free_and_clear_skb;
+               }
+
+               /* The timestamp should be available quickly, while getting it
+                * in high priority. Restart the work
+                */
+               return 1;
+       }
+
+       mutex_lock(&hellcreek->ptp_lock);
+       ns  = hellcreek_ptp_hwtstamp_read(hellcreek, data_reg);
+       ns += hellcreek_ptp_gettime_seconds(hellcreek, ns);
+       mutex_unlock(&hellcreek->ptp_lock);
+
+       /* Now we have the timestamp in nanoseconds, store it in the correct
+        * structure in order to send it to the user
+        */
+       memset(&shhwtstamps, 0, sizeof(shhwtstamps));
+       shhwtstamps.hwtstamp = ns_to_ktime(ns);
+
+       tmp_skb = ps->tx_skb;
+       ps->tx_skb = NULL;
+
+       /* skb_complete_tx_timestamp() frees up the client to make another
+        * timestampable transmit.  We have to be ready for it by clearing the
+        * ps->tx_skb "flag" beforehand
+        */
+       clear_bit_unlock(HELLCREEK_HWTSTAMP_TX_IN_PROGRESS, &ps->state);
+
+       /* Deliver a clone of the original outgoing tx_skb with tx hwtstamp */
+       skb_complete_tx_timestamp(tmp_skb, &shhwtstamps);
+
+       return 0;
+
+free_and_clear_skb:
+       dev_kfree_skb_any(ps->tx_skb);
+       ps->tx_skb = NULL;
+       clear_bit_unlock(HELLCREEK_HWTSTAMP_TX_IN_PROGRESS, &ps->state);
+
+       return 0;
+}
+
+static void hellcreek_get_rxts(struct hellcreek *hellcreek,
+                              struct hellcreek_port_hwtstamp *ps,
+                              struct sk_buff *skb, struct sk_buff_head *rxq,
+                              int port)
+{
+       struct skb_shared_hwtstamps *shwt;
+       struct sk_buff_head received;
+       unsigned long flags;
+
+       /* The latched timestamp belongs to one of the received frames. */
+       __skb_queue_head_init(&received);
+
+       /* Lock & disable interrupts */
+       spin_lock_irqsave(&rxq->lock, flags);
+
+       /* Add the reception queue "rxq" to the "received" queue an reintialize
+        * "rxq".  From now on, we deal with "received" not with "rxq"
+        */
+       skb_queue_splice_tail_init(rxq, &received);
+
+       spin_unlock_irqrestore(&rxq->lock, flags);
+
+       for (; skb; skb = __skb_dequeue(&received)) {
+               struct ptp_header *hdr;
+               unsigned int type;
+               u64 ns;
+
+               /* Get nanoseconds from ptp packet */
+               type = SKB_PTP_TYPE(skb);
+               hdr  = ptp_parse_header(skb, type);
+               ns   = hellcreek_get_reserved_field(hdr);
+               hellcreek_clear_reserved_field(hdr);
+
+               /* Add seconds part */
+               mutex_lock(&hellcreek->ptp_lock);
+               ns += hellcreek_ptp_gettime_seconds(hellcreek, ns);
+               mutex_unlock(&hellcreek->ptp_lock);
+
+               /* Save time stamp */
+               shwt = skb_hwtstamps(skb);
+               memset(shwt, 0, sizeof(*shwt));
+               shwt->hwtstamp = ns_to_ktime(ns);
+               netif_rx_ni(skb);
+       }
+}
+
+static void hellcreek_rxtstamp_work(struct hellcreek *hellcreek,
+                                   struct hellcreek_port_hwtstamp *ps,
+                                   int port)
+{
+       struct sk_buff *skb;
+
+       skb = skb_dequeue(&ps->rx_queue);
+       if (skb)
+               hellcreek_get_rxts(hellcreek, ps, skb, &ps->rx_queue, port);
+}
+
+long hellcreek_hwtstamp_work(struct ptp_clock_info *ptp)
+{
+       struct hellcreek *hellcreek = ptp_to_hellcreek(ptp);
+       struct dsa_switch *ds = hellcreek->ds;
+       int i, restart = 0;
+
+       for (i = 0; i < ds->num_ports; i++) {
+               struct hellcreek_port_hwtstamp *ps;
+
+               if (!dsa_is_user_port(ds, i))
+                       continue;
+
+               ps = &hellcreek->ports[i].port_hwtstamp;
+
+               if (test_bit(HELLCREEK_HWTSTAMP_TX_IN_PROGRESS, &ps->state))
+                       restart |= hellcreek_txtstamp_work(hellcreek, ps, i);
+
+               hellcreek_rxtstamp_work(hellcreek, ps, i);
+       }
+
+       return restart ? 1 : -1;
+}
+
+bool hellcreek_port_txtstamp(struct dsa_switch *ds, int port,
+                            struct sk_buff *clone, unsigned int type)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       struct hellcreek_port_hwtstamp *ps;
+       struct ptp_header *hdr;
+
+       ps = &hellcreek->ports[port].port_hwtstamp;
+
+       /* Check if the driver is expected to do HW timestamping */
+       if (!(skb_shinfo(clone)->tx_flags & SKBTX_HW_TSTAMP))
+               return false;
+
+       /* Make sure the message is a PTP message that needs to be timestamped
+        * and the interaction with the HW timestamping is enabled. If not, stop
+        * here
+        */
+       hdr = hellcreek_should_tstamp(hellcreek, port, clone, type);
+       if (!hdr)
+               return false;
+
+       if (test_and_set_bit_lock(HELLCREEK_HWTSTAMP_TX_IN_PROGRESS,
+                                 &ps->state))
+               return false;
+
+       ps->tx_skb = clone;
+
+       /* store the number of ticks occurred since system start-up till this
+        * moment
+        */
+       ps->tx_tstamp_start = jiffies;
+
+       ptp_schedule_worker(hellcreek->ptp_clock, 0);
+
+       return true;
+}
+
+bool hellcreek_port_rxtstamp(struct dsa_switch *ds, int port,
+                            struct sk_buff *skb, unsigned int type)
+{
+       struct hellcreek *hellcreek = ds->priv;
+       struct hellcreek_port_hwtstamp *ps;
+       struct ptp_header *hdr;
+
+       ps = &hellcreek->ports[port].port_hwtstamp;
+
+       /* This check only fails if the user did not initialize hardware
+        * timestamping beforehand.
+        */
+       if (ps->tstamp_config.rx_filter != HWTSTAMP_FILTER_PTP_V2_EVENT)
+               return false;
+
+       /* Make sure the message is a PTP message that needs to be timestamped
+        * and the interaction with the HW timestamping is enabled. If not, stop
+        * here
+        */
+       hdr = hellcreek_should_tstamp(hellcreek, port, skb, type);
+       if (!hdr)
+               return false;
+
+       SKB_PTP_TYPE(skb) = type;
+
+       skb_queue_tail(&ps->rx_queue, skb);
+
+       ptp_schedule_worker(hellcreek->ptp_clock, 0);
+
+       return true;
+}
+
+static void hellcreek_hwtstamp_port_setup(struct hellcreek *hellcreek, int port)
+{
+       struct hellcreek_port_hwtstamp *ps =
+               &hellcreek->ports[port].port_hwtstamp;
+
+       skb_queue_head_init(&ps->rx_queue);
+}
+
+int hellcreek_hwtstamp_setup(struct hellcreek *hellcreek)
+{
+       struct dsa_switch *ds = hellcreek->ds;
+       int i;
+
+       /* Initialize timestamping ports. */
+       for (i = 0; i < ds->num_ports; ++i) {
+               if (!dsa_is_user_port(ds, i))
+                       continue;
+
+               hellcreek_hwtstamp_port_setup(hellcreek, i);
+       }
+
+       /* Select the synchronized clock as the source timekeeper for the
+        * timestamps and enable inline timestamping.
+        */
+       hellcreek_ptp_write(hellcreek, PR_SETTINGS_C_TS_SRC_TK_MASK |
+                           PR_SETTINGS_C_RES3TS,
+                           PR_SETTINGS_C);
+
+       return 0;
+}
+
+void hellcreek_hwtstamp_free(struct hellcreek *hellcreek)
+{
+       /* Nothing todo */
+}
diff --git a/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h b/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h
new file mode 100644 (file)
index 0000000..c0745ff
--- /dev/null
@@ -0,0 +1,58 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
+/*
+ * DSA driver for:
+ * Hirschmann Hellcreek TSN switch.
+ *
+ * Copyright (C) 2019,2020 Hochschule Offenburg
+ * Copyright (C) 2019,2020 Linutronix GmbH
+ * Authors: Kurt Kanzenbach <kurt@linutronix.de>
+ *         Kamil Alkhouri <kamil.alkhouri@hs-offenburg.de>
+ */
+
+#ifndef _HELLCREEK_HWTSTAMP_H_
+#define _HELLCREEK_HWTSTAMP_H_
+
+#include <net/dsa.h>
+#include "hellcreek.h"
+
+/* Timestamp Register */
+#define PR_TS_RX_P1_STATUS_C   (0x1d * 2)
+#define PR_TS_RX_P1_DATA_C     (0x1e * 2)
+#define PR_TS_TX_P1_STATUS_C   (0x1f * 2)
+#define PR_TS_TX_P1_DATA_C     (0x20 * 2)
+#define PR_TS_RX_P2_STATUS_C   (0x25 * 2)
+#define PR_TS_RX_P2_DATA_C     (0x26 * 2)
+#define PR_TS_TX_P2_STATUS_C   (0x27 * 2)
+#define PR_TS_TX_P2_DATA_C     (0x28 * 2)
+
+#define PR_TS_STATUS_TS_AVAIL  BIT(2)
+#define PR_TS_STATUS_TS_LOST   BIT(3)
+
+#define SKB_PTP_TYPE(__skb) (*(unsigned int *)((__skb)->cb))
+
+/* TX_TSTAMP_TIMEOUT: This limits the time spent polling for a TX
+ * timestamp. When working properly, hardware will produce a timestamp
+ * within 1ms. Software may enounter delays, so the timeout is set
+ * accordingly.
+ */
+#define TX_TSTAMP_TIMEOUT      msecs_to_jiffies(40)
+
+int hellcreek_port_hwtstamp_set(struct dsa_switch *ds, int port,
+                               struct ifreq *ifr);
+int hellcreek_port_hwtstamp_get(struct dsa_switch *ds, int port,
+                               struct ifreq *ifr);
+
+bool hellcreek_port_rxtstamp(struct dsa_switch *ds, int port,
+                            struct sk_buff *clone, unsigned int type);
+bool hellcreek_port_txtstamp(struct dsa_switch *ds, int port,
+                            struct sk_buff *clone, unsigned int type);
+
+int hellcreek_get_ts_info(struct dsa_switch *ds, int port,
+                         struct ethtool_ts_info *info);
+
+long hellcreek_hwtstamp_work(struct ptp_clock_info *ptp);
+
+int hellcreek_hwtstamp_setup(struct hellcreek *chip);
+void hellcreek_hwtstamp_free(struct hellcreek *chip);
+
+#endif /* _HELLCREEK_HWTSTAMP_H_ */
diff --git a/drivers/net/dsa/hirschmann/hellcreek_ptp.c b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
new file mode 100644 (file)
index 0000000..2572c60
--- /dev/null
@@ -0,0 +1,452 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * DSA driver for:
+ * Hirschmann Hellcreek TSN switch.
+ *
+ * Copyright (C) 2019,2020 Hochschule Offenburg
+ * Copyright (C) 2019,2020 Linutronix GmbH
+ * Authors: Kamil Alkhouri <kamil.alkhouri@hs-offenburg.de>
+ *         Kurt Kanzenbach <kurt@linutronix.de>
+ */
+
+#include <linux/ptp_clock_kernel.h>
+#include "hellcreek.h"
+#include "hellcreek_ptp.h"
+#include "hellcreek_hwtstamp.h"
+
+u16 hellcreek_ptp_read(struct hellcreek *hellcreek, unsigned int offset)
+{
+       return readw(hellcreek->ptp_base + offset);
+}
+
+void hellcreek_ptp_write(struct hellcreek *hellcreek, u16 data,
+                        unsigned int offset)
+{
+       writew(data, hellcreek->ptp_base + offset);
+}
+
+/* Get nanoseconds from PTP clock */
+static u64 hellcreek_ptp_clock_read(struct hellcreek *hellcreek)
+{
+       u16 nsl, nsh;
+
+       /* Take a snapshot */
+       hellcreek_ptp_write(hellcreek, PR_COMMAND_C_SS, PR_COMMAND_C);
+
+       /* The time of the day is saved as 96 bits. However, due to hardware
+        * limitations the seconds are not or only partly kept in the PTP
+        * core. Currently only three bits for the seconds are available. That's
+        * why only the nanoseconds are used and the seconds are tracked in
+        * software. Anyway due to internal locking all five registers should be
+        * read.
+        */
+       nsh = hellcreek_ptp_read(hellcreek, PR_SS_SYNC_DATA_C);
+       nsh = hellcreek_ptp_read(hellcreek, PR_SS_SYNC_DATA_C);
+       nsh = hellcreek_ptp_read(hellcreek, PR_SS_SYNC_DATA_C);
+       nsh = hellcreek_ptp_read(hellcreek, PR_SS_SYNC_DATA_C);
+       nsl = hellcreek_ptp_read(hellcreek, PR_SS_SYNC_DATA_C);
+
+       return (u64)nsl | ((u64)nsh << 16);
+}
+
+static u64 __hellcreek_ptp_gettime(struct hellcreek *hellcreek)
+{
+       u64 ns;
+
+       ns = hellcreek_ptp_clock_read(hellcreek);
+       if (ns < hellcreek->last_ts)
+               hellcreek->seconds++;
+       hellcreek->last_ts = ns;
+       ns += hellcreek->seconds * NSEC_PER_SEC;
+
+       return ns;
+}
+
+/* Retrieve the seconds parts in nanoseconds for a packet timestamped with @ns.
+ * There has to be a check whether an overflow occurred between the packet
+ * arrival and now. If so use the correct seconds (-1) for calculating the
+ * packet arrival time.
+ */
+u64 hellcreek_ptp_gettime_seconds(struct hellcreek *hellcreek, u64 ns)
+{
+       u64 s;
+
+       __hellcreek_ptp_gettime(hellcreek);
+       if (hellcreek->last_ts > ns)
+               s = hellcreek->seconds * NSEC_PER_SEC;
+       else
+               s = (hellcreek->seconds - 1) * NSEC_PER_SEC;
+
+       return s;
+}
+
+static int hellcreek_ptp_gettime(struct ptp_clock_info *ptp,
+                                struct timespec64 *ts)
+{
+       struct hellcreek *hellcreek = ptp_to_hellcreek(ptp);
+       u64 ns;
+
+       mutex_lock(&hellcreek->ptp_lock);
+       ns = __hellcreek_ptp_gettime(hellcreek);
+       mutex_unlock(&hellcreek->ptp_lock);
+
+       *ts = ns_to_timespec64(ns);
+
+       return 0;
+}
+
+static int hellcreek_ptp_settime(struct ptp_clock_info *ptp,
+                                const struct timespec64 *ts)
+{
+       struct hellcreek *hellcreek = ptp_to_hellcreek(ptp);
+       u16 secl, nsh, nsl;
+
+       secl = ts->tv_sec & 0xffff;
+       nsh  = ((u32)ts->tv_nsec & 0xffff0000) >> 16;
+       nsl  = ts->tv_nsec & 0xffff;
+
+       mutex_lock(&hellcreek->ptp_lock);
+
+       /* Update overflow data structure */
+       hellcreek->seconds = ts->tv_sec;
+       hellcreek->last_ts = ts->tv_nsec;
+
+       /* Set time in clock */
+       hellcreek_ptp_write(hellcreek, 0x00, PR_CLOCK_WRITE_C);
+       hellcreek_ptp_write(hellcreek, 0x00, PR_CLOCK_WRITE_C);
+       hellcreek_ptp_write(hellcreek, secl, PR_CLOCK_WRITE_C);
+       hellcreek_ptp_write(hellcreek, nsh,  PR_CLOCK_WRITE_C);
+       hellcreek_ptp_write(hellcreek, nsl,  PR_CLOCK_WRITE_C);
+
+       mutex_unlock(&hellcreek->ptp_lock);
+
+       return 0;
+}
+
+static int hellcreek_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
+{
+       struct hellcreek *hellcreek = ptp_to_hellcreek(ptp);
+       u16 negative = 0, addendh, addendl;
+       u32 addend;
+       u64 adj;
+
+       if (scaled_ppm < 0) {
+               negative = 1;
+               scaled_ppm = -scaled_ppm;
+       }
+
+       /* IP-Core adjusts the nominal frequency by adding or subtracting 1 ns
+        * from the 8 ns (period of the oscillator) every time the accumulator
+        * register overflows. The value stored in the addend register is added
+        * to the accumulator register every 8 ns.
+        *
+        * addend value = (2^30 * accumulator_overflow_rate) /
+        *                oscillator_frequency
+        * where:
+        *
+        * oscillator_frequency = 125 MHz
+        * accumulator_overflow_rate = 125 MHz * scaled_ppm * 2^-16 * 10^-6 * 8
+        */
+       adj = scaled_ppm;
+       adj <<= 11;
+       addend = (u32)div_u64(adj, 15625);
+
+       addendh = (addend & 0xffff0000) >> 16;
+       addendl = addend & 0xffff;
+
+       negative = (negative << 15) & 0x8000;
+
+       mutex_lock(&hellcreek->ptp_lock);
+
+       /* Set drift register */
+       hellcreek_ptp_write(hellcreek, negative, PR_CLOCK_DRIFT_C);
+       hellcreek_ptp_write(hellcreek, 0x00, PR_CLOCK_DRIFT_C);
+       hellcreek_ptp_write(hellcreek, 0x00, PR_CLOCK_DRIFT_C);
+       hellcreek_ptp_write(hellcreek, addendh,  PR_CLOCK_DRIFT_C);
+       hellcreek_ptp_write(hellcreek, addendl,  PR_CLOCK_DRIFT_C);
+
+       mutex_unlock(&hellcreek->ptp_lock);
+
+       return 0;
+}
+
+static int hellcreek_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
+{
+       struct hellcreek *hellcreek = ptp_to_hellcreek(ptp);
+       u16 negative = 0, counth, countl;
+       u32 count_val;
+
+       /* If the offset is larger than IP-Core slow offset resources. Don't
+        * consider slow adjustment. Rather, add the offset directly to the
+        * current time
+        */
+       if (abs(delta) > MAX_SLOW_OFFSET_ADJ) {
+               struct timespec64 now, then = ns_to_timespec64(delta);
+
+               hellcreek_ptp_gettime(ptp, &now);
+               now = timespec64_add(now, then);
+               hellcreek_ptp_settime(ptp, &now);
+
+               return 0;
+       }
+
+       if (delta < 0) {
+               negative = 1;
+               delta = -delta;
+       }
+
+       /* 'count_val' does not exceed the maximum register size (2^30) */
+       count_val = div_s64(delta, MAX_NS_PER_STEP);
+
+       counth = (count_val & 0xffff0000) >> 16;
+       countl = count_val & 0xffff;
+
+       negative = (negative << 15) & 0x8000;
+
+       mutex_lock(&hellcreek->ptp_lock);
+
+       /* Set offset write register */
+       hellcreek_ptp_write(hellcreek, negative, PR_CLOCK_OFFSET_C);
+       hellcreek_ptp_write(hellcreek, MAX_NS_PER_STEP, PR_CLOCK_OFFSET_C);
+       hellcreek_ptp_write(hellcreek, MIN_CLK_CYCLES_BETWEEN_STEPS,
+                           PR_CLOCK_OFFSET_C);
+       hellcreek_ptp_write(hellcreek, countl,  PR_CLOCK_OFFSET_C);
+       hellcreek_ptp_write(hellcreek, counth,  PR_CLOCK_OFFSET_C);
+
+       mutex_unlock(&hellcreek->ptp_lock);
+
+       return 0;
+}
+
+static int hellcreek_ptp_enable(struct ptp_clock_info *ptp,
+                               struct ptp_clock_request *rq, int on)
+{
+       return -EOPNOTSUPP;
+}
+
+static void hellcreek_ptp_overflow_check(struct work_struct *work)
+{
+       struct delayed_work *dw = to_delayed_work(work);
+       struct hellcreek *hellcreek;
+
+       hellcreek = dw_overflow_to_hellcreek(dw);
+
+       mutex_lock(&hellcreek->ptp_lock);
+       __hellcreek_ptp_gettime(hellcreek);
+       mutex_unlock(&hellcreek->ptp_lock);
+
+       schedule_delayed_work(&hellcreek->overflow_work,
+                             HELLCREEK_OVERFLOW_PERIOD);
+}
+
+static enum led_brightness hellcreek_get_brightness(struct hellcreek *hellcreek,
+                                                   int led)
+{
+       return (hellcreek->status_out & led) ? 1 : 0;
+}
+
+static void hellcreek_set_brightness(struct hellcreek *hellcreek, int led,
+                                    enum led_brightness b)
+{
+       mutex_lock(&hellcreek->ptp_lock);
+
+       if (b)
+               hellcreek->status_out |= led;
+       else
+               hellcreek->status_out &= ~led;
+
+       hellcreek_ptp_write(hellcreek, hellcreek->status_out, STATUS_OUT);
+
+       mutex_unlock(&hellcreek->ptp_lock);
+}
+
+static void hellcreek_led_sync_good_set(struct led_classdev *ldev,
+                                       enum led_brightness b)
+{
+       struct hellcreek *hellcreek = led_to_hellcreek(ldev, led_sync_good);
+
+       hellcreek_set_brightness(hellcreek, STATUS_OUT_SYNC_GOOD, b);
+}
+
+static enum led_brightness hellcreek_led_sync_good_get(struct led_classdev *ldev)
+{
+       struct hellcreek *hellcreek = led_to_hellcreek(ldev, led_sync_good);
+
+       return hellcreek_get_brightness(hellcreek, STATUS_OUT_SYNC_GOOD);
+}
+
+static void hellcreek_led_is_gm_set(struct led_classdev *ldev,
+                                   enum led_brightness b)
+{
+       struct hellcreek *hellcreek = led_to_hellcreek(ldev, led_is_gm);
+
+       hellcreek_set_brightness(hellcreek, STATUS_OUT_IS_GM, b);
+}
+
+static enum led_brightness hellcreek_led_is_gm_get(struct led_classdev *ldev)
+{
+       struct hellcreek *hellcreek = led_to_hellcreek(ldev, led_is_gm);
+
+       return hellcreek_get_brightness(hellcreek, STATUS_OUT_IS_GM);
+}
+
+/* There two available LEDs internally called sync_good and is_gm. However, the
+ * user might want to use a different label and specify the default state. Take
+ * those properties from device tree.
+ */
+static int hellcreek_led_setup(struct hellcreek *hellcreek)
+{
+       struct device_node *leds, *led = NULL;
+       const char *label, *state;
+       int ret = -EINVAL;
+
+       leds = of_find_node_by_name(hellcreek->dev->of_node, "leds");
+       if (!leds) {
+               dev_err(hellcreek->dev, "No LEDs specified in device tree!\n");
+               return ret;
+       }
+
+       hellcreek->status_out = 0;
+
+       led = of_get_next_available_child(leds, led);
+       if (!led) {
+               dev_err(hellcreek->dev, "First LED not specified!\n");
+               goto out;
+       }
+
+       ret = of_property_read_string(led, "label", &label);
+       hellcreek->led_sync_good.name = ret ? "sync_good" : label;
+
+       ret = of_property_read_string(led, "default-state", &state);
+       if (!ret) {
+               if (!strcmp(state, "on"))
+                       hellcreek->led_sync_good.brightness = 1;
+               else if (!strcmp(state, "off"))
+                       hellcreek->led_sync_good.brightness = 0;
+               else if (!strcmp(state, "keep"))
+                       hellcreek->led_sync_good.brightness =
+                               hellcreek_get_brightness(hellcreek,
+                                                        STATUS_OUT_SYNC_GOOD);
+       }
+
+       hellcreek->led_sync_good.max_brightness = 1;
+       hellcreek->led_sync_good.brightness_set = hellcreek_led_sync_good_set;
+       hellcreek->led_sync_good.brightness_get = hellcreek_led_sync_good_get;
+
+       led = of_get_next_available_child(leds, led);
+       if (!led) {
+               dev_err(hellcreek->dev, "Second LED not specified!\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       ret = of_property_read_string(led, "label", &label);
+       hellcreek->led_is_gm.name = ret ? "is_gm" : label;
+
+       ret = of_property_read_string(led, "default-state", &state);
+       if (!ret) {
+               if (!strcmp(state, "on"))
+                       hellcreek->led_is_gm.brightness = 1;
+               else if (!strcmp(state, "off"))
+                       hellcreek->led_is_gm.brightness = 0;
+               else if (!strcmp(state, "keep"))
+                       hellcreek->led_is_gm.brightness =
+                               hellcreek_get_brightness(hellcreek,
+                                                        STATUS_OUT_IS_GM);
+       }
+
+       hellcreek->led_is_gm.max_brightness = 1;
+       hellcreek->led_is_gm.brightness_set = hellcreek_led_is_gm_set;
+       hellcreek->led_is_gm.brightness_get = hellcreek_led_is_gm_get;
+
+       /* Set initial state */
+       if (hellcreek->led_sync_good.brightness == 1)
+               hellcreek_set_brightness(hellcreek, STATUS_OUT_SYNC_GOOD, 1);
+       if (hellcreek->led_is_gm.brightness == 1)
+               hellcreek_set_brightness(hellcreek, STATUS_OUT_IS_GM, 1);
+
+       /* Register both leds */
+       led_classdev_register(hellcreek->dev, &hellcreek->led_sync_good);
+       led_classdev_register(hellcreek->dev, &hellcreek->led_is_gm);
+
+       ret = 0;
+
+out:
+       of_node_put(leds);
+
+       return ret;
+}
+
+int hellcreek_ptp_setup(struct hellcreek *hellcreek)
+{
+       u16 status;
+       int ret;
+
+       /* Set up the overflow work */
+       INIT_DELAYED_WORK(&hellcreek->overflow_work,
+                         hellcreek_ptp_overflow_check);
+
+       /* Setup PTP clock */
+       hellcreek->ptp_clock_info.owner = THIS_MODULE;
+       snprintf(hellcreek->ptp_clock_info.name,
+                sizeof(hellcreek->ptp_clock_info.name),
+                dev_name(hellcreek->dev));
+
+       /* IP-Core can add up to 0.5 ns per 8 ns cycle, which means
+        * accumulator_overflow_rate shall not exceed 62.5 MHz (which adjusts
+        * the nominal frequency by 6.25%)
+        */
+       hellcreek->ptp_clock_info.max_adj     = 62500000;
+       hellcreek->ptp_clock_info.n_alarm     = 0;
+       hellcreek->ptp_clock_info.n_pins      = 0;
+       hellcreek->ptp_clock_info.n_ext_ts    = 0;
+       hellcreek->ptp_clock_info.n_per_out   = 0;
+       hellcreek->ptp_clock_info.pps         = 0;
+       hellcreek->ptp_clock_info.adjfine     = hellcreek_ptp_adjfine;
+       hellcreek->ptp_clock_info.adjtime     = hellcreek_ptp_adjtime;
+       hellcreek->ptp_clock_info.gettime64   = hellcreek_ptp_gettime;
+       hellcreek->ptp_clock_info.settime64   = hellcreek_ptp_settime;
+       hellcreek->ptp_clock_info.enable      = hellcreek_ptp_enable;
+       hellcreek->ptp_clock_info.do_aux_work = hellcreek_hwtstamp_work;
+
+       hellcreek->ptp_clock = ptp_clock_register(&hellcreek->ptp_clock_info,
+                                                 hellcreek->dev);
+       if (IS_ERR(hellcreek->ptp_clock))
+               return PTR_ERR(hellcreek->ptp_clock);
+
+       /* Enable the offset correction process, if no offset correction is
+        * already taking place
+        */
+       status = hellcreek_ptp_read(hellcreek, PR_CLOCK_STATUS_C);
+       if (!(status & PR_CLOCK_STATUS_C_OFS_ACT))
+               hellcreek_ptp_write(hellcreek,
+                                   status | PR_CLOCK_STATUS_C_ENA_OFS,
+                                   PR_CLOCK_STATUS_C);
+
+       /* Enable the drift correction process */
+       hellcreek_ptp_write(hellcreek, status | PR_CLOCK_STATUS_C_ENA_DRIFT,
+                           PR_CLOCK_STATUS_C);
+
+       /* LED setup */
+       ret = hellcreek_led_setup(hellcreek);
+       if (ret) {
+               if (hellcreek->ptp_clock)
+                       ptp_clock_unregister(hellcreek->ptp_clock);
+               return ret;
+       }
+
+       schedule_delayed_work(&hellcreek->overflow_work,
+                             HELLCREEK_OVERFLOW_PERIOD);
+
+       return 0;
+}
+
+void hellcreek_ptp_free(struct hellcreek *hellcreek)
+{
+       led_classdev_unregister(&hellcreek->led_is_gm);
+       led_classdev_unregister(&hellcreek->led_sync_good);
+       cancel_delayed_work_sync(&hellcreek->overflow_work);
+       if (hellcreek->ptp_clock)
+               ptp_clock_unregister(hellcreek->ptp_clock);
+       hellcreek->ptp_clock = NULL;
+}
diff --git a/drivers/net/dsa/hirschmann/hellcreek_ptp.h b/drivers/net/dsa/hirschmann/hellcreek_ptp.h
new file mode 100644 (file)
index 0000000..0b51392
--- /dev/null
@@ -0,0 +1,76 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
+/*
+ * DSA driver for:
+ * Hirschmann Hellcreek TSN switch.
+ *
+ * Copyright (C) 2019,2020 Hochschule Offenburg
+ * Copyright (C) 2019,2020 Linutronix GmbH
+ * Authors: Kurt Kanzenbach <kurt@linutronix.de>
+ *         Kamil Alkhouri <kamil.alkhouri@hs-offenburg.de>
+ */
+
+#ifndef _HELLCREEK_PTP_H_
+#define _HELLCREEK_PTP_H_
+
+#include <linux/bitops.h>
+#include <linux/ptp_clock_kernel.h>
+
+#include "hellcreek.h"
+
+/* Every jump in time is 7 ns */
+#define MAX_NS_PER_STEP                        7L
+
+/* Correct offset at every clock cycle */
+#define MIN_CLK_CYCLES_BETWEEN_STEPS   0
+
+/* Maximum available slow offset resources */
+#define MAX_SLOW_OFFSET_ADJ                                    \
+       ((unsigned long long)((1 << 30) - 1) * MAX_NS_PER_STEP)
+
+/* four times a second overflow check */
+#define HELLCREEK_OVERFLOW_PERIOD      (HZ / 4)
+
+/* PTP Register */
+#define PR_SETTINGS_C                  (0x09 * 2)
+#define PR_SETTINGS_C_RES3TS           BIT(4)
+#define PR_SETTINGS_C_TS_SRC_TK_SHIFT  8
+#define PR_SETTINGS_C_TS_SRC_TK_MASK   GENMASK(9, 8)
+#define PR_COMMAND_C                   (0x0a * 2)
+#define PR_COMMAND_C_SS                        BIT(0)
+
+#define PR_CLOCK_STATUS_C              (0x0c * 2)
+#define PR_CLOCK_STATUS_C_ENA_DRIFT    BIT(12)
+#define PR_CLOCK_STATUS_C_OFS_ACT      BIT(13)
+#define PR_CLOCK_STATUS_C_ENA_OFS      BIT(14)
+
+#define PR_CLOCK_READ_C                        (0x0d * 2)
+#define PR_CLOCK_WRITE_C               (0x0e * 2)
+#define PR_CLOCK_OFFSET_C              (0x0f * 2)
+#define PR_CLOCK_DRIFT_C               (0x10 * 2)
+
+#define PR_SS_FREE_DATA_C              (0x12 * 2)
+#define PR_SS_SYNT_DATA_C              (0x14 * 2)
+#define PR_SS_SYNC_DATA_C              (0x16 * 2)
+#define PR_SS_DRAC_DATA_C              (0x18 * 2)
+
+#define STATUS_OUT                     (0x60 * 2)
+#define STATUS_OUT_SYNC_GOOD           BIT(0)
+#define STATUS_OUT_IS_GM               BIT(1)
+
+int hellcreek_ptp_setup(struct hellcreek *hellcreek);
+void hellcreek_ptp_free(struct hellcreek *hellcreek);
+u16 hellcreek_ptp_read(struct hellcreek *hellcreek, unsigned int offset);
+void hellcreek_ptp_write(struct hellcreek *hellcreek, u16 data,
+                        unsigned int offset);
+u64 hellcreek_ptp_gettime_seconds(struct hellcreek *hellcreek, u64 ns);
+
+#define ptp_to_hellcreek(ptp)                                  \
+       container_of(ptp, struct hellcreek, ptp_clock_info)
+
+#define dw_overflow_to_hellcreek(dw)                           \
+       container_of(dw, struct hellcreek, overflow_work)
+
+#define led_to_hellcreek(ldev, led)                            \
+       container_of(ldev, struct hellcreek, led)
+
+#endif /* _HELLCREEK_PTP_H_ */
index de7692b..6408402 100644 (file)
@@ -558,7 +558,7 @@ mt7531_pad_setup(struct dsa_switch *ds, phy_interface_t interface)
                val |= 0x190000 << RG_COREPLL_SDM_PCW_S;
                mt7530_write(priv, MT7531_PLLGP_CR0, val);
                break;
-       };
+       }
 
        /* Set feedback divide ratio update signal to high */
        val = mt7530_read(priv, MT7531_PLLGP_CR0);
@@ -1021,6 +1021,53 @@ mt7530_port_disable(struct dsa_switch *ds, int port)
        mutex_unlock(&priv->reg_mutex);
 }
 
+static int
+mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
+{
+       struct mt7530_priv *priv = ds->priv;
+       struct mii_bus *bus = priv->bus;
+       int length;
+       u32 val;
+
+       /* When a new MTU is set, DSA always set the CPU port's MTU to the
+        * largest MTU of the slave ports. Because the switch only has a global
+        * RX length register, only allowing CPU port here is enough.
+        */
+       if (!dsa_is_cpu_port(ds, port))
+               return 0;
+
+       mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
+
+       val = mt7530_mii_read(priv, MT7530_GMACCR);
+       val &= ~MAX_RX_PKT_LEN_MASK;
+
+       /* RX length also includes Ethernet header, MTK tag, and FCS length */
+       length = new_mtu + ETH_HLEN + MTK_HDR_LEN + ETH_FCS_LEN;
+       if (length <= 1522) {
+               val |= MAX_RX_PKT_LEN_1522;
+       } else if (length <= 1536) {
+               val |= MAX_RX_PKT_LEN_1536;
+       } else if (length <= 1552) {
+               val |= MAX_RX_PKT_LEN_1552;
+       } else {
+               val &= ~MAX_RX_JUMBO_MASK;
+               val |= MAX_RX_JUMBO(DIV_ROUND_UP(length, 1024));
+               val |= MAX_RX_PKT_LEN_JUMBO;
+       }
+
+       mt7530_mii_write(priv, MT7530_GMACCR, val);
+
+       mutex_unlock(&bus->mdio_lock);
+
+       return 0;
+}
+
+static int
+mt7530_port_max_mtu(struct dsa_switch *ds, int port)
+{
+       return MT7530_MAX_MTU;
+}
+
 static void
 mt7530_stp_state_set(struct dsa_switch *ds, int port, u8 state)
 {
@@ -2519,6 +2566,8 @@ static const struct dsa_switch_ops mt7530_switch_ops = {
        .get_sset_count         = mt7530_get_sset_count,
        .port_enable            = mt7530_port_enable,
        .port_disable           = mt7530_port_disable,
+       .port_change_mtu        = mt7530_port_change_mtu,
+       .port_max_mtu           = mt7530_port_max_mtu,
        .port_stp_state_set     = mt7530_stp_state_set,
        .port_bridge_join       = mt7530_port_bridge_join,
        .port_bridge_leave      = mt7530_port_bridge_leave,
index 9278a8e..ee3523a 100644 (file)
@@ -11,6 +11,9 @@
 #define MT7530_NUM_FDB_RECORDS         2048
 #define MT7530_ALL_MEMBERS             0xff
 
+#define MTK_HDR_LEN    4
+#define MT7530_MAX_MTU (15 * 1024 - ETH_HLEN - ETH_FCS_LEN - MTK_HDR_LEN)
+
 enum mt753x_id {
        ID_MT7530 = 0,
        ID_MT7621 = 1,
@@ -289,6 +292,15 @@ enum mt7530_vlan_port_attr {
 #define MT7531_DBG_CNT(x)              (0x3018 + (x) * 0x100)
 #define  MT7531_DIS_CLR                        BIT(31)
 
+#define MT7530_GMACCR                  0x30e0
+#define  MAX_RX_JUMBO(x)               ((x) << 2)
+#define  MAX_RX_JUMBO_MASK             GENMASK(5, 2)
+#define  MAX_RX_PKT_LEN_MASK           GENMASK(1, 0)
+#define  MAX_RX_PKT_LEN_1522           0x0
+#define  MAX_RX_PKT_LEN_1536           0x1
+#define  MAX_RX_PKT_LEN_1552           0x2
+#define  MAX_RX_PKT_LEN_JUMBO          0x3
+
 /* Register for MIB */
 #define MT7530_PORT_MIB_COUNTER(x)     (0x4000 + (x) * 0x100)
 #define MT7530_MIB_CCR                 0x4fe0
index bd297ae..ea466f8 100644 (file)
@@ -1442,7 +1442,7 @@ static void mv88e6xxx_port_fast_age(struct dsa_switch *ds, int port)
 
 static int mv88e6xxx_vtu_setup(struct mv88e6xxx_chip *chip)
 {
-       if (!chip->info->max_vid)
+       if (!mv88e6xxx_max_vid(chip))
                return 0;
 
        return mv88e6xxx_g1_vtu_flush(chip);
@@ -1484,7 +1484,7 @@ int mv88e6xxx_fid_map(struct mv88e6xxx_chip *chip, unsigned long *fid_bitmap)
        }
 
        /* Set every FID bit used by the VLAN entries */
-       vlan.vid = chip->info->max_vid;
+       vlan.vid = mv88e6xxx_max_vid(chip);
        vlan.valid = false;
 
        do {
@@ -1496,7 +1496,7 @@ int mv88e6xxx_fid_map(struct mv88e6xxx_chip *chip, unsigned long *fid_bitmap)
                        break;
 
                set_bit(vlan.fid, fid_bitmap);
-       } while (vlan.vid < chip->info->max_vid);
+       } while (vlan.vid < mv88e6xxx_max_vid(chip));
 
        return 0;
 }
@@ -1587,7 +1587,7 @@ static int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port,
        int err;
 
        if (switchdev_trans_ph_prepare(trans))
-               return chip->info->max_vid ? 0 : -EOPNOTSUPP;
+               return mv88e6xxx_max_vid(chip) ? 0 : -EOPNOTSUPP;
 
        mv88e6xxx_reg_lock(chip);
        err = mv88e6xxx_port_set_8021q_mode(chip, port, mode);
@@ -1603,7 +1603,7 @@ mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port,
        struct mv88e6xxx_chip *chip = ds->priv;
        int err;
 
-       if (!chip->info->max_vid)
+       if (!mv88e6xxx_max_vid(chip))
                return -EOPNOTSUPP;
 
        /* If the requested port doesn't belong to the same bridge as the VLAN
@@ -1973,7 +1973,7 @@ static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port,
        u8 member;
        u16 vid;
 
-       if (!chip->info->max_vid)
+       if (!mv88e6xxx_max_vid(chip))
                return;
 
        if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port))
@@ -2051,7 +2051,7 @@ static int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port,
        u16 pvid, vid;
        int err = 0;
 
-       if (!chip->info->max_vid)
+       if (!mv88e6xxx_max_vid(chip))
                return -EOPNOTSUPP;
 
        mv88e6xxx_reg_lock(chip);
@@ -2157,7 +2157,7 @@ static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port,
                return err;
 
        /* Dump VLANs' Filtering Information Databases */
-       vlan.vid = chip->info->max_vid;
+       vlan.vid = mv88e6xxx_max_vid(chip);
        vlan.valid = false;
 
        do {
@@ -2172,7 +2172,7 @@ static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port,
                                                 cb, data);
                if (err)
                        return err;
-       } while (vlan.vid < chip->info->max_vid);
+       } while (vlan.vid < mv88e6xxx_max_vid(chip));
 
        return err;
 }
@@ -2851,6 +2851,7 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
 
        chip->ds = ds;
        ds->slave_mii_bus = mv88e6xxx_default_mdio_bus(chip);
+       ds->configure_vlan_while_not_filtering = true;
 
        mv88e6xxx_reg_lock(chip);
 
index 81c244f..7faa61b 100644 (file)
@@ -245,6 +245,7 @@ enum mv88e6xxx_region_id {
        MV88E6XXX_REGION_GLOBAL1 = 0,
        MV88E6XXX_REGION_GLOBAL2,
        MV88E6XXX_REGION_ATU,
+       MV88E6XXX_REGION_VTU,
 
        _MV88E6XXX_REGION_MAX,
 };
@@ -672,6 +673,11 @@ static inline unsigned int mv88e6xxx_num_ports(struct mv88e6xxx_chip *chip)
        return chip->info->num_ports;
 }
 
+static inline unsigned int mv88e6xxx_max_vid(struct mv88e6xxx_chip *chip)
+{
+       return chip->info->max_vid;
+}
+
 static inline u16 mv88e6xxx_port_mask(struct mv88e6xxx_chip *chip)
 {
        return GENMASK((s32)mv88e6xxx_num_ports(chip) - 1, 0);
index 10cd1bf..21953d6 100644 (file)
@@ -393,8 +393,10 @@ static int mv88e6xxx_region_atu_snapshot(struct devlink *dl,
        mv88e6xxx_reg_lock(chip);
 
        err = mv88e6xxx_fid_map(chip, fid_bitmap);
-       if (err)
+       if (err) {
+               kfree(table);
                goto out;
+       }
 
        while (1) {
                fid = find_next_bit(fid_bitmap, MV88E6XXX_N_FID, fid + 1);
@@ -415,6 +417,92 @@ out:
        return err;
 }
 
+/**
+ * struct mv88e6xxx_devlink_vtu_entry - Devlink VTU entry
+ * @fid:   Global1/2:   FID and VLAN policy.
+ * @sid:   Global1/3:   SID, unknown filters and learning.
+ * @op:    Global1/5:   FID (old chipsets).
+ * @vid:   Global1/6:   VID, valid, and page.
+ * @data:  Global1/7-9: Membership data and priority override.
+ * @resvd: Reserved. Also happens to align the size to 16B.
+ *
+ * The VTU entry format varies between chipset generations, the
+ * descriptions above represent the superset of all possible
+ * information, not all fields are valid on all devices. Since this is
+ * a low-level debug interface, copy all data verbatim and defer
+ * parsing to the consumer.
+ */
+struct mv88e6xxx_devlink_vtu_entry {
+       u16 fid;
+       u16 sid;
+       u16 op;
+       u16 vid;
+       u16 data[3];
+       u16 resvd;
+};
+
+static int mv88e6xxx_region_vtu_snapshot(struct devlink *dl,
+                                        const struct devlink_region_ops *ops,
+                                        struct netlink_ext_ack *extack,
+                                        u8 **data)
+{
+       struct mv88e6xxx_devlink_vtu_entry *table, *entry;
+       struct dsa_switch *ds = dsa_devlink_to_ds(dl);
+       struct mv88e6xxx_chip *chip = ds->priv;
+       struct mv88e6xxx_vtu_entry vlan;
+       int err;
+
+       table = kcalloc(mv88e6xxx_max_vid(chip) + 1,
+                       sizeof(struct mv88e6xxx_devlink_vtu_entry),
+                       GFP_KERNEL);
+       if (!table)
+               return -ENOMEM;
+
+       entry = table;
+       vlan.vid = mv88e6xxx_max_vid(chip);
+       vlan.valid = false;
+
+       mv88e6xxx_reg_lock(chip);
+
+       do {
+               err = mv88e6xxx_g1_vtu_getnext(chip, &vlan);
+               if (err)
+                       break;
+
+               if (!vlan.valid)
+                       break;
+
+               err = err ? : mv88e6xxx_g1_read(chip, MV88E6352_G1_VTU_FID,
+                                               &entry->fid);
+               err = err ? : mv88e6xxx_g1_read(chip, MV88E6352_G1_VTU_SID,
+                                               &entry->sid);
+               err = err ? : mv88e6xxx_g1_read(chip, MV88E6XXX_G1_VTU_OP,
+                                               &entry->op);
+               err = err ? : mv88e6xxx_g1_read(chip, MV88E6XXX_G1_VTU_VID,
+                                               &entry->vid);
+               err = err ? : mv88e6xxx_g1_read(chip, MV88E6XXX_G1_VTU_DATA1,
+                                               &entry->data[0]);
+               err = err ? : mv88e6xxx_g1_read(chip, MV88E6XXX_G1_VTU_DATA2,
+                                               &entry->data[1]);
+               err = err ? : mv88e6xxx_g1_read(chip, MV88E6XXX_G1_VTU_DATA3,
+                                               &entry->data[2]);
+               if (err)
+                       break;
+
+               entry++;
+       } while (vlan.vid < mv88e6xxx_max_vid(chip));
+
+       mv88e6xxx_reg_unlock(chip);
+
+       if (err) {
+               kfree(table);
+               return err;
+       }
+
+       *data = (u8 *)table;
+       return 0;
+}
+
 static int mv88e6xxx_region_port_snapshot(struct devlink_port *devlink_port,
                                          const struct devlink_port_region_ops *ops,
                                          struct netlink_ext_ack *extack,
@@ -473,6 +561,12 @@ static struct devlink_region_ops mv88e6xxx_region_atu_ops = {
        .destructor = kfree,
 };
 
+static struct devlink_region_ops mv88e6xxx_region_vtu_ops = {
+       .name = "vtu",
+       .snapshot = mv88e6xxx_region_vtu_snapshot,
+       .destructor = kfree,
+};
+
 static const struct devlink_port_region_ops mv88e6xxx_region_port_ops = {
        .name = "port",
        .snapshot = mv88e6xxx_region_port_snapshot,
@@ -496,6 +590,10 @@ static struct mv88e6xxx_region mv88e6xxx_regions[] = {
                .ops = &mv88e6xxx_region_atu_ops
          /* calculated at runtime */
        },
+       [MV88E6XXX_REGION_VTU] = {
+               .ops = &mv88e6xxx_region_vtu_ops
+         /* calculated at runtime */
+       },
 };
 
 static void
@@ -574,9 +672,16 @@ static int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds,
                ops = mv88e6xxx_regions[i].ops;
                size = mv88e6xxx_regions[i].size;
 
-               if (i == MV88E6XXX_REGION_ATU)
+               switch (i) {
+               case MV88E6XXX_REGION_ATU:
                        size = mv88e6xxx_num_databases(chip) *
                                sizeof(struct mv88e6xxx_devlink_atu_entry);
+                       break;
+               case MV88E6XXX_REGION_VTU:
+                       size = mv88e6xxx_max_vid(chip) *
+                               sizeof(struct mv88e6xxx_devlink_vtu_entry);
+                       break;
+               }
 
                region = dsa_devlink_region_create(ds, ops, 1, size);
                if (IS_ERR(region))
index 1e3546f..a4f0c05 100644 (file)
@@ -329,6 +329,8 @@ void mv88e6xxx_g1_atu_prob_irq_free(struct mv88e6xxx_chip *chip);
 int mv88e6165_g1_atu_get_hash(struct mv88e6xxx_chip *chip, u8 *hash);
 int mv88e6165_g1_atu_set_hash(struct mv88e6xxx_chip *chip, u8 hash);
 
+int mv88e6xxx_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
+                            struct mv88e6xxx_vtu_entry *entry);
 int mv88e6185_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
                             struct mv88e6xxx_vtu_entry *entry);
 int mv88e6185_g1_vtu_loadpurge(struct mv88e6xxx_chip *chip,
index 48390b7..f24e019 100644 (file)
@@ -276,8 +276,8 @@ static int mv88e6xxx_g1_vtu_stu_get(struct mv88e6xxx_chip *chip,
        return 0;
 }
 
-static int mv88e6xxx_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
-                                   struct mv88e6xxx_vtu_entry *entry)
+int mv88e6xxx_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
+                            struct mv88e6xxx_vtu_entry *entry)
 {
        int err;
 
index f791860..ada75fa 100644 (file)
@@ -112,10 +112,32 @@ static void felix_bridge_leave(struct dsa_switch *ds, int port,
        ocelot_port_bridge_leave(ocelot, port, br);
 }
 
-/* This callback needs to be present */
 static int felix_vlan_prepare(struct dsa_switch *ds, int port,
                              const struct switchdev_obj_port_vlan *vlan)
 {
+       struct ocelot *ocelot = ds->priv;
+       u16 vid, flags = vlan->flags;
+       int err;
+
+       /* Ocelot switches copy frames as-is to the CPU, so the flags:
+        * egress-untagged or not, pvid or not, make no difference. This
+        * behavior is already better than what DSA just tries to approximate
+        * when it installs the VLAN with the same flags on the CPU port.
+        * Just accept any configuration, and don't let ocelot deny installing
+        * multiple native VLANs on the NPI port, because the switch doesn't
+        * look at the port tag settings towards the NPI interface anyway.
+        */
+       if (port == ocelot->npi)
+               return 0;
+
+       for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) {
+               err = ocelot_vlan_prepare(ocelot, port, vid,
+                                         flags & BRIDGE_VLAN_INFO_PVID,
+                                         flags & BRIDGE_VLAN_INFO_UNTAGGED);
+               if (err)
+                       return err;
+       }
+
        return 0;
 }
 
@@ -135,9 +157,6 @@ static void felix_vlan_add(struct dsa_switch *ds, int port,
        u16 vid;
        int err;
 
-       if (dsa_is_cpu_port(ds, port))
-               flags &= ~BRIDGE_VLAN_INFO_UNTAGGED;
-
        for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) {
                err = ocelot_vlan_add(ocelot, port, vid,
                                      flags & BRIDGE_VLAN_INFO_PVID,
index 53064e0..5bdac66 100644 (file)
@@ -1219,8 +1219,8 @@ qca8k_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
        priv->port_mtu[port] = new_mtu;
 
        for (i = 0; i < QCA8K_NUM_PORTS; i++)
-               if (priv->port_mtu[port] > mtu)
-                       mtu = priv->port_mtu[port];
+               if (priv->port_mtu[i] > mtu)
+                       mtu = priv->port_mtu[i];
 
        /* Include L2 header / FCS length */
        qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, mtu + ETH_HLEN + ETH_FCS_LEN);
index bab3a9b..f82ad74 100644 (file)
@@ -124,7 +124,7 @@ static void dummy_setup(struct net_device *dev)
        dev->flags &= ~IFF_MULTICAST;
        dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
        dev->features   |= NETIF_F_SG | NETIF_F_FRAGLIST;
-       dev->features   |= NETIF_F_ALL_TSO;
+       dev->features   |= NETIF_F_GSO_SOFTWARE;
        dev->features   |= NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX;
        dev->features   |= NETIF_F_GSO_ENCAP_ALL;
        dev->hw_features |= dev->features;
index d60a86a..9aac711 100644 (file)
@@ -175,7 +175,6 @@ static enum mac8390_type mac8390_ident(struct nubus_rsrc *fres)
                default:
                        return MAC8390_APPLE;
                }
-               break;
 
        case NUBUS_DRSW_APPLE:
                switch (fres->dr_hw) {
@@ -186,11 +185,9 @@ static enum mac8390_type mac8390_ident(struct nubus_rsrc *fres)
                default:
                        return MAC8390_APPLE;
                }
-               break;
 
        case NUBUS_DRSW_ASANTE:
                return MAC8390_ASANTE;
-               break;
 
        case NUBUS_DRSW_TECHWORKS:
        case NUBUS_DRSW_DAYNA2:
@@ -199,11 +196,9 @@ static enum mac8390_type mac8390_ident(struct nubus_rsrc *fres)
                        return MAC8390_CABLETRON;
                else
                        return MAC8390_APPLE;
-               break;
 
        case NUBUS_DRSW_FARALLON:
                return MAC8390_FARALLON;
-               break;
 
        case NUBUS_DRSW_KINETICS:
                switch (fres->dr_hw) {
@@ -212,7 +207,6 @@ static enum mac8390_type mac8390_ident(struct nubus_rsrc *fres)
                default:
                        return MAC8390_KINETICS;
                }
-               break;
 
        case NUBUS_DRSW_DAYNA:
                /*
@@ -224,7 +218,6 @@ static enum mac8390_type mac8390_ident(struct nubus_rsrc *fres)
                        return MAC8390_NONE;
                else
                        return MAC8390_DAYNA;
-               break;
        }
        return MAC8390_NONE;
 }
index 1c97e39..e9756d0 100644 (file)
@@ -710,7 +710,7 @@ static void ne_block_output(struct net_device *dev, int count,
 retry:
 #endif
 
-#ifdef NE8390_RW_BUGFIX
+#ifdef NE_RW_BUGFIX
        /* Handle the read-before-write bug the same way as the
           Crynwr packet driver -- the NatSemi method doesn't work.
           Actually this doesn't always work either, but if you have
index bc6edb3..d671500 100644 (file)
@@ -610,7 +610,7 @@ static void ne2k_pci_block_output(struct net_device *dev, int count,
        /* We should already be in page 0, but to be safe... */
        outb(E8390_PAGE0+E8390_START+E8390_NODMA, nic_base + NE_CMD);
 
-#ifdef NE8390_RW_BUGFIX
+#ifdef NE_RW_BUGFIX
        /* Handle the read-before-write bug the same way as the
         * Crynwr packet driver -- the NatSemi method doesn't work.
         * Actually this doesn't always work either, but if you have
index bf5e0e9..6c04986 100644 (file)
@@ -1474,7 +1474,7 @@ int aq_nic_setup_tc_mqprio(struct aq_nic_s *self, u32 tcs, u8 *prio_tc_map)
                for (i = 0; i < sizeof(cfg->prio_tc_map); i++)
                        cfg->prio_tc_map[i] = cfg->tcs * i / 8;
 
-       cfg->is_qos = (tcs != 0 ? true : false);
+       cfg->is_qos = !!tcs;
        cfg->is_ptp = (cfg->tcs <= AQ_HW_PTP_TC);
        if (!cfg->is_ptp)
                netdev_warn(self->ndev, "%s\n",
index fa14786..7975f59 100644 (file)
@@ -1160,16 +1160,6 @@ static void bnxt_queue_sp_work(struct bnxt *bp)
                schedule_work(&bp->sp_task);
 }
 
-static void bnxt_cancel_sp_work(struct bnxt *bp)
-{
-       if (BNXT_PF(bp)) {
-               flush_workqueue(bnxt_pf_wq);
-       } else {
-               cancel_work_sync(&bp->sp_task);
-               cancel_delayed_work_sync(&bp->fw_reset_task);
-       }
-}
-
 static void bnxt_sched_reset(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
 {
        if (!rxr->bnapi->in_reset) {
@@ -4362,7 +4352,8 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
        u32 bar_offset = BNXT_GRCPF_REG_CHIMP_COMM;
        u16 dst = BNXT_HWRM_CHNL_CHIMP;
 
-       if (BNXT_NO_FW_ACCESS(bp))
+       if (BNXT_NO_FW_ACCESS(bp) &&
+           le16_to_cpu(req->req_type) != HWRM_FUNC_RESET)
                return -EBUSY;
 
        if (msg_len > BNXT_HWRM_MAX_REQ_LEN) {
@@ -9789,7 +9780,10 @@ int bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
 {
        int rc = 0;
 
-       rc = __bnxt_open_nic(bp, irq_re_init, link_re_init);
+       if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state))
+               rc = -EIO;
+       if (!rc)
+               rc = __bnxt_open_nic(bp, irq_re_init, link_re_init);
        if (rc) {
                netdev_err(bp->dev, "nic open fail (rc: %x)\n", rc);
                dev_close(bp->dev);
@@ -12108,15 +12102,17 @@ static void bnxt_remove_one(struct pci_dev *pdev)
        if (BNXT_PF(bp))
                bnxt_sriov_disable(bp);
 
-       clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
-       bnxt_cancel_sp_work(bp);
-       bp->sp_event = 0;
-
-       bnxt_dl_fw_reporters_destroy(bp, true);
        if (BNXT_PF(bp))
                devlink_port_type_clear(&bp->dl_port);
        pci_disable_pcie_error_reporting(pdev);
        unregister_netdev(dev);
+       clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
+       /* Flush any pending tasks */
+       cancel_work_sync(&bp->sp_task);
+       cancel_delayed_work_sync(&bp->fw_reset_task);
+       bp->sp_event = 0;
+
+       bnxt_dl_fw_reporters_destroy(bp, true);
        bnxt_dl_unregister(bp);
        bnxt_shutdown_tc(bp);
 
@@ -12860,6 +12856,9 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
                return PCI_ERS_RESULT_DISCONNECT;
        }
 
+       if (state == pci_channel_io_frozen)
+               set_bit(BNXT_STATE_PCI_CHANNEL_IO_FROZEN, &bp->state);
+
        if (netif_running(netdev))
                bnxt_close(netdev);
 
@@ -12886,7 +12885,7 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
 {
        struct net_device *netdev = pci_get_drvdata(pdev);
        struct bnxt *bp = netdev_priv(netdev);
-       int err = 0;
+       int err = 0, off;
        pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT;
 
        netdev_info(bp->dev, "PCI Slot Reset\n");
@@ -12898,6 +12897,20 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
                        "Cannot re-enable PCI device after reset.\n");
        } else {
                pci_set_master(pdev);
+               /* Upon fatal error, our device internal logic that latches to
+                * BAR value is getting reset and will restore only upon
+                * rewritting the BARs.
+                *
+                * As pci_restore_state() does not re-write the BARs if the
+                * value is same as saved value earlier, driver needs to
+                * write the BARs to 0 to force restore, in case of fatal error.
+                */
+               if (test_and_clear_bit(BNXT_STATE_PCI_CHANNEL_IO_FROZEN,
+                                      &bp->state)) {
+                       for (off = PCI_BASE_ADDRESS_0;
+                            off <= PCI_BASE_ADDRESS_5; off += 4)
+                               pci_write_config_dword(bp->pdev, off, 0);
+               }
                pci_restore_state(pdev);
                pci_save_state(pdev);
 
index 21ef1c2..47b3c31 100644 (file)
@@ -1781,6 +1781,7 @@ struct bnxt {
 #define BNXT_STATE_ABORT_ERR   5
 #define BNXT_STATE_FW_FATAL_COND       6
 #define BNXT_STATE_DRV_REGISTERED      7
+#define BNXT_STATE_PCI_CHANNEL_IO_FROZEN       8
 
 #define BNXT_NO_FW_ACCESS(bp)                                  \
        (test_bit(BNXT_STATE_FW_FATAL_COND, &(bp)->state) ||    \
index 5de47f6..1f5da4e 100644 (file)
 #define MACB_RBQPH             0x04D4
 
 /* GEM register offsets. */
+#define GEM_NCR                        0x0000 /* Network Control */
 #define GEM_NCFGR              0x0004 /* Network Config */
 #define GEM_USRIO              0x000c /* User IO */
 #define GEM_DMACFG             0x0010 /* DMA Configuration */
 #define GEM_JML                        0x0048 /* Jumbo Max Length */
+#define GEM_HS_MAC_CONFIG      0x0050 /* GEM high speed config */
 #define GEM_HRB                        0x0080 /* Hash Bottom */
 #define GEM_HRT                        0x0084 /* Hash Top */
 #define GEM_SA1B               0x0088 /* Specific1 Bottom */
 #define GEM_DCFG7              0x0298 /* Design Config 7 */
 #define GEM_DCFG8              0x029C /* Design Config 8 */
 #define GEM_DCFG10             0x02A4 /* Design Config 10 */
+#define GEM_DCFG12             0x02AC /* Design Config 12 */
+#define GEM_USX_CONTROL                0x0A80 /* High speed PCS control register */
+#define GEM_USX_STATUS         0x0A88 /* High speed PCS status register */
 
 #define GEM_TXBDCTRL   0x04cc /* TX Buffer Descriptor control register */
 #define GEM_RXBDCTRL   0x04d0 /* RX Buffer Descriptor control register */
 #define MACB_IRXFCS_OFFSET     19
 #define MACB_IRXFCS_SIZE       1
 
+/* GEM specific NCR bitfields. */
+#define GEM_ENABLE_HS_MAC_OFFSET       31
+#define GEM_ENABLE_HS_MAC_SIZE         1
+
 /* GEM specific NCFGR bitfields. */
+#define GEM_FD_OFFSET          1 /* Full duplex */
+#define GEM_FD_SIZE            1
 #define GEM_GBE_OFFSET         10 /* Gigabit mode enable */
 #define GEM_GBE_SIZE           1
 #define GEM_PCSSEL_OFFSET      11
 #define GEM_PCSSEL_SIZE                1
+#define GEM_PAE_OFFSET         13 /* Pause enable */
+#define GEM_PAE_SIZE           1
 #define GEM_CLK_OFFSET         18 /* MDC clock division */
 #define GEM_CLK_SIZE           3
 #define GEM_DBW_OFFSET         21 /* Data bus width */
 #define MACB_REV_OFFSET                                0
 #define MACB_REV_SIZE                          16
 
+/* Bitfield in HS_MAC_CONFIG */
+#define GEM_HS_MAC_SPEED_OFFSET                        0
+#define GEM_HS_MAC_SPEED_SIZE                  3
+
 /* Bitfields in DCFG1. */
 #define GEM_IRQCOR_OFFSET                      23
 #define GEM_IRQCOR_SIZE                                1
 #define GEM_DBWDEF_OFFSET                      25
 #define GEM_DBWDEF_SIZE                                3
+#define GEM_NO_PCS_OFFSET                      0
+#define GEM_NO_PCS_SIZE                                1
 
 /* Bitfields in DCFG2. */
 #define GEM_RX_PKT_BUFF_OFFSET                 20
 #define GEM_RXBD_RDBUFF_OFFSET                 8
 #define GEM_RXBD_RDBUFF_SIZE                   4
 
+/* Bitfields in DCFG12. */
+#define GEM_HIGH_SPEED_OFFSET                  26
+#define GEM_HIGH_SPEED_SIZE                    1
+
+/* Bitfields in USX_CONTROL. */
+#define GEM_USX_CTRL_SPEED_OFFSET              14
+#define GEM_USX_CTRL_SPEED_SIZE                        3
+#define GEM_SERDES_RATE_OFFSET                 12
+#define GEM_SERDES_RATE_SIZE                   2
+#define GEM_RX_SCR_BYPASS_OFFSET               9
+#define GEM_RX_SCR_BYPASS_SIZE                 1
+#define GEM_TX_SCR_BYPASS_OFFSET               8
+#define GEM_TX_SCR_BYPASS_SIZE                 1
+#define GEM_TX_EN_OFFSET                       1
+#define GEM_TX_EN_SIZE                         1
+#define GEM_SIGNAL_OK_OFFSET                   0
+#define GEM_SIGNAL_OK_SIZE                     1
+
+/* Bitfields in USX_STATUS. */
+#define GEM_USX_BLOCK_LOCK_OFFSET              0
+#define GEM_USX_BLOCK_LOCK_SIZE                        1
+
 /* Bitfields in TISUBN */
 #define GEM_SUBNSINCR_OFFSET                   0
 #define GEM_SUBNSINCRL_OFFSET                  24
 #define MACB_CAPS_GIGABIT_MODE_AVAILABLE       0x20000000
 #define MACB_CAPS_SG_DISABLED                  0x40000000
 #define MACB_CAPS_MACB_IS_GEM                  0x80000000
+#define MACB_CAPS_PCS                          0x01000000
+#define MACB_CAPS_HIGH_SPEED                   0x02000000
 
 /* LSO settings */
 #define MACB_LSO_UFO_ENABLE                    0x01
@@ -1201,6 +1244,7 @@ struct macb {
        struct mii_bus          *mii_bus;
        struct phylink          *phylink;
        struct phylink_config   phylink_config;
+       struct phylink_pcs      phylink_pcs;
 
        u32                     caps;
        unsigned int            dma_burst_length;
index 883e47c..51f8662 100644 (file)
@@ -84,6 +84,9 @@ struct sifive_fu540_macb_mgmt {
 #define MACB_WOL_HAS_MAGIC_PACKET      (0x1 << 0)
 #define MACB_WOL_ENABLED               (0x1 << 1)
 
+#define HS_SPEED_10000M                        4
+#define MACB_SERDES_RATE_10G           1
+
 /* Graceful stop timeouts in us. We should allow up to
  * 1 frame time (10 Mbits/s, full-duplex, ignoring collisions)
  */
@@ -513,6 +516,7 @@ static void macb_validate(struct phylink_config *config,
            state->interface != PHY_INTERFACE_MODE_RMII &&
            state->interface != PHY_INTERFACE_MODE_GMII &&
            state->interface != PHY_INTERFACE_MODE_SGMII &&
+           state->interface != PHY_INTERFACE_MODE_10GBASER &&
            !phy_interface_mode_is_rgmii(state->interface)) {
                bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
                return;
@@ -525,10 +529,31 @@ static void macb_validate(struct phylink_config *config,
                return;
        }
 
+       if (state->interface == PHY_INTERFACE_MODE_10GBASER &&
+           !(bp->caps & MACB_CAPS_HIGH_SPEED &&
+             bp->caps & MACB_CAPS_PCS)) {
+               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               return;
+       }
+
        phylink_set_port_modes(mask);
        phylink_set(mask, Autoneg);
        phylink_set(mask, Asym_Pause);
 
+       if (bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE &&
+           (state->interface == PHY_INTERFACE_MODE_NA ||
+            state->interface == PHY_INTERFACE_MODE_10GBASER)) {
+               phylink_set(mask, 10000baseCR_Full);
+               phylink_set(mask, 10000baseER_Full);
+               phylink_set(mask, 10000baseKR_Full);
+               phylink_set(mask, 10000baseLR_Full);
+               phylink_set(mask, 10000baseLRM_Full);
+               phylink_set(mask, 10000baseSR_Full);
+               phylink_set(mask, 10000baseT_Full);
+               if (state->interface != PHY_INTERFACE_MODE_NA)
+                       goto out;
+       }
+
        phylink_set(mask, 10baseT_Half);
        phylink_set(mask, 10baseT_Full);
        phylink_set(mask, 100baseT_Half);
@@ -545,23 +570,90 @@ static void macb_validate(struct phylink_config *config,
                if (!(bp->caps & MACB_CAPS_NO_GIGABIT_HALF))
                        phylink_set(mask, 1000baseT_Half);
        }
-
+out:
        bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
        bitmap_and(state->advertising, state->advertising, mask,
                   __ETHTOOL_LINK_MODE_MASK_NBITS);
 }
 
-static void macb_mac_pcs_get_state(struct phylink_config *config,
+static void macb_usx_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
+                                phy_interface_t interface, int speed,
+                                int duplex)
+{
+       struct macb *bp = container_of(pcs, struct macb, phylink_pcs);
+       u32 config;
+
+       config = gem_readl(bp, USX_CONTROL);
+       config = GEM_BFINS(SERDES_RATE, MACB_SERDES_RATE_10G, config);
+       config = GEM_BFINS(USX_CTRL_SPEED, HS_SPEED_10000M, config);
+       config &= ~(GEM_BIT(TX_SCR_BYPASS) | GEM_BIT(RX_SCR_BYPASS));
+       config |= GEM_BIT(TX_EN);
+       gem_writel(bp, USX_CONTROL, config);
+}
+
+static void macb_usx_pcs_get_state(struct phylink_pcs *pcs,
                                   struct phylink_link_state *state)
 {
+       struct macb *bp = container_of(pcs, struct macb, phylink_pcs);
+       u32 val;
+
+       state->speed = SPEED_10000;
+       state->duplex = 1;
+       state->an_complete = 1;
+
+       val = gem_readl(bp, USX_STATUS);
+       state->link = !!(val & GEM_BIT(USX_BLOCK_LOCK));
+       val = gem_readl(bp, NCFGR);
+       if (val & GEM_BIT(PAE))
+               state->pause = MLO_PAUSE_RX;
+}
+
+static int macb_usx_pcs_config(struct phylink_pcs *pcs,
+                              unsigned int mode,
+                              phy_interface_t interface,
+                              const unsigned long *advertising,
+                              bool permit_pause_to_mac)
+{
+       struct macb *bp = container_of(pcs, struct macb, phylink_pcs);
+
+       gem_writel(bp, USX_CONTROL, gem_readl(bp, USX_CONTROL) |
+                  GEM_BIT(SIGNAL_OK));
+
+       return 0;
+}
+
+static void macb_pcs_get_state(struct phylink_pcs *pcs,
+                              struct phylink_link_state *state)
+{
        state->link = 0;
 }
 
-static void macb_mac_an_restart(struct phylink_config *config)
+static void macb_pcs_an_restart(struct phylink_pcs *pcs)
 {
        /* Not supported */
 }
 
+static int macb_pcs_config(struct phylink_pcs *pcs,
+                          unsigned int mode,
+                          phy_interface_t interface,
+                          const unsigned long *advertising,
+                          bool permit_pause_to_mac)
+{
+       return 0;
+}
+
+static const struct phylink_pcs_ops macb_phylink_usx_pcs_ops = {
+       .pcs_get_state = macb_usx_pcs_get_state,
+       .pcs_config = macb_usx_pcs_config,
+       .pcs_link_up = macb_usx_pcs_link_up,
+};
+
+static const struct phylink_pcs_ops macb_phylink_pcs_ops = {
+       .pcs_get_state = macb_pcs_get_state,
+       .pcs_an_restart = macb_pcs_an_restart,
+       .pcs_config = macb_pcs_config,
+};
+
 static void macb_mac_config(struct phylink_config *config, unsigned int mode,
                            const struct phylink_link_state *state)
 {
@@ -569,25 +661,35 @@ static void macb_mac_config(struct phylink_config *config, unsigned int mode,
        struct macb *bp = netdev_priv(ndev);
        unsigned long flags;
        u32 old_ctrl, ctrl;
+       u32 old_ncr, ncr;
 
        spin_lock_irqsave(&bp->lock, flags);
 
        old_ctrl = ctrl = macb_or_gem_readl(bp, NCFGR);
+       old_ncr = ncr = macb_or_gem_readl(bp, NCR);
 
        if (bp->caps & MACB_CAPS_MACB_IS_EMAC) {
                if (state->interface == PHY_INTERFACE_MODE_RMII)
                        ctrl |= MACB_BIT(RM9200_RMII);
        } else if (macb_is_gem(bp)) {
                ctrl &= ~(GEM_BIT(SGMIIEN) | GEM_BIT(PCSSEL));
+               ncr &= ~GEM_BIT(ENABLE_HS_MAC);
 
-               if (state->interface == PHY_INTERFACE_MODE_SGMII)
+               if (state->interface == PHY_INTERFACE_MODE_SGMII) {
                        ctrl |= GEM_BIT(SGMIIEN) | GEM_BIT(PCSSEL);
+               } else if (state->interface == PHY_INTERFACE_MODE_10GBASER) {
+                       ctrl |= GEM_BIT(PCSSEL);
+                       ncr |= GEM_BIT(ENABLE_HS_MAC);
+               }
        }
 
        /* Apply the new configuration, if any */
        if (old_ctrl ^ ctrl)
                macb_or_gem_writel(bp, NCFGR, ctrl);
 
+       if (old_ncr ^ ncr)
+               macb_or_gem_writel(bp, NCR, ncr);
+
        spin_unlock_irqrestore(&bp->lock, flags);
 }
 
@@ -664,6 +766,10 @@ static void macb_mac_link_up(struct phylink_config *config,
 
        macb_or_gem_writel(bp, NCFGR, ctrl);
 
+       if (bp->phy_interface == PHY_INTERFACE_MODE_10GBASER)
+               gem_writel(bp, HS_MAC_CONFIG, GEM_BFINS(HS_MAC_SPEED, HS_SPEED_10000M,
+                                                       gem_readl(bp, HS_MAC_CONFIG)));
+
        spin_unlock_irqrestore(&bp->lock, flags);
 
        /* Enable Rx and Tx */
@@ -672,10 +778,28 @@ static void macb_mac_link_up(struct phylink_config *config,
        netif_tx_wake_all_queues(ndev);
 }
 
+static int macb_mac_prepare(struct phylink_config *config, unsigned int mode,
+                           phy_interface_t interface)
+{
+       struct net_device *ndev = to_net_dev(config->dev);
+       struct macb *bp = netdev_priv(ndev);
+
+       if (interface == PHY_INTERFACE_MODE_10GBASER)
+               bp->phylink_pcs.ops = &macb_phylink_usx_pcs_ops;
+       else if (interface == PHY_INTERFACE_MODE_SGMII)
+               bp->phylink_pcs.ops = &macb_phylink_pcs_ops;
+       else
+               bp->phylink_pcs.ops = NULL;
+
+       if (bp->phylink_pcs.ops)
+               phylink_set_pcs(bp->phylink, &bp->phylink_pcs);
+
+       return 0;
+}
+
 static const struct phylink_mac_ops macb_phylink_ops = {
        .validate = macb_validate,
-       .mac_pcs_get_state = macb_mac_pcs_get_state,
-       .mac_an_restart = macb_mac_an_restart,
+       .mac_prepare = macb_mac_prepare,
        .mac_config = macb_mac_config,
        .mac_link_down = macb_mac_link_down,
        .mac_link_up = macb_mac_link_up,
@@ -1929,7 +2053,8 @@ static inline int macb_clear_csum(struct sk_buff *skb)
 
 static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev)
 {
-       bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb);
+       bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb) ||
+                     skb_is_nonlinear(*skb);
        int padlen = ETH_ZLEN - (*skb)->len;
        int headroom = skb_headroom(*skb);
        int tailroom = skb_tailroom(*skb);
@@ -3523,6 +3648,11 @@ static void macb_configure_caps(struct macb *bp,
                dcfg = gem_readl(bp, DCFG1);
                if (GEM_BFEXT(IRQCOR, dcfg) == 0)
                        bp->caps |= MACB_CAPS_ISR_CLEAR_ON_WRITE;
+               if (GEM_BFEXT(NO_PCS, dcfg) == 0)
+                       bp->caps |= MACB_CAPS_PCS;
+               dcfg = gem_readl(bp, DCFG12);
+               if (GEM_BFEXT(HIGH_SPEED, dcfg) == 1)
+                       bp->caps |= MACB_CAPS_HIGH_SPEED;
                dcfg = gem_readl(bp, DCFG2);
                if ((dcfg & (GEM_BIT(RX_PKT_BUFF) | GEM_BIT(TX_PKT_BUFF))) == 0)
                        bp->caps |= MACB_CAPS_FIFO_MODE;
index 2a6d1ca..30254e4 100644 (file)
@@ -27,7 +27,6 @@
 #include "cn66xx_device.h"
 #include "cn68xx_device.h"
 #include "cn68xx_regs.h"
-#include "cn68xx_device.h"
 
 static void lio_cn68xx_set_dpi_regs(struct octeon_device *oct)
 {
index 3352dad..2730860 100644 (file)
@@ -2124,6 +2124,9 @@ void cxgb4_inline_tx_skb(const struct sk_buff *skb, const struct sge_txq *q,
 void cxgb4_write_sgl(const struct sk_buff *skb, struct sge_txq *q,
                     struct ulptx_sgl *sgl, u64 *end, unsigned int start,
                     const dma_addr_t *addr);
+void cxgb4_write_partial_sgl(const struct sk_buff *skb, struct sge_txq *q,
+                            struct ulptx_sgl *sgl, u64 *end,
+                            const dma_addr_t *addr, u32 start, u32 send_len);
 void cxgb4_ring_tx_db(struct adapter *adap, struct sge_txq *q, int n);
 int t4_set_vlan_acl(struct adapter *adap, unsigned int mbox, unsigned int vf,
                    u16 vlan);
index 0273f40..7d49fd4 100644 (file)
@@ -2671,7 +2671,7 @@ do { \
        seq_printf(seq, "%-12s", s); \
        for (i = 0; i < n; ++i) \
                seq_printf(seq, " %16" fmt_spec, v); \
-               seq_putc(seq, '\n'); \
+       seq_putc(seq, '\n'); \
 } while (0)
 #define S(s, v) S3("s", s, v)
 #define T3(fmt_spec, s, v) S3(fmt_spec, s, tx[i].v)
@@ -3573,6 +3573,8 @@ static int chcr_stats_show(struct seq_file *seq, void *v)
                   atomic64_read(&adap->ch_ktls_stats.ktls_tx_complete_pkts));
        seq_printf(seq, "TX trim pkts :                    %20llu\n",
                   atomic64_read(&adap->ch_ktls_stats.ktls_tx_trimmed_pkts));
+       seq_printf(seq, "TX sw fallback :                  %20llu\n",
+                  atomic64_read(&adap->ch_ktls_stats.ktls_tx_fallback));
        while (i < MAX_NPORTS) {
                ktls_port = &adap->ch_ktls_stats.ktls_port[i];
                seq_printf(seq, "Port %d\n", i);
index 6ec5f2f..4e55f70 100644 (file)
@@ -145,13 +145,13 @@ static int configure_filter_smac(struct adapter *adap, struct filter_entry *f)
        int err;
 
        /* do a set-tcb for smac-sel and CWR bit.. */
-       err = set_tcb_tflag(adap, f, f->tid, TF_CCTRL_CWR_S, 1, 1);
-       if (err)
-               goto smac_err;
-
        err = set_tcb_field(adap, f, f->tid, TCB_SMAC_SEL_W,
                            TCB_SMAC_SEL_V(TCB_SMAC_SEL_M),
                            TCB_SMAC_SEL_V(f->smt->idx), 1);
+       if (err)
+               goto smac_err;
+
+       err = set_tcb_tflag(adap, f, f->tid, TF_CCTRL_CWR_S, 1, 1);
        if (!err)
                return 0;
 
@@ -862,6 +862,7 @@ int set_filter_wr(struct adapter *adapter, int fidx)
                      FW_FILTER_WR_DIRSTEERHASH_V(f->fs.dirsteerhash) |
                      FW_FILTER_WR_LPBK_V(f->fs.action == FILTER_SWITCH) |
                      FW_FILTER_WR_DMAC_V(f->fs.newdmac) |
+                     FW_FILTER_WR_SMAC_V(f->fs.newsmac) |
                      FW_FILTER_WR_INSVLAN_V(f->fs.newvlan == VLAN_INSERT ||
                                             f->fs.newvlan == VLAN_REWRITE) |
                      FW_FILTER_WR_RMVLAN_V(f->fs.newvlan == VLAN_REMOVE ||
@@ -879,7 +880,7 @@ int set_filter_wr(struct adapter *adapter, int fidx)
                 FW_FILTER_WR_OVLAN_VLD_V(f->fs.val.ovlan_vld) |
                 FW_FILTER_WR_IVLAN_VLDM_V(f->fs.mask.ivlan_vld) |
                 FW_FILTER_WR_OVLAN_VLDM_V(f->fs.mask.ovlan_vld));
-       fwr->smac_sel = 0;
+       fwr->smac_sel = f->smt->idx;
        fwr->rx_chan_rx_rpl_iq =
                htons(FW_FILTER_WR_RX_CHAN_V(0) |
                      FW_FILTER_WR_RX_RPL_IQ_V(adapter->sge.fw_evtq.abs_id));
@@ -1323,11 +1324,8 @@ static void mk_act_open_req6(struct filter_entry *f, struct sk_buff *skb,
                            TX_QUEUE_V(f->fs.nat_mode) |
                            T5_OPT_2_VALID_F |
                            RX_CHANNEL_V(cxgb4_port_e2cchan(f->dev)) |
-                           CONG_CNTRL_V((f->fs.action == FILTER_DROP) |
-                                        (f->fs.dirsteer << 1)) |
                            PACE_V((f->fs.maskhash) |
-                                  ((f->fs.dirsteerhash) << 1)) |
-                           CCTRL_ECN_V(f->fs.action == FILTER_SWITCH));
+                                  ((f->fs.dirsteerhash) << 1)));
 }
 
 static void mk_act_open_req(struct filter_entry *f, struct sk_buff *skb,
@@ -1363,11 +1361,8 @@ static void mk_act_open_req(struct filter_entry *f, struct sk_buff *skb,
                            TX_QUEUE_V(f->fs.nat_mode) |
                            T5_OPT_2_VALID_F |
                            RX_CHANNEL_V(cxgb4_port_e2cchan(f->dev)) |
-                           CONG_CNTRL_V((f->fs.action == FILTER_DROP) |
-                                        (f->fs.dirsteer << 1)) |
                            PACE_V((f->fs.maskhash) |
-                                  ((f->fs.dirsteerhash) << 1)) |
-                           CCTRL_ECN_V(f->fs.action == FILTER_SWITCH));
+                                  ((f->fs.dirsteerhash) << 1)));
 }
 
 static int cxgb4_set_hash_filter(struct net_device *dev,
@@ -2039,6 +2034,20 @@ void hash_filter_rpl(struct adapter *adap, const struct cpl_act_open_rpl *rpl)
                        }
                        return;
                }
+               switch (f->fs.action) {
+               case FILTER_PASS:
+                       if (f->fs.dirsteer)
+                               set_tcb_tflag(adap, f, tid,
+                                             TF_DIRECT_STEER_S, 1, 1);
+                       break;
+               case FILTER_DROP:
+                       set_tcb_tflag(adap, f, tid, TF_DROP_S, 1, 1);
+                       break;
+               case FILTER_SWITCH:
+                       set_tcb_tflag(adap, f, tid, TF_LPBK_S, 1, 1);
+                       break;
+               }
+
                break;
 
        default:
@@ -2106,22 +2115,11 @@ void filter_rpl(struct adapter *adap, const struct cpl_set_tcb_rpl *rpl)
                        if (ctx)
                                ctx->result = 0;
                } else if (ret == FW_FILTER_WR_FLT_ADDED) {
-                       int err = 0;
-
-                       if (f->fs.newsmac)
-                               err = configure_filter_smac(adap, f);
-
-                       if (!err) {
-                               f->pending = 0;  /* async setup completed */
-                               f->valid = 1;
-                               if (ctx) {
-                                       ctx->result = 0;
-                                       ctx->tid = idx;
-                               }
-                       } else {
-                               clear_filter(adap, f);
-                               if (ctx)
-                                       ctx->result = err;
+                       f->pending = 0;  /* async setup completed */
+                       f->valid = 1;
+                       if (ctx) {
+                               ctx->result = 0;
+                               ctx->tid = idx;
                        }
                } else {
                        /* Something went wrong.  Issue a warning about the
index a952fe1..7fd264a 100644 (file)
@@ -1176,6 +1176,7 @@ static u16 cxgb_select_queue(struct net_device *dev, struct sk_buff *skb,
                txq = netdev_pick_tx(dev, skb, sb_dev);
                if (xfrm_offload(skb) || is_ptp_enabled(skb, dev) ||
                    skb->encapsulation ||
+                   cxgb4_is_ktls_skb(skb) ||
                    (proto != IPPROTO_TCP && proto != IPPROTO_UDP))
                        txq = txq % pi->nqsets;
 
index b169776..1b49f2f 100644 (file)
@@ -388,6 +388,7 @@ struct ch_ktls_stats_debug {
        atomic64_t ktls_tx_retransmit_pkts;
        atomic64_t ktls_tx_complete_pkts;
        atomic64_t ktls_tx_trimmed_pkts;
+       atomic64_t ktls_tx_fallback;
 };
 #endif
 
@@ -493,6 +494,11 @@ struct cxgb4_uld_info {
 #endif
 };
 
+static inline bool cxgb4_is_ktls_skb(struct sk_buff *skb)
+{
+       return skb->sk && tls_is_sk_tx_device_offloaded(skb->sk);
+}
+
 void cxgb4_uld_enable(struct adapter *adap);
 void cxgb4_register_uld(enum cxgb4_uld type, const struct cxgb4_uld_info *p);
 int cxgb4_unregister_uld(enum cxgb4_uld type);
index a9e9c7a..196652a 100644 (file)
@@ -890,6 +890,114 @@ void cxgb4_write_sgl(const struct sk_buff *skb, struct sge_txq *q,
 }
 EXPORT_SYMBOL(cxgb4_write_sgl);
 
+/*     cxgb4_write_partial_sgl - populate SGL for partial packet
+ *     @skb: the packet
+ *     @q: the Tx queue we are writing into
+ *     @sgl: starting location for writing the SGL
+ *     @end: points right after the end of the SGL
+ *     @addr: the list of bus addresses for the SGL elements
+ *     @start: start offset in the SKB where partial data starts
+ *     @len: length of data from @start to send out
+ *
+ *     This API will handle sending out partial data of a skb if required.
+ *     Unlike cxgb4_write_sgl, @start can be any offset into the skb data,
+ *     and @len will decide how much data after @start offset to send out.
+ */
+void cxgb4_write_partial_sgl(const struct sk_buff *skb, struct sge_txq *q,
+                            struct ulptx_sgl *sgl, u64 *end,
+                            const dma_addr_t *addr, u32 start, u32 len)
+{
+       struct ulptx_sge_pair buf[MAX_SKB_FRAGS / 2 + 1] = {0}, *to;
+       u32 frag_size, skb_linear_data_len = skb_headlen(skb);
+       struct skb_shared_info *si = skb_shinfo(skb);
+       u8 i = 0, frag_idx = 0, nfrags = 0;
+       skb_frag_t *frag;
+
+       /* Fill the first SGL either from linear data or from partial
+        * frag based on @start.
+        */
+       if (unlikely(start < skb_linear_data_len)) {
+               frag_size = min(len, skb_linear_data_len - start);
+               sgl->len0 = htonl(frag_size);
+               sgl->addr0 = cpu_to_be64(addr[0] + start);
+               len -= frag_size;
+               nfrags++;
+       } else {
+               start -= skb_linear_data_len;
+               frag = &si->frags[frag_idx];
+               frag_size = skb_frag_size(frag);
+               /* find the first frag */
+               while (start >= frag_size) {
+                       start -= frag_size;
+                       frag_idx++;
+                       frag = &si->frags[frag_idx];
+                       frag_size = skb_frag_size(frag);
+               }
+
+               frag_size = min(len, skb_frag_size(frag) - start);
+               sgl->len0 = cpu_to_be32(frag_size);
+               sgl->addr0 = cpu_to_be64(addr[frag_idx + 1] + start);
+               len -= frag_size;
+               nfrags++;
+               frag_idx++;
+       }
+
+       /* If the entire partial data fit in one SGL, then send it out
+        * now.
+        */
+       if (!len)
+               goto done;
+
+       /* Most of the complexity below deals with the possibility we hit the
+        * end of the queue in the middle of writing the SGL.  For this case
+        * only we create the SGL in a temporary buffer and then copy it.
+        */
+       to = (u8 *)end > (u8 *)q->stat ? buf : sgl->sge;
+
+       /* If the skb couldn't fit in first SGL completely, fill the
+        * rest of the frags in subsequent SGLs. Note that each SGL
+        * pair can store 2 frags.
+        */
+       while (len) {
+               frag_size = min(len, skb_frag_size(&si->frags[frag_idx]));
+               to->len[i & 1] = cpu_to_be32(frag_size);
+               to->addr[i & 1] = cpu_to_be64(addr[frag_idx + 1]);
+               if (i && (i & 1))
+                       to++;
+               nfrags++;
+               frag_idx++;
+               i++;
+               len -= frag_size;
+       }
+
+       /* If we ended in an odd boundary, then set the second SGL's
+        * length in the pair to 0.
+        */
+       if (i & 1)
+               to->len[1] = cpu_to_be32(0);
+
+       /* Copy from temporary buffer to Tx ring, in case we hit the
+        * end of the queue in the middle of writing the SGL.
+        */
+       if (unlikely((u8 *)end > (u8 *)q->stat)) {
+               u32 part0 = (u8 *)q->stat - (u8 *)sgl->sge, part1;
+
+               if (likely(part0))
+                       memcpy(sgl->sge, buf, part0);
+               part1 = (u8 *)end - (u8 *)q->stat;
+               memcpy(q->desc, (u8 *)buf + part0, part1);
+               end = (void *)q->desc + part1;
+       }
+
+       /* 0-pad to multiple of 16 */
+       if ((uintptr_t)end & 8)
+               *end = 0;
+done:
+       sgl->cmd_nsge = htonl(ULPTX_CMD_V(ULP_TX_SC_DSGL) |
+                       ULPTX_NSGE_V(nfrags));
+}
+EXPORT_SYMBOL(cxgb4_write_partial_sgl);
+
 /* This function copies 64 byte coalesced work request to
  * memory mapped BAR2 space. For coalesced WR SGE fetches
  * data from the FIFO instead of from Host.
@@ -1422,7 +1530,8 @@ static netdev_tx_t cxgb4_eth_xmit(struct sk_buff *skb, struct net_device *dev)
 #endif /* CHELSIO_IPSEC_INLINE */
 
 #if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
-       if (skb->decrypted)
+       if (cxgb4_is_ktls_skb(skb) &&
+           (skb->len - (skb_transport_offset(skb) + tcp_hdrlen(skb))))
                return adap->uld[CXGB4_ULD_KTLS].tx_handler(skb, dev);
 #endif /* CHELSIO_TLS_DEVICE */
 
index 50232e0..92473dd 100644 (file)
 #define TCB_T_FLAGS_M          0xffffffffffffffffULL
 #define TCB_T_FLAGS_V(x)       ((__u64)(x) << TCB_T_FLAGS_S)
 
+#define TF_DROP_S              22
+#define TF_DIRECT_STEER_S      23
+#define TF_LPBK_S              59
+
 #define TF_CCTRL_ECE_S         60
 #define TF_CCTRL_CWR_S         61
 #define TF_CCTRL_RFR_S         62
index 5195f69..c24485c 100644 (file)
 static LIST_HEAD(uld_ctx_list);
 static DEFINE_MUTEX(dev_mutex);
 
+/* chcr_get_nfrags_to_send: get the remaining nfrags after start offset
+ * @skb: skb
+ * @start: start offset.
+ * @len: how much data to send after @start
+ */
+static int chcr_get_nfrags_to_send(struct sk_buff *skb, u32 start, u32 len)
+{
+       struct skb_shared_info *si = skb_shinfo(skb);
+       u32 frag_size, skb_linear_data_len = skb_headlen(skb);
+       u8 nfrags = 0, frag_idx = 0;
+       skb_frag_t *frag;
+
+       /* if its a linear skb then return 1 */
+       if (!skb_is_nonlinear(skb))
+               return 1;
+
+       if (unlikely(start < skb_linear_data_len)) {
+               frag_size = min(len, skb_linear_data_len - start);
+               start = 0;
+       } else {
+               start -= skb_linear_data_len;
+
+               frag = &si->frags[frag_idx];
+               frag_size = skb_frag_size(frag);
+               while (start >= frag_size) {
+                       start -= frag_size;
+                       frag_idx++;
+                       frag = &si->frags[frag_idx];
+                       frag_size = skb_frag_size(frag);
+               }
+               frag_size = min(len, skb_frag_size(frag) - start);
+       }
+       len -= frag_size;
+       nfrags++;
+
+       while (len) {
+               frag_size = min(len, skb_frag_size(&si->frags[frag_idx]));
+               len -= frag_size;
+               nfrags++;
+               frag_idx++;
+       }
+       return nfrags;
+}
+
 static int chcr_init_tcb_fields(struct chcr_ktls_info *tx_info);
 /*
  * chcr_ktls_save_keys: calculate and save crypto keys.
@@ -689,7 +733,8 @@ static int chcr_ktls_cpl_set_tcb_rpl(struct adapter *adap, unsigned char *input)
 }
 
 static void *__chcr_write_cpl_set_tcb_ulp(struct chcr_ktls_info *tx_info,
-                                       u32 tid, void *pos, u16 word, u64 mask,
+                                       u32 tid, void *pos, u16 word,
+                                       struct sge_eth_txq *q, u64 mask,
                                        u64 val, u32 reply)
 {
        struct cpl_set_tcb_field_core *cpl;
@@ -698,7 +743,10 @@ static void *__chcr_write_cpl_set_tcb_ulp(struct chcr_ktls_info *tx_info,
 
        /* ULP_TXPKT */
        txpkt = pos;
-       txpkt->cmd_dest = htonl(ULPTX_CMD_V(ULP_TX_PKT) | ULP_TXPKT_DEST_V(0));
+       txpkt->cmd_dest = htonl(ULPTX_CMD_V(ULP_TX_PKT) |
+                               ULP_TXPKT_CHANNELID_V(tx_info->port_id) |
+                               ULP_TXPKT_FID_V(q->q.cntxt_id) |
+                               ULP_TXPKT_RO_F);
        txpkt->len = htonl(DIV_ROUND_UP(CHCR_SET_TCB_FIELD_LEN, 16));
 
        /* ULPTX_IDATA sub-command */
@@ -753,7 +801,7 @@ static void *chcr_write_cpl_set_tcb_ulp(struct chcr_ktls_info *tx_info,
                } else {
                        u8 buf[48] = {0};
 
-                       __chcr_write_cpl_set_tcb_ulp(tx_info, tid, buf, word,
+                       __chcr_write_cpl_set_tcb_ulp(tx_info, tid, buf, word, q,
                                                     mask, val, reply);
 
                        return chcr_copy_to_txd(buf, &q->q, pos,
@@ -761,7 +809,7 @@ static void *chcr_write_cpl_set_tcb_ulp(struct chcr_ktls_info *tx_info,
                }
        }
 
-       pos = __chcr_write_cpl_set_tcb_ulp(tx_info, tid, pos, word,
+       pos = __chcr_write_cpl_set_tcb_ulp(tx_info, tid, pos, word, q,
                                           mask, val, reply);
 
        /* check again if we are at the end of the queue */
@@ -783,11 +831,11 @@ static void *chcr_write_cpl_set_tcb_ulp(struct chcr_ktls_info *tx_info,
  */
 static int chcr_ktls_xmit_tcb_cpls(struct chcr_ktls_info *tx_info,
                                   struct sge_eth_txq *q, u64 tcp_seq,
-                                  u64 tcp_ack, u64 tcp_win)
+                                  u64 tcp_ack, u64 tcp_win, bool offset)
 {
        bool first_wr = ((tx_info->prev_ack == 0) && (tx_info->prev_win == 0));
        struct ch_ktls_port_stats_debug *port_stats;
-       u32 len, cpl = 0, ndesc, wr_len;
+       u32 len, cpl = 0, ndesc, wr_len, wr_mid = 0;
        struct fw_ulptx_wr *wr;
        int credits;
        void *pos;
@@ -803,6 +851,11 @@ static int chcr_ktls_xmit_tcb_cpls(struct chcr_ktls_info *tx_info,
                return NETDEV_TX_BUSY;
        }
 
+       if (unlikely(credits < ETHTXQ_STOP_THRES)) {
+               chcr_eth_txq_stop(q);
+               wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
+       }
+
        pos = &q->q.desc[q->q.pidx];
        /* make space for WR, we'll fill it later when we know all the cpls
         * being sent out and have complete length.
@@ -818,7 +871,7 @@ static int chcr_ktls_xmit_tcb_cpls(struct chcr_ktls_info *tx_info,
                cpl++;
        }
        /* reset snd una if it's a re-transmit pkt */
-       if (tcp_seq != tx_info->prev_seq) {
+       if (tcp_seq != tx_info->prev_seq || offset) {
                /* reset snd_una */
                port_stats =
                        &tx_info->adap->ch_ktls_stats.ktls_port[tx_info->port_id];
@@ -827,7 +880,8 @@ static int chcr_ktls_xmit_tcb_cpls(struct chcr_ktls_info *tx_info,
                                                 TCB_SND_UNA_RAW_V
                                                 (TCB_SND_UNA_RAW_M),
                                                 TCB_SND_UNA_RAW_V(0), 0);
-               atomic64_inc(&port_stats->ktls_tx_ooo);
+               if (tcp_seq != tx_info->prev_seq)
+                       atomic64_inc(&port_stats->ktls_tx_ooo);
                cpl++;
        }
        /* update ack */
@@ -856,7 +910,8 @@ static int chcr_ktls_xmit_tcb_cpls(struct chcr_ktls_info *tx_info,
                wr->op_to_compl = htonl(FW_WR_OP_V(FW_ULPTX_WR));
                wr->cookie = 0;
                /* fill len in wr field */
-               wr->flowid_len16 = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(len, 16)));
+               wr->flowid_len16 = htonl(wr_mid |
+                                        FW_WR_LEN16_V(DIV_ROUND_UP(len, 16)));
 
                ndesc = DIV_ROUND_UP(len, 64);
                chcr_txq_advance(&q->q, ndesc);
@@ -866,34 +921,14 @@ static int chcr_ktls_xmit_tcb_cpls(struct chcr_ktls_info *tx_info,
 }
 
 /*
- * chcr_ktls_skb_copy
- * @nskb - new skb where the frags to be added.
- * @skb - old skb from which frags will be copied.
- */
-static void chcr_ktls_skb_copy(struct sk_buff *skb, struct sk_buff *nskb)
-{
-       int i;
-
-       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
-               skb_shinfo(nskb)->frags[i] = skb_shinfo(skb)->frags[i];
-               __skb_frag_ref(&skb_shinfo(nskb)->frags[i]);
-       }
-
-       skb_shinfo(nskb)->nr_frags = skb_shinfo(skb)->nr_frags;
-       nskb->len += skb->data_len;
-       nskb->data_len = skb->data_len;
-       nskb->truesize += skb->data_len;
-}
-
-/*
  * chcr_ktls_get_tx_flits
  * returns number of flits to be sent out, it includes key context length, WR
  * size and skb fragments.
  */
 static unsigned int
-chcr_ktls_get_tx_flits(const struct sk_buff *skb, unsigned int key_ctx_len)
+chcr_ktls_get_tx_flits(u32 nr_frags, unsigned int key_ctx_len)
 {
-       return chcr_sgl_len(skb_shinfo(skb)->nr_frags) +
+       return chcr_sgl_len(nr_frags) +
               DIV_ROUND_UP(key_ctx_len + CHCR_KTLS_WR_SIZE, 8);
 }
 
@@ -957,8 +992,10 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
        struct tcphdr *tcp;
        int len16, pktlen;
        struct iphdr *ip;
+       u32 wr_mid = 0;
        int credits;
        u8 buf[150];
+       u64 cntrl1;
        void *pos;
 
        iplen = skb_network_header_len(skb);
@@ -967,7 +1004,7 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
        /* packet length = eth hdr len + ip hdr len + tcp hdr len
         * (including options).
         */
-       pktlen = skb->len - skb->data_len;
+       pktlen = skb_transport_offset(skb) + tcp_hdrlen(skb);
 
        ctrl = sizeof(*cpl) + pktlen;
        len16 = DIV_ROUND_UP(sizeof(*wr) + ctrl, 16);
@@ -980,6 +1017,11 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
                return NETDEV_TX_BUSY;
        }
 
+       if (unlikely(credits < ETHTXQ_STOP_THRES)) {
+               chcr_eth_txq_stop(q);
+               wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
+       }
+
        pos = &q->q.desc[q->q.pidx];
        wr = pos;
 
@@ -987,7 +1029,7 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
        wr->op_immdlen = htonl(FW_WR_OP_V(FW_ETH_TX_PKT_WR) |
                               FW_WR_IMMDLEN_V(ctrl));
 
-       wr->equiq_to_len16 = htonl(FW_WR_LEN16_V(len16));
+       wr->equiq_to_len16 = htonl(wr_mid | FW_WR_LEN16_V(len16));
        wr->r3 = 0;
 
        cpl = (void *)(wr + 1);
@@ -997,22 +1039,28 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
                           TXPKT_PF_V(tx_info->adap->pf));
        cpl->pack = 0;
        cpl->len = htons(pktlen);
-       /* checksum offload */
-       cpl->ctrl1 = 0;
-
-       pos = cpl + 1;
 
        memcpy(buf, skb->data, pktlen);
        if (tx_info->ip_family == AF_INET) {
                /* we need to correct ip header len */
                ip = (struct iphdr *)(buf + maclen);
                ip->tot_len = htons(pktlen - maclen);
+               cntrl1 = TXPKT_CSUM_TYPE_V(TX_CSUM_TCPIP);
 #if IS_ENABLED(CONFIG_IPV6)
        } else {
                ip6 = (struct ipv6hdr *)(buf + maclen);
                ip6->payload_len = htons(pktlen - maclen - iplen);
+               cntrl1 = TXPKT_CSUM_TYPE_V(TX_CSUM_TCPIP6);
 #endif
        }
+
+       cntrl1 |= T6_TXPKT_ETHHDR_LEN_V(maclen - ETH_HLEN) |
+                 TXPKT_IPHDR_LEN_V(iplen);
+       /* checksum offload */
+       cpl->ctrl1 = cpu_to_be64(cntrl1);
+
+       pos = cpl + 1;
+
        /* now take care of the tcp header, if fin is not set then clear push
         * bit as well, and if fin is set, it will be sent at the last so we
         * need to update the tcp sequence number as per the last packet.
@@ -1031,71 +1079,6 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
        return 0;
 }
 
-/* chcr_ktls_skb_shift - Shifts request length paged data from skb to another.
- * @tgt- buffer into which tail data gets added
- * @skb- buffer from which the paged data comes from
- * @shiftlen- shift up to this many bytes
- */
-static int chcr_ktls_skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
-                              int shiftlen)
-{
-       skb_frag_t *fragfrom, *fragto;
-       int from, to, todo;
-
-       WARN_ON(shiftlen > skb->data_len);
-
-       todo = shiftlen;
-       from = 0;
-       to = 0;
-       fragfrom = &skb_shinfo(skb)->frags[from];
-
-       while ((todo > 0) && (from < skb_shinfo(skb)->nr_frags)) {
-               fragfrom = &skb_shinfo(skb)->frags[from];
-               fragto = &skb_shinfo(tgt)->frags[to];
-
-               if (todo >= skb_frag_size(fragfrom)) {
-                       *fragto = *fragfrom;
-                       todo -= skb_frag_size(fragfrom);
-                       from++;
-                       to++;
-
-               } else {
-                       __skb_frag_ref(fragfrom);
-                       skb_frag_page_copy(fragto, fragfrom);
-                       skb_frag_off_copy(fragto, fragfrom);
-                       skb_frag_size_set(fragto, todo);
-
-                       skb_frag_off_add(fragfrom, todo);
-                       skb_frag_size_sub(fragfrom, todo);
-                       todo = 0;
-
-                       to++;
-                       break;
-               }
-       }
-
-       /* Ready to "commit" this state change to tgt */
-       skb_shinfo(tgt)->nr_frags = to;
-
-       /* Reposition in the original skb */
-       to = 0;
-       while (from < skb_shinfo(skb)->nr_frags)
-               skb_shinfo(skb)->frags[to++] = skb_shinfo(skb)->frags[from++];
-
-       skb_shinfo(skb)->nr_frags = to;
-
-       WARN_ON(todo > 0 && !skb_shinfo(skb)->nr_frags);
-
-       skb->len -= shiftlen;
-       skb->data_len -= shiftlen;
-       skb->truesize -= shiftlen;
-       tgt->len += shiftlen;
-       tgt->data_len += shiftlen;
-       tgt->truesize += shiftlen;
-
-       return shiftlen;
-}
-
 /*
  * chcr_ktls_xmit_wr_complete: This sends out the complete record. If an skb
  * received has partial end part of the record, send out the complete record, so
@@ -1111,6 +1094,8 @@ static int chcr_ktls_skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
 static int chcr_ktls_xmit_wr_complete(struct sk_buff *skb,
                                      struct chcr_ktls_info *tx_info,
                                      struct sge_eth_txq *q, u32 tcp_seq,
+                                     bool is_last_wr, u32 data_len,
+                                     u32 skb_offset, u32 nfrags,
                                      bool tcp_push, u32 mss)
 {
        u32 len16, wr_mid = 0, flits = 0, ndesc, cipher_start;
@@ -1126,7 +1111,7 @@ static int chcr_ktls_xmit_wr_complete(struct sk_buff *skb,
        u64 *end;
 
        /* get the number of flits required */
-       flits = chcr_ktls_get_tx_flits(skb, tx_info->key_ctx_len);
+       flits = chcr_ktls_get_tx_flits(nfrags, tx_info->key_ctx_len);
        /* number of descriptors */
        ndesc = chcr_flits_to_desc(flits);
        /* check if enough credits available */
@@ -1155,6 +1140,9 @@ static int chcr_ktls_xmit_wr_complete(struct sk_buff *skb,
                return NETDEV_TX_BUSY;
        }
 
+       if (!is_last_wr)
+               skb_get(skb);
+
        pos = &q->q.desc[q->q.pidx];
        end = (u64 *)pos + flits;
        /* FW_ULPTX_WR */
@@ -1187,7 +1175,7 @@ static int chcr_ktls_xmit_wr_complete(struct sk_buff *skb,
                      CPL_TX_SEC_PDU_CPLLEN_V(CHCR_CPL_TX_SEC_PDU_LEN_64BIT) |
                      CPL_TX_SEC_PDU_PLACEHOLDER_V(1) |
                      CPL_TX_SEC_PDU_IVINSRTOFST_V(TLS_HEADER_SIZE + 1));
-       cpl->pldlen = htonl(skb->data_len);
+       cpl->pldlen = htonl(data_len);
 
        /* encryption should start after tls header size + iv size */
        cipher_start = TLS_HEADER_SIZE + tx_info->iv_size + 1;
@@ -1229,7 +1217,7 @@ static int chcr_ktls_xmit_wr_complete(struct sk_buff *skb,
        /* CPL_TX_DATA */
        tx_data = (void *)pos;
        OPCODE_TID(tx_data) = htonl(MK_OPCODE_TID(CPL_TX_DATA, tx_info->tid));
-       tx_data->len = htonl(TX_DATA_MSS_V(mss) | TX_LENGTH_V(skb->data_len));
+       tx_data->len = htonl(TX_DATA_MSS_V(mss) | TX_LENGTH_V(data_len));
 
        tx_data->rsvd = htonl(tcp_seq);
 
@@ -1249,8 +1237,8 @@ static int chcr_ktls_xmit_wr_complete(struct sk_buff *skb,
        }
 
        /* send the complete packet except the header */
-       cxgb4_write_sgl(skb, &q->q, pos, end, skb->len - skb->data_len,
-                       sgl_sdesc->addr);
+       cxgb4_write_partial_sgl(skb, &q->q, pos, end, sgl_sdesc->addr,
+                               skb_offset, data_len);
        sgl_sdesc->skb = skb;
 
        chcr_txq_advance(&q->q, ndesc);
@@ -1282,10 +1270,11 @@ static int chcr_ktls_xmit_wr_short(struct sk_buff *skb,
                                   struct sge_eth_txq *q,
                                   u32 tcp_seq, bool tcp_push, u32 mss,
                                   u32 tls_rec_offset, u8 *prior_data,
-                                  u32 prior_data_len)
+                                  u32 prior_data_len, u32 data_len,
+                                  u32 skb_offset)
 {
+       u32 len16, wr_mid = 0, cipher_start, nfrags;
        struct adapter *adap = tx_info->adap;
-       u32 len16, wr_mid = 0, cipher_start;
        unsigned int flits = 0, ndesc;
        int credits, left, last_desc;
        struct tx_sw_desc *sgl_sdesc;
@@ -1298,10 +1287,11 @@ static int chcr_ktls_xmit_wr_short(struct sk_buff *skb,
        void *pos;
        u64 *end;
 
+       nfrags = chcr_get_nfrags_to_send(skb, skb_offset, data_len);
        /* get the number of flits required, it's a partial record so 2 flits
         * (AES_BLOCK_SIZE) will be added.
         */
-       flits = chcr_ktls_get_tx_flits(skb, tx_info->key_ctx_len) + 2;
+       flits = chcr_ktls_get_tx_flits(nfrags, tx_info->key_ctx_len) + 2;
        /* get the correct 8 byte IV of this record */
        iv_record = cpu_to_be64(tx_info->iv + tx_info->record_no);
        /* If it's a middle record and not 16 byte aligned to run AES CTR, need
@@ -1373,7 +1363,7 @@ static int chcr_ktls_xmit_wr_short(struct sk_buff *skb,
                htonl(CPL_TX_SEC_PDU_OPCODE_V(CPL_TX_SEC_PDU) |
                      CPL_TX_SEC_PDU_CPLLEN_V(CHCR_CPL_TX_SEC_PDU_LEN_64BIT) |
                      CPL_TX_SEC_PDU_IVINSRTOFST_V(1));
-       cpl->pldlen = htonl(skb->data_len + AES_BLOCK_LEN + prior_data_len);
+       cpl->pldlen = htonl(data_len + AES_BLOCK_LEN + prior_data_len);
        cpl->aadstart_cipherstop_hi =
                htonl(CPL_TX_SEC_PDU_CIPHERSTART_V(cipher_start));
        cpl->cipherstop_lo_authinsert = 0;
@@ -1404,7 +1394,7 @@ static int chcr_ktls_xmit_wr_short(struct sk_buff *skb,
        tx_data = (void *)pos;
        OPCODE_TID(tx_data) = htonl(MK_OPCODE_TID(CPL_TX_DATA, tx_info->tid));
        tx_data->len = htonl(TX_DATA_MSS_V(mss) |
-                       TX_LENGTH_V(skb->data_len + prior_data_len));
+                            TX_LENGTH_V(data_len + prior_data_len));
        tx_data->rsvd = htonl(tcp_seq);
        tx_data->flags = htonl(TX_BYPASS_F);
        if (tcp_push)
@@ -1437,8 +1427,8 @@ static int chcr_ktls_xmit_wr_short(struct sk_buff *skb,
        if (prior_data_len)
                pos = chcr_copy_to_txd(prior_data, &q->q, pos, 16);
        /* send the complete packet except the header */
-       cxgb4_write_sgl(skb, &q->q, pos, end, skb->len - skb->data_len,
-                       sgl_sdesc->addr);
+       cxgb4_write_partial_sgl(skb, &q->q, pos, end, sgl_sdesc->addr,
+                               skb_offset, data_len);
        sgl_sdesc->skb = skb;
 
        chcr_txq_advance(&q->q, ndesc);
@@ -1466,6 +1456,7 @@ static int chcr_ktls_tx_plaintxt(struct chcr_ktls_info *tx_info,
                                 struct sk_buff *skb, u32 tcp_seq, u32 mss,
                                 bool tcp_push, struct sge_eth_txq *q,
                                 u32 port_id, u8 *prior_data,
+                                u32 data_len, u32 skb_offset,
                                 u32 prior_data_len)
 {
        int credits, left, len16, last_desc;
@@ -1475,14 +1466,16 @@ static int chcr_ktls_tx_plaintxt(struct chcr_ktls_info *tx_info,
        struct ulptx_idata *idata;
        struct ulp_txpkt *ulptx;
        struct fw_ulptx_wr *wr;
-       u32 wr_mid = 0;
+       u32 wr_mid = 0, nfrags;
        void *pos;
        u64 *end;
 
        flits = DIV_ROUND_UP(CHCR_PLAIN_TX_DATA_LEN, 8);
-       flits += chcr_sgl_len(skb_shinfo(skb)->nr_frags);
+       nfrags = chcr_get_nfrags_to_send(skb, skb_offset, data_len);
+       flits += chcr_sgl_len(nfrags);
        if (prior_data_len)
                flits += 2;
+
        /* WR will need len16 */
        len16 = DIV_ROUND_UP(flits, 2);
        /* check how many descriptors needed */
@@ -1535,7 +1528,7 @@ static int chcr_ktls_tx_plaintxt(struct chcr_ktls_info *tx_info,
        tx_data = (struct cpl_tx_data *)(idata + 1);
        OPCODE_TID(tx_data) = htonl(MK_OPCODE_TID(CPL_TX_DATA, tx_info->tid));
        tx_data->len = htonl(TX_DATA_MSS_V(mss) |
-                       TX_LENGTH_V(skb->data_len + prior_data_len));
+                            TX_LENGTH_V(data_len + prior_data_len));
        /* set tcp seq number */
        tx_data->rsvd = htonl(tcp_seq);
        tx_data->flags = htonl(TX_BYPASS_F);
@@ -1559,8 +1552,8 @@ static int chcr_ktls_tx_plaintxt(struct chcr_ktls_info *tx_info,
                end = pos + left;
        }
        /* send the complete packet including the header */
-       cxgb4_write_sgl(skb, &q->q, pos, end, skb->len - skb->data_len,
-                       sgl_sdesc->addr);
+       cxgb4_write_partial_sgl(skb, &q->q, pos, end, sgl_sdesc->addr,
+                               skb_offset, data_len);
        sgl_sdesc->skb = skb;
 
        chcr_txq_advance(&q->q, ndesc);
@@ -1568,12 +1561,96 @@ static int chcr_ktls_tx_plaintxt(struct chcr_ktls_info *tx_info,
        return 0;
 }
 
+static int chcr_ktls_tunnel_pkt(struct chcr_ktls_info *tx_info,
+                               struct sk_buff *skb,
+                               struct sge_eth_txq *q)
+{
+       u32 ctrl, iplen, maclen, wr_mid = 0, len16;
+       struct tx_sw_desc *sgl_sdesc;
+       struct fw_eth_tx_pkt_wr *wr;
+       struct cpl_tx_pkt_core *cpl;
+       unsigned int flits, ndesc;
+       int credits, last_desc;
+       u64 cntrl1, *end;
+       void *pos;
+
+       ctrl = sizeof(*cpl);
+       flits = DIV_ROUND_UP(sizeof(*wr) + ctrl, 8);
+
+       flits += chcr_sgl_len(skb_shinfo(skb)->nr_frags + 1);
+       len16 = DIV_ROUND_UP(flits, 2);
+       /* check how many descriptors needed */
+       ndesc = DIV_ROUND_UP(flits, 8);
+
+       credits = chcr_txq_avail(&q->q) - ndesc;
+       if (unlikely(credits < 0)) {
+               chcr_eth_txq_stop(q);
+               return -ENOMEM;
+       }
+
+       if (unlikely(credits < ETHTXQ_STOP_THRES)) {
+               chcr_eth_txq_stop(q);
+               wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
+       }
+
+       last_desc = q->q.pidx + ndesc - 1;
+       if (last_desc >= q->q.size)
+               last_desc -= q->q.size;
+       sgl_sdesc = &q->q.sdesc[last_desc];
+
+       if (unlikely(cxgb4_map_skb(tx_info->adap->pdev_dev, skb,
+                                  sgl_sdesc->addr) < 0)) {
+               memset(sgl_sdesc->addr, 0, sizeof(sgl_sdesc->addr));
+               q->mapping_err++;
+               return -ENOMEM;
+       }
+
+       iplen = skb_network_header_len(skb);
+       maclen = skb_mac_header_len(skb);
+
+       pos = &q->q.desc[q->q.pidx];
+       end = (u64 *)pos + flits;
+       wr = pos;
+
+       /* Firmware work request header */
+       wr->op_immdlen = htonl(FW_WR_OP_V(FW_ETH_TX_PKT_WR) |
+                              FW_WR_IMMDLEN_V(ctrl));
+
+       wr->equiq_to_len16 = htonl(wr_mid | FW_WR_LEN16_V(len16));
+       wr->r3 = 0;
+
+       cpl = (void *)(wr + 1);
+
+       /* CPL header */
+       cpl->ctrl0 = htonl(TXPKT_OPCODE_V(CPL_TX_PKT) |
+                          TXPKT_INTF_V(tx_info->tx_chan) |
+                          TXPKT_PF_V(tx_info->adap->pf));
+       cpl->pack = 0;
+       cntrl1 = TXPKT_CSUM_TYPE_V(tx_info->ip_family == AF_INET ?
+                                  TX_CSUM_TCPIP : TX_CSUM_TCPIP6);
+       cntrl1 |= T6_TXPKT_ETHHDR_LEN_V(maclen - ETH_HLEN) |
+                 TXPKT_IPHDR_LEN_V(iplen);
+       /* checksum offload */
+       cpl->ctrl1 = cpu_to_be64(cntrl1);
+       cpl->len = htons(skb->len);
+
+       pos = cpl + 1;
+
+       cxgb4_write_sgl(skb, &q->q, pos, end, 0, sgl_sdesc->addr);
+       sgl_sdesc->skb = skb;
+       chcr_txq_advance(&q->q, ndesc);
+       cxgb4_ring_tx_db(tx_info->adap, &q->q, ndesc);
+       return 0;
+}
+
 /*
  * chcr_ktls_copy_record_in_skb
  * @nskb - new skb where the frags to be added.
+ * @skb - old skb, to copy socket and destructor details.
  * @record - specific record which has complete 16k record in frags.
  */
 static void chcr_ktls_copy_record_in_skb(struct sk_buff *nskb,
+                                        struct sk_buff *skb,
                                         struct tls_record_info *record)
 {
        int i = 0;
@@ -1588,6 +1665,9 @@ static void chcr_ktls_copy_record_in_skb(struct sk_buff *nskb,
        nskb->data_len = record->len;
        nskb->len += record->len;
        nskb->truesize += record->len;
+       nskb->sk = skb->sk;
+       nskb->destructor = skb->destructor;
+       refcount_add(nskb->truesize, &nskb->sk->sk_wmem_alloc);
 }
 
 /*
@@ -1659,7 +1739,7 @@ static int chcr_end_part_handler(struct chcr_ktls_info *tx_info,
                                 struct sk_buff *skb,
                                 struct tls_record_info *record,
                                 u32 tcp_seq, int mss, bool tcp_push_no_fin,
-                                struct sge_eth_txq *q,
+                                struct sge_eth_txq *q, u32 skb_offset,
                                 u32 tls_end_offset, bool last_wr)
 {
        struct sk_buff *nskb = NULL;
@@ -1668,30 +1748,37 @@ static int chcr_end_part_handler(struct chcr_ktls_info *tx_info,
                nskb = skb;
                atomic64_inc(&tx_info->adap->ch_ktls_stats.ktls_tx_complete_pkts);
        } else {
-               dev_kfree_skb_any(skb);
-
-               nskb = alloc_skb(0, GFP_KERNEL);
-               if (!nskb)
+               nskb = alloc_skb(0, GFP_ATOMIC);
+               if (!nskb) {
+                       dev_kfree_skb_any(skb);
                        return NETDEV_TX_BUSY;
+               }
+
                /* copy complete record in skb */
-               chcr_ktls_copy_record_in_skb(nskb, record);
+               chcr_ktls_copy_record_in_skb(nskb, skb, record);
                /* packet is being sent from the beginning, update the tcp_seq
                 * accordingly.
                 */
                tcp_seq = tls_record_start_seq(record);
-               /* reset snd una, so the middle record won't send the already
-                * sent part.
-                */
-               if (chcr_ktls_update_snd_una(tx_info, q))
-                       goto out;
+               /* reset skb offset */
+               skb_offset = 0;
+
+               if (last_wr)
+                       dev_kfree_skb_any(skb);
+
+               last_wr = true;
+
                atomic64_inc(&tx_info->adap->ch_ktls_stats.ktls_tx_end_pkts);
        }
 
        if (chcr_ktls_xmit_wr_complete(nskb, tx_info, q, tcp_seq,
+                                      last_wr, record->len, skb_offset,
+                                      record->num_frags,
                                       (last_wr && tcp_push_no_fin),
                                       mss)) {
                goto out;
        }
+       tx_info->prev_seq = record->end_seq;
        return 0;
 out:
        dev_kfree_skb_any(nskb);
@@ -1723,41 +1810,47 @@ static int chcr_short_record_handler(struct chcr_ktls_info *tx_info,
                                     struct sk_buff *skb,
                                     struct tls_record_info *record,
                                     u32 tcp_seq, int mss, bool tcp_push_no_fin,
+                                    u32 data_len, u32 skb_offset,
                                     struct sge_eth_txq *q, u32 tls_end_offset)
 {
        u32 tls_rec_offset = tcp_seq - tls_record_start_seq(record);
        u8 prior_data[16] = {0};
        u32 prior_data_len = 0;
-       u32 data_len;
 
        /* check if the skb is ending in middle of tag/HASH, its a big
         * trouble, send the packet before the HASH.
         */
-       int remaining_record = tls_end_offset - skb->data_len;
+       int remaining_record = tls_end_offset - data_len;
 
        if (remaining_record > 0 &&
            remaining_record < TLS_CIPHER_AES_GCM_128_TAG_SIZE) {
-               int trimmed_len = skb->data_len -
-                       (TLS_CIPHER_AES_GCM_128_TAG_SIZE - remaining_record);
-               struct sk_buff *tmp_skb = NULL;
-               /* don't process the pkt if it is only a partial tag */
-               if (skb->data_len < TLS_CIPHER_AES_GCM_128_TAG_SIZE)
-                       goto out;
+               int trimmed_len = 0;
 
-               WARN_ON(trimmed_len > skb->data_len);
+               if (tls_end_offset > TLS_CIPHER_AES_GCM_128_TAG_SIZE)
+                       trimmed_len = data_len -
+                                     (TLS_CIPHER_AES_GCM_128_TAG_SIZE -
+                                      remaining_record);
+               if (!trimmed_len)
+                       return FALLBACK;
 
-               /* shift to those many bytes */
-               tmp_skb = alloc_skb(0, GFP_KERNEL);
-               if (unlikely(!tmp_skb))
-                       goto out;
+               WARN_ON(trimmed_len > data_len);
 
-               chcr_ktls_skb_shift(tmp_skb, skb, trimmed_len);
-               /* free the last trimmed portion */
-               dev_kfree_skb_any(skb);
-               skb = tmp_skb;
+               data_len = trimmed_len;
                atomic64_inc(&tx_info->adap->ch_ktls_stats.ktls_tx_trimmed_pkts);
        }
-       data_len = skb->data_len;
+
+       /* check if it is only the header part. */
+       if (tls_rec_offset + data_len <= (TLS_HEADER_SIZE + tx_info->iv_size)) {
+               if (chcr_ktls_tx_plaintxt(tx_info, skb, tcp_seq, mss,
+                                         tcp_push_no_fin, q,
+                                         tx_info->port_id, prior_data,
+                                         data_len, skb_offset, prior_data_len))
+                       goto out;
+
+               tx_info->prev_seq = tcp_seq + data_len;
+               return 0;
+       }
+
        /* check if the middle record's start point is 16 byte aligned. CTR
         * needs 16 byte aligned start point to start encryption.
         */
@@ -1818,9 +1911,6 @@ static int chcr_short_record_handler(struct chcr_ktls_info *tx_info,
                        }
                        /* reset tcp_seq as per the prior_data_required len */
                        tcp_seq -= prior_data_len;
-                       /* include prio_data_len for  further calculation.
-                        */
-                       data_len += prior_data_len;
                }
                /* reset snd una, so the middle record won't send the already
                 * sent part.
@@ -1829,37 +1919,54 @@ static int chcr_short_record_handler(struct chcr_ktls_info *tx_info,
                        goto out;
                atomic64_inc(&tx_info->adap->ch_ktls_stats.ktls_tx_middle_pkts);
        } else {
-               /* Else means, its a partial first part of the record. Check if
-                * its only the header, don't need to send for encryption then.
-                */
-               if (data_len <= TLS_HEADER_SIZE + tx_info->iv_size) {
-                       if (chcr_ktls_tx_plaintxt(tx_info, skb, tcp_seq, mss,
-                                                 tcp_push_no_fin, q,
-                                                 tx_info->port_id,
-                                                 prior_data,
-                                                 prior_data_len)) {
-                               goto out;
-                       }
-                       return 0;
-               }
                atomic64_inc(&tx_info->adap->ch_ktls_stats.ktls_tx_start_pkts);
        }
 
        if (chcr_ktls_xmit_wr_short(skb, tx_info, q, tcp_seq, tcp_push_no_fin,
                                    mss, tls_rec_offset, prior_data,
-                                   prior_data_len)) {
+                                   prior_data_len, data_len, skb_offset)) {
                goto out;
        }
 
+       tx_info->prev_seq = tcp_seq + data_len + prior_data_len;
        return 0;
 out:
        dev_kfree_skb_any(skb);
        return NETDEV_TX_BUSY;
 }
 
+static int chcr_ktls_sw_fallback(struct sk_buff *skb,
+                                struct chcr_ktls_info *tx_info,
+                                struct sge_eth_txq *q)
+{
+       u32 data_len, skb_offset;
+       struct sk_buff *nskb;
+       struct tcphdr *th;
+
+       nskb = tls_encrypt_skb(skb);
+
+       if (!nskb)
+               return 0;
+
+       th = tcp_hdr(nskb);
+       skb_offset =  skb_transport_offset(nskb) + tcp_hdrlen(nskb);
+       data_len = nskb->len - skb_offset;
+       skb_tx_timestamp(nskb);
+
+       if (chcr_ktls_tunnel_pkt(tx_info, nskb, q))
+               goto out;
+
+       tx_info->prev_seq = ntohl(th->seq) + data_len;
+       atomic64_inc(&tx_info->adap->ch_ktls_stats.ktls_tx_fallback);
+       return 0;
+out:
+       dev_kfree_skb_any(nskb);
+       return 0;
+}
 /* nic tls TX handler */
 static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev)
 {
+       u32 tls_end_offset, tcp_seq, skb_data_len, skb_offset;
        struct ch_ktls_port_stats_debug *port_stats;
        struct chcr_ktls_ofld_ctx_tx *tx_ctx;
        struct ch_ktls_stats_debug *stats;
@@ -1867,20 +1974,17 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev)
        int data_len, qidx, ret = 0, mss;
        struct tls_record_info *record;
        struct chcr_ktls_info *tx_info;
-       u32 tls_end_offset, tcp_seq;
        struct tls_context *tls_ctx;
-       struct sk_buff *local_skb;
        struct sge_eth_txq *q;
        struct adapter *adap;
        unsigned long flags;
 
        tcp_seq = ntohl(th->seq);
+       skb_offset = skb_transport_offset(skb) + tcp_hdrlen(skb);
+       skb_data_len = skb->len - skb_offset;
+       data_len = skb_data_len;
 
-       mss = skb_is_gso(skb) ? skb_shinfo(skb)->gso_size : skb->data_len;
-
-       /* check if we haven't set it for ktls offload */
-       if (!skb->sk || !tls_is_sk_tx_device_offloaded(skb->sk))
-               goto out;
+       mss = skb_is_gso(skb) ? skb_shinfo(skb)->gso_size : data_len;
 
        tls_ctx = tls_get_ctx(skb->sk);
        if (unlikely(tls_ctx->netdev != dev))
@@ -1892,14 +1996,6 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev)
        if (unlikely(!tx_info))
                goto out;
 
-       /* don't touch the original skb, make a new skb to extract each records
-        * and send them separately.
-        */
-       local_skb = alloc_skb(0, GFP_KERNEL);
-
-       if (unlikely(!local_skb))
-               return NETDEV_TX_BUSY;
-
        adap = tx_info->adap;
        stats = &adap->ch_ktls_stats;
        port_stats = &stats->ktls_port[tx_info->port_id];
@@ -1914,20 +2010,7 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev)
                if (ret)
                        return NETDEV_TX_BUSY;
        }
-       /* update tcb */
-       ret = chcr_ktls_xmit_tcb_cpls(tx_info, q, ntohl(th->seq),
-                                     ntohl(th->ack_seq),
-                                     ntohs(th->window));
-       if (ret) {
-               dev_kfree_skb_any(local_skb);
-               return NETDEV_TX_BUSY;
-       }
 
-       /* copy skb contents into local skb */
-       chcr_ktls_skb_copy(skb, local_skb);
-
-       /* go through the skb and send only one record at a time. */
-       data_len = skb->data_len;
        /* TCP segments can be in received either complete or partial.
         * chcr_end_part_handler will handle cases if complete record or end
         * part of the record is received. Incase of partial end part of record,
@@ -1952,10 +2035,64 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev)
                        goto out;
                }
 
+               tls_end_offset = record->end_seq - tcp_seq;
+
+               pr_debug("seq 0x%x, end_seq 0x%x prev_seq 0x%x, datalen 0x%x\n",
+                        tcp_seq, record->end_seq, tx_info->prev_seq, data_len);
+               /* update tcb for the skb */
+               if (skb_data_len == data_len) {
+                       u32 tx_max = tcp_seq;
+
+                       if (!tls_record_is_start_marker(record) &&
+                           tls_end_offset < TLS_CIPHER_AES_GCM_128_TAG_SIZE)
+                               tx_max = record->end_seq -
+                                       TLS_CIPHER_AES_GCM_128_TAG_SIZE;
+
+                       ret = chcr_ktls_xmit_tcb_cpls(tx_info, q, tx_max,
+                                                     ntohl(th->ack_seq),
+                                                     ntohs(th->window),
+                                                     tls_end_offset !=
+                                                     record->len);
+                       if (ret) {
+                               spin_unlock_irqrestore(&tx_ctx->base.lock,
+                                                      flags);
+                               goto out;
+                       }
+
+                       if (th->fin)
+                               skb_get(skb);
+               }
+
                if (unlikely(tls_record_is_start_marker(record))) {
-                       spin_unlock_irqrestore(&tx_ctx->base.lock, flags);
                        atomic64_inc(&port_stats->ktls_tx_skip_no_sync_data);
-                       goto out;
+                       /* If tls_end_offset < data_len, means there is some
+                        * data after start marker, which needs encryption, send
+                        * plaintext first and take skb refcount. else send out
+                        * complete pkt as plaintext.
+                        */
+                       if (tls_end_offset < data_len)
+                               skb_get(skb);
+                       else
+                               tls_end_offset = data_len;
+
+                       ret = chcr_ktls_tx_plaintxt(tx_info, skb, tcp_seq, mss,
+                                                   (!th->fin && th->psh), q,
+                                                   tx_info->port_id, NULL,
+                                                   tls_end_offset, skb_offset,
+                                                   0);
+
+                       spin_unlock_irqrestore(&tx_ctx->base.lock, flags);
+                       if (ret) {
+                               /* free the refcount taken earlier */
+                               if (tls_end_offset < data_len)
+                                       dev_kfree_skb_any(skb);
+                               goto out;
+                       }
+
+                       data_len -= tls_end_offset;
+                       tcp_seq = record->end_seq;
+                       skb_offset += tls_end_offset;
+                       continue;
                }
 
                /* increase page reference count of the record, so that there
@@ -1967,73 +2104,64 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev)
                /* lock cleared */
                spin_unlock_irqrestore(&tx_ctx->base.lock, flags);
 
-               tls_end_offset = record->end_seq - tcp_seq;
 
-               pr_debug("seq 0x%x, end_seq 0x%x prev_seq 0x%x, datalen 0x%x\n",
-                        tcp_seq, record->end_seq, tx_info->prev_seq, data_len);
                /* if a tls record is finishing in this SKB */
                if (tls_end_offset <= data_len) {
-                       struct sk_buff *nskb = NULL;
-
-                       if (tls_end_offset < data_len) {
-                               nskb = alloc_skb(0, GFP_KERNEL);
-                               if (unlikely(!nskb)) {
-                                       ret = -ENOMEM;
-                                       goto clear_ref;
-                               }
-
-                               chcr_ktls_skb_shift(nskb, local_skb,
-                                                   tls_end_offset);
-                       } else {
-                               /* its the only record in this skb, directly
-                                * point it.
-                                */
-                               nskb = local_skb;
-                       }
-                       ret = chcr_end_part_handler(tx_info, nskb, record,
+                       ret = chcr_end_part_handler(tx_info, skb, record,
                                                    tcp_seq, mss,
                                                    (!th->fin && th->psh), q,
+                                                   skb_offset,
                                                    tls_end_offset,
-                                                   (nskb == local_skb));
-
-                       if (ret && nskb != local_skb)
-                               dev_kfree_skb_any(local_skb);
+                                                   skb_offset +
+                                                   tls_end_offset == skb->len);
 
                        data_len -= tls_end_offset;
                        /* tcp_seq increment is required to handle next record.
                         */
                        tcp_seq += tls_end_offset;
+                       skb_offset += tls_end_offset;
                } else {
-                       ret = chcr_short_record_handler(tx_info, local_skb,
+                       ret = chcr_short_record_handler(tx_info, skb,
                                                        record, tcp_seq, mss,
                                                        (!th->fin && th->psh),
+                                                       data_len, skb_offset,
                                                        q, tls_end_offset);
                        data_len = 0;
                }
-clear_ref:
+
                /* clear the frag ref count which increased locally before */
                for (i = 0; i < record->num_frags; i++) {
                        /* clear the frag ref count */
                        __skb_frag_unref(&record->frags[i]);
                }
                /* if any failure, come out from the loop. */
-               if (ret)
-                       goto out;
+               if (ret) {
+                       if (th->fin)
+                               dev_kfree_skb_any(skb);
+
+                       if (ret == FALLBACK)
+                               return chcr_ktls_sw_fallback(skb, tx_info, q);
+
+                       return NETDEV_TX_OK;
+               }
+
                /* length should never be less than 0 */
                WARN_ON(data_len < 0);
 
        } while (data_len > 0);
 
-       tx_info->prev_seq = ntohl(th->seq) + skb->data_len;
        atomic64_inc(&port_stats->ktls_tx_encrypted_packets);
-       atomic64_add(skb->data_len, &port_stats->ktls_tx_encrypted_bytes);
+       atomic64_add(skb_data_len, &port_stats->ktls_tx_encrypted_bytes);
 
        /* tcp finish is set, send a separate tcp msg including all the options
         * as well.
         */
-       if (th->fin)
+       if (th->fin) {
                chcr_ktls_write_tcp_options(tx_info, skb, q, tx_info->tx_chan);
+               dev_kfree_skb_any(skb);
+       }
 
+       return NETDEV_TX_OK;
 out:
        dev_kfree_skb_any(skb);
        return NETDEV_TX_OK;
index c1651b1..18b3b1f 100644 (file)
@@ -26,6 +26,7 @@
 
 #define CHCR_KTLS_WR_SIZE      (CHCR_PLAIN_TX_DATA_LEN +\
                                 sizeof(struct cpl_tx_sec_pdu))
+#define FALLBACK               35
 
 enum ch_ktls_open_state {
        CH_KTLS_OPEN_SUCCESS = 0,
index 2d3dfdd..e7b78b6 100644 (file)
@@ -235,6 +235,7 @@ struct chtls_dev {
        struct list_head na_node;
        unsigned int send_page_order;
        int max_host_sndbuf;
+       u32 round_robin_cnt;
        struct key_map kmap;
        unsigned int cdev_state;
 };
index ec4f790..63aacc1 100644 (file)
@@ -212,7 +212,7 @@ static struct sk_buff *alloc_ctrl_skb(struct sk_buff *skb, int len)
 {
        if (likely(skb && !skb_shared(skb) && !skb_cloned(skb))) {
                __skb_trim(skb, 0);
-               refcount_add(2, &skb->users);
+               refcount_inc(&skb->users);
        } else {
                skb = alloc_skb(len, GFP_KERNEL | __GFP_NOFAIL);
        }
@@ -772,14 +772,13 @@ static int chtls_pass_open_rpl(struct chtls_dev *cdev, struct sk_buff *skb)
        if (rpl->status != CPL_ERR_NONE) {
                pr_info("Unexpected PASS_OPEN_RPL status %u for STID %u\n",
                        rpl->status, stid);
-               return CPL_RET_BUF_DONE;
+       } else {
+               cxgb4_free_stid(cdev->tids, stid, listen_ctx->lsk->sk_family);
+               sock_put(listen_ctx->lsk);
+               kfree(listen_ctx);
+               module_put(THIS_MODULE);
        }
-       cxgb4_free_stid(cdev->tids, stid, listen_ctx->lsk->sk_family);
-       sock_put(listen_ctx->lsk);
-       kfree(listen_ctx);
-       module_put(THIS_MODULE);
-
-       return 0;
+       return CPL_RET_BUF_DONE;
 }
 
 static int chtls_close_listsrv_rpl(struct chtls_dev *cdev, struct sk_buff *skb)
@@ -796,15 +795,13 @@ static int chtls_close_listsrv_rpl(struct chtls_dev *cdev, struct sk_buff *skb)
        if (rpl->status != CPL_ERR_NONE) {
                pr_info("Unexpected CLOSE_LISTSRV_RPL status %u for STID %u\n",
                        rpl->status, stid);
-               return CPL_RET_BUF_DONE;
+       } else {
+               cxgb4_free_stid(cdev->tids, stid, listen_ctx->lsk->sk_family);
+               sock_put(listen_ctx->lsk);
+               kfree(listen_ctx);
+               module_put(THIS_MODULE);
        }
-
-       cxgb4_free_stid(cdev->tids, stid, listen_ctx->lsk->sk_family);
-       sock_put(listen_ctx->lsk);
-       kfree(listen_ctx);
-       module_put(THIS_MODULE);
-
-       return 0;
+       return CPL_RET_BUF_DONE;
 }
 
 static void chtls_purge_wr_queue(struct sock *sk)
@@ -1220,8 +1217,9 @@ static struct sock *chtls_recv_sock(struct sock *lsk,
        csk->sndbuf = csk->snd_win;
        csk->ulp_mode = ULP_MODE_TLS;
        step = cdev->lldi->nrxq / cdev->lldi->nchan;
-       csk->rss_qid = cdev->lldi->rxq_ids[port_id * step];
        rxq_idx = port_id * step;
+       rxq_idx += cdev->round_robin_cnt++ % step;
+       csk->rss_qid = cdev->lldi->rxq_ids[rxq_idx];
        csk->txq_idx = (rxq_idx < cdev->lldi->ntxq) ? rxq_idx :
                        port_id * step;
        csk->sndbuf = newsk->sk_sndbuf;
@@ -1514,7 +1512,6 @@ static void add_to_reap_list(struct sock *sk)
        struct chtls_sock *csk = sk->sk_user_data;
 
        local_bh_disable();
-       bh_lock_sock(sk);
        release_tcp_port(sk); /* release the port immediately */
 
        spin_lock(&reap_list_lock);
@@ -1523,7 +1520,6 @@ static void add_to_reap_list(struct sock *sk)
        if (!csk->passive_reap_next)
                schedule_work(&reap_task);
        spin_unlock(&reap_list_lock);
-       bh_unlock_sock(sk);
        local_bh_enable();
 }
 
index f1820ac..62c8290 100644 (file)
@@ -383,6 +383,9 @@ int chtls_setkey(struct chtls_sock *csk, u32 keylen,
        if (ret)
                goto out_notcb;
 
+       if (unlikely(csk_flag(sk, CSK_ABORT_SHUTDOWN)))
+               goto out_notcb;
+
        set_wr_txq(skb, CPL_PRIORITY_DATA, csk->tlshws.txqid);
        csk->wr_credits -= DIV_ROUND_UP(len, 16);
        csk->wr_unacked += DIV_ROUND_UP(len, 16);
index 9fb5ca6..188d871 100644 (file)
@@ -1585,6 +1585,7 @@ skip_copy:
                        tp->urg_data = 0;
 
                if ((avail + offset) >= skb->len) {
+                       struct sk_buff *next_skb;
                        if (ULP_SKB_CB(skb)->flags & ULPCB_FLAG_TLS_HDR) {
                                tp->copied_seq += skb->len;
                                hws->rcvpld = skb->hdr_len;
@@ -1595,8 +1596,10 @@ skip_copy:
                        chtls_free_skb(sk, skb);
                        buffers_freed++;
                        hws->copied_seq = 0;
-                       if (copied >= target &&
-                           !skb_peek(&sk->sk_receive_queue))
+                       next_skb = skb_peek(&sk->sk_receive_queue);
+                       if (copied >= target && !next_skb)
+                               break;
+                       if (ULP_SKB_CB(next_skb)->flags & ULPCB_FLAG_TLS_HDR)
                                break;
                }
        } while (len > 0);
index 7624710..7af86b6 100644 (file)
@@ -5,7 +5,7 @@
 
 config DM9000
        tristate "DM9000 support"
-       depends on ARM || MIPS || COLDFIRE || NIOS2
+       depends on ARM || MIPS || COLDFIRE || NIOS2 || COMPILE_TEST
        select CRC32
        select MII
        help
index 5c6c8c5..3fdc70d 100644 (file)
@@ -232,32 +232,29 @@ static void dm9000_inblk_32bit(void __iomem *reg, void *data, int count)
 static void dm9000_dumpblk_8bit(void __iomem *reg, int count)
 {
        int i;
-       int tmp;
 
        for (i = 0; i < count; i++)
-               tmp = readb(reg);
+               readb(reg);
 }
 
 static void dm9000_dumpblk_16bit(void __iomem *reg, int count)
 {
        int i;
-       int tmp;
 
        count = (count + 1) >> 1;
 
        for (i = 0; i < count; i++)
-               tmp = readw(reg);
+               readw(reg);
 }
 
 static void dm9000_dumpblk_32bit(void __iomem *reg, int count)
 {
        int i;
-       int tmp;
 
        count = (count + 3) >> 2;
 
        for (i = 0; i < count; i++)
-               tmp = readl(reg);
+               readl(reg);
 }
 
 /*
index d9f6c19..c3cbe55 100644 (file)
@@ -2175,11 +2175,21 @@ out:
 
 static SIMPLE_DEV_PM_OPS(de_pm_ops, de_suspend, de_resume);
 
+static void de_shutdown(struct pci_dev *pdev)
+{
+       struct net_device *dev = pci_get_drvdata(pdev);
+
+       rtnl_lock();
+       dev_close(dev);
+       rtnl_unlock();
+}
+
 static struct pci_driver de_driver = {
        .name           = DRV_NAME,
        .id_table       = de_pci_tbl,
        .probe          = de_init_one,
        .remove         = de_remove_one,
+       .shutdown       = de_shutdown,
        .driver.pm      = &de_pm_ops,
 };
 
index e7b0d7d..c1dcd6c 100644 (file)
@@ -1293,7 +1293,9 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        static unsigned char last_phys_addr[ETH_ALEN] = {
                0x00, 'L', 'i', 'n', 'u', 'x'
        };
+#if defined(__i386__) || defined(__x86_64__)   /* Patch up x86 BIOS bug. */
        static int last_irq;
+#endif
        int i, irq;
        unsigned short sum;
        unsigned char *ee_data;
@@ -1617,7 +1619,9 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        for (i = 0; i < 6; i++)
                last_phys_addr[i] = dev->dev_addr[i];
+#if defined(__i386__) || defined(__x86_64__)   /* Patch up x86 BIOS bug. */
        last_irq = irq;
+#endif
 
        /* The lower four bits are the media type. */
        if (board_idx >= 0  &&  board_idx < MAX_UNITS) {
index 00024dd..983b6db 100644 (file)
@@ -1044,10 +1044,39 @@ static void ftgmac100_adjust_link(struct net_device *netdev)
        schedule_work(&priv->reset_task);
 }
 
-static int ftgmac100_mii_probe(struct ftgmac100 *priv, phy_interface_t intf)
+static int ftgmac100_mii_probe(struct net_device *netdev)
 {
-       struct net_device *netdev = priv->netdev;
+       struct ftgmac100 *priv = netdev_priv(netdev);
+       struct platform_device *pdev = to_platform_device(priv->dev);
+       struct device_node *np = pdev->dev.of_node;
        struct phy_device *phydev;
+       phy_interface_t phy_intf;
+       int err;
+
+       /* Default to RGMII. It's a gigabit part after all */
+       err = of_get_phy_mode(np, &phy_intf);
+       if (err)
+               phy_intf = PHY_INTERFACE_MODE_RGMII;
+
+       /* Aspeed only supports these. I don't know about other IP
+        * block vendors so I'm going to just let them through for
+        * now. Note that this is only a warning if for some obscure
+        * reason the DT really means to lie about it or it's a newer
+        * part we don't know about.
+        *
+        * On the Aspeed SoC there are additionally straps and SCU
+        * control bits that could tell us what the interface is
+        * (or allow us to configure it while the IP block is held
+        * in reset). For now I chose to keep this driver away from
+        * those SoC specific bits and assume the device-tree is
+        * right and the SCU has been configured properly by pinmux
+        * or the firmware.
+        */
+       if (priv->is_aspeed && !(phy_interface_mode_is_rgmii(phy_intf))) {
+               netdev_warn(netdev,
+                           "Unsupported PHY mode %s !\n",
+                           phy_modes(phy_intf));
+       }
 
        phydev = phy_find_first(priv->mii_bus);
        if (!phydev) {
@@ -1056,7 +1085,7 @@ static int ftgmac100_mii_probe(struct ftgmac100 *priv, phy_interface_t intf)
        }
 
        phydev = phy_connect(netdev, phydev_name(phydev),
-                            &ftgmac100_adjust_link, intf);
+                            &ftgmac100_adjust_link, phy_intf);
 
        if (IS_ERR(phydev)) {
                netdev_err(netdev, "%s: Could not attach to PHY\n", netdev->name);
@@ -1601,8 +1630,8 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
 {
        struct ftgmac100 *priv = netdev_priv(netdev);
        struct platform_device *pdev = to_platform_device(priv->dev);
-       phy_interface_t phy_intf = PHY_INTERFACE_MODE_RGMII;
        struct device_node *np = pdev->dev.of_node;
+       struct device_node *mdio_np;
        int i, err = 0;
        u32 reg;
 
@@ -1623,39 +1652,6 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
                iowrite32(reg, priv->base + FTGMAC100_OFFSET_REVR);
        }
 
-       /* Get PHY mode from device-tree */
-       if (np) {
-               /* Default to RGMII. It's a gigabit part after all */
-               err = of_get_phy_mode(np, &phy_intf);
-               if (err)
-                       phy_intf = PHY_INTERFACE_MODE_RGMII;
-
-               /* Aspeed only supports these. I don't know about other IP
-                * block vendors so I'm going to just let them through for
-                * now. Note that this is only a warning if for some obscure
-                * reason the DT really means to lie about it or it's a newer
-                * part we don't know about.
-                *
-                * On the Aspeed SoC there are additionally straps and SCU
-                * control bits that could tell us what the interface is
-                * (or allow us to configure it while the IP block is held
-                * in reset). For now I chose to keep this driver away from
-                * those SoC specific bits and assume the device-tree is
-                * right and the SCU has been configured properly by pinmux
-                * or the firmware.
-                */
-               if (priv->is_aspeed &&
-                   phy_intf != PHY_INTERFACE_MODE_RMII &&
-                   phy_intf != PHY_INTERFACE_MODE_RGMII &&
-                   phy_intf != PHY_INTERFACE_MODE_RGMII_ID &&
-                   phy_intf != PHY_INTERFACE_MODE_RGMII_RXID &&
-                   phy_intf != PHY_INTERFACE_MODE_RGMII_TXID) {
-                       netdev_warn(netdev,
-                                  "Unsupported PHY mode %s !\n",
-                                  phy_modes(phy_intf));
-               }
-       }
-
        priv->mii_bus->name = "ftgmac100_mdio";
        snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%d",
                 pdev->name, pdev->id);
@@ -1667,35 +1663,38 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
        for (i = 0; i < PHY_MAX_ADDR; i++)
                priv->mii_bus->irq[i] = PHY_POLL;
 
-       err = mdiobus_register(priv->mii_bus);
+       mdio_np = of_get_child_by_name(np, "mdio");
+
+       err = of_mdiobus_register(priv->mii_bus, mdio_np);
        if (err) {
                dev_err(priv->dev, "Cannot register MDIO bus!\n");
                goto err_register_mdiobus;
        }
 
-       err = ftgmac100_mii_probe(priv, phy_intf);
-       if (err) {
-               dev_err(priv->dev, "MII Probe failed!\n");
-               goto err_mii_probe;
-       }
+       of_node_put(mdio_np);
 
        return 0;
 
-err_mii_probe:
-       mdiobus_unregister(priv->mii_bus);
 err_register_mdiobus:
        mdiobus_free(priv->mii_bus);
        return err;
 }
 
+static void ftgmac100_phy_disconnect(struct net_device *netdev)
+{
+       if (!netdev->phydev)
+               return;
+
+       phy_disconnect(netdev->phydev);
+}
+
 static void ftgmac100_destroy_mdio(struct net_device *netdev)
 {
        struct ftgmac100 *priv = netdev_priv(netdev);
 
-       if (!netdev->phydev)
+       if (!priv->mii_bus)
                return;
 
-       phy_disconnect(netdev->phydev);
        mdiobus_unregister(priv->mii_bus);
        mdiobus_free(priv->mii_bus);
 }
@@ -1830,22 +1829,33 @@ static int ftgmac100_probe(struct platform_device *pdev)
        if (np && of_get_property(np, "use-ncsi", NULL)) {
                if (!IS_ENABLED(CONFIG_NET_NCSI)) {
                        dev_err(&pdev->dev, "NCSI stack not enabled\n");
-                       goto err_ncsi_dev;
+                       goto err_phy_connect;
                }
 
                dev_info(&pdev->dev, "Using NCSI interface\n");
                priv->use_ncsi = true;
                priv->ndev = ncsi_register_dev(netdev, ftgmac100_ncsi_handler);
                if (!priv->ndev)
-                       goto err_ncsi_dev;
+                       goto err_phy_connect;
        } else if (np && of_get_property(np, "phy-handle", NULL)) {
                struct phy_device *phy;
 
+               /* Support "mdio"/"phy" child nodes for ast2400/2500 with
+                * an embedded MDIO controller. Automatically scan the DTS for
+                * available PHYs and register them.
+                */
+               if (of_device_is_compatible(np, "aspeed,ast2400-mac") ||
+                   of_device_is_compatible(np, "aspeed,ast2500-mac")) {
+                       err = ftgmac100_setup_mdio(netdev);
+                       if (err)
+                               goto err_setup_mdio;
+               }
+
                phy = of_phy_get_and_connect(priv->netdev, np,
                                             &ftgmac100_adjust_link);
                if (!phy) {
                        dev_err(&pdev->dev, "Failed to connect to phy\n");
-                       goto err_setup_mdio;
+                       goto err_phy_connect;
                }
 
                /* Indicate that we support PAUSE frames (see comment in
@@ -1865,12 +1875,19 @@ static int ftgmac100_probe(struct platform_device *pdev)
                err = ftgmac100_setup_mdio(netdev);
                if (err)
                        goto err_setup_mdio;
+
+               err = ftgmac100_mii_probe(netdev);
+               if (err) {
+                       dev_err(priv->dev, "MII probe failed!\n");
+                       goto err_ncsi_dev;
+               }
+
        }
 
        if (priv->is_aspeed) {
                err = ftgmac100_setup_clk(priv);
                if (err)
-                       goto err_ncsi_dev;
+                       goto err_phy_connect;
        }
 
        /* Default ring sizes */
@@ -1906,6 +1923,8 @@ static int ftgmac100_probe(struct platform_device *pdev)
 err_register_netdev:
        clk_disable_unprepare(priv->rclk);
        clk_disable_unprepare(priv->clk);
+err_phy_connect:
+       ftgmac100_phy_disconnect(netdev);
 err_ncsi_dev:
        ftgmac100_destroy_mdio(netdev);
 err_setup_mdio:
@@ -1936,6 +1955,7 @@ static int ftgmac100_remove(struct platform_device *pdev)
         */
        cancel_work_sync(&priv->reset_task);
 
+       ftgmac100_phy_disconnect(netdev);
        ftgmac100_destroy_mdio(netdev);
 
        iounmap(priv->base);
index 06cc863..8867693 100644 (file)
@@ -174,12 +174,17 @@ MODULE_PARM_DESC(tx_timeout, "The Tx timeout in ms");
 #define DPAA_PARSE_RESULTS_SIZE sizeof(struct fman_prs_result)
 #define DPAA_TIME_STAMP_SIZE 8
 #define DPAA_HASH_RESULTS_SIZE 8
+#define DPAA_HWA_SIZE (DPAA_PARSE_RESULTS_SIZE + DPAA_TIME_STAMP_SIZE \
+                      + DPAA_HASH_RESULTS_SIZE)
+#define DPAA_RX_PRIV_DATA_DEFAULT_SIZE (DPAA_TX_PRIV_DATA_SIZE + \
+                                       dpaa_rx_extra_headroom)
 #ifdef CONFIG_DPAA_ERRATUM_A050385
-#define DPAA_RX_PRIV_DATA_SIZE (DPAA_A050385_ALIGN - (DPAA_PARSE_RESULTS_SIZE\
-        + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE))
+#define DPAA_RX_PRIV_DATA_A050385_SIZE (DPAA_A050385_ALIGN - DPAA_HWA_SIZE)
+#define DPAA_RX_PRIV_DATA_SIZE (fman_has_errata_a050385() ? \
+                               DPAA_RX_PRIV_DATA_A050385_SIZE : \
+                               DPAA_RX_PRIV_DATA_DEFAULT_SIZE)
 #else
-#define DPAA_RX_PRIV_DATA_SIZE (u16)(DPAA_TX_PRIV_DATA_SIZE + \
-                                       dpaa_rx_extra_headroom)
+#define DPAA_RX_PRIV_DATA_SIZE DPAA_RX_PRIV_DATA_DEFAULT_SIZE
 #endif
 
 #define DPAA_ETH_PCD_RXQ_NUM   128
@@ -2300,9 +2305,9 @@ static void dpaa_tx_conf(struct net_device *net_dev,
 }
 
 static inline int dpaa_eth_napi_schedule(struct dpaa_percpu_priv *percpu_priv,
-                                        struct qman_portal *portal)
+                                        struct qman_portal *portal, bool sched_napi)
 {
-       if (unlikely(in_irq() || !in_serving_softirq())) {
+       if (sched_napi) {
                /* Disable QMan IRQ and invoke NAPI */
                qman_p_irqsource_remove(portal, QM_PIRQ_DQRI);
 
@@ -2316,7 +2321,8 @@ static inline int dpaa_eth_napi_schedule(struct dpaa_percpu_priv *percpu_priv,
 
 static enum qman_cb_dqrr_result rx_error_dqrr(struct qman_portal *portal,
                                              struct qman_fq *fq,
-                                             const struct qm_dqrr_entry *dq)
+                                             const struct qm_dqrr_entry *dq,
+                                             bool sched_napi)
 {
        struct dpaa_fq *dpaa_fq = container_of(fq, struct dpaa_fq, fq_base);
        struct dpaa_percpu_priv *percpu_priv;
@@ -2332,7 +2338,7 @@ static enum qman_cb_dqrr_result rx_error_dqrr(struct qman_portal *portal,
 
        percpu_priv = this_cpu_ptr(priv->percpu_priv);
 
-       if (dpaa_eth_napi_schedule(percpu_priv, portal))
+       if (dpaa_eth_napi_schedule(percpu_priv, portal, sched_napi))
                return qman_cb_dqrr_stop;
 
        dpaa_eth_refill_bpools(priv);
@@ -2343,7 +2349,8 @@ static enum qman_cb_dqrr_result rx_error_dqrr(struct qman_portal *portal,
 
 static enum qman_cb_dqrr_result rx_default_dqrr(struct qman_portal *portal,
                                                struct qman_fq *fq,
-                                               const struct qm_dqrr_entry *dq)
+                                               const struct qm_dqrr_entry *dq,
+                                               bool sched_napi)
 {
        struct skb_shared_hwtstamps *shhwtstamps;
        struct rtnl_link_stats64 *percpu_stats;
@@ -2375,7 +2382,7 @@ static enum qman_cb_dqrr_result rx_default_dqrr(struct qman_portal *portal,
        percpu_priv = this_cpu_ptr(priv->percpu_priv);
        percpu_stats = &percpu_priv->stats;
 
-       if (unlikely(dpaa_eth_napi_schedule(percpu_priv, portal)))
+       if (unlikely(dpaa_eth_napi_schedule(percpu_priv, portal, sched_napi)))
                return qman_cb_dqrr_stop;
 
        /* Make sure we didn't run out of buffers */
@@ -2460,7 +2467,8 @@ static enum qman_cb_dqrr_result rx_default_dqrr(struct qman_portal *portal,
 
 static enum qman_cb_dqrr_result conf_error_dqrr(struct qman_portal *portal,
                                                struct qman_fq *fq,
-                                               const struct qm_dqrr_entry *dq)
+                                               const struct qm_dqrr_entry *dq,
+                                               bool sched_napi)
 {
        struct dpaa_percpu_priv *percpu_priv;
        struct net_device *net_dev;
@@ -2471,7 +2479,7 @@ static enum qman_cb_dqrr_result conf_error_dqrr(struct qman_portal *portal,
 
        percpu_priv = this_cpu_ptr(priv->percpu_priv);
 
-       if (dpaa_eth_napi_schedule(percpu_priv, portal))
+       if (dpaa_eth_napi_schedule(percpu_priv, portal, sched_napi))
                return qman_cb_dqrr_stop;
 
        dpaa_tx_error(net_dev, priv, percpu_priv, &dq->fd, fq->fqid);
@@ -2481,7 +2489,8 @@ static enum qman_cb_dqrr_result conf_error_dqrr(struct qman_portal *portal,
 
 static enum qman_cb_dqrr_result conf_dflt_dqrr(struct qman_portal *portal,
                                               struct qman_fq *fq,
-                                              const struct qm_dqrr_entry *dq)
+                                              const struct qm_dqrr_entry *dq,
+                                              bool sched_napi)
 {
        struct dpaa_percpu_priv *percpu_priv;
        struct net_device *net_dev;
@@ -2495,7 +2504,7 @@ static enum qman_cb_dqrr_result conf_dflt_dqrr(struct qman_portal *portal,
 
        percpu_priv = this_cpu_ptr(priv->percpu_priv);
 
-       if (dpaa_eth_napi_schedule(percpu_priv, portal))
+       if (dpaa_eth_napi_schedule(percpu_priv, portal, sched_napi))
                return qman_cb_dqrr_stop;
 
        dpaa_tx_conf(net_dev, priv, percpu_priv, &dq->fd, fq->fqid);
@@ -2541,7 +2550,7 @@ static void dpaa_eth_napi_enable(struct dpaa_priv *priv)
        for_each_online_cpu(i) {
                percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
 
-               percpu_priv->np.down = 0;
+               percpu_priv->np.down = false;
                napi_enable(&percpu_priv->np.napi);
        }
 }
@@ -2554,7 +2563,7 @@ static void dpaa_eth_napi_disable(struct dpaa_priv *priv)
        for_each_online_cpu(i) {
                percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
 
-               percpu_priv->np.down = 1;
+               percpu_priv->np.down = true;
                napi_disable(&percpu_priv->np.napi);
        }
 }
@@ -2840,7 +2849,8 @@ out_error:
        return err;
 }
 
-static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl)
+static u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl,
+                            enum port_type port)
 {
        u16 headroom;
 
@@ -2854,10 +2864,12 @@ static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl)
         *
         * Also make sure the headroom is a multiple of data_align bytes
         */
-       headroom = (u16)(bl->priv_data_size + DPAA_PARSE_RESULTS_SIZE +
-               DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE);
+       headroom = (u16)(bl[port].priv_data_size + DPAA_HWA_SIZE);
 
-       return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
+       if (port == RX)
+               return ALIGN(headroom, DPAA_FD_RX_DATA_ALIGNMENT);
+       else
+               return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
 }
 
 static int dpaa_eth_probe(struct platform_device *pdev)
@@ -3025,8 +3037,8 @@ static int dpaa_eth_probe(struct platform_device *pdev)
                        goto free_dpaa_fqs;
        }
 
-       priv->tx_headroom = dpaa_get_headroom(&priv->buf_layout[TX]);
-       priv->rx_headroom = dpaa_get_headroom(&priv->buf_layout[RX]);
+       priv->tx_headroom = dpaa_get_headroom(priv->buf_layout, TX);
+       priv->rx_headroom = dpaa_get_headroom(priv->buf_layout, RX);
 
        /* All real interfaces need their ports initialized */
        err = dpaa_eth_init_ports(mac_dev, dpaa_bp, &port_fqs,
index 52be6e3..01089c3 100644 (file)
@@ -47,40 +47,6 @@ drop_packet_err:
        return NETDEV_TX_OK;
 }
 
-static bool enetc_tx_csum(struct sk_buff *skb, union enetc_tx_bd *txbd)
-{
-       int l3_start, l3_hsize;
-       u16 l3_flags, l4_flags;
-
-       if (skb->ip_summed != CHECKSUM_PARTIAL)
-               return false;
-
-       switch (skb->csum_offset) {
-       case offsetof(struct tcphdr, check):
-               l4_flags = ENETC_TXBD_L4_TCP;
-               break;
-       case offsetof(struct udphdr, check):
-               l4_flags = ENETC_TXBD_L4_UDP;
-               break;
-       default:
-               skb_checksum_help(skb);
-               return false;
-       }
-
-       l3_start = skb_network_offset(skb);
-       l3_hsize = skb_network_header_len(skb);
-
-       l3_flags = 0;
-       if (skb->protocol == htons(ETH_P_IPV6))
-               l3_flags = ENETC_TXBD_L3_IPV6;
-
-       /* write BD fields */
-       txbd->l3_csoff = enetc_txbd_l3_csoff(l3_start, l3_hsize, l3_flags);
-       txbd->l4_csoff = l4_flags;
-
-       return true;
-}
-
 static void enetc_unmap_tx_buff(struct enetc_bdr *tx_ring,
                                struct enetc_tx_swbd *tx_swbd)
 {
@@ -146,22 +112,16 @@ static int enetc_map_tx_buffs(struct enetc_bdr *tx_ring, struct sk_buff *skb,
        if (do_vlan || do_tstamp)
                flags |= ENETC_TXBD_FLAGS_EX;
 
-       if (enetc_tx_csum(skb, &temp_bd))
-               flags |= ENETC_TXBD_FLAGS_CSUM | ENETC_TXBD_FLAGS_L4CS;
-       else if (tx_ring->tsd_enable)
+       if (tx_ring->tsd_enable)
                flags |= ENETC_TXBD_FLAGS_TSE | ENETC_TXBD_FLAGS_TXSTART;
 
        /* first BD needs frm_len and offload flags set */
        temp_bd.frm_len = cpu_to_le16(skb->len);
        temp_bd.flags = flags;
 
-       if (flags & ENETC_TXBD_FLAGS_TSE) {
-               u32 temp;
-
-               temp = (skb->skb_mstamp_ns >> 5 & ENETC_TXBD_TXSTART_MASK)
-                       | (flags << ENETC_TXBD_FLAGS_OFFSET);
-               temp_bd.txstart = cpu_to_le32(temp);
-       }
+       if (flags & ENETC_TXBD_FLAGS_TSE)
+               temp_bd.txstart = enetc_txbd_set_tx_start(skb->skb_mstamp_ns,
+                                                         flags);
 
        if (flags & ENETC_TXBD_FLAGS_EX) {
                u8 e_flags = 0;
@@ -1897,8 +1857,7 @@ static void enetc_kfree_si(struct enetc_si *si)
 static void enetc_detect_errata(struct enetc_si *si)
 {
        if (si->pdev->revision == ENETC_REV1)
-               si->errata = ENETC_ERR_TXCSUM | ENETC_ERR_VLAN_ISOL |
-                            ENETC_ERR_UCMCSWP;
+               si->errata = ENETC_ERR_VLAN_ISOL | ENETC_ERR_UCMCSWP;
 }
 
 int enetc_pci_probe(struct pci_dev *pdev, const char *name, int sizeof_priv)
index dd0fb0c..8532d23 100644 (file)
@@ -147,9 +147,8 @@ struct enetc_msg_swbd {
 
 #define ENETC_REV1     0x1
 enum enetc_errata {
-       ENETC_ERR_TXCSUM        = BIT(0),
-       ENETC_ERR_VLAN_ISOL     = BIT(1),
-       ENETC_ERR_UCMCSWP       = BIT(2),
+       ENETC_ERR_VLAN_ISOL     = BIT(0),
+       ENETC_ERR_UCMCSWP       = BIT(1),
 };
 
 #define ENETC_SI_F_QBV BIT(0)
index 17cf7c9..68ef4f9 100644 (file)
@@ -374,8 +374,7 @@ union enetc_tx_bd {
                __le16 frm_len;
                union {
                        struct {
-                               __le16 l3_csoff;
-                               u8 l4_csoff;
+                               u8 reserved[3];
                                u8 flags;
                        }; /* default layout */
                        __le32 txstart;
@@ -398,41 +397,37 @@ union enetc_tx_bd {
        } wb; /* writeback descriptor */
 };
 
-#define ENETC_TXBD_FLAGS_L4CS  BIT(0)
-#define ENETC_TXBD_FLAGS_TSE   BIT(1)
-#define ENETC_TXBD_FLAGS_W     BIT(2)
-#define ENETC_TXBD_FLAGS_CSUM  BIT(3)
-#define ENETC_TXBD_FLAGS_TXSTART BIT(4)
-#define ENETC_TXBD_FLAGS_EX    BIT(6)
-#define ENETC_TXBD_FLAGS_F     BIT(7)
+enum enetc_txbd_flags {
+       ENETC_TXBD_FLAGS_RES0 = BIT(0), /* reserved */
+       ENETC_TXBD_FLAGS_TSE = BIT(1),
+       ENETC_TXBD_FLAGS_W = BIT(2),
+       ENETC_TXBD_FLAGS_RES3 = BIT(3), /* reserved */
+       ENETC_TXBD_FLAGS_TXSTART = BIT(4),
+       ENETC_TXBD_FLAGS_EX = BIT(6),
+       ENETC_TXBD_FLAGS_F = BIT(7)
+};
 #define ENETC_TXBD_TXSTART_MASK GENMASK(24, 0)
 #define ENETC_TXBD_FLAGS_OFFSET 24
+
+static inline __le32 enetc_txbd_set_tx_start(u64 tx_start, u8 flags)
+{
+       u32 temp;
+
+       temp = (tx_start >> 5 & ENETC_TXBD_TXSTART_MASK) |
+              (flags << ENETC_TXBD_FLAGS_OFFSET);
+
+       return cpu_to_le32(temp);
+}
+
 static inline void enetc_clear_tx_bd(union enetc_tx_bd *txbd)
 {
        memset(txbd, 0, sizeof(*txbd));
 }
 
-/* L3 csum flags */
-#define ENETC_TXBD_L3_IPCS     BIT(7)
-#define ENETC_TXBD_L3_IPV6     BIT(15)
-
-#define ENETC_TXBD_L3_START_MASK       GENMASK(6, 0)
-#define ENETC_TXBD_L3_SET_HSIZE(val)   ((((val) >> 2) & 0x7f) << 8)
-
 /* Extension flags */
 #define ENETC_TXBD_E_FLAGS_VLAN_INS    BIT(0)
 #define ENETC_TXBD_E_FLAGS_TWO_STEP_PTP        BIT(2)
 
-static inline __le16 enetc_txbd_l3_csoff(int start, int hdr_sz, u16 l3_flags)
-{
-       return cpu_to_le16(l3_flags | ENETC_TXBD_L3_SET_HSIZE(hdr_sz) |
-                          (start & ENETC_TXBD_L3_START_MASK));
-}
-
-/* L4 csum flags */
-#define ENETC_TXBD_L4_UDP      BIT(5)
-#define ENETC_TXBD_L4_TCP      BIT(6)
-
 union enetc_rx_bd {
        struct {
                __le64 addr;
index 4193063..ecdc2af 100644 (file)
@@ -714,22 +714,16 @@ static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
        ndev->watchdog_timeo = 5 * HZ;
        ndev->max_mtu = ENETC_MAX_MTU;
 
-       ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_CSUM |
+       ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
                            NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
                            NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK;
-       ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG |
-                        NETIF_F_RXCSUM | NETIF_F_HW_CSUM |
+       ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM |
                         NETIF_F_HW_VLAN_CTAG_TX |
                         NETIF_F_HW_VLAN_CTAG_RX;
 
        if (si->num_rss)
                ndev->hw_features |= NETIF_F_RXHASH;
 
-       if (si->errata & ENETC_ERR_TXCSUM) {
-               ndev->hw_features &= ~NETIF_F_HW_CSUM;
-               ndev->features &= ~NETIF_F_HW_CSUM;
-       }
-
        ndev->priv_flags |= IFF_UNICAST_FLT;
 
        if (si->hw_features & ENETC_SI_F_QBV)
index c81be32..827f74e 100644 (file)
@@ -402,7 +402,7 @@ struct enetc_psfp_gate {
        u32 num_entries;
        refcount_t refcount;
        struct hlist_node node;
-       struct action_gate_entry entries[0];
+       struct action_gate_entry entries[];
 };
 
 /* Only enable the green color frame now
index 7b5c82c..39c1a09 100644 (file)
@@ -120,22 +120,16 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
        ndev->watchdog_timeo = 5 * HZ;
        ndev->max_mtu = ENETC_MAX_MTU;
 
-       ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_CSUM |
+       ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
                            NETIF_F_HW_VLAN_CTAG_TX |
                            NETIF_F_HW_VLAN_CTAG_RX;
-       ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG |
-                        NETIF_F_RXCSUM | NETIF_F_HW_CSUM |
+       ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM |
                         NETIF_F_HW_VLAN_CTAG_TX |
                         NETIF_F_HW_VLAN_CTAG_RX;
 
        if (si->num_rss)
                ndev->hw_features |= NETIF_F_RXHASH;
 
-       if (si->errata & ENETC_ERR_TXCSUM) {
-               ndev->hw_features &= ~NETIF_F_HW_CSUM;
-               ndev->features &= ~NETIF_F_HW_CSUM;
-       }
-
        /* pick up primary MAC address from SI */
        enetc_get_primary_mac_addr(&si->hw, ndev->dev_addr);
 }
index 832a217..c527f4e 100644 (file)
@@ -456,6 +456,12 @@ struct bufdesc_ex {
  */
 #define FEC_QUIRK_HAS_FRREG            (1 << 16)
 
+/* Some FEC hardware blocks need the MMFR cleared at setup time to avoid
+ * the generation of an MII event. This must be avoided in the older
+ * FEC blocks where it will stop MII events being generated.
+ */
+#define FEC_QUIRK_CLEAR_SETUP_MII      (1 << 17)
+
 struct bufdesc_prop {
        int qid;
        /* Address of Rx and Tx buffers */
index 8f7eca1..d791955 100644 (file)
@@ -100,14 +100,14 @@ static const struct fec_devinfo fec_imx27_info = {
 static const struct fec_devinfo fec_imx28_info = {
        .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME |
                  FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC |
-                 FEC_QUIRK_HAS_FRREG,
+                 FEC_QUIRK_HAS_FRREG | FEC_QUIRK_CLEAR_SETUP_MII,
 };
 
 static const struct fec_devinfo fec_imx6q_info = {
        .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
                  FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
                  FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 |
-                 FEC_QUIRK_HAS_RACC,
+                 FEC_QUIRK_HAS_RACC | FEC_QUIRK_CLEAR_SETUP_MII,
 };
 
 static const struct fec_devinfo fec_mvf600_info = {
@@ -119,7 +119,8 @@ static const struct fec_devinfo fec_imx6x_info = {
                  FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
                  FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB |
                  FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE |
-                 FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE,
+                 FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE |
+                 FEC_QUIRK_CLEAR_SETUP_MII,
 };
 
 static const struct fec_devinfo fec_imx6ul_info = {
@@ -127,7 +128,7 @@ static const struct fec_devinfo fec_imx6ul_info = {
                  FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
                  FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR007885 |
                  FEC_QUIRK_BUG_CAPTURE | FEC_QUIRK_HAS_RACC |
-                 FEC_QUIRK_HAS_COALESCE,
+                 FEC_QUIRK_HAS_COALESCE | FEC_QUIRK_CLEAR_SETUP_MII,
 };
 
 static struct platform_device_id fec_devtype[] = {
@@ -2134,15 +2135,17 @@ static int fec_enet_mii_init(struct platform_device *pdev)
        if (suppress_preamble)
                fep->phy_speed |= BIT(7);
 
-       /* Clear MMFR to avoid to generate MII event by writing MSCR.
-        * MII event generation condition:
-        * - writing MSCR:
-        *      - mmfr[31:0]_not_zero & mscr[7:0]_is_zero &
-        *        mscr_reg_data_in[7:0] != 0
-        * - writing MMFR:
-        *      - mscr[7:0]_not_zero
-        */
-       writel(0, fep->hwp + FEC_MII_DATA);
+       if (fep->quirks & FEC_QUIRK_CLEAR_SETUP_MII) {
+               /* Clear MMFR to avoid to generate MII event by writing MSCR.
+                * MII event generation condition:
+                * - writing MSCR:
+                *      - mmfr[31:0]_not_zero & mscr[7:0]_is_zero &
+                *        mscr_reg_data_in[7:0] != 0
+                * - writing MMFR:
+                *      - mscr[7:0]_not_zero
+                */
+               writel(0, fep->hwp + FEC_MII_DATA);
+       }
 
        writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
 
index 41dd3d0..d391a45 100644 (file)
@@ -1829,20 +1829,12 @@ static netdev_tx_t gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
                fcb_len = GMAC_FCB_LEN + GMAC_TXPAL_LEN;
 
        /* make space for additional header when fcb is needed */
-       if (fcb_len && unlikely(skb_headroom(skb) < fcb_len)) {
-               struct sk_buff *skb_new;
-
-               skb_new = skb_realloc_headroom(skb, fcb_len);
-               if (!skb_new) {
+       if (fcb_len) {
+               if (unlikely(skb_cow_head(skb, fcb_len))) {
                        dev->stats.tx_errors++;
                        dev_kfree_skb_any(skb);
                        return NETDEV_TX_OK;
                }
-
-               if (skb->sk)
-                       skb_set_owner_w(skb_new, skb->sk);
-               dev_consume_skb_any(skb);
-               skb = skb_new;
        }
 
        /* total number of fragments in the SKB */
@@ -3380,7 +3372,7 @@ static int gfar_probe(struct platform_device *ofdev)
 
        if (dev->features & NETIF_F_IP_CSUM ||
            priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
-               dev->needed_headroom = GMAC_FCB_LEN;
+               dev->needed_headroom = GMAC_FCB_LEN + GMAC_TXPAL_LEN;
 
        /* Initializing some of the rx/tx queue level parameters */
        for (i = 0; i < priv->num_tx_queues; i++) {
index 714b501..ba8869c 100644 (file)
@@ -1358,7 +1358,7 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
            (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
                upsmr |= UCC_GETH_UPSMR_TBIM;
        }
-       if ((ugeth->phy_interface == PHY_INTERFACE_MODE_SGMII))
+       if (ugeth->phy_interface == PHY_INTERFACE_MODE_SGMII)
                upsmr |= UCC_GETH_UPSMR_SGMM;
 
        out_be32(&uf_regs->upsmr, upsmr);
index 281de83..015796a 100644 (file)
@@ -198,7 +198,7 @@ static_assert(sizeof(struct stats) == 16);
 
 struct gve_stats_report {
        __be64 written_count;
-       struct stats stats[0];
+       struct stats stats[];
 };
 
 static_assert(sizeof(struct gve_stats_report) == 8);
index 48a4331..02e7d74 100644 (file)
@@ -116,9 +116,8 @@ static int gve_alloc_stats_report(struct gve_priv *priv)
                       priv->tx_cfg.num_queues;
        rx_stats_num = (GVE_RX_STATS_REPORT_NUM + NIC_RX_STATS_REPORT_NUM) *
                       priv->rx_cfg.num_queues;
-       priv->stats_report_len = sizeof(struct gve_stats_report) +
-                                (tx_stats_num + rx_stats_num) *
-                                sizeof(struct stats);
+       priv->stats_report_len = struct_size(priv->stats_report, stats,
+                                            tx_stats_num + rx_stats_num);
        priv->stats_report =
                dma_alloc_coherent(&priv->pdev->dev, priv->stats_report_len,
                                   &priv->stats_report_bus, GFP_KERNEL);
index 3606240..f990f69 100644 (file)
@@ -4,7 +4,6 @@
 #include "hclge_main.h"
 #include "hclge_dcb.h"
 #include "hclge_tm.h"
-#include "hclge_dcb.h"
 #include "hnae3.h"
 
 #define BW_PERCENT     100
index 15f69fa..e8495f5 100644 (file)
@@ -1373,7 +1373,7 @@ static int hclge_tm_bp_setup(struct hclge_dev *hdev)
                        return ret;
        }
 
-       return ret;
+       return 0;
 }
 
 int hclge_pause_setup_hw(struct hclge_dev *hdev, bool init)
index 50c84c5..c8e3fdd 100644 (file)
@@ -3262,8 +3262,8 @@ static void hclgevf_uninit_hdev(struct hclgevf_dev *hdev)
                hclgevf_uninit_msi(hdev);
        }
 
-       hclgevf_pci_uninit(hdev);
        hclgevf_cmd_uninit(hdev);
+       hclgevf_pci_uninit(hdev);
        hclgevf_uninit_mac_list(hdev);
 }
 
index 7ef3369..c3ec9ce 100644 (file)
@@ -1031,12 +1031,6 @@ static int ibmveth_is_packet_unsupported(struct sk_buff *skb,
                ret = -EOPNOTSUPP;
        }
 
-       if (!ether_addr_equal(ether_header->h_source, netdev->dev_addr)) {
-               netdev_dbg(netdev, "source packet MAC address does not match veth device's, dropping packet.\n");
-               netdev->stats.tx_dropped++;
-               ret = -EOPNOTSUPP;
-       }
-
        return ret;
 }
 
index 8148f79..da15913 100644 (file)
@@ -1185,18 +1185,27 @@ static int ibmvnic_open(struct net_device *netdev)
        if (adapter->state != VNIC_CLOSED) {
                rc = ibmvnic_login(netdev);
                if (rc)
-                       return rc;
+                       goto out;
 
                rc = init_resources(adapter);
                if (rc) {
                        netdev_err(netdev, "failed to initialize resources\n");
                        release_resources(adapter);
-                       return rc;
+                       goto out;
                }
        }
 
        rc = __ibmvnic_open(netdev);
 
+out:
+       /*
+        * If open fails due to a pending failover, set device state and
+        * return. Device operation will be handled by reset routine.
+        */
+       if (rc && adapter->failover_pending) {
+               adapter->state = VNIC_OPEN;
+               rc = 0;
+       }
        return rc;
 }
 
@@ -1815,9 +1824,13 @@ static int ibmvnic_set_mac(struct net_device *netdev, void *p)
        int rc;
 
        rc = 0;
-       ether_addr_copy(adapter->mac_addr, addr->sa_data);
-       if (adapter->state != VNIC_PROBED)
+       if (!is_valid_ether_addr(addr->sa_data))
+               return -EADDRNOTAVAIL;
+
+       if (adapter->state != VNIC_PROBED) {
+               ether_addr_copy(adapter->mac_addr, addr->sa_data);
                rc = __ibmvnic_set_mac(netdev, addr->sa_data);
+       }
 
        return rc;
 }
@@ -1918,6 +1931,13 @@ static int do_reset(struct ibmvnic_adapter *adapter,
                   rwi->reset_reason);
 
        rtnl_lock();
+       /*
+        * Now that we have the rtnl lock, clear any pending failover.
+        * This will ensure ibmvnic_open() has either completed or will
+        * block until failover is complete.
+        */
+       if (rwi->reset_reason == VNIC_RESET_FAILOVER)
+               adapter->failover_pending = false;
 
        netif_carrier_off(netdev);
        adapter->reset_reason = rwi->reset_reason;
@@ -2198,6 +2218,13 @@ static void __ibmvnic_reset(struct work_struct *work)
                        /* CHANGE_PARAM requestor holds rtnl_lock */
                        rc = do_change_param_reset(adapter, rwi, reset_state);
                } else if (adapter->force_reset_recovery) {
+                       /*
+                        * Since we are doing a hard reset now, clear the
+                        * failover_pending flag so we don't ignore any
+                        * future MOBILITY or other resets.
+                        */
+                       adapter->failover_pending = false;
+
                        /* Transport event occurred during previous reset */
                        if (adapter->wait_for_reset) {
                                /* Previous was CHANGE_PARAM; caller locked */
@@ -2262,9 +2289,15 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
        unsigned long flags;
        int ret;
 
+       /*
+        * If failover is pending don't schedule any other reset.
+        * Instead let the failover complete. If there is already a
+        * a failover reset scheduled, we will detect and drop the
+        * duplicate reset when walking the ->rwi_list below.
+        */
        if (adapter->state == VNIC_REMOVING ||
            adapter->state == VNIC_REMOVED ||
-           adapter->failover_pending) {
+           (adapter->failover_pending && reason != VNIC_RESET_FAILOVER)) {
                ret = EBUSY;
                netdev_dbg(netdev, "Adapter removing or pending failover, skipping reset\n");
                goto err;
@@ -4709,7 +4742,6 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
                case IBMVNIC_CRQ_INIT:
                        dev_info(dev, "Partner initialized\n");
                        adapter->from_passive_init = true;
-                       adapter->failover_pending = false;
                        if (!completion_done(&adapter->init_done)) {
                                complete(&adapter->init_done);
                                adapter->init_done_rc = -EIO;
index c96e2f2..4919d22 100644 (file)
@@ -2713,6 +2713,10 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
                                spin_unlock_bh(&vsi->mac_filter_hash_lock);
                                goto error_param;
                        }
+                       if (is_valid_ether_addr(al->list[i].addr) &&
+                           is_zero_ether_addr(vf->default_lan_addr.addr))
+                               ether_addr_copy(vf->default_lan_addr.addr,
+                                               al->list[i].addr);
                }
        }
        spin_unlock_bh(&vsi->mac_filter_hash_lock);
@@ -2740,6 +2744,7 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
 {
        struct virtchnl_ether_addr_list *al =
            (struct virtchnl_ether_addr_list *)msg;
+       bool was_unimac_deleted = false;
        struct i40e_pf *pf = vf->pf;
        struct i40e_vsi *vsi = NULL;
        i40e_status ret = 0;
@@ -2759,6 +2764,8 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
                        ret = I40E_ERR_INVALID_MAC_ADDR;
                        goto error_param;
                }
+               if (ether_addr_equal(al->list[i].addr, vf->default_lan_addr.addr))
+                       was_unimac_deleted = true;
        }
        vsi = pf->vsi[vf->lan_vsi_idx];
 
@@ -2779,10 +2786,25 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
                dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n",
                        vf->vf_id, ret);
 
+       if (vf->trusted && was_unimac_deleted) {
+               struct i40e_mac_filter *f;
+               struct hlist_node *h;
+               u8 *macaddr = NULL;
+               int bkt;
+
+               /* set last unicast mac address as default */
+               spin_lock_bh(&vsi->mac_filter_hash_lock);
+               hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
+                       if (is_valid_ether_addr(f->macaddr))
+                               macaddr = f->macaddr;
+               }
+               if (macaddr)
+                       ether_addr_copy(vf->default_lan_addr.addr, macaddr);
+               spin_unlock_bh(&vsi->mac_filter_hash_lock);
+       }
 error_param:
        /* send the response to the VF */
-       return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DEL_ETH_ADDR,
-                                      ret);
+       return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DEL_ETH_ADDR, ret);
 }
 
 /**
index 6acede0..567fd67 100644 (file)
@@ -281,8 +281,8 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
        unsigned int total_rx_bytes = 0, total_rx_packets = 0;
        u16 cleaned_count = I40E_DESC_UNUSED(rx_ring);
        unsigned int xdp_res, xdp_xmit = 0;
+       bool failure = false;
        struct sk_buff *skb;
-       bool failure;
 
        while (likely(total_rx_packets < (unsigned int)budget)) {
                union i40e_rx_desc *rx_desc;
index 9112dff..b673ac1 100644 (file)
@@ -3891,21 +3891,23 @@ static int igc_change_mtu(struct net_device *netdev, int new_mtu)
 }
 
 /**
- * igc_get_stats - Get System Network Statistics
+ * igc_get_stats64 - Get System Network Statistics
  * @netdev: network interface device structure
+ * @stats: rtnl_link_stats64 pointer
  *
  * Returns the address of the device statistics structure.
  * The statistics are updated here and also from the timer callback.
  */
-static struct net_device_stats *igc_get_stats(struct net_device *netdev)
+static void igc_get_stats64(struct net_device *netdev,
+                           struct rtnl_link_stats64 *stats)
 {
        struct igc_adapter *adapter = netdev_priv(netdev);
 
+       spin_lock(&adapter->stats64_lock);
        if (!test_bit(__IGC_RESETTING, &adapter->state))
                igc_update_stats(adapter);
-
-       /* only return the current stats */
-       return &netdev->stats;
+       memcpy(stats, &adapter->stats64, sizeof(*stats));
+       spin_unlock(&adapter->stats64_lock);
 }
 
 static netdev_features_t igc_fix_features(struct net_device *netdev,
@@ -4855,7 +4857,7 @@ static const struct net_device_ops igc_netdev_ops = {
        .ndo_set_rx_mode        = igc_set_rx_mode,
        .ndo_set_mac_address    = igc_set_mac,
        .ndo_change_mtu         = igc_change_mtu,
-       .ndo_get_stats          = igc_get_stats,
+       .ndo_get_stats64        = igc_get_stats64,
        .ndo_fix_features       = igc_fix_features,
        .ndo_set_features       = igc_set_features,
        .ndo_features_check     = igc_features_check,
index 8f17e26..7d0f962 100644 (file)
@@ -145,6 +145,16 @@ int cgx_get_cgxid(void *cgxd)
        return cgx->cgx_id;
 }
 
+u8 cgx_lmac_get_p2x(int cgx_id, int lmac_id)
+{
+       struct cgx *cgx_dev = cgx_get_pdata(cgx_id);
+       u64 cfg;
+
+       cfg = cgx_read(cgx_dev, lmac_id, CGXX_CMRX_CFG);
+
+       return (cfg & CMR_P2X_SEL_MASK) >> CMR_P2X_SEL_SHIFT;
+}
+
 /* Ensure the required lock for event queue(where asynchronous events are
  * posted) is acquired before calling this API. Else an asynchronous event(with
  * latest link status) can reach the destination before this function returns
@@ -814,8 +824,7 @@ static int cgx_lmac_verify_fwi_version(struct cgx *cgx)
        minor_ver = FIELD_GET(RESP_MINOR_VER, resp);
        dev_dbg(dev, "Firmware command interface version = %d.%d\n",
                major_ver, minor_ver);
-       if (major_ver != CGX_FIRMWARE_MAJOR_VER ||
-           minor_ver != CGX_FIRMWARE_MINOR_VER)
+       if (major_ver != CGX_FIRMWARE_MAJOR_VER)
                return -EIO;
        else
                return 0;
index 27ca329..bcfc3e5 100644 (file)
 
 /* Registers */
 #define CGXX_CMRX_CFG                  0x00
+#define CMR_P2X_SEL_MASK               GENMASK_ULL(61, 59)
+#define CMR_P2X_SEL_SHIFT              59ULL
+#define CMR_P2X_SEL_NIX0               1ULL
+#define CMR_P2X_SEL_NIX1               2ULL
 #define CMR_EN                         BIT_ULL(55)
 #define DATA_PKT_TX_EN                 BIT_ULL(53)
 #define DATA_PKT_RX_EN                 BIT_ULL(54)
@@ -142,5 +146,6 @@ int cgx_lmac_get_pause_frm(void *cgxd, int lmac_id,
 int cgx_lmac_set_pause_frm(void *cgxd, int lmac_id,
                           u8 tx_pause, u8 rx_pause);
 void cgx_lmac_ptp_config(void *cgxd, int lmac_id, bool enable);
+u8 cgx_lmac_get_p2x(int cgx_id, int lmac_id);
 
 #endif /* CGX_H */
index f48eb66..8f68e7a 100644 (file)
@@ -174,8 +174,12 @@ enum nix_scheduler {
 #define NPC_MCAM_KEY_X2                        1
 #define NPC_MCAM_KEY_X4                        2
 
-#define NIX_INTF_RX                    0
-#define NIX_INTF_TX                    1
+#define NIX_INTFX_RX(a)                        (0x0ull | (a) << 1)
+#define NIX_INTFX_TX(a)                        (0x1ull | (a) << 1)
+
+/* Default interfaces are NIX0_RX and NIX0_TX */
+#define NIX_INTF_RX                    NIX_INTFX_RX(0)
+#define NIX_INTF_TX                    NIX_INTFX_TX(0)
 
 #define NIX_INTF_TYPE_CGX              0
 #define NIX_INTF_TYPE_LBK              1
@@ -206,6 +210,8 @@ enum ndc_idx_e {
        NIX0_RX = 0x0,
        NIX0_TX = 0x1,
        NPA0_U  = 0x2,
+       NIX1_RX = 0x4,
+       NIX1_TX = 0x5,
 };
 
 enum ndc_ctype_e {
index 263a211..f46de84 100644 (file)
@@ -86,7 +86,7 @@ struct mbox_msghdr {
 #define OTX2_MBOX_REQ_SIG (0xdead)
 #define OTX2_MBOX_RSP_SIG (0xbeef)
        u16 sig;         /* Signature, for validating corrupted msgs */
-#define OTX2_MBOX_VERSION (0x0001)
+#define OTX2_MBOX_VERSION (0x0007)
        u16 ver;         /* Version of msg's structure for this ID */
        u16 next_msgoff; /* Offset of next msg within mailbox region */
        int rc;          /* Msg process'ed response code */
@@ -271,6 +271,17 @@ struct ready_msg_rsp {
  * or to detach partial of a cetain resource type.
  * Rest of the fields specify how many of what type to
  * be attached.
+ * To request LFs from two blocks of same type this mailbox
+ * can be sent twice as below:
+ *      struct rsrc_attach *attach;
+ *       .. Allocate memory for message ..
+ *       attach->cptlfs = 3; <3 LFs from CPT0>
+ *       .. Send message ..
+ *       .. Allocate memory for message ..
+ *       attach->modify = 1;
+ *       attach->cpt_blkaddr = BLKADDR_CPT1;
+ *       attach->cptlfs = 2; <2 LFs from CPT1>
+ *       .. Send message ..
  */
 struct rsrc_attach {
        struct mbox_msghdr hdr;
@@ -281,6 +292,7 @@ struct rsrc_attach {
        u16  ssow;
        u16  timlfs;
        u16  cptlfs;
+       int  cpt_blkaddr; /* BLKADDR_CPT0/BLKADDR_CPT1 or 0 for BLKADDR_CPT0 */
 };
 
 /* Structure for relinquishing resources.
@@ -314,6 +326,8 @@ struct msix_offset_rsp {
        u16  ssow_msixoff[MAX_RVU_BLKLF_CNT];
        u16  timlf_msixoff[MAX_RVU_BLKLF_CNT];
        u16  cptlf_msixoff[MAX_RVU_BLKLF_CNT];
+       u8   cpt1_lfs;
+       u16  cpt1_lf_msixoff[MAX_RVU_BLKLF_CNT];
 };
 
 struct get_hw_cap_rsp {
@@ -491,6 +505,9 @@ struct nix_lf_alloc_rsp {
        u8      lf_tx_stats; /* NIX_AF_CONST1::LF_TX_STATS */
        u16     cints; /* NIX_AF_CONST2::CINTS */
        u16     qints; /* NIX_AF_CONST2::QINTS */
+       u8      cgx_links;  /* No. of CGX links present in HW */
+       u8      lbk_links;  /* No. of LBK links present in HW */
+       u8      sdp_links;  /* No. of SDP links present in HW */
 };
 
 /* NIX AQ enqueue msg */
index 77bb4ed..1994486 100644 (file)
@@ -13380,7 +13380,7 @@ static const struct npc_lt_def_cfg npc_lt_defaults = {
        },
 };
 
-static const struct npc_mcam_kex npc_mkex_default = {
+static struct npc_mcam_kex npc_mkex_default = {
        .mkex_sign = MKEX_SIGN,
        .name = "default",
        .kpu_version = NPC_KPU_PROFILE_VER,
index e1f9189..a28a518 100644 (file)
@@ -66,6 +66,7 @@ static void rvu_setup_hw_capabilities(struct rvu *rvu)
        hw->cap.nix_shaping = true;
        hw->cap.nix_tx_link_bp = true;
        hw->cap.nix_rx_multicast = true;
+       hw->rvu = rvu;
 
        if (is_rvu_96xx_B0(rvu)) {
                hw->cap.nix_fixed_txschq_mapping = true;
@@ -210,6 +211,9 @@ int rvu_get_lf(struct rvu *rvu, struct rvu_block *block, u16 pcifunc, u16 slot)
  * multiple blocks of same type.
  *
  * @pcifunc has to be zero when no LF is yet attached.
+ *
+ * For a pcifunc if LFs are attached from multiple blocks of same type, then
+ * return blkaddr of first encountered block.
  */
 int rvu_get_blkaddr(struct rvu *rvu, int blktype, u16 pcifunc)
 {
@@ -258,20 +262,39 @@ int rvu_get_blkaddr(struct rvu *rvu, int blktype, u16 pcifunc)
                devnum = rvu_get_pf(pcifunc);
        }
 
-       /* Check if the 'pcifunc' has a NIX LF from 'BLKADDR_NIX0' */
+       /* Check if the 'pcifunc' has a NIX LF from 'BLKADDR_NIX0' or
+        * 'BLKADDR_NIX1'.
+        */
        if (blktype == BLKTYPE_NIX) {
-               reg = is_pf ? RVU_PRIV_PFX_NIX0_CFG : RVU_PRIV_HWVFX_NIX0_CFG;
+               reg = is_pf ? RVU_PRIV_PFX_NIXX_CFG(0) :
+                       RVU_PRIV_HWVFX_NIXX_CFG(0);
                cfg = rvu_read64(rvu, BLKADDR_RVUM, reg | (devnum << 16));
-               if (cfg)
+               if (cfg) {
                        blkaddr = BLKADDR_NIX0;
+                       goto exit;
+               }
+
+               reg = is_pf ? RVU_PRIV_PFX_NIXX_CFG(1) :
+                       RVU_PRIV_HWVFX_NIXX_CFG(1);
+               cfg = rvu_read64(rvu, BLKADDR_RVUM, reg | (devnum << 16));
+               if (cfg)
+                       blkaddr = BLKADDR_NIX1;
        }
 
-       /* Check if the 'pcifunc' has a CPT LF from 'BLKADDR_CPT0' */
        if (blktype == BLKTYPE_CPT) {
-               reg = is_pf ? RVU_PRIV_PFX_CPT0_CFG : RVU_PRIV_HWVFX_CPT0_CFG;
+               reg = is_pf ? RVU_PRIV_PFX_CPTX_CFG(0) :
+                       RVU_PRIV_HWVFX_CPTX_CFG(0);
                cfg = rvu_read64(rvu, BLKADDR_RVUM, reg | (devnum << 16));
-               if (cfg)
+               if (cfg) {
                        blkaddr = BLKADDR_CPT0;
+                       goto exit;
+               }
+
+               reg = is_pf ? RVU_PRIV_PFX_CPTX_CFG(1) :
+                       RVU_PRIV_HWVFX_CPTX_CFG(1);
+               cfg = rvu_read64(rvu, BLKADDR_RVUM, reg | (devnum << 16));
+               if (cfg)
+                       blkaddr = BLKADDR_CPT1;
        }
 
 exit:
@@ -306,31 +329,36 @@ static void rvu_update_rsrc_map(struct rvu *rvu, struct rvu_pfvf *pfvf,
 
        block->fn_map[lf] = attach ? pcifunc : 0;
 
-       switch (block->type) {
-       case BLKTYPE_NPA:
+       switch (block->addr) {
+       case BLKADDR_NPA:
                pfvf->npalf = attach ? true : false;
                num_lfs = pfvf->npalf;
                break;
-       case BLKTYPE_NIX:
+       case BLKADDR_NIX0:
+       case BLKADDR_NIX1:
                pfvf->nixlf = attach ? true : false;
                num_lfs = pfvf->nixlf;
                break;
-       case BLKTYPE_SSO:
+       case BLKADDR_SSO:
                attach ? pfvf->sso++ : pfvf->sso--;
                num_lfs = pfvf->sso;
                break;
-       case BLKTYPE_SSOW:
+       case BLKADDR_SSOW:
                attach ? pfvf->ssow++ : pfvf->ssow--;
                num_lfs = pfvf->ssow;
                break;
-       case BLKTYPE_TIM:
+       case BLKADDR_TIM:
                attach ? pfvf->timlfs++ : pfvf->timlfs--;
                num_lfs = pfvf->timlfs;
                break;
-       case BLKTYPE_CPT:
+       case BLKADDR_CPT0:
                attach ? pfvf->cptlfs++ : pfvf->cptlfs--;
                num_lfs = pfvf->cptlfs;
                break;
+       case BLKADDR_CPT1:
+               attach ? pfvf->cpt1_lfs++ : pfvf->cpt1_lfs--;
+               num_lfs = pfvf->cpt1_lfs;
+               break;
        }
 
        reg = is_pf ? block->pf_lfcnt_reg : block->vf_lfcnt_reg;
@@ -466,12 +494,16 @@ static void rvu_reset_all_blocks(struct rvu *rvu)
        /* Do a HW reset of all RVU blocks */
        rvu_block_reset(rvu, BLKADDR_NPA, NPA_AF_BLK_RST);
        rvu_block_reset(rvu, BLKADDR_NIX0, NIX_AF_BLK_RST);
+       rvu_block_reset(rvu, BLKADDR_NIX1, NIX_AF_BLK_RST);
        rvu_block_reset(rvu, BLKADDR_NPC, NPC_AF_BLK_RST);
        rvu_block_reset(rvu, BLKADDR_SSO, SSO_AF_BLK_RST);
        rvu_block_reset(rvu, BLKADDR_TIM, TIM_AF_BLK_RST);
        rvu_block_reset(rvu, BLKADDR_CPT0, CPT_AF_BLK_RST);
+       rvu_block_reset(rvu, BLKADDR_CPT1, CPT_AF_BLK_RST);
        rvu_block_reset(rvu, BLKADDR_NDC_NIX0_RX, NDC_AF_BLK_RST);
        rvu_block_reset(rvu, BLKADDR_NDC_NIX0_TX, NDC_AF_BLK_RST);
+       rvu_block_reset(rvu, BLKADDR_NDC_NIX1_RX, NDC_AF_BLK_RST);
+       rvu_block_reset(rvu, BLKADDR_NDC_NIX1_TX, NDC_AF_BLK_RST);
        rvu_block_reset(rvu, BLKADDR_NDC_NPA0, NDC_AF_BLK_RST);
 }
 
@@ -757,6 +789,62 @@ static void rvu_fwdata_exit(struct rvu *rvu)
                iounmap(rvu->fwdata);
 }
 
+static int rvu_setup_nix_hw_resource(struct rvu *rvu, int blkaddr)
+{
+       struct rvu_hwinfo *hw = rvu->hw;
+       struct rvu_block *block;
+       int blkid;
+       u64 cfg;
+
+       /* Init NIX LF's bitmap */
+       block = &hw->block[blkaddr];
+       if (!block->implemented)
+               return 0;
+       blkid = (blkaddr == BLKADDR_NIX0) ? 0 : 1;
+       cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST2);
+       block->lf.max = cfg & 0xFFF;
+       block->addr = blkaddr;
+       block->type = BLKTYPE_NIX;
+       block->lfshift = 8;
+       block->lookup_reg = NIX_AF_RVU_LF_CFG_DEBUG;
+       block->pf_lfcnt_reg = RVU_PRIV_PFX_NIXX_CFG(blkid);
+       block->vf_lfcnt_reg = RVU_PRIV_HWVFX_NIXX_CFG(blkid);
+       block->lfcfg_reg = NIX_PRIV_LFX_CFG;
+       block->msixcfg_reg = NIX_PRIV_LFX_INT_CFG;
+       block->lfreset_reg = NIX_AF_LF_RST;
+       sprintf(block->name, "NIX%d", blkid);
+       rvu->nix_blkaddr[blkid] = blkaddr;
+       return rvu_alloc_bitmap(&block->lf);
+}
+
+static int rvu_setup_cpt_hw_resource(struct rvu *rvu, int blkaddr)
+{
+       struct rvu_hwinfo *hw = rvu->hw;
+       struct rvu_block *block;
+       int blkid;
+       u64 cfg;
+
+       /* Init CPT LF's bitmap */
+       block = &hw->block[blkaddr];
+       if (!block->implemented)
+               return 0;
+       blkid = (blkaddr == BLKADDR_CPT0) ? 0 : 1;
+       cfg = rvu_read64(rvu, blkaddr, CPT_AF_CONSTANTS0);
+       block->lf.max = cfg & 0xFF;
+       block->addr = blkaddr;
+       block->type = BLKTYPE_CPT;
+       block->multislot = true;
+       block->lfshift = 3;
+       block->lookup_reg = CPT_AF_RVU_LF_CFG_DEBUG;
+       block->pf_lfcnt_reg = RVU_PRIV_PFX_CPTX_CFG(blkid);
+       block->vf_lfcnt_reg = RVU_PRIV_HWVFX_CPTX_CFG(blkid);
+       block->lfcfg_reg = CPT_PRIV_LFX_CFG;
+       block->msixcfg_reg = CPT_PRIV_LFX_INT_CFG;
+       block->lfreset_reg = CPT_AF_LF_RST;
+       sprintf(block->name, "CPT%d", blkid);
+       return rvu_alloc_bitmap(&block->lf);
+}
+
 static int rvu_setup_hw_resources(struct rvu *rvu)
 {
        struct rvu_hwinfo *hw = rvu->hw;
@@ -791,27 +879,13 @@ static int rvu_setup_hw_resources(struct rvu *rvu)
                return err;
 
 nix:
-       /* Init NIX LF's bitmap */
-       block = &hw->block[BLKADDR_NIX0];
-       if (!block->implemented)
-               goto sso;
-       cfg = rvu_read64(rvu, BLKADDR_NIX0, NIX_AF_CONST2);
-       block->lf.max = cfg & 0xFFF;
-       block->addr = BLKADDR_NIX0;
-       block->type = BLKTYPE_NIX;
-       block->lfshift = 8;
-       block->lookup_reg = NIX_AF_RVU_LF_CFG_DEBUG;
-       block->pf_lfcnt_reg = RVU_PRIV_PFX_NIX0_CFG;
-       block->vf_lfcnt_reg = RVU_PRIV_HWVFX_NIX0_CFG;
-       block->lfcfg_reg = NIX_PRIV_LFX_CFG;
-       block->msixcfg_reg = NIX_PRIV_LFX_INT_CFG;
-       block->lfreset_reg = NIX_AF_LF_RST;
-       sprintf(block->name, "NIX");
-       err = rvu_alloc_bitmap(&block->lf);
+       err = rvu_setup_nix_hw_resource(rvu, BLKADDR_NIX0);
+       if (err)
+               return err;
+       err = rvu_setup_nix_hw_resource(rvu, BLKADDR_NIX1);
        if (err)
                return err;
 
-sso:
        /* Init SSO group's bitmap */
        block = &hw->block[BLKADDR_SSO];
        if (!block->implemented)
@@ -877,28 +951,13 @@ tim:
                return err;
 
 cpt:
-       /* Init CPT LF's bitmap */
-       block = &hw->block[BLKADDR_CPT0];
-       if (!block->implemented)
-               goto init;
-       cfg = rvu_read64(rvu, BLKADDR_CPT0, CPT_AF_CONSTANTS0);
-       block->lf.max = cfg & 0xFF;
-       block->addr = BLKADDR_CPT0;
-       block->type = BLKTYPE_CPT;
-       block->multislot = true;
-       block->lfshift = 3;
-       block->lookup_reg = CPT_AF_RVU_LF_CFG_DEBUG;
-       block->pf_lfcnt_reg = RVU_PRIV_PFX_CPT0_CFG;
-       block->vf_lfcnt_reg = RVU_PRIV_HWVFX_CPT0_CFG;
-       block->lfcfg_reg = CPT_PRIV_LFX_CFG;
-       block->msixcfg_reg = CPT_PRIV_LFX_INT_CFG;
-       block->lfreset_reg = CPT_AF_LF_RST;
-       sprintf(block->name, "CPT");
-       err = rvu_alloc_bitmap(&block->lf);
+       err = rvu_setup_cpt_hw_resource(rvu, BLKADDR_CPT0);
+       if (err)
+               return err;
+       err = rvu_setup_cpt_hw_resource(rvu, BLKADDR_CPT1);
        if (err)
                return err;
 
-init:
        /* Allocate memory for PFVF data */
        rvu->pf = devm_kcalloc(rvu->dev, hw->total_pfs,
                               sizeof(struct rvu_pfvf), GFP_KERNEL);
@@ -1025,7 +1084,30 @@ int rvu_mbox_handler_ready(struct rvu *rvu, struct msg_req *req,
 /* Get current count of a RVU block's LF/slots
  * provisioned to a given RVU func.
  */
-static u16 rvu_get_rsrc_mapcount(struct rvu_pfvf *pfvf, int blktype)
+u16 rvu_get_rsrc_mapcount(struct rvu_pfvf *pfvf, int blkaddr)
+{
+       switch (blkaddr) {
+       case BLKADDR_NPA:
+               return pfvf->npalf ? 1 : 0;
+       case BLKADDR_NIX0:
+       case BLKADDR_NIX1:
+               return pfvf->nixlf ? 1 : 0;
+       case BLKADDR_SSO:
+               return pfvf->sso;
+       case BLKADDR_SSOW:
+               return pfvf->ssow;
+       case BLKADDR_TIM:
+               return pfvf->timlfs;
+       case BLKADDR_CPT0:
+               return pfvf->cptlfs;
+       case BLKADDR_CPT1:
+               return pfvf->cpt1_lfs;
+       }
+       return 0;
+}
+
+/* Return true if LFs of block type are attached to pcifunc */
+static bool is_blktype_attached(struct rvu_pfvf *pfvf, int blktype)
 {
        switch (blktype) {
        case BLKTYPE_NPA:
@@ -1033,15 +1115,16 @@ static u16 rvu_get_rsrc_mapcount(struct rvu_pfvf *pfvf, int blktype)
        case BLKTYPE_NIX:
                return pfvf->nixlf ? 1 : 0;
        case BLKTYPE_SSO:
-               return pfvf->sso;
+               return !!pfvf->sso;
        case BLKTYPE_SSOW:
-               return pfvf->ssow;
+               return !!pfvf->ssow;
        case BLKTYPE_TIM:
-               return pfvf->timlfs;
+               return !!pfvf->timlfs;
        case BLKTYPE_CPT:
-               return pfvf->cptlfs;
+               return pfvf->cptlfs || pfvf->cpt1_lfs;
        }
-       return 0;
+
+       return false;
 }
 
 bool is_pffunc_map_valid(struct rvu *rvu, u16 pcifunc, int blktype)
@@ -1054,7 +1137,7 @@ bool is_pffunc_map_valid(struct rvu *rvu, u16 pcifunc, int blktype)
        pfvf = rvu_get_pfvf(rvu, pcifunc);
 
        /* Check if this PFFUNC has a LF of type blktype attached */
-       if (!rvu_get_rsrc_mapcount(pfvf, blktype))
+       if (!is_blktype_attached(pfvf, blktype))
                return false;
 
        return true;
@@ -1095,7 +1178,7 @@ static void rvu_detach_block(struct rvu *rvu, int pcifunc, int blktype)
 
        block = &hw->block[blkaddr];
 
-       num_lfs = rvu_get_rsrc_mapcount(pfvf, block->type);
+       num_lfs = rvu_get_rsrc_mapcount(pfvf, block->addr);
        if (!num_lfs)
                return;
 
@@ -1146,6 +1229,8 @@ static int rvu_detach_rsrcs(struct rvu *rvu, struct rsrc_detach *detach,
                                continue;
                        else if ((blkid == BLKADDR_NIX0) && !detach->nixlf)
                                continue;
+                       else if ((blkid == BLKADDR_NIX1) && !detach->nixlf)
+                               continue;
                        else if ((blkid == BLKADDR_SSO) && !detach->sso)
                                continue;
                        else if ((blkid == BLKADDR_SSOW) && !detach->ssow)
@@ -1154,6 +1239,8 @@ static int rvu_detach_rsrcs(struct rvu *rvu, struct rsrc_detach *detach,
                                continue;
                        else if ((blkid == BLKADDR_CPT0) && !detach->cptlfs)
                                continue;
+                       else if ((blkid == BLKADDR_CPT1) && !detach->cptlfs)
+                               continue;
                }
                rvu_detach_block(rvu, pcifunc, block->type);
        }
@@ -1169,8 +1256,73 @@ int rvu_mbox_handler_detach_resources(struct rvu *rvu,
        return rvu_detach_rsrcs(rvu, detach, detach->hdr.pcifunc);
 }
 
-static void rvu_attach_block(struct rvu *rvu, int pcifunc,
-                            int blktype, int num_lfs)
+static int rvu_get_nix_blkaddr(struct rvu *rvu, u16 pcifunc)
+{
+       struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
+       int blkaddr = BLKADDR_NIX0, vf;
+       struct rvu_pfvf *pf;
+
+       /* All CGX mapped PFs are set with assigned NIX block during init */
+       if (is_pf_cgxmapped(rvu, rvu_get_pf(pcifunc))) {
+               pf = rvu_get_pfvf(rvu, pcifunc & ~RVU_PFVF_FUNC_MASK);
+               blkaddr = pf->nix_blkaddr;
+       } else if (is_afvf(pcifunc)) {
+               vf = pcifunc - 1;
+               /* Assign NIX based on VF number. All even numbered VFs get
+                * NIX0 and odd numbered gets NIX1
+                */
+               blkaddr = (vf & 1) ? BLKADDR_NIX1 : BLKADDR_NIX0;
+               /* NIX1 is not present on all silicons */
+               if (!is_block_implemented(rvu->hw, BLKADDR_NIX1))
+                       blkaddr = BLKADDR_NIX0;
+       }
+
+       switch (blkaddr) {
+       case BLKADDR_NIX1:
+               pfvf->nix_blkaddr = BLKADDR_NIX1;
+               pfvf->nix_rx_intf = NIX_INTFX_RX(1);
+               pfvf->nix_tx_intf = NIX_INTFX_TX(1);
+               break;
+       case BLKADDR_NIX0:
+       default:
+               pfvf->nix_blkaddr = BLKADDR_NIX0;
+               pfvf->nix_rx_intf = NIX_INTFX_RX(0);
+               pfvf->nix_tx_intf = NIX_INTFX_TX(0);
+               break;
+       }
+
+       return pfvf->nix_blkaddr;
+}
+
+static int rvu_get_attach_blkaddr(struct rvu *rvu, int blktype,
+                                 u16 pcifunc, struct rsrc_attach *attach)
+{
+       int blkaddr;
+
+       switch (blktype) {
+       case BLKTYPE_NIX:
+               blkaddr = rvu_get_nix_blkaddr(rvu, pcifunc);
+               break;
+       case BLKTYPE_CPT:
+               if (attach->hdr.ver < RVU_MULTI_BLK_VER)
+                       return rvu_get_blkaddr(rvu, blktype, 0);
+               blkaddr = attach->cpt_blkaddr ? attach->cpt_blkaddr :
+                         BLKADDR_CPT0;
+               if (blkaddr != BLKADDR_CPT0 && blkaddr != BLKADDR_CPT1)
+                       return -ENODEV;
+               break;
+       default:
+               return rvu_get_blkaddr(rvu, blktype, 0);
+       };
+
+       if (is_block_implemented(rvu->hw, blkaddr))
+               return blkaddr;
+
+       return -ENODEV;
+}
+
+static void rvu_attach_block(struct rvu *rvu, int pcifunc, int blktype,
+                            int num_lfs, struct rsrc_attach *attach)
 {
        struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
        struct rvu_hwinfo *hw = rvu->hw;
@@ -1182,7 +1334,7 @@ static void rvu_attach_block(struct rvu *rvu, int pcifunc,
        if (!num_lfs)
                return;
 
-       blkaddr = rvu_get_blkaddr(rvu, blktype, 0);
+       blkaddr = rvu_get_attach_blkaddr(rvu, blktype, pcifunc, attach);
        if (blkaddr < 0)
                return;
 
@@ -1211,12 +1363,12 @@ static int rvu_check_rsrc_availability(struct rvu *rvu,
                                       struct rsrc_attach *req, u16 pcifunc)
 {
        struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
+       int free_lfs, mappedlfs, blkaddr;
        struct rvu_hwinfo *hw = rvu->hw;
        struct rvu_block *block;
-       int free_lfs, mappedlfs;
 
        /* Only one NPA LF can be attached */
-       if (req->npalf && !rvu_get_rsrc_mapcount(pfvf, BLKTYPE_NPA)) {
+       if (req->npalf && !is_blktype_attached(pfvf, BLKTYPE_NPA)) {
                block = &hw->block[BLKADDR_NPA];
                free_lfs = rvu_rsrc_free_count(&block->lf);
                if (!free_lfs)
@@ -1229,8 +1381,12 @@ static int rvu_check_rsrc_availability(struct rvu *rvu,
        }
 
        /* Only one NIX LF can be attached */
-       if (req->nixlf && !rvu_get_rsrc_mapcount(pfvf, BLKTYPE_NIX)) {
-               block = &hw->block[BLKADDR_NIX0];
+       if (req->nixlf && !is_blktype_attached(pfvf, BLKTYPE_NIX)) {
+               blkaddr = rvu_get_attach_blkaddr(rvu, BLKTYPE_NIX,
+                                                pcifunc, req);
+               if (blkaddr < 0)
+                       return blkaddr;
+               block = &hw->block[blkaddr];
                free_lfs = rvu_rsrc_free_count(&block->lf);
                if (!free_lfs)
                        goto fail;
@@ -1250,7 +1406,7 @@ static int rvu_check_rsrc_availability(struct rvu *rvu,
                                 pcifunc, req->sso, block->lf.max);
                        return -EINVAL;
                }
-               mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->type);
+               mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->addr);
                free_lfs = rvu_rsrc_free_count(&block->lf);
                /* Check if additional resources are available */
                if (req->sso > mappedlfs &&
@@ -1266,7 +1422,7 @@ static int rvu_check_rsrc_availability(struct rvu *rvu,
                                 pcifunc, req->sso, block->lf.max);
                        return -EINVAL;
                }
-               mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->type);
+               mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->addr);
                free_lfs = rvu_rsrc_free_count(&block->lf);
                if (req->ssow > mappedlfs &&
                    ((req->ssow - mappedlfs) > free_lfs))
@@ -1281,7 +1437,7 @@ static int rvu_check_rsrc_availability(struct rvu *rvu,
                                 pcifunc, req->timlfs, block->lf.max);
                        return -EINVAL;
                }
-               mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->type);
+               mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->addr);
                free_lfs = rvu_rsrc_free_count(&block->lf);
                if (req->timlfs > mappedlfs &&
                    ((req->timlfs - mappedlfs) > free_lfs))
@@ -1289,14 +1445,18 @@ static int rvu_check_rsrc_availability(struct rvu *rvu,
        }
 
        if (req->cptlfs) {
-               block = &hw->block[BLKADDR_CPT0];
+               blkaddr = rvu_get_attach_blkaddr(rvu, BLKTYPE_CPT,
+                                                pcifunc, req);
+               if (blkaddr < 0)
+                       return blkaddr;
+               block = &hw->block[blkaddr];
                if (req->cptlfs > block->lf.max) {
                        dev_err(&rvu->pdev->dev,
                                "Func 0x%x: Invalid CPTLF req, %d > max %d\n",
                                 pcifunc, req->cptlfs, block->lf.max);
                        return -EINVAL;
                }
-               mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->type);
+               mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->addr);
                free_lfs = rvu_rsrc_free_count(&block->lf);
                if (req->cptlfs > mappedlfs &&
                    ((req->cptlfs - mappedlfs) > free_lfs))
@@ -1310,6 +1470,22 @@ fail:
        return -ENOSPC;
 }
 
+static bool rvu_attach_from_same_block(struct rvu *rvu, int blktype,
+                                      struct rsrc_attach *attach)
+{
+       int blkaddr, num_lfs;
+
+       blkaddr = rvu_get_attach_blkaddr(rvu, blktype,
+                                        attach->hdr.pcifunc, attach);
+       if (blkaddr < 0)
+               return false;
+
+       num_lfs = rvu_get_rsrc_mapcount(rvu_get_pfvf(rvu, attach->hdr.pcifunc),
+                                       blkaddr);
+       /* Requester already has LFs from given block ? */
+       return !!num_lfs;
+}
+
 int rvu_mbox_handler_attach_resources(struct rvu *rvu,
                                      struct rsrc_attach *attach,
                                      struct msg_rsp *rsp)
@@ -1330,10 +1506,10 @@ int rvu_mbox_handler_attach_resources(struct rvu *rvu,
 
        /* Now attach the requested resources */
        if (attach->npalf)
-               rvu_attach_block(rvu, pcifunc, BLKTYPE_NPA, 1);
+               rvu_attach_block(rvu, pcifunc, BLKTYPE_NPA, 1, attach);
 
        if (attach->nixlf)
-               rvu_attach_block(rvu, pcifunc, BLKTYPE_NIX, 1);
+               rvu_attach_block(rvu, pcifunc, BLKTYPE_NIX, 1, attach);
 
        if (attach->sso) {
                /* RVU func doesn't know which exact LF or slot is attached
@@ -1343,25 +1519,30 @@ int rvu_mbox_handler_attach_resources(struct rvu *rvu,
                 */
                if (attach->modify)
                        rvu_detach_block(rvu, pcifunc, BLKTYPE_SSO);
-               rvu_attach_block(rvu, pcifunc, BLKTYPE_SSO, attach->sso);
+               rvu_attach_block(rvu, pcifunc, BLKTYPE_SSO,
+                                attach->sso, attach);
        }
 
        if (attach->ssow) {
                if (attach->modify)
                        rvu_detach_block(rvu, pcifunc, BLKTYPE_SSOW);
-               rvu_attach_block(rvu, pcifunc, BLKTYPE_SSOW, attach->ssow);
+               rvu_attach_block(rvu, pcifunc, BLKTYPE_SSOW,
+                                attach->ssow, attach);
        }
 
        if (attach->timlfs) {
                if (attach->modify)
                        rvu_detach_block(rvu, pcifunc, BLKTYPE_TIM);
-               rvu_attach_block(rvu, pcifunc, BLKTYPE_TIM, attach->timlfs);
+               rvu_attach_block(rvu, pcifunc, BLKTYPE_TIM,
+                                attach->timlfs, attach);
        }
 
        if (attach->cptlfs) {
-               if (attach->modify)
+               if (attach->modify &&
+                   rvu_attach_from_same_block(rvu, BLKTYPE_CPT, attach))
                        rvu_detach_block(rvu, pcifunc, BLKTYPE_CPT);
-               rvu_attach_block(rvu, pcifunc, BLKTYPE_CPT, attach->cptlfs);
+               rvu_attach_block(rvu, pcifunc, BLKTYPE_CPT,
+                                attach->cptlfs, attach);
        }
 
 exit:
@@ -1439,7 +1620,7 @@ int rvu_mbox_handler_msix_offset(struct rvu *rvu, struct msg_req *req,
        struct rvu_hwinfo *hw = rvu->hw;
        u16 pcifunc = req->hdr.pcifunc;
        struct rvu_pfvf *pfvf;
-       int lf, slot;
+       int lf, slot, blkaddr;
 
        pfvf = rvu_get_pfvf(rvu, pcifunc);
        if (!pfvf->msix.bmap)
@@ -1449,8 +1630,14 @@ int rvu_mbox_handler_msix_offset(struct rvu *rvu, struct msg_req *req,
        lf = rvu_get_lf(rvu, &hw->block[BLKADDR_NPA], pcifunc, 0);
        rsp->npa_msixoff = rvu_get_msix_offset(rvu, pfvf, BLKADDR_NPA, lf);
 
-       lf = rvu_get_lf(rvu, &hw->block[BLKADDR_NIX0], pcifunc, 0);
-       rsp->nix_msixoff = rvu_get_msix_offset(rvu, pfvf, BLKADDR_NIX0, lf);
+       /* Get BLKADDR from which LFs are attached to pcifunc */
+       blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
+       if (blkaddr < 0) {
+               rsp->nix_msixoff = MSIX_VECTOR_INVALID;
+       } else {
+               lf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0);
+               rsp->nix_msixoff = rvu_get_msix_offset(rvu, pfvf, blkaddr, lf);
+       }
 
        rsp->sso = pfvf->sso;
        for (slot = 0; slot < rsp->sso; slot++) {
@@ -1479,6 +1666,14 @@ int rvu_mbox_handler_msix_offset(struct rvu *rvu, struct msg_req *req,
                rsp->cptlf_msixoff[slot] =
                        rvu_get_msix_offset(rvu, pfvf, BLKADDR_CPT0, lf);
        }
+
+       rsp->cpt1_lfs = pfvf->cpt1_lfs;
+       for (slot = 0; slot < rsp->cpt1_lfs; slot++) {
+               lf = rvu_get_lf(rvu, &hw->block[BLKADDR_CPT1], pcifunc, slot);
+               rsp->cpt1_lf_msixoff[slot] =
+                       rvu_get_msix_offset(rvu, pfvf, BLKADDR_CPT1, lf);
+       }
+
        return 0;
 }
 
@@ -1932,7 +2127,7 @@ static void rvu_blklf_teardown(struct rvu *rvu, u16 pcifunc, u8 blkaddr)
 
        block = &rvu->hw->block[blkaddr];
        num_lfs = rvu_get_rsrc_mapcount(rvu_get_pfvf(rvu, pcifunc),
-                                       block->type);
+                                       block->addr);
        if (!num_lfs)
                return;
        for (slot = 0; slot < num_lfs; slot++) {
@@ -1941,7 +2136,7 @@ static void rvu_blklf_teardown(struct rvu *rvu, u16 pcifunc, u8 blkaddr)
                        continue;
 
                /* Cleanup LF and reset it */
-               if (block->addr == BLKADDR_NIX0)
+               if (block->addr == BLKADDR_NIX0 || block->addr == BLKADDR_NIX1)
                        rvu_nix_lf_teardown(rvu, pcifunc, block->addr, lf);
                else if (block->addr == BLKADDR_NPA)
                        rvu_npa_lf_teardown(rvu, pcifunc, lf);
@@ -1963,7 +2158,9 @@ static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc)
         * 3. Cleanup pools (NPA)
         */
        rvu_blklf_teardown(rvu, pcifunc, BLKADDR_NIX0);
+       rvu_blklf_teardown(rvu, pcifunc, BLKADDR_NIX1);
        rvu_blklf_teardown(rvu, pcifunc, BLKADDR_CPT0);
+       rvu_blklf_teardown(rvu, pcifunc, BLKADDR_CPT1);
        rvu_blklf_teardown(rvu, pcifunc, BLKADDR_TIM);
        rvu_blklf_teardown(rvu, pcifunc, BLKADDR_SSOW);
        rvu_blklf_teardown(rvu, pcifunc, BLKADDR_SSO);
index 90eed31..5ac9bb1 100644 (file)
@@ -28,6 +28,7 @@
 #define        PCI_MBOX_BAR_NUM                        4
 
 #define NAME_SIZE                              32
+#define MAX_NIX_BLKS                           2
 
 /* PF_FUNC */
 #define RVU_PFVF_PF_SHIFT      10
@@ -137,6 +138,7 @@ struct rvu_pfvf {
        u16             ssow;
        u16             cptlfs;
        u16             timlfs;
+       u16             cpt1_lfs;
        u8              cgx_lmac;
 
        /* Block LF's MSIX vector info */
@@ -182,6 +184,10 @@ struct rvu_pfvf {
 
        bool    cgx_in_use; /* this PF/VF using CGX? */
        int     cgx_users;  /* number of cgx users - used only by PFs */
+
+       u8      nix_blkaddr; /* BLKADDR_NIX0/1 assigned to this PF */
+       u8      nix_rx_intf; /* NIX0_RX/NIX1_RX interface to NPC */
+       u8      nix_tx_intf; /* NIX0_TX/NIX1_TX interface to NPC */
 };
 
 struct nix_txsch {
@@ -219,6 +225,8 @@ struct nix_lso {
 };
 
 struct nix_hw {
+       int blkaddr;
+       struct rvu *rvu;
        struct nix_txsch txsch[NIX_TXSCH_LVL_CNT]; /* Tx schedulers */
        struct nix_mcast mcast;
        struct nix_flowkey flowkey;
@@ -251,10 +259,16 @@ struct rvu_hwinfo {
        u8      lbk_links;
        u8      sdp_links;
        u8      npc_kpus;          /* No of parser units */
+       u8      npc_pkinds;        /* No of port kinds */
+       u8      npc_intfs;         /* No of interfaces */
+       u8      npc_kpu_entries;   /* No of KPU entries */
+       u16     npc_counters;      /* No of match stats counters */
+       bool    npc_ext_set;       /* Extended register set */
 
        struct hw_cap    cap;
        struct rvu_block block[BLK_COUNT]; /* Block info */
-       struct nix_hw    *nix0;
+       struct nix_hw    *nix;
+       struct rvu       *rvu;
        struct npc_pkind pkind;
        struct npc_mcam  mcam;
 };
@@ -300,7 +314,7 @@ struct npc_kpu_profile_adapter {
        const struct npc_lt_def_cfg     *lt_def;
        const struct npc_kpu_profile_action     *ikpu; /* array[pkinds] */
        const struct npc_kpu_profile    *kpu; /* array[kpus] */
-       const struct npc_mcam_kex       *mkex;
+       struct npc_mcam_kex             *mkex;
        size_t                          pkinds;
        size_t                          kpus;
 };
@@ -315,6 +329,7 @@ struct rvu {
        struct rvu_pfvf         *hwvf;
        struct mutex            rsrc_lock; /* Serialize resource alloc/free */
        int                     vfs; /* Number of VFs attached to RVU */
+       int                     nix_blkaddr[MAX_NIX_BLKS];
 
        /* Mbox */
        struct mbox_wq_info     afpf_wq_info;
@@ -420,6 +435,7 @@ void rvu_free_rsrc(struct rsrc_bmap *rsrc, int id);
 int rvu_rsrc_free_count(struct rsrc_bmap *rsrc);
 int rvu_alloc_rsrc_contig(struct rsrc_bmap *rsrc, int nrsrc);
 bool rvu_rsrc_check_contig(struct rsrc_bmap *rsrc, int nrsrc);
+u16 rvu_get_rsrc_mapcount(struct rvu_pfvf *pfvf, int blkaddr);
 int rvu_get_pf(u16 pcifunc);
 struct rvu_pfvf *rvu_get_pfvf(struct rvu *rvu, int pcifunc);
 void rvu_get_pf_numvfs(struct rvu *rvu, int pf, int *numvfs, int *hwvf);
@@ -485,6 +501,8 @@ int rvu_get_nixlf_count(struct rvu *rvu);
 void rvu_nix_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int npalf);
 int nix_get_nixlf(struct rvu *rvu, u16 pcifunc, int *nixlf, int *nix_blkaddr);
 int nix_update_bcast_mce_list(struct rvu *rvu, u16 pcifunc, bool add);
+struct nix_hw *get_nix_hw(struct rvu_hwinfo *hw, int blkaddr);
+int rvu_get_next_nix_blkaddr(struct rvu *rvu, int blkaddr);
 
 /* NPC APIs */
 int rvu_npc_init(struct rvu *rvu);
@@ -513,6 +531,10 @@ void rvu_npc_get_mcam_entry_alloc_info(struct rvu *rvu, u16 pcifunc,
 void rvu_npc_get_mcam_counter_alloc_info(struct rvu *rvu, u16 pcifunc,
                                         int blkaddr, int *alloc_cnt,
                                         int *enable_cnt);
+bool is_npc_intf_tx(u8 intf);
+bool is_npc_intf_rx(u8 intf);
+bool is_npc_interface_valid(struct rvu *rvu, u8 intf);
+int rvu_npc_get_tx_nibble_cfg(struct rvu *rvu, u64 nibble_ena);
 
 #ifdef CONFIG_DEBUG_FS
 void rvu_dbg_init(struct rvu *rvu);
index fa9152f..d298b93 100644 (file)
@@ -74,6 +74,20 @@ void *rvu_cgx_pdata(u8 cgx_id, struct rvu *rvu)
        return rvu->cgx_idmap[cgx_id];
 }
 
+/* Based on P2X connectivity find mapped NIX block for a PF */
+static void rvu_map_cgx_nix_block(struct rvu *rvu, int pf,
+                                 int cgx_id, int lmac_id)
+{
+       struct rvu_pfvf *pfvf = &rvu->pf[pf];
+       u8 p2x;
+
+       p2x = cgx_lmac_get_p2x(cgx_id, lmac_id);
+       /* Firmware sets P2X_SELECT as either NIX0 or NIX1 */
+       pfvf->nix_blkaddr = BLKADDR_NIX0;
+       if (p2x == CMR_P2X_SEL_NIX1)
+               pfvf->nix_blkaddr = BLKADDR_NIX1;
+}
+
 static int rvu_map_cgx_lmac_pf(struct rvu *rvu)
 {
        struct npc_pkind *pkind = &rvu->hw->pkind;
@@ -117,6 +131,7 @@ static int rvu_map_cgx_lmac_pf(struct rvu *rvu)
                        rvu->cgxlmac2pf_map[CGX_OFFSET(cgx) + lmac] = 1 << pf;
                        free_pkind = rvu_alloc_rsrc(&pkind->rsrc);
                        pkind->pfchan_map[free_pkind] = ((pf) & 0x3F) << 16;
+                       rvu_map_cgx_nix_block(rvu, pf, cgx, lmac);
                        rvu->cgx_mapped_pfs++;
                }
        }
index 77adad4..b7b6b6f 100644 (file)
@@ -224,18 +224,53 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp,
 
 RVU_DEBUG_FOPS(rsrc_status, rsrc_attach_status, NULL);
 
-static bool rvu_dbg_is_valid_lf(struct rvu *rvu, int blktype, int lf,
+static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused)
+{
+       struct rvu *rvu = filp->private;
+       struct pci_dev *pdev = NULL;
+       char cgx[10], lmac[10];
+       struct rvu_pfvf *pfvf;
+       int pf, domain, blkid;
+       u8 cgx_id, lmac_id;
+       u16 pcifunc;
+
+       domain = 2;
+       seq_puts(filp, "PCI dev\t\tRVU PF Func\tNIX block\tCGX\tLMAC\n");
+       for (pf = 0; pf < rvu->hw->total_pfs; pf++) {
+               if (!is_pf_cgxmapped(rvu, pf))
+                       continue;
+
+               pdev =  pci_get_domain_bus_and_slot(domain, pf + 1, 0);
+               if (!pdev)
+                       continue;
+
+               cgx[0] = 0;
+               lmac[0] = 0;
+               pcifunc = pf << 10;
+               pfvf = rvu_get_pfvf(rvu, pcifunc);
+
+               if (pfvf->nix_blkaddr == BLKADDR_NIX0)
+                       blkid = 0;
+               else
+                       blkid = 1;
+
+               rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id,
+                                   &lmac_id);
+               sprintf(cgx, "CGX%d", cgx_id);
+               sprintf(lmac, "LMAC%d", lmac_id);
+               seq_printf(filp, "%s\t0x%x\t\tNIX%d\t\t%s\t%s\n",
+                          dev_name(&pdev->dev), pcifunc, blkid, cgx, lmac);
+       }
+       return 0;
+}
+
+RVU_DEBUG_SEQ_FOPS(rvu_pf_cgx_map, rvu_pf_cgx_map_display, NULL);
+
+static bool rvu_dbg_is_valid_lf(struct rvu *rvu, int blkaddr, int lf,
                                u16 *pcifunc)
 {
        struct rvu_block *block;
        struct rvu_hwinfo *hw;
-       int blkaddr;
-
-       blkaddr = rvu_get_blkaddr(rvu, blktype, 0);
-       if (blkaddr < 0) {
-               dev_warn(rvu->dev, "Invalid blktype\n");
-               return false;
-       }
 
        hw = rvu->hw;
        block = &hw->block[blkaddr];
@@ -291,10 +326,12 @@ static int rvu_dbg_qsize_display(struct seq_file *filp, void *unsused,
 {
        void (*print_qsize)(struct seq_file *filp,
                            struct rvu_pfvf *pfvf) = NULL;
+       struct dentry *current_dir;
        struct rvu_pfvf *pfvf;
        struct rvu *rvu;
        int qsize_id;
        u16 pcifunc;
+       int blkaddr;
 
        rvu = filp->private;
        switch (blktype) {
@@ -312,7 +349,15 @@ static int rvu_dbg_qsize_display(struct seq_file *filp, void *unsused,
                return -EINVAL;
        }
 
-       if (!rvu_dbg_is_valid_lf(rvu, blktype, qsize_id, &pcifunc))
+       if (blktype == BLKTYPE_NPA) {
+               blkaddr = BLKADDR_NPA;
+       } else {
+               current_dir = filp->file->f_path.dentry->d_parent;
+               blkaddr = (!strcmp(current_dir->d_name.name, "nix1") ?
+                                  BLKADDR_NIX1 : BLKADDR_NIX0);
+       }
+
+       if (!rvu_dbg_is_valid_lf(rvu, blkaddr, qsize_id, &pcifunc))
                return -EINVAL;
 
        pfvf = rvu_get_pfvf(rvu, pcifunc);
@@ -329,6 +374,8 @@ static ssize_t rvu_dbg_qsize_write(struct file *filp,
        struct seq_file *seqfile = filp->private_data;
        char *cmd_buf, *cmd_buf_tmp, *subtoken;
        struct rvu *rvu = seqfile->private;
+       struct dentry *current_dir;
+       int blkaddr;
        u16 pcifunc;
        int ret, lf;
 
@@ -355,7 +402,15 @@ static ssize_t rvu_dbg_qsize_write(struct file *filp,
                goto qsize_write_done;
        }
 
-       if (!rvu_dbg_is_valid_lf(rvu, blktype, lf, &pcifunc)) {
+       if (blktype == BLKTYPE_NPA) {
+               blkaddr = BLKADDR_NPA;
+       } else {
+               current_dir = filp->f_path.dentry->d_parent;
+               blkaddr = (!strcmp(current_dir->d_name.name, "nix1") ?
+                                  BLKADDR_NIX1 : BLKADDR_NIX0);
+       }
+
+       if (!rvu_dbg_is_valid_lf(rvu, blkaddr, lf, &pcifunc)) {
                ret = -EINVAL;
                goto qsize_write_done;
        }
@@ -498,7 +553,7 @@ static int rvu_dbg_npa_ctx_display(struct seq_file *m, void *unused, int ctype)
                return -EINVAL;
        }
 
-       if (!rvu_dbg_is_valid_lf(rvu, BLKTYPE_NPA, npalf, &pcifunc))
+       if (!rvu_dbg_is_valid_lf(rvu, BLKADDR_NPA, npalf, &pcifunc))
                return -EINVAL;
 
        pfvf = rvu_get_pfvf(rvu, pcifunc);
@@ -556,7 +611,7 @@ static int write_npa_ctx(struct rvu *rvu, bool all,
        int max_id = 0;
        u16 pcifunc;
 
-       if (!rvu_dbg_is_valid_lf(rvu, BLKTYPE_NPA, npalf, &pcifunc))
+       if (!rvu_dbg_is_valid_lf(rvu, BLKADDR_NPA, npalf, &pcifunc))
                return -EINVAL;
 
        pfvf = rvu_get_pfvf(rvu, pcifunc);
@@ -704,9 +759,17 @@ static void ndc_cache_stats(struct seq_file *s, int blk_addr,
                            int ctype, int transaction)
 {
        u64 req, out_req, lat, cant_alloc;
-       struct rvu *rvu = s->private;
+       struct nix_hw *nix_hw;
+       struct rvu *rvu;
        int port;
 
+       if (blk_addr == BLKADDR_NDC_NPA0) {
+               rvu = s->private;
+       } else {
+               nix_hw = s->private;
+               rvu = nix_hw->rvu;
+       }
+
        for (port = 0; port < NDC_MAX_PORT; port++) {
                req = rvu_read64(rvu, blk_addr, NDC_AF_PORTX_RTX_RWX_REQ_PC
                                                (port, ctype, transaction));
@@ -749,9 +812,17 @@ RVU_DEBUG_SEQ_FOPS(npa_ndc_cache, npa_ndc_cache_display, NULL);
 
 static int ndc_blk_hits_miss_stats(struct seq_file *s, int idx, int blk_addr)
 {
-       struct rvu *rvu = s->private;
+       struct nix_hw *nix_hw;
+       struct rvu *rvu;
        int bank, max_bank;
 
+       if (blk_addr == BLKADDR_NDC_NPA0) {
+               rvu = s->private;
+       } else {
+               nix_hw = s->private;
+               rvu = nix_hw->rvu;
+       }
+
        max_bank = NDC_MAX_BANK(rvu, blk_addr);
        for (bank = 0; bank < max_bank; bank++) {
                seq_printf(s, "BANK:%d\n", bank);
@@ -767,16 +838,30 @@ static int ndc_blk_hits_miss_stats(struct seq_file *s, int idx, int blk_addr)
 
 static int rvu_dbg_nix_ndc_rx_cache_display(struct seq_file *filp, void *unused)
 {
-       return ndc_blk_cache_stats(filp, NIX0_RX,
-                                  BLKADDR_NDC_NIX0_RX);
+       struct nix_hw *nix_hw = filp->private;
+       int blkaddr = 0;
+       int ndc_idx = 0;
+
+       blkaddr = (nix_hw->blkaddr == BLKADDR_NIX1 ?
+                  BLKADDR_NDC_NIX1_RX : BLKADDR_NDC_NIX0_RX);
+       ndc_idx = (nix_hw->blkaddr == BLKADDR_NIX1 ? NIX1_RX : NIX0_RX);
+
+       return ndc_blk_cache_stats(filp, ndc_idx, blkaddr);
 }
 
 RVU_DEBUG_SEQ_FOPS(nix_ndc_rx_cache, nix_ndc_rx_cache_display, NULL);
 
 static int rvu_dbg_nix_ndc_tx_cache_display(struct seq_file *filp, void *unused)
 {
-       return ndc_blk_cache_stats(filp, NIX0_TX,
-                                  BLKADDR_NDC_NIX0_TX);
+       struct nix_hw *nix_hw = filp->private;
+       int blkaddr = 0;
+       int ndc_idx = 0;
+
+       blkaddr = (nix_hw->blkaddr == BLKADDR_NIX1 ?
+                  BLKADDR_NDC_NIX1_TX : BLKADDR_NDC_NIX0_TX);
+       ndc_idx = (nix_hw->blkaddr == BLKADDR_NIX1 ? NIX1_TX : NIX0_TX);
+
+       return ndc_blk_cache_stats(filp, ndc_idx, blkaddr);
 }
 
 RVU_DEBUG_SEQ_FOPS(nix_ndc_tx_cache, nix_ndc_tx_cache_display, NULL);
@@ -792,8 +877,14 @@ RVU_DEBUG_SEQ_FOPS(npa_ndc_hits_miss, npa_ndc_hits_miss_display, NULL);
 static int rvu_dbg_nix_ndc_rx_hits_miss_display(struct seq_file *filp,
                                                void *unused)
 {
-       return ndc_blk_hits_miss_stats(filp,
-                                     NPA0_U, BLKADDR_NDC_NIX0_RX);
+       struct nix_hw *nix_hw = filp->private;
+       int ndc_idx = NPA0_U;
+       int blkaddr = 0;
+
+       blkaddr = (nix_hw->blkaddr == BLKADDR_NIX1 ?
+                  BLKADDR_NDC_NIX1_RX : BLKADDR_NDC_NIX0_RX);
+
+       return ndc_blk_hits_miss_stats(filp, ndc_idx, blkaddr);
 }
 
 RVU_DEBUG_SEQ_FOPS(nix_ndc_rx_hits_miss, nix_ndc_rx_hits_miss_display, NULL);
@@ -801,8 +892,14 @@ RVU_DEBUG_SEQ_FOPS(nix_ndc_rx_hits_miss, nix_ndc_rx_hits_miss_display, NULL);
 static int rvu_dbg_nix_ndc_tx_hits_miss_display(struct seq_file *filp,
                                                void *unused)
 {
-       return ndc_blk_hits_miss_stats(filp,
-                                     NPA0_U, BLKADDR_NDC_NIX0_TX);
+       struct nix_hw *nix_hw = filp->private;
+       int ndc_idx = NPA0_U;
+       int blkaddr = 0;
+
+       blkaddr = (nix_hw->blkaddr == BLKADDR_NIX1 ?
+                  BLKADDR_NDC_NIX1_TX : BLKADDR_NDC_NIX0_TX);
+
+       return ndc_blk_hits_miss_stats(filp, ndc_idx, blkaddr);
 }
 
 RVU_DEBUG_SEQ_FOPS(nix_ndc_tx_hits_miss, nix_ndc_tx_hits_miss_display, NULL);
@@ -969,7 +1066,8 @@ static int rvu_dbg_nix_queue_ctx_display(struct seq_file *filp,
 {
        void (*print_nix_ctx)(struct seq_file *filp,
                              struct nix_aq_enq_rsp *rsp) = NULL;
-       struct rvu *rvu = filp->private;
+       struct nix_hw *nix_hw = filp->private;
+       struct rvu *rvu = nix_hw->rvu;
        struct nix_aq_enq_req aq_req;
        struct nix_aq_enq_rsp rsp;
        char *ctype_string = NULL;
@@ -1001,7 +1099,7 @@ static int rvu_dbg_nix_queue_ctx_display(struct seq_file *filp,
                return -EINVAL;
        }
 
-       if (!rvu_dbg_is_valid_lf(rvu, BLKTYPE_NIX, nixlf, &pcifunc))
+       if (!rvu_dbg_is_valid_lf(rvu, nix_hw->blkaddr, nixlf, &pcifunc))
                return -EINVAL;
 
        pfvf = rvu_get_pfvf(rvu, pcifunc);
@@ -1053,13 +1151,15 @@ static int rvu_dbg_nix_queue_ctx_display(struct seq_file *filp,
 }
 
 static int write_nix_queue_ctx(struct rvu *rvu, bool all, int nixlf,
-                              int id, int ctype, char *ctype_string)
+                              int id, int ctype, char *ctype_string,
+                              struct seq_file *m)
 {
+       struct nix_hw *nix_hw = m->private;
        struct rvu_pfvf *pfvf;
        int max_id = 0;
        u16 pcifunc;
 
-       if (!rvu_dbg_is_valid_lf(rvu, BLKTYPE_NIX, nixlf, &pcifunc))
+       if (!rvu_dbg_is_valid_lf(rvu, nix_hw->blkaddr, nixlf, &pcifunc))
                return -EINVAL;
 
        pfvf = rvu_get_pfvf(rvu, pcifunc);
@@ -1119,7 +1219,8 @@ static ssize_t rvu_dbg_nix_queue_ctx_write(struct file *filp,
                                           int ctype)
 {
        struct seq_file *m = filp->private_data;
-       struct rvu *rvu = m->private;
+       struct nix_hw *nix_hw = m->private;
+       struct rvu *rvu = nix_hw->rvu;
        char *cmd_buf, *ctype_string;
        int nixlf, id = 0, ret;
        bool all = false;
@@ -1155,7 +1256,7 @@ static ssize_t rvu_dbg_nix_queue_ctx_write(struct file *filp,
                goto done;
        } else {
                ret = write_nix_queue_ctx(rvu, all, nixlf, id, ctype,
-                                         ctype_string);
+                                         ctype_string, m);
        }
 done:
        kfree(cmd_buf);
@@ -1259,49 +1360,67 @@ static int rvu_dbg_nix_qsize_display(struct seq_file *filp, void *unused)
 
 RVU_DEBUG_SEQ_FOPS(nix_qsize, nix_qsize_display, nix_qsize_write);
 
-static void rvu_dbg_nix_init(struct rvu *rvu)
+static void rvu_dbg_nix_init(struct rvu *rvu, int blkaddr)
 {
        const struct device *dev = &rvu->pdev->dev;
+       struct nix_hw *nix_hw;
        struct dentry *pfile;
 
-       rvu->rvu_dbg.nix = debugfs_create_dir("nix", rvu->rvu_dbg.root);
-       if (!rvu->rvu_dbg.nix) {
-               dev_err(rvu->dev, "create debugfs dir failed for nix\n");
+       if (!is_block_implemented(rvu->hw, blkaddr))
                return;
+
+       if (blkaddr == BLKADDR_NIX0) {
+               rvu->rvu_dbg.nix = debugfs_create_dir("nix", rvu->rvu_dbg.root);
+               if (!rvu->rvu_dbg.nix) {
+                       dev_err(rvu->dev, "create debugfs dir failed for nix\n");
+                       return;
+               }
+               nix_hw = &rvu->hw->nix[0];
+       } else {
+               rvu->rvu_dbg.nix = debugfs_create_dir("nix1",
+                                                     rvu->rvu_dbg.root);
+               if (!rvu->rvu_dbg.nix) {
+                       dev_err(rvu->dev,
+                               "create debugfs dir failed for nix1\n");
+                       return;
+               }
+               nix_hw = &rvu->hw->nix[1];
        }
 
-       pfile = debugfs_create_file("sq_ctx", 0600, rvu->rvu_dbg.nix, rvu,
+       pfile = debugfs_create_file("sq_ctx", 0600, rvu->rvu_dbg.nix, nix_hw,
                                    &rvu_dbg_nix_sq_ctx_fops);
        if (!pfile)
                goto create_failed;
 
-       pfile = debugfs_create_file("rq_ctx", 0600, rvu->rvu_dbg.nix, rvu,
+       pfile = debugfs_create_file("rq_ctx", 0600, rvu->rvu_dbg.nix, nix_hw,
                                    &rvu_dbg_nix_rq_ctx_fops);
        if (!pfile)
                goto create_failed;
 
-       pfile = debugfs_create_file("cq_ctx", 0600, rvu->rvu_dbg.nix, rvu,
+       pfile = debugfs_create_file("cq_ctx", 0600, rvu->rvu_dbg.nix, nix_hw,
                                    &rvu_dbg_nix_cq_ctx_fops);
        if (!pfile)
                goto create_failed;
 
-       pfile = debugfs_create_file("ndc_tx_cache", 0600, rvu->rvu_dbg.nix, rvu,
-                                   &rvu_dbg_nix_ndc_tx_cache_fops);
+       pfile = debugfs_create_file("ndc_tx_cache", 0600, rvu->rvu_dbg.nix,
+                                   nix_hw, &rvu_dbg_nix_ndc_tx_cache_fops);
        if (!pfile)
                goto create_failed;
 
-       pfile = debugfs_create_file("ndc_rx_cache", 0600, rvu->rvu_dbg.nix, rvu,
-                                   &rvu_dbg_nix_ndc_rx_cache_fops);
+       pfile = debugfs_create_file("ndc_rx_cache", 0600, rvu->rvu_dbg.nix,
+                                   nix_hw, &rvu_dbg_nix_ndc_rx_cache_fops);
        if (!pfile)
                goto create_failed;
 
        pfile = debugfs_create_file("ndc_tx_hits_miss", 0600, rvu->rvu_dbg.nix,
-                                   rvu, &rvu_dbg_nix_ndc_tx_hits_miss_fops);
+                                   nix_hw,
+                                   &rvu_dbg_nix_ndc_tx_hits_miss_fops);
        if (!pfile)
                goto create_failed;
 
        pfile = debugfs_create_file("ndc_rx_hits_miss", 0600, rvu->rvu_dbg.nix,
-                                   rvu, &rvu_dbg_nix_ndc_rx_hits_miss_fops);
+                                   nix_hw,
+                                   &rvu_dbg_nix_ndc_rx_hits_miss_fops);
        if (!pfile)
                goto create_failed;
 
@@ -1312,7 +1431,8 @@ static void rvu_dbg_nix_init(struct rvu *rvu)
 
        return;
 create_failed:
-       dev_err(dev, "Failed to create debugfs dir/file for NIX\n");
+       dev_err(dev,
+               "Failed to create debugfs dir/file for NIX blk\n");
        debugfs_remove_recursive(rvu->rvu_dbg.nix);
 }
 
@@ -1565,7 +1685,7 @@ static int rvu_dbg_npc_mcam_info_display(struct seq_file *filp, void *unsued)
        struct rvu *rvu = filp->private;
        int pf, vf, numvfs, blkaddr;
        struct npc_mcam *mcam;
-       u16 pcifunc;
+       u16 pcifunc, counters;
        u64 cfg;
 
        blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
@@ -1573,6 +1693,7 @@ static int rvu_dbg_npc_mcam_info_display(struct seq_file *filp, void *unsued)
                return -ENODEV;
 
        mcam = &rvu->hw->mcam;
+       counters = rvu->hw->npc_counters;
 
        seq_puts(filp, "\nNPC MCAM info:\n");
        /* MCAM keywidth on receive and transmit sides */
@@ -1595,10 +1716,9 @@ static int rvu_dbg_npc_mcam_info_display(struct seq_file *filp, void *unsued)
        seq_printf(filp, "\t\t Available \t: %d\n", mcam->bmap_fcnt);
 
        /* MCAM counters */
-       cfg = rvu_read64(rvu, blkaddr, NPC_AF_CONST);
-       cfg = (cfg >> 48) & 0xFFFF;
-       seq_printf(filp, "\n\t\t MCAM counters \t: %lld\n", cfg);
-       seq_printf(filp, "\t\t Reserved \t: %lld\n", cfg - mcam->counters.max);
+       seq_printf(filp, "\n\t\t MCAM counters \t: %d\n", counters);
+       seq_printf(filp, "\t\t Reserved \t: %d\n",
+                  counters - mcam->counters.max);
        seq_printf(filp, "\t\t Available \t: %d\n",
                   rvu_rsrc_free_count(&mcam->counters));
 
@@ -1691,8 +1811,15 @@ void rvu_dbg_init(struct rvu *rvu)
        if (!pfile)
                goto create_failed;
 
+       pfile = debugfs_create_file("rvu_pf_cgx_map", 0444, rvu->rvu_dbg.root,
+                                   rvu, &rvu_dbg_rvu_pf_cgx_map_fops);
+       if (!pfile)
+               goto create_failed;
+
        rvu_dbg_npa_init(rvu);
-       rvu_dbg_nix_init(rvu);
+       rvu_dbg_nix_init(rvu, BLKADDR_NIX0);
+
+       rvu_dbg_nix_init(rvu, BLKADDR_NIX1);
        rvu_dbg_cgx_init(rvu);
        rvu_dbg_npc_init(rvu);
 
index 21a89dd..8bac1dd 100644 (file)
@@ -68,6 +68,23 @@ struct mce {
        u16                     pcifunc;
 };
 
+int rvu_get_next_nix_blkaddr(struct rvu *rvu, int blkaddr)
+{
+       int i = 0;
+
+       /*If blkaddr is 0, return the first nix block address*/
+       if (blkaddr == 0)
+               return rvu->nix_blkaddr[blkaddr];
+
+       while (i + 1 < MAX_NIX_BLKS) {
+               if (rvu->nix_blkaddr[i] == blkaddr)
+                       return rvu->nix_blkaddr[i + 1];
+               i++;
+       }
+
+       return 0;
+}
+
 bool is_nixlf_attached(struct rvu *rvu, u16 pcifunc)
 {
        struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
@@ -81,14 +98,16 @@ bool is_nixlf_attached(struct rvu *rvu, u16 pcifunc)
 
 int rvu_get_nixlf_count(struct rvu *rvu)
 {
+       int blkaddr = 0, max = 0;
        struct rvu_block *block;
-       int blkaddr;
 
-       blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, 0);
-       if (blkaddr < 0)
-               return 0;
-       block = &rvu->hw->block[blkaddr];
-       return block->lf.max;
+       blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr);
+       while (blkaddr) {
+               block = &rvu->hw->block[blkaddr];
+               max += block->lf.max;
+               blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr);
+       }
+       return max;
 }
 
 int nix_get_nixlf(struct rvu *rvu, u16 pcifunc, int *nixlf, int *nix_blkaddr)
@@ -130,11 +149,18 @@ static u16 nix_alloc_mce_list(struct nix_mcast *mcast, int count)
        return idx;
 }
 
-static inline struct nix_hw *get_nix_hw(struct rvu_hwinfo *hw, int blkaddr)
+struct nix_hw *get_nix_hw(struct rvu_hwinfo *hw, int blkaddr)
 {
-       if (blkaddr == BLKADDR_NIX0 && hw->nix0)
-               return hw->nix0;
+       int nix_blkaddr = 0, i = 0;
+       struct rvu *rvu = hw->rvu;
 
+       nix_blkaddr = rvu_get_next_nix_blkaddr(rvu, nix_blkaddr);
+       while (nix_blkaddr) {
+               if (blkaddr == nix_blkaddr && hw->nix)
+                       return &hw->nix[i];
+               nix_blkaddr = rvu_get_next_nix_blkaddr(rvu, nix_blkaddr);
+               i++;
+       }
        return NULL;
 }
 
@@ -187,8 +213,8 @@ static bool is_valid_txschq(struct rvu *rvu, int blkaddr,
 static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf)
 {
        struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
+       int pkind, pf, vf, lbkid;
        u8 cgx_id, lmac_id;
-       int pkind, pf, vf;
        int err;
 
        pf = rvu_get_pf(pcifunc);
@@ -221,13 +247,24 @@ static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf)
        case NIX_INTF_TYPE_LBK:
                vf = (pcifunc & RVU_PFVF_FUNC_MASK) - 1;
 
+               /* If NIX1 block is present on the silicon then NIXes are
+                * assigned alternatively for lbk interfaces. NIX0 should
+                * send packets on lbk link 1 channels and NIX1 should send
+                * on lbk link 0 channels for the communication between
+                * NIX0 and NIX1.
+                */
+               lbkid = 0;
+               if (rvu->hw->lbk_links > 1)
+                       lbkid = vf & 0x1 ? 0 : 1;
+
                /* Note that AF's VFs work in pairs and talk over consecutive
                 * loopback channels.Therefore if odd number of AF VFs are
                 * enabled then the last VF remains with no pair.
                 */
-               pfvf->rx_chan_base = NIX_CHAN_LBK_CHX(0, vf);
-               pfvf->tx_chan_base = vf & 0x1 ? NIX_CHAN_LBK_CHX(0, vf - 1) :
-                                               NIX_CHAN_LBK_CHX(0, vf + 1);
+               pfvf->rx_chan_base = NIX_CHAN_LBK_CHX(lbkid, vf);
+               pfvf->tx_chan_base = vf & 0x1 ?
+                                       NIX_CHAN_LBK_CHX(lbkid, vf - 1) :
+                                       NIX_CHAN_LBK_CHX(lbkid, vf + 1);
                pfvf->rx_chan_cnt = 1;
                pfvf->tx_chan_cnt = 1;
                rvu_npc_install_promisc_entry(rvu, pcifunc, nixlf,
@@ -612,8 +649,9 @@ static int nix_aq_enqueue_wait(struct rvu *rvu, struct rvu_block *block,
        return 0;
 }
 
-static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req,
-                              struct nix_aq_enq_rsp *rsp)
+static int rvu_nix_blk_aq_enq_inst(struct rvu *rvu, struct nix_hw *nix_hw,
+                                  struct nix_aq_enq_req *req,
+                                  struct nix_aq_enq_rsp *rsp)
 {
        struct rvu_hwinfo *hw = rvu->hw;
        u16 pcifunc = req->hdr.pcifunc;
@@ -626,10 +664,7 @@ static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req,
        bool ena;
        u64 cfg;
 
-       blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
-       if (blkaddr < 0)
-               return NIX_AF_ERR_AF_LF_INVALID;
-
+       blkaddr = nix_hw->blkaddr;
        block = &hw->block[blkaddr];
        aq = block->aq;
        if (!aq) {
@@ -669,8 +704,9 @@ static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req,
                break;
        case NIX_AQ_CTYPE_MCE:
                cfg = rvu_read64(rvu, blkaddr, NIX_AF_RX_MCAST_CFG);
+
                /* Check if index exceeds MCE list length */
-               if (!hw->nix0->mcast.mce_ctx ||
+               if (!nix_hw->mcast.mce_ctx ||
                    (req->qidx >= (256UL << (cfg & 0xF))))
                        rc = NIX_AF_ERR_AQ_ENQUEUE;
 
@@ -832,6 +868,23 @@ static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req,
        return 0;
 }
 
+static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req,
+                              struct nix_aq_enq_rsp *rsp)
+{
+       struct nix_hw *nix_hw;
+       int blkaddr;
+
+       blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, req->hdr.pcifunc);
+       if (blkaddr < 0)
+               return NIX_AF_ERR_AF_LF_INVALID;
+
+       nix_hw =  get_nix_hw(rvu->hw, blkaddr);
+       if (!nix_hw)
+               return -EINVAL;
+
+       return rvu_nix_blk_aq_enq_inst(rvu, nix_hw, req, rsp);
+}
+
 static const char *nix_get_ctx_name(int ctype)
 {
        switch (ctype) {
@@ -1164,6 +1217,10 @@ exit:
        cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST2);
        rsp->qints = ((cfg >> 12) & 0xFFF);
        rsp->cints = ((cfg >> 24) & 0xFFF);
+       rsp->cgx_links = hw->cgx_links;
+       rsp->lbk_links = hw->lbk_links;
+       rsp->sdp_links = hw->sdp_links;
+
        return rc;
 }
 
@@ -1950,8 +2007,8 @@ int rvu_mbox_handler_nix_vtag_cfg(struct rvu *rvu,
        return 0;
 }
 
-static int nix_setup_mce(struct rvu *rvu, int mce, u8 op,
-                        u16 pcifunc, int next, bool eol)
+static int nix_blk_setup_mce(struct rvu *rvu, struct nix_hw *nix_hw,
+                            int mce, u8 op, u16 pcifunc, int next, bool eol)
 {
        struct nix_aq_enq_req aq_req;
        int err;
@@ -1971,7 +2028,7 @@ static int nix_setup_mce(struct rvu *rvu, int mce, u8 op,
        /* All fields valid */
        *(u64 *)(&aq_req.mce_mask) = ~0ULL;
 
-       err = rvu_nix_aq_enq_inst(rvu, &aq_req, NULL);
+       err = rvu_nix_blk_aq_enq_inst(rvu, nix_hw, &aq_req, NULL);
        if (err) {
                dev_err(rvu->dev, "Failed to setup Bcast MCE for PF%d:VF%d\n",
                        rvu_get_pf(pcifunc), pcifunc & RVU_PFVF_FUNC_MASK);
@@ -2077,9 +2134,9 @@ int nix_update_bcast_mce_list(struct rvu *rvu, u16 pcifunc, bool add)
 
                next_idx = idx + 1;
                /* EOL should be set in last MCE */
-               err = nix_setup_mce(rvu, idx, NIX_AQ_INSTOP_WRITE,
-                                   mce->pcifunc, next_idx,
-                                   (next_idx > last_idx) ? true : false);
+               err = nix_blk_setup_mce(rvu, nix_hw, idx, NIX_AQ_INSTOP_WRITE,
+                                       mce->pcifunc, next_idx,
+                                       (next_idx > last_idx) ? true : false);
                if (err)
                        goto end;
                idx++;
@@ -2108,6 +2165,11 @@ static int nix_setup_bcast_tables(struct rvu *rvu, struct nix_hw *nix_hw)
                numvfs = (cfg >> 12) & 0xFF;
 
                pfvf = &rvu->pf[pf];
+
+               /* This NIX0/1 block mapped to PF ? */
+               if (pfvf->nix_blkaddr != nix_hw->blkaddr)
+                       continue;
+
                /* Save the start MCE */
                pfvf->bcast_mce_idx = nix_alloc_mce_list(mcast, numvfs + 1);
 
@@ -2122,9 +2184,10 @@ static int nix_setup_bcast_tables(struct rvu *rvu, struct nix_hw *nix_hw)
                         * Will be updated when a NIXLF is attached/detached to
                         * these PF/VFs.
                         */
-                       err = nix_setup_mce(rvu, pfvf->bcast_mce_idx + idx,
-                                           NIX_AQ_INSTOP_INIT,
-                                           pcifunc, 0, true);
+                       err = nix_blk_setup_mce(rvu, nix_hw,
+                                               pfvf->bcast_mce_idx + idx,
+                                               NIX_AQ_INSTOP_INIT,
+                                               pcifunc, 0, true);
                        if (err)
                                return err;
                }
@@ -3109,17 +3172,15 @@ static int nix_aq_init(struct rvu *rvu, struct rvu_block *block)
        return 0;
 }
 
-int rvu_nix_init(struct rvu *rvu)
+static int rvu_nix_block_init(struct rvu *rvu, struct nix_hw *nix_hw)
 {
        const struct npc_lt_def_cfg *ltdefs;
        struct rvu_hwinfo *hw = rvu->hw;
+       int blkaddr = nix_hw->blkaddr;
        struct rvu_block *block;
-       int blkaddr, err;
+       int err;
        u64 cfg;
 
-       blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, 0);
-       if (blkaddr < 0)
-               return 0;
        block = &hw->block[blkaddr];
 
        if (is_rvu_96xx_B0(rvu)) {
@@ -3153,7 +3214,7 @@ int rvu_nix_init(struct rvu *rvu)
        hw->cgx = (cfg >> 12) & 0xF;
        hw->lmac_per_cgx = (cfg >> 8) & 0xF;
        hw->cgx_links = hw->cgx * hw->lmac_per_cgx;
-       hw->lbk_links = 1;
+       hw->lbk_links = (cfg >> 24) & 0xF;
        hw->sdp_links = 1;
 
        /* Initialize admin queue */
@@ -3164,26 +3225,21 @@ int rvu_nix_init(struct rvu *rvu)
        /* Restore CINT timer delay to HW reset values */
        rvu_write64(rvu, blkaddr, NIX_AF_CINT_DELAY, 0x0ULL);
 
-       if (blkaddr == BLKADDR_NIX0) {
-               hw->nix0 = devm_kzalloc(rvu->dev,
-                                       sizeof(struct nix_hw), GFP_KERNEL);
-               if (!hw->nix0)
-                       return -ENOMEM;
-
-               err = nix_setup_txschq(rvu, hw->nix0, blkaddr);
+       if (is_block_implemented(hw, blkaddr)) {
+               err = nix_setup_txschq(rvu, nix_hw, blkaddr);
                if (err)
                        return err;
 
-               err = nix_af_mark_format_setup(rvu, hw->nix0, blkaddr);
+               err = nix_af_mark_format_setup(rvu, nix_hw, blkaddr);
                if (err)
                        return err;
 
-               err = nix_setup_mcast(rvu, hw->nix0, blkaddr);
+               err = nix_setup_mcast(rvu, nix_hw, blkaddr);
                if (err)
                        return err;
 
                /* Configure segmentation offload formats */
-               nix_setup_lso(rvu, hw->nix0, blkaddr);
+               nix_setup_lso(rvu, nix_hw, blkaddr);
 
                /* Config Outer/Inner L2, IP, TCP, UDP and SCTP NPC layer info.
                 * This helps HW protocol checker to identify headers
@@ -3236,23 +3292,44 @@ int rvu_nix_init(struct rvu *rvu)
        return 0;
 }
 
-void rvu_nix_freemem(struct rvu *rvu)
+int rvu_nix_init(struct rvu *rvu)
 {
        struct rvu_hwinfo *hw = rvu->hw;
-       struct rvu_block *block;
+       struct nix_hw *nix_hw;
+       int blkaddr = 0, err;
+       int i = 0;
+
+       hw->nix = devm_kcalloc(rvu->dev, MAX_NIX_BLKS, sizeof(struct nix_hw),
+                              GFP_KERNEL);
+       if (!hw->nix)
+               return -ENOMEM;
+
+       blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr);
+       while (blkaddr) {
+               nix_hw = &hw->nix[i];
+               nix_hw->rvu = rvu;
+               nix_hw->blkaddr = blkaddr;
+               err = rvu_nix_block_init(rvu, nix_hw);
+               if (err)
+                       return err;
+               blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr);
+               i++;
+       }
+
+       return 0;
+}
+
+static void rvu_nix_block_freemem(struct rvu *rvu, int blkaddr,
+                                 struct rvu_block *block)
+{
        struct nix_txsch *txsch;
        struct nix_mcast *mcast;
        struct nix_hw *nix_hw;
-       int blkaddr, lvl;
-
-       blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, 0);
-       if (blkaddr < 0)
-               return;
+       int lvl;
 
-       block = &hw->block[blkaddr];
        rvu_aq_free(rvu, block->aq);
 
-       if (blkaddr == BLKADDR_NIX0) {
+       if (is_block_implemented(rvu->hw, blkaddr)) {
                nix_hw = get_nix_hw(rvu->hw, blkaddr);
                if (!nix_hw)
                        return;
@@ -3269,6 +3346,20 @@ void rvu_nix_freemem(struct rvu *rvu)
        }
 }
 
+void rvu_nix_freemem(struct rvu *rvu)
+{
+       struct rvu_hwinfo *hw = rvu->hw;
+       struct rvu_block *block;
+       int blkaddr = 0;
+
+       blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr);
+       while (blkaddr) {
+               block = &hw->block[blkaddr];
+               rvu_nix_block_freemem(rvu, blkaddr, block);
+               blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr);
+       }
+}
+
 int rvu_mbox_handler_nix_lf_start_rx(struct rvu *rvu, struct msg_req *req,
                                     struct msg_rsp *rsp)
 {
index 511b01d..989533a 100644 (file)
@@ -36,6 +36,33 @@ static void npc_mcam_free_all_entries(struct rvu *rvu, struct npc_mcam *mcam,
 static void npc_mcam_free_all_counters(struct rvu *rvu, struct npc_mcam *mcam,
                                       u16 pcifunc);
 
+bool is_npc_intf_tx(u8 intf)
+{
+       return !!(intf & 0x1);
+}
+
+bool is_npc_intf_rx(u8 intf)
+{
+       return !(intf & 0x1);
+}
+
+bool is_npc_interface_valid(struct rvu *rvu, u8 intf)
+{
+       struct rvu_hwinfo *hw = rvu->hw;
+
+       return intf < hw->npc_intfs;
+}
+
+int rvu_npc_get_tx_nibble_cfg(struct rvu *rvu, u64 nibble_ena)
+{
+       /* Due to a HW issue in these silicon versions, parse nibble enable
+        * configuration has to be identical for both Rx and Tx interfaces.
+        */
+       if (is_rvu_96xx_B0(rvu))
+               return nibble_ena;
+       return 0;
+}
+
 void rvu_npc_set_pkind(struct rvu *rvu, int pkind, struct rvu_pfvf *pfvf)
 {
        int blkaddr;
@@ -94,6 +121,31 @@ int npc_config_ts_kpuaction(struct rvu *rvu, int pf, u16 pcifunc, bool enable)
        return 0;
 }
 
+static int npc_get_ucast_mcam_index(struct npc_mcam *mcam, u16 pcifunc,
+                                   int nixlf)
+{
+       struct rvu_hwinfo *hw = container_of(mcam, struct rvu_hwinfo, mcam);
+       struct rvu *rvu = hw->rvu;
+       int blkaddr = 0, max = 0;
+       struct rvu_block *block;
+       struct rvu_pfvf *pfvf;
+
+       pfvf = rvu_get_pfvf(rvu, pcifunc);
+       /* Given a PF/VF and NIX LF number calculate the unicast mcam
+        * entry index based on the NIX block assigned to the PF/VF.
+        */
+       blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr);
+       while (blkaddr) {
+               if (pfvf->nix_blkaddr == blkaddr)
+                       break;
+               block = &rvu->hw->block[blkaddr];
+               max += block->lf.max;
+               blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr);
+       }
+
+       return mcam->nixlf_offset + (max + nixlf) * RSVD_MCAM_ENTRIES_PER_NIXLF;
+}
+
 static int npc_get_nixlf_mcam_index(struct npc_mcam *mcam,
                                    u16 pcifunc, int nixlf, int type)
 {
@@ -114,7 +166,7 @@ static int npc_get_nixlf_mcam_index(struct npc_mcam *mcam,
                        return index + 1;
        }
 
-       return (mcam->nixlf_offset + (nixlf * RSVD_MCAM_ENTRIES_PER_NIXLF));
+       return npc_get_ucast_mcam_index(mcam, pcifunc, nixlf);
 }
 
 static int npc_get_bank(struct npc_mcam *mcam, int index)
@@ -413,7 +465,7 @@ void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc,
 
        entry.action = *(u64 *)&action;
        npc_config_mcam_entry(rvu, mcam, blkaddr, index,
-                             NIX_INTF_RX, &entry, true);
+                             pfvf->nix_rx_intf, &entry, true);
 
        /* add VLAN matching, setup action and save entry back for later */
        entry.kw[0] |= (NPC_LT_LB_STAG_QINQ | NPC_LT_LB_CTAG) << 20;
@@ -430,6 +482,7 @@ void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc,
 void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
                                   int nixlf, u64 chan, bool allmulti)
 {
+       struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
        struct npc_mcam *mcam = &rvu->hw->mcam;
        int blkaddr, ucast_idx, index, kwi;
        struct mcam_entry entry = { {0} };
@@ -473,7 +526,7 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
 
        entry.action = *(u64 *)&action;
        npc_config_mcam_entry(rvu, mcam, blkaddr, index,
-                             NIX_INTF_RX, &entry, true);
+                             pfvf->nix_rx_intf, &entry, true);
 }
 
 static void npc_enadis_promisc_entry(struct rvu *rvu, u16 pcifunc,
@@ -531,6 +584,7 @@ void rvu_npc_install_bcast_match_entry(struct rvu *rvu, u16 pcifunc,
 
        /* Get 'pcifunc' of PF device */
        pcifunc = pcifunc & ~RVU_PFVF_FUNC_MASK;
+       pfvf = rvu_get_pfvf(rvu, pcifunc);
        index = npc_get_nixlf_mcam_index(mcam, pcifunc,
                                         nixlf, NIXLF_BCAST_ENTRY);
 
@@ -553,14 +607,13 @@ void rvu_npc_install_bcast_match_entry(struct rvu *rvu, u16 pcifunc,
                action.op = NIX_RX_ACTIONOP_UCAST;
                action.pf_func = pcifunc;
        } else {
-               pfvf = rvu_get_pfvf(rvu, pcifunc);
                action.index = pfvf->bcast_mce_idx;
                action.op = NIX_RX_ACTIONOP_MCAST;
        }
 
        entry.action = *(u64 *)&action;
        npc_config_mcam_entry(rvu, mcam, blkaddr, index,
-                             NIX_INTF_RX, &entry, true);
+                             pfvf->nix_rx_intf, &entry, true);
 }
 
 void rvu_npc_enable_bcast_entry(struct rvu *rvu, u16 pcifunc, bool enable)
@@ -732,44 +785,78 @@ void rvu_npc_disable_mcam_entries(struct rvu *rvu, u16 pcifunc, int nixlf)
        rvu_write64(rvu, blkaddr,                       \
                NPC_AF_INTFX_LDATAX_FLAGSX_CFG(intf, ld, flags), cfg)
 
-static void npc_program_mkex_profile(struct rvu *rvu, int blkaddr,
-                                    const struct npc_mcam_kex *mkex)
+static void npc_program_mkex_rx(struct rvu *rvu, int blkaddr,
+                               struct npc_mcam_kex *mkex, u8 intf)
 {
        int lid, lt, ld, fl;
 
-       rvu_write64(rvu, blkaddr, NPC_AF_INTFX_KEX_CFG(NIX_INTF_RX),
-                   mkex->keyx_cfg[NIX_INTF_RX]);
-       rvu_write64(rvu, blkaddr, NPC_AF_INTFX_KEX_CFG(NIX_INTF_TX),
-                   mkex->keyx_cfg[NIX_INTF_TX]);
+       if (is_npc_intf_tx(intf))
+               return;
 
-       for (ld = 0; ld < NPC_MAX_LD; ld++)
-               rvu_write64(rvu, blkaddr, NPC_AF_KEX_LDATAX_FLAGS_CFG(ld),
-                           mkex->kex_ld_flags[ld]);
+       rvu_write64(rvu, blkaddr, NPC_AF_INTFX_KEX_CFG(intf),
+                   mkex->keyx_cfg[NIX_INTF_RX]);
 
+       /* Program LDATA */
        for (lid = 0; lid < NPC_MAX_LID; lid++) {
                for (lt = 0; lt < NPC_MAX_LT; lt++) {
-                       for (ld = 0; ld < NPC_MAX_LD; ld++) {
-                               SET_KEX_LD(NIX_INTF_RX, lid, lt, ld,
+                       for (ld = 0; ld < NPC_MAX_LD; ld++)
+                               SET_KEX_LD(intf, lid, lt, ld,
                                           mkex->intf_lid_lt_ld[NIX_INTF_RX]
                                           [lid][lt][ld]);
-
-                               SET_KEX_LD(NIX_INTF_TX, lid, lt, ld,
-                                          mkex->intf_lid_lt_ld[NIX_INTF_TX]
-                                          [lid][lt][ld]);
-                       }
                }
        }
-
+       /* Program LFLAGS */
        for (ld = 0; ld < NPC_MAX_LD; ld++) {
-               for (fl = 0; fl < NPC_MAX_LFL; fl++) {
-                       SET_KEX_LDFLAGS(NIX_INTF_RX, ld, fl,
+               for (fl = 0; fl < NPC_MAX_LFL; fl++)
+                       SET_KEX_LDFLAGS(intf, ld, fl,
                                        mkex->intf_ld_flags[NIX_INTF_RX]
                                        [ld][fl]);
+       }
+}
+
+static void npc_program_mkex_tx(struct rvu *rvu, int blkaddr,
+                               struct npc_mcam_kex *mkex, u8 intf)
+{
+       int lid, lt, ld, fl;
 
-                       SET_KEX_LDFLAGS(NIX_INTF_TX, ld, fl,
+       if (is_npc_intf_rx(intf))
+               return;
+
+       rvu_write64(rvu, blkaddr, NPC_AF_INTFX_KEX_CFG(intf),
+                   mkex->keyx_cfg[NIX_INTF_TX]);
+
+       /* Program LDATA */
+       for (lid = 0; lid < NPC_MAX_LID; lid++) {
+               for (lt = 0; lt < NPC_MAX_LT; lt++) {
+                       for (ld = 0; ld < NPC_MAX_LD; ld++)
+                               SET_KEX_LD(intf, lid, lt, ld,
+                                          mkex->intf_lid_lt_ld[NIX_INTF_TX]
+                                          [lid][lt][ld]);
+               }
+       }
+       /* Program LFLAGS */
+       for (ld = 0; ld < NPC_MAX_LD; ld++) {
+               for (fl = 0; fl < NPC_MAX_LFL; fl++)
+                       SET_KEX_LDFLAGS(intf, ld, fl,
                                        mkex->intf_ld_flags[NIX_INTF_TX]
                                        [ld][fl]);
-               }
+       }
+}
+
+static void npc_program_mkex_profile(struct rvu *rvu, int blkaddr,
+                                    struct npc_mcam_kex *mkex)
+{
+       struct rvu_hwinfo *hw = rvu->hw;
+       u8 intf;
+       int ld;
+
+       for (ld = 0; ld < NPC_MAX_LD; ld++)
+               rvu_write64(rvu, blkaddr, NPC_AF_KEX_LDATAX_FLAGS_CFG(ld),
+                           mkex->kex_ld_flags[ld]);
+
+       for (intf = 0; intf < hw->npc_intfs; intf++) {
+               npc_program_mkex_rx(rvu, blkaddr, mkex, intf);
+               npc_program_mkex_tx(rvu, blkaddr, mkex, intf);
        }
 }
 
@@ -909,7 +996,7 @@ static void npc_program_kpu_profile(struct rvu *rvu, int blkaddr, int kpu,
                        kpu, profile->cam_entries, profile->action_entries);
        }
 
-       max_entries = rvu_read64(rvu, blkaddr, NPC_AF_CONST1) & 0xFFF;
+       max_entries = rvu->hw->npc_kpu_entries;
 
        /* Program CAM match entries for previous KPU extracted data */
        num_entries = min_t(int, profile->cam_entries, max_entries);
@@ -964,9 +1051,6 @@ static void npc_parser_profile_init(struct rvu *rvu, int blkaddr)
        int num_pkinds, num_kpus, idx;
        struct npc_pkind *pkind;
 
-       /* Get HW limits */
-       hw->npc_kpus = (rvu_read64(rvu, blkaddr, NPC_AF_CONST) >> 8) & 0x1F;
-
        /* Disable all KPUs and their entries */
        for (idx = 0; idx < hw->npc_kpus; idx++) {
                rvu_write64(rvu, blkaddr,
@@ -1005,12 +1089,6 @@ static int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr)
        int rsvd, err;
        u64 cfg;
 
-       /* Get HW limits */
-       cfg = rvu_read64(rvu, blkaddr, NPC_AF_CONST);
-       mcam->banks = (cfg >> 44) & 0xF;
-       mcam->banksize = (cfg >> 28) & 0xFFFF;
-       mcam->counters.max = (cfg >> 48) & 0xFFFF;
-
        /* Actual number of MCAM entries vary by entry size */
        cfg = (rvu_read64(rvu, blkaddr,
                          NPC_AF_INTFX_KEX_CFG(0)) >> 32) & 0x07;
@@ -1077,12 +1155,6 @@ static int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr)
        mcam->hprio_count = mcam->lprio_count;
        mcam->hprio_end = mcam->hprio_count;
 
-       /* Reserve last counter for MCAM RX miss action which is set to
-        * drop pkt. This way we will know how many pkts didn't match
-        * any MCAM entry.
-        */
-       mcam->counters.max--;
-       mcam->rx_miss_act_cntr = mcam->counters.max;
 
        /* Allocate bitmap for managing MCAM counters and memory
         * for saving counter to RVU PFFUNC allocation mapping.
@@ -1118,12 +1190,110 @@ free_mem:
        return -ENOMEM;
 }
 
+static void rvu_npc_hw_init(struct rvu *rvu, int blkaddr)
+{
+       struct npc_pkind *pkind = &rvu->hw->pkind;
+       struct npc_mcam *mcam = &rvu->hw->mcam;
+       struct rvu_hwinfo *hw = rvu->hw;
+       u64 npc_const, npc_const1;
+       u64 npc_const2 = 0;
+
+       npc_const = rvu_read64(rvu, blkaddr, NPC_AF_CONST);
+       npc_const1 = rvu_read64(rvu, blkaddr, NPC_AF_CONST1);
+       if (npc_const1 & BIT_ULL(63))
+               npc_const2 = rvu_read64(rvu, blkaddr, NPC_AF_CONST2);
+
+       pkind->rsrc.max = (npc_const1 >> 12) & 0xFFULL;
+       hw->npc_kpu_entries = npc_const1 & 0xFFFULL;
+       hw->npc_kpus = (npc_const >> 8) & 0x1FULL;
+       hw->npc_intfs = npc_const & 0xFULL;
+       hw->npc_counters = (npc_const >> 48) & 0xFFFFULL;
+
+       mcam->banks = (npc_const >> 44) & 0xFULL;
+       mcam->banksize = (npc_const >> 28) & 0xFFFFULL;
+       /* Extended set */
+       if (npc_const2) {
+               hw->npc_ext_set = true;
+               hw->npc_counters = (npc_const2 >> 16) & 0xFFFFULL;
+               mcam->banksize = npc_const2 & 0xFFFFULL;
+       }
+
+       mcam->counters.max = hw->npc_counters;
+}
+
+static void rvu_npc_setup_interfaces(struct rvu *rvu, int blkaddr)
+{
+       struct npc_mcam *mcam = &rvu->hw->mcam;
+       struct rvu_hwinfo *hw = rvu->hw;
+       u64 nibble_ena, rx_kex, tx_kex;
+       u8 intf;
+
+       /* Reserve last counter for MCAM RX miss action which is set to
+        * drop packet. This way we will know how many pkts didn't match
+        * any MCAM entry.
+        */
+       mcam->counters.max--;
+       mcam->rx_miss_act_cntr = mcam->counters.max;
+
+       rx_kex = npc_mkex_default.keyx_cfg[NIX_INTF_RX];
+       tx_kex = npc_mkex_default.keyx_cfg[NIX_INTF_TX];
+       nibble_ena = FIELD_GET(NPC_PARSE_NIBBLE, rx_kex);
+
+       nibble_ena = rvu_npc_get_tx_nibble_cfg(rvu, nibble_ena);
+       if (nibble_ena) {
+               tx_kex &= ~NPC_PARSE_NIBBLE;
+               tx_kex |= FIELD_PREP(NPC_PARSE_NIBBLE, nibble_ena);
+               npc_mkex_default.keyx_cfg[NIX_INTF_TX] = tx_kex;
+       }
+
+       /* Configure RX interfaces */
+       for (intf = 0; intf < hw->npc_intfs; intf++) {
+               if (is_npc_intf_tx(intf))
+                       continue;
+
+               /* Set RX MCAM search key size. LA..LE (ltype only) + Channel */
+               rvu_write64(rvu, blkaddr, NPC_AF_INTFX_KEX_CFG(intf),
+                           rx_kex);
+
+               /* If MCAM lookup doesn't result in a match, drop the received
+                * packet. And map this action to a counter to count dropped
+                * packets.
+                */
+               rvu_write64(rvu, blkaddr,
+                           NPC_AF_INTFX_MISS_ACT(intf), NIX_RX_ACTIONOP_DROP);
+
+               /* NPC_AF_INTFX_MISS_STAT_ACT[14:12] - counter[11:9]
+                * NPC_AF_INTFX_MISS_STAT_ACT[8:0] - counter[8:0]
+                */
+               rvu_write64(rvu, blkaddr,
+                           NPC_AF_INTFX_MISS_STAT_ACT(intf),
+                           ((mcam->rx_miss_act_cntr >> 9) << 12) |
+                           BIT_ULL(9) | mcam->rx_miss_act_cntr);
+       }
+
+       /* Configure TX interfaces */
+       for (intf = 0; intf < hw->npc_intfs; intf++) {
+               if (is_npc_intf_rx(intf))
+                       continue;
+
+               /* Extract Ltypes LID_LA to LID_LE */
+               rvu_write64(rvu, blkaddr, NPC_AF_INTFX_KEX_CFG(intf),
+                           tx_kex);
+
+               /* Set TX miss action to UCAST_DEFAULT i.e
+                * transmit the packet on NIX LF SQ's default channel.
+                */
+               rvu_write64(rvu, blkaddr,
+                           NPC_AF_INTFX_MISS_ACT(intf),
+                           NIX_TX_ACTIONOP_UCAST_DEFAULT);
+       }
+}
+
 int rvu_npc_init(struct rvu *rvu)
 {
        struct npc_kpu_profile_adapter *kpu = &rvu->kpu;
        struct npc_pkind *pkind = &rvu->hw->pkind;
        struct npc_mcam *mcam = &rvu->hw->mcam;
-       u64 cfg, nibble_ena, rx_kex, tx_kex;
        int blkaddr, entry, bank, err;
 
        blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
@@ -1132,17 +1302,15 @@ int rvu_npc_init(struct rvu *rvu)
                return -ENODEV;
        }
 
+       rvu_npc_hw_init(rvu, blkaddr);
+
        /* First disable all MCAM entries, to stop traffic towards NIXLFs */
-       cfg = rvu_read64(rvu, blkaddr, NPC_AF_CONST);
-       for (bank = 0; bank < ((cfg >> 44) & 0xF); bank++) {
-               for (entry = 0; entry < ((cfg >> 28) & 0xFFFF); entry++)
+       for (bank = 0; bank < mcam->banks; bank++) {
+               for (entry = 0; entry < mcam->banksize; entry++)
                        rvu_write64(rvu, blkaddr,
                                    NPC_AF_MCAMEX_BANKX_CFG(entry, bank), 0);
        }
 
-       /* Allocate resource bimap for pkind*/
-       pkind->rsrc.max = (rvu_read64(rvu, blkaddr,
-                                     NPC_AF_CONST1) >> 12) & 0xFF;
        err = rvu_alloc_bitmap(&pkind->rsrc);
        if (err)
                return err;
@@ -1180,21 +1348,7 @@ int rvu_npc_init(struct rvu *rvu)
                    BIT_ULL(32) | BIT_ULL(24) | BIT_ULL(6) |
                    BIT_ULL(2) | BIT_ULL(1));
 
-       /* Set RX and TX side MCAM search key size.
-        * LA..LD (ltype only) + Channel
-        */
-       rx_kex = npc_mkex_default.keyx_cfg[NIX_INTF_RX];
-       tx_kex = npc_mkex_default.keyx_cfg[NIX_INTF_TX];
-       nibble_ena = FIELD_GET(NPC_PARSE_NIBBLE, rx_kex);
-       rvu_write64(rvu, blkaddr, NPC_AF_INTFX_KEX_CFG(NIX_INTF_RX), rx_kex);
-       /* Due to an errata (35786) in A0 pass silicon, parse nibble enable
-        * configuration has to be identical for both Rx and Tx interfaces.
-        */
-       if (is_rvu_96xx_B0(rvu)) {
-               tx_kex &= ~NPC_PARSE_NIBBLE;
-               tx_kex |= FIELD_PREP(NPC_PARSE_NIBBLE, nibble_ena);
-       }
-       rvu_write64(rvu, blkaddr, NPC_AF_INTFX_KEX_CFG(NIX_INTF_TX), tx_kex);
+       rvu_npc_setup_interfaces(rvu, blkaddr);
 
        err = npc_mcam_rsrcs_init(rvu, blkaddr);
        if (err)
@@ -1203,20 +1357,6 @@ int rvu_npc_init(struct rvu *rvu)
        /* Configure MKEX profile */
        npc_load_mkex_profile(rvu, blkaddr, rvu->mkex_pfl_name);
 
-       /* Set TX miss action to UCAST_DEFAULT i.e
-        * transmit the packet on NIX LF SQ's default channel.
-        */
-       rvu_write64(rvu, blkaddr, NPC_AF_INTFX_MISS_ACT(NIX_INTF_TX),
-                   NIX_TX_ACTIONOP_UCAST_DEFAULT);
-
-       /* If MCAM lookup doesn't result in a match, drop the received packet.
-        * And map this action to a counter to count dropped pkts.
-        */
-       rvu_write64(rvu, blkaddr, NPC_AF_INTFX_MISS_ACT(NIX_INTF_RX),
-                   NIX_RX_ACTIONOP_DROP);
-       rvu_write64(rvu, blkaddr, NPC_AF_INTFX_MISS_STAT_ACT(NIX_INTF_RX),
-                   BIT_ULL(9) | mcam->rx_miss_act_cntr);
-
        return 0;
 }
 
@@ -1307,10 +1447,13 @@ static void npc_map_mcam_entry_and_cntr(struct rvu *rvu, struct npc_mcam *mcam,
        /* Set mapping and increment counter's refcnt */
        mcam->entry2cntr_map[entry] = cntr;
        mcam->cntr_refcnt[cntr]++;
-       /* Enable stats */
+       /* Enable stats
+        * NPC_AF_MCAMEX_BANKX_STAT_ACT[14:12] - counter[11:9]
+        * NPC_AF_MCAMEX_BANKX_STAT_ACT[8:0] - counter[8:0]
+        */
        rvu_write64(rvu, blkaddr,
                    NPC_AF_MCAMEX_BANKX_STAT_ACT(index, bank),
-                   BIT_ULL(9) | cntr);
+                   ((cntr >> 9) << 12) | BIT_ULL(9) | cntr);
 }
 
 static void npc_unmap_mcam_entry_and_cntr(struct rvu *rvu,
@@ -1789,9 +1932,11 @@ int rvu_mbox_handler_npc_mcam_write_entry(struct rvu *rvu,
                                          struct npc_mcam_write_entry_req *req,
                                          struct msg_rsp *rsp)
 {
+       struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, req->hdr.pcifunc);
        struct npc_mcam *mcam = &rvu->hw->mcam;
        u16 pcifunc = req->hdr.pcifunc;
        int blkaddr, rc;
+       u8 nix_intf;
 
        blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
        if (blkaddr < 0)
@@ -1808,12 +1953,17 @@ int rvu_mbox_handler_npc_mcam_write_entry(struct rvu *rvu,
                goto exit;
        }
 
-       if (req->intf != NIX_INTF_RX && req->intf != NIX_INTF_TX) {
+       if (!is_npc_interface_valid(rvu, req->intf)) {
                rc = NPC_MCAM_INVALID_REQ;
                goto exit;
        }
 
-       npc_config_mcam_entry(rvu, mcam, blkaddr, req->entry, req->intf,
+       if (is_npc_intf_tx(req->intf))
+               nix_intf = pfvf->nix_tx_intf;
+       else
+               nix_intf = pfvf->nix_rx_intf;
+
+       npc_config_mcam_entry(rvu, mcam, blkaddr, req->entry, nix_intf,
                              &req->entry_data, req->enable_entry);
 
        if (req->set_cntr)
@@ -2141,6 +2291,7 @@ int rvu_mbox_handler_npc_mcam_alloc_and_write_entry(struct rvu *rvu,
                          struct npc_mcam_alloc_and_write_entry_req *req,
                          struct npc_mcam_alloc_and_write_entry_rsp *rsp)
 {
+       struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, req->hdr.pcifunc);
        struct npc_mcam_alloc_counter_req cntr_req;
        struct npc_mcam_alloc_counter_rsp cntr_rsp;
        struct npc_mcam_alloc_entry_req entry_req;
@@ -2149,12 +2300,13 @@ int rvu_mbox_handler_npc_mcam_alloc_and_write_entry(struct rvu *rvu,
        u16 entry = NPC_MCAM_ENTRY_INVALID;
        u16 cntr = NPC_MCAM_ENTRY_INVALID;
        int blkaddr, rc;
+       u8 nix_intf;
 
        blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
        if (blkaddr < 0)
                return NPC_MCAM_INVALID_REQ;
 
-       if (req->intf != NIX_INTF_RX && req->intf != NIX_INTF_TX)
+       if (!is_npc_interface_valid(rvu, req->intf))
                return NPC_MCAM_INVALID_REQ;
 
        /* Try to allocate a MCAM entry */
@@ -2196,7 +2348,13 @@ int rvu_mbox_handler_npc_mcam_alloc_and_write_entry(struct rvu *rvu,
 
 write_entry:
        mutex_lock(&mcam->lock);
-       npc_config_mcam_entry(rvu, mcam, blkaddr, entry, req->intf,
+
+       if (is_npc_intf_tx(req->intf))
+               nix_intf = pfvf->nix_tx_intf;
+       else
+               nix_intf = pfvf->nix_rx_intf;
+
+       npc_config_mcam_entry(rvu, mcam, blkaddr, entry, nix_intf,
                              &req->entry_data, req->enable_entry);
 
        if (req->alloc_cntr)
@@ -2274,7 +2432,7 @@ int rvu_npc_update_rxvlan(struct rvu *rvu, u16 pcifunc, int nixlf)
        pfvf->entry.action = npc_get_mcam_action(rvu, mcam, blkaddr, index);
        enable = is_mcam_entry_enabled(rvu, mcam, blkaddr, index);
        npc_config_mcam_entry(rvu, mcam, blkaddr, pfvf->rxvlan_index,
-                             NIX_INTF_RX, &pfvf->entry, enable);
+                             pfvf->nix_rx_intf, &pfvf->entry, enable);
 
        return 0;
 }
index 9d7c135..e266f0c 100644 (file)
@@ -35,7 +35,7 @@ static struct hw_reg_map txsch_reg_map[NIX_TXSCH_LVL_CNT] = {
                              {0x1200, 0x12E0} } },
        {NIX_TXSCH_LVL_TL3, 3, 0xFFFF, {{0x1000, 0x10E0}, {0x1600, 0x1608},
                              {0x1610, 0x1618} } },
-       {NIX_TXSCH_LVL_TL2, 2, 0xFFFF, {{0x0E00, 0x0EE0}, {0x1700, 0x1768} } },
+       {NIX_TXSCH_LVL_TL2, 2, 0xFFFF, {{0x0E00, 0x0EE0}, {0x1700, 0x17B0} } },
        {NIX_TXSCH_LVL_TL1, 1, 0xFFFF, {{0x0C00, 0x0D98} } },
 };
 
index 7ca599b..1f3379f 100644 (file)
 #define RVU_PRIV_PFX_MSIX_CFG(a)            (0x8000110 | (a) << 16)
 #define RVU_PRIV_PFX_ID_CFG(a)              (0x8000120 | (a) << 16)
 #define RVU_PRIV_PFX_INT_CFG(a)             (0x8000200 | (a) << 16)
-#define RVU_PRIV_PFX_NIX0_CFG               (0x8000300)
+#define RVU_PRIV_PFX_NIXX_CFG(a)            (0x8000300 | (a) << 3)
 #define RVU_PRIV_PFX_NPA_CFG               (0x8000310)
 #define RVU_PRIV_PFX_SSO_CFG                (0x8000320)
 #define RVU_PRIV_PFX_SSOW_CFG               (0x8000330)
 #define RVU_PRIV_PFX_TIM_CFG                (0x8000340)
-#define RVU_PRIV_PFX_CPT0_CFG               (0x8000350)
+#define RVU_PRIV_PFX_CPTX_CFG(a)            (0x8000350 | (a) << 3)
 #define RVU_PRIV_BLOCK_TYPEX_REV(a)         (0x8000400 | (a) << 3)
 #define RVU_PRIV_HWVFX_INT_CFG(a)           (0x8001280 | (a) << 16)
-#define RVU_PRIV_HWVFX_NIX0_CFG             (0x8001300)
+#define RVU_PRIV_HWVFX_NIXX_CFG(a)          (0x8001300 | (a) << 3)
 #define RVU_PRIV_HWVFX_NPA_CFG              (0x8001310)
 #define RVU_PRIV_HWVFX_SSO_CFG              (0x8001320)
 #define RVU_PRIV_HWVFX_SSOW_CFG             (0x8001330)
 #define RVU_PRIV_HWVFX_TIM_CFG              (0x8001340)
-#define RVU_PRIV_HWVFX_CPT0_CFG             (0x8001350)
+#define RVU_PRIV_HWVFX_CPTX_CFG(a)          (0x8001350 | (a) << 3)
 
 /* RVU PF registers */
 #define        RVU_PF_VFX_PFVF_MBOX0               (0x00000)
 #define NPC_AF_BLK_RST                 (0x00040)
 #define NPC_AF_MCAM_SCRUB_CTL          (0x000a0)
 #define NPC_AF_KCAM_SCRUB_CTL          (0x000b0)
+#define NPC_AF_CONST2                  (0x00100)
+#define NPC_AF_CONST3                  (0x00110)
 #define NPC_AF_KPUX_CFG(a)             (0x00500 | (a) << 3)
 #define NPC_AF_PCK_CFG                 (0x00600)
 #define NPC_AF_PCK_DEF_OL2             (0x00610)
                (0x900000 | (a) << 16 | (b) << 12 | (c) << 5 | (d) << 3)
 #define NPC_AF_INTFX_LDATAX_FLAGSX_CFG(a, b, c) \
                (0x980000 | (a) << 16 | (b) << 12 | (c) << 3)
-#define NPC_AF_MCAMEX_BANKX_CAMX_INTF(a, b, c)       \
-               (0x1000000ull | (a) << 10 | (b) << 6 | (c) << 3)
-#define NPC_AF_MCAMEX_BANKX_CAMX_W0(a, b, c)         \
-               (0x1000010ull | (a) << 10 | (b) << 6 | (c) << 3)
-#define NPC_AF_MCAMEX_BANKX_CAMX_W1(a, b, c)         \
-               (0x1000020ull | (a) << 10 | (b) << 6 | (c) << 3)
-#define NPC_AF_MCAMEX_BANKX_CFG(a, b)   (0x1800000ull | (a) << 8 | (b) << 4)
-#define NPC_AF_MCAMEX_BANKX_STAT_ACT(a, b) \
-               (0x1880000 | (a) << 8 | (b) << 4)
-#define NPC_AF_MATCH_STATX(a)          (0x1880008 | (a) << 8)
 #define NPC_AF_INTFX_MISS_STAT_ACT(a)  (0x1880040 + (a) * 0x8)
-#define NPC_AF_MCAMEX_BANKX_ACTION(a, b) (0x1900000ull | (a) << 8 | (b) << 4)
-#define NPC_AF_MCAMEX_BANKX_TAG_ACT(a, b) \
-               (0x1900008 | (a) << 8 | (b) << 4)
 #define NPC_AF_INTFX_MISS_ACT(a)       (0x1a00000 | (a) << 4)
 #define NPC_AF_INTFX_MISS_TAG_ACT(a)   (0x1b00008 | (a) << 4)
 #define NPC_AF_MCAM_BANKX_HITX(a, b)   (0x1c80000 | (a) << 8 | (b) << 4)
 #define NPC_AF_DBG_DATAX(a)            (0x3001400 | (a) << 4)
 #define NPC_AF_DBG_RESULTX(a)          (0x3001800 | (a) << 4)
 
+#define NPC_AF_MCAMEX_BANKX_CAMX_INTF(a, b, c) ({                         \
+       u64 offset;                                                        \
+                                                                          \
+       offset = (0x1000000ull | (a) << 10 | (b) << 6 | (c) << 3);         \
+       if (rvu->hw->npc_ext_set)                                          \
+               offset = (0x8000000ull | (a) << 8 | (b) << 22 | (c) << 3); \
+       offset; })
+
+#define NPC_AF_MCAMEX_BANKX_CAMX_W0(a, b, c) ({                                   \
+       u64 offset;                                                        \
+                                                                          \
+       offset = (0x1000010ull | (a) << 10 | (b) << 6 | (c) << 3);         \
+       if (rvu->hw->npc_ext_set)                                          \
+               offset = (0x8000010ull | (a) << 8 | (b) << 22 | (c) << 3); \
+       offset; })
+
+#define NPC_AF_MCAMEX_BANKX_CAMX_W1(a, b, c) ({                                   \
+       u64 offset;                                                        \
+                                                                          \
+       offset = (0x1000020ull | (a) << 10 | (b) << 6 | (c) << 3);         \
+       if (rvu->hw->npc_ext_set)                                          \
+               offset = (0x8000020ull | (a) << 8 | (b) << 22 | (c) << 3); \
+       offset; })
+
+#define NPC_AF_MCAMEX_BANKX_CFG(a, b) ({                                  \
+       u64 offset;                                                        \
+                                                                          \
+       offset = (0x1800000ull | (a) << 8 | (b) << 4);                     \
+       if (rvu->hw->npc_ext_set)                                          \
+               offset = (0x8000038ull | (a) << 8 | (b) << 22);            \
+       offset; })
+
+#define NPC_AF_MCAMEX_BANKX_ACTION(a, b) ({                               \
+       u64 offset;                                                        \
+                                                                          \
+       offset = (0x1900000ull | (a) << 8 | (b) << 4);                     \
+       if (rvu->hw->npc_ext_set)                                          \
+               offset = (0x8000040ull | (a) << 8 | (b) << 22);            \
+       offset; })                                                         \
+
+#define NPC_AF_MCAMEX_BANKX_TAG_ACT(a, b) ({                              \
+       u64 offset;                                                        \
+                                                                          \
+       offset = (0x1900008ull | (a) << 8 | (b) << 4);                     \
+       if (rvu->hw->npc_ext_set)                                          \
+               offset = (0x8000048ull | (a) << 8 | (b) << 22);            \
+       offset; })                                                         \
+
+#define NPC_AF_MCAMEX_BANKX_STAT_ACT(a, b) ({                             \
+       u64 offset;                                                        \
+                                                                          \
+       offset = (0x1880000ull | (a) << 8 | (b) << 4);                     \
+       if (rvu->hw->npc_ext_set)                                          \
+               offset = (0x8000050ull | (a) << 8 | (b) << 22);            \
+       offset; })                                                         \
+
+#define NPC_AF_MATCH_STATX(a) ({                                          \
+       u64 offset;                                                        \
+                                                                          \
+       offset = (0x1880008ull | (a) << 8);                                \
+       if (rvu->hw->npc_ext_set)                                          \
+               offset = (0x8000078ull | (a) << 8);                        \
+       offset; })                                                         \
+
 /* NDC */
 #define NDC_AF_CONST                   (0x00000)
 #define NDC_AF_CLK_EN                  (0x00020)
index a3ecb5d..9a7eb07 100644 (file)
@@ -14,6 +14,8 @@
 /* RVU Block revision IDs */
 #define RVU_BLK_RVUM_REVID             0x01
 
+#define RVU_MULTI_BLK_VER              0x7ULL
+
 /* RVU Block Address Enumeration */
 enum rvu_block_addr_e {
        BLKADDR_RVUM            = 0x0ULL,
@@ -31,7 +33,9 @@ enum rvu_block_addr_e {
        BLKADDR_NDC_NIX0_RX     = 0xcULL,
        BLKADDR_NDC_NIX0_TX     = 0xdULL,
        BLKADDR_NDC_NPA0        = 0xeULL,
-       BLK_COUNT               = 0xfULL,
+       BLKADDR_NDC_NIX1_RX     = 0x10ULL,
+       BLKADDR_NDC_NIX1_TX     = 0x11ULL,
+       BLK_COUNT               = 0x12ULL,
 };
 
 /* RVU Block Type Enumeration */
index d258109..9f3d671 100644 (file)
@@ -531,8 +531,10 @@ static int otx2_get_link(struct otx2_nic *pfvf)
                link = 4 * ((map >> 8) & 0xF) + ((map >> 4) & 0xF);
        }
        /* LBK channel */
-       if (pfvf->hw.tx_chan_base < SDP_CHAN_BASE)
-               link = 12;
+       if (pfvf->hw.tx_chan_base < SDP_CHAN_BASE) {
+               map = pfvf->hw.tx_chan_base & 0x7FF;
+               link = pfvf->hw.cgx_links | ((map >> 8) & 0xF);
+       }
 
        return link;
 }
@@ -1237,7 +1239,7 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf)
 
                sq = &qset->sq[qidx];
                sq->sqb_count = 0;
-               sq->sqb_ptrs = kcalloc(num_sqbs, sizeof(u64 *), GFP_KERNEL);
+               sq->sqb_ptrs = kcalloc(num_sqbs, sizeof(*sq->sqb_ptrs), GFP_KERNEL);
                if (!sq->sqb_ptrs)
                        return -ENOMEM;
 
@@ -1503,6 +1505,8 @@ void mbox_handler_nix_lf_alloc(struct otx2_nic *pfvf,
        pfvf->hw.tx_chan_base = rsp->tx_chan_base;
        pfvf->hw.lso_tsov4_idx = rsp->lso_tsov4_idx;
        pfvf->hw.lso_tsov6_idx = rsp->lso_tsov6_idx;
+       pfvf->hw.cgx_links = rsp->cgx_links;
+       pfvf->hw.lbk_links = rsp->lbk_links;
 }
 EXPORT_SYMBOL(mbox_handler_nix_lf_alloc);
 
index d6253f2..386cb08 100644 (file)
@@ -197,6 +197,8 @@ struct otx2_hw {
        struct otx2_drv_stats   drv_stats;
        u64                     cgx_rx_stats[CGX_RX_STATS_COUNT];
        u64                     cgx_tx_stats[CGX_TX_STATS_COUNT];
+       u8                      cgx_links;  /* No. of CGX links present in HW */
+       u8                      lbk_links;  /* No. of LBK links present in HW */
 };
 
 struct otx2_vf_config {
index b1fcc44..b6f20e2 100644 (file)
@@ -6,6 +6,7 @@
 config PRESTERA
        tristate "Marvell Prestera Switch ASICs support"
        depends on NET_SWITCHDEV && VLAN_8021Q
+       depends on BRIDGE || BRIDGE=n
        select NET_DEVLINK
        help
          This driver supports Marvell Prestera Switch ASICs family.
index 25981a7..ebe1406 100644 (file)
@@ -4900,7 +4900,7 @@ static const char *sky2_name(u8 chipid, char *buf, int sz)
        };
 
        if (chipid >= CHIP_ID_YUKON_XL && chipid <= CHIP_ID_YUKON_OP_2)
-               strncpy(buf, name[chipid - CHIP_ID_YUKON_XL], sz);
+               snprintf(buf, sz, "%s", name[chipid - CHIP_ID_YUKON_XL]);
        else
                snprintf(buf, sz, "(chip %#x)", chipid);
        return buf;
index 502d1b9..b0f79a5 100644 (file)
@@ -684,7 +684,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
        xdp_prog = rcu_dereference(ring->xdp_prog);
        xdp.rxq = &ring->xdp_rxq;
        xdp.frame_sz = priv->frag_info[0].frag_stride;
-       doorbell_pending = 0;
+       doorbell_pending = false;
 
        /* We assume a 1:1 mapping between CQEs and Rx descriptors, so Rx
         * descriptor offset can be deduced from the CQE index instead of
index 5829975..954b86f 100644 (file)
@@ -135,7 +135,7 @@ int mlx4_SET_VPORT_QOS_get(struct mlx4_dev *dev, u8 port, u8 vport,
  * @dev: mlx4_dev.
  * @port: Physical port number.
  * @vport: Vport id.
- * @out_param: Array of mlx4_vport_qos_param which holds the requested values.
+ * @in_param: Array of mlx4_vport_qos_param which holds the requested values.
  *
  * Returns 0 on success or a negative mlx4_core errno code.
  **/
index 1187ef1..394f43a 100644 (file)
@@ -300,7 +300,7 @@ static const char *resource_str(enum mlx4_resource rt)
        case RES_FS_RULE: return "RES_FS_RULE";
        case RES_XRCD: return "RES_XRCD";
        default: return "Unknown resource type !!!";
-       };
+       }
 }
 
 static void rem_slave_vlans(struct mlx4_dev *dev, int slave);
index 2d477f9..83a67ca 100644 (file)
@@ -81,7 +81,7 @@ mlx5_core-$(CONFIG_MLX5_EN_TLS) += en_accel/tls.o en_accel/tls_rxtx.o en_accel/t
 
 mlx5_core-$(CONFIG_MLX5_SW_STEERING) += steering/dr_domain.o steering/dr_table.o \
                                        steering/dr_matcher.o steering/dr_rule.o \
-                                       steering/dr_icm_pool.o \
+                                       steering/dr_icm_pool.o steering/dr_buddy.o \
                                        steering/dr_ste.o steering/dr_send.o \
                                        steering/dr_cmd.o steering/dr_fw.o \
                                        steering/dr_action.o steering/fs_dr.o
index 38e4f19..43271a3 100644 (file)
@@ -2,6 +2,8 @@
 /* Copyright (c) 2019 Mellanox Technologies. */
 
 #include "en/params.h"
+#include "en/txrx.h"
+#include "en_accel/tls_rxtx.h"
 
 static inline bool mlx5e_rx_is_xdp(struct mlx5e_params *params,
                                   struct mlx5e_xsk_param *xsk)
@@ -152,3 +154,35 @@ u16 mlx5e_get_rq_headroom(struct mlx5_core_dev *mdev,
 
        return is_linear_skb ? mlx5e_get_linear_rq_headroom(params, xsk) : 0;
 }
+
+u16 mlx5e_calc_sq_stop_room(struct mlx5_core_dev *mdev, struct mlx5e_params *params)
+{
+       bool is_mpwqe = MLX5E_GET_PFLAG(params, MLX5E_PFLAG_SKB_TX_MPWQE);
+       u16 stop_room;
+
+       stop_room  = mlx5e_tls_get_stop_room(mdev, params);
+       stop_room += mlx5e_stop_room_for_wqe(MLX5_SEND_WQE_MAX_WQEBBS);
+       if (is_mpwqe)
+               /* A MPWQE can take up to the maximum-sized WQE + all the normal
+                * stop room can be taken if a new packet breaks the active
+                * MPWQE session and allocates its WQEs right away.
+                */
+               stop_room += mlx5e_stop_room_for_wqe(MLX5_SEND_WQE_MAX_WQEBBS);
+
+       return stop_room;
+}
+
+int mlx5e_validate_params(struct mlx5e_priv *priv, struct mlx5e_params *params)
+{
+       size_t sq_size = 1 << params->log_sq_size;
+       u16 stop_room;
+
+       stop_room = mlx5e_calc_sq_stop_room(priv->mdev, params);
+       if (stop_room >= sq_size) {
+               netdev_err(priv->netdev, "Stop room %hu is bigger than the SQ size %zu\n",
+                          stop_room, sq_size);
+               return -EINVAL;
+       }
+
+       return 0;
+}
index a87273e..187007a 100644 (file)
@@ -30,6 +30,7 @@ struct mlx5e_sq_param {
        u32                        sqc[MLX5_ST_SZ_DW(sqc)];
        struct mlx5_wq_param       wq;
        bool                       is_mpw;
+       u16                        stop_room;
 };
 
 struct mlx5e_channel_param {
@@ -124,4 +125,7 @@ void mlx5e_build_xdpsq_param(struct mlx5e_priv *priv,
                             struct mlx5e_params *params,
                             struct mlx5e_sq_param *param);
 
+u16 mlx5e_calc_sq_stop_room(struct mlx5_core_dev *mdev, struct mlx5e_params *params);
+int mlx5e_validate_params(struct mlx5e_priv *priv, struct mlx5e_params *params);
+
 #endif /* __MLX5_EN_PARAMS_H__ */
index e36e505..d29af7b 100644 (file)
@@ -107,12 +107,16 @@ void mlx5e_rep_update_flows(struct mlx5e_priv *priv,
                mlx5e_tc_encap_flows_del(priv, e, &flow_list);
 
        if (neigh_connected && !(e->flags & MLX5_ENCAP_ENTRY_VALID)) {
+               struct net_device *route_dev;
+
                ether_addr_copy(e->h_dest, ha);
                ether_addr_copy(eth->h_dest, ha);
                /* Update the encap source mac, in case that we delete
                 * the flows when encap source mac changed.
                 */
-               ether_addr_copy(eth->h_source, e->route_dev->dev_addr);
+               route_dev = __dev_get_by_index(dev_net(priv->netdev), e->route_dev_ifindex);
+               if (route_dev)
+                       ether_addr_copy(eth->h_source, route_dev->dev_addr);
 
                mlx5e_tc_encap_flows_add(priv, e, &flow_list);
        }
index 7cce85f..90930e5 100644 (file)
@@ -77,13 +77,13 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv,
        return 0;
 }
 
-static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
-                                  struct net_device *mirred_dev,
-                                  struct net_device **out_dev,
-                                  struct net_device **route_dev,
-                                  struct flowi4 *fl4,
-                                  struct neighbour **out_n,
-                                  u8 *out_ttl)
+static int mlx5e_route_lookup_ipv4_get(struct mlx5e_priv *priv,
+                                      struct net_device *mirred_dev,
+                                      struct net_device **out_dev,
+                                      struct net_device **route_dev,
+                                      struct flowi4 *fl4,
+                                      struct neighbour **out_n,
+                                      u8 *out_ttl)
 {
        struct neighbour *n;
        struct rtable *rt;
@@ -117,18 +117,28 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
                ip_rt_put(rt);
                return ret;
        }
+       dev_hold(*route_dev);
 
        if (!(*out_ttl))
                *out_ttl = ip4_dst_hoplimit(&rt->dst);
        n = dst_neigh_lookup(&rt->dst, &fl4->daddr);
        ip_rt_put(rt);
-       if (!n)
+       if (!n) {
+               dev_put(*route_dev);
                return -ENOMEM;
+       }
 
        *out_n = n;
        return 0;
 }
 
+static void mlx5e_route_lookup_ipv4_put(struct net_device *route_dev,
+                                       struct neighbour *n)
+{
+       neigh_release(n);
+       dev_put(route_dev);
+}
+
 static const char *mlx5e_netdev_kind(struct net_device *dev)
 {
        if (dev->rtnl_link_ops)
@@ -193,8 +203,8 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
        fl4.saddr = tun_key->u.ipv4.src;
        ttl = tun_key->ttl;
 
-       err = mlx5e_route_lookup_ipv4(priv, mirred_dev, &out_dev, &route_dev,
-                                     &fl4, &n, &ttl);
+       err = mlx5e_route_lookup_ipv4_get(priv, mirred_dev, &out_dev, &route_dev,
+                                         &fl4, &n, &ttl);
        if (err)
                return err;
 
@@ -223,7 +233,7 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
        e->m_neigh.family = n->ops->family;
        memcpy(&e->m_neigh.dst_ip, n->primary_key, n->tbl->key_len);
        e->out_dev = out_dev;
-       e->route_dev = route_dev;
+       e->route_dev_ifindex = route_dev->ifindex;
 
        /* It's important to add the neigh to the hash table before checking
         * the neigh validity state. So if we'll get a notification, in case the
@@ -278,7 +288,7 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
 
        e->flags |= MLX5_ENCAP_ENTRY_VALID;
        mlx5e_rep_queue_neigh_stats_work(netdev_priv(out_dev));
-       neigh_release(n);
+       mlx5e_route_lookup_ipv4_put(route_dev, n);
        return err;
 
 destroy_neigh_entry:
@@ -286,18 +296,18 @@ destroy_neigh_entry:
 free_encap:
        kfree(encap_header);
 release_neigh:
-       neigh_release(n);
+       mlx5e_route_lookup_ipv4_put(route_dev, n);
        return err;
 }
 
 #if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6)
-static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv,
-                                  struct net_device *mirred_dev,
-                                  struct net_device **out_dev,
-                                  struct net_device **route_dev,
-                                  struct flowi6 *fl6,
-                                  struct neighbour **out_n,
-                                  u8 *out_ttl)
+static int mlx5e_route_lookup_ipv6_get(struct mlx5e_priv *priv,
+                                      struct net_device *mirred_dev,
+                                      struct net_device **out_dev,
+                                      struct net_device **route_dev,
+                                      struct flowi6 *fl6,
+                                      struct neighbour **out_n,
+                                      u8 *out_ttl)
 {
        struct dst_entry *dst;
        struct neighbour *n;
@@ -318,15 +328,25 @@ static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv,
                return ret;
        }
 
+       dev_hold(*route_dev);
        n = dst_neigh_lookup(dst, &fl6->daddr);
        dst_release(dst);
-       if (!n)
+       if (!n) {
+               dev_put(*route_dev);
                return -ENOMEM;
+       }
 
        *out_n = n;
        return 0;
 }
 
+static void mlx5e_route_lookup_ipv6_put(struct net_device *route_dev,
+                                       struct neighbour *n)
+{
+       neigh_release(n);
+       dev_put(route_dev);
+}
+
 int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
                                    struct net_device *mirred_dev,
                                    struct mlx5e_encap_entry *e)
@@ -348,8 +368,8 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
        fl6.daddr = tun_key->u.ipv6.dst;
        fl6.saddr = tun_key->u.ipv6.src;
 
-       err = mlx5e_route_lookup_ipv6(priv, mirred_dev, &out_dev, &route_dev,
-                                     &fl6, &n, &ttl);
+       err = mlx5e_route_lookup_ipv6_get(priv, mirred_dev, &out_dev, &route_dev,
+                                         &fl6, &n, &ttl);
        if (err)
                return err;
 
@@ -378,7 +398,7 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
        e->m_neigh.family = n->ops->family;
        memcpy(&e->m_neigh.dst_ip, n->primary_key, n->tbl->key_len);
        e->out_dev = out_dev;
-       e->route_dev = route_dev;
+       e->route_dev_ifindex = route_dev->ifindex;
 
        /* It's importent to add the neigh to the hash table before checking
         * the neigh validity state. So if we'll get a notification, in case the
@@ -433,7 +453,7 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
 
        e->flags |= MLX5_ENCAP_ENTRY_VALID;
        mlx5e_rep_queue_neigh_stats_work(netdev_priv(out_dev));
-       neigh_release(n);
+       mlx5e_route_lookup_ipv6_put(route_dev, n);
        return err;
 
 destroy_neigh_entry:
@@ -441,7 +461,7 @@ destroy_neigh_entry:
 free_encap:
        kfree(encap_header);
 release_neigh:
-       neigh_release(n);
+       mlx5e_route_lookup_ipv6_put(route_dev, n);
        return err;
 }
 #endif
index 4e574ac..be3465b 100644 (file)
@@ -122,9 +122,9 @@ void mlx5e_activate_xsk(struct mlx5e_channel *c)
        set_bit(MLX5E_RQ_STATE_ENABLED, &c->xskrq.state);
        /* TX queue is created active. */
 
-       spin_lock(&c->async_icosq_lock);
+       spin_lock_bh(&c->async_icosq_lock);
        mlx5e_trigger_irq(&c->async_icosq);
-       spin_unlock(&c->async_icosq_lock);
+       spin_unlock_bh(&c->async_icosq_lock);
 }
 
 void mlx5e_deactivate_xsk(struct mlx5e_channel *c)
index fb671a4..8e96260 100644 (file)
@@ -36,9 +36,9 @@ int mlx5e_xsk_wakeup(struct net_device *dev, u32 qid, u32 flags)
                if (test_and_set_bit(MLX5E_SQ_STATE_PENDING_XSK_TX, &c->async_icosq.state))
                        return 0;
 
-               spin_lock(&c->async_icosq_lock);
+               spin_lock_bh(&c->async_icosq_lock);
                mlx5e_trigger_irq(&c->async_icosq);
-               spin_unlock(&c->async_icosq_lock);
+               spin_unlock_bh(&c->async_icosq_lock);
        }
 
        return 0;
index ccaccb9..7f6221b 100644 (file)
@@ -188,7 +188,7 @@ static int post_rx_param_wqes(struct mlx5e_channel *c,
 
        err = 0;
        sq = &c->async_icosq;
-       spin_lock(&c->async_icosq_lock);
+       spin_lock_bh(&c->async_icosq_lock);
 
        cseg = post_static_params(sq, priv_rx);
        if (IS_ERR(cseg))
@@ -199,7 +199,7 @@ static int post_rx_param_wqes(struct mlx5e_channel *c,
 
        mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, cseg);
 unlock:
-       spin_unlock(&c->async_icosq_lock);
+       spin_unlock_bh(&c->async_icosq_lock);
 
        return err;
 
@@ -265,10 +265,10 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq,
 
        BUILD_BUG_ON(MLX5E_KTLS_GET_PROGRESS_WQEBBS != 1);
 
-       spin_lock(&sq->channel->async_icosq_lock);
+       spin_lock_bh(&sq->channel->async_icosq_lock);
 
        if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, 1))) {
-               spin_unlock(&sq->channel->async_icosq_lock);
+               spin_unlock_bh(&sq->channel->async_icosq_lock);
                err = -ENOSPC;
                goto err_dma_unmap;
        }
@@ -299,7 +299,7 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq,
        icosq_fill_wi(sq, pi, &wi);
        sq->pc++;
        mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, cseg);
-       spin_unlock(&sq->channel->async_icosq_lock);
+       spin_unlock_bh(&sq->channel->async_icosq_lock);
 
        return 0;
 
@@ -360,7 +360,7 @@ static int resync_handle_seq_match(struct mlx5e_ktls_offload_context_rx *priv_rx
        err = 0;
 
        sq = &c->async_icosq;
-       spin_lock(&c->async_icosq_lock);
+       spin_lock_bh(&c->async_icosq_lock);
 
        cseg = post_static_params(sq, priv_rx);
        if (IS_ERR(cseg)) {
@@ -372,7 +372,7 @@ static int resync_handle_seq_match(struct mlx5e_ktls_offload_context_rx *priv_rx
        mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, cseg);
        priv_rx->stats->tls_resync_res_ok++;
 unlock:
-       spin_unlock(&c->async_icosq_lock);
+       spin_unlock_bh(&c->async_icosq_lock);
 
        return err;
 }
index b140e13..d16def6 100644 (file)
@@ -13,20 +13,20 @@ struct mlx5e_dump_wqe {
        (DIV_ROUND_UP(sizeof(struct mlx5e_dump_wqe), MLX5_SEND_WQE_BB))
 
 static u8
-mlx5e_ktls_dumps_num_wqes(struct mlx5e_txqsq *sq, unsigned int nfrags,
+mlx5e_ktls_dumps_num_wqes(struct mlx5e_params *params, unsigned int nfrags,
                          unsigned int sync_len)
 {
        /* Given the MTU and sync_len, calculates an upper bound for the
         * number of DUMP WQEs needed for the TX resync of a record.
         */
-       return nfrags + DIV_ROUND_UP(sync_len, sq->hw_mtu);
+       return nfrags + DIV_ROUND_UP(sync_len, MLX5E_SW2HW_MTU(params, params->sw_mtu));
 }
 
-u16 mlx5e_ktls_get_stop_room(struct mlx5e_txqsq *sq)
+u16 mlx5e_ktls_get_stop_room(struct mlx5e_params *params)
 {
        u16 num_dumps, stop_room = 0;
 
-       num_dumps = mlx5e_ktls_dumps_num_wqes(sq, MAX_SKB_FRAGS, TLS_MAX_PAYLOAD_SIZE);
+       num_dumps = mlx5e_ktls_dumps_num_wqes(params, MAX_SKB_FRAGS, TLS_MAX_PAYLOAD_SIZE);
 
        stop_room += mlx5e_stop_room_for_wqe(MLX5E_TLS_SET_STATIC_PARAMS_WQEBBS);
        stop_room += mlx5e_stop_room_for_wqe(MLX5E_TLS_SET_PROGRESS_PARAMS_WQEBBS);
index 7521c9b..ee04e91 100644 (file)
@@ -14,7 +14,7 @@ struct mlx5e_accel_tx_tls_state {
        u32 tls_tisn;
 };
 
-u16 mlx5e_ktls_get_stop_room(struct mlx5e_txqsq *sq);
+u16 mlx5e_ktls_get_stop_room(struct mlx5e_params *params);
 
 bool mlx5e_ktls_handle_tx_skb(struct tls_context *tls_ctx, struct mlx5e_txqsq *sq,
                              struct sk_buff *skb, int datalen,
index 6982b19..f51c042 100644 (file)
@@ -385,15 +385,13 @@ void mlx5e_tls_handle_rx_skb_metadata(struct mlx5e_rq *rq, struct sk_buff *skb,
        *cqe_bcnt -= MLX5E_METADATA_ETHER_LEN;
 }
 
-u16 mlx5e_tls_get_stop_room(struct mlx5e_txqsq *sq)
+u16 mlx5e_tls_get_stop_room(struct mlx5_core_dev *mdev, struct mlx5e_params *params)
 {
-       struct mlx5_core_dev *mdev = sq->channel->mdev;
-
        if (!mlx5_accel_is_tls_device(mdev))
                return 0;
 
        if (mlx5_accel_is_ktls_device(mdev))
-               return mlx5e_ktls_get_stop_room(sq);
+               return mlx5e_ktls_get_stop_room(params);
 
        /* FPGA */
        /* Resync SKB. */
index 5f162ad..9923132 100644 (file)
@@ -43,7 +43,7 @@
 #include "en.h"
 #include "en/txrx.h"
 
-u16 mlx5e_tls_get_stop_room(struct mlx5e_txqsq *sq);
+u16 mlx5e_tls_get_stop_room(struct mlx5_core_dev *mdev, struct mlx5e_params *params);
 
 bool mlx5e_tls_handle_tx_skb(struct net_device *netdev, struct mlx5e_txqsq *sq,
                             struct sk_buff *skb, struct mlx5e_accel_tx_tls_state *state);
@@ -71,7 +71,7 @@ mlx5e_accel_is_tls(struct mlx5_cqe64 *cqe, struct sk_buff *skb) { return false;
 static inline void
 mlx5e_tls_handle_rx_skb(struct mlx5e_rq *rq, struct sk_buff *skb,
                        struct mlx5_cqe64 *cqe, u32 *cqe_bcnt) {}
-static inline u16 mlx5e_tls_get_stop_room(struct mlx5e_txqsq *sq)
+static inline u16 mlx5e_tls_get_stop_room(struct mlx5_core_dev *mdev, struct mlx5e_params *params)
 {
        return 0;
 }
index d25a56e..42e61dc 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "en.h"
 #include "en/port.h"
+#include "en/params.h"
 #include "en/xsk/pool.h"
 #include "lib/clock.h"
 
@@ -369,6 +370,10 @@ int mlx5e_ethtool_set_ringparam(struct mlx5e_priv *priv,
        new_channels.params.log_rq_mtu_frames = log_rq_size;
        new_channels.params.log_sq_size = log_sq_size;
 
+       err = mlx5e_validate_params(priv, &new_channels.params);
+       if (err)
+               goto unlock;
+
        if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
                priv->channels.params = new_channels.params;
                goto unlock;
index b3f02aa..527c5f1 100644 (file)
@@ -1121,28 +1121,6 @@ static int mlx5e_alloc_txqsq_db(struct mlx5e_txqsq *sq, int numa)
        return 0;
 }
 
-static int mlx5e_calc_sq_stop_room(struct mlx5e_txqsq *sq, u8 log_sq_size)
-{
-       int sq_size = 1 << log_sq_size;
-
-       sq->stop_room  = mlx5e_tls_get_stop_room(sq);
-       sq->stop_room += mlx5e_stop_room_for_wqe(MLX5_SEND_WQE_MAX_WQEBBS);
-       if (test_bit(MLX5E_SQ_STATE_MPWQE, &sq->state))
-               /* A MPWQE can take up to the maximum-sized WQE + all the normal
-                * stop room can be taken if a new packet breaks the active
-                * MPWQE session and allocates its WQEs right away.
-                */
-               sq->stop_room += mlx5e_stop_room_for_wqe(MLX5_SEND_WQE_MAX_WQEBBS);
-
-       if (WARN_ON(sq->stop_room >= sq_size)) {
-               netdev_err(sq->channel->netdev, "Stop room %hu is bigger than the SQ size %d\n",
-                          sq->stop_room, sq_size);
-               return -ENOSPC;
-       }
-
-       return 0;
-}
-
 static void mlx5e_tx_err_cqe_work(struct work_struct *recover_work);
 static int mlx5e_alloc_txqsq(struct mlx5e_channel *c,
                             int txq_ix,
@@ -1176,9 +1154,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c,
                set_bit(MLX5E_SQ_STATE_TLS, &sq->state);
        if (param->is_mpw)
                set_bit(MLX5E_SQ_STATE_MPWQE, &sq->state);
-       err = mlx5e_calc_sq_stop_room(sq, params->log_sq_size);
-       if (err)
-               return err;
+       sq->stop_room = param->stop_room;
 
        param->wq.db_numa_node = cpu_to_node(c->cpu);
        err = mlx5_wq_cyc_create(mdev, &param->wq, sqc_wq, wq, &sq->wq_ctrl);
@@ -2225,6 +2201,7 @@ static void mlx5e_build_sq_param(struct mlx5e_priv *priv,
        MLX5_SET(wq, wq, log_wq_sz, params->log_sq_size);
        MLX5_SET(sqc, sqc, allow_swp, allow_swp);
        param->is_mpw = MLX5E_GET_PFLAG(params, MLX5E_PFLAG_SKB_TX_MPWQE);
+       param->stop_room = mlx5e_calc_sq_stop_room(priv->mdev, params);
        mlx5e_build_tx_cq_param(priv, params, &param->cqp);
 }
 
@@ -3999,6 +3976,9 @@ int mlx5e_change_mtu(struct net_device *netdev, int new_mtu,
 
        new_channels.params = *params;
        new_channels.params.sw_mtu = new_mtu;
+       err = mlx5e_validate_params(priv, &new_channels.params);
+       if (err)
+               goto out;
 
        if (params->xdp_prog &&
            !mlx5e_rx_is_linear_skb(&new_channels.params, NULL)) {
@@ -5253,6 +5233,7 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv)
 
        mlx5e_disable_async_events(priv);
        mlx5_lag_remove(mdev);
+       mlx5_vxlan_reset_to_default(mdev->vxlan);
 }
 
 int mlx5e_update_nic_rx(struct mlx5e_priv *priv)
index 9020d14..8932c38 100644 (file)
@@ -186,7 +186,7 @@ struct mlx5e_encap_entry {
        unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
 
        struct net_device *out_dev;
-       struct net_device *route_dev;
+       int route_dev_ifindex;
        struct mlx5e_tc_tunnel *tunnel;
        int reformat_type;
        u8 flags;
index 599f5b5..6628a01 100644 (file)
@@ -1584,7 +1584,7 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
        } while ((++work_done < budget) && (cqe = mlx5_cqwq_get_cqe(cqwq)));
 
 out:
-       if (rq->xdp_prog)
+       if (rcu_access_pointer(rq->xdp_prog))
                mlx5e_xdp_rx_poll_complete(rq);
 
        mlx5_cqwq_update_db_record(cqwq);
index e3a968e..2e2fa04 100644 (file)
@@ -4658,6 +4658,7 @@ __mlx5e_add_fdb_flow(struct mlx5e_priv *priv,
        return flow;
 
 err_free:
+       dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts);
        mlx5e_flow_put(priv, flow);
 out:
        return ERR_PTR(err);
@@ -4802,6 +4803,7 @@ mlx5e_add_nic_flow(struct mlx5e_priv *priv,
        return 0;
 
 err_free:
+       dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts);
        mlx5e_flow_put(priv, flow);
 out:
        return err;
index 8ebfe78..4ea5d6d 100644 (file)
@@ -189,19 +189,21 @@ u32 mlx5_eq_poll_irq_disabled(struct mlx5_eq_comp *eq)
        return count_eqe;
 }
 
-static void mlx5_eq_async_int_lock(struct mlx5_eq_async *eq, unsigned long *flags)
+static void mlx5_eq_async_int_lock(struct mlx5_eq_async *eq, bool recovery,
+                                  unsigned long *flags)
        __acquires(&eq->lock)
 {
-       if (in_irq())
+       if (!recovery)
                spin_lock(&eq->lock);
        else
                spin_lock_irqsave(&eq->lock, *flags);
 }
 
-static void mlx5_eq_async_int_unlock(struct mlx5_eq_async *eq, unsigned long *flags)
+static void mlx5_eq_async_int_unlock(struct mlx5_eq_async *eq, bool recovery,
+                                    unsigned long *flags)
        __releases(&eq->lock)
 {
-       if (in_irq())
+       if (!recovery)
                spin_unlock(&eq->lock);
        else
                spin_unlock_irqrestore(&eq->lock, *flags);
@@ -223,11 +225,13 @@ static int mlx5_eq_async_int(struct notifier_block *nb,
        struct mlx5_eqe *eqe;
        unsigned long flags;
        int num_eqes = 0;
+       bool recovery;
 
        dev = eq->dev;
        eqt = dev->priv.eq_table;
 
-       mlx5_eq_async_int_lock(eq_async, &flags);
+       recovery = action == ASYNC_EQ_RECOVER;
+       mlx5_eq_async_int_lock(eq_async, recovery, &flags);
 
        eqe = next_eqe_sw(eq);
        if (!eqe)
@@ -249,9 +253,9 @@ static int mlx5_eq_async_int(struct notifier_block *nb,
 
 out:
        eq_update_ci(eq, 1);
-       mlx5_eq_async_int_unlock(eq_async, &flags);
+       mlx5_eq_async_int_unlock(eq_async, recovery, &flags);
 
-       return unlikely(action == ASYNC_EQ_RECOVER) ? num_eqes : 0;
+       return unlikely(recovery) ? num_eqes : 0;
 }
 
 void mlx5_cmd_eq_recover(struct mlx5_core_dev *dev)
index 6e6a9a5..e8e6294 100644 (file)
@@ -1902,8 +1902,6 @@ int mlx5_devlink_port_function_hw_addr_get(struct devlink *devlink,
                ether_addr_copy(hw_addr, vport->info.mac);
                *hw_addr_len = ETH_ALEN;
                err = 0;
-       } else {
-               NL_SET_ERR_MSG_MOD(extack, "Eswitch vport is disabled");
        }
        mutex_unlock(&esw->state_lock);
        return err;
index 656f96b..89ef592 100644 (file)
 /**
  * enum mlx5_fpga_access_type - Enumerated the different methods possible for
  * accessing the device memory address space
+ *
+ * @MLX5_FPGA_ACCESS_TYPE_I2C: Use the slow CX-FPGA I2C bus
+ * @MLX5_FPGA_ACCESS_TYPE_DONTCARE: Use the fastest available method
  */
 enum mlx5_fpga_access_type {
-       /** Use the slow CX-FPGA I2C bus */
        MLX5_FPGA_ACCESS_TYPE_I2C = 0x0,
-       /** Use the fastest available method */
        MLX5_FPGA_ACCESS_TYPE_DONTCARE = 0x0,
 };
 
@@ -113,6 +114,7 @@ struct mlx5_fpga_conn_attr {
         * subsequent receives.
         */
        void (*recv_cb)(void *cb_arg, struct mlx5_fpga_dma_buf *buf);
+       /** @cb_arg: A context to be passed to recv_cb callback */
        void *cb_arg;
 };
 
@@ -145,7 +147,7 @@ void mlx5_fpga_sbu_conn_destroy(struct mlx5_fpga_conn *conn);
 
 /**
  * mlx5_fpga_sbu_conn_sendmsg() - Queue the transmission of a packet
- * @fdev: An FPGA SBU connection
+ * @conn: An FPGA SBU connection
  * @buf: The packet buffer
  *
  * Queues a packet for transmission over an FPGA SBU connection.
index 1609183..325a5b0 100644 (file)
@@ -2010,10 +2010,11 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle)
        down_write_ref_node(&fte->node, false);
        for (i = handle->num_rules - 1; i >= 0; i--)
                tree_remove_node(&handle->rule[i]->node, true);
-       if (fte->modify_mask && fte->dests_size) {
-               modify_fte(fte);
+       if (fte->dests_size) {
+               if (fte->modify_mask)
+                       modify_fte(fte);
                up_write_ref_node(&fte->node, false);
-       } else {
+       } else if (list_empty(&fte->node.children)) {
                del_hw_fte(&fte->node);
                /* Avoid double call to del_hw_fte */
                fte->node.del_hw_func = NULL;
index d046db7..3a9fa62 100644 (file)
@@ -90,9 +90,4 @@ int mlx5_create_encryption_key(struct mlx5_core_dev *mdev,
                               u32 key_type, u32 *p_key_id);
 void mlx5_destroy_encryption_key(struct mlx5_core_dev *mdev, u32 key_id);
 
-static inline struct net *mlx5_core_net(struct mlx5_core_dev *dev)
-{
-       return devlink_net(priv_to_devlink(dev));
-}
-
 #endif
index 3315afe..3808440 100644 (file)
@@ -168,6 +168,17 @@ struct mlx5_vxlan *mlx5_vxlan_create(struct mlx5_core_dev *mdev)
 
 void mlx5_vxlan_destroy(struct mlx5_vxlan *vxlan)
 {
+       if (!mlx5_vxlan_allowed(vxlan))
+               return;
+
+       mlx5_vxlan_del_port(vxlan, IANA_VXLAN_UDP_PORT);
+       WARN_ON(!hash_empty(vxlan->htable));
+
+       kfree(vxlan);
+}
+
+void mlx5_vxlan_reset_to_default(struct mlx5_vxlan *vxlan)
+{
        struct mlx5_vxlan_port *vxlanp;
        struct hlist_node *tmp;
        int bkt;
@@ -175,12 +186,12 @@ void mlx5_vxlan_destroy(struct mlx5_vxlan *vxlan)
        if (!mlx5_vxlan_allowed(vxlan))
                return;
 
-       /* Lockless since we are the only hash table consumers*/
        hash_for_each_safe(vxlan->htable, bkt, tmp, vxlanp, hlist) {
-               hash_del(&vxlanp->hlist);
-               mlx5_vxlan_core_del_port_cmd(vxlan->mdev, vxlanp->udp_port);
-               kfree(vxlanp);
+               /* Don't delete default UDP port added by the HW.
+                * Remove only user configured ports
+                */
+               if (vxlanp->udp_port == IANA_VXLAN_UDP_PORT)
+                       continue;
+               mlx5_vxlan_del_port(vxlan, vxlanp->udp_port);
        }
-
-       kfree(vxlan);
 }
index ec76652..34ef662 100644 (file)
@@ -56,6 +56,7 @@ void mlx5_vxlan_destroy(struct mlx5_vxlan *vxlan);
 int mlx5_vxlan_add_port(struct mlx5_vxlan *vxlan, u16 port);
 int mlx5_vxlan_del_port(struct mlx5_vxlan *vxlan, u16 port);
 bool mlx5_vxlan_lookup_port(struct mlx5_vxlan *vxlan, u16 port);
+void mlx5_vxlan_reset_to_default(struct mlx5_vxlan *vxlan);
 #else
 static inline struct mlx5_vxlan*
 mlx5_vxlan_create(struct mlx5_core_dev *mdev) { return ERR_PTR(-EOPNOTSUPP); }
@@ -63,6 +64,7 @@ static inline void mlx5_vxlan_destroy(struct mlx5_vxlan *vxlan) { return; }
 static inline int mlx5_vxlan_add_port(struct mlx5_vxlan *vxlan, u16 port) { return -EOPNOTSUPP; }
 static inline int mlx5_vxlan_del_port(struct mlx5_vxlan *vxlan, u16 port) { return -EOPNOTSUPP; }
 static inline bool mlx5_vxlan_lookup_port(struct mlx5_vxlan *vxlan, u16 port) { return false; }
+static inline void mlx5_vxlan_reset_to_default(struct mlx5_vxlan *vxlan) { return; }
 #endif
 
 #endif /* __MLX5_VXLAN_H__ */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_buddy.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_buddy.c
new file mode 100644 (file)
index 0000000..7df11a0
--- /dev/null
@@ -0,0 +1,170 @@
+// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
+/* Copyright (c) 2004 Topspin Communications. All rights reserved.
+ * Copyright (c) 2005 - 2008 Mellanox Technologies. All rights reserved.
+ * Copyright (c) 2006 - 2007 Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
+ */
+
+#include "dr_types.h"
+
+int mlx5dr_buddy_init(struct mlx5dr_icm_buddy_mem *buddy,
+                     unsigned int max_order)
+{
+       int i;
+
+       buddy->max_order = max_order;
+
+       INIT_LIST_HEAD(&buddy->list_node);
+       INIT_LIST_HEAD(&buddy->used_list);
+       INIT_LIST_HEAD(&buddy->hot_list);
+
+       buddy->bitmap = kcalloc(buddy->max_order + 1,
+                               sizeof(*buddy->bitmap),
+                               GFP_KERNEL);
+       buddy->num_free = kcalloc(buddy->max_order + 1,
+                                 sizeof(*buddy->num_free),
+                                 GFP_KERNEL);
+
+       if (!buddy->bitmap || !buddy->num_free)
+               goto err_free_all;
+
+       /* Allocating max_order bitmaps, one for each order */
+
+       for (i = 0; i <= buddy->max_order; ++i) {
+               unsigned int size = 1 << (buddy->max_order - i);
+
+               buddy->bitmap[i] = bitmap_zalloc(size, GFP_KERNEL);
+               if (!buddy->bitmap[i])
+                       goto err_out_free_each_bit_per_order;
+       }
+
+       /* In the beginning, we have only one order that is available for
+        * use (the biggest one), so mark the first bit in both bitmaps.
+        */
+
+       bitmap_set(buddy->bitmap[buddy->max_order], 0, 1);
+
+       buddy->num_free[buddy->max_order] = 1;
+
+       return 0;
+
+err_out_free_each_bit_per_order:
+       for (i = 0; i <= buddy->max_order; ++i)
+               bitmap_free(buddy->bitmap[i]);
+
+err_free_all:
+       kfree(buddy->num_free);
+       kfree(buddy->bitmap);
+       return -ENOMEM;
+}
+
+void mlx5dr_buddy_cleanup(struct mlx5dr_icm_buddy_mem *buddy)
+{
+       int i;
+
+       list_del(&buddy->list_node);
+
+       for (i = 0; i <= buddy->max_order; ++i)
+               bitmap_free(buddy->bitmap[i]);
+
+       kfree(buddy->num_free);
+       kfree(buddy->bitmap);
+}
+
+static int dr_buddy_find_free_seg(struct mlx5dr_icm_buddy_mem *buddy,
+                                 unsigned int start_order,
+                                 unsigned int *segment,
+                                 unsigned int *order)
+{
+       unsigned int seg, order_iter, m;
+
+       for (order_iter = start_order;
+            order_iter <= buddy->max_order; ++order_iter) {
+               if (!buddy->num_free[order_iter])
+                       continue;
+
+               m = 1 << (buddy->max_order - order_iter);
+               seg = find_first_bit(buddy->bitmap[order_iter], m);
+
+               if (WARN(seg >= m,
+                        "ICM Buddy: failed finding free mem for order %d\n",
+                        order_iter))
+                       return -ENOMEM;
+
+               break;
+       }
+
+       if (order_iter > buddy->max_order)
+               return -ENOMEM;
+
+       *segment = seg;
+       *order = order_iter;
+       return 0;
+}
+
+/**
+ * mlx5dr_buddy_alloc_mem() - Update second level bitmap.
+ * @buddy: Buddy to update.
+ * @order: Order of the buddy to update.
+ * @segment: Segment number.
+ *
+ * This function finds the first area of the ICM memory managed by this buddy.
+ * It uses the data structures of the buddy system in order to find the first
+ * area of free place, starting from the current order till the maximum order
+ * in the system.
+ *
+ * Return: 0 when segment is set, non-zero error status otherwise.
+ *
+ * The function returns the location (segment) in the whole buddy ICM memory
+ * area - the index of the memory segment that is available for use.
+ */
+int mlx5dr_buddy_alloc_mem(struct mlx5dr_icm_buddy_mem *buddy,
+                          unsigned int order,
+                          unsigned int *segment)
+{
+       unsigned int seg, order_iter;
+       int err;
+
+       err = dr_buddy_find_free_seg(buddy, order, &seg, &order_iter);
+       if (err)
+               return err;
+
+       bitmap_clear(buddy->bitmap[order_iter], seg, 1);
+       --buddy->num_free[order_iter];
+
+       /* If we found free memory in some order that is bigger than the
+        * required order, we need to split every order between the required
+        * order and the order that we found into two parts, and mark accordingly.
+        */
+       while (order_iter > order) {
+               --order_iter;
+               seg <<= 1;
+               bitmap_set(buddy->bitmap[order_iter], seg ^ 1, 1);
+               ++buddy->num_free[order_iter];
+       }
+
+       seg <<= order;
+       *segment = seg;
+
+       return 0;
+}
+
+void mlx5dr_buddy_free_mem(struct mlx5dr_icm_buddy_mem *buddy,
+                          unsigned int seg, unsigned int order)
+{
+       seg >>= order;
+
+       /* Whenever a segment is free,
+        * the mem is added to the buddy that gave it.
+        */
+       while (test_bit(seg ^ 1, buddy->bitmap[order])) {
+               bitmap_clear(buddy->bitmap[order], seg ^ 1, 1);
+               --buddy->num_free[order];
+               seg >>= 1;
+               ++order;
+       }
+       bitmap_set(buddy->bitmap[order], seg, 1);
+
+       ++buddy->num_free[order];
+}
+
index 6bd34b2..ebc8790 100644 (file)
@@ -93,12 +93,12 @@ int mlx5dr_cmd_query_device(struct mlx5_core_dev *mdev,
        caps->gvmi              = MLX5_CAP_GEN(mdev, vhca_id);
        caps->flex_protocols    = MLX5_CAP_GEN(mdev, flex_parser_protocols);
 
-       if (mlx5dr_matcher_supp_flex_parser_icmp_v4(caps)) {
+       if (caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V4_ENABLED) {
                caps->flex_parser_id_icmp_dw0 = MLX5_CAP_GEN(mdev, flex_parser_id_icmp_dw0);
                caps->flex_parser_id_icmp_dw1 = MLX5_CAP_GEN(mdev, flex_parser_id_icmp_dw1);
        }
 
-       if (mlx5dr_matcher_supp_flex_parser_icmp_v6(caps)) {
+       if (caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V6_ENABLED) {
                caps->flex_parser_id_icmpv6_dw0 =
                        MLX5_CAP_GEN(mdev, flex_parser_id_icmpv6_dw0);
                caps->flex_parser_id_icmpv6_dw1 =
index cc33515..66c2476 100644 (file)
@@ -4,50 +4,16 @@
 #include "dr_types.h"
 
 #define DR_ICM_MODIFY_HDR_ALIGN_BASE 64
-#define DR_ICM_SYNC_THRESHOLD (64 * 1024 * 1024)
-
-struct mlx5dr_icm_pool;
-
-struct mlx5dr_icm_bucket {
-       struct mlx5dr_icm_pool *pool;
-
-       /* Chunks that aren't visible to HW not directly and not in cache */
-       struct list_head free_list;
-       unsigned int free_list_count;
-
-       /* Used chunks, HW may be accessing this memory */
-       struct list_head used_list;
-       unsigned int used_list_count;
-
-       /* HW may be accessing this memory but at some future,
-        * undetermined time, it might cease to do so. Before deciding to call
-        * sync_ste, this list is moved to sync_list
-        */
-       struct list_head hot_list;
-       unsigned int hot_list_count;
-
-       /* Pending sync list, entries from the hot list are moved to this list.
-        * sync_ste is executed and then sync_list is concatenated to the free list
-        */
-       struct list_head sync_list;
-       unsigned int sync_list_count;
-
-       u32 total_chunks;
-       u32 num_of_entries;
-       u32 entry_size;
-       /* protect the ICM bucket */
-       struct mutex mutex;
-};
+#define DR_ICM_SYNC_THRESHOLD_POOL (64 * 1024 * 1024)
 
 struct mlx5dr_icm_pool {
-       struct mlx5dr_icm_bucket *buckets;
        enum mlx5dr_icm_type icm_type;
        enum mlx5dr_icm_chunk_size max_log_chunk_sz;
-       enum mlx5dr_icm_chunk_size num_of_buckets;
-       struct list_head icm_mr_list;
-       /* protect the ICM MR list */
-       struct mutex mr_mutex;
        struct mlx5dr_domain *dmn;
+       /* memory management */
+       struct mutex mutex; /* protect the ICM pool and ICM buddy */
+       struct list_head buddy_mem_list;
+       u64 hot_memory_size;
 };
 
 struct mlx5dr_icm_dm {
@@ -58,13 +24,11 @@ struct mlx5dr_icm_dm {
 };
 
 struct mlx5dr_icm_mr {
-       struct mlx5dr_icm_pool *pool;
        struct mlx5_core_mkey mkey;
        struct mlx5dr_icm_dm dm;
-       size_t used_length;
+       struct mlx5dr_domain *dmn;
        size_t length;
        u64 icm_start_addr;
-       struct list_head mr_list;
 };
 
 static int dr_icm_create_dm_mkey(struct mlx5_core_dev *mdev,
@@ -107,8 +71,7 @@ dr_icm_pool_mr_create(struct mlx5dr_icm_pool *pool)
        if (!icm_mr)
                return NULL;
 
-       icm_mr->pool = pool;
-       INIT_LIST_HEAD(&icm_mr->mr_list);
+       icm_mr->dmn = pool->dmn;
 
        icm_mr->dm.length = mlx5dr_icm_pool_chunk_size_to_byte(pool->max_log_chunk_sz,
                                                               pool->icm_type);
@@ -150,8 +113,6 @@ dr_icm_pool_mr_create(struct mlx5dr_icm_pool *pool)
                goto free_mkey;
        }
 
-       list_add_tail(&icm_mr->mr_list, &pool->icm_mr_list);
-
        return icm_mr;
 
 free_mkey:
@@ -166,10 +127,9 @@ free_icm_mr:
 
 static void dr_icm_pool_mr_destroy(struct mlx5dr_icm_mr *icm_mr)
 {
-       struct mlx5_core_dev *mdev = icm_mr->pool->dmn->mdev;
+       struct mlx5_core_dev *mdev = icm_mr->dmn->mdev;
        struct mlx5dr_icm_dm *dm = &icm_mr->dm;
 
-       list_del(&icm_mr->mr_list);
        mlx5_core_destroy_mkey(mdev, &icm_mr->mkey);
        mlx5_dm_sw_icm_dealloc(mdev, dm->type, dm->length, 0,
                               dm->addr, dm->obj_id);
@@ -178,19 +138,17 @@ static void dr_icm_pool_mr_destroy(struct mlx5dr_icm_mr *icm_mr)
 
 static int dr_icm_chunk_ste_init(struct mlx5dr_icm_chunk *chunk)
 {
-       struct mlx5dr_icm_bucket *bucket = chunk->bucket;
-
-       chunk->ste_arr = kvzalloc(bucket->num_of_entries *
+       chunk->ste_arr = kvzalloc(chunk->num_of_entries *
                                  sizeof(chunk->ste_arr[0]), GFP_KERNEL);
        if (!chunk->ste_arr)
                return -ENOMEM;
 
-       chunk->hw_ste_arr = kvzalloc(bucket->num_of_entries *
+       chunk->hw_ste_arr = kvzalloc(chunk->num_of_entries *
                                     DR_STE_SIZE_REDUCED, GFP_KERNEL);
        if (!chunk->hw_ste_arr)
                goto out_free_ste_arr;
 
-       chunk->miss_list = kvmalloc(bucket->num_of_entries *
+       chunk->miss_list = kvmalloc(chunk->num_of_entries *
                                    sizeof(chunk->miss_list[0]), GFP_KERNEL);
        if (!chunk->miss_list)
                goto out_free_hw_ste_arr;
@@ -204,72 +162,6 @@ out_free_ste_arr:
        return -ENOMEM;
 }
 
-static int dr_icm_chunks_create(struct mlx5dr_icm_bucket *bucket)
-{
-       size_t mr_free_size, mr_req_size, mr_row_size;
-       struct mlx5dr_icm_pool *pool = bucket->pool;
-       struct mlx5dr_icm_mr *icm_mr = NULL;
-       struct mlx5dr_icm_chunk *chunk;
-       int i, err = 0;
-
-       mr_req_size = bucket->num_of_entries * bucket->entry_size;
-       mr_row_size = mlx5dr_icm_pool_chunk_size_to_byte(pool->max_log_chunk_sz,
-                                                        pool->icm_type);
-       mutex_lock(&pool->mr_mutex);
-       if (!list_empty(&pool->icm_mr_list)) {
-               icm_mr = list_last_entry(&pool->icm_mr_list,
-                                        struct mlx5dr_icm_mr, mr_list);
-
-               if (icm_mr)
-                       mr_free_size = icm_mr->dm.length - icm_mr->used_length;
-       }
-
-       if (!icm_mr || mr_free_size < mr_row_size) {
-               icm_mr = dr_icm_pool_mr_create(pool);
-               if (!icm_mr) {
-                       err = -ENOMEM;
-                       goto out_err;
-               }
-       }
-
-       /* Create memory aligned chunks */
-       for (i = 0; i < mr_row_size / mr_req_size; i++) {
-               chunk = kvzalloc(sizeof(*chunk), GFP_KERNEL);
-               if (!chunk) {
-                       err = -ENOMEM;
-                       goto out_err;
-               }
-
-               chunk->bucket = bucket;
-               chunk->rkey = icm_mr->mkey.key;
-               /* mr start addr is zero based */
-               chunk->mr_addr = icm_mr->used_length;
-               chunk->icm_addr = (uintptr_t)icm_mr->icm_start_addr + icm_mr->used_length;
-               icm_mr->used_length += mr_req_size;
-               chunk->num_of_entries = bucket->num_of_entries;
-               chunk->byte_size = chunk->num_of_entries * bucket->entry_size;
-
-               if (pool->icm_type == DR_ICM_TYPE_STE) {
-                       err = dr_icm_chunk_ste_init(chunk);
-                       if (err)
-                               goto out_free_chunk;
-               }
-
-               INIT_LIST_HEAD(&chunk->chunk_list);
-               list_add(&chunk->chunk_list, &bucket->free_list);
-               bucket->free_list_count++;
-               bucket->total_chunks++;
-       }
-       mutex_unlock(&pool->mr_mutex);
-       return 0;
-
-out_free_chunk:
-       kvfree(chunk);
-out_err:
-       mutex_unlock(&pool->mr_mutex);
-       return err;
-}
-
 static void dr_icm_chunk_ste_cleanup(struct mlx5dr_icm_chunk *chunk)
 {
        kvfree(chunk->miss_list);
@@ -277,166 +169,199 @@ static void dr_icm_chunk_ste_cleanup(struct mlx5dr_icm_chunk *chunk)
        kvfree(chunk->ste_arr);
 }
 
-static void dr_icm_chunk_destroy(struct mlx5dr_icm_chunk *chunk)
+static enum mlx5dr_icm_type
+get_chunk_icm_type(struct mlx5dr_icm_chunk *chunk)
+{
+       return chunk->buddy_mem->pool->icm_type;
+}
+
+static void dr_icm_chunk_destroy(struct mlx5dr_icm_chunk *chunk,
+                                struct mlx5dr_icm_buddy_mem *buddy)
 {
-       struct mlx5dr_icm_bucket *bucket = chunk->bucket;
+       enum mlx5dr_icm_type icm_type = get_chunk_icm_type(chunk);
 
+       buddy->used_memory -= chunk->byte_size;
        list_del(&chunk->chunk_list);
-       bucket->total_chunks--;
 
-       if (bucket->pool->icm_type == DR_ICM_TYPE_STE)
+       if (icm_type == DR_ICM_TYPE_STE)
                dr_icm_chunk_ste_cleanup(chunk);
 
        kvfree(chunk);
 }
 
-static void dr_icm_bucket_init(struct mlx5dr_icm_pool *pool,
-                              struct mlx5dr_icm_bucket *bucket,
-                              enum mlx5dr_icm_chunk_size chunk_size)
+static int dr_icm_buddy_create(struct mlx5dr_icm_pool *pool)
 {
-       if (pool->icm_type == DR_ICM_TYPE_STE)
-               bucket->entry_size = DR_STE_SIZE;
-       else
-               bucket->entry_size = DR_MODIFY_ACTION_SIZE;
-
-       bucket->num_of_entries = mlx5dr_icm_pool_chunk_size_to_entries(chunk_size);
-       bucket->pool = pool;
-       mutex_init(&bucket->mutex);
-       INIT_LIST_HEAD(&bucket->free_list);
-       INIT_LIST_HEAD(&bucket->used_list);
-       INIT_LIST_HEAD(&bucket->hot_list);
-       INIT_LIST_HEAD(&bucket->sync_list);
+       struct mlx5dr_icm_buddy_mem *buddy;
+       struct mlx5dr_icm_mr *icm_mr;
+
+       icm_mr = dr_icm_pool_mr_create(pool);
+       if (!icm_mr)
+               return -ENOMEM;
+
+       buddy = kvzalloc(sizeof(*buddy), GFP_KERNEL);
+       if (!buddy)
+               goto free_mr;
+
+       if (mlx5dr_buddy_init(buddy, pool->max_log_chunk_sz))
+               goto err_free_buddy;
+
+       buddy->icm_mr = icm_mr;
+       buddy->pool = pool;
+
+       /* add it to the -start- of the list in order to search in it first */
+       list_add(&buddy->list_node, &pool->buddy_mem_list);
+
+       return 0;
+
+err_free_buddy:
+       kvfree(buddy);
+free_mr:
+       dr_icm_pool_mr_destroy(icm_mr);
+       return -ENOMEM;
 }
 
-static void dr_icm_bucket_cleanup(struct mlx5dr_icm_bucket *bucket)
+static void dr_icm_buddy_destroy(struct mlx5dr_icm_buddy_mem *buddy)
 {
        struct mlx5dr_icm_chunk *chunk, *next;
 
-       mutex_destroy(&bucket->mutex);
-       list_splice_tail_init(&bucket->sync_list, &bucket->free_list);
-       list_splice_tail_init(&bucket->hot_list, &bucket->free_list);
+       list_for_each_entry_safe(chunk, next, &buddy->hot_list, chunk_list)
+               dr_icm_chunk_destroy(chunk, buddy);
+
+       list_for_each_entry_safe(chunk, next, &buddy->used_list, chunk_list)
+               dr_icm_chunk_destroy(chunk, buddy);
 
-       list_for_each_entry_safe(chunk, next, &bucket->free_list, chunk_list)
-               dr_icm_chunk_destroy(chunk);
+       dr_icm_pool_mr_destroy(buddy->icm_mr);
 
-       WARN_ON(bucket->total_chunks != 0);
+       mlx5dr_buddy_cleanup(buddy);
 
-       /* Cleanup of unreturned chunks */
-       list_for_each_entry_safe(chunk, next, &bucket->used_list, chunk_list)
-               dr_icm_chunk_destroy(chunk);
+       kvfree(buddy);
 }
 
-static u64 dr_icm_hot_mem_size(struct mlx5dr_icm_pool *pool)
+static struct mlx5dr_icm_chunk *
+dr_icm_chunk_create(struct mlx5dr_icm_pool *pool,
+                   enum mlx5dr_icm_chunk_size chunk_size,
+                   struct mlx5dr_icm_buddy_mem *buddy_mem_pool,
+                   unsigned int seg)
 {
-       u64 hot_size = 0;
-       int chunk_order;
+       struct mlx5dr_icm_chunk *chunk;
+       int offset;
 
-       for (chunk_order = 0; chunk_order < pool->num_of_buckets; chunk_order++)
-               hot_size += pool->buckets[chunk_order].hot_list_count *
-                           mlx5dr_icm_pool_chunk_size_to_byte(chunk_order, pool->icm_type);
+       chunk = kvzalloc(sizeof(*chunk), GFP_KERNEL);
+       if (!chunk)
+               return NULL;
 
-       return hot_size;
-}
+       offset = mlx5dr_icm_pool_dm_type_to_entry_size(pool->icm_type) * seg;
+
+       chunk->rkey = buddy_mem_pool->icm_mr->mkey.key;
+       chunk->mr_addr = offset;
+       chunk->icm_addr =
+               (uintptr_t)buddy_mem_pool->icm_mr->icm_start_addr + offset;
+       chunk->num_of_entries =
+               mlx5dr_icm_pool_chunk_size_to_entries(chunk_size);
+       chunk->byte_size =
+               mlx5dr_icm_pool_chunk_size_to_byte(chunk_size, pool->icm_type);
+       chunk->seg = seg;
+
+       if (pool->icm_type == DR_ICM_TYPE_STE && dr_icm_chunk_ste_init(chunk)) {
+               mlx5dr_err(pool->dmn,
+                          "Failed to init ste arrays (order: %d)\n",
+                          chunk_size);
+               goto out_free_chunk;
+       }
 
-static bool dr_icm_reuse_hot_entries(struct mlx5dr_icm_pool *pool,
-                                    struct mlx5dr_icm_bucket *bucket)
-{
-       u64 bytes_for_sync;
+       buddy_mem_pool->used_memory += chunk->byte_size;
+       chunk->buddy_mem = buddy_mem_pool;
+       INIT_LIST_HEAD(&chunk->chunk_list);
 
-       bytes_for_sync = dr_icm_hot_mem_size(pool);
-       if (bytes_for_sync < DR_ICM_SYNC_THRESHOLD || !bucket->hot_list_count)
-               return false;
+       /* chunk now is part of the used_list */
+       list_add_tail(&chunk->chunk_list, &buddy_mem_pool->used_list);
 
-       return true;
-}
+       return chunk;
 
-static void dr_icm_chill_bucket_start(struct mlx5dr_icm_bucket *bucket)
-{
-       list_splice_tail_init(&bucket->hot_list, &bucket->sync_list);
-       bucket->sync_list_count += bucket->hot_list_count;
-       bucket->hot_list_count = 0;
+out_free_chunk:
+       kvfree(chunk);
+       return NULL;
 }
 
-static void dr_icm_chill_bucket_end(struct mlx5dr_icm_bucket *bucket)
+static bool dr_icm_pool_is_sync_required(struct mlx5dr_icm_pool *pool)
 {
-       list_splice_tail_init(&bucket->sync_list, &bucket->free_list);
-       bucket->free_list_count += bucket->sync_list_count;
-       bucket->sync_list_count = 0;
-}
+       if (pool->hot_memory_size > DR_ICM_SYNC_THRESHOLD_POOL)
+               return true;
 
-static void dr_icm_chill_bucket_abort(struct mlx5dr_icm_bucket *bucket)
-{
-       list_splice_tail_init(&bucket->sync_list, &bucket->hot_list);
-       bucket->hot_list_count += bucket->sync_list_count;
-       bucket->sync_list_count = 0;
+       return false;
 }
 
-static void dr_icm_chill_buckets_start(struct mlx5dr_icm_pool *pool,
-                                      struct mlx5dr_icm_bucket *cb,
-                                      bool buckets[DR_CHUNK_SIZE_MAX])
+static int dr_icm_pool_sync_all_buddy_pools(struct mlx5dr_icm_pool *pool)
 {
-       struct mlx5dr_icm_bucket *bucket;
-       int i;
-
-       for (i = 0; i < pool->num_of_buckets; i++) {
-               bucket = &pool->buckets[i];
-               if (bucket == cb) {
-                       dr_icm_chill_bucket_start(bucket);
-                       continue;
-               }
+       struct mlx5dr_icm_buddy_mem *buddy, *tmp_buddy;
+       int err;
 
-               /* Freeing the mutex is done at the end of that process, after
-                * sync_ste was executed at dr_icm_chill_buckets_end func.
-                */
-               if (mutex_trylock(&bucket->mutex)) {
-                       dr_icm_chill_bucket_start(bucket);
-                       buckets[i] = true;
-               }
+       err = mlx5dr_cmd_sync_steering(pool->dmn->mdev);
+       if (err) {
+               mlx5dr_err(pool->dmn, "Failed to sync to HW (err: %d)\n", err);
+               return err;
        }
-}
 
-static void dr_icm_chill_buckets_end(struct mlx5dr_icm_pool *pool,
-                                    struct mlx5dr_icm_bucket *cb,
-                                    bool buckets[DR_CHUNK_SIZE_MAX])
-{
-       struct mlx5dr_icm_bucket *bucket;
-       int i;
-
-       for (i = 0; i < pool->num_of_buckets; i++) {
-               bucket = &pool->buckets[i];
-               if (bucket == cb) {
-                       dr_icm_chill_bucket_end(bucket);
-                       continue;
-               }
+       list_for_each_entry_safe(buddy, tmp_buddy, &pool->buddy_mem_list, list_node) {
+               struct mlx5dr_icm_chunk *chunk, *tmp_chunk;
 
-               if (!buckets[i])
-                       continue;
+               list_for_each_entry_safe(chunk, tmp_chunk, &buddy->hot_list, chunk_list) {
+                       mlx5dr_buddy_free_mem(buddy, chunk->seg,
+                                             ilog2(chunk->num_of_entries));
+                       pool->hot_memory_size -= chunk->byte_size;
+                       dr_icm_chunk_destroy(chunk, buddy);
+               }
 
-               dr_icm_chill_bucket_end(bucket);
-               mutex_unlock(&bucket->mutex);
+               if (!buddy->used_memory && pool->icm_type == DR_ICM_TYPE_STE)
+                       dr_icm_buddy_destroy(buddy);
        }
+
+       return 0;
 }
 
-static void dr_icm_chill_buckets_abort(struct mlx5dr_icm_pool *pool,
-                                      struct mlx5dr_icm_bucket *cb,
-                                      bool buckets[DR_CHUNK_SIZE_MAX])
+static int dr_icm_handle_buddies_get_mem(struct mlx5dr_icm_pool *pool,
+                                        enum mlx5dr_icm_chunk_size chunk_size,
+                                        struct mlx5dr_icm_buddy_mem **buddy,
+                                        unsigned int *seg)
 {
-       struct mlx5dr_icm_bucket *bucket;
-       int i;
-
-       for (i = 0; i < pool->num_of_buckets; i++) {
-               bucket = &pool->buckets[i];
-               if (bucket == cb) {
-                       dr_icm_chill_bucket_abort(bucket);
-                       continue;
-               }
+       struct mlx5dr_icm_buddy_mem *buddy_mem_pool;
+       bool new_mem = false;
+       int err;
 
-               if (!buckets[i])
-                       continue;
+alloc_buddy_mem:
+       /* find the next free place from the buddy list */
+       list_for_each_entry(buddy_mem_pool, &pool->buddy_mem_list, list_node) {
+               err = mlx5dr_buddy_alloc_mem(buddy_mem_pool,
+                                            chunk_size, seg);
+               if (!err)
+                       goto found;
+
+               if (WARN_ON(new_mem)) {
+                       /* We have new memory pool, first in the list */
+                       mlx5dr_err(pool->dmn,
+                                  "No memory for order: %d\n",
+                                  chunk_size);
+                       goto out;
+               }
+       }
 
-               dr_icm_chill_bucket_abort(bucket);
-               mutex_unlock(&bucket->mutex);
+       /* no more available allocators in that pool, create new */
+       err = dr_icm_buddy_create(pool);
+       if (err) {
+               mlx5dr_err(pool->dmn,
+                          "Failed creating buddy for order %d\n",
+                          chunk_size);
+               goto out;
        }
+
+       /* mark we have new memory, first in list */
+       new_mem = true;
+       goto alloc_buddy_mem;
+
+found:
+       *buddy = buddy_mem_pool;
+out:
+       return err;
 }
 
 /* Allocate an ICM chunk, each chunk holds a piece of ICM memory and
@@ -446,68 +371,48 @@ struct mlx5dr_icm_chunk *
 mlx5dr_icm_alloc_chunk(struct mlx5dr_icm_pool *pool,
                       enum mlx5dr_icm_chunk_size chunk_size)
 {
-       struct mlx5dr_icm_chunk *chunk = NULL; /* Fix compilation warning */
-       bool buckets[DR_CHUNK_SIZE_MAX] = {};
-       struct mlx5dr_icm_bucket *bucket;
-       int err;
+       struct mlx5dr_icm_chunk *chunk = NULL;
+       struct mlx5dr_icm_buddy_mem *buddy;
+       unsigned int seg;
+       int ret;
 
        if (chunk_size > pool->max_log_chunk_sz)
                return NULL;
 
-       bucket = &pool->buckets[chunk_size];
-
-       mutex_lock(&bucket->mutex);
-
-       /* Take chunk from pool if available, otherwise allocate new chunks */
-       if (list_empty(&bucket->free_list)) {
-               if (dr_icm_reuse_hot_entries(pool, bucket)) {
-                       dr_icm_chill_buckets_start(pool, bucket, buckets);
-                       err = mlx5dr_cmd_sync_steering(pool->dmn->mdev);
-                       if (err) {
-                               dr_icm_chill_buckets_abort(pool, bucket, buckets);
-                               mlx5dr_err(pool->dmn, "Sync_steering failed\n");
-                               chunk = NULL;
-                               goto out;
-                       }
-                       dr_icm_chill_buckets_end(pool, bucket, buckets);
-               } else {
-                       dr_icm_chunks_create(bucket);
-               }
-       }
+       mutex_lock(&pool->mutex);
+       /* find mem, get back the relevant buddy pool and seg in that mem */
+       ret = dr_icm_handle_buddies_get_mem(pool, chunk_size, &buddy, &seg);
+       if (ret)
+               goto out;
 
-       if (!list_empty(&bucket->free_list)) {
-               chunk = list_last_entry(&bucket->free_list,
-                                       struct mlx5dr_icm_chunk,
-                                       chunk_list);
-               if (chunk) {
-                       list_del_init(&chunk->chunk_list);
-                       list_add_tail(&chunk->chunk_list, &bucket->used_list);
-                       bucket->free_list_count--;
-                       bucket->used_list_count++;
-               }
-       }
+       chunk = dr_icm_chunk_create(pool, chunk_size, buddy, seg);
+       if (!chunk)
+               goto out_err;
+
+       goto out;
+
+out_err:
+       mlx5dr_buddy_free_mem(buddy, seg, chunk_size);
 out:
-       mutex_unlock(&bucket->mutex);
+       mutex_unlock(&pool->mutex);
        return chunk;
 }
 
 void mlx5dr_icm_free_chunk(struct mlx5dr_icm_chunk *chunk)
 {
-       struct mlx5dr_icm_bucket *bucket = chunk->bucket;
+       struct mlx5dr_icm_buddy_mem *buddy = chunk->buddy_mem;
+       struct mlx5dr_icm_pool *pool = buddy->pool;
 
-       if (bucket->pool->icm_type == DR_ICM_TYPE_STE) {
-               memset(chunk->ste_arr, 0,
-                      bucket->num_of_entries * sizeof(chunk->ste_arr[0]));
-               memset(chunk->hw_ste_arr, 0,
-                      bucket->num_of_entries * DR_STE_SIZE_REDUCED);
-       }
+       /* move the memory to the waiting list AKA "hot" */
+       mutex_lock(&pool->mutex);
+       list_move_tail(&chunk->chunk_list, &buddy->hot_list);
+       pool->hot_memory_size += chunk->byte_size;
+
+       /* Check if we have chunks that are waiting for sync-ste */
+       if (dr_icm_pool_is_sync_required(pool))
+               dr_icm_pool_sync_all_buddy_pools(pool);
 
-       mutex_lock(&bucket->mutex);
-       list_del_init(&chunk->chunk_list);
-       list_add_tail(&chunk->chunk_list, &bucket->hot_list);
-       bucket->hot_list_count++;
-       bucket->used_list_count--;
-       mutex_unlock(&bucket->mutex);
+       mutex_unlock(&pool->mutex);
 }
 
 struct mlx5dr_icm_pool *mlx5dr_icm_pool_create(struct mlx5dr_domain *dmn,
@@ -515,7 +420,6 @@ struct mlx5dr_icm_pool *mlx5dr_icm_pool_create(struct mlx5dr_domain *dmn,
 {
        enum mlx5dr_icm_chunk_size max_log_chunk_sz;
        struct mlx5dr_icm_pool *pool;
-       int i;
 
        if (icm_type == DR_ICM_TYPE_STE)
                max_log_chunk_sz = dmn->info.max_log_sw_icm_sz;
@@ -526,43 +430,24 @@ struct mlx5dr_icm_pool *mlx5dr_icm_pool_create(struct mlx5dr_domain *dmn,
        if (!pool)
                return NULL;
 
-       pool->buckets = kcalloc(max_log_chunk_sz + 1,
-                               sizeof(pool->buckets[0]),
-                               GFP_KERNEL);
-       if (!pool->buckets)
-               goto free_pool;
-
        pool->dmn = dmn;
        pool->icm_type = icm_type;
        pool->max_log_chunk_sz = max_log_chunk_sz;
-       pool->num_of_buckets = max_log_chunk_sz + 1;
-       INIT_LIST_HEAD(&pool->icm_mr_list);
 
-       for (i = 0; i < pool->num_of_buckets; i++)
-               dr_icm_bucket_init(pool, &pool->buckets[i], i);
+       INIT_LIST_HEAD(&pool->buddy_mem_list);
 
-       mutex_init(&pool->mr_mutex);
+       mutex_init(&pool->mutex);
 
        return pool;
-
-free_pool:
-       kvfree(pool);
-       return NULL;
 }
 
 void mlx5dr_icm_pool_destroy(struct mlx5dr_icm_pool *pool)
 {
-       struct mlx5dr_icm_mr *icm_mr, *next;
-       int i;
-
-       mutex_destroy(&pool->mr_mutex);
-
-       list_for_each_entry_safe(icm_mr, next, &pool->icm_mr_list, mr_list)
-               dr_icm_pool_mr_destroy(icm_mr);
+       struct mlx5dr_icm_buddy_mem *buddy, *tmp_buddy;
 
-       for (i = 0; i < pool->num_of_buckets; i++)
-               dr_icm_bucket_cleanup(&pool->buckets[i]);
+       list_for_each_entry_safe(buddy, tmp_buddy, &pool->buddy_mem_list, list_node)
+               dr_icm_buddy_destroy(buddy);
 
-       kfree(pool->buckets);
+       mutex_destroy(&pool->mutex);
        kvfree(pool);
 }
index 7df8836..cb5202e 100644 (file)
@@ -85,7 +85,7 @@ static bool dr_mask_is_ttl_set(struct mlx5dr_match_spec *spec)
        (_misc2)._inner_outer##_first_mpls_s_bos || \
        (_misc2)._inner_outer##_first_mpls_ttl)
 
-static bool dr_mask_is_gre_set(struct mlx5dr_match_misc *misc)
+static bool dr_mask_is_tnl_gre_set(struct mlx5dr_match_misc *misc)
 {
        return (misc->gre_key_h || misc->gre_key_l ||
                misc->gre_protocol || misc->gre_c_present ||
@@ -98,12 +98,12 @@ static bool dr_mask_is_gre_set(struct mlx5dr_match_misc *misc)
        (_misc2).outer_first_mpls_over_##gre_udp##_s_bos || \
        (_misc2).outer_first_mpls_over_##gre_udp##_ttl)
 
-#define DR_MASK_IS_FLEX_PARSER_0_SET(_misc2) ( \
+#define DR_MASK_IS_TNL_MPLS_SET(_misc2) ( \
        DR_MASK_IS_OUTER_MPLS_OVER_GRE_UDP_SET((_misc2), gre) || \
        DR_MASK_IS_OUTER_MPLS_OVER_GRE_UDP_SET((_misc2), udp))
 
 static bool
-dr_mask_is_misc3_vxlan_gpe_set(struct mlx5dr_match_misc3 *misc3)
+dr_mask_is_vxlan_gpe_set(struct mlx5dr_match_misc3 *misc3)
 {
        return (misc3->outer_vxlan_gpe_vni ||
                misc3->outer_vxlan_gpe_next_protocol ||
@@ -111,21 +111,20 @@ dr_mask_is_misc3_vxlan_gpe_set(struct mlx5dr_match_misc3 *misc3)
 }
 
 static bool
-dr_matcher_supp_flex_parser_vxlan_gpe(struct mlx5dr_cmd_caps *caps)
+dr_matcher_supp_vxlan_gpe(struct mlx5dr_cmd_caps *caps)
 {
-       return caps->flex_protocols &
-              MLX5_FLEX_PARSER_VXLAN_GPE_ENABLED;
+       return caps->flex_protocols & MLX5_FLEX_PARSER_VXLAN_GPE_ENABLED;
 }
 
 static bool
-dr_mask_is_flex_parser_tnl_vxlan_gpe_set(struct mlx5dr_match_param *mask,
-                                        struct mlx5dr_domain *dmn)
+dr_mask_is_tnl_vxlan_gpe(struct mlx5dr_match_param *mask,
+                        struct mlx5dr_domain *dmn)
 {
-       return dr_mask_is_misc3_vxlan_gpe_set(&mask->misc3) &&
-              dr_matcher_supp_flex_parser_vxlan_gpe(&dmn->info.caps);
+       return dr_mask_is_vxlan_gpe_set(&mask->misc3) &&
+              dr_matcher_supp_vxlan_gpe(&dmn->info.caps);
 }
 
-static bool dr_mask_is_misc_geneve_set(struct mlx5dr_match_misc *misc)
+static bool dr_mask_is_tnl_geneve_set(struct mlx5dr_match_misc *misc)
 {
        return misc->geneve_vni ||
               misc->geneve_oam ||
@@ -134,26 +133,46 @@ static bool dr_mask_is_misc_geneve_set(struct mlx5dr_match_misc *misc)
 }
 
 static bool
-dr_matcher_supp_flex_parser_geneve(struct mlx5dr_cmd_caps *caps)
+dr_matcher_supp_tnl_geneve(struct mlx5dr_cmd_caps *caps)
 {
-       return caps->flex_protocols &
-              MLX5_FLEX_PARSER_GENEVE_ENABLED;
+       return caps->flex_protocols & MLX5_FLEX_PARSER_GENEVE_ENABLED;
 }
 
 static bool
-dr_mask_is_flex_parser_tnl_geneve_set(struct mlx5dr_match_param *mask,
-                                     struct mlx5dr_domain *dmn)
+dr_mask_is_tnl_geneve(struct mlx5dr_match_param *mask,
+                     struct mlx5dr_domain *dmn)
 {
-       return dr_mask_is_misc_geneve_set(&mask->misc) &&
-              dr_matcher_supp_flex_parser_geneve(&dmn->info.caps);
+       return dr_mask_is_tnl_geneve_set(&mask->misc) &&
+              dr_matcher_supp_tnl_geneve(&dmn->info.caps);
 }
 
-static bool dr_mask_is_flex_parser_icmpv6_set(struct mlx5dr_match_misc3 *misc3)
+static int dr_matcher_supp_icmp_v4(struct mlx5dr_cmd_caps *caps)
+{
+       return caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V4_ENABLED;
+}
+
+static int dr_matcher_supp_icmp_v6(struct mlx5dr_cmd_caps *caps)
+{
+       return caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V6_ENABLED;
+}
+
+static bool dr_mask_is_icmpv6_set(struct mlx5dr_match_misc3 *misc3)
 {
        return (misc3->icmpv6_type || misc3->icmpv6_code ||
                misc3->icmpv6_header_data);
 }
 
+static bool dr_mask_is_icmp(struct mlx5dr_match_param *mask,
+                           struct mlx5dr_domain *dmn)
+{
+       if (DR_MASK_IS_ICMPV4_SET(&mask->misc3))
+               return dr_matcher_supp_icmp_v4(&dmn->info.caps);
+       else if (dr_mask_is_icmpv6_set(&mask->misc3))
+               return dr_matcher_supp_icmp_v6(&dmn->info.caps);
+
+       return false;
+}
+
 static bool dr_mask_is_wqe_metadata_set(struct mlx5dr_match_misc2 *misc2)
 {
        return misc2->metadata_reg_a;
@@ -257,7 +276,7 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
 
                if (dr_mask_is_smac_set(&mask.outer) &&
                    dr_mask_is_dmac_set(&mask.outer)) {
-                       mlx5dr_ste_build_eth_l2_src_des(&sb[idx++], &mask,
+                       mlx5dr_ste_build_eth_l2_src_dst(&sb[idx++], &mask,
                                                        inner, rx);
                }
 
@@ -277,8 +296,8 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
                                                                 inner, rx);
 
                        if (DR_MASK_IS_ETH_L4_SET(mask.outer, mask.misc, outer))
-                               mlx5dr_ste_build_ipv6_l3_l4(&sb[idx++], &mask,
-                                                           inner, rx);
+                               mlx5dr_ste_build_eth_ipv6_l3_l4(&sb[idx++], &mask,
+                                                               inner, rx);
                } else {
                        if (dr_mask_is_ipv4_5_tuple_set(&mask.outer))
                                mlx5dr_ste_build_eth_l3_ipv4_5_tuple(&sb[idx++], &mask,
@@ -289,14 +308,12 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
                                                                  inner, rx);
                }
 
-               if (dr_mask_is_flex_parser_tnl_vxlan_gpe_set(&mask, dmn))
-                       mlx5dr_ste_build_flex_parser_tnl_vxlan_gpe(&sb[idx++],
-                                                                  &mask,
-                                                                  inner, rx);
-               else if (dr_mask_is_flex_parser_tnl_geneve_set(&mask, dmn))
-                       mlx5dr_ste_build_flex_parser_tnl_geneve(&sb[idx++],
-                                                               &mask,
-                                                               inner, rx);
+               if (dr_mask_is_tnl_vxlan_gpe(&mask, dmn))
+                       mlx5dr_ste_build_tnl_vxlan_gpe(&sb[idx++], &mask,
+                                                      inner, rx);
+               else if (dr_mask_is_tnl_geneve(&mask, dmn))
+                       mlx5dr_ste_build_tnl_geneve(&sb[idx++], &mask,
+                                                   inner, rx);
 
                if (DR_MASK_IS_ETH_L4_MISC_SET(mask.misc3, outer))
                        mlx5dr_ste_build_eth_l4_misc(&sb[idx++], &mask, inner, rx);
@@ -304,22 +321,18 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
                if (DR_MASK_IS_FIRST_MPLS_SET(mask.misc2, outer))
                        mlx5dr_ste_build_mpls(&sb[idx++], &mask, inner, rx);
 
-               if (DR_MASK_IS_FLEX_PARSER_0_SET(mask.misc2))
-                       mlx5dr_ste_build_flex_parser_0(&sb[idx++], &mask,
-                                                      inner, rx);
+               if (DR_MASK_IS_TNL_MPLS_SET(mask.misc2))
+                       mlx5dr_ste_build_tnl_mpls(&sb[idx++], &mask, inner, rx);
 
-               if ((DR_MASK_IS_FLEX_PARSER_ICMPV4_SET(&mask.misc3) &&
-                    mlx5dr_matcher_supp_flex_parser_icmp_v4(&dmn->info.caps)) ||
-                   (dr_mask_is_flex_parser_icmpv6_set(&mask.misc3) &&
-                    mlx5dr_matcher_supp_flex_parser_icmp_v6(&dmn->info.caps))) {
-                       ret = mlx5dr_ste_build_flex_parser_1(&sb[idx++],
-                                                            &mask, &dmn->info.caps,
-                                                            inner, rx);
+               if (dr_mask_is_icmp(&mask, dmn)) {
+                       ret = mlx5dr_ste_build_icmp(&sb[idx++],
+                                                   &mask, &dmn->info.caps,
+                                                   inner, rx);
                        if (ret)
                                return ret;
                }
-               if (dr_mask_is_gre_set(&mask.misc))
-                       mlx5dr_ste_build_gre(&sb[idx++], &mask, inner, rx);
+               if (dr_mask_is_tnl_gre_set(&mask.misc))
+                       mlx5dr_ste_build_tnl_gre(&sb[idx++], &mask, inner, rx);
        }
 
        /* Inner */
@@ -334,7 +347,7 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
 
                if (dr_mask_is_smac_set(&mask.inner) &&
                    dr_mask_is_dmac_set(&mask.inner)) {
-                       mlx5dr_ste_build_eth_l2_src_des(&sb[idx++],
+                       mlx5dr_ste_build_eth_l2_src_dst(&sb[idx++],
                                                        &mask, inner, rx);
                }
 
@@ -354,8 +367,8 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
                                                                 inner, rx);
 
                        if (DR_MASK_IS_ETH_L4_SET(mask.inner, mask.misc, inner))
-                               mlx5dr_ste_build_ipv6_l3_l4(&sb[idx++], &mask,
-                                                           inner, rx);
+                               mlx5dr_ste_build_eth_ipv6_l3_l4(&sb[idx++], &mask,
+                                                               inner, rx);
                } else {
                        if (dr_mask_is_ipv4_5_tuple_set(&mask.inner))
                                mlx5dr_ste_build_eth_l3_ipv4_5_tuple(&sb[idx++], &mask,
@@ -372,8 +385,8 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
                if (DR_MASK_IS_FIRST_MPLS_SET(mask.misc2, inner))
                        mlx5dr_ste_build_mpls(&sb[idx++], &mask, inner, rx);
 
-               if (DR_MASK_IS_FLEX_PARSER_0_SET(mask.misc2))
-                       mlx5dr_ste_build_flex_parser_0(&sb[idx++], &mask, inner, rx);
+               if (DR_MASK_IS_TNL_MPLS_SET(mask.misc2))
+                       mlx5dr_ste_build_tnl_mpls(&sb[idx++], &mask, inner, rx);
        }
        /* Empty matcher, takes all */
        if (matcher->match_criteria == DR_MATCHER_CRITERIA_EMPTY)
index b01aaec..d275823 100644 (file)
@@ -1090,7 +1090,7 @@ static int dr_ste_build_eth_l2_src_des_tag(struct mlx5dr_match_param *value,
        return 0;
 }
 
-void mlx5dr_ste_build_eth_l2_src_des(struct mlx5dr_ste_build *sb,
+void mlx5dr_ste_build_eth_l2_src_dst(struct mlx5dr_ste_build *sb,
                                     struct mlx5dr_match_param *mask,
                                     bool inner, bool rx)
 {
@@ -1594,9 +1594,9 @@ static int dr_ste_build_ipv6_l3_l4_tag(struct mlx5dr_match_param *value,
        return 0;
 }
 
-void mlx5dr_ste_build_ipv6_l3_l4(struct mlx5dr_ste_build *sb,
-                                struct mlx5dr_match_param *mask,
-                                bool inner, bool rx)
+void mlx5dr_ste_build_eth_ipv6_l3_l4(struct mlx5dr_ste_build *sb,
+                                    struct mlx5dr_match_param *mask,
+                                    bool inner, bool rx)
 {
        dr_ste_build_ipv6_l3_l4_bit_mask(mask, inner, sb->bit_mask);
 
@@ -1693,8 +1693,8 @@ static int dr_ste_build_gre_tag(struct mlx5dr_match_param *value,
        return 0;
 }
 
-void mlx5dr_ste_build_gre(struct mlx5dr_ste_build *sb,
-                         struct mlx5dr_match_param *mask, bool inner, bool rx)
+void mlx5dr_ste_build_tnl_gre(struct mlx5dr_ste_build *sb,
+                             struct mlx5dr_match_param *mask, bool inner, bool rx)
 {
        dr_ste_build_gre_bit_mask(mask, inner, sb->bit_mask);
 
@@ -1771,9 +1771,9 @@ static int dr_ste_build_flex_parser_0_tag(struct mlx5dr_match_param *value,
        return 0;
 }
 
-void mlx5dr_ste_build_flex_parser_0(struct mlx5dr_ste_build *sb,
-                                   struct mlx5dr_match_param *mask,
-                                   bool inner, bool rx)
+void mlx5dr_ste_build_tnl_mpls(struct mlx5dr_ste_build *sb,
+                              struct mlx5dr_match_param *mask,
+                              bool inner, bool rx)
 {
        dr_ste_build_flex_parser_0_bit_mask(mask, inner, sb->bit_mask);
 
@@ -1792,8 +1792,8 @@ static int dr_ste_build_flex_parser_1_bit_mask(struct mlx5dr_match_param *mask,
                                               struct mlx5dr_cmd_caps *caps,
                                               u8 *bit_mask)
 {
+       bool is_ipv4_mask = DR_MASK_IS_ICMPV4_SET(&mask->misc3);
        struct mlx5dr_match_misc3 *misc_3_mask = &mask->misc3;
-       bool is_ipv4_mask = DR_MASK_IS_FLEX_PARSER_ICMPV4_SET(misc_3_mask);
        u32 icmp_header_data_mask;
        u32 icmp_type_mask;
        u32 icmp_code_mask;
@@ -1869,7 +1869,7 @@ static int dr_ste_build_flex_parser_1_tag(struct mlx5dr_match_param *value,
        u32 icmp_code;
        bool is_ipv4;
 
-       is_ipv4 = DR_MASK_IS_FLEX_PARSER_ICMPV4_SET(misc_3);
+       is_ipv4 = DR_MASK_IS_ICMPV4_SET(misc_3);
        if (is_ipv4) {
                icmp_header_data        = misc_3->icmpv4_header_data;
                icmp_type               = misc_3->icmpv4_type;
@@ -1928,10 +1928,10 @@ static int dr_ste_build_flex_parser_1_tag(struct mlx5dr_match_param *value,
        return 0;
 }
 
-int mlx5dr_ste_build_flex_parser_1(struct mlx5dr_ste_build *sb,
-                                  struct mlx5dr_match_param *mask,
-                                  struct mlx5dr_cmd_caps *caps,
-                                  bool inner, bool rx)
+int mlx5dr_ste_build_icmp(struct mlx5dr_ste_build *sb,
+                         struct mlx5dr_match_param *mask,
+                         struct mlx5dr_cmd_caps *caps,
+                         bool inner, bool rx)
 {
        int ret;
 
@@ -2069,9 +2069,9 @@ dr_ste_build_flex_parser_tnl_vxlan_gpe_tag(struct mlx5dr_match_param *value,
        return 0;
 }
 
-void mlx5dr_ste_build_flex_parser_tnl_vxlan_gpe(struct mlx5dr_ste_build *sb,
-                                               struct mlx5dr_match_param *mask,
-                                               bool inner, bool rx)
+void mlx5dr_ste_build_tnl_vxlan_gpe(struct mlx5dr_ste_build *sb,
+                                   struct mlx5dr_match_param *mask,
+                                   bool inner, bool rx)
 {
        dr_ste_build_flex_parser_tnl_vxlan_gpe_bit_mask(mask, inner,
                                                        sb->bit_mask);
@@ -2122,9 +2122,9 @@ dr_ste_build_flex_parser_tnl_geneve_tag(struct mlx5dr_match_param *value,
        return 0;
 }
 
-void mlx5dr_ste_build_flex_parser_tnl_geneve(struct mlx5dr_ste_build *sb,
-                                            struct mlx5dr_match_param *mask,
-                                            bool inner, bool rx)
+void mlx5dr_ste_build_tnl_geneve(struct mlx5dr_ste_build *sb,
+                                struct mlx5dr_match_param *mask,
+                                bool inner, bool rx)
 {
        dr_ste_build_flex_parser_tnl_geneve_bit_mask(mask, sb->bit_mask);
        sb->rx = rx;
index f50f3b1..3e423c8 100644 (file)
@@ -114,7 +114,7 @@ enum mlx5dr_ipv {
 
 struct mlx5dr_icm_pool;
 struct mlx5dr_icm_chunk;
-struct mlx5dr_icm_bucket;
+struct mlx5dr_icm_buddy_mem;
 struct mlx5dr_ste_htbl;
 struct mlx5dr_match_param;
 struct mlx5dr_cmd_caps;
@@ -288,7 +288,7 @@ int mlx5dr_ste_build_ste_arr(struct mlx5dr_matcher *matcher,
                             struct mlx5dr_matcher_rx_tx *nic_matcher,
                             struct mlx5dr_match_param *value,
                             u8 *ste_arr);
-void mlx5dr_ste_build_eth_l2_src_des(struct mlx5dr_ste_build *builder,
+void mlx5dr_ste_build_eth_l2_src_dst(struct mlx5dr_ste_build *builder,
                                     struct mlx5dr_match_param *mask,
                                     bool inner, bool rx);
 void mlx5dr_ste_build_eth_l3_ipv4_5_tuple(struct mlx5dr_ste_build *sb,
@@ -312,31 +312,31 @@ void mlx5dr_ste_build_eth_l2_dst(struct mlx5dr_ste_build *sb,
 void mlx5dr_ste_build_eth_l2_tnl(struct mlx5dr_ste_build *sb,
                                 struct mlx5dr_match_param *mask,
                                 bool inner, bool rx);
-void mlx5dr_ste_build_ipv6_l3_l4(struct mlx5dr_ste_build *sb,
-                                struct mlx5dr_match_param *mask,
-                                bool inner, bool rx);
+void mlx5dr_ste_build_eth_ipv6_l3_l4(struct mlx5dr_ste_build *sb,
+                                    struct mlx5dr_match_param *mask,
+                                    bool inner, bool rx);
 void mlx5dr_ste_build_eth_l4_misc(struct mlx5dr_ste_build *sb,
                                  struct mlx5dr_match_param *mask,
                                  bool inner, bool rx);
-void mlx5dr_ste_build_gre(struct mlx5dr_ste_build *sb,
-                         struct mlx5dr_match_param *mask,
-                         bool inner, bool rx);
+void mlx5dr_ste_build_tnl_gre(struct mlx5dr_ste_build *sb,
+                             struct mlx5dr_match_param *mask,
+                             bool inner, bool rx);
 void mlx5dr_ste_build_mpls(struct mlx5dr_ste_build *sb,
                           struct mlx5dr_match_param *mask,
                           bool inner, bool rx);
-void mlx5dr_ste_build_flex_parser_0(struct mlx5dr_ste_build *sb,
+void mlx5dr_ste_build_tnl_mpls(struct mlx5dr_ste_build *sb,
+                              struct mlx5dr_match_param *mask,
+                              bool inner, bool rx);
+int mlx5dr_ste_build_icmp(struct mlx5dr_ste_build *sb,
+                         struct mlx5dr_match_param *mask,
+                         struct mlx5dr_cmd_caps *caps,
+                         bool inner, bool rx);
+void mlx5dr_ste_build_tnl_vxlan_gpe(struct mlx5dr_ste_build *sb,
                                    struct mlx5dr_match_param *mask,
                                    bool inner, bool rx);
-int mlx5dr_ste_build_flex_parser_1(struct mlx5dr_ste_build *sb,
-                                  struct mlx5dr_match_param *mask,
-                                  struct mlx5dr_cmd_caps *caps,
-                                  bool inner, bool rx);
-void mlx5dr_ste_build_flex_parser_tnl_vxlan_gpe(struct mlx5dr_ste_build *sb,
-                                               struct mlx5dr_match_param *mask,
-                                               bool inner, bool rx);
-void mlx5dr_ste_build_flex_parser_tnl_geneve(struct mlx5dr_ste_build *sb,
-                                            struct mlx5dr_match_param *mask,
-                                            bool inner, bool rx);
+void mlx5dr_ste_build_tnl_geneve(struct mlx5dr_ste_build *sb,
+                                struct mlx5dr_match_param *mask,
+                                bool inner, bool rx);
 void mlx5dr_ste_build_general_purpose(struct mlx5dr_ste_build *sb,
                                      struct mlx5dr_match_param *mask,
                                      bool inner, bool rx);
@@ -588,9 +588,9 @@ struct mlx5dr_match_param {
        struct mlx5dr_match_misc3 misc3;
 };
 
-#define DR_MASK_IS_FLEX_PARSER_ICMPV4_SET(_misc3) ((_misc3)->icmpv4_type || \
-                                                  (_misc3)->icmpv4_code || \
-                                                  (_misc3)->icmpv4_header_data)
+#define DR_MASK_IS_ICMPV4_SET(_misc3) ((_misc3)->icmpv4_type || \
+                                      (_misc3)->icmpv4_code || \
+                                      (_misc3)->icmpv4_header_data)
 
 struct mlx5dr_esw_caps {
        u64 drop_icm_address_rx;
@@ -731,7 +731,6 @@ struct mlx5dr_action {
                        struct mlx5dr_domain *dmn;
                        struct mlx5dr_icm_chunk *chunk;
                        u8 *data;
-                       u32 data_size;
                        u16 num_of_actions;
                        u32 index;
                        u8 allow_rx:1;
@@ -804,7 +803,7 @@ void mlx5dr_rule_update_rule_member(struct mlx5dr_ste *new_ste,
                                    struct mlx5dr_ste *ste);
 
 struct mlx5dr_icm_chunk {
-       struct mlx5dr_icm_bucket *bucket;
+       struct mlx5dr_icm_buddy_mem *buddy_mem;
        struct list_head chunk_list;
        u32 rkey;
        u32 num_of_entries;
@@ -812,6 +811,11 @@ struct mlx5dr_icm_chunk {
        u64 icm_addr;
        u64 mr_addr;
 
+       /* indicates the index of this chunk in the whole memory,
+        * used for deleting the chunk from the buddy
+        */
+       unsigned int seg;
+
        /* Memory optimisation */
        struct mlx5dr_ste *ste_arr;
        u8 *hw_ste_arr;
@@ -840,23 +844,20 @@ static inline void mlx5dr_domain_unlock(struct mlx5dr_domain *dmn)
        mlx5dr_domain_nic_unlock(&dmn->info.rx);
 }
 
-static inline int
-mlx5dr_matcher_supp_flex_parser_icmp_v4(struct mlx5dr_cmd_caps *caps)
-{
-       return caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V4_ENABLED;
-}
-
-static inline int
-mlx5dr_matcher_supp_flex_parser_icmp_v6(struct mlx5dr_cmd_caps *caps)
-{
-       return caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V6_ENABLED;
-}
-
 int mlx5dr_matcher_select_builders(struct mlx5dr_matcher *matcher,
                                   struct mlx5dr_matcher_rx_tx *nic_matcher,
                                   enum mlx5dr_ipv outer_ipv,
                                   enum mlx5dr_ipv inner_ipv);
 
+static inline int
+mlx5dr_icm_pool_dm_type_to_entry_size(enum mlx5dr_icm_type icm_type)
+{
+       if (icm_type == DR_ICM_TYPE_STE)
+               return DR_STE_SIZE;
+
+       return DR_MODIFY_ACTION_SIZE;
+}
+
 static inline u32
 mlx5dr_icm_pool_chunk_size_to_entries(enum mlx5dr_icm_chunk_size chunk_size)
 {
@@ -870,11 +871,7 @@ mlx5dr_icm_pool_chunk_size_to_byte(enum mlx5dr_icm_chunk_size chunk_size,
        int num_of_entries;
        int entry_size;
 
-       if (icm_type == DR_ICM_TYPE_STE)
-               entry_size = DR_STE_SIZE;
-       else
-               entry_size = DR_MODIFY_ACTION_SIZE;
-
+       entry_size = mlx5dr_icm_pool_dm_type_to_entry_size(icm_type);
        num_of_entries = mlx5dr_icm_pool_chunk_size_to_entries(chunk_size);
 
        return entry_size * num_of_entries;
index 7914fe3..4177786 100644 (file)
@@ -127,4 +127,36 @@ mlx5dr_is_supported(struct mlx5_core_dev *dev)
        return MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner);
 }
 
+/* buddy functions & structure */
+
+struct mlx5dr_icm_mr;
+
+struct mlx5dr_icm_buddy_mem {
+       unsigned long           **bitmap;
+       unsigned int            *num_free;
+       u32                     max_order;
+       struct list_head        list_node;
+       struct mlx5dr_icm_mr    *icm_mr;
+       struct mlx5dr_icm_pool  *pool;
+
+       /* This is the list of used chunks. HW may be accessing this memory */
+       struct list_head        used_list;
+       u64                     used_memory;
+
+       /* Hardware may be accessing this memory but at some future,
+        * undetermined time, it might cease to do so.
+        * sync_ste command sets them free.
+        */
+       struct list_head        hot_list;
+};
+
+int mlx5dr_buddy_init(struct mlx5dr_icm_buddy_mem *buddy,
+                     unsigned int max_order);
+void mlx5dr_buddy_cleanup(struct mlx5dr_icm_buddy_mem *buddy);
+int mlx5dr_buddy_alloc_mem(struct mlx5dr_icm_buddy_mem *buddy,
+                          unsigned int order,
+                          unsigned int *segment);
+void mlx5dr_buddy_free_mem(struct mlx5dr_icm_buddy_mem *buddy,
+                          unsigned int seg, unsigned int order);
+
 #endif /* _MLX5DR_H_ */
index 7f77c2a..937b8e4 100644 (file)
@@ -620,6 +620,9 @@ static void mlxsw_emad_transmit_retry(struct mlxsw_core *mlxsw_core,
                err = mlxsw_emad_transmit(trans->core, trans);
                if (err == 0)
                        return;
+
+               if (!atomic_dec_and_test(&trans->active))
+                       return;
        } else {
                err = -EIO;
        }
@@ -2064,6 +2067,8 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core,
        if (!reload)
                devlink_resources_unregister(devlink, NULL);
        mlxsw_core->bus->fini(mlxsw_core->bus_priv);
+       if (!reload)
+               devlink_free(devlink);
 
        return;
 
index 39eff6a..fcf9095 100644 (file)
@@ -7279,10 +7279,11 @@ static inline void mlxsw_reg_ralue_pack4(char *payload,
                                         enum mlxsw_reg_ralxx_protocol protocol,
                                         enum mlxsw_reg_ralue_op op,
                                         u16 virtual_router, u8 prefix_len,
-                                        u32 dip)
+                                        u32 *dip)
 {
        mlxsw_reg_ralue_pack(payload, protocol, op, virtual_router, prefix_len);
-       mlxsw_reg_ralue_dip4_set(payload, dip);
+       if (dip)
+               mlxsw_reg_ralue_dip4_set(payload, *dip);
 }
 
 static inline void mlxsw_reg_ralue_pack6(char *payload,
@@ -7292,7 +7293,8 @@ static inline void mlxsw_reg_ralue_pack6(char *payload,
                                         const void *dip)
 {
        mlxsw_reg_ralue_pack(payload, protocol, op, virtual_router, prefix_len);
-       mlxsw_reg_ralue_dip6_memcpy_to(payload, dip);
+       if (dip)
+               mlxsw_reg_ralue_dip6_memcpy_to(payload, dip);
 }
 
 static inline void
@@ -8245,6 +8247,86 @@ mlxsw_reg_rmft2_ipv6_pack(char *payload, bool v, u16 offset, u16 virtual_router,
        mlxsw_reg_rmft2_sip6_mask_memcpy_to(payload, (void *)&sip6_mask);
 }
 
+/* Note that XRALXX register position violates the rule of ordering register
+ * definition by the ID. However, XRALXX pack helpers are using RALXX pack
+ * helpers, RALXX registers have higher IDs.
+ */
+
+/* XRALTA - XM Router Algorithmic LPM Tree Allocation Register
+ * -----------------------------------------------------------
+ * The XRALTA is used to allocate the XLT LPM trees.
+ *
+ * This register embeds original RALTA register.
+ */
+#define MLXSW_REG_XRALTA_ID 0x7811
+#define MLXSW_REG_XRALTA_LEN 0x08
+#define MLXSW_REG_XRALTA_RALTA_OFFSET 0x04
+
+MLXSW_REG_DEFINE(xralta, MLXSW_REG_XRALTA_ID, MLXSW_REG_XRALTA_LEN);
+
+static inline void mlxsw_reg_xralta_pack(char *payload, bool alloc,
+                                        enum mlxsw_reg_ralxx_protocol protocol,
+                                        u8 tree_id)
+{
+       char *ralta_payload = payload + MLXSW_REG_XRALTA_RALTA_OFFSET;
+
+       MLXSW_REG_ZERO(xralta, payload);
+       mlxsw_reg_ralta_pack(ralta_payload, alloc, protocol, tree_id);
+}
+
+/* XRALST - XM Router Algorithmic LPM Structure Tree Register
+ * ----------------------------------------------------------
+ * The XRALST is used to set and query the structure of an XLT LPM tree.
+ *
+ * This register embeds original RALST register.
+ */
+#define MLXSW_REG_XRALST_ID 0x7812
+#define MLXSW_REG_XRALST_LEN 0x108
+#define MLXSW_REG_XRALST_RALST_OFFSET 0x04
+
+MLXSW_REG_DEFINE(xralst, MLXSW_REG_XRALST_ID, MLXSW_REG_XRALST_LEN);
+
+static inline void mlxsw_reg_xralst_pack(char *payload, u8 root_bin, u8 tree_id)
+{
+       char *ralst_payload = payload + MLXSW_REG_XRALST_RALST_OFFSET;
+
+       MLXSW_REG_ZERO(xralst, payload);
+       mlxsw_reg_ralst_pack(ralst_payload, root_bin, tree_id);
+}
+
+static inline void mlxsw_reg_xralst_bin_pack(char *payload, u8 bin_number,
+                                            u8 left_child_bin,
+                                            u8 right_child_bin)
+{
+       char *ralst_payload = payload + MLXSW_REG_XRALST_RALST_OFFSET;
+
+       mlxsw_reg_ralst_bin_pack(ralst_payload, bin_number, left_child_bin,
+                                right_child_bin);
+}
+
+/* XRALTB - XM Router Algorithmic LPM Tree Binding Register
+ * --------------------------------------------------------
+ * The XRALTB register is used to bind virtual router and protocol
+ * to an allocated LPM tree.
+ *
+ * This register embeds original RALTB register.
+ */
+#define MLXSW_REG_XRALTB_ID 0x7813
+#define MLXSW_REG_XRALTB_LEN 0x08
+#define MLXSW_REG_XRALTB_RALTB_OFFSET 0x04
+
+MLXSW_REG_DEFINE(xraltb, MLXSW_REG_XRALTB_ID, MLXSW_REG_XRALTB_LEN);
+
+static inline void mlxsw_reg_xraltb_pack(char *payload, u16 virtual_router,
+                                        enum mlxsw_reg_ralxx_protocol protocol,
+                                        u8 tree_id)
+{
+       char *raltb_payload = payload + MLXSW_REG_XRALTB_RALTB_OFFSET;
+
+       MLXSW_REG_ZERO(xraltb, payload);
+       mlxsw_reg_raltb_pack(raltb_payload, virtual_router, protocol, tree_id);
+}
+
 /* MFCR - Management Fan Control Register
  * --------------------------------------
  * This register controls the settings of the Fan Speed PWM mechanism.
@@ -11195,6 +11277,9 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {
        MLXSW_REG(rigr2),
        MLXSW_REG(recr2),
        MLXSW_REG(rmft2),
+       MLXSW_REG(xralta),
+       MLXSW_REG(xralst),
+       MLXSW_REG(xraltb),
        MLXSW_REG(mfcr),
        MLXSW_REG(mfsc),
        MLXSW_REG(mfsm),
index 16b47fc..b08853f 100644 (file)
@@ -1174,11 +1174,14 @@ mlxsw_sp_port_speed_by_width_set(struct mlxsw_sp_port *mlxsw_sp_port)
        u32 eth_proto_cap, eth_proto_admin, eth_proto_oper;
        const struct mlxsw_sp_port_type_speed_ops *ops;
        char ptys_pl[MLXSW_REG_PTYS_LEN];
+       u32 eth_proto_cap_masked;
        int err;
 
        ops = mlxsw_sp->port_type_speed_ops;
 
-       /* Set advertised speeds to supported speeds. */
+       /* Set advertised speeds to speeds supported by both the driver
+        * and the device.
+        */
        ops->reg_ptys_eth_pack(mlxsw_sp, ptys_pl, mlxsw_sp_port->local_port,
                               0, false);
        err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl);
@@ -1187,8 +1190,10 @@ mlxsw_sp_port_speed_by_width_set(struct mlxsw_sp_port *mlxsw_sp_port)
 
        ops->reg_ptys_eth_unpack(mlxsw_sp, ptys_pl, &eth_proto_cap,
                                 &eth_proto_admin, &eth_proto_oper);
+       eth_proto_cap_masked = ops->ptys_proto_cap_masked_get(eth_proto_cap);
        ops->reg_ptys_eth_pack(mlxsw_sp, ptys_pl, mlxsw_sp_port->local_port,
-                              eth_proto_cap, mlxsw_sp_port->link.autoneg);
+                              eth_proto_cap_masked,
+                              mlxsw_sp_port->link.autoneg);
        return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl);
 }
 
index 3e26eb6..74b3959 100644 (file)
@@ -342,6 +342,7 @@ struct mlxsw_sp_port_type_speed_ops {
                                    u32 *p_eth_proto_cap,
                                    u32 *p_eth_proto_admin,
                                    u32 *p_eth_proto_oper);
+       u32 (*ptys_proto_cap_masked_get)(u32 eth_proto_cap);
 };
 
 static inline struct net_device *
index 2096b64..5406164 100644 (file)
@@ -1303,6 +1303,20 @@ mlxsw_sp1_reg_ptys_eth_unpack(struct mlxsw_sp *mlxsw_sp, char *payload,
                                  p_eth_proto_oper);
 }
 
+static u32 mlxsw_sp1_ptys_proto_cap_masked_get(u32 eth_proto_cap)
+{
+       u32 ptys_proto_cap_masked = 0;
+       int i;
+
+       for (i = 0; i < MLXSW_SP1_PORT_LINK_MODE_LEN; i++) {
+               if (mlxsw_sp1_port_link_mode[i].mask & eth_proto_cap)
+                       ptys_proto_cap_masked |=
+                               mlxsw_sp1_port_link_mode[i].mask;
+       }
+
+       return ptys_proto_cap_masked;
+}
+
 const struct mlxsw_sp_port_type_speed_ops mlxsw_sp1_port_type_speed_ops = {
        .from_ptys_supported_port       = mlxsw_sp1_from_ptys_supported_port,
        .from_ptys_link                 = mlxsw_sp1_from_ptys_link,
@@ -1313,6 +1327,7 @@ const struct mlxsw_sp_port_type_speed_ops mlxsw_sp1_port_type_speed_ops = {
        .to_ptys_speed                  = mlxsw_sp1_to_ptys_speed,
        .reg_ptys_eth_pack              = mlxsw_sp1_reg_ptys_eth_pack,
        .reg_ptys_eth_unpack            = mlxsw_sp1_reg_ptys_eth_unpack,
+       .ptys_proto_cap_masked_get      = mlxsw_sp1_ptys_proto_cap_masked_get,
 };
 
 static const enum ethtool_link_mode_bit_indices
@@ -1731,6 +1746,20 @@ mlxsw_sp2_reg_ptys_eth_unpack(struct mlxsw_sp *mlxsw_sp, char *payload,
                                      p_eth_proto_admin, p_eth_proto_oper);
 }
 
+static u32 mlxsw_sp2_ptys_proto_cap_masked_get(u32 eth_proto_cap)
+{
+       u32 ptys_proto_cap_masked = 0;
+       int i;
+
+       for (i = 0; i < MLXSW_SP2_PORT_LINK_MODE_LEN; i++) {
+               if (mlxsw_sp2_port_link_mode[i].mask & eth_proto_cap)
+                       ptys_proto_cap_masked |=
+                               mlxsw_sp2_port_link_mode[i].mask;
+       }
+
+       return ptys_proto_cap_masked;
+}
+
 const struct mlxsw_sp_port_type_speed_ops mlxsw_sp2_port_type_speed_ops = {
        .from_ptys_supported_port       = mlxsw_sp2_from_ptys_supported_port,
        .from_ptys_link                 = mlxsw_sp2_from_ptys_link,
@@ -1741,4 +1770,5 @@ const struct mlxsw_sp_port_type_speed_ops mlxsw_sp2_port_type_speed_ops = {
        .to_ptys_speed                  = mlxsw_sp2_to_ptys_speed,
        .reg_ptys_eth_pack              = mlxsw_sp2_reg_ptys_eth_pack,
        .reg_ptys_eth_unpack            = mlxsw_sp2_reg_ptys_eth_unpack,
+       .ptys_proto_cap_masked_get      = mlxsw_sp2_ptys_proto_cap_masked_get,
 };
index a852599..ab2e0eb 100644 (file)
@@ -181,23 +181,26 @@ mlxsw_sp_ipip_fib_entry_op_gre4_rtdp(struct mlxsw_sp *mlxsw_sp,
 }
 
 static int
-mlxsw_sp_ipip_fib_entry_op_gre4_ralue(struct mlxsw_sp *mlxsw_sp,
-                                     u32 dip, u8 prefix_len, u16 ul_vr_id,
-                                     enum mlxsw_reg_ralue_op op,
-                                     u32 tunnel_index)
+mlxsw_sp_ipip_fib_entry_op_gre4_do(struct mlxsw_sp *mlxsw_sp,
+                                  const struct mlxsw_sp_router_ll_ops *ll_ops,
+                                  struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                  u32 dip, u8 prefix_len, u16 ul_vr_id,
+                                  enum mlxsw_sp_fib_entry_op op,
+                                  u32 tunnel_index,
+                                  struct mlxsw_sp_fib_entry_priv *priv)
 {
-       char ralue_pl[MLXSW_REG_RALUE_LEN];
-
-       mlxsw_reg_ralue_pack4(ralue_pl, MLXSW_REG_RALXX_PROTOCOL_IPV4, op,
-                             ul_vr_id, prefix_len, dip);
-       mlxsw_reg_ralue_act_ip2me_tun_pack(ralue_pl, tunnel_index);
-       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue), ralue_pl);
+       ll_ops->fib_entry_pack(op_ctx, MLXSW_SP_L3_PROTO_IPV4, op, ul_vr_id,
+                              prefix_len, (unsigned char *) &dip, priv);
+       ll_ops->fib_entry_act_ip2me_tun_pack(op_ctx, tunnel_index);
+       return mlxsw_sp_fib_entry_commit(mlxsw_sp, op_ctx, ll_ops);
 }
 
 static int mlxsw_sp_ipip_fib_entry_op_gre4(struct mlxsw_sp *mlxsw_sp,
-                                       struct mlxsw_sp_ipip_entry *ipip_entry,
-                                       enum mlxsw_reg_ralue_op op,
-                                       u32 tunnel_index)
+                                          const struct mlxsw_sp_router_ll_ops *ll_ops,
+                                          struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                          struct mlxsw_sp_ipip_entry *ipip_entry,
+                                          enum mlxsw_sp_fib_entry_op op, u32 tunnel_index,
+                                          struct mlxsw_sp_fib_entry_priv *priv)
 {
        u16 ul_vr_id = mlxsw_sp_ipip_lb_ul_vr_id(ipip_entry->ol_lb);
        __be32 dip;
@@ -210,9 +213,8 @@ static int mlxsw_sp_ipip_fib_entry_op_gre4(struct mlxsw_sp *mlxsw_sp,
 
        dip = mlxsw_sp_ipip_netdev_saddr(MLXSW_SP_L3_PROTO_IPV4,
                                         ipip_entry->ol_dev).addr4;
-       return mlxsw_sp_ipip_fib_entry_op_gre4_ralue(mlxsw_sp, be32_to_cpu(dip),
-                                                    32, ul_vr_id, op,
-                                                    tunnel_index);
+       return mlxsw_sp_ipip_fib_entry_op_gre4_do(mlxsw_sp, ll_ops, op_ctx, be32_to_cpu(dip),
+                                                 32, ul_vr_id, op, tunnel_index, priv);
 }
 
 static bool mlxsw_sp_ipip_tunnel_complete(enum mlxsw_sp_l3proto proto,
index bb5c4d4..00448cb 100644 (file)
@@ -52,9 +52,12 @@ struct mlxsw_sp_ipip_ops {
                              const struct net_device *ol_dev);
 
        int (*fib_entry_op)(struct mlxsw_sp *mlxsw_sp,
+                           const struct mlxsw_sp_router_ll_ops *ll_ops,
+                           struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                            struct mlxsw_sp_ipip_entry *ipip_entry,
-                           enum mlxsw_reg_ralue_op op,
-                           u32 tunnel_index);
+                           enum mlxsw_sp_fib_entry_op op,
+                           u32 tunnel_index,
+                           struct mlxsw_sp_fib_entry_priv *priv);
 
        int (*ol_netdev_change)(struct mlxsw_sp *mlxsw_sp,
                                struct mlxsw_sp_ipip_entry *ipip_entry,
index 4381f8c..e692e5a 100644 (file)
@@ -368,12 +368,65 @@ struct mlxsw_sp_fib_entry_decap {
        u32 tunnel_index;
 };
 
+static struct mlxsw_sp_fib_entry_priv *
+mlxsw_sp_fib_entry_priv_create(const struct mlxsw_sp_router_ll_ops *ll_ops)
+{
+       struct mlxsw_sp_fib_entry_priv *priv;
+
+       if (!ll_ops->fib_entry_priv_size)
+               /* No need to have priv */
+               return NULL;
+
+       priv = kzalloc(sizeof(*priv) + ll_ops->fib_entry_priv_size, GFP_KERNEL);
+       if (!priv)
+               return ERR_PTR(-ENOMEM);
+       refcount_set(&priv->refcnt, 1);
+       return priv;
+}
+
+static void
+mlxsw_sp_fib_entry_priv_destroy(struct mlxsw_sp_fib_entry_priv *priv)
+{
+       kfree(priv);
+}
+
+static void mlxsw_sp_fib_entry_priv_hold(struct mlxsw_sp_fib_entry_priv *priv)
+{
+       refcount_inc(&priv->refcnt);
+}
+
+static void mlxsw_sp_fib_entry_priv_put(struct mlxsw_sp_fib_entry_priv *priv)
+{
+       if (!priv || !refcount_dec_and_test(&priv->refcnt))
+               return;
+       mlxsw_sp_fib_entry_priv_destroy(priv);
+}
+
+static void mlxsw_sp_fib_entry_op_ctx_priv_hold(struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                               struct mlxsw_sp_fib_entry_priv *priv)
+{
+       if (!priv)
+               return;
+       mlxsw_sp_fib_entry_priv_hold(priv);
+       list_add(&priv->list, &op_ctx->fib_entry_priv_list);
+}
+
+static void mlxsw_sp_fib_entry_op_ctx_priv_put_all(struct mlxsw_sp_fib_entry_op_ctx *op_ctx)
+{
+       struct mlxsw_sp_fib_entry_priv *priv, *tmp;
+
+       list_for_each_entry_safe(priv, tmp, &op_ctx->fib_entry_priv_list, list)
+               mlxsw_sp_fib_entry_priv_put(priv);
+       INIT_LIST_HEAD(&op_ctx->fib_entry_priv_list);
+}
+
 struct mlxsw_sp_fib_entry {
        struct mlxsw_sp_fib_node *fib_node;
        enum mlxsw_sp_fib_entry_type type;
        struct list_head nexthop_group_node;
        struct mlxsw_sp_nexthop_group *nh_group;
        struct mlxsw_sp_fib_entry_decap decap; /* Valid for decap entries. */
+       struct mlxsw_sp_fib_entry_priv *priv;
 };
 
 struct mlxsw_sp_fib4_entry {
@@ -409,6 +462,7 @@ struct mlxsw_sp_fib {
        struct mlxsw_sp_vr *vr;
        struct mlxsw_sp_lpm_tree *lpm_tree;
        enum mlxsw_sp_l3proto proto;
+       const struct mlxsw_sp_router_ll_ops *ll_ops;
 };
 
 struct mlxsw_sp_vr {
@@ -422,12 +476,31 @@ struct mlxsw_sp_vr {
        refcount_t ul_rif_refcnt;
 };
 
+static int mlxsw_sp_router_ll_basic_ralta_write(struct mlxsw_sp *mlxsw_sp, char *xralta_pl)
+{
+       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralta),
+                              xralta_pl + MLXSW_REG_XRALTA_RALTA_OFFSET);
+}
+
+static int mlxsw_sp_router_ll_basic_ralst_write(struct mlxsw_sp *mlxsw_sp, char *xralst_pl)
+{
+       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralst),
+                              xralst_pl + MLXSW_REG_XRALST_RALST_OFFSET);
+}
+
+static int mlxsw_sp_router_ll_basic_raltb_write(struct mlxsw_sp *mlxsw_sp, char *xraltb_pl)
+{
+       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(raltb),
+                              xraltb_pl + MLXSW_REG_XRALTB_RALTB_OFFSET);
+}
+
 static const struct rhashtable_params mlxsw_sp_fib_ht_params;
 
 static struct mlxsw_sp_fib *mlxsw_sp_fib_create(struct mlxsw_sp *mlxsw_sp,
                                                struct mlxsw_sp_vr *vr,
                                                enum mlxsw_sp_l3proto proto)
 {
+       const struct mlxsw_sp_router_ll_ops *ll_ops = mlxsw_sp->router->proto_ll_ops[proto];
        struct mlxsw_sp_lpm_tree *lpm_tree;
        struct mlxsw_sp_fib *fib;
        int err;
@@ -443,6 +516,7 @@ static struct mlxsw_sp_fib *mlxsw_sp_fib_create(struct mlxsw_sp *mlxsw_sp,
        fib->proto = proto;
        fib->vr = vr;
        fib->lpm_tree = lpm_tree;
+       fib->ll_ops = ll_ops;
        mlxsw_sp_lpm_tree_hold(lpm_tree);
        err = mlxsw_sp_vr_lpm_tree_bind(mlxsw_sp, fib, lpm_tree->id);
        if (err)
@@ -481,33 +555,36 @@ mlxsw_sp_lpm_tree_find_unused(struct mlxsw_sp *mlxsw_sp)
 }
 
 static int mlxsw_sp_lpm_tree_alloc(struct mlxsw_sp *mlxsw_sp,
+                                  const struct mlxsw_sp_router_ll_ops *ll_ops,
                                   struct mlxsw_sp_lpm_tree *lpm_tree)
 {
-       char ralta_pl[MLXSW_REG_RALTA_LEN];
+       char xralta_pl[MLXSW_REG_XRALTA_LEN];
 
-       mlxsw_reg_ralta_pack(ralta_pl, true,
-                            (enum mlxsw_reg_ralxx_protocol) lpm_tree->proto,
-                            lpm_tree->id);
-       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralta), ralta_pl);
+       mlxsw_reg_xralta_pack(xralta_pl, true,
+                             (enum mlxsw_reg_ralxx_protocol) lpm_tree->proto,
+                             lpm_tree->id);
+       return ll_ops->ralta_write(mlxsw_sp, xralta_pl);
 }
 
 static void mlxsw_sp_lpm_tree_free(struct mlxsw_sp *mlxsw_sp,
+                                  const struct mlxsw_sp_router_ll_ops *ll_ops,
                                   struct mlxsw_sp_lpm_tree *lpm_tree)
 {
-       char ralta_pl[MLXSW_REG_RALTA_LEN];
+       char xralta_pl[MLXSW_REG_XRALTA_LEN];
 
-       mlxsw_reg_ralta_pack(ralta_pl, false,
-                            (enum mlxsw_reg_ralxx_protocol) lpm_tree->proto,
-                            lpm_tree->id);
-       mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralta), ralta_pl);
+       mlxsw_reg_xralta_pack(xralta_pl, false,
+                             (enum mlxsw_reg_ralxx_protocol) lpm_tree->proto,
+                             lpm_tree->id);
+       ll_ops->ralta_write(mlxsw_sp, xralta_pl);
 }
 
 static int
 mlxsw_sp_lpm_tree_left_struct_set(struct mlxsw_sp *mlxsw_sp,
+                                 const struct mlxsw_sp_router_ll_ops *ll_ops,
                                  struct mlxsw_sp_prefix_usage *prefix_usage,
                                  struct mlxsw_sp_lpm_tree *lpm_tree)
 {
-       char ralst_pl[MLXSW_REG_RALST_LEN];
+       char xralst_pl[MLXSW_REG_XRALST_LEN];
        u8 root_bin = 0;
        u8 prefix;
        u8 last_prefix = MLXSW_REG_RALST_BIN_NO_CHILD;
@@ -515,19 +592,20 @@ mlxsw_sp_lpm_tree_left_struct_set(struct mlxsw_sp *mlxsw_sp,
        mlxsw_sp_prefix_usage_for_each(prefix, prefix_usage)
                root_bin = prefix;
 
-       mlxsw_reg_ralst_pack(ralst_pl, root_bin, lpm_tree->id);
+       mlxsw_reg_xralst_pack(xralst_pl, root_bin, lpm_tree->id);
        mlxsw_sp_prefix_usage_for_each(prefix, prefix_usage) {
                if (prefix == 0)
                        continue;
-               mlxsw_reg_ralst_bin_pack(ralst_pl, prefix, last_prefix,
-                                        MLXSW_REG_RALST_BIN_NO_CHILD);
+               mlxsw_reg_xralst_bin_pack(xralst_pl, prefix, last_prefix,
+                                         MLXSW_REG_RALST_BIN_NO_CHILD);
                last_prefix = prefix;
        }
-       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralst), ralst_pl);
+       return ll_ops->ralst_write(mlxsw_sp, xralst_pl);
 }
 
 static struct mlxsw_sp_lpm_tree *
 mlxsw_sp_lpm_tree_create(struct mlxsw_sp *mlxsw_sp,
+                        const struct mlxsw_sp_router_ll_ops *ll_ops,
                         struct mlxsw_sp_prefix_usage *prefix_usage,
                         enum mlxsw_sp_l3proto proto)
 {
@@ -538,12 +616,11 @@ mlxsw_sp_lpm_tree_create(struct mlxsw_sp *mlxsw_sp,
        if (!lpm_tree)
                return ERR_PTR(-EBUSY);
        lpm_tree->proto = proto;
-       err = mlxsw_sp_lpm_tree_alloc(mlxsw_sp, lpm_tree);
+       err = mlxsw_sp_lpm_tree_alloc(mlxsw_sp, ll_ops, lpm_tree);
        if (err)
                return ERR_PTR(err);
 
-       err = mlxsw_sp_lpm_tree_left_struct_set(mlxsw_sp, prefix_usage,
-                                               lpm_tree);
+       err = mlxsw_sp_lpm_tree_left_struct_set(mlxsw_sp, ll_ops, prefix_usage, lpm_tree);
        if (err)
                goto err_left_struct_set;
        memcpy(&lpm_tree->prefix_usage, prefix_usage,
@@ -554,14 +631,15 @@ mlxsw_sp_lpm_tree_create(struct mlxsw_sp *mlxsw_sp,
        return lpm_tree;
 
 err_left_struct_set:
-       mlxsw_sp_lpm_tree_free(mlxsw_sp, lpm_tree);
+       mlxsw_sp_lpm_tree_free(mlxsw_sp, ll_ops, lpm_tree);
        return ERR_PTR(err);
 }
 
 static void mlxsw_sp_lpm_tree_destroy(struct mlxsw_sp *mlxsw_sp,
+                                     const struct mlxsw_sp_router_ll_ops *ll_ops,
                                      struct mlxsw_sp_lpm_tree *lpm_tree)
 {
-       mlxsw_sp_lpm_tree_free(mlxsw_sp, lpm_tree);
+       mlxsw_sp_lpm_tree_free(mlxsw_sp, ll_ops, lpm_tree);
 }
 
 static struct mlxsw_sp_lpm_tree *
@@ -569,6 +647,7 @@ mlxsw_sp_lpm_tree_get(struct mlxsw_sp *mlxsw_sp,
                      struct mlxsw_sp_prefix_usage *prefix_usage,
                      enum mlxsw_sp_l3proto proto)
 {
+       const struct mlxsw_sp_router_ll_ops *ll_ops = mlxsw_sp->router->proto_ll_ops[proto];
        struct mlxsw_sp_lpm_tree *lpm_tree;
        int i;
 
@@ -582,7 +661,7 @@ mlxsw_sp_lpm_tree_get(struct mlxsw_sp *mlxsw_sp,
                        return lpm_tree;
                }
        }
-       return mlxsw_sp_lpm_tree_create(mlxsw_sp, prefix_usage, proto);
+       return mlxsw_sp_lpm_tree_create(mlxsw_sp, ll_ops, prefix_usage, proto);
 }
 
 static void mlxsw_sp_lpm_tree_hold(struct mlxsw_sp_lpm_tree *lpm_tree)
@@ -593,8 +672,11 @@ static void mlxsw_sp_lpm_tree_hold(struct mlxsw_sp_lpm_tree *lpm_tree)
 static void mlxsw_sp_lpm_tree_put(struct mlxsw_sp *mlxsw_sp,
                                  struct mlxsw_sp_lpm_tree *lpm_tree)
 {
+       const struct mlxsw_sp_router_ll_ops *ll_ops =
+                               mlxsw_sp->router->proto_ll_ops[lpm_tree->proto];
+
        if (--lpm_tree->ref_count == 0)
-               mlxsw_sp_lpm_tree_destroy(mlxsw_sp, lpm_tree);
+               mlxsw_sp_lpm_tree_destroy(mlxsw_sp, ll_ops, lpm_tree);
 }
 
 #define MLXSW_SP_LPM_TREE_MIN 1 /* tree 0 is reserved */
@@ -684,23 +766,23 @@ static struct mlxsw_sp_vr *mlxsw_sp_vr_find_unused(struct mlxsw_sp *mlxsw_sp)
 static int mlxsw_sp_vr_lpm_tree_bind(struct mlxsw_sp *mlxsw_sp,
                                     const struct mlxsw_sp_fib *fib, u8 tree_id)
 {
-       char raltb_pl[MLXSW_REG_RALTB_LEN];
+       char xraltb_pl[MLXSW_REG_XRALTB_LEN];
 
-       mlxsw_reg_raltb_pack(raltb_pl, fib->vr->id,
-                            (enum mlxsw_reg_ralxx_protocol) fib->proto,
-                            tree_id);
-       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(raltb), raltb_pl);
+       mlxsw_reg_xraltb_pack(xraltb_pl, fib->vr->id,
+                             (enum mlxsw_reg_ralxx_protocol) fib->proto,
+                             tree_id);
+       return fib->ll_ops->raltb_write(mlxsw_sp, xraltb_pl);
 }
 
 static int mlxsw_sp_vr_lpm_tree_unbind(struct mlxsw_sp *mlxsw_sp,
                                       const struct mlxsw_sp_fib *fib)
 {
-       char raltb_pl[MLXSW_REG_RALTB_LEN];
+       char xraltb_pl[MLXSW_REG_XRALTB_LEN];
 
        /* Bind to tree 0 which is default */
-       mlxsw_reg_raltb_pack(raltb_pl, fib->vr->id,
-                            (enum mlxsw_reg_ralxx_protocol) fib->proto, 0);
-       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(raltb), raltb_pl);
+       mlxsw_reg_xraltb_pack(xraltb_pl, fib->vr->id,
+                             (enum mlxsw_reg_ralxx_protocol) fib->proto, 0);
+       return fib->ll_ops->raltb_write(mlxsw_sp, xraltb_pl);
 }
 
 static u32 mlxsw_sp_fix_tb_id(u32 tb_id)
@@ -4264,13 +4346,14 @@ mlxsw_sp_fib_entry_hw_flags_clear(struct mlxsw_sp *mlxsw_sp,
 static void
 mlxsw_sp_fib_entry_hw_flags_refresh(struct mlxsw_sp *mlxsw_sp,
                                    struct mlxsw_sp_fib_entry *fib_entry,
-                                   enum mlxsw_reg_ralue_op op)
+                                   enum mlxsw_sp_fib_entry_op op)
 {
        switch (op) {
-       case MLXSW_REG_RALUE_OP_WRITE_WRITE:
+       case MLXSW_SP_FIB_ENTRY_OP_WRITE:
+       case MLXSW_SP_FIB_ENTRY_OP_UPDATE:
                mlxsw_sp_fib_entry_hw_flags_set(mlxsw_sp, fib_entry);
                break;
-       case MLXSW_REG_RALUE_OP_WRITE_DELETE:
+       case MLXSW_SP_FIB_ENTRY_OP_DELETE:
                mlxsw_sp_fib_entry_hw_flags_clear(mlxsw_sp, fib_entry);
                break;
        default:
@@ -4278,32 +4361,132 @@ mlxsw_sp_fib_entry_hw_flags_refresh(struct mlxsw_sp *mlxsw_sp,
        }
 }
 
+struct mlxsw_sp_fib_entry_op_ctx_basic {
+       char ralue_pl[MLXSW_REG_RALUE_LEN];
+};
+
 static void
-mlxsw_sp_fib_entry_ralue_pack(char *ralue_pl,
-                             const struct mlxsw_sp_fib_entry *fib_entry,
-                             enum mlxsw_reg_ralue_op op)
+mlxsw_sp_router_ll_basic_fib_entry_pack(struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                       enum mlxsw_sp_l3proto proto,
+                                       enum mlxsw_sp_fib_entry_op op,
+                                       u16 virtual_router, u8 prefix_len,
+                                       unsigned char *addr,
+                                       struct mlxsw_sp_fib_entry_priv *priv)
 {
-       struct mlxsw_sp_fib *fib = fib_entry->fib_node->fib;
-       enum mlxsw_reg_ralxx_protocol proto;
-       u32 *p_dip;
+       struct mlxsw_sp_fib_entry_op_ctx_basic *op_ctx_basic = (void *) op_ctx->ll_priv;
+       enum mlxsw_reg_ralxx_protocol ralxx_proto;
+       char *ralue_pl = op_ctx_basic->ralue_pl;
+       enum mlxsw_reg_ralue_op ralue_op;
+
+       ralxx_proto = (enum mlxsw_reg_ralxx_protocol) proto;
 
-       proto = (enum mlxsw_reg_ralxx_protocol) fib->proto;
+       switch (op) {
+       case MLXSW_SP_FIB_ENTRY_OP_WRITE:
+       case MLXSW_SP_FIB_ENTRY_OP_UPDATE:
+               ralue_op = MLXSW_REG_RALUE_OP_WRITE_WRITE;
+               break;
+       case MLXSW_SP_FIB_ENTRY_OP_DELETE:
+               ralue_op = MLXSW_REG_RALUE_OP_WRITE_DELETE;
+               break;
+       default:
+               WARN_ON_ONCE(1);
+               return;
+       }
 
-       switch (fib->proto) {
+       switch (proto) {
        case MLXSW_SP_L3_PROTO_IPV4:
-               p_dip = (u32 *) fib_entry->fib_node->key.addr;
-               mlxsw_reg_ralue_pack4(ralue_pl, proto, op, fib->vr->id,
-                                     fib_entry->fib_node->key.prefix_len,
-                                     *p_dip);
+               mlxsw_reg_ralue_pack4(ralue_pl, ralxx_proto, ralue_op,
+                                     virtual_router, prefix_len, (u32 *) addr);
                break;
        case MLXSW_SP_L3_PROTO_IPV6:
-               mlxsw_reg_ralue_pack6(ralue_pl, proto, op, fib->vr->id,
-                                     fib_entry->fib_node->key.prefix_len,
-                                     fib_entry->fib_node->key.addr);
+               mlxsw_reg_ralue_pack6(ralue_pl, ralxx_proto, ralue_op,
+                                     virtual_router, prefix_len, addr);
                break;
        }
 }
 
+static void
+mlxsw_sp_router_ll_basic_fib_entry_act_remote_pack(struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                                  enum mlxsw_reg_ralue_trap_action trap_action,
+                                                  u16 trap_id, u32 adjacency_index, u16 ecmp_size)
+{
+       struct mlxsw_sp_fib_entry_op_ctx_basic *op_ctx_basic = (void *) op_ctx->ll_priv;
+
+       mlxsw_reg_ralue_act_remote_pack(op_ctx_basic->ralue_pl, trap_action,
+                                       trap_id, adjacency_index, ecmp_size);
+}
+
+static void
+mlxsw_sp_router_ll_basic_fib_entry_act_local_pack(struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                                 enum mlxsw_reg_ralue_trap_action trap_action,
+                                                 u16 trap_id, u16 local_erif)
+{
+       struct mlxsw_sp_fib_entry_op_ctx_basic *op_ctx_basic = (void *) op_ctx->ll_priv;
+
+       mlxsw_reg_ralue_act_local_pack(op_ctx_basic->ralue_pl, trap_action,
+                                      trap_id, local_erif);
+}
+
+static void
+mlxsw_sp_router_ll_basic_fib_entry_act_ip2me_pack(struct mlxsw_sp_fib_entry_op_ctx *op_ctx)
+{
+       struct mlxsw_sp_fib_entry_op_ctx_basic *op_ctx_basic = (void *) op_ctx->ll_priv;
+
+       mlxsw_reg_ralue_act_ip2me_pack(op_ctx_basic->ralue_pl);
+}
+
+static void
+mlxsw_sp_router_ll_basic_fib_entry_act_ip2me_tun_pack(struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                                     u32 tunnel_ptr)
+{
+       struct mlxsw_sp_fib_entry_op_ctx_basic *op_ctx_basic = (void *) op_ctx->ll_priv;
+
+       mlxsw_reg_ralue_act_ip2me_tun_pack(op_ctx_basic->ralue_pl, tunnel_ptr);
+}
+
+static int
+mlxsw_sp_router_ll_basic_fib_entry_commit(struct mlxsw_sp *mlxsw_sp,
+                                         struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                         bool *postponed_for_bulk)
+{
+       struct mlxsw_sp_fib_entry_op_ctx_basic *op_ctx_basic = (void *) op_ctx->ll_priv;
+
+       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue),
+                              op_ctx_basic->ralue_pl);
+}
+
+static bool
+mlxsw_sp_router_ll_basic_fib_entry_is_committed(struct mlxsw_sp_fib_entry_priv *priv)
+{
+       return true;
+}
+
+static void mlxsw_sp_fib_entry_pack(struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                   struct mlxsw_sp_fib_entry *fib_entry,
+                                   enum mlxsw_sp_fib_entry_op op)
+{
+       struct mlxsw_sp_fib *fib = fib_entry->fib_node->fib;
+
+       mlxsw_sp_fib_entry_op_ctx_priv_hold(op_ctx, fib_entry->priv);
+       fib->ll_ops->fib_entry_pack(op_ctx, fib->proto, op, fib->vr->id,
+                                   fib_entry->fib_node->key.prefix_len,
+                                   fib_entry->fib_node->key.addr,
+                                   fib_entry->priv);
+}
+
+int mlxsw_sp_fib_entry_commit(struct mlxsw_sp *mlxsw_sp,
+                             struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                             const struct mlxsw_sp_router_ll_ops *ll_ops)
+{
+       bool postponed_for_bulk = false;
+       int err;
+
+       err = ll_ops->fib_entry_commit(mlxsw_sp, op_ctx, &postponed_for_bulk);
+       if (!postponed_for_bulk)
+               mlxsw_sp_fib_entry_op_ctx_priv_put_all(op_ctx);
+       return err;
+}
+
 static int mlxsw_sp_adj_discard_write(struct mlxsw_sp *mlxsw_sp, u16 rif_index)
 {
        enum mlxsw_reg_ratr_trap_action trap_action;
@@ -4338,11 +4521,12 @@ err_ratr_write:
 }
 
 static int mlxsw_sp_fib_entry_op_remote(struct mlxsw_sp *mlxsw_sp,
+                                       struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                        struct mlxsw_sp_fib_entry *fib_entry,
-                                       enum mlxsw_reg_ralue_op op)
+                                       enum mlxsw_sp_fib_entry_op op)
 {
+       const struct mlxsw_sp_router_ll_ops *ll_ops = fib_entry->fib_node->fib->ll_ops;
        struct mlxsw_sp_nexthop_group *nh_group = fib_entry->nh_group;
-       char ralue_pl[MLXSW_REG_RALUE_LEN];
        enum mlxsw_reg_ralue_trap_action trap_action;
        u16 trap_id = 0;
        u32 adjacency_index = 0;
@@ -4371,19 +4555,20 @@ static int mlxsw_sp_fib_entry_op_remote(struct mlxsw_sp *mlxsw_sp,
                trap_id = MLXSW_TRAP_ID_RTR_INGRESS0;
        }
 
-       mlxsw_sp_fib_entry_ralue_pack(ralue_pl, fib_entry, op);
-       mlxsw_reg_ralue_act_remote_pack(ralue_pl, trap_action, trap_id,
-                                       adjacency_index, ecmp_size);
-       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue), ralue_pl);
+       mlxsw_sp_fib_entry_pack(op_ctx, fib_entry, op);
+       ll_ops->fib_entry_act_remote_pack(op_ctx, trap_action, trap_id,
+                                         adjacency_index, ecmp_size);
+       return mlxsw_sp_fib_entry_commit(mlxsw_sp, op_ctx, ll_ops);
 }
 
 static int mlxsw_sp_fib_entry_op_local(struct mlxsw_sp *mlxsw_sp,
+                                      struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                       struct mlxsw_sp_fib_entry *fib_entry,
-                                      enum mlxsw_reg_ralue_op op)
+                                      enum mlxsw_sp_fib_entry_op op)
 {
+       const struct mlxsw_sp_router_ll_ops *ll_ops = fib_entry->fib_node->fib->ll_ops;
        struct mlxsw_sp_rif *rif = fib_entry->nh_group->nh_rif;
        enum mlxsw_reg_ralue_trap_action trap_action;
-       char ralue_pl[MLXSW_REG_RALUE_LEN];
        u16 trap_id = 0;
        u16 rif_index = 0;
 
@@ -4395,58 +4580,62 @@ static int mlxsw_sp_fib_entry_op_local(struct mlxsw_sp *mlxsw_sp,
                trap_id = MLXSW_TRAP_ID_RTR_INGRESS0;
        }
 
-       mlxsw_sp_fib_entry_ralue_pack(ralue_pl, fib_entry, op);
-       mlxsw_reg_ralue_act_local_pack(ralue_pl, trap_action, trap_id,
-                                      rif_index);
-       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue), ralue_pl);
+       mlxsw_sp_fib_entry_pack(op_ctx, fib_entry, op);
+       ll_ops->fib_entry_act_local_pack(op_ctx, trap_action, trap_id, rif_index);
+       return mlxsw_sp_fib_entry_commit(mlxsw_sp, op_ctx, ll_ops);
 }
 
 static int mlxsw_sp_fib_entry_op_trap(struct mlxsw_sp *mlxsw_sp,
+                                     struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                      struct mlxsw_sp_fib_entry *fib_entry,
-                                     enum mlxsw_reg_ralue_op op)
+                                     enum mlxsw_sp_fib_entry_op op)
 {
-       char ralue_pl[MLXSW_REG_RALUE_LEN];
+       const struct mlxsw_sp_router_ll_ops *ll_ops = fib_entry->fib_node->fib->ll_ops;
 
-       mlxsw_sp_fib_entry_ralue_pack(ralue_pl, fib_entry, op);
-       mlxsw_reg_ralue_act_ip2me_pack(ralue_pl);
-       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue), ralue_pl);
+       mlxsw_sp_fib_entry_pack(op_ctx, fib_entry, op);
+       ll_ops->fib_entry_act_ip2me_pack(op_ctx);
+       return mlxsw_sp_fib_entry_commit(mlxsw_sp, op_ctx, ll_ops);
 }
 
 static int mlxsw_sp_fib_entry_op_blackhole(struct mlxsw_sp *mlxsw_sp,
+                                          struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                           struct mlxsw_sp_fib_entry *fib_entry,
-                                          enum mlxsw_reg_ralue_op op)
+                                          enum mlxsw_sp_fib_entry_op op)
 {
+       const struct mlxsw_sp_router_ll_ops *ll_ops = fib_entry->fib_node->fib->ll_ops;
        enum mlxsw_reg_ralue_trap_action trap_action;
-       char ralue_pl[MLXSW_REG_RALUE_LEN];
 
        trap_action = MLXSW_REG_RALUE_TRAP_ACTION_DISCARD_ERROR;
-       mlxsw_sp_fib_entry_ralue_pack(ralue_pl, fib_entry, op);
-       mlxsw_reg_ralue_act_local_pack(ralue_pl, trap_action, 0, 0);
-       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue), ralue_pl);
+       mlxsw_sp_fib_entry_pack(op_ctx, fib_entry, op);
+       ll_ops->fib_entry_act_local_pack(op_ctx, trap_action, 0, 0);
+       return mlxsw_sp_fib_entry_commit(mlxsw_sp, op_ctx, ll_ops);
 }
 
 static int
 mlxsw_sp_fib_entry_op_unreachable(struct mlxsw_sp *mlxsw_sp,
+                                 struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                  struct mlxsw_sp_fib_entry *fib_entry,
-                                 enum mlxsw_reg_ralue_op op)
+                                 enum mlxsw_sp_fib_entry_op op)
 {
+       const struct mlxsw_sp_router_ll_ops *ll_ops = fib_entry->fib_node->fib->ll_ops;
        enum mlxsw_reg_ralue_trap_action trap_action;
-       char ralue_pl[MLXSW_REG_RALUE_LEN];
        u16 trap_id;
 
        trap_action = MLXSW_REG_RALUE_TRAP_ACTION_TRAP;
        trap_id = MLXSW_TRAP_ID_RTR_INGRESS1;
 
-       mlxsw_sp_fib_entry_ralue_pack(ralue_pl, fib_entry, op);
-       mlxsw_reg_ralue_act_local_pack(ralue_pl, trap_action, trap_id, 0);
-       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue), ralue_pl);
+       mlxsw_sp_fib_entry_pack(op_ctx, fib_entry, op);
+       ll_ops->fib_entry_act_local_pack(op_ctx, trap_action, trap_id, 0);
+       return mlxsw_sp_fib_entry_commit(mlxsw_sp, op_ctx, ll_ops);
 }
 
 static int
 mlxsw_sp_fib_entry_op_ipip_decap(struct mlxsw_sp *mlxsw_sp,
+                                struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                 struct mlxsw_sp_fib_entry *fib_entry,
-                                enum mlxsw_reg_ralue_op op)
+                                enum mlxsw_sp_fib_entry_op op)
 {
+       const struct mlxsw_sp_router_ll_ops *ll_ops = fib_entry->fib_node->fib->ll_ops;
        struct mlxsw_sp_ipip_entry *ipip_entry = fib_entry->decap.ipip_entry;
        const struct mlxsw_sp_ipip_ops *ipip_ops;
 
@@ -4454,52 +4643,53 @@ mlxsw_sp_fib_entry_op_ipip_decap(struct mlxsw_sp *mlxsw_sp,
                return -EINVAL;
 
        ipip_ops = mlxsw_sp->router->ipip_ops_arr[ipip_entry->ipipt];
-       return ipip_ops->fib_entry_op(mlxsw_sp, ipip_entry, op,
-                                     fib_entry->decap.tunnel_index);
+       return ipip_ops->fib_entry_op(mlxsw_sp, ll_ops, op_ctx, ipip_entry, op,
+                                     fib_entry->decap.tunnel_index, fib_entry->priv);
 }
 
 static int mlxsw_sp_fib_entry_op_nve_decap(struct mlxsw_sp *mlxsw_sp,
+                                          struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                           struct mlxsw_sp_fib_entry *fib_entry,
-                                          enum mlxsw_reg_ralue_op op)
+                                          enum mlxsw_sp_fib_entry_op op)
 {
-       char ralue_pl[MLXSW_REG_RALUE_LEN];
+       const struct mlxsw_sp_router_ll_ops *ll_ops = fib_entry->fib_node->fib->ll_ops;
 
-       mlxsw_sp_fib_entry_ralue_pack(ralue_pl, fib_entry, op);
-       mlxsw_reg_ralue_act_ip2me_tun_pack(ralue_pl,
-                                          fib_entry->decap.tunnel_index);
-       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue), ralue_pl);
+       mlxsw_sp_fib_entry_pack(op_ctx, fib_entry, op);
+       ll_ops->fib_entry_act_ip2me_tun_pack(op_ctx,
+                                            fib_entry->decap.tunnel_index);
+       return mlxsw_sp_fib_entry_commit(mlxsw_sp, op_ctx, ll_ops);
 }
 
 static int __mlxsw_sp_fib_entry_op(struct mlxsw_sp *mlxsw_sp,
+                                  struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                   struct mlxsw_sp_fib_entry *fib_entry,
-                                  enum mlxsw_reg_ralue_op op)
+                                  enum mlxsw_sp_fib_entry_op op)
 {
        switch (fib_entry->type) {
        case MLXSW_SP_FIB_ENTRY_TYPE_REMOTE:
-               return mlxsw_sp_fib_entry_op_remote(mlxsw_sp, fib_entry, op);
+               return mlxsw_sp_fib_entry_op_remote(mlxsw_sp, op_ctx, fib_entry, op);
        case MLXSW_SP_FIB_ENTRY_TYPE_LOCAL:
-               return mlxsw_sp_fib_entry_op_local(mlxsw_sp, fib_entry, op);
+               return mlxsw_sp_fib_entry_op_local(mlxsw_sp, op_ctx, fib_entry, op);
        case MLXSW_SP_FIB_ENTRY_TYPE_TRAP:
-               return mlxsw_sp_fib_entry_op_trap(mlxsw_sp, fib_entry, op);
+               return mlxsw_sp_fib_entry_op_trap(mlxsw_sp, op_ctx, fib_entry, op);
        case MLXSW_SP_FIB_ENTRY_TYPE_BLACKHOLE:
-               return mlxsw_sp_fib_entry_op_blackhole(mlxsw_sp, fib_entry, op);
+               return mlxsw_sp_fib_entry_op_blackhole(mlxsw_sp, op_ctx, fib_entry, op);
        case MLXSW_SP_FIB_ENTRY_TYPE_UNREACHABLE:
-               return mlxsw_sp_fib_entry_op_unreachable(mlxsw_sp, fib_entry,
-                                                        op);
+               return mlxsw_sp_fib_entry_op_unreachable(mlxsw_sp, op_ctx, fib_entry, op);
        case MLXSW_SP_FIB_ENTRY_TYPE_IPIP_DECAP:
-               return mlxsw_sp_fib_entry_op_ipip_decap(mlxsw_sp,
-                                                       fib_entry, op);
+               return mlxsw_sp_fib_entry_op_ipip_decap(mlxsw_sp, op_ctx, fib_entry, op);
        case MLXSW_SP_FIB_ENTRY_TYPE_NVE_DECAP:
-               return mlxsw_sp_fib_entry_op_nve_decap(mlxsw_sp, fib_entry, op);
+               return mlxsw_sp_fib_entry_op_nve_decap(mlxsw_sp, op_ctx, fib_entry, op);
        }
        return -EINVAL;
 }
 
 static int mlxsw_sp_fib_entry_op(struct mlxsw_sp *mlxsw_sp,
+                                struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                 struct mlxsw_sp_fib_entry *fib_entry,
-                                enum mlxsw_reg_ralue_op op)
+                                enum mlxsw_sp_fib_entry_op op)
 {
-       int err = __mlxsw_sp_fib_entry_op(mlxsw_sp, fib_entry, op);
+       int err = __mlxsw_sp_fib_entry_op(mlxsw_sp, op_ctx, fib_entry, op);
 
        if (err)
                return err;
@@ -4509,18 +4699,35 @@ static int mlxsw_sp_fib_entry_op(struct mlxsw_sp *mlxsw_sp,
        return err;
 }
 
+static int __mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp,
+                                      struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                      struct mlxsw_sp_fib_entry *fib_entry,
+                                      bool is_new)
+{
+       return mlxsw_sp_fib_entry_op(mlxsw_sp, op_ctx, fib_entry,
+                                    is_new ? MLXSW_SP_FIB_ENTRY_OP_WRITE :
+                                             MLXSW_SP_FIB_ENTRY_OP_UPDATE);
+}
+
 static int mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp,
                                     struct mlxsw_sp_fib_entry *fib_entry)
 {
-       return mlxsw_sp_fib_entry_op(mlxsw_sp, fib_entry,
-                                    MLXSW_REG_RALUE_OP_WRITE_WRITE);
+       struct mlxsw_sp_fib_entry_op_ctx *op_ctx = mlxsw_sp->router->ll_op_ctx;
+
+       mlxsw_sp_fib_entry_op_ctx_clear(op_ctx);
+       return __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx, fib_entry, false);
 }
 
 static int mlxsw_sp_fib_entry_del(struct mlxsw_sp *mlxsw_sp,
+                                 struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                  struct mlxsw_sp_fib_entry *fib_entry)
 {
-       return mlxsw_sp_fib_entry_op(mlxsw_sp, fib_entry,
-                                    MLXSW_REG_RALUE_OP_WRITE_DELETE);
+       const struct mlxsw_sp_router_ll_ops *ll_ops = fib_entry->fib_node->fib->ll_ops;
+
+       if (!ll_ops->fib_entry_is_committed(fib_entry->priv))
+               return 0;
+       return mlxsw_sp_fib_entry_op(mlxsw_sp, op_ctx, fib_entry,
+                                    MLXSW_SP_FIB_ENTRY_OP_DELETE);
 }
 
 static int
@@ -4608,6 +4815,12 @@ mlxsw_sp_fib4_entry_create(struct mlxsw_sp *mlxsw_sp,
                return ERR_PTR(-ENOMEM);
        fib_entry = &fib4_entry->common;
 
+       fib_entry->priv = mlxsw_sp_fib_entry_priv_create(fib_node->fib->ll_ops);
+       if (IS_ERR(fib_entry->priv)) {
+               err = PTR_ERR(fib_entry->priv);
+               goto err_fib_entry_priv_create;
+       }
+
        err = mlxsw_sp_fib4_entry_type_set(mlxsw_sp, fen_info, fib_entry);
        if (err)
                goto err_fib4_entry_type_set;
@@ -4628,6 +4841,8 @@ mlxsw_sp_fib4_entry_create(struct mlxsw_sp *mlxsw_sp,
 err_nexthop4_group_get:
        mlxsw_sp_fib4_entry_type_unset(mlxsw_sp, fib_entry);
 err_fib4_entry_type_set:
+       mlxsw_sp_fib_entry_priv_put(fib_entry->priv);
+err_fib_entry_priv_create:
        kfree(fib4_entry);
        return ERR_PTR(err);
 }
@@ -4637,6 +4852,7 @@ static void mlxsw_sp_fib4_entry_destroy(struct mlxsw_sp *mlxsw_sp,
 {
        mlxsw_sp_nexthop4_group_put(mlxsw_sp, &fib4_entry->common);
        mlxsw_sp_fib4_entry_type_unset(mlxsw_sp, &fib4_entry->common);
+       mlxsw_sp_fib_entry_priv_put(fib4_entry->common.priv);
        kfree(fib4_entry);
 }
 
@@ -4875,14 +5091,16 @@ static void mlxsw_sp_fib_node_put(struct mlxsw_sp *mlxsw_sp,
 }
 
 static int mlxsw_sp_fib_node_entry_link(struct mlxsw_sp *mlxsw_sp,
+                                       struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                        struct mlxsw_sp_fib_entry *fib_entry)
 {
        struct mlxsw_sp_fib_node *fib_node = fib_entry->fib_node;
+       bool is_new = !fib_node->fib_entry;
        int err;
 
        fib_node->fib_entry = fib_entry;
 
-       err = mlxsw_sp_fib_entry_update(mlxsw_sp, fib_entry);
+       err = __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx, fib_entry, is_new);
        if (err)
                goto err_fib_entry_update;
 
@@ -4893,14 +5111,25 @@ err_fib_entry_update:
        return err;
 }
 
-static void
-mlxsw_sp_fib_node_entry_unlink(struct mlxsw_sp *mlxsw_sp,
-                              struct mlxsw_sp_fib_entry *fib_entry)
+static int __mlxsw_sp_fib_node_entry_unlink(struct mlxsw_sp *mlxsw_sp,
+                                           struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                           struct mlxsw_sp_fib_entry *fib_entry)
 {
        struct mlxsw_sp_fib_node *fib_node = fib_entry->fib_node;
+       int err;
 
-       mlxsw_sp_fib_entry_del(mlxsw_sp, fib_entry);
+       err = mlxsw_sp_fib_entry_del(mlxsw_sp, op_ctx, fib_entry);
        fib_node->fib_entry = NULL;
+       return err;
+}
+
+static void mlxsw_sp_fib_node_entry_unlink(struct mlxsw_sp *mlxsw_sp,
+                                          struct mlxsw_sp_fib_entry *fib_entry)
+{
+       struct mlxsw_sp_fib_entry_op_ctx *op_ctx = mlxsw_sp->router->ll_op_ctx;
+
+       mlxsw_sp_fib_entry_op_ctx_clear(op_ctx);
+       __mlxsw_sp_fib_node_entry_unlink(mlxsw_sp, op_ctx, fib_entry);
 }
 
 static bool mlxsw_sp_fib4_allow_replace(struct mlxsw_sp_fib4_entry *fib4_entry)
@@ -4922,6 +5151,7 @@ static bool mlxsw_sp_fib4_allow_replace(struct mlxsw_sp_fib4_entry *fib4_entry)
 
 static int
 mlxsw_sp_router_fib4_replace(struct mlxsw_sp *mlxsw_sp,
+                            struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                             const struct fib_entry_notifier_info *fen_info)
 {
        struct mlxsw_sp_fib4_entry *fib4_entry, *fib4_replaced;
@@ -4955,7 +5185,7 @@ mlxsw_sp_router_fib4_replace(struct mlxsw_sp *mlxsw_sp,
        }
 
        replaced = fib_node->fib_entry;
-       err = mlxsw_sp_fib_node_entry_link(mlxsw_sp, &fib4_entry->common);
+       err = mlxsw_sp_fib_node_entry_link(mlxsw_sp, op_ctx, &fib4_entry->common);
        if (err) {
                dev_warn(mlxsw_sp->bus_info->dev, "Failed to link FIB entry to node\n");
                goto err_fib_node_entry_link;
@@ -4980,23 +5210,26 @@ err_fib4_entry_create:
        return err;
 }
 
-static void mlxsw_sp_router_fib4_del(struct mlxsw_sp *mlxsw_sp,
-                                    struct fib_entry_notifier_info *fen_info)
+static int mlxsw_sp_router_fib4_del(struct mlxsw_sp *mlxsw_sp,
+                                   struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                   struct fib_entry_notifier_info *fen_info)
 {
        struct mlxsw_sp_fib4_entry *fib4_entry;
        struct mlxsw_sp_fib_node *fib_node;
+       int err;
 
        if (mlxsw_sp->router->aborted)
-               return;
+               return 0;
 
        fib4_entry = mlxsw_sp_fib4_entry_lookup(mlxsw_sp, fen_info);
        if (!fib4_entry)
-               return;
+               return 0;
        fib_node = fib4_entry->common.fib_node;
 
-       mlxsw_sp_fib_node_entry_unlink(mlxsw_sp, &fib4_entry->common);
+       err = __mlxsw_sp_fib_node_entry_unlink(mlxsw_sp, op_ctx, &fib4_entry->common);
        mlxsw_sp_fib4_entry_destroy(mlxsw_sp, fib4_entry);
        mlxsw_sp_fib_node_put(mlxsw_sp, fib_node);
+       return err;
 }
 
 static bool mlxsw_sp_fib6_rt_should_ignore(const struct fib6_info *rt)
@@ -5263,9 +5496,9 @@ static void mlxsw_sp_nexthop6_group_put(struct mlxsw_sp *mlxsw_sp,
        mlxsw_sp_nexthop6_group_destroy(mlxsw_sp, nh_grp);
 }
 
-static int
-mlxsw_sp_nexthop6_group_update(struct mlxsw_sp *mlxsw_sp,
-                              struct mlxsw_sp_fib6_entry *fib6_entry)
+static int mlxsw_sp_nexthop6_group_update(struct mlxsw_sp *mlxsw_sp,
+                                         struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                         struct mlxsw_sp_fib6_entry *fib6_entry)
 {
        struct mlxsw_sp_nexthop_group *old_nh_grp = fib6_entry->common.nh_group;
        int err;
@@ -5281,7 +5514,8 @@ mlxsw_sp_nexthop6_group_update(struct mlxsw_sp *mlxsw_sp,
         * currently associated with it in the device's table is that
         * of the old group. Start using the new one instead.
         */
-       err = mlxsw_sp_fib_entry_update(mlxsw_sp, &fib6_entry->common);
+       err = __mlxsw_sp_fib_entry_update(mlxsw_sp, op_ctx,
+                                         &fib6_entry->common, false);
        if (err)
                goto err_fib_entry_update;
 
@@ -5301,6 +5535,7 @@ err_nexthop6_group_get:
 
 static int
 mlxsw_sp_fib6_entry_nexthop_add(struct mlxsw_sp *mlxsw_sp,
+                               struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                struct mlxsw_sp_fib6_entry *fib6_entry,
                                struct fib6_info **rt_arr, unsigned int nrt6)
 {
@@ -5318,7 +5553,7 @@ mlxsw_sp_fib6_entry_nexthop_add(struct mlxsw_sp *mlxsw_sp,
                fib6_entry->nrt6++;
        }
 
-       err = mlxsw_sp_nexthop6_group_update(mlxsw_sp, fib6_entry);
+       err = mlxsw_sp_nexthop6_group_update(mlxsw_sp, op_ctx, fib6_entry);
        if (err)
                goto err_nexthop6_group_update;
 
@@ -5339,6 +5574,7 @@ err_rt6_create:
 
 static void
 mlxsw_sp_fib6_entry_nexthop_del(struct mlxsw_sp *mlxsw_sp,
+                               struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
                                struct mlxsw_sp_fib6_entry *fib6_entry,
                                struct fib6_info **rt_arr, unsigned int nrt6)
 {
@@ -5356,7 +5592,7 @@ mlxsw_sp_fib6_entry_nexthop_del(struct mlxsw_sp *mlxsw_sp,
                mlxsw_sp_rt6_destroy(mlxsw_sp_rt6);
        }
 
-       mlxsw_sp_nexthop6_group_update(mlxsw_sp, fib6_entry);
+       mlxsw_sp_nexthop6_group_update(mlxsw_sp, op_ctx, fib6_entry);
 }
 
 static void mlxsw_sp_fib6_entry_type_set(struct mlxsw_sp *mlxsw_sp,
@@ -5409,6 +5645,12 @@ mlxsw_sp_fib6_entry_create(struct mlxsw_sp *mlxsw_sp,
                return ERR_PTR(-ENOMEM);
        fib_entry = &fib6_entry->common;
 
+       fib_entry->priv = mlxsw_sp_fib_entry_priv_create(fib_node->fib->ll_ops);
+       if (IS_ERR(fib_entry->priv)) {
+               err = PTR_ERR(fib_entry->priv);
+               goto err_fib_entry_priv_create;
+       }
+
        INIT_LIST_HEAD(&fib6_entry->rt6_list);
 
        for (i = 0; i < nrt6; i++) {
@@ -5441,6 +5683,8 @@ err_rt6_create:
                list_del(&mlxsw_sp_rt6->list);
                mlxsw_sp_rt6_destroy(mlxsw_sp_rt6);
        }
+       mlxsw_sp_fib_entry_priv_put(fib_entry->priv);
+err_fib_entry_priv_create:
        kfree(fib6_entry);
        return ERR_PTR(err);
 }
@@ -5451,6 +5695,7 @@ static void mlxsw_sp_fib6_entry_destroy(struct mlxsw_sp *mlxsw_sp,
        mlxsw_sp_nexthop6_group_put(mlxsw_sp, &fib6_entry->common);
        mlxsw_sp_fib6_entry_rt_destroy_all(fib6_entry);
        WARN_ON(fib6_entry->nrt6);
+       mlxsw_sp_fib_entry_priv_put(fib6_entry->common.priv);
        kfree(fib6_entry);
 }
 
@@ -5508,8 +5753,8 @@ static bool mlxsw_sp_fib6_allow_replace(struct mlxsw_sp_fib6_entry *fib6_entry)
 }
 
 static int mlxsw_sp_router_fib6_replace(struct mlxsw_sp *mlxsw_sp,
-                                       struct fib6_info **rt_arr,
-                                       unsigned int nrt6)
+                                       struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                       struct fib6_info **rt_arr, unsigned int nrt6)
 {
        struct mlxsw_sp_fib6_entry *fib6_entry, *fib6_replaced;
        struct mlxsw_sp_fib_entry *replaced;
@@ -5548,7 +5793,7 @@ static int mlxsw_sp_router_fib6_replace(struct mlxsw_sp *mlxsw_sp,
        }
 
        replaced = fib_node->fib_entry;
-       err = mlxsw_sp_fib_node_entry_link(mlxsw_sp, &fib6_entry->common);
+       err = mlxsw_sp_fib_node_entry_link(mlxsw_sp, op_ctx, &fib6_entry->common);
        if (err)
                goto err_fib_node_entry_link;
 
@@ -5572,8 +5817,8 @@ err_fib6_entry_create:
 }
 
 static int mlxsw_sp_router_fib6_append(struct mlxsw_sp *mlxsw_sp,
-                                      struct fib6_info **rt_arr,
-                                      unsigned int nrt6)
+                                      struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                      struct fib6_info **rt_arr, unsigned int nrt6)
 {
        struct mlxsw_sp_fib6_entry *fib6_entry;
        struct mlxsw_sp_fib_node *fib_node;
@@ -5604,8 +5849,7 @@ static int mlxsw_sp_router_fib6_append(struct mlxsw_sp *mlxsw_sp,
 
        fib6_entry = container_of(fib_node->fib_entry,
                                  struct mlxsw_sp_fib6_entry, common);
-       err = mlxsw_sp_fib6_entry_nexthop_add(mlxsw_sp, fib6_entry, rt_arr,
-                                             nrt6);
+       err = mlxsw_sp_fib6_entry_nexthop_add(mlxsw_sp, op_ctx, fib6_entry, rt_arr, nrt6);
        if (err)
                goto err_fib6_entry_nexthop_add;
 
@@ -5616,19 +5860,20 @@ err_fib6_entry_nexthop_add:
        return err;
 }
 
-static void mlxsw_sp_router_fib6_del(struct mlxsw_sp *mlxsw_sp,
-                                    struct fib6_info **rt_arr,
-                                    unsigned int nrt6)
+static int mlxsw_sp_router_fib6_del(struct mlxsw_sp *mlxsw_sp,
+                                   struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                   struct fib6_info **rt_arr, unsigned int nrt6)
 {
        struct mlxsw_sp_fib6_entry *fib6_entry;
        struct mlxsw_sp_fib_node *fib_node;
        struct fib6_info *rt = rt_arr[0];
+       int err;
 
        if (mlxsw_sp->router->aborted)
-               return;
+               return 0;
 
        if (mlxsw_sp_fib6_rt_should_ignore(rt))
-               return;
+               return 0;
 
        /* Multipath routes are first added to the FIB trie and only then
         * notified. If we vetoed the addition, we will get a delete
@@ -5637,58 +5882,66 @@ static void mlxsw_sp_router_fib6_del(struct mlxsw_sp *mlxsw_sp,
         */
        fib6_entry = mlxsw_sp_fib6_entry_lookup(mlxsw_sp, rt);
        if (!fib6_entry)
-               return;
+               return 0;
 
        /* If not all the nexthops are deleted, then only reduce the nexthop
         * group.
         */
        if (nrt6 != fib6_entry->nrt6) {
-               mlxsw_sp_fib6_entry_nexthop_del(mlxsw_sp, fib6_entry, rt_arr,
-                                               nrt6);
-               return;
+               mlxsw_sp_fib6_entry_nexthop_del(mlxsw_sp, op_ctx, fib6_entry, rt_arr, nrt6);
+               return 0;
        }
 
        fib_node = fib6_entry->common.fib_node;
 
-       mlxsw_sp_fib_node_entry_unlink(mlxsw_sp, &fib6_entry->common);
+       err = __mlxsw_sp_fib_node_entry_unlink(mlxsw_sp, op_ctx, &fib6_entry->common);
        mlxsw_sp_fib6_entry_destroy(mlxsw_sp, fib6_entry);
        mlxsw_sp_fib_node_put(mlxsw_sp, fib_node);
+       return err;
 }
 
 static int __mlxsw_sp_router_set_abort_trap(struct mlxsw_sp *mlxsw_sp,
-                                           enum mlxsw_reg_ralxx_protocol proto,
+                                           enum mlxsw_sp_l3proto proto,
                                            u8 tree_id)
 {
-       char ralta_pl[MLXSW_REG_RALTA_LEN];
-       char ralst_pl[MLXSW_REG_RALST_LEN];
+       const struct mlxsw_sp_router_ll_ops *ll_ops = mlxsw_sp->router->proto_ll_ops[proto];
+       enum mlxsw_reg_ralxx_protocol ralxx_proto =
+                               (enum mlxsw_reg_ralxx_protocol) proto;
+       struct mlxsw_sp_fib_entry_priv *priv;
+       char xralta_pl[MLXSW_REG_XRALTA_LEN];
+       char xralst_pl[MLXSW_REG_XRALST_LEN];
        int i, err;
 
-       mlxsw_reg_ralta_pack(ralta_pl, true, proto, tree_id);
-       err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralta), ralta_pl);
+       mlxsw_reg_xralta_pack(xralta_pl, true, ralxx_proto, tree_id);
+       err = ll_ops->ralta_write(mlxsw_sp, xralta_pl);
        if (err)
                return err;
 
-       mlxsw_reg_ralst_pack(ralst_pl, 0xff, tree_id);
-       err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralst), ralst_pl);
+       mlxsw_reg_xralst_pack(xralst_pl, 0xff, tree_id);
+       err = ll_ops->ralst_write(mlxsw_sp, xralst_pl);
        if (err)
                return err;
 
        for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_VRS); i++) {
+               struct mlxsw_sp_fib_entry_op_ctx *op_ctx = mlxsw_sp->router->ll_op_ctx;
                struct mlxsw_sp_vr *vr = &mlxsw_sp->router->vrs[i];
-               char raltb_pl[MLXSW_REG_RALTB_LEN];
-               char ralue_pl[MLXSW_REG_RALUE_LEN];
+               char xraltb_pl[MLXSW_REG_XRALTB_LEN];
 
-               mlxsw_reg_raltb_pack(raltb_pl, vr->id, proto, tree_id);
-               err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(raltb),
-                                     raltb_pl);
+               mlxsw_sp_fib_entry_op_ctx_clear(op_ctx);
+               mlxsw_reg_xraltb_pack(xraltb_pl, vr->id, ralxx_proto, tree_id);
+               err = ll_ops->raltb_write(mlxsw_sp, xraltb_pl);
                if (err)
                        return err;
 
-               mlxsw_reg_ralue_pack(ralue_pl, proto,
-                                    MLXSW_REG_RALUE_OP_WRITE_WRITE, vr->id, 0);
-               mlxsw_reg_ralue_act_ip2me_pack(ralue_pl);
-               err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue),
-                                     ralue_pl);
+               priv = mlxsw_sp_fib_entry_priv_create(ll_ops);
+               if (IS_ERR(priv))
+                       return PTR_ERR(priv);
+
+               ll_ops->fib_entry_pack(op_ctx, proto, MLXSW_SP_FIB_ENTRY_OP_WRITE,
+                                      vr->id, 0, NULL, priv);
+               ll_ops->fib_entry_act_ip2me_pack(op_ctx);
+               err = ll_ops->fib_entry_commit(mlxsw_sp, op_ctx, NULL);
+               mlxsw_sp_fib_entry_priv_put(priv);
                if (err)
                        return err;
        }
@@ -5784,7 +6037,7 @@ mlxsw_sp_router_fibmr_vif_del(struct mlxsw_sp *mlxsw_sp,
 
 static int mlxsw_sp_router_set_abort_trap(struct mlxsw_sp *mlxsw_sp)
 {
-       enum mlxsw_reg_ralxx_protocol proto = MLXSW_REG_RALXX_PROTOCOL_IPV4;
+       enum mlxsw_sp_l3proto proto = MLXSW_SP_L3_PROTO_IPV4;
        int err;
 
        err = __mlxsw_sp_router_set_abort_trap(mlxsw_sp, proto,
@@ -5796,7 +6049,7 @@ static int mlxsw_sp_router_set_abort_trap(struct mlxsw_sp *mlxsw_sp)
         * packets that don't match any routes are trapped to the CPU.
         */
 
-       proto = MLXSW_REG_RALXX_PROTOCOL_IPV6;
+       proto = MLXSW_SP_L3_PROTO_IPV6;
        return __mlxsw_sp_router_set_abort_trap(mlxsw_sp, proto,
                                                MLXSW_SP_LPM_TREE_MIN + 1);
 }
@@ -5901,15 +6154,15 @@ static void mlxsw_sp_router_fib_abort(struct mlxsw_sp *mlxsw_sp)
                dev_warn(mlxsw_sp->bus_info->dev, "Failed to set abort trap.\n");
 }
 
-struct mlxsw_sp_fib6_event_work {
+struct mlxsw_sp_fib6_event {
        struct fib6_info **rt_arr;
        unsigned int nrt6;
 };
 
-struct mlxsw_sp_fib_event_work {
-       struct work_struct work;
+struct mlxsw_sp_fib_event {
+       struct list_head list; /* node in fib queue */
        union {
-               struct mlxsw_sp_fib6_event_work fib6_work;
+               struct mlxsw_sp_fib6_event fib6_event;
                struct fib_entry_notifier_info fen_info;
                struct fib_rule_notifier_info fr_info;
                struct fib_nh_notifier_info fnh_info;
@@ -5918,11 +6171,12 @@ struct mlxsw_sp_fib_event_work {
        };
        struct mlxsw_sp *mlxsw_sp;
        unsigned long event;
+       int family;
 };
 
 static int
-mlxsw_sp_router_fib6_work_init(struct mlxsw_sp_fib6_event_work *fib6_work,
-                              struct fib6_entry_notifier_info *fen6_info)
+mlxsw_sp_router_fib6_event_init(struct mlxsw_sp_fib6_event *fib6_event,
+                               struct fib6_entry_notifier_info *fen6_info)
 {
        struct fib6_info *rt = fen6_info->rt;
        struct fib6_info **rt_arr;
@@ -5936,8 +6190,8 @@ mlxsw_sp_router_fib6_work_init(struct mlxsw_sp_fib6_event_work *fib6_work,
        if (!rt_arr)
                return -ENOMEM;
 
-       fib6_work->rt_arr = rt_arr;
-       fib6_work->nrt6 = nrt6;
+       fib6_event->rt_arr = rt_arr;
+       fib6_event->nrt6 = nrt6;
 
        rt_arr[0] = rt;
        fib6_info_hold(rt);
@@ -5959,170 +6213,232 @@ mlxsw_sp_router_fib6_work_init(struct mlxsw_sp_fib6_event_work *fib6_work,
 }
 
 static void
-mlxsw_sp_router_fib6_work_fini(struct mlxsw_sp_fib6_event_work *fib6_work)
+mlxsw_sp_router_fib6_event_fini(struct mlxsw_sp_fib6_event *fib6_event)
 {
        int i;
 
-       for (i = 0; i < fib6_work->nrt6; i++)
-               mlxsw_sp_rt6_release(fib6_work->rt_arr[i]);
-       kfree(fib6_work->rt_arr);
+       for (i = 0; i < fib6_event->nrt6; i++)
+               mlxsw_sp_rt6_release(fib6_event->rt_arr[i]);
+       kfree(fib6_event->rt_arr);
 }
 
-static void mlxsw_sp_router_fib4_event_work(struct work_struct *work)
+static void mlxsw_sp_router_fib4_event_process(struct mlxsw_sp *mlxsw_sp,
+                                              struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                              struct mlxsw_sp_fib_event *fib_event)
 {
-       struct mlxsw_sp_fib_event_work *fib_work =
-               container_of(work, struct mlxsw_sp_fib_event_work, work);
-       struct mlxsw_sp *mlxsw_sp = fib_work->mlxsw_sp;
        int err;
 
-       mutex_lock(&mlxsw_sp->router->lock);
        mlxsw_sp_span_respin(mlxsw_sp);
 
-       switch (fib_work->event) {
+       switch (fib_event->event) {
        case FIB_EVENT_ENTRY_REPLACE:
-               err = mlxsw_sp_router_fib4_replace(mlxsw_sp,
-                                                  &fib_work->fen_info);
-               if (err)
+               err = mlxsw_sp_router_fib4_replace(mlxsw_sp, op_ctx, &fib_event->fen_info);
+               if (err) {
+                       mlxsw_sp_fib_entry_op_ctx_priv_put_all(op_ctx);
                        mlxsw_sp_router_fib_abort(mlxsw_sp);
-               fib_info_put(fib_work->fen_info.fi);
+               }
+               fib_info_put(fib_event->fen_info.fi);
                break;
        case FIB_EVENT_ENTRY_DEL:
-               mlxsw_sp_router_fib4_del(mlxsw_sp, &fib_work->fen_info);
-               fib_info_put(fib_work->fen_info.fi);
+               err = mlxsw_sp_router_fib4_del(mlxsw_sp, op_ctx, &fib_event->fen_info);
+               if (err)
+                       mlxsw_sp_fib_entry_op_ctx_priv_put_all(op_ctx);
+               fib_info_put(fib_event->fen_info.fi);
                break;
        case FIB_EVENT_NH_ADD:
        case FIB_EVENT_NH_DEL:
-               mlxsw_sp_nexthop4_event(mlxsw_sp, fib_work->event,
-                                       fib_work->fnh_info.fib_nh);
-               fib_info_put(fib_work->fnh_info.fib_nh->nh_parent);
+               mlxsw_sp_nexthop4_event(mlxsw_sp, fib_event->event, fib_event->fnh_info.fib_nh);
+               fib_info_put(fib_event->fnh_info.fib_nh->nh_parent);
                break;
        }
-       mutex_unlock(&mlxsw_sp->router->lock);
-       kfree(fib_work);
 }
 
-static void mlxsw_sp_router_fib6_event_work(struct work_struct *work)
+static void mlxsw_sp_router_fib6_event_process(struct mlxsw_sp *mlxsw_sp,
+                                              struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                              struct mlxsw_sp_fib_event *fib_event)
 {
-       struct mlxsw_sp_fib_event_work *fib_work =
-               container_of(work, struct mlxsw_sp_fib_event_work, work);
-       struct mlxsw_sp *mlxsw_sp = fib_work->mlxsw_sp;
        int err;
 
-       mutex_lock(&mlxsw_sp->router->lock);
        mlxsw_sp_span_respin(mlxsw_sp);
 
-       switch (fib_work->event) {
+       switch (fib_event->event) {
        case FIB_EVENT_ENTRY_REPLACE:
-               err = mlxsw_sp_router_fib6_replace(mlxsw_sp,
-                                                  fib_work->fib6_work.rt_arr,
-                                                  fib_work->fib6_work.nrt6);
-               if (err)
+               err = mlxsw_sp_router_fib6_replace(mlxsw_sp, op_ctx, fib_event->fib6_event.rt_arr,
+                                                  fib_event->fib6_event.nrt6);
+               if (err) {
+                       mlxsw_sp_fib_entry_op_ctx_priv_put_all(op_ctx);
                        mlxsw_sp_router_fib_abort(mlxsw_sp);
-               mlxsw_sp_router_fib6_work_fini(&fib_work->fib6_work);
+               }
+               mlxsw_sp_router_fib6_event_fini(&fib_event->fib6_event);
                break;
        case FIB_EVENT_ENTRY_APPEND:
-               err = mlxsw_sp_router_fib6_append(mlxsw_sp,
-                                                 fib_work->fib6_work.rt_arr,
-                                                 fib_work->fib6_work.nrt6);
-               if (err)
+               err = mlxsw_sp_router_fib6_append(mlxsw_sp, op_ctx, fib_event->fib6_event.rt_arr,
+                                                 fib_event->fib6_event.nrt6);
+               if (err) {
+                       mlxsw_sp_fib_entry_op_ctx_priv_put_all(op_ctx);
                        mlxsw_sp_router_fib_abort(mlxsw_sp);
-               mlxsw_sp_router_fib6_work_fini(&fib_work->fib6_work);
+               }
+               mlxsw_sp_router_fib6_event_fini(&fib_event->fib6_event);
                break;
        case FIB_EVENT_ENTRY_DEL:
-               mlxsw_sp_router_fib6_del(mlxsw_sp,
-                                        fib_work->fib6_work.rt_arr,
-                                        fib_work->fib6_work.nrt6);
-               mlxsw_sp_router_fib6_work_fini(&fib_work->fib6_work);
+               err = mlxsw_sp_router_fib6_del(mlxsw_sp, op_ctx, fib_event->fib6_event.rt_arr,
+                                              fib_event->fib6_event.nrt6);
+               if (err)
+                       mlxsw_sp_fib_entry_op_ctx_priv_put_all(op_ctx);
+               mlxsw_sp_router_fib6_event_fini(&fib_event->fib6_event);
                break;
        }
-       mutex_unlock(&mlxsw_sp->router->lock);
-       kfree(fib_work);
 }
 
-static void mlxsw_sp_router_fibmr_event_work(struct work_struct *work)
+static void mlxsw_sp_router_fibmr_event_process(struct mlxsw_sp *mlxsw_sp,
+                                               struct mlxsw_sp_fib_event *fib_event)
 {
-       struct mlxsw_sp_fib_event_work *fib_work =
-               container_of(work, struct mlxsw_sp_fib_event_work, work);
-       struct mlxsw_sp *mlxsw_sp = fib_work->mlxsw_sp;
        bool replace;
        int err;
 
        rtnl_lock();
        mutex_lock(&mlxsw_sp->router->lock);
-       switch (fib_work->event) {
+       switch (fib_event->event) {
        case FIB_EVENT_ENTRY_REPLACE:
        case FIB_EVENT_ENTRY_ADD:
-               replace = fib_work->event == FIB_EVENT_ENTRY_REPLACE;
+               replace = fib_event->event == FIB_EVENT_ENTRY_REPLACE;
 
-               err = mlxsw_sp_router_fibmr_add(mlxsw_sp, &fib_work->men_info,
-                                               replace);
+               err = mlxsw_sp_router_fibmr_add(mlxsw_sp, &fib_event->men_info, replace);
                if (err)
                        mlxsw_sp_router_fib_abort(mlxsw_sp);
-               mr_cache_put(fib_work->men_info.mfc);
+               mr_cache_put(fib_event->men_info.mfc);
                break;
        case FIB_EVENT_ENTRY_DEL:
-               mlxsw_sp_router_fibmr_del(mlxsw_sp, &fib_work->men_info);
-               mr_cache_put(fib_work->men_info.mfc);
+               mlxsw_sp_router_fibmr_del(mlxsw_sp, &fib_event->men_info);
+               mr_cache_put(fib_event->men_info.mfc);
                break;
        case FIB_EVENT_VIF_ADD:
                err = mlxsw_sp_router_fibmr_vif_add(mlxsw_sp,
-                                                   &fib_work->ven_info);
+                                                   &fib_event->ven_info);
                if (err)
                        mlxsw_sp_router_fib_abort(mlxsw_sp);
-               dev_put(fib_work->ven_info.dev);
+               dev_put(fib_event->ven_info.dev);
                break;
        case FIB_EVENT_VIF_DEL:
-               mlxsw_sp_router_fibmr_vif_del(mlxsw_sp,
-                                             &fib_work->ven_info);
-               dev_put(fib_work->ven_info.dev);
+               mlxsw_sp_router_fibmr_vif_del(mlxsw_sp, &fib_event->ven_info);
+               dev_put(fib_event->ven_info.dev);
                break;
        }
        mutex_unlock(&mlxsw_sp->router->lock);
        rtnl_unlock();
-       kfree(fib_work);
 }
 
-static void mlxsw_sp_router_fib4_event(struct mlxsw_sp_fib_event_work *fib_work,
+static void mlxsw_sp_router_fib_event_work(struct work_struct *work)
+{
+       struct mlxsw_sp_router *router = container_of(work, struct mlxsw_sp_router, fib_event_work);
+       struct mlxsw_sp_fib_entry_op_ctx *op_ctx = router->ll_op_ctx;
+       struct mlxsw_sp *mlxsw_sp = router->mlxsw_sp;
+       struct mlxsw_sp_fib_event *next_fib_event;
+       struct mlxsw_sp_fib_event *fib_event;
+       int last_family = AF_UNSPEC;
+       LIST_HEAD(fib_event_queue);
+
+       spin_lock_bh(&router->fib_event_queue_lock);
+       list_splice_init(&router->fib_event_queue, &fib_event_queue);
+       spin_unlock_bh(&router->fib_event_queue_lock);
+
+       /* Router lock is held here to make sure per-instance
+        * operation context is not used in between FIB4/6 events
+        * processing.
+        */
+       mutex_lock(&router->lock);
+       mlxsw_sp_fib_entry_op_ctx_clear(op_ctx);
+       list_for_each_entry_safe(fib_event, next_fib_event,
+                                &fib_event_queue, list) {
+               /* Check if the next entry in the queue exists and it is
+                * of the same type (family and event) as the currect one.
+                * In that case it is permitted to do the bulking
+                * of multiple FIB entries to a single register write.
+                */
+               op_ctx->bulk_ok = !list_is_last(&fib_event->list, &fib_event_queue) &&
+                                 fib_event->family == next_fib_event->family &&
+                                 fib_event->event == next_fib_event->event;
+
+               /* In case family of this and the previous entry are different, context
+                * reinitialization is going to be needed now, indicate that.
+                * Note that since last_family is initialized to AF_UNSPEC, this is always
+                * going to happen for the first entry processed in the work.
+                */
+               if (fib_event->family != last_family)
+                       op_ctx->initialized = false;
+
+               switch (fib_event->family) {
+               case AF_INET:
+                       mlxsw_sp_router_fib4_event_process(mlxsw_sp, op_ctx,
+                                                          fib_event);
+                       break;
+               case AF_INET6:
+                       mlxsw_sp_router_fib6_event_process(mlxsw_sp, op_ctx,
+                                                          fib_event);
+                       break;
+               case RTNL_FAMILY_IP6MR:
+               case RTNL_FAMILY_IPMR:
+                       /* Unlock here as inside FIBMR the lock is taken again
+                        * under RTNL. The per-instance operation context
+                        * is not used by FIBMR.
+                        */
+                       mutex_unlock(&router->lock);
+                       mlxsw_sp_router_fibmr_event_process(mlxsw_sp,
+                                                           fib_event);
+                       mutex_lock(&router->lock);
+                       break;
+               default:
+                       WARN_ON_ONCE(1);
+               }
+               last_family = fib_event->family;
+               kfree(fib_event);
+               cond_resched();
+       }
+       WARN_ON_ONCE(!list_empty(&router->ll_op_ctx->fib_entry_priv_list));
+       mutex_unlock(&router->lock);
+}
+
+static void mlxsw_sp_router_fib4_event(struct mlxsw_sp_fib_event *fib_event,
                                       struct fib_notifier_info *info)
 {
        struct fib_entry_notifier_info *fen_info;
        struct fib_nh_notifier_info *fnh_info;
 
-       switch (fib_work->event) {
+       switch (fib_event->event) {
        case FIB_EVENT_ENTRY_REPLACE:
        case FIB_EVENT_ENTRY_DEL:
                fen_info = container_of(info, struct fib_entry_notifier_info,
                                        info);
-               fib_work->fen_info = *fen_info;
+               fib_event->fen_info = *fen_info;
                /* Take reference on fib_info to prevent it from being
-                * freed while work is queued. Release it afterwards.
+                * freed while event is queued. Release it afterwards.
                 */
-               fib_info_hold(fib_work->fen_info.fi);
+               fib_info_hold(fib_event->fen_info.fi);
                break;
        case FIB_EVENT_NH_ADD:
        case FIB_EVENT_NH_DEL:
                fnh_info = container_of(info, struct fib_nh_notifier_info,
                                        info);
-               fib_work->fnh_info = *fnh_info;
-               fib_info_hold(fib_work->fnh_info.fib_nh->nh_parent);
+               fib_event->fnh_info = *fnh_info;
+               fib_info_hold(fib_event->fnh_info.fib_nh->nh_parent);
                break;
        }
 }
 
-static int mlxsw_sp_router_fib6_event(struct mlxsw_sp_fib_event_work *fib_work,
+static int mlxsw_sp_router_fib6_event(struct mlxsw_sp_fib_event *fib_event,
                                      struct fib_notifier_info *info)
 {
        struct fib6_entry_notifier_info *fen6_info;
        int err;
 
-       switch (fib_work->event) {
+       switch (fib_event->event) {
        case FIB_EVENT_ENTRY_REPLACE:
        case FIB_EVENT_ENTRY_APPEND:
        case FIB_EVENT_ENTRY_DEL:
                fen6_info = container_of(info, struct fib6_entry_notifier_info,
                                         info);
-               err = mlxsw_sp_router_fib6_work_init(&fib_work->fib6_work,
-                                                    fen6_info);
+               err = mlxsw_sp_router_fib6_event_init(&fib_event->fib6_event,
+                                                     fen6_info);
                if (err)
                        return err;
                break;
@@ -6132,20 +6448,20 @@ static int mlxsw_sp_router_fib6_event(struct mlxsw_sp_fib_event_work *fib_work,
 }
 
 static void
-mlxsw_sp_router_fibmr_event(struct mlxsw_sp_fib_event_work *fib_work,
+mlxsw_sp_router_fibmr_event(struct mlxsw_sp_fib_event *fib_event,
                            struct fib_notifier_info *info)
 {
-       switch (fib_work->event) {
+       switch (fib_event->event) {
        case FIB_EVENT_ENTRY_REPLACE:
        case FIB_EVENT_ENTRY_ADD:
        case FIB_EVENT_ENTRY_DEL:
-               memcpy(&fib_work->men_info, info, sizeof(fib_work->men_info));
-               mr_cache_hold(fib_work->men_info.mfc);
+               memcpy(&fib_event->men_info, info, sizeof(fib_event->men_info));
+               mr_cache_hold(fib_event->men_info.mfc);
                break;
        case FIB_EVENT_VIF_ADD:
        case FIB_EVENT_VIF_DEL:
-               memcpy(&fib_work->ven_info, info, sizeof(fib_work->ven_info));
-               dev_hold(fib_work->ven_info.dev);
+               memcpy(&fib_event->ven_info, info, sizeof(fib_event->ven_info));
+               dev_hold(fib_event->ven_info.dev);
                break;
        }
 }
@@ -6202,7 +6518,7 @@ static int mlxsw_sp_router_fib_rule_event(unsigned long event,
 static int mlxsw_sp_router_fib_event(struct notifier_block *nb,
                                     unsigned long event, void *ptr)
 {
-       struct mlxsw_sp_fib_event_work *fib_work;
+       struct mlxsw_sp_fib_event *fib_event;
        struct fib_notifier_info *info = ptr;
        struct mlxsw_sp_router *router;
        int err;
@@ -6252,37 +6568,39 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb,
                break;
        }
 
-       fib_work = kzalloc(sizeof(*fib_work), GFP_ATOMIC);
-       if (!fib_work)
+       fib_event = kzalloc(sizeof(*fib_event), GFP_ATOMIC);
+       if (!fib_event)
                return NOTIFY_BAD;
 
-       fib_work->mlxsw_sp = router->mlxsw_sp;
-       fib_work->event = event;
+       fib_event->mlxsw_sp = router->mlxsw_sp;
+       fib_event->event = event;
+       fib_event->family = info->family;
 
        switch (info->family) {
        case AF_INET:
-               INIT_WORK(&fib_work->work, mlxsw_sp_router_fib4_event_work);
-               mlxsw_sp_router_fib4_event(fib_work, info);
+               mlxsw_sp_router_fib4_event(fib_event, info);
                break;
        case AF_INET6:
-               INIT_WORK(&fib_work->work, mlxsw_sp_router_fib6_event_work);
-               err = mlxsw_sp_router_fib6_event(fib_work, info);
+               err = mlxsw_sp_router_fib6_event(fib_event, info);
                if (err)
                        goto err_fib_event;
                break;
        case RTNL_FAMILY_IP6MR:
        case RTNL_FAMILY_IPMR:
-               INIT_WORK(&fib_work->work, mlxsw_sp_router_fibmr_event_work);
-               mlxsw_sp_router_fibmr_event(fib_work, info);
+               mlxsw_sp_router_fibmr_event(fib_event, info);
                break;
        }
 
-       mlxsw_core_schedule_work(&fib_work->work);
+       /* Enqueue the event and trigger the work */
+       spin_lock_bh(&router->fib_event_queue_lock);
+       list_add_tail(&fib_event->list, &router->fib_event_queue);
+       spin_unlock_bh(&router->fib_event_queue_lock);
+       mlxsw_core_schedule_work(&router->fib_event_work);
 
        return NOTIFY_DONE;
 
 err_fib_event:
-       kfree(fib_work);
+       kfree(fib_event);
        return NOTIFY_BAD;
 }
 
@@ -8057,6 +8375,45 @@ static void __mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp)
        mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(rgcr), rgcr_pl);
 }
 
+static const struct mlxsw_sp_router_ll_ops mlxsw_sp_router_ll_basic_ops = {
+       .ralta_write = mlxsw_sp_router_ll_basic_ralta_write,
+       .ralst_write = mlxsw_sp_router_ll_basic_ralst_write,
+       .raltb_write = mlxsw_sp_router_ll_basic_raltb_write,
+       .fib_entry_op_ctx_size = sizeof(struct mlxsw_sp_fib_entry_op_ctx_basic),
+       .fib_entry_pack = mlxsw_sp_router_ll_basic_fib_entry_pack,
+       .fib_entry_act_remote_pack = mlxsw_sp_router_ll_basic_fib_entry_act_remote_pack,
+       .fib_entry_act_local_pack = mlxsw_sp_router_ll_basic_fib_entry_act_local_pack,
+       .fib_entry_act_ip2me_pack = mlxsw_sp_router_ll_basic_fib_entry_act_ip2me_pack,
+       .fib_entry_act_ip2me_tun_pack = mlxsw_sp_router_ll_basic_fib_entry_act_ip2me_tun_pack,
+       .fib_entry_commit = mlxsw_sp_router_ll_basic_fib_entry_commit,
+       .fib_entry_is_committed = mlxsw_sp_router_ll_basic_fib_entry_is_committed,
+};
+
+static int mlxsw_sp_router_ll_op_ctx_init(struct mlxsw_sp_router *router)
+{
+       size_t max_size = 0;
+       int i;
+
+       for (i = 0; i < MLXSW_SP_L3_PROTO_MAX; i++) {
+               size_t size = router->proto_ll_ops[i]->fib_entry_op_ctx_size;
+
+               if (size > max_size)
+                       max_size = size;
+       }
+       router->ll_op_ctx = kzalloc(sizeof(*router->ll_op_ctx) + max_size,
+                                   GFP_KERNEL);
+       if (!router->ll_op_ctx)
+               return -ENOMEM;
+       INIT_LIST_HEAD(&router->ll_op_ctx->fib_entry_priv_list);
+       return 0;
+}
+
+static void mlxsw_sp_router_ll_op_ctx_fini(struct mlxsw_sp_router *router)
+{
+       WARN_ON(!list_empty(&router->ll_op_ctx->fib_entry_priv_list));
+       kfree(router->ll_op_ctx);
+}
+
 int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp,
                         struct netlink_ext_ack *extack)
 {
@@ -8070,6 +8427,13 @@ int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp,
        mlxsw_sp->router = router;
        router->mlxsw_sp = mlxsw_sp;
 
+       router->proto_ll_ops[MLXSW_SP_L3_PROTO_IPV4] = &mlxsw_sp_router_ll_basic_ops;
+       router->proto_ll_ops[MLXSW_SP_L3_PROTO_IPV6] = &mlxsw_sp_router_ll_basic_ops;
+
+       err = mlxsw_sp_router_ll_op_ctx_init(router);
+       if (err)
+               goto err_ll_op_ctx_init;
+
        INIT_LIST_HEAD(&mlxsw_sp->router->nexthop_neighs_list);
        err = __mlxsw_sp_router_init(mlxsw_sp);
        if (err)
@@ -8118,6 +8482,10 @@ int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp,
        if (err)
                goto err_dscp_init;
 
+       INIT_WORK(&router->fib_event_work, mlxsw_sp_router_fib_event_work);
+       INIT_LIST_HEAD(&router->fib_event_queue);
+       spin_lock_init(&router->fib_event_queue_lock);
+
        router->inetaddr_nb.notifier_call = mlxsw_sp_inetaddr_event;
        err = register_inetaddr_notifier(&router->inetaddr_nb);
        if (err)
@@ -8151,6 +8519,7 @@ err_register_inet6addr_notifier:
        unregister_inetaddr_notifier(&router->inetaddr_nb);
 err_register_inetaddr_notifier:
        mlxsw_core_flush_owq();
+       WARN_ON(!list_empty(&router->fib_event_queue));
 err_dscp_init:
 err_mp_hash_init:
        mlxsw_sp_neigh_fini(mlxsw_sp);
@@ -8171,6 +8540,8 @@ err_ipips_init:
 err_rifs_init:
        __mlxsw_sp_router_fini(mlxsw_sp);
 err_router_init:
+       mlxsw_sp_router_ll_op_ctx_fini(router);
+err_ll_op_ctx_init:
        mutex_destroy(&mlxsw_sp->router->lock);
        kfree(mlxsw_sp->router);
        return err;
@@ -8184,6 +8555,7 @@ void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp)
        unregister_inet6addr_notifier(&mlxsw_sp->router->inet6addr_nb);
        unregister_inetaddr_notifier(&mlxsw_sp->router->inetaddr_nb);
        mlxsw_core_flush_owq();
+       WARN_ON(!list_empty(&mlxsw_sp->router->fib_event_queue));
        mlxsw_sp_neigh_fini(mlxsw_sp);
        mlxsw_sp_vrs_fini(mlxsw_sp);
        mlxsw_sp_mr_fini(mlxsw_sp);
@@ -8193,6 +8565,7 @@ void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp)
        mlxsw_sp_ipips_fini(mlxsw_sp);
        mlxsw_sp_rifs_fini(mlxsw_sp);
        __mlxsw_sp_router_fini(mlxsw_sp);
+       mlxsw_sp_router_ll_op_ctx_fini(mlxsw_sp->router);
        mutex_destroy(&mlxsw_sp->router->lock);
        kfree(mlxsw_sp->router);
 }
index 8418dc3..8230f6f 100644 (file)
@@ -15,6 +15,26 @@ struct mlxsw_sp_router_nve_decap {
        u8 valid:1;
 };
 
+struct mlxsw_sp_fib_entry_op_ctx {
+       u8 bulk_ok:1, /* Indicate to the low-level op it is ok to bulk
+                      * the actual entry with the one that is the next
+                      * in queue.
+                      */
+          initialized:1; /* Bit that the low-level op sets in case
+                          * the context priv is initialized.
+                          */
+       struct list_head fib_entry_priv_list;
+       unsigned long ll_priv[];
+};
+
+static inline void
+mlxsw_sp_fib_entry_op_ctx_clear(struct mlxsw_sp_fib_entry_op_ctx *op_ctx)
+{
+       WARN_ON_ONCE(!list_empty(&op_ctx->fib_entry_priv_list));
+       memset(op_ctx, 0, sizeof(*op_ctx));
+       INIT_LIST_HEAD(&op_ctx->fib_entry_priv_list);
+}
+
 struct mlxsw_sp_router {
        struct mlxsw_sp *mlxsw_sp;
        struct mlxsw_sp_rif **rifs;
@@ -48,8 +68,58 @@ struct mlxsw_sp_router {
        bool adj_discard_index_valid;
        struct mlxsw_sp_router_nve_decap nve_decap_config;
        struct mutex lock; /* Protects shared router resources */
+       struct work_struct fib_event_work;
+       struct list_head fib_event_queue;
+       spinlock_t fib_event_queue_lock; /* Protects fib event queue list */
+       /* One set of ops for each protocol: IPv4 and IPv6 */
+       const struct mlxsw_sp_router_ll_ops *proto_ll_ops[MLXSW_SP_L3_PROTO_MAX];
+       struct mlxsw_sp_fib_entry_op_ctx *ll_op_ctx;
+};
+
+struct mlxsw_sp_fib_entry_priv {
+       refcount_t refcnt;
+       struct list_head list; /* Member in op_ctx->fib_entry_priv_list */
+       unsigned long priv[];
+};
+
+enum mlxsw_sp_fib_entry_op {
+       MLXSW_SP_FIB_ENTRY_OP_WRITE,
+       MLXSW_SP_FIB_ENTRY_OP_UPDATE,
+       MLXSW_SP_FIB_ENTRY_OP_DELETE,
 };
 
+/* Low-level router ops. Basically this is to handle the different
+ * register sets to work with ordinary and XM trees and FIB entries.
+ */
+struct mlxsw_sp_router_ll_ops {
+       int (*ralta_write)(struct mlxsw_sp *mlxsw_sp, char *xralta_pl);
+       int (*ralst_write)(struct mlxsw_sp *mlxsw_sp, char *xralst_pl);
+       int (*raltb_write)(struct mlxsw_sp *mlxsw_sp, char *xraltb_pl);
+       size_t fib_entry_op_ctx_size;
+       size_t fib_entry_priv_size;
+       void (*fib_entry_pack)(struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                              enum mlxsw_sp_l3proto proto, enum mlxsw_sp_fib_entry_op op,
+                              u16 virtual_router, u8 prefix_len, unsigned char *addr,
+                              struct mlxsw_sp_fib_entry_priv *priv);
+       void (*fib_entry_act_remote_pack)(struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                         enum mlxsw_reg_ralue_trap_action trap_action,
+                                         u16 trap_id, u32 adjacency_index, u16 ecmp_size);
+       void (*fib_entry_act_local_pack)(struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                        enum mlxsw_reg_ralue_trap_action trap_action,
+                                        u16 trap_id, u16 local_erif);
+       void (*fib_entry_act_ip2me_pack)(struct mlxsw_sp_fib_entry_op_ctx *op_ctx);
+       void (*fib_entry_act_ip2me_tun_pack)(struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                                            u32 tunnel_ptr);
+       int (*fib_entry_commit)(struct mlxsw_sp *mlxsw_sp,
+                               struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                               bool *postponed_for_bulk);
+       bool (*fib_entry_is_committed)(struct mlxsw_sp_fib_entry_priv *priv);
+};
+
+int mlxsw_sp_fib_entry_commit(struct mlxsw_sp *mlxsw_sp,
+                             struct mlxsw_sp_fib_entry_op_ctx *op_ctx,
+                             const struct mlxsw_sp_router_ll_ops *ll_ops);
+
 struct mlxsw_sp_rif_ipip_lb;
 struct mlxsw_sp_rif_ipip_lb_config {
        enum mlxsw_reg_ritr_loopback_ipip_type lb_ipipt;
index dcde496..c5de8f4 100644 (file)
@@ -780,7 +780,9 @@ static void lan743x_ethtool_get_wol(struct net_device *netdev,
 
        wol->supported = 0;
        wol->wolopts = 0;
-       phy_ethtool_get_wol(netdev->phydev, wol);
+
+       if (netdev->phydev)
+               phy_ethtool_get_wol(netdev->phydev, wol);
 
        wol->supported |= WAKE_BCAST | WAKE_UCAST | WAKE_MCAST |
                WAKE_MAGIC | WAKE_PHY | WAKE_ARP;
@@ -809,9 +811,8 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,
 
        device_set_wakeup_enable(&adapter->pdev->dev, (bool)wol->wolopts);
 
-       phy_ethtool_set_wol(netdev->phydev, wol);
-
-       return 0;
+       return netdev->phydev ? phy_ethtool_set_wol(netdev->phydev, wol)
+                       : -ENETDOWN;
 }
 #endif /* CONFIG_PM */
 
index a193884..083d237 100644 (file)
@@ -674,14 +674,12 @@ clean_up:
 static int lan743x_dp_write(struct lan743x_adapter *adapter,
                            u32 select, u32 addr, u32 length, u32 *buf)
 {
-       int ret = -EIO;
        u32 dp_sel;
        int i;
 
-       mutex_lock(&adapter->dp_lock);
        if (lan743x_csr_wait_for_bit(adapter, DP_SEL, DP_SEL_DPRDY_,
                                     1, 40, 100, 100))
-               goto unlock;
+               return -EIO;
        dp_sel = lan743x_csr_read(adapter, DP_SEL);
        dp_sel &= ~DP_SEL_MASK_;
        dp_sel |= select;
@@ -693,13 +691,10 @@ static int lan743x_dp_write(struct lan743x_adapter *adapter,
                lan743x_csr_write(adapter, DP_CMD, DP_CMD_WRITE_);
                if (lan743x_csr_wait_for_bit(adapter, DP_SEL, DP_SEL_DPRDY_,
                                             1, 40, 100, 100))
-                       goto unlock;
+                       return -EIO;
        }
-       ret = 0;
 
-unlock:
-       mutex_unlock(&adapter->dp_lock);
-       return ret;
+       return 0;
 }
 
 static u32 lan743x_mac_mii_access(u16 id, u16 index, int read)
@@ -834,14 +829,13 @@ static int lan743x_mac_init(struct lan743x_adapter *adapter)
 
 static int lan743x_mac_open(struct lan743x_adapter *adapter)
 {
-       int ret = 0;
        u32 temp;
 
        temp = lan743x_csr_read(adapter, MAC_RX);
        lan743x_csr_write(adapter, MAC_RX, temp | MAC_RX_RXEN_);
        temp = lan743x_csr_read(adapter, MAC_TX);
        lan743x_csr_write(adapter, MAC_TX, temp | MAC_TX_TXEN_);
-       return ret;
+       return 0;
 }
 
 static void lan743x_mac_close(struct lan743x_adapter *adapter)
@@ -1019,16 +1013,16 @@ static void lan743x_phy_close(struct lan743x_adapter *adapter)
 static int lan743x_phy_open(struct lan743x_adapter *adapter)
 {
        struct lan743x_phy *phy = &adapter->phy;
+       struct phy_device *phydev = NULL;
        struct device_node *phynode;
-       struct phy_device *phydev;
        struct net_device *netdev;
        int ret = -EIO;
 
        netdev = adapter->netdev;
        phynode = of_node_get(adapter->pdev->dev.of_node);
-       adapter->phy_mode = PHY_INTERFACE_MODE_GMII;
 
        if (phynode) {
+               /* try devicetree phy, or fixed link */
                of_get_phy_mode(phynode, &adapter->phy_mode);
 
                if (of_phy_is_fixed_link(phynode)) {
@@ -1044,13 +1038,15 @@ static int lan743x_phy_open(struct lan743x_adapter *adapter)
                                        lan743x_phy_link_status_change, 0,
                                        adapter->phy_mode);
                of_node_put(phynode);
-               if (!phydev)
-                       goto return_error;
-       } else {
+       }
+
+       if (!phydev) {
+               /* try internal phy */
                phydev = phy_find_first(adapter->mdiobus);
                if (!phydev)
                        goto return_error;
 
+               adapter->phy_mode = PHY_INTERFACE_MODE_GMII;
                ret = phy_connect_direct(netdev, phydev,
                                         lan743x_phy_link_status_change,
                                         adapter->phy_mode);
@@ -2733,7 +2729,6 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
 
        adapter->intr.irq = adapter->pdev->irq;
        lan743x_csr_write(adapter, INT_EN_CLR, 0xFFFFFFFF);
-       mutex_init(&adapter->dp_lock);
 
        ret = lan743x_gpio_init(adapter);
        if (ret)
index c61a404..a536f4a 100644 (file)
@@ -712,9 +712,6 @@ struct lan743x_adapter {
        struct lan743x_csr      csr;
        struct lan743x_intr     intr;
 
-       /* lock, used to prevent concurrent access to data port */
-       struct mutex            dp_lock;
-
        struct lan743x_gpio     gpio;
        struct lan743x_ptp      ptp;
 
index 70bf8c6..2632fe2 100644 (file)
@@ -147,42 +147,20 @@ static int ocelot_vlant_set_mask(struct ocelot *ocelot, u16 vid, u32 mask)
        return ocelot_vlant_wait_for_completion(ocelot);
 }
 
-static int ocelot_port_set_native_vlan(struct ocelot *ocelot, int port,
-                                      u16 vid)
+static void ocelot_port_set_native_vlan(struct ocelot *ocelot, int port,
+                                       struct ocelot_vlan native_vlan)
 {
        struct ocelot_port *ocelot_port = ocelot->ports[port];
        u32 val = 0;
 
-       if (ocelot_port->vid != vid) {
-               /* Always permit deleting the native VLAN (vid = 0) */
-               if (ocelot_port->vid && vid) {
-                       dev_err(ocelot->dev,
-                               "Port already has a native VLAN: %d\n",
-                               ocelot_port->vid);
-                       return -EBUSY;
-               }
-               ocelot_port->vid = vid;
-       }
+       ocelot_port->native_vlan = native_vlan;
 
-       ocelot_rmw_gix(ocelot, REW_PORT_VLAN_CFG_PORT_VID(vid),
+       ocelot_rmw_gix(ocelot, REW_PORT_VLAN_CFG_PORT_VID(native_vlan.vid),
                       REW_PORT_VLAN_CFG_PORT_VID_M,
                       REW_PORT_VLAN_CFG, port);
 
-       if (ocelot_port->vlan_aware && !ocelot_port->vid)
-               /* If port is vlan-aware and tagged, drop untagged and priority
-                * tagged frames.
-                */
-               val = ANA_PORT_DROP_CFG_DROP_UNTAGGED_ENA |
-                     ANA_PORT_DROP_CFG_DROP_PRIO_S_TAGGED_ENA |
-                     ANA_PORT_DROP_CFG_DROP_PRIO_C_TAGGED_ENA;
-       ocelot_rmw_gix(ocelot, val,
-                      ANA_PORT_DROP_CFG_DROP_UNTAGGED_ENA |
-                      ANA_PORT_DROP_CFG_DROP_PRIO_S_TAGGED_ENA |
-                      ANA_PORT_DROP_CFG_DROP_PRIO_C_TAGGED_ENA,
-                      ANA_PORT_DROP_CFG, port);
-
        if (ocelot_port->vlan_aware) {
-               if (ocelot_port->vid)
+               if (native_vlan.valid)
                        /* Tag all frames except when VID == DEFAULT_VLAN */
                        val = REW_TAG_CFG_TAG_CFG(1);
                else
@@ -195,8 +173,38 @@ static int ocelot_port_set_native_vlan(struct ocelot *ocelot, int port,
        ocelot_rmw_gix(ocelot, val,
                       REW_TAG_CFG_TAG_CFG_M,
                       REW_TAG_CFG, port);
+}
 
-       return 0;
+/* Default vlan to clasify for untagged frames (may be zero) */
+static void ocelot_port_set_pvid(struct ocelot *ocelot, int port,
+                                struct ocelot_vlan pvid_vlan)
+{
+       struct ocelot_port *ocelot_port = ocelot->ports[port];
+       u32 val = 0;
+
+       ocelot_port->pvid_vlan = pvid_vlan;
+
+       if (!ocelot_port->vlan_aware)
+               pvid_vlan.vid = 0;
+
+       ocelot_rmw_gix(ocelot,
+                      ANA_PORT_VLAN_CFG_VLAN_VID(pvid_vlan.vid),
+                      ANA_PORT_VLAN_CFG_VLAN_VID_M,
+                      ANA_PORT_VLAN_CFG, port);
+
+       /* If there's no pvid, we should drop not only untagged traffic (which
+        * happens automatically), but also 802.1p traffic which gets
+        * classified to VLAN 0, but that is always in our RX filter, so it
+        * would get accepted were it not for this setting.
+        */
+       if (!pvid_vlan.valid && ocelot_port->vlan_aware)
+               val = ANA_PORT_DROP_CFG_DROP_PRIO_S_TAGGED_ENA |
+                     ANA_PORT_DROP_CFG_DROP_PRIO_C_TAGGED_ENA;
+
+       ocelot_rmw_gix(ocelot, val,
+                      ANA_PORT_DROP_CFG_DROP_PRIO_S_TAGGED_ENA |
+                      ANA_PORT_DROP_CFG_DROP_PRIO_C_TAGGED_ENA,
+                      ANA_PORT_DROP_CFG, port);
 }
 
 int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
@@ -233,24 +241,30 @@ int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
                       ANA_PORT_VLAN_CFG_VLAN_POP_CNT_M,
                       ANA_PORT_VLAN_CFG, port);
 
-       ocelot_port_set_native_vlan(ocelot, port, ocelot_port->vid);
+       ocelot_port_set_pvid(ocelot, port, ocelot_port->pvid_vlan);
+       ocelot_port_set_native_vlan(ocelot, port, ocelot_port->native_vlan);
 
        return 0;
 }
 EXPORT_SYMBOL(ocelot_port_vlan_filtering);
 
-/* Default vlan to clasify for untagged frames (may be zero) */
-static void ocelot_port_set_pvid(struct ocelot *ocelot, int port, u16 pvid)
+int ocelot_vlan_prepare(struct ocelot *ocelot, int port, u16 vid, bool pvid,
+                       bool untagged)
 {
        struct ocelot_port *ocelot_port = ocelot->ports[port];
 
-       ocelot_rmw_gix(ocelot,
-                      ANA_PORT_VLAN_CFG_VLAN_VID(pvid),
-                      ANA_PORT_VLAN_CFG_VLAN_VID_M,
-                      ANA_PORT_VLAN_CFG, port);
+       /* Deny changing the native VLAN, but always permit deleting it */
+       if (untagged && ocelot_port->native_vlan.vid != vid &&
+           ocelot_port->native_vlan.valid) {
+               dev_err(ocelot->dev,
+                       "Port already has a native VLAN: %d\n",
+                       ocelot_port->native_vlan.vid);
+               return -EBUSY;
+       }
 
-       ocelot_port->pvid = pvid;
+       return 0;
 }
+EXPORT_SYMBOL(ocelot_vlan_prepare);
 
 int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
                    bool untagged)
@@ -264,14 +278,21 @@ int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
                return ret;
 
        /* Default ingress vlan classification */
-       if (pvid)
-               ocelot_port_set_pvid(ocelot, port, vid);
+       if (pvid) {
+               struct ocelot_vlan pvid_vlan;
+
+               pvid_vlan.vid = vid;
+               pvid_vlan.valid = true;
+               ocelot_port_set_pvid(ocelot, port, pvid_vlan);
+       }
 
        /* Untagged egress vlan clasification */
        if (untagged) {
-               ret = ocelot_port_set_native_vlan(ocelot, port, vid);
-               if (ret)
-                       return ret;
+               struct ocelot_vlan native_vlan;
+
+               native_vlan.vid = vid;
+               native_vlan.valid = true;
+               ocelot_port_set_native_vlan(ocelot, port, native_vlan);
        }
 
        return 0;
@@ -290,12 +311,18 @@ int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid)
                return ret;
 
        /* Ingress */
-       if (ocelot_port->pvid == vid)
-               ocelot_port_set_pvid(ocelot, port, 0);
+       if (ocelot_port->pvid_vlan.vid == vid) {
+               struct ocelot_vlan pvid_vlan = {0};
+
+               ocelot_port_set_pvid(ocelot, port, pvid_vlan);
+       }
 
        /* Egress */
-       if (ocelot_port->vid == vid)
-               ocelot_port_set_native_vlan(ocelot, port, 0);
+       if (ocelot_port->native_vlan.vid == vid) {
+               struct ocelot_vlan native_vlan = {0};
+
+               ocelot_port_set_native_vlan(ocelot, port, native_vlan);
+       }
 
        return 0;
 }
@@ -542,26 +569,11 @@ EXPORT_SYMBOL(ocelot_get_txtstamp);
 int ocelot_fdb_add(struct ocelot *ocelot, int port,
                   const unsigned char *addr, u16 vid)
 {
-       struct ocelot_port *ocelot_port = ocelot->ports[port];
        int pgid = port;
 
        if (port == ocelot->npi)
                pgid = PGID_CPU;
 
-       if (!vid) {
-               if (!ocelot_port->vlan_aware)
-                       /* If the bridge is not VLAN aware and no VID was
-                        * provided, set it to pvid to ensure the MAC entry
-                        * matches incoming untagged packets
-                        */
-                       vid = ocelot_port->pvid;
-               else
-                       /* If the bridge is VLAN aware a VID must be provided as
-                        * otherwise the learnt entry wouldn't match any frame.
-                        */
-                       return -EINVAL;
-       }
-
        return ocelot_mact_learn(ocelot, pgid, addr, vid, ENTRYTYPE_LOCKED);
 }
 EXPORT_SYMBOL(ocelot_fdb_add);
@@ -958,52 +970,88 @@ static enum macaccess_entry_type ocelot_classify_mdb(const unsigned char *addr)
                return ENTRYTYPE_MACv4;
        if (addr[0] == 0x33 && addr[1] == 0x33)
                return ENTRYTYPE_MACv6;
-       return ENTRYTYPE_NORMAL;
+       return ENTRYTYPE_LOCKED;
+}
+
+static struct ocelot_pgid *ocelot_pgid_alloc(struct ocelot *ocelot, int index,
+                                            unsigned long ports)
+{
+       struct ocelot_pgid *pgid;
+
+       pgid = kzalloc(sizeof(*pgid), GFP_KERNEL);
+       if (!pgid)
+               return ERR_PTR(-ENOMEM);
+
+       pgid->ports = ports;
+       pgid->index = index;
+       refcount_set(&pgid->refcount, 1);
+       list_add_tail(&pgid->list, &ocelot->pgids);
+
+       return pgid;
+}
+
+static void ocelot_pgid_free(struct ocelot *ocelot, struct ocelot_pgid *pgid)
+{
+       if (!refcount_dec_and_test(&pgid->refcount))
+               return;
+
+       list_del(&pgid->list);
+       kfree(pgid);
 }
 
-static int ocelot_mdb_get_pgid(struct ocelot *ocelot,
-                              enum macaccess_entry_type entry_type)
+static struct ocelot_pgid *ocelot_mdb_get_pgid(struct ocelot *ocelot,
+                                              const struct ocelot_multicast *mc)
 {
-       int pgid;
+       struct ocelot_pgid *pgid;
+       int index;
 
        /* According to VSC7514 datasheet 3.9.1.5 IPv4 Multicast Entries and
         * 3.9.1.6 IPv6 Multicast Entries, "Instead of a lookup in the
         * destination mask table (PGID), the destination set is programmed as
         * part of the entry MAC address.", and the DEST_IDX is set to 0.
         */
-       if (entry_type == ENTRYTYPE_MACv4 ||
-           entry_type == ENTRYTYPE_MACv6)
-               return 0;
+       if (mc->entry_type == ENTRYTYPE_MACv4 ||
+           mc->entry_type == ENTRYTYPE_MACv6)
+               return ocelot_pgid_alloc(ocelot, 0, mc->ports);
 
-       for_each_nonreserved_multicast_dest_pgid(ocelot, pgid) {
-               struct ocelot_multicast *mc;
+       list_for_each_entry(pgid, &ocelot->pgids, list) {
+               /* When searching for a nonreserved multicast PGID, ignore the
+                * dummy PGID of zero that we have for MACv4/MACv6 entries
+                */
+               if (pgid->index && pgid->ports == mc->ports) {
+                       refcount_inc(&pgid->refcount);
+                       return pgid;
+               }
+       }
+
+       /* Search for a free index in the nonreserved multicast PGID area */
+       for_each_nonreserved_multicast_dest_pgid(ocelot, index) {
                bool used = false;
 
-               list_for_each_entry(mc, &ocelot->multicast, list) {
-                       if (mc->pgid == pgid) {
+               list_for_each_entry(pgid, &ocelot->pgids, list) {
+                       if (pgid->index == index) {
                                used = true;
                                break;
                        }
                }
 
                if (!used)
-                       return pgid;
+                       return ocelot_pgid_alloc(ocelot, index, mc->ports);
        }
 
-       return -1;
+       return ERR_PTR(-ENOSPC);
 }
 
 static void ocelot_encode_ports_to_mdb(unsigned char *addr,
-                                      struct ocelot_multicast *mc,
-                                      enum macaccess_entry_type entry_type)
+                                      struct ocelot_multicast *mc)
 {
-       memcpy(addr, mc->addr, ETH_ALEN);
+       ether_addr_copy(addr, mc->addr);
 
-       if (entry_type == ENTRYTYPE_MACv4) {
+       if (mc->entry_type == ENTRYTYPE_MACv4) {
                addr[0] = 0;
                addr[1] = mc->ports >> 8;
                addr[2] = mc->ports & 0xff;
-       } else if (entry_type == ENTRYTYPE_MACv6) {
+       } else if (mc->entry_type == ENTRYTYPE_MACv6) {
                addr[0] = mc->ports >> 8;
                addr[1] = mc->ports & 0xff;
        }
@@ -1012,80 +1060,78 @@ static void ocelot_encode_ports_to_mdb(unsigned char *addr,
 int ocelot_port_mdb_add(struct ocelot *ocelot, int port,
                        const struct switchdev_obj_port_mdb *mdb)
 {
-       struct ocelot_port *ocelot_port = ocelot->ports[port];
-       enum macaccess_entry_type entry_type;
        unsigned char addr[ETH_ALEN];
        struct ocelot_multicast *mc;
+       struct ocelot_pgid *pgid;
        u16 vid = mdb->vid;
-       bool new = false;
 
        if (port == ocelot->npi)
                port = ocelot->num_phys_ports;
 
-       if (!vid)
-               vid = ocelot_port->pvid;
-
-       entry_type = ocelot_classify_mdb(mdb->addr);
-
        mc = ocelot_multicast_get(ocelot, mdb->addr, vid);
        if (!mc) {
-               int pgid = ocelot_mdb_get_pgid(ocelot, entry_type);
-
-               if (pgid < 0) {
-                       dev_err(ocelot->dev,
-                               "No more PGIDs available for mdb %pM vid %d\n",
-                               mdb->addr, vid);
-                       return -ENOSPC;
-               }
-
+               /* New entry */
                mc = devm_kzalloc(ocelot->dev, sizeof(*mc), GFP_KERNEL);
                if (!mc)
                        return -ENOMEM;
 
-               memcpy(mc->addr, mdb->addr, ETH_ALEN);
+               mc->entry_type = ocelot_classify_mdb(mdb->addr);
+               ether_addr_copy(mc->addr, mdb->addr);
                mc->vid = vid;
-               mc->pgid = pgid;
 
                list_add_tail(&mc->list, &ocelot->multicast);
-               new = true;
-       }
-
-       if (!new) {
-               ocelot_encode_ports_to_mdb(addr, mc, entry_type);
+       } else {
+               /* Existing entry. Clean up the current port mask from
+                * hardware now, because we'll be modifying it.
+                */
+               ocelot_pgid_free(ocelot, mc->pgid);
+               ocelot_encode_ports_to_mdb(addr, mc);
                ocelot_mact_forget(ocelot, addr, vid);
        }
 
        mc->ports |= BIT(port);
-       ocelot_encode_ports_to_mdb(addr, mc, entry_type);
 
-       return ocelot_mact_learn(ocelot, mc->pgid, addr, vid, entry_type);
+       pgid = ocelot_mdb_get_pgid(ocelot, mc);
+       if (IS_ERR(pgid)) {
+               dev_err(ocelot->dev,
+                       "Cannot allocate PGID for mdb %pM vid %d\n",
+                       mc->addr, mc->vid);
+               devm_kfree(ocelot->dev, mc);
+               return PTR_ERR(pgid);
+       }
+       mc->pgid = pgid;
+
+       ocelot_encode_ports_to_mdb(addr, mc);
+
+       if (mc->entry_type != ENTRYTYPE_MACv4 &&
+           mc->entry_type != ENTRYTYPE_MACv6)
+               ocelot_write_rix(ocelot, pgid->ports, ANA_PGID_PGID,
+                                pgid->index);
+
+       return ocelot_mact_learn(ocelot, pgid->index, addr, vid,
+                                mc->entry_type);
 }
 EXPORT_SYMBOL(ocelot_port_mdb_add);
 
 int ocelot_port_mdb_del(struct ocelot *ocelot, int port,
                        const struct switchdev_obj_port_mdb *mdb)
 {
-       struct ocelot_port *ocelot_port = ocelot->ports[port];
-       enum macaccess_entry_type entry_type;
        unsigned char addr[ETH_ALEN];
        struct ocelot_multicast *mc;
+       struct ocelot_pgid *pgid;
        u16 vid = mdb->vid;
 
        if (port == ocelot->npi)
                port = ocelot->num_phys_ports;
 
-       if (!vid)
-               vid = ocelot_port->pvid;
-
        mc = ocelot_multicast_get(ocelot, mdb->addr, vid);
        if (!mc)
                return -ENOENT;
 
-       entry_type = ocelot_classify_mdb(mdb->addr);
-
-       ocelot_encode_ports_to_mdb(addr, mc, entry_type);
+       ocelot_encode_ports_to_mdb(addr, mc);
        ocelot_mact_forget(ocelot, addr, vid);
 
+       ocelot_pgid_free(ocelot, mc->pgid);
        mc->ports &= ~BIT(port);
        if (!mc->ports) {
                list_del(&mc->list);
@@ -1093,9 +1139,21 @@ int ocelot_port_mdb_del(struct ocelot *ocelot, int port,
                return 0;
        }
 
-       ocelot_encode_ports_to_mdb(addr, mc, entry_type);
+       /* We have a PGID with fewer ports now */
+       pgid = ocelot_mdb_get_pgid(ocelot, mc);
+       if (IS_ERR(pgid))
+               return PTR_ERR(pgid);
+       mc->pgid = pgid;
+
+       ocelot_encode_ports_to_mdb(addr, mc);
+
+       if (mc->entry_type != ENTRYTYPE_MACv4 &&
+           mc->entry_type != ENTRYTYPE_MACv6)
+               ocelot_write_rix(ocelot, pgid->ports, ANA_PGID_PGID,
+                                pgid->index);
 
-       return ocelot_mact_learn(ocelot, mc->pgid, addr, vid, entry_type);
+       return ocelot_mact_learn(ocelot, pgid->index, addr, vid,
+                                mc->entry_type);
 }
 EXPORT_SYMBOL(ocelot_port_mdb_del);
 
@@ -1120,6 +1178,7 @@ EXPORT_SYMBOL(ocelot_port_bridge_join);
 int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
                             struct net_device *bridge)
 {
+       struct ocelot_vlan pvid = {0}, native_vlan = {0};
        struct switchdev_trans trans;
        int ret;
 
@@ -1138,8 +1197,10 @@ int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
        if (ret)
                return ret;
 
-       ocelot_port_set_pvid(ocelot, port, 0);
-       return ocelot_port_set_native_vlan(ocelot, port, 0);
+       ocelot_port_set_pvid(ocelot, port, pvid);
+       ocelot_port_set_native_vlan(ocelot, port, native_vlan);
+
+       return 0;
 }
 EXPORT_SYMBOL(ocelot_port_bridge_leave);
 
@@ -1453,6 +1514,7 @@ int ocelot_init(struct ocelot *ocelot)
                return -ENOMEM;
 
        INIT_LIST_HEAD(&ocelot->multicast);
+       INIT_LIST_HEAD(&ocelot->pgids);
        ocelot_mact_init(ocelot);
        ocelot_vlan_init(ocelot);
        ocelot_vcap_init(ocelot);
index abb407d..291d39d 100644 (file)
@@ -41,14 +41,6 @@ struct frame_info {
        u32 timestamp;  /* rew_val */
 };
 
-struct ocelot_multicast {
-       struct list_head list;
-       unsigned char addr[ETH_ALEN];
-       u16 vid;
-       u16 ports;
-       int pgid;
-};
-
 struct ocelot_port_tc {
        bool block_shared;
        unsigned long offload_cnt;
@@ -87,6 +79,29 @@ enum macaccess_entry_type {
        ENTRYTYPE_MACv6,
 };
 
+/* A (PGID) port mask structure, encoding the 2^ocelot->num_phys_ports
+ * possibilities of egress port masks for L2 multicast traffic.
+ * For a switch with 9 user ports, there are 512 possible port masks, but the
+ * hardware only has 46 individual PGIDs that it can forward multicast traffic
+ * to. So we need a structure that maps the limited PGID indices to the port
+ * destinations requested by the user for L2 multicast.
+ */
+struct ocelot_pgid {
+       unsigned long ports;
+       int index;
+       refcount_t refcount;
+       struct list_head list;
+};
+
+struct ocelot_multicast {
+       struct list_head list;
+       enum macaccess_entry_type entry_type;
+       unsigned char addr[ETH_ALEN];
+       u16 vid;
+       u16 ports;
+       struct ocelot_pgid *pgid;
+};
+
 int ocelot_port_fdb_do_dump(const unsigned char *addr, u16 vid,
                            bool is_static, void *data);
 int ocelot_mact_learn(struct ocelot *ocelot, int port,
index b34da11..c65ae6f 100644 (file)
@@ -206,6 +206,17 @@ static void ocelot_port_adjust_link(struct net_device *dev)
        ocelot_adjust_link(ocelot, port, dev->phydev);
 }
 
+static int ocelot_vlan_vid_prepare(struct net_device *dev, u16 vid, bool pvid,
+                                  bool untagged)
+{
+       struct ocelot_port_private *priv = netdev_priv(dev);
+       struct ocelot_port *ocelot_port = &priv->port;
+       struct ocelot *ocelot = ocelot_port->ocelot;
+       int port = priv->chip_port;
+
+       return ocelot_vlan_prepare(ocelot, port, vid, pvid, untagged);
+}
+
 static int ocelot_vlan_vid_add(struct net_device *dev, u16 vid, bool pvid,
                               bool untagged)
 {
@@ -409,7 +420,7 @@ static int ocelot_mc_unsync(struct net_device *dev, const unsigned char *addr)
        struct ocelot_port *ocelot_port = &priv->port;
        struct ocelot *ocelot = ocelot_port->ocelot;
 
-       return ocelot_mact_forget(ocelot, addr, ocelot_port->pvid);
+       return ocelot_mact_forget(ocelot, addr, ocelot_port->pvid_vlan.vid);
 }
 
 static int ocelot_mc_sync(struct net_device *dev, const unsigned char *addr)
@@ -418,8 +429,8 @@ static int ocelot_mc_sync(struct net_device *dev, const unsigned char *addr)
        struct ocelot_port *ocelot_port = &priv->port;
        struct ocelot *ocelot = ocelot_port->ocelot;
 
-       return ocelot_mact_learn(ocelot, PGID_CPU, addr, ocelot_port->pvid,
-                                ENTRYTYPE_LOCKED);
+       return ocelot_mact_learn(ocelot, PGID_CPU, addr,
+                                ocelot_port->pvid_vlan.vid, ENTRYTYPE_LOCKED);
 }
 
 static void ocelot_set_rx_mode(struct net_device *dev)
@@ -462,10 +473,10 @@ static int ocelot_port_set_mac_address(struct net_device *dev, void *p)
        const struct sockaddr *addr = p;
 
        /* Learn the new net device MAC address in the mac table. */
-       ocelot_mact_learn(ocelot, PGID_CPU, addr->sa_data, ocelot_port->pvid,
-                         ENTRYTYPE_LOCKED);
+       ocelot_mact_learn(ocelot, PGID_CPU, addr->sa_data,
+                         ocelot_port->pvid_vlan.vid, ENTRYTYPE_LOCKED);
        /* Then forget the previous one. */
-       ocelot_mact_forget(ocelot, dev->dev_addr, ocelot_port->pvid);
+       ocelot_mact_forget(ocelot, dev->dev_addr, ocelot_port->pvid_vlan.vid);
 
        ether_addr_copy(dev->dev_addr, addr->sa_data);
        return 0;
@@ -812,9 +823,14 @@ static int ocelot_port_obj_add_vlan(struct net_device *dev,
        u16 vid;
 
        for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) {
-               ret = ocelot_vlan_vid_add(dev, vid,
-                                         vlan->flags & BRIDGE_VLAN_INFO_PVID,
-                                         vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED);
+               bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID;
+               bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
+
+               if (switchdev_trans_ph_prepare(trans))
+                       ret = ocelot_vlan_vid_prepare(dev, vid, pvid,
+                                                     untagged);
+               else
+                       ret = ocelot_vlan_vid_add(dev, vid, pvid, untagged);
                if (ret)
                        return ret;
        }
@@ -1074,8 +1090,8 @@ int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target,
 
        memcpy(dev->dev_addr, ocelot->base_mac, ETH_ALEN);
        dev->dev_addr[ETH_ALEN - 1] += port;
-       ocelot_mact_learn(ocelot, PGID_CPU, dev->dev_addr, ocelot_port->pvid,
-                         ENTRYTYPE_LOCKED);
+       ocelot_mact_learn(ocelot, PGID_CPU, dev->dev_addr,
+                         ocelot_port->pvid_vlan.vid, ENTRYTYPE_LOCKED);
 
        ocelot_init_port(ocelot, port);
 
index d13d92b..8f2f091 100644 (file)
@@ -1106,7 +1106,7 @@ static int s2io_print_pci_mode(struct s2io_nic *nic)
  *  '-1' on failure
  */
 
-static int init_tti(struct s2io_nic *nic, int link)
+static int init_tti(struct s2io_nic *nic, int link, bool may_sleep)
 {
        struct XENA_dev_config __iomem *bar0 = nic->bar0;
        register u64 val64 = 0;
@@ -1166,7 +1166,7 @@ static int init_tti(struct s2io_nic *nic, int link)
 
                if (wait_for_cmd_complete(&bar0->tti_command_mem,
                                          TTI_CMD_MEM_STROBE_NEW_CMD,
-                                         S2IO_BIT_RESET) != SUCCESS)
+                                         S2IO_BIT_RESET, may_sleep) != SUCCESS)
                        return FAILURE;
        }
 
@@ -1659,7 +1659,7 @@ static int init_nic(struct s2io_nic *nic)
         */
 
        /* Initialize TTI */
-       if (SUCCESS != init_tti(nic, nic->last_link_state))
+       if (SUCCESS != init_tti(nic, nic->last_link_state, true))
                return -ENODEV;
 
        /* RTI Initialization */
@@ -3331,7 +3331,7 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
  */
 
 static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit,
-                                int bit_state)
+                                int bit_state, bool may_sleep)
 {
        int ret = FAILURE, cnt = 0, delay = 1;
        u64 val64;
@@ -3353,7 +3353,7 @@ static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit,
                        }
                }
 
-               if (in_interrupt())
+               if (!may_sleep)
                        mdelay(delay);
                else
                        msleep(delay);
@@ -4877,8 +4877,7 @@ static struct net_device_stats *s2io_get_stats(struct net_device *dev)
  *  Return value:
  *  void.
  */
-
-static void s2io_set_multicast(struct net_device *dev)
+static void s2io_set_multicast(struct net_device *dev, bool may_sleep)
 {
        int i, j, prev_cnt;
        struct netdev_hw_addr *ha;
@@ -4903,7 +4902,7 @@ static void s2io_set_multicast(struct net_device *dev)
                /* Wait till command completes */
                wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
                                      RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING,
-                                     S2IO_BIT_RESET);
+                                     S2IO_BIT_RESET, may_sleep);
 
                sp->m_cast_flg = 1;
                sp->all_multi_pos = config->max_mc_addr - 1;
@@ -4920,7 +4919,7 @@ static void s2io_set_multicast(struct net_device *dev)
                /* Wait till command completes */
                wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
                                      RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING,
-                                     S2IO_BIT_RESET);
+                                     S2IO_BIT_RESET, may_sleep);
 
                sp->m_cast_flg = 0;
                sp->all_multi_pos = 0;
@@ -5000,7 +4999,7 @@ static void s2io_set_multicast(struct net_device *dev)
                        /* Wait for command completes */
                        if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
                                                  RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING,
-                                                 S2IO_BIT_RESET)) {
+                                                 S2IO_BIT_RESET, may_sleep)) {
                                DBG_PRINT(ERR_DBG,
                                          "%s: Adding Multicasts failed\n",
                                          dev->name);
@@ -5030,7 +5029,7 @@ static void s2io_set_multicast(struct net_device *dev)
                        /* Wait for command completes */
                        if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
                                                  RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING,
-                                                 S2IO_BIT_RESET)) {
+                                                 S2IO_BIT_RESET, may_sleep)) {
                                DBG_PRINT(ERR_DBG,
                                          "%s: Adding Multicasts failed\n",
                                          dev->name);
@@ -5041,6 +5040,12 @@ static void s2io_set_multicast(struct net_device *dev)
        }
 }
 
+/* NDO wrapper for s2io_set_multicast */
+static void s2io_ndo_set_multicast(struct net_device *dev)
+{
+       s2io_set_multicast(dev, false);
+}
+
 /* read from CAM unicast & multicast addresses and store it in
  * def_mac_addr structure
  */
@@ -5127,7 +5132,7 @@ static int do_s2io_add_mac(struct s2io_nic *sp, u64 addr, int off)
        /* Wait till command completes */
        if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
                                  RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING,
-                                 S2IO_BIT_RESET)) {
+                                 S2IO_BIT_RESET, true)) {
                DBG_PRINT(INFO_DBG, "do_s2io_add_mac failed\n");
                return FAILURE;
        }
@@ -5171,7 +5176,7 @@ static u64 do_s2io_read_unicast_mc(struct s2io_nic *sp, int offset)
        /* Wait till command completes */
        if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
                                  RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING,
-                                 S2IO_BIT_RESET)) {
+                                 S2IO_BIT_RESET, true)) {
                DBG_PRINT(INFO_DBG, "do_s2io_read_unicast_mc failed\n");
                return FAILURE;
        }
@@ -7141,7 +7146,7 @@ static int s2io_card_up(struct s2io_nic *sp)
        }
 
        /* Setting its receive mode */
-       s2io_set_multicast(dev);
+       s2io_set_multicast(dev, true);
 
        if (dev->features & NETIF_F_LRO) {
                /* Initialize max aggregatable pkts per session based on MTU */
@@ -7447,7 +7452,7 @@ static void s2io_link(struct s2io_nic *sp, int link)
        struct swStat *swstats = &sp->mac_control.stats_info->sw_stat;
 
        if (link != sp->last_link_state) {
-               init_tti(sp, link);
+               init_tti(sp, link, false);
                if (link == LINK_DOWN) {
                        DBG_PRINT(ERR_DBG, "%s: Link down\n", dev->name);
                        s2io_stop_all_tx_queue(sp);
@@ -7604,7 +7609,7 @@ static int rts_ds_steer(struct s2io_nic *nic, u8 ds_codepoint, u8 ring)
 
        return wait_for_cmd_complete(&bar0->rts_ds_mem_ctrl,
                                     RTS_DS_MEM_CTRL_STROBE_CMD_BEING_EXECUTED,
-                                    S2IO_BIT_RESET);
+                                    S2IO_BIT_RESET, true);
 }
 
 static const struct net_device_ops s2io_netdev_ops = {
@@ -7613,7 +7618,7 @@ static const struct net_device_ops s2io_netdev_ops = {
        .ndo_get_stats          = s2io_get_stats,
        .ndo_start_xmit         = s2io_xmit,
        .ndo_validate_addr      = eth_validate_addr,
-       .ndo_set_rx_mode        = s2io_set_multicast,
+       .ndo_set_rx_mode        = s2io_ndo_set_multicast,
        .ndo_do_ioctl           = s2io_ioctl,
        .ndo_set_mac_address    = s2io_set_mac_addr,
        .ndo_change_mtu         = s2io_change_mtu,
@@ -7929,7 +7934,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
        writeq(val64, &bar0->rmac_addr_cmd_mem);
        wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
                              RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING,
-                             S2IO_BIT_RESET);
+                             S2IO_BIT_RESET, true);
        tmp64 = readq(&bar0->rmac_addr_data0_mem);
        mac_down = (u32)tmp64;
        mac_up = (u32) (tmp64 >> 32);
index 6fa3159..5a60322 100644 (file)
@@ -1066,7 +1066,7 @@ static void tx_intr_handler(struct fifo_info *fifo_data);
 static void s2io_handle_errors(void * dev_id);
 
 static void s2io_tx_watchdog(struct net_device *dev, unsigned int txqueue);
-static void s2io_set_multicast(struct net_device *dev);
+static void s2io_set_multicast(struct net_device *dev, bool may_sleep);
 static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp);
 static void s2io_link(struct s2io_nic * sp, int link);
 static void s2io_reset(struct s2io_nic * sp);
@@ -1087,7 +1087,7 @@ static int s2io_set_swapper(struct s2io_nic * sp);
 static void s2io_card_down(struct s2io_nic *nic);
 static int s2io_card_up(struct s2io_nic *nic);
 static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit,
-                                       int bit_state);
+                                int bit_state, bool may_sleep);
 static int s2io_add_isr(struct s2io_nic * sp);
 static void s2io_rem_isr(struct s2io_nic * sp);
 
index f5d48d7..da48dd8 100644 (file)
@@ -1121,7 +1121,7 @@ static void __vxge_hw_blockpool_destroy(struct __vxge_hw_blockpool *blockpool)
 
        list_for_each_safe(p, n, &blockpool->free_entry_list) {
                list_del(&((struct __vxge_hw_blockpool_entry *)p)->item);
-               kfree((void *)p);
+               kfree(p);
        }
 
        return;
index 7ff2ccb..e672614 100644 (file)
@@ -724,10 +724,8 @@ static int nfp_pci_probe(struct pci_dev *pdev,
        }
 
        pf->cpp = nfp_cpp_from_nfp6000_pcie(pdev);
-       if (IS_ERR_OR_NULL(pf->cpp)) {
+       if (IS_ERR(pf->cpp)) {
                err = PTR_ERR(pf->cpp);
-               if (err >= 0)
-                       err = -ENOMEM;
                goto err_disable_msix;
        }
 
index 2fc10a3..8724d6a 100644 (file)
@@ -1043,8 +1043,7 @@ static int using_multi_irqs(struct net_device *dev)
        struct fe_priv *np = get_nvpriv(dev);
 
        if (!(np->msi_flags & NV_MSI_X_ENABLED) ||
-           ((np->msi_flags & NV_MSI_X_ENABLED) &&
-            ((np->msi_flags & NV_MSI_X_VECTORS_MASK) == 0x1)))
+           ((np->msi_flags & NV_MSI_X_VECTORS_MASK) == 0x1))
                return 0;
        else
                return 1;
@@ -1666,11 +1665,7 @@ static void nv_update_stats(struct net_device *dev)
        struct fe_priv *np = netdev_priv(dev);
        u8 __iomem *base = get_hwbase(dev);
 
-       /* If it happens that this is run in top-half context, then
-        * replace the spin_lock of hwstats_lock with
-        * spin_lock_irqsave() in calling functions. */
-       WARN_ONCE(in_irq(), "forcedeth: estats spin_lock(_bh) from top-half");
-       assert_spin_locked(&np->hwstats_lock);
+       lockdep_assert_held(&np->hwstats_lock);
 
        /* query hardware */
        np->estats.tx_bytes += readl(base + NvRegTxCnt);
index ade8c44..b9e32e4 100644 (file)
@@ -2412,7 +2412,6 @@ static int __pch_gbe_suspend(struct pci_dev *pdev)
        struct pch_gbe_adapter *adapter = netdev_priv(netdev);
        struct pch_gbe_hw *hw = &adapter->hw;
        u32 wufc = adapter->wake_up_evt;
-       int retval = 0;
 
        netif_device_detach(netdev);
        if (netif_running(netdev))
@@ -2432,7 +2431,7 @@ static int __pch_gbe_suspend(struct pci_dev *pdev)
                pch_gbe_mac_set_wol_event(hw, wufc);
                pci_disable_device(pdev);
        }
-       return retval;
+       return 0;
 }
 
 #ifdef CONFIG_PM
index 545c99b..dc5fbc2 100644 (file)
@@ -333,7 +333,7 @@ int ionic_set_vf_config(struct ionic *ionic, int vf, u8 attr, u8 *data)
        union ionic_dev_cmd cmd = {
                .vf_setattr.opcode = IONIC_CMD_VF_SETATTR,
                .vf_setattr.attr = attr,
-               .vf_setattr.vf_index = vf,
+               .vf_setattr.vf_index = cpu_to_le16(vf),
        };
        int err;
 
@@ -391,7 +391,7 @@ void ionic_dev_cmd_queue_identify(struct ionic_dev *idev,
 {
        union ionic_dev_cmd cmd = {
                .q_identify.opcode = IONIC_CMD_Q_IDENTIFY,
-               .q_identify.lif_type = lif_type,
+               .q_identify.lif_type = cpu_to_le16(lif_type),
                .q_identify.type = qtype,
                .q_identify.ver = qver,
        };
index c109cd5..6c243b1 100644 (file)
@@ -29,6 +29,7 @@ struct ionic_dev_bar {
        int res_index;
 };
 
+#ifndef __CHECKER__
 /* Registers */
 static_assert(sizeof(struct ionic_intr) == 32);
 
@@ -119,6 +120,7 @@ static_assert(sizeof(struct ionic_vf_setattr_cmd) == 64);
 static_assert(sizeof(struct ionic_vf_setattr_comp) == 16);
 static_assert(sizeof(struct ionic_vf_getattr_cmd) == 64);
 static_assert(sizeof(struct ionic_vf_getattr_comp) == 16);
+#endif /* __CHECKER__ */
 
 struct ionic_devinfo {
        u8 asic_type;
index ed9808f..35c72d4 100644 (file)
@@ -126,6 +126,11 @@ static int ionic_get_link_ksettings(struct net_device *netdev,
 
        ethtool_link_ksettings_zero_link_mode(ks, supported);
 
+       if (!idev->port_info) {
+               netdev_err(netdev, "port_info not initialized\n");
+               return -EOPNOTSUPP;
+       }
+
        /* The port_info data is found in a DMA space that the NIC keeps
         * up-to-date, so there's no need to request the data from the
         * NIC, we already have it in our memory space.
index f492ae4..d7bbf33 100644 (file)
@@ -27,9 +27,9 @@ static void ionic_dev_cmd_firmware_download(struct ionic_dev *idev, u64 addr,
 {
        union ionic_dev_cmd cmd = {
                .fw_download.opcode = IONIC_CMD_FW_DOWNLOAD,
-               .fw_download.offset = offset,
-               .fw_download.addr = addr,
-               .fw_download.length = length
+               .fw_download.offset = cpu_to_le32(offset),
+               .fw_download.addr = cpu_to_le64(addr),
+               .fw_download.length = cpu_to_le32(length),
        };
 
        ionic_dev_cmd_go(idev, &cmd);
index d655a7a..a12df39 100644 (file)
@@ -1656,7 +1656,6 @@ static void ionic_txrx_deinit(struct ionic_lif *lif)
        if (lif->rxqcqs) {
                for (i = 0; i < lif->nxqs && lif->rxqcqs[i]; i++) {
                        ionic_lif_qcq_deinit(lif, lif->rxqcqs[i]);
-                       ionic_rx_flush(&lif->rxqcqs[i]->cq);
                        ionic_rx_empty(&lif->rxqcqs[i]->q);
                }
        }
@@ -1915,11 +1914,11 @@ static int ionic_get_vf_config(struct net_device *netdev,
                ret = -EINVAL;
        } else {
                ivf->vf           = vf;
-               ivf->vlan         = ionic->vfs[vf].vlanid;
+               ivf->vlan         = le16_to_cpu(ionic->vfs[vf].vlanid);
                ivf->qos          = 0;
                ivf->spoofchk     = ionic->vfs[vf].spoofchk;
                ivf->linkstate    = ionic->vfs[vf].linkstate;
-               ivf->max_tx_rate  = ionic->vfs[vf].maxrate;
+               ivf->max_tx_rate  = le32_to_cpu(ionic->vfs[vf].maxrate);
                ivf->trusted      = ionic->vfs[vf].trusted;
                ether_addr_copy(ivf->mac, ionic->vfs[vf].macaddr);
        }
@@ -2019,7 +2018,7 @@ static int ionic_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan,
                ret = ionic_set_vf_config(ionic, vf,
                                          IONIC_VF_ATTR_VLAN, (u8 *)&vlan);
                if (!ret)
-                       ionic->vfs[vf].vlanid = vlan;
+                       ionic->vfs[vf].vlanid = cpu_to_le16(vlan);
        }
 
        up_write(&ionic->vf_op_lock);
@@ -2048,7 +2047,7 @@ static int ionic_set_vf_rate(struct net_device *netdev, int vf,
                ret = ionic_set_vf_config(ionic, vf,
                                          IONIC_VF_ATTR_RATE, (u8 *)&tx_max);
                if (!ret)
-                       lif->ionic->vfs[vf].maxrate = tx_max;
+                       lif->ionic->vfs[vf].maxrate = cpu_to_le32(tx_max);
        }
 
        up_write(&ionic->vf_op_lock);
@@ -2981,14 +2980,14 @@ void ionic_lif_unregister(struct ionic_lif *lif)
 
 static void ionic_lif_queue_identify(struct ionic_lif *lif)
 {
+       union ionic_q_identity __iomem *q_ident;
        struct ionic *ionic = lif->ionic;
-       union ionic_q_identity *q_ident;
        struct ionic_dev *idev;
        int qtype;
        int err;
 
        idev = &lif->ionic->idev;
-       q_ident = (union ionic_q_identity *)&idev->dev_cmd_regs->data;
+       q_ident = (union ionic_q_identity __iomem *)&idev->dev_cmd_regs->data;
 
        for (qtype = 0; qtype < ARRAY_SIZE(ionic_qtype_versions); qtype++) {
                struct ionic_qtype_info *qti = &lif->qtype_info[qtype];
@@ -3011,14 +3010,14 @@ static void ionic_lif_queue_identify(struct ionic_lif *lif)
                                             ionic_qtype_versions[qtype]);
                err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
                if (!err) {
-                       qti->version   = q_ident->version;
-                       qti->supported = q_ident->supported;
-                       qti->features  = le64_to_cpu(q_ident->features);
-                       qti->desc_sz   = le16_to_cpu(q_ident->desc_sz);
-                       qti->comp_sz   = le16_to_cpu(q_ident->comp_sz);
-                       qti->sg_desc_sz   = le16_to_cpu(q_ident->sg_desc_sz);
-                       qti->max_sg_elems = le16_to_cpu(q_ident->max_sg_elems);
-                       qti->sg_desc_stride = le16_to_cpu(q_ident->sg_desc_stride);
+                       qti->version   = readb(&q_ident->version);
+                       qti->supported = readb(&q_ident->supported);
+                       qti->features  = readq(&q_ident->features);
+                       qti->desc_sz   = readw(&q_ident->desc_sz);
+                       qti->comp_sz   = readw(&q_ident->comp_sz);
+                       qti->sg_desc_sz   = readw(&q_ident->sg_desc_sz);
+                       qti->max_sg_elems = readw(&q_ident->max_sg_elems);
+                       qti->sg_desc_stride = readw(&q_ident->sg_desc_stride);
                }
                mutex_unlock(&ionic->dev_cmd_lock);
 
index ee07408..d355676 100644 (file)
@@ -311,7 +311,7 @@ int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
 
 static void ionic_dev_cmd_clean(struct ionic *ionic)
 {
-       union ionic_dev_cmd_regs *regs = ionic->idev.dev_cmd_regs;
+       union __iomem ionic_dev_cmd_regs *regs = ionic->idev.dev_cmd_regs;
 
        iowrite32(0, &regs->doorbell);
        memset_io(&regs->cmd, 0, sizeof(regs->cmd));
@@ -333,7 +333,7 @@ int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds)
         */
        max_wait = jiffies + (max_seconds * HZ);
 try_again:
-       opcode = idev->dev_cmd_regs->cmd.cmd.opcode;
+       opcode = readb(&idev->dev_cmd_regs->cmd.cmd.opcode);
        start_time = jiffies;
        do {
                done = ionic_dev_cmd_done(idev);
index 3f54351..2a72583 100644 (file)
@@ -49,7 +49,7 @@ extern const int ionic_num_stats_grps;
        (*((u64 *)(((u8 *)(base_ptr)) + (desc_ptr)->offset)))
 
 #define IONIC_READ_STAT_LE64(base_ptr, desc_ptr) \
-       __le64_to_cpu(*((u64 *)(((u8 *)(base_ptr)) + (desc_ptr)->offset)))
+       __le64_to_cpu(*((__le64 *)(((u8 *)(base_ptr)) + (desc_ptr)->offset)))
 
 struct ionic_stat_desc {
        char name[ETH_GSTRING_LEN];
index 169ac4f..b3d2250 100644 (file)
@@ -200,7 +200,7 @@ static void ionic_rx_clean(struct ionic_queue *q,
        if (likely(netdev->features & NETIF_F_RXCSUM)) {
                if (comp->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC) {
                        skb->ip_summed = CHECKSUM_COMPLETE;
-                       skb->csum = (__wsum)le16_to_cpu(comp->csum);
+                       skb->csum = (__force __wsum)le16_to_cpu(comp->csum);
                        stats->csum_complete++;
                }
        } else {
@@ -253,19 +253,6 @@ static bool ionic_rx_service(struct ionic_cq *cq, struct ionic_cq_info *cq_info)
        return true;
 }
 
-void ionic_rx_flush(struct ionic_cq *cq)
-{
-       struct ionic_dev *idev = &cq->lif->ionic->idev;
-       u32 work_done;
-
-       work_done = ionic_cq_service(cq, cq->num_descs,
-                                    ionic_rx_service, NULL, NULL);
-
-       if (work_done)
-               ionic_intr_credits(idev->intr_ctrl, cq->bound_intr->index,
-                                  work_done, IONIC_INTR_CRED_RESET_COALESCE);
-}
-
 static int ionic_rx_page_alloc(struct ionic_queue *q,
                               struct ionic_page_info *page_info)
 {
@@ -413,22 +400,20 @@ static void ionic_rx_fill_cb(void *arg)
 void ionic_rx_empty(struct ionic_queue *q)
 {
        struct ionic_desc_info *desc_info;
-       struct ionic_rxq_desc *desc;
-       unsigned int i;
-       u16 idx;
-
-       idx = q->tail_idx;
-       while (idx != q->head_idx) {
-               desc_info = &q->info[idx];
-               desc = desc_info->desc;
-               desc->addr = 0;
-               desc->len = 0;
+       struct ionic_page_info *page_info;
+       unsigned int i, j;
 
-               for (i = 0; i < desc_info->npages; i++)
-                       ionic_rx_page_free(q, &desc_info->pages[i]);
+       for (i = 0; i < q->num_descs; i++) {
+               desc_info = &q->info[i];
+               for (j = 0; j < IONIC_RX_MAX_SG_ELEMS + 1; j++) {
+                       page_info = &desc_info->pages[j];
+                       if (page_info->page)
+                               ionic_rx_page_free(q, page_info);
+               }
 
+               desc_info->npages = 0;
+               desc_info->cb = NULL;
                desc_info->cb_arg = NULL;
-               idx = (idx + 1) & (q->num_descs - 1);
        }
 }
 
@@ -812,6 +797,7 @@ static int ionic_tx_tso(struct ionic_queue *q, struct sk_buff *skb)
        skb_frag_t *frag;
        bool start, done;
        bool outer_csum;
+       dma_addr_t addr;
        bool has_vlan;
        u16 desc_len;
        u8 desc_nsge;
@@ -893,11 +879,10 @@ static int ionic_tx_tso(struct ionic_queue *q, struct sk_buff *skb)
                        if (frag_left > 0) {
                                len = min(frag_left, left);
                                frag_left -= len;
-                               elem->addr =
-                                   cpu_to_le64(ionic_tx_map_frag(q, frag,
-                                                                 offset, len));
-                               if (dma_mapping_error(dev, elem->addr))
+                               addr = ionic_tx_map_frag(q, frag, offset, len);
+                               if (dma_mapping_error(dev, addr))
                                        goto err_out_abort;
+                               elem->addr = cpu_to_le64(addr);
                                elem->len = cpu_to_le16(len);
                                elem++;
                                desc_nsge++;
index a5883be..7667b72 100644 (file)
@@ -4,7 +4,6 @@
 #ifndef _IONIC_TXRX_H_
 #define _IONIC_TXRX_H_
 
-void ionic_rx_flush(struct ionic_cq *cq);
 void ionic_tx_flush(struct ionic_cq *cq);
 
 void ionic_rx_fill(struct ionic_queue *q);
index 3b6ddc7..8910e90 100644 (file)
@@ -67,7 +67,7 @@
 
 #define R8169_REGS_SIZE                256
 #define R8169_RX_BUF_SIZE      (SZ_16K - 1)
-#define NUM_TX_DESC    64      /* Number of Tx descriptor registers */
+#define NUM_TX_DESC    256     /* Number of Tx descriptor registers */
 #define NUM_RX_DESC    256U    /* Number of Rx descriptor registers */
 #define R8169_TX_RING_BYTES    (NUM_TX_DESC * sizeof(struct TxDesc))
 #define R8169_RX_RING_BYTES    (NUM_RX_DESC * sizeof(struct RxDesc))
@@ -584,12 +584,6 @@ enum rtl_flag {
        RTL_FLAG_MAX
 };
 
-struct rtl8169_stats {
-       u64                     packets;
-       u64                     bytes;
-       struct u64_stats_sync   syncp;
-};
-
 struct rtl8169_private {
        void __iomem *mmio_addr;        /* memory map physical address */
        struct pci_dev *pci_dev;
@@ -600,8 +594,6 @@ struct rtl8169_private {
        u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */
        u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
        u32 dirty_tx;
-       struct rtl8169_stats rx_stats;
-       struct rtl8169_stats tx_stats;
        struct TxDesc *TxDescArray;     /* 256-aligned Tx descriptor ring */
        struct RxDesc *RxDescArray;     /* 256-aligned Rx descriptor ring */
        dma_addr_t TxPhyAddr;
@@ -700,27 +692,6 @@ static bool rtl_supports_eee(struct rtl8169_private *tp)
               tp->mac_version != RTL_GIGA_MAC_VER_39;
 }
 
-static void rtl_get_priv_stats(struct rtl8169_stats *stats,
-                              u64 *pkts, u64 *bytes)
-{
-       unsigned int start;
-
-       do {
-               start = u64_stats_fetch_begin_irq(&stats->syncp);
-               *pkts = stats->packets;
-               *bytes = stats->bytes;
-       } while (u64_stats_fetch_retry_irq(&stats->syncp, start));
-}
-
-static void rtl_inc_priv_stats(struct rtl8169_stats *stats,
-                              u64 pkts, u64 bytes)
-{
-       u64_stats_update_begin(&stats->syncp);
-       stats->packets += pkts;
-       stats->bytes += bytes;
-       u64_stats_update_end(&stats->syncp);
-}
-
 static void rtl_read_mac_from_reg(struct rtl8169_private *tp, u8 *mac, int reg)
 {
        int i;
@@ -4080,9 +4051,17 @@ err_out:
        return -EIO;
 }
 
-static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp, struct sk_buff *skb)
+static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp)
 {
-       return skb->len < ETH_ZLEN && tp->mac_version == RTL_GIGA_MAC_VER_34;
+       switch (tp->mac_version) {
+       case RTL_GIGA_MAC_VER_34:
+       case RTL_GIGA_MAC_VER_60:
+       case RTL_GIGA_MAC_VER_61:
+       case RTL_GIGA_MAC_VER_63:
+               return true;
+       default:
+               return false;
+       }
 }
 
 static void rtl8169_tso_csum_v1(struct sk_buff *skb, u32 *opts)
@@ -4154,8 +4133,9 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp,
 
                opts[1] |= transport_offset << TCPHO_SHIFT;
        } else {
-               if (unlikely(rtl_test_hw_pad_bug(tp, skb)))
-                       return !eth_skb_pad(skb);
+               if (unlikely(skb->len < ETH_ZLEN && rtl_test_hw_pad_bug(tp)))
+                       /* eth_skb_pad would free the skb on error */
+                       return !__skb_put_padto(skb, ETH_ZLEN, false);
        }
 
        return true;
@@ -4164,7 +4144,8 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp,
 static bool rtl_tx_slots_avail(struct rtl8169_private *tp,
                               unsigned int nr_frags)
 {
-       unsigned int slots_avail = tp->dirty_tx + NUM_TX_DESC - tp->cur_tx;
+       unsigned int slots_avail = READ_ONCE(tp->dirty_tx) + NUM_TX_DESC
+                                       - READ_ONCE(tp->cur_tx);
 
        /* A skbuff with nr_frags needs nr_frags+1 entries in the tx queue */
        return slots_avail > nr_frags;
@@ -4334,18 +4315,9 @@ static netdev_features_t rtl8169_features_check(struct sk_buff *skb,
                    rtl_chip_supports_csum_v2(tp))
                        features &= ~NETIF_F_ALL_TSO;
        } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               if (skb->len < ETH_ZLEN) {
-                       switch (tp->mac_version) {
-                       case RTL_GIGA_MAC_VER_11:
-                       case RTL_GIGA_MAC_VER_12:
-                       case RTL_GIGA_MAC_VER_17:
-                       case RTL_GIGA_MAC_VER_34:
-                               features &= ~NETIF_F_CSUM_MASK;
-                               break;
-                       default:
-                               break;
-                       }
-               }
+               /* work around hw bug on some chip versions */
+               if (skb->len < ETH_ZLEN)
+                       features &= ~NETIF_F_CSUM_MASK;
 
                if (transport_offset > TCPHO_MAX &&
                    rtl_chip_supports_csum_v2(tp))
@@ -4390,12 +4362,11 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev)
 static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
                   int budget)
 {
-       unsigned int dirty_tx, tx_left, bytes_compl = 0, pkts_compl = 0;
+       unsigned int dirty_tx, bytes_compl = 0, pkts_compl = 0;
 
        dirty_tx = tp->dirty_tx;
-       smp_rmb();
 
-       for (tx_left = tp->cur_tx - dirty_tx; tx_left > 0; tx_left--) {
+       while (READ_ONCE(tp->cur_tx) != dirty_tx) {
                unsigned int entry = dirty_tx % NUM_TX_DESC;
                struct sk_buff *skb = tp->tx_skb[entry].skb;
                u32 status;
@@ -4416,10 +4387,8 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
 
        if (tp->dirty_tx != dirty_tx) {
                netdev_completed_queue(dev, pkts_compl, bytes_compl);
+               dev_sw_netstats_tx_add(dev, pkts_compl, bytes_compl);
 
-               rtl_inc_priv_stats(&tp->tx_stats, pkts_compl, bytes_compl);
-
-               tp->dirty_tx = dirty_tx;
                /* Sync with rtl8169_start_xmit:
                 * - publish dirty_tx ring index (write barrier)
                 * - refresh cur_tx ring index and queue status (read barrier)
@@ -4427,7 +4396,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
                 * a racing xmit thread can only have a right view of the
                 * ring status.
                 */
-               smp_mb();
+               smp_store_mb(tp->dirty_tx, dirty_tx);
                if (netif_queue_stopped(dev) &&
                    rtl_tx_slots_avail(tp, MAX_SKB_FRAGS)) {
                        netif_wake_queue(dev);
@@ -4539,7 +4508,7 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget
 
                napi_gro_receive(&tp->napi, skb);
 
-               rtl_inc_priv_stats(&tp->rx_stats, 1, pkt_size);
+               dev_sw_netstats_rx_add(dev, pkt_size);
 release_descriptor:
                rtl8169_mark_to_asic(desc);
        }
@@ -4573,7 +4542,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
        }
 
        rtl_irq_disable(tp);
-       napi_schedule_irqoff(&tp->napi);
+       napi_schedule(&tp->napi);
 out:
        rtl_ack_events(tp, status);
 
@@ -4721,6 +4690,7 @@ static int rtl_open(struct net_device *dev)
 {
        struct rtl8169_private *tp = netdev_priv(dev);
        struct pci_dev *pdev = tp->pci_dev;
+       unsigned long irqflags;
        int retval = -ENOMEM;
 
        pm_runtime_get_sync(&pdev->dev);
@@ -4732,7 +4702,7 @@ static int rtl_open(struct net_device *dev)
        tp->TxDescArray = dma_alloc_coherent(&pdev->dev, R8169_TX_RING_BYTES,
                                             &tp->TxPhyAddr, GFP_KERNEL);
        if (!tp->TxDescArray)
-               goto err_pm_runtime_put;
+               goto out;
 
        tp->RxDescArray = dma_alloc_coherent(&pdev->dev, R8169_RX_RING_BYTES,
                                             &tp->RxPhyAddr, GFP_KERNEL);
@@ -4745,8 +4715,9 @@ static int rtl_open(struct net_device *dev)
 
        rtl_request_firmware(tp);
 
+       irqflags = pci_dev_msi_enabled(pdev) ? IRQF_NO_THREAD : IRQF_SHARED;
        retval = request_irq(pci_irq_vector(pdev, 0), rtl8169_interrupt,
-                            IRQF_NO_THREAD | IRQF_SHARED, dev->name, tp);
+                            irqflags, dev->name, tp);
        if (retval < 0)
                goto err_release_fw_2;
 
@@ -4757,9 +4728,9 @@ static int rtl_open(struct net_device *dev)
        rtl8169_up(tp);
        rtl8169_init_counter_offsets(tp);
        netif_start_queue(dev);
-
-       pm_runtime_put_sync(&pdev->dev);
 out:
+       pm_runtime_put_sync(&pdev->dev);
+
        return retval;
 
 err_free_irq:
@@ -4775,8 +4746,6 @@ err_free_tx_0:
        dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray,
                          tp->TxPhyAddr);
        tp->TxDescArray = NULL;
-err_pm_runtime_put:
-       pm_runtime_put_noidle(&pdev->dev);
        goto out;
 }
 
@@ -4790,9 +4759,7 @@ rtl8169_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
        pm_runtime_get_noresume(&pdev->dev);
 
        netdev_stats_to_stats64(stats, &dev->stats);
-
-       rtl_get_priv_stats(&tp->rx_stats, &stats->rx_packets, &stats->rx_bytes);
-       rtl_get_priv_stats(&tp->tx_stats, &stats->tx_packets, &stats->tx_bytes);
+       dev_fetch_sw_netstats(stats, dev->tstats);
 
        /*
         * Fetch additional counter values missing in stats collected by driver
@@ -5263,6 +5230,11 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        tp->eee_adv = -1;
        tp->ocp_base = OCP_STD_PHY_BASE;
 
+       dev->tstats = devm_netdev_alloc_pcpu_stats(&pdev->dev,
+                                                  struct pcpu_sw_netstats);
+       if (!dev->tstats)
+               return -ENOMEM;
+
        /* Get the *optional* external "ether_clk" used on some boards */
        rc = rtl_get_ether_clk(tp);
        if (rc)
@@ -5340,8 +5312,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        }
 
        INIT_WORK(&tp->wk.work, rtl_task);
-       u64_stats_init(&tp->rx_stats.syncp);
-       u64_stats_init(&tp->tx_stats.syncp);
 
        rtl_init_mac_address(tp);
 
index 9c4df4e..bd30505 100644 (file)
@@ -1744,12 +1744,16 @@ static int ravb_hwtstamp_get(struct net_device *ndev, struct ifreq *req)
        config.flags = 0;
        config.tx_type = priv->tstamp_tx_ctrl ? HWTSTAMP_TX_ON :
                                                HWTSTAMP_TX_OFF;
-       if (priv->tstamp_rx_ctrl & RAVB_RXTSTAMP_TYPE_V2_L2_EVENT)
+       switch (priv->tstamp_rx_ctrl & RAVB_RXTSTAMP_TYPE) {
+       case RAVB_RXTSTAMP_TYPE_V2_L2_EVENT:
                config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
-       else if (priv->tstamp_rx_ctrl & RAVB_RXTSTAMP_TYPE_ALL)
+               break;
+       case RAVB_RXTSTAMP_TYPE_ALL:
                config.rx_filter = HWTSTAMP_FILTER_ALL;
-       else
+               break;
+       default:
                config.rx_filter = HWTSTAMP_FILTER_NONE;
+       }
 
        return copy_to_user(req->ifr_data, &config, sizeof(config)) ?
                -EFAULT : 0;
index 2590cab..1f981df 100644 (file)
@@ -285,7 +285,13 @@ typedef union efx_oword {
                                 field10, value10,                      \
                                 field11, value11,                      \
                                 field12, value12,                      \
-                                field13, value13)                      \
+                                field13, value13,                      \
+                                field14, value14,                      \
+                                field15, value15,                      \
+                                field16, value16,                      \
+                                field17, value17,                      \
+                                field18, value18,                      \
+                                field19, value19)                      \
        (EFX_INSERT_FIELD_NATIVE((min), (max), field1, (value1)) |      \
         EFX_INSERT_FIELD_NATIVE((min), (max), field2, (value2)) |      \
         EFX_INSERT_FIELD_NATIVE((min), (max), field3, (value3)) |      \
@@ -298,7 +304,13 @@ typedef union efx_oword {
         EFX_INSERT_FIELD_NATIVE((min), (max), field10, (value10)) |    \
         EFX_INSERT_FIELD_NATIVE((min), (max), field11, (value11)) |    \
         EFX_INSERT_FIELD_NATIVE((min), (max), field12, (value12)) |    \
-        EFX_INSERT_FIELD_NATIVE((min), (max), field13, (value13)))
+        EFX_INSERT_FIELD_NATIVE((min), (max), field13, (value13)) |    \
+        EFX_INSERT_FIELD_NATIVE((min), (max), field14, (value14)) |    \
+        EFX_INSERT_FIELD_NATIVE((min), (max), field15, (value15)) |    \
+        EFX_INSERT_FIELD_NATIVE((min), (max), field16, (value16)) |    \
+        EFX_INSERT_FIELD_NATIVE((min), (max), field17, (value17)) |    \
+        EFX_INSERT_FIELD_NATIVE((min), (max), field18, (value18)) |    \
+        EFX_INSERT_FIELD_NATIVE((min), (max), field19, (value19)))
 
 #define EFX_INSERT_FIELDS64(...)                               \
        cpu_to_le64(EFX_INSERT_FIELDS_NATIVE(__VA_ARGS__))
@@ -340,7 +352,19 @@ typedef union efx_oword {
 #endif
 
 /* Populate an octword field with various numbers of arguments */
-#define EFX_POPULATE_OWORD_13 EFX_POPULATE_OWORD
+#define EFX_POPULATE_OWORD_19 EFX_POPULATE_OWORD
+#define EFX_POPULATE_OWORD_18(oword, ...) \
+       EFX_POPULATE_OWORD_19(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_OWORD_17(oword, ...) \
+       EFX_POPULATE_OWORD_18(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_OWORD_16(oword, ...) \
+       EFX_POPULATE_OWORD_17(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_OWORD_15(oword, ...) \
+       EFX_POPULATE_OWORD_16(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_OWORD_14(oword, ...) \
+       EFX_POPULATE_OWORD_15(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_OWORD_13(oword, ...) \
+       EFX_POPULATE_OWORD_14(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
 #define EFX_POPULATE_OWORD_12(oword, ...) \
        EFX_POPULATE_OWORD_13(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
 #define EFX_POPULATE_OWORD_11(oword, ...) \
@@ -375,7 +399,19 @@ typedef union efx_oword {
                             EFX_DWORD_3, 0xffffffff)
 
 /* Populate a quadword field with various numbers of arguments */
-#define EFX_POPULATE_QWORD_13 EFX_POPULATE_QWORD
+#define EFX_POPULATE_QWORD_19 EFX_POPULATE_QWORD
+#define EFX_POPULATE_QWORD_18(qword, ...) \
+       EFX_POPULATE_QWORD_19(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_QWORD_17(qword, ...) \
+       EFX_POPULATE_QWORD_18(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_QWORD_16(qword, ...) \
+       EFX_POPULATE_QWORD_17(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_QWORD_15(qword, ...) \
+       EFX_POPULATE_QWORD_16(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_QWORD_14(qword, ...) \
+       EFX_POPULATE_QWORD_15(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_QWORD_13(qword, ...) \
+       EFX_POPULATE_QWORD_14(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
 #define EFX_POPULATE_QWORD_12(qword, ...) \
        EFX_POPULATE_QWORD_13(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
 #define EFX_POPULATE_QWORD_11(qword, ...) \
@@ -408,7 +444,19 @@ typedef union efx_oword {
                             EFX_DWORD_1, 0xffffffff)
 
 /* Populate a dword field with various numbers of arguments */
-#define EFX_POPULATE_DWORD_13 EFX_POPULATE_DWORD
+#define EFX_POPULATE_DWORD_19 EFX_POPULATE_DWORD
+#define EFX_POPULATE_DWORD_18(dword, ...) \
+       EFX_POPULATE_DWORD_19(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_DWORD_17(dword, ...) \
+       EFX_POPULATE_DWORD_18(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_DWORD_16(dword, ...) \
+       EFX_POPULATE_DWORD_17(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_DWORD_15(dword, ...) \
+       EFX_POPULATE_DWORD_16(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_DWORD_14(dword, ...) \
+       EFX_POPULATE_DWORD_15(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
+#define EFX_POPULATE_DWORD_13(dword, ...) \
+       EFX_POPULATE_DWORD_14(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
 #define EFX_POPULATE_DWORD_12(dword, ...) \
        EFX_POPULATE_DWORD_13(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
 #define EFX_POPULATE_DWORD_11(dword, ...) \
index 3148fe7..518268c 100644 (file)
@@ -182,8 +182,20 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
        if (rc)
                return rc;
 
-       if (efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3))
-               efx->net_dev->features |= NETIF_F_TSO | NETIF_F_TSO6;
+       if (efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3)) {
+               struct net_device *net_dev = efx->net_dev;
+               netdev_features_t tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
+                                       NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
+                                       NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
+
+               net_dev->features |= tso;
+               net_dev->hw_features |= tso;
+               net_dev->hw_enc_features |= tso;
+               /* EF100 HW can only offload outer checksums if they are UDP,
+                * so for GRE_CSUM we have to use GSO_PARTIAL.
+                */
+               net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
+       }
        efx->num_mac_stats = MCDI_WORD(outbuf,
                                       GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS);
        netif_dbg(efx, probe, efx->net_dev,
@@ -686,7 +698,7 @@ static unsigned int ef100_check_caps(const struct efx_nic *efx,
 #define EF100_OFFLOAD_FEATURES (NETIF_F_HW_CSUM | NETIF_F_RXCSUM |     \
        NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_NTUPLE | \
        NETIF_F_RXHASH | NETIF_F_RXFCS | NETIF_F_TSO_ECN | NETIF_F_RXALL | \
-       NETIF_F_TSO_MANGLEID | NETIF_F_HW_VLAN_CTAG_TX)
+       NETIF_F_HW_VLAN_CTAG_TX)
 
 const struct efx_nic_type ef100_pf_nic_type = {
        .revision = EFX_REV_EF100,
@@ -1101,6 +1113,9 @@ static int ef100_probe_main(struct efx_nic *efx)
        nic_data->efx = efx;
        net_dev->features |= efx->type->offload_features;
        net_dev->hw_features |= efx->type->offload_features;
+       net_dev->hw_enc_features |= efx->type->offload_features;
+       net_dev->vlan_features |= NETIF_F_HW_CSUM | NETIF_F_SG |
+                                 NETIF_F_HIGHDMA | NETIF_F_ALL_TSO;
 
        /* Populate design-parameter defaults */
        nic_data->tso_max_hdr_len = ESE_EF100_DP_GZ_TSO_MAX_HDR_LEN_DEFAULT;
index a90e5a9..26ef51d 100644 (file)
@@ -54,8 +54,6 @@ static bool ef100_tx_can_tso(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
        struct efx_nic *efx = tx_queue->efx;
        struct ef100_nic_data *nic_data;
        struct efx_tx_buffer *buffer;
-       struct tcphdr *tcphdr;
-       struct iphdr *iphdr;
        size_t header_len;
        u32 mss;
 
@@ -98,20 +96,6 @@ static bool ef100_tx_can_tso(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
        buffer->unmap_len = 0;
        buffer->skb = skb;
        ++tx_queue->insert_count;
-
-       /* Adjust the TCP checksum to exclude the total length, since we set
-        * ED_INNER_IP_LEN in the descriptor.
-        */
-       tcphdr = tcp_hdr(skb);
-       if (skb_is_gso_v6(skb)) {
-               tcphdr->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
-                                                &ipv6_hdr(skb)->daddr,
-                                                0, IPPROTO_TCP, 0);
-       } else {
-               iphdr = ip_hdr(skb);
-               tcphdr->check = ~csum_tcpudp_magic(iphdr->saddr, iphdr->daddr,
-                                                  0, IPPROTO_TCP, 0);
-       }
        return true;
 }
 
@@ -203,34 +187,66 @@ static void ef100_make_tso_desc(struct efx_nic *efx,
                                struct efx_tx_buffer *buffer, efx_oword_t *txd,
                                unsigned int segment_count)
 {
-       u32 mangleid = (efx->net_dev->features & NETIF_F_TSO_MANGLEID) ||
-               skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID ?
-               ESE_GZ_TX_DESC_IP4_ID_NO_OP :
-               ESE_GZ_TX_DESC_IP4_ID_INC_MOD16;
-       u16 vlan_enable =  efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_TX ?
-               skb_vlan_tag_present(skb) : 0;
+       bool gso_partial = skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL;
        unsigned int len, ip_offset, tcp_offset, payload_segs;
+       u32 mangleid = ESE_GZ_TX_DESC_IP4_ID_INC_MOD16;
+       unsigned int outer_ip_offset, outer_l4_offset;
        u16 vlan_tci = skb_vlan_tag_get(skb);
        u32 mss = skb_shinfo(skb)->gso_size;
+       bool encap = skb->encapsulation;
+       bool udp_encap = false;
+       u16 vlan_enable = 0;
+       struct tcphdr *tcp;
+       bool outer_csum;
+       u32 paylen;
+
+       if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID)
+               mangleid = ESE_GZ_TX_DESC_IP4_ID_NO_OP;
+       if (efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_TX)
+               vlan_enable = skb_vlan_tag_present(skb);
 
        len = skb->len - buffer->len;
        /* We use 1 for the TSO descriptor and 1 for the header */
        payload_segs = segment_count - 2;
-       ip_offset =  skb_network_offset(skb);
-       tcp_offset = skb_transport_offset(skb);
+       if (encap) {
+               outer_ip_offset = skb_network_offset(skb);
+               outer_l4_offset = skb_transport_offset(skb);
+               ip_offset = skb_inner_network_offset(skb);
+               tcp_offset = skb_inner_transport_offset(skb);
+               if (skb_shinfo(skb)->gso_type &
+                   (SKB_GSO_UDP_TUNNEL | SKB_GSO_UDP_TUNNEL_CSUM))
+                       udp_encap = true;
+       } else {
+               ip_offset =  skb_network_offset(skb);
+               tcp_offset = skb_transport_offset(skb);
+               outer_ip_offset = outer_l4_offset = 0;
+       }
+       outer_csum = skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM;
+
+       /* subtract TCP payload length from inner checksum */
+       tcp = (void *)skb->data + tcp_offset;
+       paylen = skb->len - tcp_offset;
+       csum_replace_by_diff(&tcp->check, (__force __wsum)htonl(paylen));
 
-       EFX_POPULATE_OWORD_13(*txd,
+       EFX_POPULATE_OWORD_19(*txd,
                              ESF_GZ_TX_DESC_TYPE, ESE_GZ_TX_DESC_TYPE_TSO,
                              ESF_GZ_TX_TSO_MSS, mss,
                              ESF_GZ_TX_TSO_HDR_NUM_SEGS, 1,
                              ESF_GZ_TX_TSO_PAYLOAD_NUM_SEGS, payload_segs,
                              ESF_GZ_TX_TSO_HDR_LEN_W, buffer->len >> 1,
                              ESF_GZ_TX_TSO_PAYLOAD_LEN, len,
+                             ESF_GZ_TX_TSO_CSO_OUTER_L4, outer_csum,
                              ESF_GZ_TX_TSO_CSO_INNER_L4, 1,
                              ESF_GZ_TX_TSO_INNER_L3_OFF_W, ip_offset >> 1,
                              ESF_GZ_TX_TSO_INNER_L4_OFF_W, tcp_offset >> 1,
                              ESF_GZ_TX_TSO_ED_INNER_IP4_ID, mangleid,
                              ESF_GZ_TX_TSO_ED_INNER_IP_LEN, 1,
+                             ESF_GZ_TX_TSO_OUTER_L3_OFF_W, outer_ip_offset >> 1,
+                             ESF_GZ_TX_TSO_OUTER_L4_OFF_W, outer_l4_offset >> 1,
+                             ESF_GZ_TX_TSO_ED_OUTER_UDP_LEN, udp_encap && !gso_partial,
+                             ESF_GZ_TX_TSO_ED_OUTER_IP_LEN, encap && !gso_partial,
+                             ESF_GZ_TX_TSO_ED_OUTER_IP4_ID, encap ? mangleid :
+                                                                    ESE_GZ_TX_DESC_IP4_ID_NO_OP,
                              ESF_GZ_TX_TSO_VLAN_INSERT_EN, vlan_enable,
                              ESF_GZ_TX_TSO_VLAN_INSERT_TCI, vlan_tci
                );
index b77e427..c52a38d 100644 (file)
@@ -8,7 +8,7 @@ config NET_VENDOR_SMSC
        default y
        depends on ARM || ARM64 || ATARI_ETHERNAT || COLDFIRE || \
                   ISA || MAC || MIPS || NIOS2 || PCI || \
-                  PCMCIA || SUPERH || XTENSA || H8300
+                  PCMCIA || SUPERH || XTENSA || H8300 || COMPILE_TEST
        help
          If you have a network (Ethernet) card belonging to this class, say Y.
 
@@ -39,7 +39,7 @@ config SMC91X
        select MII
        depends on !OF || GPIOLIB
        depends on ARM || ARM64 || ATARI_ETHERNAT || COLDFIRE || \
-                  MIPS || NIOS2 || SUPERH || XTENSA || H8300
+                  MIPS || NIOS2 || SUPERH || XTENSA || H8300 || COMPILE_TEST
        help
          This is a driver for SMC's 91x series of Ethernet chipsets,
          including the SMC91C94 and the SMC91C111. Say Y if you want it
@@ -78,7 +78,7 @@ config SMC911X
        tristate "SMSC LAN911[5678] support"
        select CRC32
        select MII
-       depends on (ARM || SUPERH)
+       depends on (ARM || SUPERH || COMPILE_TEST)
        help
          This is a driver for SMSC's LAN911x series of Ethernet chipsets
          including the new LAN9115, LAN9116, LAN9117, and LAN9118.
index 01069df..22cdbf1 100644 (file)
@@ -102,7 +102,10 @@ MODULE_ALIAS("platform:smc911x");
 
 #define PRINTK(dev, args...)   netdev_info(dev, args)
 #else
-#define DBG(n, dev, args...)   do { } while (0)
+#define DBG(n, dev, args...)                    \
+       while (0) {                              \
+               netdev_dbg(dev, args);           \
+       }
 #define PRINTK(dev, args...)   netdev_dbg(dev, args)
 #endif
 
@@ -462,9 +465,9 @@ static void smc911x_hardware_send_pkt(struct net_device *dev)
                        TX_CMD_A_INT_FIRST_SEG_ | TX_CMD_A_INT_LAST_SEG_ |
                        skb->len;
 #else
-       buf = (char*)((u32)skb->data & ~0x3);
-       len = (skb->len + 3 + ((u32)skb->data & 3)) & ~0x3;
-       cmdA = (((u32)skb->data & 0x3) << 16) |
+       buf = (char *)((uintptr_t)skb->data & ~0x3);
+       len = (skb->len + 3 + ((uintptr_t)skb->data & 3)) & ~0x3;
+       cmdA = (((uintptr_t)skb->data & 0x3) << 16) |
                        TX_CMD_A_INT_FIRST_SEG_ | TX_CMD_A_INT_LAST_SEG_ |
                        skb->len;
 #endif
@@ -879,7 +882,7 @@ static void smc911x_phy_configure(struct work_struct *work)
        int phyaddr = lp->mii.phy_id;
        int my_phy_caps; /* My PHY capabilities */
        int my_ad_caps; /* My Advertised capabilities */
-       int status;
+       int status __always_unused;
        unsigned long flags;
 
        DBG(SMC_DEBUG_FUNC, dev, "--> %s()\n", __func__);
@@ -973,7 +976,7 @@ static void smc911x_phy_interrupt(struct net_device *dev)
 {
        struct smc911x_local *lp = netdev_priv(dev);
        int phyaddr = lp->mii.phy_id;
-       int status;
+       int status __always_unused;
 
        DBG(SMC_DEBUG_FUNC, dev, "--> %s\n", __func__);
 
@@ -2044,8 +2047,6 @@ static int smc911x_drv_probe(struct platform_device *pdev)
        void __iomem *addr;
        int ret;
 
-       /* ndev is not valid yet, so avoid passing it in. */
-       DBG(SMC_DEBUG_FUNC, "--> %s\n",  __func__);
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!res) {
                ret = -ENODEV;
index f6b73af..742a1f7 100644 (file)
@@ -703,7 +703,8 @@ static void smc_tx(struct net_device *dev)
 {
        struct smc_local *lp = netdev_priv(dev);
        void __iomem *ioaddr = lp->base;
-       unsigned int saved_packet, packet_no, tx_status, pkt_len;
+       unsigned int saved_packet, packet_no, tx_status;
+       unsigned int pkt_len __always_unused;
 
        DBG(3, dev, "%s\n", __func__);
 
@@ -2191,6 +2192,12 @@ MODULE_DEVICE_TABLE(of, smc91x_match);
 
 /**
  * of_try_set_control_gpio - configure a gpio if it exists
+ * @dev: net device
+ * @desc: where to store the GPIO descriptor, if it exists
+ * @name: name of the GPIO in DT
+ * @index: index of the GPIO in DT
+ * @value: set the GPIO to this value
+ * @nsdelay: delay before setting the GPIO
  */
 static int try_toggle_control_gpio(struct device *dev,
                                   struct gpio_desc **desc,
index df7de50..6f271c4 100644 (file)
@@ -402,6 +402,7 @@ struct dma_features {
 /* Default LPI timers */
 #define STMMAC_DEFAULT_LIT_LS  0x3E8
 #define STMMAC_DEFAULT_TWT_LS  0x1E
+#define STMMAC_ET_MAX          0xFFFFF
 
 #define STMMAC_CHAIN_MODE      0x1
 #define STMMAC_RING_MODE       0x2
index 2342d49..27254b2 100644 (file)
@@ -119,23 +119,23 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
        return 0;
 }
 
-static void *dwc_qos_probe(struct platform_device *pdev,
-                          struct plat_stmmacenet_data *plat_dat,
-                          struct stmmac_resources *stmmac_res)
+static int dwc_qos_probe(struct platform_device *pdev,
+                        struct plat_stmmacenet_data *plat_dat,
+                        struct stmmac_resources *stmmac_res)
 {
        int err;
 
        plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "apb_pclk");
        if (IS_ERR(plat_dat->stmmac_clk)) {
                dev_err(&pdev->dev, "apb_pclk clock not found.\n");
-               return ERR_CAST(plat_dat->stmmac_clk);
+               return PTR_ERR(plat_dat->stmmac_clk);
        }
 
        err = clk_prepare_enable(plat_dat->stmmac_clk);
        if (err < 0) {
                dev_err(&pdev->dev, "failed to enable apb_pclk clock: %d\n",
                        err);
-               return ERR_PTR(err);
+               return err;
        }
 
        plat_dat->pclk = devm_clk_get(&pdev->dev, "phy_ref_clk");
@@ -152,11 +152,11 @@ static void *dwc_qos_probe(struct platform_device *pdev,
                goto disable;
        }
 
-       return NULL;
+       return 0;
 
 disable:
        clk_disable_unprepare(plat_dat->stmmac_clk);
-       return ERR_PTR(err);
+       return err;
 }
 
 static int dwc_qos_remove(struct platform_device *pdev)
@@ -267,19 +267,17 @@ static int tegra_eqos_init(struct platform_device *pdev, void *priv)
        return 0;
 }
 
-static void *tegra_eqos_probe(struct platform_device *pdev,
-                             struct plat_stmmacenet_data *data,
-                             struct stmmac_resources *res)
+static int tegra_eqos_probe(struct platform_device *pdev,
+                           struct plat_stmmacenet_data *data,
+                           struct stmmac_resources *res)
 {
        struct device *dev = &pdev->dev;
        struct tegra_eqos *eqos;
        int err;
 
        eqos = devm_kzalloc(&pdev->dev, sizeof(*eqos), GFP_KERNEL);
-       if (!eqos) {
-               err = -ENOMEM;
-               goto error;
-       }
+       if (!eqos)
+               return -ENOMEM;
 
        eqos->dev = &pdev->dev;
        eqos->regs = res->addr;
@@ -368,9 +366,7 @@ bypass_clk_reset_gpio:
        if (err < 0)
                goto reset;
 
-out:
-       return eqos;
-
+       return 0;
 reset:
        reset_control_assert(eqos->rst);
 reset_phy:
@@ -384,8 +380,7 @@ disable_slave:
 disable_master:
        clk_disable_unprepare(eqos->clk_master);
 error:
-       eqos = ERR_PTR(err);
-       goto out;
+       return err;
 }
 
 static int tegra_eqos_remove(struct platform_device *pdev)
@@ -403,9 +398,9 @@ static int tegra_eqos_remove(struct platform_device *pdev)
 }
 
 struct dwc_eth_dwmac_data {
-       void *(*probe)(struct platform_device *pdev,
-                      struct plat_stmmacenet_data *data,
-                      struct stmmac_resources *res);
+       int (*probe)(struct platform_device *pdev,
+                    struct plat_stmmacenet_data *data,
+                    struct stmmac_resources *res);
        int (*remove)(struct platform_device *pdev);
 };
 
@@ -424,7 +419,6 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
        const struct dwc_eth_dwmac_data *data;
        struct plat_stmmacenet_data *plat_dat;
        struct stmmac_resources stmmac_res;
-       void *priv;
        int ret;
 
        data = device_get_match_data(&pdev->dev);
@@ -448,10 +442,8 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
        if (IS_ERR(plat_dat))
                return PTR_ERR(plat_dat);
 
-       priv = data->probe(pdev, plat_dat, &stmmac_res);
-       if (IS_ERR(priv)) {
-               ret = PTR_ERR(priv);
-
+       ret = data->probe(pdev, plat_dat, &stmmac_res);
+       if (ret < 0) {
                if (ret != -EPROBE_DEFER)
                        dev_err(&pdev->dev, "failed to probe subdriver: %d\n",
                                ret);
index b6e5e3e..a2e80c8 100644 (file)
@@ -236,6 +236,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
        int ret;
        int i;
 
+       plat->phy_addr = -1;
        plat->clk_csr = 5;
        plat->has_gmac = 0;
        plat->has_gmac4 = 1;
@@ -345,7 +346,6 @@ static int ehl_sgmii_data(struct pci_dev *pdev,
                          struct plat_stmmacenet_data *plat)
 {
        plat->bus_id = 1;
-       plat->phy_addr = 0;
        plat->phy_interface = PHY_INTERFACE_MODE_SGMII;
 
        plat->serdes_powerup = intel_serdes_powerup;
@@ -362,7 +362,6 @@ static int ehl_rgmii_data(struct pci_dev *pdev,
                          struct plat_stmmacenet_data *plat)
 {
        plat->bus_id = 1;
-       plat->phy_addr = 0;
        plat->phy_interface = PHY_INTERFACE_MODE_RGMII;
 
        return ehl_common_data(pdev, plat);
@@ -376,7 +375,6 @@ static int ehl_pse0_common_data(struct pci_dev *pdev,
                                struct plat_stmmacenet_data *plat)
 {
        plat->bus_id = 2;
-       plat->phy_addr = 1;
        return ehl_common_data(pdev, plat);
 }
 
@@ -408,7 +406,6 @@ static int ehl_pse1_common_data(struct pci_dev *pdev,
                                struct plat_stmmacenet_data *plat)
 {
        plat->bus_id = 3;
-       plat->phy_addr = 1;
        return ehl_common_data(pdev, plat);
 }
 
@@ -450,7 +447,6 @@ static int tgl_sgmii_data(struct pci_dev *pdev,
                          struct plat_stmmacenet_data *plat)
 {
        plat->bus_id = 1;
-       plat->phy_addr = 0;
        plat->phy_interface = PHY_INTERFACE_MODE_SGMII;
        plat->serdes_powerup = intel_serdes_powerup;
        plat->serdes_powerdown = intel_serdes_powerdown;
@@ -625,13 +621,6 @@ static int intel_eth_pci_probe(struct pci_dev *pdev,
        if (ret)
                return ret;
 
-       if (plat->eee_usecs_rate > 0) {
-               u32 tx_lpi_usec;
-
-               tx_lpi_usec = (plat->eee_usecs_rate / 1000000) - 1;
-               writel(tx_lpi_usec, res.addr + GMAC_1US_TIC_COUNTER);
-       }
-
        ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
        if (ret < 0)
                return ret;
@@ -641,6 +630,13 @@ static int intel_eth_pci_probe(struct pci_dev *pdev,
        res.wol_irq = pci_irq_vector(pdev, 0);
        res.irq = pci_irq_vector(pdev, 0);
 
+       if (plat->eee_usecs_rate > 0) {
+               u32 tx_lpi_usec;
+
+               tx_lpi_usec = (plat->eee_usecs_rate / 1000000) - 1;
+               writel(tx_lpi_usec, res.addr + GMAC_1US_TIC_COUNTER);
+       }
+
        ret = stmmac_dvr_probe(&pdev->dev, plat, &res);
        if (ret) {
                pci_free_irq_vectors(pdev);
index 5afcf05..dc0b8b6 100644 (file)
@@ -299,7 +299,7 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac)
                dev_err(dwmac->dev, "unsupported phy-mode %s\n",
                        phy_modes(dwmac->phy_mode));
                return -EINVAL;
-       };
+       }
 
        if (rx_dly_config & PRG_ETH0_ADJ_ENABLE) {
                if (!dwmac->timing_adj_clk) {
index 592b043..82df91c 100644 (file)
@@ -176,9 +176,11 @@ enum power_event {
  */
 #define GMAC4_LPI_CTRL_STATUS  0xd0
 #define GMAC4_LPI_TIMER_CTRL   0xd4
+#define GMAC4_LPI_ENTRY_TIMER  0xd8
 
 /* LPI control and status defines */
 #define GMAC4_LPI_CTRL_STATUS_LPITCSE  BIT(21) /* LPI Tx Clock Stop Enable */
+#define GMAC4_LPI_CTRL_STATUS_LPIATE   BIT(20) /* LPI Timer Enable */
 #define GMAC4_LPI_CTRL_STATUS_LPITXA   BIT(19) /* Enable LPI TX Automate */
 #define GMAC4_LPI_CTRL_STATUS_PLS      BIT(17) /* PHY Link Status */
 #define GMAC4_LPI_CTRL_STATUS_LPIEN    BIT(16) /* LPI Enable */
index 002791b..3ed4f4c 100644 (file)
@@ -379,6 +379,27 @@ static void dwmac4_set_eee_pls(struct mac_device_info *hw, int link)
        writel(value, ioaddr + GMAC4_LPI_CTRL_STATUS);
 }
 
+static void dwmac4_set_eee_lpi_entry_timer(struct mac_device_info *hw, int et)
+{
+       void __iomem *ioaddr = hw->pcsr;
+       int value = et & STMMAC_ET_MAX;
+       int regval;
+
+       /* Program LPI entry timer value into register */
+       writel(value, ioaddr + GMAC4_LPI_ENTRY_TIMER);
+
+       /* Enable/disable LPI entry timer */
+       regval = readl(ioaddr + GMAC4_LPI_CTRL_STATUS);
+       regval |= GMAC4_LPI_CTRL_STATUS_LPIEN | GMAC4_LPI_CTRL_STATUS_LPITXA;
+
+       if (et)
+               regval |= GMAC4_LPI_CTRL_STATUS_LPIATE;
+       else
+               regval &= ~GMAC4_LPI_CTRL_STATUS_LPIATE;
+
+       writel(regval, ioaddr + GMAC4_LPI_CTRL_STATUS);
+}
+
 static void dwmac4_set_eee_timer(struct mac_device_info *hw, int ls, int tw)
 {
        void __iomem *ioaddr = hw->pcsr;
@@ -1164,6 +1185,7 @@ const struct stmmac_ops dwmac4_ops = {
        .get_umac_addr = dwmac4_get_umac_addr,
        .set_eee_mode = dwmac4_set_eee_mode,
        .reset_eee_mode = dwmac4_reset_eee_mode,
+       .set_eee_lpi_entry_timer = dwmac4_set_eee_lpi_entry_timer,
        .set_eee_timer = dwmac4_set_eee_timer,
        .set_eee_pls = dwmac4_set_eee_pls,
        .pcs_ctrl_ane = dwmac4_ctrl_ane,
@@ -1206,6 +1228,7 @@ const struct stmmac_ops dwmac410_ops = {
        .get_umac_addr = dwmac4_get_umac_addr,
        .set_eee_mode = dwmac4_set_eee_mode,
        .reset_eee_mode = dwmac4_reset_eee_mode,
+       .set_eee_lpi_entry_timer = dwmac4_set_eee_lpi_entry_timer,
        .set_eee_timer = dwmac4_set_eee_timer,
        .set_eee_pls = dwmac4_set_eee_pls,
        .pcs_ctrl_ane = dwmac4_ctrl_ane,
@@ -1249,6 +1272,7 @@ const struct stmmac_ops dwmac510_ops = {
        .get_umac_addr = dwmac4_get_umac_addr,
        .set_eee_mode = dwmac4_set_eee_mode,
        .reset_eee_mode = dwmac4_reset_eee_mode,
+       .set_eee_lpi_entry_timer = dwmac4_set_eee_lpi_entry_timer,
        .set_eee_timer = dwmac4_set_eee_timer,
        .set_eee_pls = dwmac4_set_eee_pls,
        .pcs_ctrl_ane = dwmac4_ctrl_ane,
index e2dca9b..b40b2e0 100644 (file)
@@ -337,6 +337,7 @@ struct stmmac_ops {
        void (*set_eee_mode)(struct mac_device_info *hw,
                             bool en_tx_lpi_clockgating);
        void (*reset_eee_mode)(struct mac_device_info *hw);
+       void (*set_eee_lpi_entry_timer)(struct mac_device_info *hw, int et);
        void (*set_eee_timer)(struct mac_device_info *hw, int ls, int tw);
        void (*set_eee_pls)(struct mac_device_info *hw, int link);
        void (*debug)(void __iomem *ioaddr, struct stmmac_extra_stats *x,
@@ -439,6 +440,8 @@ struct stmmac_ops {
        stmmac_do_void_callback(__priv, mac, set_eee_mode, __args)
 #define stmmac_reset_eee_mode(__priv, __args...) \
        stmmac_do_void_callback(__priv, mac, reset_eee_mode, __args)
+#define stmmac_set_eee_lpi_timer(__priv, __args...) \
+       stmmac_do_void_callback(__priv, mac, set_eee_lpi_entry_timer, __args)
 #define stmmac_set_eee_timer(__priv, __args...) \
        stmmac_do_void_callback(__priv, mac, set_eee_timer, __args)
 #define stmmac_set_eee_pls(__priv, __args...) \
index 727e68d..c88ee8e 100644 (file)
@@ -207,6 +207,7 @@ struct stmmac_priv {
        int tx_lpi_timer;
        int tx_lpi_enabled;
        int eee_tw_timer;
+       bool eee_sw_timer_en;
        unsigned int mode;
        unsigned int chain_mode;
        int extend_desc;
index 220626a..ba85546 100644 (file)
@@ -294,6 +294,16 @@ static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv, u32 queue)
        return dirty;
 }
 
+static void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en)
+{
+       int tx_lpi_timer;
+
+       /* Clear/set the SW EEE timer flag based on LPI ET enablement */
+       priv->eee_sw_timer_en = en ? 0 : 1;
+       tx_lpi_timer  = en ? priv->tx_lpi_timer : 0;
+       stmmac_set_eee_lpi_timer(priv, priv->hw, tx_lpi_timer);
+}
+
 /**
  * stmmac_enable_eee_mode - check and enter in LPI mode
  * @priv: driver private structure
@@ -327,6 +337,11 @@ static void stmmac_enable_eee_mode(struct stmmac_priv *priv)
  */
 void stmmac_disable_eee_mode(struct stmmac_priv *priv)
 {
+       if (!priv->eee_sw_timer_en) {
+               stmmac_lpi_entry_timer_config(priv, 0);
+               return;
+       }
+
        stmmac_reset_eee_mode(priv, priv->hw);
        del_timer_sync(&priv->eee_ctrl_timer);
        priv->tx_path_in_lpi_mode = false;
@@ -376,6 +391,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
        if (!priv->eee_active) {
                if (priv->eee_enabled) {
                        netdev_dbg(priv->dev, "disable EEE\n");
+                       stmmac_lpi_entry_timer_config(priv, 0);
                        del_timer_sync(&priv->eee_ctrl_timer);
                        stmmac_set_eee_timer(priv, priv->hw, 0, eee_tw_timer);
                }
@@ -389,7 +405,15 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
                                     eee_tw_timer);
        }
 
-       mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer));
+       if (priv->plat->has_gmac4 && priv->tx_lpi_timer <= STMMAC_ET_MAX) {
+               del_timer_sync(&priv->eee_ctrl_timer);
+               priv->tx_path_in_lpi_mode = false;
+               stmmac_lpi_entry_timer_config(priv, 1);
+       } else {
+               stmmac_lpi_entry_timer_config(priv, 0);
+               mod_timer(&priv->eee_ctrl_timer,
+                         STMMAC_LPI_T(priv->tx_lpi_timer));
+       }
 
        mutex_unlock(&priv->lock);
        netdev_dbg(priv->dev, "Energy-Efficient Ethernet initialized\n");
@@ -2044,7 +2068,8 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue)
                netif_tx_wake_queue(netdev_get_tx_queue(priv->dev, queue));
        }
 
-       if ((priv->eee_enabled) && (!priv->tx_path_in_lpi_mode)) {
+       if (priv->eee_enabled && !priv->tx_path_in_lpi_mode &&
+           priv->eee_sw_timer_en) {
                stmmac_enable_eee_mode(priv);
                mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer));
        }
@@ -3306,7 +3331,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
        tx_q = &priv->tx_queue[queue];
        first_tx = tx_q->cur_tx;
 
-       if (priv->tx_path_in_lpi_mode)
+       if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en)
                stmmac_disable_eee_mode(priv);
 
        /* Manage oversized TCP frames for GMAC4 device */
@@ -4757,6 +4782,7 @@ static void stmmac_napi_add(struct net_device *dev)
 
                ch->priv_data = priv;
                ch->index = queue;
+               spin_lock_init(&ch->lock);
 
                if (queue < priv->plat->rx_queues_to_use) {
                        netif_napi_add(dev, &ch->rx_napi, stmmac_napi_poll_rx,
index af34a4c..6dc9f10 100644 (file)
@@ -399,6 +399,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
        struct device_node *np = pdev->dev.of_node;
        struct plat_stmmacenet_data *plat;
        struct stmmac_dma_cfg *dma_cfg;
+       void *ret;
        int rc;
 
        plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
@@ -576,12 +577,10 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
                clk_prepare_enable(plat->stmmac_clk);
        }
 
-       plat->pclk = devm_clk_get(&pdev->dev, "pclk");
+       plat->pclk = devm_clk_get_optional(&pdev->dev, "pclk");
        if (IS_ERR(plat->pclk)) {
-               if (PTR_ERR(plat->pclk) == -EPROBE_DEFER)
-                       goto error_pclk_get;
-
-               plat->pclk = NULL;
+               ret = plat->pclk;
+               goto error_pclk_get;
        }
        clk_prepare_enable(plat->pclk);
 
@@ -596,14 +595,11 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
                dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate);
        }
 
-       plat->stmmac_rst = devm_reset_control_get(&pdev->dev,
-                                                 STMMAC_RESOURCE_NAME);
+       plat->stmmac_rst = devm_reset_control_get_optional(&pdev->dev,
+                                                          STMMAC_RESOURCE_NAME);
        if (IS_ERR(plat->stmmac_rst)) {
-               if (PTR_ERR(plat->stmmac_rst) == -EPROBE_DEFER)
-                       goto error_hw_init;
-
-               dev_info(&pdev->dev, "no reset control found\n");
-               plat->stmmac_rst = NULL;
+               ret = plat->stmmac_rst;
+               goto error_hw_init;
        }
 
        return plat;
@@ -613,7 +609,7 @@ error_hw_init:
 error_pclk_get:
        clk_disable_unprepare(plat->stmmac_clk);
 
-       return ERR_PTR(-EPROBE_DEFER);
+       return ret;
 }
 
 /**
index 501d676..766e886 100644 (file)
@@ -241,8 +241,8 @@ static int am65_cpsw_nuss_ndo_slave_add_vid(struct net_device *ndev,
        if (!vid)
                unreg_mcast = port_mask;
        dev_info(common->dev, "Adding vlan %d to vlan filter\n", vid);
-       ret = cpsw_ale_add_vlan(common->ale, vid, port_mask,
-                               unreg_mcast, port_mask, 0);
+       ret = cpsw_ale_vlan_add_modify(common->ale, vid, port_mask,
+                                      unreg_mcast, port_mask, 0);
 
        pm_runtime_put(common->dev);
        return ret;
@@ -252,6 +252,7 @@ static int am65_cpsw_nuss_ndo_slave_kill_vid(struct net_device *ndev,
                                             __be16 proto, u16 vid)
 {
        struct am65_cpsw_common *common = am65_ndev_to_common(ndev);
+       struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
        int ret;
 
        if (!netif_running(ndev) || !vid)
@@ -264,14 +265,15 @@ static int am65_cpsw_nuss_ndo_slave_kill_vid(struct net_device *ndev,
        }
 
        dev_info(common->dev, "Removing vlan %d from vlan filter\n", vid);
-       ret = cpsw_ale_del_vlan(common->ale, vid, 0);
+       ret = cpsw_ale_del_vlan(common->ale, vid,
+                               BIT(port->port_id) | ALE_PORT_HOST);
 
        pm_runtime_put(common->dev);
        return ret;
 }
 
-static void am65_cpsw_slave_set_promisc_2g(struct am65_cpsw_port *port,
-                                          bool promisc)
+static void am65_cpsw_slave_set_promisc(struct am65_cpsw_port *port,
+                                       bool promisc)
 {
        struct am65_cpsw_common *common = port->common;
 
@@ -296,7 +298,7 @@ static void am65_cpsw_nuss_ndo_slave_set_rx_mode(struct net_device *ndev)
        bool promisc;
 
        promisc = !!(ndev->flags & IFF_PROMISC);
-       am65_cpsw_slave_set_promisc_2g(port, promisc);
+       am65_cpsw_slave_set_promisc(port, promisc);
 
        if (promisc)
                return;
@@ -373,7 +375,7 @@ static int am65_cpsw_nuss_rx_push(struct am65_cpsw_common *common,
 
        cppi5_hdesc_init(desc_rx, CPPI5_INFO0_HDESC_EPIB_PRESENT,
                         AM65_CPSW_NAV_PS_DATA_SIZE);
-       cppi5_hdesc_attach_buf(desc_rx, 0, 0, buf_dma, skb_tailroom(skb));
+       cppi5_hdesc_attach_buf(desc_rx, buf_dma, skb_tailroom(skb), buf_dma, skb_tailroom(skb));
        swdata = cppi5_hdesc_get_swdata(desc_rx);
        *((void **)swdata) = skb;
 
@@ -426,9 +428,7 @@ static int am65_cpsw_nuss_common_open(struct am65_cpsw_common *common,
        writel(common->rx_flow_id_base,
               host_p->port_base + AM65_CPSW_PORT0_REG_FLOW_ID_OFFSET);
        /* en tx crc offload */
-       if (features & NETIF_F_HW_CSUM)
-               writel(AM65_CPSW_P0_REG_CTL_RX_CHECKSUM_EN,
-                      host_p->port_base + AM65_CPSW_P0_REG_CTL);
+       writel(AM65_CPSW_P0_REG_CTL_RX_CHECKSUM_EN, host_p->port_base + AM65_CPSW_P0_REG_CTL);
 
        am65_cpsw_nuss_set_p0_ptype(common);
 
@@ -629,13 +629,13 @@ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev)
 
        am65_cpsw_port_set_sl_mac(port, ndev->dev_addr);
 
-       if (port->slave.mac_only)
+       if (port->slave.mac_only) {
                /* enable mac-only mode on port */
                cpsw_ale_control_set(common->ale, port->port_id,
                                     ALE_PORT_MACONLY, 1);
-       if (AM65_CPSW_IS_CPSW2G(common))
                cpsw_ale_control_set(common->ale, port->port_id,
                                     ALE_PORT_NOLEARN, 1);
+       }
 
        port_mask = BIT(port->port_id) | ALE_PORT_HOST;
        cpsw_ale_add_ucast(common->ale, ndev->dev_addr,
@@ -767,7 +767,7 @@ static int am65_cpsw_nuss_rx_packets(struct am65_cpsw_common *common,
                return ret;
        }
 
-       if (desc_dma & 0x1) {
+       if (cppi5_desc_is_tdcm(desc_dma)) {
                dev_dbg(dev, "%s RX tdown flow: %u\n", __func__, flow_idx);
                return 0;
        }
@@ -911,10 +911,57 @@ static void am65_cpsw_nuss_tx_cleanup(void *data, dma_addr_t desc_dma)
        dev_kfree_skb_any(skb);
 }
 
+static struct sk_buff *
+am65_cpsw_nuss_tx_compl_packet(struct am65_cpsw_tx_chn *tx_chn,
+                              dma_addr_t desc_dma)
+{
+       struct am65_cpsw_ndev_priv *ndev_priv;
+       struct am65_cpsw_ndev_stats *stats;
+       struct cppi5_host_desc_t *desc_tx;
+       struct net_device *ndev;
+       struct sk_buff *skb;
+       void **swdata;
+
+       desc_tx = k3_cppi_desc_pool_dma2virt(tx_chn->desc_pool,
+                                            desc_dma);
+       swdata = cppi5_hdesc_get_swdata(desc_tx);
+       skb = *(swdata);
+       am65_cpsw_nuss_xmit_free(tx_chn, tx_chn->common->dev, desc_tx);
+
+       ndev = skb->dev;
+
+       am65_cpts_tx_timestamp(tx_chn->common->cpts, skb);
+
+       ndev_priv = netdev_priv(ndev);
+       stats = this_cpu_ptr(ndev_priv->stats);
+       u64_stats_update_begin(&stats->syncp);
+       stats->tx_packets++;
+       stats->tx_bytes += skb->len;
+       u64_stats_update_end(&stats->syncp);
+
+       return skb;
+}
+
+static void am65_cpsw_nuss_tx_wake(struct am65_cpsw_tx_chn *tx_chn, struct net_device *ndev,
+                                  struct netdev_queue *netif_txq)
+{
+       if (netif_tx_queue_stopped(netif_txq)) {
+               /* Check whether the queue is stopped due to stalled
+                * tx dma, if the queue is stopped then wake the queue
+                * as we have free desc for tx
+                */
+               __netif_tx_lock(netif_txq, smp_processor_id());
+               if (netif_running(ndev) &&
+                   (k3_cppi_desc_pool_avail(tx_chn->desc_pool) >= MAX_SKB_FRAGS))
+                       netif_tx_wake_queue(netif_txq);
+
+               __netif_tx_unlock(netif_txq);
+       }
+}
+
 static int am65_cpsw_nuss_tx_compl_packets(struct am65_cpsw_common *common,
                                           int chn, unsigned int budget)
 {
-       struct cppi5_host_desc_t *desc_tx;
        struct device *dev = common->dev;
        struct am65_cpsw_tx_chn *tx_chn;
        struct netdev_queue *netif_txq;
@@ -923,41 +970,68 @@ static int am65_cpsw_nuss_tx_compl_packets(struct am65_cpsw_common *common,
        struct sk_buff *skb;
        dma_addr_t desc_dma;
        int res, num_tx = 0;
-       void **swdata;
 
        tx_chn = &common->tx_chns[chn];
 
        while (true) {
-               struct am65_cpsw_ndev_priv *ndev_priv;
-               struct am65_cpsw_ndev_stats *stats;
-
+               spin_lock(&tx_chn->lock);
                res = k3_udma_glue_pop_tx_chn(tx_chn->tx_chn, &desc_dma);
+               spin_unlock(&tx_chn->lock);
                if (res == -ENODATA)
                        break;
 
-               if (desc_dma & 0x1) {
+               if (cppi5_desc_is_tdcm(desc_dma)) {
                        if (atomic_dec_and_test(&common->tdown_cnt))
                                complete(&common->tdown_complete);
                        break;
                }
 
-               desc_tx = k3_cppi_desc_pool_dma2virt(tx_chn->desc_pool,
-                                                    desc_dma);
-               swdata = cppi5_hdesc_get_swdata(desc_tx);
-               skb = *(swdata);
-               am65_cpsw_nuss_xmit_free(tx_chn, dev, desc_tx);
-
+               skb = am65_cpsw_nuss_tx_compl_packet(tx_chn, desc_dma);
+               total_bytes = skb->len;
                ndev = skb->dev;
+               napi_consume_skb(skb, budget);
+               num_tx++;
 
-               am65_cpts_tx_timestamp(common->cpts, skb);
+               netif_txq = netdev_get_tx_queue(ndev, chn);
 
-               ndev_priv = netdev_priv(ndev);
-               stats = this_cpu_ptr(ndev_priv->stats);
-               u64_stats_update_begin(&stats->syncp);
-               stats->tx_packets++;
-               stats->tx_bytes += skb->len;
-               u64_stats_update_end(&stats->syncp);
+               netdev_tx_completed_queue(netif_txq, num_tx, total_bytes);
 
+               am65_cpsw_nuss_tx_wake(tx_chn, ndev, netif_txq);
+       }
+
+       dev_dbg(dev, "%s:%u pkt:%d\n", __func__, chn, num_tx);
+
+       return num_tx;
+}
+
+static int am65_cpsw_nuss_tx_compl_packets_2g(struct am65_cpsw_common *common,
+                                             int chn, unsigned int budget)
+{
+       struct device *dev = common->dev;
+       struct am65_cpsw_tx_chn *tx_chn;
+       struct netdev_queue *netif_txq;
+       unsigned int total_bytes = 0;
+       struct net_device *ndev;
+       struct sk_buff *skb;
+       dma_addr_t desc_dma;
+       int res, num_tx = 0;
+
+       tx_chn = &common->tx_chns[chn];
+
+       while (true) {
+               res = k3_udma_glue_pop_tx_chn(tx_chn->tx_chn, &desc_dma);
+               if (res == -ENODATA)
+                       break;
+
+               if (cppi5_desc_is_tdcm(desc_dma)) {
+                       if (atomic_dec_and_test(&common->tdown_cnt))
+                               complete(&common->tdown_complete);
+                       break;
+               }
+
+               skb = am65_cpsw_nuss_tx_compl_packet(tx_chn, desc_dma);
+
+               ndev = skb->dev;
                total_bytes += skb->len;
                napi_consume_skb(skb, budget);
                num_tx++;
@@ -970,19 +1044,8 @@ static int am65_cpsw_nuss_tx_compl_packets(struct am65_cpsw_common *common,
 
        netdev_tx_completed_queue(netif_txq, num_tx, total_bytes);
 
-       if (netif_tx_queue_stopped(netif_txq)) {
-               /* Check whether the queue is stopped due to stalled tx dma,
-                * if the queue is stopped then wake the queue as
-                * we have free desc for tx
-                */
-               __netif_tx_lock(netif_txq, smp_processor_id());
-               if (netif_running(ndev) &&
-                   (k3_cppi_desc_pool_avail(tx_chn->desc_pool) >=
-                    MAX_SKB_FRAGS))
-                       netif_tx_wake_queue(netif_txq);
+       am65_cpsw_nuss_tx_wake(tx_chn, ndev, netif_txq);
 
-               __netif_tx_unlock(netif_txq);
-       }
        dev_dbg(dev, "%s:%u pkt:%d\n", __func__, chn, num_tx);
 
        return num_tx;
@@ -993,8 +1056,11 @@ static int am65_cpsw_nuss_tx_poll(struct napi_struct *napi_tx, int budget)
        struct am65_cpsw_tx_chn *tx_chn = am65_cpsw_napi_to_tx_chn(napi_tx);
        int num_tx;
 
-       num_tx = am65_cpsw_nuss_tx_compl_packets(tx_chn->common, tx_chn->id,
-                                                budget);
+       if (AM65_CPSW_IS_CPSW2G(tx_chn->common))
+               num_tx = am65_cpsw_nuss_tx_compl_packets_2g(tx_chn->common, tx_chn->id, budget);
+       else
+               num_tx = am65_cpsw_nuss_tx_compl_packets(tx_chn->common, tx_chn->id, budget);
+
        num_tx = min(num_tx, budget);
        if (num_tx < budget) {
                napi_complete(napi_tx);
@@ -1139,7 +1205,13 @@ done_tx:
 
        cppi5_hdesc_set_pktlen(first_desc, pkt_len);
        desc_dma = k3_cppi_desc_pool_virt2dma(tx_chn->desc_pool, first_desc);
-       ret = k3_udma_glue_push_tx_chn(tx_chn->tx_chn, first_desc, desc_dma);
+       if (AM65_CPSW_IS_CPSW2G(common)) {
+               ret = k3_udma_glue_push_tx_chn(tx_chn->tx_chn, first_desc, desc_dma);
+       } else {
+               spin_lock_bh(&tx_chn->lock);
+               ret = k3_udma_glue_push_tx_chn(tx_chn->tx_chn, first_desc, desc_dma);
+               spin_unlock_bh(&tx_chn->lock);
+       }
        if (ret) {
                dev_err(dev, "can't push desc %d\n", ret);
                /* inform bql */
@@ -1369,32 +1441,7 @@ static void am65_cpsw_nuss_ndo_get_stats(struct net_device *dev,
        stats->tx_dropped       = dev->stats.tx_dropped;
 }
 
-static int am65_cpsw_nuss_ndo_slave_set_features(struct net_device *ndev,
-                                                netdev_features_t features)
-{
-       struct am65_cpsw_common *common = am65_ndev_to_common(ndev);
-       netdev_features_t changes = features ^ ndev->features;
-       struct am65_cpsw_host *host_p;
-
-       host_p = am65_common_get_host(common);
-
-       if (changes & NETIF_F_HW_CSUM) {
-               bool enable = !!(features & NETIF_F_HW_CSUM);
-
-               dev_info(common->dev, "Turn %s tx-checksum-ip-generic\n",
-                        enable ? "ON" : "OFF");
-               if (enable)
-                       writel(AM65_CPSW_P0_REG_CTL_RX_CHECKSUM_EN,
-                              host_p->port_base + AM65_CPSW_P0_REG_CTL);
-               else
-                       writel(0,
-                              host_p->port_base + AM65_CPSW_P0_REG_CTL);
-       }
-
-       return 0;
-}
-
-static const struct net_device_ops am65_cpsw_nuss_netdev_ops_2g = {
+static const struct net_device_ops am65_cpsw_nuss_netdev_ops = {
        .ndo_open               = am65_cpsw_nuss_ndo_slave_open,
        .ndo_stop               = am65_cpsw_nuss_ndo_slave_stop,
        .ndo_start_xmit         = am65_cpsw_nuss_ndo_slave_xmit,
@@ -1406,7 +1453,6 @@ static const struct net_device_ops am65_cpsw_nuss_netdev_ops_2g = {
        .ndo_vlan_rx_add_vid    = am65_cpsw_nuss_ndo_slave_add_vid,
        .ndo_vlan_rx_kill_vid   = am65_cpsw_nuss_ndo_slave_kill_vid,
        .ndo_do_ioctl           = am65_cpsw_nuss_ndo_slave_ioctl,
-       .ndo_set_features       = am65_cpsw_nuss_ndo_slave_set_features,
        .ndo_setup_tc           = am65_cpsw_qos_ndo_setup_tc,
 };
 
@@ -1417,7 +1463,6 @@ static void am65_cpsw_nuss_slave_disable_unused(struct am65_cpsw_port *port)
        if (!port->disabled)
                return;
 
-       common->disabled_ports_mask |= BIT(port->port_id);
        cpsw_ale_control_set(common->ale, port->port_id,
                             ALE_PORT_STATE, ALE_PORT_STATE_DISABLE);
 
@@ -1496,6 +1541,7 @@ static int am65_cpsw_nuss_init_tx_chns(struct am65_cpsw_common *common)
                snprintf(tx_chn->tx_chn_name,
                         sizeof(tx_chn->tx_chn_name), "tx%d", i);
 
+               spin_lock_init(&tx_chn->lock);
                tx_chn->common = common;
                tx_chn->id = i;
                tx_chn->descs_num = max_desc_num;
@@ -1515,9 +1561,8 @@ static int am65_cpsw_nuss_init_tx_chns(struct am65_cpsw_common *common)
                                                    tx_chn->tx_chn_name,
                                                    &tx_cfg);
                if (IS_ERR(tx_chn->tx_chn)) {
-                       ret = PTR_ERR(tx_chn->tx_chn);
-                       dev_err(dev, "Failed to request tx dma channel %d\n",
-                               ret);
+                       ret = dev_err_probe(dev, PTR_ERR(tx_chn->tx_chn),
+                                           "Failed to request tx dma channel\n");
                        goto err;
                }
 
@@ -1588,8 +1633,8 @@ static int am65_cpsw_nuss_init_rx_chns(struct am65_cpsw_common *common)
 
        rx_chn->rx_chn = k3_udma_glue_request_rx_chn(dev, "rx", &rx_cfg);
        if (IS_ERR(rx_chn->rx_chn)) {
-               ret = PTR_ERR(rx_chn->rx_chn);
-               dev_err(dev, "Failed to request rx dma channel %d\n", ret);
+               ret = dev_err_probe(dev, PTR_ERR(rx_chn->rx_chn),
+                                   "Failed to request rx dma channel\n");
                goto err;
        }
 
@@ -1606,7 +1651,6 @@ static int am65_cpsw_nuss_init_rx_chns(struct am65_cpsw_common *common)
                };
                struct k3_ring_cfg fdqring_cfg = {
                        .elm_size = K3_RINGACC_RING_ELSIZE_8,
-                       .mode = K3_RINGACC_RING_MODE_MESSAGE,
                        .flags = K3_RINGACC_RING_SHARED,
                };
                struct k3_udma_glue_rx_flow_cfg rx_flow_cfg = {
@@ -1620,6 +1664,7 @@ static int am65_cpsw_nuss_init_rx_chns(struct am65_cpsw_common *common)
                rx_flow_cfg.ring_rxfdq0_id = fdqring_id;
                rx_flow_cfg.rx_cfg.size = max_desc_num;
                rx_flow_cfg.rxfdq_cfg.size = max_desc_num;
+               rx_flow_cfg.rxfdq_cfg.mode = common->pdata.fdqring_mode;
 
                ret = k3_udma_glue_rx_flow_init(rx_chn->rx_chn,
                                                i, &rx_flow_cfg);
@@ -1725,6 +1770,13 @@ static int am65_cpsw_init_cpts(struct am65_cpsw_common *common)
                return ret;
        }
        common->cpts = cpts;
+       /* Forbid PM runtime if CPTS is running.
+        * K3 CPSWxG modules may completely lose context during ON->OFF
+        * transitions depending on integration.
+        * AM65x/J721E MCU CPSW2G: false
+        * J721E MAIN_CPSW9G: true
+        */
+       pm_runtime_forbid(dev);
 
        return 0;
 }
@@ -1778,8 +1830,10 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common)
                        return PTR_ERR(port->slave.mac_sl);
 
                port->disabled = !of_device_is_available(port_np);
-               if (port->disabled)
+               if (port->disabled) {
+                       common->disabled_ports_mask |= BIT(port->port_id);
                        continue;
+               }
 
                port->slave.ifphy = devm_of_phy_get(dev, port_np, NULL);
                if (IS_ERR(port->slave.ifphy)) {
@@ -1795,12 +1849,10 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common)
                /* get phy/link info */
                if (of_phy_is_fixed_link(port_np)) {
                        ret = of_phy_register_fixed_link(port_np);
-                       if (ret) {
-                               if (ret != -EPROBE_DEFER)
-                                       dev_err(dev, "%pOF failed to register fixed-link phy: %d\n",
-                                               port_np, ret);
-                               return ret;
-                       }
+                       if (ret)
+                               return dev_err_probe(dev, ret,
+                                                    "failed to register fixed-link phy %pOF\n",
+                                                    port_np);
                        port->slave.phy_node = of_node_get(port_np);
                } else {
                        port->slave.phy_node =
@@ -1833,6 +1885,12 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common)
        }
        of_node_put(node);
 
+       /* is there at least one ext.port */
+       if (!(~common->disabled_ports_mask & GENMASK(common->port_num, 1))) {
+               dev_err(dev, "No Ext. port are available\n");
+               return -ENODEV;
+       }
+
        return 0;
 }
 
@@ -1843,14 +1901,18 @@ static void am65_cpsw_pcpu_stats_free(void *data)
        free_percpu(stats);
 }
 
-static int am65_cpsw_nuss_init_ndev_2g(struct am65_cpsw_common *common)
+static int
+am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx)
 {
        struct am65_cpsw_ndev_priv *ndev_priv;
        struct device *dev = common->dev;
        struct am65_cpsw_port *port;
        int ret;
 
-       port = am65_common_get_port(common, 1);
+       port = &common->ports[port_idx];
+
+       if (port->disabled)
+               return 0;
 
        /* alloc netdev */
        port->ndev = devm_alloc_etherdev_mqs(common->dev,
@@ -1879,7 +1941,7 @@ static int am65_cpsw_nuss_init_ndev_2g(struct am65_cpsw_common *common)
        port->ndev->features = port->ndev->hw_features |
                               NETIF_F_HW_VLAN_CTAG_FILTER;
        port->ndev->vlan_features |=  NETIF_F_SG;
-       port->ndev->netdev_ops = &am65_cpsw_nuss_netdev_ops_2g;
+       port->ndev->netdev_ops = &am65_cpsw_nuss_netdev_ops;
        port->ndev->ethtool_ops = &am65_cpsw_ethtool_ops_slave;
 
        /* Disable TX checksum offload by default due to HW bug */
@@ -1892,29 +1954,41 @@ static int am65_cpsw_nuss_init_ndev_2g(struct am65_cpsw_common *common)
 
        ret = devm_add_action_or_reset(dev, am65_cpsw_pcpu_stats_free,
                                       ndev_priv->stats);
-       if (ret) {
-               dev_err(dev, "Failed to add percpu stat free action %d\n", ret);
-               return ret;
+       if (ret)
+               dev_err(dev, "failed to add percpu stat free action %d\n", ret);
+
+       if (!common->dma_ndev)
+               common->dma_ndev = port->ndev;
+
+       return ret;
+}
+
+static int am65_cpsw_nuss_init_ndevs(struct am65_cpsw_common *common)
+{
+       int ret;
+       int i;
+
+       for (i = 0; i < common->port_num; i++) {
+               ret = am65_cpsw_nuss_init_port_ndev(common, i);
+               if (ret)
+                       return ret;
        }
 
-       netif_napi_add(port->ndev, &common->napi_rx,
+       netif_napi_add(common->dma_ndev, &common->napi_rx,
                       am65_cpsw_nuss_rx_poll, NAPI_POLL_WEIGHT);
 
        return ret;
 }
 
-static int am65_cpsw_nuss_ndev_add_napi_2g(struct am65_cpsw_common *common)
+static int am65_cpsw_nuss_ndev_add_tx_napi(struct am65_cpsw_common *common)
 {
        struct device *dev = common->dev;
-       struct am65_cpsw_port *port;
        int i, ret = 0;
 
-       port = am65_common_get_port(common, 1);
-
        for (i = 0; i < common->tx_ch_num; i++) {
                struct am65_cpsw_tx_chn *tx_chn = &common->tx_chns[i];
 
-               netif_tx_napi_add(port->ndev, &tx_chn->napi_tx,
+               netif_tx_napi_add(common->dma_ndev, &tx_chn->napi_tx,
                                  am65_cpsw_nuss_tx_poll, NAPI_POLL_WEIGHT);
 
                ret = devm_request_irq(dev, tx_chn->irq,
@@ -1932,16 +2006,27 @@ err:
        return ret;
 }
 
-static int am65_cpsw_nuss_ndev_reg_2g(struct am65_cpsw_common *common)
+static void am65_cpsw_nuss_cleanup_ndev(struct am65_cpsw_common *common)
+{
+       struct am65_cpsw_port *port;
+       int i;
+
+       for (i = 0; i < common->port_num; i++) {
+               port = &common->ports[i];
+               if (port->ndev)
+                       unregister_netdev(port->ndev);
+       }
+}
+
+static int am65_cpsw_nuss_register_ndevs(struct am65_cpsw_common *common)
 {
        struct device *dev = common->dev;
        struct am65_cpsw_port *port;
-       int ret = 0;
+       int ret = 0, i;
 
-       port = am65_common_get_port(common, 1);
-       ret = am65_cpsw_nuss_ndev_add_napi_2g(common);
+       ret = am65_cpsw_nuss_ndev_add_tx_napi(common);
        if (ret)
-               goto err;
+               return ret;
 
        ret = devm_request_irq(dev, common->rx_chns.irq,
                               am65_cpsw_nuss_rx_irq,
@@ -1949,17 +2034,31 @@ static int am65_cpsw_nuss_ndev_reg_2g(struct am65_cpsw_common *common)
        if (ret) {
                dev_err(dev, "failure requesting rx irq %u, %d\n",
                        common->rx_chns.irq, ret);
-               goto err;
+               return ret;
+       }
+
+       for (i = 0; i < common->port_num; i++) {
+               port = &common->ports[i];
+
+               if (!port->ndev)
+                       continue;
+
+               ret = register_netdev(port->ndev);
+               if (ret) {
+                       dev_err(dev, "error registering slave net device%i %d\n",
+                               i, ret);
+                       goto err_cleanup_ndev;
+               }
        }
 
-       ret = register_netdev(port->ndev);
-       if (ret)
-               dev_err(dev, "error registering slave net device %d\n", ret);
 
        /* can't auto unregister ndev using devm_add_action() due to
         * devres release sequence in DD core for DMA
         */
-err:
+       return 0;
+
+err_cleanup_ndev:
+       am65_cpsw_nuss_cleanup_ndev(common);
        return ret;
 }
 
@@ -1972,19 +2071,7 @@ int am65_cpsw_nuss_update_tx_chns(struct am65_cpsw_common *common, int num_tx)
        if (ret)
                return ret;
 
-       return am65_cpsw_nuss_ndev_add_napi_2g(common);
-}
-
-static void am65_cpsw_nuss_cleanup_ndev(struct am65_cpsw_common *common)
-{
-       struct am65_cpsw_port *port;
-       int i;
-
-       for (i = 0; i < common->port_num; i++) {
-               port = &common->ports[i];
-               if (port->ndev)
-                       unregister_netdev(port->ndev);
-       }
+       return am65_cpsw_nuss_ndev_add_tx_napi(common);
 }
 
 struct am65_cpsw_soc_pdata {
@@ -2005,10 +2092,14 @@ static const struct soc_device_attribute am65_cpsw_socinfo[] = {
 
 static const struct am65_cpsw_pdata am65x_sr1_0 = {
        .quirks = AM65_CPSW_QUIRK_I2027_NO_TX_CSUM,
+       .ale_dev_id = "am65x-cpsw2g",
+       .fdqring_mode = K3_RINGACC_RING_MODE_MESSAGE,
 };
 
 static const struct am65_cpsw_pdata j721e_pdata = {
        .quirks = 0,
+       .ale_dev_id = "am65x-cpsw2g",
+       .fdqring_mode = K3_RINGACC_RING_MODE_MESSAGE,
 };
 
 static const struct of_device_id am65_cpsw_nuss_of_mtable[] = {
@@ -2068,9 +2159,6 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
                return -ENOENT;
        of_node_put(node);
 
-       if (common->port_num != 1)
-               return -EOPNOTSUPP;
-
        common->rx_flow_id_base = -1;
        init_completion(&common->tdown_complete);
        common->tx_ch_num = 1;
@@ -2089,13 +2177,8 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        clk = devm_clk_get(dev, "fck");
-       if (IS_ERR(clk)) {
-               ret = PTR_ERR(clk);
-
-               if (ret != -EPROBE_DEFER)
-                       dev_err(dev, "error getting fck clock %d\n", ret);
-               return ret;
-       }
+       if (IS_ERR(clk))
+               return dev_err_probe(dev, PTR_ERR(clk), "getting fck clock\n");
        common->bus_freq = clk_get_rate(clk);
 
        pm_runtime_enable(dev);
@@ -2145,7 +2228,7 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
        ale_params.ale_ageout = AM65_CPSW_ALE_AGEOUT_DEFAULT;
        ale_params.ale_ports = common->port_num + 1;
        ale_params.ale_regs = common->cpsw_base + AM65_CPSW_NU_ALE_BASE;
-       ale_params.dev_id = "am65x-cpsw2g";
+       ale_params.dev_id = common->pdata.ale_dev_id;
        ale_params.bus_freq = common->bus_freq;
 
        common->ale = cpsw_ale_create(&ale_params);
@@ -2165,11 +2248,11 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
 
        dev_set_drvdata(dev, common);
 
-       ret = am65_cpsw_nuss_init_ndev_2g(common);
+       ret = am65_cpsw_nuss_init_ndevs(common);
        if (ret)
                goto err_of_clear;
 
-       ret = am65_cpsw_nuss_ndev_reg_2g(common);
+       ret = am65_cpsw_nuss_register_ndevs(common);
        if (ret)
                goto err_of_clear;
 
index 993e1d4..02aed4c 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/netdevice.h>
 #include <linux/phy.h>
 #include <linux/platform_device.h>
+#include <linux/soc/ti/k3-ringacc.h>
 #include "am65-cpsw-qos.h"
 
 struct am65_cpts;
@@ -59,6 +60,7 @@ struct am65_cpsw_tx_chn {
        struct am65_cpsw_common *common;
        struct k3_cppi_desc_pool *desc_pool;
        struct k3_udma_glue_tx_channel *tx_chn;
+       spinlock_t lock; /* protect TX rings in multi-port mode */
        int irq;
        u32 id;
        u32 descs_num;
@@ -77,6 +79,8 @@ struct am65_cpsw_rx_chn {
 
 struct am65_cpsw_pdata {
        u32     quirks;
+       enum k3_ring_mode fdqring_mode;
+       const char      *ale_dev_id;
 };
 
 struct am65_cpsw_common {
@@ -91,6 +95,7 @@ struct am65_cpsw_common {
        struct am65_cpsw_host   host;
        struct am65_cpsw_port   *ports;
        u32                     disabled_ports_mask;
+       struct net_device       *dma_ndev;
 
        int                     usage_count; /* number of opened ports */
        struct cpsw_ale         *ale;
index a6a455c..cdc308a 100644 (file)
@@ -634,8 +634,8 @@ int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port_mask, int untag,
        return 0;
 }
 
-static void cpsw_ale_del_vlan_modify(struct cpsw_ale *ale, u32 *ale_entry,
-                                    u16 vid, int port_mask)
+static void cpsw_ale_vlan_del_modify_int(struct cpsw_ale *ale,  u32 *ale_entry,
+                                        u16 vid, int port_mask)
 {
        int reg_mcast, unreg_mcast;
        int members, untag;
@@ -644,6 +644,7 @@ static void cpsw_ale_del_vlan_modify(struct cpsw_ale *ale, u32 *ale_entry,
                                        ALE_ENT_VID_MEMBER_LIST);
        members &= ~port_mask;
        if (!members) {
+               cpsw_ale_set_vlan_untag(ale, ale_entry, vid, 0);
                cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE);
                return;
        }
@@ -673,7 +674,7 @@ static void cpsw_ale_del_vlan_modify(struct cpsw_ale *ale, u32 *ale_entry,
                              ALE_ENT_VID_MEMBER_LIST, members);
 }
 
-int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask)
+int cpsw_ale_vlan_del_modify(struct cpsw_ale *ale, u16 vid, int port_mask)
 {
        u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
        int idx;
@@ -684,11 +685,39 @@ int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask)
 
        cpsw_ale_read(ale, idx, ale_entry);
 
-       if (port_mask) {
-               cpsw_ale_del_vlan_modify(ale, ale_entry, vid, port_mask);
-       } else {
+       cpsw_ale_vlan_del_modify_int(ale, ale_entry, vid, port_mask);
+       cpsw_ale_write(ale, idx, ale_entry);
+
+       return 0;
+}
+
+int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask)
+{
+       u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
+       int members, idx;
+
+       idx = cpsw_ale_match_vlan(ale, vid);
+       if (idx < 0)
+               return -ENOENT;
+
+       cpsw_ale_read(ale, idx, ale_entry);
+
+       /* if !port_mask - force remove VLAN (legacy).
+        * Check if there are other VLAN members ports
+        * if no - remove VLAN.
+        * if yes it means same VLAN was added to >1 port in multi port mode, so
+        * remove port_mask ports from VLAN ALE entry excluding Host port.
+        */
+       members = cpsw_ale_vlan_get_fld(ale, ale_entry, ALE_ENT_VID_MEMBER_LIST);
+       members &= ~port_mask;
+
+       if (!port_mask || !members) {
+               /* last port or force remove - remove VLAN */
                cpsw_ale_set_vlan_untag(ale, ale_entry, vid, 0);
                cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE);
+       } else {
+               port_mask &= ~ALE_PORT_HOST;
+               cpsw_ale_vlan_del_modify_int(ale, ale_entry, vid, port_mask);
        }
 
        cpsw_ale_write(ale, idx, ale_entry);
index 5e4a696..13fe476 100644 (file)
@@ -134,6 +134,7 @@ static inline int cpsw_ale_get_vlan_p0_untag(struct cpsw_ale *ale, u16 vid)
 
 int cpsw_ale_vlan_add_modify(struct cpsw_ale *ale, u16 vid, int port_mask,
                             int untag_mask, int reg_mcast, int unreg_mcast);
+int cpsw_ale_vlan_del_modify(struct cpsw_ale *ale, u16 vid, int port_mask);
 void cpsw_ale_set_unreg_mcast(struct cpsw_ale *ale, int unreg_mcast_mask,
                              bool add);
 
index 4d02c51..4619c3a 100644 (file)
@@ -728,7 +728,6 @@ int cpsw_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info)
                (1 << HWTSTAMP_TX_ON);
        info->rx_filters =
                (1 << HWTSTAMP_FILTER_NONE) |
-               (1 << HWTSTAMP_FILTER_PTP_V1_L4_EVENT) |
                (1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
        return 0;
 }
index 51cc29f..31c5e36 100644 (file)
@@ -639,13 +639,10 @@ static int cpsw_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
                break;
        case HWTSTAMP_FILTER_ALL:
        case HWTSTAMP_FILTER_NTP_ALL:
-               return -ERANGE;
        case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
        case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
        case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
-               priv->rx_ts_enabled = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
-               cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
-               break;
+               return -ERANGE;
        case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
        case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
        case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
index 985a929..29747da 100644 (file)
@@ -227,7 +227,7 @@ static int cpsw_port_vlan_del(struct cpsw_priv *priv, u16 vid,
        else
                port_mask = BIT(priv->emac_port);
 
-       ret = cpsw_ale_del_vlan(cpsw->ale, vid, port_mask);
+       ret = cpsw_ale_vlan_del_modify(cpsw->ale, vid, port_mask);
        if (ret != 0)
                return ret;
 
index 267c080..0b2ce4b 100644 (file)
@@ -186,6 +186,7 @@ static void tlan_reset_adapter(struct net_device *);
 static void    tlan_finish_reset(struct net_device *);
 static void    tlan_set_mac(struct net_device *, int areg, char *mac);
 
+static void    __tlan_phy_print(struct net_device *);
 static void    tlan_phy_print(struct net_device *);
 static void    tlan_phy_detect(struct net_device *);
 static void    tlan_phy_power_down(struct net_device *);
@@ -201,9 +202,11 @@ static void        tlan_phy_finish_auto_neg(struct net_device *);
   static int   tlan_phy_dp83840a_check(struct net_device *);
 */
 
-static bool    tlan_mii_read_reg(struct net_device *, u16, u16, u16 *);
+static bool    __tlan_mii_read_reg(struct net_device *, u16, u16, u16 *);
+static void    tlan_mii_read_reg(struct net_device *, u16, u16, u16 *);
 static void    tlan_mii_send_data(u16, u32, unsigned);
 static void    tlan_mii_sync(u16);
+static void    __tlan_mii_write_reg(struct net_device *, u16, u16, u16);
 static void    tlan_mii_write_reg(struct net_device *, u16, u16, u16);
 
 static void    tlan_ee_send_start(u16);
@@ -242,23 +245,20 @@ static u32
        tlan_handle_rx_eoc
 };
 
-static inline void
+static void
 tlan_set_timer(struct net_device *dev, u32 ticks, u32 type)
 {
        struct tlan_priv *priv = netdev_priv(dev);
        unsigned long flags = 0;
 
-       if (!in_irq())
-               spin_lock_irqsave(&priv->lock, flags);
+       spin_lock_irqsave(&priv->lock, flags);
        if (priv->timer.function != NULL &&
            priv->timer_type != TLAN_TIMER_ACTIVITY) {
-               if (!in_irq())
-                       spin_unlock_irqrestore(&priv->lock, flags);
+               spin_unlock_irqrestore(&priv->lock, flags);
                return;
        }
        priv->timer.function = tlan_timer;
-       if (!in_irq())
-               spin_unlock_irqrestore(&priv->lock, flags);
+       spin_unlock_irqrestore(&priv->lock, flags);
 
        priv->timer_set_at = jiffies;
        priv->timer_type = type;
@@ -1703,22 +1703,22 @@ static u32 tlan_handle_status_check(struct net_device *dev, u16 host_int)
                                 dev->name, (unsigned) net_sts);
                }
                if ((net_sts & TLAN_NET_STS_MIRQ) &&  (priv->phy_num == 0)) {
-                       tlan_mii_read_reg(dev, phy, TLAN_TLPHY_STS, &tlphy_sts);
-                       tlan_mii_read_reg(dev, phy, TLAN_TLPHY_CTL, &tlphy_ctl);
+                       __tlan_mii_read_reg(dev, phy, TLAN_TLPHY_STS, &tlphy_sts);
+                       __tlan_mii_read_reg(dev, phy, TLAN_TLPHY_CTL, &tlphy_ctl);
                        if (!(tlphy_sts & TLAN_TS_POLOK) &&
                            !(tlphy_ctl & TLAN_TC_SWAPOL)) {
                                tlphy_ctl |= TLAN_TC_SWAPOL;
-                               tlan_mii_write_reg(dev, phy, TLAN_TLPHY_CTL,
-                                                  tlphy_ctl);
+                               __tlan_mii_write_reg(dev, phy, TLAN_TLPHY_CTL,
+                                                    tlphy_ctl);
                        } else if ((tlphy_sts & TLAN_TS_POLOK) &&
                                   (tlphy_ctl & TLAN_TC_SWAPOL)) {
                                tlphy_ctl &= ~TLAN_TC_SWAPOL;
-                               tlan_mii_write_reg(dev, phy, TLAN_TLPHY_CTL,
-                                                  tlphy_ctl);
+                               __tlan_mii_write_reg(dev, phy, TLAN_TLPHY_CTL,
+                                                    tlphy_ctl);
                        }
 
                        if (debug)
-                               tlan_phy_print(dev);
+                               __tlan_phy_print(dev);
                }
        }
 
@@ -2379,7 +2379,7 @@ ThunderLAN driver PHY layer routines
 
 
 /*********************************************************************
- *     tlan_phy_print
+ *     __tlan_phy_print
  *
  *     Returns:
  *             Nothing
@@ -2391,11 +2391,13 @@ ThunderLAN driver PHY layer routines
  *
  ********************************************************************/
 
-static void tlan_phy_print(struct net_device *dev)
+static void __tlan_phy_print(struct net_device *dev)
 {
        struct tlan_priv *priv = netdev_priv(dev);
        u16 i, data0, data1, data2, data3, phy;
 
+       lockdep_assert_held(&priv->lock);
+
        phy = priv->phy[priv->phy_num];
 
        if (priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) {
@@ -2404,10 +2406,10 @@ static void tlan_phy_print(struct net_device *dev)
                netdev_info(dev, "PHY 0x%02x\n", phy);
                pr_info("   Off.  +0     +1     +2     +3\n");
                for (i = 0; i < 0x20; i += 4) {
-                       tlan_mii_read_reg(dev, phy, i, &data0);
-                       tlan_mii_read_reg(dev, phy, i + 1, &data1);
-                       tlan_mii_read_reg(dev, phy, i + 2, &data2);
-                       tlan_mii_read_reg(dev, phy, i + 3, &data3);
+                       __tlan_mii_read_reg(dev, phy, i, &data0);
+                       __tlan_mii_read_reg(dev, phy, i + 1, &data1);
+                       __tlan_mii_read_reg(dev, phy, i + 2, &data2);
+                       __tlan_mii_read_reg(dev, phy, i + 3, &data3);
                        pr_info("   0x%02x 0x%04hx 0x%04hx 0x%04hx 0x%04hx\n",
                                i, data0, data1, data2, data3);
                }
@@ -2417,7 +2419,15 @@ static void tlan_phy_print(struct net_device *dev)
 
 }
 
+static void tlan_phy_print(struct net_device *dev)
+{
+       struct tlan_priv *priv = netdev_priv(dev);
+       unsigned long flags;
 
+       spin_lock_irqsave(&priv->lock, flags);
+       __tlan_phy_print(dev);
+       spin_unlock_irqrestore(&priv->lock, flags);
+}
 
 
 /*********************************************************************
@@ -2795,7 +2805,7 @@ these routines are based on the information in chap. 2 of the
 
 
 /***************************************************************
- *     tlan_mii_read_reg
+ *     __tlan_mii_read_reg
  *
  *     Returns:
  *             false   if ack received ok
@@ -2819,7 +2829,7 @@ these routines are based on the information in chap. 2 of the
  **************************************************************/
 
 static bool
-tlan_mii_read_reg(struct net_device *dev, u16 phy, u16 reg, u16 *val)
+__tlan_mii_read_reg(struct net_device *dev, u16 phy, u16 reg, u16 *val)
 {
        u8      nack;
        u16     sio, tmp;
@@ -2827,15 +2837,13 @@ tlan_mii_read_reg(struct net_device *dev, u16 phy, u16 reg, u16 *val)
        bool    err;
        int     minten;
        struct tlan_priv *priv = netdev_priv(dev);
-       unsigned long flags = 0;
+
+       lockdep_assert_held(&priv->lock);
 
        err = false;
        outw(TLAN_NET_SIO, dev->base_addr + TLAN_DIO_ADR);
        sio = dev->base_addr + TLAN_DIO_DATA + TLAN_NET_SIO;
 
-       if (!in_irq())
-               spin_lock_irqsave(&priv->lock, flags);
-
        tlan_mii_sync(dev->base_addr);
 
        minten = tlan_get_bit(TLAN_NET_SIO_MINTEN, sio);
@@ -2881,15 +2889,19 @@ tlan_mii_read_reg(struct net_device *dev, u16 phy, u16 reg, u16 *val)
 
        *val = tmp;
 
-       if (!in_irq())
-               spin_unlock_irqrestore(&priv->lock, flags);
-
        return err;
-
 }
 
+static void tlan_mii_read_reg(struct net_device *dev, u16 phy, u16 reg,
+                             u16 *val)
+{
+       struct tlan_priv *priv = netdev_priv(dev);
+       unsigned long flags;
 
-
+       spin_lock_irqsave(&priv->lock, flags);
+       __tlan_mii_read_reg(dev, phy, reg, val);
+       spin_unlock_irqrestore(&priv->lock, flags);
+}
 
 /***************************************************************
  *     tlan_mii_send_data
@@ -2971,7 +2983,7 @@ static void tlan_mii_sync(u16 base_port)
 
 
 /***************************************************************
- *     tlan_mii_write_reg
+ *     __tlan_mii_write_reg
  *
  *     Returns:
  *             Nothing
@@ -2991,19 +3003,17 @@ static void tlan_mii_sync(u16 base_port)
  **************************************************************/
 
 static void
-tlan_mii_write_reg(struct net_device *dev, u16 phy, u16 reg, u16 val)
+__tlan_mii_write_reg(struct net_device *dev, u16 phy, u16 reg, u16 val)
 {
        u16     sio;
        int     minten;
-       unsigned long flags = 0;
        struct tlan_priv *priv = netdev_priv(dev);
 
+       lockdep_assert_held(&priv->lock);
+
        outw(TLAN_NET_SIO, dev->base_addr + TLAN_DIO_ADR);
        sio = dev->base_addr + TLAN_DIO_DATA + TLAN_NET_SIO;
 
-       if (!in_irq())
-               spin_lock_irqsave(&priv->lock, flags);
-
        tlan_mii_sync(dev->base_addr);
 
        minten = tlan_get_bit(TLAN_NET_SIO_MINTEN, sio);
@@ -3024,12 +3034,18 @@ tlan_mii_write_reg(struct net_device *dev, u16 phy, u16 reg, u16 val)
        if (minten)
                tlan_set_bit(TLAN_NET_SIO_MINTEN, sio);
 
-       if (!in_irq())
-               spin_unlock_irqrestore(&priv->lock, flags);
-
 }
 
+static void
+tlan_mii_write_reg(struct net_device *dev, u16 phy, u16 reg, u16 val)
+{
+       struct tlan_priv *priv = netdev_priv(dev);
+       unsigned long flags;
 
+       spin_lock_irqsave(&priv->lock, flags);
+       __tlan_mii_write_reg(dev, phy, reg, val);
+       spin_unlock_irqrestore(&priv->lock, flags);
+}
 
 
 /*****************************************************************************
index d0d0d4f..3b2137d 100644 (file)
@@ -18,7 +18,7 @@ if NET_VENDOR_XILINX
 
 config XILINX_EMACLITE
        tristate "Xilinx 10/100 Ethernet Lite support"
-       depends on PPC32 || MICROBLAZE || ARCH_ZYNQ || MIPS
+       depends on PPC32 || MICROBLAZE || ARCH_ZYNQ || MIPS || COMPILE_TEST
        select PHYLIB
        help
          This driver supports the 10/100 Ethernet Lite from Xilinx.
index f34c790..a03c3ca 100644 (file)
@@ -378,6 +378,7 @@ struct axidma_bd {
  * @dev:       Pointer to device structure
  * @phy_node:  Pointer to device node structure
  * @mii_bus:   Pointer to MII bus structure
+ * @mii_clk_div: MII bus clock divider value
  * @regs_start: Resource start for axienet device addresses
  * @regs:      Base address for the axienet_local device address space
  * @dma_regs:  Base address for the axidma device address space
@@ -419,11 +420,15 @@ struct axienet_local {
        struct phylink *phylink;
        struct phylink_config phylink_config;
 
+       /* Reference to PCS/PMA PHY if used */
+       struct mdio_device *pcs_phy;
+
        /* Clock for AXI bus */
        struct clk *clk;
 
        /* MDIO bus data */
        struct mii_bus *mii_bus;        /* MII bus reference */
+       u8 mii_clk_div; /* MII bus clock divider value */
 
        /* IO registers, dma functions and IRQs */
        resource_size_t regs_start;
index 9aafd3e..6fea980 100644 (file)
@@ -1049,20 +1049,13 @@ static int axienet_open(struct net_device *ndev)
 
        dev_dbg(&ndev->dev, "axienet_open()\n");
 
-       /* Disable the MDIO interface till Axi Ethernet Reset is completed.
-        * When we do an Axi Ethernet reset, it resets the complete core
-        * including the MDIO. MDIO must be disabled before resetting
-        * and re-enabled afterwards.
+       /* When we do an Axi Ethernet reset, it resets the complete core
+        * including the MDIO. MDIO must be disabled before resetting.
         * Hold MDIO bus lock to avoid MDIO accesses during the reset.
         */
        mutex_lock(&lp->mii_bus->mdio_lock);
-       axienet_mdio_disable(lp);
        ret = axienet_device_reset(ndev);
-       if (ret == 0)
-               ret = axienet_mdio_enable(lp);
        mutex_unlock(&lp->mii_bus->mdio_lock);
-       if (ret < 0)
-               return ret;
 
        ret = phylink_of_phy_connect(lp->phylink, lp->dev->of_node, 0);
        if (ret) {
@@ -1156,9 +1149,7 @@ static int axienet_stop(struct net_device *ndev)
 
        /* Do a reset to ensure DMA is really stopped */
        mutex_lock(&lp->mii_bus->mdio_lock);
-       axienet_mdio_disable(lp);
        __axienet_device_reset(lp);
-       axienet_mdio_enable(lp);
        mutex_unlock(&lp->mii_bus->mdio_lock);
 
        cancel_work_sync(&lp->dma_err_task);
@@ -1517,10 +1508,27 @@ static void axienet_validate(struct phylink_config *config,
 
        phylink_set(mask, Asym_Pause);
        phylink_set(mask, Pause);
-       phylink_set(mask, 1000baseX_Full);
-       phylink_set(mask, 10baseT_Full);
-       phylink_set(mask, 100baseT_Full);
-       phylink_set(mask, 1000baseT_Full);
+
+       switch (state->interface) {
+       case PHY_INTERFACE_MODE_NA:
+       case PHY_INTERFACE_MODE_1000BASEX:
+       case PHY_INTERFACE_MODE_SGMII:
+       case PHY_INTERFACE_MODE_GMII:
+       case PHY_INTERFACE_MODE_RGMII:
+       case PHY_INTERFACE_MODE_RGMII_ID:
+       case PHY_INTERFACE_MODE_RGMII_RXID:
+       case PHY_INTERFACE_MODE_RGMII_TXID:
+               phylink_set(mask, 1000baseX_Full);
+               phylink_set(mask, 1000baseT_Full);
+               if (state->interface == PHY_INTERFACE_MODE_1000BASEX)
+                       break;
+               fallthrough;
+       case PHY_INTERFACE_MODE_MII:
+               phylink_set(mask, 100baseT_Full);
+               phylink_set(mask, 10baseT_Full);
+       default:
+               break;
+       }
 
        bitmap_and(supported, supported, mask,
                   __ETHTOOL_LINK_MODE_MASK_NBITS);
@@ -1533,38 +1541,46 @@ static void axienet_mac_pcs_get_state(struct phylink_config *config,
 {
        struct net_device *ndev = to_net_dev(config->dev);
        struct axienet_local *lp = netdev_priv(ndev);
-       u32 emmc_reg, fcc_reg;
-
-       state->interface = lp->phy_mode;
 
-       emmc_reg = axienet_ior(lp, XAE_EMMC_OFFSET);
-       if (emmc_reg & XAE_EMMC_LINKSPD_1000)
-               state->speed = SPEED_1000;
-       else if (emmc_reg & XAE_EMMC_LINKSPD_100)
-               state->speed = SPEED_100;
-       else
-               state->speed = SPEED_10;
-
-       state->pause = 0;
-       fcc_reg = axienet_ior(lp, XAE_FCC_OFFSET);
-       if (fcc_reg & XAE_FCC_FCTX_MASK)
-               state->pause |= MLO_PAUSE_TX;
-       if (fcc_reg & XAE_FCC_FCRX_MASK)
-               state->pause |= MLO_PAUSE_RX;
-
-       state->an_complete = 0;
-       state->duplex = 1;
+       switch (state->interface) {
+       case PHY_INTERFACE_MODE_SGMII:
+       case PHY_INTERFACE_MODE_1000BASEX:
+               phylink_mii_c22_pcs_get_state(lp->pcs_phy, state);
+               break;
+       default:
+               break;
+       }
 }
 
 static void axienet_mac_an_restart(struct phylink_config *config)
 {
-       /* Unsupported, do nothing */
+       struct net_device *ndev = to_net_dev(config->dev);
+       struct axienet_local *lp = netdev_priv(ndev);
+
+       phylink_mii_c22_pcs_an_restart(lp->pcs_phy);
 }
 
 static void axienet_mac_config(struct phylink_config *config, unsigned int mode,
                               const struct phylink_link_state *state)
 {
-       /* nothing meaningful to do */
+       struct net_device *ndev = to_net_dev(config->dev);
+       struct axienet_local *lp = netdev_priv(ndev);
+       int ret;
+
+       switch (state->interface) {
+       case PHY_INTERFACE_MODE_SGMII:
+       case PHY_INTERFACE_MODE_1000BASEX:
+               ret = phylink_mii_c22_pcs_config(lp->pcs_phy, mode,
+                                                state->interface,
+                                                state->advertising);
+               if (ret < 0)
+                       netdev_warn(ndev, "Failed to configure PCS: %d\n",
+                                   ret);
+               break;
+
+       default:
+               break;
+       }
 }
 
 static void axienet_mac_link_down(struct phylink_config *config,
@@ -1644,16 +1660,12 @@ static void axienet_dma_err_handler(struct work_struct *work)
 
        axienet_setoptions(ndev, lp->options &
                           ~(XAE_OPTION_TXEN | XAE_OPTION_RXEN));
-       /* Disable the MDIO interface till Axi Ethernet Reset is completed.
-        * When we do an Axi Ethernet reset, it resets the complete core
-        * including the MDIO. MDIO must be disabled before resetting
-        * and re-enabled afterwards.
+       /* When we do an Axi Ethernet reset, it resets the complete core
+        * including the MDIO. MDIO must be disabled before resetting.
         * Hold MDIO bus lock to avoid MDIO accesses during the reset.
         */
        mutex_lock(&lp->mii_bus->mdio_lock);
-       axienet_mdio_disable(lp);
        __axienet_device_reset(lp);
-       axienet_mdio_enable(lp);
        mutex_unlock(&lp->mii_bus->mdio_lock);
 
        for (i = 0; i < lp->tx_bd_num; i++) {
@@ -1999,6 +2011,20 @@ static int axienet_probe(struct platform_device *pdev)
                        dev_warn(&pdev->dev,
                                 "error registering MDIO bus: %d\n", ret);
        }
+       if (lp->phy_mode == PHY_INTERFACE_MODE_SGMII ||
+           lp->phy_mode == PHY_INTERFACE_MODE_1000BASEX) {
+               if (!lp->phy_node) {
+                       dev_err(&pdev->dev, "phy-handle required for 1000BaseX/SGMII\n");
+                       ret = -EINVAL;
+                       goto free_netdev;
+               }
+               lp->pcs_phy = of_mdio_find_device(lp->phy_node);
+               if (!lp->pcs_phy) {
+                       ret = -EPROBE_DEFER;
+                       goto free_netdev;
+               }
+               lp->phylink_config.pcs_poll = true;
+       }
 
        lp->phylink_config.dev = &ndev->dev;
        lp->phylink_config.type = PHYLINK_NETDEV;
@@ -2036,6 +2062,9 @@ static int axienet_remove(struct platform_device *pdev)
        if (lp->phylink)
                phylink_destroy(lp->phylink);
 
+       if (lp->pcs_phy)
+               put_device(&lp->pcs_phy->dev);
+
        axienet_mdio_teardown(lp);
 
        clk_disable_unprepare(lp->clk);
index 435ed30..9c014ce 100644 (file)
@@ -30,6 +30,23 @@ static int axienet_mdio_wait_until_ready(struct axienet_local *lp)
                                  1, 20000);
 }
 
+/* Enable the MDIO MDC. Called prior to a read/write operation */
+static void axienet_mdio_mdc_enable(struct axienet_local *lp)
+{
+       axienet_iow(lp, XAE_MDIO_MC_OFFSET,
+                   ((u32)lp->mii_clk_div | XAE_MDIO_MC_MDIOEN_MASK));
+}
+
+/* Disable the MDIO MDC. Called after a read/write operation*/
+static void axienet_mdio_mdc_disable(struct axienet_local *lp)
+{
+       u32 mc_reg;
+
+       mc_reg = axienet_ior(lp, XAE_MDIO_MC_OFFSET);
+       axienet_iow(lp, XAE_MDIO_MC_OFFSET,
+                   (mc_reg & ~XAE_MDIO_MC_MDIOEN_MASK));
+}
+
 /**
  * axienet_mdio_read - MDIO interface read function
  * @bus:       Pointer to mii bus structure
@@ -48,9 +65,13 @@ static int axienet_mdio_read(struct mii_bus *bus, int phy_id, int reg)
        int ret;
        struct axienet_local *lp = bus->priv;
 
+       axienet_mdio_mdc_enable(lp);
+
        ret = axienet_mdio_wait_until_ready(lp);
-       if (ret < 0)
+       if (ret < 0) {
+               axienet_mdio_mdc_disable(lp);
                return ret;
+       }
 
        axienet_iow(lp, XAE_MDIO_MCR_OFFSET,
                    (((phy_id << XAE_MDIO_MCR_PHYAD_SHIFT) &
@@ -61,14 +82,17 @@ static int axienet_mdio_read(struct mii_bus *bus, int phy_id, int reg)
                     XAE_MDIO_MCR_OP_READ_MASK));
 
        ret = axienet_mdio_wait_until_ready(lp);
-       if (ret < 0)
+       if (ret < 0) {
+               axienet_mdio_mdc_disable(lp);
                return ret;
+       }
 
        rc = axienet_ior(lp, XAE_MDIO_MRD_OFFSET) & 0x0000FFFF;
 
        dev_dbg(lp->dev, "axienet_mdio_read(phy_id=%i, reg=%x) == %x\n",
                phy_id, reg, rc);
 
+       axienet_mdio_mdc_disable(lp);
        return rc;
 }
 
@@ -94,9 +118,13 @@ static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg,
        dev_dbg(lp->dev, "axienet_mdio_write(phy_id=%i, reg=%x, val=%x)\n",
                phy_id, reg, val);
 
+       axienet_mdio_mdc_enable(lp);
+
        ret = axienet_mdio_wait_until_ready(lp);
-       if (ret < 0)
+       if (ret < 0) {
+               axienet_mdio_mdc_disable(lp);
                return ret;
+       }
 
        axienet_iow(lp, XAE_MDIO_MWD_OFFSET, (u32) val);
        axienet_iow(lp, XAE_MDIO_MCR_OFFSET,
@@ -108,8 +136,11 @@ static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg,
                     XAE_MDIO_MCR_OP_WRITE_MASK));
 
        ret = axienet_mdio_wait_until_ready(lp);
-       if (ret < 0)
+       if (ret < 0) {
+               axienet_mdio_mdc_disable(lp);
                return ret;
+       }
+       axienet_mdio_mdc_disable(lp);
        return 0;
 }
 
@@ -124,7 +155,9 @@ static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg,
  **/
 int axienet_mdio_enable(struct axienet_local *lp)
 {
-       u32 clk_div, host_clock;
+       u32 host_clock;
+
+       lp->mii_clk_div = 0;
 
        if (lp->clk) {
                host_clock = clk_get_rate(lp->clk);
@@ -176,19 +209,19 @@ int axienet_mdio_enable(struct axienet_local *lp)
         * "clock-frequency" from the CPU
         */
 
-       clk_div = (host_clock / (MAX_MDIO_FREQ * 2)) - 1;
+       lp->mii_clk_div = (host_clock / (MAX_MDIO_FREQ * 2)) - 1;
        /* If there is any remainder from the division of
         * fHOST / (MAX_MDIO_FREQ * 2), then we need to add
         * 1 to the clock divisor or we will surely be above 2.5 MHz
         */
        if (host_clock % (MAX_MDIO_FREQ * 2))
-               clk_div++;
+               lp->mii_clk_div++;
 
        netdev_dbg(lp->ndev,
                   "Setting MDIO clock divisor to %u/%u Hz host clock.\n",
-                  clk_div, host_clock);
+                  lp->mii_clk_div, host_clock);
 
-       axienet_iow(lp, XAE_MDIO_MC_OFFSET, clk_div | XAE_MDIO_MC_MDIOEN_MASK);
+       axienet_iow(lp, XAE_MDIO_MC_OFFSET, lp->mii_clk_div | XAE_MDIO_MC_MDIOEN_MASK);
 
        return axienet_mdio_wait_until_ready(lp);
 }
@@ -211,8 +244,8 @@ void axienet_mdio_disable(struct axienet_local *lp)
  * Return:     0 on success, -ETIMEDOUT on a timeout, -ENOMEM when
  *             mdiobus_alloc (to allocate memory for mii bus structure) fails.
  *
- * Sets up the MDIO interface by initializing the MDIO clock and enabling the
- * MDIO interface in hardware. Register the MDIO interface.
+ * Sets up the MDIO interface by initializing the MDIO clock.
+ * Register the MDIO interface.
  **/
 int axienet_mdio_setup(struct axienet_local *lp)
 {
@@ -246,6 +279,7 @@ int axienet_mdio_setup(struct axienet_local *lp)
                lp->mii_bus = NULL;
                return ret;
        }
+       axienet_mdio_mdc_disable(lp);
        return 0;
 }
 
index 0c26f5b..008b9a4 100644 (file)
@@ -97,7 +97,7 @@
 #define ALIGNMENT              4
 
 /* BUFFER_ALIGN(adr) calculates the number of bytes to the next alignment. */
-#define BUFFER_ALIGN(adr) ((ALIGNMENT - ((u32)adr)) % ALIGNMENT)
+#define BUFFER_ALIGN(adr) ((ALIGNMENT - ((uintptr_t)adr)) % ALIGNMENT)
 
 #ifdef __BIG_ENDIAN
 #define xemaclite_readl                ioread32be
@@ -338,7 +338,7 @@ static int xemaclite_send_data(struct net_local *drvdata, u8 *data,
                 * if it is configured in HW
                 */
 
-               addr = (void __iomem __force *)((u32 __force)addr ^
+               addr = (void __iomem __force *)((uintptr_t __force)addr ^
                                                 XEL_BUFFER_OFFSET);
                reg_data = xemaclite_readl(addr + XEL_TSR_OFFSET);
 
@@ -399,8 +399,9 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data, int maxlen)
                 * will correct on subsequent calls
                 */
                if (drvdata->rx_ping_pong != 0)
-                       addr = (void __iomem __force *)((u32 __force)addr ^
-                                                        XEL_BUFFER_OFFSET);
+                       addr = (void __iomem __force *)
+                               ((uintptr_t __force)addr ^
+                                XEL_BUFFER_OFFSET);
                else
                        return 0;       /* No data was available */
 
@@ -518,6 +519,7 @@ static int xemaclite_set_mac_address(struct net_device *dev, void *address)
 /**
  * xemaclite_tx_timeout - Callback for Tx Timeout
  * @dev:       Pointer to the network device
+ * @txqueue:   Unused
  *
  * This function is called when Tx time out occurs for Emaclite device.
  */
@@ -1191,9 +1193,9 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
        }
 
        dev_info(dev,
-                "Xilinx EmacLite at 0x%08X mapped to 0x%08X, irq=%d\n",
+                "Xilinx EmacLite at 0x%08X mapped to 0x%08lX, irq=%d\n",
                 (unsigned int __force)ndev->mem_start,
-                (unsigned int __force)lp->base_addr, ndev->irq);
+                (unsigned long __force)lp->base_addr, ndev->irq);
        return 0;
 
 error:
index cc9ac57..e9b9614 100644 (file)
 #include <linux/bitrev.h>
 #include <linux/pci.h>
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)drvfbi.c    1.63 99/02/11 (C) SK " ;
-#endif
-
 /*
  * PCM active state
  */
index 15c503f..2f5f5f2 100644 (file)
 #define KERNEL
 #include "h/smtstate.h"
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)ecm.c       2.7 99/08/05 (C) SK " ;
-#endif
-
 /*
  * FSM Macros
  */
@@ -147,10 +143,11 @@ static void ecm_fsm(struct s_smc *smc, int cmd)
        /* For AIX event notification: */
        /* Is a disconnect  command remotely issued ? */
        if (cmd == EC_DISCONNECT &&
-               smc->mib.fddiSMTRemoteDisconnectFlag == TRUE)
+           smc->mib.fddiSMTRemoteDisconnectFlag == TRUE) {
                AIX_EVENT (smc, (u_long) CIO_HARD_FAIL, (u_long)
                        FDDI_REMOTE_DISCONNECT, smt_get_event_word(smc),
                        smt_get_error_word(smc) );
+       }
 
        /*jd 05-Aug-1999 Bug #10419 "Port Disconnect fails at Dup MAc Cond."*/
        if (cmd == EC_CONNECT) {
index afd5ca3..35110c0 100644 (file)
@@ -40,7 +40,6 @@
 #ifdef ESS
 
 #ifndef lint
-static const char ID_sccs[] = "@(#)ess.c       1.10 96/02/23 (C) SK" ;
 #define LINT_USE(x)
 #else
 #define LINT_USE(x)    (x)=(x)
index 32804ed..5577b8e 100644 (file)
 #include "h/fddi.h"
 #include "h/smc.h"
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)hwt.c       1.13 97/04/23 (C) SK " ;
-#endif
-
 /*
  * Prototypes of local functions.
  */
index 554cde8..90e8df6 100644 (file)
 #define KERNEL
 #include "h/smtstate.h"
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)pcmplc.c    2.55 99/08/05 (C) SK " ;
-#endif
-
 #ifdef FDDI_MIB
 extern int snmp_fddi_trap(
 #ifdef ANSIC
index 14f10b4..563fb7f 100644 (file)
 
 #ifndef        SLIM_SMT
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)pmf.c       1.37 97/08/04 (C) SK " ;
-#endif
-
 static int smt_authorize(struct s_smc *smc, struct smt_header *sm);
 static int smt_check_set_count(struct s_smc *smc, struct smt_header *sm);
 static const struct s_p_tab* smt_get_ptab(u_short para);
index ba022f7..abe155a 100644 (file)
 #include "h/fddi.h"
 #include "h/smc.h"
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)queue.c     2.9 97/08/04 (C) SK " ;
-#endif
-
 #define PRINTF(a,b,c)
 
 /*
index c0e62c2..37a8967 100644 (file)
 #define KERNEL
 #include "h/smtstate.h"
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)rmt.c       2.13 99/07/02 (C) SK " ;
-#endif
-
 /*
  * FSM Macros
  */
index 0bebde3..99cc9a5 100644 (file)
 #define OEM_USER_DATA  "SK-NET FDDI V2.0 Userdata"
 #endif
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)smtdef.c    2.53 99/08/11 (C) SK " ;
-#endif
-
 /*
  * defaults
  */
index 01f6c75..c9898c8 100644 (file)
 #include "h/fddi.h"
 #include "h/smc.h"
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)smtinit.c   1.15 97/05/06 (C) SK " ;
-#endif
-
 void init_fddi_driver(struct s_smc *smc, u_char *mac_addr);
 
 /* define global debug variable */
index 9d549bb..5f3e5d7 100644 (file)
 #include "h/fddi.h"
 #include "h/smc.h"
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)smttimer.c  2.4 97/08/04 (C) SK " ;
-#endif
-
 static void timer_done(struct s_smc *smc, int restart);
 
 void smt_timer_init(struct s_smc *smc)
index f98d060..4cad68c 100644 (file)
 #ifndef        SLIM_SMT
 #ifndef        BOOT
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)srf.c       1.18 97/08/04 (C) SK " ;
-#endif
-
-
 /*
  * function declarations
  */
index d07008a..a3c8ce6 100644 (file)
@@ -1138,7 +1138,7 @@ static const struct net_device_ops geneve_netdev_ops = {
        .ndo_open               = geneve_open,
        .ndo_stop               = geneve_stop,
        .ndo_start_xmit         = geneve_xmit,
-       .ndo_get_stats64        = ip_tunnel_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_change_mtu         = geneve_change_mtu,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
index 030a1a5..4c04e27 100644 (file)
@@ -607,7 +607,7 @@ static const struct net_device_ops gtp_netdev_ops = {
        .ndo_init               = gtp_dev_init,
        .ndo_uninit             = gtp_dev_uninit,
        .ndo_start_xmit         = gtp_dev_xmit,
-       .ndo_get_stats64        = ip_tunnel_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
 };
 
 static void gtp_link_setup(struct net_device *dev)
@@ -657,10 +657,6 @@ static int gtp_newlink(struct net *src_net, struct net_device *dev,
 
        gtp = netdev_priv(dev);
 
-       err = gtp_encap_enable(gtp, data);
-       if (err < 0)
-               return err;
-
        if (!data[IFLA_GTP_PDP_HASHSIZE]) {
                hashsize = 1024;
        } else {
@@ -671,12 +667,16 @@ static int gtp_newlink(struct net *src_net, struct net_device *dev,
 
        err = gtp_hashtable_new(gtp, hashsize);
        if (err < 0)
-               goto out_encap;
+               return err;
+
+       err = gtp_encap_enable(gtp, data);
+       if (err < 0)
+               goto out_hashtable;
 
        err = register_netdevice(dev);
        if (err < 0) {
                netdev_dbg(dev, "failed to register new netdev %d\n", err);
-               goto out_hashtable;
+               goto out_encap;
        }
 
        gn = net_generic(dev_net(dev), gtp_net_id);
@@ -687,11 +687,11 @@ static int gtp_newlink(struct net *src_net, struct net_device *dev,
 
        return 0;
 
+out_encap:
+       gtp_encap_disable(gtp);
 out_hashtable:
        kfree(gtp->addr_hash);
        kfree(gtp->tid_hash);
-out_encap:
-       gtp_encap_disable(gtp);
        return err;
 }
 
index e7413a6..9e00581 100644 (file)
@@ -597,7 +597,7 @@ static int hdlcdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 
        case HDLCDRVCTL_DRIVERNAME:
                if (s->ops && s->ops->drvname) {
-                       strncpy(bi.data.drivername, s->ops->drvname, 
+                       strlcpy(bi.data.drivername, s->ops->drvname,
                                sizeof(bi.data.drivername));
                        break;
                }
index 4eb6470..3a2824f 100644 (file)
@@ -316,6 +316,7 @@ struct cas_control {
  * struct ca8210_test - ca8210 test interface structure
  * @ca8210_dfs_spi_int: pointer to the entry in the debug fs for this device
  * @up_fifo:            fifo for upstream messages
+ * @readq:              read wait queue
  *
  * This structure stores all the data pertaining to the debug interface
  */
@@ -346,12 +347,12 @@ struct ca8210_test {
  * @ca8210_is_awake:        nonzero if ca8210 is initialised, ready for comms
  * @sync_down:              counts number of downstream synchronous commands
  * @sync_up:                counts number of upstream synchronous commands
- * @spi_transfer_complete   completion object for a single spi_transfer
- * @sync_exchange_complete  completion object for a complete synchronous API
- *                           exchange
- * @promiscuous             whether the ca8210 is in promiscuous mode or not
+ * @spi_transfer_complete:  completion object for a single spi_transfer
+ * @sync_exchange_complete: completion object for a complete synchronous API
+ *                          exchange
+ * @promiscuous:            whether the ca8210 is in promiscuous mode or not
  * @retries:                records how many times the current pending spi
- *                           transfer has been retried
+ *                          transfer has been retried
  */
 struct ca8210_priv {
        struct spi_device *spi;
@@ -420,8 +421,8 @@ struct fulladdr {
 
 /**
  * union macaddr: generic MAC address container
- * @short_addr:   16-bit short address
- * @ieee_address: 64-bit extended address as LE byte array
+ * @short_address: 16-bit short address
+ * @ieee_address:  64-bit extended address as LE byte array
  *
  */
 union macaddr {
@@ -714,7 +715,7 @@ static void ca8210_mlme_reset_worker(struct work_struct *work)
 /**
  * ca8210_rx_done() - Calls various message dispatches responding to a received
  *                    command
- * @arg:  Pointer to the cas_control object for the relevant spi transfer
+ * @cas_ctl: Pointer to the cas_control object for the relevant spi transfer
  *
  * Presents a received SAP command from the ca8210 to the Cascoda EVBME, test
  * interface and network driver.
@@ -1277,7 +1278,6 @@ static u8 tdme_channelinit(u8 channel, void *device_ref)
  * @pib_attribute:        Attribute Number
  * @pib_attribute_length: Attribute length
  * @pib_attribute_value:  Pointer to Attribute Value
- * @device_ref:           Nondescript pointer to target device
  *
  * Return: 802.15.4 status code of checks
  */
@@ -3046,7 +3046,7 @@ static void ca8210_test_interface_clear(struct ca8210_priv *priv)
 
 /**
  * ca8210_remove() - Shut down a ca8210 upon being disconnected
- * @priv:  Pointer to private data structure
+ * @spi_device:  Pointer to spi device data structure
  *
  * Return: 0 or linux error code
  */
@@ -3096,7 +3096,7 @@ static int ca8210_remove(struct spi_device *spi_device)
 
 /**
  * ca8210_probe() - Set up a connected ca8210 upon being detected by the system
- * @priv:  Pointer to private data structure
+ * @spi_device:  Pointer to spi device data structure
  *
  * Return: 0 or linux error code
  */
index 7fe306e..fa63d4d 100644 (file)
@@ -187,8 +187,7 @@ static const struct net_device_ops ifb_netdev_ops = {
 };
 
 #define IFB_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG  | NETIF_F_FRAGLIST | \
-                     NETIF_F_TSO_ECN | NETIF_F_TSO | NETIF_F_TSO6      | \
-                     NETIF_F_GSO_ENCAP_ALL                             | \
+                     NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ENCAP_ALL      | \
                      NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX         | \
                      NETIF_F_HW_VLAN_STAG_TX)
 
index 6bfac1e..5515196 100644 (file)
@@ -21,6 +21,7 @@
 #include "gsi_trans.h"
 #include "ipa_gsi.h"
 #include "ipa_data.h"
+#include "ipa_version.h"
 
 /**
  * DOC: The IPA Generic Software Interface
@@ -108,62 +109,6 @@ struct gsi_event {
        u8 chid;
 };
 
-/* Hardware values from the error log register error code field */
-enum gsi_err_code {
-       GSI_INVALID_TRE_ERR                     = 0x1,
-       GSI_OUT_OF_BUFFERS_ERR                  = 0x2,
-       GSI_OUT_OF_RESOURCES_ERR                = 0x3,
-       GSI_UNSUPPORTED_INTER_EE_OP_ERR         = 0x4,
-       GSI_EVT_RING_EMPTY_ERR                  = 0x5,
-       GSI_NON_ALLOCATED_EVT_ACCESS_ERR        = 0x6,
-       GSI_HWO_1_ERR                           = 0x8,
-};
-
-/* Hardware values from the error log register error type field */
-enum gsi_err_type {
-       GSI_ERR_TYPE_GLOB       = 0x1,
-       GSI_ERR_TYPE_CHAN       = 0x2,
-       GSI_ERR_TYPE_EVT        = 0x3,
-};
-
-/* Hardware values used when programming an event ring */
-enum gsi_evt_chtype {
-       GSI_EVT_CHTYPE_MHI_EV   = 0x0,
-       GSI_EVT_CHTYPE_XHCI_EV  = 0x1,
-       GSI_EVT_CHTYPE_GPI_EV   = 0x2,
-       GSI_EVT_CHTYPE_XDCI_EV  = 0x3,
-};
-
-/* Hardware values used when programming a channel */
-enum gsi_channel_protocol {
-       GSI_CHANNEL_PROTOCOL_MHI        = 0x0,
-       GSI_CHANNEL_PROTOCOL_XHCI       = 0x1,
-       GSI_CHANNEL_PROTOCOL_GPI        = 0x2,
-       GSI_CHANNEL_PROTOCOL_XDCI       = 0x3,
-};
-
-/* Hardware values representing an event ring immediate command opcode */
-enum gsi_evt_cmd_opcode {
-       GSI_EVT_ALLOCATE        = 0x0,
-       GSI_EVT_RESET           = 0x9,
-       GSI_EVT_DE_ALLOC        = 0xa,
-};
-
-/* Hardware values representing a generic immediate command opcode */
-enum gsi_generic_cmd_opcode {
-       GSI_GENERIC_HALT_CHANNEL        = 0x1,
-       GSI_GENERIC_ALLOCATE_CHANNEL    = 0x2,
-};
-
-/* Hardware values representing a channel immediate command opcode */
-enum gsi_ch_cmd_opcode {
-       GSI_CH_ALLOCATE = 0x0,
-       GSI_CH_START    = 0x1,
-       GSI_CH_STOP     = 0x2,
-       GSI_CH_RESET    = 0x9,
-       GSI_CH_DE_ALLOC = 0xa,
-};
-
 /** gsi_channel_scratch_gpi - GPI protocol scratch register
  * @max_outstanding_tre:
  *     Defines the maximum number of TREs allowed in a single transaction
@@ -229,21 +174,70 @@ static u32 gsi_channel_id(struct gsi_channel *channel)
        return channel - &channel->gsi->channel[0];
 }
 
+/* Update the GSI IRQ type register with the cached value */
+static void gsi_irq_type_update(struct gsi *gsi, u32 val)
+{
+       gsi->type_enabled_bitmap = val;
+       iowrite32(val, gsi->virt + GSI_CNTXT_TYPE_IRQ_MSK_OFFSET);
+}
+
+static void gsi_irq_type_enable(struct gsi *gsi, enum gsi_irq_type_id type_id)
+{
+       gsi_irq_type_update(gsi, gsi->type_enabled_bitmap | BIT(type_id));
+}
+
+static void gsi_irq_type_disable(struct gsi *gsi, enum gsi_irq_type_id type_id)
+{
+       gsi_irq_type_update(gsi, gsi->type_enabled_bitmap & ~BIT(type_id));
+}
+
+/* Turn off all GSI interrupts initially */
+static void gsi_irq_setup(struct gsi *gsi)
+{
+       /* Disable all interrupt types */
+       gsi_irq_type_update(gsi, 0);
+
+       /* Clear all type-specific interrupt masks */
+       iowrite32(0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET);
+       iowrite32(0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET);
+       iowrite32(0, gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET);
+       iowrite32(0, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET);
+       iowrite32(0, gsi->virt + GSI_INTER_EE_SRC_CH_IRQ_OFFSET);
+       iowrite32(0, gsi->virt + GSI_INTER_EE_SRC_EV_CH_IRQ_OFFSET);
+       iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET);
+}
+
+/* Turn off all GSI interrupts when we're all done */
+static void gsi_irq_teardown(struct gsi *gsi)
+{
+       /* Nothing to do */
+}
+
 static void gsi_irq_ieob_enable(struct gsi *gsi, u32 evt_ring_id)
 {
+       bool enable_ieob = !gsi->ieob_enabled_bitmap;
        u32 val;
 
-       gsi->event_enable_bitmap |= BIT(evt_ring_id);
-       val = gsi->event_enable_bitmap;
+       gsi->ieob_enabled_bitmap |= BIT(evt_ring_id);
+       val = gsi->ieob_enabled_bitmap;
        iowrite32(val, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET);
+
+       /* Enable the interrupt type if this is the first channel enabled */
+       if (enable_ieob)
+               gsi_irq_type_enable(gsi, GSI_IEOB);
 }
 
 static void gsi_irq_ieob_disable(struct gsi *gsi, u32 evt_ring_id)
 {
        u32 val;
 
-       gsi->event_enable_bitmap &= ~BIT(evt_ring_id);
-       val = gsi->event_enable_bitmap;
+       gsi->ieob_enabled_bitmap &= ~BIT(evt_ring_id);
+
+       /* Disable the interrupt type if this was the last enabled channel */
+       if (!gsi->ieob_enabled_bitmap)
+               gsi_irq_type_disable(gsi, GSI_IEOB);
+
+       val = gsi->ieob_enabled_bitmap;
        iowrite32(val, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET);
 }
 
@@ -252,38 +246,32 @@ static void gsi_irq_enable(struct gsi *gsi)
 {
        u32 val;
 
-       /* We don't use inter-EE channel or event interrupts */
-       val = GSI_CNTXT_TYPE_IRQ_MSK_ALL;
-       val &= ~INTER_EE_CH_CTRL_FMASK;
-       val &= ~INTER_EE_EV_CTRL_FMASK;
-       iowrite32(val, gsi->virt + GSI_CNTXT_TYPE_IRQ_MSK_OFFSET);
-
-       val = GENMASK(gsi->channel_count - 1, 0);
-       iowrite32(val, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET);
-
-       val = GENMASK(gsi->evt_ring_count - 1, 0);
-       iowrite32(val, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET);
-
-       /* Each IEOB interrupt is enabled (later) as needed by channels */
-       iowrite32(0, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET);
-
-       val = GSI_CNTXT_GLOB_IRQ_ALL;
-       iowrite32(val, gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET);
+       /* Global interrupts include hardware error reports.  Enable
+        * that so we can at least report the error should it occur.
+        */
+       iowrite32(BIT(ERROR_INT), gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET);
+       gsi_irq_type_update(gsi, gsi->type_enabled_bitmap | BIT(GSI_GLOB_EE));
 
-       /* Never enable GSI_BREAK_POINT */
-       val = GSI_CNTXT_GSI_IRQ_ALL & ~BREAK_POINT_FMASK;
+       /* General GSI interrupts are reported to all EEs; if they occur
+        * they are unrecoverable (without reset).  A breakpoint interrupt
+        * also exists, but we don't support that.  We want to be notified
+        * of errors so we can report them, even if they can't be handled.
+        */
+       val = BIT(BUS_ERROR);
+       val |= BIT(CMD_FIFO_OVRFLOW);
+       val |= BIT(MCS_STACK_OVRFLOW);
        iowrite32(val, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET);
+       gsi_irq_type_update(gsi, gsi->type_enabled_bitmap | BIT(GSI_GENERAL));
 }
 
-/* Disable all GSI_interrupt types */
+/* Disable all GSI interrupt types */
 static void gsi_irq_disable(struct gsi *gsi)
 {
+       gsi_irq_type_update(gsi, 0);
+
+       /* Clear the type-specific interrupt masks set by gsi_irq_enable() */
        iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET);
        iowrite32(0, gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET);
-       iowrite32(0, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET);
-       iowrite32(0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET);
-       iowrite32(0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET);
-       iowrite32(0, gsi->virt + GSI_CNTXT_TYPE_IRQ_MSK_OFFSET);
 }
 
 /* Return the virtual address associated with a ring index */
@@ -337,13 +325,30 @@ static int evt_ring_command(struct gsi *gsi, u32 evt_ring_id,
        struct gsi_evt_ring *evt_ring = &gsi->evt_ring[evt_ring_id];
        struct completion *completion = &evt_ring->completion;
        struct device *dev = gsi->dev;
+       bool success;
        u32 val;
 
+       /* We only perform one event ring command at a time, and event
+        * control interrupts should only occur when such a command
+        * is issued here.  Only permit *this* event ring to trigger
+        * an interrupt, and only enable the event control IRQ type
+        * when we expect it to occur.
+        */
+       val = BIT(evt_ring_id);
+       iowrite32(val, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET);
+       gsi_irq_type_enable(gsi, GSI_EV_CTRL);
+
        val = u32_encode_bits(evt_ring_id, EV_CHID_FMASK);
        val |= u32_encode_bits(opcode, EV_OPCODE_FMASK);
 
-       if (gsi_command(gsi, GSI_EV_CH_CMD_OFFSET, val, completion))
-               return 0;       /* Success! */
+       success = gsi_command(gsi, GSI_EV_CH_CMD_OFFSET, val, completion);
+
+       /* Disable the interrupt again */
+       gsi_irq_type_disable(gsi, GSI_EV_CTRL);
+       iowrite32(0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET);
+
+       if (success)
+               return 0;
 
        dev_err(dev, "GSI command %u for event ring %u timed out, state %u\n",
                opcode, evt_ring_id, evt_ring->state);
@@ -433,13 +438,29 @@ gsi_channel_command(struct gsi_channel *channel, enum gsi_ch_cmd_opcode opcode)
        u32 channel_id = gsi_channel_id(channel);
        struct gsi *gsi = channel->gsi;
        struct device *dev = gsi->dev;
+       bool success;
        u32 val;
 
+       /* We only perform one channel command at a time, and channel
+        * control interrupts should only occur when such a command is
+        * issued here.  So we only permit *this* channel to trigger
+        * an interrupt and only enable the channel control IRQ type
+        * when we expect it to occur.
+        */
+       val = BIT(channel_id);
+       iowrite32(val, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET);
+       gsi_irq_type_enable(gsi, GSI_CH_CTRL);
+
        val = u32_encode_bits(channel_id, CH_CHID_FMASK);
        val |= u32_encode_bits(opcode, CH_OPCODE_FMASK);
+       success = gsi_command(gsi, GSI_CH_CMD_OFFSET, val, completion);
 
-       if (gsi_command(gsi, GSI_CH_CMD_OFFSET, val, completion))
-               return 0;       /* Success! */
+       /* Disable the interrupt again */
+       gsi_irq_type_disable(gsi, GSI_CH_CTRL);
+       iowrite32(0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET);
+
+       if (success)
+               return 0;
 
        dev_err(dev, "GSI command %u for channel %u timed out, state %u\n",
                opcode, channel_id, gsi_channel_state(channel));
@@ -607,7 +628,8 @@ static void gsi_evt_ring_program(struct gsi *gsi, u32 evt_ring_id)
        size_t size = evt_ring->ring.count * GSI_RING_ELEMENT_SIZE;
        u32 val;
 
-       val = u32_encode_bits(GSI_EVT_CHTYPE_GPI_EV, EV_CHTYPE_FMASK);
+       /* We program all event rings as GPI type/protocol */
+       val = u32_encode_bits(GSI_CHANNEL_TYPE_GPI, EV_CHTYPE_FMASK);
        val |= EV_INTYPE_FMASK;
        val |= u32_encode_bits(GSI_RING_ELEMENT_SIZE, EV_ELEMENT_SIZE_FMASK);
        iowrite32(val, gsi->virt + GSI_EV_CH_E_CNTXT_0_OFFSET(evt_ring_id));
@@ -714,8 +736,8 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell)
        /* Arbitrarily pick TRE 0 as the first channel element to use */
        channel->tre_ring.index = 0;
 
-       /* We program all channels to use GPI protocol */
-       val = u32_encode_bits(GSI_CHANNEL_PROTOCOL_GPI, CHTYPE_PROTOCOL_FMASK);
+       /* We program all channels as GPI type/protocol */
+       val = u32_encode_bits(GSI_CHANNEL_TYPE_GPI, CHTYPE_PROTOCOL_FMASK);
        if (channel->toward_ipa)
                val |= CHTYPE_DIR_FMASK;
        val |= u32_encode_bits(channel->evt_ring_id, ERINDEX_FMASK);
@@ -742,11 +764,12 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell)
 
        /* Max prefetch is 1 segment (do not set MAX_PREFETCH_FMASK) */
 
-       /* Enable the doorbell engine if requested */
-       if (doorbell)
+       /* We enable the doorbell engine for IPA v3.5.1 */
+       if (gsi->version == IPA_VERSION_3_5_1 && doorbell)
                val |= USE_DB_ENG_FMASK;
 
-       if (!channel->use_prefetch)
+       /* Starting with IPA v4.0 the command channel uses the escape buffer */
+       if (gsi->version != IPA_VERSION_3_5_1 && channel->command)
                val |= USE_ESCAPE_BUF_ONLY_FMASK;
 
        iowrite32(val, gsi->virt + GSI_CH_C_QOS_OFFSET(channel_id));
@@ -829,8 +852,8 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id)
        return ret;
 }
 
-/* Reset and reconfigure a channel (possibly leaving doorbell disabled) */
-void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool legacy)
+/* Reset and reconfigure a channel, (possibly) enabling the doorbell engine */
+void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell)
 {
        struct gsi_channel *channel = &gsi->channel[channel_id];
 
@@ -838,10 +861,10 @@ void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool legacy)
 
        gsi_channel_reset_command(channel);
        /* Due to a hardware quirk we may need to reset RX channels twice. */
-       if (legacy && !channel->toward_ipa)
+       if (gsi->version == IPA_VERSION_3_5_1 && !channel->toward_ipa)
                gsi_channel_reset_command(channel);
 
-       gsi_channel_program(channel, legacy);
+       gsi_channel_program(channel, doorbell);
        gsi_channel_trans_cancel_pending(channel);
 
        mutex_unlock(&gsi->mutex);
@@ -989,7 +1012,7 @@ static void gsi_isr_evt_ctrl(struct gsi *gsi)
 static void
 gsi_isr_glob_chan_err(struct gsi *gsi, u32 err_ee, u32 channel_id, u32 code)
 {
-       if (code == GSI_OUT_OF_RESOURCES_ERR) {
+       if (code == GSI_OUT_OF_RESOURCES) {
                dev_err(gsi->dev, "channel %u out of resources\n", channel_id);
                complete(&gsi->channel[channel_id].completion);
                return;
@@ -1004,7 +1027,7 @@ gsi_isr_glob_chan_err(struct gsi *gsi, u32 err_ee, u32 channel_id, u32 code)
 static void
 gsi_isr_glob_evt_err(struct gsi *gsi, u32 err_ee, u32 evt_ring_id, u32 code)
 {
-       if (code == GSI_OUT_OF_RESOURCES_ERR) {
+       if (code == GSI_OUT_OF_RESOURCES) {
                struct gsi_evt_ring *evt_ring = &gsi->evt_ring[evt_ring_id];
                u32 channel_id = gsi_channel_id(evt_ring->channel);
 
@@ -1034,8 +1057,8 @@ static void gsi_isr_glob_err(struct gsi *gsi)
        iowrite32(~0, gsi->virt + GSI_ERROR_LOG_CLR_OFFSET);
 
        ee = u32_get_bits(val, ERR_EE_FMASK);
-       which = u32_get_bits(val, ERR_VIRT_IDX_FMASK);
        type = u32_get_bits(val, ERR_TYPE_FMASK);
+       which = u32_get_bits(val, ERR_VIRT_IDX_FMASK);
        code = u32_get_bits(val, ERR_CODE_FMASK);
 
        if (type == GSI_ERR_TYPE_CHAN)
@@ -1054,7 +1077,7 @@ static void gsi_isr_gp_int1(struct gsi *gsi)
 
        val = ioread32(gsi->virt + GSI_CNTXT_SCRATCH_0_OFFSET);
        result = u32_get_bits(val, GENERIC_EE_RESULT_FMASK);
-       if (result != GENERIC_EE_SUCCESS_FVAL)
+       if (result != GENERIC_EE_SUCCESS)
                dev_err(gsi->dev, "global INT1 generic result %u\n", result);
 
        complete(&gsi->completion);
@@ -1067,15 +1090,15 @@ static void gsi_isr_glob_ee(struct gsi *gsi)
 
        val = ioread32(gsi->virt + GSI_CNTXT_GLOB_IRQ_STTS_OFFSET);
 
-       if (val & ERROR_INT_FMASK)
+       if (val & BIT(ERROR_INT))
                gsi_isr_glob_err(gsi);
 
        iowrite32(val, gsi->virt + GSI_CNTXT_GLOB_IRQ_CLR_OFFSET);
 
-       val &= ~ERROR_INT_FMASK;
+       val &= ~BIT(ERROR_INT);
 
-       if (val & GP_INT1_FMASK) {
-               val ^= GP_INT1_FMASK;
+       if (val & BIT(GP_INT1)) {
+               val ^= BIT(GP_INT1);
                gsi_isr_gp_int1(gsi);
        }
 
@@ -1110,8 +1133,7 @@ static void gsi_isr_general(struct gsi *gsi)
        val = ioread32(gsi->virt + GSI_CNTXT_GSI_IRQ_STTS_OFFSET);
        iowrite32(val, gsi->virt + GSI_CNTXT_GSI_IRQ_CLR_OFFSET);
 
-       if (val)
-               dev_err(dev, "unexpected general interrupt 0x%08x\n", val);
+       dev_err(dev, "unexpected general interrupt 0x%08x\n", val);
 }
 
 /**
@@ -1128,6 +1150,7 @@ static irqreturn_t gsi_isr(int irq, void *dev_id)
        u32 intr_mask;
        u32 cnt = 0;
 
+       /* enum gsi_irq_type_id defines GSI interrupt types */
        while ((intr_mask = ioread32(gsi->virt + GSI_CNTXT_TYPE_IRQ_OFFSET))) {
                /* intr_mask contains bitmask of pending GSI interrupts */
                do {
@@ -1136,19 +1159,19 @@ static irqreturn_t gsi_isr(int irq, void *dev_id)
                        intr_mask ^= gsi_intr;
 
                        switch (gsi_intr) {
-                       case CH_CTRL_FMASK:
+                       case BIT(GSI_CH_CTRL):
                                gsi_isr_chan_ctrl(gsi);
                                break;
-                       case EV_CTRL_FMASK:
+                       case BIT(GSI_EV_CTRL):
                                gsi_isr_evt_ctrl(gsi);
                                break;
-                       case GLOB_EE_FMASK:
+                       case BIT(GSI_GLOB_EE):
                                gsi_isr_glob_ee(gsi);
                                break;
-                       case IEOB_FMASK:
+                       case BIT(GSI_IEOB):
                                gsi_isr_ieob(gsi);
                                break;
-                       case GENERAL_FMASK:
+                       case BIT(GSI_GENERAL):
                                gsi_isr_general(gsi);
                                break;
                        default:
@@ -1168,6 +1191,34 @@ static irqreturn_t gsi_isr(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
+static int gsi_irq_init(struct gsi *gsi, struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       unsigned int irq;
+       int ret;
+
+       ret = platform_get_irq_byname(pdev, "gsi");
+       if (ret <= 0) {
+               dev_err(dev, "DT error %d getting \"gsi\" IRQ property\n", ret);
+               return ret ? : -EINVAL;
+       }
+       irq = ret;
+
+       ret = request_irq(irq, gsi_isr, 0, "gsi", gsi);
+       if (ret) {
+               dev_err(dev, "error %d requesting \"gsi\" IRQ\n", ret);
+               return ret;
+       }
+       gsi->irq = irq;
+
+       return 0;
+}
+
+static void gsi_irq_exit(struct gsi *gsi)
+{
+       free_irq(gsi->irq, gsi);
+}
+
 /* Return the transaction associated with a transfer completion event */
 static struct gsi_trans *gsi_event_trans(struct gsi_channel *channel,
                                         struct gsi_event *event)
@@ -1452,8 +1503,7 @@ static void gsi_evt_ring_teardown(struct gsi *gsi)
 }
 
 /* Setup function for a single channel */
-static int gsi_channel_setup_one(struct gsi *gsi, u32 channel_id,
-                                bool legacy)
+static int gsi_channel_setup_one(struct gsi *gsi, u32 channel_id)
 {
        struct gsi_channel *channel = &gsi->channel[channel_id];
        u32 evt_ring_id = channel->evt_ring_id;
@@ -1472,7 +1522,7 @@ static int gsi_channel_setup_one(struct gsi *gsi, u32 channel_id,
        if (ret)
                goto err_evt_ring_de_alloc;
 
-       gsi_channel_program(channel, legacy);
+       gsi_channel_program(channel, true);
 
        if (channel->toward_ipa)
                netif_tx_napi_add(&gsi->dummy_dev, &channel->napi,
@@ -1511,8 +1561,19 @@ static int gsi_generic_command(struct gsi *gsi, u32 channel_id,
                               enum gsi_generic_cmd_opcode opcode)
 {
        struct completion *completion = &gsi->completion;
+       bool success;
        u32 val;
 
+       /* The error global interrupt type is always enabled (until we
+        * teardown), so we won't change that.  A generic EE command
+        * completes with a GSI global interrupt of type GP_INT1.  We
+        * only perform one generic command at a time (to allocate or
+        * halt a modem channel) and only from this function.  So we
+        * enable the GP_INT1 IRQ type here while we're expecting it.
+        */
+       val = BIT(ERROR_INT) | BIT(GP_INT1);
+       iowrite32(val, gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET);
+
        /* First zero the result code field */
        val = ioread32(gsi->virt + GSI_CNTXT_SCRATCH_0_OFFSET);
        val &= ~GENERIC_EE_RESULT_FMASK;
@@ -1523,8 +1584,13 @@ static int gsi_generic_command(struct gsi *gsi, u32 channel_id,
        val |= u32_encode_bits(channel_id, GENERIC_CHID_FMASK);
        val |= u32_encode_bits(GSI_EE_MODEM, GENERIC_EE_FMASK);
 
-       if (gsi_command(gsi, GSI_GENERIC_CMD_OFFSET, val, completion))
-               return 0;       /* Success! */
+       success = gsi_command(gsi, GSI_GENERIC_CMD_OFFSET, val, completion);
+
+       /* Disable the GP_INT1 IRQ type again */
+       iowrite32(BIT(ERROR_INT), gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET);
+
+       if (success)
+               return 0;
 
        dev_err(gsi->dev, "GSI generic command %u to channel %u timed out\n",
                opcode, channel_id);
@@ -1540,16 +1606,11 @@ static int gsi_modem_channel_alloc(struct gsi *gsi, u32 channel_id)
 
 static void gsi_modem_channel_halt(struct gsi *gsi, u32 channel_id)
 {
-       int ret;
-
-       ret = gsi_generic_command(gsi, channel_id, GSI_GENERIC_HALT_CHANNEL);
-       if (ret)
-               dev_err(gsi->dev, "error %d halting modem channel %u\n",
-                       ret, channel_id);
+       (void)gsi_generic_command(gsi, channel_id, GSI_GENERIC_HALT_CHANNEL);
 }
 
 /* Setup function for channels */
-static int gsi_channel_setup(struct gsi *gsi, bool legacy)
+static int gsi_channel_setup(struct gsi *gsi)
 {
        u32 channel_id = 0;
        u32 mask;
@@ -1561,7 +1622,7 @@ static int gsi_channel_setup(struct gsi *gsi, bool legacy)
        mutex_lock(&gsi->mutex);
 
        do {
-               ret = gsi_channel_setup_one(gsi, channel_id, legacy);
+               ret = gsi_channel_setup_one(gsi, channel_id);
                if (ret)
                        goto err_unwind;
        } while (++channel_id < gsi->channel_count);
@@ -1647,10 +1708,11 @@ static void gsi_channel_teardown(struct gsi *gsi)
 }
 
 /* Setup function for GSI.  GSI firmware must be loaded and initialized */
-int gsi_setup(struct gsi *gsi, bool legacy)
+int gsi_setup(struct gsi *gsi)
 {
        struct device *dev = gsi->dev;
        u32 val;
+       int ret;
 
        /* Here is where we first touch the GSI hardware */
        val = ioread32(gsi->virt + GSI_GSI_STATUS_OFFSET);
@@ -1659,6 +1721,8 @@ int gsi_setup(struct gsi *gsi, bool legacy)
                return -EIO;
        }
 
+       gsi_irq_setup(gsi);
+
        val = ioread32(gsi->virt + GSI_GSI_HW_PARAM_2_OFFSET);
 
        gsi->channel_count = u32_get_bits(val, NUM_CH_PER_EE_FMASK);
@@ -1691,13 +1755,18 @@ int gsi_setup(struct gsi *gsi, bool legacy)
        /* Writing 1 indicates IRQ interrupts; 0 would be MSI */
        iowrite32(1, gsi->virt + GSI_CNTXT_INTSET_OFFSET);
 
-       return gsi_channel_setup(gsi, legacy);
+       ret = gsi_channel_setup(gsi);
+       if (ret)
+               gsi_irq_teardown(gsi);
+
+       return ret;
 }
 
 /* Inverse of gsi_setup() */
 void gsi_teardown(struct gsi *gsi)
 {
        gsi_channel_teardown(gsi);
+       gsi_irq_teardown(gsi);
 }
 
 /* Initialize a channel's event ring */
@@ -1745,7 +1814,7 @@ static void gsi_evt_ring_init(struct gsi *gsi)
        u32 evt_ring_id = 0;
 
        gsi->event_bitmap = gsi_event_bitmap_init(GSI_EVT_RING_COUNT_MAX);
-       gsi->event_enable_bitmap = 0;
+       gsi->ieob_enabled_bitmap = 0;
        do
                init_completion(&gsi->evt_ring[evt_ring_id].completion);
        while (++evt_ring_id < GSI_EVT_RING_COUNT_MAX);
@@ -1814,7 +1883,7 @@ static bool gsi_channel_data_valid(struct gsi *gsi,
 /* Init function for a single channel */
 static int gsi_channel_init_one(struct gsi *gsi,
                                const struct ipa_gsi_endpoint_data *data,
-                               bool command, bool prefetch)
+                               bool command)
 {
        struct gsi_channel *channel;
        u32 tre_count;
@@ -1838,7 +1907,6 @@ static int gsi_channel_init_one(struct gsi *gsi,
        channel->gsi = gsi;
        channel->toward_ipa = data->toward_ipa;
        channel->command = command;
-       channel->use_prefetch = command && prefetch;
        channel->tlv_count = data->channel.tlv_count;
        channel->tre_count = tre_count;
        channel->event_count = data->channel.event_count;
@@ -1892,13 +1960,16 @@ static void gsi_channel_exit_one(struct gsi_channel *channel)
 }
 
 /* Init function for channels */
-static int gsi_channel_init(struct gsi *gsi, bool prefetch, u32 count,
-                           const struct ipa_gsi_endpoint_data *data,
-                           bool modem_alloc)
+static int gsi_channel_init(struct gsi *gsi, u32 count,
+                           const struct ipa_gsi_endpoint_data *data)
 {
+       bool modem_alloc;
        int ret = 0;
        u32 i;
 
+       /* IPA v4.2 requires the AP to allocate channels for the modem */
+       modem_alloc = gsi->version == IPA_VERSION_4_2;
+
        gsi_evt_ring_init(gsi);
 
        /* The endpoint data array is indexed by endpoint name */
@@ -1916,7 +1987,7 @@ static int gsi_channel_init(struct gsi *gsi, bool prefetch, u32 count,
                        continue;
                }
 
-               ret = gsi_channel_init_one(gsi, &data[i], command, prefetch);
+               ret = gsi_channel_init_one(gsi, &data[i], command);
                if (ret)
                        goto err_unwind;
        }
@@ -1952,19 +2023,19 @@ static void gsi_channel_exit(struct gsi *gsi)
 }
 
 /* Init function for GSI.  GSI hardware does not need to be "ready" */
-int gsi_init(struct gsi *gsi, struct platform_device *pdev, bool prefetch,
-            u32 count, const struct ipa_gsi_endpoint_data *data,
-            bool modem_alloc)
+int gsi_init(struct gsi *gsi, struct platform_device *pdev,
+            enum ipa_version version, u32 count,
+            const struct ipa_gsi_endpoint_data *data)
 {
        struct device *dev = &pdev->dev;
        struct resource *res;
        resource_size_t size;
-       unsigned int irq;
        int ret;
 
        gsi_validate_build();
 
        gsi->dev = dev;
+       gsi->version = version;
 
        /* The GSI layer performs NAPI on all endpoints.  NAPI requires a
         * network device structure, but the GSI layer does not have one,
@@ -1972,55 +2043,43 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, bool prefetch,
         */
        init_dummy_netdev(&gsi->dummy_dev);
 
-       ret = platform_get_irq_byname(pdev, "gsi");
-       if (ret <= 0) {
-               dev_err(dev, "DT error %d getting \"gsi\" IRQ property\n", ret);
-               return ret ? : -EINVAL;
-       }
-       irq = ret;
-
-       ret = request_irq(irq, gsi_isr, 0, "gsi", gsi);
-       if (ret) {
-               dev_err(dev, "error %d requesting \"gsi\" IRQ\n", ret);
-               return ret;
-       }
-       gsi->irq = irq;
-
        /* Get GSI memory range and map it */
        res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gsi");
        if (!res) {
                dev_err(dev, "DT error getting \"gsi\" memory property\n");
-               ret = -ENODEV;
-               goto err_free_irq;
+               return -ENODEV;
        }
 
        size = resource_size(res);
        if (res->start > U32_MAX || size > U32_MAX - res->start) {
                dev_err(dev, "DT memory resource \"gsi\" out of range\n");
-               ret = -EINVAL;
-               goto err_free_irq;
+               return -EINVAL;
        }
 
        gsi->virt = ioremap(res->start, size);
        if (!gsi->virt) {
                dev_err(dev, "unable to remap \"gsi\" memory\n");
-               ret = -ENOMEM;
-               goto err_free_irq;
+               return -ENOMEM;
        }
 
-       ret = gsi_channel_init(gsi, prefetch, count, data, modem_alloc);
+       init_completion(&gsi->completion);
+
+       ret = gsi_irq_init(gsi, pdev);
        if (ret)
                goto err_iounmap;
 
+       ret = gsi_channel_init(gsi, count, data);
+       if (ret)
+               goto err_irq_exit;
+
        mutex_init(&gsi->mutex);
-       init_completion(&gsi->completion);
 
        return 0;
 
+err_irq_exit:
+       gsi_irq_exit(gsi);
 err_iounmap:
        iounmap(gsi->virt);
-err_free_irq:
-       free_irq(gsi->irq, gsi);
 
        return ret;
 }
@@ -2030,7 +2089,7 @@ void gsi_exit(struct gsi *gsi)
 {
        mutex_destroy(&gsi->mutex);
        gsi_channel_exit(gsi);
-       free_irq(gsi->irq, gsi);
+       gsi_irq_exit(gsi);
        iounmap(gsi->virt);
 }
 
index 3f9f29d..7581257 100644 (file)
@@ -13,6 +13,8 @@
 #include <linux/platform_device.h>
 #include <linux/netdevice.h>
 
+#include "ipa_version.h"
+
 /* Maximum number of channels and event rings supported by the driver */
 #define GSI_CHANNEL_COUNT_MAX  17
 #define GSI_EVT_RING_COUNT_MAX 13
@@ -107,7 +109,6 @@ struct gsi_channel {
        struct gsi *gsi;
        bool toward_ipa;
        bool command;                   /* AP command TX channel or not */
-       bool use_prefetch;              /* use prefetch (else escape buf) */
 
        u8 tlv_count;                   /* # entries in TLV FIFO */
        u16 tre_count;
@@ -147,6 +148,7 @@ struct gsi_evt_ring {
 
 struct gsi {
        struct device *dev;             /* Same as IPA device */
+       enum ipa_version version;
        struct net_device dummy_dev;    /* needed for NAPI */
        void __iomem *virt;
        u32 irq;
@@ -154,9 +156,10 @@ struct gsi {
        u32 evt_ring_count;
        struct gsi_channel channel[GSI_CHANNEL_COUNT_MAX];
        struct gsi_evt_ring evt_ring[GSI_EVT_RING_COUNT_MAX];
-       u32 event_bitmap;
-       u32 event_enable_bitmap;
-       u32 modem_channel_bitmap;
+       u32 event_bitmap;               /* allocated event rings */
+       u32 modem_channel_bitmap;       /* modem channels to allocate */
+       u32 type_enabled_bitmap;        /* GSI IRQ types enabled */
+       u32 ieob_enabled_bitmap;        /* IEOB IRQ enabled (event rings) */
        struct completion completion;   /* for global EE commands */
        struct mutex mutex;             /* protects commands, programming */
 };
@@ -164,14 +167,13 @@ struct gsi {
 /**
  * gsi_setup() - Set up the GSI subsystem
  * @gsi:       Address of GSI structure embedded in an IPA structure
- * @legacy:    Set up for legacy hardware
  *
  * Return:     0 if successful, or a negative error code
  *
  * Performs initialization that must wait until the GSI hardware is
  * ready (including firmware loaded).
  */
-int gsi_setup(struct gsi *gsi, bool legacy);
+int gsi_setup(struct gsi *gsi);
 
 /**
  * gsi_teardown() - Tear down GSI subsystem
@@ -219,15 +221,15 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id);
  * gsi_channel_reset() - Reset an allocated GSI channel
  * @gsi:       GSI pointer
  * @channel_id:        Channel to be reset
- * @legacy:    Legacy behavior
+ * @doorbell:  Whether to (possibly) enable the doorbell engine
  *
- * Reset a channel and reconfigure it.  The @legacy flag indicates
- * that some steps should be done differently for legacy hardware.
+ * Reset a channel and reconfigure it.  The @doorbell flag indicates
+ * that the doorbell engine should be enabled if needed.
  *
  * GSI hardware relinquishes ownership of all pending receive buffer
  * transactions and they will complete with their cancelled flag set.
  */
-void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool legacy);
+void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell);
 
 int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop);
 int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start);
@@ -236,15 +238,18 @@ int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start);
  * gsi_init() - Initialize the GSI subsystem
  * @gsi:       Address of GSI structure embedded in an IPA structure
  * @pdev:      IPA platform device
+ * @version:   IPA hardware version (implies GSI version)
+ * @count:     Number of entries in the configuration data array
+ * @data:      Endpoint and channel configuration data
  *
  * Return:     0 if successful, or a negative error code
  *
  * Early stage initialization of the GSI subsystem, performing tasks
  * that can be done before the GSI hardware is ready to use.
  */
-int gsi_init(struct gsi *gsi, struct platform_device *pdev, bool prefetch,
-            u32 count, const struct ipa_gsi_endpoint_data *data,
-            bool modem_alloc);
+int gsi_init(struct gsi *gsi, struct platform_device *pdev,
+            enum ipa_version version, u32 count,
+            const struct ipa_gsi_endpoint_data *data);
 
 /**
  * gsi_exit() - Exit the GSI subsystem
index 8e0e935..8e3a7ff 100644 (file)
 #define CHTYPE_DIR_FMASK               GENMASK(3, 3)
 #define EE_FMASK                       GENMASK(7, 4)
 #define CHID_FMASK                     GENMASK(12, 8)
-/* The next field is present for GSI v2.0 and above */
+/* The next field is present for IPA v4.5 and above */
 #define CHTYPE_PROTOCOL_MSB_FMASK      GENMASK(13, 13)
 #define ERINDEX_FMASK                  GENMASK(18, 14)
 #define CHSTATE_FMASK                  GENMASK(23, 20)
 #define ELEMENT_SIZE_FMASK             GENMASK(31, 24)
+/** enum gsi_channel_type - CHTYPE_PROTOCOL field values in CH_C_CNTXT_0 */
+enum gsi_channel_type {
+       GSI_CHANNEL_TYPE_MHI                    = 0x0,
+       GSI_CHANNEL_TYPE_XHCI                   = 0x1,
+       GSI_CHANNEL_TYPE_GPI                    = 0x2,
+       GSI_CHANNEL_TYPE_XDCI                   = 0x3,
+};
 
 #define GSI_CH_C_CNTXT_1_OFFSET(ch) \
                GSI_EE_N_CH_C_CNTXT_1_OFFSET((ch), GSI_EE_AP)
 #define WRR_WEIGHT_FMASK               GENMASK(3, 0)
 #define MAX_PREFETCH_FMASK             GENMASK(8, 8)
 #define USE_DB_ENG_FMASK               GENMASK(9, 9)
-/* The next field is present for GSI v2.0 and above */
+/* The next field is only present for IPA v4.0, v4.1, and v4.2 */
 #define USE_ESCAPE_BUF_ONLY_FMASK      GENMASK(10, 10)
 
 #define GSI_CH_C_SCRATCH_0_OFFSET(ch) \
 #define EV_INTYPE_FMASK                        GENMASK(16, 16)
 #define EV_CHSTATE_FMASK               GENMASK(23, 20)
 #define EV_ELEMENT_SIZE_FMASK          GENMASK(31, 24)
+/* enum gsi_channel_type defines EV_CHTYPE field values in EV_CH_E_CNTXT_0 */
 
 #define GSI_EV_CH_E_CNTXT_1_OFFSET(ev) \
                GSI_EE_N_EV_CH_E_CNTXT_1_OFFSET((ev), GSI_EE_AP)
                        (0x0001f008 + 0x4000 * (ee))
 #define CH_CHID_FMASK                  GENMASK(7, 0)
 #define CH_OPCODE_FMASK                        GENMASK(31, 24)
+/** enum gsi_ch_cmd_opcode - CH_OPCODE field values in CH_CMD */
+enum gsi_ch_cmd_opcode {
+       GSI_CH_ALLOCATE                         = 0x0,
+       GSI_CH_START                            = 0x1,
+       GSI_CH_STOP                             = 0x2,
+       GSI_CH_RESET                            = 0x9,
+       GSI_CH_DE_ALLOC                         = 0xa,
+};
 
 #define GSI_EV_CH_CMD_OFFSET \
                        GSI_EE_N_EV_CH_CMD_OFFSET(GSI_EE_AP)
                        (0x0001f010 + 0x4000 * (ee))
 #define EV_CHID_FMASK                  GENMASK(7, 0)
 #define EV_OPCODE_FMASK                        GENMASK(31, 24)
+/** enum gsi_evt_cmd_opcode - EV_OPCODE field values in EV_CH_CMD */
+enum gsi_evt_cmd_opcode {
+       GSI_EVT_ALLOCATE                        = 0x0,
+       GSI_EVT_RESET                           = 0x9,
+       GSI_EVT_DE_ALLOC                        = 0xa,
+};
 
 #define GSI_GENERIC_CMD_OFFSET \
                        GSI_EE_N_GENERIC_CMD_OFFSET(GSI_EE_AP)
 #define GENERIC_OPCODE_FMASK           GENMASK(4, 0)
 #define GENERIC_CHID_FMASK             GENMASK(9, 5)
 #define GENERIC_EE_FMASK               GENMASK(13, 10)
+/** enum gsi_generic_cmd_opcode - GENERIC_OPCODE field values in GENERIC_CMD */
+enum gsi_generic_cmd_opcode {
+       GSI_GENERIC_HALT_CHANNEL                = 0x1,
+       GSI_GENERIC_ALLOCATE_CHANNEL            = 0x2,
+};
 
 #define GSI_GSI_HW_PARAM_2_OFFSET \
                        GSI_EE_N_GSI_HW_PARAM_2_OFFSET(GSI_EE_AP)
 #define GSI_EE_N_GSI_HW_PARAM_2_OFFSET(ee) \
                        (0x0001f040 + 0x4000 * (ee))
 #define IRAM_SIZE_FMASK                        GENMASK(2, 0)
-#define IRAM_SIZE_ONE_KB_FVAL                  0
-#define IRAM_SIZE_TWO_KB_FVAL                  1
-/* The next two values are available for GSI v2.0 and above */
-#define IRAM_SIZE_TWO_N_HALF_KB_FVAL           2
-#define IRAM_SIZE_THREE_KB_FVAL                        3
 #define NUM_CH_PER_EE_FMASK            GENMASK(7, 3)
 #define NUM_EV_PER_EE_FMASK            GENMASK(12, 8)
 #define GSI_CH_PEND_TRANSLATE_FMASK    GENMASK(13, 13)
 #define GSI_CH_FULL_LOGIC_FMASK                GENMASK(14, 14)
-/* Fields below are present for GSI v2.0 and above */
+/* Fields below are present for IPA v4.0 and above */
 #define GSI_USE_SDMA_FMASK             GENMASK(15, 15)
 #define GSI_SDMA_N_INT_FMASK           GENMASK(18, 16)
 #define GSI_SDMA_MAX_BURST_FMASK       GENMASK(26, 19)
 #define GSI_SDMA_N_IOVEC_FMASK         GENMASK(29, 27)
-/* Fields below are present for GSI v2.2 and above */
+/* Fields below are present for IPA v4.2 and above */
 #define GSI_USE_RD_WR_ENG_FMASK                GENMASK(30, 30)
 #define GSI_USE_INTER_EE_FMASK         GENMASK(31, 31)
-
+/** enum gsi_iram_size - IRAM_SIZE field values in HW_PARAM_2 */
+enum gsi_iram_size {
+       IRAM_SIZE_ONE_KB                        = 0x0,
+       IRAM_SIZE_TWO_KB                        = 0x1,
+/* The next two values are available for IPA v4.0 and above */
+       IRAM_SIZE_TWO_N_HALF_KB                 = 0x2,
+       IRAM_SIZE_THREE_KB                      = 0x3,
+};
+
+/* IRQ condition for each type is cleared by writing type-specific register */
 #define GSI_CNTXT_TYPE_IRQ_OFFSET \
                        GSI_EE_N_CNTXT_TYPE_IRQ_OFFSET(GSI_EE_AP)
 #define GSI_EE_N_CNTXT_TYPE_IRQ_OFFSET(ee) \
                        GSI_EE_N_CNTXT_TYPE_IRQ_MSK_OFFSET(GSI_EE_AP)
 #define GSI_EE_N_CNTXT_TYPE_IRQ_MSK_OFFSET(ee) \
                        (0x0001f088 + 0x4000 * (ee))
-/* The masks below are used for the TYPE_IRQ and TYPE_IRQ_MASK registers */
-#define CH_CTRL_FMASK                  GENMASK(0, 0)
-#define EV_CTRL_FMASK                  GENMASK(1, 1)
-#define GLOB_EE_FMASK                  GENMASK(2, 2)
-#define IEOB_FMASK                     GENMASK(3, 3)
-#define INTER_EE_CH_CTRL_FMASK         GENMASK(4, 4)
-#define INTER_EE_EV_CTRL_FMASK         GENMASK(5, 5)
-#define GENERAL_FMASK                  GENMASK(6, 6)
-#define GSI_CNTXT_TYPE_IRQ_MSK_ALL     GENMASK(6, 0)
+/* Values here are bit positions in the TYPE_IRQ and TYPE_IRQ_MSK registers */
+enum gsi_irq_type_id {
+       GSI_CH_CTRL             = 0,    /* channel allocation, etc.  */
+       GSI_EV_CTRL             = 1,    /* event ring allocation, etc. */
+       GSI_GLOB_EE             = 2,    /* global/general event */
+       GSI_IEOB                = 3,    /* TRE completion */
+       GSI_INTER_EE_CH_CTRL    = 4,    /* remote-issued stop/reset (unused) */
+       GSI_INTER_EE_EV_CTRL    = 5,    /* remote-issued event reset (unused) */
+       GSI_GENERAL             = 6,    /* general-purpose event */
+};
 
 #define GSI_CNTXT_SRC_CH_IRQ_OFFSET \
                        GSI_EE_N_CNTXT_SRC_CH_IRQ_OFFSET(GSI_EE_AP)
                        GSI_EE_N_CNTXT_GLOB_IRQ_CLR_OFFSET(GSI_EE_AP)
 #define GSI_EE_N_CNTXT_GLOB_IRQ_CLR_OFFSET(ee) \
                        (0x0001f110 + 0x4000 * (ee))
-/* The masks below are used for the general IRQ STTS, EN, and CLR registers */
-#define ERROR_INT_FMASK                        GENMASK(0, 0)
-#define GP_INT1_FMASK                  GENMASK(1, 1)
-#define GP_INT2_FMASK                  GENMASK(2, 2)
-#define GP_INT3_FMASK                  GENMASK(3, 3)
-#define GSI_CNTXT_GLOB_IRQ_ALL         GENMASK(3, 0)
+/* Values here are bit positions in the GLOB_IRQ_* registers */
+enum gsi_global_irq_id {
+       ERROR_INT                               = 0x0,
+       GP_INT1                                 = 0x1,
+       GP_INT2                                 = 0x2,
+       GP_INT3                                 = 0x3,
+};
 
 #define GSI_CNTXT_GSI_IRQ_STTS_OFFSET \
                        GSI_EE_N_CNTXT_GSI_IRQ_STTS_OFFSET(GSI_EE_AP)
                        GSI_EE_N_CNTXT_GSI_IRQ_CLR_OFFSET(GSI_EE_AP)
 #define GSI_EE_N_CNTXT_GSI_IRQ_CLR_OFFSET(ee) \
                        (0x0001f128 + 0x4000 * (ee))
-/* The masks below are used for the general IRQ STTS, EN, and CLR registers */
-#define BREAK_POINT_FMASK              GENMASK(0, 0)
-#define BUS_ERROR_FMASK                        GENMASK(1, 1)
-#define CMD_FIFO_OVRFLOW_FMASK         GENMASK(2, 2)
-#define MCS_STACK_OVRFLOW_FMASK                GENMASK(3, 3)
-#define GSI_CNTXT_GSI_IRQ_ALL          GENMASK(3, 0)
+/* Values here are bit positions in the (general) GSI_IRQ_* registers */
+enum gsi_general_id {
+       BREAK_POINT                             = 0x0,
+       BUS_ERROR                               = 0x1,
+       CMD_FIFO_OVRFLOW                        = 0x2,
+       MCS_STACK_OVRFLOW                       = 0x3,
+};
 
 #define GSI_CNTXT_INTSET_OFFSET \
                        GSI_EE_N_CNTXT_INTSET_OFFSET(GSI_EE_AP)
 #define ERR_VIRT_IDX_FMASK             GENMASK(23, 19)
 #define ERR_TYPE_FMASK                 GENMASK(27, 24)
 #define ERR_EE_FMASK                   GENMASK(31, 28)
+/** enum gsi_err_code - ERR_CODE field values in EE_ERR_LOG */
+enum gsi_err_code {
+       GSI_INVALID_TRE                         = 0x1,
+       GSI_OUT_OF_BUFFERS                      = 0x2,
+       GSI_OUT_OF_RESOURCES                    = 0x3,
+       GSI_UNSUPPORTED_INTER_EE_OP             = 0x4,
+       GSI_EVT_RING_EMPTY                      = 0x5,
+       GSI_NON_ALLOCATED_EVT_ACCESS            = 0x6,
+       /* 7 is not assigned */
+       GSI_HWO_1                               = 0x8,
+};
+/** enum gsi_err_type - ERR_TYPE field values in EE_ERR_LOG */
+enum gsi_err_type {
+       GSI_ERR_TYPE_GLOB                       = 0x1,
+       GSI_ERR_TYPE_CHAN                       = 0x2,
+       GSI_ERR_TYPE_EVT                        = 0x3,
+};
 
 #define GSI_ERROR_LOG_CLR_OFFSET \
                        GSI_EE_N_ERROR_LOG_CLR_OFFSET(GSI_EE_AP)
                        (0x0001f400 + 0x4000 * (ee))
 #define INTER_EE_RESULT_FMASK          GENMASK(2, 0)
 #define GENERIC_EE_RESULT_FMASK                GENMASK(7, 5)
-#define GENERIC_EE_SUCCESS_FVAL                        1
-#define GENERIC_EE_INCORRECT_DIRECTION_FVAL    3
-#define GENERIC_EE_INCORRECT_CHANNEL_FVAL      5
-#define GENERIC_EE_NO_RESOURCES_FVAL           7
+enum gsi_generic_ee_result {
+       GENERIC_EE_SUCCESS                      = 0x1,
+       GENERIC_EE_CHANNEL_NOT_RUNNING          = 0x2,
+       GENERIC_EE_INCORRECT_DIRECTION          = 0x3,
+       GENERIC_EE_INCORRECT_CHANNEL_TYPE       = 0x4,
+       GENERIC_EE_INCORRECT_CHANNEL            = 0x5,
+       GENERIC_EE_RETRY                        = 0x6,
+       GENERIC_EE_NO_RESOURCES                 = 0x7,
+};
 #define USB_MAX_PACKET_FMASK           GENMASK(15, 15) /* 0: HS; 1: SS */
 #define MHI_BASE_CHANNEL_FMASK         GENMASK(31, 24)
 
index 43f5f5d..9264203 100644 (file)
@@ -397,15 +397,24 @@ void gsi_trans_cmd_add(struct gsi_trans *trans, void *buf, u32 size,
 
        /* assert(which < trans->tre_count); */
 
-       /* Set the page information for the buffer.  We also need to fill in
-        * the DMA address and length for the buffer (something dma_map_sg()
-        * normally does).
+       /* Commands are quite different from data transfer requests.
+        * Their payloads come from a pool whose memory is allocated
+        * using dma_alloc_coherent().  We therefore do *not* map them
+        * for DMA (unlike what we do for pages and skbs).
+        *
+        * When a transaction completes, the SGL is normally unmapped.
+        * A command transaction has direction DMA_NONE, which tells
+        * gsi_trans_complete() to skip the unmapping step.
+        *
+        * The only things we use directly in a command scatter/gather
+        * entry are the DMA address and length.  We still need the SG
+        * table flags to be maintained though, so assign a NULL page
+        * pointer for that purpose.
         */
        sg = &trans->sgl[which];
-
-       sg_set_buf(sg, buf, size);
+       sg_assign_page(sg, NULL);
        sg_dma_address(sg) = addr;
-       sg_dma_len(sg) = sg->length;
+       sg_dma_len(sg) = size;
 
        info = &trans->info[which];
        info->opcode = opcode;
index d4c2bc7..37dada4 100644 (file)
@@ -24,6 +24,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .seq_type       = IPA_SEQ_DMA_ONLY,
                        .config = {
+                               .resource_group = 0,
                                .dma_mode       = true,
                                .dma_endpoint   = IPA_ENDPOINT_AP_LAN_RX,
                        },
@@ -42,6 +43,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .seq_type       = IPA_SEQ_INVALID,
                        .config = {
+                               .resource_group = 0,
                                .aggregation    = true,
                                .status_enable  = true,
                                .rx = {
@@ -65,6 +67,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                        .seq_type       =
                                IPA_SEQ_PKT_PROCESS_NO_DEC_NO_UCP_DMAP,
                        .config = {
+                               .resource_group = 0,
                                .checksum       = true,
                                .qmap           = true,
                                .status_enable  = true,
@@ -88,6 +91,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .seq_type       = IPA_SEQ_INVALID,
                        .config = {
+                               .resource_group = 0,
                                .checksum       = true,
                                .qmap           = true,
                                .aggregation    = true,
index de2768d..bd92b61 100644 (file)
@@ -26,6 +26,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .seq_type       = IPA_SEQ_DMA_ONLY,
                        .config = {
+                               .resource_group = 1,
                                .dma_mode       = true,
                                .dma_endpoint   = IPA_ENDPOINT_AP_LAN_RX,
                        },
@@ -44,6 +45,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .seq_type       = IPA_SEQ_INVALID,
                        .config = {
+                               .resource_group = 1,
                                .aggregation    = true,
                                .status_enable  = true,
                                .rx = {
@@ -67,6 +69,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                        .seq_type       =
                                IPA_SEQ_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
                        .config = {
+                               .resource_group = 1,
                                .checksum       = true,
                                .qmap           = true,
                                .status_enable  = true,
@@ -90,6 +93,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .seq_type       = IPA_SEQ_INVALID,
                        .config = {
+                               .resource_group = 1,
                                .checksum       = true,
                                .qmap           = true,
                                .aggregation    = true,
@@ -146,11 +150,11 @@ static const struct ipa_resource_src ipa_resource_src[] = {
                .type = IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS,
                .limits[0] = {
                        .min = 1,
-                       .max = 63,
+                       .max = 255,
                },
                .limits[1] = {
                        .min = 1,
-                       .max = 63,
+                       .max = 255,
                },
        },
        {
index 7fc1058..83c4b78 100644 (file)
  * the IPA endpoint.
  */
 
-/* The maximum value returned by ipa_resource_group_count() */
-#define IPA_RESOURCE_GROUP_COUNT       4
+/* The maximum value returned by ipa_resource_group_{src,dst}_count() */
+#define IPA_RESOURCE_GROUP_SRC_MAX     5
+#define IPA_RESOURCE_GROUP_DST_MAX     5
 
-/** enum ipa_resource_type_src - source resource types */
 /**
  * struct gsi_channel_data - GSI channel configuration data
  * @tre_count:         number of TREs in the channel ring
@@ -109,6 +109,7 @@ struct ipa_endpoint_rx_data {
 
 /**
  * struct ipa_endpoint_config_data - IPA endpoint hardware configuration
+ * @resource_group:    resource group to assign endpoint to
  * @checksum:          whether checksum offload is enabled
  * @qmap:              whether endpoint uses QMAP protocol
  * @aggregation:       whether endpoint supports aggregation
@@ -119,6 +120,7 @@ struct ipa_endpoint_rx_data {
  * @rx:                        RX-specific endpoint information (see above)
  */
 struct ipa_endpoint_config_data {
+       u32 resource_group;
        bool checksum;
        bool qmap;
        bool aggregation;
@@ -206,7 +208,7 @@ struct ipa_resource_limits {
  */
 struct ipa_resource_src {
        enum ipa_resource_type_src type;
-       struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_COUNT];
+       struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_SRC_MAX];
 };
 
 /**
@@ -216,7 +218,7 @@ struct ipa_resource_src {
  */
 struct ipa_resource_dst {
        enum ipa_resource_type_dst type;
-       struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_COUNT];
+       struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_DST_MAX];
 };
 
 /**
index b40b711..548121b 100644 (file)
@@ -751,6 +751,16 @@ static void ipa_endpoint_init_deaggr(struct ipa_endpoint *endpoint)
        iowrite32(val, endpoint->ipa->reg_virt + offset);
 }
 
+static void ipa_endpoint_init_rsrc_grp(struct ipa_endpoint *endpoint)
+{
+       u32 offset = IPA_REG_ENDP_INIT_RSRC_GRP_N_OFFSET(endpoint->endpoint_id);
+       struct ipa *ipa = endpoint->ipa;
+       u32 val;
+
+       val = rsrc_grp_encoded(ipa->version, endpoint->data->resource_group);
+       iowrite32(val, ipa->reg_virt + offset);
+}
+
 static void ipa_endpoint_init_seq(struct ipa_endpoint *endpoint)
 {
        u32 offset = IPA_REG_ENDP_INIT_SEQ_N_OFFSET(endpoint->endpoint_id);
@@ -1207,7 +1217,6 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint)
        struct gsi *gsi = &ipa->gsi;
        bool suspended = false;
        dma_addr_t addr;
-       bool legacy;
        u32 retries;
        u32 len = 1;
        void *virt;
@@ -1269,8 +1278,7 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint)
         * complete the channel reset sequence.  Finish by suspending the
         * channel again (if necessary).
         */
-       legacy = ipa->version == IPA_VERSION_3_5_1;
-       gsi_channel_reset(gsi, endpoint->channel_id, legacy);
+       gsi_channel_reset(gsi, endpoint->channel_id, true);
 
        msleep(1);
 
@@ -1293,21 +1301,19 @@ static void ipa_endpoint_reset(struct ipa_endpoint *endpoint)
        u32 channel_id = endpoint->channel_id;
        struct ipa *ipa = endpoint->ipa;
        bool special;
-       bool legacy;
        int ret = 0;
 
        /* On IPA v3.5.1, if an RX endpoint is reset while aggregation
         * is active, we need to handle things specially to recover.
         * All other cases just need to reset the underlying GSI channel.
-        *
-        * IPA v3.5.1 enables the doorbell engine.  Newer versions do not.
         */
-       legacy = ipa->version == IPA_VERSION_3_5_1;
-       special = !endpoint->toward_ipa && endpoint->data->aggregation;
+       special = ipa->version == IPA_VERSION_3_5_1 &&
+                       !endpoint->toward_ipa &&
+                       endpoint->data->aggregation;
        if (special && ipa_endpoint_aggr_active(endpoint))
                ret = ipa_endpoint_reset_rx_aggr(endpoint);
        else
-               gsi_channel_reset(&ipa->gsi, channel_id, legacy);
+               gsi_channel_reset(&ipa->gsi, channel_id, true);
 
        if (ret)
                dev_err(&ipa->pdev->dev,
@@ -1328,6 +1334,7 @@ static void ipa_endpoint_program(struct ipa_endpoint *endpoint)
        ipa_endpoint_init_mode(endpoint);
        ipa_endpoint_init_aggr(endpoint);
        ipa_endpoint_init_deaggr(endpoint);
+       ipa_endpoint_init_rsrc_grp(endpoint);
        ipa_endpoint_init_seq(endpoint);
        ipa_endpoint_status(endpoint);
 }
index cd4d993..bfe95a4 100644 (file)
@@ -111,8 +111,7 @@ int ipa_setup(struct ipa *ipa)
        struct device *dev = &ipa->pdev->dev;
        int ret;
 
-       /* Setup for IPA v3.5.1 has some slight differences */
-       ret = gsi_setup(&ipa->gsi, ipa->version == IPA_VERSION_3_5_1);
+       ret = gsi_setup(&ipa->gsi);
        if (ret)
                return ret;
 
@@ -336,7 +335,6 @@ static void ipa_hardware_config(struct ipa *ipa)
        ipa_hardware_config_qsb(ipa);
 
        /* Configure aggregation granularity */
-       val = ioread32(ipa->reg_virt + IPA_REG_COUNTER_CFG_OFFSET);
        granularity = ipa_aggr_granularity_val(IPA_AGGR_GRANULARITY);
        val = u32_encode_bits(granularity, AGGR_GRANULARITY);
        iowrite32(val, ipa->reg_virt + IPA_REG_COUNTER_CFG_OFFSET);
@@ -363,52 +361,41 @@ static void ipa_hardware_deconfig(struct ipa *ipa)
 
 #ifdef IPA_VALIDATION
 
-/* # IPA resources used based on version (see IPA_RESOURCE_GROUP_COUNT) */
-static int ipa_resource_group_count(struct ipa *ipa)
-{
-       switch (ipa->version) {
-       case IPA_VERSION_3_5_1:
-               return 3;
-
-       case IPA_VERSION_4_0:
-       case IPA_VERSION_4_1:
-               return 4;
-
-       case IPA_VERSION_4_2:
-               return 1;
-
-       default:
-               return 0;
-       }
-}
-
 static bool ipa_resource_limits_valid(struct ipa *ipa,
                                      const struct ipa_resource_data *data)
 {
-       u32 group_count = ipa_resource_group_count(ipa);
+       u32 group_count;
        u32 i;
        u32 j;
 
-       if (!group_count)
+       /* We program at most 6 source or destination resource group limits */
+       BUILD_BUG_ON(IPA_RESOURCE_GROUP_SRC_MAX > 6);
+
+       group_count = ipa_resource_group_src_count(ipa->version);
+       if (!group_count || group_count > IPA_RESOURCE_GROUP_SRC_MAX)
                return false;
 
-       /* Return an error if a non-zero resource group limit is specified
-        * for a resource not supported by hardware.
+       /* Return an error if a non-zero resource limit is specified
+        * for a resource group not supported by hardware.
         */
        for (i = 0; i < data->resource_src_count; i++) {
                const struct ipa_resource_src *resource;
 
                resource = &data->resource_src[i];
-               for (j = group_count; j < IPA_RESOURCE_GROUP_COUNT; j++)
+               for (j = group_count; j < IPA_RESOURCE_GROUP_SRC_MAX; j++)
                        if (resource->limits[j].min || resource->limits[j].max)
                                return false;
        }
 
+       group_count = ipa_resource_group_dst_count(ipa->version);
+       if (!group_count || group_count > IPA_RESOURCE_GROUP_DST_MAX)
+               return false;
+
        for (i = 0; i < data->resource_dst_count; i++) {
                const struct ipa_resource_dst *resource;
 
                resource = &data->resource_dst[i];
-               for (j = group_count; j < IPA_RESOURCE_GROUP_COUNT; j++)
+               for (j = group_count; j < IPA_RESOURCE_GROUP_DST_MAX; j++)
                        if (resource->limits[j].min || resource->limits[j].max)
                                return false;
        }
@@ -435,46 +422,64 @@ ipa_resource_config_common(struct ipa *ipa, u32 offset,
 
        val = u32_encode_bits(xlimits->min, X_MIN_LIM_FMASK);
        val |= u32_encode_bits(xlimits->max, X_MAX_LIM_FMASK);
-       val |= u32_encode_bits(ylimits->min, Y_MIN_LIM_FMASK);
-       val |= u32_encode_bits(ylimits->max, Y_MAX_LIM_FMASK);
+       if (ylimits) {
+               val |= u32_encode_bits(ylimits->min, Y_MIN_LIM_FMASK);
+               val |= u32_encode_bits(ylimits->max, Y_MAX_LIM_FMASK);
+       }
 
        iowrite32(val, ipa->reg_virt + offset);
 }
 
-static void ipa_resource_config_src_01(struct ipa *ipa,
-                                      const struct ipa_resource_src *resource)
+static void ipa_resource_config_src(struct ipa *ipa,
+                                   const struct ipa_resource_src *resource)
 {
-       u32 offset = IPA_REG_SRC_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource->type);
+       u32 group_count = ipa_resource_group_src_count(ipa->version);
+       const struct ipa_resource_limits *ylimits;
+       u32 offset;
 
-       ipa_resource_config_common(ipa, offset,
-                                  &resource->limits[0], &resource->limits[1]);
-}
+       offset = IPA_REG_SRC_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource->type);
+       ylimits = group_count == 1 ? NULL : &resource->limits[1];
+       ipa_resource_config_common(ipa, offset, &resource->limits[0], ylimits);
 
-static void ipa_resource_config_src_23(struct ipa *ipa,
-                                      const struct ipa_resource_src *resource)
-{
-       u32 offset = IPA_REG_SRC_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource->type);
+       if (group_count < 2)
+               return;
 
-       ipa_resource_config_common(ipa, offset,
-                                  &resource->limits[2], &resource->limits[3]);
-}
+       offset = IPA_REG_SRC_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource->type);
+       ylimits = group_count == 3 ? NULL : &resource->limits[3];
+       ipa_resource_config_common(ipa, offset, &resource->limits[2], ylimits);
 
-static void ipa_resource_config_dst_01(struct ipa *ipa,
-                                      const struct ipa_resource_dst *resource)
-{
-       u32 offset = IPA_REG_DST_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource->type);
+       if (group_count < 4)
+               return;
 
-       ipa_resource_config_common(ipa, offset,
-                                  &resource->limits[0], &resource->limits[1]);
+       offset = IPA_REG_SRC_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource->type);
+       ylimits = group_count == 5 ? NULL : &resource->limits[5];
+       ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits);
 }
 
-static void ipa_resource_config_dst_23(struct ipa *ipa,
-                                      const struct ipa_resource_dst *resource)
+static void ipa_resource_config_dst(struct ipa *ipa,
+                                   const struct ipa_resource_dst *resource)
 {
-       u32 offset = IPA_REG_DST_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource->type);
+       u32 group_count = ipa_resource_group_dst_count(ipa->version);
+       const struct ipa_resource_limits *ylimits;
+       u32 offset;
+
+       offset = IPA_REG_DST_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource->type);
+       ylimits = group_count == 1 ? NULL : &resource->limits[1];
+       ipa_resource_config_common(ipa, offset, &resource->limits[0], ylimits);
+
+       if (group_count < 2)
+               return;
+
+       offset = IPA_REG_DST_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource->type);
+       ylimits = group_count == 3 ? NULL : &resource->limits[3];
+       ipa_resource_config_common(ipa, offset, &resource->limits[2], ylimits);
 
-       ipa_resource_config_common(ipa, offset,
-                                  &resource->limits[2], &resource->limits[3]);
+       if (group_count < 4)
+               return;
+
+       offset = IPA_REG_DST_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource->type);
+       ylimits = group_count == 5 ? NULL : &resource->limits[5];
+       ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits);
 }
 
 static int
@@ -485,15 +490,11 @@ ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data)
        if (!ipa_resource_limits_valid(ipa, data))
                return -EINVAL;
 
-       for (i = 0; i < data->resource_src_count; i++) {
-               ipa_resource_config_src_01(ipa, &data->resource_src[i]);
-               ipa_resource_config_src_23(ipa, &data->resource_src[i]);
-       }
+       for (i = 0; i < data->resource_src_count; i++)
+               ipa_resource_config_src(ipa, data->resource_src);
 
-       for (i = 0; i < data->resource_dst_count; i++) {
-               ipa_resource_config_dst_01(ipa, &data->resource_dst[i]);
-               ipa_resource_config_dst_23(ipa, &data->resource_dst[i]);
-       }
+       for (i = 0; i < data->resource_dst_count; i++)
+               ipa_resource_config_dst(ipa, data->resource_dst);
 
        return 0;
 }
@@ -678,9 +679,6 @@ static void ipa_validate_build(void)
         */
        BUILD_BUG_ON(GSI_TLV_MAX > U8_MAX);
 
-       /* Exceeding 128 bytes makes the transaction pool *much* larger */
-       BUILD_BUG_ON(sizeof(struct gsi_trans) > 128);
-
        /* This is used as a divisor */
        BUILD_BUG_ON(!IPA_AGGR_GRANULARITY);
 
@@ -720,10 +718,8 @@ static int ipa_probe(struct platform_device *pdev)
        const struct ipa_data *data;
        struct ipa_clock *clock;
        struct rproc *rproc;
-       bool modem_alloc;
        bool modem_init;
        struct ipa *ipa;
-       bool prefetch;
        phandle ph;
        int ret;
 
@@ -785,17 +781,12 @@ static int ipa_probe(struct platform_device *pdev)
        if (ret)
                goto err_reg_exit;
 
-       /* GSI v2.0+ (IPA v4.0+) uses prefetch for the command channel */
-       prefetch = ipa->version != IPA_VERSION_3_5_1;
-       /* IPA v4.2 requires the AP to allocate channels for the modem */
-       modem_alloc = ipa->version == IPA_VERSION_4_2;
-
-       ret = gsi_init(&ipa->gsi, pdev, prefetch, data->endpoint_count,
-                      data->endpoint_data, modem_alloc);
+       ret = gsi_init(&ipa->gsi, pdev, ipa->version, data->endpoint_count,
+                      data->endpoint_data);
        if (ret)
                goto err_mem_exit;
 
-       /* Result is a non-zero mask endpoints that support filtering */
+       /* Result is a non-zero mask of endpoints that support filtering */
        ipa->filter_map = ipa_endpoint_init(ipa, data->endpoint_count,
                                            data->endpoint_data);
        if (!ipa->filter_map) {
index 2d45c44..0cc3a33 100644 (file)
@@ -89,7 +89,7 @@ int ipa_mem_setup(struct ipa *ipa)
        gsi_trans_commit_wait(trans);
 
        /* Tell the hardware where the processing context area is located */
-       iowrite32(ipa->mem_offset + offset,
+       iowrite32(ipa->mem_offset + ipa->mem[IPA_MEM_MODEM_PROC_CTX].offset,
                  ipa->reg_virt + IPA_REG_LOCAL_PKT_PROC_CNTXT_BASE_OFFSET);
 
        return 0;
@@ -160,13 +160,13 @@ int ipa_mem_config(struct ipa *ipa)
        mem_size = 8 * u32_get_bits(val, SHARED_MEM_SIZE_FMASK);
 
        /* If the sizes don't match, issue a warning */
-       if (ipa->mem_offset + mem_size > ipa->mem_size) {
-               dev_warn(dev, "ignoring larger reported memory size: 0x%08x\n",
-                       mem_size);
-       } else if (ipa->mem_offset + mem_size < ipa->mem_size) {
+       if (ipa->mem_offset + mem_size < ipa->mem_size) {
                dev_warn(dev, "limiting IPA memory size to 0x%08x\n",
                         mem_size);
                ipa->mem_size = mem_size;
+       } else if (ipa->mem_offset + mem_size > ipa->mem_size) {
+               dev_dbg(dev, "ignoring larger reported memory size: 0x%08x\n",
+                       mem_size);
        }
 
        /* Prealloc DMA memory for zeroing regions */
index e542598..8eaf5f2 100644 (file)
@@ -244,6 +244,43 @@ static inline u32 ipa_reg_idle_indication_cfg_offset(enum ipa_version version)
 #define ENTER_IDLE_DEBOUNCE_THRESH_FMASK       GENMASK(15, 0)
 #define CONST_NON_IDLE_ENABLE_FMASK            GENMASK(16, 16)
 
+/* # IPA source resource groups available based on version */
+static inline u32 ipa_resource_group_src_count(enum ipa_version version)
+{
+       switch (version) {
+       case IPA_VERSION_3_5_1:
+       case IPA_VERSION_4_0:
+       case IPA_VERSION_4_1:
+               return 4;
+
+       case IPA_VERSION_4_2:
+               return 1;
+
+       default:
+               return 0;
+       }
+}
+
+/* # IPA destination resource groups available based on version */
+static inline u32 ipa_resource_group_dst_count(enum ipa_version version)
+{
+       switch (version) {
+       case IPA_VERSION_3_5_1:
+               return 3;
+
+       case IPA_VERSION_4_0:
+       case IPA_VERSION_4_1:
+               return 4;
+
+       case IPA_VERSION_4_2:
+               return 1;
+
+       default:
+               return 0;
+       }
+}
+
+/* Not all of the following are valid (depends on the count, above) */
 #define IPA_REG_SRC_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(rt) \
                                        (0x00000400 + 0x0020 * (rt))
 #define IPA_REG_SRC_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(rt) \
@@ -341,7 +378,16 @@ static inline u32 ipa_reg_idle_indication_cfg_offset(enum ipa_version version)
 
 #define IPA_REG_ENDP_INIT_RSRC_GRP_N_OFFSET(ep) \
                                        (0x00000838 + 0x0070 * (ep))
-#define RSRC_GRP_FMASK                         GENMASK(1, 0)
+/* Encoded value for RSRC_GRP endpoint register RSRC_GRP field */
+static inline u32 rsrc_grp_encoded(enum ipa_version version, u32 rsrc_grp)
+{
+       switch (version) {
+       case IPA_VERSION_4_2:
+               return u32_encode_bits(rsrc_grp, GENMASK(0, 0));
+       default:
+               return u32_encode_bits(rsrc_grp, GENMASK(1, 0));
+       }
+}
 
 /* Valid only for TX (IPA consumer) endpoints */
 #define IPA_REG_ENDP_INIT_SEQ_N_OFFSET(txep) \
index b382d47..15bb357 100644 (file)
@@ -129,9 +129,10 @@ static void ipa_uc_event_handler(struct ipa *ipa, enum ipa_irq_id irq_id)
 
        if (shared->event == IPA_UC_EVENT_ERROR)
                dev_err(dev, "microcontroller error event\n");
-       else
+       else if (shared->event != IPA_UC_EVENT_LOG_INFO)
                dev_err(dev, "unsupported microcontroller event %hhu\n",
                        shared->event);
+       /* The LOG_INFO event can be safely ignored */
 }
 
 /* Microcontroller response IPA interrupt handler */
index 11ca5fa..92425e1 100644 (file)
@@ -101,6 +101,7 @@ struct pcpu_secy_stats {
  * @real_dev: pointer to underlying netdevice
  * @stats: MACsec device stats
  * @secys: linked list of SecY's on the underlying device
+ * @gro_cells: pointer to the Generic Receive Offload cell
  * @offload: status of offloading on the MACsec device
  */
 struct macsec_dev {
index c8d803d..d9b6c44 100644 (file)
@@ -1096,7 +1096,7 @@ static int macvlan_dev_netpoll_setup(struct net_device *dev, struct netpoll_info
        struct macvlan_dev *vlan = netdev_priv(dev);
        struct net_device *real_dev = vlan->lowerdev;
        struct netpoll *netpoll;
-       int err = 0;
+       int err;
 
        netpoll = kzalloc(sizeof(*netpoll), GFP_KERNEL);
        err = -ENOMEM;
@@ -1339,7 +1339,7 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[],
        return 0;
 }
 
-/**
+/*
  * reconfigure list of remote source mac address
  * (only for macvlan devices in source mode)
  * Note regarding alignment: all netlink data is aligned to 4 Byte, which
diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
new file mode 100644 (file)
index 0000000..d3f9278
--- /dev/null
@@ -0,0 +1,316 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* MHI Network driver - Network over MHI bus
+ *
+ * Copyright (C) 2020 Linaro Ltd <loic.poulain@linaro.org>
+ */
+
+#include <linux/if_arp.h>
+#include <linux/mhi.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/u64_stats_sync.h>
+
+#define MHI_NET_MIN_MTU                ETH_MIN_MTU
+#define MHI_NET_MAX_MTU                0xffff
+#define MHI_NET_DEFAULT_MTU    0x4000
+
+struct mhi_net_stats {
+       u64_stats_t rx_packets;
+       u64_stats_t rx_bytes;
+       u64_stats_t rx_errors;
+       u64_stats_t rx_dropped;
+       u64_stats_t tx_packets;
+       u64_stats_t tx_bytes;
+       u64_stats_t tx_errors;
+       u64_stats_t tx_dropped;
+       atomic_t rx_queued;
+       struct u64_stats_sync tx_syncp;
+       struct u64_stats_sync rx_syncp;
+};
+
+struct mhi_net_dev {
+       struct mhi_device *mdev;
+       struct net_device *ndev;
+       struct delayed_work rx_refill;
+       struct mhi_net_stats stats;
+       u32 rx_queue_sz;
+};
+
+static int mhi_ndo_open(struct net_device *ndev)
+{
+       struct mhi_net_dev *mhi_netdev = netdev_priv(ndev);
+
+       /* Feed the rx buffer pool */
+       schedule_delayed_work(&mhi_netdev->rx_refill, 0);
+
+       /* Carrier is established via out-of-band channel (e.g. qmi) */
+       netif_carrier_on(ndev);
+
+       netif_start_queue(ndev);
+
+       return 0;
+}
+
+static int mhi_ndo_stop(struct net_device *ndev)
+{
+       struct mhi_net_dev *mhi_netdev = netdev_priv(ndev);
+
+       netif_stop_queue(ndev);
+       netif_carrier_off(ndev);
+       cancel_delayed_work_sync(&mhi_netdev->rx_refill);
+
+       return 0;
+}
+
+static int mhi_ndo_xmit(struct sk_buff *skb, struct net_device *ndev)
+{
+       struct mhi_net_dev *mhi_netdev = netdev_priv(ndev);
+       struct mhi_device *mdev = mhi_netdev->mdev;
+       int err;
+
+       err = mhi_queue_skb(mdev, DMA_TO_DEVICE, skb, skb->len, MHI_EOT);
+       if (unlikely(err)) {
+               net_err_ratelimited("%s: Failed to queue TX buf (%d)\n",
+                                   ndev->name, err);
+
+               u64_stats_update_begin(&mhi_netdev->stats.tx_syncp);
+               u64_stats_inc(&mhi_netdev->stats.tx_dropped);
+               u64_stats_update_end(&mhi_netdev->stats.tx_syncp);
+
+               /* drop the packet */
+               dev_kfree_skb_any(skb);
+       }
+
+       if (mhi_queue_is_full(mdev, DMA_TO_DEVICE))
+               netif_stop_queue(ndev);
+
+       return NETDEV_TX_OK;
+}
+
+static void mhi_ndo_get_stats64(struct net_device *ndev,
+                               struct rtnl_link_stats64 *stats)
+{
+       struct mhi_net_dev *mhi_netdev = netdev_priv(ndev);
+       unsigned int start;
+
+       do {
+               start = u64_stats_fetch_begin_irq(&mhi_netdev->stats.rx_syncp);
+               stats->rx_packets = u64_stats_read(&mhi_netdev->stats.rx_packets);
+               stats->rx_bytes = u64_stats_read(&mhi_netdev->stats.rx_bytes);
+               stats->rx_errors = u64_stats_read(&mhi_netdev->stats.rx_errors);
+               stats->rx_dropped = u64_stats_read(&mhi_netdev->stats.rx_dropped);
+       } while (u64_stats_fetch_retry_irq(&mhi_netdev->stats.rx_syncp, start));
+
+       do {
+               start = u64_stats_fetch_begin_irq(&mhi_netdev->stats.tx_syncp);
+               stats->tx_packets = u64_stats_read(&mhi_netdev->stats.tx_packets);
+               stats->tx_bytes = u64_stats_read(&mhi_netdev->stats.tx_bytes);
+               stats->tx_errors = u64_stats_read(&mhi_netdev->stats.tx_errors);
+               stats->tx_dropped = u64_stats_read(&mhi_netdev->stats.tx_dropped);
+       } while (u64_stats_fetch_retry_irq(&mhi_netdev->stats.tx_syncp, start));
+}
+
+static const struct net_device_ops mhi_netdev_ops = {
+       .ndo_open               = mhi_ndo_open,
+       .ndo_stop               = mhi_ndo_stop,
+       .ndo_start_xmit         = mhi_ndo_xmit,
+       .ndo_get_stats64        = mhi_ndo_get_stats64,
+};
+
+static void mhi_net_setup(struct net_device *ndev)
+{
+       ndev->header_ops = NULL;  /* No header */
+       ndev->type = ARPHRD_NONE; /* QMAP... */
+       ndev->hard_header_len = 0;
+       ndev->addr_len = 0;
+       ndev->flags = IFF_POINTOPOINT | IFF_NOARP;
+       ndev->netdev_ops = &mhi_netdev_ops;
+       ndev->mtu = MHI_NET_DEFAULT_MTU;
+       ndev->min_mtu = MHI_NET_MIN_MTU;
+       ndev->max_mtu = MHI_NET_MAX_MTU;
+       ndev->tx_queue_len = 1000;
+}
+
+static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
+                               struct mhi_result *mhi_res)
+{
+       struct mhi_net_dev *mhi_netdev = dev_get_drvdata(&mhi_dev->dev);
+       struct sk_buff *skb = mhi_res->buf_addr;
+       int remaining;
+
+       remaining = atomic_dec_return(&mhi_netdev->stats.rx_queued);
+
+       if (unlikely(mhi_res->transaction_status)) {
+               dev_kfree_skb_any(skb);
+
+               /* MHI layer stopping/resetting the DL channel */
+               if (mhi_res->transaction_status == -ENOTCONN)
+                       return;
+
+               u64_stats_update_begin(&mhi_netdev->stats.rx_syncp);
+               u64_stats_inc(&mhi_netdev->stats.rx_errors);
+               u64_stats_update_end(&mhi_netdev->stats.rx_syncp);
+       } else {
+               u64_stats_update_begin(&mhi_netdev->stats.rx_syncp);
+               u64_stats_inc(&mhi_netdev->stats.rx_packets);
+               u64_stats_add(&mhi_netdev->stats.rx_bytes, mhi_res->bytes_xferd);
+               u64_stats_update_end(&mhi_netdev->stats.rx_syncp);
+
+               skb->protocol = htons(ETH_P_MAP);
+               skb_put(skb, mhi_res->bytes_xferd);
+               netif_rx(skb);
+       }
+
+       /* Refill if RX buffers queue becomes low */
+       if (remaining <= mhi_netdev->rx_queue_sz / 2)
+               schedule_delayed_work(&mhi_netdev->rx_refill, 0);
+}
+
+static void mhi_net_ul_callback(struct mhi_device *mhi_dev,
+                               struct mhi_result *mhi_res)
+{
+       struct mhi_net_dev *mhi_netdev = dev_get_drvdata(&mhi_dev->dev);
+       struct net_device *ndev = mhi_netdev->ndev;
+       struct sk_buff *skb = mhi_res->buf_addr;
+
+       /* Hardware has consumed the buffer, so free the skb (which is not
+        * freed by the MHI stack) and perform accounting.
+        */
+       dev_consume_skb_any(skb);
+
+       u64_stats_update_begin(&mhi_netdev->stats.tx_syncp);
+       if (unlikely(mhi_res->transaction_status)) {
+
+               /* MHI layer stopping/resetting the UL channel */
+               if (mhi_res->transaction_status == -ENOTCONN) {
+                       u64_stats_update_end(&mhi_netdev->stats.tx_syncp);
+                       return;
+               }
+
+               u64_stats_inc(&mhi_netdev->stats.tx_errors);
+       } else {
+               u64_stats_inc(&mhi_netdev->stats.tx_packets);
+               u64_stats_add(&mhi_netdev->stats.tx_bytes, mhi_res->bytes_xferd);
+       }
+       u64_stats_update_end(&mhi_netdev->stats.tx_syncp);
+
+       if (netif_queue_stopped(ndev))
+               netif_wake_queue(ndev);
+}
+
+static void mhi_net_rx_refill_work(struct work_struct *work)
+{
+       struct mhi_net_dev *mhi_netdev = container_of(work, struct mhi_net_dev,
+                                                     rx_refill.work);
+       struct net_device *ndev = mhi_netdev->ndev;
+       struct mhi_device *mdev = mhi_netdev->mdev;
+       int size = READ_ONCE(ndev->mtu);
+       struct sk_buff *skb;
+       int err;
+
+       while (atomic_read(&mhi_netdev->stats.rx_queued) < mhi_netdev->rx_queue_sz) {
+               skb = netdev_alloc_skb(ndev, size);
+               if (unlikely(!skb))
+                       break;
+
+               err = mhi_queue_skb(mdev, DMA_FROM_DEVICE, skb, size, MHI_EOT);
+               if (unlikely(err)) {
+                       net_err_ratelimited("%s: Failed to queue RX buf (%d)\n",
+                                           ndev->name, err);
+                       kfree_skb(skb);
+                       break;
+               }
+
+               atomic_inc(&mhi_netdev->stats.rx_queued);
+
+               /* Do not hog the CPU if rx buffers are consumed faster than
+                * queued (unlikely).
+                */
+               cond_resched();
+       }
+
+       /* If we're still starved of rx buffers, reschedule later */
+       if (unlikely(!atomic_read(&mhi_netdev->stats.rx_queued)))
+               schedule_delayed_work(&mhi_netdev->rx_refill, HZ / 2);
+}
+
+static int mhi_net_probe(struct mhi_device *mhi_dev,
+                        const struct mhi_device_id *id)
+{
+       const char *netname = (char *)id->driver_data;
+       struct device *dev = &mhi_dev->dev;
+       struct mhi_net_dev *mhi_netdev;
+       struct net_device *ndev;
+       int err;
+
+       ndev = alloc_netdev(sizeof(*mhi_netdev), netname, NET_NAME_PREDICTABLE,
+                           mhi_net_setup);
+       if (!ndev)
+               return -ENOMEM;
+
+       mhi_netdev = netdev_priv(ndev);
+       dev_set_drvdata(dev, mhi_netdev);
+       mhi_netdev->ndev = ndev;
+       mhi_netdev->mdev = mhi_dev;
+       SET_NETDEV_DEV(ndev, &mhi_dev->dev);
+
+       /* All MHI net channels have 128 ring elements (at least for now) */
+       mhi_netdev->rx_queue_sz = 128;
+
+       INIT_DELAYED_WORK(&mhi_netdev->rx_refill, mhi_net_rx_refill_work);
+       u64_stats_init(&mhi_netdev->stats.rx_syncp);
+       u64_stats_init(&mhi_netdev->stats.tx_syncp);
+
+       /* Start MHI channels */
+       err = mhi_prepare_for_transfer(mhi_dev);
+       if (err)
+               goto out_err;
+
+       err = register_netdev(ndev);
+       if (err)
+               goto out_err;
+
+       return 0;
+
+out_err:
+       free_netdev(ndev);
+       return err;
+}
+
+static void mhi_net_remove(struct mhi_device *mhi_dev)
+{
+       struct mhi_net_dev *mhi_netdev = dev_get_drvdata(&mhi_dev->dev);
+
+       unregister_netdev(mhi_netdev->ndev);
+
+       mhi_unprepare_from_transfer(mhi_netdev->mdev);
+
+       free_netdev(mhi_netdev->ndev);
+}
+
+static const struct mhi_device_id mhi_net_id_table[] = {
+       { .chan = "IP_HW0", .driver_data = (kernel_ulong_t)"mhi_hwip%d" },
+       { .chan = "IP_SW0", .driver_data = (kernel_ulong_t)"mhi_swip%d" },
+       {}
+};
+MODULE_DEVICE_TABLE(mhi, mhi_net_id_table);
+
+static struct mhi_driver mhi_net_driver = {
+       .probe = mhi_net_probe,
+       .remove = mhi_net_remove,
+       .dl_xfer_cb = mhi_net_dl_callback,
+       .ul_xfer_cb = mhi_net_ul_callback,
+       .id_table = mhi_net_id_table,
+       .driver = {
+               .name = "mhi_net",
+               .owner = THIS_MODULE,
+       },
+};
+
+module_mhi_driver(mhi_net_driver);
+
+MODULE_AUTHOR("Loic Poulain <loic.poulain@linaro.org>");
+MODULE_DESCRIPTION("Network over MHI");
+MODULE_LICENSE("GPL v2");
index f6a97c8..e71ebb9 100644 (file)
@@ -84,15 +84,16 @@ int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
                ctrl1000 = mii->mdio_read(dev, mii->phy_id, MII_CTRL1000);
                stat1000 = mii->mdio_read(dev, mii->phy_id, MII_STAT1000);
        }
+
+       ecmd->advertising |= mii_get_an(mii, MII_ADVERTISE);
+       if (mii->supports_gmii)
+               ecmd->advertising |=
+                       mii_ctrl1000_to_ethtool_adv_t(ctrl1000);
+
        if (bmcr & BMCR_ANENABLE) {
                ecmd->advertising |= ADVERTISED_Autoneg;
                ecmd->autoneg = AUTONEG_ENABLE;
 
-               ecmd->advertising |= mii_get_an(mii, MII_ADVERTISE);
-               if (mii->supports_gmii)
-                       ecmd->advertising |=
-                                       mii_ctrl1000_to_ethtool_adv_t(ctrl1000);
-
                if (bmsr & BMSR_ANEGCOMPLETE) {
                        ecmd->lp_advertising = mii_get_an(mii, MII_LPA);
                        ecmd->lp_advertising |=
@@ -171,14 +172,15 @@ void mii_ethtool_get_link_ksettings(struct mii_if_info *mii,
                ctrl1000 = mii->mdio_read(dev, mii->phy_id, MII_CTRL1000);
                stat1000 = mii->mdio_read(dev, mii->phy_id, MII_STAT1000);
        }
+
+       advertising |= mii_get_an(mii, MII_ADVERTISE);
+       if (mii->supports_gmii)
+               advertising |= mii_ctrl1000_to_ethtool_adv_t(ctrl1000);
+
        if (bmcr & BMCR_ANENABLE) {
                advertising |= ADVERTISED_Autoneg;
                cmd->base.autoneg = AUTONEG_ENABLE;
 
-               advertising |= mii_get_an(mii, MII_ADVERTISE);
-               if (mii->supports_gmii)
-                       advertising |= mii_ctrl1000_to_ethtool_adv_t(ctrl1000);
-
                if (bmsr & BMSR_ANEGCOMPLETE) {
                        lp_advertising = mii_get_an(mii, MII_LPA);
                        lp_advertising |=
index fb182be..2a48924 100644 (file)
@@ -697,7 +697,7 @@ static struct failover_ops net_failover_ops = {
 /**
  * net_failover_create - Create and register a failover instance
  *
- * @dev: standby netdev
+ * @standby_dev: standby netdev
  *
  * Creates a failover netdev and registers a failover instance for a standby
  * netdev. Used by paravirtual drivers that use 3-netdev model.
index 92001f7..ccecba9 100644 (file)
@@ -83,6 +83,7 @@ static struct console netconsole_ext;
  *             whether the corresponding netpoll is active or inactive.
  *             Also, other parameters of a target may be modified at
  *             runtime only when it is disabled (enabled == 0).
+ * @extended:  Denotes whether console is extended or not.
  * @np:                The netpoll structure for this target.
  *             Contains the other userspace visible parameters:
  *             dev_name        (read-write)
index d070614..49cc1fe 100644 (file)
@@ -324,6 +324,12 @@ static int nsim_dev_resources_register(struct devlink *devlink)
                return err;
        }
 
+       /* Resources for nexthops */
+       err = devlink_resource_register(devlink, "nexthops", (u64)-1,
+                                       NSIM_RESOURCE_NEXTHOPS,
+                                       DEVLINK_RESOURCE_ID_PARENT_TOP,
+                                       &params);
+
 out:
        return err;
 }
index deea17a..45d8a77 100644 (file)
@@ -25,6 +25,7 @@
 #include <net/ip6_fib.h>
 #include <net/fib_rules.h>
 #include <net/net_namespace.h>
+#include <net/nexthop.h>
 
 #include "netdevsim.h"
 
@@ -42,9 +43,12 @@ struct nsim_fib_data {
        struct notifier_block fib_nb;
        struct nsim_per_fib_data ipv4;
        struct nsim_per_fib_data ipv6;
+       struct nsim_fib_entry nexthops;
        struct rhashtable fib_rt_ht;
        struct list_head fib_rt_list;
        spinlock_t fib_lock;    /* Protects hashtable, list and accounting */
+       struct notifier_block nexthop_nb;
+       struct rhashtable nexthop_ht;
        struct devlink *devlink;
 };
 
@@ -86,6 +90,19 @@ static const struct rhashtable_params nsim_fib_rt_ht_params = {
        .automatic_shrinking = true,
 };
 
+struct nsim_nexthop {
+       struct rhash_head ht_node;
+       u64 occ;
+       u32 id;
+};
+
+static const struct rhashtable_params nsim_nexthop_ht_params = {
+       .key_offset = offsetof(struct nsim_nexthop, id),
+       .head_offset = offsetof(struct nsim_nexthop, ht_node),
+       .key_len = sizeof(u32),
+       .automatic_shrinking = true,
+};
+
 u64 nsim_fib_get_val(struct nsim_fib_data *fib_data,
                     enum nsim_resource_id res_id, bool max)
 {
@@ -104,6 +121,9 @@ u64 nsim_fib_get_val(struct nsim_fib_data *fib_data,
        case NSIM_RESOURCE_IPV6_FIB_RULES:
                entry = &fib_data->ipv6.rules;
                break;
+       case NSIM_RESOURCE_NEXTHOPS:
+               entry = &fib_data->nexthops;
+               break;
        default:
                return 0;
        }
@@ -129,6 +149,9 @@ static void nsim_fib_set_max(struct nsim_fib_data *fib_data,
        case NSIM_RESOURCE_IPV6_FIB_RULES:
                entry = &fib_data->ipv6.rules;
                break;
+       case NSIM_RESOURCE_NEXTHOPS:
+               entry = &fib_data->nexthops;
+               break;
        default:
                WARN_ON(1);
                return;
@@ -389,11 +412,6 @@ static int nsim_fib4_event(struct nsim_fib_data *data,
 
        fen_info = container_of(info, struct fib_entry_notifier_info, info);
 
-       if (fen_info->fi->nh) {
-               NL_SET_ERR_MSG_MOD(info->extack, "IPv4 route with nexthop objects is not supported");
-               return 0;
-       }
-
        switch (event) {
        case FIB_EVENT_ENTRY_REPLACE:
                err = nsim_fib4_rt_insert(data, fen_info);
@@ -704,11 +722,6 @@ static int nsim_fib6_event(struct nsim_fib_data *data,
 
        fen6_info = container_of(info, struct fib6_entry_notifier_info, info);
 
-       if (fen6_info->rt->nh) {
-               NL_SET_ERR_MSG_MOD(info->extack, "IPv6 route with nexthop objects is not supported");
-               return 0;
-       }
-
        if (fen6_info->rt->fib6_src.plen) {
                NL_SET_ERR_MSG_MOD(info->extack, "IPv6 source-specific route is not supported");
                return 0;
@@ -838,6 +851,196 @@ static void nsim_fib_dump_inconsistent(struct notifier_block *nb)
        data->ipv6.rules.num = 0ULL;
 }
 
+static struct nsim_nexthop *nsim_nexthop_create(struct nsim_fib_data *data,
+                                               struct nh_notifier_info *info)
+{
+       struct nsim_nexthop *nexthop;
+       u64 occ = 0;
+       int i;
+
+       nexthop = kzalloc(sizeof(*nexthop), GFP_KERNEL);
+       if (!nexthop)
+               return NULL;
+
+       nexthop->id = info->id;
+
+       /* Determine the number of nexthop entries the new nexthop will
+        * occupy.
+        */
+
+       if (!info->is_grp) {
+               occ = 1;
+               goto out;
+       }
+
+       for (i = 0; i < info->nh_grp->num_nh; i++)
+               occ += info->nh_grp->nh_entries[i].weight;
+
+out:
+       nexthop->occ = occ;
+       return nexthop;
+}
+
+static void nsim_nexthop_destroy(struct nsim_nexthop *nexthop)
+{
+       kfree(nexthop);
+}
+
+static int nsim_nexthop_account(struct nsim_fib_data *data, u64 occ,
+                               bool add, struct netlink_ext_ack *extack)
+{
+       int err = 0;
+
+       if (add) {
+               if (data->nexthops.num + occ <= data->nexthops.max) {
+                       data->nexthops.num += occ;
+               } else {
+                       err = -ENOSPC;
+                       NL_SET_ERR_MSG_MOD(extack, "Exceeded number of supported nexthops");
+               }
+       } else {
+               if (WARN_ON(occ > data->nexthops.num))
+                       return -EINVAL;
+               data->nexthops.num -= occ;
+       }
+
+       return err;
+}
+
+static int nsim_nexthop_add(struct nsim_fib_data *data,
+                           struct nsim_nexthop *nexthop,
+                           struct netlink_ext_ack *extack)
+{
+       struct net *net = devlink_net(data->devlink);
+       int err;
+
+       err = nsim_nexthop_account(data, nexthop->occ, true, extack);
+       if (err)
+               return err;
+
+       err = rhashtable_insert_fast(&data->nexthop_ht, &nexthop->ht_node,
+                                    nsim_nexthop_ht_params);
+       if (err) {
+               NL_SET_ERR_MSG_MOD(extack, "Failed to insert nexthop");
+               goto err_nexthop_dismiss;
+       }
+
+       nexthop_set_hw_flags(net, nexthop->id, false, true);
+
+       return 0;
+
+err_nexthop_dismiss:
+       nsim_nexthop_account(data, nexthop->occ, false, extack);
+       return err;
+}
+
+static int nsim_nexthop_replace(struct nsim_fib_data *data,
+                               struct nsim_nexthop *nexthop,
+                               struct nsim_nexthop *nexthop_old,
+                               struct netlink_ext_ack *extack)
+{
+       struct net *net = devlink_net(data->devlink);
+       int err;
+
+       err = nsim_nexthop_account(data, nexthop->occ, true, extack);
+       if (err)
+               return err;
+
+       err = rhashtable_replace_fast(&data->nexthop_ht,
+                                     &nexthop_old->ht_node, &nexthop->ht_node,
+                                     nsim_nexthop_ht_params);
+       if (err) {
+               NL_SET_ERR_MSG_MOD(extack, "Failed to replace nexthop");
+               goto err_nexthop_dismiss;
+       }
+
+       nexthop_set_hw_flags(net, nexthop->id, false, true);
+       nsim_nexthop_account(data, nexthop_old->occ, false, extack);
+       nsim_nexthop_destroy(nexthop_old);
+
+       return 0;
+
+err_nexthop_dismiss:
+       nsim_nexthop_account(data, nexthop->occ, false, extack);
+       return err;
+}
+
+static int nsim_nexthop_insert(struct nsim_fib_data *data,
+                              struct nh_notifier_info *info)
+{
+       struct nsim_nexthop *nexthop, *nexthop_old;
+       int err;
+
+       nexthop = nsim_nexthop_create(data, info);
+       if (!nexthop)
+               return -ENOMEM;
+
+       nexthop_old = rhashtable_lookup_fast(&data->nexthop_ht, &info->id,
+                                            nsim_nexthop_ht_params);
+       if (!nexthop_old)
+               err = nsim_nexthop_add(data, nexthop, info->extack);
+       else
+               err = nsim_nexthop_replace(data, nexthop, nexthop_old,
+                                          info->extack);
+
+       if (err)
+               nsim_nexthop_destroy(nexthop);
+
+       return err;
+}
+
+static void nsim_nexthop_remove(struct nsim_fib_data *data,
+                               struct nh_notifier_info *info)
+{
+       struct nsim_nexthop *nexthop;
+
+       nexthop = rhashtable_lookup_fast(&data->nexthop_ht, &info->id,
+                                        nsim_nexthop_ht_params);
+       if (!nexthop)
+               return;
+
+       rhashtable_remove_fast(&data->nexthop_ht, &nexthop->ht_node,
+                              nsim_nexthop_ht_params);
+       nsim_nexthop_account(data, nexthop->occ, false, info->extack);
+       nsim_nexthop_destroy(nexthop);
+}
+
+static int nsim_nexthop_event_nb(struct notifier_block *nb, unsigned long event,
+                                void *ptr)
+{
+       struct nsim_fib_data *data = container_of(nb, struct nsim_fib_data,
+                                                 nexthop_nb);
+       struct nh_notifier_info *info = ptr;
+       int err = 0;
+
+       ASSERT_RTNL();
+
+       switch (event) {
+       case NEXTHOP_EVENT_REPLACE:
+               err = nsim_nexthop_insert(data, info);
+               break;
+       case NEXTHOP_EVENT_DEL:
+               nsim_nexthop_remove(data, info);
+               break;
+       default:
+               break;
+       }
+
+       return notifier_from_errno(err);
+}
+
+static void nsim_nexthop_free(void *ptr, void *arg)
+{
+       struct nsim_nexthop *nexthop = ptr;
+       struct nsim_fib_data *data = arg;
+       struct net *net;
+
+       net = devlink_net(data->devlink);
+       nexthop_set_hw_flags(net, nexthop->id, false, false);
+       nsim_nexthop_account(data, nexthop->occ, false, NULL);
+       nsim_nexthop_destroy(nexthop);
+}
+
 static u64 nsim_fib_ipv4_resource_occ_get(void *priv)
 {
        struct nsim_fib_data *data = priv;
@@ -866,12 +1069,20 @@ static u64 nsim_fib_ipv6_rules_res_occ_get(void *priv)
        return nsim_fib_get_val(data, NSIM_RESOURCE_IPV6_FIB_RULES, false);
 }
 
+static u64 nsim_fib_nexthops_res_occ_get(void *priv)
+{
+       struct nsim_fib_data *data = priv;
+
+       return nsim_fib_get_val(data, NSIM_RESOURCE_NEXTHOPS, false);
+}
+
 static void nsim_fib_set_max_all(struct nsim_fib_data *data,
                                 struct devlink *devlink)
 {
        enum nsim_resource_id res_ids[] = {
                NSIM_RESOURCE_IPV4_FIB, NSIM_RESOURCE_IPV4_FIB_RULES,
-               NSIM_RESOURCE_IPV6_FIB, NSIM_RESOURCE_IPV6_FIB_RULES
+               NSIM_RESOURCE_IPV6_FIB, NSIM_RESOURCE_IPV6_FIB_RULES,
+               NSIM_RESOURCE_NEXTHOPS,
        };
        int i;
 
@@ -897,20 +1108,32 @@ struct nsim_fib_data *nsim_fib_create(struct devlink *devlink,
                return ERR_PTR(-ENOMEM);
        data->devlink = devlink;
 
+       err = rhashtable_init(&data->nexthop_ht, &nsim_nexthop_ht_params);
+       if (err)
+               goto err_data_free;
+
        spin_lock_init(&data->fib_lock);
        INIT_LIST_HEAD(&data->fib_rt_list);
        err = rhashtable_init(&data->fib_rt_ht, &nsim_fib_rt_ht_params);
        if (err)
-               goto err_data_free;
+               goto err_rhashtable_nexthop_destroy;
 
        nsim_fib_set_max_all(data, devlink);
 
+       data->nexthop_nb.notifier_call = nsim_nexthop_event_nb;
+       err = register_nexthop_notifier(devlink_net(devlink), &data->nexthop_nb,
+                                       extack);
+       if (err) {
+               pr_err("Failed to register nexthop notifier\n");
+               goto err_rhashtable_fib_destroy;
+       }
+
        data->fib_nb.notifier_call = nsim_fib_event_nb;
        err = register_fib_notifier(devlink_net(devlink), &data->fib_nb,
                                    nsim_fib_dump_inconsistent, extack);
        if (err) {
                pr_err("Failed to register fib notifier\n");
-               goto err_rhashtable_destroy;
+               goto err_nexthop_nb_unregister;
        }
 
        devlink_resource_occ_get_register(devlink,
@@ -929,11 +1152,20 @@ struct nsim_fib_data *nsim_fib_create(struct devlink *devlink,
                                          NSIM_RESOURCE_IPV6_FIB_RULES,
                                          nsim_fib_ipv6_rules_res_occ_get,
                                          data);
+       devlink_resource_occ_get_register(devlink,
+                                         NSIM_RESOURCE_NEXTHOPS,
+                                         nsim_fib_nexthops_res_occ_get,
+                                         data);
        return data;
 
-err_rhashtable_destroy:
+err_nexthop_nb_unregister:
+       unregister_nexthop_notifier(devlink_net(devlink), &data->nexthop_nb);
+err_rhashtable_fib_destroy:
        rhashtable_free_and_destroy(&data->fib_rt_ht, nsim_fib_rt_free,
                                    data);
+err_rhashtable_nexthop_destroy:
+       rhashtable_free_and_destroy(&data->nexthop_ht, nsim_nexthop_free,
+                                   data);
 err_data_free:
        kfree(data);
        return ERR_PTR(err);
@@ -942,6 +1174,8 @@ err_data_free:
 void nsim_fib_destroy(struct devlink *devlink, struct nsim_fib_data *data)
 {
        devlink_resource_occ_get_unregister(devlink,
+                                           NSIM_RESOURCE_NEXTHOPS);
+       devlink_resource_occ_get_unregister(devlink,
                                            NSIM_RESOURCE_IPV6_FIB_RULES);
        devlink_resource_occ_get_unregister(devlink,
                                            NSIM_RESOURCE_IPV6_FIB);
@@ -950,8 +1184,11 @@ void nsim_fib_destroy(struct devlink *devlink, struct nsim_fib_data *data)
        devlink_resource_occ_get_unregister(devlink,
                                            NSIM_RESOURCE_IPV4_FIB);
        unregister_fib_notifier(devlink_net(devlink), &data->fib_nb);
+       unregister_nexthop_notifier(devlink_net(devlink), &data->nexthop_nb);
        rhashtable_free_and_destroy(&data->fib_rt_ht, nsim_fib_rt_free,
                                    data);
+       rhashtable_free_and_destroy(&data->nexthop_ht, nsim_nexthop_free,
+                                   data);
        WARN_ON_ONCE(!list_empty(&data->fib_rt_list));
        kfree(data);
 }
index 827fc80..698be04 100644 (file)
@@ -158,6 +158,7 @@ enum nsim_resource_id {
        NSIM_RESOURCE_IPV6,
        NSIM_RESOURCE_IPV6_FIB,
        NSIM_RESOURCE_IPV6_FIB_RULES,
+       NSIM_RESOURCE_NEXTHOPS,
 };
 
 struct nsim_dev_health {
index 307f0ac..3727b38 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/bitfield.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
+#include <linux/ethtool_netlink.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/mii.h>
@@ -23,6 +24,7 @@
 #define ADIN1300_PHY_CTRL1                     0x0012
 #define   ADIN1300_AUTO_MDI_EN                 BIT(10)
 #define   ADIN1300_MAN_MDIX_EN                 BIT(9)
+#define   ADIN1300_DIAG_CLK_EN                 BIT(2)
 
 #define ADIN1300_RX_ERR_CNT                    0x0014
 
 #define ADIN1300_CLOCK_STOP_REG                        0x9400
 #define ADIN1300_LPI_WAKE_ERR_CNT_REG          0xa000
 
+#define ADIN1300_CDIAG_RUN                     0xba1b
+#define   ADIN1300_CDIAG_RUN_EN                        BIT(0)
+
+/*
+ * The XSIM3/2/1 and XSHRT3/2/1 are actually relative.
+ * For CDIAG_DTLD_RSLTS(0) it's ADIN1300_CDIAG_RSLT_XSIM3/2/1
+ * For CDIAG_DTLD_RSLTS(1) it's ADIN1300_CDIAG_RSLT_XSIM3/2/0
+ * For CDIAG_DTLD_RSLTS(2) it's ADIN1300_CDIAG_RSLT_XSIM3/1/0
+ * For CDIAG_DTLD_RSLTS(3) it's ADIN1300_CDIAG_RSLT_XSIM2/1/0
+ */
+#define ADIN1300_CDIAG_DTLD_RSLTS(x)           (0xba1d + (x))
+#define   ADIN1300_CDIAG_RSLT_BUSY             BIT(10)
+#define   ADIN1300_CDIAG_RSLT_XSIM3            BIT(9)
+#define   ADIN1300_CDIAG_RSLT_XSIM2            BIT(8)
+#define   ADIN1300_CDIAG_RSLT_XSIM1            BIT(7)
+#define   ADIN1300_CDIAG_RSLT_SIM              BIT(6)
+#define   ADIN1300_CDIAG_RSLT_XSHRT3           BIT(5)
+#define   ADIN1300_CDIAG_RSLT_XSHRT2           BIT(4)
+#define   ADIN1300_CDIAG_RSLT_XSHRT1           BIT(3)
+#define   ADIN1300_CDIAG_RSLT_SHRT             BIT(2)
+#define   ADIN1300_CDIAG_RSLT_OPEN             BIT(1)
+#define   ADIN1300_CDIAG_RSLT_GOOD             BIT(0)
+
+#define ADIN1300_CDIAG_FLT_DIST(x)             (0xba21 + (x))
+
 #define ADIN1300_GE_SOFT_RESET_REG             0xff0c
 #define   ADIN1300_GE_SOFT_RESET               BIT(0)
 
@@ -321,10 +348,9 @@ static int adin_set_downshift(struct phy_device *phydev, u8 cnt)
                return -E2BIG;
 
        val = FIELD_PREP(ADIN1300_DOWNSPEED_RETRIES_MSK, cnt);
-       val |= ADIN1300_LINKING_EN;
 
        rc = phy_modify(phydev, ADIN1300_PHY_CTRL3,
-                       ADIN1300_LINKING_EN | ADIN1300_DOWNSPEED_RETRIES_MSK,
+                       ADIN1300_DOWNSPEED_RETRIES_MSK,
                        val);
        if (rc < 0)
                return rc;
@@ -555,6 +581,14 @@ static int adin_config_aneg(struct phy_device *phydev)
 {
        int ret;
 
+       ret = phy_clear_bits(phydev, ADIN1300_PHY_CTRL1, ADIN1300_DIAG_CLK_EN);
+       if (ret < 0)
+               return ret;
+
+       ret = phy_set_bits(phydev, ADIN1300_PHY_CTRL3, ADIN1300_LINKING_EN);
+       if (ret < 0)
+               return ret;
+
        ret = adin_config_mdix(phydev);
        if (ret)
                return ret;
@@ -725,10 +759,117 @@ static int adin_probe(struct phy_device *phydev)
        return 0;
 }
 
+static int adin_cable_test_start(struct phy_device *phydev)
+{
+       int ret;
+
+       ret = phy_clear_bits(phydev, ADIN1300_PHY_CTRL3, ADIN1300_LINKING_EN);
+       if (ret < 0)
+               return ret;
+
+       ret = phy_clear_bits(phydev, ADIN1300_PHY_CTRL1, ADIN1300_DIAG_CLK_EN);
+       if (ret < 0)
+               return ret;
+
+       /* wait a bit for the clock to stabilize */
+       msleep(50);
+
+       return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, ADIN1300_CDIAG_RUN,
+                               ADIN1300_CDIAG_RUN_EN);
+}
+
+static int adin_cable_test_report_trans(int result)
+{
+       int mask;
+
+       if (result & ADIN1300_CDIAG_RSLT_GOOD)
+               return ETHTOOL_A_CABLE_RESULT_CODE_OK;
+       if (result & ADIN1300_CDIAG_RSLT_OPEN)
+               return ETHTOOL_A_CABLE_RESULT_CODE_OPEN;
+
+       /* short with other pairs */
+       mask = ADIN1300_CDIAG_RSLT_XSHRT3 |
+              ADIN1300_CDIAG_RSLT_XSHRT2 |
+              ADIN1300_CDIAG_RSLT_XSHRT1;
+       if (result & mask)
+               return ETHTOOL_A_CABLE_RESULT_CODE_CROSS_SHORT;
+
+       if (result & ADIN1300_CDIAG_RSLT_SHRT)
+               return ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT;
+
+       return ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC;
+}
+
+static int adin_cable_test_report_pair(struct phy_device *phydev,
+                                      unsigned int pair)
+{
+       int fault_rslt;
+       int ret;
+
+       ret = phy_read_mmd(phydev, MDIO_MMD_VEND1,
+                          ADIN1300_CDIAG_DTLD_RSLTS(pair));
+       if (ret < 0)
+               return ret;
+
+       fault_rslt = adin_cable_test_report_trans(ret);
+
+       ret = ethnl_cable_test_result(phydev, pair, fault_rslt);
+       if (ret < 0)
+               return ret;
+
+       ret = phy_read_mmd(phydev, MDIO_MMD_VEND1,
+                          ADIN1300_CDIAG_FLT_DIST(pair));
+       if (ret < 0)
+               return ret;
+
+       switch (fault_rslt) {
+       case ETHTOOL_A_CABLE_RESULT_CODE_OPEN:
+       case ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT:
+       case ETHTOOL_A_CABLE_RESULT_CODE_CROSS_SHORT:
+               return ethnl_cable_test_fault_length(phydev, pair, ret * 100);
+       default:
+               return  0;
+       }
+}
+
+static int adin_cable_test_report(struct phy_device *phydev)
+{
+       unsigned int pair;
+       int ret;
+
+       for (pair = ETHTOOL_A_CABLE_PAIR_A; pair <= ETHTOOL_A_CABLE_PAIR_D; pair++) {
+               ret = adin_cable_test_report_pair(phydev, pair);
+               if (ret < 0)
+                       return ret;
+       }
+
+       return 0;
+}
+
+static int adin_cable_test_get_status(struct phy_device *phydev,
+                                     bool *finished)
+{
+       int ret;
+
+       *finished = false;
+
+       ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, ADIN1300_CDIAG_RUN);
+       if (ret < 0)
+               return ret;
+
+       if (ret & ADIN1300_CDIAG_RUN_EN)
+               return 0;
+
+       *finished = true;
+
+       return adin_cable_test_report(phydev);
+}
+
 static struct phy_driver adin_driver[] = {
        {
                PHY_ID_MATCH_MODEL(PHY_ID_ADIN1200),
                .name           = "ADIN1200",
+               .flags          = PHY_POLL_CABLE_TEST,
                .probe          = adin_probe,
                .config_init    = adin_config_init,
                .soft_reset     = adin_soft_reset,
@@ -745,10 +886,13 @@ static struct phy_driver adin_driver[] = {
                .suspend        = genphy_suspend,
                .read_mmd       = adin_read_mmd,
                .write_mmd      = adin_write_mmd,
+               .cable_test_start       = adin_cable_test_start,
+               .cable_test_get_status  = adin_cable_test_get_status,
        },
        {
                PHY_ID_MATCH_MODEL(PHY_ID_ADIN1300),
                .name           = "ADIN1300",
+               .flags          = PHY_POLL_CABLE_TEST,
                .probe          = adin_probe,
                .config_init    = adin_config_init,
                .soft_reset     = adin_soft_reset,
@@ -765,6 +909,8 @@ static struct phy_driver adin_driver[] = {
                .suspend        = genphy_suspend,
                .read_mmd       = adin_read_mmd,
                .write_mmd      = adin_write_mmd,
+               .cable_test_start       = adin_cable_test_start,
+               .cable_test_get_status  = adin_cable_test_get_status,
        },
 };
 
index 41e7c14..968dd43 100644 (file)
@@ -52,6 +52,7 @@
 #define MDIO_AN_TX_VEND_INT_STATUS1_DOWNSHIFT  BIT(1)
 
 #define MDIO_AN_TX_VEND_INT_STATUS2            0xcc01
+#define MDIO_AN_TX_VEND_INT_STATUS2_MASK       BIT(0)
 
 #define MDIO_AN_TX_VEND_INT_MASK2              0xd401
 #define MDIO_AN_TX_VEND_INT_MASK2_LINK         BIT(0)
@@ -246,6 +247,13 @@ static int aqr_config_intr(struct phy_device *phydev)
        bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED;
        int err;
 
+       if (en) {
+               /* Clear any pending interrupts before enabling them */
+               err = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_STATUS2);
+               if (err < 0)
+                       return err;
+       }
+
        err = phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_MASK2,
                            en ? MDIO_AN_TX_VEND_INT_MASK2_LINK : 0);
        if (err < 0)
@@ -256,18 +264,39 @@ static int aqr_config_intr(struct phy_device *phydev)
        if (err < 0)
                return err;
 
-       return phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_INT_VEND_MASK,
-                            en ? VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 |
-                            VEND1_GLOBAL_INT_VEND_MASK_AN : 0);
+       err = phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_INT_VEND_MASK,
+                           en ? VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 |
+                           VEND1_GLOBAL_INT_VEND_MASK_AN : 0);
+       if (err < 0)
+               return err;
+
+       if (!en) {
+               /* Clear any pending interrupts after we have disabled them */
+               err = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_STATUS2);
+               if (err < 0)
+                       return err;
+       }
+
+       return 0;
 }
 
-static int aqr_ack_interrupt(struct phy_device *phydev)
+static irqreturn_t aqr_handle_interrupt(struct phy_device *phydev)
 {
-       int reg;
+       int irq_status;
+
+       irq_status = phy_read_mmd(phydev, MDIO_MMD_AN,
+                                 MDIO_AN_TX_VEND_INT_STATUS2);
+       if (irq_status < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+
+       if (!(irq_status & MDIO_AN_TX_VEND_INT_STATUS2_MASK))
+               return IRQ_NONE;
+
+       phy_trigger_machine(phydev);
 
-       reg = phy_read_mmd(phydev, MDIO_MMD_AN,
-                          MDIO_AN_TX_VEND_INT_STATUS2);
-       return (reg < 0) ? reg : 0;
+       return IRQ_HANDLED;
 }
 
 static int aqr_read_status(struct phy_device *phydev)
@@ -584,7 +613,7 @@ static struct phy_driver aqr_driver[] = {
        .name           = "Aquantia AQ1202",
        .config_aneg    = aqr_config_aneg,
        .config_intr    = aqr_config_intr,
-       .ack_interrupt  = aqr_ack_interrupt,
+       .handle_interrupt = aqr_handle_interrupt,
        .read_status    = aqr_read_status,
 },
 {
@@ -592,7 +621,7 @@ static struct phy_driver aqr_driver[] = {
        .name           = "Aquantia AQ2104",
        .config_aneg    = aqr_config_aneg,
        .config_intr    = aqr_config_intr,
-       .ack_interrupt  = aqr_ack_interrupt,
+       .handle_interrupt = aqr_handle_interrupt,
        .read_status    = aqr_read_status,
 },
 {
@@ -600,7 +629,7 @@ static struct phy_driver aqr_driver[] = {
        .name           = "Aquantia AQR105",
        .config_aneg    = aqr_config_aneg,
        .config_intr    = aqr_config_intr,
-       .ack_interrupt  = aqr_ack_interrupt,
+       .handle_interrupt = aqr_handle_interrupt,
        .read_status    = aqr_read_status,
        .suspend        = aqr107_suspend,
        .resume         = aqr107_resume,
@@ -610,7 +639,7 @@ static struct phy_driver aqr_driver[] = {
        .name           = "Aquantia AQR106",
        .config_aneg    = aqr_config_aneg,
        .config_intr    = aqr_config_intr,
-       .ack_interrupt  = aqr_ack_interrupt,
+       .handle_interrupt = aqr_handle_interrupt,
        .read_status    = aqr_read_status,
 },
 {
@@ -620,7 +649,7 @@ static struct phy_driver aqr_driver[] = {
        .config_init    = aqr107_config_init,
        .config_aneg    = aqr_config_aneg,
        .config_intr    = aqr_config_intr,
-       .ack_interrupt  = aqr_ack_interrupt,
+       .handle_interrupt = aqr_handle_interrupt,
        .read_status    = aqr107_read_status,
        .get_tunable    = aqr107_get_tunable,
        .set_tunable    = aqr107_set_tunable,
@@ -638,7 +667,7 @@ static struct phy_driver aqr_driver[] = {
        .config_init    = aqcs109_config_init,
        .config_aneg    = aqr_config_aneg,
        .config_intr    = aqr_config_intr,
-       .ack_interrupt  = aqr_ack_interrupt,
+       .handle_interrupt = aqr_handle_interrupt,
        .read_status    = aqr107_read_status,
        .get_tunable    = aqr107_get_tunable,
        .set_tunable    = aqr107_set_tunable,
@@ -654,7 +683,7 @@ static struct phy_driver aqr_driver[] = {
        .name           = "Aquantia AQR405",
        .config_aneg    = aqr_config_aneg,
        .config_intr    = aqr_config_intr,
-       .ack_interrupt  = aqr_ack_interrupt,
+       .handle_interrupt = aqr_handle_interrupt,
        .read_status    = aqr_read_status,
 },
 };
index ed601a7..d0b36fd 100644 (file)
@@ -614,6 +614,11 @@ static int at803x_config_intr(struct phy_device *phydev)
        value = phy_read(phydev, AT803X_INTR_ENABLE);
 
        if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               /* Clear any pending interrupts */
+               err = at803x_ack_interrupt(phydev);
+               if (err)
+                       return err;
+
                value |= AT803X_INTR_ENABLE_AUTONEG_ERR;
                value |= AT803X_INTR_ENABLE_SPEED_CHANGED;
                value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED;
@@ -621,13 +626,44 @@ static int at803x_config_intr(struct phy_device *phydev)
                value |= AT803X_INTR_ENABLE_LINK_SUCCESS;
 
                err = phy_write(phydev, AT803X_INTR_ENABLE, value);
-       }
-       else
+       } else {
                err = phy_write(phydev, AT803X_INTR_ENABLE, 0);
+               if (err)
+                       return err;
+
+               /* Clear any pending interrupts */
+               err = at803x_ack_interrupt(phydev);
+       }
 
        return err;
 }
 
+static irqreturn_t at803x_handle_interrupt(struct phy_device *phydev)
+{
+       int irq_status, int_enabled;
+
+       irq_status = phy_read(phydev, AT803X_INTR_STATUS);
+       if (irq_status < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+
+       /* Read the current enabled interrupts */
+       int_enabled = phy_read(phydev, AT803X_INTR_ENABLE);
+       if (int_enabled < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+
+       /* See if this was one of our enabled interrupts */
+       if (!(irq_status & int_enabled))
+               return IRQ_NONE;
+
+       phy_trigger_machine(phydev);
+
+       return IRQ_HANDLED;
+}
+
 static void at803x_link_change_notify(struct phy_device *phydev)
 {
        /*
@@ -1062,8 +1098,8 @@ static struct phy_driver at803x_driver[] = {
        .resume                 = at803x_resume,
        /* PHY_GBIT_FEATURES */
        .read_status            = at803x_read_status,
-       .ack_interrupt          = at803x_ack_interrupt,
        .config_intr            = at803x_config_intr,
+       .handle_interrupt       = at803x_handle_interrupt,
        .get_tunable            = at803x_get_tunable,
        .set_tunable            = at803x_set_tunable,
        .cable_test_start       = at803x_cable_test_start,
@@ -1082,8 +1118,8 @@ static struct phy_driver at803x_driver[] = {
        .suspend                = at803x_suspend,
        .resume                 = at803x_resume,
        /* PHY_BASIC_FEATURES */
-       .ack_interrupt          = at803x_ack_interrupt,
        .config_intr            = at803x_config_intr,
+       .handle_interrupt       = at803x_handle_interrupt,
 }, {
        /* Qualcomm Atheros AR8031/AR8033 */
        PHY_ID_MATCH_EXACT(ATH8031_PHY_ID),
@@ -1100,8 +1136,8 @@ static struct phy_driver at803x_driver[] = {
        /* PHY_GBIT_FEATURES */
        .read_status            = at803x_read_status,
        .aneg_done              = at803x_aneg_done,
-       .ack_interrupt          = &at803x_ack_interrupt,
        .config_intr            = &at803x_config_intr,
+       .handle_interrupt       = at803x_handle_interrupt,
        .get_tunable            = at803x_get_tunable,
        .set_tunable            = at803x_set_tunable,
        .cable_test_start       = at803x_cable_test_start,
@@ -1120,8 +1156,8 @@ static struct phy_driver at803x_driver[] = {
        .suspend                = at803x_suspend,
        .resume                 = at803x_resume,
        /* PHY_BASIC_FEATURES */
-       .ack_interrupt          = at803x_ack_interrupt,
        .config_intr            = at803x_config_intr,
+       .handle_interrupt       = at803x_handle_interrupt,
        .cable_test_start       = at803x_cable_test_start,
        .cable_test_get_status  = at803x_cable_test_get_status,
 }, {
@@ -1132,8 +1168,8 @@ static struct phy_driver at803x_driver[] = {
        .resume                 = at803x_resume,
        .flags                  = PHY_POLL_CABLE_TEST,
        /* PHY_BASIC_FEATURES */
-       .ack_interrupt          = &at803x_ack_interrupt,
        .config_intr            = &at803x_config_intr,
+       .handle_interrupt       = at803x_handle_interrupt,
        .cable_test_start       = at803x_cable_test_start,
        .cable_test_get_status  = at803x_cable_test_get_status,
        .read_status            = at803x_read_status,
index 9ccf28b..da8f7cb 100644 (file)
@@ -256,8 +256,8 @@ static struct phy_driver bcm_cygnus_phy_driver[] = {
        .name          = "Broadcom Cygnus PHY",
        /* PHY_GBIT_FEATURES */
        .config_init   = bcm_cygnus_config_init,
-       .ack_interrupt = bcm_phy_ack_intr,
        .config_intr   = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
        .suspend       = genphy_suspend,
        .resume        = bcm_cygnus_resume,
 }, {
index ef6825b..53282a6 100644 (file)
@@ -181,21 +181,62 @@ EXPORT_SYMBOL_GPL(bcm_phy_ack_intr);
 
 int bcm_phy_config_intr(struct phy_device *phydev)
 {
-       int reg;
+       int reg, err;
 
        reg = phy_read(phydev, MII_BCM54XX_ECR);
        if (reg < 0)
                return reg;
 
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               err = bcm_phy_ack_intr(phydev);
+               if (err)
+                       return err;
+
                reg &= ~MII_BCM54XX_ECR_IM;
-       else
+               err = phy_write(phydev, MII_BCM54XX_ECR, reg);
+       } else {
                reg |= MII_BCM54XX_ECR_IM;
+               err = phy_write(phydev, MII_BCM54XX_ECR, reg);
+               if (err)
+                       return err;
 
-       return phy_write(phydev, MII_BCM54XX_ECR, reg);
+               err = bcm_phy_ack_intr(phydev);
+       }
+       return err;
 }
 EXPORT_SYMBOL_GPL(bcm_phy_config_intr);
 
+irqreturn_t bcm_phy_handle_interrupt(struct phy_device *phydev)
+{
+       int irq_status, irq_mask;
+
+       irq_status = phy_read(phydev, MII_BCM54XX_ISR);
+       if (irq_status < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+
+       /* If a bit from the Interrupt Mask register is set, the corresponding
+        * bit from the Interrupt Status register is masked. So read the IMR
+        * and then flip the bits to get the list of possible interrupt
+        * sources.
+        */
+       irq_mask = phy_read(phydev, MII_BCM54XX_IMR);
+       if (irq_mask < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+       irq_mask = ~irq_mask;
+
+       if (!(irq_status & irq_mask))
+               return IRQ_NONE;
+
+       phy_trigger_machine(phydev);
+
+       return IRQ_HANDLED;
+}
+EXPORT_SYMBOL_GPL(bcm_phy_handle_interrupt);
+
 int bcm_phy_read_shadow(struct phy_device *phydev, u16 shadow)
 {
        phy_write(phydev, MII_BCM54XX_SHD, MII_BCM54XX_SHD_VAL(shadow));
index 237a850..c3842f8 100644 (file)
@@ -63,6 +63,7 @@ int bcm_phy_modify_rdb(struct phy_device *phydev, u16 rdb, u16 mask,
 
 int bcm_phy_ack_intr(struct phy_device *phydev);
 int bcm_phy_config_intr(struct phy_device *phydev);
+irqreturn_t bcm_phy_handle_interrupt(struct phy_device *phydev);
 
 int bcm_phy_enable_apd(struct phy_device *phydev, bool dll_pwr_down);
 
index 8998e68..d8f3024 100644 (file)
@@ -637,13 +637,29 @@ static int bcm54140_config_init(struct phy_device *phydev)
                                  BCM54140_RDB_C_PWR_ISOLATE, 0);
 }
 
-static int bcm54140_did_interrupt(struct phy_device *phydev)
+static irqreturn_t bcm54140_handle_interrupt(struct phy_device *phydev)
 {
-       int ret;
+       int irq_status, irq_mask;
+
+       irq_status = bcm_phy_read_rdb(phydev, BCM54140_RDB_ISR);
+       if (irq_status < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+
+       irq_mask = bcm_phy_read_rdb(phydev, BCM54140_RDB_IMR);
+       if (irq_mask < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+       irq_mask = ~irq_mask;
+
+       if (!(irq_status & irq_mask))
+               return IRQ_NONE;
 
-       ret = bcm_phy_read_rdb(phydev, BCM54140_RDB_ISR);
+       phy_trigger_machine(phydev);
 
-       return (ret < 0) ? 0 : ret;
+       return IRQ_HANDLED;
 }
 
 static int bcm54140_ack_intr(struct phy_device *phydev)
@@ -665,7 +681,7 @@ static int bcm54140_config_intr(struct phy_device *phydev)
                BCM54140_RDB_TOP_IMR_PORT0, BCM54140_RDB_TOP_IMR_PORT1,
                BCM54140_RDB_TOP_IMR_PORT2, BCM54140_RDB_TOP_IMR_PORT3,
        };
-       int reg;
+       int reg, err;
 
        if (priv->port >= ARRAY_SIZE(port_to_imr_bit))
                return -EINVAL;
@@ -674,12 +690,23 @@ static int bcm54140_config_intr(struct phy_device *phydev)
        if (reg < 0)
                return reg;
 
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               err = bcm54140_ack_intr(phydev);
+               if (err)
+                       return err;
+
                reg &= ~port_to_imr_bit[priv->port];
-       else
+               err = bcm54140_base_write_rdb(phydev, BCM54140_RDB_TOP_IMR, reg);
+       } else {
                reg |= port_to_imr_bit[priv->port];
+               err = bcm54140_base_write_rdb(phydev, BCM54140_RDB_TOP_IMR, reg);
+               if (err)
+                       return err;
+
+               err = bcm54140_ack_intr(phydev);
+       }
 
-       return bcm54140_base_write_rdb(phydev, BCM54140_RDB_TOP_IMR, reg);
+       return err;
 }
 
 static int bcm54140_get_downshift(struct phy_device *phydev, u8 *data)
@@ -834,8 +861,7 @@ static struct phy_driver bcm54140_drivers[] = {
                .flags          = PHY_POLL_CABLE_TEST,
                .features       = PHY_GBIT_FEATURES,
                .config_init    = bcm54140_config_init,
-               .did_interrupt  = bcm54140_did_interrupt,
-               .ack_interrupt  = bcm54140_ack_intr,
+               .handle_interrupt = bcm54140_handle_interrupt,
                .config_intr    = bcm54140_config_intr,
                .probe          = bcm54140_probe,
                .suspend        = genphy_suspend,
index 459fb20..0eb33be 100644 (file)
@@ -25,12 +25,22 @@ static int bcm63xx_config_intr(struct phy_device *phydev)
        if (reg < 0)
                return reg;
 
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               err = bcm_phy_ack_intr(phydev);
+               if (err)
+                       return err;
+
                reg &= ~MII_BCM63XX_IR_GMASK;
-       else
+               err = phy_write(phydev, MII_BCM63XX_IR, reg);
+       } else {
                reg |= MII_BCM63XX_IR_GMASK;
+               err = phy_write(phydev, MII_BCM63XX_IR, reg);
+               if (err)
+                       return err;
+
+               err = bcm_phy_ack_intr(phydev);
+       }
 
-       err = phy_write(phydev, MII_BCM63XX_IR, reg);
        return err;
 }
 
@@ -67,8 +77,8 @@ static struct phy_driver bcm63xx_driver[] = {
        /* PHY_BASIC_FEATURES */
        .flags          = PHY_IS_INTERNAL,
        .config_init    = bcm63xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm63xx_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 }, {
        /* same phy as above, with just a different OUI */
        .phy_id         = 0x002bdc00,
@@ -77,8 +87,8 @@ static struct phy_driver bcm63xx_driver[] = {
        /* PHY_BASIC_FEATURES */
        .flags          = PHY_IS_INTERNAL,
        .config_init    = bcm63xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm63xx_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 } };
 
 module_phy_driver(bcm63xx_driver);
index df360e1..4ac8fd1 100644 (file)
@@ -144,35 +144,41 @@ static int bcm87xx_config_intr(struct phy_device *phydev)
        if (reg < 0)
                return reg;
 
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               err = phy_read(phydev, BCM87XX_LASI_STATUS);
+               if (err)
+                       return err;
+
                reg |= 1;
-       else
+               err = phy_write(phydev, BCM87XX_LASI_CONTROL, reg);
+       } else {
                reg &= ~1;
+               err = phy_write(phydev, BCM87XX_LASI_CONTROL, reg);
+               if (err)
+                       return err;
+
+               err = phy_read(phydev, BCM87XX_LASI_STATUS);
+       }
 
-       err = phy_write(phydev, BCM87XX_LASI_CONTROL, reg);
        return err;
 }
 
-static int bcm87xx_did_interrupt(struct phy_device *phydev)
+static irqreturn_t bcm87xx_handle_interrupt(struct phy_device *phydev)
 {
-       int reg;
+       int irq_status;
 
-       reg = phy_read(phydev, BCM87XX_LASI_STATUS);
-
-       if (reg < 0) {
-               phydev_err(phydev,
-                          "Error: Read of BCM87XX_LASI_STATUS failed: %d\n",
-                          reg);
-               return 0;
+       irq_status = phy_read(phydev, BCM87XX_LASI_STATUS);
+       if (irq_status < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
        }
-       return (reg & 1) != 0;
-}
 
-static int bcm87xx_ack_interrupt(struct phy_device *phydev)
-{
-       /* Reading the LASI status clears it. */
-       bcm87xx_did_interrupt(phydev);
-       return 0;
+       if (irq_status == 0)
+               return IRQ_NONE;
+
+       phy_trigger_machine(phydev);
+
+       return IRQ_HANDLED;
 }
 
 static int bcm8706_match_phy_device(struct phy_device *phydev)
@@ -194,9 +200,8 @@ static struct phy_driver bcm87xx_driver[] = {
        .config_init    = bcm87xx_config_init,
        .config_aneg    = bcm87xx_config_aneg,
        .read_status    = bcm87xx_read_status,
-       .ack_interrupt  = bcm87xx_ack_interrupt,
        .config_intr    = bcm87xx_config_intr,
-       .did_interrupt  = bcm87xx_did_interrupt,
+       .handle_interrupt = bcm87xx_handle_interrupt,
        .match_phy_device = bcm8706_match_phy_device,
 }, {
        .phy_id         = PHY_ID_BCM8727,
@@ -206,9 +211,8 @@ static struct phy_driver bcm87xx_driver[] = {
        .config_init    = bcm87xx_config_init,
        .config_aneg    = bcm87xx_config_aneg,
        .read_status    = bcm87xx_read_status,
-       .ack_interrupt  = bcm87xx_ack_interrupt,
        .config_intr    = bcm87xx_config_intr,
-       .did_interrupt  = bcm87xx_did_interrupt,
+       .handle_interrupt = bcm87xx_handle_interrupt,
        .match_phy_device = bcm8727_match_phy_device,
 } };
 
index cd271de..8a4ec32 100644 (file)
@@ -634,15 +634,43 @@ static int brcm_fet_config_intr(struct phy_device *phydev)
        if (reg < 0)
                return reg;
 
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               err = brcm_fet_ack_interrupt(phydev);
+               if (err)
+                       return err;
+
                reg &= ~MII_BRCM_FET_IR_MASK;
-       else
+               err = phy_write(phydev, MII_BRCM_FET_INTREG, reg);
+       } else {
                reg |= MII_BRCM_FET_IR_MASK;
+               err = phy_write(phydev, MII_BRCM_FET_INTREG, reg);
+               if (err)
+                       return err;
+
+               err = brcm_fet_ack_interrupt(phydev);
+       }
 
-       err = phy_write(phydev, MII_BRCM_FET_INTREG, reg);
        return err;
 }
 
+static irqreturn_t brcm_fet_handle_interrupt(struct phy_device *phydev)
+{
+       int irq_status;
+
+       irq_status = phy_read(phydev, MII_BRCM_FET_INTREG);
+       if (irq_status < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+
+       if (irq_status == 0)
+               return IRQ_NONE;
+
+       phy_trigger_machine(phydev);
+
+       return IRQ_HANDLED;
+}
+
 struct bcm53xx_phy_priv {
        u64     *stats;
 };
@@ -681,40 +709,40 @@ static struct phy_driver broadcom_drivers[] = {
        .name           = "Broadcom BCM5411",
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCM5421,
        .phy_id_mask    = 0xfffffff0,
        .name           = "Broadcom BCM5421",
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCM54210E,
        .phy_id_mask    = 0xfffffff0,
        .name           = "Broadcom BCM54210E",
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCM5461,
        .phy_id_mask    = 0xfffffff0,
        .name           = "Broadcom BCM5461",
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCM54612E,
        .phy_id_mask    = 0xfffffff0,
        .name           = "Broadcom BCM54612E",
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCM54616S,
        .phy_id_mask    = 0xfffffff0,
@@ -722,8 +750,8 @@ static struct phy_driver broadcom_drivers[] = {
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
        .config_aneg    = bcm54616s_config_aneg,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
        .read_status    = bcm54616s_read_status,
        .probe          = bcm54616s_probe,
 }, {
@@ -732,8 +760,8 @@ static struct phy_driver broadcom_drivers[] = {
        .name           = "Broadcom BCM5464",
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
        .suspend        = genphy_suspend,
        .resume         = genphy_resume,
 }, {
@@ -743,8 +771,8 @@ static struct phy_driver broadcom_drivers[] = {
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
        .config_aneg    = bcm5481_config_aneg,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCM54810,
        .phy_id_mask    = 0xfffffff0,
@@ -752,8 +780,8 @@ static struct phy_driver broadcom_drivers[] = {
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
        .config_aneg    = bcm5481_config_aneg,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
        .suspend        = genphy_suspend,
        .resume         = bcm54xx_resume,
 }, {
@@ -763,8 +791,8 @@ static struct phy_driver broadcom_drivers[] = {
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54811_config_init,
        .config_aneg    = bcm5481_config_aneg,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
        .suspend        = genphy_suspend,
        .resume         = bcm54xx_resume,
 }, {
@@ -774,48 +802,48 @@ static struct phy_driver broadcom_drivers[] = {
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm5482_config_init,
        .read_status    = bcm5482_read_status,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCM50610,
        .phy_id_mask    = 0xfffffff0,
        .name           = "Broadcom BCM50610",
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCM50610M,
        .phy_id_mask    = 0xfffffff0,
        .name           = "Broadcom BCM50610M",
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCM57780,
        .phy_id_mask    = 0xfffffff0,
        .name           = "Broadcom BCM57780",
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCMAC131,
        .phy_id_mask    = 0xfffffff0,
        .name           = "Broadcom BCMAC131",
        /* PHY_BASIC_FEATURES */
        .config_init    = brcm_fet_config_init,
-       .ack_interrupt  = brcm_fet_ack_interrupt,
        .config_intr    = brcm_fet_config_intr,
+       .handle_interrupt = brcm_fet_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCM5241,
        .phy_id_mask    = 0xfffffff0,
        .name           = "Broadcom BCM5241",
        /* PHY_BASIC_FEATURES */
        .config_init    = brcm_fet_config_init,
-       .ack_interrupt  = brcm_fet_ack_interrupt,
        .config_intr    = brcm_fet_config_intr,
+       .handle_interrupt = brcm_fet_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCM5395,
        .phy_id_mask    = 0xfffffff0,
@@ -837,16 +865,16 @@ static struct phy_driver broadcom_drivers[] = {
        .get_stats      = bcm53xx_phy_get_stats,
        .probe          = bcm53xx_phy_probe,
        .config_init    = bcm54xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 }, {
        .phy_id         = PHY_ID_BCM89610,
        .phy_id_mask    = 0xfffffff0,
        .name           = "Broadcom BCM89610",
        /* PHY_GBIT_FEATURES */
        .config_init    = bcm54xx_config_init,
-       .ack_interrupt  = bcm_phy_ack_intr,
        .config_intr    = bcm_phy_config_intr,
+       .handle_interrupt = bcm_phy_handle_interrupt,
 } };
 
 module_phy_driver(broadcom_drivers);
index 9d1612a..ef5f412 100644 (file)
@@ -87,15 +87,42 @@ static int cis820x_config_intr(struct phy_device *phydev)
 {
        int err;
 
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               err = cis820x_ack_interrupt(phydev);
+               if (err)
+                       return err;
+
                err = phy_write(phydev, MII_CIS8201_IMASK,
                                MII_CIS8201_IMASK_MASK);
-       else
+       } else {
                err = phy_write(phydev, MII_CIS8201_IMASK, 0);
+               if (err)
+                       return err;
+
+               err = cis820x_ack_interrupt(phydev);
+       }
 
        return err;
 }
 
+static irqreturn_t cis820x_handle_interrupt(struct phy_device *phydev)
+{
+       int irq_status;
+
+       irq_status = phy_read(phydev, MII_CIS8201_ISTAT);
+       if (irq_status < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+
+       if (!(irq_status & MII_CIS8201_IMASK_MASK))
+               return IRQ_NONE;
+
+       phy_trigger_machine(phydev);
+
+       return IRQ_HANDLED;
+}
+
 /* Cicada 8201, a.k.a Vitesse VSC8201 */
 static struct phy_driver cis820x_driver[] = {
 {
@@ -104,16 +131,16 @@ static struct phy_driver cis820x_driver[] = {
        .phy_id_mask    = 0x000ffff0,
        /* PHY_GBIT_FEATURES */
        .config_init    = &cis820x_config_init,
-       .ack_interrupt  = &cis820x_ack_interrupt,
        .config_intr    = &cis820x_config_intr,
+       .handle_interrupt = &cis820x_handle_interrupt,
 }, {
        .phy_id         = 0x000fc440,
        .name           = "Cicada Cis8204",
        .phy_id_mask    = 0x000fffc0,
        /* PHY_GBIT_FEATURES */
        .config_init    = &cis820x_config_init,
-       .ack_interrupt  = &cis820x_ack_interrupt,
        .config_intr    = &cis820x_config_intr,
+       .handle_interrupt = &cis820x_handle_interrupt,
 } };
 
 module_phy_driver(cis820x_driver);
index 942f277..a3b3842 100644 (file)
 #define MII_DM9161_INTR_STOP   \
 (MII_DM9161_INTR_DPLX_MASK | MII_DM9161_INTR_SPD_MASK \
  | MII_DM9161_INTR_LINK_MASK | MII_DM9161_INTR_MASK)
+#define MII_DM9161_INTR_CHANGE \
+       (MII_DM9161_INTR_DPLX_CHANGE | \
+        MII_DM9161_INTR_SPD_CHANGE | \
+        MII_DM9161_INTR_LINK_CHANGE)
 
 /* DM9161 10BT Configuration/Status */
 #define MII_DM9161_10BTCSR     0x12
@@ -57,24 +61,58 @@ MODULE_AUTHOR("Andy Fleming");
 MODULE_LICENSE("GPL");
 
 
+static int dm9161_ack_interrupt(struct phy_device *phydev)
+{
+       int err = phy_read(phydev, MII_DM9161_INTR);
+
+       return (err < 0) ? err : 0;
+}
+
 #define DM9161_DELAY 1
 static int dm9161_config_intr(struct phy_device *phydev)
 {
-       int temp;
+       int temp, err;
 
        temp = phy_read(phydev, MII_DM9161_INTR);
 
        if (temp < 0)
                return temp;
 
-       if (PHY_INTERRUPT_ENABLED == phydev->interrupts)
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               err = dm9161_ack_interrupt(phydev);
+               if (err)
+                       return err;
+
                temp &= ~(MII_DM9161_INTR_STOP);
-       else
+               err = phy_write(phydev, MII_DM9161_INTR, temp);
+       } else {
                temp |= MII_DM9161_INTR_STOP;
+               err = phy_write(phydev, MII_DM9161_INTR, temp);
+               if (err)
+                       return err;
+
+               err = dm9161_ack_interrupt(phydev);
+       }
+
+       return err;
+}
 
-       temp = phy_write(phydev, MII_DM9161_INTR, temp);
+static irqreturn_t dm9161_handle_interrupt(struct phy_device *phydev)
+{
+       int irq_status;
+
+       irq_status = phy_read(phydev, MII_DM9161_INTR);
+       if (irq_status < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
 
-       return temp;
+       if (!(irq_status & MII_DM9161_INTR_CHANGE))
+               return IRQ_NONE;
+
+       phy_trigger_machine(phydev);
+
+       return IRQ_HANDLED;
 }
 
 static int dm9161_config_aneg(struct phy_device *phydev)
@@ -132,13 +170,6 @@ static int dm9161_config_init(struct phy_device *phydev)
        return phy_write(phydev, MII_BMCR, BMCR_ANENABLE);
 }
 
-static int dm9161_ack_interrupt(struct phy_device *phydev)
-{
-       int err = phy_read(phydev, MII_DM9161_INTR);
-
-       return (err < 0) ? err : 0;
-}
-
 static struct phy_driver dm91xx_driver[] = {
 {
        .phy_id         = 0x0181b880,
@@ -147,8 +178,8 @@ static struct phy_driver dm91xx_driver[] = {
        /* PHY_BASIC_FEATURES */
        .config_init    = dm9161_config_init,
        .config_aneg    = dm9161_config_aneg,
-       .ack_interrupt  = dm9161_ack_interrupt,
        .config_intr    = dm9161_config_intr,
+       .handle_interrupt = dm9161_handle_interrupt,
 }, {
        .phy_id         = 0x0181b8b0,
        .name           = "Davicom DM9161B/C",
@@ -156,8 +187,8 @@ static struct phy_driver dm91xx_driver[] = {
        /* PHY_BASIC_FEATURES */
        .config_init    = dm9161_config_init,
        .config_aneg    = dm9161_config_aneg,
-       .ack_interrupt  = dm9161_ack_interrupt,
        .config_intr    = dm9161_config_intr,
+       .handle_interrupt = dm9161_handle_interrupt,
 }, {
        .phy_id         = 0x0181b8a0,
        .name           = "Davicom DM9161A",
@@ -165,15 +196,15 @@ static struct phy_driver dm91xx_driver[] = {
        /* PHY_BASIC_FEATURES */
        .config_init    = dm9161_config_init,
        .config_aneg    = dm9161_config_aneg,
-       .ack_interrupt  = dm9161_ack_interrupt,
        .config_intr    = dm9161_config_intr,
+       .handle_interrupt = dm9161_handle_interrupt,
 }, {
        .phy_id         = 0x00181b80,
        .name           = "Davicom DM9131",
        .phy_id_mask    = 0x0ffffff0,
        /* PHY_BASIC_FEATURES */
-       .ack_interrupt  = dm9161_ack_interrupt,
        .config_intr    = dm9161_config_intr,
+       .handle_interrupt = dm9161_handle_interrupt,
 } };
 
 module_phy_driver(dm91xx_driver);
index 5aec673..2563526 100644 (file)
 #define MII_M1111_HWCFG_MODE_FIBER_RGMII       0x3
 #define MII_M1111_HWCFG_MODE_SGMII_NO_CLK      0x4
 #define MII_M1111_HWCFG_MODE_RTBI              0x7
+#define MII_M1111_HWCFG_MODE_COPPER_1000X_AN   0x8
 #define MII_M1111_HWCFG_MODE_COPPER_RTBI       0x9
 #define MII_M1111_HWCFG_MODE_COPPER_RGMII      0xb
+#define MII_M1111_HWCFG_MODE_COPPER_1000X_NOAN 0xc
+#define MII_M1111_HWCFG_SERIAL_AN_BYPASS       BIT(12)
 #define MII_M1111_HWCFG_FIBER_COPPER_RES       BIT(13)
 #define MII_M1111_HWCFG_FIBER_COPPER_AUTO      BIT(15)
 
@@ -629,6 +632,51 @@ static int marvell_config_aneg_fiber(struct phy_device *phydev)
        return genphy_check_and_restart_aneg(phydev, changed);
 }
 
+static int m88e1111_config_aneg(struct phy_device *phydev)
+{
+       int extsr = phy_read(phydev, MII_M1111_PHY_EXT_SR);
+       int err;
+
+       if (extsr < 0)
+               return extsr;
+
+       /* If not using SGMII or copper 1000BaseX modes, use normal process.
+        * Steps below are only required for these modes.
+        */
+       if (phydev->interface != PHY_INTERFACE_MODE_SGMII &&
+           (extsr & MII_M1111_HWCFG_MODE_MASK) !=
+           MII_M1111_HWCFG_MODE_COPPER_1000X_AN)
+               return marvell_config_aneg(phydev);
+
+       err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE);
+       if (err < 0)
+               goto error;
+
+       /* Configure the copper link first */
+       err = marvell_config_aneg(phydev);
+       if (err < 0)
+               goto error;
+
+       /* Do not touch the fiber page if we're in copper->sgmii mode */
+       if (phydev->interface == PHY_INTERFACE_MODE_SGMII)
+               return 0;
+
+       /* Then the fiber link */
+       err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE);
+       if (err < 0)
+               goto error;
+
+       err = marvell_config_aneg_fiber(phydev);
+       if (err < 0)
+               goto error;
+
+       return marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE);
+
+error:
+       marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE);
+       return err;
+}
+
 static int m88e1510_config_aneg(struct phy_device *phydev)
 {
        int err;
@@ -696,7 +744,7 @@ static void marvell_config_led(struct phy_device *phydev)
 
 static int marvell_config_init(struct phy_device *phydev)
 {
-       /* Set defalut LED */
+       /* Set default LED */
        marvell_config_led(phydev);
 
        /* Set registers from marvell,reg-init DT property */
@@ -814,6 +862,28 @@ static int m88e1111_config_init_rtbi(struct phy_device *phydev)
                MII_M1111_HWCFG_FIBER_COPPER_AUTO);
 }
 
+static int m88e1111_config_init_1000basex(struct phy_device *phydev)
+{
+       int extsr = phy_read(phydev, MII_M1111_PHY_EXT_SR);
+       int err, mode;
+
+       if (extsr < 0)
+               return extsr;
+
+       /* If using copper mode, ensure 1000BaseX auto-negotiation is enabled */
+       mode = extsr & MII_M1111_HWCFG_MODE_MASK;
+       if (mode == MII_M1111_HWCFG_MODE_COPPER_1000X_NOAN) {
+               err = phy_modify(phydev, MII_M1111_PHY_EXT_SR,
+                                MII_M1111_HWCFG_MODE_MASK |
+                                MII_M1111_HWCFG_SERIAL_AN_BYPASS,
+                                MII_M1111_HWCFG_MODE_COPPER_1000X_AN |
+                                MII_M1111_HWCFG_SERIAL_AN_BYPASS);
+               if (err < 0)
+                       return err;
+       }
+       return 0;
+}
+
 static int m88e1111_config_init(struct phy_device *phydev)
 {
        int err;
@@ -836,6 +906,12 @@ static int m88e1111_config_init(struct phy_device *phydev)
                        return err;
        }
 
+       if (phydev->interface == PHY_INTERFACE_MODE_1000BASEX) {
+               err = m88e1111_config_init_1000basex(phydev);
+               if (err < 0)
+                       return err;
+       }
+
        err = marvell_of_reg_init(phydev);
        if (err < 0)
                return err;
@@ -2658,7 +2734,28 @@ static struct phy_driver marvell_drivers[] = {
                /* PHY_GBIT_FEATURES */
                .probe = marvell_probe,
                .config_init = m88e1111_config_init,
-               .config_aneg = marvell_config_aneg,
+               .config_aneg = m88e1111_config_aneg,
+               .read_status = marvell_read_status,
+               .ack_interrupt = marvell_ack_interrupt,
+               .config_intr = marvell_config_intr,
+               .resume = genphy_resume,
+               .suspend = genphy_suspend,
+               .read_page = marvell_read_page,
+               .write_page = marvell_write_page,
+               .get_sset_count = marvell_get_sset_count,
+               .get_strings = marvell_get_strings,
+               .get_stats = marvell_get_stats,
+               .get_tunable = m88e1111_get_tunable,
+               .set_tunable = m88e1111_set_tunable,
+       },
+       {
+               .phy_id = MARVELL_PHY_ID_88E1111_FINISAR,
+               .phy_id_mask = MARVELL_PHY_ID_MASK,
+               .name = "Marvell 88E1111 (Finisar)",
+               /* PHY_GBIT_FEATURES */
+               .probe = marvell_probe,
+               .config_init = m88e1111_config_init,
+               .config_aneg = m88e1111_config_aneg,
                .read_status = marvell_read_status,
                .ack_interrupt = marvell_ack_interrupt,
                .config_intr = marvell_config_intr,
@@ -2989,6 +3086,7 @@ static struct mdio_device_id __maybe_unused marvell_tbl[] = {
        { MARVELL_PHY_ID_88E1101, MARVELL_PHY_ID_MASK },
        { MARVELL_PHY_ID_88E1112, MARVELL_PHY_ID_MASK },
        { MARVELL_PHY_ID_88E1111, MARVELL_PHY_ID_MASK },
+       { MARVELL_PHY_ID_88E1111_FINISAR, MARVELL_PHY_ID_MASK },
        { MARVELL_PHY_ID_88E1118, MARVELL_PHY_ID_MASK },
        { MARVELL_PHY_ID_88E1121R, MARVELL_PHY_ID_MASK },
        { MARVELL_PHY_ID_88E1145, MARVELL_PHY_ID_MASK },
index fed3e39..1c99001 100644 (file)
@@ -219,7 +219,6 @@ static struct phy_driver microchip_t1_phy_driver[] = {
                .features       = PHY_BASIC_T1_FEATURES,
 
                .config_init    = lan87xx_config_init,
-               .config_aneg    = genphy_config_aneg,
 
                .ack_interrupt  = lan87xx_phy_ack_interrupt,
                .config_intr    = lan87xx_phy_config_intr,
index 6bc7406..2f2157e 100644 (file)
@@ -1498,7 +1498,7 @@ static irqreturn_t vsc8584_handle_interrupt(struct phy_device *phydev)
                vsc8584_handle_macsec_interrupt(phydev);
 
        if (irq_status & MII_VSC85XX_INT_MASK_LINK_CHG)
-               phy_mac_interrupt(phydev);
+               phy_trigger_machine(phydev);
 
        return IRQ_HANDLED;
 }
@@ -1541,16 +1541,6 @@ static int vsc85xx_config_init(struct phy_device *phydev)
        return 0;
 }
 
-static int vsc8584_did_interrupt(struct phy_device *phydev)
-{
-       int rc = 0;
-
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
-               rc = phy_read(phydev, MII_VSC85XX_INT_STATUS);
-
-       return (rc < 0) ? 0 : rc & MII_VSC85XX_INT_MASK_MASK;
-}
-
 static int vsc8514_config_pre_init(struct phy_device *phydev)
 {
        /* These are the settings to override the silicon default
@@ -1933,6 +1923,10 @@ static int vsc85xx_config_intr(struct phy_device *phydev)
        int rc;
 
        if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               rc = vsc85xx_ack_interrupt(phydev);
+               if (rc)
+                       return rc;
+
                vsc8584_config_macsec_intr(phydev);
                vsc8584_config_ts_intr(phydev);
 
@@ -1943,11 +1937,33 @@ static int vsc85xx_config_intr(struct phy_device *phydev)
                if (rc < 0)
                        return rc;
                rc = phy_read(phydev, MII_VSC85XX_INT_STATUS);
+               if (rc < 0)
+                       return rc;
+
+               rc = vsc85xx_ack_interrupt(phydev);
        }
 
        return rc;
 }
 
+static irqreturn_t vsc85xx_handle_interrupt(struct phy_device *phydev)
+{
+       int irq_status;
+
+       irq_status = phy_read(phydev, MII_VSC85XX_INT_STATUS);
+       if (irq_status < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+
+       if (!(irq_status & MII_VSC85XX_INT_MASK_MASK))
+               return IRQ_NONE;
+
+       phy_trigger_machine(phydev);
+
+       return IRQ_HANDLED;
+}
+
 static int vsc85xx_config_aneg(struct phy_device *phydev)
 {
        int rc;
@@ -2114,7 +2130,7 @@ static struct phy_driver vsc85xx_driver[] = {
        .config_init    = &vsc85xx_config_init,
        .config_aneg    = &vsc85xx_config_aneg,
        .read_status    = &vsc85xx_read_status,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
+       .handle_interrupt = vsc85xx_handle_interrupt,
        .config_intr    = &vsc85xx_config_intr,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
@@ -2139,9 +2155,8 @@ static struct phy_driver vsc85xx_driver[] = {
        .config_aneg    = &vsc85xx_config_aneg,
        .aneg_done      = &genphy_aneg_done,
        .read_status    = &vsc85xx_read_status,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
+       .handle_interrupt = vsc85xx_handle_interrupt,
        .config_intr    = &vsc85xx_config_intr,
-       .did_interrupt  = &vsc8584_did_interrupt,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
        .probe          = &vsc8574_probe,
@@ -2163,7 +2178,7 @@ static struct phy_driver vsc85xx_driver[] = {
        .config_init    = &vsc8514_config_init,
        .config_aneg    = &vsc85xx_config_aneg,
        .read_status    = &vsc85xx_read_status,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
+       .handle_interrupt = vsc85xx_handle_interrupt,
        .config_intr    = &vsc85xx_config_intr,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
@@ -2187,7 +2202,7 @@ static struct phy_driver vsc85xx_driver[] = {
        .config_init    = &vsc85xx_config_init,
        .config_aneg    = &vsc85xx_config_aneg,
        .read_status    = &vsc85xx_read_status,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
+       .handle_interrupt = vsc85xx_handle_interrupt,
        .config_intr    = &vsc85xx_config_intr,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
@@ -2211,7 +2226,7 @@ static struct phy_driver vsc85xx_driver[] = {
        .config_init    = &vsc85xx_config_init,
        .config_aneg    = &vsc85xx_config_aneg,
        .read_status    = &vsc85xx_read_status,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
+       .handle_interrupt = vsc85xx_handle_interrupt,
        .config_intr    = &vsc85xx_config_intr,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
@@ -2235,7 +2250,7 @@ static struct phy_driver vsc85xx_driver[] = {
        .config_init    = &vsc85xx_config_init,
        .config_aneg    = &vsc85xx_config_aneg,
        .read_status    = &vsc85xx_read_status,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
+       .handle_interrupt = vsc85xx_handle_interrupt,
        .config_intr    = &vsc85xx_config_intr,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
@@ -2259,7 +2274,7 @@ static struct phy_driver vsc85xx_driver[] = {
        .config_init    = &vsc85xx_config_init,
        .config_aneg    = &vsc85xx_config_aneg,
        .read_status    = &vsc85xx_read_status,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
+       .handle_interrupt = vsc85xx_handle_interrupt,
        .config_intr    = &vsc85xx_config_intr,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
@@ -2283,9 +2298,8 @@ static struct phy_driver vsc85xx_driver[] = {
        .config_init    = &vsc8584_config_init,
        .config_aneg    = &vsc85xx_config_aneg,
        .read_status    = &vsc85xx_read_status,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
+       .handle_interrupt = vsc85xx_handle_interrupt,
        .config_intr    = &vsc85xx_config_intr,
-       .did_interrupt  = &vsc8584_did_interrupt,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
        .probe          = &vsc8574_probe,
@@ -2308,9 +2322,8 @@ static struct phy_driver vsc85xx_driver[] = {
        .config_init    = &vsc8584_config_init,
        .config_aneg    = &vsc85xx_config_aneg,
        .read_status    = &vsc85xx_read_status,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
+       .handle_interrupt = vsc85xx_handle_interrupt,
        .config_intr    = &vsc85xx_config_intr,
-       .did_interrupt  = &vsc8584_did_interrupt,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
        .probe          = &vsc8584_probe,
@@ -2333,9 +2346,7 @@ static struct phy_driver vsc85xx_driver[] = {
        .aneg_done      = &genphy_aneg_done,
        .read_status    = &vsc85xx_read_status,
        .handle_interrupt = &vsc8584_handle_interrupt,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
        .config_intr    = &vsc85xx_config_intr,
-       .did_interrupt  = &vsc8584_did_interrupt,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
        .probe          = &vsc8574_probe,
@@ -2359,9 +2370,8 @@ static struct phy_driver vsc85xx_driver[] = {
        .config_aneg    = &vsc85xx_config_aneg,
        .aneg_done      = &genphy_aneg_done,
        .read_status    = &vsc85xx_read_status,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
+       .handle_interrupt = vsc85xx_handle_interrupt,
        .config_intr    = &vsc85xx_config_intr,
-       .did_interrupt  = &vsc8584_did_interrupt,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
        .probe          = &vsc8574_probe,
@@ -2386,9 +2396,7 @@ static struct phy_driver vsc85xx_driver[] = {
        .aneg_done      = &genphy_aneg_done,
        .read_status    = &vsc85xx_read_status,
        .handle_interrupt = &vsc8584_handle_interrupt,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
        .config_intr    = &vsc85xx_config_intr,
-       .did_interrupt  = &vsc8584_did_interrupt,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
        .probe          = &vsc8584_probe,
@@ -2411,9 +2419,7 @@ static struct phy_driver vsc85xx_driver[] = {
        .aneg_done      = &genphy_aneg_done,
        .read_status    = &vsc85xx_read_status,
        .handle_interrupt = &vsc8584_handle_interrupt,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
        .config_intr    = &vsc85xx_config_intr,
-       .did_interrupt  = &vsc8584_did_interrupt,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
        .probe          = &vsc8584_probe,
@@ -2436,9 +2442,7 @@ static struct phy_driver vsc85xx_driver[] = {
        .aneg_done      = &genphy_aneg_done,
        .read_status    = &vsc85xx_read_status,
        .handle_interrupt = &vsc8584_handle_interrupt,
-       .ack_interrupt  = &vsc85xx_ack_interrupt,
        .config_intr    = &vsc85xx_config_intr,
-       .did_interrupt  = &vsc8584_did_interrupt,
        .suspend        = &genphy_suspend,
        .resume         = &genphy_resume,
        .probe          = &vsc8584_probe,
index b97ee79..f053729 100644 (file)
@@ -1510,6 +1510,8 @@ void vsc8584_config_ts_intr(struct phy_device *phydev)
 int vsc8584_ptp_init(struct phy_device *phydev)
 {
        switch (phydev->phy_id & phydev->drv->phy_id_mask) {
+       case PHY_ID_VSC8572:
+       case PHY_ID_VSC8574:
        case PHY_ID_VSC8575:
        case PHY_ID_VSC8582:
        case PHY_ID_VSC8584:
index 35525a6..477bdf2 100644 (file)
@@ -493,10 +493,11 @@ EXPORT_SYMBOL(phy_queue_state_machine);
  *
  * @phydev: the phy_device struct
  */
-static void phy_trigger_machine(struct phy_device *phydev)
+void phy_trigger_machine(struct phy_device *phydev)
 {
        phy_queue_state_machine(phydev, 0);
 }
+EXPORT_SYMBOL(phy_trigger_machine);
 
 static void phy_abort_cable_test(struct phy_device *phydev)
 {
@@ -924,7 +925,7 @@ void phy_stop_machine(struct phy_device *phydev)
  * Must not be called from interrupt context, or while the
  * phydev->lock is held.
  */
-static void phy_error(struct phy_device *phydev)
+void phy_error(struct phy_device *phydev)
 {
        WARN_ON(1);
 
@@ -934,6 +935,7 @@ static void phy_error(struct phy_device *phydev)
 
        phy_trigger_machine(phydev);
 }
+EXPORT_SYMBOL(phy_error);
 
 /**
  * phy_disable_interrupts - Disable the PHY interrupts from the PHY side
index 5dab6be..e13a46c 100644 (file)
@@ -2463,6 +2463,19 @@ int genphy_soft_reset(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(genphy_soft_reset);
 
+irqreturn_t genphy_handle_interrupt_no_ack(struct phy_device *phydev)
+{
+       /* It seems there are cases where the interrupts are handled by another
+        * entity (ie an IRQ controller embedded inside the PHY) and do not
+        * need any other interraction from phylib. In this case, just trigger
+        * the state machine directly.
+        */
+       phy_trigger_machine(phydev);
+
+       return 0;
+}
+EXPORT_SYMBOL(genphy_handle_interrupt_no_ack);
+
 /**
  * genphy_read_abilities - read PHY abilities from Clause 22 registers
  * @phydev: target phy_device struct
@@ -2815,7 +2828,7 @@ EXPORT_SYMBOL(phy_get_internal_delay);
 
 static bool phy_drv_supports_irq(struct phy_driver *phydrv)
 {
-       return phydrv->config_intr && phydrv->ack_interrupt;
+       return phydrv->config_intr && (phydrv->ack_interrupt || phydrv->handle_interrupt);
 }
 
 /**
@@ -2947,6 +2960,13 @@ static int phy_remove(struct device *dev)
        return 0;
 }
 
+static void phy_shutdown(struct device *dev)
+{
+       struct phy_device *phydev = to_phy_device(dev);
+
+       phy_disable_interrupts(phydev);
+}
+
 /**
  * phy_driver_register - register a phy_driver with the PHY layer
  * @new_driver: new phy_driver to register
@@ -2970,6 +2990,7 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner)
        new_driver->mdiodrv.driver.bus = &mdio_bus_type;
        new_driver->mdiodrv.driver.probe = phy_probe;
        new_driver->mdiodrv.driver.remove = phy_remove;
+       new_driver->mdiodrv.driver.shutdown = phy_shutdown;
        new_driver->mdiodrv.driver.owner = owner;
        new_driver->mdiodrv.driver.probe_type = PROBE_FORCE_SYNCHRONOUS;
 
index 59a94e0..f550576 100644 (file)
@@ -66,11 +66,11 @@ static void phy_led_trigger_format_name(struct phy_device *phy, char *buf,
 
 static int phy_led_trigger_register(struct phy_device *phy,
                                    struct phy_led_trigger *plt,
-                                   unsigned int speed)
+                                   unsigned int speed,
+                                   const char *suffix)
 {
        plt->speed = speed;
-       phy_led_trigger_format_name(phy, plt->name, sizeof(plt->name),
-                                   phy_speed_to_str(speed));
+       phy_led_trigger_format_name(phy, plt->name, sizeof(plt->name), suffix);
        plt->trigger.name = plt->name;
 
        return led_trigger_register(&plt->trigger);
@@ -99,12 +99,7 @@ int phy_led_triggers_register(struct phy_device *phy)
                goto out_clear;
        }
 
-       phy_led_trigger_format_name(phy, phy->led_link_trigger->name,
-                                   sizeof(phy->led_link_trigger->name),
-                                   "link");
-       phy->led_link_trigger->trigger.name = phy->led_link_trigger->name;
-
-       err = led_trigger_register(&phy->led_link_trigger->trigger);
+       err = phy_led_trigger_register(phy, phy->led_link_trigger, 0, "link");
        if (err)
                goto out_free_link;
 
@@ -119,7 +114,8 @@ int phy_led_triggers_register(struct phy_device *phy)
 
        for (i = 0; i < phy->phy_num_led_triggers; i++) {
                err = phy_led_trigger_register(phy, &phy->phy_led_triggers[i],
-                                              speeds[i]);
+                                              speeds[i],
+                                              phy_speed_to_str(speeds[i]));
                if (err)
                        goto out_unreg;
        }
index fe2296f..5d8c015 100644 (file)
@@ -2515,9 +2515,10 @@ int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode,
 
        changed = ret > 0;
 
+       /* Ensure ISOLATE bit is disabled */
        bmcr = mode == MLO_AN_INBAND ? BMCR_ANENABLE : 0;
        ret = mdiobus_modify(pcs->bus, pcs->addr, MII_BMCR,
-                            BMCR_ANENABLE, bmcr);
+                            BMCR_ANENABLE | BMCR_ISOLATE, bmcr);
        if (ret < 0)
                return ret;
 
index fb1db71..f71eda9 100644 (file)
 #define RTL8211E_RX_DELAY                      BIT(11)
 
 #define RTL8201F_ISR                           0x1e
+#define RTL8201F_ISR_ANERR                     BIT(15)
+#define RTL8201F_ISR_DUPLEX                    BIT(13)
+#define RTL8201F_ISR_LINK                      BIT(11)
+#define RTL8201F_ISR_MASK                      (RTL8201F_ISR_ANERR | \
+                                                RTL8201F_ISR_DUPLEX | \
+                                                RTL8201F_ISR_LINK)
 #define RTL8201F_IER                           0x13
 
 #define RTL8366RB_POWER_SAVE                   0x15
@@ -102,24 +108,45 @@ static int rtl8211f_ack_interrupt(struct phy_device *phydev)
 static int rtl8201_config_intr(struct phy_device *phydev)
 {
        u16 val;
+       int err;
+
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               err = rtl8201_ack_interrupt(phydev);
+               if (err)
+                       return err;
 
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
                val = BIT(13) | BIT(12) | BIT(11);
-       else
+               err = phy_write_paged(phydev, 0x7, RTL8201F_IER, val);
+       } else {
                val = 0;
+               err = phy_write_paged(phydev, 0x7, RTL8201F_IER, val);
+               if (err)
+                       return err;
 
-       return phy_write_paged(phydev, 0x7, RTL8201F_IER, val);
+               err = rtl8201_ack_interrupt(phydev);
+       }
+
+       return err;
 }
 
 static int rtl8211b_config_intr(struct phy_device *phydev)
 {
        int err;
 
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               err = rtl821x_ack_interrupt(phydev);
+               if (err)
+                       return err;
+
                err = phy_write(phydev, RTL821x_INER,
                                RTL8211B_INER_INIT);
-       else
+       } else {
                err = phy_write(phydev, RTL821x_INER, 0);
+               if (err)
+                       return err;
+
+               err = rtl821x_ack_interrupt(phydev);
+       }
 
        return err;
 }
@@ -128,11 +155,20 @@ static int rtl8211e_config_intr(struct phy_device *phydev)
 {
        int err;
 
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               err = rtl821x_ack_interrupt(phydev);
+               if (err)
+                       return err;
+
                err = phy_write(phydev, RTL821x_INER,
                                RTL8211E_INER_LINK_STATUS);
-       else
+       } else {
                err = phy_write(phydev, RTL821x_INER, 0);
+               if (err)
+                       return err;
+
+               err = rtl821x_ack_interrupt(phydev);
+       }
 
        return err;
 }
@@ -140,13 +176,85 @@ static int rtl8211e_config_intr(struct phy_device *phydev)
 static int rtl8211f_config_intr(struct phy_device *phydev)
 {
        u16 val;
+       int err;
+
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               err = rtl8211f_ack_interrupt(phydev);
+               if (err)
+                       return err;
 
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
                val = RTL8211F_INER_LINK_STATUS;
-       else
+               err = phy_write_paged(phydev, 0xa42, RTL821x_INER, val);
+       } else {
                val = 0;
+               err = phy_write_paged(phydev, 0xa42, RTL821x_INER, val);
+               if (err)
+                       return err;
+
+               err = rtl8211f_ack_interrupt(phydev);
+       }
+
+       return err;
+}
+
+static irqreturn_t rtl8201_handle_interrupt(struct phy_device *phydev)
+{
+       int irq_status;
+
+       irq_status = phy_read(phydev, RTL8201F_ISR);
+       if (irq_status < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
 
-       return phy_write_paged(phydev, 0xa42, RTL821x_INER, val);
+       if (!(irq_status & RTL8201F_ISR_MASK))
+               return IRQ_NONE;
+
+       phy_trigger_machine(phydev);
+
+       return IRQ_HANDLED;
+}
+
+static irqreturn_t rtl821x_handle_interrupt(struct phy_device *phydev)
+{
+       int irq_status, irq_enabled;
+
+       irq_status = phy_read(phydev, RTL821x_INSR);
+       if (irq_status < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+
+       irq_enabled = phy_read(phydev, RTL821x_INER);
+       if (irq_enabled < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+
+       if (!(irq_status & irq_enabled))
+               return IRQ_NONE;
+
+       phy_trigger_machine(phydev);
+
+       return IRQ_HANDLED;
+}
+
+static irqreturn_t rtl8211f_handle_interrupt(struct phy_device *phydev)
+{
+       int irq_status;
+
+       irq_status = phy_read_paged(phydev, 0xa43, RTL8211F_INSR);
+       if (irq_status < 0) {
+               phy_error(phydev);
+               return IRQ_NONE;
+       }
+
+       if (!(irq_status & RTL8211F_INER_LINK_STATUS))
+               return IRQ_NONE;
+
+       phy_trigger_machine(phydev);
+
+       return IRQ_HANDLED;
 }
 
 static int rtl8211_config_aneg(struct phy_device *phydev)
@@ -551,11 +659,13 @@ static struct phy_driver realtek_drvs[] = {
        {
                PHY_ID_MATCH_EXACT(0x00008201),
                .name           = "RTL8201CP Ethernet",
+               .read_page      = rtl821x_read_page,
+               .write_page     = rtl821x_write_page,
        }, {
                PHY_ID_MATCH_EXACT(0x001cc816),
                .name           = "RTL8201F Fast Ethernet",
-               .ack_interrupt  = &rtl8201_ack_interrupt,
                .config_intr    = &rtl8201_config_intr,
+               .handle_interrupt = rtl8201_handle_interrupt,
                .suspend        = genphy_suspend,
                .resume         = genphy_resume,
                .read_page      = rtl821x_read_page,
@@ -580,8 +690,8 @@ static struct phy_driver realtek_drvs[] = {
        }, {
                PHY_ID_MATCH_EXACT(0x001cc912),
                .name           = "RTL8211B Gigabit Ethernet",
-               .ack_interrupt  = &rtl821x_ack_interrupt,
                .config_intr    = &rtl8211b_config_intr,
+               .handle_interrupt = rtl821x_handle_interrupt,
                .read_mmd       = &genphy_read_mmd_unsupported,
                .write_mmd      = &genphy_write_mmd_unsupported,
                .suspend        = rtl8211b_suspend,
@@ -599,8 +709,8 @@ static struct phy_driver realtek_drvs[] = {
        }, {
                PHY_ID_MATCH_EXACT(0x001cc914),
                .name           = "RTL8211DN Gigabit Ethernet",
-               .ack_interrupt  = rtl821x_ack_interrupt,
                .config_intr    = rtl8211e_config_intr,
+               .handle_interrupt = rtl821x_handle_interrupt,
                .suspend        = genphy_suspend,
                .resume         = genphy_resume,
                .read_page      = rtl821x_read_page,
@@ -609,8 +719,8 @@ static struct phy_driver realtek_drvs[] = {
                PHY_ID_MATCH_EXACT(0x001cc915),
                .name           = "RTL8211E Gigabit Ethernet",
                .config_init    = &rtl8211e_config_init,
-               .ack_interrupt  = &rtl821x_ack_interrupt,
                .config_intr    = &rtl8211e_config_intr,
+               .handle_interrupt = rtl821x_handle_interrupt,
                .suspend        = genphy_suspend,
                .resume         = genphy_resume,
                .read_page      = rtl821x_read_page,
@@ -619,8 +729,8 @@ static struct phy_driver realtek_drvs[] = {
                PHY_ID_MATCH_EXACT(0x001cc916),
                .name           = "RTL8211F Gigabit Ethernet",
                .config_init    = &rtl8211f_config_init,
-               .ack_interrupt  = &rtl8211f_ack_interrupt,
                .config_intr    = &rtl8211f_config_intr,
+               .handle_interrupt = rtl8211f_handle_interrupt,
                .suspend        = genphy_suspend,
                .resume         = genphy_resume,
                .read_page      = rtl821x_read_page,
@@ -660,6 +770,46 @@ static struct phy_driver realtek_drvs[] = {
                .read_mmd       = rtl822x_read_mmd,
                .write_mmd      = rtl822x_write_mmd,
        }, {
+               PHY_ID_MATCH_EXACT(0x001cc838),
+               .name           = "RTL8226-CG 2.5Gbps PHY",
+               .get_features   = rtl822x_get_features,
+               .config_aneg    = rtl822x_config_aneg,
+               .read_status    = rtl822x_read_status,
+               .suspend        = genphy_suspend,
+               .resume         = rtlgen_resume,
+               .read_page      = rtl821x_read_page,
+               .write_page     = rtl821x_write_page,
+       }, {
+               PHY_ID_MATCH_EXACT(0x001cc848),
+               .name           = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY",
+               .get_features   = rtl822x_get_features,
+               .config_aneg    = rtl822x_config_aneg,
+               .read_status    = rtl822x_read_status,
+               .suspend        = genphy_suspend,
+               .resume         = rtlgen_resume,
+               .read_page      = rtl821x_read_page,
+               .write_page     = rtl821x_write_page,
+       }, {
+               PHY_ID_MATCH_EXACT(0x001cc849),
+               .name           = "RTL8221B-VB-CG 2.5Gbps PHY",
+               .get_features   = rtl822x_get_features,
+               .config_aneg    = rtl822x_config_aneg,
+               .read_status    = rtl822x_read_status,
+               .suspend        = genphy_suspend,
+               .resume         = rtlgen_resume,
+               .read_page      = rtl821x_read_page,
+               .write_page     = rtl821x_write_page,
+       }, {
+               PHY_ID_MATCH_EXACT(0x001cc84a),
+               .name           = "RTL8221B-VM-CG 2.5Gbps PHY",
+               .get_features   = rtl822x_get_features,
+               .config_aneg    = rtl822x_config_aneg,
+               .read_status    = rtl822x_read_status,
+               .suspend        = genphy_suspend,
+               .resume         = rtlgen_resume,
+               .read_page      = rtl821x_read_page,
+               .write_page     = rtl821x_write_page,
+       }, {
                PHY_ID_MATCH_EXACT(0x001cc961),
                .name           = "RTL8366RB Gigabit Ethernet",
                .config_init    = &rtl8366rb_config_init,
@@ -668,8 +818,8 @@ static struct phy_driver realtek_drvs[] = {
                 * irq is requested and ACKed by reading the status register,
                 * which is done by the irqchip code.
                 */
-               .ack_interrupt  = genphy_no_ack_interrupt,
                .config_intr    = genphy_no_config_intr,
+               .handle_interrupt = genphy_handle_interrupt_no_ack,
                .suspend        = genphy_suspend,
                .resume         = genphy_resume,
        },
index 1d18c10..34aa196 100644 (file)
@@ -2389,7 +2389,8 @@ static int sfp_probe(struct platform_device *pdev)
                        continue;
 
                sfp->gpio_irq[i] = gpiod_to_irq(sfp->gpio[i]);
-               if (!sfp->gpio_irq[i]) {
+               if (sfp->gpio_irq[i] < 0) {
+                       sfp->gpio_irq[i] = 0;
                        sfp->need_poll = true;
                        continue;
                }
index 07f1f39..b409212 100644 (file)
@@ -975,11 +975,11 @@ static void team_port_disable(struct team *team,
 }
 
 #define TEAM_VLAN_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
-                           NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
+                           NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | \
                            NETIF_F_HIGHDMA | NETIF_F_LRO)
 
 #define TEAM_ENC_FEATURES      (NETIF_F_HW_CSUM | NETIF_F_SG | \
-                                NETIF_F_RXCSUM | NETIF_F_ALL_TSO)
+                                NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE)
 
 static void __team_compute_features(struct team *team)
 {
@@ -1009,8 +1009,7 @@ static void __team_compute_features(struct team *team)
        team->dev->vlan_features = vlan_features;
        team->dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |
                                     NETIF_F_HW_VLAN_CTAG_TX |
-                                    NETIF_F_HW_VLAN_STAG_TX |
-                                    NETIF_F_GSO_UDP_L4;
+                                    NETIF_F_HW_VLAN_STAG_TX;
        team->dev->hard_header_len = max_hard_header_len;
 
        team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
@@ -2175,7 +2174,7 @@ static void team_setup(struct net_device *dev)
                           NETIF_F_HW_VLAN_CTAG_RX |
                           NETIF_F_HW_VLAN_CTAG_FILTER;
 
-       dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4;
+       dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
        dev->features |= dev->hw_features;
        dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
 }
index be69d27..3d45d56 100644 (file)
@@ -107,17 +107,6 @@ struct tap_filter {
 
 #define TUN_FLOW_EXPIRE (3 * HZ)
 
-struct tun_pcpu_stats {
-       u64_stats_t rx_packets;
-       u64_stats_t rx_bytes;
-       u64_stats_t tx_packets;
-       u64_stats_t tx_bytes;
-       struct u64_stats_sync syncp;
-       u32 rx_dropped;
-       u32 tx_dropped;
-       u32 rx_frame_errors;
-};
-
 /* A tun_file connects an open character device to a tuntap netdevice. It
  * also contains all socket related structures (except sock_fprog and tap_filter)
  * to serve as one transmit queue for tuntap device. The sock_fprog and
@@ -207,7 +196,7 @@ struct tun_struct {
        void *security;
        u32 flow_count;
        u32 rx_batched;
-       struct tun_pcpu_stats __percpu *pcpu_stats;
+       atomic_long_t rx_frame_errors;
        struct bpf_prog __rcu *xdp_prog;
        struct tun_prog __rcu *steering_prog;
        struct tun_prog __rcu *filter_prog;
@@ -1066,7 +1055,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
        return NETDEV_TX_OK;
 
 drop:
-       this_cpu_inc(tun->pcpu_stats->tx_dropped);
+       atomic_long_inc(&dev->tx_dropped);
        skb_tx_error(skb);
        kfree_skb(skb);
        rcu_read_unlock();
@@ -1103,37 +1092,12 @@ static void tun_set_headroom(struct net_device *dev, int new_hr)
 static void
 tun_net_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
 {
-       u32 rx_dropped = 0, tx_dropped = 0, rx_frame_errors = 0;
        struct tun_struct *tun = netdev_priv(dev);
-       struct tun_pcpu_stats *p;
-       int i;
-
-       for_each_possible_cpu(i) {
-               u64 rxpackets, rxbytes, txpackets, txbytes;
-               unsigned int start;
 
-               p = per_cpu_ptr(tun->pcpu_stats, i);
-               do {
-                       start = u64_stats_fetch_begin(&p->syncp);
-                       rxpackets       = u64_stats_read(&p->rx_packets);
-                       rxbytes         = u64_stats_read(&p->rx_bytes);
-                       txpackets       = u64_stats_read(&p->tx_packets);
-                       txbytes         = u64_stats_read(&p->tx_bytes);
-               } while (u64_stats_fetch_retry(&p->syncp, start));
+       dev_get_tstats64(dev, stats);
 
-               stats->rx_packets       += rxpackets;
-               stats->rx_bytes         += rxbytes;
-               stats->tx_packets       += txpackets;
-               stats->tx_bytes         += txbytes;
-
-               /* u32 counters */
-               rx_dropped      += p->rx_dropped;
-               rx_frame_errors += p->rx_frame_errors;
-               tx_dropped      += p->tx_dropped;
-       }
-       stats->rx_dropped  = rx_dropped;
-       stats->rx_frame_errors = rx_frame_errors;
-       stats->tx_dropped = tx_dropped;
+       stats->rx_frame_errors +=
+               (unsigned long)atomic_long_read(&tun->rx_frame_errors);
 }
 
 static int tun_xdp_set(struct net_device *dev, struct bpf_prog *prog,
@@ -1247,7 +1211,7 @@ resample:
                void *frame = tun_xdp_to_ptr(xdp);
 
                if (__ptr_ring_produce(&tfile->tx_ring, frame)) {
-                       this_cpu_inc(tun->pcpu_stats->tx_dropped);
+                       atomic_long_inc(&dev->tx_dropped);
                        xdp_return_frame_rx_napi(xdp);
                        drops++;
                }
@@ -1283,7 +1247,7 @@ static const struct net_device_ops tap_netdev_ops = {
        .ndo_select_queue       = tun_select_queue,
        .ndo_features_check     = passthru_features_check,
        .ndo_set_rx_headroom    = tun_set_headroom,
-       .ndo_get_stats64        = tun_net_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_bpf                = tun_xdp,
        .ndo_xdp_xmit           = tun_xdp_xmit,
        .ndo_change_carrier     = tun_net_change_carrier,
@@ -1577,7 +1541,7 @@ static int tun_xdp_act(struct tun_struct *tun, struct bpf_prog *xdp_prog,
                trace_xdp_exception(tun->dev, xdp_prog, act);
                fallthrough;
        case XDP_DROP:
-               this_cpu_inc(tun->pcpu_stats->rx_dropped);
+               atomic_long_inc(&tun->dev->rx_dropped);
                break;
        }
 
@@ -1683,7 +1647,6 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
        size_t total_len = iov_iter_count(from);
        size_t len = total_len, align = tun->align, linear;
        struct virtio_net_hdr gso = { 0 };
-       struct tun_pcpu_stats *stats;
        int good_linear;
        int copylen;
        bool zerocopy = false;
@@ -1752,7 +1715,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
                 */
                skb = tun_build_skb(tun, tfile, from, &gso, len, &skb_xdp);
                if (IS_ERR(skb)) {
-                       this_cpu_inc(tun->pcpu_stats->rx_dropped);
+                       atomic_long_inc(&tun->dev->rx_dropped);
                        return PTR_ERR(skb);
                }
                if (!skb)
@@ -1781,7 +1744,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 
                if (IS_ERR(skb)) {
                        if (PTR_ERR(skb) != -EAGAIN)
-                               this_cpu_inc(tun->pcpu_stats->rx_dropped);
+                               atomic_long_inc(&tun->dev->rx_dropped);
                        if (frags)
                                mutex_unlock(&tfile->napi_mutex);
                        return PTR_ERR(skb);
@@ -1795,7 +1758,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
                if (err) {
                        err = -EFAULT;
 drop:
-                       this_cpu_inc(tun->pcpu_stats->rx_dropped);
+                       atomic_long_inc(&tun->dev->rx_dropped);
                        kfree_skb(skb);
                        if (frags) {
                                tfile->napi.skb = NULL;
@@ -1807,7 +1770,7 @@ drop:
        }
 
        if (virtio_net_hdr_to_skb(skb, &gso, tun_is_little_endian(tun))) {
-               this_cpu_inc(tun->pcpu_stats->rx_frame_errors);
+               atomic_long_inc(&tun->rx_frame_errors);
                kfree_skb(skb);
                if (frags) {
                        tfile->napi.skb = NULL;
@@ -1830,7 +1793,7 @@ drop:
                                pi.proto = htons(ETH_P_IPV6);
                                break;
                        default:
-                               this_cpu_inc(tun->pcpu_stats->rx_dropped);
+                               atomic_long_inc(&tun->dev->rx_dropped);
                                kfree_skb(skb);
                                return -EINVAL;
                        }
@@ -1910,7 +1873,7 @@ drop:
                                          skb_headlen(skb));
 
                if (unlikely(headlen > skb_headlen(skb))) {
-                       this_cpu_inc(tun->pcpu_stats->rx_dropped);
+                       atomic_long_inc(&tun->dev->rx_dropped);
                        napi_free_frags(&tfile->napi);
                        rcu_read_unlock();
                        mutex_unlock(&tfile->napi_mutex);
@@ -1942,12 +1905,9 @@ drop:
        }
        rcu_read_unlock();
 
-       stats = get_cpu_ptr(tun->pcpu_stats);
-       u64_stats_update_begin(&stats->syncp);
-       u64_stats_inc(&stats->rx_packets);
-       u64_stats_add(&stats->rx_bytes, len);
-       u64_stats_update_end(&stats->syncp);
-       put_cpu_ptr(stats);
+       preempt_disable();
+       dev_sw_netstats_rx_add(tun->dev, len);
+       preempt_enable();
 
        if (rxhash)
                tun_flow_update(tun, rxhash, tfile);
@@ -1979,7 +1939,6 @@ static ssize_t tun_put_user_xdp(struct tun_struct *tun,
 {
        int vnet_hdr_sz = 0;
        size_t size = xdp_frame->len;
-       struct tun_pcpu_stats *stats;
        size_t ret;
 
        if (tun->flags & IFF_VNET_HDR) {
@@ -1996,12 +1955,9 @@ static ssize_t tun_put_user_xdp(struct tun_struct *tun,
 
        ret = copy_to_iter(xdp_frame->data, size, iter) + vnet_hdr_sz;
 
-       stats = get_cpu_ptr(tun->pcpu_stats);
-       u64_stats_update_begin(&stats->syncp);
-       u64_stats_inc(&stats->tx_packets);
-       u64_stats_add(&stats->tx_bytes, ret);
-       u64_stats_update_end(&stats->syncp);
-       put_cpu_ptr(tun->pcpu_stats);
+       preempt_disable();
+       dev_sw_netstats_tx_add(tun->dev, 1, ret);
+       preempt_enable();
 
        return ret;
 }
@@ -2013,7 +1969,6 @@ static ssize_t tun_put_user(struct tun_struct *tun,
                            struct iov_iter *iter)
 {
        struct tun_pi pi = { 0, skb->protocol };
-       struct tun_pcpu_stats *stats;
        ssize_t total;
        int vlan_offset = 0;
        int vlan_hlen = 0;
@@ -2091,12 +2046,9 @@ static ssize_t tun_put_user(struct tun_struct *tun,
 
 done:
        /* caller is in process context, */
-       stats = get_cpu_ptr(tun->pcpu_stats);
-       u64_stats_update_begin(&stats->syncp);
-       u64_stats_inc(&stats->tx_packets);
-       u64_stats_add(&stats->tx_bytes, skb->len + vlan_hlen);
-       u64_stats_update_end(&stats->syncp);
-       put_cpu_ptr(tun->pcpu_stats);
+       preempt_disable();
+       dev_sw_netstats_tx_add(tun->dev, 1, skb->len + vlan_hlen);
+       preempt_enable();
 
        return total;
 }
@@ -2235,11 +2187,11 @@ static void tun_free_netdev(struct net_device *dev)
 
        BUG_ON(!(list_empty(&tun->disabled)));
 
-       free_percpu(tun->pcpu_stats);
-       /* We clear pcpu_stats so that tun_set_iff() can tell if
+       free_percpu(dev->tstats);
+       /* We clear tstats so that tun_set_iff() can tell if
         * tun_free_netdev() has been called from register_netdevice().
         */
-       tun->pcpu_stats = NULL;
+       dev->tstats = NULL;
 
        tun_flow_uninit(tun);
        security_tun_dev_free_security(tun->security);
@@ -2370,7 +2322,6 @@ static int tun_xdp_one(struct tun_struct *tun,
        unsigned int datasize = xdp->data_end - xdp->data;
        struct tun_xdp_hdr *hdr = xdp->data_hard_start;
        struct virtio_net_hdr *gso = &hdr->gso;
-       struct tun_pcpu_stats *stats;
        struct bpf_prog *xdp_prog;
        struct sk_buff *skb = NULL;
        u32 rxhash = 0, act;
@@ -2428,7 +2379,7 @@ build:
        skb_put(skb, xdp->data_end - xdp->data);
 
        if (virtio_net_hdr_to_skb(skb, gso, tun_is_little_endian(tun))) {
-               this_cpu_inc(tun->pcpu_stats->rx_frame_errors);
+               atomic_long_inc(&tun->rx_frame_errors);
                kfree_skb(skb);
                err = -EINVAL;
                goto out;
@@ -2451,14 +2402,10 @@ build:
 
        netif_receive_skb(skb);
 
-       /* No need for get_cpu_ptr() here since this function is
+       /* No need to disable preemption here since this function is
         * always called with bh disabled
         */
-       stats = this_cpu_ptr(tun->pcpu_stats);
-       u64_stats_update_begin(&stats->syncp);
-       u64_stats_inc(&stats->rx_packets);
-       u64_stats_add(&stats->rx_bytes, datasize);
-       u64_stats_update_end(&stats->syncp);
+       dev_sw_netstats_rx_add(tun->dev, datasize);
 
        if (rxhash)
                tun_flow_update(tun, rxhash, tfile);
@@ -2751,8 +2698,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
                tun->rx_batched = 0;
                RCU_INIT_POINTER(tun->steering_prog, NULL);
 
-               tun->pcpu_stats = netdev_alloc_pcpu_stats(struct tun_pcpu_stats);
-               if (!tun->pcpu_stats) {
+               dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
+               if (!dev->tstats) {
                        err = -ENOMEM;
                        goto err_free_dev;
                }
@@ -2807,16 +2754,16 @@ err_detach:
        tun_detach_all(dev);
        /* We are here because register_netdevice() has failed.
         * If register_netdevice() already called tun_free_netdev()
-        * while dealing with the error, tun->pcpu_stats has been cleared.
+        * while dealing with the error, dev->stats has been cleared.
         */
-       if (!tun->pcpu_stats)
+       if (!dev->tstats)
                goto err_free_dev;
 
 err_free_flow:
        tun_flow_uninit(tun);
        security_tun_dev_free_security(tun->security);
 err_free_stat:
-       free_percpu(tun->pcpu_stats);
+       free_percpu(dev->tstats);
 err_free_dev:
        free_netdev(dev);
        return err;
index 99fd12b..99381e6 100644 (file)
@@ -13,7 +13,7 @@ obj-$(CONFIG_USB_LAN78XX)     += lan78xx.o
 obj-$(CONFIG_USB_NET_AX8817X)  += asix.o
 asix-y := asix_devices.o asix_common.o ax88172a.o
 obj-$(CONFIG_USB_NET_AX88179_178A)      += ax88179_178a.o
-obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
+obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o r8153_ecm.o
 obj-$(CONFIG_USB_NET_CDC_EEM)  += cdc_eem.o
 obj-$(CONFIG_USB_NET_DM9601)   += dm9601.o
 obj-$(CONFIG_USB_NET_SR9700)   += sr9700.o
index 0717c18..73b97f4 100644 (file)
@@ -641,7 +641,7 @@ static const struct net_device_ops aqc111_netdev_ops = {
        .ndo_stop               = usbnet_stop,
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_change_mtu         = aqc111_change_mtu,
        .ndo_set_mac_address    = aqc111_set_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
index ef548be..6e13d81 100644 (file)
@@ -194,7 +194,7 @@ static const struct net_device_ops ax88172_netdev_ops = {
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
        .ndo_change_mtu         = usbnet_change_mtu,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_do_ioctl           = asix_ioctl,
@@ -580,7 +580,7 @@ static const struct net_device_ops ax88772_netdev_ops = {
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
        .ndo_change_mtu         = usbnet_change_mtu,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_mac_address    = asix_set_mac_address,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_do_ioctl           = asix_ioctl,
@@ -1050,7 +1050,7 @@ static const struct net_device_ops ax88178_netdev_ops = {
        .ndo_stop               = usbnet_stop,
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_mac_address    = asix_set_mac_address,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_rx_mode        = asix_set_multicast,
index fd3a04d..b404c94 100644 (file)
@@ -120,7 +120,7 @@ static const struct net_device_ops ax88172a_netdev_ops = {
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
        .ndo_change_mtu         = usbnet_change_mtu,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_mac_address    = asix_set_mac_address,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_do_ioctl           = phy_do_ioctl_running,
index 5541f3f..d650b39 100644 (file)
@@ -1031,7 +1031,7 @@ static const struct net_device_ops ax88179_netdev_ops = {
        .ndo_stop               = usbnet_stop,
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_change_mtu         = ax88179_change_mtu,
        .ndo_set_mac_address    = ax88179_set_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
index eb100eb..5db6627 100644 (file)
@@ -98,7 +98,7 @@ static const struct net_device_ops cdc_mbim_netdev_ops = {
        .ndo_stop             = usbnet_stop,
        .ndo_start_xmit       = usbnet_start_xmit,
        .ndo_tx_timeout       = usbnet_tx_timeout,
-       .ndo_get_stats64      = usbnet_get_stats64,
+       .ndo_get_stats64      = dev_get_tstats64,
        .ndo_change_mtu       = cdc_ncm_change_mtu,
        .ndo_set_mac_address  = eth_mac_addr,
        .ndo_validate_addr    = eth_validate_addr,
index e04f588..2bac57d 100644 (file)
@@ -793,7 +793,7 @@ static const struct net_device_ops cdc_ncm_netdev_ops = {
        .ndo_start_xmit      = usbnet_start_xmit,
        .ndo_tx_timeout      = usbnet_tx_timeout,
        .ndo_set_rx_mode     = usbnet_set_rx_mode,
-       .ndo_get_stats64     = usbnet_get_stats64,
+       .ndo_get_stats64     = dev_get_tstats64,
        .ndo_change_mtu      = cdc_ncm_change_mtu,
        .ndo_set_mac_address = eth_mac_addr,
        .ndo_validate_addr   = eth_validate_addr,
@@ -1317,7 +1317,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
                        break;
                }
 
-               /* calculate frame number withing this NDP */
+               /* calculate frame number within this NDP */
                if (ctx->is_ndp16) {
                        ndplen = le16_to_cpu(ndp.ndp16->wLength);
                        index = (ndplen - sizeof(struct usb_cdc_ncm_ndp16)) / sizeof(struct usb_cdc_ncm_dpe16) - 1;
index 915ac75..b5d2ac5 100644 (file)
@@ -343,7 +343,7 @@ static const struct net_device_ops dm9601_netdev_ops = {
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
        .ndo_change_mtu         = usbnet_change_mtu,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_do_ioctl           = dm9601_ioctl,
        .ndo_set_rx_mode        = dm9601_set_multicast,
index cb5bc1a..ed05f99 100644 (file)
@@ -133,7 +133,7 @@ static const struct net_device_ops int51x1_netdev_ops = {
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
        .ndo_change_mtu         = usbnet_change_mtu,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_rx_mode        = int51x1_set_multicast,
index 65b315b..bf243ed 100644 (file)
@@ -822,20 +822,19 @@ static int lan78xx_read_raw_otp(struct lan78xx_net *dev, u32 offset,
                                u32 length, u8 *data)
 {
        int i;
-       int ret;
        u32 buf;
        unsigned long timeout;
 
-       ret = lan78xx_read_reg(dev, OTP_PWR_DN, &buf);
+       lan78xx_read_reg(dev, OTP_PWR_DN, &buf);
 
        if (buf & OTP_PWR_DN_PWRDN_N_) {
                /* clear it and wait to be cleared */
-               ret = lan78xx_write_reg(dev, OTP_PWR_DN, 0);
+               lan78xx_write_reg(dev, OTP_PWR_DN, 0);
 
                timeout = jiffies + HZ;
                do {
                        usleep_range(1, 10);
-                       ret = lan78xx_read_reg(dev, OTP_PWR_DN, &buf);
+                       lan78xx_read_reg(dev, OTP_PWR_DN, &buf);
                        if (time_after(jiffies, timeout)) {
                                netdev_warn(dev->net,
                                            "timeout on OTP_PWR_DN");
@@ -845,18 +844,18 @@ static int lan78xx_read_raw_otp(struct lan78xx_net *dev, u32 offset,
        }
 
        for (i = 0; i < length; i++) {
-               ret = lan78xx_write_reg(dev, OTP_ADDR1,
+               lan78xx_write_reg(dev, OTP_ADDR1,
                                        ((offset + i) >> 8) & OTP_ADDR1_15_11);
-               ret = lan78xx_write_reg(dev, OTP_ADDR2,
+               lan78xx_write_reg(dev, OTP_ADDR2,
                                        ((offset + i) & OTP_ADDR2_10_3));
 
-               ret = lan78xx_write_reg(dev, OTP_FUNC_CMD, OTP_FUNC_CMD_READ_);
-               ret = lan78xx_write_reg(dev, OTP_CMD_GO, OTP_CMD_GO_GO_);
+               lan78xx_write_reg(dev, OTP_FUNC_CMD, OTP_FUNC_CMD_READ_);
+               lan78xx_write_reg(dev, OTP_CMD_GO, OTP_CMD_GO_GO_);
 
                timeout = jiffies + HZ;
                do {
                        udelay(1);
-                       ret = lan78xx_read_reg(dev, OTP_STATUS, &buf);
+                       lan78xx_read_reg(dev, OTP_STATUS, &buf);
                        if (time_after(jiffies, timeout)) {
                                netdev_warn(dev->net,
                                            "timeout on OTP_STATUS");
@@ -864,7 +863,7 @@ static int lan78xx_read_raw_otp(struct lan78xx_net *dev, u32 offset,
                        }
                } while (buf & OTP_STATUS_BUSY_);
 
-               ret = lan78xx_read_reg(dev, OTP_RD_DATA, &buf);
+               lan78xx_read_reg(dev, OTP_RD_DATA, &buf);
 
                data[i] = (u8)(buf & 0xFF);
        }
@@ -876,20 +875,19 @@ static int lan78xx_write_raw_otp(struct lan78xx_net *dev, u32 offset,
                                 u32 length, u8 *data)
 {
        int i;
-       int ret;
        u32 buf;
        unsigned long timeout;
 
-       ret = lan78xx_read_reg(dev, OTP_PWR_DN, &buf);
+       lan78xx_read_reg(dev, OTP_PWR_DN, &buf);
 
        if (buf & OTP_PWR_DN_PWRDN_N_) {
                /* clear it and wait to be cleared */
-               ret = lan78xx_write_reg(dev, OTP_PWR_DN, 0);
+               lan78xx_write_reg(dev, OTP_PWR_DN, 0);
 
                timeout = jiffies + HZ;
                do {
                        udelay(1);
-                       ret = lan78xx_read_reg(dev, OTP_PWR_DN, &buf);
+                       lan78xx_read_reg(dev, OTP_PWR_DN, &buf);
                        if (time_after(jiffies, timeout)) {
                                netdev_warn(dev->net,
                                            "timeout on OTP_PWR_DN completion");
@@ -899,21 +897,21 @@ static int lan78xx_write_raw_otp(struct lan78xx_net *dev, u32 offset,
        }
 
        /* set to BYTE program mode */
-       ret = lan78xx_write_reg(dev, OTP_PRGM_MODE, OTP_PRGM_MODE_BYTE_);
+       lan78xx_write_reg(dev, OTP_PRGM_MODE, OTP_PRGM_MODE_BYTE_);
 
        for (i = 0; i < length; i++) {
-               ret = lan78xx_write_reg(dev, OTP_ADDR1,
+               lan78xx_write_reg(dev, OTP_ADDR1,
                                        ((offset + i) >> 8) & OTP_ADDR1_15_11);
-               ret = lan78xx_write_reg(dev, OTP_ADDR2,
+               lan78xx_write_reg(dev, OTP_ADDR2,
                                        ((offset + i) & OTP_ADDR2_10_3));
-               ret = lan78xx_write_reg(dev, OTP_PRGM_DATA, data[i]);
-               ret = lan78xx_write_reg(dev, OTP_TST_CMD, OTP_TST_CMD_PRGVRFY_);
-               ret = lan78xx_write_reg(dev, OTP_CMD_GO, OTP_CMD_GO_GO_);
+               lan78xx_write_reg(dev, OTP_PRGM_DATA, data[i]);
+               lan78xx_write_reg(dev, OTP_TST_CMD, OTP_TST_CMD_PRGVRFY_);
+               lan78xx_write_reg(dev, OTP_CMD_GO, OTP_CMD_GO_GO_);
 
                timeout = jiffies + HZ;
                do {
                        udelay(1);
-                       ret = lan78xx_read_reg(dev, OTP_STATUS, &buf);
+                       lan78xx_read_reg(dev, OTP_STATUS, &buf);
                        if (time_after(jiffies, timeout)) {
                                netdev_warn(dev->net,
                                            "Timeout on OTP_STATUS completion");
@@ -1038,7 +1036,6 @@ static void lan78xx_deferred_multicast_write(struct work_struct *param)
                        container_of(param, struct lan78xx_priv, set_multicast);
        struct lan78xx_net *dev = pdata->dev;
        int i;
-       int ret;
 
        netif_dbg(dev, drv, dev->net, "deferred multicast write 0x%08x\n",
                  pdata->rfe_ctl);
@@ -1047,14 +1044,14 @@ static void lan78xx_deferred_multicast_write(struct work_struct *param)
                               DP_SEL_VHF_HASH_LEN, pdata->mchash_table);
 
        for (i = 1; i < NUM_OF_MAF; i++) {
-               ret = lan78xx_write_reg(dev, MAF_HI(i), 0);
-               ret = lan78xx_write_reg(dev, MAF_LO(i),
+               lan78xx_write_reg(dev, MAF_HI(i), 0);
+               lan78xx_write_reg(dev, MAF_LO(i),
                                        pdata->pfilter_table[i][1]);
-               ret = lan78xx_write_reg(dev, MAF_HI(i),
+               lan78xx_write_reg(dev, MAF_HI(i),
                                        pdata->pfilter_table[i][0]);
        }
 
-       ret = lan78xx_write_reg(dev, RFE_CTL, pdata->rfe_ctl);
+       lan78xx_write_reg(dev, RFE_CTL, pdata->rfe_ctl);
 }
 
 static void lan78xx_set_multicast(struct net_device *netdev)
@@ -1124,7 +1121,6 @@ static int lan78xx_update_flowcontrol(struct lan78xx_net *dev, u8 duplex,
                                      u16 lcladv, u16 rmtadv)
 {
        u32 flow = 0, fct_flow = 0;
-       int ret;
        u8 cap;
 
        if (dev->fc_autoneg)
@@ -1147,10 +1143,10 @@ static int lan78xx_update_flowcontrol(struct lan78xx_net *dev, u8 duplex,
                  (cap & FLOW_CTRL_RX ? "enabled" : "disabled"),
                  (cap & FLOW_CTRL_TX ? "enabled" : "disabled"));
 
-       ret = lan78xx_write_reg(dev, FCT_FLOW, fct_flow);
+       lan78xx_write_reg(dev, FCT_FLOW, fct_flow);
 
        /* threshold value should be set before enabling flow */
-       ret = lan78xx_write_reg(dev, FLOW, flow);
+       lan78xx_write_reg(dev, FLOW, flow);
 
        return 0;
 }
@@ -1663,11 +1659,10 @@ static const struct ethtool_ops lan78xx_ethtool_ops = {
 static void lan78xx_init_mac_address(struct lan78xx_net *dev)
 {
        u32 addr_lo, addr_hi;
-       int ret;
        u8 addr[6];
 
-       ret = lan78xx_read_reg(dev, RX_ADDRL, &addr_lo);
-       ret = lan78xx_read_reg(dev, RX_ADDRH, &addr_hi);
+       lan78xx_read_reg(dev, RX_ADDRL, &addr_lo);
+       lan78xx_read_reg(dev, RX_ADDRH, &addr_hi);
 
        addr[0] = addr_lo & 0xFF;
        addr[1] = (addr_lo >> 8) & 0xFF;
@@ -1700,12 +1695,12 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
                          (addr[2] << 16) | (addr[3] << 24);
                addr_hi = addr[4] | (addr[5] << 8);
 
-               ret = lan78xx_write_reg(dev, RX_ADDRL, addr_lo);
-               ret = lan78xx_write_reg(dev, RX_ADDRH, addr_hi);
+               lan78xx_write_reg(dev, RX_ADDRL, addr_lo);
+               lan78xx_write_reg(dev, RX_ADDRH, addr_hi);
        }
 
-       ret = lan78xx_write_reg(dev, MAF_LO(0), addr_lo);
-       ret = lan78xx_write_reg(dev, MAF_HI(0), addr_hi | MAF_HI_VALID_);
+       lan78xx_write_reg(dev, MAF_LO(0), addr_lo);
+       lan78xx_write_reg(dev, MAF_HI(0), addr_hi | MAF_HI_VALID_);
 
        ether_addr_copy(dev->net->dev_addr, addr);
 }
@@ -1838,7 +1833,7 @@ static void lan78xx_remove_mdio(struct lan78xx_net *dev)
 static void lan78xx_link_status_change(struct net_device *net)
 {
        struct phy_device *phydev = net->phydev;
-       int ret, temp;
+       int temp;
 
        /* At forced 100 F/H mode, chip may fail to set mode correctly
         * when cable is switched between long(~50+m) and short one.
@@ -1849,7 +1844,7 @@ static void lan78xx_link_status_change(struct net_device *net)
                /* disable phy interrupt */
                temp = phy_read(phydev, LAN88XX_INT_MASK);
                temp &= ~LAN88XX_INT_MASK_MDINTPIN_EN_;
-               ret = phy_write(phydev, LAN88XX_INT_MASK, temp);
+               phy_write(phydev, LAN88XX_INT_MASK, temp);
 
                temp = phy_read(phydev, MII_BMCR);
                temp &= ~(BMCR_SPEED100 | BMCR_SPEED1000);
@@ -1863,7 +1858,7 @@ static void lan78xx_link_status_change(struct net_device *net)
                /* enable phy interrupt back */
                temp = phy_read(phydev, LAN88XX_INT_MASK);
                temp |= LAN88XX_INT_MASK_MDINTPIN_EN_;
-               ret = phy_write(phydev, LAN88XX_INT_MASK, temp);
+               phy_write(phydev, LAN88XX_INT_MASK, temp);
        }
 }
 
@@ -1917,14 +1912,13 @@ static void lan78xx_irq_bus_sync_unlock(struct irq_data *irqd)
        struct lan78xx_net *dev =
                        container_of(data, struct lan78xx_net, domain_data);
        u32 buf;
-       int ret;
 
        /* call register access here because irq_bus_lock & irq_bus_sync_unlock
         * are only two callbacks executed in non-atomic contex.
         */
-       ret = lan78xx_read_reg(dev, INT_EP_CTL, &buf);
+       lan78xx_read_reg(dev, INT_EP_CTL, &buf);
        if (buf != data->irqenable)
-               ret = lan78xx_write_reg(dev, INT_EP_CTL, data->irqenable);
+               lan78xx_write_reg(dev, INT_EP_CTL, data->irqenable);
 
        mutex_unlock(&data->irq_lock);
 }
@@ -1991,7 +1985,6 @@ static void lan78xx_remove_irq_domain(struct lan78xx_net *dev)
 static int lan8835_fixup(struct phy_device *phydev)
 {
        int buf;
-       int ret;
        struct lan78xx_net *dev = netdev_priv(phydev->attached_dev);
 
        /* LED2/PME_N/IRQ_N/RGMII_ID pin to IRQ_N mode */
@@ -2001,11 +1994,11 @@ static int lan8835_fixup(struct phy_device *phydev)
        phy_write_mmd(phydev, MDIO_MMD_PCS, 0x8010, buf);
 
        /* RGMII MAC TXC Delay Enable */
-       ret = lan78xx_write_reg(dev, MAC_RGMII_ID,
+       lan78xx_write_reg(dev, MAC_RGMII_ID,
                                MAC_RGMII_ID_TXC_DELAY_EN_);
 
        /* RGMII TX DLL Tune Adjust */
-       ret = lan78xx_write_reg(dev, RGMII_TX_BYP_DLL, 0x3D00);
+       lan78xx_write_reg(dev, RGMII_TX_BYP_DLL, 0x3D00);
 
        dev->interface = PHY_INTERFACE_MODE_RGMII_TXID;
 
@@ -2189,28 +2182,27 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
 
 static int lan78xx_set_rx_max_frame_length(struct lan78xx_net *dev, int size)
 {
-       int ret = 0;
        u32 buf;
        bool rxenabled;
 
-       ret = lan78xx_read_reg(dev, MAC_RX, &buf);
+       lan78xx_read_reg(dev, MAC_RX, &buf);
 
        rxenabled = ((buf & MAC_RX_RXEN_) != 0);
 
        if (rxenabled) {
                buf &= ~MAC_RX_RXEN_;
-               ret = lan78xx_write_reg(dev, MAC_RX, buf);
+               lan78xx_write_reg(dev, MAC_RX, buf);
        }
 
        /* add 4 to size for FCS */
        buf &= ~MAC_RX_MAX_SIZE_MASK_;
        buf |= (((size + 4) << MAC_RX_MAX_SIZE_SHIFT_) & MAC_RX_MAX_SIZE_MASK_);
 
-       ret = lan78xx_write_reg(dev, MAC_RX, buf);
+       lan78xx_write_reg(dev, MAC_RX, buf);
 
        if (rxenabled) {
                buf |= MAC_RX_RXEN_;
-               ret = lan78xx_write_reg(dev, MAC_RX, buf);
+               lan78xx_write_reg(dev, MAC_RX, buf);
        }
 
        return 0;
@@ -2267,13 +2259,12 @@ static int lan78xx_change_mtu(struct net_device *netdev, int new_mtu)
        int ll_mtu = new_mtu + netdev->hard_header_len;
        int old_hard_mtu = dev->hard_mtu;
        int old_rx_urb_size = dev->rx_urb_size;
-       int ret;
 
        /* no second zero-length packet read wanted after mtu-sized packets */
        if ((ll_mtu % dev->maxpacket) == 0)
                return -EDOM;
 
-       ret = lan78xx_set_rx_max_frame_length(dev, new_mtu + VLAN_ETH_HLEN);
+       lan78xx_set_rx_max_frame_length(dev, new_mtu + VLAN_ETH_HLEN);
 
        netdev->mtu = new_mtu;
 
@@ -2296,7 +2287,6 @@ static int lan78xx_set_mac_addr(struct net_device *netdev, void *p)
        struct lan78xx_net *dev = netdev_priv(netdev);
        struct sockaddr *addr = p;
        u32 addr_lo, addr_hi;
-       int ret;
 
        if (netif_running(netdev))
                return -EBUSY;
@@ -2313,12 +2303,12 @@ static int lan78xx_set_mac_addr(struct net_device *netdev, void *p)
        addr_hi = netdev->dev_addr[4] |
                  netdev->dev_addr[5] << 8;
 
-       ret = lan78xx_write_reg(dev, RX_ADDRL, addr_lo);
-       ret = lan78xx_write_reg(dev, RX_ADDRH, addr_hi);
+       lan78xx_write_reg(dev, RX_ADDRL, addr_lo);
+       lan78xx_write_reg(dev, RX_ADDRH, addr_hi);
 
        /* Added to support MAC address changes */
-       ret = lan78xx_write_reg(dev, MAF_LO(0), addr_lo);
-       ret = lan78xx_write_reg(dev, MAF_HI(0), addr_hi | MAF_HI_VALID_);
+       lan78xx_write_reg(dev, MAF_LO(0), addr_lo);
+       lan78xx_write_reg(dev, MAF_HI(0), addr_hi | MAF_HI_VALID_);
 
        return 0;
 }
@@ -2330,7 +2320,6 @@ static int lan78xx_set_features(struct net_device *netdev,
        struct lan78xx_net *dev = netdev_priv(netdev);
        struct lan78xx_priv *pdata = (struct lan78xx_priv *)(dev->data[0]);
        unsigned long flags;
-       int ret;
 
        spin_lock_irqsave(&pdata->rfe_ctl_lock, flags);
 
@@ -2354,7 +2343,7 @@ static int lan78xx_set_features(struct net_device *netdev,
 
        spin_unlock_irqrestore(&pdata->rfe_ctl_lock, flags);
 
-       ret = lan78xx_write_reg(dev, RFE_CTL, pdata->rfe_ctl);
+       lan78xx_write_reg(dev, RFE_CTL, pdata->rfe_ctl);
 
        return 0;
 }
@@ -3804,7 +3793,6 @@ static u16 lan78xx_wakeframe_crc16(const u8 *buf, int len)
 static int lan78xx_set_suspend(struct lan78xx_net *dev, u32 wol)
 {
        u32 buf;
-       int ret;
        int mask_index;
        u16 crc;
        u32 temp_wucsr;
@@ -3813,26 +3801,26 @@ static int lan78xx_set_suspend(struct lan78xx_net *dev, u32 wol)
        const u8 ipv6_multicast[3] = { 0x33, 0x33 };
        const u8 arp_type[2] = { 0x08, 0x06 };
 
-       ret = lan78xx_read_reg(dev, MAC_TX, &buf);
+       lan78xx_read_reg(dev, MAC_TX, &buf);
        buf &= ~MAC_TX_TXEN_;
-       ret = lan78xx_write_reg(dev, MAC_TX, buf);
-       ret = lan78xx_read_reg(dev, MAC_RX, &buf);
+       lan78xx_write_reg(dev, MAC_TX, buf);
+       lan78xx_read_reg(dev, MAC_RX, &buf);
        buf &= ~MAC_RX_RXEN_;
-       ret = lan78xx_write_reg(dev, MAC_RX, buf);
+       lan78xx_write_reg(dev, MAC_RX, buf);
 
-       ret = lan78xx_write_reg(dev, WUCSR, 0);
-       ret = lan78xx_write_reg(dev, WUCSR2, 0);
-       ret = lan78xx_write_reg(dev, WK_SRC, 0xFFF1FF1FUL);
+       lan78xx_write_reg(dev, WUCSR, 0);
+       lan78xx_write_reg(dev, WUCSR2, 0);
+       lan78xx_write_reg(dev, WK_SRC, 0xFFF1FF1FUL);
 
        temp_wucsr = 0;
 
        temp_pmt_ctl = 0;
-       ret = lan78xx_read_reg(dev, PMT_CTL, &temp_pmt_ctl);
+       lan78xx_read_reg(dev, PMT_CTL, &temp_pmt_ctl);
        temp_pmt_ctl &= ~PMT_CTL_RES_CLR_WKP_EN_;
        temp_pmt_ctl |= PMT_CTL_RES_CLR_WKP_STS_;
 
        for (mask_index = 0; mask_index < NUM_OF_WUF_CFG; mask_index++)
-               ret = lan78xx_write_reg(dev, WUF_CFG(mask_index), 0);
+               lan78xx_write_reg(dev, WUF_CFG(mask_index), 0);
 
        mask_index = 0;
        if (wol & WAKE_PHY) {
@@ -3861,30 +3849,30 @@ static int lan78xx_set_suspend(struct lan78xx_net *dev, u32 wol)
 
                /* set WUF_CFG & WUF_MASK for IPv4 Multicast */
                crc = lan78xx_wakeframe_crc16(ipv4_multicast, 3);
-               ret = lan78xx_write_reg(dev, WUF_CFG(mask_index),
+               lan78xx_write_reg(dev, WUF_CFG(mask_index),
                                        WUF_CFGX_EN_ |
                                        WUF_CFGX_TYPE_MCAST_ |
                                        (0 << WUF_CFGX_OFFSET_SHIFT_) |
                                        (crc & WUF_CFGX_CRC16_MASK_));
 
-               ret = lan78xx_write_reg(dev, WUF_MASK0(mask_index), 7);
-               ret = lan78xx_write_reg(dev, WUF_MASK1(mask_index), 0);
-               ret = lan78xx_write_reg(dev, WUF_MASK2(mask_index), 0);
-               ret = lan78xx_write_reg(dev, WUF_MASK3(mask_index), 0);
+               lan78xx_write_reg(dev, WUF_MASK0(mask_index), 7);
+               lan78xx_write_reg(dev, WUF_MASK1(mask_index), 0);
+               lan78xx_write_reg(dev, WUF_MASK2(mask_index), 0);
+               lan78xx_write_reg(dev, WUF_MASK3(mask_index), 0);
                mask_index++;
 
                /* for IPv6 Multicast */
                crc = lan78xx_wakeframe_crc16(ipv6_multicast, 2);
-               ret = lan78xx_write_reg(dev, WUF_CFG(mask_index),
+               lan78xx_write_reg(dev, WUF_CFG(mask_index),
                                        WUF_CFGX_EN_ |
                                        WUF_CFGX_TYPE_MCAST_ |
                                        (0 << WUF_CFGX_OFFSET_SHIFT_) |
                                        (crc & WUF_CFGX_CRC16_MASK_));
 
-               ret = lan78xx_write_reg(dev, WUF_MASK0(mask_index), 3);
-               ret = lan78xx_write_reg(dev, WUF_MASK1(mask_index), 0);
-               ret = lan78xx_write_reg(dev, WUF_MASK2(mask_index), 0);
-               ret = lan78xx_write_reg(dev, WUF_MASK3(mask_index), 0);
+               lan78xx_write_reg(dev, WUF_MASK0(mask_index), 3);
+               lan78xx_write_reg(dev, WUF_MASK1(mask_index), 0);
+               lan78xx_write_reg(dev, WUF_MASK2(mask_index), 0);
+               lan78xx_write_reg(dev, WUF_MASK3(mask_index), 0);
                mask_index++;
 
                temp_pmt_ctl |= PMT_CTL_WOL_EN_;
@@ -3905,16 +3893,16 @@ static int lan78xx_set_suspend(struct lan78xx_net *dev, u32 wol)
                 * for packettype (offset 12,13) = ARP (0x0806)
                 */
                crc = lan78xx_wakeframe_crc16(arp_type, 2);
-               ret = lan78xx_write_reg(dev, WUF_CFG(mask_index),
+               lan78xx_write_reg(dev, WUF_CFG(mask_index),
                                        WUF_CFGX_EN_ |
                                        WUF_CFGX_TYPE_ALL_ |
                                        (0 << WUF_CFGX_OFFSET_SHIFT_) |
                                        (crc & WUF_CFGX_CRC16_MASK_));
 
-               ret = lan78xx_write_reg(dev, WUF_MASK0(mask_index), 0x3000);
-               ret = lan78xx_write_reg(dev, WUF_MASK1(mask_index), 0);
-               ret = lan78xx_write_reg(dev, WUF_MASK2(mask_index), 0);
-               ret = lan78xx_write_reg(dev, WUF_MASK3(mask_index), 0);
+               lan78xx_write_reg(dev, WUF_MASK0(mask_index), 0x3000);
+               lan78xx_write_reg(dev, WUF_MASK1(mask_index), 0);
+               lan78xx_write_reg(dev, WUF_MASK2(mask_index), 0);
+               lan78xx_write_reg(dev, WUF_MASK3(mask_index), 0);
                mask_index++;
 
                temp_pmt_ctl |= PMT_CTL_WOL_EN_;
@@ -3922,7 +3910,7 @@ static int lan78xx_set_suspend(struct lan78xx_net *dev, u32 wol)
                temp_pmt_ctl |= PMT_CTL_SUS_MODE_0_;
        }
 
-       ret = lan78xx_write_reg(dev, WUCSR, temp_wucsr);
+       lan78xx_write_reg(dev, WUCSR, temp_wucsr);
 
        /* when multiple WOL bits are set */
        if (hweight_long((unsigned long)wol) > 1) {
@@ -3930,16 +3918,16 @@ static int lan78xx_set_suspend(struct lan78xx_net *dev, u32 wol)
                temp_pmt_ctl &= ~PMT_CTL_SUS_MODE_MASK_;
                temp_pmt_ctl |= PMT_CTL_SUS_MODE_0_;
        }
-       ret = lan78xx_write_reg(dev, PMT_CTL, temp_pmt_ctl);
+       lan78xx_write_reg(dev, PMT_CTL, temp_pmt_ctl);
 
        /* clear WUPS */
-       ret = lan78xx_read_reg(dev, PMT_CTL, &buf);
+       lan78xx_read_reg(dev, PMT_CTL, &buf);
        buf |= PMT_CTL_WUPS_MASK_;
-       ret = lan78xx_write_reg(dev, PMT_CTL, buf);
+       lan78xx_write_reg(dev, PMT_CTL, buf);
 
-       ret = lan78xx_read_reg(dev, MAC_RX, &buf);
+       lan78xx_read_reg(dev, MAC_RX, &buf);
        buf |= MAC_RX_RXEN_;
-       ret = lan78xx_write_reg(dev, MAC_RX, buf);
+       lan78xx_write_reg(dev, MAC_RX, buf);
 
        return 0;
 }
index 09bfa6a..fc512b7 100644 (file)
@@ -462,7 +462,7 @@ static const struct net_device_ops mcs7830_netdev_ops = {
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
        .ndo_change_mtu         = usbnet_change_mtu,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_do_ioctl           = mcs7830_ioctl,
        .ndo_set_rx_mode        = mcs7830_set_multicast,
index a322f51..afeb09b 100644 (file)
@@ -72,7 +72,6 @@ struct qmimux_hdr {
 struct qmimux_priv {
        struct net_device *real_dev;
        u8 mux_id;
-       struct pcpu_sw_netstats __percpu *stats64;
 };
 
 static int qmimux_open(struct net_device *dev)
@@ -108,34 +107,19 @@ static netdev_tx_t qmimux_start_xmit(struct sk_buff *skb, struct net_device *dev
        skb->dev = priv->real_dev;
        ret = dev_queue_xmit(skb);
 
-       if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {
-               struct pcpu_sw_netstats *stats64 = this_cpu_ptr(priv->stats64);
-
-               u64_stats_update_begin(&stats64->syncp);
-               stats64->tx_packets++;
-               stats64->tx_bytes += len;
-               u64_stats_update_end(&stats64->syncp);
-       } else {
+       if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN))
+               dev_sw_netstats_tx_add(dev, 1, len);
+       else
                dev->stats.tx_dropped++;
-       }
 
        return ret;
 }
 
-static void qmimux_get_stats64(struct net_device *net,
-                              struct rtnl_link_stats64 *stats)
-{
-       struct qmimux_priv *priv = netdev_priv(net);
-
-       netdev_stats_to_stats64(stats, &net->stats);
-       dev_fetch_sw_netstats(stats, priv->stats64);
-}
-
 static const struct net_device_ops qmimux_netdev_ops = {
        .ndo_open        = qmimux_open,
        .ndo_stop        = qmimux_stop,
        .ndo_start_xmit  = qmimux_start_xmit,
-       .ndo_get_stats64 = qmimux_get_stats64,
+       .ndo_get_stats64 = dev_get_tstats64,
 };
 
 static void qmimux_setup(struct net_device *dev)
@@ -224,14 +208,7 @@ static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
                        net->stats.rx_errors++;
                        return 0;
                } else {
-                       struct pcpu_sw_netstats *stats64;
-                       struct qmimux_priv *priv = netdev_priv(net);
-
-                       stats64 = this_cpu_ptr(priv->stats64);
-                       u64_stats_update_begin(&stats64->syncp);
-                       stats64->rx_packets++;
-                       stats64->rx_bytes += pkt_len;
-                       u64_stats_update_end(&stats64->syncp);
+                       dev_sw_netstats_rx_add(net, pkt_len);
                }
 
 skip:
@@ -256,8 +233,8 @@ static int qmimux_register_device(struct net_device *real_dev, u8 mux_id)
        priv->mux_id = mux_id;
        priv->real_dev = real_dev;
 
-       priv->stats64 = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
-       if (!priv->stats64) {
+       new_dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
+       if (!new_dev->tstats) {
                err = -ENOBUFS;
                goto out_free_newdev;
        }
@@ -292,7 +269,7 @@ static void qmimux_unregister_device(struct net_device *dev,
        struct qmimux_priv *priv = netdev_priv(dev);
        struct net_device *real_dev = priv->real_dev;
 
-       free_percpu(priv->stats64);
+       free_percpu(dev->tstats);
        netdev_upper_dev_unlink(real_dev, dev);
        unregister_netdevice_queue(dev, head);
 
@@ -598,7 +575,7 @@ static const struct net_device_ops qmi_wwan_netdev_ops = {
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
        .ndo_change_mtu         = usbnet_change_mtu,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_mac_address    = qmi_wwan_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
 };
@@ -1309,6 +1286,7 @@ static const struct usb_device_id products[] = {
        {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)},    /* Telit ME910 dual modem */
        {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)},    /* Telit LE920 */
        {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */
+       {QMI_QUIRK_SET_DTR(0x1bc7, 0x1230, 2)}, /* Telit LE910Cx */
        {QMI_QUIRK_SET_DTR(0x1bc7, 0x1260, 2)}, /* Telit LE910Cx */
        {QMI_QUIRK_SET_DTR(0x1bc7, 0x1261, 2)}, /* Telit LE910Cx */
        {QMI_QUIRK_SET_DTR(0x1bc7, 0x1900, 1)}, /* Telit LN940 series */
index b177048..c448d60 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/acpi.h>
 #include <linux/firmware.h>
 #include <crypto/hash.h>
+#include <linux/usb/r8152.h>
 
 /* Information for net-next */
 #define NETNEXT_VERSION                "11"
@@ -653,18 +654,6 @@ enum rtl_register_content {
 
 #define INTR_LINK              0x0004
 
-#define RTL8152_REQT_READ      0xc0
-#define RTL8152_REQT_WRITE     0x40
-#define RTL8152_REQ_GET_REGS   0x05
-#define RTL8152_REQ_SET_REGS   0x05
-
-#define BYTE_EN_DWORD          0xff
-#define BYTE_EN_WORD           0x33
-#define BYTE_EN_BYTE           0x11
-#define BYTE_EN_SIX_BYTES      0x3f
-#define BYTE_EN_START_MASK     0x0f
-#define BYTE_EN_END_MASK       0xf0
-
 #define RTL8153_MAX_PACKET     9216 /* 9K */
 #define RTL8153_MAX_MTU                (RTL8153_MAX_PACKET - VLAN_ETH_HLEN - \
                                 ETH_FCS_LEN)
@@ -689,21 +678,9 @@ enum rtl8152_flags {
        LENOVO_MACPASSTHRU,
 };
 
-/* Define these values to match your device */
-#define VENDOR_ID_REALTEK              0x0bda
-#define VENDOR_ID_MICROSOFT            0x045e
-#define VENDOR_ID_SAMSUNG              0x04e8
-#define VENDOR_ID_LENOVO               0x17ef
-#define VENDOR_ID_LINKSYS              0x13b1
-#define VENDOR_ID_NVIDIA               0x0955
-#define VENDOR_ID_TPLINK               0x2357
-
 #define DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2      0x3082
 #define DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2             0xa387
 
-#define MCU_TYPE_PLA                   0x0100
-#define MCU_TYPE_USB                   0x0000
-
 struct tally_counter {
        __le64  tx_packets;
        __le64  rx_packets;
@@ -898,6 +875,7 @@ struct fw_header {
  * struct fw_mac - a firmware block used by RTL_FW_PLA and RTL_FW_USB.
  *     The layout of the firmware block is:
  *     <struct fw_mac> + <info> + <firmware data>.
+ * @blk_hdr: firmware descriptor (type, length)
  * @fw_offset: offset of the firmware binary data. The start address of
  *     the data would be the address of struct fw_mac + @fw_offset.
  * @fw_reg: the register to load the firmware. Depends on chip.
@@ -911,6 +889,7 @@ struct fw_header {
  * @bp_num: the break point number which needs to be set for this firmware.
  *     Depends on the firmware.
  * @bp: break points. Depends on firmware.
+ * @reserved: reserved space (unused)
  * @fw_ver_reg: the register to store the fw version.
  * @fw_ver_data: the firmware version of the current type.
  * @info: additional information for debugging, and is followed by the
@@ -936,8 +915,10 @@ struct fw_mac {
 /**
  * struct fw_phy_patch_key - a firmware block used by RTL_FW_PHY_START.
  *     This is used to set patch key when loading the firmware of PHY.
+ * @blk_hdr: firmware descriptor (type, length)
  * @key_reg: the register to write the patch key.
  * @key_data: patch key.
+ * @reserved: reserved space (unused)
  */
 struct fw_phy_patch_key {
        struct fw_block blk_hdr;
@@ -950,6 +931,7 @@ struct fw_phy_patch_key {
  * struct fw_phy_nc - a firmware block used by RTL_FW_PHY_NC.
  *     The layout of the firmware block is:
  *     <struct fw_phy_nc> + <info> + <firmware data>.
+ * @blk_hdr: firmware descriptor (type, length)
  * @fw_offset: offset of the firmware binary data. The start address of
  *     the data would be the address of struct fw_phy_nc + @fw_offset.
  * @fw_reg: the register to load the firmware. Depends on chip.
@@ -958,8 +940,9 @@ struct fw_phy_patch_key {
  * @patch_en_addr: the register of enabling patch mode. Depends on chip.
  * @patch_en_value: patch mode enabled mask. Depends on the firmware.
  * @mode_reg: the regitster of switching the mode.
- * @mod_pre: the mode needing to be set before loading the firmware.
- * @mod_post: the mode to be set when finishing to load the firmware.
+ * @mode_pre: the mode needing to be set before loading the firmware.
+ * @mode_post: the mode to be set when finishing to load the firmware.
+ * @reserved: reserved space (unused)
  * @bp_start: the start register of break points. Depends on chip.
  * @bp_num: the break point number which needs to be set for this firmware.
  *     Depends on the firmware.
@@ -6615,7 +6598,7 @@ static int rtl_fw_init(struct r8152 *tp)
        return 0;
 }
 
-static u8 rtl_get_version(struct usb_interface *intf)
+u8 rtl8152_get_version(struct usb_interface *intf)
 {
        struct usb_device *udev = interface_to_usbdev(intf);
        u32 ocp_data = 0;
@@ -6673,12 +6656,13 @@ static u8 rtl_get_version(struct usb_interface *intf)
 
        return version;
 }
+EXPORT_SYMBOL_GPL(rtl8152_get_version);
 
 static int rtl8152_probe(struct usb_interface *intf,
                         const struct usb_device_id *id)
 {
        struct usb_device *udev = interface_to_usbdev(intf);
-       u8 version = rtl_get_version(intf);
+       u8 version = rtl8152_get_version(intf);
        struct r8152 *tp;
        struct net_device *netdev;
        int ret;
diff --git a/drivers/net/usb/r8153_ecm.c b/drivers/net/usb/r8153_ecm.c
new file mode 100644 (file)
index 0000000..2c3fabd
--- /dev/null
@@ -0,0 +1,162 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/mii.h>
+#include <linux/usb.h>
+#include <linux/usb/cdc.h>
+#include <linux/usb/usbnet.h>
+#include <linux/usb/r8152.h>
+
+#define OCP_BASE               0xe86c
+
+static int pla_read_word(struct usbnet *dev, u16 index)
+{
+       u16 byen = BYTE_EN_WORD;
+       u8 shift = index & 2;
+       __le32 tmp;
+       int ret;
+
+       if (shift)
+               byen <<= shift;
+
+       index &= ~3;
+
+       ret = usbnet_read_cmd(dev, RTL8152_REQ_GET_REGS, RTL8152_REQT_READ, index,
+                             MCU_TYPE_PLA | byen, &tmp, sizeof(tmp));
+       if (ret < 0)
+               goto out;
+
+       ret = __le32_to_cpu(tmp);
+       ret >>= (shift * 8);
+       ret &= 0xffff;
+
+out:
+       return ret;
+}
+
+static int pla_write_word(struct usbnet *dev, u16 index, u32 data)
+{
+       u32 mask = 0xffff;
+       u16 byen = BYTE_EN_WORD;
+       u8 shift = index & 2;
+       __le32 tmp;
+       int ret;
+
+       data &= mask;
+
+       if (shift) {
+               byen <<= shift;
+               mask <<= (shift * 8);
+               data <<= (shift * 8);
+       }
+
+       index &= ~3;
+
+       ret = usbnet_read_cmd(dev, RTL8152_REQ_GET_REGS, RTL8152_REQT_READ, index,
+                             MCU_TYPE_PLA | byen, &tmp, sizeof(tmp));
+
+       if (ret < 0)
+               goto out;
+
+       data |= __le32_to_cpu(tmp) & ~mask;
+       tmp = __cpu_to_le32(data);
+
+       ret = usbnet_write_cmd(dev, RTL8152_REQ_SET_REGS, RTL8152_REQT_WRITE, index,
+                              MCU_TYPE_PLA | byen, &tmp, sizeof(tmp));
+
+out:
+       return ret;
+}
+
+static int r8153_ecm_mdio_read(struct net_device *netdev, int phy_id, int reg)
+{
+       struct usbnet *dev = netdev_priv(netdev);
+       int ret;
+
+       ret = pla_write_word(dev, OCP_BASE, 0xa000);
+       if (ret < 0)
+               goto out;
+
+       ret = pla_read_word(dev, 0xb400 + reg * 2);
+
+out:
+       return ret;
+}
+
+static void r8153_ecm_mdio_write(struct net_device *netdev, int phy_id, int reg, int val)
+{
+       struct usbnet *dev = netdev_priv(netdev);
+       int ret;
+
+       ret = pla_write_word(dev, OCP_BASE, 0xa000);
+       if (ret < 0)
+               return;
+
+       ret = pla_write_word(dev, 0xb400 + reg * 2, val);
+}
+
+static int r8153_bind(struct usbnet *dev, struct usb_interface *intf)
+{
+       int status;
+
+       status = usbnet_cdc_bind(dev, intf);
+       if (status < 0)
+               return status;
+
+       dev->mii.dev = dev->net;
+       dev->mii.mdio_read = r8153_ecm_mdio_read;
+       dev->mii.mdio_write = r8153_ecm_mdio_write;
+       dev->mii.reg_num_mask = 0x1f;
+       dev->mii.supports_gmii = 1;
+
+       return status;
+}
+
+static const struct driver_info r8153_info = {
+       .description =  "RTL8153 ECM Device",
+       .flags =        FLAG_ETHER,
+       .bind =         r8153_bind,
+       .unbind =       usbnet_cdc_unbind,
+       .status =       usbnet_cdc_status,
+       .manage_power = usbnet_manage_power,
+};
+
+static const struct usb_device_id products[] = {
+{
+       USB_DEVICE_AND_INTERFACE_INFO(VENDOR_ID_REALTEK, 0x8153, USB_CLASS_COMM,
+                                     USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
+       .driver_info = (unsigned long)&r8153_info,
+},
+
+       { },            /* END */
+};
+MODULE_DEVICE_TABLE(usb, products);
+
+static int rtl8153_ecm_probe(struct usb_interface *intf,
+                            const struct usb_device_id *id)
+{
+#if IS_REACHABLE(CONFIG_USB_RTL8152)
+       if (rtl8152_get_version(intf))
+               return -ENODEV;
+#endif
+
+       return usbnet_probe(intf, id);
+}
+
+static struct usb_driver r8153_ecm_driver = {
+       .name =         "r8153_ecm",
+       .id_table =     products,
+       .probe =        rtl8153_ecm_probe,
+       .disconnect =   usbnet_disconnect,
+       .suspend =      usbnet_suspend,
+       .resume =       usbnet_resume,
+       .reset_resume = usbnet_resume,
+       .supports_autosuspend = 1,
+       .disable_hub_initiated_lpm = 1,
+};
+
+module_usb_driver(r8153_ecm_driver);
+
+MODULE_AUTHOR("Hayes Wang");
+MODULE_DESCRIPTION("Realtek USB ECM device");
+MODULE_LICENSE("GPL");
index 6fa7a00..6609d21 100644 (file)
@@ -279,7 +279,7 @@ static const struct net_device_ops rndis_netdev_ops = {
        .ndo_stop               = usbnet_stop,
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
 };
index 0abd257..55a244e 100644 (file)
@@ -184,7 +184,7 @@ static const struct net_device_ops sierra_net_device_ops = {
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
        .ndo_change_mtu         = usbnet_change_mtu,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
 };
index 8689835..4353b37 100644 (file)
@@ -1435,7 +1435,7 @@ static const struct net_device_ops smsc75xx_netdev_ops = {
        .ndo_stop               = usbnet_stop,
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_change_mtu         = smsc75xx_change_mtu,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
index ea0d5f0..4c8ee1c 100644 (file)
@@ -1041,7 +1041,7 @@ static const struct net_device_ops smsc95xx_netdev_ops = {
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
        .ndo_change_mtu         = usbnet_change_mtu,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_do_ioctl           = smsc95xx_ioctl,
index e04c805..878557a 100644 (file)
@@ -308,7 +308,7 @@ static const struct net_device_ops sr9700_netdev_ops = {
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
        .ndo_change_mtu         = usbnet_change_mtu,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_do_ioctl           = sr9700_ioctl,
        .ndo_set_rx_mode        = sr9700_set_multicast,
index 681e0de..da56735 100644 (file)
@@ -681,7 +681,7 @@ static const struct net_device_ops sr9800_netdev_ops = {
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
        .ndo_change_mtu         = usbnet_change_mtu,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_mac_address    = sr_set_mac_address,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_do_ioctl           = sr_ioctl,
index 6062dc2..1447da1 100644 (file)
@@ -304,7 +304,7 @@ static void __usbnet_status_stop_force(struct usbnet *dev)
  */
 void usbnet_skb_return (struct usbnet *dev, struct sk_buff *skb)
 {
-       struct pcpu_sw_netstats *stats64 = this_cpu_ptr(dev->stats64);
+       struct pcpu_sw_netstats *stats64 = this_cpu_ptr(dev->net->tstats);
        unsigned long flags;
        int     status;
 
@@ -980,15 +980,6 @@ int usbnet_set_link_ksettings(struct net_device *net,
 }
 EXPORT_SYMBOL_GPL(usbnet_set_link_ksettings);
 
-void usbnet_get_stats64(struct net_device *net, struct rtnl_link_stats64 *stats)
-{
-       struct usbnet *dev = netdev_priv(net);
-
-       netdev_stats_to_stats64(stats, &net->stats);
-       dev_fetch_sw_netstats(stats, dev->stats64);
-}
-EXPORT_SYMBOL_GPL(usbnet_get_stats64);
-
 u32 usbnet_get_link (struct net_device *net)
 {
        struct usbnet *dev = netdev_priv(net);
@@ -1220,7 +1211,7 @@ static void tx_complete (struct urb *urb)
        struct usbnet           *dev = entry->dev;
 
        if (urb->status == 0) {
-               struct pcpu_sw_netstats *stats64 = this_cpu_ptr(dev->stats64);
+               struct pcpu_sw_netstats *stats64 = this_cpu_ptr(dev->net->tstats);
                unsigned long flags;
 
                flags = u64_stats_update_begin_irqsave(&stats64->syncp);
@@ -1596,7 +1587,7 @@ void usbnet_disconnect (struct usb_interface *intf)
        usb_free_urb(dev->interrupt);
        kfree(dev->padding_pkt);
 
-       free_percpu(dev->stats64);
+       free_percpu(net->tstats);
        free_netdev(net);
 }
 EXPORT_SYMBOL_GPL(usbnet_disconnect);
@@ -1608,7 +1599,7 @@ static const struct net_device_ops usbnet_netdev_ops = {
        .ndo_tx_timeout         = usbnet_tx_timeout,
        .ndo_set_rx_mode        = usbnet_set_rx_mode,
        .ndo_change_mtu         = usbnet_change_mtu,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
 };
@@ -1671,8 +1662,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
        dev->driver_info = info;
        dev->driver_name = name;
 
-       dev->stats64 = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
-       if (!dev->stats64)
+       net->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
+       if (!net->tstats)
                goto out0;
 
        dev->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV
@@ -1812,7 +1803,7 @@ out1:
         */
        cancel_work_sync(&dev->kevent);
        del_timer_sync(&dev->delay);
-       free_percpu(dev->stats64);
+       free_percpu(net->tstats);
 out0:
        free_netdev(net);
 out:
index 60c1aad..f2793ff 100644 (file)
@@ -608,8 +608,7 @@ static netdev_tx_t vrf_xmit(struct sk_buff *skb, struct net_device *dev)
        return ret;
 }
 
-static int vrf_finish_direct(struct net *net, struct sock *sk,
-                            struct sk_buff *skb)
+static void vrf_finish_direct(struct sk_buff *skb)
 {
        struct net_device *vrf_dev = skb->dev;
 
@@ -628,7 +627,8 @@ static int vrf_finish_direct(struct net *net, struct sock *sk,
                skb_pull(skb, ETH_HLEN);
        }
 
-       return 1;
+       /* reset skb device */
+       nf_reset_ct(skb);
 }
 
 #if IS_ENABLED(CONFIG_IPV6)
@@ -707,15 +707,41 @@ static struct sk_buff *vrf_ip6_out_redirect(struct net_device *vrf_dev,
        return skb;
 }
 
+static int vrf_output6_direct_finish(struct net *net, struct sock *sk,
+                                    struct sk_buff *skb)
+{
+       vrf_finish_direct(skb);
+
+       return vrf_ip6_local_out(net, sk, skb);
+}
+
 static int vrf_output6_direct(struct net *net, struct sock *sk,
                              struct sk_buff *skb)
 {
+       int err = 1;
+
        skb->protocol = htons(ETH_P_IPV6);
 
-       return NF_HOOK_COND(NFPROTO_IPV6, NF_INET_POST_ROUTING,
-                           net, sk, skb, NULL, skb->dev,
-                           vrf_finish_direct,
-                           !(IPCB(skb)->flags & IPSKB_REROUTED));
+       if (!(IPCB(skb)->flags & IPSKB_REROUTED))
+               err = nf_hook(NFPROTO_IPV6, NF_INET_POST_ROUTING, net, sk, skb,
+                             NULL, skb->dev, vrf_output6_direct_finish);
+
+       if (likely(err == 1))
+               vrf_finish_direct(skb);
+
+       return err;
+}
+
+static int vrf_ip6_out_direct_finish(struct net *net, struct sock *sk,
+                                    struct sk_buff *skb)
+{
+       int err;
+
+       err = vrf_output6_direct(net, sk, skb);
+       if (likely(err == 1))
+               err = vrf_ip6_local_out(net, sk, skb);
+
+       return err;
 }
 
 static struct sk_buff *vrf_ip6_out_direct(struct net_device *vrf_dev,
@@ -728,18 +754,15 @@ static struct sk_buff *vrf_ip6_out_direct(struct net_device *vrf_dev,
        skb->dev = vrf_dev;
 
        err = nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, sk,
-                     skb, NULL, vrf_dev, vrf_output6_direct);
+                     skb, NULL, vrf_dev, vrf_ip6_out_direct_finish);
 
        if (likely(err == 1))
                err = vrf_output6_direct(net, sk, skb);
 
-       /* reset skb device */
        if (likely(err == 1))
-               nf_reset_ct(skb);
-       else
-               skb = NULL;
+               return skb;
 
-       return skb;
+       return NULL;
 }
 
 static struct sk_buff *vrf_ip6_out(struct net_device *vrf_dev,
@@ -919,15 +942,41 @@ static struct sk_buff *vrf_ip_out_redirect(struct net_device *vrf_dev,
        return skb;
 }
 
+static int vrf_output_direct_finish(struct net *net, struct sock *sk,
+                                   struct sk_buff *skb)
+{
+       vrf_finish_direct(skb);
+
+       return vrf_ip_local_out(net, sk, skb);
+}
+
 static int vrf_output_direct(struct net *net, struct sock *sk,
                             struct sk_buff *skb)
 {
+       int err = 1;
+
        skb->protocol = htons(ETH_P_IP);
 
-       return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING,
-                           net, sk, skb, NULL, skb->dev,
-                           vrf_finish_direct,
-                           !(IPCB(skb)->flags & IPSKB_REROUTED));
+       if (!(IPCB(skb)->flags & IPSKB_REROUTED))
+               err = nf_hook(NFPROTO_IPV4, NF_INET_POST_ROUTING, net, sk, skb,
+                             NULL, skb->dev, vrf_output_direct_finish);
+
+       if (likely(err == 1))
+               vrf_finish_direct(skb);
+
+       return err;
+}
+
+static int vrf_ip_out_direct_finish(struct net *net, struct sock *sk,
+                                   struct sk_buff *skb)
+{
+       int err;
+
+       err = vrf_output_direct(net, sk, skb);
+       if (likely(err == 1))
+               err = vrf_ip_local_out(net, sk, skb);
+
+       return err;
 }
 
 static struct sk_buff *vrf_ip_out_direct(struct net_device *vrf_dev,
@@ -940,18 +989,15 @@ static struct sk_buff *vrf_ip_out_direct(struct net_device *vrf_dev,
        skb->dev = vrf_dev;
 
        err = nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, net, sk,
-                     skb, NULL, vrf_dev, vrf_output_direct);
+                     skb, NULL, vrf_dev, vrf_ip_out_direct_finish);
 
        if (likely(err == 1))
                err = vrf_output_direct(net, sk, skb);
 
-       /* reset skb device */
        if (likely(err == 1))
-               nf_reset_ct(skb);
-       else
-               skb = NULL;
+               return skb;
 
-       return skb;
+       return NULL;
 }
 
 static struct sk_buff *vrf_ip_out(struct net_device *vrf_dev,
index 1a557ae..236fcc5 100644 (file)
@@ -66,6 +66,7 @@ struct vxlan_net {
        struct list_head  vxlan_list;
        struct hlist_head sock_list[PORT_HASH_SIZE];
        spinlock_t        sock_lock;
+       struct notifier_block nexthop_notifier_block;
 };
 
 /* Forwarding table entry */
@@ -3210,7 +3211,7 @@ static const struct net_device_ops vxlan_netdev_ether_ops = {
        .ndo_open               = vxlan_open,
        .ndo_stop               = vxlan_stop,
        .ndo_start_xmit         = vxlan_xmit,
-       .ndo_get_stats64        = ip_tunnel_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_rx_mode        = vxlan_set_multicast_list,
        .ndo_change_mtu         = vxlan_change_mtu,
        .ndo_validate_addr      = eth_validate_addr,
@@ -3229,7 +3230,7 @@ static const struct net_device_ops vxlan_netdev_raw_ops = {
        .ndo_open               = vxlan_open,
        .ndo_stop               = vxlan_stop,
        .ndo_start_xmit         = vxlan_xmit,
-       .ndo_get_stats64        = ip_tunnel_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_change_mtu         = vxlan_change_mtu,
        .ndo_fill_metadata_dst  = vxlan_fill_metadata_dst,
 };
@@ -4683,9 +4684,14 @@ static void vxlan_fdb_nh_flush(struct nexthop *nh)
 static int vxlan_nexthop_event(struct notifier_block *nb,
                               unsigned long event, void *ptr)
 {
-       struct nexthop *nh = ptr;
+       struct nh_notifier_info *info = ptr;
+       struct nexthop *nh;
+
+       if (event != NEXTHOP_EVENT_DEL)
+               return NOTIFY_DONE;
 
-       if (!nh || event != NEXTHOP_EVENT_DEL)
+       nh = nexthop_find_by_id(info->net, info->id);
+       if (!nh)
                return NOTIFY_DONE;
 
        vxlan_fdb_nh_flush(nh);
@@ -4693,10 +4699,6 @@ static int vxlan_nexthop_event(struct notifier_block *nb,
        return NOTIFY_DONE;
 }
 
-static struct notifier_block vxlan_nexthop_notifier_block __read_mostly = {
-       .notifier_call = vxlan_nexthop_event,
-};
-
 static __net_init int vxlan_init_net(struct net *net)
 {
        struct vxlan_net *vn = net_generic(net, vxlan_net_id);
@@ -4704,11 +4706,13 @@ static __net_init int vxlan_init_net(struct net *net)
 
        INIT_LIST_HEAD(&vn->vxlan_list);
        spin_lock_init(&vn->sock_lock);
+       vn->nexthop_notifier_block.notifier_call = vxlan_nexthop_event;
 
        for (h = 0; h < PORT_HASH_SIZE; ++h)
                INIT_HLIST_HEAD(&vn->sock_list[h]);
 
-       return register_nexthop_notifier(net, &vxlan_nexthop_notifier_block);
+       return register_nexthop_notifier(net, &vn->nexthop_notifier_block,
+                                        NULL);
 }
 
 static void vxlan_destroy_tunnels(struct net *net, struct list_head *head)
@@ -4740,8 +4744,11 @@ static void __net_exit vxlan_exit_batch_net(struct list_head *net_list)
        LIST_HEAD(list);
 
        rtnl_lock();
-       list_for_each_entry(net, net_list, exit_list)
-               unregister_nexthop_notifier(net, &vxlan_nexthop_notifier_block);
+       list_for_each_entry(net, net_list, exit_list) {
+               struct vxlan_net *vn = net_generic(net, vxlan_net_id);
+
+               unregister_nexthop_notifier(net, &vn->nexthop_notifier_block);
+       }
        list_for_each_entry(net, net_list, exit_list)
                vxlan_destroy_tunnels(net, &list);
 
index 39e5ab2..2cf98a7 100644 (file)
@@ -383,21 +383,6 @@ config LAPBETHER
 
          If unsure, say N.
 
-config X25_ASY
-       tristate "X.25 async driver"
-       depends on LAPB && X25 && TTY
-       help
-         Send and receive X.25 frames over regular asynchronous serial
-         lines such as telephone lines equipped with ordinary modems.
-
-         Experts should note that this driver doesn't currently comply with
-         the asynchronous HDLS framing protocols in CCITT recommendation X.25.
-
-         To compile this driver as a module, choose M here: the
-         module will be called x25_asy.
-
-         If unsure, say N.
-
 config SBNI
        tristate "Granch SBNI12 Leased Line adapter support"
        depends on X86
index 380271a..5b9dc85 100644 (file)
@@ -18,7 +18,6 @@ obj-$(CONFIG_HOSTESS_SV11)    += z85230.o     hostess_sv11.o
 obj-$(CONFIG_SEALEVEL_4021)    += z85230.o     sealevel.o
 obj-$(CONFIG_COSA)             += cosa.o
 obj-$(CONFIG_FARSYNC)          += farsync.o
-obj-$(CONFIG_X25_ASY)          += x25_asy.o
 
 obj-$(CONFIG_LANMEDIA)         += lmc/
 
index f8aed06..2369ca2 100644 (file)
@@ -889,6 +889,7 @@ static ssize_t cosa_write(struct file *file,
                        chan->tx_status = 1;
                        spin_unlock_irqrestore(&cosa->lock, flags);
                        up(&chan->wsem);
+                       kfree(kbuf);
                        return -ERESTARTSYS;
                }
        }
index 409e5a7..0720f5f 100644 (file)
@@ -871,6 +871,45 @@ static int fr_lmi_recv(struct net_device *dev, struct sk_buff *skb)
        return 0;
 }
 
+static int fr_snap_parse(struct sk_buff *skb, struct pvc_device *pvc)
+{
+       /* OUI 00-00-00 indicates an Ethertype follows */
+       if (skb->data[0] == 0x00 &&
+           skb->data[1] == 0x00 &&
+           skb->data[2] == 0x00) {
+               if (!pvc->main)
+                       return -1;
+               skb->dev = pvc->main;
+               skb->protocol = *(__be16 *)(skb->data + 3); /* Ethertype */
+               skb_pull(skb, 5);
+               skb_reset_mac_header(skb);
+               return 0;
+
+       /* OUI 00-80-C2 stands for the 802.1 organization */
+       } else if (skb->data[0] == 0x00 &&
+                  skb->data[1] == 0x80 &&
+                  skb->data[2] == 0xC2) {
+               /* PID 00-07 stands for Ethernet frames without FCS */
+               if (skb->data[3] == 0x00 &&
+                   skb->data[4] == 0x07) {
+                       if (!pvc->ether)
+                               return -1;
+                       skb_pull(skb, 5);
+                       if (skb->len < ETH_HLEN)
+                               return -1;
+                       skb->protocol = eth_type_trans(skb, pvc->ether);
+                       return 0;
+
+               /* PID unsupported */
+               } else {
+                       return -1;
+               }
+
+       /* OUI unsupported */
+       } else {
+               return -1;
+       }
+}
 
 static int fr_rx(struct sk_buff *skb)
 {
@@ -880,9 +919,9 @@ static int fr_rx(struct sk_buff *skb)
        u8 *data = skb->data;
        u16 dlci;
        struct pvc_device *pvc;
-       struct net_device *dev = NULL;
+       struct net_device *dev;
 
-       if (skb->len <= 4 || fh->ea1 || data[2] != FR_UI)
+       if (skb->len < 4 || fh->ea1 || !fh->ea2 || data[2] != FR_UI)
                goto rx_error;
 
        dlci = q922_to_dlci(skb->data);
@@ -904,8 +943,7 @@ static int fr_rx(struct sk_buff *skb)
                netdev_info(frad, "No PVC for received frame's DLCI %d\n",
                            dlci);
 #endif
-               dev_kfree_skb_any(skb);
-               return NET_RX_DROP;
+               goto rx_drop;
        }
 
        if (pvc->state.fecn != fh->fecn) {
@@ -931,63 +969,51 @@ static int fr_rx(struct sk_buff *skb)
        }
 
        if (data[3] == NLPID_IP) {
+               if (!pvc->main)
+                       goto rx_drop;
                skb_pull(skb, 4); /* Remove 4-byte header (hdr, UI, NLPID) */
-               dev = pvc->main;
+               skb->dev = pvc->main;
                skb->protocol = htons(ETH_P_IP);
+               skb_reset_mac_header(skb);
 
        } else if (data[3] == NLPID_IPV6) {
+               if (!pvc->main)
+                       goto rx_drop;
                skb_pull(skb, 4); /* Remove 4-byte header (hdr, UI, NLPID) */
-               dev = pvc->main;
+               skb->dev = pvc->main;
                skb->protocol = htons(ETH_P_IPV6);
+               skb_reset_mac_header(skb);
 
-       } else if (skb->len > 10 && data[3] == FR_PAD &&
-                  data[4] == NLPID_SNAP && data[5] == FR_PAD) {
-               u16 oui = ntohs(*(__be16*)(data + 6));
-               u16 pid = ntohs(*(__be16*)(data + 8));
-               skb_pull(skb, 10);
-
-               switch ((((u32)oui) << 16) | pid) {
-               case ETH_P_ARP: /* routed frame with SNAP */
-               case ETH_P_IPX:
-               case ETH_P_IP:  /* a long variant */
-               case ETH_P_IPV6:
-                       dev = pvc->main;
-                       skb->protocol = htons(pid);
-                       break;
-
-               case 0x80C20007: /* bridged Ethernet frame */
-                       if ((dev = pvc->ether) != NULL)
-                               skb->protocol = eth_type_trans(skb, dev);
-                       break;
-
-               default:
-                       netdev_info(frad, "Unsupported protocol, OUI=%x PID=%x\n",
-                                   oui, pid);
-                       dev_kfree_skb_any(skb);
-                       return NET_RX_DROP;
+       } else if (data[3] == FR_PAD) {
+               if (skb->len < 5)
+                       goto rx_error;
+               if (data[4] == NLPID_SNAP) { /* A SNAP header follows */
+                       skb_pull(skb, 5);
+                       if (skb->len < 5) /* Incomplete SNAP header */
+                               goto rx_error;
+                       if (fr_snap_parse(skb, pvc))
+                               goto rx_drop;
+               } else {
+                       goto rx_drop;
                }
+
        } else {
                netdev_info(frad, "Unsupported protocol, NLPID=%x length=%i\n",
                            data[3], skb->len);
-               dev_kfree_skb_any(skb);
-               return NET_RX_DROP;
+               goto rx_drop;
        }
 
-       if (dev) {
-               dev->stats.rx_packets++; /* PVC traffic */
-               dev->stats.rx_bytes += skb->len;
-               if (pvc->state.becn)
-                       dev->stats.rx_compressed++;
-               skb->dev = dev;
-               netif_rx(skb);
-               return NET_RX_SUCCESS;
-       } else {
-               dev_kfree_skb_any(skb);
-               return NET_RX_DROP;
-       }
+       dev = skb->dev;
+       dev->stats.rx_packets++; /* PVC traffic */
+       dev->stats.rx_bytes += skb->len;
+       if (pvc->state.becn)
+               dev->stats.rx_compressed++;
+       netif_rx(skb);
+       return NET_RX_SUCCESS;
 
- rx_error:
+rx_error:
        frad->stats.rx_errors++; /* Mark error */
+rx_drop:
        dev_kfree_skb_any(skb);
        return NET_RX_DROP;
 }
index 36600b0..93c7e85 100644 (file)
@@ -353,9 +353,8 @@ int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
             switch(xc.command){
             case lmc_xilinx_reset: /*fold02*/
                 {
-                    u16 mii;
                    spin_lock_irqsave(&sc->lmc_lock, flags);
-                    mii = lmc_mii_readreg (sc, 0, 16);
+                    lmc_mii_readreg (sc, 0, 16);
 
                     /*
                      * Make all of them 0 and make input
@@ -424,10 +423,9 @@ int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
                 break;
             case lmc_xilinx_load_prom: /*fold02*/
                 {
-                    u16 mii;
                     int timeout = 500000;
                    spin_lock_irqsave(&sc->lmc_lock, flags);
-                    mii = lmc_mii_readreg (sc, 0, 16);
+                    lmc_mii_readreg (sc, 0, 16);
 
                     /*
                      * Make all of them 0 and make input
@@ -1185,7 +1183,6 @@ static irqreturn_t lmc_interrupt (int irq, void *dev_instance) /*fold00*/
     int i;
     s32 stat;
     unsigned int badtx;
-    u32 firstcsr;
     int max_work = LMC_RXDESCS;
     int handled = 0;
 
@@ -1203,8 +1200,6 @@ static irqreturn_t lmc_interrupt (int irq, void *dev_instance) /*fold00*/
         goto lmc_int_fail_out;
     }
 
-    firstcsr = csr;
-
     /* always go through this loop at least once */
     while (csr & sc->lmc_intrmask) {
        handled = 1;
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
deleted file mode 100644 (file)
index 54b1a5a..0000000
+++ /dev/null
@@ -1,836 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- *     Things to sort out:
- *
- *     o       tbusy handling
- *     o       allow users to set the parameters
- *     o       sync/async switching ?
- *
- *     Note: This does _not_ implement CCITT X.25 asynchronous framing
- *     recommendations. Its primarily for testing purposes. If you wanted
- *     to do CCITT then in theory all you need is to nick the HDLC async
- *     checksum routines from ppp.c
- *      Changes:
- *
- *     2000-10-29      Henner Eisen    lapb_data_indication() return status.
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/module.h>
-
-#include <linux/uaccess.h>
-#include <linux/bitops.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/interrupt.h>
-#include <linux/in.h>
-#include <linux/tty.h>
-#include <linux/errno.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/if_arp.h>
-#include <linux/lapb.h>
-#include <linux/init.h>
-#include <linux/rtnetlink.h>
-#include <linux/slab.h>
-#include <net/x25device.h>
-#include "x25_asy.h"
-
-static struct net_device **x25_asy_devs;
-static int x25_asy_maxdev = SL_NRUNIT;
-
-module_param(x25_asy_maxdev, int, 0);
-MODULE_LICENSE("GPL");
-
-static int x25_asy_esc(unsigned char *p, unsigned char *d, int len);
-static void x25_asy_unesc(struct x25_asy *sl, unsigned char c);
-static void x25_asy_setup(struct net_device *dev);
-
-/* Find a free X.25 channel, and link in this `tty' line. */
-static struct x25_asy *x25_asy_alloc(void)
-{
-       struct net_device *dev = NULL;
-       struct x25_asy *sl;
-       int i;
-
-       if (x25_asy_devs == NULL)
-               return NULL;    /* Master array missing ! */
-
-       for (i = 0; i < x25_asy_maxdev; i++) {
-               dev = x25_asy_devs[i];
-
-               /* Not allocated ? */
-               if (dev == NULL)
-                       break;
-
-               sl = netdev_priv(dev);
-               /* Not in use ? */
-               if (!test_and_set_bit(SLF_INUSE, &sl->flags))
-                       return sl;
-       }
-
-
-       /* Sorry, too many, all slots in use */
-       if (i >= x25_asy_maxdev)
-               return NULL;
-
-       /* If no channels are available, allocate one */
-       if (!dev) {
-               char name[IFNAMSIZ];
-               sprintf(name, "x25asy%d", i);
-
-               dev = alloc_netdev(sizeof(struct x25_asy), name,
-                                  NET_NAME_UNKNOWN, x25_asy_setup);
-               if (!dev)
-                       return NULL;
-
-               /* Initialize channel control data */
-               sl = netdev_priv(dev);
-               dev->base_addr    = i;
-
-               /* register device so that it can be ifconfig'ed       */
-               if (register_netdev(dev) == 0) {
-                       /* (Re-)Set the INUSE bit.   Very Important! */
-                       set_bit(SLF_INUSE, &sl->flags);
-                       x25_asy_devs[i] = dev;
-                       return sl;
-               } else {
-                       pr_warn("%s(): register_netdev() failure\n", __func__);
-                       free_netdev(dev);
-               }
-       }
-       return NULL;
-}
-
-
-/* Free an X.25 channel. */
-static void x25_asy_free(struct x25_asy *sl)
-{
-       /* Free all X.25 frame buffers. */
-       kfree(sl->rbuff);
-       sl->rbuff = NULL;
-       kfree(sl->xbuff);
-       sl->xbuff = NULL;
-
-       if (!test_and_clear_bit(SLF_INUSE, &sl->flags))
-               netdev_err(sl->dev, "x25_asy_free for already free unit\n");
-}
-
-static int x25_asy_change_mtu(struct net_device *dev, int newmtu)
-{
-       struct x25_asy *sl = netdev_priv(dev);
-       unsigned char *xbuff, *rbuff;
-       int len;
-
-       len = 2 * newmtu;
-       xbuff = kmalloc(len + 4, GFP_ATOMIC);
-       rbuff = kmalloc(len + 4, GFP_ATOMIC);
-
-       if (xbuff == NULL || rbuff == NULL) {
-               kfree(xbuff);
-               kfree(rbuff);
-               return -ENOMEM;
-       }
-
-       spin_lock_bh(&sl->lock);
-       xbuff    = xchg(&sl->xbuff, xbuff);
-       if (sl->xleft)  {
-               if (sl->xleft <= len)  {
-                       memcpy(sl->xbuff, sl->xhead, sl->xleft);
-               } else  {
-                       sl->xleft = 0;
-                       dev->stats.tx_dropped++;
-               }
-       }
-       sl->xhead = sl->xbuff;
-
-       rbuff    = xchg(&sl->rbuff, rbuff);
-       if (sl->rcount)  {
-               if (sl->rcount <= len) {
-                       memcpy(sl->rbuff, rbuff, sl->rcount);
-               } else  {
-                       sl->rcount = 0;
-                       dev->stats.rx_over_errors++;
-                       set_bit(SLF_ERROR, &sl->flags);
-               }
-       }
-
-       dev->mtu    = newmtu;
-       sl->buffsize = len;
-
-       spin_unlock_bh(&sl->lock);
-
-       kfree(xbuff);
-       kfree(rbuff);
-       return 0;
-}
-
-
-/* Set the "sending" flag.  This must be atomic, hence the ASM. */
-
-static inline void x25_asy_lock(struct x25_asy *sl)
-{
-       netif_stop_queue(sl->dev);
-}
-
-
-/* Clear the "sending" flag.  This must be atomic, hence the ASM. */
-
-static inline void x25_asy_unlock(struct x25_asy *sl)
-{
-       netif_wake_queue(sl->dev);
-}
-
-/* Send an LAPB frame to the LAPB module to process. */
-
-static void x25_asy_bump(struct x25_asy *sl)
-{
-       struct net_device *dev = sl->dev;
-       struct sk_buff *skb;
-       int count;
-       int err;
-
-       count = sl->rcount;
-       dev->stats.rx_bytes += count;
-
-       skb = dev_alloc_skb(count);
-       if (skb == NULL) {
-               netdev_warn(sl->dev, "memory squeeze, dropping packet\n");
-               dev->stats.rx_dropped++;
-               return;
-       }
-       skb_put_data(skb, sl->rbuff, count);
-       err = lapb_data_received(sl->dev, skb);
-       if (err != LAPB_OK) {
-               kfree_skb(skb);
-               printk(KERN_DEBUG "x25_asy: data received err - %d\n", err);
-       } else {
-               dev->stats.rx_packets++;
-       }
-}
-
-/* Encapsulate one IP datagram and stuff into a TTY queue. */
-static void x25_asy_encaps(struct x25_asy *sl, unsigned char *icp, int len)
-{
-       unsigned char *p;
-       int actual, count, mtu = sl->dev->mtu;
-
-       if (len > mtu) {
-               /* Sigh, shouldn't occur BUT ... */
-               len = mtu;
-               printk(KERN_DEBUG "%s: truncating oversized transmit packet!\n",
-                                       sl->dev->name);
-               sl->dev->stats.tx_dropped++;
-               x25_asy_unlock(sl);
-               return;
-       }
-
-       p = icp;
-       count = x25_asy_esc(p, sl->xbuff, len);
-
-       /* Order of next two lines is *very* important.
-        * When we are sending a little amount of data,
-        * the transfer may be completed inside driver.write()
-        * routine, because it's running with interrupts enabled.
-        * In this case we *never* got WRITE_WAKEUP event,
-        * if we did not request it before write operation.
-        *       14 Oct 1994  Dmitry Gorodchanin.
-        */
-       set_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
-       actual = sl->tty->ops->write(sl->tty, sl->xbuff, count);
-       sl->xleft = count - actual;
-       sl->xhead = sl->xbuff + actual;
-}
-
-/*
- * Called by the driver when there's room for more data.  If we have
- * more packets to send, we send them here.
- */
-static void x25_asy_write_wakeup(struct tty_struct *tty)
-{
-       int actual;
-       struct x25_asy *sl = tty->disc_data;
-
-       /* First make sure we're connected. */
-       if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev))
-               return;
-
-       if (sl->xleft <= 0) {
-               /* Now serial buffer is almost free & we can start
-                * transmission of another packet */
-               sl->dev->stats.tx_packets++;
-               clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
-               x25_asy_unlock(sl);
-               return;
-       }
-
-       actual = tty->ops->write(tty, sl->xhead, sl->xleft);
-       sl->xleft -= actual;
-       sl->xhead += actual;
-}
-
-static void x25_asy_timeout(struct net_device *dev, unsigned int txqueue)
-{
-       struct x25_asy *sl = netdev_priv(dev);
-
-       spin_lock(&sl->lock);
-       if (netif_queue_stopped(dev)) {
-               /* May be we must check transmitter timeout here ?
-                *      14 Oct 1994 Dmitry Gorodchanin.
-                */
-               netdev_warn(dev, "transmit timed out, %s?\n",
-                           (tty_chars_in_buffer(sl->tty) || sl->xleft) ?
-                           "bad line quality" : "driver error");
-               sl->xleft = 0;
-               clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
-               x25_asy_unlock(sl);
-       }
-       spin_unlock(&sl->lock);
-}
-
-/* Encapsulate an IP datagram and kick it into a TTY queue. */
-
-static netdev_tx_t x25_asy_xmit(struct sk_buff *skb,
-                                     struct net_device *dev)
-{
-       struct x25_asy *sl = netdev_priv(dev);
-       int err;
-
-       if (!netif_running(sl->dev)) {
-               netdev_err(dev, "xmit call when iface is down\n");
-               kfree_skb(skb);
-               return NETDEV_TX_OK;
-       }
-
-       /* There should be a pseudo header of 1 byte added by upper layers.
-        * Check to make sure it is there before reading it.
-        */
-       if (skb->len < 1) {
-               kfree_skb(skb);
-               return NETDEV_TX_OK;
-       }
-
-       switch (skb->data[0]) {
-       case X25_IFACE_DATA:
-               break;
-       case X25_IFACE_CONNECT: /* Connection request .. do nothing */
-               err = lapb_connect_request(dev);
-               if (err != LAPB_OK)
-                       netdev_err(dev, "lapb_connect_request error: %d\n",
-                                  err);
-               kfree_skb(skb);
-               return NETDEV_TX_OK;
-       case X25_IFACE_DISCONNECT: /* do nothing - hang up ?? */
-               err = lapb_disconnect_request(dev);
-               if (err != LAPB_OK)
-                       netdev_err(dev, "lapb_disconnect_request error: %d\n",
-                                  err);
-               fallthrough;
-       default:
-               kfree_skb(skb);
-               return NETDEV_TX_OK;
-       }
-       skb_pull(skb, 1);       /* Remove control byte */
-       /*
-        * If we are busy already- too bad.  We ought to be able
-        * to queue things at this point, to allow for a little
-        * frame buffer.  Oh well...
-        * -----------------------------------------------------
-        * I hate queues in X.25 driver. May be it's efficient,
-        * but for me latency is more important. ;)
-        * So, no queues !
-        *        14 Oct 1994  Dmitry Gorodchanin.
-        */
-
-       err = lapb_data_request(dev, skb);
-       if (err != LAPB_OK) {
-               netdev_err(dev, "lapb_data_request error: %d\n", err);
-               kfree_skb(skb);
-               return NETDEV_TX_OK;
-       }
-       return NETDEV_TX_OK;
-}
-
-
-/*
- *     LAPB interface boilerplate
- */
-
-/*
- *     Called when I frame data arrive. We add a pseudo header for upper
- *     layers and pass it to upper layers.
- */
-
-static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb)
-{
-       if (skb_cow(skb, 1)) {
-               kfree_skb(skb);
-               return NET_RX_DROP;
-       }
-       skb_push(skb, 1);
-       skb->data[0] = X25_IFACE_DATA;
-
-       skb->protocol = x25_type_trans(skb, dev);
-
-       return netif_rx(skb);
-}
-
-/*
- *     Data has emerged from the LAPB protocol machine. We don't handle
- *     busy cases too well. Its tricky to see how to do this nicely -
- *     perhaps lapb should allow us to bounce this ?
- */
-
-static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff *skb)
-{
-       struct x25_asy *sl = netdev_priv(dev);
-
-       spin_lock(&sl->lock);
-       if (netif_queue_stopped(sl->dev) || sl->tty == NULL) {
-               spin_unlock(&sl->lock);
-               netdev_err(dev, "tbusy drop\n");
-               kfree_skb(skb);
-               return;
-       }
-       /* We were not busy, so we are now... :-) */
-       if (skb != NULL) {
-               x25_asy_lock(sl);
-               dev->stats.tx_bytes += skb->len;
-               x25_asy_encaps(sl, skb->data, skb->len);
-               dev_kfree_skb(skb);
-       }
-       spin_unlock(&sl->lock);
-}
-
-/*
- *     LAPB connection establish/down information.
- */
-
-static void x25_asy_connected(struct net_device *dev, int reason)
-{
-       struct x25_asy *sl = netdev_priv(dev);
-       struct sk_buff *skb;
-       unsigned char *ptr;
-
-       skb = dev_alloc_skb(1);
-       if (skb == NULL) {
-               netdev_err(dev, "out of memory\n");
-               return;
-       }
-
-       ptr  = skb_put(skb, 1);
-       *ptr = X25_IFACE_CONNECT;
-
-       skb->protocol = x25_type_trans(skb, sl->dev);
-       netif_rx(skb);
-}
-
-static void x25_asy_disconnected(struct net_device *dev, int reason)
-{
-       struct x25_asy *sl = netdev_priv(dev);
-       struct sk_buff *skb;
-       unsigned char *ptr;
-
-       skb = dev_alloc_skb(1);
-       if (skb == NULL) {
-               netdev_err(dev, "out of memory\n");
-               return;
-       }
-
-       ptr  = skb_put(skb, 1);
-       *ptr = X25_IFACE_DISCONNECT;
-
-       skb->protocol = x25_type_trans(skb, sl->dev);
-       netif_rx(skb);
-}
-
-static const struct lapb_register_struct x25_asy_callbacks = {
-       .connect_confirmation = x25_asy_connected,
-       .connect_indication = x25_asy_connected,
-       .disconnect_confirmation = x25_asy_disconnected,
-       .disconnect_indication = x25_asy_disconnected,
-       .data_indication = x25_asy_data_indication,
-       .data_transmit = x25_asy_data_transmit,
-};
-
-
-/* Open the low-level part of the X.25 channel. Easy! */
-static int x25_asy_open(struct net_device *dev)
-{
-       struct x25_asy *sl = netdev_priv(dev);
-       unsigned long len;
-
-       if (sl->tty == NULL)
-               return -ENODEV;
-
-       /*
-        * Allocate the X.25 frame buffers:
-        *
-        * rbuff        Receive buffer.
-        * xbuff        Transmit buffer.
-        */
-
-       len = dev->mtu * 2;
-
-       sl->rbuff = kmalloc(len + 4, GFP_KERNEL);
-       if (sl->rbuff == NULL)
-               goto norbuff;
-       sl->xbuff = kmalloc(len + 4, GFP_KERNEL);
-       if (sl->xbuff == NULL)
-               goto noxbuff;
-
-       sl->buffsize = len;
-       sl->rcount   = 0;
-       sl->xleft    = 0;
-       sl->flags   &= (1 << SLF_INUSE);      /* Clear ESCAPE & ERROR flags */
-
-       return 0;
-
-       /* Cleanup */
-       kfree(sl->xbuff);
-       sl->xbuff = NULL;
-noxbuff:
-       kfree(sl->rbuff);
-       sl->rbuff = NULL;
-norbuff:
-       return -ENOMEM;
-}
-
-
-/* Close the low-level part of the X.25 channel. Easy! */
-static int x25_asy_close(struct net_device *dev)
-{
-       struct x25_asy *sl = netdev_priv(dev);
-
-       spin_lock(&sl->lock);
-       if (sl->tty)
-               clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
-
-       sl->rcount = 0;
-       sl->xleft  = 0;
-       spin_unlock(&sl->lock);
-       return 0;
-}
-
-/*
- * Handle the 'receiver data ready' interrupt.
- * This function is called by the 'tty_io' module in the kernel when
- * a block of X.25 data has been received, which can now be decapsulated
- * and sent on to some IP layer for further processing.
- */
-
-static void x25_asy_receive_buf(struct tty_struct *tty,
-                               const unsigned char *cp, char *fp, int count)
-{
-       struct x25_asy *sl = tty->disc_data;
-
-       if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev))
-               return;
-
-
-       /* Read the characters out of the buffer */
-       while (count--) {
-               if (fp && *fp++) {
-                       if (!test_and_set_bit(SLF_ERROR, &sl->flags))
-                               sl->dev->stats.rx_errors++;
-                       cp++;
-                       continue;
-               }
-               x25_asy_unesc(sl, *cp++);
-       }
-}
-
-/*
- * Open the high-level part of the X.25 channel.
- * This function is called by the TTY module when the
- * X.25 line discipline is called for.  Because we are
- * sure the tty line exists, we only have to link it to
- * a free X.25 channel...
- */
-
-static int x25_asy_open_tty(struct tty_struct *tty)
-{
-       struct x25_asy *sl;
-       int err;
-
-       if (tty->ops->write == NULL)
-               return -EOPNOTSUPP;
-
-       /* OK.  Find a free X.25 channel to use. */
-       sl = x25_asy_alloc();
-       if (sl == NULL)
-               return -ENFILE;
-
-       sl->tty = tty;
-       tty->disc_data = sl;
-       tty->receive_room = 65536;
-       tty_driver_flush_buffer(tty);
-       tty_ldisc_flush(tty);
-
-       /* Restore default settings */
-       sl->dev->type = ARPHRD_X25;
-
-       /* Perform the low-level X.25 async init */
-       err = x25_asy_open(sl->dev);
-       if (err) {
-               x25_asy_free(sl);
-               return err;
-       }
-       /* Done.  We have linked the TTY line to a channel. */
-       return 0;
-}
-
-
-/*
- * Close down an X.25 channel.
- * This means flushing out any pending queues, and then restoring the
- * TTY line discipline to what it was before it got hooked to X.25
- * (which usually is TTY again).
- */
-static void x25_asy_close_tty(struct tty_struct *tty)
-{
-       struct x25_asy *sl = tty->disc_data;
-
-       /* First make sure we're connected. */
-       if (!sl || sl->magic != X25_ASY_MAGIC)
-               return;
-
-       rtnl_lock();
-       if (sl->dev->flags & IFF_UP)
-               dev_close(sl->dev);
-       rtnl_unlock();
-
-       tty->disc_data = NULL;
-       sl->tty = NULL;
-       x25_asy_free(sl);
-}
-
- /************************************************************************
-  *                    STANDARD X.25 ENCAPSULATION                      *
-  ************************************************************************/
-
-static int x25_asy_esc(unsigned char *s, unsigned char *d, int len)
-{
-       unsigned char *ptr = d;
-       unsigned char c;
-
-       /*
-        * Send an initial END character to flush out any
-        * data that may have accumulated in the receiver
-        * due to line noise.
-        */
-
-       *ptr++ = X25_END;       /* Send 10111110 bit seq */
-
-       /*
-        * For each byte in the packet, send the appropriate
-        * character sequence, according to the X.25 protocol.
-        */
-
-       while (len-- > 0) {
-               switch (c = *s++) {
-               case X25_END:
-                       *ptr++ = X25_ESC;
-                       *ptr++ = X25_ESCAPE(X25_END);
-                       break;
-               case X25_ESC:
-                       *ptr++ = X25_ESC;
-                       *ptr++ = X25_ESCAPE(X25_ESC);
-                       break;
-               default:
-                       *ptr++ = c;
-                       break;
-               }
-       }
-       *ptr++ = X25_END;
-       return ptr - d;
-}
-
-static void x25_asy_unesc(struct x25_asy *sl, unsigned char s)
-{
-
-       switch (s) {
-       case X25_END:
-               if (!test_and_clear_bit(SLF_ERROR, &sl->flags) &&
-                   sl->rcount >= 2)
-                       x25_asy_bump(sl);
-               clear_bit(SLF_ESCAPE, &sl->flags);
-               sl->rcount = 0;
-               return;
-       case X25_ESC:
-               set_bit(SLF_ESCAPE, &sl->flags);
-               return;
-       case X25_ESCAPE(X25_ESC):
-       case X25_ESCAPE(X25_END):
-               if (test_and_clear_bit(SLF_ESCAPE, &sl->flags))
-                       s = X25_UNESCAPE(s);
-               break;
-       }
-       if (!test_bit(SLF_ERROR, &sl->flags)) {
-               if (sl->rcount < sl->buffsize) {
-                       sl->rbuff[sl->rcount++] = s;
-                       return;
-               }
-               sl->dev->stats.rx_over_errors++;
-               set_bit(SLF_ERROR, &sl->flags);
-       }
-}
-
-
-/* Perform I/O control on an active X.25 channel. */
-static int x25_asy_ioctl(struct tty_struct *tty, struct file *file,
-                        unsigned int cmd,  unsigned long arg)
-{
-       struct x25_asy *sl = tty->disc_data;
-
-       /* First make sure we're connected. */
-       if (!sl || sl->magic != X25_ASY_MAGIC)
-               return -EINVAL;
-
-       switch (cmd) {
-       case SIOCGIFNAME:
-               if (copy_to_user((void __user *)arg, sl->dev->name,
-                                       strlen(sl->dev->name) + 1))
-                       return -EFAULT;
-               return 0;
-       case SIOCSIFHWADDR:
-               return -EINVAL;
-       default:
-               return tty_mode_ioctl(tty, file, cmd, arg);
-       }
-}
-
-static int x25_asy_open_dev(struct net_device *dev)
-{
-       int err;
-       struct x25_asy *sl = netdev_priv(dev);
-       if (sl->tty == NULL)
-               return -ENODEV;
-
-       err = lapb_register(dev, &x25_asy_callbacks);
-       if (err != LAPB_OK)
-               return -ENOMEM;
-
-       netif_start_queue(dev);
-
-       return 0;
-}
-
-static int x25_asy_close_dev(struct net_device *dev)
-{
-       int err;
-
-       netif_stop_queue(dev);
-
-       err = lapb_unregister(dev);
-       if (err != LAPB_OK)
-               pr_err("%s: lapb_unregister error: %d\n",
-                      __func__, err);
-
-       x25_asy_close(dev);
-
-       return 0;
-}
-
-static const struct net_device_ops x25_asy_netdev_ops = {
-       .ndo_open       = x25_asy_open_dev,
-       .ndo_stop       = x25_asy_close_dev,
-       .ndo_start_xmit = x25_asy_xmit,
-       .ndo_tx_timeout = x25_asy_timeout,
-       .ndo_change_mtu = x25_asy_change_mtu,
-};
-
-/* Initialise the X.25 driver.  Called by the device init code */
-static void x25_asy_setup(struct net_device *dev)
-{
-       struct x25_asy *sl = netdev_priv(dev);
-
-       sl->magic  = X25_ASY_MAGIC;
-       sl->dev    = dev;
-       spin_lock_init(&sl->lock);
-       set_bit(SLF_INUSE, &sl->flags);
-
-       /*
-        *      Finish setting up the DEVICE info.
-        */
-
-       dev->mtu                = SL_MTU;
-       dev->min_mtu            = 0;
-       dev->max_mtu            = 65534;
-       dev->netdev_ops         = &x25_asy_netdev_ops;
-       dev->watchdog_timeo     = HZ*20;
-       dev->hard_header_len    = 0;
-       dev->addr_len           = 0;
-       dev->type               = ARPHRD_X25;
-       dev->tx_queue_len       = 10;
-
-       /* When transmitting data:
-        * first this driver removes a pseudo header of 1 byte,
-        * then the lapb module prepends an LAPB header of at most 3 bytes.
-        */
-       dev->needed_headroom    = 3 - 1;
-
-       /* New-style flags. */
-       dev->flags              = IFF_NOARP;
-}
-
-static struct tty_ldisc_ops x25_ldisc = {
-       .owner          = THIS_MODULE,
-       .magic          = TTY_LDISC_MAGIC,
-       .name           = "X.25",
-       .open           = x25_asy_open_tty,
-       .close          = x25_asy_close_tty,
-       .ioctl          = x25_asy_ioctl,
-       .receive_buf    = x25_asy_receive_buf,
-       .write_wakeup   = x25_asy_write_wakeup,
-};
-
-static int __init init_x25_asy(void)
-{
-       if (x25_asy_maxdev < 4)
-               x25_asy_maxdev = 4; /* Sanity */
-
-       pr_info("X.25 async: version 0.00 ALPHA (dynamic channels, max=%d)\n",
-               x25_asy_maxdev);
-
-       x25_asy_devs = kcalloc(x25_asy_maxdev, sizeof(struct net_device *),
-                               GFP_KERNEL);
-       if (!x25_asy_devs)
-               return -ENOMEM;
-
-       return tty_register_ldisc(N_X25, &x25_ldisc);
-}
-
-
-static void __exit exit_x25_asy(void)
-{
-       struct net_device *dev;
-       int i;
-
-       for (i = 0; i < x25_asy_maxdev; i++) {
-               dev = x25_asy_devs[i];
-               if (dev) {
-                       struct x25_asy *sl = netdev_priv(dev);
-
-                       spin_lock_bh(&sl->lock);
-                       if (sl->tty)
-                               tty_hangup(sl->tty);
-
-                       spin_unlock_bh(&sl->lock);
-                       /*
-                        * VSV = if dev->start==0, then device
-                        * unregistered while close proc.
-                        */
-                       unregister_netdev(dev);
-                       free_netdev(dev);
-               }
-       }
-
-       kfree(x25_asy_devs);
-       tty_unregister_ldisc(N_X25);
-}
-
-module_init(init_x25_asy);
-module_exit(exit_x25_asy);
diff --git a/drivers/net/wan/x25_asy.h b/drivers/net/wan/x25_asy.h
deleted file mode 100644 (file)
index 8779828..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _LINUX_X25_ASY_H
-#define _LINUX_X25_ASY_H
-
-/* X.25 asy configuration. */
-#define SL_NRUNIT      256             /* MAX number of X.25 channels;
-                                          This can be overridden with
-                                          insmod -ox25_asy_maxdev=nnn  */
-#define SL_MTU         256     
-
-/* X25 async protocol characters. */
-#define X25_END         0x7E           /* indicates end of frame       */
-#define X25_ESC         0x7D           /* indicates byte stuffing      */
-#define X25_ESCAPE(x)  ((x)^0x20)
-#define X25_UNESCAPE(x)        ((x)^0x20)
-
-
-struct x25_asy {
-  int                  magic;
-
-  /* Various fields. */
-  spinlock_t           lock;
-  struct tty_struct    *tty;           /* ptr to TTY structure         */
-  struct net_device    *dev;           /* easy for intr handling       */
-
-  /* These are pointers to the malloc()ed frame buffers. */
-  unsigned char                *rbuff;         /* receiver buffer              */
-  int                   rcount;         /* received chars counter       */
-  unsigned char                *xbuff;         /* transmitter buffer           */
-  unsigned char         *xhead;         /* pointer to next byte to XMIT */
-  int                   xleft;          /* bytes left in XMIT queue     */
-  int                   buffsize;       /* Max buffers sizes            */
-
-  unsigned long                flags;          /* Flag values/ mode etc        */
-#define SLF_INUSE      0               /* Channel in use               */
-#define SLF_ESCAPE     1               /* ESC received                 */
-#define SLF_ERROR      2               /* Parity, etc. error           */
-};
-
-
-
-#define X25_ASY_MAGIC 0x5303
-
-int x25_asy_init(struct net_device *dev);
-
-#endif /* _LINUX_X25_ASY.H */
diff --git a/drivers/net/wimax/Kconfig b/drivers/net/wimax/Kconfig
deleted file mode 100644 (file)
index 2249e3d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# WiMAX LAN device drivers configuration
-#
-
-
-comment "Enable WiMAX (Networking options) to see the WiMAX drivers"
-       depends on WIMAX = n
-
-if WIMAX
-
-menu "WiMAX Wireless Broadband devices"
-
-source "drivers/net/wimax/i2400m/Kconfig"
-
-endmenu
-
-endif
diff --git a/drivers/net/wimax/Makefile b/drivers/net/wimax/Makefile
deleted file mode 100644 (file)
index b4575ba..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_WIMAX_I2400M)     += i2400m/
index c9f65e9..a3ed49c 100644 (file)
@@ -215,7 +215,7 @@ static const struct net_device_ops netdev_ops = {
        .ndo_open               = wg_open,
        .ndo_stop               = wg_stop,
        .ndo_start_xmit         = wg_xmit,
-       .ndo_get_stats64        = ip_tunnel_get_stats64
+       .ndo_get_stats64        = dev_get_tstats64
 };
 
 static void wg_destruct(struct net_device *dev)
index 170a64e..7add200 100644 (file)
@@ -18,19 +18,6 @@ menuconfig WLAN
 
 if WLAN
 
-config WIRELESS_WDS
-       bool "mac80211-based legacy WDS support" if EXPERT
-       help
-         This option enables the deprecated WDS support, the newer
-         mac80211-based 4-addr AP/client support supersedes it with
-         a much better feature set (HT, VHT, ...)
-
-         We plan to remove this option and code, so if you find
-         that you have to enable it, please let us know on the
-         linux-wireless@vger.kernel.org mailing list, so we can
-         help you migrate to 4-addr AP/client (or, if it's really
-         necessary, give up on our plan of removing it).
-
 source "drivers/net/wireless/admtek/Kconfig"
 source "drivers/net/wireless/ath/Kconfig"
 source "drivers/net/wireless/atmel/Kconfig"
index e06b74a..13b4f5f 100644 (file)
@@ -661,7 +661,6 @@ struct ath9k_vif_iter_data {
        int naps;      /* number of AP vifs */
        int nmeshes;   /* number of mesh vifs */
        int nstations; /* number of station vifs */
-       int nwds;      /* number of WDS vifs */
        int nadhocs;   /* number of adhoc vifs */
        int nocbs;     /* number of OCB vifs */
        int nbcnvifs;  /* number of beaconing vifs */
index 26ea51a..017a43b 100644 (file)
@@ -735,10 +735,10 @@ static int read_file_misc(struct seq_file *file, void *data)
                ath9k_calculate_iter_data(sc, ctx, &iter_data);
 
                seq_printf(file,
-                          "VIFS: CTX %i(%i) AP: %i STA: %i MESH: %i WDS: %i",
+                          "VIFS: CTX %i(%i) AP: %i STA: %i MESH: %i",
                           i++, (int)(ctx->assigned), iter_data.naps,
                           iter_data.nstations,
-                          iter_data.nmeshes, iter_data.nwds);
+                          iter_data.nmeshes);
                seq_printf(file, " ADHOC: %i OCB: %i TOTAL: %hi BEACON-VIF: %hi\n",
                           iter_data.nadhocs, iter_data.nocbs, sc->cur_chan->nvifs,
                           sc->nbcnvifs);
index 690fe3a..42a2087 100644 (file)
@@ -832,12 +832,6 @@ static const struct ieee80211_iface_limit if_limits[] = {
                                 BIT(NL80211_IFTYPE_P2P_GO) },
 };
 
-#ifdef CONFIG_WIRELESS_WDS
-static const struct ieee80211_iface_limit wds_limits[] = {
-       { .max = 2048,  .types = BIT(NL80211_IFTYPE_WDS) },
-};
-#endif
-
 #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
 
 static const struct ieee80211_iface_limit if_limits_multi[] = {
@@ -874,15 +868,6 @@ static const struct ieee80211_iface_combination if_comb[] = {
                                        BIT(NL80211_CHAN_WIDTH_40),
 #endif
        },
-#ifdef CONFIG_WIRELESS_WDS
-       {
-               .limits = wds_limits,
-               .n_limits = ARRAY_SIZE(wds_limits),
-               .max_interfaces = 2048,
-               .num_different_channels = 1,
-               .beacon_int_infra_match = true,
-       },
-#endif
 };
 
 #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
@@ -897,7 +882,6 @@ static void ath9k_set_mcc_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
        ieee80211_hw_set(hw, QUEUE_CONTROL);
        hw->queues = ATH9K_NUM_TX_QUEUES;
        hw->offchannel_tx_hw_queue = hw->queues - 1;
-       hw->wiphy->interface_modes &= ~ BIT(NL80211_IFTYPE_WDS);
        hw->wiphy->iface_combinations = if_comb_multi;
        hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_multi);
        hw->wiphy->max_scan_ssids = 255;
@@ -953,9 +937,6 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
                        BIT(NL80211_IFTYPE_STATION) |
                        BIT(NL80211_IFTYPE_ADHOC) |
                        BIT(NL80211_IFTYPE_MESH_POINT) |
-#ifdef CONFIG_WIRELESS_WDS
-                       BIT(NL80211_IFTYPE_WDS) |
-#endif
                        BIT(NL80211_IFTYPE_OCB);
 
                if (ath9k_is_chanctx_enabled())
index 8dbf68b..caebe3f 100644 (file)
@@ -973,9 +973,6 @@ static void ath9k_vif_iter(struct ath9k_vif_iter_data *iter_data,
                if (vif->bss_conf.enable_beacon)
                        ath9k_vif_iter_set_beacon(iter_data, vif);
                break;
-       case NL80211_IFTYPE_WDS:
-               iter_data->nwds++;
-               break;
        default:
                break;
        }
@@ -1136,8 +1133,6 @@ void ath9k_calculate_summary_state(struct ath_softc *sc,
                        ah->opmode = NL80211_IFTYPE_MESH_POINT;
                else if (iter_data.nocbs)
                        ah->opmode = NL80211_IFTYPE_OCB;
-               else if (iter_data.nwds)
-                       ah->opmode = NL80211_IFTYPE_AP;
                else if (iter_data.nadhocs)
                        ah->opmode = NL80211_IFTYPE_ADHOC;
                else
index b2eeb9f..6cdbee5 100644 (file)
@@ -329,10 +329,6 @@ int carl9170_set_operating_mode(struct ar9170 *ar)
                        /* iwlagn 802.11n STA Workaround */
                        rx_ctrl |= AR9170_MAC_RX_CTRL_PASS_TO_HOST;
                        break;
-               case NL80211_IFTYPE_WDS:
-                       cam_mode |= AR9170_MAC_CAM_AP_WDS;
-                       rx_ctrl |= AR9170_MAC_RX_CTRL_PASS_TO_HOST;
-                       break;
                case NL80211_IFTYPE_STATION:
                        cam_mode |= AR9170_MAC_CAM_STA;
                        rx_ctrl |= AR9170_MAC_RX_CTRL_PASS_TO_HOST;
index dbef9d8..cca3b08 100644 (file)
@@ -646,7 +646,6 @@ static int carl9170_op_add_interface(struct ieee80211_hw *hw,
                case NL80211_IFTYPE_MESH_POINT:
                case NL80211_IFTYPE_AP:
                        if ((vif->type == NL80211_IFTYPE_STATION) ||
-                           (vif->type == NL80211_IFTYPE_WDS) ||
                            (vif->type == NL80211_IFTYPE_AP) ||
                            (vif->type == NL80211_IFTYPE_MESH_POINT))
                                break;
index f175dba..150a366 100644 (file)
@@ -4961,12 +4961,11 @@ static int b43_op_add_interface(struct ieee80211_hw *hw,
        struct b43_wldev *dev;
        int err = -EOPNOTSUPP;
 
-       /* TODO: allow WDS/AP devices to coexist */
+       /* TODO: allow AP devices to coexist */
 
        if (vif->type != NL80211_IFTYPE_AP &&
            vif->type != NL80211_IFTYPE_MESH_POINT &&
            vif->type != NL80211_IFTYPE_STATION &&
-           vif->type != NL80211_IFTYPE_WDS &&
            vif->type != NL80211_IFTYPE_ADHOC)
                return -EOPNOTSUPP;
 
@@ -5576,9 +5575,6 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev)
                BIT(NL80211_IFTYPE_AP) |
                BIT(NL80211_IFTYPE_MESH_POINT) |
                BIT(NL80211_IFTYPE_STATION) |
-#ifdef CONFIG_WIRELESS_WDS
-               BIT(NL80211_IFTYPE_WDS) |
-#endif
                BIT(NL80211_IFTYPE_ADHOC);
 
        hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
index a27125b..7692a26 100644 (file)
@@ -3381,11 +3381,10 @@ static int b43legacy_op_add_interface(struct ieee80211_hw *hw,
        unsigned long flags;
        int err = -EOPNOTSUPP;
 
-       /* TODO: allow WDS/AP devices to coexist */
+       /* TODO: allow AP devices to coexist */
 
        if (vif->type != NL80211_IFTYPE_AP &&
            vif->type != NL80211_IFTYPE_STATION &&
-           vif->type != NL80211_IFTYPE_WDS &&
            vif->type != NL80211_IFTYPE_ADHOC)
                return -EOPNOTSUPP;
 
@@ -3805,9 +3804,6 @@ static int b43legacy_wireless_init(struct ssb_device *dev)
        hw->wiphy->interface_modes =
                BIT(NL80211_IFTYPE_AP) |
                BIT(NL80211_IFTYPE_STATION) |
-#ifdef CONFIG_WIRELESS_WDS
-               BIT(NL80211_IFTYPE_WDS) |
-#endif
                BIT(NL80211_IFTYPE_ADHOC);
        hw->queues = 1; /* FIXME: hardware has more queues */
        hw->max_rates = 2;
index bf6dbeb..ad726bd 100644 (file)
@@ -126,28 +126,13 @@ qtnf_netdev_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 
        if (unlikely(skb->protocol == htons(ETH_P_PAE))) {
                qtnf_packet_send_hi_pri(skb);
-               qtnf_update_tx_stats(ndev, skb);
+               dev_sw_netstats_tx_add(ndev, 1, skb->len);
                return NETDEV_TX_OK;
        }
 
        return qtnf_bus_data_tx(mac->bus, skb, mac->macid, vif->vifid);
 }
 
-/* Netdev handler for getting stats.
- */
-static void qtnf_netdev_get_stats64(struct net_device *ndev,
-                                   struct rtnl_link_stats64 *stats)
-{
-       struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev);
-
-       netdev_stats_to_stats64(stats, &ndev->stats);
-
-       if (!vif->stats64)
-               return;
-
-       dev_fetch_sw_netstats(stats, vif->stats64);
-}
-
 /* Netdev handler for transmission timeout.
  */
 static void qtnf_netdev_tx_timeout(struct net_device *ndev, unsigned int txqueue)
@@ -211,13 +196,27 @@ static int qtnf_netdev_port_parent_id(struct net_device *ndev,
        return 0;
 }
 
+static int qtnf_netdev_alloc_pcpu_stats(struct net_device *dev)
+{
+       dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
+
+       return dev->tstats ? 0 : -ENOMEM;
+}
+
+static void qtnf_netdev_free_pcpu_stats(struct net_device *dev)
+{
+       free_percpu(dev->tstats);
+}
+
 /* Network device ops handlers */
 const struct net_device_ops qtnf_netdev_ops = {
+       .ndo_init = qtnf_netdev_alloc_pcpu_stats,
+       .ndo_uninit = qtnf_netdev_free_pcpu_stats,
        .ndo_open = qtnf_netdev_open,
        .ndo_stop = qtnf_netdev_close,
        .ndo_start_xmit = qtnf_netdev_hard_start_xmit,
        .ndo_tx_timeout = qtnf_netdev_tx_timeout,
-       .ndo_get_stats64 = qtnf_netdev_get_stats64,
+       .ndo_get_stats64 = dev_get_tstats64,
        .ndo_set_mac_address = qtnf_netdev_set_mac_address,
        .ndo_get_port_parent_id = qtnf_netdev_port_parent_id,
 };
@@ -448,10 +447,6 @@ static struct qtnf_wmac *qtnf_core_mac_alloc(struct qtnf_bus *bus,
                qtnf_sta_list_init(&vif->sta_list);
                INIT_WORK(&vif->high_pri_tx_work, qtnf_vif_send_data_high_pri);
                skb_queue_head_init(&vif->high_pri_tx_queue);
-               vif->stats64 = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
-               if (!vif->stats64)
-                       pr_warn("VIF%u.%u: per cpu stats allocation failed\n",
-                               macid, i);
        }
 
        qtnf_mac_init_primary_intf(mac);
@@ -531,7 +526,6 @@ static void qtnf_core_mac_detach(struct qtnf_bus *bus, unsigned int macid)
                }
                rtnl_unlock();
                qtnf_sta_list_free(&vif->sta_list);
-               free_percpu(vif->stats64);
        }
 
        if (mac->wiphy_registered)
@@ -924,46 +918,6 @@ void qtnf_wake_all_queues(struct net_device *ndev)
 }
 EXPORT_SYMBOL_GPL(qtnf_wake_all_queues);
 
-void qtnf_update_rx_stats(struct net_device *ndev, const struct sk_buff *skb)
-{
-       struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev);
-       struct pcpu_sw_netstats *stats64;
-
-       if (unlikely(!vif || !vif->stats64)) {
-               ndev->stats.rx_packets++;
-               ndev->stats.rx_bytes += skb->len;
-               return;
-       }
-
-       stats64 = this_cpu_ptr(vif->stats64);
-
-       u64_stats_update_begin(&stats64->syncp);
-       stats64->rx_packets++;
-       stats64->rx_bytes += skb->len;
-       u64_stats_update_end(&stats64->syncp);
-}
-EXPORT_SYMBOL_GPL(qtnf_update_rx_stats);
-
-void qtnf_update_tx_stats(struct net_device *ndev, const struct sk_buff *skb)
-{
-       struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev);
-       struct pcpu_sw_netstats *stats64;
-
-       if (unlikely(!vif || !vif->stats64)) {
-               ndev->stats.tx_packets++;
-               ndev->stats.tx_bytes += skb->len;
-               return;
-       }
-
-       stats64 = this_cpu_ptr(vif->stats64);
-
-       u64_stats_update_begin(&stats64->syncp);
-       stats64->tx_packets++;
-       stats64->tx_bytes += skb->len;
-       u64_stats_update_end(&stats64->syncp);
-}
-EXPORT_SYMBOL_GPL(qtnf_update_tx_stats);
-
 struct dentry *qtnf_get_debugfs_dir(void)
 {
        return qtnf_debugfs_dir;
index 269ce12..b204a24 100644 (file)
@@ -70,8 +70,6 @@ struct qtnf_vif {
        struct qtnf_sta_list sta_list;
        unsigned long cons_tx_timeout_cnt;
        int generation;
-
-       struct pcpu_sw_netstats __percpu *stats64;
 };
 
 struct qtnf_mac_info {
@@ -139,8 +137,6 @@ int qtnf_cmd_send_update_phy_params(struct qtnf_wmac *mac, u32 changed);
 struct qtnf_wmac *qtnf_core_get_mac(const struct qtnf_bus *bus, u8 macid);
 struct net_device *qtnf_classify_skb(struct qtnf_bus *bus, struct sk_buff *skb);
 void qtnf_wake_all_queues(struct net_device *ndev);
-void qtnf_update_rx_stats(struct net_device *ndev, const struct sk_buff *skb);
-void qtnf_update_tx_stats(struct net_device *ndev, const struct sk_buff *skb);
 
 void qtnf_virtual_intf_cleanup(struct net_device *ndev);
 
index 9a20c0f..0003df5 100644 (file)
@@ -489,7 +489,7 @@ static void qtnf_pearl_data_tx_reclaim(struct qtnf_pcie_pearl_state *ps)
                                         PCI_DMA_TODEVICE);
 
                        if (skb->dev) {
-                               qtnf_update_tx_stats(skb->dev, skb);
+                               dev_sw_netstats_tx_add(skb->dev, 1, skb->len);
                                if (unlikely(priv->tx_stopped)) {
                                        qtnf_wake_all_queues(skb->dev);
                                        priv->tx_stopped = 0;
@@ -756,7 +756,7 @@ static int qtnf_pcie_pearl_rx_poll(struct napi_struct *napi, int budget)
                        skb_put(skb, psize);
                        ndev = qtnf_classify_skb(bus, skb);
                        if (likely(ndev)) {
-                               qtnf_update_rx_stats(ndev, skb);
+                               dev_sw_netstats_rx_add(ndev, skb->len);
                                skb->protocol = eth_type_trans(skb, ndev);
                                napi_gro_receive(napi, skb);
                        } else {
index 4b87d31..24f1be8 100644 (file)
@@ -418,7 +418,7 @@ static void qtnf_topaz_data_tx_reclaim(struct qtnf_pcie_topaz_state *ts)
                                         PCI_DMA_TODEVICE);
 
                        if (skb->dev) {
-                               qtnf_update_tx_stats(skb->dev, skb);
+                               dev_sw_netstats_tx_add(skb->dev, 1, skb->len);
                                if (unlikely(priv->tx_stopped)) {
                                        qtnf_wake_all_queues(skb->dev);
                                        priv->tx_stopped = 0;
@@ -662,7 +662,7 @@ static int qtnf_topaz_rx_poll(struct napi_struct *napi, int budget)
                        skb_put(skb, psize);
                        ndev = qtnf_classify_skb(bus, skb);
                        if (likely(ndev)) {
-                               qtnf_update_rx_stats(ndev, skb);
+                               dev_sw_netstats_rx_add(ndev, skb->len);
                                skb->protocol = eth_type_trans(skb, ndev);
                                netif_receive_skb(skb);
                        } else {
index 0ee1813..6bafdd9 100644 (file)
@@ -32,7 +32,6 @@ void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev,
                break;
        case NL80211_IFTYPE_AP:
        case NL80211_IFTYPE_MESH_POINT:
-       case NL80211_IFTYPE_WDS:
                conf.sync = TSF_SYNC_AP_NONE;
                break;
        case NL80211_IFTYPE_STATION:
index b04f765..61a4f1a 100644 (file)
@@ -194,8 +194,7 @@ static void rt2x00lib_beaconupdate_iter(void *data, u8 *mac,
 
        if (vif->type != NL80211_IFTYPE_AP &&
            vif->type != NL80211_IFTYPE_ADHOC &&
-           vif->type != NL80211_IFTYPE_MESH_POINT &&
-           vif->type != NL80211_IFTYPE_WDS)
+           vif->type != NL80211_IFTYPE_MESH_POINT)
                return;
 
        /*
@@ -1437,9 +1436,6 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
 #ifdef CONFIG_MAC80211_MESH
                    BIT(NL80211_IFTYPE_MESH_POINT) |
 #endif
-#ifdef CONFIG_WIRELESS_WDS
-                   BIT(NL80211_IFTYPE_WDS) |
-#endif
                    BIT(NL80211_IFTYPE_AP);
 
        rt2x00dev->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
index 2f68a31..dea5bab 100644 (file)
@@ -408,8 +408,7 @@ static void rt2x00mac_set_tim_iter(void *data, u8 *mac,
 
        if (vif->type != NL80211_IFTYPE_AP &&
            vif->type != NL80211_IFTYPE_ADHOC &&
-           vif->type != NL80211_IFTYPE_MESH_POINT &&
-           vif->type != NL80211_IFTYPE_WDS)
+           vif->type != NL80211_IFTYPE_MESH_POINT)
                return;
 
        set_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags);
index 75b5d54..9fe7755 100644 (file)
@@ -3379,7 +3379,7 @@ static const struct net_device_ops rndis_wlan_netdev_ops = {
        .ndo_stop               = usbnet_stop,
        .ndo_start_xmit         = usbnet_start_xmit,
        .ndo_tx_timeout         = usbnet_tx_timeout,
-       .ndo_get_stats64        = usbnet_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_rx_mode        = rndis_wlan_set_multicast_list,
index 3e9895b..920cac4 100644 (file)
@@ -2413,12 +2413,11 @@ static ssize_t store_rxbuf(struct device *dev,
                           const char *buf, size_t len)
 {
        char *endp;
-       unsigned long target;
 
        if (!capable(CAP_NET_ADMIN))
                return -EPERM;
 
-       target = simple_strtoul(buf, &endp, 0);
+       simple_strtoul(buf, &endp, 0);
        if (endp == buf)
                return -EBADMSG;
 
index 88e1db6..71428d8 100644 (file)
@@ -1203,6 +1203,7 @@ static int amd_ntb_init_pci(struct amd_ntb_dev *ndev,
 
 err_dma_mask:
        pci_clear_master(pdev);
+       pci_release_regions(pdev);
 err_pci_regions:
        pci_disable_device(pdev);
 err_pci_enable:
index 3185efe..093dd20 100644 (file)
@@ -1893,7 +1893,7 @@ static int intel_ntb_pci_probe(struct pci_dev *pdev,
                        goto err_init_dev;
        } else {
                rc = -EINVAL;
-               goto err_ndev;
+               goto err_init_pci;
        }
 
        ndev_reset_unsafe_flags(ndev);
index 99d826e..7095ecd 100644 (file)
@@ -319,7 +319,6 @@ static void ntb_msit_remove_dbgfs(struct ntb_msit_ctx *nm)
 static int ntb_msit_probe(struct ntb_client *client, struct ntb_dev *ntb)
 {
        struct ntb_msit_ctx *nm;
-       size_t struct_size;
        int peers;
        int ret;
 
@@ -352,9 +351,7 @@ static int ntb_msit_probe(struct ntb_client *client, struct ntb_dev *ntb)
                return ret;
        }
 
-       struct_size = sizeof(*nm) + sizeof(*nm->peers) * peers;
-
-       nm = devm_kzalloc(&ntb->dev, struct_size, GFP_KERNEL);
+       nm = devm_kzalloc(&ntb->dev, struct_size(nm, peers, peers), GFP_KERNEL);
        if (!nm)
                return -ENOMEM;
 
index 56e2a22..40ca71b 100644 (file)
@@ -248,6 +248,10 @@ static blk_status_t nvme_error_status(u16 status)
                return BLK_STS_NEXUS;
        case NVME_SC_HOST_PATH_ERROR:
                return BLK_STS_TRANSPORT;
+       case NVME_SC_ZONE_TOO_MANY_ACTIVE:
+               return BLK_STS_ZONE_ACTIVE_RESOURCE;
+       case NVME_SC_ZONE_TOO_MANY_OPEN:
+               return BLK_STS_ZONE_OPEN_RESOURCE;
        default:
                return BLK_STS_IOERR;
        }
@@ -2121,7 +2125,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
 
        if (blk_queue_is_zoned(ns->queue)) {
                ret = nvme_revalidate_zones(ns);
-               if (ret)
+               if (ret && !nvme_first_scan(ns->disk))
                        return ret;
        }
 
@@ -4578,8 +4582,7 @@ void nvme_start_queues(struct nvme_ctrl *ctrl)
 }
 EXPORT_SYMBOL_GPL(nvme_start_queues);
 
-
-void nvme_sync_queues(struct nvme_ctrl *ctrl)
+void nvme_sync_io_queues(struct nvme_ctrl *ctrl)
 {
        struct nvme_ns *ns;
 
@@ -4587,7 +4590,12 @@ void nvme_sync_queues(struct nvme_ctrl *ctrl)
        list_for_each_entry(ns, &ctrl->namespaces, list)
                blk_sync_queue(ns->queue);
        up_read(&ctrl->namespaces_rwsem);
+}
+EXPORT_SYMBOL_GPL(nvme_sync_io_queues);
 
+void nvme_sync_queues(struct nvme_ctrl *ctrl)
+{
+       nvme_sync_io_queues(ctrl);
        if (ctrl->admin_q)
                blk_sync_queue(ctrl->admin_q);
 }
index e2e09e2..f4c2464 100644 (file)
@@ -26,6 +26,10 @@ enum nvme_fc_queue_flags {
 };
 
 #define NVME_FC_DEFAULT_DEV_LOSS_TMO   60      /* seconds */
+#define NVME_FC_DEFAULT_RECONNECT_TMO  2       /* delay between reconnects
+                                                * when connected and a
+                                                * connection failure.
+                                                */
 
 struct nvme_fc_queue {
        struct nvme_fc_ctrl     *ctrl;
@@ -142,7 +146,8 @@ struct nvme_fc_rport {
 
 /* fc_ctrl flags values - specified as bit positions */
 #define ASSOC_ACTIVE           0
-#define FCCTRL_TERMIO          1
+#define ASSOC_FAILED           1
+#define FCCTRL_TERMIO          2
 
 struct nvme_fc_ctrl {
        spinlock_t              lock;
@@ -153,7 +158,6 @@ struct nvme_fc_ctrl {
        u32                     cnum;
 
        bool                    ioq_live;
-       atomic_t                err_work_active;
        u64                     association_id;
        struct nvmefc_ls_rcv_op *rcv_disconn;
 
@@ -163,7 +167,6 @@ struct nvme_fc_ctrl {
        struct blk_mq_tag_set   tag_set;
 
        struct delayed_work     connect_work;
-       struct work_struct      err_work;
 
        struct kref             ref;
        unsigned long           flags;
@@ -1837,8 +1840,10 @@ __nvme_fc_abort_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_fcp_op *op)
        opstate = atomic_xchg(&op->state, FCPOP_STATE_ABORTED);
        if (opstate != FCPOP_STATE_ACTIVE)
                atomic_set(&op->state, opstate);
-       else if (test_bit(FCCTRL_TERMIO, &ctrl->flags))
+       else if (test_bit(FCCTRL_TERMIO, &ctrl->flags)) {
+               op->flags |= FCOP_FLAGS_TERMIO;
                ctrl->iocnt++;
+       }
        spin_unlock_irqrestore(&ctrl->lock, flags);
 
        if (opstate != FCPOP_STATE_ACTIVE)
@@ -1874,7 +1879,8 @@ __nvme_fc_fcpop_chk_teardowns(struct nvme_fc_ctrl *ctrl,
 
        if (opstate == FCPOP_STATE_ABORTED) {
                spin_lock_irqsave(&ctrl->lock, flags);
-               if (test_bit(FCCTRL_TERMIO, &ctrl->flags)) {
+               if (test_bit(FCCTRL_TERMIO, &ctrl->flags) &&
+                   op->flags & FCOP_FLAGS_TERMIO) {
                        if (!--ctrl->iocnt)
                                wake_up(&ctrl->ioabort_wait);
                }
@@ -2314,7 +2320,7 @@ nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize)
        return 0;
 
 delete_queues:
-       for (; i >= 0; i--)
+       for (; i > 0; i--)
                __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[i], i);
        return ret;
 }
@@ -2407,24 +2413,97 @@ nvme_fc_nvme_ctrl_freed(struct nvme_ctrl *nctrl)
        nvme_fc_ctrl_put(ctrl);
 }
 
+/*
+ * This routine is used by the transport when it needs to find active
+ * io on a queue that is to be terminated. The transport uses
+ * blk_mq_tagset_busy_itr() to find the busy requests, which then invoke
+ * this routine to kill them on a 1 by 1 basis.
+ *
+ * As FC allocates FC exchange for each io, the transport must contact
+ * the LLDD to terminate the exchange, thus releasing the FC exchange.
+ * After terminating the exchange the LLDD will call the transport's
+ * normal io done path for the request, but it will have an aborted
+ * status. The done path will return the io request back to the block
+ * layer with an error status.
+ */
+static bool
+nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved)
+{
+       struct nvme_ctrl *nctrl = data;
+       struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl);
+       struct nvme_fc_fcp_op *op = blk_mq_rq_to_pdu(req);
+
+       __nvme_fc_abort_op(ctrl, op);
+       return true;
+}
+
+/*
+ * This routine runs through all outstanding commands on the association
+ * and aborts them.  This routine is typically be called by the
+ * delete_association routine. It is also called due to an error during
+ * reconnect. In that scenario, it is most likely a command that initializes
+ * the controller, including fabric Connect commands on io queues, that
+ * may have timed out or failed thus the io must be killed for the connect
+ * thread to see the error.
+ */
 static void
-nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
+__nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)
 {
-       int active;
+       /*
+        * If io queues are present, stop them and terminate all outstanding
+        * ios on them. As FC allocates FC exchange for each io, the
+        * transport must contact the LLDD to terminate the exchange,
+        * thus releasing the FC exchange. We use blk_mq_tagset_busy_itr()
+        * to tell us what io's are busy and invoke a transport routine
+        * to kill them with the LLDD.  After terminating the exchange
+        * the LLDD will call the transport's normal io done path, but it
+        * will have an aborted status. The done path will return the
+        * io requests back to the block layer as part of normal completions
+        * (but with error status).
+        */
+       if (ctrl->ctrl.queue_count > 1) {
+               nvme_stop_queues(&ctrl->ctrl);
+               blk_mq_tagset_busy_iter(&ctrl->tag_set,
+                               nvme_fc_terminate_exchange, &ctrl->ctrl);
+               blk_mq_tagset_wait_completed_request(&ctrl->tag_set);
+               if (start_queues)
+                       nvme_start_queues(&ctrl->ctrl);
+       }
 
        /*
-        * if an error (io timeout, etc) while (re)connecting,
-        * it's an error on creating the new association.
-        * Start the error recovery thread if it hasn't already
-        * been started. It is expected there could be multiple
-        * ios hitting this path before things are cleaned up.
+        * Other transports, which don't have link-level contexts bound
+        * to sqe's, would try to gracefully shutdown the controller by
+        * writing the registers for shutdown and polling (call
+        * nvme_shutdown_ctrl()). Given a bunch of i/o was potentially
+        * just aborted and we will wait on those contexts, and given
+        * there was no indication of how live the controlelr is on the
+        * link, don't send more io to create more contexts for the
+        * shutdown. Let the controller fail via keepalive failure if
+        * its still present.
+        */
+
+       /*
+        * clean up the admin queue. Same thing as above.
+        */
+       blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
+       blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
+                               nvme_fc_terminate_exchange, &ctrl->ctrl);
+       blk_mq_tagset_wait_completed_request(&ctrl->admin_tag_set);
+}
+
+static void
+nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
+{
+       /*
+        * if an error (io timeout, etc) while (re)connecting, the remote
+        * port requested terminating of the association (disconnect_ls)
+        * or an error (timeout or abort) occurred on an io while creating
+        * the controller.  Abort any ios on the association and let the
+        * create_association error path resolve things.
         */
        if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) {
-               active = atomic_xchg(&ctrl->err_work_active, 1);
-               if (!active && !queue_work(nvme_fc_wq, &ctrl->err_work)) {
-                       atomic_set(&ctrl->err_work_active, 0);
-                       WARN_ON(1);
-               }
+               __nvme_fc_abort_outstanding_ios(ctrl, true);
+               set_bit(ASSOC_FAILED, &ctrl->flags);
                return;
        }
 
@@ -2433,7 +2512,7 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
                return;
 
        dev_warn(ctrl->ctrl.device,
-               "NVME-FC{%d}: transport association error detected: %s\n",
+               "NVME-FC{%d}: transport association event: %s\n",
                ctrl->cnum, errmsg);
        dev_warn(ctrl->ctrl.device,
                "NVME-FC{%d}: resetting controller\n", ctrl->cnum);
@@ -2446,15 +2525,20 @@ nvme_fc_timeout(struct request *rq, bool reserved)
 {
        struct nvme_fc_fcp_op *op = blk_mq_rq_to_pdu(rq);
        struct nvme_fc_ctrl *ctrl = op->ctrl;
+       struct nvme_fc_cmd_iu *cmdiu = &op->cmd_iu;
+       struct nvme_command *sqe = &cmdiu->sqe;
 
        /*
-        * we can't individually ABTS an io without affecting the queue,
-        * thus killing the queue, and thus the association.
-        * So resolve by performing a controller reset, which will stop
-        * the host/io stack, terminate the association on the link,
-        * and recreate an association on the link.
+        * Attempt to abort the offending command. Command completion
+        * will detect the aborted io and will fail the connection.
         */
-       nvme_fc_error_recovery(ctrl, "io timeout error");
+       dev_info(ctrl->ctrl.device,
+               "NVME-FC{%d.%d}: io timeout: opcode %d fctype %d w10/11: "
+               "x%08x/x%08x\n",
+               ctrl->cnum, op->queue->qnum, sqe->common.opcode,
+               sqe->connect.fctype, sqe->common.cdw10, sqe->common.cdw11);
+       if (__nvme_fc_abort_op(ctrl, op))
+               nvme_fc_error_recovery(ctrl, "io timeout abort failed");
 
        /*
         * the io abort has been initiated. Have the reset timer
@@ -2726,36 +2810,13 @@ nvme_fc_complete_rq(struct request *rq)
        struct nvme_fc_ctrl *ctrl = op->ctrl;
 
        atomic_set(&op->state, FCPOP_STATE_IDLE);
+       op->flags &= ~FCOP_FLAGS_TERMIO;
 
        nvme_fc_unmap_data(ctrl, rq, op);
        nvme_complete_rq(rq);
        nvme_fc_ctrl_put(ctrl);
 }
 
-/*
- * This routine is used by the transport when it needs to find active
- * io on a queue that is to be terminated. The transport uses
- * blk_mq_tagset_busy_itr() to find the busy requests, which then invoke
- * this routine to kill them on a 1 by 1 basis.
- *
- * As FC allocates FC exchange for each io, the transport must contact
- * the LLDD to terminate the exchange, thus releasing the FC exchange.
- * After terminating the exchange the LLDD will call the transport's
- * normal io done path for the request, but it will have an aborted
- * status. The done path will return the io request back to the block
- * layer with an error status.
- */
-static bool
-nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved)
-{
-       struct nvme_ctrl *nctrl = data;
-       struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl);
-       struct nvme_fc_fcp_op *op = blk_mq_rq_to_pdu(req);
-
-       __nvme_fc_abort_op(ctrl, op);
-       return true;
-}
-
 
 static const struct blk_mq_ops nvme_fc_mq_ops = {
        .queue_rq       = nvme_fc_queue_rq,
@@ -2876,11 +2937,14 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl)
        if (ret)
                goto out_delete_hw_queues;
 
-       if (prior_ioq_cnt != nr_io_queues)
+       if (prior_ioq_cnt != nr_io_queues) {
                dev_info(ctrl->ctrl.device,
                        "reconnect: revising io queue count from %d to %d\n",
                        prior_ioq_cnt, nr_io_queues);
-       blk_mq_update_nr_hw_queues(&ctrl->tag_set, nr_io_queues);
+               nvme_wait_freeze(&ctrl->ctrl);
+               blk_mq_update_nr_hw_queues(&ctrl->tag_set, nr_io_queues);
+               nvme_unfreeze(&ctrl->ctrl);
+       }
 
        return 0;
 
@@ -2972,6 +3036,8 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
                ctrl->cnum, ctrl->lport->localport.port_name,
                ctrl->rport->remoteport.port_name, ctrl->ctrl.opts->subsysnqn);
 
+       clear_bit(ASSOC_FAILED, &ctrl->flags);
+
        /*
         * Create the admin queue
         */
@@ -3000,7 +3066,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
         */
 
        ret = nvme_enable_ctrl(&ctrl->ctrl);
-       if (ret)
+       if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
                goto out_disconnect_admin_queue;
 
        ctrl->ctrl.max_segments = ctrl->lport->ops->max_sgl_segments;
@@ -3010,7 +3076,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
        blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
 
        ret = nvme_init_identify(&ctrl->ctrl);
-       if (ret)
+       if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
                goto out_disconnect_admin_queue;
 
        /* sanity checks */
@@ -3055,9 +3121,9 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
                        ret = nvme_fc_create_io_queues(ctrl);
                else
                        ret = nvme_fc_recreate_io_queues(ctrl);
-               if (ret)
-                       goto out_term_aen_ops;
        }
+       if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
+               goto out_term_aen_ops;
 
        changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
 
@@ -3090,6 +3156,7 @@ out_free_queue:
        return ret;
 }
 
+
 /*
  * This routine stops operation of the controller on the host side.
  * On the host os stack side: Admin and IO queues are stopped,
@@ -3110,46 +3177,7 @@ nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl)
        ctrl->iocnt = 0;
        spin_unlock_irqrestore(&ctrl->lock, flags);
 
-       /*
-        * If io queues are present, stop them and terminate all outstanding
-        * ios on them. As FC allocates FC exchange for each io, the
-        * transport must contact the LLDD to terminate the exchange,
-        * thus releasing the FC exchange. We use blk_mq_tagset_busy_itr()
-        * to tell us what io's are busy and invoke a transport routine
-        * to kill them with the LLDD.  After terminating the exchange
-        * the LLDD will call the transport's normal io done path, but it
-        * will have an aborted status. The done path will return the
-        * io requests back to the block layer as part of normal completions
-        * (but with error status).
-        */
-       if (ctrl->ctrl.queue_count > 1) {
-               nvme_stop_queues(&ctrl->ctrl);
-               blk_mq_tagset_busy_iter(&ctrl->tag_set,
-                               nvme_fc_terminate_exchange, &ctrl->ctrl);
-               blk_mq_tagset_wait_completed_request(&ctrl->tag_set);
-       }
-
-       /*
-        * Other transports, which don't have link-level contexts bound
-        * to sqe's, would try to gracefully shutdown the controller by
-        * writing the registers for shutdown and polling (call
-        * nvme_shutdown_ctrl()). Given a bunch of i/o was potentially
-        * just aborted and we will wait on those contexts, and given
-        * there was no indication of how live the controlelr is on the
-        * link, don't send more io to create more contexts for the
-        * shutdown. Let the controller fail via keepalive failure if
-        * its still present.
-        */
-
-       /*
-        * clean up the admin queue. Same thing as above.
-        * use blk_mq_tagset_busy_itr() and the transport routine to
-        * terminate the exchanges.
-        */
-       blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
-       blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
-                               nvme_fc_terminate_exchange, &ctrl->ctrl);
-       blk_mq_tagset_wait_completed_request(&ctrl->admin_tag_set);
+       __nvme_fc_abort_outstanding_ios(ctrl, false);
 
        /* kill the aens as they are a separate path */
        nvme_fc_abort_aen_ops(ctrl);
@@ -3205,7 +3233,6 @@ nvme_fc_delete_ctrl(struct nvme_ctrl *nctrl)
 {
        struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl);
 
-       cancel_work_sync(&ctrl->err_work);
        cancel_delayed_work_sync(&ctrl->connect_work);
        /*
         * kill the association on the link side.  this will block
@@ -3260,74 +3287,35 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status)
 }
 
 static void
-__nvme_fc_terminate_io(struct nvme_fc_ctrl *ctrl)
-{
-       /*
-        * if state is connecting - the error occurred as part of a
-        * reconnect attempt. The create_association error paths will
-        * clean up any outstanding io.
-        *
-        * if it's a different state - ensure all pending io is
-        * terminated. Given this can delay while waiting for the
-        * aborted io to return, we recheck adapter state below
-        * before changing state.
-        */
-       if (ctrl->ctrl.state != NVME_CTRL_CONNECTING) {
-               nvme_stop_keep_alive(&ctrl->ctrl);
-
-               /* will block will waiting for io to terminate */
-               nvme_fc_delete_association(ctrl);
-       }
-
-       if (ctrl->ctrl.state != NVME_CTRL_CONNECTING &&
-           !nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING))
-               dev_err(ctrl->ctrl.device,
-                       "NVME-FC{%d}: error_recovery: Couldn't change state "
-                       "to CONNECTING\n", ctrl->cnum);
-}
-
-static void
 nvme_fc_reset_ctrl_work(struct work_struct *work)
 {
        struct nvme_fc_ctrl *ctrl =
                container_of(work, struct nvme_fc_ctrl, ctrl.reset_work);
-       int ret;
-
-       __nvme_fc_terminate_io(ctrl);
 
        nvme_stop_ctrl(&ctrl->ctrl);
 
-       if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE)
-               ret = nvme_fc_create_association(ctrl);
-       else
-               ret = -ENOTCONN;
-
-       if (ret)
-               nvme_fc_reconnect_or_delete(ctrl, ret);
-       else
-               dev_info(ctrl->ctrl.device,
-                       "NVME-FC{%d}: controller reset complete\n",
-                       ctrl->cnum);
-}
-
-static void
-nvme_fc_connect_err_work(struct work_struct *work)
-{
-       struct nvme_fc_ctrl *ctrl =
-                       container_of(work, struct nvme_fc_ctrl, err_work);
-
-       __nvme_fc_terminate_io(ctrl);
+       /* will block will waiting for io to terminate */
+       nvme_fc_delete_association(ctrl);
 
-       atomic_set(&ctrl->err_work_active, 0);
+       if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING))
+               dev_err(ctrl->ctrl.device,
+                       "NVME-FC{%d}: error_recovery: Couldn't change state "
+                       "to CONNECTING\n", ctrl->cnum);
 
-       /*
-        * Rescheduling the connection after recovering
-        * from the io error is left to the reconnect work
-        * item, which is what should have stalled waiting on
-        * the io that had the error that scheduled this work.
-        */
+       if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE) {
+               if (!queue_delayed_work(nvme_wq, &ctrl->connect_work, 0)) {
+                       dev_err(ctrl->ctrl.device,
+                               "NVME-FC{%d}: failed to schedule connect "
+                               "after reset\n", ctrl->cnum);
+               } else {
+                       flush_delayed_work(&ctrl->connect_work);
+               }
+       } else {
+               nvme_fc_reconnect_or_delete(ctrl, -ENOTCONN);
+       }
 }
 
+
 static const struct nvme_ctrl_ops nvme_fc_ctrl_ops = {
        .name                   = "fc",
        .module                 = THIS_MODULE,
@@ -3403,7 +3391,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 {
        struct nvme_fc_ctrl *ctrl;
        unsigned long flags;
-       int ret, idx;
+       int ret, idx, ctrl_loss_tmo;
 
        if (!(rport->remoteport.port_role &
            (FC_PORT_ROLE_NVME_DISCOVERY | FC_PORT_ROLE_NVME_TARGET))) {
@@ -3429,6 +3417,19 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
                goto out_free_ctrl;
        }
 
+       /*
+        * if ctrl_loss_tmo is being enforced and the default reconnect delay
+        * is being used, change to a shorter reconnect delay for FC.
+        */
+       if (opts->max_reconnects != -1 &&
+           opts->reconnect_delay == NVMF_DEF_RECONNECT_DELAY &&
+           opts->reconnect_delay > NVME_FC_DEFAULT_RECONNECT_TMO) {
+               ctrl_loss_tmo = opts->max_reconnects * opts->reconnect_delay;
+               opts->reconnect_delay = NVME_FC_DEFAULT_RECONNECT_TMO;
+               opts->max_reconnects = DIV_ROUND_UP(ctrl_loss_tmo,
+                                               opts->reconnect_delay);
+       }
+
        ctrl->ctrl.opts = opts;
        ctrl->ctrl.nr_reconnects = 0;
        if (lport->dev)
@@ -3441,7 +3442,6 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
        ctrl->dev = lport->dev;
        ctrl->cnum = idx;
        ctrl->ioq_live = false;
-       atomic_set(&ctrl->err_work_active, 0);
        init_waitqueue_head(&ctrl->ioabort_wait);
 
        get_device(ctrl->dev);
@@ -3449,7 +3449,6 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 
        INIT_WORK(&ctrl->ctrl.reset_work, nvme_fc_reset_ctrl_work);
        INIT_DELAYED_WORK(&ctrl->connect_work, nvme_fc_connect_ctrl_work);
-       INIT_WORK(&ctrl->err_work, nvme_fc_connect_err_work);
        spin_lock_init(&ctrl->lock);
 
        /* io queue count */
@@ -3542,7 +3541,6 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 fail_ctrl:
        nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING);
        cancel_work_sync(&ctrl->ctrl.reset_work);
-       cancel_work_sync(&ctrl->err_work);
        cancel_delayed_work_sync(&ctrl->connect_work);
 
        ctrl->ctrl.opts = NULL;
index e7c88b4..bc330bf 100644 (file)
@@ -176,7 +176,7 @@ static inline struct nvme_request *nvme_req(struct request *req)
 
 static inline u16 nvme_req_qid(struct request *req)
 {
-       if (!req->rq_disk)
+       if (!req->q->queuedata)
                return 0;
        return blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(req)) + 1;
 }
@@ -602,6 +602,7 @@ void nvme_stop_queues(struct nvme_ctrl *ctrl);
 void nvme_start_queues(struct nvme_ctrl *ctrl);
 void nvme_kill_queues(struct nvme_ctrl *ctrl);
 void nvme_sync_queues(struct nvme_ctrl *ctrl);
+void nvme_sync_io_queues(struct nvme_ctrl *ctrl);
 void nvme_unfreeze(struct nvme_ctrl *ctrl);
 void nvme_wait_freeze(struct nvme_ctrl *ctrl);
 int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout);
index e5b0224..0578ff2 100644 (file)
@@ -198,6 +198,7 @@ struct nvme_queue {
        u32 q_depth;
        u16 cq_vector;
        u16 sq_tail;
+       u16 last_sq_tail;
        u16 cq_head;
        u16 qid;
        u8 cq_phase;
@@ -455,11 +456,24 @@ static int nvme_pci_map_queues(struct blk_mq_tag_set *set)
        return 0;
 }
 
-static inline void nvme_write_sq_db(struct nvme_queue *nvmeq)
+/*
+ * Write sq tail if we are asked to, or if the next command would wrap.
+ */
+static inline void nvme_write_sq_db(struct nvme_queue *nvmeq, bool write_sq)
 {
+       if (!write_sq) {
+               u16 next_tail = nvmeq->sq_tail + 1;
+
+               if (next_tail == nvmeq->q_depth)
+                       next_tail = 0;
+               if (next_tail != nvmeq->last_sq_tail)
+                       return;
+       }
+
        if (nvme_dbbuf_update_and_check_event(nvmeq->sq_tail,
                        nvmeq->dbbuf_sq_db, nvmeq->dbbuf_sq_ei))
                writel(nvmeq->sq_tail, nvmeq->q_db);
+       nvmeq->last_sq_tail = nvmeq->sq_tail;
 }
 
 /**
@@ -476,8 +490,7 @@ static void nvme_submit_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd,
               cmd, sizeof(*cmd));
        if (++nvmeq->sq_tail == nvmeq->q_depth)
                nvmeq->sq_tail = 0;
-       if (write_sq)
-               nvme_write_sq_db(nvmeq);
+       nvme_write_sq_db(nvmeq, write_sq);
        spin_unlock(&nvmeq->sq_lock);
 }
 
@@ -486,7 +499,8 @@ static void nvme_commit_rqs(struct blk_mq_hw_ctx *hctx)
        struct nvme_queue *nvmeq = hctx->driver_data;
 
        spin_lock(&nvmeq->sq_lock);
-       nvme_write_sq_db(nvmeq);
+       if (nvmeq->sq_tail != nvmeq->last_sq_tail)
+               nvme_write_sq_db(nvmeq, true);
        spin_unlock(&nvmeq->sq_lock);
 }
 
@@ -1496,6 +1510,7 @@ static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid)
        struct nvme_dev *dev = nvmeq->dev;
 
        nvmeq->sq_tail = 0;
+       nvmeq->last_sq_tail = 0;
        nvmeq->cq_head = 0;
        nvmeq->cq_phase = 1;
        nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride];
@@ -3185,6 +3200,8 @@ static const struct pci_device_id nvme_id_table[] = {
                                NVME_QUIRK_IGNORE_DEV_SUBNQN, },
        { PCI_DEVICE(0x1c5c, 0x1504),   /* SK Hynix PC400 */
                .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
+       { PCI_DEVICE(0x15b7, 0x2001),   /*  Sandisk Skyhawk */
+               .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
        { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001),
                .driver_data = NVME_QUIRK_SINGLE_VECTOR },
        { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) },
index 9e378d0..65e3d0e 100644 (file)
@@ -122,7 +122,6 @@ struct nvme_rdma_ctrl {
        struct sockaddr_storage src_addr;
 
        struct nvme_ctrl        ctrl;
-       struct mutex            teardown_lock;
        bool                    use_inline_data;
        u32                     io_queues[HCTX_MAX_TYPES];
 };
@@ -1010,8 +1009,8 @@ out_free_io_queues:
 static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl,
                bool remove)
 {
-       mutex_lock(&ctrl->teardown_lock);
        blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
+       blk_sync_queue(ctrl->ctrl.admin_q);
        nvme_rdma_stop_queue(&ctrl->queues[0]);
        if (ctrl->ctrl.admin_tagset) {
                blk_mq_tagset_busy_iter(ctrl->ctrl.admin_tagset,
@@ -1021,16 +1020,15 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl,
        if (remove)
                blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
        nvme_rdma_destroy_admin_queue(ctrl, remove);
-       mutex_unlock(&ctrl->teardown_lock);
 }
 
 static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,
                bool remove)
 {
-       mutex_lock(&ctrl->teardown_lock);
        if (ctrl->ctrl.queue_count > 1) {
                nvme_start_freeze(&ctrl->ctrl);
                nvme_stop_queues(&ctrl->ctrl);
+               nvme_sync_io_queues(&ctrl->ctrl);
                nvme_rdma_stop_io_queues(ctrl);
                if (ctrl->ctrl.tagset) {
                        blk_mq_tagset_busy_iter(ctrl->ctrl.tagset,
@@ -1041,7 +1039,6 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,
                        nvme_start_queues(&ctrl->ctrl);
                nvme_rdma_destroy_io_queues(ctrl, remove);
        }
-       mutex_unlock(&ctrl->teardown_lock);
 }
 
 static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl)
@@ -1730,10 +1727,11 @@ static void nvme_rdma_process_nvme_rsp(struct nvme_rdma_queue *queue,
        req->result = cqe->result;
 
        if (wc->wc_flags & IB_WC_WITH_INVALIDATE) {
-               if (unlikely(wc->ex.invalidate_rkey != req->mr->rkey)) {
+               if (unlikely(!req->mr ||
+                            wc->ex.invalidate_rkey != req->mr->rkey)) {
                        dev_err(queue->ctrl->ctrl.device,
                                "Bogus remote invalidation for rkey %#x\n",
-                               req->mr->rkey);
+                               req->mr ? req->mr->rkey : 0);
                        nvme_rdma_error_recovery(queue->ctrl);
                }
        } else if (req->mr) {
@@ -1767,6 +1765,14 @@ static void nvme_rdma_recv_done(struct ib_cq *cq, struct ib_wc *wc)
                return;
        }
 
+       /* sanity checking for received data length */
+       if (unlikely(wc->byte_len < len)) {
+               dev_err(queue->ctrl->ctrl.device,
+                       "Unexpected nvme completion length(%d)\n", wc->byte_len);
+               nvme_rdma_error_recovery(queue->ctrl);
+               return;
+       }
+
        ib_dma_sync_single_for_cpu(ibdev, qe->dma, len, DMA_FROM_DEVICE);
        /*
         * AEN requests are special as they don't time out and can
@@ -1889,10 +1895,10 @@ static int nvme_rdma_route_resolved(struct nvme_rdma_queue *queue)
                priv.hsqsize = cpu_to_le16(queue->ctrl->ctrl.sqsize);
        }
 
-       ret = rdma_connect(queue->cm_id, &param);
+       ret = rdma_connect_locked(queue->cm_id, &param);
        if (ret) {
                dev_err(ctrl->ctrl.device,
-                       "rdma_connect failed (%d).\n", ret);
+                       "rdma_connect_locked failed (%d).\n", ret);
                goto out_destroy_queue_ib;
        }
 
@@ -1926,7 +1932,6 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id,
                complete(&queue->cm_done);
                return 0;
        case RDMA_CM_EVENT_REJECTED:
-               nvme_rdma_destroy_queue_ib(queue);
                cm_error = nvme_rdma_conn_rejected(queue, ev);
                break;
        case RDMA_CM_EVENT_ROUTE_ERROR:
@@ -1968,16 +1973,12 @@ static void nvme_rdma_complete_timed_out(struct request *rq)
 {
        struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq);
        struct nvme_rdma_queue *queue = req->queue;
-       struct nvme_rdma_ctrl *ctrl = queue->ctrl;
 
-       /* fence other contexts that may complete the command */
-       mutex_lock(&ctrl->teardown_lock);
        nvme_rdma_stop_queue(queue);
-       if (!blk_mq_request_completed(rq)) {
+       if (blk_mq_request_started(rq) && !blk_mq_request_completed(rq)) {
                nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
                blk_mq_complete_request(rq);
        }
-       mutex_unlock(&ctrl->teardown_lock);
 }
 
 static enum blk_eh_timer_return
@@ -2312,7 +2313,6 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,
                return ERR_PTR(-ENOMEM);
        ctrl->ctrl.opts = opts;
        INIT_LIST_HEAD(&ctrl->list);
-       mutex_init(&ctrl->teardown_lock);
 
        if (!(opts->mask & NVMF_OPT_TRSVCID)) {
                opts->trsvcid =
index d6a3e14..c0c3332 100644 (file)
@@ -124,7 +124,6 @@ struct nvme_tcp_ctrl {
        struct sockaddr_storage src_addr;
        struct nvme_ctrl        ctrl;
 
-       struct mutex            teardown_lock;
        struct work_struct      err_work;
        struct delayed_work     connect_work;
        struct nvme_tcp_request async_req;
@@ -1886,8 +1885,8 @@ out_free_queue:
 static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl,
                bool remove)
 {
-       mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
        blk_mq_quiesce_queue(ctrl->admin_q);
+       blk_sync_queue(ctrl->admin_q);
        nvme_tcp_stop_queue(ctrl, 0);
        if (ctrl->admin_tagset) {
                blk_mq_tagset_busy_iter(ctrl->admin_tagset,
@@ -1897,18 +1896,17 @@ static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl,
        if (remove)
                blk_mq_unquiesce_queue(ctrl->admin_q);
        nvme_tcp_destroy_admin_queue(ctrl, remove);
-       mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
 }
 
 static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
                bool remove)
 {
-       mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
        if (ctrl->queue_count <= 1)
-               goto out;
+               return;
        blk_mq_quiesce_queue(ctrl->admin_q);
        nvme_start_freeze(ctrl);
        nvme_stop_queues(ctrl);
+       nvme_sync_io_queues(ctrl);
        nvme_tcp_stop_io_queues(ctrl);
        if (ctrl->tagset) {
                blk_mq_tagset_busy_iter(ctrl->tagset,
@@ -1918,8 +1916,6 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
        if (remove)
                nvme_start_queues(ctrl);
        nvme_tcp_destroy_io_queues(ctrl, remove);
-out:
-       mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
 }
 
 static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl)
@@ -2171,14 +2167,11 @@ static void nvme_tcp_complete_timed_out(struct request *rq)
        struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
        struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;
 
-       /* fence other contexts that may complete the command */
-       mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
        nvme_tcp_stop_queue(ctrl, nvme_tcp_queue_id(req->queue));
-       if (!blk_mq_request_completed(rq)) {
+       if (blk_mq_request_started(rq) && !blk_mq_request_completed(rq)) {
                nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
                blk_mq_complete_request(rq);
        }
-       mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
 }
 
 static enum blk_eh_timer_return
@@ -2455,7 +2448,6 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev,
                        nvme_tcp_reconnect_ctrl_work);
        INIT_WORK(&ctrl->err_work, nvme_tcp_error_recovery_work);
        INIT_WORK(&ctrl->ctrl.reset_work, nvme_reset_ctrl_work);
-       mutex_init(&ctrl->teardown_lock);
 
        if (!(opts->mask & NVMF_OPT_TRSVCID)) {
                opts->trsvcid =
index 25d62d8..957b39a 100644 (file)
@@ -907,8 +907,6 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
        req->error_loc = NVMET_NO_ERROR_LOC;
        req->error_slba = 0;
 
-       trace_nvmet_req_init(req, req->cmd);
-
        /* no support for fused commands yet */
        if (unlikely(flags & (NVME_CMD_FUSE_FIRST | NVME_CMD_FUSE_SECOND))) {
                req->error_loc = offsetof(struct nvme_common_command, flags);
@@ -938,6 +936,8 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
        if (status)
                goto fail;
 
+       trace_nvmet_req_init(req, req->cmd);
+
        if (unlikely(!percpu_ref_tryget_live(&sq->ref))) {
                status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
                goto fail;
@@ -1126,7 +1126,8 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl)
         * in case a host died before it enabled the controller.  Hence, simply
         * reset the keep alive timer when the controller is enabled.
         */
-       mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ);
+       if (ctrl->kato)
+               mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ);
 }
 
 static void nvmet_clear_ctrl(struct nvmet_ctrl *ctrl)
index 56c5710..8ee94f0 100644 (file)
@@ -26,7 +26,7 @@ static u16 nvmet_passthru_override_id_ctrl(struct nvmet_req *req)
        struct nvme_ctrl *pctrl = ctrl->subsys->passthru_ctrl;
        u16 status = NVME_SC_SUCCESS;
        struct nvme_id_ctrl *id;
-       u32 max_hw_sectors;
+       int max_hw_sectors;
        int page_shift;
 
        id = kzalloc(sizeof(*id), GFP_KERNEL);
@@ -48,6 +48,13 @@ static u16 nvmet_passthru_override_id_ctrl(struct nvmet_req *req)
        max_hw_sectors = min_not_zero(pctrl->max_segments << (PAGE_SHIFT - 9),
                                      pctrl->max_hw_sectors);
 
+       /*
+        * nvmet_passthru_map_sg is limitted to using a single bio so limit
+        * the mdts based on BIO_MAX_PAGES as well
+        */
+       max_hw_sectors = min_not_zero(BIO_MAX_PAGES << (PAGE_SHIFT - 9),
+                                     max_hw_sectors);
+
        page_shift = NVME_CAP_MPSMIN(ctrl->cap) + 12;
 
        id->mdts = ilog2(max_hw_sectors) + 9 - page_shift;
@@ -180,18 +187,20 @@ static void nvmet_passthru_req_done(struct request *rq,
 
 static int nvmet_passthru_map_sg(struct nvmet_req *req, struct request *rq)
 {
-       int sg_cnt = req->sg_cnt;
        struct scatterlist *sg;
        int op_flags = 0;
        struct bio *bio;
        int i, ret;
 
+       if (req->sg_cnt > BIO_MAX_PAGES)
+               return -EINVAL;
+
        if (req->cmd->common.opcode == nvme_cmd_flush)
                op_flags = REQ_FUA;
        else if (nvme_is_write(req->cmd))
                op_flags = REQ_SYNC | REQ_IDLE;
 
-       bio = bio_alloc(GFP_KERNEL, min(sg_cnt, BIO_MAX_PAGES));
+       bio = bio_alloc(GFP_KERNEL, req->sg_cnt);
        bio->bi_end_io = bio_put;
        bio->bi_opf = req_op(rq) | op_flags;
 
@@ -201,7 +210,6 @@ static int nvmet_passthru_map_sg(struct nvmet_req *req, struct request *rq)
                        bio_put(bio);
                        return -EINVAL;
                }
-               sg_cnt--;
        }
 
        ret = blk_rq_append_bio(rq, &bio);
@@ -236,7 +244,7 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
                q = ns->queue;
        }
 
-       rq = nvme_alloc_request(q, req->cmd, BLK_MQ_REQ_NOWAIT, NVME_QID_ANY);
+       rq = nvme_alloc_request(q, req->cmd, 0, NVME_QID_ANY);
        if (IS_ERR(rq)) {
                status = NVME_SC_INTERNAL;
                goto out_put_ns;
index 0458046..c14e324 100644 (file)
@@ -46,19 +46,12 @@ static inline struct nvmet_ctrl *nvmet_req_to_ctrl(struct nvmet_req *req)
        return req->sq->ctrl;
 }
 
-static inline void __assign_disk_name(char *name, struct nvmet_req *req,
-               bool init)
+static inline void __assign_req_name(char *name, struct nvmet_req *req)
 {
-       struct nvmet_ctrl *ctrl = nvmet_req_to_ctrl(req);
-       struct nvmet_ns *ns;
-
-       if ((init && req->sq->qid) || (!init && req->cq->qid)) {
-               ns = nvmet_find_namespace(ctrl, req->cmd->rw.nsid);
-               strncpy(name, ns->device_path, DISK_NAME_LEN);
-               return;
-       }
-
-       memset(name, 0, DISK_NAME_LEN);
+       if (req->ns)
+               strncpy(name, req->ns->device_path, DISK_NAME_LEN);
+       else
+               memset(name, 0, DISK_NAME_LEN);
 }
 #endif
 
@@ -81,7 +74,7 @@ TRACE_EVENT(nvmet_req_init,
        TP_fast_assign(
                __entry->cmd = cmd;
                __entry->ctrl = nvmet_req_to_ctrl(req);
-               __assign_disk_name(__entry->disk, req, true);
+               __assign_req_name(__entry->disk, req);
                __entry->qid = req->sq->qid;
                __entry->cid = cmd->common.command_id;
                __entry->opcode = cmd->common.opcode;
@@ -121,7 +114,7 @@ TRACE_EVENT(nvmet_req_complete,
                __entry->cid = req->cqe->command_id;
                __entry->result = le64_to_cpu(req->cqe->result.u64);
                __entry->status = le16_to_cpu(req->cqe->status) >> 1;
-               __assign_disk_name(__entry->disk, req, false);
+               __assign_req_name(__entry->disk, req);
        ),
        TP_printk("nvmet%s: %sqid=%d, cmdid=%u, res=%#llx, status=%#x",
                __print_ctrl_name(__entry->ctrl),
index 655dee4..aedfaaa 100644 (file)
@@ -93,7 +93,7 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
 {
        const struct iommu_ops *iommu;
        const struct bus_dma_region *map = NULL;
-       dma_addr_t dma_start = 0;
+       u64 dma_start = 0;
        u64 mask, end, size = 0;
        bool coherent;
        int ret;
@@ -109,10 +109,10 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
                        return ret == -ENODEV ? 0 : ret;
        } else {
                const struct bus_dma_region *r = map;
-               dma_addr_t dma_end = 0;
+               u64 dma_end = 0;
 
                /* Determine the overall bounds of all DMA regions */
-               for (dma_start = ~(dma_addr_t)0; r->size; r++) {
+               for (dma_start = ~0; r->size; r++) {
                        /* Take lower and upper limits */
                        if (r->dma_start < dma_start)
                                dma_start = r->dma_start;
index 46b9371..a7fbc5e 100644 (file)
@@ -162,7 +162,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
 }
 
 static const struct of_device_id __rmem_of_table_sentinel
-       __used __section(__reservedmem_of_table_end);
+       __used __section("__reservedmem_of_table_end");
 
 /**
  * __reserved_mem_init_node() - call region specific reserved memory init code
@@ -200,6 +200,16 @@ static int __init __rmem_cmp(const void *a, const void *b)
        if (ra->base > rb->base)
                return 1;
 
+       /*
+        * Put the dynamic allocations (address == 0, size == 0) before static
+        * allocations at address 0x0 so that overlap detection works
+        * correctly.
+        */
+       if (ra->size < rb->size)
+               return -1;
+       if (ra->size > rb->size)
+               return 1;
+
        return 0;
 }
 
@@ -217,8 +227,7 @@ static void __init __rmem_check_for_overlap(void)
 
                this = &reserved_mem[i];
                next = &reserved_mem[i + 1];
-               if (!(this->base && next->base))
-                       continue;
+
                if (this->base + this->size > next->base) {
                        phys_addr_t this_end, next_end;
 
index 2483e76..0e0a526 100644 (file)
@@ -1181,6 +1181,10 @@ static void _opp_table_kref_release(struct kref *kref)
        struct opp_device *opp_dev, *temp;
        int i;
 
+       /* Drop the lock as soon as we can */
+       list_del(&opp_table->node);
+       mutex_unlock(&opp_table_lock);
+
        _of_clear_opp_table(opp_table);
 
        /* Release clk */
@@ -1208,10 +1212,7 @@ static void _opp_table_kref_release(struct kref *kref)
 
        mutex_destroy(&opp_table->genpd_virt_dev_lock);
        mutex_destroy(&opp_table->lock);
-       list_del(&opp_table->node);
        kfree(opp_table);
-
-       mutex_unlock(&opp_table_lock);
 }
 
 void dev_pm_opp_put_opp_table(struct opp_table *opp_table)
@@ -1930,7 +1931,7 @@ struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev,
                return ERR_PTR(-EINVAL);
 
        opp_table = dev_pm_opp_get_opp_table(dev);
-       if (!IS_ERR(opp_table))
+       if (IS_ERR(opp_table))
                return opp_table;
 
        /* This should be called before OPPs are initialized */
index 874b587..9faeb83 100644 (file)
@@ -944,6 +944,8 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
                nr -= 2;
        }
 
+       return 0;
+
 remove_static_opp:
        _opp_remove_all_static(opp_table);
 
index 674f32d..44c2a65 100644 (file)
@@ -586,8 +586,12 @@ void dw_pcie_setup_rc(struct pcie_port *pp)
         * ATU, so we should not program the ATU here.
         */
        if (pp->bridge->child_ops == &dw_child_pcie_ops) {
-               struct resource_entry *entry =
-                       resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM);
+               struct resource_entry *tmp, *entry = NULL;
+
+               /* Get last memory resource entry */
+               resource_list_for_each_entry(tmp, &pp->bridge->windows)
+                       if (resource_type(tmp->res) == IORESOURCE_MEM)
+                               entry = tmp;
 
                dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX0,
                                          PCIE_ATU_TYPE_MEM, entry->res->start,
index eee8283..ed13e81 100644 (file)
@@ -958,25 +958,16 @@ static void mvebu_pcie_powerdown(struct mvebu_pcie_port *port)
 }
 
 /*
- * We can't use devm_of_pci_get_host_bridge_resources() because we
- * need to parse our special DT properties encoding the MEM and IO
- * apertures.
+ * devm_of_pci_get_host_bridge_resources() only sets up translateable resources,
+ * so we need extra resource setup parsing our special DT properties encoding
+ * the MEM and IO apertures.
  */
 static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
 {
        struct device *dev = &pcie->pdev->dev;
-       struct device_node *np = dev->of_node;
        struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
        int ret;
 
-       /* Get the bus range */
-       ret = of_pci_parse_bus_range(np, &pcie->busn);
-       if (ret) {
-               dev_err(dev, "failed to parse bus-range property: %d\n", ret);
-               return ret;
-       }
-       pci_add_resource(&bridge->windows, &pcie->busn);
-
        /* Get the PCIe memory aperture */
        mvebu_mbus_get_pcie_mem_aperture(&pcie->mem);
        if (resource_size(&pcie->mem) == 0) {
@@ -986,6 +977,9 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
 
        pcie->mem.name = "PCI MEM";
        pci_add_resource(&bridge->windows, &pcie->mem);
+       ret = devm_request_resource(dev, &iomem_resource, &pcie->mem);
+       if (ret)
+               return ret;
 
        /* Get the PCIe IO aperture */
        mvebu_mbus_get_pcie_io_aperture(&pcie->io);
@@ -999,9 +993,12 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
                pcie->realio.name = "PCI I/O";
 
                pci_add_resource(&bridge->windows, &pcie->realio);
+               ret = devm_request_resource(dev, &ioport_resource, &pcie->realio);
+               if (ret)
+                       return ret;
        }
 
-       return devm_request_pci_bus_resources(dev, &bridge->windows);
+       return 0;
 }
 
 /*
index 6d4d5a2..e578d34 100644 (file)
@@ -3516,8 +3516,13 @@ void pci_acs_init(struct pci_dev *dev)
 {
        dev->acs_cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS);
 
-       if (dev->acs_cap)
-               pci_enable_acs(dev);
+       /*
+        * Attempt to enable ACS regardless of capability because some Root
+        * Ports (e.g. those quirked with *_intel_pch_acs_*) do not have
+        * the standard ACS capability but still support ACS via those
+        * quirks.
+        */
+       pci_enable_acs(dev);
 }
 
 /**
index eae3579..e381067 100644 (file)
@@ -1913,6 +1913,10 @@ enum {   /* hot key scan codes (derived from ACPI DSDT) */
        TP_ACPI_HOTKEYSCAN_CALCULATOR,
        TP_ACPI_HOTKEYSCAN_BLUETOOTH,
        TP_ACPI_HOTKEYSCAN_KEYBOARD,
+       TP_ACPI_HOTKEYSCAN_FN_RIGHT_SHIFT, /* Used by "Lenovo Quick Clean" */
+       TP_ACPI_HOTKEYSCAN_NOTIFICATION_CENTER,
+       TP_ACPI_HOTKEYSCAN_PICKUP_PHONE,
+       TP_ACPI_HOTKEYSCAN_HANGUP_PHONE,
 
        /* Hotkey keymap size */
        TPACPI_HOTKEY_MAP_LEN
@@ -3429,11 +3433,15 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
                KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
                KEY_UNKNOWN,
 
-               KEY_BOOKMARKS,       /* Favorite app, 0x311 */
-               KEY_RESERVED,        /* Clipping tool */
-               KEY_CALC,            /* Calculator (above numpad, P52) */
-               KEY_BLUETOOTH,       /* Bluetooth */
-               KEY_KEYBOARD         /* Keyboard, 0x315 */
+               KEY_BOOKMARKS,                  /* Favorite app, 0x311 */
+               KEY_SELECTIVE_SCREENSHOT,       /* Clipping tool */
+               KEY_CALC,                       /* Calculator (above numpad, P52) */
+               KEY_BLUETOOTH,                  /* Bluetooth */
+               KEY_KEYBOARD,                   /* Keyboard, 0x315 */
+               KEY_FN_RIGHT_SHIFT,             /* Fn + right Shift */
+               KEY_NOTIFICATION_CENTER,        /* Notification Center */
+               KEY_PICKUP_PHONE,               /* Answer incoming call */
+               KEY_HANGUP_PHONE,               /* Decline incoming call */
                },
        };
 
index 3bf18d7..a50ab00 100644 (file)
@@ -51,7 +51,7 @@ static void pnp_remove_protocol(struct pnp_protocol *protocol)
 }
 
 /**
- * pnp_protocol_register - adds a pnp protocol to the pnp layer
+ * pnp_register_protocol - adds a pnp protocol to the pnp layer
  * @protocol: pointer to the corresponding pnp_protocol structure
  *
  *  Ex protocols: ISAPNP, PNPBIOS, etc
@@ -91,7 +91,7 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
 }
 
 /**
- * pnp_protocol_unregister - removes a pnp protocol from the pnp layer
+ * pnp_unregister_protocol - removes a pnp protocol from the pnp layer
  * @protocol: pointer to the corresponding pnp_protocol structure
  */
 void pnp_unregister_protocol(struct pnp_protocol *protocol)
index ff0350c..696bf77 100644 (file)
@@ -1,4 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
-source "drivers/power/avs/Kconfig"
 source "drivers/power/reset/Kconfig"
 source "drivers/power/supply/Kconfig"
index b7c2e37..effbf03 100644 (file)
@@ -1,4 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_POWER_AVS)                += avs/
 obj-$(CONFIG_POWER_RESET)      += reset/
 obj-$(CONFIG_POWER_SUPPLY)     += supply/
diff --git a/drivers/power/avs/Kconfig b/drivers/power/avs/Kconfig
deleted file mode 100644 (file)
index cdb4237..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-menuconfig POWER_AVS
-       bool "Adaptive Voltage Scaling class support"
-       help
-         AVS is a power management technique which finely controls the
-         operating voltage of a device in order to optimize (i.e. reduce)
-         its power consumption.
-         At a given operating point the voltage is adapted depending on
-         static factors (chip manufacturing process) and dynamic factors
-         (temperature depending performance).
-         AVS is also called SmartReflex on OMAP devices.
-
-         Say Y here to enable Adaptive Voltage Scaling class support.
-
-config QCOM_CPR
-       tristate "QCOM Core Power Reduction (CPR) support"
-       depends on POWER_AVS && HAS_IOMEM
-       select PM_OPP
-       select REGMAP
-       help
-         Say Y here to enable support for the CPR hardware found on Qualcomm
-         SoCs like QCS404.
-
-         This driver populates CPU OPPs tables and makes adjustments to the
-         tables based on feedback from the CPR hardware. If you want to do
-         CPUfrequency scaling say Y here.
-
-         To compile this driver as a module, choose M here: the module will
-         be called qcom-cpr
-
-config ROCKCHIP_IODOMAIN
-       tristate "Rockchip IO domain support"
-       depends on POWER_AVS && ARCH_ROCKCHIP && OF
-       help
-         Say y here to enable support io domains on Rockchip SoCs. It is
-         necessary for the io domain setting of the SoC to match the
-         voltage supplied by the regulators.
diff --git a/drivers/power/avs/Makefile b/drivers/power/avs/Makefile
deleted file mode 100644 (file)
index 9007d05..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_POWER_AVS_OMAP)           += smartreflex.o
-obj-$(CONFIG_QCOM_CPR)                 += qcom-cpr.o
-obj-$(CONFIG_ROCKCHIP_IODOMAIN)                += rockchip-io-domain.o
index 3d00b35..60b7f41 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 
-#include <plat/adc.h>
+#include <linux/soc/samsung/s3c-adc.h>
 
 #define BAT_POLL_INTERVAL              10000 /* ms */
 #define JITTER_DELAY                   500 /* ms */
index ebc4d45..bc22872 100644 (file)
@@ -30,7 +30,7 @@ config INTEL_RAPL
 
          In RAPL, the platform level settings are divided into domains for
          fine grained control. These domains include processor package, DRAM
-         controller, CPU core (Power Plance 0), graphics uncore (Power Plane
+         controller, CPU core (Power Plane 0), graphics uncore (Power Plane
          1), etc.
 
 config IDLE_INJECT
index 983d75b..70d6d52 100644 (file)
@@ -544,7 +544,14 @@ static void rapl_init_domains(struct rapl_package *rp)
                        continue;
 
                rd->rp = rp;
-               rd->name = rapl_domain_names[i];
+
+               if (i == RAPL_DOMAIN_PLATFORM && rp->id > 0) {
+                       snprintf(rd->name, RAPL_DOMAIN_NAME_LENGTH, "psys-%d",
+                               cpu_data(rp->lead_cpu).phys_proc_id);
+               } else
+                       snprintf(rd->name, RAPL_DOMAIN_NAME_LENGTH, "%s",
+                               rapl_domain_names[i]);
+
                rd->id = i;
                rd->rpl[0].prim_id = PL1_ENABLE;
                rd->rpl[0].name = pl1_name;
@@ -613,7 +620,7 @@ static u64 rapl_unit_xlate(struct rapl_domain *rd, enum unit_type type,
        case ARBITRARY_UNIT:
        default:
                return value;
-       };
+       }
 
        if (to_raw)
                return div64_u64(value, units) * scale;
@@ -1112,13 +1119,17 @@ static int rapl_package_register_powercap(struct rapl_package *rp)
        }
        /* now register domains as children of the socket/package */
        for (rd = rp->domains; rd < rp->domains + rp->nr_domains; rd++) {
+               struct powercap_zone *parent = rp->power_zone;
+
                if (rd->id == RAPL_DOMAIN_PACKAGE)
                        continue;
+               if (rd->id == RAPL_DOMAIN_PLATFORM)
+                       parent = NULL;
                /* number of power limits per domain varies */
                nr_pl = find_nr_power_limit(rd);
                power_zone = powercap_register_zone(&rd->power_zone,
                                                    rp->priv->control_type,
-                                                   rd->name, rp->power_zone,
+                                                   rd->name, parent,
                                                    &zone_ops[rd->id], nr_pl,
                                                    &constraint_ops);
 
@@ -1145,67 +1156,6 @@ err_cleanup:
        return ret;
 }
 
-int rapl_add_platform_domain(struct rapl_if_priv *priv)
-{
-       struct rapl_domain *rd;
-       struct powercap_zone *power_zone;
-       struct reg_action ra;
-       int ret;
-
-       ra.reg = priv->regs[RAPL_DOMAIN_PLATFORM][RAPL_DOMAIN_REG_STATUS];
-       ra.mask = ~0;
-       ret = priv->read_raw(0, &ra);
-       if (ret || !ra.value)
-               return -ENODEV;
-
-       ra.reg = priv->regs[RAPL_DOMAIN_PLATFORM][RAPL_DOMAIN_REG_LIMIT];
-       ra.mask = ~0;
-       ret = priv->read_raw(0, &ra);
-       if (ret || !ra.value)
-               return -ENODEV;
-
-       rd = kzalloc(sizeof(*rd), GFP_KERNEL);
-       if (!rd)
-               return -ENOMEM;
-
-       rd->name = rapl_domain_names[RAPL_DOMAIN_PLATFORM];
-       rd->id = RAPL_DOMAIN_PLATFORM;
-       rd->regs[RAPL_DOMAIN_REG_LIMIT] =
-           priv->regs[RAPL_DOMAIN_PLATFORM][RAPL_DOMAIN_REG_LIMIT];
-       rd->regs[RAPL_DOMAIN_REG_STATUS] =
-           priv->regs[RAPL_DOMAIN_PLATFORM][RAPL_DOMAIN_REG_STATUS];
-       rd->rpl[0].prim_id = PL1_ENABLE;
-       rd->rpl[0].name = pl1_name;
-       rd->rpl[1].prim_id = PL2_ENABLE;
-       rd->rpl[1].name = pl2_name;
-       rd->rp = rapl_find_package_domain(0, priv);
-
-       power_zone = powercap_register_zone(&rd->power_zone, priv->control_type,
-                                           "psys", NULL,
-                                           &zone_ops[RAPL_DOMAIN_PLATFORM],
-                                           2, &constraint_ops);
-
-       if (IS_ERR(power_zone)) {
-               kfree(rd);
-               return PTR_ERR(power_zone);
-       }
-
-       priv->platform_rapl_domain = rd;
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(rapl_add_platform_domain);
-
-void rapl_remove_platform_domain(struct rapl_if_priv *priv)
-{
-       if (priv->platform_rapl_domain) {
-               powercap_unregister_zone(priv->control_type,
-                                &priv->platform_rapl_domain->power_zone);
-               kfree(priv->platform_rapl_domain);
-       }
-}
-EXPORT_SYMBOL_GPL(rapl_remove_platform_domain);
-
 static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp)
 {
        struct reg_action ra;
@@ -1215,11 +1165,9 @@ static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp)
        case RAPL_DOMAIN_PP0:
        case RAPL_DOMAIN_PP1:
        case RAPL_DOMAIN_DRAM:
+       case RAPL_DOMAIN_PLATFORM:
                ra.reg = rp->priv->regs[domain][RAPL_DOMAIN_REG_STATUS];
                break;
-       case RAPL_DOMAIN_PLATFORM:
-               /* PSYS(PLATFORM) is not a CPU domain, so avoid printng error */
-               return -EINVAL;
        default:
                pr_err("invalid domain id %d\n", domain);
                return -EINVAL;
@@ -1228,7 +1176,7 @@ static int rapl_check_domain(int cpu, int domain, struct rapl_package *rp)
         * values, otherwise skip it.
         */
 
-       ra.mask = ~0;
+       ra.mask = ENERGY_STATUS_MASK;
        if (rp->priv->read_raw(cpu, &ra) || !ra.value)
                return -ENODEV;
 
index d2a2627..1646808 100644 (file)
@@ -44,6 +44,7 @@ static struct rapl_if_priv rapl_msr_priv = {
        .regs[RAPL_DOMAIN_PLATFORM] = {
                MSR_PLATFORM_POWER_LIMIT, MSR_PLATFORM_ENERGY_STATUS, 0, 0, 0},
        .limits[RAPL_DOMAIN_PACKAGE] = 2,
+       .limits[RAPL_DOMAIN_PLATFORM] = 2,
 };
 
 /* Handles CPU hotplug on multi-socket systems.
@@ -157,9 +158,6 @@ static int rapl_msr_probe(struct platform_device *pdev)
                goto out;
        rapl_msr_priv.pcap_rapl_online = ret;
 
-       /* Don't bail out if PSys is not supported */
-       rapl_add_platform_domain(&rapl_msr_priv);
-
        return 0;
 
 out:
@@ -171,7 +169,6 @@ out:
 static int rapl_msr_remove(struct platform_device *pdev)
 {
        cpuhp_remove_state(rapl_msr_priv.pcap_rapl_online);
-       rapl_remove_platform_domain(&rapl_msr_priv);
        powercap_unregister_control_type(rapl_msr_priv.control_type);
        return 0;
 }
index f808c5f..3f0b8e2 100644 (file)
@@ -367,9 +367,9 @@ static void create_power_zone_common_attributes(
                                        &dev_attr_max_energy_range_uj.attr;
        if (power_zone->ops->get_energy_uj) {
                if (power_zone->ops->reset_energy_uj)
-                       dev_attr_energy_uj.attr.mode = S_IWUSR | S_IRUGO;
+                       dev_attr_energy_uj.attr.mode = S_IWUSR | S_IRUSR;
                else
-                       dev_attr_energy_uj.attr.mode = S_IRUGO;
+                       dev_attr_energy_uj.attr.mode = S_IRUSR;
                power_zone->zone_dev_attrs[count++] =
                                        &dev_attr_energy_uj.attr;
        }
index 179f6c4..c1c959f 100644 (file)
@@ -21,6 +21,7 @@ MODULE_DESCRIPTION("Driver for IDT 82p33xxx clock devices");
 MODULE_AUTHOR("IDT support-1588 <IDT-support-1588@lm.renesas.com>");
 MODULE_VERSION("1.0");
 MODULE_LICENSE("GPL");
+MODULE_FIRMWARE(FW_FILENAME);
 
 /* Module Parameters */
 static u32 sync_tod_timeout = SYNC_TOD_TIMEOUT_SEC;
@@ -77,11 +78,10 @@ static void idt82p33_timespec_to_byte_array(struct timespec64 const *ts,
        }
 }
 
-static int idt82p33_xfer(struct idt82p33 *idt82p33,
-                        unsigned char regaddr,
-                        unsigned char *buf,
-                        unsigned int count,
-                        int write)
+static int idt82p33_xfer_read(struct idt82p33 *idt82p33,
+                             unsigned char regaddr,
+                             unsigned char *buf,
+                             unsigned int count)
 {
        struct i2c_client *client = idt82p33->client;
        struct i2c_msg msg[2];
@@ -93,7 +93,7 @@ static int idt82p33_xfer(struct idt82p33 *idt82p33,
        msg[0].buf = &regaddr;
 
        msg[1].addr = client->addr;
-       msg[1].flags = write ? 0 : I2C_M_RD;
+       msg[1].flags = I2C_M_RD;
        msg[1].len = count;
        msg[1].buf = buf;
 
@@ -109,6 +109,31 @@ static int idt82p33_xfer(struct idt82p33 *idt82p33,
        return 0;
 }
 
+static int idt82p33_xfer_write(struct idt82p33 *idt82p33,
+                              u8 regaddr,
+                              u8 *buf,
+                              u16 count)
+{
+       struct i2c_client *client = idt82p33->client;
+       /* we add 1 byte for device register */
+       u8 msg[IDT82P33_MAX_WRITE_COUNT + 1];
+       int err;
+
+       if (count > IDT82P33_MAX_WRITE_COUNT)
+               return -EINVAL;
+
+       msg[0] = regaddr;
+       memcpy(&msg[1], buf, count);
+
+       err = i2c_master_send(client, msg, count + 1);
+       if (err < 0) {
+               dev_err(&client->dev, "i2c_master_send returned %d\n", err);
+               return err;
+       }
+
+       return 0;
+}
+
 static int idt82p33_page_offset(struct idt82p33 *idt82p33, unsigned char val)
 {
        int err;
@@ -116,7 +141,7 @@ static int idt82p33_page_offset(struct idt82p33 *idt82p33, unsigned char val)
        if (idt82p33->page_offset == val)
                return 0;
 
-       err = idt82p33_xfer(idt82p33, PAGE_ADDR, &val, sizeof(val), 1);
+       err = idt82p33_xfer_write(idt82p33, PAGE_ADDR, &val, sizeof(val));
        if (err)
                dev_err(&idt82p33->client->dev,
                        "failed to set page offset %d\n", val);
@@ -137,11 +162,12 @@ static int idt82p33_rdwr(struct idt82p33 *idt82p33, unsigned int regaddr,
 
        err = idt82p33_page_offset(idt82p33, page);
        if (err)
-               goto out;
+               return err;
 
-       err = idt82p33_xfer(idt82p33, offset, buf, count, write);
-out:
-       return err;
+       if (write)
+               return idt82p33_xfer_write(idt82p33, offset, buf, count);
+
+       return idt82p33_xfer_read(idt82p33, offset, buf, count);
 }
 
 static int idt82p33_read(struct idt82p33 *idt82p33, unsigned int regaddr,
@@ -294,7 +320,6 @@ static int _idt82p33_adjfine(struct idt82p33_channel *channel, long scaled_ppm)
 {
        struct idt82p33 *idt82p33 = channel->idt82p33;
        unsigned char buf[5] = {0};
-       int neg_adj = 0;
        int err, i;
        s64 fcw;
 
@@ -314,16 +339,9 @@ static int _idt82p33_adjfine(struct idt82p33_channel *channel, long scaled_ppm)
         * FCW = -------------
         *         168 * 2^4
         */
-       if (scaled_ppm < 0) {
-               neg_adj = 1;
-               scaled_ppm = -scaled_ppm;
-       }
 
        fcw = scaled_ppm * 244140625ULL;
-       fcw = div_u64(fcw, 2688);
-
-       if (neg_adj)
-               fcw = -fcw;
+       fcw = div_s64(fcw, 2688);
 
        for (i = 0; i < 5; i++) {
                buf[i] = fcw & 0xff;
@@ -448,8 +466,11 @@ static int idt82p33_measure_tod_write_overhead(struct idt82p33_channel *channel)
 
        err = idt82p33_measure_settime_gettime_gap_overhead(channel, &gap_ns);
 
-       if (err)
+       if (err) {
+               dev_err(&idt82p33->client->dev,
+                       "Failed in %s with err %d!\n", __func__, err);
                return err;
+       }
 
        err = idt82p33_measure_one_byte_write_overhead(channel,
                                                       &one_byte_write_ns);
@@ -518,13 +539,10 @@ static int idt82p33_sync_tod(struct idt82p33_channel *channel, bool enable)
        u8 sync_cnfg;
        int err;
 
-       if (enable == channel->sync_tod_on) {
-               if (enable && sync_tod_timeout) {
-                       mod_delayed_work(system_wq, &channel->sync_tod_work,
-                                        sync_tod_timeout * HZ);
-               }
-               return 0;
-       }
+       /* Turn it off after sync_tod_timeout seconds */
+       if (enable && sync_tod_timeout)
+               ptp_schedule_worker(channel->ptp_clock,
+                                   sync_tod_timeout * HZ);
 
        err = idt82p33_read(idt82p33, channel->dpll_sync_cnfg,
                            &sync_cnfg, sizeof(sync_cnfg));
@@ -532,29 +550,17 @@ static int idt82p33_sync_tod(struct idt82p33_channel *channel, bool enable)
                return err;
 
        sync_cnfg &= ~SYNC_TOD;
-
        if (enable)
                sync_cnfg |= SYNC_TOD;
 
-       err = idt82p33_write(idt82p33, channel->dpll_sync_cnfg,
-                            &sync_cnfg, sizeof(sync_cnfg));
-       if (err)
-               return err;
-
-       channel->sync_tod_on = enable;
-
-       if (enable && sync_tod_timeout) {
-               mod_delayed_work(system_wq, &channel->sync_tod_work,
-                                sync_tod_timeout * HZ);
-       }
-
-       return 0;
+       return idt82p33_write(idt82p33, channel->dpll_sync_cnfg,
+                             &sync_cnfg, sizeof(sync_cnfg));
 }
 
-static void idt82p33_sync_tod_work_handler(struct work_struct *work)
+static long idt82p33_sync_tod_work_handler(struct ptp_clock_info *ptp)
 {
        struct idt82p33_channel *channel =
-               container_of(work, struct idt82p33_channel, sync_tod_work.work);
+                       container_of(ptp, struct idt82p33_channel, caps);
        struct idt82p33 *idt82p33 = channel->idt82p33;
 
        mutex_lock(&idt82p33->reg_lock);
@@ -562,35 +568,46 @@ static void idt82p33_sync_tod_work_handler(struct work_struct *work)
        (void)idt82p33_sync_tod(channel, false);
 
        mutex_unlock(&idt82p33->reg_lock);
+
+       /* Return a negative value here to not reschedule */
+       return -1;
 }
 
-static int idt82p33_pps_enable(struct idt82p33_channel *channel, bool enable)
+static int idt82p33_output_enable(struct idt82p33_channel *channel,
+                                 bool enable, unsigned int outn)
 {
        struct idt82p33 *idt82p33 = channel->idt82p33;
-       u8 mask, outn, val;
        int err;
+       u8 val;
+
+       err = idt82p33_read(idt82p33, OUT_MUX_CNFG(outn), &val, sizeof(val));
+       if (err)
+               return err;
+       if (enable)
+               val &= ~SQUELCH_ENABLE;
+       else
+               val |= SQUELCH_ENABLE;
+
+       return idt82p33_write(idt82p33, OUT_MUX_CNFG(outn), &val, sizeof(val));
+}
+
+static int idt82p33_output_mask_enable(struct idt82p33_channel *channel,
+                                      bool enable)
+{
+       u16 mask;
+       int err;
+       u8 outn;
 
        mask = channel->output_mask;
        outn = 0;
 
        while (mask) {
                if (mask & 0x1) {
-                       err = idt82p33_read(idt82p33, OUT_MUX_CNFG(outn),
-                                           &val, sizeof(val));
-                       if (err)
-                               return err;
-
-                       if (enable)
-                               val &= ~SQUELCH_ENABLE;
-                       else
-                               val |= SQUELCH_ENABLE;
-
-                       err = idt82p33_write(idt82p33, OUT_MUX_CNFG(outn),
-                                            &val, sizeof(val));
-
+                       err = idt82p33_output_enable(channel, enable, outn);
                        if (err)
                                return err;
                }
+
                mask >>= 0x1;
                outn++;
        }
@@ -598,6 +615,20 @@ static int idt82p33_pps_enable(struct idt82p33_channel *channel, bool enable)
        return 0;
 }
 
+static int idt82p33_perout_enable(struct idt82p33_channel *channel,
+                                 bool enable,
+                                 struct ptp_perout_request *perout)
+{
+       unsigned int flags = perout->flags;
+
+       /* Enable/disable output based on output_mask */
+       if (flags == PEROUT_ENABLE_OUTPUT_MASK)
+               return idt82p33_output_mask_enable(channel, enable);
+
+       /* Enable/disable individual output instead */
+       return idt82p33_output_enable(channel, enable, perout->index);
+}
+
 static int idt82p33_enable_tod(struct idt82p33_channel *channel)
 {
        struct idt82p33 *idt82p33 = channel->idt82p33;
@@ -611,15 +642,13 @@ static int idt82p33_enable_tod(struct idt82p33_channel *channel)
        if (err)
                return err;
 
-       err = idt82p33_pps_enable(channel, false);
-
-       if (err)
-               return err;
-
        err = idt82p33_measure_tod_write_overhead(channel);
 
-       if (err)
+       if (err) {
+               dev_err(&idt82p33->client->dev,
+                       "Failed in %s with err %d!\n", __func__, err);
                return err;
+       }
 
        err = _idt82p33_settime(channel, &ts);
 
@@ -638,10 +667,8 @@ static void idt82p33_ptp_clock_unregister_all(struct idt82p33 *idt82p33)
 
                channel = &idt82p33->channel[i];
 
-               if (channel->ptp_clock) {
+               if (channel->ptp_clock)
                        ptp_clock_unregister(channel->ptp_clock);
-                       cancel_delayed_work_sync(&channel->sync_tod_work);
-               }
        }
 }
 
@@ -659,14 +686,15 @@ static int idt82p33_enable(struct ptp_clock_info *ptp,
 
        if (rq->type == PTP_CLK_REQ_PEROUT) {
                if (!on)
-                       err = idt82p33_pps_enable(channel, false);
-
+                       err = idt82p33_perout_enable(channel, false,
+                                                    &rq->perout);
                /* Only accept a 1-PPS aligned to the second. */
                else if (rq->perout.start.nsec || rq->perout.period.sec != 1 ||
                    rq->perout.period.nsec) {
                        err = -ERANGE;
                } else
-                       err = idt82p33_pps_enable(channel, true);
+                       err = idt82p33_perout_enable(channel, true,
+                                                    &rq->perout);
        }
 
        mutex_unlock(&idt82p33->reg_lock);
@@ -674,6 +702,48 @@ static int idt82p33_enable(struct ptp_clock_info *ptp,
        return err;
 }
 
+static int idt82p33_adjwritephase(struct ptp_clock_info *ptp, s32 offset_ns)
+{
+       struct idt82p33_channel *channel =
+               container_of(ptp, struct idt82p33_channel, caps);
+       struct idt82p33 *idt82p33 = channel->idt82p33;
+       s64 offset_regval, offset_fs;
+       u8 val[4] = {0};
+       int err;
+
+       offset_fs = (s64)(-offset_ns) * 1000000;
+
+       if (offset_fs > WRITE_PHASE_OFFSET_LIMIT)
+               offset_fs = WRITE_PHASE_OFFSET_LIMIT;
+       else if (offset_fs < -WRITE_PHASE_OFFSET_LIMIT)
+               offset_fs = -WRITE_PHASE_OFFSET_LIMIT;
+
+       /* Convert from phaseoffset_fs to register value */
+       offset_regval = div_s64(offset_fs * 1000, IDT_T0DPLL_PHASE_RESOL);
+
+       val[0] = offset_regval & 0xFF;
+       val[1] = (offset_regval >> 8) & 0xFF;
+       val[2] = (offset_regval >> 16) & 0xFF;
+       val[3] = (offset_regval >> 24) & 0x1F;
+       val[3] |= PH_OFFSET_EN;
+
+       mutex_lock(&idt82p33->reg_lock);
+
+       err = idt82p33_dpll_set_mode(channel, PLL_MODE_WPH);
+       if (err) {
+               dev_err(&idt82p33->client->dev,
+                       "Failed in %s with err %d!\n", __func__, err);
+               goto out;
+       }
+
+       err = idt82p33_write(idt82p33, channel->dpll_phase_cnfg, val,
+                            sizeof(val));
+
+out:
+       mutex_unlock(&idt82p33->reg_lock);
+       return err;
+}
+
 static int idt82p33_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
 {
        struct idt82p33_channel *channel =
@@ -683,6 +753,9 @@ static int idt82p33_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
 
        mutex_lock(&idt82p33->reg_lock);
        err = _idt82p33_adjfine(channel, scaled_ppm);
+       if (err)
+               dev_err(&idt82p33->client->dev,
+                       "Failed in %s with err %d!\n", __func__, err);
        mutex_unlock(&idt82p33->reg_lock);
 
        return err;
@@ -706,10 +779,15 @@ static int idt82p33_adjtime(struct ptp_clock_info *ptp, s64 delta_ns)
 
        if (err) {
                mutex_unlock(&idt82p33->reg_lock);
+               dev_err(&idt82p33->client->dev,
+                       "Adjtime failed in %s with err %d!\n", __func__, err);
                return err;
        }
 
        err = idt82p33_sync_tod(channel, true);
+       if (err)
+               dev_err(&idt82p33->client->dev,
+                       "Sync_tod failed in %s with err %d!\n", __func__, err);
 
        mutex_unlock(&idt82p33->reg_lock);
 
@@ -725,6 +803,9 @@ static int idt82p33_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
 
        mutex_lock(&idt82p33->reg_lock);
        err = _idt82p33_gettime(channel, ts);
+       if (err)
+               dev_err(&idt82p33->client->dev,
+                       "Failed in %s with err %d!\n", __func__, err);
        mutex_unlock(&idt82p33->reg_lock);
 
        return err;
@@ -740,6 +821,9 @@ static int idt82p33_settime(struct ptp_clock_info *ptp,
 
        mutex_lock(&idt82p33->reg_lock);
        err = _idt82p33_settime(channel, ts);
+       if (err)
+               dev_err(&idt82p33->client->dev,
+                       "Failed in %s with err %d!\n", __func__, err);
        mutex_unlock(&idt82p33->reg_lock);
 
        return err;
@@ -772,9 +856,6 @@ static int idt82p33_channel_init(struct idt82p33_channel *channel, int index)
                return -EINVAL;
        }
 
-       INIT_DELAYED_WORK(&channel->sync_tod_work,
-                         idt82p33_sync_tod_work_handler);
-       channel->sync_tod_on = false;
        channel->current_freq_ppb = 0;
 
        return 0;
@@ -784,11 +865,14 @@ static void idt82p33_caps_init(struct ptp_clock_info *caps)
 {
        caps->owner = THIS_MODULE;
        caps->max_adj = 92000;
+       caps->n_per_out = 11;
+       caps->adjphase = idt82p33_adjwritephase;
        caps->adjfine = idt82p33_adjfine;
        caps->adjtime = idt82p33_adjtime;
        caps->gettime64 = idt82p33_gettime;
        caps->settime64 = idt82p33_settime;
        caps->enable = idt82p33_enable;
+       caps->do_aux_work = idt82p33_sync_tod_work_handler;
 }
 
 static int idt82p33_enable_channel(struct idt82p33 *idt82p33, u32 index)
@@ -802,23 +886,18 @@ static int idt82p33_enable_channel(struct idt82p33 *idt82p33, u32 index)
        channel = &idt82p33->channel[index];
 
        err = idt82p33_channel_init(channel, index);
-       if (err)
+       if (err) {
+               dev_err(&idt82p33->client->dev,
+                       "Channel_init failed in %s with err %d!\n",
+                       __func__, err);
                return err;
+       }
 
        channel->idt82p33 = idt82p33;
 
        idt82p33_caps_init(&channel->caps);
        snprintf(channel->caps.name, sizeof(channel->caps.name),
                 "IDT 82P33 PLL%u", index);
-       channel->caps.n_per_out = hweight8(channel->output_mask);
-
-       err = idt82p33_dpll_set_mode(channel, PLL_MODE_DCO);
-       if (err)
-               return err;
-
-       err = idt82p33_enable_tod(channel);
-       if (err)
-               return err;
 
        channel->ptp_clock = ptp_clock_register(&channel->caps, NULL);
 
@@ -831,6 +910,22 @@ static int idt82p33_enable_channel(struct idt82p33 *idt82p33, u32 index)
        if (!channel->ptp_clock)
                return -ENOTSUPP;
 
+       err = idt82p33_dpll_set_mode(channel, PLL_MODE_DCO);
+       if (err) {
+               dev_err(&idt82p33->client->dev,
+                       "Dpll_set_mode failed in %s with err %d!\n",
+                       __func__, err);
+               return err;
+       }
+
+       err = idt82p33_enable_tod(channel);
+       if (err) {
+               dev_err(&idt82p33->client->dev,
+                       "Enable_tod failed in %s with err %d!\n",
+                       __func__, err);
+               return err;
+       }
+
        dev_info(&idt82p33->client->dev, "PLL%d registered as ptp%d\n",
                 index, channel->ptp_clock->index);
 
@@ -850,8 +945,11 @@ static int idt82p33_load_firmware(struct idt82p33 *idt82p33)
 
        err = request_firmware(&fw, FW_FILENAME, &idt82p33->client->dev);
 
-       if (err)
+       if (err) {
+               dev_err(&idt82p33->client->dev,
+                       "Failed in %s with err %d!\n", __func__, err);
                return err;
+       }
 
        dev_dbg(&idt82p33->client->dev, "firmware size %zu bytes\n", fw->size);
 
@@ -935,8 +1033,12 @@ static int idt82p33_probe(struct i2c_client *client,
                for (i = 0; i < MAX_PHC_PLL; i++) {
                        if (idt82p33->pll_mask & (1 << i)) {
                                err = idt82p33_enable_channel(idt82p33, i);
-                               if (err)
+                               if (err) {
+                                       dev_err(&idt82p33->client->dev,
+                                               "Failed in %s with err %d!\n",
+                                               __func__, err);
                                        break;
+                               }
                        }
                }
        } else {
index 9d46966..1c7a0f0 100644 (file)
@@ -56,6 +56,8 @@
 #define PLL_MODE_SHIFT                    (0)
 #define PLL_MODE_MASK                     (0x1F)
 
+#define PEROUT_ENABLE_OUTPUT_MASK         (0xdeadbeef)
+
 enum pll_mode {
        PLL_MODE_MIN = 0,
        PLL_MODE_AUTOMATIC = PLL_MODE_MIN,
@@ -93,6 +95,7 @@ enum hw_tod_trig_sel {
 #define MAX_MEASURMENT_COUNT (5)
 #define SNAP_THRESHOLD_NS (150000)
 #define SYNC_TOD_TIMEOUT_SEC (5)
+#define IDT82P33_MAX_WRITE_COUNT (512)
 
 #define PLLMASK_ADDR_HI        0xFF
 #define PLLMASK_ADDR_LO        0xA5
index 78ddc12..63be536 100644 (file)
@@ -410,7 +410,7 @@ config PWM_ROCKCHIP
 
 config PWM_SAMSUNG
        tristate "Samsung PWM support"
-       depends on PLAT_SAMSUNG || ARCH_EXYNOS || COMPILE_TEST
+       depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
        help
          Generic PWM framework driver for Samsung.
 
index a4ffd71..a5ad553 100644 (file)
@@ -4165,6 +4165,8 @@ int regulator_get_voltage_rdev(struct regulator_dev *rdev)
                ret = rdev->desc->fixed_uV;
        } else if (rdev->supply) {
                ret = regulator_get_voltage_rdev(rdev->supply->rdev);
+       } else if (rdev->supply_name) {
+               return -EPROBE_DEFER;
        } else {
                return -EINVAL;
        }
index 97e8487..07d162b 100644 (file)
@@ -65,9 +65,10 @@ config RESET_HSDK
          This enables the reset controller driver for HSDK board.
 
 config RESET_IMX7
-       bool "i.MX7/8 Reset Driver" if COMPILE_TEST
+       tristate "i.MX7/8 Reset Driver"
        depends on HAS_IOMEM
-       default SOC_IMX7D || (ARM64 && ARCH_MXC)
+       depends on SOC_IMX7D || (ARM64 && ARCH_MXC) || COMPILE_TEST
+       default y if SOC_IMX7D
        select MFD_SYSCON
        help
          This enables the reset controller driver for i.MX7 SoCs.
index 01c0c7a..a2df88e 100644 (file)
@@ -32,7 +32,8 @@ static LIST_HEAD(reset_lookup_list);
  * @refcnt: Number of gets of this reset_control
  * @acquired: Only one reset_control may be acquired for a given rcdev and id.
  * @shared: Is this a shared (1), or an exclusive (0) reset_control?
- * @deassert_cnt: Number of times this reset line has been deasserted
+ * @array: Is this an array of reset controls (1)?
+ * @deassert_count: Number of times this reset line has been deasserted
  * @triggered_count: Number of times this reset line has been reset. Currently
  *                   only used for shared resets, which means that the value
  *                   will be either 0 or 1.
index e8aa869..185a333 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <linux/mfd/syscon.h>
-#include <linux/mod_devicetable.h>
+#include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/reset-controller.h>
@@ -178,6 +178,9 @@ static const struct imx7_src_signal imx8mq_src_signals[IMX8MQ_RESET_NUM] = {
        [IMX8MQ_RESET_A53_SOC_DBG_RESET]        = { SRC_A53RCR0, BIT(20) },
        [IMX8MQ_RESET_A53_L2RESET]              = { SRC_A53RCR0, BIT(21) },
        [IMX8MQ_RESET_SW_NON_SCLR_M4C_RST]      = { SRC_M4RCR, BIT(0) },
+       [IMX8MQ_RESET_SW_M4C_RST]               = { SRC_M4RCR, BIT(1) },
+       [IMX8MQ_RESET_SW_M4P_RST]               = { SRC_M4RCR, BIT(2) },
+       [IMX8MQ_RESET_M4_ENABLE]                = { SRC_M4RCR, BIT(3) },
        [IMX8MQ_RESET_OTG1_PHY_RESET]           = { SRC_USBOPHY1_RCR, BIT(0) },
        [IMX8MQ_RESET_OTG2_PHY_RESET]           = { SRC_USBOPHY2_RCR, BIT(0) },
        [IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N]    = { SRC_MIPIPHY_RCR, BIT(1) },
@@ -238,6 +241,7 @@ static int imx8mq_reset_set(struct reset_controller_dev *rcdev,
        case IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N:
        case IMX8MQ_RESET_MIPI_DSI_RESET_N:
        case IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N:
+       case IMX8MQ_RESET_M4_ENABLE:
                value = assert ? 0 : bit;
                break;
        }
@@ -386,6 +390,7 @@ static const struct of_device_id imx7_reset_dt_ids[] = {
        { .compatible = "fsl,imx8mp-src", .data = &variant_imx8mp },
        { /* sentinel */ },
 };
+MODULE_DEVICE_TABLE(of, imx7_reset_dt_ids);
 
 static struct platform_driver imx7_reset_driver = {
        .probe  = imx7_reset_probe,
@@ -394,4 +399,8 @@ static struct platform_driver imx7_reset_driver = {
                .of_match_table = imx7_reset_dt_ids,
        },
 };
-builtin_platform_driver(imx7_reset_driver);
+module_platform_driver(imx7_reset_driver);
+
+MODULE_AUTHOR("Andrey Smirnov <andrew.smirnov@gmail.com>");
+MODULE_DESCRIPTION("NXP i.MX7 reset driver");
+MODULE_LICENSE("GPL v2");
index 373ea8d..ebd433f 100644 (file)
@@ -9,12 +9,20 @@
 #include <linux/platform_device.h>
 #include <linux/reset-controller.h>
 #include <linux/firmware/xlnx-zynqmp.h>
+#include <linux/of_device.h>
 
 #define ZYNQMP_NR_RESETS (ZYNQMP_PM_RESET_END - ZYNQMP_PM_RESET_START)
 #define ZYNQMP_RESET_ID ZYNQMP_PM_RESET_START
+#define VERSAL_NR_RESETS       95
+
+struct zynqmp_reset_soc_data {
+       u32 reset_id;
+       u32 num_resets;
+};
 
 struct zynqmp_reset_data {
        struct reset_controller_dev rcdev;
+       const struct zynqmp_reset_soc_data *data;
 };
 
 static inline struct zynqmp_reset_data *
@@ -26,23 +34,28 @@ to_zynqmp_reset_data(struct reset_controller_dev *rcdev)
 static int zynqmp_reset_assert(struct reset_controller_dev *rcdev,
                               unsigned long id)
 {
-       return zynqmp_pm_reset_assert(ZYNQMP_RESET_ID + id,
+       struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev);
+
+       return zynqmp_pm_reset_assert(priv->data->reset_id + id,
                                      PM_RESET_ACTION_ASSERT);
 }
 
 static int zynqmp_reset_deassert(struct reset_controller_dev *rcdev,
                                 unsigned long id)
 {
-       return zynqmp_pm_reset_assert(ZYNQMP_RESET_ID + id,
+       struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev);
+
+       return zynqmp_pm_reset_assert(priv->data->reset_id + id,
                                      PM_RESET_ACTION_RELEASE);
 }
 
 static int zynqmp_reset_status(struct reset_controller_dev *rcdev,
                               unsigned long id)
 {
+       struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev);
        int val, err;
 
-       err = zynqmp_pm_reset_get_status(ZYNQMP_RESET_ID + id, &val);
+       err = zynqmp_pm_reset_get_status(priv->data->reset_id + id, &val);
        if (err)
                return err;
 
@@ -52,10 +65,28 @@ static int zynqmp_reset_status(struct reset_controller_dev *rcdev,
 static int zynqmp_reset_reset(struct reset_controller_dev *rcdev,
                              unsigned long id)
 {
-       return zynqmp_pm_reset_assert(ZYNQMP_RESET_ID + id,
+       struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev);
+
+       return zynqmp_pm_reset_assert(priv->data->reset_id + id,
                                      PM_RESET_ACTION_PULSE);
 }
 
+static int zynqmp_reset_of_xlate(struct reset_controller_dev *rcdev,
+                                const struct of_phandle_args *reset_spec)
+{
+       return reset_spec->args[0];
+}
+
+static const struct zynqmp_reset_soc_data zynqmp_reset_data = {
+       .reset_id = ZYNQMP_RESET_ID,
+       .num_resets = ZYNQMP_NR_RESETS,
+};
+
+static const struct zynqmp_reset_soc_data versal_reset_data = {
+        .reset_id = 0,
+        .num_resets = VERSAL_NR_RESETS,
+};
+
 static const struct reset_control_ops zynqmp_reset_ops = {
        .reset = zynqmp_reset_reset,
        .assert = zynqmp_reset_assert,
@@ -71,18 +102,25 @@ static int zynqmp_reset_probe(struct platform_device *pdev)
        if (!priv)
                return -ENOMEM;
 
+       priv->data = of_device_get_match_data(&pdev->dev);
+       if (!priv->data)
+               return -EINVAL;
+
        platform_set_drvdata(pdev, priv);
 
        priv->rcdev.ops = &zynqmp_reset_ops;
        priv->rcdev.owner = THIS_MODULE;
        priv->rcdev.of_node = pdev->dev.of_node;
-       priv->rcdev.nr_resets = ZYNQMP_NR_RESETS;
+       priv->rcdev.nr_resets = priv->data->num_resets;
+       priv->rcdev.of_reset_n_cells = 1;
+       priv->rcdev.of_xlate = zynqmp_reset_of_xlate;
 
        return devm_reset_controller_register(&pdev->dev, &priv->rcdev);
 }
 
 static const struct of_device_id zynqmp_reset_dt_ids[] = {
-       { .compatible = "xlnx,zynqmp-reset", },
+       { .compatible = "xlnx,zynqmp-reset", .data = &zynqmp_reset_data, },
+       { .compatible = "xlnx,versal-reset", .data = &versal_reset_data, },
        { /* sentinel */ },
 };
 
index 91215bb..99b6303 100644 (file)
@@ -17,7 +17,7 @@
 #include "reset-syscfg.h"
 
 /**
- * Reset channel regmap configuration
+ * struct syscfg_reset_channel - Reset channel regmap configuration
  *
  * @reset: regmap field for the channel's reset bit.
  * @ack: regmap field for the channel's ack bit (optional).
@@ -28,8 +28,9 @@ struct syscfg_reset_channel {
 };
 
 /**
- * A reset controller which groups together a set of related reset bits, which
- * may be located in different system configuration registers.
+ * struct syscfg_reset_controller - A reset controller which groups together
+ * a set of related reset bits, which may be located in different system
+ * configuration registers.
  *
  * @rst: base reset controller structure.
  * @active_low: are the resets in this controller active low, i.e. clearing
index 485cbfc..ef738b4 100644 (file)
@@ -680,7 +680,10 @@ static int ap_device_probe(struct device *dev)
 {
        struct ap_device *ap_dev = to_ap_dev(dev);
        struct ap_driver *ap_drv = to_ap_drv(dev->driver);
-       int card, queue, devres, drvres, rc;
+       int card, queue, devres, drvres, rc = -ENODEV;
+
+       if (!get_device(dev))
+               return rc;
 
        if (is_queue_dev(dev)) {
                /*
@@ -697,7 +700,7 @@ static int ap_device_probe(struct device *dev)
                mutex_unlock(&ap_perms_mutex);
                drvres = ap_drv->flags & AP_DRIVER_FLAG_DEFAULT;
                if (!!devres != !!drvres)
-                       return -ENODEV;
+                       goto out;
        }
 
        /* Add queue/card to list of active queues/cards */
@@ -718,6 +721,9 @@ static int ap_device_probe(struct device *dev)
                ap_dev->drv = NULL;
        }
 
+out:
+       if (rc)
+               put_device(dev);
        return rc;
 }
 
@@ -744,6 +750,8 @@ static int ap_device_remove(struct device *dev)
                hash_del(&to_ap_queue(dev)->hnode);
        spin_unlock_bh(&ap_queues_lock);
 
+       put_device(dev);
+
        return 0;
 }
 
@@ -1371,6 +1379,8 @@ static inline void ap_scan_domains(struct ap_card *ac)
                                            __func__, ac->id, dom);
                                goto put_dev_and_continue;
                        }
+                       /* get it and thus adjust reference counter */
+                       get_device(dev);
                        if (decfg)
                                AP_DBF_INFO("%s(%d,%d) new (decfg) queue device created\n",
                                            __func__, ac->id, dom);
index 99cb60e..dd84995 100644 (file)
@@ -35,9 +35,6 @@ MODULE_DESCRIPTION("s390 protected key interface");
 #define PROTKEYBLOBBUFSIZE 256 /* protected key buffer size used internal */
 #define MAXAPQNSINLIST 64      /* max 64 apqns within a apqn list */
 
-/* mask of available pckmo subfunctions, fetched once at module init */
-static cpacf_mask_t pckmo_functions;
-
 /*
  * debug feature data and functions
  */
@@ -91,6 +88,9 @@ static int pkey_clr2protkey(u32 keytype,
                            const struct pkey_clrkey *clrkey,
                            struct pkey_protkey *protkey)
 {
+       /* mask of available pckmo subfunctions */
+       static cpacf_mask_t pckmo_functions;
+
        long fc;
        int keysize;
        u8 paramblock[64];
@@ -114,11 +114,13 @@ static int pkey_clr2protkey(u32 keytype,
                return -EINVAL;
        }
 
-       /*
-        * Check if the needed pckmo subfunction is available.
-        * These subfunctions can be enabled/disabled by customers
-        * in the LPAR profile or may even change on the fly.
-        */
+       /* Did we already check for PCKMO ? */
+       if (!pckmo_functions.bytes[0]) {
+               /* no, so check now */
+               if (!cpacf_query(CPACF_PCKMO, &pckmo_functions))
+                       return -ENODEV;
+       }
+       /* check for the pckmo subfunction we need now */
        if (!cpacf_test_func(&pckmo_functions, fc)) {
                DEBUG_ERR("%s pckmo functions not available\n", __func__);
                return -ENODEV;
@@ -2058,7 +2060,7 @@ static struct miscdevice pkey_dev = {
  */
 static int __init pkey_init(void)
 {
-       cpacf_mask_t kmc_functions;
+       cpacf_mask_t func_mask;
 
        /*
         * The pckmo instruction should be available - even if we don't
@@ -2066,15 +2068,15 @@ static int __init pkey_init(void)
         * is also the minimum level for the kmc instructions which
         * are able to work with protected keys.
         */
-       if (!cpacf_query(CPACF_PCKMO, &pckmo_functions))
+       if (!cpacf_query(CPACF_PCKMO, &func_mask))
                return -ENODEV;
 
        /* check for kmc instructions available */
-       if (!cpacf_query(CPACF_KMC, &kmc_functions))
+       if (!cpacf_query(CPACF_KMC, &func_mask))
                return -ENODEV;
-       if (!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_128) ||
-           !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_192) ||
-           !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_256))
+       if (!cpacf_test_func(&func_mask, CPACF_KMC_PAES_128) ||
+           !cpacf_test_func(&func_mask, CPACF_KMC_PAES_192) ||
+           !cpacf_test_func(&func_mask, CPACF_KMC_PAES_256))
                return -ENODEV;
 
        pkey_debug_init();
index e342eb8..33b2388 100644 (file)
@@ -157,11 +157,6 @@ int zcrypt_card_register(struct zcrypt_card *zc)
 {
        int rc;
 
-       rc = sysfs_create_group(&zc->card->ap_dev.device.kobj,
-                               &zcrypt_card_attr_group);
-       if (rc)
-               return rc;
-
        spin_lock(&zcrypt_list_lock);
        list_add_tail(&zc->list, &zcrypt_card_list);
        spin_unlock(&zcrypt_list_lock);
@@ -170,6 +165,14 @@ int zcrypt_card_register(struct zcrypt_card *zc)
 
        ZCRYPT_DBF(DBF_INFO, "card=%02x register online=1\n", zc->card->id);
 
+       rc = sysfs_create_group(&zc->card->ap_dev.device.kobj,
+                               &zcrypt_card_attr_group);
+       if (rc) {
+               spin_lock(&zcrypt_list_lock);
+               list_del_init(&zc->list);
+               spin_unlock(&zcrypt_list_lock);
+       }
+
        return rc;
 }
 EXPORT_SYMBOL(zcrypt_card_register);
index 3c20706..5062eae 100644 (file)
@@ -180,7 +180,6 @@ int zcrypt_queue_register(struct zcrypt_queue *zq)
                                &zcrypt_queue_attr_group);
        if (rc)
                goto out;
-       get_device(&zq->queue->ap_dev.device);
 
        if (zq->ops->rng) {
                rc = zcrypt_rng_device_add();
@@ -192,7 +191,6 @@ int zcrypt_queue_register(struct zcrypt_queue *zq)
 out_unregister:
        sysfs_remove_group(&zq->queue->ap_dev.device.kobj,
                           &zcrypt_queue_attr_group);
-       put_device(&zq->queue->ap_dev.device);
 out:
        spin_lock(&zcrypt_list_lock);
        list_del_init(&zq->list);
@@ -220,12 +218,10 @@ void zcrypt_queue_unregister(struct zcrypt_queue *zq)
        list_del_init(&zq->list);
        zcrypt_device_count--;
        spin_unlock(&zcrypt_list_lock);
-       zcrypt_card_put(zc);
        if (zq->ops->rng)
                zcrypt_rng_device_remove();
        sysfs_remove_group(&zq->queue->ap_dev.device.kobj,
                           &zcrypt_queue_attr_group);
-       put_device(&zq->queue->ap_dev.device);
-       zcrypt_queue_put(zq);
+       zcrypt_card_put(zc);
 }
 EXPORT_SYMBOL(zcrypt_queue_unregister);
index fe96ca3..26cc943 100644 (file)
@@ -390,7 +390,7 @@ static int ism_move(struct smcd_dev *smcd, u64 dmb_tok, unsigned int idx,
 }
 
 static struct ism_systemeid SYSTEM_EID = {
-       .seid_string = "IBM-SYSZ-IBMSEID00000000",
+       .seid_string = "IBM-SYSZ-ISMSEID00000000",
        .serial_number = "0000",
        .type = "0000",
 };
index 5117d90..3242ff6 100644 (file)
@@ -1506,10 +1506,8 @@ NCR_700_intr(int irq, void *dev_id)
                __u8 sstat0 = 0, dstat = 0;
                __u32 dsp;
                struct scsi_cmnd *SCp = hostdata->cmd;
-               enum NCR_700_Host_State state;
 
                handled = 1;
-               state = hostdata->state;
                SCp = hostdata->cmd;
 
                if(istat & SCSI_INT_PENDING) {
@@ -1760,7 +1758,6 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
        struct NCR_700_Host_Parameters *hostdata = 
                (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0];
        __u32 move_ins;
-       enum dma_data_direction direction;
        struct NCR_700_command_slot *slot;
 
        if(hostdata->command_slot_count >= NCR_700_COMMAND_SLOTS_PER_HOST) {
@@ -1877,7 +1874,6 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
        }
 
        /* now build the scatter gather list */
-       direction = SCp->sc_data_direction;
        if(move_ins != 0) {
                int i;
                int sg_count;
index 9220bcf..5d054d5 100644 (file)
@@ -49,7 +49,7 @@ struct device_attribute;
 #define ARCMSR_MAX_OUTSTANDING_CMD     1024
 #define ARCMSR_DEFAULT_OUTSTANDING_CMD 128
 #define ARCMSR_MIN_OUTSTANDING_CMD     32
-#define ARCMSR_DRIVER_VERSION          "v1.40.00.10-20190116"
+#define ARCMSR_DRIVER_VERSION          "v1.50.00.02-20200819"
 #define ARCMSR_SCSI_INITIATOR_ID       255
 #define ARCMSR_MAX_XFER_SECTORS                512
 #define ARCMSR_MAX_XFER_SECTORS_B      4096
@@ -80,6 +80,7 @@ struct device_attribute;
 #ifndef PCI_DEVICE_ID_ARECA_1884
 #define PCI_DEVICE_ID_ARECA_1884       0x1884
 #endif
+#define PCI_DEVICE_ID_ARECA_1886       0x188A
 #define        ARCMSR_HOURS                    (1000 * 60 * 60 * 4)
 #define        ARCMSR_MINUTES                  (1000 * 60 * 60)
 /*
@@ -436,6 +437,21 @@ struct FIRMWARE_INFO
 #define ARCMSR_HBEMU_DOORBELL_SYNC             0x100
 #define ARCMSR_ARC188X_RESET_ADAPTER           0x00000004
 #define ARCMSR_ARC1884_DiagWrite_ENABLE                0x00000080
+
+/*
+*******************************************************************************
+**                SPEC. for Areca Type F adapter
+*******************************************************************************
+*/
+#define ARCMSR_SIGNATURE_1886                  0x188617D3
+// Doorbell and interrupt definition are same as Type E adapter
+/* ARC-1886 doorbell sync */
+#define ARCMSR_HBFMU_DOORBELL_SYNC             0x100
+//set host rw buffer physical address at inbound message 0, 1 (low,high)
+#define ARCMSR_HBFMU_DOORBELL_SYNC1            0x300
+#define ARCMSR_HBFMU_MESSAGE_FIRMWARE_OK       0x80000000
+#define ARCMSR_HBFMU_MESSAGE_NO_VOLUME_CHANGE  0x20000000
+
 /*
 *******************************************************************************
 **    ARECA SCSI COMMAND DESCRIPTOR BLOCK size 0x1F8 (504)
@@ -720,6 +736,80 @@ struct MessageUnit_E{
        uint32_t        msgcode_rwbuffer[256];                  /*2200 23FF*/
 };
 
+/*
+*********************************************************************
+**     Messaging Unit (MU) of Type F processor(LSI)
+*********************************************************************
+*/
+struct MessageUnit_F {
+       uint32_t        iobound_doorbell;                       /*0000 0003*/
+       uint32_t        write_sequence_3xxx;                    /*0004 0007*/
+       uint32_t        host_diagnostic_3xxx;                   /*0008 000B*/
+       uint32_t        posted_outbound_doorbell;               /*000C 000F*/
+       uint32_t        master_error_attribute;                 /*0010 0013*/
+       uint32_t        master_error_address_low;               /*0014 0017*/
+       uint32_t        master_error_address_high;              /*0018 001B*/
+       uint32_t        hcb_size;                               /*001C 001F*/
+       uint32_t        inbound_doorbell;                       /*0020 0023*/
+       uint32_t        diagnostic_rw_data;                     /*0024 0027*/
+       uint32_t        diagnostic_rw_address_low;              /*0028 002B*/
+       uint32_t        diagnostic_rw_address_high;             /*002C 002F*/
+       uint32_t        host_int_status;                        /*0030 0033*/
+       uint32_t        host_int_mask;                          /*0034 0037*/
+       uint32_t        dcr_data;                               /*0038 003B*/
+       uint32_t        dcr_address;                            /*003C 003F*/
+       uint32_t        inbound_queueport;                      /*0040 0043*/
+       uint32_t        outbound_queueport;                     /*0044 0047*/
+       uint32_t        hcb_pci_address_low;                    /*0048 004B*/
+       uint32_t        hcb_pci_address_high;                   /*004C 004F*/
+       uint32_t        iop_int_status;                         /*0050 0053*/
+       uint32_t        iop_int_mask;                           /*0054 0057*/
+       uint32_t        iop_inbound_queue_port;                 /*0058 005B*/
+       uint32_t        iop_outbound_queue_port;                /*005C 005F*/
+       uint32_t        inbound_free_list_index;                /*0060 0063*/
+       uint32_t        inbound_post_list_index;                /*0064 0067*/
+       uint32_t        reply_post_producer_index;              /*0068 006B*/
+       uint32_t        reply_post_consumer_index;              /*006C 006F*/
+       uint32_t        inbound_doorbell_clear;                 /*0070 0073*/
+       uint32_t        i2o_message_unit_control;               /*0074 0077*/
+       uint32_t        last_used_message_source_address_low;   /*0078 007B*/
+       uint32_t        last_used_message_source_address_high;  /*007C 007F*/
+       uint32_t        pull_mode_data_byte_count[4];           /*0080 008F*/
+       uint32_t        message_dest_address_index;             /*0090 0093*/
+       uint32_t        done_queue_not_empty_int_counter_timer; /*0094 0097*/
+       uint32_t        utility_A_int_counter_timer;            /*0098 009B*/
+       uint32_t        outbound_doorbell;                      /*009C 009F*/
+       uint32_t        outbound_doorbell_clear;                /*00A0 00A3*/
+       uint32_t        message_source_address_index;           /*00A4 00A7*/
+       uint32_t        message_done_queue_index;               /*00A8 00AB*/
+       uint32_t        reserved0;                              /*00AC 00AF*/
+       uint32_t        inbound_msgaddr0;                       /*00B0 00B3*/
+       uint32_t        inbound_msgaddr1;                       /*00B4 00B7*/
+       uint32_t        outbound_msgaddr0;                      /*00B8 00BB*/
+       uint32_t        outbound_msgaddr1;                      /*00BC 00BF*/
+       uint32_t        inbound_queueport_low;                  /*00C0 00C3*/
+       uint32_t        inbound_queueport_high;                 /*00C4 00C7*/
+       uint32_t        outbound_queueport_low;                 /*00C8 00CB*/
+       uint32_t        outbound_queueport_high;                /*00CC 00CF*/
+       uint32_t        iop_inbound_queue_port_low;             /*00D0 00D3*/
+       uint32_t        iop_inbound_queue_port_high;            /*00D4 00D7*/
+       uint32_t        iop_outbound_queue_port_low;            /*00D8 00DB*/
+       uint32_t        iop_outbound_queue_port_high;           /*00DC 00DF*/
+       uint32_t        message_dest_queue_port_low;            /*00E0 00E3*/
+       uint32_t        message_dest_queue_port_high;           /*00E4 00E7*/
+       uint32_t        last_used_message_dest_address_low;     /*00E8 00EB*/
+       uint32_t        last_used_message_dest_address_high;    /*00EC 00EF*/
+       uint32_t        message_done_queue_base_address_low;    /*00F0 00F3*/
+       uint32_t        message_done_queue_base_address_high;   /*00F4 00F7*/
+       uint32_t        host_diagnostic;                        /*00F8 00FB*/
+       uint32_t        write_sequence;                         /*00FC 00FF*/
+       uint32_t        reserved1[46];                          /*0100 01B7*/
+       uint32_t        reply_post_producer_index1;             /*01B8 01BB*/
+       uint32_t        reply_post_consumer_index1;             /*01BC 01BF*/
+};
+
+#define        MESG_RW_BUFFER_SIZE     (256 * 3)
+
 typedef struct deliver_completeQ {
        uint16_t        cmdFlag;
        uint16_t        cmdSMID;
@@ -739,6 +829,7 @@ struct AdapterControlBlock
 #define ACB_ADAPTER_TYPE_C             0x00000002      /* hbc L IOP */
 #define ACB_ADAPTER_TYPE_D             0x00000003      /* hbd M IOP */
 #define ACB_ADAPTER_TYPE_E             0x00000004      /* hba L IOP */
+#define ACB_ADAPTER_TYPE_F             0x00000005      /* hba L IOP */
        u32                     ioqueue_size;
        struct pci_dev *        pdev;
        struct Scsi_Host *      host;
@@ -760,10 +851,16 @@ struct AdapterControlBlock
                struct MessageUnit_C __iomem *pmuC;
                struct MessageUnit_D    *pmuD;
                struct MessageUnit_E __iomem *pmuE;
+               struct MessageUnit_F __iomem *pmuF;
        };
        /* message unit ATU inbound base address0 */
        void __iomem            *mem_base0;
        void __iomem            *mem_base1;
+       //0x000 - COMPORT_IN  (Host sent to ROC)
+       uint32_t                *message_wbuffer;
+       //0x100 - COMPORT_OUT (ROC sent to Host)
+       uint32_t                *message_rbuffer;
+       uint32_t                *msgcode_rwbuffer;      //0x200 - BIOS_AREA
        uint32_t                acb_flags;
        u16                     dev_id;
        uint8_t                 adapter_index;
@@ -836,8 +933,6 @@ struct AdapterControlBlock
 #define        FW_NORMAL                       0x0000
 #define        FW_BOG                          0x0001
 #define        FW_DEADLOCK                     0x0010
-       atomic_t                rq_map_token;
-       atomic_t                ante_token_value;
        uint32_t                maxOutstanding;
        int                     vector_count;
        uint32_t                maxFreeCCB;
@@ -848,6 +943,7 @@ struct AdapterControlBlock
        uint32_t                out_doorbell;
        uint32_t                completionQ_entry;
        pCompletion_Q           pCompletionQ;
+       uint32_t                completeQ_size;
 };/* HW_DEVICE_EXTENSION */
 /*
 *******************************************************************************
index ec895d0..e4fdb47 100644 (file)
@@ -133,6 +133,7 @@ static void arcmsr_hbaC_message_isr(struct AdapterControlBlock *pACB);
 static void arcmsr_hbaD_message_isr(struct AdapterControlBlock *acb);
 static void arcmsr_hbaE_message_isr(struct AdapterControlBlock *acb);
 static void arcmsr_hbaE_postqueue_isr(struct AdapterControlBlock *acb);
+static void arcmsr_hbaF_postqueue_isr(struct AdapterControlBlock *acb);
 static void arcmsr_hardware_reset(struct AdapterControlBlock *acb);
 static const char *arcmsr_info(struct Scsi_Host *);
 static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb);
@@ -209,6 +210,8 @@ static struct pci_device_id arcmsr_device_id_table[] = {
                .driver_data = ACB_ADAPTER_TYPE_C},
        {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1884),
                .driver_data = ACB_ADAPTER_TYPE_E},
+       {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1886),
+               .driver_data = ACB_ADAPTER_TYPE_F},
        {0, 0}, /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(pci, arcmsr_device_id_table);
@@ -232,12 +235,12 @@ static void arcmsr_free_io_queue(struct AdapterControlBlock *acb)
        switch (acb->adapter_type) {
        case ACB_ADAPTER_TYPE_B:
        case ACB_ADAPTER_TYPE_D:
-       case ACB_ADAPTER_TYPE_E: {
+       case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F:
                dma_free_coherent(&acb->pdev->dev, acb->ioqueue_size,
                        acb->dma_coherent2, acb->dma_coherent_handle2);
                break;
        }
-       }
 }
 
 static bool arcmsr_remap_pciregion(struct AdapterControlBlock *acb)
@@ -310,6 +313,19 @@ static bool arcmsr_remap_pciregion(struct AdapterControlBlock *acb)
                acb->out_doorbell = 0;
                break;
                }
+       case ACB_ADAPTER_TYPE_F: {
+               acb->pmuF = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
+               if (!acb->pmuF) {
+                       pr_notice("arcmsr%d: memory mapping region fail\n",
+                               acb->host->host_no);
+                       return false;
+               }
+               writel(0, &acb->pmuF->host_int_status); /* clear interrupt */
+               writel(ARCMSR_HBFMU_DOORBELL_SYNC, &acb->pmuF->iobound_doorbell);
+               acb->in_doorbell = 0;
+               acb->out_doorbell = 0;
+               break;
+               }
        }
        return true;
 }
@@ -317,26 +333,25 @@ static bool arcmsr_remap_pciregion(struct AdapterControlBlock *acb)
 static void arcmsr_unmap_pciregion(struct AdapterControlBlock *acb)
 {
        switch (acb->adapter_type) {
-       case ACB_ADAPTER_TYPE_A:{
+       case ACB_ADAPTER_TYPE_A:
                iounmap(acb->pmuA);
-       }
-       break;
-       case ACB_ADAPTER_TYPE_B:{
+               break;
+       case ACB_ADAPTER_TYPE_B:
                iounmap(acb->mem_base0);
                iounmap(acb->mem_base1);
-       }
-
-       break;
-       case ACB_ADAPTER_TYPE_C:{
+               break;
+       case ACB_ADAPTER_TYPE_C:
                iounmap(acb->pmuC);
-       }
-       break;
+               break;
        case ACB_ADAPTER_TYPE_D:
                iounmap(acb->mem_base0);
                break;
        case ACB_ADAPTER_TYPE_E:
                iounmap(acb->pmuE);
                break;
+       case ACB_ADAPTER_TYPE_F:
+               iounmap(acb->pmuF);
+               break;
        }
 }
 
@@ -552,23 +567,20 @@ static void arcmsr_flush_adapter_cache(struct AdapterControlBlock *acb)
 {
        switch (acb->adapter_type) {
 
-       case ACB_ADAPTER_TYPE_A: {
+       case ACB_ADAPTER_TYPE_A:
                arcmsr_hbaA_flush_cache(acb);
-               }
                break;
-
-       case ACB_ADAPTER_TYPE_B: {
+       case ACB_ADAPTER_TYPE_B:
                arcmsr_hbaB_flush_cache(acb);
-               }
                break;
-       case ACB_ADAPTER_TYPE_C: {
+       case ACB_ADAPTER_TYPE_C:
                arcmsr_hbaC_flush_cache(acb);
-               }
                break;
        case ACB_ADAPTER_TYPE_D:
                arcmsr_hbaD_flush_cache(acb);
                break;
        case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F:
                arcmsr_hbaE_flush_cache(acb);
                break;
        }
@@ -626,6 +638,27 @@ static void arcmsr_hbaD_assign_regAddr(struct AdapterControlBlock *acb)
        reg->msgcode_rwbuffer = MEM_BASE0(ARCMSR_ARC1214_MESSAGE_RWBUFFER);
 }
 
+static void arcmsr_hbaF_assign_regAddr(struct AdapterControlBlock *acb)
+{
+       dma_addr_t host_buffer_dma;
+       struct MessageUnit_F __iomem *pmuF;
+
+       memset(acb->dma_coherent2, 0xff, acb->completeQ_size);
+       acb->message_wbuffer = (uint32_t *)round_up((unsigned long)acb->dma_coherent2 +
+               acb->completeQ_size, 4);
+       acb->message_rbuffer = ((void *)acb->message_wbuffer) + 0x100;
+       acb->msgcode_rwbuffer = ((void *)acb->message_wbuffer) + 0x200;
+       memset((void *)acb->message_wbuffer, 0, MESG_RW_BUFFER_SIZE);
+       host_buffer_dma = round_up(acb->dma_coherent_handle2 + acb->completeQ_size, 4);
+       pmuF = acb->pmuF;
+       /* host buffer low address, bit0:1 all buffer active */
+       writel(lower_32_bits(host_buffer_dma | 1), &pmuF->inbound_msgaddr0);
+       /* host buffer high address */
+       writel(upper_32_bits(host_buffer_dma), &pmuF->inbound_msgaddr1);
+       /* set host buffer physical address */
+       writel(ARCMSR_HBFMU_DOORBELL_SYNC1, &pmuF->iobound_doorbell);
+}
+
 static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb)
 {
        bool rtn = true;
@@ -679,6 +712,28 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb)
                acb->doneq_index = 0;
                }
                break;
+       case ACB_ADAPTER_TYPE_F: {
+               uint32_t QueueDepth;
+               uint32_t depthTbl[] = {256, 512, 1024, 128, 64, 32};
+
+               arcmsr_wait_firmware_ready(acb);
+               QueueDepth = depthTbl[readl(&acb->pmuF->outbound_msgaddr1) & 7];
+               acb->completeQ_size = sizeof(struct deliver_completeQ) * QueueDepth + 128;
+               acb->ioqueue_size = roundup(acb->completeQ_size + MESG_RW_BUFFER_SIZE, 32);
+               dma_coherent = dma_alloc_coherent(&pdev->dev, acb->ioqueue_size,
+                       &dma_coherent_handle, GFP_KERNEL);
+               if (!dma_coherent) {
+                       pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no);
+                       return false;
+               }
+               acb->dma_coherent_handle2 = dma_coherent_handle;
+               acb->dma_coherent2 = dma_coherent;
+               acb->pCompletionQ = dma_coherent;
+               acb->completionQ_entry = acb->completeQ_size / sizeof(struct deliver_completeQ);
+               acb->doneq_index = 0;
+               arcmsr_hbaF_assign_regAddr(acb);
+               }
+               break;
        default:
                break;
        }
@@ -713,7 +768,8 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb)
        acb->host->sg_tablesize = max_sg_entrys;
        roundup_ccbsize = roundup(sizeof(struct CommandControlBlock) + (max_sg_entrys - 1) * sizeof(struct SG64ENTRY), 32);
        acb->uncache_size = roundup_ccbsize * acb->maxFreeCCB;
-       acb->uncache_size += acb->ioqueue_size;
+       if (acb->adapter_type != ACB_ADAPTER_TYPE_F)
+               acb->uncache_size += acb->ioqueue_size;
        dma_coherent = dma_alloc_coherent(&pdev->dev, acb->uncache_size, &dma_coherent_handle, GFP_KERNEL);
        if(!dma_coherent){
                printk(KERN_NOTICE "arcmsr%d: dma_alloc_coherent got error\n", acb->host->host_no);
@@ -736,6 +792,7 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb)
                case ACB_ADAPTER_TYPE_C:
                case ACB_ADAPTER_TYPE_D:
                case ACB_ADAPTER_TYPE_E:
+               case ACB_ADAPTER_TYPE_F:
                        ccb_tmp->cdb_phyaddr = cdb_phyaddr;
                        break;
                }
@@ -754,8 +811,10 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb)
                ccb_tmp = (struct CommandControlBlock *)((unsigned long)ccb_tmp + roundup_ccbsize);
                dma_coherent_handle = next_ccb_phy;
        }
-       acb->dma_coherent_handle2 = dma_coherent_handle;
-       acb->dma_coherent2 = ccb_tmp;
+       if (acb->adapter_type != ACB_ADAPTER_TYPE_F) {
+               acb->dma_coherent_handle2 = dma_coherent_handle;
+               acb->dma_coherent2 = ccb_tmp;
+       }
        switch (acb->adapter_type) {
        case ACB_ADAPTER_TYPE_B:
                acb->pmuB = (struct MessageUnit_B *)acb->dma_coherent2;
@@ -785,7 +844,6 @@ static void arcmsr_message_isr_bh_fn(struct work_struct *work)
        struct scsi_device *psdev;
        char diff, temp;
 
-       acb->acb_flags &= ~ACB_F_MSG_GET_CONFIG;
        switch (acb->adapter_type) {
        case ACB_ADAPTER_TYPE_A: {
                struct MessageUnit_A __iomem *reg  = acb->pmuA;
@@ -822,8 +880,12 @@ static void arcmsr_message_isr_bh_fn(struct work_struct *work)
                devicemap = (char __iomem *)(&reg->msgcode_rwbuffer[21]);
                break;
                }
+       case ACB_ADAPTER_TYPE_F: {
+               signature = (uint32_t __iomem *)(&acb->msgcode_rwbuffer[0]);
+               devicemap = (char __iomem *)(&acb->msgcode_rwbuffer[21]);
+               break;
+               }
        }
-       atomic_inc(&acb->rq_map_token);
        if (readl(signature) != ARCMSR_SIGNATURE_GET_CONFIG)
                return;
        for (target = 0; target < ARCMSR_MAX_TARGETID - 1;
@@ -854,6 +916,7 @@ static void arcmsr_message_isr_bh_fn(struct work_struct *work)
                devicemap++;
                acb_dev_map++;
        }
+       acb->acb_flags &= ~ACB_F_MSG_GET_CONFIG;
 }
 
 static int
@@ -906,8 +969,6 @@ out_free_irq:
 static void arcmsr_init_get_devmap_timer(struct AdapterControlBlock *pacb)
 {
        INIT_WORK(&pacb->arcmsr_do_message_isr_bh, arcmsr_message_isr_bh_fn);
-       atomic_set(&pacb->rq_map_token, 16);
-       atomic_set(&pacb->ante_token_value, 16);
        pacb->fw_flag = FW_NORMAL;
        timer_setup(&pacb->eternal_timer, arcmsr_request_device_map, 0);
        pacb->eternal_timer.expires = jiffies + msecs_to_jiffies(6 * HZ);
@@ -1009,7 +1070,8 @@ static int arcmsr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        if(!error){
                goto free_hbb_mu;
        }
-       arcmsr_free_io_queue(acb);
+       if (acb->adapter_type != ACB_ADAPTER_TYPE_F)
+               arcmsr_free_io_queue(acb);
        error = arcmsr_alloc_ccb_pool(acb);
        if(error){
                goto unmap_pci_region;
@@ -1122,6 +1184,14 @@ static int arcmsr_resume(struct pci_dev *pdev)
                acb->out_doorbell = 0;
                acb->doneq_index = 0;
                break;
+       case ACB_ADAPTER_TYPE_F:
+               writel(0, &acb->pmuF->host_int_status);
+               writel(ARCMSR_HBFMU_DOORBELL_SYNC, &acb->pmuF->iobound_doorbell);
+               acb->in_doorbell = 0;
+               acb->out_doorbell = 0;
+               acb->doneq_index = 0;
+               arcmsr_hbaF_assign_regAddr(acb);
+               break;
        }
        arcmsr_iop_init(acb);
        arcmsr_init_get_devmap_timer(acb);
@@ -1134,6 +1204,8 @@ controller_stop:
 controller_unregister:
        scsi_remove_host(host);
        arcmsr_free_ccb_pool(acb);
+       if (acb->adapter_type == ACB_ADAPTER_TYPE_F)
+               arcmsr_free_io_queue(acb);
        arcmsr_unmap_pciregion(acb);
        pci_release_regions(pdev);
        scsi_host_put(host);
@@ -1213,25 +1285,20 @@ static uint8_t arcmsr_abort_allcmd(struct AdapterControlBlock *acb)
 {
        uint8_t rtnval = 0;
        switch (acb->adapter_type) {
-       case ACB_ADAPTER_TYPE_A: {
+       case ACB_ADAPTER_TYPE_A:
                rtnval = arcmsr_hbaA_abort_allcmd(acb);
-               }
                break;
-
-       case ACB_ADAPTER_TYPE_B: {
+       case ACB_ADAPTER_TYPE_B:
                rtnval = arcmsr_hbaB_abort_allcmd(acb);
-               }
                break;
-
-       case ACB_ADAPTER_TYPE_C: {
+       case ACB_ADAPTER_TYPE_C:
                rtnval = arcmsr_hbaC_abort_allcmd(acb);
-               }
                break;
-
        case ACB_ADAPTER_TYPE_D:
                rtnval = arcmsr_hbaD_abort_allcmd(acb);
                break;
        case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F:
                rtnval = arcmsr_hbaE_abort_allcmd(acb);
                break;
        }
@@ -1307,7 +1374,8 @@ static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb)
                writel(ARCMSR_ARC1214_ALL_INT_DISABLE, reg->pcief0_int_enable);
                }
                break;
-       case ACB_ADAPTER_TYPE_E: {
+       case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F: {
                struct MessageUnit_E __iomem *reg = acb->pmuE;
                orig_mask = readl(&reg->host_int_mask);
                writel(orig_mask | ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR | ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR, &reg->host_int_mask);
@@ -1514,6 +1582,9 @@ static void arcmsr_done4abort_postqueue(struct AdapterControlBlock *acb)
        case ACB_ADAPTER_TYPE_E:
                arcmsr_hbaE_postqueue_isr(acb);
                break;
+       case ACB_ADAPTER_TYPE_F:
+               arcmsr_hbaF_postqueue_isr(acb);
+               break;
        }
 }
 
@@ -1568,6 +1639,8 @@ static void arcmsr_free_pcidev(struct AdapterControlBlock *acb)
        pdev = acb->pdev;
        arcmsr_free_irq(pdev, acb);
        arcmsr_free_ccb_pool(acb);
+       if (acb->adapter_type == ACB_ADAPTER_TYPE_F)
+               arcmsr_free_io_queue(acb);
        arcmsr_unmap_pciregion(acb);
        pci_release_regions(pdev);
        scsi_host_put(host);
@@ -1625,6 +1698,8 @@ static void arcmsr_remove(struct pci_dev *pdev)
        }
        arcmsr_free_irq(pdev, acb);
        arcmsr_free_ccb_pool(acb);
+       if (acb->adapter_type == ACB_ADAPTER_TYPE_F)
+               arcmsr_free_io_queue(acb);
        arcmsr_unmap_pciregion(acb);
        pci_release_regions(pdev);
        scsi_host_put(host);
@@ -1702,7 +1777,8 @@ static void arcmsr_enable_outbound_ints(struct AdapterControlBlock *acb,
                writel(intmask_org | mask, reg->pcief0_int_enable);
                break;
                }
-       case ACB_ADAPTER_TYPE_E: {
+       case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F: {
                struct MessageUnit_E __iomem *reg = acb->pmuE;
 
                mask = ~(ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR | ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR);
@@ -1846,6 +1922,19 @@ static void arcmsr_post_ccb(struct AdapterControlBlock *acb, struct CommandContr
                writel(ccb_post_stamp, &pmu->inbound_queueport_low);
                break;
                }
+       case ACB_ADAPTER_TYPE_F: {
+               struct MessageUnit_F __iomem *pmu = acb->pmuF;
+               u32 ccb_post_stamp, arc_cdb_size;
+
+               if (ccb->arc_cdb_size <= 0x300)
+                       arc_cdb_size = (ccb->arc_cdb_size - 1) >> 6 | 1;
+               else
+                       arc_cdb_size = (((ccb->arc_cdb_size + 0xff) >> 8) + 2) << 1 | 1;
+               ccb_post_stamp = (ccb->smid | arc_cdb_size);
+               writel(0, &pmu->inbound_queueport_high);
+               writel(ccb_post_stamp, &pmu->inbound_queueport_low);
+               break;
+               }
        }
 }
 
@@ -1916,23 +2005,20 @@ static void arcmsr_hbaE_stop_bgrb(struct AdapterControlBlock *pACB)
 static void arcmsr_stop_adapter_bgrb(struct AdapterControlBlock *acb)
 {
        switch (acb->adapter_type) {
-       case ACB_ADAPTER_TYPE_A: {
+       case ACB_ADAPTER_TYPE_A:
                arcmsr_hbaA_stop_bgrb(acb);
-               }
                break;
-
-       case ACB_ADAPTER_TYPE_B: {
+       case ACB_ADAPTER_TYPE_B:
                arcmsr_hbaB_stop_bgrb(acb);
-               }
                break;
-       case ACB_ADAPTER_TYPE_C: {
+       case ACB_ADAPTER_TYPE_C:
                arcmsr_hbaC_stop_bgrb(acb);
-               }
                break;
        case ACB_ADAPTER_TYPE_D:
                arcmsr_hbaD_stop_bgrb(acb);
                break;
        case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F:
                arcmsr_hbaE_stop_bgrb(acb);
                break;
        }
@@ -1951,7 +2037,6 @@ static void arcmsr_iop_message_read(struct AdapterControlBlock *acb)
                writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, &reg->inbound_doorbell);
                }
                break;
-
        case ACB_ADAPTER_TYPE_B: {
                struct MessageUnit_B *reg = acb->pmuB;
                writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell);
@@ -1969,7 +2054,8 @@ static void arcmsr_iop_message_read(struct AdapterControlBlock *acb)
                        reg->inbound_doorbell);
                }
                break;
-       case ACB_ADAPTER_TYPE_E: {
+       case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F: {
                struct MessageUnit_E __iomem *reg = acb->pmuE;
                acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_DATA_READ_OK;
                writel(acb->out_doorbell, &reg->iobound_doorbell);
@@ -2015,7 +2101,8 @@ static void arcmsr_iop_message_wrote(struct AdapterControlBlock *acb)
                        reg->inbound_doorbell);
                }
                break;
-       case ACB_ADAPTER_TYPE_E: {
+       case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F: {
                struct MessageUnit_E __iomem *reg = acb->pmuE;
                acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_DATA_WRITE_OK;
                writel(acb->out_doorbell, &reg->iobound_doorbell);
@@ -2034,7 +2121,6 @@ struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *acb)
                qbuffer = (struct QBUFFER __iomem *)&reg->message_rbuffer;
                }
                break;
-
        case ACB_ADAPTER_TYPE_B: {
                struct MessageUnit_B *reg = acb->pmuB;
                qbuffer = (struct QBUFFER __iomem *)reg->message_rbuffer;
@@ -2055,6 +2141,10 @@ struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *acb)
                qbuffer = (struct QBUFFER __iomem *)&reg->message_rbuffer;
                }
                break;
+       case ACB_ADAPTER_TYPE_F: {
+               qbuffer = (struct QBUFFER __iomem *)acb->message_rbuffer;
+               }
+               break;
        }
        return qbuffer;
 }
@@ -2069,7 +2159,6 @@ static struct QBUFFER __iomem *arcmsr_get_iop_wqbuffer(struct AdapterControlBloc
                pqbuffer = (struct QBUFFER __iomem *) &reg->message_wbuffer;
                }
                break;
-
        case ACB_ADAPTER_TYPE_B: {
                struct MessageUnit_B  *reg = acb->pmuB;
                pqbuffer = (struct QBUFFER __iomem *)reg->message_wbuffer;
@@ -2090,6 +2179,9 @@ static struct QBUFFER __iomem *arcmsr_get_iop_wqbuffer(struct AdapterControlBloc
                pqbuffer = (struct QBUFFER __iomem *)&reg->message_wbuffer;
                }
                break;
+       case ACB_ADAPTER_TYPE_F:
+               pqbuffer = (struct QBUFFER __iomem *)acb->message_wbuffer;
+               break;
        }
        return pqbuffer;
 }
@@ -2504,6 +2596,36 @@ static void arcmsr_hbaE_postqueue_isr(struct AdapterControlBlock *acb)
        spin_unlock_irqrestore(&acb->doneq_lock, flags);
 }
 
+static void arcmsr_hbaF_postqueue_isr(struct AdapterControlBlock *acb)
+{
+       uint32_t doneq_index;
+       uint16_t cmdSMID;
+       int error;
+       struct MessageUnit_F __iomem *phbcmu;
+       struct CommandControlBlock *ccb;
+       unsigned long flags;
+
+       spin_lock_irqsave(&acb->doneq_lock, flags);
+       doneq_index = acb->doneq_index;
+       phbcmu = acb->pmuF;
+       while (1) {
+               cmdSMID = acb->pCompletionQ[doneq_index].cmdSMID;
+               if (cmdSMID == 0xffff)
+                       break;
+               ccb = acb->pccb_pool[cmdSMID];
+               error = (acb->pCompletionQ[doneq_index].cmdFlag &
+                       ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ? true : false;
+               arcmsr_drain_donequeue(acb, ccb, error);
+               acb->pCompletionQ[doneq_index].cmdSMID = 0xffff;
+               doneq_index++;
+               if (doneq_index >= acb->completionQ_entry)
+                       doneq_index = 0;
+       }
+       acb->doneq_index = doneq_index;
+       writel(doneq_index, &phbcmu->reply_post_consumer_index);
+       spin_unlock_irqrestore(&acb->doneq_lock, flags);
+}
+
 /*
 **********************************************************************************
 ** Handle a message interrupt
@@ -2694,21 +2816,46 @@ static irqreturn_t arcmsr_hbaE_handle_isr(struct AdapterControlBlock *pACB)
        return IRQ_HANDLED;
 }
 
+static irqreturn_t arcmsr_hbaF_handle_isr(struct AdapterControlBlock *pACB)
+{
+       uint32_t host_interrupt_status;
+       struct MessageUnit_F __iomem *phbcmu = pACB->pmuF;
+
+       host_interrupt_status = readl(&phbcmu->host_int_status) &
+               (ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR |
+               ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR);
+       if (!host_interrupt_status)
+               return IRQ_NONE;
+       do {
+               /* MU post queue interrupts*/
+               if (host_interrupt_status & ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR)
+                       arcmsr_hbaF_postqueue_isr(pACB);
+
+               /* MU ioctl transfer doorbell interrupts*/
+               if (host_interrupt_status & ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR)
+                       arcmsr_hbaE_doorbell_isr(pACB);
+
+               host_interrupt_status = readl(&phbcmu->host_int_status);
+       } while (host_interrupt_status & (ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR |
+               ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR));
+       return IRQ_HANDLED;
+}
+
 static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb)
 {
        switch (acb->adapter_type) {
        case ACB_ADAPTER_TYPE_A:
                return arcmsr_hbaA_handle_isr(acb);
-               break;
        case ACB_ADAPTER_TYPE_B:
                return arcmsr_hbaB_handle_isr(acb);
-               break;
        case ACB_ADAPTER_TYPE_C:
                return arcmsr_hbaC_handle_isr(acb);
        case ACB_ADAPTER_TYPE_D:
                return arcmsr_hbaD_handle_isr(acb);
        case ACB_ADAPTER_TYPE_E:
                return arcmsr_hbaE_handle_isr(acb);
+       case ACB_ADAPTER_TYPE_F:
+               return arcmsr_hbaF_handle_isr(acb);
        default:
                return IRQ_NONE;
        }
@@ -3257,6 +3404,31 @@ static bool arcmsr_hbaE_get_config(struct AdapterControlBlock *pACB)
        return true;
 }
 
+static bool arcmsr_hbaF_get_config(struct AdapterControlBlock *pACB)
+{
+       struct MessageUnit_F __iomem *reg = pACB->pmuF;
+       uint32_t intmask_org;
+
+       /* disable all outbound interrupt */
+       intmask_org = readl(&reg->host_int_mask); /* disable outbound message0 int */
+       writel(intmask_org | ARCMSR_HBEMU_ALL_INTMASKENABLE, &reg->host_int_mask);
+       /* wait firmware ready */
+       arcmsr_wait_firmware_ready(pACB);
+       /* post "get config" instruction */
+       writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, &reg->inbound_msgaddr0);
+
+       pACB->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE;
+       writel(pACB->out_doorbell, &reg->iobound_doorbell);
+       /* wait message ready */
+       if (!arcmsr_hbaE_wait_msgint_ready(pACB)) {
+               pr_notice("arcmsr%d: wait get adapter firmware miscellaneous data timeout\n",
+                         pACB->host->host_no);
+               return false;
+       }
+       arcmsr_get_adapter_config(pACB, pACB->msgcode_rwbuffer);
+       return true;
+}
+
 static bool arcmsr_get_firmware_spec(struct AdapterControlBlock *acb)
 {
        bool rtn = false;
@@ -3277,6 +3449,9 @@ static bool arcmsr_get_firmware_spec(struct AdapterControlBlock *acb)
        case ACB_ADAPTER_TYPE_E:
                rtn = arcmsr_hbaE_get_config(acb);
                break;
+       case ACB_ADAPTER_TYPE_F:
+               rtn = arcmsr_hbaF_get_config(acb);
+               break;
        default:
                break;
        }
@@ -3634,23 +3809,20 @@ static int arcmsr_polling_ccbdone(struct AdapterControlBlock *acb,
        int rtn = 0;
        switch (acb->adapter_type) {
 
-       case ACB_ADAPTER_TYPE_A: {
+       case ACB_ADAPTER_TYPE_A:
                rtn = arcmsr_hbaA_polling_ccbdone(acb, poll_ccb);
-               }
                break;
-
-       case ACB_ADAPTER_TYPE_B: {
+       case ACB_ADAPTER_TYPE_B:
                rtn = arcmsr_hbaB_polling_ccbdone(acb, poll_ccb);
-               }
                break;
-       case ACB_ADAPTER_TYPE_C: {
+       case ACB_ADAPTER_TYPE_C:
                rtn = arcmsr_hbaC_polling_ccbdone(acb, poll_ccb);
-               }
                break;
        case ACB_ADAPTER_TYPE_D:
                rtn = arcmsr_hbaD_polling_ccbdone(acb, poll_ccb);
                break;
        case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F:
                rtn = arcmsr_hbaE_polling_ccbdone(acb, poll_ccb);
                break;
        }
@@ -3731,6 +3903,16 @@ static void arcmsr_set_iop_datetime(struct timer_list *t)
                        writel(pacb->out_doorbell, &reg->iobound_doorbell);
                        break;
                }
+               case ACB_ADAPTER_TYPE_F: {
+                       struct MessageUnit_F __iomem *reg = pacb->pmuF;
+
+                       pacb->msgcode_rwbuffer[0] = datetime.b.msg_time[0];
+                       pacb->msgcode_rwbuffer[1] = datetime.b.msg_time[1];
+                       writel(ARCMSR_INBOUND_MESG0_SYNC_TIMER, &reg->inbound_msgaddr0);
+                       pacb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE;
+                       writel(pacb->out_doorbell, &reg->iobound_doorbell);
+                       break;
+               }
        }
        if (sys_tz.tz_minuteswest)
                next_time = ARCMSR_HOURS;
@@ -3756,6 +3938,7 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb)
                dma_coherent_handle = acb->dma_coherent_handle2;
                break;
        case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F:
                dma_coherent_handle = acb->dma_coherent_handle +
                        offsetof(struct CommandControlBlock, arcmsr_cdb);
                break;
@@ -3873,11 +4056,8 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb)
                writel(cdb_phyaddr, &reg->msgcode_rwbuffer[2]);
                writel(cdb_phyaddr_hi32, &reg->msgcode_rwbuffer[3]);
                writel(acb->ccbsize, &reg->msgcode_rwbuffer[4]);
-               dma_coherent_handle = acb->dma_coherent_handle2;
-               cdb_phyaddr = (uint32_t)(dma_coherent_handle & 0xffffffff);
-               cdb_phyaddr_hi32 = (uint32_t)((dma_coherent_handle >> 16) >> 16);
-               writel(cdb_phyaddr, &reg->msgcode_rwbuffer[5]);
-               writel(cdb_phyaddr_hi32, &reg->msgcode_rwbuffer[6]);
+               writel(lower_32_bits(acb->dma_coherent_handle2), &reg->msgcode_rwbuffer[5]);
+               writel(upper_32_bits(acb->dma_coherent_handle2), &reg->msgcode_rwbuffer[6]);
                writel(acb->ioqueue_size, &reg->msgcode_rwbuffer[7]);
                writel(ARCMSR_INBOUND_MESG0_SET_CONFIG, &reg->inbound_msgaddr0);
                acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE;
@@ -3889,6 +4069,27 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb)
                }
                }
                break;
+       case ACB_ADAPTER_TYPE_F: {
+               struct MessageUnit_F __iomem *reg = acb->pmuF;
+
+               acb->msgcode_rwbuffer[0] = ARCMSR_SIGNATURE_SET_CONFIG;
+               acb->msgcode_rwbuffer[1] = ARCMSR_SIGNATURE_1886;
+               acb->msgcode_rwbuffer[2] = cdb_phyaddr;
+               acb->msgcode_rwbuffer[3] = cdb_phyaddr_hi32;
+               acb->msgcode_rwbuffer[4] = acb->ccbsize;
+               acb->msgcode_rwbuffer[5] = lower_32_bits(acb->dma_coherent_handle2);
+               acb->msgcode_rwbuffer[6] = upper_32_bits(acb->dma_coherent_handle2);
+               acb->msgcode_rwbuffer[7] = acb->completeQ_size;
+               writel(ARCMSR_INBOUND_MESG0_SET_CONFIG, &reg->inbound_msgaddr0);
+               acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE;
+               writel(acb->out_doorbell, &reg->iobound_doorbell);
+               if (!arcmsr_hbaE_wait_msgint_ready(acb)) {
+                       pr_notice("arcmsr%d: 'set command Q window' timeout\n",
+                               acb->host->host_no);
+                       return 1;
+               }
+               }
+               break;
        }
        return 0;
 }
@@ -3937,7 +4138,8 @@ static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb)
                        ARCMSR_ARC1214_MESSAGE_FIRMWARE_OK) == 0);
                }
                break;
-       case ACB_ADAPTER_TYPE_E: {
+       case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F: {
                struct MessageUnit_E __iomem *reg = acb->pmuE;
                do {
                        if (!(acb->acb_flags & ACB_F_IOP_INITED))
@@ -3952,24 +4154,10 @@ static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb)
 static void arcmsr_request_device_map(struct timer_list *t)
 {
        struct AdapterControlBlock *acb = from_timer(acb, t, eternal_timer);
-       if (unlikely(atomic_read(&acb->rq_map_token) == 0) ||
-               (acb->acb_flags & ACB_F_BUS_RESET) ||
-               (acb->acb_flags & ACB_F_ABORT)) {
-               mod_timer(&acb->eternal_timer,
-                       jiffies + msecs_to_jiffies(6 * HZ));
+       if (acb->acb_flags & (ACB_F_MSG_GET_CONFIG | ACB_F_BUS_RESET | ACB_F_ABORT)) {
+               mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ));
        } else {
                acb->fw_flag = FW_NORMAL;
-               if (atomic_read(&acb->ante_token_value) ==
-                       atomic_read(&acb->rq_map_token)) {
-                       atomic_set(&acb->rq_map_token, 16);
-               }
-               atomic_set(&acb->ante_token_value,
-                       atomic_read(&acb->rq_map_token));
-               if (atomic_dec_and_test(&acb->rq_map_token)) {
-                       mod_timer(&acb->eternal_timer, jiffies +
-                               msecs_to_jiffies(6 * HZ));
-                       return;
-               }
                switch (acb->adapter_type) {
                case ACB_ADAPTER_TYPE_A: {
                        struct MessageUnit_A __iomem *reg = acb->pmuA;
@@ -3999,10 +4187,23 @@ static void arcmsr_request_device_map(struct timer_list *t)
                        writel(acb->out_doorbell, &reg->iobound_doorbell);
                        break;
                        }
+               case ACB_ADAPTER_TYPE_F: {
+                       struct MessageUnit_F __iomem *reg = acb->pmuF;
+                       uint32_t outMsg1 = readl(&reg->outbound_msgaddr1);
+
+                       if (!(outMsg1 & ARCMSR_HBFMU_MESSAGE_FIRMWARE_OK) ||
+                               (outMsg1 & ARCMSR_HBFMU_MESSAGE_NO_VOLUME_CHANGE))
+                               goto nxt6s;
+                       writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, &reg->inbound_msgaddr0);
+                       acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE;
+                       writel(acb->out_doorbell, &reg->iobound_doorbell);
+                       break;
+                       }
                default:
                        return;
                }
                acb->acb_flags |= ACB_F_MSG_GET_CONFIG;
+nxt6s:
                mod_timer(&acb->eternal_timer, jiffies + msecs_to_jiffies(6 * HZ));
        }
 }
@@ -4084,6 +4285,7 @@ static void arcmsr_start_adapter_bgrb(struct AdapterControlBlock *acb)
                arcmsr_hbaD_start_bgrb(acb);
                break;
        case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F:
                arcmsr_hbaE_start_bgrb(acb);
                break;
        }
@@ -4163,7 +4365,8 @@ static void arcmsr_clear_doorbell_queue_buffer(struct AdapterControlBlock *acb)
                }
                }
                break;
-       case ACB_ADAPTER_TYPE_E: {
+       case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F: {
                struct MessageUnit_E __iomem *reg = acb->pmuE;
                uint32_t i, tmp;
 
@@ -4290,7 +4493,8 @@ static bool arcmsr_reset_in_progress(struct AdapterControlBlock *acb)
                        true : false;
                }
                break;
-       case ACB_ADAPTER_TYPE_E:{
+       case ACB_ADAPTER_TYPE_E:
+       case ACB_ADAPTER_TYPE_F:{
                struct MessageUnit_E __iomem *reg = acb->pmuE;
                rtn = (readl(&reg->host_diagnostic_3xxx) &
                        ARCMSR_ARC188X_RESET_ADAPTER) ? true : false;
@@ -4389,8 +4593,6 @@ wait_reset_done:
                        goto wait_reset_done;
                }
                arcmsr_iop_init(acb);
-               atomic_set(&acb->rq_map_token, 16);
-               atomic_set(&acb->ante_token_value, 16);
                acb->fw_flag = FW_NORMAL;
                mod_timer(&acb->eternal_timer, jiffies +
                        msecs_to_jiffies(6 * HZ));
@@ -4399,8 +4601,6 @@ wait_reset_done:
                pr_notice("arcmsr: scsi bus reset eh returns with success\n");
        } else {
                acb->acb_flags &= ~ACB_F_BUS_RESET;
-               atomic_set(&acb->rq_map_token, 16);
-               atomic_set(&acb->ante_token_value, 16);
                acb->fw_flag = FW_NORMAL;
                mod_timer(&acb->eternal_timer, jiffies +
                        msecs_to_jiffies(6 * HZ));
@@ -4493,6 +4693,9 @@ static const char *arcmsr_info(struct Scsi_Host *host)
        case PCI_DEVICE_ID_ARECA_1884:
                type = "SAS/SATA";
                break;
+       case PCI_DEVICE_ID_ARECA_1886:
+               type = "NVMe/SAS/SATA";
+               break;
        default:
                type = "unknown";
                raid6 = 0;
index bc5d84f..440ef32 100644 (file)
@@ -749,6 +749,7 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
 
        if (bfad->pci_bar0_kva == NULL) {
                printk(KERN_ERR "Fail to map bar0\n");
+               rc = -ENODEV;
                goto out_release_region;
        }
 
index 0c251a3..fa16894 100644 (file)
@@ -4721,30 +4721,7 @@ static struct pci_driver dc395x_driver = {
        .probe          = dc395x_init_one,
        .remove         = dc395x_remove_one,
 };
-
-
-/**
- * dc395x_module_init - Module initialization function
- *
- * Used by both module and built-in driver to initialise this driver.
- **/
-static int __init dc395x_module_init(void)
-{
-       return pci_register_driver(&dc395x_driver);
-}
-
-
-/**
- * dc395x_module_exit - Module cleanup function.
- **/
-static void __exit dc395x_module_exit(void)
-{
-       pci_unregister_driver(&dc395x_driver);
-}
-
-
-module_init(dc395x_module_init);
-module_exit(dc395x_module_exit);
+module_pci_driver(dc395x_driver);
 
 MODULE_AUTHOR("C.L. Huang / Erich Chen / Kurt Garloff");
 MODULE_DESCRIPTION("SCSI host adapter driver for Tekram TRM-S1040 based adapters: Tekram DC395 and DC315 series");
index f32da0c..308bda2 100644 (file)
@@ -658,8 +658,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
                                        rcu_read_lock();
                                        list_for_each_entry_rcu(h,
                                                &tmp_pg->dh_list, node) {
-                                               /* h->sdev should always be valid */
-                                               BUG_ON(!h->sdev);
+                                               if (!h->sdev)
+                                                       continue;
                                                h->sdev->access_state = desc[0];
                                        }
                                        rcu_read_unlock();
@@ -705,7 +705,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
                        pg->expiry = 0;
                        rcu_read_lock();
                        list_for_each_entry_rcu(h, &pg->dh_list, node) {
-                               BUG_ON(!h->sdev);
+                               if (!h->sdev)
+                                       continue;
                                h->sdev->access_state =
                                        (pg->state & SCSI_ACCESS_STATE_MASK);
                                if (pg->pref)
@@ -1147,7 +1148,6 @@ static void alua_bus_detach(struct scsi_device *sdev)
        spin_lock(&h->pg_lock);
        pg = rcu_dereference_protected(h->pg, lockdep_is_held(&h->pg_lock));
        rcu_assign_pointer(h->pg, NULL);
-       h->sdev = NULL;
        spin_unlock(&h->pg_lock);
        if (pg) {
                spin_lock_irq(&pg->lock);
@@ -1156,6 +1156,7 @@ static void alua_bus_detach(struct scsi_device *sdev)
                kref_put(&pg->kref, release_port_group);
        }
        sdev->handler_data = NULL;
+       synchronize_rcu();
        kfree(h);
 }
 
index 2cb7a8c..ffef2c8 100644 (file)
@@ -1053,16 +1053,10 @@ EXPORT_SYMBOL_GPL(fcoe_fcf_device_add);
 
 int __init fcoe_sysfs_setup(void)
 {
-       int error;
-
        atomic_set(&ctlr_num, 0);
        atomic_set(&fcf_num, 0);
 
-       error = bus_register(&fcoe_bus_type);
-       if (error)
-               return error;
-
-       return 0;
+       return bus_register(&fcoe_bus_type);
 }
 
 void __exit fcoe_sysfs_teardown(void)
index 9eab7e7..7b18635 100644 (file)
@@ -79,8 +79,6 @@ int vnic_wq_copy_alloc(struct vnic_dev *vdev, struct vnic_wq_copy *wq,
                       unsigned int index, unsigned int desc_count,
                       unsigned int desc_size)
 {
-       int err;
-
        wq->index = index;
        wq->vdev = vdev;
        wq->to_use_index = wq->to_clean_index = 0;
@@ -92,11 +90,7 @@ int vnic_wq_copy_alloc(struct vnic_dev *vdev, struct vnic_wq_copy *wq,
 
        vnic_wq_copy_disable(wq);
 
-       err = vnic_dev_alloc_desc_ring(vdev, &wq->ring, desc_count, desc_size);
-       if (err)
-               return err;
-
-       return 0;
+       return vnic_dev_alloc_desc_ring(vdev, &wq->ring, desc_count, desc_size);
 }
 
 void vnic_wq_copy_init(struct vnic_wq_copy *wq, unsigned int cq_index,
index dc0e177..5d80138 100644 (file)
@@ -3168,81 +3168,6 @@ static inline void gdth_timer_init(void)
 }
 #endif
 
-static void __init internal_setup(char *str,int *ints)
-{
-    int i;
-    char *cur_str, *argv;
-
-    TRACE2(("internal_setup() str %s ints[0] %d\n", 
-            str ? str:"NULL", ints ? ints[0]:0));
-
-    /* analyse string */
-    argv = str;
-    while (argv && (cur_str = strchr(argv, ':'))) {
-        int val = 0, c = *++cur_str;
-        
-        if (c == 'n' || c == 'N')
-            val = 0;
-        else if (c == 'y' || c == 'Y')
-            val = 1;
-        else
-            val = (int)simple_strtoul(cur_str, NULL, 0);
-
-        if (!strncmp(argv, "disable:", 8))
-            disable = val;
-        else if (!strncmp(argv, "reserve_mode:", 13))
-            reserve_mode = val;
-        else if (!strncmp(argv, "reverse_scan:", 13))
-            reverse_scan = val;
-        else if (!strncmp(argv, "hdr_channel:", 12))
-            hdr_channel = val;
-        else if (!strncmp(argv, "max_ids:", 8))
-            max_ids = val;
-        else if (!strncmp(argv, "rescan:", 7))
-            rescan = val;
-        else if (!strncmp(argv, "shared_access:", 14))
-            shared_access = val;
-        else if (!strncmp(argv, "reserve_list:", 13)) {
-            reserve_list[0] = val;
-            for (i = 1; i < MAX_RES_ARGS; i++) {
-                cur_str = strchr(cur_str, ',');
-                if (!cur_str)
-                    break;
-                if (!isdigit((int)*++cur_str)) {
-                    --cur_str;          
-                    break;
-                }
-                reserve_list[i] = 
-                    (int)simple_strtoul(cur_str, NULL, 0);
-            }
-            if (!cur_str)
-                break;
-            argv = ++cur_str;
-            continue;
-        }
-
-        if ((argv = strchr(argv, ',')))
-            ++argv;
-    }
-}
-
-int __init option_setup(char *str)
-{
-    int ints[MAXHA];
-    char *cur = str;
-    int i = 1;
-
-    TRACE2(("option_setup() str %s\n", str ? str:"NULL")); 
-
-    while (cur && isdigit(*cur) && i < MAXHA) {
-        ints[i++] = simple_strtoul(cur, NULL, 0);
-        if ((cur = strchr(cur, ',')) != NULL) cur++;
-    }
-
-    ints[0] = i - 1;
-    internal_setup(cur, ints);
-    return 1;
-}
 
 static const char *gdth_ctr_name(gdth_ha_str *ha)
 {
@@ -4317,5 +4242,81 @@ module_init(gdth_init);
 module_exit(gdth_exit);
 
 #ifndef MODULE
+static void __init internal_setup(char *str,int *ints)
+{
+    int i;
+    char *cur_str, *argv;
+
+    TRACE2(("internal_setup() str %s ints[0] %d\n",
+            str ? str:"NULL", ints ? ints[0]:0));
+
+    /* analyse string */
+    argv = str;
+    while (argv && (cur_str = strchr(argv, ':'))) {
+        int val = 0, c = *++cur_str;
+
+        if (c == 'n' || c == 'N')
+            val = 0;
+        else if (c == 'y' || c == 'Y')
+            val = 1;
+        else
+            val = (int)simple_strtoul(cur_str, NULL, 0);
+
+        if (!strncmp(argv, "disable:", 8))
+            disable = val;
+        else if (!strncmp(argv, "reserve_mode:", 13))
+            reserve_mode = val;
+        else if (!strncmp(argv, "reverse_scan:", 13))
+            reverse_scan = val;
+        else if (!strncmp(argv, "hdr_channel:", 12))
+            hdr_channel = val;
+        else if (!strncmp(argv, "max_ids:", 8))
+            max_ids = val;
+        else if (!strncmp(argv, "rescan:", 7))
+            rescan = val;
+        else if (!strncmp(argv, "shared_access:", 14))
+            shared_access = val;
+        else if (!strncmp(argv, "reserve_list:", 13)) {
+            reserve_list[0] = val;
+            for (i = 1; i < MAX_RES_ARGS; i++) {
+                cur_str = strchr(cur_str, ',');
+                if (!cur_str)
+                    break;
+                if (!isdigit((int)*++cur_str)) {
+                    --cur_str;
+                    break;
+                }
+                reserve_list[i] =
+                    (int)simple_strtoul(cur_str, NULL, 0);
+            }
+            if (!cur_str)
+                break;
+            argv = ++cur_str;
+            continue;
+        }
+
+        if ((argv = strchr(argv, ',')))
+            ++argv;
+    }
+}
+
+static int __init option_setup(char *str)
+{
+    int ints[MAXHA];
+    char *cur = str;
+    int i = 1;
+
+    TRACE2(("option_setup() str %s\n", str ? str:"NULL"));
+
+    while (cur && isdigit(*cur) && i < MAXHA) {
+        ints[i++] = simple_strtoul(cur, NULL, 0);
+        if ((cur = strchr(cur, ',')) != NULL) cur++;
+    }
+
+    ints[0] = i - 1;
+    internal_setup(cur, ints);
+    return 1;
+}
+
 __setup("gdth=", option_setup);
 #endif
index 128583d..c8dd858 100644 (file)
@@ -445,7 +445,7 @@ static int hisi_sas_task_prep(struct sas_task *task,
                }
        }
 
-       if (scmd) {
+       if (scmd && hisi_hba->shost->nr_hw_queues) {
                unsigned int dq_index;
                u32 blk_tag;
 
index 83ce4f1..8df70c9 100644 (file)
@@ -8855,7 +8855,7 @@ reinit_after_soft_reset:
        /* hook into SCSI subsystem */
        rc = hpsa_scsi_add_host(h);
        if (rc)
-               goto clean7; /* perf, sg, cmd, irq, shost, pci, lu, aer/h */
+               goto clean8; /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */
 
        /* Monitor the controller for firmware lockups */
        h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL;
@@ -8870,6 +8870,8 @@ reinit_after_soft_reset:
                                HPSA_EVENT_MONITOR_INTERVAL);
        return 0;
 
+clean8: /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */
+       kfree(h->lastlogicals);
 clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */
        hpsa_free_performant_mode(h);
        h->access.set_intr_mask(h, HPSA_INTR_OFF);
index b1f3017..29fcc44 100644 (file)
@@ -807,13 +807,29 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code)
 }
 
 /**
+ * ibmvscsi_set_request_limit - Set the adapter request_limit in response to
+ * an adapter failure, reset, or SRP Login. Done under host lock to prevent
+ * race with SCSI command submission.
+ * @hostdata:  adapter to adjust
+ * @limit:     new request limit
+ */
+static void ibmvscsi_set_request_limit(struct ibmvscsi_host_data *hostdata, int limit)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(hostdata->host->host_lock, flags);
+       atomic_set(&hostdata->request_limit, limit);
+       spin_unlock_irqrestore(hostdata->host->host_lock, flags);
+}
+
+/**
  * ibmvscsi_reset_host - Reset the connection to the server
  * @hostdata:  struct ibmvscsi_host_data to reset
 */
 static void ibmvscsi_reset_host(struct ibmvscsi_host_data *hostdata)
 {
        scsi_block_requests(hostdata->host);
-       atomic_set(&hostdata->request_limit, 0);
+       ibmvscsi_set_request_limit(hostdata, 0);
 
        purge_requests(hostdata, DID_ERROR);
        hostdata->action = IBMVSCSI_HOST_ACTION_RESET;
@@ -1146,13 +1162,13 @@ static void login_rsp(struct srp_event_struct *evt_struct)
                dev_info(hostdata->dev, "SRP_LOGIN_REJ reason %u\n",
                         evt_struct->xfer_iu->srp.login_rej.reason);
                /* Login failed.  */
-               atomic_set(&hostdata->request_limit, -1);
+               ibmvscsi_set_request_limit(hostdata, -1);
                return;
        default:
                dev_err(hostdata->dev, "Invalid login response typecode 0x%02x!\n",
                        evt_struct->xfer_iu->srp.login_rsp.opcode);
                /* Login failed.  */
-               atomic_set(&hostdata->request_limit, -1);
+               ibmvscsi_set_request_limit(hostdata, -1);
                return;
        }
 
@@ -1163,7 +1179,7 @@ static void login_rsp(struct srp_event_struct *evt_struct)
         * This value is set rather than added to request_limit because
         * request_limit could have been set to -1 by this client.
         */
-       atomic_set(&hostdata->request_limit,
+       ibmvscsi_set_request_limit(hostdata,
                   be32_to_cpu(evt_struct->xfer_iu->srp.login_rsp.req_lim_delta));
 
        /* If we had any pending I/Os, kick them */
@@ -1195,13 +1211,13 @@ static int send_srp_login(struct ibmvscsi_host_data *hostdata)
        login->req_buf_fmt = cpu_to_be16(SRP_BUF_FORMAT_DIRECT |
                                         SRP_BUF_FORMAT_INDIRECT);
 
-       spin_lock_irqsave(hostdata->host->host_lock, flags);
        /* Start out with a request limit of 0, since this is negotiated in
         * the login request we are just sending and login requests always
         * get sent by the driver regardless of request_limit.
         */
-       atomic_set(&hostdata->request_limit, 0);
+       ibmvscsi_set_request_limit(hostdata, 0);
 
+       spin_lock_irqsave(hostdata->host->host_lock, flags);
        rc = ibmvscsi_send_srp_event(evt_struct, hostdata, login_timeout * 2);
        spin_unlock_irqrestore(hostdata->host->host_lock, flags);
        dev_info(hostdata->dev, "sent SRP login\n");
@@ -1781,7 +1797,7 @@ static void ibmvscsi_handle_crq(struct viosrp_crq *crq,
                return;
        case VIOSRP_CRQ_XPORT_EVENT:    /* Hypervisor telling us the connection is closed */
                scsi_block_requests(hostdata->host);
-               atomic_set(&hostdata->request_limit, 0);
+               ibmvscsi_set_request_limit(hostdata, 0);
                if (crq->format == 0x06) {
                        /* We need to re-setup the interpartition connection */
                        dev_info(hostdata->dev, "Re-enabling adapter!\n");
@@ -2137,12 +2153,12 @@ static void ibmvscsi_do_work(struct ibmvscsi_host_data *hostdata)
        }
 
        hostdata->action = IBMVSCSI_HOST_ACTION_NONE;
+       spin_unlock_irqrestore(hostdata->host->host_lock, flags);
 
        if (rc) {
-               atomic_set(&hostdata->request_limit, -1);
+               ibmvscsi_set_request_limit(hostdata, -1);
                dev_err(hostdata->dev, "error after %s\n", action);
        }
-       spin_unlock_irqrestore(hostdata->host->host_lock, flags);
 
        scsi_unblock_requests(hostdata->host);
 }
@@ -2226,7 +2242,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
        init_waitqueue_head(&hostdata->work_wait_q);
        hostdata->host = host;
        hostdata->dev = dev;
-       atomic_set(&hostdata->request_limit, -1);
+       ibmvscsi_set_request_limit(hostdata, -1);
        hostdata->host->max_sectors = IBMVSCSI_MAX_SECTORS_DEFAULT;
 
        if (map_persist_bufs(hostdata)) {
index 1d39628..ca16ef4 100644 (file)
@@ -2962,20 +2962,8 @@ static struct pci_driver initio_pci_driver = {
        .probe          = initio_probe_one,
        .remove         = initio_remove_one,
 };
-
-static int __init initio_init_driver(void)
-{
-       return pci_register_driver(&initio_pci_driver);
-}
-
-static void __exit initio_exit_driver(void)
-{
-       pci_unregister_driver(&initio_pci_driver);
-}
+module_pci_driver(initio_pci_driver);
 
 MODULE_DESCRIPTION("Initio INI-9X00U/UW SCSI device driver");
 MODULE_AUTHOR("Initio Corporation");
 MODULE_LICENSE("GPL");
-
-module_init(initio_init_driver);
-module_exit(initio_exit_driver);
index 721ab98..0ddfdda 100644 (file)
@@ -61,7 +61,7 @@
 /**
  *
  *
- * Remote node sets are sets of remote node index in the remtoe node table The
+ * Remote node sets are sets of remote node index in the remote node table. The
  * SCU hardware requires that STP remote node entries take three consecutive
  * remote node index so the table is arranged in sets of three. The bits are
  * used as 0111 0111 to make a byte and the bits define the set of three remote
index 93230cd..e4cc92b 100644 (file)
@@ -1740,6 +1740,13 @@ _base_irqpoll(struct irq_poll *irqpoll, int budget)
                reply_q->irq_poll_scheduled = false;
                reply_q->irq_line_enable = true;
                enable_irq(reply_q->os_irq);
+               /*
+                * Go for one more round of processing the
+                * reply descriptor post queue incase if HBA
+                * Firmware has posted some reply descriptors
+                * while reenabling the IRQ.
+                */
+               _base_process_reply_queue(reply_q);
        }
 
        return num_entries;
index cbf1e8b..5fa0f4e 100644 (file)
@@ -1050,7 +1050,7 @@ static int myrb_get_hba_config(struct myrb_hba *cb)
                enquiry2->fw.turn_id = 0;
        }
        snprintf(cb->fw_version, sizeof(cb->fw_version),
-               "%d.%02d-%c-%02d",
+               "%u.%02u-%c-%02u",
                enquiry2->fw.major_version,
                enquiry2->fw.minor_version,
                enquiry2->fw.firmware_type,
@@ -2167,7 +2167,7 @@ static ssize_t ctlr_num_show(struct device *dev,
        struct Scsi_Host *shost = class_to_shost(dev);
        struct myrb_hba *cb = shost_priv(shost);
 
-       return snprintf(buf, 20, "%d\n", cb->ctlr_num);
+       return snprintf(buf, 20, "%u\n", cb->ctlr_num);
 }
 static DEVICE_ATTR_RO(ctlr_num);
 
@@ -2732,7 +2732,6 @@ static int DAC960_LA_hw_init(struct pci_dev *pdev,
        DAC960_LA_disable_intr(base);
        DAC960_LA_ack_hw_mbox_status(base);
        udelay(1000);
-       timeout = 0;
        while (DAC960_LA_init_in_progress(base) &&
               timeout < MYRB_MAILBOX_TIMEOUT) {
                if (DAC960_LA_read_error_status(base, &error,
index 77c805d..3587f7c 100644 (file)
@@ -408,9 +408,10 @@ static ssize_t pm8001_ctl_ib_queue_log_show(struct device *cdev,
        int offset;
        char *str = buf;
        int start = 0;
+       u32 ib_offset = pm8001_ha->ib_offset;
 #define IB_MEMMAP(c)   \
                (*(u32 *)((u8 *)pm8001_ha->     \
-               memoryMap.region[IB].virt_ptr + \
+               memoryMap.region[ib_offset].virt_ptr +  \
                pm8001_ha->evtlog_ib_offset + (c)))
 
        for (offset = 0; offset < IB_OB_READ_TIMES; offset++) {
@@ -442,9 +443,10 @@ static ssize_t pm8001_ctl_ob_queue_log_show(struct device *cdev,
        int offset;
        char *str = buf;
        int start = 0;
+       u32 ob_offset = pm8001_ha->ob_offset;
 #define OB_MEMMAP(c)   \
                (*(u32 *)((u8 *)pm8001_ha->     \
-               memoryMap.region[OB].virt_ptr + \
+               memoryMap.region[ob_offset].virt_ptr +  \
                pm8001_ha->evtlog_ob_offset + (c)))
 
        for (offset = 0; offset < IB_OB_READ_TIMES; offset++) {
index 1c7f15f..501b574 100644 (file)
@@ -75,12 +75,10 @@ enum port_type {
 };
 
 /* driver compile-time configuration */
-#define        PM8001_MAX_CCB           256    /* max ccbs supported */
+#define        PM8001_MAX_CCB           1024   /* max ccbs supported */
 #define PM8001_MPI_QUEUE         1024   /* maximum mpi queue entries */
-#define        PM8001_MAX_INB_NUM       1
-#define        PM8001_MAX_OUTB_NUM      1
-#define        PM8001_MAX_SPCV_INB_NUM         1
-#define        PM8001_MAX_SPCV_OUTB_NUM        4
+#define        PM8001_MAX_INB_NUM       64
+#define        PM8001_MAX_OUTB_NUM      64
 #define        PM8001_CAN_QUEUE         508    /* SCSI Queue depth */
 
 /* Inbound/Outbound queue size */
@@ -92,26 +90,27 @@ enum port_type {
 #define        PM8001_MAX_PORTS         16     /* max. possible ports */
 #define        PM8001_MAX_DEVICES       2048   /* max supported device */
 #define        PM8001_MAX_MSIX_VEC      64     /* max msi-x int for spcv/ve */
+#define        PM8001_RESERVE_SLOT      8
 
-#define USI_MAX_MEMCNT_BASE    5
-#define IB                     (USI_MAX_MEMCNT_BASE + 1)
-#define CI                     (IB + PM8001_MAX_SPCV_INB_NUM)
-#define OB                     (CI + PM8001_MAX_SPCV_INB_NUM)
-#define PI                     (OB + PM8001_MAX_SPCV_OUTB_NUM)
-#define USI_MAX_MEMCNT         (PI + PM8001_MAX_SPCV_OUTB_NUM)
 #define        CONFIG_SCSI_PM8001_MAX_DMA_SG   528
 #define PM8001_MAX_DMA_SG      CONFIG_SCSI_PM8001_MAX_DMA_SG
+
 enum memory_region_num {
        AAP1 = 0x0, /* application acceleration processor */
        IOP,        /* IO processor */
        NVMD,       /* NVM device */
-       DEV_MEM,    /* memory for devices */
-       CCB_MEM,    /* memory for command control block */
        FW_FLASH,    /* memory for fw flash update */
-       FORENSIC_MEM  /* memory for fw forensic data */
+       FORENSIC_MEM,  /* memory for fw forensic data */
+       USI_MAX_MEMCNT_BASE
 };
 #define        PM8001_EVENT_LOG_SIZE    (128 * 1024)
 
+/**
+ * maximum DMA memory regions(number of IBQ + number of IBQ CI
+ * + number of  OBQ + number of OBQ PI)
+ */
+#define USI_MAX_MEMCNT (USI_MAX_MEMCNT_BASE + ((2 * PM8001_MAX_INB_NUM) \
+                       + (2 * PM8001_MAX_OUTB_NUM)))
 /*error code*/
 enum mpi_err {
        MPI_IO_STATUS_SUCCESS = 0x0,
index e9a9392..2b7b295 100644 (file)
@@ -189,6 +189,10 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha)
        u32 offsetib, offsetob;
        void __iomem *addressib = pm8001_ha->inbnd_q_tbl_addr;
        void __iomem *addressob = pm8001_ha->outbnd_q_tbl_addr;
+       u32 ib_offset = pm8001_ha->ib_offset;
+       u32 ob_offset = pm8001_ha->ob_offset;
+       u32 ci_offset = pm8001_ha->ci_offset;
+       u32 pi_offset = pm8001_ha->pi_offset;
 
        pm8001_ha->main_cfg_tbl.pm8001_tbl.inbound_q_nppd_hppd          = 0;
        pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_hw_event_pid0_3     = 0;
@@ -223,19 +227,19 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha)
                pm8001_ha->inbnd_q_tbl[i].element_pri_size_cnt  =
                        PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x00<<30);
                pm8001_ha->inbnd_q_tbl[i].upper_base_addr       =
-                       pm8001_ha->memoryMap.region[IB + i].phys_addr_hi;
+                       pm8001_ha->memoryMap.region[ib_offset + i].phys_addr_hi;
                pm8001_ha->inbnd_q_tbl[i].lower_base_addr       =
-               pm8001_ha->memoryMap.region[IB + i].phys_addr_lo;
+               pm8001_ha->memoryMap.region[ib_offset + i].phys_addr_lo;
                pm8001_ha->inbnd_q_tbl[i].base_virt             =
-                       (u8 *)pm8001_ha->memoryMap.region[IB + i].virt_ptr;
+                 (u8 *)pm8001_ha->memoryMap.region[ib_offset + i].virt_ptr;
                pm8001_ha->inbnd_q_tbl[i].total_length          =
-                       pm8001_ha->memoryMap.region[IB + i].total_len;
+                       pm8001_ha->memoryMap.region[ib_offset + i].total_len;
                pm8001_ha->inbnd_q_tbl[i].ci_upper_base_addr    =
-                       pm8001_ha->memoryMap.region[CI + i].phys_addr_hi;
+                       pm8001_ha->memoryMap.region[ci_offset + i].phys_addr_hi;
                pm8001_ha->inbnd_q_tbl[i].ci_lower_base_addr    =
-                       pm8001_ha->memoryMap.region[CI + i].phys_addr_lo;
+                       pm8001_ha->memoryMap.region[ci_offset + i].phys_addr_lo;
                pm8001_ha->inbnd_q_tbl[i].ci_virt               =
-                       pm8001_ha->memoryMap.region[CI + i].virt_ptr;
+                       pm8001_ha->memoryMap.region[ci_offset + i].virt_ptr;
                offsetib = i * 0x20;
                pm8001_ha->inbnd_q_tbl[i].pi_pci_bar            =
                        get_pci_bar_index(pm8001_mr32(addressib,
@@ -249,21 +253,21 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha)
                pm8001_ha->outbnd_q_tbl[i].element_size_cnt     =
                        PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x01<<30);
                pm8001_ha->outbnd_q_tbl[i].upper_base_addr      =
-                       pm8001_ha->memoryMap.region[OB + i].phys_addr_hi;
+                       pm8001_ha->memoryMap.region[ob_offset + i].phys_addr_hi;
                pm8001_ha->outbnd_q_tbl[i].lower_base_addr      =
-                       pm8001_ha->memoryMap.region[OB + i].phys_addr_lo;
+                       pm8001_ha->memoryMap.region[ob_offset + i].phys_addr_lo;
                pm8001_ha->outbnd_q_tbl[i].base_virt            =
-                       (u8 *)pm8001_ha->memoryMap.region[OB + i].virt_ptr;
+                 (u8 *)pm8001_ha->memoryMap.region[ob_offset + i].virt_ptr;
                pm8001_ha->outbnd_q_tbl[i].total_length         =
-                       pm8001_ha->memoryMap.region[OB + i].total_len;
+                       pm8001_ha->memoryMap.region[ob_offset + i].total_len;
                pm8001_ha->outbnd_q_tbl[i].pi_upper_base_addr   =
-                       pm8001_ha->memoryMap.region[PI + i].phys_addr_hi;
+                       pm8001_ha->memoryMap.region[pi_offset + i].phys_addr_hi;
                pm8001_ha->outbnd_q_tbl[i].pi_lower_base_addr   =
-                       pm8001_ha->memoryMap.region[PI + i].phys_addr_lo;
+                       pm8001_ha->memoryMap.region[pi_offset + i].phys_addr_lo;
                pm8001_ha->outbnd_q_tbl[i].interrup_vec_cnt_delay       =
                        0 | (10 << 16) | (i << 24);
                pm8001_ha->outbnd_q_tbl[i].pi_virt              =
-                       pm8001_ha->memoryMap.region[PI + i].virt_ptr;
+                       pm8001_ha->memoryMap.region[pi_offset + i].virt_ptr;
                offsetob = i * 0x24;
                pm8001_ha->outbnd_q_tbl[i].ci_pci_bar           =
                        get_pci_bar_index(pm8001_mr32(addressob,
@@ -4371,8 +4375,7 @@ static int pm8001_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
        /* fill in PRD (scatter/gather) table, if any */
        if (task->num_scatter > 1) {
                pm8001_chip_make_sg(task->scatter, ccb->n_elem, ccb->buf_prd);
-               phys_addr = ccb->ccb_dma_handle +
-                               offsetof(struct pm8001_ccb_info, buf_prd[0]);
+               phys_addr = ccb->ccb_dma_handle;
                ssp_cmd.addr_low = cpu_to_le32(lower_32_bits(phys_addr));
                ssp_cmd.addr_high = cpu_to_le32(upper_32_bits(phys_addr));
                ssp_cmd.esgl = cpu_to_le32(1<<31);
@@ -4445,8 +4448,7 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
        /* fill in PRD (scatter/gather) table, if any */
        if (task->num_scatter > 1) {
                pm8001_chip_make_sg(task->scatter, ccb->n_elem, ccb->buf_prd);
-               phys_addr = ccb->ccb_dma_handle +
-                               offsetof(struct pm8001_ccb_info, buf_prd[0]);
+               phys_addr = ccb->ccb_dma_handle;
                sata_cmd.addr_low = lower_32_bits(phys_addr);
                sata_cmd.addr_high = upper_32_bits(phys_addr);
                sata_cmd.esgl = cpu_to_le32(1 << 31);
index 20fa96c..3cf3e58 100644 (file)
@@ -56,6 +56,7 @@ MODULE_PARM_DESC(link_rate, "Enable link rate.\n"
                " 8: Link rate 12.0G\n");
 
 static struct scsi_transport_template *pm8001_stt;
+static int pm8001_init_ccb_tag(struct pm8001_hba_info *, struct Scsi_Host *, struct pci_dev *);
 
 /*
  * chip info structure to identify chip key functionality as
@@ -264,12 +265,36 @@ static u32 pm8001_request_irq(struct pm8001_hba_info *pm8001_ha);
 static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
                        const struct pci_device_id *ent)
 {
-       int i;
+       int i, count = 0, rc = 0;
+       u32 ci_offset, ib_offset, ob_offset, pi_offset;
+       struct inbound_queue_table *circularQ;
+
        spin_lock_init(&pm8001_ha->lock);
        spin_lock_init(&pm8001_ha->bitmap_lock);
        PM8001_INIT_DBG(pm8001_ha,
                pm8001_printk("pm8001_alloc: PHY:%x\n",
                                pm8001_ha->chip->n_phy));
+
+       /* Setup Interrupt */
+       rc = pm8001_setup_irq(pm8001_ha);
+       if (rc) {
+               PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
+                               "pm8001_setup_irq failed [ret: %d]\n", rc));
+               goto err_out_shost;
+       }
+       /* Request Interrupt */
+       rc = pm8001_request_irq(pm8001_ha);
+       if (rc)
+               goto err_out_shost;
+
+       count = pm8001_ha->max_q_num;
+       /* Queues are chosen based on the number of cores/msix availability */
+       ib_offset = pm8001_ha->ib_offset  = USI_MAX_MEMCNT_BASE;
+       ci_offset = pm8001_ha->ci_offset  = ib_offset + count;
+       ob_offset = pm8001_ha->ob_offset  = ci_offset + count;
+       pi_offset = pm8001_ha->pi_offset  = ob_offset + count;
+       pm8001_ha->max_memcnt = pi_offset + count;
+
        for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
                pm8001_phy_init(pm8001_ha, i);
                pm8001_ha->port[i].wide_port_phymap = 0;
@@ -278,9 +303,6 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
                INIT_LIST_HEAD(&pm8001_ha->port[i].list);
        }
 
-       pm8001_ha->tags = kzalloc(PM8001_MAX_CCB, GFP_KERNEL);
-       if (!pm8001_ha->tags)
-               goto err_out;
        /* MPI Memory region 1 for AAP Event Log for fw */
        pm8001_ha->memoryMap.region[AAP1].num_elements = 1;
        pm8001_ha->memoryMap.region[AAP1].element_size = PM8001_EVENT_LOG_SIZE;
@@ -293,54 +315,62 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
        pm8001_ha->memoryMap.region[IOP].total_len = PM8001_EVENT_LOG_SIZE;
        pm8001_ha->memoryMap.region[IOP].alignment = 32;
 
-       for (i = 0; i < PM8001_MAX_SPCV_INB_NUM; i++) {
+       for (i = 0; i < count; i++) {
+               circularQ = &pm8001_ha->inbnd_q_tbl[i];
+               spin_lock_init(&circularQ->iq_lock);
                /* MPI Memory region 3 for consumer Index of inbound queues */
-               pm8001_ha->memoryMap.region[CI+i].num_elements = 1;
-               pm8001_ha->memoryMap.region[CI+i].element_size = 4;
-               pm8001_ha->memoryMap.region[CI+i].total_len = 4;
-               pm8001_ha->memoryMap.region[CI+i].alignment = 4;
+               pm8001_ha->memoryMap.region[ci_offset+i].num_elements = 1;
+               pm8001_ha->memoryMap.region[ci_offset+i].element_size = 4;
+               pm8001_ha->memoryMap.region[ci_offset+i].total_len = 4;
+               pm8001_ha->memoryMap.region[ci_offset+i].alignment = 4;
 
                if ((ent->driver_data) != chip_8001) {
                        /* MPI Memory region 5 inbound queues */
-                       pm8001_ha->memoryMap.region[IB+i].num_elements =
+                       pm8001_ha->memoryMap.region[ib_offset+i].num_elements =
                                                PM8001_MPI_QUEUE;
-                       pm8001_ha->memoryMap.region[IB+i].element_size = 128;
-                       pm8001_ha->memoryMap.region[IB+i].total_len =
+                       pm8001_ha->memoryMap.region[ib_offset+i].element_size
+                                                               = 128;
+                       pm8001_ha->memoryMap.region[ib_offset+i].total_len =
                                                PM8001_MPI_QUEUE * 128;
-                       pm8001_ha->memoryMap.region[IB+i].alignment = 128;
+                       pm8001_ha->memoryMap.region[ib_offset+i].alignment
+                                                               = 128;
                } else {
-                       pm8001_ha->memoryMap.region[IB+i].num_elements =
+                       pm8001_ha->memoryMap.region[ib_offset+i].num_elements =
                                                PM8001_MPI_QUEUE;
-                       pm8001_ha->memoryMap.region[IB+i].element_size = 64;
-                       pm8001_ha->memoryMap.region[IB+i].total_len =
+                       pm8001_ha->memoryMap.region[ib_offset+i].element_size
+                                                               = 64;
+                       pm8001_ha->memoryMap.region[ib_offset+i].total_len =
                                                PM8001_MPI_QUEUE * 64;
-                       pm8001_ha->memoryMap.region[IB+i].alignment = 64;
+                       pm8001_ha->memoryMap.region[ib_offset+i].alignment = 64;
                }
        }
 
-       for (i = 0; i < PM8001_MAX_SPCV_OUTB_NUM; i++) {
+       for (i = 0; i < count; i++) {
                /* MPI Memory region 4 for producer Index of outbound queues */
-               pm8001_ha->memoryMap.region[PI+i].num_elements = 1;
-               pm8001_ha->memoryMap.region[PI+i].element_size = 4;
-               pm8001_ha->memoryMap.region[PI+i].total_len = 4;
-               pm8001_ha->memoryMap.region[PI+i].alignment = 4;
+               pm8001_ha->memoryMap.region[pi_offset+i].num_elements = 1;
+               pm8001_ha->memoryMap.region[pi_offset+i].element_size = 4;
+               pm8001_ha->memoryMap.region[pi_offset+i].total_len = 4;
+               pm8001_ha->memoryMap.region[pi_offset+i].alignment = 4;
 
                if (ent->driver_data != chip_8001) {
                        /* MPI Memory region 6 Outbound queues */
-                       pm8001_ha->memoryMap.region[OB+i].num_elements =
+                       pm8001_ha->memoryMap.region[ob_offset+i].num_elements =
                                                PM8001_MPI_QUEUE;
-                       pm8001_ha->memoryMap.region[OB+i].element_size = 128;
-                       pm8001_ha->memoryMap.region[OB+i].total_len =
+                       pm8001_ha->memoryMap.region[ob_offset+i].element_size
+                                                               = 128;
+                       pm8001_ha->memoryMap.region[ob_offset+i].total_len =
                                                PM8001_MPI_QUEUE * 128;
-                       pm8001_ha->memoryMap.region[OB+i].alignment = 128;
+                       pm8001_ha->memoryMap.region[ob_offset+i].alignment
+                                                               = 128;
                } else {
                        /* MPI Memory region 6 Outbound queues */
-                       pm8001_ha->memoryMap.region[OB+i].num_elements =
+                       pm8001_ha->memoryMap.region[ob_offset+i].num_elements =
                                                PM8001_MPI_QUEUE;
-                       pm8001_ha->memoryMap.region[OB+i].element_size = 64;
-                       pm8001_ha->memoryMap.region[OB+i].total_len =
+                       pm8001_ha->memoryMap.region[ob_offset+i].element_size
+                                                               = 64;
+                       pm8001_ha->memoryMap.region[ob_offset+i].total_len =
                                                PM8001_MPI_QUEUE * 64;
-                       pm8001_ha->memoryMap.region[OB+i].alignment = 64;
+                       pm8001_ha->memoryMap.region[ob_offset+i].alignment = 64;
                }
 
        }
@@ -348,19 +378,6 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
        pm8001_ha->memoryMap.region[NVMD].num_elements = 1;
        pm8001_ha->memoryMap.region[NVMD].element_size = 4096;
        pm8001_ha->memoryMap.region[NVMD].total_len = 4096;
-       /* Memory region for devices*/
-       pm8001_ha->memoryMap.region[DEV_MEM].num_elements = 1;
-       pm8001_ha->memoryMap.region[DEV_MEM].element_size = PM8001_MAX_DEVICES *
-               sizeof(struct pm8001_device);
-       pm8001_ha->memoryMap.region[DEV_MEM].total_len = PM8001_MAX_DEVICES *
-               sizeof(struct pm8001_device);
-
-       /* Memory region for ccb_info*/
-       pm8001_ha->memoryMap.region[CCB_MEM].num_elements = 1;
-       pm8001_ha->memoryMap.region[CCB_MEM].element_size = PM8001_MAX_CCB *
-               sizeof(struct pm8001_ccb_info);
-       pm8001_ha->memoryMap.region[CCB_MEM].total_len = PM8001_MAX_CCB *
-               sizeof(struct pm8001_ccb_info);
 
        /* Memory region for fw flash */
        pm8001_ha->memoryMap.region[FW_FLASH].total_len = 4096;
@@ -369,7 +386,7 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
        pm8001_ha->memoryMap.region[FORENSIC_MEM].total_len = 0x10000;
        pm8001_ha->memoryMap.region[FORENSIC_MEM].element_size = 0x10000;
        pm8001_ha->memoryMap.region[FORENSIC_MEM].alignment = 0x10000;
-       for (i = 0; i < USI_MAX_MEMCNT; i++) {
+       for (i = 0; i < pm8001_ha->max_memcnt; i++) {
                if (pm8001_mem_alloc(pm8001_ha->pdev,
                        &pm8001_ha->memoryMap.region[i].virt_ptr,
                        &pm8001_ha->memoryMap.region[i].phys_addr,
@@ -384,27 +401,36 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
                }
        }
 
-       pm8001_ha->devices = pm8001_ha->memoryMap.region[DEV_MEM].virt_ptr;
+       /* Memory region for devices*/
+       pm8001_ha->devices = kzalloc(PM8001_MAX_DEVICES
+                               * sizeof(struct pm8001_device), GFP_KERNEL);
+       if (!pm8001_ha->devices) {
+               rc = -ENOMEM;
+               goto err_out_nodev;
+       }
        for (i = 0; i < PM8001_MAX_DEVICES; i++) {
                pm8001_ha->devices[i].dev_type = SAS_PHY_UNUSED;
                pm8001_ha->devices[i].id = i;
                pm8001_ha->devices[i].device_id = PM8001_MAX_DEVICES;
                pm8001_ha->devices[i].running_req = 0;
        }
-       pm8001_ha->ccb_info = pm8001_ha->memoryMap.region[CCB_MEM].virt_ptr;
-       for (i = 0; i < PM8001_MAX_CCB; i++) {
-               pm8001_ha->ccb_info[i].ccb_dma_handle =
-                       pm8001_ha->memoryMap.region[CCB_MEM].phys_addr +
-                       i * sizeof(struct pm8001_ccb_info);
-               pm8001_ha->ccb_info[i].task = NULL;
-               pm8001_ha->ccb_info[i].ccb_tag = 0xffffffff;
-               pm8001_ha->ccb_info[i].device = NULL;
-               ++pm8001_ha->tags_num;
-       }
        pm8001_ha->flags = PM8001F_INIT_TIME;
        /* Initialize tags */
        pm8001_tag_init(pm8001_ha);
        return 0;
+
+err_out_shost:
+       scsi_remove_host(pm8001_ha->shost);
+err_out_nodev:
+       for (i = 0; i < pm8001_ha->max_memcnt; i++) {
+               if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) {
+                       pci_free_consistent(pm8001_ha->pdev,
+                               (pm8001_ha->memoryMap.region[i].total_len +
+                               pm8001_ha->memoryMap.region[i].alignment),
+                               pm8001_ha->memoryMap.region[i].virt_ptr,
+                               pm8001_ha->memoryMap.region[i].phys_addr);
+               }
+       }
 err_out:
        return 1;
 }
@@ -899,7 +925,8 @@ static int pm8001_configure_phy_settings(struct pm8001_hba_info *pm8001_ha)
 static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
 {
        u32 number_of_intr;
-       int rc;
+       int rc, cpu_online_count;
+       unsigned int allocated_irq_vectors;
 
        /* SPCv controllers supports 64 msi-x */
        if (pm8001_ha->chip_id == chip_8001) {
@@ -908,13 +935,21 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
                number_of_intr = PM8001_MAX_MSIX_VEC;
        }
 
+       cpu_online_count = num_online_cpus();
+       number_of_intr = min_t(int, cpu_online_count, number_of_intr);
        rc = pci_alloc_irq_vectors(pm8001_ha->pdev, number_of_intr,
                        number_of_intr, PCI_IRQ_MSIX);
-       number_of_intr = rc;
+       allocated_irq_vectors = rc;
        if (rc < 0)
                return rc;
+
+       /* Assigns the number of interrupts */
+       number_of_intr = min_t(int, allocated_irq_vectors, number_of_intr);
        pm8001_ha->number_of_intr = number_of_intr;
 
+       /* Maximum queue number updating in HBA structure */
+       pm8001_ha->max_q_num = number_of_intr;
+
        PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
                "pci_alloc_irq_vectors request ret:%d no of intr %d\n",
                                rc, pm8001_ha->number_of_intr));
@@ -1069,13 +1104,6 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
                rc = -ENOMEM;
                goto err_out_free;
        }
-       /* Setup Interrupt */
-       rc = pm8001_setup_irq(pm8001_ha);
-       if (rc) {
-               PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
-                       "pm8001_setup_irq failed [ret: %d]\n", rc));
-               goto err_out_shost;
-       }
 
        PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha);
        rc = PM8001_CHIP_DISP->chip_init(pm8001_ha);
@@ -1085,16 +1113,13 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
                goto err_out_ha_free;
        }
 
+       rc = pm8001_init_ccb_tag(pm8001_ha, shost, pdev);
+       if (rc)
+               goto err_out_enable;
+
        rc = scsi_add_host(shost, &pdev->dev);
        if (rc)
                goto err_out_ha_free;
-       /* Request Interrupt */
-       rc = pm8001_request_irq(pm8001_ha);
-       if (rc) {
-               PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
-                       "pm8001_request_irq failed [ret: %d]\n", rc));
-               goto err_out_shost;
-       }
 
        PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0);
        if (pm8001_ha->chip_id != chip_8001) {
@@ -1137,6 +1162,60 @@ err_out_enable:
        return rc;
 }
 
+/*
+ * pm8001_init_ccb_tag - allocate memory to CCB and tag.
+ * @pm8001_ha: our hba card information.
+ * @shost: scsi host which has been allocated outside.
+ */
+static int
+pm8001_init_ccb_tag(struct pm8001_hba_info *pm8001_ha, struct Scsi_Host *shost,
+                       struct pci_dev *pdev)
+{
+       int i = 0;
+       u32 max_out_io, ccb_count;
+       u32 can_queue;
+
+       max_out_io = pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_out_io;
+       ccb_count = min_t(int, PM8001_MAX_CCB, max_out_io);
+
+       /* Update to the scsi host*/
+       can_queue = ccb_count - PM8001_RESERVE_SLOT;
+       shost->can_queue = can_queue;
+
+       pm8001_ha->tags = kzalloc(ccb_count, GFP_KERNEL);
+       if (!pm8001_ha->tags)
+               goto err_out;
+
+       /* Memory region for ccb_info*/
+       pm8001_ha->ccb_info = (struct pm8001_ccb_info *)
+               kcalloc(ccb_count, sizeof(struct pm8001_ccb_info), GFP_KERNEL);
+       if (!pm8001_ha->ccb_info) {
+               PM8001_FAIL_DBG(pm8001_ha, pm8001_printk
+                       ("Unable to allocate memory for ccb\n"));
+               goto err_out_noccb;
+       }
+       for (i = 0; i < ccb_count; i++) {
+               pm8001_ha->ccb_info[i].buf_prd = pci_alloc_consistent(pdev,
+                               sizeof(struct pm8001_prd) * PM8001_MAX_DMA_SG,
+                               &pm8001_ha->ccb_info[i].ccb_dma_handle);
+               if (!pm8001_ha->ccb_info[i].buf_prd) {
+                       PM8001_FAIL_DBG(pm8001_ha, pm8001_printk
+                                       ("pm80xx: ccb prd memory allocation error\n"));
+                       goto err_out;
+               }
+               pm8001_ha->ccb_info[i].task = NULL;
+               pm8001_ha->ccb_info[i].ccb_tag = 0xffffffff;
+               pm8001_ha->ccb_info[i].device = NULL;
+               ++pm8001_ha->tags_num;
+       }
+       return 0;
+
+err_out_noccb:
+       kfree(pm8001_ha->devices);
+err_out:
+       return -ENOMEM;
+}
+
 static void pm8001_pci_remove(struct pci_dev *pdev)
 {
        struct sas_ha_struct *sha = pci_get_drvdata(pdev);
index ae7ba9b..95663e1 100644 (file)
@@ -58,7 +58,7 @@
 #include "pm8001_defs.h"
 
 #define DRV_NAME               "pm80xx"
-#define DRV_VERSION            "0.1.39"
+#define DRV_VERSION            "0.1.40"
 #define PM8001_FAIL_LOGGING    0x01 /* Error message logging */
 #define PM8001_INIT_LOGGING    0x02 /* driver init logging */
 #define PM8001_DISC_LOGGING    0x04 /* discovery layer logging */
@@ -315,7 +315,7 @@ struct pm8001_ccb_info {
        u32                     ccb_tag;
        dma_addr_t              ccb_dma_handle;
        struct pm8001_device    *device;
-       struct pm8001_prd       buf_prd[PM8001_MAX_DMA_SG];
+       struct pm8001_prd       *buf_prd;
        struct fw_control_ex    *fw_control_context;
        u8                      open_retry;
 };
@@ -468,6 +468,7 @@ struct inbound_queue_table {
        u32                     reserved;
        __le32                  consumer_index;
        u32                     producer_idx;
+       spinlock_t              iq_lock;
 };
 struct outbound_queue_table {
        u32                     element_size_cnt;
@@ -524,8 +525,8 @@ struct pm8001_hba_info {
        void __iomem    *fatal_tbl_addr; /*MPI IVT Table Addr */
        union main_cfg_table    main_cfg_tbl;
        union general_status_table      gs_tbl;
-       struct inbound_queue_table      inbnd_q_tbl[PM8001_MAX_SPCV_INB_NUM];
-       struct outbound_queue_table     outbnd_q_tbl[PM8001_MAX_SPCV_OUTB_NUM];
+       struct inbound_queue_table      inbnd_q_tbl[PM8001_MAX_INB_NUM];
+       struct outbound_queue_table     outbnd_q_tbl[PM8001_MAX_OUTB_NUM];
        struct sas_phy_attribute_table  phy_attr_table;
                                        /* MPI SAS PHY attributes */
        u8                      sas_addr[SAS_ADDR_SIZE];
@@ -561,6 +562,12 @@ struct pm8001_hba_info {
        u32                     reset_in_progress;
        u32                     non_fatal_count;
        u32                     non_fatal_read_length;
+       u32 max_q_num;
+       u32 ib_offset;
+       u32 ob_offset;
+       u32 ci_offset;
+       u32 pi_offset;
+       u32 max_memcnt;
 };
 
 struct pm8001_work {
index b42f41d..7593f24 100644 (file)
@@ -720,7 +720,7 @@ static void read_inbnd_queue_table(struct pm8001_hba_info *pm8001_ha)
 {
        int i;
        void __iomem *address = pm8001_ha->inbnd_q_tbl_addr;
-       for (i = 0; i < PM8001_MAX_SPCV_INB_NUM; i++) {
+       for (i = 0; i < PM8001_MAX_INB_NUM; i++) {
                u32 offset = i * 0x20;
                pm8001_ha->inbnd_q_tbl[i].pi_pci_bar =
                        get_pci_bar_index(pm8001_mr32(address,
@@ -738,7 +738,7 @@ static void read_outbnd_queue_table(struct pm8001_hba_info *pm8001_ha)
 {
        int i;
        void __iomem *address = pm8001_ha->outbnd_q_tbl_addr;
-       for (i = 0; i < PM8001_MAX_SPCV_OUTB_NUM; i++) {
+       for (i = 0; i < PM8001_MAX_OUTB_NUM; i++) {
                u32 offset = i * 0x24;
                pm8001_ha->outbnd_q_tbl[i].ci_pci_bar =
                        get_pci_bar_index(pm8001_mr32(address,
@@ -758,6 +758,10 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha)
        u32 offsetib, offsetob;
        void __iomem *addressib = pm8001_ha->inbnd_q_tbl_addr;
        void __iomem *addressob = pm8001_ha->outbnd_q_tbl_addr;
+       u32 ib_offset = pm8001_ha->ib_offset;
+       u32 ob_offset = pm8001_ha->ob_offset;
+       u32 ci_offset = pm8001_ha->ci_offset;
+       u32 pi_offset = pm8001_ha->pi_offset;
 
        pm8001_ha->main_cfg_tbl.pm80xx_tbl.upper_event_log_addr         =
                pm8001_ha->memoryMap.region[AAP1].phys_addr_hi;
@@ -778,23 +782,23 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha)
        /* Disable end to end CRC checking */
        pm8001_ha->main_cfg_tbl.pm80xx_tbl.crc_core_dump = (0x1 << 16);
 
-       for (i = 0; i < PM8001_MAX_SPCV_INB_NUM; i++) {
+       for (i = 0; i < pm8001_ha->max_q_num; i++) {
                pm8001_ha->inbnd_q_tbl[i].element_pri_size_cnt  =
                        PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x00<<30);
                pm8001_ha->inbnd_q_tbl[i].upper_base_addr       =
-                       pm8001_ha->memoryMap.region[IB + i].phys_addr_hi;
+                       pm8001_ha->memoryMap.region[ib_offset + i].phys_addr_hi;
                pm8001_ha->inbnd_q_tbl[i].lower_base_addr       =
-               pm8001_ha->memoryMap.region[IB + i].phys_addr_lo;
+               pm8001_ha->memoryMap.region[ib_offset + i].phys_addr_lo;
                pm8001_ha->inbnd_q_tbl[i].base_virt             =
-                       (u8 *)pm8001_ha->memoryMap.region[IB + i].virt_ptr;
+                 (u8 *)pm8001_ha->memoryMap.region[ib_offset + i].virt_ptr;
                pm8001_ha->inbnd_q_tbl[i].total_length          =
-                       pm8001_ha->memoryMap.region[IB + i].total_len;
+                       pm8001_ha->memoryMap.region[ib_offset + i].total_len;
                pm8001_ha->inbnd_q_tbl[i].ci_upper_base_addr    =
-                       pm8001_ha->memoryMap.region[CI + i].phys_addr_hi;
+                       pm8001_ha->memoryMap.region[ci_offset + i].phys_addr_hi;
                pm8001_ha->inbnd_q_tbl[i].ci_lower_base_addr    =
-                       pm8001_ha->memoryMap.region[CI + i].phys_addr_lo;
+                       pm8001_ha->memoryMap.region[ci_offset + i].phys_addr_lo;
                pm8001_ha->inbnd_q_tbl[i].ci_virt               =
-                       pm8001_ha->memoryMap.region[CI + i].virt_ptr;
+                       pm8001_ha->memoryMap.region[ci_offset + i].virt_ptr;
                offsetib = i * 0x20;
                pm8001_ha->inbnd_q_tbl[i].pi_pci_bar            =
                        get_pci_bar_index(pm8001_mr32(addressib,
@@ -809,25 +813,25 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha)
                        pm8001_ha->inbnd_q_tbl[i].pi_pci_bar,
                        pm8001_ha->inbnd_q_tbl[i].pi_offset));
        }
-       for (i = 0; i < PM8001_MAX_SPCV_OUTB_NUM; i++) {
+       for (i = 0; i < pm8001_ha->max_q_num; i++) {
                pm8001_ha->outbnd_q_tbl[i].element_size_cnt     =
                        PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x01<<30);
                pm8001_ha->outbnd_q_tbl[i].upper_base_addr      =
-                       pm8001_ha->memoryMap.region[OB + i].phys_addr_hi;
+                       pm8001_ha->memoryMap.region[ob_offset + i].phys_addr_hi;
                pm8001_ha->outbnd_q_tbl[i].lower_base_addr      =
-                       pm8001_ha->memoryMap.region[OB + i].phys_addr_lo;
+                       pm8001_ha->memoryMap.region[ob_offset + i].phys_addr_lo;
                pm8001_ha->outbnd_q_tbl[i].base_virt            =
-                       (u8 *)pm8001_ha->memoryMap.region[OB + i].virt_ptr;
+                 (u8 *)pm8001_ha->memoryMap.region[ob_offset + i].virt_ptr;
                pm8001_ha->outbnd_q_tbl[i].total_length         =
-                       pm8001_ha->memoryMap.region[OB + i].total_len;
+                       pm8001_ha->memoryMap.region[ob_offset + i].total_len;
                pm8001_ha->outbnd_q_tbl[i].pi_upper_base_addr   =
-                       pm8001_ha->memoryMap.region[PI + i].phys_addr_hi;
+                       pm8001_ha->memoryMap.region[pi_offset + i].phys_addr_hi;
                pm8001_ha->outbnd_q_tbl[i].pi_lower_base_addr   =
-                       pm8001_ha->memoryMap.region[PI + i].phys_addr_lo;
+                       pm8001_ha->memoryMap.region[pi_offset + i].phys_addr_lo;
                /* interrupt vector based on oq */
                pm8001_ha->outbnd_q_tbl[i].interrup_vec_cnt_delay = (i << 24);
                pm8001_ha->outbnd_q_tbl[i].pi_virt              =
-                       pm8001_ha->memoryMap.region[PI + i].virt_ptr;
+                       pm8001_ha->memoryMap.region[pi_offset + i].virt_ptr;
                offsetob = i * 0x24;
                pm8001_ha->outbnd_q_tbl[i].ci_pci_bar           =
                        get_pci_bar_index(pm8001_mr32(addressob,
@@ -871,7 +875,7 @@ static void update_main_config_table(struct pm8001_hba_info *pm8001_ha)
                pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_severity);
        /* Update Fatal error interrupt vector */
        pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt |=
-                                       ((pm8001_ha->number_of_intr - 1) << 8);
+                                       ((pm8001_ha->max_q_num - 1) << 8);
        pm8001_mw32(address, MAIN_FATAL_ERROR_INTERRUPT,
                pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt);
        PM8001_DEV_DBG(pm8001_ha, pm8001_printk(
@@ -1010,8 +1014,12 @@ static int mpi_init_check(struct pm8001_hba_info *pm8001_ha)
                value &= SPCv_MSGU_CFG_TABLE_UPDATE;
        } while ((value != 0) && (--max_wait_count));
 
-       if (!max_wait_count)
-               return -1;
+       if (!max_wait_count) {
+               /* additional check */
+               PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
+                       "Inb doorbell clear not toggled[value:%x]\n", value));
+               return -EBUSY;
+       }
        /* check the MPI-State for initialization upto 100ms*/
        max_wait_count = 100 * 1000;/* 100 msec */
        do {
@@ -1022,12 +1030,12 @@ static int mpi_init_check(struct pm8001_hba_info *pm8001_ha)
        } while ((GST_MPI_STATE_INIT !=
                (gst_len_mpistate & GST_MPI_STATE_MASK)) && (--max_wait_count));
        if (!max_wait_count)
-               return -1;
+               return -EBUSY;
 
        /* check MPI Initialization error */
        gst_len_mpistate = gst_len_mpistate >> 16;
        if (0x0000 != gst_len_mpistate)
-               return -1;
+               return -EBUSY;
 
        return 0;
 }
@@ -1469,11 +1477,10 @@ static int pm80xx_chip_init(struct pm8001_hba_info *pm8001_ha)
 
        /* update main config table ,inbound table and outbound table */
        update_main_config_table(pm8001_ha);
-       for (i = 0; i < PM8001_MAX_SPCV_INB_NUM; i++)
+       for (i = 0; i < pm8001_ha->max_q_num; i++) {
                update_inbnd_queue_table(pm8001_ha, i);
-       for (i = 0; i < PM8001_MAX_SPCV_OUTB_NUM; i++)
                update_outbnd_queue_table(pm8001_ha, i);
-
+       }
        /* notify firmware update finished and check initialization status */
        if (0 == mpi_init_check(pm8001_ha)) {
                PM8001_INIT_DBG(pm8001_ha,
@@ -4191,7 +4198,7 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec)
        unsigned long flags;
        u32 regval;
 
-       if (vec == (pm8001_ha->number_of_intr - 1)) {
+       if (vec == (pm8001_ha->max_q_num - 1)) {
                regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1);
                if ((regval & SCRATCH_PAD_MIPSALL_READY) !=
                                        SCRATCH_PAD_MIPSALL_READY) {
@@ -4274,6 +4281,7 @@ static int pm80xx_chip_smp_req(struct pm8001_hba_info *pm8001_ha,
        char *preq_dma_addr = NULL;
        __le64 tmp_addr;
        u32 i, length;
+       unsigned long flags;
 
        memset(&smp_cmd, 0, sizeof(smp_cmd));
        /*
@@ -4369,8 +4377,10 @@ static int pm80xx_chip_smp_req(struct pm8001_hba_info *pm8001_ha,
 
        build_smp_cmd(pm8001_dev->device_id, smp_cmd.tag,
                                &smp_cmd, pm8001_ha->smp_exp_mode, length);
+       spin_lock_irqsave(&circularQ->iq_lock, flags);
        rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &smp_cmd,
                        sizeof(smp_cmd), 0);
+       spin_unlock_irqrestore(&circularQ->iq_lock, flags);
        if (rc)
                goto err_out_2;
        return 0;
@@ -4434,7 +4444,8 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
        u64 phys_addr, start_addr, end_addr;
        u32 end_addr_high, end_addr_low;
        struct inbound_queue_table *circularQ;
-       u32 q_index;
+       unsigned long flags;
+       u32 q_index, cpu_id;
        u32 opc = OPC_INB_SSPINIIOSTART;
        memset(&ssp_cmd, 0, sizeof(ssp_cmd));
        memcpy(ssp_cmd.ssp_iu.lun, task->ssp_task.LUN, 8);
@@ -4453,7 +4464,8 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
        ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7);
        memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd,
                       task->ssp_task.cmd->cmd_len);
-       q_index = (u32) (pm8001_dev->id & 0x00ffffff) % PM8001_MAX_INB_NUM;
+       cpu_id = smp_processor_id();
+       q_index = (u32) (cpu_id) % (pm8001_ha->max_q_num);
        circularQ = &pm8001_ha->inbnd_q_tbl[q_index];
 
        /* Check if encryption is set */
@@ -4471,8 +4483,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
                if (task->num_scatter > 1) {
                        pm8001_chip_make_sg(task->scatter,
                                                ccb->n_elem, ccb->buf_prd);
-                       phys_addr = ccb->ccb_dma_handle +
-                               offsetof(struct pm8001_ccb_info, buf_prd[0]);
+                       phys_addr = ccb->ccb_dma_handle;
                        ssp_cmd.enc_addr_low =
                                cpu_to_le32(lower_32_bits(phys_addr));
                        ssp_cmd.enc_addr_high =
@@ -4501,9 +4512,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
                                                end_addr_high, end_addr_low));
                                pm8001_chip_make_sg(task->scatter, 1,
                                        ccb->buf_prd);
-                               phys_addr = ccb->ccb_dma_handle +
-                                       offsetof(struct pm8001_ccb_info,
-                                               buf_prd[0]);
+                               phys_addr = ccb->ccb_dma_handle;
                                ssp_cmd.enc_addr_low =
                                        cpu_to_le32(lower_32_bits(phys_addr));
                                ssp_cmd.enc_addr_high =
@@ -4531,8 +4540,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
                if (task->num_scatter > 1) {
                        pm8001_chip_make_sg(task->scatter, ccb->n_elem,
                                        ccb->buf_prd);
-                       phys_addr = ccb->ccb_dma_handle +
-                               offsetof(struct pm8001_ccb_info, buf_prd[0]);
+                       phys_addr = ccb->ccb_dma_handle;
                        ssp_cmd.addr_low =
                                cpu_to_le32(lower_32_bits(phys_addr));
                        ssp_cmd.addr_high =
@@ -4560,9 +4568,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
                                                 end_addr_high, end_addr_low));
                                pm8001_chip_make_sg(task->scatter, 1,
                                        ccb->buf_prd);
-                               phys_addr = ccb->ccb_dma_handle +
-                                       offsetof(struct pm8001_ccb_info,
-                                                buf_prd[0]);
+                               phys_addr = ccb->ccb_dma_handle;
                                ssp_cmd.addr_low =
                                        cpu_to_le32(lower_32_bits(phys_addr));
                                ssp_cmd.addr_high =
@@ -4576,9 +4582,10 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
                        ssp_cmd.esgl = 0;
                }
        }
-       q_index = (u32) (pm8001_dev->id & 0x00ffffff) % PM8001_MAX_OUTB_NUM;
+       spin_lock_irqsave(&circularQ->iq_lock, flags);
        ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc,
                        &ssp_cmd, sizeof(ssp_cmd), q_index);
+       spin_unlock_irqrestore(&circularQ->iq_lock, flags);
        return ret;
 }
 
@@ -4590,7 +4597,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
        struct pm8001_device *pm8001_ha_dev = dev->lldd_dev;
        u32 tag = ccb->ccb_tag;
        int ret;
-       u32 q_index;
+       u32 q_index, cpu_id;
        struct sata_start_req sata_cmd;
        u32 hdr_tag, ncg_tag = 0;
        u64 phys_addr, start_addr, end_addr;
@@ -4601,7 +4608,8 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
        unsigned long flags;
        u32 opc = OPC_INB_SATA_HOST_OPSTART;
        memset(&sata_cmd, 0, sizeof(sata_cmd));
-       q_index = (u32) (pm8001_ha_dev->id & 0x00ffffff) % PM8001_MAX_INB_NUM;
+       cpu_id = smp_processor_id();
+       q_index = (u32) (cpu_id) % (pm8001_ha->max_q_num);
        circularQ = &pm8001_ha->inbnd_q_tbl[q_index];
 
        if (task->data_dir == DMA_NONE) {
@@ -4652,8 +4660,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
                if (task->num_scatter > 1) {
                        pm8001_chip_make_sg(task->scatter,
                                                ccb->n_elem, ccb->buf_prd);
-                       phys_addr = ccb->ccb_dma_handle +
-                               offsetof(struct pm8001_ccb_info, buf_prd[0]);
+                       phys_addr = ccb->ccb_dma_handle;
                        sata_cmd.enc_addr_low = lower_32_bits(phys_addr);
                        sata_cmd.enc_addr_high = upper_32_bits(phys_addr);
                        sata_cmd.enc_esgl = cpu_to_le32(1 << 31);
@@ -4678,9 +4685,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
                                                end_addr_high, end_addr_low));
                                pm8001_chip_make_sg(task->scatter, 1,
                                        ccb->buf_prd);
-                               phys_addr = ccb->ccb_dma_handle +
-                                               offsetof(struct pm8001_ccb_info,
-                                               buf_prd[0]);
+                               phys_addr = ccb->ccb_dma_handle;
                                sata_cmd.enc_addr_low =
                                        lower_32_bits(phys_addr);
                                sata_cmd.enc_addr_high =
@@ -4718,8 +4723,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
                if (task->num_scatter > 1) {
                        pm8001_chip_make_sg(task->scatter,
                                        ccb->n_elem, ccb->buf_prd);
-                       phys_addr = ccb->ccb_dma_handle +
-                               offsetof(struct pm8001_ccb_info, buf_prd[0]);
+                       phys_addr = ccb->ccb_dma_handle;
                        sata_cmd.addr_low = lower_32_bits(phys_addr);
                        sata_cmd.addr_high = upper_32_bits(phys_addr);
                        sata_cmd.esgl = cpu_to_le32(1 << 31);
@@ -4744,9 +4748,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
                                                end_addr_high, end_addr_low));
                                pm8001_chip_make_sg(task->scatter, 1,
                                        ccb->buf_prd);
-                               phys_addr = ccb->ccb_dma_handle +
-                                       offsetof(struct pm8001_ccb_info,
-                                       buf_prd[0]);
+                               phys_addr = ccb->ccb_dma_handle;
                                sata_cmd.addr_low =
                                        lower_32_bits(phys_addr);
                                sata_cmd.addr_high =
@@ -4817,9 +4819,10 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
                        }
                }
        }
-       q_index = (u32) (pm8001_ha_dev->id & 0x00ffffff) % PM8001_MAX_OUTB_NUM;
+       spin_lock_irqsave(&circularQ->iq_lock, flags);
        ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc,
                        &sata_cmd, sizeof(sata_cmd), q_index);
+       spin_unlock_irqrestore(&circularQ->iq_lock, flags);
        return ret;
 }
 
index f89ad32..d5ebcf7 100644 (file)
@@ -170,20 +170,7 @@ qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused)
        return 0;
 }
 
-static int
-qla2x00_dfs_tgt_sess_open(struct inode *inode, struct file *file)
-{
-       scsi_qla_host_t *vha = inode->i_private;
-
-       return single_open(file, qla2x00_dfs_tgt_sess_show, vha);
-}
-
-static const struct file_operations dfs_tgt_sess_ops = {
-       .open           = qla2x00_dfs_tgt_sess_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(qla2x00_dfs_tgt_sess);
 
 static int
 qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
@@ -239,20 +226,7 @@ out_free_id_list:
        return 0;
 }
 
-static int
-qla2x00_dfs_tgt_port_database_open(struct inode *inode, struct file *file)
-{
-       scsi_qla_host_t *vha = inode->i_private;
-
-       return single_open(file, qla2x00_dfs_tgt_port_database_show, vha);
-}
-
-static const struct file_operations dfs_tgt_port_database_ops = {
-       .open           = qla2x00_dfs_tgt_port_database_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(qla2x00_dfs_tgt_port_database);
 
 static int
 qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
@@ -301,20 +275,7 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
        return 0;
 }
 
-static int
-qla_dfs_fw_resource_cnt_open(struct inode *inode, struct file *file)
-{
-       struct scsi_qla_host *vha = inode->i_private;
-
-       return single_open(file, qla_dfs_fw_resource_cnt_show, vha);
-}
-
-static const struct file_operations dfs_fw_resource_cnt_ops = {
-       .open           = qla_dfs_fw_resource_cnt_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(qla_dfs_fw_resource_cnt);
 
 static int
 qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
@@ -391,20 +352,7 @@ qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
        return 0;
 }
 
-static int
-qla_dfs_tgt_counters_open(struct inode *inode, struct file *file)
-{
-       struct scsi_qla_host *vha = inode->i_private;
-
-       return single_open(file, qla_dfs_tgt_counters_show, vha);
-}
-
-static const struct file_operations dfs_tgt_counters_ops = {
-       .open           = qla_dfs_tgt_counters_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(qla_dfs_tgt_counters);
 
 static int
 qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
@@ -606,19 +554,19 @@ create_dir:
 
 create_nodes:
        ha->dfs_fw_resource_cnt = debugfs_create_file("fw_resource_count",
-           S_IRUSR, ha->dfs_dir, vha, &dfs_fw_resource_cnt_ops);
+           S_IRUSR, ha->dfs_dir, vha, &qla_dfs_fw_resource_cnt_fops);
 
        ha->dfs_tgt_counters = debugfs_create_file("tgt_counters", S_IRUSR,
-           ha->dfs_dir, vha, &dfs_tgt_counters_ops);
+           ha->dfs_dir, vha, &qla_dfs_tgt_counters_fops);
 
        ha->tgt.dfs_tgt_port_database = debugfs_create_file("tgt_port_database",
-           S_IRUSR,  ha->dfs_dir, vha, &dfs_tgt_port_database_ops);
+           S_IRUSR,  ha->dfs_dir, vha, &qla2x00_dfs_tgt_port_database_fops);
 
        ha->dfs_fce = debugfs_create_file("fce", S_IRUSR, ha->dfs_dir, vha,
            &dfs_fce_ops);
 
        ha->tgt.dfs_tgt_sess = debugfs_create_file("tgt_sess",
-               S_IRUSR, ha->dfs_dir, vha, &dfs_tgt_sess_ops);
+               S_IRUSR, ha->dfs_dir, vha, &qla2x00_dfs_tgt_sess_fops);
 
        if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) {
                ha->tgt.dfs_naqp = debugfs_create_file("naqp",
index a39b1a8..a24b82d 100644 (file)
@@ -1838,6 +1838,7 @@ qla24xx_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
     struct mbx_24xx_entry *pkt)
 {
        const char func[] = "MBX-IOCB2";
+       struct qla_hw_data *ha = vha->hw;
        srb_t *sp;
        struct srb_iocb *si;
        u16 sz, i;
@@ -1847,6 +1848,18 @@ qla24xx_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
        if (!sp)
                return;
 
+       if (sp->type == SRB_SCSI_CMD ||
+           sp->type == SRB_NVME_CMD ||
+           sp->type == SRB_TM_CMD) {
+               ql_log(ql_log_warn, vha, 0x509d,
+                       "Inconsistent event entry type %d\n", sp->type);
+               if (IS_P3P_TYPE(ha))
+                       set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
+               else
+                       set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
+               return;
+       }
+
        si = &sp->u.iocb_cmd;
        sz = min(ARRAY_SIZE(pkt->mb), ARRAY_SIZE(sp->u.iocb_cmd.u.mbx.in_mb));
 
@@ -3399,32 +3412,6 @@ void qla24xx_nvme_ls4_iocb(struct scsi_qla_host *vha,
        sp->done(sp, comp_status);
 }
 
-static void qla24xx_process_mbx_iocb_response(struct scsi_qla_host *vha,
-       struct rsp_que *rsp, struct sts_entry_24xx *pkt)
-{
-       struct qla_hw_data *ha = vha->hw;
-       srb_t *sp;
-       static const char func[] = "MBX-IOCB2";
-
-       sp = qla2x00_get_sp_from_handle(vha, func, rsp->req, pkt);
-       if (!sp)
-               return;
-
-       if (sp->type == SRB_SCSI_CMD ||
-           sp->type == SRB_NVME_CMD ||
-           sp->type == SRB_TM_CMD) {
-               ql_log(ql_log_warn, vha, 0x509d,
-                       "Inconsistent event entry type %d\n", sp->type);
-               if (IS_P3P_TYPE(ha))
-                       set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
-               else
-                       set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
-               return;
-       }
-
-       qla24xx_mbx_iocb_entry(vha, rsp->req, (struct mbx_24xx_entry *)pkt);
-}
-
 /**
  * qla24xx_process_response_queue() - Process response queue entries.
  * @vha: SCSI driver HA context
@@ -3534,7 +3521,8 @@ process_err:
                            (struct abort_entry_24xx *)pkt);
                        break;
                case MBX_IOCB_TYPE:
-                       qla24xx_process_mbx_iocb_response(vha, rsp, pkt);
+                       qla24xx_mbx_iocb_entry(vha, rsp->req,
+                           (struct mbx_24xx_entry *)pkt);
                        break;
                case VP_CTRL_IOCB_TYPE:
                        qla_ctrlvp_completed(vha, rsp->req,
index b4f22db..b7a1dc2 100644 (file)
@@ -541,7 +541,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
        fc_port_t *fcport;
        struct srb_iocb *nvme;
        struct scsi_qla_host *vha;
-       int rval = -ENODEV;
+       int rval;
        srb_t *sp;
        struct qla_qpair *qpair = hw_queue_handle;
        struct nvme_private *priv = fd->private;
@@ -549,19 +549,21 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
 
        if (!priv) {
                /* nvme association has been torn down */
-               return rval;
+               return -ENODEV;
        }
 
        fcport = qla_rport->fcport;
 
-       if (!qpair || !fcport || (qpair && !qpair->fw_started) ||
-           (fcport && fcport->deleted))
-               return rval;
+       if (!qpair || !fcport)
+               return -ENODEV;
+
+       if (!qpair->fw_started || fcport->deleted)
+               return -EBUSY;
 
        vha = fcport->vha;
 
        if (!(fcport->nvme_flag & NVME_FLAG_REGISTERED))
-               return rval;
+               return -ENODEV;
 
        if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
            (qpair && !qpair->fw_started) || fcport->deleted)
index 3a415b1..01ccd45 100644 (file)
@@ -659,7 +659,7 @@ static int
 qla8044_poll_reg(struct scsi_qla_host *vha, uint32_t addr,
        int duration, uint32_t test_mask, uint32_t test_result)
 {
-       uint32_t value;
+       uint32_t value = 0;
        int timeout_error;
        uint8_t retries;
        int ret_val = QLA_SUCCESS;
index 84f4416..bd8623e 100644 (file)
@@ -1001,10 +1001,8 @@ qla27xx_mpi_fwdump(scsi_qla_host_t *vha, int hardware_locked)
 {
        ulong flags = 0;
 
-#ifndef __CHECKER__
        if (!hardware_locked)
                spin_lock_irqsave(&vha->hw->hardware_lock, flags);
-#endif
        if (!vha->hw->mpi_fw_dump) {
                ql_log(ql_log_warn, vha, 0x02f3, "-> mpi_fwdump no buffer\n");
        } else {
@@ -1050,10 +1048,8 @@ qla27xx_mpi_fwdump(scsi_qla_host_t *vha, int hardware_locked)
        }
 
 bailout:
-#ifndef __CHECKER__
        if (!hardware_locked)
                spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
-#endif
 }
 
 void
index fd3aabb..f1767b2 100644 (file)
@@ -3225,7 +3225,7 @@ static void qla4_8xxx_uevent_emit(struct scsi_qla_host *ha, u32 code)
 
        switch (code) {
        case QL4_UEVENT_CODE_FW_DUMP:
-               snprintf(event_string, sizeof(event_string), "FW_DUMP=%ld",
+               snprintf(event_string, sizeof(event_string), "FW_DUMP=%lu",
                         ha->host_no);
                break;
        default:
index 97ff31e..60c7a7d 100644 (file)
@@ -293,21 +293,6 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
 }
 EXPORT_SYMBOL(__scsi_execute);
 
-/**
- * scsi_init_cmd_errh - Initialize cmd fields related to error handling.
- * @cmd:  command that is ready to be queued.
- *
- * This function has the job of initializing a number of fields related to error
- * handling. Typically this will be called once for each command, as required.
- */
-static void scsi_init_cmd_errh(struct scsi_cmnd *cmd)
-{
-       scsi_set_resid(cmd, 0);
-       memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
-       if (cmd->cmd_len == 0)
-               cmd->cmd_len = scsi_command_size(cmd->cmnd);
-}
-
 /*
  * Wake up the error handler if necessary. Avoid as follows that the error
  * handler is not woken up if host in-flight requests number ==
@@ -530,7 +515,7 @@ static void scsi_uninit_cmd(struct scsi_cmnd *cmd)
        }
 }
 
-static void scsi_free_sgtables(struct scsi_cmnd *cmd)
+void scsi_free_sgtables(struct scsi_cmnd *cmd)
 {
        if (cmd->sdb.table.nents)
                sg_free_table_chained(&cmd->sdb.table,
@@ -539,6 +524,7 @@ static void scsi_free_sgtables(struct scsi_cmnd *cmd)
                sg_free_table_chained(&cmd->prot_sdb->table,
                                SCSI_INLINE_PROT_SG_CNT);
 }
+EXPORT_SYMBOL_GPL(scsi_free_sgtables);
 
 static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd)
 {
@@ -791,6 +777,15 @@ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result)
                        /* See SSC3rXX or current. */
                        action = ACTION_FAIL;
                        break;
+               case DATA_PROTECT:
+                       action = ACTION_FAIL;
+                       if ((sshdr.asc == 0x0C && sshdr.ascq == 0x12) ||
+                           (sshdr.asc == 0x55 &&
+                            (sshdr.ascq == 0x0E || sshdr.ascq == 0x0F))) {
+                               /* Insufficient zone resources */
+                               blk_stat = BLK_STS_ZONE_OPEN_RESOURCE;
+                       }
+                       break;
                default:
                        action = ACTION_FAIL;
                        break;
@@ -998,7 +993,7 @@ static inline bool scsi_cmd_needs_dma_drain(struct scsi_device *sdev,
 }
 
 /**
- * scsi_init_io - SCSI I/O initialization function.
+ * scsi_alloc_sgtables - allocate S/G tables for a command
  * @cmd:  command descriptor we wish to initialize
  *
  * Returns:
@@ -1006,7 +1001,7 @@ static inline bool scsi_cmd_needs_dma_drain(struct scsi_device *sdev,
  * * BLK_STS_RESOURCE - if the failure is retryable
  * * BLK_STS_IOERR    - if the failure is fatal
  */
-blk_status_t scsi_init_io(struct scsi_cmnd *cmd)
+blk_status_t scsi_alloc_sgtables(struct scsi_cmnd *cmd)
 {
        struct scsi_device *sdev = cmd->device;
        struct request *rq = cmd->request;
@@ -1098,7 +1093,7 @@ out_free_sgtables:
        scsi_free_sgtables(cmd);
        return ret;
 }
-EXPORT_SYMBOL(scsi_init_io);
+EXPORT_SYMBOL(scsi_alloc_sgtables);
 
 /**
  * scsi_initialize_rq - initialize struct scsi_cmnd partially
@@ -1186,7 +1181,7 @@ static blk_status_t scsi_setup_scsi_cmnd(struct scsi_device *sdev,
         * submit a request without an attached bio.
         */
        if (req->bio) {
-               blk_status_t ret = scsi_init_io(cmd);
+               blk_status_t ret = scsi_alloc_sgtables(cmd);
                if (unlikely(ret != BLK_STS_OK))
                        return ret;
        } else {
@@ -1196,58 +1191,16 @@ static blk_status_t scsi_setup_scsi_cmnd(struct scsi_device *sdev,
        }
 
        cmd->cmd_len = scsi_req(req)->cmd_len;
+       if (cmd->cmd_len == 0)
+               cmd->cmd_len = scsi_command_size(cmd->cmnd);
        cmd->cmnd = scsi_req(req)->cmd;
        cmd->transfersize = blk_rq_bytes(req);
        cmd->allowed = scsi_req(req)->retries;
        return BLK_STS_OK;
 }
 
-/*
- * Setup a normal block command.  These are simple request from filesystems
- * that still need to be translated to SCSI CDBs from the ULD.
- */
-static blk_status_t scsi_setup_fs_cmnd(struct scsi_device *sdev,
-               struct request *req)
-{
-       struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
-
-       if (unlikely(sdev->handler && sdev->handler->prep_fn)) {
-               blk_status_t ret = sdev->handler->prep_fn(sdev, req);
-               if (ret != BLK_STS_OK)
-                       return ret;
-       }
-
-       cmd->cmnd = scsi_req(req)->cmd = scsi_req(req)->__cmd;
-       memset(cmd->cmnd, 0, BLK_MAX_CDB);
-       return scsi_cmd_to_driver(cmd)->init_command(cmd);
-}
-
-static blk_status_t scsi_setup_cmnd(struct scsi_device *sdev,
-               struct request *req)
-{
-       struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
-       blk_status_t ret;
-
-       if (!blk_rq_bytes(req))
-               cmd->sc_data_direction = DMA_NONE;
-       else if (rq_data_dir(req) == WRITE)
-               cmd->sc_data_direction = DMA_TO_DEVICE;
-       else
-               cmd->sc_data_direction = DMA_FROM_DEVICE;
-
-       if (blk_rq_is_scsi(req))
-               ret = scsi_setup_scsi_cmnd(sdev, req);
-       else
-               ret = scsi_setup_fs_cmnd(sdev, req);
-
-       if (ret != BLK_STS_OK)
-               scsi_free_sgtables(cmd);
-
-       return ret;
-}
-
 static blk_status_t
-scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
+scsi_device_state_check(struct scsi_device *sdev, struct request *req)
 {
        switch (sdev->sdev_state) {
        case SDEV_OFFLINE:
@@ -1589,7 +1542,7 @@ static unsigned int scsi_mq_inline_sgl_size(struct Scsi_Host *shost)
                sizeof(struct scatterlist);
 }
 
-static blk_status_t scsi_mq_prep_fn(struct request *req)
+static blk_status_t scsi_prepare_cmd(struct request *req)
 {
        struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
        struct scsi_device *sdev = req->q->queuedata;
@@ -1601,6 +1554,10 @@ static blk_status_t scsi_mq_prep_fn(struct request *req)
        cmd->request = req;
        cmd->tag = req->tag;
        cmd->prot_op = SCSI_PROT_NORMAL;
+       if (blk_rq_bytes(req))
+               cmd->sc_data_direction = rq_dma_dir(req);
+       else
+               cmd->sc_data_direction = DMA_NONE;
 
        sg = (void *)cmd + sizeof(struct scsi_cmnd) + shost->hostt->cmd_size;
        cmd->sdb.table.sgl = sg;
@@ -1612,9 +1569,23 @@ static blk_status_t scsi_mq_prep_fn(struct request *req)
                        (struct scatterlist *)(cmd->prot_sdb + 1);
        }
 
-       blk_mq_start_request(req);
+       /*
+        * Special handling for passthrough commands, which don't go to the ULP
+        * at all:
+        */
+       if (blk_rq_is_scsi(req))
+               return scsi_setup_scsi_cmnd(sdev, req);
+
+       if (sdev->handler && sdev->handler->prep_fn) {
+               blk_status_t ret = sdev->handler->prep_fn(sdev, req);
+
+               if (ret != BLK_STS_OK)
+                       return ret;
+       }
 
-       return scsi_setup_cmnd(sdev, req);
+       cmd->cmnd = scsi_req(req)->cmd = scsi_req(req)->__cmd;
+       memset(cmd->cmnd, 0, BLK_MAX_CDB);
+       return scsi_cmd_to_driver(cmd)->init_command(cmd);
 }
 
 static void scsi_mq_done(struct scsi_cmnd *cmd)
@@ -1680,7 +1651,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
         * commands.
         */
        if (unlikely(sdev->sdev_state != SDEV_RUNNING)) {
-               ret = scsi_prep_state_check(sdev, req);
+               ret = scsi_device_state_check(sdev, req);
                if (ret != BLK_STS_OK)
                        goto out_put_budget;
        }
@@ -1692,13 +1663,12 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
                goto out_dec_target_busy;
 
        if (!(req->rq_flags & RQF_DONTPREP)) {
-               ret = scsi_mq_prep_fn(req);
+               ret = scsi_prepare_cmd(req);
                if (ret != BLK_STS_OK)
                        goto out_dec_host_busy;
                req->rq_flags |= RQF_DONTPREP;
        } else {
                clear_bit(SCMD_STATE_COMPLETE, &cmd->state);
-               blk_mq_start_request(req);
        }
 
        cmd->flags &= SCMD_PRESERVED_FLAGS;
@@ -1707,9 +1677,11 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
        if (bd->last)
                cmd->flags |= SCMD_LAST;
 
-       scsi_init_cmd_errh(cmd);
+       scsi_set_resid(cmd, 0);
+       memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
        cmd->scsi_done = scsi_mq_done;
 
+       blk_mq_start_request(req);
        reason = scsi_dispatch_cmd(cmd);
        if (reason) {
                scsi_set_blocked(cmd, reason);
@@ -1970,7 +1942,6 @@ struct scsi_device *scsi_device_from_queue(struct request_queue *q)
 
        return sdev;
 }
-EXPORT_SYMBOL_GPL(scsi_device_from_queue);
 
 /**
  * scsi_block_requests - Utility function used by low-level drivers to prevent
index f2437a7..9af50e6 100644 (file)
@@ -1714,15 +1714,16 @@ static void scsi_sysfs_add_devices(struct Scsi_Host *shost)
  */
 static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost)
 {
-       struct async_scan_data *data;
+       struct async_scan_data *data = NULL;
        unsigned long flags;
 
        if (strncmp(scsi_scan_type, "sync", 4) == 0)
                return NULL;
 
+       mutex_lock(&shost->scan_mutex);
        if (shost->async_scan) {
                shost_printk(KERN_DEBUG, shost, "%s called twice\n", __func__);
-               return NULL;
+               goto err;
        }
 
        data = kmalloc(sizeof(*data), GFP_KERNEL);
@@ -1733,7 +1734,6 @@ static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost)
                goto err;
        init_completion(&data->prev_finished);
 
-       mutex_lock(&shost->scan_mutex);
        spin_lock_irqsave(shost->host_lock, flags);
        shost->async_scan = 1;
        spin_unlock_irqrestore(shost->host_lock, flags);
@@ -1748,6 +1748,7 @@ static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost)
        return data;
 
  err:
+       mutex_unlock(&shost->scan_mutex);
        kfree(data);
        return NULL;
 }
index 83c4d95..656bcf4 100644 (file)
@@ -902,7 +902,7 @@ static blk_status_t sd_setup_unmap_cmnd(struct scsi_cmnd *cmd)
        cmd->transfersize = data_len;
        rq->timeout = SD_TIMEOUT;
 
-       return scsi_init_io(cmd);
+       return scsi_alloc_sgtables(cmd);
 }
 
 static blk_status_t sd_setup_write_same16_cmnd(struct scsi_cmnd *cmd,
@@ -934,7 +934,7 @@ static blk_status_t sd_setup_write_same16_cmnd(struct scsi_cmnd *cmd,
        cmd->transfersize = data_len;
        rq->timeout = unmap ? SD_TIMEOUT : SD_WRITE_SAME_TIMEOUT;
 
-       return scsi_init_io(cmd);
+       return scsi_alloc_sgtables(cmd);
 }
 
 static blk_status_t sd_setup_write_same10_cmnd(struct scsi_cmnd *cmd,
@@ -966,7 +966,7 @@ static blk_status_t sd_setup_write_same10_cmnd(struct scsi_cmnd *cmd,
        cmd->transfersize = data_len;
        rq->timeout = unmap ? SD_TIMEOUT : SD_WRITE_SAME_TIMEOUT;
 
-       return scsi_init_io(cmd);
+       return scsi_alloc_sgtables(cmd);
 }
 
 static blk_status_t sd_setup_write_zeroes_cmnd(struct scsi_cmnd *cmd)
@@ -1107,7 +1107,7 @@ static blk_status_t sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
         * knows how much to actually write.
         */
        rq->__data_len = sdp->sector_size;
-       ret = scsi_init_io(cmd);
+       ret = scsi_alloc_sgtables(cmd);
        rq->__data_len = blk_rq_bytes(rq);
 
        return ret;
@@ -1226,23 +1226,24 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
        unsigned int dif;
        bool dix;
 
-       ret = scsi_init_io(cmd);
+       ret = scsi_alloc_sgtables(cmd);
        if (ret != BLK_STS_OK)
                return ret;
 
+       ret = BLK_STS_IOERR;
        if (!scsi_device_online(sdp) || sdp->changed) {
                scmd_printk(KERN_ERR, cmd, "device offline or changed\n");
-               return BLK_STS_IOERR;
+               goto fail;
        }
 
        if (blk_rq_pos(rq) + blk_rq_sectors(rq) > get_capacity(rq->rq_disk)) {
                scmd_printk(KERN_ERR, cmd, "access beyond end of device\n");
-               return BLK_STS_IOERR;
+               goto fail;
        }
 
        if ((blk_rq_pos(rq) & mask) || (blk_rq_sectors(rq) & mask)) {
                scmd_printk(KERN_ERR, cmd, "request not aligned to the logical block size\n");
-               return BLK_STS_IOERR;
+               goto fail;
        }
 
        /*
@@ -1264,7 +1265,7 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
        if (req_op(rq) == REQ_OP_ZONE_APPEND) {
                ret = sd_zbc_prepare_zone_append(cmd, &lba, nr_blocks);
                if (ret)
-                       return ret;
+                       goto fail;
        }
 
        fua = rq->cmd_flags & REQ_FUA ? 0x8 : 0;
@@ -1292,7 +1293,7 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
        }
 
        if (unlikely(ret != BLK_STS_OK))
-               return ret;
+               goto fail;
 
        /*
         * We shouldn't disconnect in the middle of a sector, so with a dumb
@@ -1316,10 +1317,12 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
                                     blk_rq_sectors(rq)));
 
        /*
-        * This indicates that the command is ready from our end to be
-        * queued.
+        * This indicates that the command is ready from our end to be queued.
         */
        return BLK_STS_OK;
+fail:
+       scsi_free_sgtables(cmd);
+       return ret;
 }
 
 static blk_status_t sd_init_command(struct scsi_cmnd *cmd)
index 4c8e64e..3455dd7 100644 (file)
@@ -31,8 +31,6 @@ void svnic_cq_free(struct vnic_cq *cq)
 int svnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq,
        unsigned int index, unsigned int desc_count, unsigned int desc_size)
 {
-       int err;
-
        cq->index = index;
        cq->vdev = vdev;
 
@@ -43,11 +41,7 @@ int svnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq,
                return -EINVAL;
        }
 
-       err = svnic_dev_alloc_desc_ring(vdev, &cq->ring, desc_count, desc_size);
-       if (err)
-               return err;
-
-       return 0;
+       return svnic_dev_alloc_desc_ring(vdev, &cq->ring, desc_count, desc_size);
 }
 
 void svnic_cq_init(struct vnic_cq *cq, unsigned int flow_control_enable,
index 2b43c0f..fd4b582 100644 (file)
@@ -392,15 +392,11 @@ static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt)
        struct request *rq = SCpnt->request;
        blk_status_t ret;
 
-       ret = scsi_init_io(SCpnt);
+       ret = scsi_alloc_sgtables(SCpnt);
        if (ret != BLK_STS_OK)
-               goto out;
+               return ret;
        cd = scsi_cd(rq->rq_disk);
 
-       /* from here on until we're complete, any goto out
-        * is used for a killable error condition */
-       ret = BLK_STS_IOERR;
-
        SCSI_LOG_HLQUEUE(1, scmd_printk(KERN_INFO, SCpnt,
                "Doing sr request, block = %d\n", block));
 
@@ -507,14 +503,15 @@ static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt)
        SCpnt->transfersize = cd->device->sector_size;
        SCpnt->underflow = this_count << 9;
        SCpnt->allowed = MAX_RETRIES;
+       SCpnt->cmd_len = 10;
 
        /*
-        * This indicates that the command is ready from our end to be
-        * queued.
+        * This indicates that the command is ready from our end to be queued.
         */
-       ret = BLK_STS_OK;
+       return BLK_STS_OK;
  out:
-       return ret;
+       scsi_free_sgtables(SCpnt);
+       return BLK_STS_IOERR;
 }
 
 static void sr_revalidate_disk(struct scsi_cd *cd)
index cc11daa..a9fe092 100644 (file)
@@ -5656,7 +5656,7 @@ int sym_hcb_attach(struct Scsi_Host *shost, struct sym_fw *fw, struct sym_nvram
        /*
         *  Allocate the array of lists of CCBs hashed by DSA.
         */
-       np->ccbh = kcalloc(CCB_HASH_SIZE, sizeof(struct sym_ccb **), GFP_KERNEL);
+       np->ccbh = kcalloc(CCB_HASH_SIZE, sizeof(*np->ccbh), GFP_KERNEL);
        if (!np->ccbh)
                goto attach_failed;
 
index 291a206..e3f3660 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/soc/actions/owl-sps.h>
 
 #define OWL_SPS_PG_CTL 0x0
 
index 43665b7..5164a4d 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/reset.h>
 #include <linux/clk.h>
 #include <dt-bindings/power/meson8-power.h>
+#include <dt-bindings/power/meson-axg-power.h>
 #include <dt-bindings/power/meson-g12a-power.h>
 #include <dt-bindings/power/meson-gxbb-power.h>
 #include <dt-bindings/power/meson-sm1-power.h>
@@ -134,6 +135,11 @@ static struct meson_ee_pwrc_top_domain sm1_pwrc_ge2d = SM1_EE_PD(19);
        { __reg, BIT(14) },                                     \
        { __reg, BIT(15) }
 
+static struct meson_ee_pwrc_mem_domain axg_pwrc_mem_vpu[] = {
+       VPU_MEMPD(HHI_VPU_MEM_PD_REG0),
+       VPU_HHI_MEMPD(HHI_MEM_PD_REG0),
+};
+
 static struct meson_ee_pwrc_mem_domain g12a_pwrc_mem_vpu[] = {
        VPU_MEMPD(HHI_VPU_MEM_PD_REG0),
        VPU_MEMPD(HHI_VPU_MEM_PD_REG1),
@@ -190,6 +196,10 @@ static struct meson_ee_pwrc_mem_domain sm1_pwrc_mem_ge2d[] = {
        { HHI_MEM_PD_REG0, GENMASK(25, 18) },
 };
 
+static struct meson_ee_pwrc_mem_domain axg_pwrc_mem_audio[] = {
+       { HHI_MEM_PD_REG0, GENMASK(5, 4) },
+};
+
 static struct meson_ee_pwrc_mem_domain sm1_pwrc_mem_audio[] = {
        { HHI_MEM_PD_REG0, GENMASK(5, 4) },
        { HHI_AUDIO_MEM_PD_REG0, GENMASK(1, 0) },
@@ -231,6 +241,13 @@ static struct meson_ee_pwrc_mem_domain sm1_pwrc_mem_audio[] = {
 
 static bool pwrc_ee_get_power(struct meson_ee_pwrc_domain *pwrc_domain);
 
+static struct meson_ee_pwrc_domain_desc axg_pwrc_domains[] = {
+       [PWRC_AXG_VPU_ID]  = VPU_PD("VPU", &gx_pwrc_vpu, axg_pwrc_mem_vpu,
+                                    pwrc_ee_get_power, 5, 2),
+       [PWRC_AXG_ETHERNET_MEM_ID] = MEM_PD("ETH", meson_pwrc_mem_eth),
+       [PWRC_AXG_AUDIO_ID] = MEM_PD("AUDIO", axg_pwrc_mem_audio),
+};
+
 static struct meson_ee_pwrc_domain_desc g12a_pwrc_domains[] = {
        [PWRC_G12A_VPU_ID]  = VPU_PD("VPU", &gx_pwrc_vpu, g12a_pwrc_mem_vpu,
                                     pwrc_ee_get_power, 11, 2),
@@ -433,8 +450,8 @@ static int meson_ee_pwrc_init_domain(struct platform_device *pdev,
                if (ret)
                        return ret;
 
-               ret = pm_genpd_init(&dom->base, &pm_domain_always_on_gov,
-                                   false);
+               dom->base.flags = GENPD_FLAG_ALWAYS_ON;
+               ret = pm_genpd_init(&dom->base, NULL, false);
                if (ret)
                        return ret;
        } else {
@@ -529,6 +546,11 @@ static struct meson_ee_pwrc_domain_data meson_ee_g12a_pwrc_data = {
        .domains = g12a_pwrc_domains,
 };
 
+static struct meson_ee_pwrc_domain_data meson_ee_axg_pwrc_data = {
+       .count = ARRAY_SIZE(axg_pwrc_domains),
+       .domains = axg_pwrc_domains,
+};
+
 static struct meson_ee_pwrc_domain_data meson_ee_gxbb_pwrc_data = {
        .count = ARRAY_SIZE(gxbb_pwrc_domains),
        .domains = gxbb_pwrc_domains,
@@ -563,6 +585,10 @@ static const struct of_device_id meson_ee_pwrc_match_table[] = {
                .data = &meson_ee_m8b_pwrc_data,
        },
        {
+               .compatible = "amlogic,meson-axg-pwrc",
+               .data = &meson_ee_axg_pwrc_data,
+       },
+       {
                .compatible = "amlogic,meson-gxbb-pwrc",
                .data = &meson_ee_gxbb_pwrc_data,
        },
index 511b685..21b4bc8 100644 (file)
@@ -339,8 +339,8 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
                        return ret;
        }
 
-       pm_genpd_init(&vpu_pd->genpd, &pm_domain_always_on_gov,
-                     powered_off);
+       vpu_pd->genpd.flags = GENPD_FLAG_ALWAYS_ON;
+       pm_genpd_init(&vpu_pd->genpd, NULL, powered_off);
 
        return of_genpd_add_provider_simple(pdev->dev.of_node,
                                            &vpu_pd->genpd);
index 648e326..24f92a6 100644 (file)
@@ -22,6 +22,15 @@ config RASPBERRYPI_POWER
          This enables support for the RPi power domains which can be enabled
          or disabled via the RPi firmware.
 
+config SOC_BCM63XX
+       bool "Broadcom 63xx SoC drivers"
+       depends on BMIPS_GENERIC || COMPILE_TEST
+       help
+         Enables drivers for the Broadcom 63xx series of chips.
+         Drivers can be enabled individually within this menu.
+
+         If unsure, say N.
+
 config SOC_BRCMSTB
        bool "Broadcom STB SoC drivers"
        depends on ARM || ARM64 || BMIPS_GENERIC || COMPILE_TEST
@@ -33,6 +42,7 @@ config SOC_BRCMSTB
 
          If unsure, say N.
 
+source "drivers/soc/bcm/bcm63xx/Kconfig"
 source "drivers/soc/bcm/brcmstb/Kconfig"
 
 endmenu
index d92268a..7bc90e0 100644 (file)
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BCM2835_POWER)    += bcm2835-power.o
 obj-$(CONFIG_RASPBERRYPI_POWER)        += raspberrypi-power.o
+obj-$(CONFIG_SOC_BCM63XX)      += bcm63xx/
 obj-$(CONFIG_SOC_BRCMSTB)      += brcmstb/
diff --git a/drivers/soc/bcm/bcm63xx/Kconfig b/drivers/soc/bcm/bcm63xx/Kconfig
new file mode 100644 (file)
index 0000000..16f648a
--- /dev/null
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0-only
+if SOC_BCM63XX
+
+config BCM63XX_POWER
+       bool "BCM63xx power domain driver"
+       depends on BMIPS_GENERIC || (COMPILE_TEST && OF)
+       select PM_GENERIC_DOMAINS if PM
+       help
+         This enables support for the BCM63xx power domains controller on
+         BCM6318, BCM6328, BCM6362 and BCM63268 SoCs.
+
+endif # SOC_BCM63XX
diff --git a/drivers/soc/bcm/bcm63xx/Makefile b/drivers/soc/bcm/bcm63xx/Makefile
new file mode 100644 (file)
index 0000000..0710d5e
--- /dev/null
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_BCM63XX_POWER) += bcm63xx-power.o
diff --git a/drivers/soc/bcm/bcm63xx/bcm63xx-power.c b/drivers/soc/bcm/bcm63xx/bcm63xx-power.c
new file mode 100644 (file)
index 0000000..515fe18
--- /dev/null
@@ -0,0 +1,378 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * BCM63xx Power Domain Controller Driver
+ *
+ * Copyright (C) 2020 Álvaro Fernández Rojas <noltari@gmail.com>
+ */
+
+#include <dt-bindings/soc/bcm6318-pm.h>
+#include <dt-bindings/soc/bcm6328-pm.h>
+#include <dt-bindings/soc/bcm6362-pm.h>
+#include <dt-bindings/soc/bcm63268-pm.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/pm_domain.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+
+struct bcm63xx_power_dev {
+       struct generic_pm_domain genpd;
+       struct bcm63xx_power *power;
+       uint32_t mask;
+};
+
+struct bcm63xx_power {
+       void __iomem *base;
+       spinlock_t lock;
+       struct bcm63xx_power_dev *dev;
+       struct genpd_onecell_data genpd_data;
+       struct generic_pm_domain **genpd;
+};
+
+struct bcm63xx_power_data {
+       const char * const name;
+       uint8_t bit;
+       unsigned int flags;
+};
+
+static int bcm63xx_power_get_state(struct bcm63xx_power_dev *pmd, bool *is_on)
+{
+       struct bcm63xx_power *power = pmd->power;
+
+       if (!pmd->mask) {
+               *is_on = false;
+               return -EINVAL;
+       }
+
+       *is_on = !(__raw_readl(power->base) & pmd->mask);
+
+       return 0;
+}
+
+static int bcm63xx_power_set_state(struct bcm63xx_power_dev *pmd, bool on)
+{
+       struct bcm63xx_power *power = pmd->power;
+       unsigned long flags;
+       uint32_t val;
+
+       if (!pmd->mask)
+               return -EINVAL;
+
+       spin_lock_irqsave(&power->lock, flags);
+       val = __raw_readl(power->base);
+       if (on)
+               val &= ~pmd->mask;
+       else
+               val |= pmd->mask;
+       __raw_writel(val, power->base);
+       spin_unlock_irqrestore(&power->lock, flags);
+
+       return 0;
+}
+
+static int bcm63xx_power_on(struct generic_pm_domain *genpd)
+{
+       struct bcm63xx_power_dev *pmd = container_of(genpd,
+               struct bcm63xx_power_dev, genpd);
+
+       return bcm63xx_power_set_state(pmd, true);
+}
+
+static int bcm63xx_power_off(struct generic_pm_domain *genpd)
+{
+       struct bcm63xx_power_dev *pmd = container_of(genpd,
+               struct bcm63xx_power_dev, genpd);
+
+       return bcm63xx_power_set_state(pmd, false);
+}
+
+static int bcm63xx_power_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct device_node *np = dev->of_node;
+       struct resource *res;
+       const struct bcm63xx_power_data *entry, *table;
+       struct bcm63xx_power *power;
+       unsigned int ndom;
+       uint8_t max_bit = 0;
+       int ret;
+
+       power = devm_kzalloc(dev, sizeof(*power), GFP_KERNEL);
+       if (!power)
+               return -ENOMEM;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       power->base = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(power->base))
+               return PTR_ERR(power->base);
+
+       table = of_device_get_match_data(dev);
+       if (!table)
+               return -EINVAL;
+
+       power->genpd_data.num_domains = 0;
+       ndom = 0;
+       for (entry = table; entry->name; entry++) {
+               max_bit = max(max_bit, entry->bit);
+               ndom++;
+       }
+
+       if (!ndom)
+               return -ENODEV;
+
+       power->genpd_data.num_domains = max_bit + 1;
+
+       power->dev = devm_kcalloc(dev, power->genpd_data.num_domains,
+                                 sizeof(struct bcm63xx_power_dev),
+                                 GFP_KERNEL);
+       if (!power->dev)
+               return -ENOMEM;
+
+       power->genpd = devm_kcalloc(dev, power->genpd_data.num_domains,
+                                   sizeof(struct generic_pm_domain *),
+                                   GFP_KERNEL);
+       if (!power->genpd)
+               return -ENOMEM;
+
+       power->genpd_data.domains = power->genpd;
+
+       ndom = 0;
+       for (entry = table; entry->name; entry++) {
+               struct bcm63xx_power_dev *pmd = &power->dev[ndom];
+               bool is_on;
+
+               pmd->power = power;
+               pmd->mask = BIT(entry->bit);
+               pmd->genpd.name = entry->name;
+               pmd->genpd.flags = entry->flags;
+
+               ret = bcm63xx_power_get_state(pmd, &is_on);
+               if (ret)
+                       dev_warn(dev, "unable to get current state for %s\n",
+                                pmd->genpd.name);
+
+               pmd->genpd.power_on = bcm63xx_power_on;
+               pmd->genpd.power_off = bcm63xx_power_off;
+
+               pm_genpd_init(&pmd->genpd, NULL, !is_on);
+               power->genpd[entry->bit] = &pmd->genpd;
+
+               ndom++;
+       }
+
+       spin_lock_init(&power->lock);
+
+       ret = of_genpd_add_provider_onecell(np, &power->genpd_data);
+       if (ret) {
+               dev_err(dev, "failed to register genpd driver: %d\n", ret);
+               return ret;
+       }
+
+       dev_info(dev, "registered %u power domains\n", ndom);
+
+       return 0;
+}
+
+static const struct bcm63xx_power_data bcm6318_power_domains[] = {
+       {
+               .name = "pcie",
+               .bit = BCM6318_POWER_DOMAIN_PCIE,
+       }, {
+               .name = "usb",
+               .bit = BCM6318_POWER_DOMAIN_USB,
+       }, {
+               .name = "ephy0",
+               .bit = BCM6318_POWER_DOMAIN_EPHY0,
+       }, {
+               .name = "ephy1",
+               .bit = BCM6318_POWER_DOMAIN_EPHY1,
+       }, {
+               .name = "ephy2",
+               .bit = BCM6318_POWER_DOMAIN_EPHY2,
+       }, {
+               .name = "ephy3",
+               .bit = BCM6318_POWER_DOMAIN_EPHY3,
+       }, {
+               .name = "ldo2p5",
+               .bit = BCM6318_POWER_DOMAIN_LDO2P5,
+               .flags = GENPD_FLAG_ALWAYS_ON,
+       }, {
+               .name = "ldo2p9",
+               .bit = BCM6318_POWER_DOMAIN_LDO2P9,
+               .flags = GENPD_FLAG_ALWAYS_ON,
+       }, {
+               .name = "sw1p0",
+               .bit = BCM6318_POWER_DOMAIN_SW1P0,
+               .flags = GENPD_FLAG_ALWAYS_ON,
+       }, {
+               .name = "pad",
+               .bit = BCM6318_POWER_DOMAIN_PAD,
+               .flags = GENPD_FLAG_ALWAYS_ON,
+       }, {
+               /* sentinel */
+       },
+};
+
+static const struct bcm63xx_power_data bcm6328_power_domains[] = {
+       {
+               .name = "adsl2-mips",
+               .bit = BCM6328_POWER_DOMAIN_ADSL2_MIPS,
+       }, {
+               .name = "adsl2-phy",
+               .bit = BCM6328_POWER_DOMAIN_ADSL2_PHY,
+       }, {
+               .name = "adsl2-afe",
+               .bit = BCM6328_POWER_DOMAIN_ADSL2_AFE,
+       }, {
+               .name = "sar",
+               .bit = BCM6328_POWER_DOMAIN_SAR,
+       }, {
+               .name = "pcm",
+               .bit = BCM6328_POWER_DOMAIN_PCM,
+       }, {
+               .name = "usbd",
+               .bit = BCM6328_POWER_DOMAIN_USBD,
+       }, {
+               .name = "usbh",
+               .bit = BCM6328_POWER_DOMAIN_USBH,
+       }, {
+               .name = "pcie",
+               .bit = BCM6328_POWER_DOMAIN_PCIE,
+       }, {
+               .name = "robosw",
+               .bit = BCM6328_POWER_DOMAIN_ROBOSW,
+       }, {
+               .name = "ephy",
+               .bit = BCM6328_POWER_DOMAIN_EPHY,
+       }, {
+               /* sentinel */
+       },
+};
+
+static const struct bcm63xx_power_data bcm6362_power_domains[] = {
+       {
+               .name = "sar",
+               .bit = BCM6362_POWER_DOMAIN_SAR,
+       }, {
+               .name = "ipsec",
+               .bit = BCM6362_POWER_DOMAIN_IPSEC,
+       }, {
+               .name = "mips",
+               .bit = BCM6362_POWER_DOMAIN_MIPS,
+               .flags = GENPD_FLAG_ALWAYS_ON,
+       }, {
+               .name = "dect",
+               .bit = BCM6362_POWER_DOMAIN_DECT,
+       }, {
+               .name = "usbh",
+               .bit = BCM6362_POWER_DOMAIN_USBH,
+       }, {
+               .name = "usbd",
+               .bit = BCM6362_POWER_DOMAIN_USBD,
+       }, {
+               .name = "robosw",
+               .bit = BCM6362_POWER_DOMAIN_ROBOSW,
+       }, {
+               .name = "pcm",
+               .bit = BCM6362_POWER_DOMAIN_PCM,
+       }, {
+               .name = "periph",
+               .bit = BCM6362_POWER_DOMAIN_PERIPH,
+               .flags = GENPD_FLAG_ALWAYS_ON,
+       }, {
+               .name = "adsl-phy",
+               .bit = BCM6362_POWER_DOMAIN_ADSL_PHY,
+       }, {
+               .name = "gmii-pads",
+               .bit = BCM6362_POWER_DOMAIN_GMII_PADS,
+       }, {
+               .name = "fap",
+               .bit = BCM6362_POWER_DOMAIN_FAP,
+       }, {
+               .name = "pcie",
+               .bit = BCM6362_POWER_DOMAIN_PCIE,
+       }, {
+               .name = "wlan-pads",
+               .bit = BCM6362_POWER_DOMAIN_WLAN_PADS,
+       }, {
+               /* sentinel */
+       },
+};
+
+static const struct bcm63xx_power_data bcm63268_power_domains[] = {
+       {
+               .name = "sar",
+               .bit = BCM63268_POWER_DOMAIN_SAR,
+       }, {
+               .name = "ipsec",
+               .bit = BCM63268_POWER_DOMAIN_IPSEC,
+       }, {
+               .name = "mips",
+               .bit = BCM63268_POWER_DOMAIN_MIPS,
+               .flags = GENPD_FLAG_ALWAYS_ON,
+       }, {
+               .name = "dect",
+               .bit = BCM63268_POWER_DOMAIN_DECT,
+       }, {
+               .name = "usbh",
+               .bit = BCM63268_POWER_DOMAIN_USBH,
+       }, {
+               .name = "usbd",
+               .bit = BCM63268_POWER_DOMAIN_USBD,
+       }, {
+               .name = "robosw",
+               .bit = BCM63268_POWER_DOMAIN_ROBOSW,
+       }, {
+               .name = "pcm",
+               .bit = BCM63268_POWER_DOMAIN_PCM,
+       }, {
+               .name = "periph",
+               .bit = BCM63268_POWER_DOMAIN_PERIPH,
+               .flags = GENPD_FLAG_ALWAYS_ON,
+       }, {
+               .name = "vdsl-phy",
+               .bit = BCM63268_POWER_DOMAIN_VDSL_PHY,
+       }, {
+               .name = "vdsl-mips",
+               .bit = BCM63268_POWER_DOMAIN_VDSL_MIPS,
+       }, {
+               .name = "fap",
+               .bit = BCM63268_POWER_DOMAIN_FAP,
+       }, {
+               .name = "pcie",
+               .bit = BCM63268_POWER_DOMAIN_PCIE,
+       }, {
+               .name = "wlan-pads",
+               .bit = BCM63268_POWER_DOMAIN_WLAN_PADS,
+       }, {
+               /* sentinel */
+       },
+};
+
+static const struct of_device_id bcm63xx_power_of_match[] = {
+       {
+               .compatible = "brcm,bcm6318-power-controller",
+               .data = &bcm6318_power_domains,
+       }, {
+               .compatible = "brcm,bcm6328-power-controller",
+               .data = &bcm6328_power_domains,
+       }, {
+               .compatible = "brcm,bcm6362-power-controller",
+               .data = &bcm6362_power_domains,
+       }, {
+               .compatible = "brcm,bcm63268-power-controller",
+               .data = &bcm63268_power_domains,
+       }, {
+               /* sentinel */
+       }
+};
+
+static struct platform_driver bcm63xx_power_driver = {
+       .driver = {
+               .name = "bcm63xx-power-controller",
+               .of_match_table = bcm63xx_power_of_match,
+       },
+       .probe  = bcm63xx_power_probe,
+};
+builtin_platform_driver(bcm63xx_power_driver);
index 61731e0..7f8dc30 100644 (file)
 #include <linux/syscore_ops.h>
 #include <linux/soc/brcmstb/brcmstb.h>
 
+#define RACENPREF_MASK                 0x3
+#define RACPREFINST_SHIFT              0
+#define RACENINST_SHIFT                        2
+#define RACPREFDATA_SHIFT              4
+#define RACENDATA_SHIFT                        6
+#define RAC_CPU_SHIFT                  8
+#define RACCFG_MASK                    0xff
+#define DPREF_LINE_2_SHIFT             24
+#define DPREF_LINE_2_MASK              0xff
+
+/* Bitmask to enable instruction and data prefetching with a 256-bytes stride */
+#define RAC_DATA_INST_EN_MASK          (1 << RACPREFINST_SHIFT | \
+                                        RACENPREF_MASK << RACENINST_SHIFT | \
+                                        1 << RACPREFDATA_SHIFT | \
+                                        RACENPREF_MASK << RACENDATA_SHIFT)
+
 #define  CPU_CREDIT_REG_MCPx_WR_PAIRING_EN_MASK        0x70000000
 #define CPU_CREDIT_REG_MCPx_READ_CRED_MASK     0xf
 #define CPU_CREDIT_REG_MCPx_WRITE_CRED_MASK    0xf
@@ -31,11 +47,21 @@ static void __iomem *cpubiuctrl_base;
 static bool mcp_wr_pairing_en;
 static const int *cpubiuctrl_regs;
 
+enum cpubiuctrl_regs {
+       CPU_CREDIT_REG = 0,
+       CPU_MCP_FLOW_REG,
+       CPU_WRITEBACK_CTRL_REG,
+       RAC_CONFIG0_REG,
+       RAC_CONFIG1_REG,
+       NUM_CPU_BIUCTRL_REGS,
+};
+
 static inline u32 cbc_readl(int reg)
 {
        int offset = cpubiuctrl_regs[reg];
 
-       if (offset == -1)
+       if (offset == -1 ||
+           (IS_ENABLED(CONFIG_CACHE_B15_RAC) && reg >= RAC_CONFIG0_REG))
                return (u32)-1;
 
        return readl_relaxed(cpubiuctrl_base + offset);
@@ -45,22 +71,19 @@ static inline void cbc_writel(u32 val, int reg)
 {
        int offset = cpubiuctrl_regs[reg];
 
-       if (offset == -1)
+       if (offset == -1 ||
+           (IS_ENABLED(CONFIG_CACHE_B15_RAC) && reg >= RAC_CONFIG0_REG))
                return;
 
        writel(val, cpubiuctrl_base + offset);
 }
 
-enum cpubiuctrl_regs {
-       CPU_CREDIT_REG = 0,
-       CPU_MCP_FLOW_REG,
-       CPU_WRITEBACK_CTRL_REG
-};
-
 static const int b15_cpubiuctrl_regs[] = {
        [CPU_CREDIT_REG] = 0x184,
        [CPU_MCP_FLOW_REG] = -1,
        [CPU_WRITEBACK_CTRL_REG] = -1,
+       [RAC_CONFIG0_REG] = -1,
+       [RAC_CONFIG1_REG] = -1,
 };
 
 /* Odd cases, e.g: 7260A0 */
@@ -68,22 +91,26 @@ static const int b53_cpubiuctrl_no_wb_regs[] = {
        [CPU_CREDIT_REG] = 0x0b0,
        [CPU_MCP_FLOW_REG] = 0x0b4,
        [CPU_WRITEBACK_CTRL_REG] = -1,
+       [RAC_CONFIG0_REG] = 0x78,
+       [RAC_CONFIG1_REG] = 0x7c,
 };
 
 static const int b53_cpubiuctrl_regs[] = {
        [CPU_CREDIT_REG] = 0x0b0,
        [CPU_MCP_FLOW_REG] = 0x0b4,
        [CPU_WRITEBACK_CTRL_REG] = 0x22c,
+       [RAC_CONFIG0_REG] = 0x78,
+       [RAC_CONFIG1_REG] = 0x7c,
 };
 
 static const int a72_cpubiuctrl_regs[] = {
        [CPU_CREDIT_REG] = 0x18,
        [CPU_MCP_FLOW_REG] = 0x1c,
        [CPU_WRITEBACK_CTRL_REG] = 0x20,
+       [RAC_CONFIG0_REG] = 0x08,
+       [RAC_CONFIG1_REG] = 0x0c,
 };
 
-#define NUM_CPU_BIUCTRL_REGS   3
-
 static int __init mcp_write_pairing_set(void)
 {
        u32 creds = 0;
@@ -110,6 +137,8 @@ static int __init mcp_write_pairing_set(void)
 static const u32 a72_b53_mach_compat[] = {
        0x7211,
        0x7216,
+       0x72164,
+       0x72165,
        0x7255,
        0x7260,
        0x7268,
@@ -117,6 +146,61 @@ static const u32 a72_b53_mach_compat[] = {
        0x7278,
 };
 
+/* The read-ahead cache present in the Brahma-B53 CPU is a special piece of
+ * hardware after the integrated L2 cache of the B53 CPU complex whose purpose
+ * is to prefetch instruction and/or data with a line size of either 64 bytes
+ * or 256 bytes. The rationale is that the data-bus of the CPU interface is
+ * optimized for 256-byte transactions, and enabling the read-ahead cache
+ * provides a significant performance boost (typically twice the performance
+ * for a memcpy benchmark application).
+ *
+ * The read-ahead cache is transparent for Virtual Address cache maintenance
+ * operations: IC IVAU, DC IVAC, DC CVAC, DC CVAU and DC CIVAC.  So no special
+ * handling is needed for the DMA API above and beyond what is included in the
+ * arm64 implementation.
+ *
+ * In addition, since the Point of Unification is typically between L1 and L2
+ * for the Brahma-B53 processor no special read-ahead cache handling is needed
+ * for the IC IALLU and IC IALLUIS cache maintenance operations.
+ *
+ * However, it is not possible to specify the cache level (L3) for the cache
+ * maintenance instructions operating by set/way to operate on the read-ahead
+ * cache.  The read-ahead cache will maintain coherency when inner cache lines
+ * are cleaned by set/way, but if it is necessary to invalidate inner cache
+ * lines by set/way to maintain coherency with system masters operating on
+ * shared memory that does not have hardware support for coherency, then it
+ * will also be necessary to explicitly invalidate the read-ahead cache.
+ */
+static void __init a72_b53_rac_enable_all(struct device_node *np)
+{
+       unsigned int cpu;
+       u32 enable = 0, pref_dist, shift;
+
+       if (IS_ENABLED(CONFIG_CACHE_B15_RAC))
+               return;
+
+       if (WARN(num_possible_cpus() > 4, "RAC only supports 4 CPUs\n"))
+               return;
+
+       pref_dist = cbc_readl(RAC_CONFIG1_REG);
+       for_each_possible_cpu(cpu) {
+               shift = cpu * RAC_CPU_SHIFT + RACPREFDATA_SHIFT;
+               enable |= RAC_DATA_INST_EN_MASK << (cpu * RAC_CPU_SHIFT);
+               if (cpubiuctrl_regs == a72_cpubiuctrl_regs) {
+                       enable &= ~(RACENPREF_MASK << shift);
+                       enable |= 3 << shift;
+                       pref_dist |= 1 << (cpu + DPREF_LINE_2_SHIFT);
+               }
+       }
+
+       cbc_writel(enable, RAC_CONFIG0_REG);
+       cbc_writel(pref_dist, RAC_CONFIG1_REG);
+
+       pr_info("%pOF: Broadcom %s read-ahead cache\n",
+               np, cpubiuctrl_regs == a72_cpubiuctrl_regs ?
+               "Cortex-A72" : "Brahma-B53");
+}
+
 static void __init mcp_a72_b53_set(void)
 {
        unsigned int i;
@@ -262,6 +346,7 @@ static int __init brcmstb_biuctrl_init(void)
                return ret;
        }
 
+       a72_b53_rac_enable_all(np);
        mcp_a72_b53_set();
 #ifdef CONFIG_PM_SLEEP
        register_syscore_ops(&brcmstb_cpu_credit_syscore_ops);
index 0ab85bf..659b4a5 100644 (file)
@@ -647,7 +647,6 @@ int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s,
        const uint32_t *cl = (uint32_t *)d;
        uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
        int i, num_enqueued = 0;
-       uint64_t addr_cena;
 
        spin_lock(&s->access_spinlock);
        half_mask = (s->eqcr.pi_ci_mask>>1);
@@ -701,7 +700,6 @@ int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s,
 
        /* Flush all the cacheline without load/store in between */
        eqcr_pi = s->eqcr.pi;
-       addr_cena = (size_t)s->addr_cena;
        for (i = 0; i < num_enqueued; i++)
                eqcr_pi++;
        s->eqcr.pi = eqcr_pi & full_mask;
index f4fb527..c5dd026 100644 (file)
@@ -660,7 +660,7 @@ int bm_shutdown_pool(u32 bpid)
        }
 done:
        put_affine_portal();
-       return 0;
+       return err;
 }
 
 struct gen_pool *bm_bpalloc;
index 9888a70..101def7 100644 (file)
@@ -1159,7 +1159,7 @@ static u32 fq_to_tag(struct qman_fq *fq)
 
 static u32 __poll_portal_slow(struct qman_portal *p, u32 is);
 static inline unsigned int __poll_portal_fast(struct qman_portal *p,
-                                       unsigned int poll_limit);
+                                       unsigned int poll_limit, bool sched_napi);
 static void qm_congestion_task(struct work_struct *work);
 static void qm_mr_process_task(struct work_struct *work);
 
@@ -1174,7 +1174,7 @@ static irqreturn_t portal_isr(int irq, void *ptr)
 
        /* DQRR-handling if it's interrupt-driven */
        if (is & QM_PIRQ_DQRI) {
-               __poll_portal_fast(p, QMAN_POLL_LIMIT);
+               __poll_portal_fast(p, QMAN_POLL_LIMIT, true);
                clear = QM_DQAVAIL_MASK | QM_PIRQ_DQRI;
        }
        /* Handling of anything else that's interrupt-driven */
@@ -1602,7 +1602,7 @@ static noinline void clear_vdqcr(struct qman_portal *p, struct qman_fq *fq)
  * user callbacks to call into any QMan API.
  */
 static inline unsigned int __poll_portal_fast(struct qman_portal *p,
-                                       unsigned int poll_limit)
+                                       unsigned int poll_limit, bool sched_napi)
 {
        const struct qm_dqrr_entry *dq;
        struct qman_fq *fq;
@@ -1636,7 +1636,7 @@ static inline unsigned int __poll_portal_fast(struct qman_portal *p,
                         * and we don't want multiple if()s in the critical
                         * path (SDQCR).
                         */
-                       res = fq->cb.dqrr(p, fq, dq);
+                       res = fq->cb.dqrr(p, fq, dq, sched_napi);
                        if (res == qman_cb_dqrr_stop)
                                break;
                        /* Check for VDQCR completion */
@@ -1646,7 +1646,7 @@ static inline unsigned int __poll_portal_fast(struct qman_portal *p,
                        /* SDQCR: context_b points to the FQ */
                        fq = tag_to_fq(be32_to_cpu(dq->context_b));
                        /* Now let the callback do its stuff */
-                       res = fq->cb.dqrr(p, fq, dq);
+                       res = fq->cb.dqrr(p, fq, dq, sched_napi);
                        /*
                         * The callback can request that we exit without
                         * consuming this entry nor advancing;
@@ -1753,7 +1753,7 @@ EXPORT_SYMBOL(qman_start_using_portal);
 
 int qman_p_poll_dqrr(struct qman_portal *p, unsigned int limit)
 {
-       return __poll_portal_fast(p, limit);
+       return __poll_portal_fast(p, limit, false);
 }
 EXPORT_SYMBOL(qman_p_poll_dqrr);
 
index 2895d06..28fbddc 100644 (file)
@@ -45,7 +45,8 @@
 
 static enum qman_cb_dqrr_result cb_dqrr(struct qman_portal *,
                                        struct qman_fq *,
-                                       const struct qm_dqrr_entry *);
+                                       const struct qm_dqrr_entry *,
+                                       bool sched_napi);
 static void cb_ern(struct qman_portal *, struct qman_fq *,
                   const union qm_mr_entry *);
 static void cb_fqs(struct qman_portal *, struct qman_fq *,
@@ -86,7 +87,7 @@ static void fd_inc(struct qm_fd *fd)
        len--;
        qm_fd_set_param(fd, fmt, off, len);
 
-       fd->cmd = cpu_to_be32(be32_to_cpu(fd->cmd) + 1);
+       be32_add_cpu(&fd->cmd, 1);
 }
 
 /* The only part of the 'fd' we can't memcmp() is the ppid */
@@ -208,7 +209,8 @@ failed:
 
 static enum qman_cb_dqrr_result cb_dqrr(struct qman_portal *p,
                                        struct qman_fq *fq,
-                                       const struct qm_dqrr_entry *dq)
+                                       const struct qm_dqrr_entry *dq,
+                                       bool sched_napi)
 {
        if (WARN_ON(fd_neq(&fd_dq, &dq->fd))) {
                pr_err("BADNESS: dequeued frame doesn't match;\n");
index e87b654..b7e8e5e 100644 (file)
@@ -275,7 +275,8 @@ static inline int process_frame_data(struct hp_handler *handler,
 
 static enum qman_cb_dqrr_result normal_dqrr(struct qman_portal *portal,
                                            struct qman_fq *fq,
-                                           const struct qm_dqrr_entry *dqrr)
+                                           const struct qm_dqrr_entry *dqrr,
+                                           bool sched_napi)
 {
        struct hp_handler *handler = (struct hp_handler *)fq;
 
@@ -293,7 +294,8 @@ skip:
 
 static enum qman_cb_dqrr_result special_dqrr(struct qman_portal *portal,
                                             struct qman_fq *fq,
-                                            const struct qm_dqrr_entry *dqrr)
+                                            const struct qm_dqrr_entry *dqrr,
+                                            bool sched_napi)
 {
        struct hp_handler *handler = (struct hp_handler *)fq;
 
index cac0fb7..21dbcd7 100644 (file)
@@ -523,7 +523,7 @@ int ucc_set_tdm_rxtx_clk(u32 tdm_num, enum qe_clock clock,
 
        qe_mux_reg = &qe_immr->qmx;
 
-       if (tdm_num > 7 || tdm_num < 0)
+       if (tdm_num > 7)
                return -EINVAL;
 
        /* The communications direction must be RX or TX */
index 6cf8a7a..db7e7fc 100644 (file)
@@ -487,22 +487,17 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
 
        domain->regulator = devm_regulator_get_optional(domain->dev, "power");
        if (IS_ERR(domain->regulator)) {
-               if (PTR_ERR(domain->regulator) != -ENODEV) {
-                       if (PTR_ERR(domain->regulator) != -EPROBE_DEFER)
-                               dev_err(domain->dev, "Failed to get domain's regulator\n");
-                       return PTR_ERR(domain->regulator);
-               }
+               if (PTR_ERR(domain->regulator) != -ENODEV)
+                       return dev_err_probe(domain->dev, PTR_ERR(domain->regulator),
+                                            "Failed to get domain's regulator\n");
        } else if (domain->voltage) {
                regulator_set_voltage(domain->regulator,
                                      domain->voltage, domain->voltage);
        }
 
        ret = imx_pgc_get_clocks(domain);
-       if (ret) {
-               if (ret != -EPROBE_DEFER)
-                       dev_err(domain->dev, "Failed to get domain's clocks\n");
-               return ret;
-       }
+       if (ret)
+               return dev_err_probe(domain->dev, ret, "Failed to get domain's clocks\n");
 
        ret = pm_genpd_init(&domain->genpd, NULL, true);
        if (ret) {
index dc644cf..505651b 100644 (file)
 #define CMDQ_POLL_ENABLE_MASK  BIT(0)
 #define CMDQ_EOC_IRQ_EN                BIT(0)
 #define CMDQ_REG_TYPE          1
+#define CMDQ_JUMP_RELATIVE     1
 
 struct cmdq_instruction {
        union {
                u32 value;
                u32 mask;
+               struct {
+                       u16 arg_c;
+                       u16 src_reg;
+               };
        };
        union {
                u16 offset;
@@ -223,15 +228,104 @@ int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys,
 }
 EXPORT_SYMBOL(cmdq_pkt_write_mask);
 
-int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event)
+int cmdq_pkt_read_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, u16 addr_low,
+                   u16 reg_idx)
+{
+       struct cmdq_instruction inst = {};
+
+       inst.op = CMDQ_CODE_READ_S;
+       inst.dst_t = CMDQ_REG_TYPE;
+       inst.sop = high_addr_reg_idx;
+       inst.reg_dst = reg_idx;
+       inst.src_reg = addr_low;
+
+       return cmdq_pkt_append_command(pkt, inst);
+}
+EXPORT_SYMBOL(cmdq_pkt_read_s);
+
+int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
+                    u16 addr_low, u16 src_reg_idx)
+{
+       struct cmdq_instruction inst = {};
+
+       inst.op = CMDQ_CODE_WRITE_S;
+       inst.src_t = CMDQ_REG_TYPE;
+       inst.sop = high_addr_reg_idx;
+       inst.offset = addr_low;
+       inst.src_reg = src_reg_idx;
+
+       return cmdq_pkt_append_command(pkt, inst);
+}
+EXPORT_SYMBOL(cmdq_pkt_write_s);
+
+int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
+                         u16 addr_low, u16 src_reg_idx, u32 mask)
+{
+       struct cmdq_instruction inst = {};
+       int err;
+
+       inst.op = CMDQ_CODE_MASK;
+       inst.mask = ~mask;
+       err = cmdq_pkt_append_command(pkt, inst);
+       if (err < 0)
+               return err;
+
+       inst.mask = 0;
+       inst.op = CMDQ_CODE_WRITE_S_MASK;
+       inst.src_t = CMDQ_REG_TYPE;
+       inst.sop = high_addr_reg_idx;
+       inst.offset = addr_low;
+       inst.src_reg = src_reg_idx;
+
+       return cmdq_pkt_append_command(pkt, inst);
+}
+EXPORT_SYMBOL(cmdq_pkt_write_s_mask);
+
+int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
+                          u16 addr_low, u32 value)
+{
+       struct cmdq_instruction inst = {};
+
+       inst.op = CMDQ_CODE_WRITE_S;
+       inst.sop = high_addr_reg_idx;
+       inst.offset = addr_low;
+       inst.value = value;
+
+       return cmdq_pkt_append_command(pkt, inst);
+}
+EXPORT_SYMBOL(cmdq_pkt_write_s_value);
+
+int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
+                               u16 addr_low, u32 value, u32 mask)
+{
+       struct cmdq_instruction inst = {};
+       int err;
+
+       inst.op = CMDQ_CODE_MASK;
+       inst.mask = ~mask;
+       err = cmdq_pkt_append_command(pkt, inst);
+       if (err < 0)
+               return err;
+
+       inst.op = CMDQ_CODE_WRITE_S_MASK;
+       inst.sop = high_addr_reg_idx;
+       inst.offset = addr_low;
+       inst.value = value;
+
+       return cmdq_pkt_append_command(pkt, inst);
+}
+EXPORT_SYMBOL(cmdq_pkt_write_s_mask_value);
+
+int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear)
 {
        struct cmdq_instruction inst = { {0} };
+       u32 clear_option = clear ? CMDQ_WFE_UPDATE : 0;
 
        if (event >= CMDQ_MAX_EVENT)
                return -EINVAL;
 
        inst.op = CMDQ_CODE_WFE;
-       inst.value = CMDQ_WFE_OPTION;
+       inst.value = CMDQ_WFE_OPTION | clear_option;
        inst.event = event;
 
        return cmdq_pkt_append_command(pkt, inst);
@@ -315,6 +409,18 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value)
 }
 EXPORT_SYMBOL(cmdq_pkt_assign);
 
+int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr)
+{
+       struct cmdq_instruction inst = {};
+
+       inst.op = CMDQ_CODE_JUMP;
+       inst.offset = CMDQ_JUMP_RELATIVE;
+       inst.value = addr >>
+               cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan);
+       return cmdq_pkt_append_command(pkt, inst);
+}
+EXPORT_SYMBOL(cmdq_pkt_jump);
+
 int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
 {
        struct cmdq_instruction inst = { {0} };
@@ -329,7 +435,8 @@ int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
 
        /* JUMP to end */
        inst.op = CMDQ_CODE_JUMP;
-       inst.value = CMDQ_JUMP_PASS;
+       inst.value = CMDQ_JUMP_PASS >>
+               cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan);
        err = cmdq_pkt_append_command(pkt, inst);
 
        return err;
index 341c7ac..4a12379 100644 (file)
@@ -19,7 +19,7 @@
 
 /**
  * mtk_infracfg_set_bus_protection - enable bus protection
- * @regmap: The infracfg regmap
+ * @infracfg: The infracfg regmap
  * @mask: The mask containing the protection bits to be enabled.
  * @reg_update: The boolean flag determines to set the protection bits
  *              by regmap_update_bits with enable register(PROTECTEN) or
@@ -50,7 +50,7 @@ int mtk_infracfg_set_bus_protection(struct regmap *infracfg, u32 mask,
 
 /**
  * mtk_infracfg_clear_bus_protection - disable bus protection
- * @regmap: The infracfg regmap
+ * @infracfg: The infracfg regmap
  * @mask: The mask containing the protection bits to be disabled.
  * @reg_update: The boolean flag determines to clear the protection bits
  *              by regmap_update_bits with enable register(PROTECTEN) or
index 3dc3e3d..6a3b69b 100644 (file)
@@ -26,6 +26,22 @@ config QCOM_COMMAND_DB
          resource on a RPM-hardened platform must use this database to get
          SoC specific identifier and information for the shared resources.
 
+config QCOM_CPR
+       tristate "QCOM Core Power Reduction (CPR) support"
+       depends on ARCH_QCOM && HAS_IOMEM
+       select PM_OPP
+       select REGMAP
+       help
+         Say Y here to enable support for the CPR hardware found on Qualcomm
+         SoCs like QCS404.
+
+         This driver populates CPU OPPs tables and makes adjustments to the
+         tables based on feedback from the CPR hardware. If you want to do
+         CPUfrequency scaling say Y here.
+
+         To compile this driver as a module, choose M here: the module will
+         be called qcom-cpr
+
 config QCOM_GENI_SE
        tristate "QCOM GENI Serial Engine Driver"
        depends on ARCH_QCOM || COMPILE_TEST
index 93392d9..ad675a6 100644 (file)
@@ -3,6 +3,7 @@ CFLAGS_rpmh-rsc.o := -I$(src)
 obj-$(CONFIG_QCOM_AOSS_QMP) += qcom_aoss.o
 obj-$(CONFIG_QCOM_GENI_SE) +=  qcom-geni-se.o
 obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o
+obj-$(CONFIG_QCOM_CPR)         += cpr.o
 obj-$(CONFIG_QCOM_GSBI)        +=      qcom_gsbi.o
 obj-$(CONFIG_QCOM_MDT_LOADER)  += mdt_loader.o
 obj-$(CONFIG_QCOM_OCMEM)       += ocmem.o
index 1f35b09..7abfc8c 100644 (file)
@@ -328,7 +328,7 @@ static int of_apr_add_pd_lookups(struct device *dev)
 
                pds = pdr_add_lookup(apr->pdr, service_name, service_path);
                if (IS_ERR(pds) && PTR_ERR(pds) != -EALREADY) {
-                       dev_err(dev, "pdr add lookup failed: %d\n", ret);
+                       dev_err(dev, "pdr add lookup failed: %ld\n", PTR_ERR(pds));
                        return PTR_ERR(pds);
                }
        }
index 429b5a6..70fbe70 100644 (file)
@@ -387,7 +387,6 @@ static int qcom_llcc_remove(struct platform_device *pdev)
 static struct regmap *qcom_llcc_init_mmio(struct platform_device *pdev,
                const char *name)
 {
-       struct resource *res;
        void __iomem *base;
        struct regmap_config llcc_regmap_config = {
                .reg_bits = 32,
@@ -396,11 +395,7 @@ static struct regmap *qcom_llcc_init_mmio(struct platform_device *pdev,
                .fast_io = true,
        };
 
-       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
-       if (!res)
-               return ERR_PTR(-ENODEV);
-
-       base = devm_ioremap_resource(&pdev->dev, res);
+       base = devm_platform_ioremap_resource_byname(pdev, name);
        if (IS_ERR(base))
                return ERR_CAST(base);
 
index 15b5002..ab9ae8c 100644 (file)
@@ -185,7 +185,7 @@ struct qmi_elem_info servreg_get_domain_list_resp_ei[] = {
                .data_type      = QMI_STRUCT,
                .elem_len       = SERVREG_DOMAIN_LIST_LENGTH,
                .elem_size      = sizeof(struct servreg_location_entry),
-               .array_type     = NO_ARRAY,
+               .array_type     = VAR_LEN_ARRAY,
                .tlv_type       = 0x12,
                .offset         = offsetof(struct servreg_get_domain_list_resp,
                                           domain_list),
index ef60e79..344ba68 100644 (file)
@@ -8,6 +8,7 @@
 #define __RPM_INTERNAL_H__
 
 #include <linux/bitmap.h>
+#include <linux/wait.h>
 #include <soc/qcom/tcs.h>
 
 #define TCS_TYPE_NR                    4
@@ -106,6 +107,8 @@ struct rpmh_ctrlr {
  * @lock:               Synchronize state of the controller.  If RPMH's cache
  *                      lock will also be held, the order is: drv->lock then
  *                      cache_lock.
+ * @tcs_wait:           Wait queue used to wait for @tcs_in_use to free up a
+ *                      slot
  * @client:             Handle to the DRV's client.
  */
 struct rsc_drv {
@@ -118,6 +121,7 @@ struct rsc_drv {
        struct tcs_group tcs[TCS_TYPE_NR];
        DECLARE_BITMAP(tcs_in_use, MAX_TCS_NR);
        spinlock_t lock;
+       wait_queue_head_t tcs_wait;
        struct rpmh_ctrlr client;
 };
 
index ae66757..a297911 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
+#include <linux/wait.h>
 
 #include <soc/qcom/cmd-db.h>
 #include <soc/qcom/tcs.h>
@@ -453,6 +454,7 @@ skip:
                if (!drv->tcs[ACTIVE_TCS].num_tcs)
                        enable_tcs_irq(drv, i, false);
                spin_unlock(&drv->lock);
+               wake_up(&drv->tcs_wait);
                if (req)
                        rpmh_tx_done(req, err);
        }
@@ -571,73 +573,34 @@ static int find_free_tcs(struct tcs_group *tcs)
 }
 
 /**
- * tcs_write() - Store messages into a TCS right now, or return -EBUSY.
+ * claim_tcs_for_req() - Claim a tcs in the given tcs_group; only for active.
  * @drv: The controller.
+ * @tcs: The tcs_group used for ACTIVE_ONLY transfers.
  * @msg: The data to be sent.
  *
- * Grabs a TCS for ACTIVE_ONLY transfers and writes the messages to it.
+ * Claims a tcs in the given tcs_group while making sure that no existing cmd
+ * is in flight that would conflict with the one in @msg.
  *
- * If there are no free TCSes for ACTIVE_ONLY transfers or if a command for
- * the same address is already transferring returns -EBUSY which means the
- * client should retry shortly.
+ * Context: Must be called with the drv->lock held since that protects
+ * tcs_in_use.
  *
- * Return: 0 on success, -EBUSY if client should retry, or an error.
- *         Client should have interrupts enabled for a bit before retrying.
+ * Return: The id of the claimed tcs or -EBUSY if a matching msg is in flight
+ * or the tcs_group is full.
  */
-static int tcs_write(struct rsc_drv *drv, const struct tcs_request *msg)
+static int claim_tcs_for_req(struct rsc_drv *drv, struct tcs_group *tcs,
+                            const struct tcs_request *msg)
 {
-       struct tcs_group *tcs;
-       int tcs_id;
-       unsigned long flags;
        int ret;
 
-       tcs = get_tcs_for_msg(drv, msg);
-       if (IS_ERR(tcs))
-               return PTR_ERR(tcs);
-
-       spin_lock_irqsave(&drv->lock, flags);
        /*
         * The h/w does not like if we send a request to the same address,
         * when one is already in-flight or being processed.
         */
        ret = check_for_req_inflight(drv, tcs, msg);
        if (ret)
-               goto unlock;
-
-       ret = find_free_tcs(tcs);
-       if (ret < 0)
-               goto unlock;
-       tcs_id = ret;
-
-       tcs->req[tcs_id - tcs->offset] = msg;
-       set_bit(tcs_id, drv->tcs_in_use);
-       if (msg->state == RPMH_ACTIVE_ONLY_STATE && tcs->type != ACTIVE_TCS) {
-               /*
-                * Clear previously programmed WAKE commands in selected
-                * repurposed TCS to avoid triggering them. tcs->slots will be
-                * cleaned from rpmh_flush() by invoking rpmh_rsc_invalidate()
-                */
-               write_tcs_reg_sync(drv, RSC_DRV_CMD_ENABLE, tcs_id, 0);
-               write_tcs_reg_sync(drv, RSC_DRV_CMD_WAIT_FOR_CMPL, tcs_id, 0);
-               enable_tcs_irq(drv, tcs_id, true);
-       }
-       spin_unlock_irqrestore(&drv->lock, flags);
-
-       /*
-        * These two can be done after the lock is released because:
-        * - We marked "tcs_in_use" under lock.
-        * - Once "tcs_in_use" has been marked nobody else could be writing
-        *   to these registers until the interrupt goes off.
-        * - The interrupt can't go off until we trigger w/ the last line
-        *   of __tcs_set_trigger() below.
-        */
-       __tcs_buffer_write(drv, tcs_id, 0, msg);
-       __tcs_set_trigger(drv, tcs_id, true);
+               return ret;
 
-       return 0;
-unlock:
-       spin_unlock_irqrestore(&drv->lock, flags);
-       return ret;
+       return find_free_tcs(tcs);
 }
 
 /**
@@ -664,18 +627,47 @@ unlock:
  */
 int rpmh_rsc_send_data(struct rsc_drv *drv, const struct tcs_request *msg)
 {
-       int ret;
+       struct tcs_group *tcs;
+       int tcs_id;
+       unsigned long flags;
 
-       do {
-               ret = tcs_write(drv, msg);
-               if (ret == -EBUSY) {
-                       pr_info_ratelimited("TCS Busy, retrying RPMH message send: addr=%#x\n",
-                                           msg->cmds[0].addr);
-                       udelay(10);
-               }
-       } while (ret == -EBUSY);
+       tcs = get_tcs_for_msg(drv, msg);
+       if (IS_ERR(tcs))
+               return PTR_ERR(tcs);
 
-       return ret;
+       spin_lock_irqsave(&drv->lock, flags);
+
+       /* Wait forever for a free tcs. It better be there eventually! */
+       wait_event_lock_irq(drv->tcs_wait,
+                           (tcs_id = claim_tcs_for_req(drv, tcs, msg)) >= 0,
+                           drv->lock);
+
+       tcs->req[tcs_id - tcs->offset] = msg;
+       set_bit(tcs_id, drv->tcs_in_use);
+       if (msg->state == RPMH_ACTIVE_ONLY_STATE && tcs->type != ACTIVE_TCS) {
+               /*
+                * Clear previously programmed WAKE commands in selected
+                * repurposed TCS to avoid triggering them. tcs->slots will be
+                * cleaned from rpmh_flush() by invoking rpmh_rsc_invalidate()
+                */
+               write_tcs_reg_sync(drv, RSC_DRV_CMD_ENABLE, tcs_id, 0);
+               write_tcs_reg_sync(drv, RSC_DRV_CMD_WAIT_FOR_CMPL, tcs_id, 0);
+               enable_tcs_irq(drv, tcs_id, true);
+       }
+       spin_unlock_irqrestore(&drv->lock, flags);
+
+       /*
+        * These two can be done after the lock is released because:
+        * - We marked "tcs_in_use" under lock.
+        * - Once "tcs_in_use" has been marked nobody else could be writing
+        *   to these registers until the interrupt goes off.
+        * - The interrupt can't go off until we trigger w/ the last line
+        *   of __tcs_set_trigger() below.
+        */
+       __tcs_buffer_write(drv, tcs_id, 0, msg);
+       __tcs_set_trigger(drv, tcs_id, true);
+
+       return 0;
 }
 
 /**
@@ -983,6 +975,7 @@ static int rpmh_rsc_probe(struct platform_device *pdev)
                return ret;
 
        spin_lock_init(&drv->lock);
+       init_waitqueue_head(&drv->tcs_wait);
        bitmap_zero(drv->tcs_in_use, MAX_TCS_NR);
 
        irq = platform_get_irq(pdev, drv->id);
index b25d0f7..b44ede4 100644 (file)
@@ -194,6 +194,7 @@ static const struct soc_id soc_id[] = {
        { 186, "MSM8674" },
        { 194, "MSM8974PRO" },
        { 206, "MSM8916" },
+       { 207, "MSM8994" },
        { 208, "APQ8074-AA" },
        { 209, "APQ8074-AB" },
        { 210, "APQ8074PRO" },
@@ -214,6 +215,8 @@ static const struct soc_id soc_id[] = {
        { 248, "MSM8216" },
        { 249, "MSM8116" },
        { 250, "MSM8616" },
+       { 251, "MSM8992" },
+       { 253, "APQ8094" },
        { 291, "APQ8096" },
        { 305, "MSM8996SG" },
        { 310, "MSM8996AU" },
@@ -223,6 +226,8 @@ static const struct soc_id soc_id[] = {
        { 321, "SDM845" },
        { 341, "SDA845" },
        { 356, "SM8250" },
+       { 402, "IPQ6018" },
+       { 425, "SC7180" },
 };
 
 static const char *socinfo_machine(struct device *dev, unsigned int id)
index 3098465..b70bbc3 100644 (file)
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
-config SOC_RENESAS
+menuconfig SOC_RENESAS
        bool "Renesas SoC driver support" if COMPILE_TEST && !ARCH_RENESAS
        default y if ARCH_RENESAS
        select SOC_BUS
@@ -49,126 +49,126 @@ if ARM && ARCH_RENESAS
 #comment "Renesas ARM SoCs System Type"
 
 config ARCH_EMEV2
-       bool "Emma Mobile EV2"
+       bool "ARM32 Platform support for Emma Mobile EV2"
        select HAVE_ARM_SCU if SMP
        select SYS_SUPPORTS_EM_STI
 
-config ARCH_R7S72100
-       bool "RZ/A1H (R7S72100)"
-       select ARM_ERRATA_754322
-       select PM
-       select PM_GENERIC_DOMAINS
-       select RENESAS_OSTM
-       select RENESAS_RZA1_IRQC
-       select SYS_SUPPORTS_SH_MTU2
+config ARCH_R8A7794
+       bool "ARM32 Platform support for R-Car E2"
+       select ARCH_RCAR_GEN2
+       select ARM_ERRATA_814220
+       select SYSC_R8A7794
 
-config ARCH_R7S9210
-       bool "RZ/A2 (R7S9210)"
-       select PM
-       select PM_GENERIC_DOMAINS
-       select RENESAS_OSTM
-       select RENESAS_RZA1_IRQC
+config ARCH_R8A7779
+       bool "ARM32 Platform support for R-Car H1"
+       select ARCH_RCAR_GEN1
+       select ARM_ERRATA_754322
+       select ARM_GLOBAL_TIMER
+       select HAVE_ARM_SCU if SMP
+       select HAVE_ARM_TWD if SMP
+       select SYSC_R8A7779
 
-config ARCH_R8A73A4
-       bool "R-Mobile APE6 (R8A73A40)"
-       select ARCH_RMOBILE
+config ARCH_R8A7790
+       bool "ARM32 Platform support for R-Car H2"
+       select ARCH_RCAR_GEN2
        select ARM_ERRATA_798181 if SMP
        select ARM_ERRATA_814220
-       select HAVE_ARM_ARCH_TIMER
-       select RENESAS_IRQC
+       select I2C
+       select SYSC_R8A7790
 
-config ARCH_R8A7740
-       bool "R-Mobile A1 (R8A77400)"
-       select ARCH_RMOBILE
+config ARCH_R8A7778
+       bool "ARM32 Platform support for R-Car M1A"
+       select ARCH_RCAR_GEN1
        select ARM_ERRATA_754322
-       select RENESAS_INTC_IRQPIN
 
-config ARCH_R8A7742
-       bool "RZ/G1H (R8A77420)"
+config ARCH_R8A7793
+       bool "ARM32 Platform support for R-Car M2-N"
        select ARCH_RCAR_GEN2
        select ARM_ERRATA_798181 if SMP
-       select ARM_ERRATA_814220
-       select SYSC_R8A7742
+       select I2C
+       select SYSC_R8A7791
 
-config ARCH_R8A7743
-       bool "RZ/G1M (R8A77430)"
+config ARCH_R8A7791
+       bool "ARM32 Platform support for R-Car M2-W"
        select ARCH_RCAR_GEN2
        select ARM_ERRATA_798181 if SMP
-       select SYSC_R8A7743
+       select I2C
+       select SYSC_R8A7791
 
-config ARCH_R8A7744
-       bool "RZ/G1N (R8A77440)"
+config ARCH_R8A7792
+       bool "ARM32 Platform support for R-Car V2H"
        select ARCH_RCAR_GEN2
        select ARM_ERRATA_798181 if SMP
-       select SYSC_R8A7743
+       select SYSC_R8A7792
 
-config ARCH_R8A7745
-       bool "RZ/G1E (R8A77450)"
-       select ARCH_RCAR_GEN2
-       select ARM_ERRATA_814220
-       select SYSC_R8A7745
+config ARCH_R8A7740
+       bool "ARM32 Platform support for R-Mobile A1"
+       select ARCH_RMOBILE
+       select ARM_ERRATA_754322
+       select RENESAS_INTC_IRQPIN
 
-config ARCH_R8A77470
-       bool "RZ/G1C (R8A77470)"
-       select ARCH_RCAR_GEN2
+config ARCH_R8A73A4
+       bool "ARM32 Platform support for R-Mobile APE6"
+       select ARCH_RMOBILE
+       select ARM_ERRATA_798181 if SMP
        select ARM_ERRATA_814220
-       select SYSC_R8A77470
+       select HAVE_ARM_ARCH_TIMER
+       select RENESAS_IRQC
 
-config ARCH_R8A7778
-       bool "R-Car M1A (R8A77781)"
-       select ARCH_RCAR_GEN1
+config ARCH_R7S72100
+       bool "ARM32 Platform support for RZ/A1H"
        select ARM_ERRATA_754322
+       select PM
+       select PM_GENERIC_DOMAINS
+       select RENESAS_OSTM
+       select RENESAS_RZA1_IRQC
+       select SYS_SUPPORTS_SH_MTU2
 
-config ARCH_R8A7779
-       bool "R-Car H1 (R8A77790)"
-       select ARCH_RCAR_GEN1
-       select ARM_ERRATA_754322
-       select ARM_GLOBAL_TIMER
-       select HAVE_ARM_SCU if SMP
-       select HAVE_ARM_TWD if SMP
-       select SYSC_R8A7779
+config ARCH_R7S9210
+       bool "ARM32 Platform support for RZ/A2"
+       select PM
+       select PM_GENERIC_DOMAINS
+       select RENESAS_OSTM
+       select RENESAS_RZA1_IRQC
 
-config ARCH_R8A7790
-       bool "R-Car H2 (R8A77900)"
+config ARCH_R8A77470
+       bool "ARM32 Platform support for RZ/G1C"
        select ARCH_RCAR_GEN2
-       select ARM_ERRATA_798181 if SMP
        select ARM_ERRATA_814220
-       select I2C
-       select SYSC_R8A7790
+       select SYSC_R8A77470
 
-config ARCH_R8A7791
-       bool "R-Car M2-W (R8A77910)"
+config ARCH_R8A7745
+       bool "ARM32 Platform support for RZ/G1E"
        select ARCH_RCAR_GEN2
-       select ARM_ERRATA_798181 if SMP
-       select I2C
-       select SYSC_R8A7791
+       select ARM_ERRATA_814220
+       select SYSC_R8A7745
 
-config ARCH_R8A7792
-       bool "R-Car V2H (R8A77920)"
+config ARCH_R8A7742
+       bool "ARM32 Platform support for RZ/G1H"
        select ARCH_RCAR_GEN2
        select ARM_ERRATA_798181 if SMP
-       select SYSC_R8A7792
+       select ARM_ERRATA_814220
+       select SYSC_R8A7742
 
-config ARCH_R8A7793
-       bool "R-Car M2-N (R8A7793)"
+config ARCH_R8A7743
+       bool "ARM32 Platform support for RZ/G1M"
        select ARCH_RCAR_GEN2
        select ARM_ERRATA_798181 if SMP
-       select I2C
-       select SYSC_R8A7791
+       select SYSC_R8A7743
 
-config ARCH_R8A7794
-       bool "R-Car E2 (R8A77940)"
+config ARCH_R8A7744
+       bool "ARM32 Platform support for RZ/G1N"
        select ARCH_RCAR_GEN2
-       select ARM_ERRATA_814220
-       select SYSC_R8A7794
+       select ARM_ERRATA_798181 if SMP
+       select SYSC_R8A7743
 
 config ARCH_R9A06G032
-       bool "RZ/N1D (R9A06G032)"
+       bool "ARM32 Platform support for RZ/N1D"
        select ARCH_RZN1
        select ARM_ERRATA_814220
 
 config ARCH_SH73A0
-       bool "SH-Mobile AG5 (R8A73A00)"
+       bool "ARM32 Platform support for SH-Mobile AG5"
        select ARCH_RMOBILE
        select ARM_ERRATA_754322
        select ARM_GLOBAL_TIMER
@@ -180,193 +180,201 @@ endif # ARM
 
 if ARM64
 
-config ARCH_R8A774A1
-       bool "Renesas RZ/G2M SoC Platform"
-       select ARCH_RCAR_GEN3
-       select SYSC_R8A774A1
-       help
-         This enables support for the Renesas RZ/G2M SoC.
-
-config ARCH_R8A774B1
-       bool "Renesas RZ/G2N SoC Platform"
-       select ARCH_RCAR_GEN3
-       select SYSC_R8A774B1
-       help
-         This enables support for the Renesas RZ/G2N SoC.
-
-config ARCH_R8A774C0
-       bool "Renesas RZ/G2E SoC Platform"
+config ARCH_R8A77995
+       bool "ARM64 Platform support for R-Car D3"
        select ARCH_RCAR_GEN3
-       select SYSC_R8A774C0
+       select SYSC_R8A77995
        help
-         This enables support for the Renesas RZ/G2E SoC.
+         This enables support for the Renesas R-Car D3 SoC.
 
-config ARCH_R8A774E1
-       bool "Renesas RZ/G2H SoC Platform"
+config ARCH_R8A77990
+       bool "ARM64 Platform support for R-Car E3"
        select ARCH_RCAR_GEN3
-       select SYSC_R8A774E1
+       select SYSC_R8A77990
        help
-         This enables support for the Renesas RZ/G2H SoC.
+         This enables support for the Renesas R-Car E3 SoC.
 
 config ARCH_R8A77950
-       bool "Renesas R-Car H3 ES1.x SoC Platform"
+       bool "ARM64 Platform support for R-Car H3 ES1.x"
        select ARCH_RCAR_GEN3
        select SYSC_R8A7795
        help
          This enables support for the Renesas R-Car H3 SoC (revision 1.x).
 
 config ARCH_R8A77951
-       bool "Renesas R-Car H3 ES2.0+ SoC Platform"
+       bool "ARM64 Platform support for R-Car H3 ES2.0+"
        select ARCH_RCAR_GEN3
        select SYSC_R8A7795
        help
          This enables support for the Renesas R-Car H3 SoC (revisions 2.0 and
          later).
 
+config ARCH_R8A77965
+       bool "ARM64 Platform support for R-Car M3-N"
+       select ARCH_RCAR_GEN3
+       select SYSC_R8A77965
+       help
+         This enables support for the Renesas R-Car M3-N SoC.
+
 config ARCH_R8A77960
-       bool "Renesas R-Car M3-W SoC Platform"
+       bool "ARM64 Platform support for R-Car M3-W"
        select ARCH_RCAR_GEN3
        select SYSC_R8A77960
        help
          This enables support for the Renesas R-Car M3-W SoC.
 
 config ARCH_R8A77961
-       bool "Renesas R-Car M3-W+ SoC Platform"
+       bool "ARM64 Platform support for R-Car M3-W+"
        select ARCH_RCAR_GEN3
        select SYSC_R8A77961
        help
          This enables support for the Renesas R-Car M3-W+ SoC.
 
-config ARCH_R8A77965
-       bool "Renesas R-Car M3-N SoC Platform"
+config ARCH_R8A77980
+       bool "ARM64 Platform support for R-Car V3H"
        select ARCH_RCAR_GEN3
-       select SYSC_R8A77965
+       select SYSC_R8A77980
        help
-         This enables support for the Renesas R-Car M3-N SoC.
+         This enables support for the Renesas R-Car V3H SoC.
 
 config ARCH_R8A77970
-       bool "Renesas R-Car V3M SoC Platform"
+       bool "ARM64 Platform support for R-Car V3M"
        select ARCH_RCAR_GEN3
        select SYSC_R8A77970
        help
          This enables support for the Renesas R-Car V3M SoC.
 
-config ARCH_R8A77980
-       bool "Renesas R-Car V3H SoC Platform"
+config ARCH_R8A779A0
+       bool "ARM64 Platform support for R-Car V3U"
        select ARCH_RCAR_GEN3
-       select SYSC_R8A77980
+       select SYSC_R8A779A0
        help
-         This enables support for the Renesas R-Car V3H SoC.
+         This enables support for the Renesas R-Car V3U SoC.
 
-config ARCH_R8A77990
-       bool "Renesas R-Car E3 SoC Platform"
+config ARCH_R8A774C0
+       bool "ARM64 Platform support for RZ/G2E"
        select ARCH_RCAR_GEN3
-       select SYSC_R8A77990
+       select SYSC_R8A774C0
        help
-         This enables support for the Renesas R-Car E3 SoC.
+         This enables support for the Renesas RZ/G2E SoC.
 
-config ARCH_R8A77995
-       bool "Renesas R-Car D3 SoC Platform"
+config ARCH_R8A774E1
+       bool "ARM64 Platform support for RZ/G2H"
        select ARCH_RCAR_GEN3
-       select SYSC_R8A77995
+       select SYSC_R8A774E1
        help
-         This enables support for the Renesas R-Car D3 SoC.
+         This enables support for the Renesas RZ/G2H SoC.
+
+config ARCH_R8A774A1
+       bool "ARM64 Platform support for RZ/G2M"
+       select ARCH_RCAR_GEN3
+       select SYSC_R8A774A1
+       help
+         This enables support for the Renesas RZ/G2M SoC.
+
+config ARCH_R8A774B1
+       bool "ARM64 Platform support for RZ/G2N"
+       select ARCH_RCAR_GEN3
+       select SYSC_R8A774B1
+       help
+         This enables support for the Renesas RZ/G2N SoC.
 
 endif # ARM64
 
-# SoC
-config SYSC_R8A7742
-       bool "RZ/G1H System Controller support" if COMPILE_TEST
-       select SYSC_RCAR
+config RST_RCAR
+       bool "Reset Controller support for R-Car" if COMPILE_TEST
 
-config SYSC_R8A7743
-       bool "RZ/G1M System Controller support" if COMPILE_TEST
+config SYSC_RCAR
+       bool "System Controller support for R-Car" if COMPILE_TEST
+
+config SYSC_R8A77995
+       bool "System Controller support for R-Car D3" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A7745
-       bool "RZ/G1E System Controller support" if COMPILE_TEST
+config SYSC_R8A7794
+       bool "System Controller support for R-Car E2" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A77470
-       bool "RZ/G1C System Controller support" if COMPILE_TEST
+config SYSC_R8A77990
+       bool "System Controller support for R-Car E3" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A774A1
-       bool "RZ/G2M System Controller support" if COMPILE_TEST
+config SYSC_R8A7779
+       bool "System Controller support for R-Car H1" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A774B1
-       bool "RZ/G2N System Controller support" if COMPILE_TEST
+config SYSC_R8A7790
+       bool "System Controller support for R-Car H2" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A774C0
-       bool "RZ/G2E System Controller support" if COMPILE_TEST
+config SYSC_R8A7795
+       bool "System Controller support for R-Car H3" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A774E1
-       bool "RZ/G2H System Controller support" if COMPILE_TEST
+config SYSC_R8A7791
+       bool "System Controller support for R-Car M2-W/N" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A7779
-       bool "R-Car H1 System Controller support" if COMPILE_TEST
+config SYSC_R8A77965
+       bool "System Controller support for R-Car M3-N" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A7790
-       bool "R-Car H2 System Controller support" if COMPILE_TEST
+config SYSC_R8A77960
+       bool "System Controller support for R-Car M3-W" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A7791
-       bool "R-Car M2-W/N System Controller support" if COMPILE_TEST
+config SYSC_R8A77961
+       bool "System Controller support for R-Car M3-W+" if COMPILE_TEST
        select SYSC_RCAR
 
 config SYSC_R8A7792
-       bool "R-Car V2H System Controller support" if COMPILE_TEST
+       bool "System Controller support for R-Car V2H" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A7794
-       bool "R-Car E2 System Controller support" if COMPILE_TEST
+config SYSC_R8A77980
+       bool "System Controller support for R-Car V3H" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A7795
-       bool "R-Car H3 System Controller support" if COMPILE_TEST
+config SYSC_R8A77970
+       bool "System Controller support for R-Car V3M" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A77960
-       bool "R-Car M3-W System Controller support" if COMPILE_TEST
-       select SYSC_RCAR
+config SYSC_R8A779A0
+       bool "System Controller support for R-Car V3U" if COMPILE_TEST
 
-config SYSC_R8A77961
-       bool "R-Car M3-W+ System Controller support" if COMPILE_TEST
-       select SYSC_RCAR
+config SYSC_RMOBILE
+       bool "System Controller support for R-Mobile" if COMPILE_TEST
 
-config SYSC_R8A77965
-       bool "R-Car M3-N System Controller support" if COMPILE_TEST
+config SYSC_R8A77470
+       bool "System Controller support for RZ/G1C" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A77970
-       bool "R-Car V3M System Controller support" if COMPILE_TEST
+config SYSC_R8A7745
+       bool "System Controller support for RZ/G1E" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A77980
-       bool "R-Car V3H System Controller support" if COMPILE_TEST
+config SYSC_R8A7742
+       bool "System Controller support for RZ/G1H" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A77990
-       bool "R-Car E3 System Controller support" if COMPILE_TEST
+config SYSC_R8A7743
+       bool "System Controller support for RZ/G1M" if COMPILE_TEST
        select SYSC_RCAR
 
-config SYSC_R8A77995
-       bool "R-Car D3 System Controller support" if COMPILE_TEST
+config SYSC_R8A774C0
+       bool "System Controller support for RZ/G2E" if COMPILE_TEST
        select SYSC_RCAR
 
-# Family
-config RST_RCAR
-       bool "R-Car Reset Controller support" if COMPILE_TEST
+config SYSC_R8A774E1
+       bool "System Controller support for RZ/G2H" if COMPILE_TEST
+       select SYSC_RCAR
 
-config SYSC_RCAR
-       bool "R-Car System Controller support" if COMPILE_TEST
+config SYSC_R8A774A1
+       bool "System Controller support for RZ/G2M" if COMPILE_TEST
+       select SYSC_RCAR
 
-config SYSC_RMOBILE
-       bool "R-Mobile System Controller support" if COMPILE_TEST
+config SYSC_R8A774B1
+       bool "System Controller support for RZ/G2N" if COMPILE_TEST
+       select SYSC_RCAR
 
 endif # SOC_RENESAS
index 10a399f..9b29bed 100644 (file)
@@ -24,6 +24,7 @@ obj-$(CONFIG_SYSC_R8A77970)   += r8a77970-sysc.o
 obj-$(CONFIG_SYSC_R8A77980)    += r8a77980-sysc.o
 obj-$(CONFIG_SYSC_R8A77990)    += r8a77990-sysc.o
 obj-$(CONFIG_SYSC_R8A77995)    += r8a77995-sysc.o
+obj-$(CONFIG_SYSC_R8A779A0)    += r8a779a0-sysc.o
 ifdef CONFIG_SMP
 obj-$(CONFIG_ARCH_R9A06G032)   += r9a06g032-smp.o
 endif
diff --git a/drivers/soc/renesas/r8a779a0-sysc.c b/drivers/soc/renesas/r8a779a0-sysc.c
new file mode 100644 (file)
index 0000000..d464ffa
--- /dev/null
@@ -0,0 +1,448 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Renesas R-Car V3U System Controller
+ *
+ * Copyright (C) 2020 Renesas Electronics Corp.
+ */
+
+#include <linux/bits.h>
+#include <linux/clk/renesas.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/of_address.h>
+#include <linux/pm_domain.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+
+#include <dt-bindings/power/r8a779a0-sysc.h>
+
+/*
+ * Power Domain flags
+ */
+#define PD_CPU         BIT(0)  /* Area contains main CPU core */
+#define PD_SCU         BIT(1)  /* Area contains SCU and L2 cache */
+#define PD_NO_CR       BIT(2)  /* Area lacks PWR{ON,OFF}CR registers */
+
+#define PD_CPU_NOCR    PD_CPU | PD_NO_CR /* CPU area lacks CR */
+#define PD_ALWAYS_ON   PD_NO_CR          /* Always-on area */
+
+/*
+ * Description of a Power Area
+ */
+struct r8a779a0_sysc_area {
+       const char *name;
+       u8 pdr;                 /* PDRn */
+       int parent;             /* -1 if none */
+       unsigned int flags;     /* See PD_* */
+};
+
+/*
+ * SoC-specific Power Area Description
+ */
+struct r8a779a0_sysc_info {
+       const struct r8a779a0_sysc_area *areas;
+       unsigned int num_areas;
+};
+
+static struct r8a779a0_sysc_area r8a779a0_areas[] __initdata = {
+       { "always-on",  R8A779A0_PD_ALWAYS_ON, -1, PD_ALWAYS_ON },
+       { "a3e0",       R8A779A0_PD_A3E0, R8A779A0_PD_ALWAYS_ON, PD_SCU },
+       { "a3e1",       R8A779A0_PD_A3E1, R8A779A0_PD_ALWAYS_ON, PD_SCU },
+       { "a2e0d0",     R8A779A0_PD_A2E0D0, R8A779A0_PD_A3E0, PD_SCU },
+       { "a2e0d1",     R8A779A0_PD_A2E0D1, R8A779A0_PD_A3E0, PD_SCU },
+       { "a2e1d0",     R8A779A0_PD_A2E1D0, R8A779A0_PD_A3E1, PD_SCU },
+       { "a2e1d1",     R8A779A0_PD_A2E1D1, R8A779A0_PD_A3E1, PD_SCU },
+       { "a1e0d0c0",   R8A779A0_PD_A1E0D0C0, R8A779A0_PD_A2E0D0, PD_CPU_NOCR },
+       { "a1e0d0c1",   R8A779A0_PD_A1E0D0C1, R8A779A0_PD_A2E0D0, PD_CPU_NOCR },
+       { "a1e0d1c0",   R8A779A0_PD_A1E0D1C0, R8A779A0_PD_A2E0D1, PD_CPU_NOCR },
+       { "a1e0d1c1",   R8A779A0_PD_A1E0D1C1, R8A779A0_PD_A2E0D1, PD_CPU_NOCR },
+       { "a1e1d0c0",   R8A779A0_PD_A1E1D0C0, R8A779A0_PD_A2E1D0, PD_CPU_NOCR },
+       { "a1e1d0c1",   R8A779A0_PD_A1E1D0C1, R8A779A0_PD_A2E1D0, PD_CPU_NOCR },
+       { "a1e1d1c0",   R8A779A0_PD_A1E1D1C0, R8A779A0_PD_A2E1D1, PD_CPU_NOCR },
+       { "a1e1d1c1",   R8A779A0_PD_A1E1D1C1, R8A779A0_PD_A2E1D1, PD_CPU_NOCR },
+       { "3dg-a",      R8A779A0_PD_3DG_A, R8A779A0_PD_ALWAYS_ON },
+       { "3dg-b",      R8A779A0_PD_3DG_B, R8A779A0_PD_3DG_A },
+       { "a3vip0",     R8A779A0_PD_A3VIP0, R8A779A0_PD_ALWAYS_ON },
+       { "a3vip1",     R8A779A0_PD_A3VIP1, R8A779A0_PD_ALWAYS_ON },
+       { "a3vip3",     R8A779A0_PD_A3VIP3, R8A779A0_PD_ALWAYS_ON },
+       { "a3vip2",     R8A779A0_PD_A3VIP2, R8A779A0_PD_ALWAYS_ON },
+       { "a3isp01",    R8A779A0_PD_A3ISP01, R8A779A0_PD_ALWAYS_ON },
+       { "a3isp23",    R8A779A0_PD_A3ISP23, R8A779A0_PD_ALWAYS_ON },
+       { "a3ir",       R8A779A0_PD_A3IR, R8A779A0_PD_ALWAYS_ON },
+       { "a2cn0",      R8A779A0_PD_A2CN0, R8A779A0_PD_A3IR },
+       { "a2imp01",    R8A779A0_PD_A2IMP01, R8A779A0_PD_A3IR },
+       { "a2dp0",      R8A779A0_PD_A2DP0, R8A779A0_PD_A3IR },
+       { "a2cv0",      R8A779A0_PD_A2CV0, R8A779A0_PD_A3IR },
+       { "a2cv1",      R8A779A0_PD_A2CV1, R8A779A0_PD_A3IR },
+       { "a2cv4",      R8A779A0_PD_A2CV4, R8A779A0_PD_A3IR },
+       { "a2cv6",      R8A779A0_PD_A2CV6, R8A779A0_PD_A3IR },
+       { "a2cn2",      R8A779A0_PD_A2CN2, R8A779A0_PD_A3IR },
+       { "a2imp23",    R8A779A0_PD_A2IMP23, R8A779A0_PD_A3IR },
+       { "a2dp1",      R8A779A0_PD_A2DP0, R8A779A0_PD_A3IR },
+       { "a2cv2",      R8A779A0_PD_A2CV0, R8A779A0_PD_A3IR },
+       { "a2cv3",      R8A779A0_PD_A2CV1, R8A779A0_PD_A3IR },
+       { "a2cv5",      R8A779A0_PD_A2CV4, R8A779A0_PD_A3IR },
+       { "a2cv7",      R8A779A0_PD_A2CV6, R8A779A0_PD_A3IR },
+       { "a2cn1",      R8A779A0_PD_A2CN1, R8A779A0_PD_A3IR },
+       { "a1cnn0",     R8A779A0_PD_A1CNN0, R8A779A0_PD_A2CN0 },
+       { "a1cnn2",     R8A779A0_PD_A1CNN2, R8A779A0_PD_A2CN2 },
+       { "a1dsp0",     R8A779A0_PD_A1DSP0, R8A779A0_PD_A2CN2 },
+       { "a1cnn1",     R8A779A0_PD_A1CNN1, R8A779A0_PD_A2CN1 },
+       { "a1dsp1",     R8A779A0_PD_A1DSP1, R8A779A0_PD_A2CN1 },
+};
+
+static const struct r8a779a0_sysc_info r8a779a0_sysc_info __initconst = {
+       .areas = r8a779a0_areas,
+       .num_areas = ARRAY_SIZE(r8a779a0_areas),
+};
+
+/* SYSC Common */
+#define SYSCSR         0x000   /* SYSC Status Register */
+#define SYSCPONSR(x)   (0x800 + ((x) * 0x4)) /* Power-ON Status Register 0 */
+#define SYSCPOFFSR(x)  (0x808 + ((x) * 0x4)) /* Power-OFF Status Register */
+#define SYSCISCR(x)    (0x810 + ((x) * 0x4)) /* Interrupt Status/Clear Register */
+#define SYSCIER(x)     (0x820 + ((x) * 0x4)) /* Interrupt Enable Register */
+#define SYSCIMR(x)     (0x830 + ((x) * 0x4)) /* Interrupt Mask Register */
+
+/* Power Domain Registers */
+#define PDRSR(n)       (0x1000 + ((n) * 0x40))
+#define PDRONCR(n)     (0x1004 + ((n) * 0x40))
+#define PDROFFCR(n)    (0x1008 + ((n) * 0x40))
+#define PDRESR(n)      (0x100C + ((n) * 0x40))
+
+/* PWRON/PWROFF */
+#define PWRON_PWROFF           BIT(0)  /* Power-ON/OFF request */
+
+/* PDRESR */
+#define PDRESR_ERR             BIT(0)
+
+/* PDRSR */
+#define PDRSR_OFF              BIT(0)  /* Power-OFF state */
+#define PDRSR_ON               BIT(4)  /* Power-ON state */
+#define PDRSR_OFF_STATE                BIT(8)  /* Processing Power-OFF sequence */
+#define PDRSR_ON_STATE         BIT(12) /* Processing Power-ON sequence */
+
+#define SYSCSR_BUSY            GENMASK(1, 0)   /* All bit sets is not busy */
+
+#define SYSCSR_TIMEOUT         10000
+#define SYSCSR_DELAY_US                10
+
+#define PDRESR_RETRIES         1000
+#define PDRESR_DELAY_US                10
+
+#define SYSCISR_TIMEOUT                10000
+#define SYSCISR_DELAY_US       10
+
+#define NUM_DOMAINS_EACH_REG   BITS_PER_TYPE(u32)
+
+static void __iomem *r8a779a0_sysc_base;
+static DEFINE_SPINLOCK(r8a779a0_sysc_lock); /* SMP CPUs + I/O devices */
+
+static int r8a779a0_sysc_pwr_on_off(u8 pdr, bool on)
+{
+       unsigned int reg_offs;
+       u32 val;
+       int ret;
+
+       if (on)
+               reg_offs = PDRONCR(pdr);
+       else
+               reg_offs = PDROFFCR(pdr);
+
+       /* Wait until SYSC is ready to accept a power request */
+       ret = readl_poll_timeout_atomic(r8a779a0_sysc_base + SYSCSR, val,
+                                       (val & SYSCSR_BUSY) == SYSCSR_BUSY,
+                                       SYSCSR_DELAY_US, SYSCSR_TIMEOUT);
+       if (ret < 0)
+               return -EAGAIN;
+
+       /* Submit power shutoff or power resume request */
+       iowrite32(PWRON_PWROFF, r8a779a0_sysc_base + reg_offs);
+
+       return 0;
+}
+
+static int clear_irq_flags(unsigned int reg_idx, unsigned int isr_mask)
+{
+       u32 val;
+       int ret;
+
+       iowrite32(isr_mask, r8a779a0_sysc_base + SYSCISCR(reg_idx));
+
+       ret = readl_poll_timeout_atomic(r8a779a0_sysc_base + SYSCISCR(reg_idx),
+                                       val, !(val & isr_mask),
+                                       SYSCISR_DELAY_US, SYSCISR_TIMEOUT);
+       if (ret < 0) {
+               pr_err("\n %s : Can not clear IRQ flags in SYSCISCR", __func__);
+               return -EIO;
+       }
+
+       return 0;
+}
+
+static int r8a779a0_sysc_power(u8 pdr, bool on)
+{
+       unsigned int isr_mask;
+       unsigned int reg_idx, bit_idx;
+       unsigned int status;
+       unsigned long flags;
+       int ret = 0;
+       u32 val;
+       int k;
+
+       spin_lock_irqsave(&r8a779a0_sysc_lock, flags);
+
+       reg_idx = pdr / NUM_DOMAINS_EACH_REG;
+       bit_idx = pdr % NUM_DOMAINS_EACH_REG;
+
+       isr_mask = BIT(bit_idx);
+
+       /*
+        * The interrupt source needs to be enabled, but masked, to prevent the
+        * CPU from receiving it.
+        */
+       iowrite32(ioread32(r8a779a0_sysc_base + SYSCIER(reg_idx)) | isr_mask,
+                 r8a779a0_sysc_base + SYSCIER(reg_idx));
+       iowrite32(ioread32(r8a779a0_sysc_base + SYSCIMR(reg_idx)) | isr_mask,
+                 r8a779a0_sysc_base + SYSCIMR(reg_idx));
+
+       ret = clear_irq_flags(reg_idx, isr_mask);
+       if (ret)
+               goto out;
+
+       /* Submit power shutoff or resume request until it was accepted */
+       for (k = 0; k < PDRESR_RETRIES; k++) {
+               ret = r8a779a0_sysc_pwr_on_off(pdr, on);
+               if (ret)
+                       goto out;
+
+               status = ioread32(r8a779a0_sysc_base + PDRESR(pdr));
+               if (!(status & PDRESR_ERR))
+                       break;
+
+               udelay(PDRESR_DELAY_US);
+       }
+
+       if (k == PDRESR_RETRIES) {
+               ret = -EIO;
+               goto out;
+       }
+
+       /* Wait until the power shutoff or resume request has completed * */
+       ret = readl_poll_timeout_atomic(r8a779a0_sysc_base + SYSCISCR(reg_idx),
+                                       val, (val & isr_mask),
+                                       SYSCISR_DELAY_US, SYSCISR_TIMEOUT);
+       if (ret < 0) {
+               ret = -EIO;
+               goto out;
+       }
+
+       /* Clear interrupt flags */
+       ret = clear_irq_flags(reg_idx, isr_mask);
+       if (ret)
+               goto out;
+
+ out:
+       spin_unlock_irqrestore(&r8a779a0_sysc_lock, flags);
+
+       pr_debug("sysc power %s domain %d: %08x -> %d\n", on ? "on" : "off",
+                pdr, ioread32(r8a779a0_sysc_base + SYSCISCR(reg_idx)), ret);
+       return ret;
+}
+
+static bool r8a779a0_sysc_power_is_off(u8 pdr)
+{
+       unsigned int st;
+
+       st = ioread32(r8a779a0_sysc_base + PDRSR(pdr));
+
+       if (st & PDRSR_OFF)
+               return true;
+
+       return false;
+}
+
+struct r8a779a0_sysc_pd {
+       struct generic_pm_domain genpd;
+       u8 pdr;
+       unsigned int flags;
+       char name[];
+};
+
+static inline struct r8a779a0_sysc_pd *to_r8a779a0_pd(struct generic_pm_domain *d)
+{
+       return container_of(d, struct r8a779a0_sysc_pd, genpd);
+}
+
+static int r8a779a0_sysc_pd_power_off(struct generic_pm_domain *genpd)
+{
+       struct r8a779a0_sysc_pd *pd = to_r8a779a0_pd(genpd);
+
+       pr_debug("%s: %s\n", __func__, genpd->name);
+       return r8a779a0_sysc_power(pd->pdr, false);
+}
+
+static int r8a779a0_sysc_pd_power_on(struct generic_pm_domain *genpd)
+{
+       struct r8a779a0_sysc_pd *pd = to_r8a779a0_pd(genpd);
+
+       pr_debug("%s: %s\n", __func__, genpd->name);
+       return r8a779a0_sysc_power(pd->pdr, true);
+}
+
+static int __init r8a779a0_sysc_pd_setup(struct r8a779a0_sysc_pd *pd)
+{
+       struct generic_pm_domain *genpd = &pd->genpd;
+       const char *name = pd->genpd.name;
+       int error;
+
+       if (pd->flags & PD_CPU) {
+               /*
+                * This domain contains a CPU core and therefore it should
+                * only be turned off if the CPU is not in use.
+                */
+               pr_debug("PM domain %s contains %s\n", name, "CPU");
+               genpd->flags |= GENPD_FLAG_ALWAYS_ON;
+       } else if (pd->flags & PD_SCU) {
+               /*
+                * This domain contains an SCU and cache-controller, and
+                * therefore it should only be turned off if the CPU cores are
+                * not in use.
+                */
+               pr_debug("PM domain %s contains %s\n", name, "SCU");
+               genpd->flags |= GENPD_FLAG_ALWAYS_ON;
+       } else if (pd->flags & PD_NO_CR) {
+               /*
+                * This domain cannot be turned off.
+                */
+               genpd->flags |= GENPD_FLAG_ALWAYS_ON;
+       }
+
+       if (!(pd->flags & (PD_CPU | PD_SCU))) {
+               /* Enable Clock Domain for I/O devices */
+               genpd->flags |= GENPD_FLAG_PM_CLK | GENPD_FLAG_ACTIVE_WAKEUP;
+               genpd->attach_dev = cpg_mssr_attach_dev;
+               genpd->detach_dev = cpg_mssr_detach_dev;
+       }
+
+       genpd->power_off = r8a779a0_sysc_pd_power_off;
+       genpd->power_on = r8a779a0_sysc_pd_power_on;
+
+       if (pd->flags & (PD_CPU | PD_NO_CR)) {
+               /* Skip CPUs (handled by SMP code) and areas without control */
+               pr_debug("%s: Not touching %s\n", __func__, genpd->name);
+               goto finalize;
+       }
+
+       if (!r8a779a0_sysc_power_is_off(pd->pdr)) {
+               pr_debug("%s: %s is already powered\n", __func__, genpd->name);
+               goto finalize;
+       }
+
+       r8a779a0_sysc_power(pd->pdr, true);
+
+finalize:
+       error = pm_genpd_init(genpd, &simple_qos_governor, false);
+       if (error)
+               pr_err("Failed to init PM domain %s: %d\n", name, error);
+
+       return error;
+}
+
+static const struct of_device_id r8a779a0_sysc_matches[] __initconst = {
+       { .compatible = "renesas,r8a779a0-sysc", .data = &r8a779a0_sysc_info },
+       { /* sentinel */ }
+};
+
+struct r8a779a0_pm_domains {
+       struct genpd_onecell_data onecell_data;
+       struct generic_pm_domain *domains[R8A779A0_PD_ALWAYS_ON + 1];
+};
+
+static struct genpd_onecell_data *r8a779a0_sysc_onecell_data;
+
+static int __init r8a779a0_sysc_pd_init(void)
+{
+       const struct r8a779a0_sysc_info *info;
+       const struct of_device_id *match;
+       struct r8a779a0_pm_domains *domains;
+       struct device_node *np;
+       void __iomem *base;
+       unsigned int i;
+       int error;
+
+       np = of_find_matching_node_and_match(NULL, r8a779a0_sysc_matches, &match);
+       if (!np)
+               return -ENODEV;
+
+       info = match->data;
+
+       base = of_iomap(np, 0);
+       if (!base) {
+               pr_warn("%pOF: Cannot map regs\n", np);
+               error = -ENOMEM;
+               goto out_put;
+       }
+
+       r8a779a0_sysc_base = base;
+
+       domains = kzalloc(sizeof(*domains), GFP_KERNEL);
+       if (!domains) {
+               error = -ENOMEM;
+               goto out_put;
+       }
+
+       domains->onecell_data.domains = domains->domains;
+       domains->onecell_data.num_domains = ARRAY_SIZE(domains->domains);
+       r8a779a0_sysc_onecell_data = &domains->onecell_data;
+
+       for (i = 0; i < info->num_areas; i++) {
+               const struct r8a779a0_sysc_area *area = &info->areas[i];
+               struct r8a779a0_sysc_pd *pd;
+
+               if (!area->name) {
+                       /* Skip NULLified area */
+                       continue;
+               }
+
+               pd = kzalloc(sizeof(*pd) + strlen(area->name) + 1, GFP_KERNEL);
+               if (!pd) {
+                       error = -ENOMEM;
+                       goto out_put;
+               }
+
+               strcpy(pd->name, area->name);
+               pd->genpd.name = pd->name;
+               pd->pdr = area->pdr;
+               pd->flags = area->flags;
+
+               error = r8a779a0_sysc_pd_setup(pd);
+               if (error)
+                       goto out_put;
+
+               domains->domains[area->pdr] = &pd->genpd;
+
+               if (area->parent < 0)
+                       continue;
+
+               error = pm_genpd_add_subdomain(domains->domains[area->parent],
+                                              &pd->genpd);
+               if (error) {
+                       pr_warn("Failed to add PM subdomain %s to parent %u\n",
+                               area->name, area->parent);
+                       goto out_put;
+               }
+       }
+
+       error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
+
+out_put:
+       of_node_put(np);
+       return error;
+}
+early_initcall(r8a779a0_sysc_pd_init);
index a932015..8a1e402 100644 (file)
@@ -37,6 +37,10 @@ static const struct rst_config rcar_rst_gen3 __initconst = {
        .modemr = 0x60,
 };
 
+static const struct rst_config rcar_rst_r8a779a0 __initconst = {
+       .modemr = 0x00,         /* MODEMR0 and it has CPG related bits */
+};
+
 static const struct of_device_id rcar_rst_matches[] __initconst = {
        /* RZ/G1 is handled like R-Car Gen2 */
        { .compatible = "renesas,r8a7742-rst", .data = &rcar_rst_gen2 },
@@ -67,6 +71,8 @@ static const struct of_device_id rcar_rst_matches[] __initconst = {
        { .compatible = "renesas,r8a77980-rst", .data = &rcar_rst_gen3 },
        { .compatible = "renesas,r8a77990-rst", .data = &rcar_rst_gen3 },
        { .compatible = "renesas,r8a77995-rst", .data = &rcar_rst_gen3 },
+       /* R-Car V3U */
+       { .compatible = "renesas,r8a779a0-rst", .data = &rcar_rst_r8a779a0 },
        { /* sentinel */ }
 };
 
index f815a6a..0f8eff4 100644 (file)
@@ -200,6 +200,11 @@ static const struct renesas_soc soc_rcar_d3 __initconst __maybe_unused = {
        .id     = 0x58,
 };
 
+static const struct renesas_soc soc_rcar_v3u __initconst __maybe_unused = {
+       .family = &fam_rcar_gen3,
+       .id     = 0x59,
+};
+
 static const struct renesas_soc soc_shmobile_ag5 __initconst __maybe_unused = {
        .family = &fam_shmobile,
        .id     = 0x37,
@@ -291,6 +296,9 @@ static const struct of_device_id renesas_socs[] __initconst = {
 #ifdef CONFIG_ARCH_R8A77995
        { .compatible = "renesas,r8a77995",     .data = &soc_rcar_d3 },
 #endif
+#ifdef CONFIG_ARCH_R8A779A0
+       { .compatible = "renesas,r8a779a0",     .data = &soc_rcar_v3u },
+#endif
 #ifdef CONFIG_ARCH_SH73A0
        { .compatible = "renesas,sh73a0",       .data = &soc_shmobile_ag5 },
 #endif
index b71b73b..2c13bf4 100644 (file)
@@ -14,6 +14,14 @@ config ROCKCHIP_GRF
          In a lot of cases there also need to be default settings initialized
          to make some of them conform to expectations of the kernel.
 
+config ROCKCHIP_IODOMAIN
+       tristate "Rockchip IO domain support"
+       depends on OF
+       help
+         Say y here to enable support io domains on Rockchip SoCs. It is
+         necessary for the io domain setting of the SoC to match the
+         voltage supplied by the regulators.
+
 config ROCKCHIP_PM_DOMAINS
         bool "Rockchip generic power domain"
         depends on PM
index afca0a4..875032f 100644 (file)
@@ -3,4 +3,5 @@
 # Rockchip Soc drivers
 #
 obj-$(CONFIG_ROCKCHIP_GRF) += grf.o
+obj-$(CONFIG_ROCKCHIP_IODOMAIN) += io-domain.o
 obj-$(CONFIG_ROCKCHIP_PM_DOMAINS) += pm_domains.o
index 2641856..fc7f48a 100644 (file)
@@ -35,7 +35,54 @@ config EXYNOS_PMU_ARM_DRIVERS
 
 config EXYNOS_PM_DOMAINS
        bool "Exynos PM domains" if COMPILE_TEST
-       depends on PM_GENERIC_DOMAINS || COMPILE_TEST
+       depends on (ARCH_EXYNOS && PM_GENERIC_DOMAINS) || COMPILE_TEST
+
+config SAMSUNG_PM_DEBUG
+       bool "Samsung PM Suspend debug"
+       depends on PM && DEBUG_KERNEL
+       depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
+       depends on DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART
+       depends on DEBUG_LL && MMU
+       help
+         Say Y here if you want verbose debugging from the PM Suspend and
+         Resume code. See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
+         for more information.
+
+config S3C_PM_DEBUG_LED_SMDK
+       bool "SMDK LED suspend/resume debugging"
+       depends on PM && (MACH_SMDK6410)
+       help
+         Say Y here to enable the use of the SMDK LEDs on the baseboard
+        for debugging of the state of the suspend and resume process.
+
+        Note, this currently only works for S3C64XX based SMDK boards.
+
+config SAMSUNG_PM_CHECK
+       bool "S3C2410 PM Suspend Memory CRC"
+       depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210)
+       select CRC32
+       help
+         Enable the PM code's memory area checksum over sleep. This option
+         will generate CRCs of all blocks of memory, and store them before
+         going to sleep. The blocks are then checked on resume for any
+         errors.
+
+         Note, this can take several seconds depending on memory size
+         and CPU speed.
+
+         See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
+
+config SAMSUNG_PM_CHECK_CHUNKSIZE
+       int "S3C2410 PM Suspend CRC Chunksize (KiB)"
+       depends on PM && SAMSUNG_PM_CHECK
+       default 64
+       help
+         Set the chunksize in Kilobytes of the CRC for checking memory
+         corruption over suspend and resume. A smaller value will mean that
+         the CRC data block will take more memory, but will identify any
+         faults with better precision.
+
+         See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
 
 config EXYNOS_REGULATOR_COUPLER
        bool "Exynos SoC Regulator Coupler" if COMPILE_TEST
index ecc3a32..59e8e94 100644 (file)
@@ -10,3 +10,6 @@ obj-$(CONFIG_EXYNOS_PMU_ARM_DRIVERS)  += exynos3250-pmu.o exynos4-pmu.o \
                                        exynos5250-pmu.o exynos5420-pmu.o
 obj-$(CONFIG_EXYNOS_PM_DOMAINS) += pm_domains.o
 obj-$(CONFIG_EXYNOS_REGULATOR_COUPLER) += exynos-regulator-coupler.o
+
+obj-$(CONFIG_SAMSUNG_PM_CHECK) += s3c-pm-check.o
+obj-$(CONFIG_SAMSUNG_PM_DEBUG) += s3c-pm-debug.o
similarity index 99%
rename from arch/arm/plat-samsung/pm-check.c
rename to drivers/soc/samsung/s3c-pm-check.c
index cd2c02c..ff3e099 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/ioport.h>
 #include <linux/slab.h>
 
-#include <plat/pm-common.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #if CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE < 1
 #error CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE must be a positive non-zero value
similarity index 78%
rename from arch/arm/plat-samsung/pm-debug.c
rename to drivers/soc/samsung/s3c-pm-debug.c
index b76b1e9..b5ce0e9 100644 (file)
 
 #include <asm/mach/map.h>
 
-#include <plat/cpu.h>
-#include <plat/pm-common.h>
-
-#ifdef CONFIG_SAMSUNG_ATAGS
-#include <plat/pm.h>
-#include <mach/pm-core.h>
-#else
-static inline void s3c_pm_debug_init_uart(void) {}
-static inline void s3c_pm_arch_update_uart(void __iomem *regs,
-                                          struct pm_uart_save *save) {}
-#endif
+#include <linux/soc/samsung/s3c-pm.h>
 
 static struct pm_uart_save uart_save;
 
@@ -43,12 +33,6 @@ void s3c_pm_dbg(const char *fmt, ...)
        printascii(buff);
 }
 
-void s3c_pm_debug_init(void)
-{
-       /* restart uart clocks so we can use them to output */
-       s3c_pm_debug_init_uart();
-}
-
 static inline void __iomem *s3c_pm_uart_base(void)
 {
        unsigned long paddr;
@@ -59,7 +43,7 @@ static inline void __iomem *s3c_pm_uart_base(void)
        return (void __iomem *)vaddr;
 }
 
-void s3c_pm_save_uarts(void)
+void s3c_pm_save_uarts(bool is_s3c2410)
 {
        void __iomem *regs = s3c_pm_uart_base();
        struct pm_uart_save *save = &uart_save;
@@ -70,14 +54,14 @@ void s3c_pm_save_uarts(void)
        save->umcon = __raw_readl(regs + S3C2410_UMCON);
        save->ubrdiv = __raw_readl(regs + S3C2410_UBRDIV);
 
-       if (!soc_is_s3c2410())
+       if (!is_s3c2410)
                save->udivslot = __raw_readl(regs + S3C2443_DIVSLOT);
 
        S3C_PMDBG("UART[%p]: ULCON=%04x, UCON=%04x, UFCON=%04x, UBRDIV=%04x\n",
                  regs, save->ulcon, save->ucon, save->ufcon, save->ubrdiv);
 }
 
-void s3c_pm_restore_uarts(void)
+void s3c_pm_restore_uarts(bool is_s3c2410)
 {
        void __iomem *regs = s3c_pm_uart_base();
        struct pm_uart_save *save = &uart_save;
@@ -90,6 +74,6 @@ void s3c_pm_restore_uarts(void)
        __raw_writel(save->umcon, regs + S3C2410_UMCON);
        __raw_writel(save->ubrdiv, regs + S3C2410_UBRDIV);
 
-       if (!soc_is_s3c2410())
+       if (!is_s3c2410)
                __raw_writel(save->udivslot, regs + S3C2443_DIVSLOT);
 }
index 1b0d50f..d4c7bd5 100644 (file)
@@ -194,7 +194,7 @@ static const struct sunxi_sram_data *sunxi_sram_of_parse(struct device_node *nod
        if (!data) {
                ret = -EINVAL;
                goto err;
-       };
+       }
 
        for (func = data->func; func->func; func++) {
                if (val == func->val) {
index 6bc603d..976dee0 100644 (file)
@@ -119,6 +119,16 @@ config ARCH_TEGRA_194_SOC
        help
          Enable support for the NVIDIA Tegra194 SoC.
 
+config ARCH_TEGRA_234_SOC
+       bool "NVIDIA Tegra234 SoC"
+       select MAILBOX
+       select TEGRA_BPMP
+       select TEGRA_HSP_MBOX
+       select TEGRA_IVC
+       select SOC_TEGRA_PMC
+       help
+         Enable support for the NVIDIA Tegra234 SoC.
+
 endif
 endif
 
index d1f8dd0..94b60a6 100644 (file)
@@ -49,6 +49,9 @@ static struct tegra_fuse *fuse = &(struct tegra_fuse) {
 };
 
 static const struct of_device_id tegra_fuse_match[] = {
+#ifdef CONFIG_ARCH_TEGRA_234_SOC
+       { .compatible = "nvidia,tegra234-efuse", .data = &tegra234_fuse_soc },
+#endif
 #ifdef CONFIG_ARCH_TEGRA_194_SOC
        { .compatible = "nvidia,tegra194-efuse", .data = &tegra194_fuse_soc },
 #endif
@@ -326,7 +329,8 @@ const struct attribute_group tegra_soc_attr_group = {
        .attrs = tegra_soc_attr,
 };
 
-#ifdef CONFIG_ARCH_TEGRA_194_SOC
+#if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
+    IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC)
 static ssize_t platform_show(struct device *dev, struct device_attribute *attr,
                             char *buf)
 {
@@ -336,7 +340,7 @@ static ssize_t platform_show(struct device *dev, struct device_attribute *attr,
         * platform type is silicon and all other non-zero values indicate
         * the type of simulation platform is being used.
         */
-       return sprintf(buf, "%d\n", (tegra_read_chipid() >> 20) & 0xf);
+       return sprintf(buf, "%d\n", tegra_get_platform());
 }
 
 static DEVICE_ATTR_RO(platform);
index 85accef..9ea7f01 100644 (file)
@@ -356,3 +356,33 @@ const struct tegra_fuse_soc tegra194_fuse_soc = {
        .soc_attr_group = &tegra194_soc_attr_group,
 };
 #endif
+
+#if defined(CONFIG_ARCH_TEGRA_234_SOC)
+static const struct nvmem_cell_lookup tegra234_fuse_lookups[] = {
+       {
+               .nvmem_name = "fuse",
+               .cell_name = "xusb-pad-calibration",
+               .dev_id = "3520000.padctl",
+               .con_id = "calibration",
+       }, {
+               .nvmem_name = "fuse",
+               .cell_name = "xusb-pad-calibration-ext",
+               .dev_id = "3520000.padctl",
+               .con_id = "calibration-ext",
+       },
+};
+
+static const struct tegra_fuse_info tegra234_fuse_info = {
+       .read = tegra30_fuse_read,
+       .size = 0x300,
+       .spare = 0x280,
+};
+
+const struct tegra_fuse_soc tegra234_fuse_soc = {
+       .init = tegra30_fuse_init,
+       .info = &tegra234_fuse_info,
+       .lookups = tegra234_fuse_lookups,
+       .num_lookups = ARRAY_SIZE(tegra234_fuse_lookups),
+       .soc_attr_group = &tegra194_soc_attr_group,
+};
+#endif
index 9d4fc31..e057a58 100644 (file)
@@ -115,9 +115,17 @@ extern const struct tegra_fuse_soc tegra210_fuse_soc;
 extern const struct tegra_fuse_soc tegra186_fuse_soc;
 #endif
 
+#if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
+    IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC)
+extern const struct attribute_group tegra194_soc_attr_group;
+#endif
+
 #ifdef CONFIG_ARCH_TEGRA_194_SOC
 extern const struct tegra_fuse_soc tegra194_fuse_soc;
-extern const struct attribute_group tegra194_soc_attr_group;
+#endif
+
+#ifdef CONFIG_ARCH_TEGRA_234_SOC
+extern const struct tegra_fuse_soc tegra234_fuse_soc;
 #endif
 
 #endif
index 8e416ad..cee207d 100644 (file)
@@ -47,6 +47,31 @@ u8 tegra_get_minor_rev(void)
        return (tegra_read_chipid() >> 16) & 0xf;
 }
 
+u8 tegra_get_platform(void)
+{
+       return (tegra_read_chipid() >> 20) & 0xf;
+}
+
+bool tegra_is_silicon(void)
+{
+       switch (tegra_get_chip_id()) {
+       case TEGRA194:
+       case TEGRA234:
+               if (tegra_get_platform() == 0)
+                       return true;
+
+               return false;
+       }
+
+       /*
+        * Chips prior to Tegra194 have a different way of determining whether
+        * they are silicon or not. Since we never supported simulation on the
+        * older Tegra chips, don't bother extracting the information and just
+        * report that we're running on silicon.
+        */
+       return true;
+}
+
 u32 tegra_read_straps(void)
 {
        WARN(!chipid, "Tegra ABP MISC not yet available\n");
@@ -70,6 +95,7 @@ static const struct of_device_id apbmisc_match[] __initconst = {
        { .compatible = "nvidia,tegra20-apbmisc", },
        { .compatible = "nvidia,tegra186-misc", },
        { .compatible = "nvidia,tegra194-misc", },
+       { .compatible = "nvidia,tegra234-misc", },
        {},
 };
 
index b0bba8a..df9a5ca 100644 (file)
@@ -336,45 +336,6 @@ struct tegra_pmc_soc {
        bool has_blink_output;
 };
 
-static const char * const tegra186_reset_sources[] = {
-       "SYS_RESET",
-       "AOWDT",
-       "MCCPLEXWDT",
-       "BPMPWDT",
-       "SCEWDT",
-       "SPEWDT",
-       "APEWDT",
-       "BCCPLEXWDT",
-       "SENSOR",
-       "AOTAG",
-       "VFSENSOR",
-       "SWREST",
-       "SC7",
-       "HSM",
-       "CORESIGHT"
-};
-
-static const char * const tegra186_reset_levels[] = {
-       "L0", "L1", "L2", "WARM"
-};
-
-static const char * const tegra30_reset_sources[] = {
-       "POWER_ON_RESET",
-       "WATCHDOG",
-       "SENSOR",
-       "SW_MAIN",
-       "LP0"
-};
-
-static const char * const tegra210_reset_sources[] = {
-       "POWER_ON_RESET",
-       "WATCHDOG",
-       "SENSOR",
-       "SW_MAIN",
-       "LP0",
-       "AOTAG"
-};
-
 /**
  * struct tegra_pmc - NVIDIA Tegra PMC
  * @dev: pointer to PMC device structure
@@ -2771,6 +2732,14 @@ static const u8 tegra30_cpu_powergates[] = {
        TEGRA_POWERGATE_CPU3,
 };
 
+static const char * const tegra30_reset_sources[] = {
+       "POWER_ON_RESET",
+       "WATCHDOG",
+       "SENSOR",
+       "SW_MAIN",
+       "LP0"
+};
+
 static const struct tegra_pmc_soc tegra30_pmc_soc = {
        .num_powergates = ARRAY_SIZE(tegra30_powergates),
        .powergates = tegra30_powergates,
@@ -3048,6 +3017,15 @@ static const struct pinctrl_pin_desc tegra210_pin_descs[] = {
        TEGRA210_IO_PAD_TABLE(TEGRA_IO_PIN_DESC)
 };
 
+static const char * const tegra210_reset_sources[] = {
+       "POWER_ON_RESET",
+       "WATCHDOG",
+       "SENSOR",
+       "SW_MAIN",
+       "LP0",
+       "AOTAG"
+};
+
 static const struct tegra_wake_event tegra210_wake_events[] = {
        TEGRA_WAKE_IRQ("rtc", 16, 2),
        TEGRA_WAKE_IRQ("pmu", 51, 86),
@@ -3180,6 +3158,28 @@ static void tegra186_pmc_setup_irq_polarity(struct tegra_pmc *pmc,
        iounmap(wake);
 }
 
+static const char * const tegra186_reset_sources[] = {
+       "SYS_RESET",
+       "AOWDT",
+       "MCCPLEXWDT",
+       "BPMPWDT",
+       "SCEWDT",
+       "SPEWDT",
+       "APEWDT",
+       "BCCPLEXWDT",
+       "SENSOR",
+       "AOTAG",
+       "VFSENSOR",
+       "SWREST",
+       "SC7",
+       "HSM",
+       "CORESIGHT"
+};
+
+static const char * const tegra186_reset_levels[] = {
+       "L0", "L1", "L2", "WARM"
+};
+
 static const struct tegra_wake_event tegra186_wake_events[] = {
        TEGRA_WAKE_IRQ("pmu", 24, 209),
        TEGRA_WAKE_GPIO("power", 29, 1, TEGRA186_AON_GPIO(FF, 0)),
@@ -3349,7 +3349,75 @@ static const struct tegra_pmc_soc tegra194_pmc_soc = {
        .has_blink_output = false,
 };
 
+static const struct tegra_pmc_regs tegra234_pmc_regs = {
+       .scratch0 = 0x2000,
+       .dpd_req = 0,
+       .dpd_status = 0,
+       .dpd2_req = 0,
+       .dpd2_status = 0,
+       .rst_status = 0x70,
+       .rst_source_shift = 0x2,
+       .rst_source_mask = 0xfc,
+       .rst_level_shift = 0x0,
+       .rst_level_mask = 0x3,
+};
+
+static const char * const tegra234_reset_sources[] = {
+       "SYS_RESET_N",
+       "AOWDT",
+       "BCCPLEXWDT",
+       "BPMPWDT",
+       "SCEWDT",
+       "SPEWDT",
+       "APEWDT",
+       "LCCPLEXWDT",
+       "SENSOR",
+       "AOTAG",
+       "VFSENSOR",
+       "MAINSWRST",
+       "SC7",
+       "HSM",
+       "CSITE",
+       "RCEWDT",
+       "PVA0WDT",
+       "PVA1WDT",
+       "L1A_ASYNC",
+       "BPMPBOOT",
+       "FUSECRC",
+};
+
+static const struct tegra_pmc_soc tegra234_pmc_soc = {
+       .num_powergates = 0,
+       .powergates = NULL,
+       .num_cpu_powergates = 0,
+       .cpu_powergates = NULL,
+       .has_tsense_reset = false,
+       .has_gpu_clamps = false,
+       .needs_mbist_war = false,
+       .has_impl_33v_pwr = true,
+       .maybe_tz_only = false,
+       .num_io_pads = 0,
+       .io_pads = NULL,
+       .num_pin_descs = 0,
+       .pin_descs = NULL,
+       .regs = &tegra234_pmc_regs,
+       .init = NULL,
+       .setup_irq_polarity = tegra186_pmc_setup_irq_polarity,
+       .irq_set_wake = tegra186_pmc_irq_set_wake,
+       .irq_set_type = tegra186_pmc_irq_set_type,
+       .reset_sources = tegra234_reset_sources,
+       .num_reset_sources = ARRAY_SIZE(tegra234_reset_sources),
+       .reset_levels = tegra186_reset_levels,
+       .num_reset_levels = ARRAY_SIZE(tegra186_reset_levels),
+       .num_wake_events = 0,
+       .wake_events = NULL,
+       .pmc_clks_data = NULL,
+       .num_pmc_clks = 0,
+       .has_blink_output = false,
+};
+
 static const struct of_device_id tegra_pmc_match[] = {
+       { .compatible = "nvidia,tegra234-pmc", .data = &tegra234_pmc_soc },
        { .compatible = "nvidia,tegra194-pmc", .data = &tegra194_pmc_soc },
        { .compatible = "nvidia,tegra186-pmc", .data = &tegra186_pmc_soc },
        { .compatible = "nvidia,tegra210-pmc", .data = &tegra210_pmc_soc },
index e192fb7..f5b82ff 100644 (file)
@@ -101,6 +101,17 @@ config TI_K3_SOCINFO
          platforms to provide information about the SoC family and
          variant to user space.
 
+config TI_PRUSS
+       tristate "TI PRU-ICSS Subsystem Platform drivers"
+       depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
+       select MFD_SYSCON
+       help
+         TI PRU-ICSS Subsystem platform specific support.
+
+         Say Y or M here to support the Programmable Realtime Unit (PRU)
+         processors on various TI SoCs. It's safe to say N here if you're
+         not interested in the PRU or if you are unsure.
+
 endif # SOC_TI
 
 config TI_SCI_INTA_MSI_DOMAIN
index 1110e5c..cc3c972 100644 (file)
@@ -12,3 +12,5 @@ obj-$(CONFIG_TI_SCI_PM_DOMAINS)               += ti_sci_pm_domains.o
 obj-$(CONFIG_TI_SCI_INTA_MSI_DOMAIN)   += ti_sci_inta_msi.o
 obj-$(CONFIG_TI_K3_RINGACC)            += k3-ringacc.o
 obj-$(CONFIG_TI_K3_SOCINFO)            += k3-socinfo.o
+obj-$(CONFIG_TI_PRUSS)                 += pruss.o
+obj-$(CONFIG_POWER_AVS_OMAP)           += smartreflex.o
index 6dcc21d..1147dc4 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/sys_soc.h>
 #include <linux/soc/ti/k3-ringacc.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <linux/soc/ti/ti_sci_inta_msi.h>
@@ -208,6 +209,15 @@ struct k3_ringacc {
        const struct k3_ringacc_ops *ops;
 };
 
+/**
+ * struct k3_ringacc - Rings accelerator SoC data
+ *
+ * @dma_ring_reset_quirk:  DMA reset w/a enable
+ */
+struct k3_ringacc_soc_data {
+       unsigned dma_ring_reset_quirk:1;
+};
+
 static long k3_ringacc_ring_get_fifo_pos(struct k3_ring *ring)
 {
        return K3_RINGACC_FIFO_WINDOW_SIZE_BYTES -
@@ -1051,9 +1061,6 @@ static int k3_ringacc_probe_dt(struct k3_ringacc *ringacc)
                return ret;
        }
 
-       ringacc->dma_ring_reset_quirk =
-                       of_property_read_bool(node, "ti,dma-ring-reset-quirk");
-
        ringacc->tisci = ti_sci_get_by_phandle(node, "ti,sci");
        if (IS_ERR(ringacc->tisci)) {
                ret = PTR_ERR(ringacc->tisci);
@@ -1084,9 +1091,22 @@ static int k3_ringacc_probe_dt(struct k3_ringacc *ringacc)
                                                 ringacc->rm_gp_range);
 }
 
+static const struct k3_ringacc_soc_data k3_ringacc_soc_data_sr1 = {
+       .dma_ring_reset_quirk = 1,
+};
+
+static const struct soc_device_attribute k3_ringacc_socinfo[] = {
+       { .family = "AM65X",
+         .revision = "SR1.0",
+         .data = &k3_ringacc_soc_data_sr1
+       },
+       {/* sentinel */}
+};
+
 static int k3_ringacc_init(struct platform_device *pdev,
                           struct k3_ringacc *ringacc)
 {
+       const struct soc_device_attribute *soc;
        void __iomem *base_fifo, *base_rt;
        struct device *dev = &pdev->dev;
        struct resource *res;
@@ -1103,6 +1123,13 @@ static int k3_ringacc_init(struct platform_device *pdev,
        if (ret)
                return ret;
 
+       soc = soc_device_match(k3_ringacc_socinfo);
+       if (soc && soc->data) {
+               const struct k3_ringacc_soc_data *soc_data = soc->data;
+
+               ringacc->dma_ring_reset_quirk = soc_data->dma_ring_reset_quirk;
+       }
+
        res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rt");
        base_rt = devm_ioremap_resource(dev, res);
        if (IS_ERR(base_rt))
index af0ba52..bbbc2d2 100644 (file)
@@ -39,6 +39,7 @@ static const struct k3_soc_id {
 } k3_soc_ids[] = {
        { 0xBB5A, "AM65X" },
        { 0xBB64, "J721E" },
+       { 0xBB6D, "J7200" },
 };
 
 static int
index 6285cd8..8c863ec 100644 (file)
@@ -355,7 +355,7 @@ static void dma_debug_show_devices(struct seq_file *s,
        }
 }
 
-static int dma_debug_show(struct seq_file *s, void *v)
+static int knav_dma_debug_show(struct seq_file *s, void *v)
 {
        struct knav_dma_device *dma;
 
@@ -370,17 +370,7 @@ static int dma_debug_show(struct seq_file *s, void *v)
        return 0;
 }
 
-static int knav_dma_debug_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, dma_debug_show, NULL);
-}
-
-static const struct file_operations knav_dma_debug_ops = {
-       .open           = knav_dma_debug_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(knav_dma_debug);
 
 static int of_channel_match_helper(struct device_node *np, const char *name,
                                        const char **dma_instance)
@@ -778,7 +768,7 @@ static int knav_dma_probe(struct platform_device *pdev)
        }
 
        debugfs_create_file("knav_dma", S_IFREG | S_IRUGO, NULL, NULL,
-                           &knav_dma_debug_ops);
+                           &knav_dma_debug_fops);
 
        device_ready = true;
        return ret;
index aa071d9..a460f20 100644 (file)
@@ -478,17 +478,7 @@ static int knav_queue_debug_show(struct seq_file *s, void *v)
        return 0;
 }
 
-static int knav_queue_debug_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, knav_queue_debug_show, NULL);
-}
-
-static const struct file_operations knav_queue_debug_ops = {
-       .open           = knav_queue_debug_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(knav_queue_debug);
 
 static inline int knav_queue_pdsp_wait(u32 * __iomem addr, unsigned timeout,
                                        u32 flags)
@@ -1878,7 +1868,7 @@ static int knav_queue_probe(struct platform_device *pdev)
        }
 
        debugfs_create_file("qmss", S_IFREG | S_IRUGO, NULL, NULL,
-                           &knav_queue_debug_ops);
+                           &knav_queue_debug_fops);
        device_ready = true;
        return 0;
 
index c9b3f9e..980b04c 100644 (file)
 #include <linux/device.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
+#include <linux/pm_domain.h>
 #include <linux/reset-controller.h>
 #include <linux/delay.h>
 
 #include <linux/platform_data/ti-prm.h>
 
+enum omap_prm_domain_mode {
+       OMAP_PRMD_OFF,
+       OMAP_PRMD_RETENTION,
+       OMAP_PRMD_ON_INACTIVE,
+       OMAP_PRMD_ON_ACTIVE,
+};
+
+struct omap_prm_domain_map {
+       unsigned int usable_modes;      /* Mask of hardware supported modes */
+       unsigned long statechange:1;    /* Optional low-power state change */
+       unsigned long logicretstate:1;  /* Optional logic off mode */
+};
+
+struct omap_prm_domain {
+       struct device *dev;
+       struct omap_prm *prm;
+       struct generic_pm_domain pd;
+       u16 pwrstctrl;
+       u16 pwrstst;
+       const struct omap_prm_domain_map *cap;
+       u32 pwrstctrl_saved;
+};
+
 struct omap_rst_map {
        s8 rst;
        s8 st;
@@ -27,6 +52,9 @@ struct omap_prm_data {
        u32 base;
        const char *name;
        const char *clkdm_name;
+       u16 pwrstctrl;
+       u16 pwrstst;
+       const struct omap_prm_domain_map *dmap;
        u16 rstctrl;
        u16 rstst;
        const struct omap_rst_map *rstmap;
@@ -36,6 +64,7 @@ struct omap_prm_data {
 struct omap_prm {
        const struct omap_prm_data *data;
        void __iomem *base;
+       struct omap_prm_domain *prmd;
 };
 
 struct omap_reset_data {
@@ -47,6 +76,7 @@ struct omap_reset_data {
        struct device *dev;
 };
 
+#define genpd_to_prm_domain(gpd) container_of(gpd, struct omap_prm_domain, pd)
 #define to_omap_reset_data(p) container_of((p), struct omap_reset_data, rcdev)
 
 #define OMAP_MAX_RESETS                8
@@ -58,6 +88,39 @@ struct omap_reset_data {
 
 #define OMAP_PRM_HAS_RESETS    (OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_RSTST)
 
+#define PRM_STATE_MAX_WAIT     10000
+#define PRM_LOGICRETSTATE      BIT(2)
+#define PRM_LOWPOWERSTATECHANGE        BIT(4)
+#define PRM_POWERSTATE_MASK    OMAP_PRMD_ON_ACTIVE
+
+#define PRM_ST_INTRANSITION    BIT(20)
+
+static const struct omap_prm_domain_map omap_prm_all = {
+       .usable_modes = BIT(OMAP_PRMD_ON_ACTIVE) | BIT(OMAP_PRMD_ON_INACTIVE) |
+                       BIT(OMAP_PRMD_RETENTION) | BIT(OMAP_PRMD_OFF),
+       .statechange = 1,
+       .logicretstate = 1,
+};
+
+static const struct omap_prm_domain_map omap_prm_noinact = {
+       .usable_modes = BIT(OMAP_PRMD_ON_ACTIVE) | BIT(OMAP_PRMD_RETENTION) |
+                       BIT(OMAP_PRMD_OFF),
+       .statechange = 1,
+       .logicretstate = 1,
+};
+
+static const struct omap_prm_domain_map omap_prm_nooff = {
+       .usable_modes = BIT(OMAP_PRMD_ON_ACTIVE) | BIT(OMAP_PRMD_ON_INACTIVE) |
+                       BIT(OMAP_PRMD_RETENTION),
+       .statechange = 1,
+       .logicretstate = 1,
+};
+
+static const struct omap_prm_domain_map omap_prm_onoff_noauto = {
+       .usable_modes = BIT(OMAP_PRMD_ON_ACTIVE) | BIT(OMAP_PRMD_OFF),
+       .statechange = 1,
+};
+
 static const struct omap_rst_map rst_map_0[] = {
        { .rst = 0, .st = 0 },
        { .rst = -1 },
@@ -78,6 +141,10 @@ static const struct omap_rst_map rst_map_012[] = {
 
 static const struct omap_prm_data omap4_prm_data[] = {
        { .name = "tesla", .base = 0x4a306400, .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_01 },
+       {
+               .name = "abe", .base = 0x4a306500,
+               .pwrstctrl = 0, .pwrstst = 0x4, .dmap = &omap_prm_all,
+       },
        { .name = "core", .base = 0x4a306700, .rstctrl = 0x210, .rstst = 0x214, .clkdm_name = "ducati", .rstmap = rst_map_012 },
        { .name = "ivahd", .base = 0x4a306f00, .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_012 },
        { .name = "device", .base = 0x4a307b00, .rstctrl = 0x0, .rstst = 0x4, .rstmap = rst_map_01, .flags = OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_NO_CLKDM },
@@ -86,6 +153,10 @@ static const struct omap_prm_data omap4_prm_data[] = {
 
 static const struct omap_prm_data omap5_prm_data[] = {
        { .name = "dsp", .base = 0x4ae06400, .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_01 },
+       {
+               .name = "abe", .base = 0x4ae06500,
+               .pwrstctrl = 0, .pwrstst = 0x4, .dmap = &omap_prm_nooff,
+       },
        { .name = "core", .base = 0x4ae06700, .rstctrl = 0x210, .rstst = 0x214, .clkdm_name = "ipu", .rstmap = rst_map_012 },
        { .name = "iva", .base = 0x4ae07200, .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_012 },
        { .name = "device", .base = 0x4ae07c00, .rstctrl = 0x0, .rstst = 0x4, .rstmap = rst_map_01, .flags = OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_NO_CLKDM },
@@ -119,7 +190,11 @@ static const struct omap_prm_data am3_prm_data[] = {
        { .name = "per", .base = 0x44e00c00, .rstctrl = 0x0, .rstmap = am3_per_rst_map, .flags = OMAP_PRM_HAS_RSTCTRL, .clkdm_name = "pruss_ocp" },
        { .name = "wkup", .base = 0x44e00d00, .rstctrl = 0x0, .rstst = 0xc, .rstmap = am3_wkup_rst_map, .flags = OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_NO_CLKDM },
        { .name = "device", .base = 0x44e00f00, .rstctrl = 0x0, .rstst = 0x8, .rstmap = rst_map_01, .flags = OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_NO_CLKDM },
-       { .name = "gfx", .base = 0x44e01100, .rstctrl = 0x4, .rstst = 0x14, .rstmap = rst_map_0, .clkdm_name = "gfx_l3" },
+       {
+               .name = "gfx", .base = 0x44e01100,
+               .pwrstctrl = 0, .pwrstst = 0x10, .dmap = &omap_prm_noinact,
+               .rstctrl = 0x4, .rstst = 0x14, .rstmap = rst_map_0, .clkdm_name = "gfx_l3",
+       },
        { },
 };
 
@@ -135,7 +210,11 @@ static const struct omap_rst_map am4_device_rst_map[] = {
 };
 
 static const struct omap_prm_data am4_prm_data[] = {
-       { .name = "gfx", .base = 0x44df0400, .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_0, .clkdm_name = "gfx_l3" },
+       {
+               .name = "gfx", .base = 0x44df0400,
+               .pwrstctrl = 0, .pwrstst = 0x4, .dmap = &omap_prm_onoff_noauto,
+               .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_0, .clkdm_name = "gfx_l3",
+       },
        { .name = "per", .base = 0x44df0800, .rstctrl = 0x10, .rstst = 0x14, .rstmap = am4_per_rst_map, .clkdm_name = "pruss_ocp" },
        { .name = "wkup", .base = 0x44df2000, .rstctrl = 0x10, .rstst = 0x14, .rstmap = am3_wkup_rst_map, .flags = OMAP_PRM_HAS_NO_CLKDM },
        { .name = "device", .base = 0x44df4000, .rstctrl = 0x0, .rstst = 0x4, .rstmap = am4_device_rst_map, .flags = OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_NO_CLKDM },
@@ -151,6 +230,180 @@ static const struct of_device_id omap_prm_id_table[] = {
        { },
 };
 
+#ifdef DEBUG
+static void omap_prm_domain_show_state(struct omap_prm_domain *prmd,
+                                      const char *desc)
+{
+       dev_dbg(prmd->dev, "%s %s: %08x/%08x\n",
+               prmd->pd.name, desc,
+               readl_relaxed(prmd->prm->base + prmd->pwrstctrl),
+               readl_relaxed(prmd->prm->base + prmd->pwrstst));
+}
+#else
+static inline void omap_prm_domain_show_state(struct omap_prm_domain *prmd,
+                                             const char *desc)
+{
+}
+#endif
+
+static int omap_prm_domain_power_on(struct generic_pm_domain *domain)
+{
+       struct omap_prm_domain *prmd;
+       int ret;
+       u32 v;
+
+       prmd = genpd_to_prm_domain(domain);
+       if (!prmd->cap)
+               return 0;
+
+       omap_prm_domain_show_state(prmd, "on: previous state");
+
+       if (prmd->pwrstctrl_saved)
+               v = prmd->pwrstctrl_saved;
+       else
+               v = readl_relaxed(prmd->prm->base + prmd->pwrstctrl);
+
+       writel_relaxed(v | OMAP_PRMD_ON_ACTIVE,
+                      prmd->prm->base + prmd->pwrstctrl);
+
+       /* wait for the transition bit to get cleared */
+       ret = readl_relaxed_poll_timeout(prmd->prm->base + prmd->pwrstst,
+                                        v, !(v & PRM_ST_INTRANSITION), 1,
+                                        PRM_STATE_MAX_WAIT);
+       if (ret)
+               dev_err(prmd->dev, "%s: %s timed out\n",
+                       prmd->pd.name, __func__);
+
+       omap_prm_domain_show_state(prmd, "on: new state");
+
+       return ret;
+}
+
+/* No need to check for holes in the mask for the lowest mode */
+static int omap_prm_domain_find_lowest(struct omap_prm_domain *prmd)
+{
+       return __ffs(prmd->cap->usable_modes);
+}
+
+static int omap_prm_domain_power_off(struct generic_pm_domain *domain)
+{
+       struct omap_prm_domain *prmd;
+       int ret;
+       u32 v;
+
+       prmd = genpd_to_prm_domain(domain);
+       if (!prmd->cap)
+               return 0;
+
+       omap_prm_domain_show_state(prmd, "off: previous state");
+
+       v = readl_relaxed(prmd->prm->base + prmd->pwrstctrl);
+       prmd->pwrstctrl_saved = v;
+
+       v &= ~PRM_POWERSTATE_MASK;
+       v |= omap_prm_domain_find_lowest(prmd);
+
+       if (prmd->cap->statechange)
+               v |= PRM_LOWPOWERSTATECHANGE;
+       if (prmd->cap->logicretstate)
+               v &= ~PRM_LOGICRETSTATE;
+       else
+               v |= PRM_LOGICRETSTATE;
+
+       writel_relaxed(v, prmd->prm->base + prmd->pwrstctrl);
+
+       /* wait for the transition bit to get cleared */
+       ret = readl_relaxed_poll_timeout(prmd->prm->base + prmd->pwrstst,
+                                        v, !(v & PRM_ST_INTRANSITION), 1,
+                                        PRM_STATE_MAX_WAIT);
+       if (ret)
+               dev_warn(prmd->dev, "%s: %s timed out\n",
+                        __func__, prmd->pd.name);
+
+       omap_prm_domain_show_state(prmd, "off: new state");
+
+       return 0;
+}
+
+static int omap_prm_domain_attach_dev(struct generic_pm_domain *domain,
+                                     struct device *dev)
+{
+       struct generic_pm_domain_data *genpd_data;
+       struct of_phandle_args pd_args;
+       struct omap_prm_domain *prmd;
+       struct device_node *np;
+       int ret;
+
+       prmd = genpd_to_prm_domain(domain);
+       np = dev->of_node;
+
+       ret = of_parse_phandle_with_args(np, "power-domains",
+                                        "#power-domain-cells", 0, &pd_args);
+       if (ret < 0)
+               return ret;
+
+       if (pd_args.args_count != 0)
+               dev_warn(dev, "%s: unusupported #power-domain-cells: %i\n",
+                        prmd->pd.name, pd_args.args_count);
+
+       genpd_data = dev_gpd_data(dev);
+       genpd_data->data = NULL;
+
+       return 0;
+}
+
+static void omap_prm_domain_detach_dev(struct generic_pm_domain *domain,
+                                      struct device *dev)
+{
+       struct generic_pm_domain_data *genpd_data;
+
+       genpd_data = dev_gpd_data(dev);
+       genpd_data->data = NULL;
+}
+
+static int omap_prm_domain_init(struct device *dev, struct omap_prm *prm)
+{
+       struct omap_prm_domain *prmd;
+       struct device_node *np = dev->of_node;
+       const struct omap_prm_data *data;
+       const char *name;
+       int error;
+
+       if (!of_find_property(dev->of_node, "#power-domain-cells", NULL))
+               return 0;
+
+       of_node_put(dev->of_node);
+
+       prmd = devm_kzalloc(dev, sizeof(*prmd), GFP_KERNEL);
+       if (!prmd)
+               return -ENOMEM;
+
+       data = prm->data;
+       name = devm_kasprintf(dev, GFP_KERNEL, "prm_%s",
+                             data->name);
+
+       prmd->dev = dev;
+       prmd->prm = prm;
+       prmd->cap = prmd->prm->data->dmap;
+       prmd->pwrstctrl = prmd->prm->data->pwrstctrl;
+       prmd->pwrstst = prmd->prm->data->pwrstst;
+
+       prmd->pd.name = name;
+       prmd->pd.power_on = omap_prm_domain_power_on;
+       prmd->pd.power_off = omap_prm_domain_power_off;
+       prmd->pd.attach_dev = omap_prm_domain_attach_dev;
+       prmd->pd.detach_dev = omap_prm_domain_detach_dev;
+
+       pm_genpd_init(&prmd->pd, NULL, true);
+       error = of_genpd_add_provider_simple(np, &prmd->pd);
+       if (error)
+               pm_genpd_remove(&prmd->pd);
+       else
+               prm->prmd = prmd;
+
+       return error;
+}
+
 static bool _is_valid_reset(struct omap_reset_data *reset, unsigned long id)
 {
        if (reset->mask & BIT(id))
@@ -351,6 +604,7 @@ static int omap_prm_probe(struct platform_device *pdev)
        const struct omap_prm_data *data;
        struct omap_prm *prm;
        const struct of_device_id *match;
+       int ret;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!res)
@@ -378,7 +632,21 @@ static int omap_prm_probe(struct platform_device *pdev)
        if (IS_ERR(prm->base))
                return PTR_ERR(prm->base);
 
-       return omap_prm_reset_init(pdev, prm);
+       ret = omap_prm_domain_init(&pdev->dev, prm);
+       if (ret)
+               return ret;
+
+       ret = omap_prm_reset_init(pdev, prm);
+       if (ret)
+               goto err_domain;
+
+       return 0;
+
+err_domain:
+       of_genpd_del_provider(pdev->dev.of_node);
+       pm_genpd_remove(&prm->prmd->pd);
+
+       return ret;
 }
 
 static struct platform_driver omap_prm_driver = {
index de0123e..d2f5e70 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/nvmem-consumer.h>
 #include <linux/of.h>
+#include <linux/of_address.h>
 #include <linux/platform_data/pm33xx.h>
 #include <linux/platform_device.h>
 #include <linux/rtc.h>
@@ -39,6 +40,8 @@
 #define GIC_INT_SET_PENDING_BASE 0x200
 #define AM43XX_GIC_DIST_BASE   0x48241000
 
+static void __iomem *rtc_base_virt;
+static struct clk *rtc_fck;
 static u32 rtc_magic_val;
 
 static int (*am33xx_do_wfi_sram)(unsigned long unused);
@@ -90,7 +93,7 @@ static int am33xx_push_sram_idle(void)
        ro_sram_data.amx3_pm_sram_data_virt = ocmcram_location_data;
        ro_sram_data.amx3_pm_sram_data_phys =
                gen_pool_virt_to_phys(sram_pool_data, ocmcram_location_data);
-       ro_sram_data.rtc_base_virt = pm_ops->get_rtc_base_addr();
+       ro_sram_data.rtc_base_virt = rtc_base_virt;
 
        /* Save physical address to calculate resume offset during pm init */
        am33xx_do_wfi_sram_phys = gen_pool_virt_to_phys(sram_pool,
@@ -158,7 +161,7 @@ static struct wkup_m3_wakeup_src rtc_wake_src(void)
 {
        u32 i;
 
-       i = __raw_readl(pm_ops->get_rtc_base_addr() + 0x44) & 0x40;
+       i = __raw_readl(rtc_base_virt + 0x44) & 0x40;
 
        if (i) {
                retrigger_irq = rtc_alarm_wakeup.irq_nr;
@@ -177,13 +180,24 @@ static int am33xx_rtc_only_idle(unsigned long wfi_flags)
        return 0;
 }
 
+/*
+ * Note that the RTC module clock must be re-enabled only for rtc+ddr suspend.
+ * And looks like the module can stay in SYSC_IDLE_SMART_WKUP mode configured
+ * by the interconnect code just fine for both rtc+ddr suspend and retention
+ * suspend.
+ */
 static int am33xx_pm_suspend(suspend_state_t suspend_state)
 {
        int i, ret = 0;
 
        if (suspend_state == PM_SUSPEND_MEM &&
            pm_ops->check_off_mode_enable()) {
-               pm_ops->prepare_rtc_suspend();
+               ret = clk_prepare_enable(rtc_fck);
+               if (ret) {
+                       dev_err(pm33xx_dev, "Failed to enable clock: %i\n", ret);
+                       return ret;
+               }
+
                pm_ops->save_context();
                suspend_wfi_flags |= WFI_FLAG_RTC_ONLY;
                clk_save_context();
@@ -236,7 +250,7 @@ static int am33xx_pm_suspend(suspend_state_t suspend_state)
        }
 
        if (suspend_state == PM_SUSPEND_MEM && pm_ops->check_off_mode_enable())
-               pm_ops->prepare_rtc_resume();
+               clk_disable_unprepare(rtc_fck);
 
        return ret;
 }
@@ -425,14 +439,28 @@ static int am33xx_pm_rtc_setup(void)
        struct device_node *np;
        unsigned long val = 0;
        struct nvmem_device *nvmem;
+       int error;
 
        np = of_find_node_by_name(NULL, "rtc");
 
        if (of_device_is_available(np)) {
+               /* RTC interconnect target module clock */
+               rtc_fck = of_clk_get_by_name(np->parent, "fck");
+               if (IS_ERR(rtc_fck))
+                       return PTR_ERR(rtc_fck);
+
+               rtc_base_virt = of_iomap(np, 0);
+               if (!rtc_base_virt) {
+                       pr_warn("PM: could not iomap rtc");
+                       error = -ENODEV;
+                       goto err_clk_put;
+               }
+
                omap_rtc = rtc_class_open("rtc0");
                if (!omap_rtc) {
                        pr_warn("PM: rtc0 not available");
-                       return -EPROBE_DEFER;
+                       error = -EPROBE_DEFER;
+                       goto err_iounmap;
                }
 
                nvmem = devm_nvmem_device_get(&omap_rtc->dev,
@@ -454,6 +482,13 @@ static int am33xx_pm_rtc_setup(void)
        }
 
        return 0;
+
+err_iounmap:
+       iounmap(rtc_base_virt);
+err_clk_put:
+       clk_put(rtc_fck);
+
+       return error;
 }
 
 static int am33xx_pm_probe(struct platform_device *pdev)
@@ -544,6 +579,8 @@ static int am33xx_pm_remove(struct platform_device *pdev)
        suspend_set_ops(NULL);
        wkup_m3_ipc_put(m3_ipc);
        am33xx_pm_free_sram();
+       iounmap(rtc_base_virt);
+       clk_put(rtc_fck);
        return 0;
 }
 
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
new file mode 100644 (file)
index 0000000..cc0b4ad
--- /dev/null
@@ -0,0 +1,354 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * PRU-ICSS platform driver for various TI SoCs
+ *
+ * Copyright (C) 2014-2020 Texas Instruments Incorporated - http://www.ti.com/
+ * Author(s):
+ *     Suman Anna <s-anna@ti.com>
+ *     Andrew F. Davis <afd@ti.com>
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/dma-mapping.h>
+#include <linux/io.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/pruss_driver.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+/**
+ * struct pruss_private_data - PRUSS driver private data
+ * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM
+ * @has_core_mux_clock: flag to indicate the presence of PRUSS core clock
+ */
+struct pruss_private_data {
+       bool has_no_sharedram;
+       bool has_core_mux_clock;
+};
+
+static void pruss_of_free_clk_provider(void *data)
+{
+       struct device_node *clk_mux_np = data;
+
+       of_clk_del_provider(clk_mux_np);
+       of_node_put(clk_mux_np);
+}
+
+static int pruss_clk_mux_setup(struct pruss *pruss, struct clk *clk_mux,
+                              char *mux_name, struct device_node *clks_np)
+{
+       struct device_node *clk_mux_np;
+       struct device *dev = pruss->dev;
+       char *clk_mux_name;
+       unsigned int num_parents;
+       const char **parent_names;
+       void __iomem *reg;
+       u32 reg_offset;
+       int ret;
+
+       clk_mux_np = of_get_child_by_name(clks_np, mux_name);
+       if (!clk_mux_np) {
+               dev_err(dev, "%pOF is missing its '%s' node\n", clks_np,
+                       mux_name);
+               return -ENODEV;
+       }
+
+       num_parents = of_clk_get_parent_count(clk_mux_np);
+       if (num_parents < 1) {
+               dev_err(dev, "mux-clock %pOF must have parents\n", clk_mux_np);
+               ret = -EINVAL;
+               goto put_clk_mux_np;
+       }
+
+       parent_names = devm_kcalloc(dev, sizeof(*parent_names), num_parents,
+                                   GFP_KERNEL);
+       if (!parent_names) {
+               ret = -ENOMEM;
+               goto put_clk_mux_np;
+       }
+
+       of_clk_parent_fill(clk_mux_np, parent_names, num_parents);
+
+       clk_mux_name = devm_kasprintf(dev, GFP_KERNEL, "%s.%pOFn",
+                                     dev_name(dev), clk_mux_np);
+       if (!clk_mux_name) {
+               ret = -ENOMEM;
+               goto put_clk_mux_np;
+       }
+
+       ret = of_property_read_u32(clk_mux_np, "reg", &reg_offset);
+       if (ret)
+               goto put_clk_mux_np;
+
+       reg = pruss->cfg_base + reg_offset;
+
+       clk_mux = clk_register_mux(NULL, clk_mux_name, parent_names,
+                                  num_parents, 0, reg, 0, 1, 0, NULL);
+       if (IS_ERR(clk_mux)) {
+               ret = PTR_ERR(clk_mux);
+               goto put_clk_mux_np;
+       }
+
+       ret = devm_add_action_or_reset(dev, (void(*)(void *))clk_unregister_mux,
+                                      clk_mux);
+       if (ret) {
+               dev_err(dev, "failed to add clkmux unregister action %d", ret);
+               goto put_clk_mux_np;
+       }
+
+       ret = of_clk_add_provider(clk_mux_np, of_clk_src_simple_get, clk_mux);
+       if (ret)
+               goto put_clk_mux_np;
+
+       ret = devm_add_action_or_reset(dev, pruss_of_free_clk_provider,
+                                      clk_mux_np);
+       if (ret) {
+               dev_err(dev, "failed to add clkmux free action %d", ret);
+               goto put_clk_mux_np;
+       }
+
+       return 0;
+
+put_clk_mux_np:
+       of_node_put(clk_mux_np);
+       return ret;
+}
+
+static int pruss_clk_init(struct pruss *pruss, struct device_node *cfg_node)
+{
+       const struct pruss_private_data *data;
+       struct device_node *clks_np;
+       struct device *dev = pruss->dev;
+       int ret = 0;
+
+       data = of_device_get_match_data(dev);
+       if (IS_ERR(data))
+               return -ENODEV;
+
+       clks_np = of_get_child_by_name(cfg_node, "clocks");
+       if (!clks_np) {
+               dev_err(dev, "%pOF is missing its 'clocks' node\n", clks_np);
+               return -ENODEV;
+       }
+
+       if (data && data->has_core_mux_clock) {
+               ret = pruss_clk_mux_setup(pruss, pruss->core_clk_mux,
+                                         "coreclk-mux", clks_np);
+               if (ret) {
+                       dev_err(dev, "failed to setup coreclk-mux\n");
+                       goto put_clks_node;
+               }
+       }
+
+       ret = pruss_clk_mux_setup(pruss, pruss->iep_clk_mux, "iepclk-mux",
+                                 clks_np);
+       if (ret) {
+               dev_err(dev, "failed to setup iepclk-mux\n");
+               goto put_clks_node;
+       }
+
+put_clks_node:
+       of_node_put(clks_np);
+
+       return ret;
+}
+
+static struct regmap_config regmap_conf = {
+       .reg_bits = 32,
+       .val_bits = 32,
+       .reg_stride = 4,
+};
+
+static int pruss_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct device_node *np = dev_of_node(dev);
+       struct device_node *child;
+       struct pruss *pruss;
+       struct resource res;
+       int ret, i, index;
+       const struct pruss_private_data *data;
+       const char *mem_names[PRUSS_MEM_MAX] = { "dram0", "dram1", "shrdram2" };
+
+       data = of_device_get_match_data(&pdev->dev);
+       if (IS_ERR(data)) {
+               dev_err(dev, "missing private data\n");
+               return -ENODEV;
+       }
+
+       ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
+       if (ret) {
+               dev_err(dev, "failed to set the DMA coherent mask");
+               return ret;
+       }
+
+       pruss = devm_kzalloc(dev, sizeof(*pruss), GFP_KERNEL);
+       if (!pruss)
+               return -ENOMEM;
+
+       pruss->dev = dev;
+
+       child = of_get_child_by_name(np, "memories");
+       if (!child) {
+               dev_err(dev, "%pOF is missing its 'memories' node\n", child);
+               return -ENODEV;
+       }
+
+       for (i = 0; i < PRUSS_MEM_MAX; i++) {
+               /*
+                * On AM437x one of two PRUSS units don't contain Shared RAM,
+                * skip it
+                */
+               if (data && data->has_no_sharedram && i == PRUSS_MEM_SHRD_RAM2)
+                       continue;
+
+               index = of_property_match_string(child, "reg-names",
+                                                mem_names[i]);
+               if (index < 0) {
+                       of_node_put(child);
+                       return index;
+               }
+
+               if (of_address_to_resource(child, index, &res)) {
+                       of_node_put(child);
+                       return -EINVAL;
+               }
+
+               pruss->mem_regions[i].va = devm_ioremap(dev, res.start,
+                                                       resource_size(&res));
+               if (!pruss->mem_regions[i].va) {
+                       dev_err(dev, "failed to parse and map memory resource %d %s\n",
+                               i, mem_names[i]);
+                       of_node_put(child);
+                       return -ENOMEM;
+               }
+               pruss->mem_regions[i].pa = res.start;
+               pruss->mem_regions[i].size = resource_size(&res);
+
+               dev_dbg(dev, "memory %8s: pa %pa size 0x%zx va %pK\n",
+                       mem_names[i], &pruss->mem_regions[i].pa,
+                       pruss->mem_regions[i].size, pruss->mem_regions[i].va);
+       }
+       of_node_put(child);
+
+       platform_set_drvdata(pdev, pruss);
+
+       pm_runtime_enable(dev);
+       ret = pm_runtime_get_sync(dev);
+       if (ret < 0) {
+               dev_err(dev, "couldn't enable module\n");
+               pm_runtime_put_noidle(dev);
+               goto rpm_disable;
+       }
+
+       child = of_get_child_by_name(np, "cfg");
+       if (!child) {
+               dev_err(dev, "%pOF is missing its 'cfg' node\n", child);
+               ret = -ENODEV;
+               goto rpm_put;
+       }
+
+       if (of_address_to_resource(child, 0, &res)) {
+               ret = -ENOMEM;
+               goto node_put;
+       }
+
+       pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res));
+       if (!pruss->cfg_base) {
+               ret = -ENOMEM;
+               goto node_put;
+       }
+
+       regmap_conf.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", child,
+                                    (u64)res.start);
+       regmap_conf.max_register = resource_size(&res) - 4;
+
+       pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base,
+                                                 &regmap_conf);
+       kfree(regmap_conf.name);
+       if (IS_ERR(pruss->cfg_regmap)) {
+               dev_err(dev, "regmap_init_mmio failed for cfg, ret = %ld\n",
+                       PTR_ERR(pruss->cfg_regmap));
+               ret = PTR_ERR(pruss->cfg_regmap);
+               goto node_put;
+       }
+
+       ret = pruss_clk_init(pruss, child);
+       if (ret) {
+               dev_err(dev, "failed to setup coreclk-mux\n");
+               goto node_put;
+       }
+
+       ret = devm_of_platform_populate(dev);
+       if (ret) {
+               dev_err(dev, "failed to register child devices\n");
+               goto node_put;
+       }
+
+       of_node_put(child);
+
+       return 0;
+
+node_put:
+       of_node_put(child);
+rpm_put:
+       pm_runtime_put_sync(dev);
+rpm_disable:
+       pm_runtime_disable(dev);
+       return ret;
+}
+
+static int pruss_remove(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+
+       devm_of_platform_depopulate(dev);
+
+       pm_runtime_put_sync(dev);
+       pm_runtime_disable(dev);
+
+       return 0;
+}
+
+/* instance-specific driver private data */
+static const struct pruss_private_data am437x_pruss1_data = {
+       .has_no_sharedram = false,
+};
+
+static const struct pruss_private_data am437x_pruss0_data = {
+       .has_no_sharedram = true,
+};
+
+static const struct pruss_private_data am65x_j721e_pruss_data = {
+       .has_core_mux_clock = true,
+};
+
+static const struct of_device_id pruss_of_match[] = {
+       { .compatible = "ti,am3356-pruss" },
+       { .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, },
+       { .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, },
+       { .compatible = "ti,am5728-pruss" },
+       { .compatible = "ti,k2g-pruss" },
+       { .compatible = "ti,am654-icssg", .data = &am65x_j721e_pruss_data, },
+       { .compatible = "ti,j721e-icssg", .data = &am65x_j721e_pruss_data, },
+       {},
+};
+MODULE_DEVICE_TABLE(of, pruss_of_match);
+
+static struct platform_driver pruss_driver = {
+       .driver = {
+               .name = "pruss",
+               .of_match_table = pruss_of_match,
+       },
+       .probe  = pruss_probe,
+       .remove = pruss_remove,
+};
+module_platform_driver(pruss_driver);
+
+MODULE_AUTHOR("Suman Anna <s-anna@ti.com>");
+MODULE_DESCRIPTION("PRU-ICSS Subsystem Driver");
+MODULE_LICENSE("GPL v2");
index 8c2a2f2..8afb3f4 100644 (file)
@@ -9,7 +9,6 @@
 
 #include <linux/err.h>
 #include <linux/module.h>
-#include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
 #include <dt-bindings/soc/ti,sci_pm_domain.h>
 
 /**
- * struct ti_sci_genpd_dev_data: holds data needed for every device attached
- *                              to this genpd
- * @idx: index of the device that identifies it with the system
- *      control processor.
- * @exclusive: Permissions for exclusive request or shared request of the
- *            device.
+ * struct ti_sci_genpd_provider: holds common TI SCI genpd provider data
+ * @ti_sci: handle to TI SCI protocol driver that provides ops to
+ *         communicate with system control processor.
+ * @dev: pointer to dev for the driver for devm allocs
+ * @pd_list: list of all the power domains on the device
+ * @data: onecell data for genpd core
  */
-struct ti_sci_genpd_dev_data {
-       int idx;
-       u8 exclusive;
+struct ti_sci_genpd_provider {
+       const struct ti_sci_handle *ti_sci;
+       struct device *dev;
+       struct list_head pd_list;
+       struct genpd_onecell_data data;
 };
 
 /**
  * struct ti_sci_pm_domain: TI specific data needed for power domain
- * @ti_sci: handle to TI SCI protocol driver that provides ops to
- *         communicate with system control processor.
- * @dev: pointer to dev for the driver for devm allocs
+ * @idx: index of the device that identifies it with the system
+ *      control processor.
+ * @exclusive: Permissions for exclusive request or shared request of the
+ *            device.
  * @pd: generic_pm_domain for use with the genpd framework
+ * @node: link for the genpd list
+ * @parent: link to the parent TI SCI genpd provider
  */
 struct ti_sci_pm_domain {
-       const struct ti_sci_handle *ti_sci;
-       struct device *dev;
+       int idx;
+       u8 exclusive;
        struct generic_pm_domain pd;
+       struct list_head node;
+       struct ti_sci_genpd_provider *parent;
 };
 
 #define genpd_to_ti_sci_pd(gpd) container_of(gpd, struct ti_sci_pm_domain, pd)
 
-/**
- * ti_sci_dev_id(): get prepopulated ti_sci id from struct dev
- * @dev: pointer to device associated with this genpd
- *
- * Returns device_id stored from ti,sci_id property
- */
-static int ti_sci_dev_id(struct device *dev)
-{
-       struct generic_pm_domain_data *genpd_data = dev_gpd_data(dev);
-       struct ti_sci_genpd_dev_data *sci_dev_data = genpd_data->data;
-
-       return sci_dev_data->idx;
-}
-
-static u8 is_ti_sci_dev_exclusive(struct device *dev)
-{
-       struct generic_pm_domain_data *genpd_data = dev_gpd_data(dev);
-       struct ti_sci_genpd_dev_data *sci_dev_data = genpd_data->data;
-
-       return sci_dev_data->exclusive;
-}
-
-/**
- * ti_sci_dev_to_sci_handle(): get pointer to ti_sci_handle
- * @dev: pointer to device associated with this genpd
- *
- * Returns ti_sci_handle to be used to communicate with system
- *        control processor.
+/*
+ * ti_sci_pd_power_off(): genpd power down hook
+ * @domain: pointer to the powerdomain to power off
  */
-static const struct ti_sci_handle *ti_sci_dev_to_sci_handle(struct device *dev)
+static int ti_sci_pd_power_off(struct generic_pm_domain *domain)
 {
-       struct generic_pm_domain *pd = pd_to_genpd(dev->pm_domain);
-       struct ti_sci_pm_domain *ti_sci_genpd = genpd_to_ti_sci_pd(pd);
+       struct ti_sci_pm_domain *pd = genpd_to_ti_sci_pd(domain);
+       const struct ti_sci_handle *ti_sci = pd->parent->ti_sci;
 
-       return ti_sci_genpd->ti_sci;
+       return ti_sci->ops.dev_ops.put_device(ti_sci, pd->idx);
 }
 
-/**
- * ti_sci_dev_start(): genpd device start hook called to turn device on
- * @dev: pointer to device associated with this genpd to be powered on
+/*
+ * ti_sci_pd_power_on(): genpd power up hook
+ * @domain: pointer to the powerdomain to power on
  */
-static int ti_sci_dev_start(struct device *dev)
+static int ti_sci_pd_power_on(struct generic_pm_domain *domain)
 {
-       const struct ti_sci_handle *ti_sci = ti_sci_dev_to_sci_handle(dev);
-       int idx = ti_sci_dev_id(dev);
+       struct ti_sci_pm_domain *pd = genpd_to_ti_sci_pd(domain);
+       const struct ti_sci_handle *ti_sci = pd->parent->ti_sci;
 
-       if (is_ti_sci_dev_exclusive(dev))
-               return ti_sci->ops.dev_ops.get_device_exclusive(ti_sci, idx);
+       if (pd->exclusive)
+               return ti_sci->ops.dev_ops.get_device_exclusive(ti_sci,
+                                                               pd->idx);
        else
-               return ti_sci->ops.dev_ops.get_device(ti_sci, idx);
+               return ti_sci->ops.dev_ops.get_device(ti_sci, pd->idx);
 }
 
-/**
- * ti_sci_dev_stop(): genpd device stop hook called to turn device off
- * @dev: pointer to device associated with this genpd to be powered off
+/*
+ * ti_sci_pd_xlate(): translation service for TI SCI genpds
+ * @genpdspec: DT identification data for the genpd
+ * @data: genpd core data for all the powerdomains on the device
  */
-static int ti_sci_dev_stop(struct device *dev)
+static struct generic_pm_domain *ti_sci_pd_xlate(
+                                       struct of_phandle_args *genpdspec,
+                                       void *data)
 {
-       const struct ti_sci_handle *ti_sci = ti_sci_dev_to_sci_handle(dev);
-       int idx = ti_sci_dev_id(dev);
+       struct genpd_onecell_data *genpd_data = data;
+       unsigned int idx = genpdspec->args[0];
 
-       return ti_sci->ops.dev_ops.put_device(ti_sci, idx);
-}
+       if (genpdspec->args_count != 1 && genpdspec->args_count != 2)
+               return ERR_PTR(-EINVAL);
 
-static int ti_sci_pd_attach_dev(struct generic_pm_domain *domain,
-                               struct device *dev)
-{
-       struct device_node *np = dev->of_node;
-       struct of_phandle_args pd_args;
-       struct ti_sci_pm_domain *ti_sci_genpd = genpd_to_ti_sci_pd(domain);
-       const struct ti_sci_handle *ti_sci = ti_sci_genpd->ti_sci;
-       struct ti_sci_genpd_dev_data *sci_dev_data;
-       struct generic_pm_domain_data *genpd_data;
-       int idx, ret = 0;
-
-       ret = of_parse_phandle_with_args(np, "power-domains",
-                                        "#power-domain-cells", 0, &pd_args);
-       if (ret < 0)
-               return ret;
-
-       if (pd_args.args_count != 1 && pd_args.args_count != 2)
-               return -EINVAL;
-
-       idx = pd_args.args[0];
-
-       /*
-        * Check the validity of the requested idx, if the index is not valid
-        * the PMMC will return a NAK here and we will not allocate it.
-        */
-       ret = ti_sci->ops.dev_ops.is_valid(ti_sci, idx);
-       if (ret)
-               return -EINVAL;
-
-       sci_dev_data = kzalloc(sizeof(*sci_dev_data), GFP_KERNEL);
-       if (!sci_dev_data)
-               return -ENOMEM;
+       if (idx >= genpd_data->num_domains) {
+               pr_err("%s: invalid domain index %u\n", __func__, idx);
+               return ERR_PTR(-EINVAL);
+       }
 
-       sci_dev_data->idx = idx;
-       /* Enable the exclusive permissions by default */
-       sci_dev_data->exclusive = TI_SCI_PD_EXCLUSIVE;
-       if (pd_args.args_count == 2)
-               sci_dev_data->exclusive = pd_args.args[1] & 0x1;
+       if (!genpd_data->domains[idx])
+               return ERR_PTR(-ENOENT);
 
-       genpd_data = dev_gpd_data(dev);
-       genpd_data->data = sci_dev_data;
+       genpd_to_ti_sci_pd(genpd_data->domains[idx])->exclusive =
+               genpdspec->args[1];
 
-       return 0;
-}
-
-static void ti_sci_pd_detach_dev(struct generic_pm_domain *domain,
-                                struct device *dev)
-{
-       struct generic_pm_domain_data *genpd_data = dev_gpd_data(dev);
-       struct ti_sci_genpd_dev_data *sci_dev_data = genpd_data->data;
-
-       kfree(sci_dev_data);
-       genpd_data->data = NULL;
+       return genpd_data->domains[idx];
 }
 
 static const struct of_device_id ti_sci_pm_domain_matches[] = {
@@ -173,33 +117,80 @@ MODULE_DEVICE_TABLE(of, ti_sci_pm_domain_matches);
 static int ti_sci_pm_domain_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
-       struct device_node *np = dev->of_node;
-       struct ti_sci_pm_domain *ti_sci_pd;
+       struct ti_sci_genpd_provider *pd_provider;
+       struct ti_sci_pm_domain *pd;
+       struct device_node *np = NULL;
+       struct of_phandle_args args;
        int ret;
+       u32 max_id = 0;
+       int index;
 
-       ti_sci_pd = devm_kzalloc(dev, sizeof(*ti_sci_pd), GFP_KERNEL);
-       if (!ti_sci_pd)
+       pd_provider = devm_kzalloc(dev, sizeof(*pd_provider), GFP_KERNEL);
+       if (!pd_provider)
                return -ENOMEM;
 
-       ti_sci_pd->ti_sci = devm_ti_sci_get_handle(dev);
-       if (IS_ERR(ti_sci_pd->ti_sci))
-               return PTR_ERR(ti_sci_pd->ti_sci);
+       pd_provider->ti_sci = devm_ti_sci_get_handle(dev);
+       if (IS_ERR(pd_provider->ti_sci))
+               return PTR_ERR(pd_provider->ti_sci);
+
+       pd_provider->dev = dev;
+
+       INIT_LIST_HEAD(&pd_provider->pd_list);
+
+       /* Find highest device ID used for power domains */
+       while (1) {
+               np = of_find_node_with_property(np, "power-domains");
+               if (!np)
+                       break;
+
+               index = 0;
+
+               while (1) {
+                       ret = of_parse_phandle_with_args(np, "power-domains",
+                                                        "#power-domain-cells",
+                                                        index, &args);
+                       if (ret)
+                               break;
+
+                       if (args.args_count >= 1 && args.np == dev->of_node) {
+                               if (args.args[0] > max_id)
+                                       max_id = args.args[0];
+
+                               pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
+                               if (!pd)
+                                       return -ENOMEM;
+
+                               pd->pd.name = devm_kasprintf(dev, GFP_KERNEL,
+                                                            "pd:%d",
+                                                            args.args[0]);
+                               if (!pd->pd.name)
+                                       return -ENOMEM;
 
-       ti_sci_pd->dev = dev;
+                               pd->pd.power_off = ti_sci_pd_power_off;
+                               pd->pd.power_on = ti_sci_pd_power_on;
+                               pd->idx = args.args[0];
+                               pd->parent = pd_provider;
 
-       ti_sci_pd->pd.name = "ti_sci_pd";
+                               pm_genpd_init(&pd->pd, NULL, true);
 
-       ti_sci_pd->pd.attach_dev = ti_sci_pd_attach_dev;
-       ti_sci_pd->pd.detach_dev = ti_sci_pd_detach_dev;
+                               list_add(&pd->node, &pd_provider->pd_list);
+                       }
+                       index++;
+               }
+       }
 
-       ti_sci_pd->pd.dev_ops.start = ti_sci_dev_start;
-       ti_sci_pd->pd.dev_ops.stop = ti_sci_dev_stop;
+       pd_provider->data.domains =
+               devm_kcalloc(dev, max_id + 1,
+                            sizeof(*pd_provider->data.domains),
+                            GFP_KERNEL);
 
-       pm_genpd_init(&ti_sci_pd->pd, NULL, true);
+       pd_provider->data.num_domains = max_id + 1;
+       pd_provider->data.xlate = ti_sci_pd_xlate;
 
-       ret = of_genpd_add_provider_simple(np, &ti_sci_pd->pd);
+       list_for_each_entry(pd, &pd_provider->pd_list, node)
+               pd_provider->data.domains[pd->idx] = &pd->pd;
 
-       return ret;
+       return of_genpd_add_provider_onecell(dev->of_node, &pd_provider->data);
 }
 
 static struct platform_driver ti_sci_pm_domains_driver = {
index 7dcf77c..bab4ad8 100644 (file)
@@ -100,7 +100,7 @@ ATTRIBUTE_GROUPS(integrator);
 
 static int __init integrator_soc_init(void)
 {
-       static struct regmap *syscon_regmap;
+       struct regmap *syscon_regmap;
        struct soc_device *soc_dev;
        struct soc_device_attribute *soc_dev_attr;
        struct device_node *np;
index 31ff49f..c556623 100644 (file)
@@ -205,7 +205,7 @@ static int zynqmp_pm_probe(struct platform_device *pdev)
                rx_chan = mbox_request_channel_byname(client, "rx");
                if (IS_ERR(rx_chan)) {
                        dev_err(&pdev->dev, "Failed to request rx channel\n");
-                       return IS_ERR(rx_chan);
+                       return PTR_ERR(rx_chan);
                }
        } else if (of_find_property(pdev->dev.of_node, "interrupts", NULL)) {
                irq = platform_get_irq(pdev, 0);
index d2c976e..5cff60d 100644 (file)
@@ -709,7 +709,7 @@ config SPI_S3C24XX_FIQ
 
 config SPI_S3C64XX
        tristate "Samsung S3C64XX series type SPI"
-       depends on (PLAT_SAMSUNG || ARCH_EXYNOS || COMPILE_TEST)
+       depends on (PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST)
        help
          SPI driver for Samsung S3C64XX and newer SoCs.
 
index 21dc758..6fea582 100644 (file)
@@ -98,7 +98,6 @@ obj-$(CONFIG_SPI_RPCIF)                       += spi-rpc-if.o
 obj-$(CONFIG_SPI_RSPI)                 += spi-rspi.o
 obj-$(CONFIG_SPI_S3C24XX)              += spi-s3c24xx-hw.o
 spi-s3c24xx-hw-y                       := spi-s3c24xx.o
-spi-s3c24xx-hw-$(CONFIG_SPI_S3C24XX_FIQ) += spi-s3c24xx-fiq.o
 obj-$(CONFIG_SPI_S3C64XX)              += spi-s3c64xx.o
 obj-$(CONFIG_SPI_SC18IS602)            += spi-sc18is602.o
 obj-$(CONFIG_SPI_SH)                   += spi-sh.o
index b87116e..7104cf1 100644 (file)
@@ -1193,7 +1193,6 @@ static int bcm2835_spi_setup(struct spi_device *spi)
        struct spi_controller *ctlr = spi->controller;
        struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
        struct gpio_chip *chip;
-       enum gpio_lookup_flags lflags;
        u32 cs;
 
        /*
@@ -1259,21 +1258,9 @@ static int bcm2835_spi_setup(struct spi_device *spi)
        if (!chip)
                return 0;
 
-       /*
-        * Retrieve the corresponding GPIO line used for CS.
-        * The inversion semantics will be handled by the GPIO core
-        * code, so we pass GPIOD_OUT_LOW for "unasserted" and
-        * the correct flag for inversion semantics. The SPI_CS_HIGH
-        * on spi->mode cannot be checked for polarity in this case
-        * as the flag use_gpio_descriptors enforces SPI_CS_HIGH.
-        */
-       if (of_property_read_bool(spi->dev.of_node, "spi-cs-high"))
-               lflags = GPIO_ACTIVE_HIGH;
-       else
-               lflags = GPIO_ACTIVE_LOW;
        spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select,
                                                  DRV_NAME,
-                                                 lflags,
+                                                 GPIO_LOOKUP_FLAGS_DEFAULT,
                                                  GPIOD_OUT_LOW);
        if (IS_ERR(spi->cs_gpiod))
                return PTR_ERR(spi->cs_gpiod);
index 3967afa..1a08c1d 100644 (file)
@@ -1080,12 +1080,11 @@ MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids);
 #ifdef CONFIG_PM_SLEEP
 static int dspi_suspend(struct device *dev)
 {
-       struct spi_controller *ctlr = dev_get_drvdata(dev);
-       struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
+       struct fsl_dspi *dspi = dev_get_drvdata(dev);
 
        if (dspi->irq)
                disable_irq(dspi->irq);
-       spi_controller_suspend(ctlr);
+       spi_controller_suspend(dspi->ctlr);
        clk_disable_unprepare(dspi->clk);
 
        pinctrl_pm_select_sleep_state(dev);
@@ -1095,8 +1094,7 @@ static int dspi_suspend(struct device *dev)
 
 static int dspi_resume(struct device *dev)
 {
-       struct spi_controller *ctlr = dev_get_drvdata(dev);
-       struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
+       struct fsl_dspi *dspi = dev_get_drvdata(dev);
        int ret;
 
        pinctrl_pm_select_default_state(dev);
@@ -1104,7 +1102,7 @@ static int dspi_resume(struct device *dev)
        ret = clk_prepare_enable(dspi->clk);
        if (ret)
                return ret;
-       spi_controller_resume(ctlr);
+       spi_controller_resume(dspi->ctlr);
        if (dspi->irq)
                enable_irq(dspi->irq);
 
index 060b1f5..4b80e27 100644 (file)
@@ -1676,15 +1676,18 @@ static int spi_imx_probe(struct platform_device *pdev)
                goto out_master_put;
        }
 
-       pm_runtime_enable(spi_imx->dev);
+       ret = clk_prepare_enable(spi_imx->clk_per);
+       if (ret)
+               goto out_master_put;
+
+       ret = clk_prepare_enable(spi_imx->clk_ipg);
+       if (ret)
+               goto out_put_per;
+
        pm_runtime_set_autosuspend_delay(spi_imx->dev, MXC_RPM_TIMEOUT);
        pm_runtime_use_autosuspend(spi_imx->dev);
-
-       ret = pm_runtime_get_sync(spi_imx->dev);
-       if (ret < 0) {
-               dev_err(spi_imx->dev, "failed to enable clock\n");
-               goto out_runtime_pm_put;
-       }
+       pm_runtime_set_active(spi_imx->dev);
+       pm_runtime_enable(spi_imx->dev);
 
        spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per);
        /*
@@ -1722,8 +1725,12 @@ out_bitbang_start:
                spi_imx_sdma_exit(spi_imx);
 out_runtime_pm_put:
        pm_runtime_dont_use_autosuspend(spi_imx->dev);
-       pm_runtime_put_sync(spi_imx->dev);
+       pm_runtime_set_suspended(&pdev->dev);
        pm_runtime_disable(spi_imx->dev);
+
+       clk_disable_unprepare(spi_imx->clk_ipg);
+out_put_per:
+       clk_disable_unprepare(spi_imx->clk_per);
 out_master_put:
        spi_master_put(master);
 
similarity index 89%
rename from arch/arm/plat-samsung/include/plat/regs-spi.h
rename to drivers/spi/spi-s3c24xx-regs.h
index 6078443..f51464a 100644 (file)
@@ -5,11 +5,8 @@
  * S3C2410 SPI register definition
  */
 
-#ifndef __ASM_ARCH_REGS_SPI_H
-#define __ASM_ARCH_REGS_SPI_H
-
-#define S3C2410_SPI1           (0x20)
-#define S3C2412_SPI1           (0x100)
+#ifndef __SPI_S3C2410_H
+#define __SPI_S3C2410_H
 
 #define S3C2410_SPCON          (0x00)
 
@@ -41,4 +38,4 @@
 #define S3C2410_SPTDAT         (0x10)
 #define S3C2410_SPRDAT         (0x14)
 
-#endif /* __ASM_ARCH_REGS_SPI_H */
+#endif /* __SPI_S3C2410_H */
index 7742170..d6f5169 100644 (file)
 #include <linux/spi/spi.h>
 #include <linux/spi/spi_bitbang.h>
 #include <linux/spi/s3c24xx.h>
+#include <linux/spi/s3c24xx-fiq.h>
 #include <linux/module.h>
 
-#include <plat/regs-spi.h>
-
 #include <asm/fiq.h>
 
-#include "spi-s3c24xx-fiq.h"
+#include "spi-s3c24xx-regs.h"
 
 /**
  * struct s3c24xx_spi_devstate - per device data
@@ -230,21 +229,6 @@ struct spi_fiq_code {
        u8      data[];
 };
 
-extern struct spi_fiq_code s3c24xx_spi_fiq_txrx;
-extern struct spi_fiq_code s3c24xx_spi_fiq_tx;
-extern struct spi_fiq_code s3c24xx_spi_fiq_rx;
-
-/**
- * ack_bit - turn IRQ into IRQ acknowledgement bit
- * @irq: The interrupt number
- *
- * Returns the bit to write to the interrupt acknowledge register.
- */
-static inline u32 ack_bit(unsigned int irq)
-{
-       return 1 << (irq - IRQ_EINT0);
-}
-
 /**
  * s3c24xx_spi_tryfiq - attempt to claim and setup FIQ for transfer
  * @hw: The hardware state.
@@ -261,6 +245,7 @@ static void s3c24xx_spi_tryfiq(struct s3c24xx_spi *hw)
        struct pt_regs regs;
        enum spi_fiq_mode mode;
        struct spi_fiq_code *code;
+       u32 *ack_ptr = NULL;
        int ret;
 
        if (!hw->fiq_claimed) {
@@ -283,13 +268,10 @@ static void s3c24xx_spi_tryfiq(struct s3c24xx_spi *hw)
        regs.uregs[fiq_rrx]  = (long)hw->rx;
        regs.uregs[fiq_rtx]  = (long)hw->tx + 1;
        regs.uregs[fiq_rcount] = hw->len - 1;
-       regs.uregs[fiq_rirq] = (long)S3C24XX_VA_IRQ;
 
        set_fiq_regs(&regs);
 
        if (hw->fiq_mode != mode) {
-               u32 *ack_ptr;
-
                hw->fiq_mode = mode;
 
                switch (mode) {
@@ -309,12 +291,10 @@ static void s3c24xx_spi_tryfiq(struct s3c24xx_spi *hw)
                BUG_ON(!code);
 
                ack_ptr = (u32 *)&code->data[code->ack_offset];
-               *ack_ptr = ack_bit(hw->irq);
-
                set_fiq_handler(&code->data, code->length);
        }
 
-       s3c24xx_set_fiq(hw->irq, true);
+       s3c24xx_set_fiq(hw->irq, ack_ptr, true);
 
        hw->fiq_mode = mode;
        hw->fiq_inuse = 1;
index 2d03104..443ca3f 100644 (file)
@@ -114,6 +114,8 @@ source "drivers/staging/kpc2000/Kconfig"
 
 source "drivers/staging/qlge/Kconfig"
 
+source "drivers/staging/wimax/Kconfig"
+
 source "drivers/staging/wfx/Kconfig"
 
 source "drivers/staging/hikey9xx/Kconfig"
index 757a892..dc45128 100644 (file)
@@ -47,5 +47,6 @@ obj-$(CONFIG_XIL_AXIS_FIFO)   += axis-fifo/
 obj-$(CONFIG_FIELDBUS_DEV)     += fieldbus/
 obj-$(CONFIG_KPC2000)          += kpc2000/
 obj-$(CONFIG_QLGE)             += qlge/
+obj-$(CONFIG_WIMAX)            += wimax/
 obj-$(CONFIG_WFX)              += wfx/
 obj-y                          += hikey9xx/
index 48ec2ee..d740c47 100644 (file)
@@ -1342,6 +1342,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev,
                if (dev->irq && board->has_ao_fifo) {
                        dev->write_subdev = s;
                        s->subdev_flags |= SDF_CMD_WRITE;
+                       s->len_chanlist = s->n_chan;
                        s->do_cmdtest   = cb_pcidas_ao_cmdtest;
                        s->do_cmd       = cb_pcidas_ao_cmd;
                        s->cancel       = cb_pcidas_ao_cancel;
index 5b8d0ba..b5fded1 100644 (file)
@@ -293,7 +293,7 @@ static int controller_probe(struct platform_device *pdev)
        regulator = devm_regulator_register(dev, &can_power_desc, &config);
        if (IS_ERR(regulator)) {
                err = PTR_ERR(regulator);
-               goto out_reset;
+               goto out_ida;
        }
        /* make controller info visible to userspace */
        cd->class_dev = kzalloc(sizeof(*cd->class_dev), GFP_KERNEL);
index cfb673a..0bf5458 100644 (file)
@@ -147,12 +147,6 @@ int cvm_oct_phy_setup_device(struct net_device *dev)
 
        phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0);
        if (!phy_node && of_phy_is_fixed_link(priv->of_node)) {
-               int rc;
-
-               rc = of_phy_register_fixed_link(priv->of_node);
-               if (rc)
-                       return rc;
-
                phy_node = of_node_get(priv->of_node);
        }
        if (!phy_node)
index 2c16230..9ebd665 100644 (file)
@@ -69,15 +69,17 @@ static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)
        else
                port = work->word1.cn38xx.ipprt;
 
-       if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64)) {
+       if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64))
                /*
                 * Ignore length errors on min size packets. Some
                 * equipment incorrectly pads packets to 64+4FCS
                 * instead of 60+4FCS.  Note these packets still get
                 * counted as frame errors.
                 */
-       } else if (work->word2.snoip.err_code == 5 ||
-                  work->word2.snoip.err_code == 7) {
+               return 0;
+
+       if (work->word2.snoip.err_code == 5 ||
+           work->word2.snoip.err_code == 7) {
                /*
                 * We received a packet with either an alignment error
                 * or a FCS error. This may be signalling that we are
@@ -108,7 +110,10 @@ static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)
                                /* Port received 0xd5 preamble */
                                work->packet_ptr.s.addr += i + 1;
                                work->word1.len -= i + 5;
-                       } else if ((*ptr & 0xf) == 0xd) {
+                               return 0;
+                       }
+
+                       if ((*ptr & 0xf) == 0xd) {
                                /* Port received 0xd preamble */
                                work->packet_ptr.s.addr += i;
                                work->word1.len -= i + 4;
@@ -118,21 +123,20 @@ static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)
                                            ((*(ptr + 1) & 0xf) << 4);
                                        ptr++;
                                }
-                       } else {
-                               printk_ratelimited("Port %d unknown preamble, packet dropped\n",
-                                                  port);
-                               cvm_oct_free_work(work);
-                               return 1;
+                               return 0;
                        }
+
+                       printk_ratelimited("Port %d unknown preamble, packet dropped\n",
+                                          port);
+                       cvm_oct_free_work(work);
+                       return 1;
                }
-       } else {
-               printk_ratelimited("Port %d receive error code %d, packet dropped\n",
-                                  port, work->word2.snoip.err_code);
-               cvm_oct_free_work(work);
-               return 1;
        }
 
-       return 0;
+       printk_ratelimited("Port %d receive error code %d, packet dropped\n",
+                          port, work->word2.snoip.err_code);
+       cvm_oct_free_work(work);
+       return 1;
 }
 
 static void copy_segments_to_skb(struct cvmx_wqe *work, struct sk_buff *skb)
index 204f0b1..5dea6e9 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/phy.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
+#include <linux/of_mdio.h>
 #include <linux/of_net.h>
 #include <linux/if_ether.h>
 #include <linux/if_vlan.h>
@@ -892,6 +893,14 @@ static int cvm_oct_probe(struct platform_device *pdev)
                                break;
                        }
 
+                       if (priv->of_node && of_phy_is_fixed_link(priv->of_node)) {
+                               if (of_phy_register_fixed_link(priv->of_node)) {
+                                       netdev_err(dev, "Failed to register fixed link for interface %d, port %d\n",
+                                                  interface, priv->port);
+                                       dev->netdev_ops = NULL;
+                               }
+                       }
+
                        if (!dev->netdev_ops) {
                                free_netdev(dev);
                        } else if (register_netdev(dev) < 0) {
index 8c2ff37..238387d 100644 (file)
@@ -100,7 +100,7 @@ static void rtllib_tkip_deinit(void *priv)
                crypto_free_shash(_priv->tx_tfm_michael);
                crypto_free_shash(_priv->rx_tfm_michael);
        }
-       kzfree(priv);
+       kfree_sensitive(priv);
 }
 
 
index 7cdd17f..7790271 100644 (file)
@@ -49,7 +49,7 @@ static void *prism2_wep_init(int keyidx)
 
 static void prism2_wep_deinit(void *priv)
 {
-       kzfree(priv);
+       kfree_sensitive(priv);
 }
 
 /* Perform WEP encryption on given skb that has at least 4 bytes of headroom
index 4b415cc..e8fa1d3 100644 (file)
@@ -107,7 +107,7 @@ static void ieee80211_tkip_deinit(void *priv)
                crypto_free_shash(_priv->tx_tfm_michael);
                crypto_free_shash(_priv->rx_tfm_michael);
        }
-       kzfree(priv);
+       kfree_sensitive(priv);
 }
 
 
index 1c56e2d..a41b651 100644 (file)
@@ -54,7 +54,7 @@ static void *prism2_wep_init(int keyidx)
 
 static void prism2_wep_deinit(void *priv)
 {
-       kzfree(priv);
+       kfree_sensitive(priv);
 }
 
 /* Perform WEP encryption on given skb that has at least 4 bytes of headroom
index 3a42025..9097bcb 100644 (file)
@@ -179,6 +179,9 @@ struct vchiq_mmal_instance {
 
        /* ordered workqueue to process all bulk operations */
        struct workqueue_struct *bulk_wq;
+
+       /* handle for a vchiq instance */
+       struct vchiq_instance *vchiq_instance;
 };
 
 static struct mmal_msg_context *
@@ -1840,6 +1843,7 @@ int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance)
 
        mutex_unlock(&instance->vchiq_mutex);
 
+       vchiq_shutdown(instance->vchiq_instance);
        flush_workqueue(instance->bulk_wq);
        destroy_workqueue(instance->bulk_wq);
 
@@ -1856,6 +1860,7 @@ EXPORT_SYMBOL_GPL(vchiq_mmal_finalise);
 int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance)
 {
        int status;
+       int err = -ENODEV;
        struct vchiq_mmal_instance *instance;
        static struct vchiq_instance *vchiq_instance;
        struct vchiq_service_params_kernel params = {
@@ -1890,17 +1895,21 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance)
        status = vchiq_connect(vchiq_instance);
        if (status) {
                pr_err("Failed to connect VCHI instance (status=%d)\n", status);
-               return -EIO;
+               err = -EIO;
+               goto err_shutdown_vchiq;
        }
 
        instance = kzalloc(sizeof(*instance), GFP_KERNEL);
 
-       if (!instance)
-               return -ENOMEM;
+       if (!instance) {
+               err = -ENOMEM;
+               goto err_shutdown_vchiq;
+       }
 
        mutex_init(&instance->vchiq_mutex);
 
        instance->bulk_scratch = vmalloc(PAGE_SIZE);
+       instance->vchiq_instance = vchiq_instance;
 
        mutex_init(&instance->context_map_lock);
        idr_init_base(&instance->context_map, 1);
@@ -1932,7 +1941,9 @@ err_close_services:
 err_free:
        vfree(instance->bulk_scratch);
        kfree(instance);
-       return -ENODEV;
+err_shutdown_vchiq:
+       vchiq_shutdown(vchiq_instance);
+       return err;
 }
 EXPORT_SYMBOL_GPL(vchiq_mmal_init);
 
index 43b5630..510edd1 100644 (file)
@@ -24,7 +24,7 @@ description:
     In addition, it is recommended to declare a mmc-pwrseq on SDIO host above
     WFx. Without it, you may encounter issues with warm boot. The mmc-pwrseq
     should be compatible with mmc-pwrseq-simple. Please consult
-    Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt for more
+    Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml for more
     information.
 
   For SPI':'
index 2ffa587..ed53d0b 100644 (file)
@@ -21,7 +21,7 @@ static void device_wakeup(struct wfx_dev *wdev)
 
        if (!wdev->pdata.gpio_wakeup)
                return;
-       if (gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup) >= 0)
+       if (gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup) > 0)
                return;
 
        if (wfx_api_older_than(wdev, 1, 4)) {
index 41f6a60..36b36ef 100644 (file)
@@ -31,13 +31,13 @@ static int wfx_get_hw_rate(struct wfx_dev *wdev,
                }
                return rate->idx + 14;
        }
+       // WFx only support 2GHz, else band information should be retrieved
+       // from ieee80211_tx_info
+       band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];
        if (rate->idx >= band->n_bitrates) {
                WARN(1, "wrong rate->idx value: %d", rate->idx);
                return -1;
        }
-       // WFx only support 2GHz, else band information should be retrieved
-       // from ieee80211_tx_info
-       band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];
        return band->bitrates[rate->idx].hw_value;
 }
 
similarity index 94%
rename from net/wimax/Kconfig
rename to drivers/staging/wimax/Kconfig
index d13762b..ded8b70 100644 (file)
@@ -22,6 +22,8 @@ menuconfig WIMAX
 
          If unsure, it is safe to select M (module).
 
+if WIMAX
+
 config WIMAX_DEBUG_LEVEL
        int "WiMAX debug level"
        depends on WIMAX
@@ -38,3 +40,7 @@ config WIMAX_DEBUG_LEVEL
          If set at zero, this will compile out all the debug code.
 
          It is recommended that it is left at 8.
+
+source "drivers/staging/wimax/i2400m/Kconfig"
+
+endif
similarity index 83%
rename from net/wimax/Makefile
rename to drivers/staging/wimax/Makefile
index c2a71ae..0e3f988 100644 (file)
@@ -11,3 +11,5 @@ wimax-y :=            \
        stack.o
 
 wimax-$(CONFIG_DEBUG_FS) += debugfs.o
+
+obj-$(CONFIG_WIMAX_I2400M)     += i2400m/
diff --git a/drivers/staging/wimax/TODO b/drivers/staging/wimax/TODO
new file mode 100644 (file)
index 0000000..26e4cb9
--- /dev/null
@@ -0,0 +1,18 @@
+There are no known users of this driver as of October 2020, and it will
+be removed unless someone turns out to still need it in future releases.
+
+According to https://en.wikipedia.org/wiki/List_of_WiMAX_networks, there
+have been many public wimax networks, but it appears that many of these
+have migrated to LTE or discontinued their service altogether.  As most
+PCs and phones lack WiMAX hardware support, the remaining networks tend
+to use standalone routers. These almost certainly run Linux, but not a
+modern kernel or the mainline wimax driver stack.
+
+NetworkManager appears to have dropped userspace support in 2015
+https://bugzilla.gnome.org/show_bug.cgi?id=747846, the www.linuxwimax.org
+site had already shut down earlier.
+
+WiMax is apparently still being deployed on airport campus networks
+("AeroMACS"), but in a frequency band that was not supported by the old
+Intel 2400m (used in Sandy Bridge laptops and earlier), which is the
+only driver using the kernel's wimax stack.
similarity index 96%
rename from net/wimax/debug-levels.h
rename to drivers/staging/wimax/debug-levels.h
index ebc287c..b854802 100644 (file)
@@ -13,7 +13,7 @@
 #define D_MODULENAME wimax
 #define D_MASTER CONFIG_WIMAX_DEBUG_LEVEL
 
-#include <linux/wimax/debug.h>
+#include "linux-wimax-debug.h"
 
 /* List of all the enabled modules */
 enum d_module {
similarity index 97%
rename from net/wimax/debugfs.c
rename to drivers/staging/wimax/debugfs.c
index 3c54bb6..e11bff6 100644 (file)
@@ -7,7 +7,7 @@
  * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
  */
 #include <linux/debugfs.h>
-#include <linux/wimax.h>
+#include "linux-wimax.h"
 #include "wimax-internal.h"
 
 #define D_SUBMODULE debugfs
similarity index 99%
rename from drivers/net/wimax/i2400m/control.c
rename to drivers/staging/wimax/i2400m/control.c
index 8df9875..fe885aa 100644 (file)
@@ -77,7 +77,7 @@
 #include "i2400m.h"
 #include <linux/kernel.h>
 #include <linux/slab.h>
-#include <linux/wimax/i2400m.h>
+#include "linux-wimax-i2400m.h"
 #include <linux/export.h>
 #include <linux/moduleparam.h>
 
similarity index 96%
rename from drivers/net/wimax/i2400m/debug-levels.h
rename to drivers/staging/wimax/i2400m/debug-levels.h
index 00942bb..a317e9f 100644 (file)
@@ -13,7 +13,7 @@
 #define D_MODULENAME i2400m
 #define D_MASTER CONFIG_WIMAX_I2400M_DEBUG_LEVEL
 
-#include <linux/wimax/debug.h>
+#include "../linux-wimax-debug.h"
 
 /* List of all the enabled modules */
 enum d_module {
similarity index 99%
rename from drivers/net/wimax/i2400m/driver.c
rename to drivers/staging/wimax/i2400m/driver.c
index ecb3fcc..dc8939f 100644 (file)
@@ -50,7 +50,7 @@
  */
 #include "i2400m.h"
 #include <linux/etherdevice.h>
-#include <linux/wimax/i2400m.h>
+#include "linux-wimax-i2400m.h"
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/suspend.h>
similarity index 99%
rename from drivers/net/wimax/i2400m/i2400m.h
rename to drivers/staging/wimax/i2400m/i2400m.h
index a3733a6..de22cc6 100644 (file)
 #include <linux/completion.h>
 #include <linux/rwsem.h>
 #include <linux/atomic.h>
-#include <net/wimax.h>
-#include <linux/wimax/i2400m.h>
+#include "../net-wimax.h"
+#include "linux-wimax-i2400m.h"
 #include <asm/byteorder.h>
 
 enum {
similarity index 99%
rename from drivers/net/wimax/i2400m/op-rfkill.c
rename to drivers/staging/wimax/i2400m/op-rfkill.c
index 5c79f05..fbddf2e 100644 (file)
@@ -18,7 +18,7 @@
  *   switch (coming from sysfs, the wimax stack or user space).
  */
 #include "i2400m.h"
-#include <linux/wimax/i2400m.h>
+#include "linux-wimax-i2400m.h"
 #include <linux/slab.h>
 
 
@@ -13,7 +13,7 @@
 #define D_MODULENAME i2400m_usb
 #define D_MASTER CONFIG_WIMAX_I2400M_DEBUG_LEVEL
 
-#include <linux/wimax/debug.h>
+#include "../linux-wimax-debug.h"
 
 /* List of all the enabled modules */
 enum d_module {
similarity index 99%
rename from drivers/net/wimax/i2400m/usb.c
rename to drivers/staging/wimax/i2400m/usb.c
index b684e97..3b84dd7 100644 (file)
@@ -49,7 +49,7 @@
  *   usb_reset_device()
  */
 #include "i2400m-usb.h"
-#include <linux/wimax/i2400m.h>
+#include "linux-wimax-i2400m.h"
 #include <linux/debugfs.h>
 #include <linux/slab.h>
 #include <linux/module.h>
similarity index 99%
rename from net/wimax/id-table.c
rename to drivers/staging/wimax/id-table.c
index 02eee37..0e6f4aa 100644 (file)
@@ -28,7 +28,7 @@
 #include <net/genetlink.h>
 #include <linux/netdevice.h>
 #include <linux/list.h>
-#include <linux/wimax.h>
+#include "linux-wimax.h"
 #include "wimax-internal.h"
 
 
similarity index 99%
rename from include/linux/wimax/debug.h
rename to drivers/staging/wimax/linux-wimax-debug.h
index cdae052..5b5ec40 100644 (file)
@@ -60,7 +60,7 @@
  *     #define D_MODULENAME modulename
  *     #define D_MASTER 10
  *
- *     #include <linux/wimax/debug.h>
+ *     #include "linux-wimax-debug.h"
  *
  *     enum d_module {
  *             D_SUBMODULE_DECLARE(submodule_1),
similarity index 99%
rename from include/net/wimax.h
rename to drivers/staging/wimax/net-wimax.h
index f6e31d2..f578e34 100644 (file)
 #ifndef __NET__WIMAX_H__
 #define __NET__WIMAX_H__
 
-#include <linux/wimax.h>
+#include "linux-wimax.h"
 #include <net/genetlink.h>
 #include <linux/netdevice.h>
 
similarity index 99%
rename from net/wimax/op-msg.c
rename to drivers/staging/wimax/op-msg.c
index 6460b57..e20ac7d 100644 (file)
@@ -60,7 +60,7 @@
 #include <linux/slab.h>
 #include <net/genetlink.h>
 #include <linux/netdevice.h>
-#include <linux/wimax.h>
+#include "linux-wimax.h"
 #include <linux/security.h>
 #include <linux/export.h>
 #include "wimax-internal.h"
similarity index 98%
rename from net/wimax/op-reset.c
rename to drivers/staging/wimax/op-reset.c
index 9899b2e..b3f000c 100644 (file)
@@ -13,9 +13,9 @@
  * disconnect and reconnect the device).
  */
 
-#include <net/wimax.h>
+#include "net-wimax.h"
 #include <net/genetlink.h>
-#include <linux/wimax.h>
+#include "linux-wimax.h"
 #include <linux/security.h>
 #include <linux/export.h>
 #include "wimax-internal.h"
similarity index 99%
rename from net/wimax/op-rfkill.c
rename to drivers/staging/wimax/op-rfkill.c
index 248d10b..78b2944 100644 (file)
@@ -45,9 +45,9 @@
  * wimax_rfkill_rm()            [called by wimax_dev_add/rm()]
  */
 
-#include <net/wimax.h>
+#include "net-wimax.h"
 #include <net/genetlink.h>
-#include <linux/wimax.h>
+#include "linux-wimax.h"
 #include <linux/security.h>
 #include <linux/rfkill.h>
 #include <linux/export.h>
similarity index 96%
rename from net/wimax/op-state-get.c
rename to drivers/staging/wimax/op-state-get.c
index 5bc712d..c5bfbed 100644 (file)
@@ -10,9 +10,9 @@
  *  Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
  */
 
-#include <net/wimax.h>
+#include "net-wimax.h"
 #include <net/genetlink.h>
-#include <linux/wimax.h>
+#include "linux-wimax.h"
 #include <linux/security.h>
 #include "wimax-internal.h"
 
similarity index 97%
rename from net/wimax/stack.c
rename to drivers/staging/wimax/stack.c
index b6dd9d9..ace24a6 100644 (file)
@@ -39,7 +39,7 @@
 #include <linux/gfp.h>
 #include <net/genetlink.h>
 #include <linux/netdevice.h>
-#include <linux/wimax.h>
+#include "linux-wimax.h"
 #include <linux/module.h>
 #include "wimax-internal.h"
 
@@ -388,17 +388,24 @@ void wimax_dev_init(struct wimax_dev *wimax_dev)
 }
 EXPORT_SYMBOL_GPL(wimax_dev_init);
 
+/*
+ * There are multiple enums reusing the same values, adding
+ * others is only possible if they use a compatible policy.
+ */
 static const struct nla_policy wimax_gnl_policy[WIMAX_GNL_ATTR_MAX + 1] = {
-       [WIMAX_GNL_RESET_IFIDX] = { .type = NLA_U32, },
-       [WIMAX_GNL_RFKILL_IFIDX] = { .type = NLA_U32, },
-       [WIMAX_GNL_RFKILL_STATE] = {
-               .type = NLA_U32         /* enum wimax_rf_state */
-       },
-       [WIMAX_GNL_STGET_IFIDX] = { .type = NLA_U32, },
-       [WIMAX_GNL_MSG_IFIDX] = { .type = NLA_U32, },
-       [WIMAX_GNL_MSG_DATA] = {
-               .type = NLA_UNSPEC,     /* libnl doesn't grok BINARY yet */
-       },
+       /*
+        * WIMAX_GNL_RESET_IFIDX, WIMAX_GNL_RFKILL_IFIDX,
+        * WIMAX_GNL_STGET_IFIDX, WIMAX_GNL_MSG_IFIDX
+        */
+       [1] = { .type = NLA_U32, },
+       /*
+        * WIMAX_GNL_RFKILL_STATE, WIMAX_GNL_MSG_PIPE_NAME
+        */
+       [2] = { .type = NLA_U32, }, /* enum wimax_rf_state */
+       /*
+        * WIMAX_GNL_MSG_DATA
+        */
+       [3] = { .type = NLA_UNSPEC, }, /* libnl doesn't grok BINARY yet */
 };
 
 static const struct genl_small_ops wimax_gnl_ops[] = {
similarity index 99%
rename from net/wimax/wimax-internal.h
rename to drivers/staging/wimax/wimax-internal.h
index 4075120..a6b6990 100644 (file)
@@ -22,7 +22,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/device.h>
-#include <net/wimax.h>
+#include "net-wimax.h"
 
 
 /*
index 408bd97..bf936bb 100644 (file)
@@ -131,7 +131,7 @@ static int rd_allocate_sgl_table(struct rd_dev *rd_dev, struct rd_dev_sg_table *
                if (sg_per_table < total_sg_needed)
                        chain_entry = 1;
 
-               sg = kcalloc(sg_per_table + chain_entry, sizeof(*sg),
+               sg = kmalloc_array(sg_per_table + chain_entry, sizeof(*sg),
                                GFP_KERNEL);
                if (!sg)
                        return -ENOMEM;
index ea84d08..590e6d0 100644 (file)
@@ -194,7 +194,7 @@ struct tcmu_tmr {
 
        uint8_t tmr_type;
        uint32_t tmr_cmd_cnt;
-       int16_t tmr_cmd_ids[0];
+       int16_t tmr_cmd_ids[];
 };
 
 /*
index b373b1b..cf4718c 100644 (file)
@@ -216,6 +216,8 @@ static void optee_get_version(struct tee_device *teedev,
 
        if (optee->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
                v.gen_caps |= TEE_GEN_CAP_REG_MEM;
+       if (optee->sec_caps & OPTEE_SMC_SEC_CAP_MEMREF_NULL)
+               v.gen_caps |= TEE_GEN_CAP_MEMREF_NULL;
        *vers = v;
 }
 
@@ -262,6 +264,11 @@ static int optee_open(struct tee_context *ctx)
        mutex_init(&ctxdata->mutex);
        INIT_LIST_HEAD(&ctxdata->sess_list);
 
+       if (optee->sec_caps & OPTEE_SMC_SEC_CAP_MEMREF_NULL)
+               ctx->cap_memref_null  = true;
+       else
+               ctx->cap_memref_null = false;
+
        ctx->data = ctxdata;
        return 0;
 }
index 795bc19..7b2d919 100644 (file)
@@ -419,4 +419,25 @@ struct optee_msg_arg {
  */
 #define OPTEE_MSG_RPC_CMD_SHM_FREE     7
 
+/*
+ * Access a device on an i2c bus
+ *
+ * [in]  param[0].u.value.a            mode: RD(0), WR(1)
+ * [in]  param[0].u.value.b            i2c adapter
+ * [in]  param[0].u.value.c            i2c chip
+ *
+ * [in]  param[1].u.value.a            i2c control flags
+ *
+ * [in/out] memref[2]                  buffer to exchange the transfer data
+ *                                     with the secure world
+ *
+ * [out]  param[3].u.value.a           bytes transferred by the driver
+ */
+#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER 21
+/* I2C master transfer modes */
+#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD 0
+#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR 1
+/* I2C master control flags */
+#define OPTEE_MSG_RPC_CMD_I2C_FLAGS_TEN_BIT  BIT(0)
+
 #endif /* _OPTEE_MSG_H */
index 8b71839..e25b216 100644 (file)
@@ -17,6 +17,7 @@
 /* Some Global Platform error codes used in this driver */
 #define TEEC_SUCCESS                   0x00000000
 #define TEEC_ERROR_BAD_PARAMETERS      0xFFFF0006
+#define TEEC_ERROR_NOT_SUPPORTED       0xFFFF000A
 #define TEEC_ERROR_COMMUNICATION       0xFFFF000E
 #define TEEC_ERROR_OUT_OF_MEMORY       0xFFFF000C
 #define TEEC_ERROR_SHORT_BUFFER                0xFFFF0010
index c72122d..777ad54 100644 (file)
@@ -215,6 +215,9 @@ struct optee_smc_get_shm_config_result {
  */
 #define OPTEE_SMC_SEC_CAP_DYNAMIC_SHM          BIT(2)
 
+/* Secure world supports Shared Memory with a NULL buffer reference */
+#define OPTEE_SMC_SEC_CAP_MEMREF_NULL          BIT(4)
+
 #define OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES 9
 #define OPTEE_SMC_EXCHANGE_CAPABILITIES \
        OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES)
index b4ade54..1e3614e 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/delay.h>
 #include <linux/device.h>
+#include <linux/i2c.h>
 #include <linux/slab.h>
 #include <linux/tee_drv.h>
 #include "optee_private.h"
@@ -49,6 +50,97 @@ bad:
        arg->ret = TEEC_ERROR_BAD_PARAMETERS;
 }
 
+#if IS_REACHABLE(CONFIG_I2C)
+static void handle_rpc_func_cmd_i2c_transfer(struct tee_context *ctx,
+                                            struct optee_msg_arg *arg)
+{
+       struct i2c_client client = { 0 };
+       struct tee_param *params;
+       size_t i;
+       int ret = -EOPNOTSUPP;
+       u8 attr[] = {
+               TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT,
+               TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT,
+               TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT,
+               TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT,
+       };
+
+       if (arg->num_params != ARRAY_SIZE(attr)) {
+               arg->ret = TEEC_ERROR_BAD_PARAMETERS;
+               return;
+       }
+
+       params = kmalloc_array(arg->num_params, sizeof(struct tee_param),
+                              GFP_KERNEL);
+       if (!params) {
+               arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
+               return;
+       }
+
+       if (optee_from_msg_param(params, arg->num_params, arg->params))
+               goto bad;
+
+       for (i = 0; i < arg->num_params; i++) {
+               if (params[i].attr != attr[i])
+                       goto bad;
+       }
+
+       client.adapter = i2c_get_adapter(params[0].u.value.b);
+       if (!client.adapter)
+               goto bad;
+
+       if (params[1].u.value.a & OPTEE_MSG_RPC_CMD_I2C_FLAGS_TEN_BIT) {
+               if (!i2c_check_functionality(client.adapter,
+                                            I2C_FUNC_10BIT_ADDR)) {
+                       i2c_put_adapter(client.adapter);
+                       goto bad;
+               }
+
+               client.flags = I2C_CLIENT_TEN;
+       }
+
+       client.addr = params[0].u.value.c;
+       snprintf(client.name, I2C_NAME_SIZE, "i2c%d", client.adapter->nr);
+
+       switch (params[0].u.value.a) {
+       case OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD:
+               ret = i2c_master_recv(&client, params[2].u.memref.shm->kaddr,
+                                     params[2].u.memref.size);
+               break;
+       case OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR:
+               ret = i2c_master_send(&client, params[2].u.memref.shm->kaddr,
+                                     params[2].u.memref.size);
+               break;
+       default:
+               i2c_put_adapter(client.adapter);
+               goto bad;
+       }
+
+       if (ret < 0) {
+               arg->ret = TEEC_ERROR_COMMUNICATION;
+       } else {
+               params[3].u.value.a = ret;
+               if (optee_to_msg_param(arg->params, arg->num_params, params))
+                       arg->ret = TEEC_ERROR_BAD_PARAMETERS;
+               else
+                       arg->ret = TEEC_SUCCESS;
+       }
+
+       i2c_put_adapter(client.adapter);
+       kfree(params);
+       return;
+bad:
+       kfree(params);
+       arg->ret = TEEC_ERROR_BAD_PARAMETERS;
+}
+#else
+static void handle_rpc_func_cmd_i2c_transfer(struct tee_context *ctx,
+                                            struct optee_msg_arg *arg)
+{
+       arg->ret = TEEC_ERROR_NOT_SUPPORTED;
+}
+#endif
+
 static struct wq_entry *wq_entry_get(struct optee_wait_queue *wq, u32 key)
 {
        struct wq_entry *w;
@@ -382,6 +474,9 @@ static void handle_rpc_func_cmd(struct tee_context *ctx, struct optee *optee,
        case OPTEE_MSG_RPC_CMD_SHM_FREE:
                handle_rpc_func_cmd_shm_free(ctx, arg);
                break;
+       case OPTEE_MSG_RPC_CMD_I2C_TRANSFER:
+               handle_rpc_func_cmd_i2c_transfer(ctx, arg);
+               break;
        default:
                handle_rpc_supp_cmd(ctx, arg);
        }
index 64637e0..6ade4a5 100644 (file)
@@ -200,7 +200,8 @@ int tee_session_calc_client_uuid(uuid_t *uuid, u32 connection_method,
        int name_len;
        int rc;
 
-       if (connection_method == TEE_IOCTL_LOGIN_PUBLIC) {
+       if (connection_method == TEE_IOCTL_LOGIN_PUBLIC ||
+           connection_method == TEE_IOCTL_LOGIN_REE_KERNEL) {
                /* Nil UUID to be passed to TEE environment */
                uuid_copy(uuid, &uuid_null);
                return 0;
@@ -383,25 +384,38 @@ static int params_from_user(struct tee_context *ctx, struct tee_param *params,
                case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT:
                case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT:
                        /*
-                        * If we fail to get a pointer to a shared memory
-                        * object (and increase the ref count) from an
-                        * identifier we return an error. All pointers that
-                        * has been added in params have an increased ref
-                        * count. It's the callers responibility to do
-                        * tee_shm_put() on all resolved pointers.
+                        * If a NULL pointer is passed to a TA in the TEE,
+                        * the ip.c IOCTL parameters is set to TEE_MEMREF_NULL
+                        * indicating a NULL memory reference.
                         */
-                       shm = tee_shm_get_from_id(ctx, ip.c);
-                       if (IS_ERR(shm))
-                               return PTR_ERR(shm);
-
-                       /*
-                        * Ensure offset + size does not overflow offset
-                        * and does not overflow the size of the referred
-                        * shared memory object.
-                        */
-                       if ((ip.a + ip.b) < ip.a ||
-                           (ip.a + ip.b) > shm->size) {
-                               tee_shm_put(shm);
+                       if (ip.c != TEE_MEMREF_NULL) {
+                               /*
+                                * If we fail to get a pointer to a shared
+                                * memory object (and increase the ref count)
+                                * from an identifier we return an error. All
+                                * pointers that has been added in params have
+                                * an increased ref count. It's the callers
+                                * responibility to do tee_shm_put() on all
+                                * resolved pointers.
+                                */
+                               shm = tee_shm_get_from_id(ctx, ip.c);
+                               if (IS_ERR(shm))
+                                       return PTR_ERR(shm);
+
+                               /*
+                                * Ensure offset + size does not overflow
+                                * offset and does not overflow the size of
+                                * the referred shared memory object.
+                                */
+                               if ((ip.a + ip.b) < ip.a ||
+                                   (ip.a + ip.b) > shm->size) {
+                                       tee_shm_put(shm);
+                                       return -EINVAL;
+                               }
+                       } else if (ctx->cap_memref_null) {
+                               /* Pass NULL pointer to OP-TEE */
+                               shm = NULL;
+                       } else {
                                return -EINVAL;
                        }
 
@@ -917,7 +931,6 @@ struct tee_device *tee_device_alloc(const struct tee_desc *teedesc,
 
        cdev_init(&teedev->cdev, &tee_fops);
        teedev->cdev.owner = teedesc->owner;
-       teedev->cdev.kobj.parent = &teedev->dev.kobj;
 
        dev_set_drvdata(&teedev->dev, driver_data);
        device_initialize(&teedev->dev);
@@ -963,9 +976,7 @@ static struct attribute *tee_dev_attrs[] = {
        NULL
 };
 
-static const struct attribute_group tee_dev_group = {
-       .attrs = tee_dev_attrs,
-};
+ATTRIBUTE_GROUPS(tee_dev);
 
 /**
  * tee_device_register() - Registers a TEE device
@@ -985,39 +996,19 @@ int tee_device_register(struct tee_device *teedev)
                return -EINVAL;
        }
 
-       rc = cdev_add(&teedev->cdev, teedev->dev.devt, 1);
-       if (rc) {
-               dev_err(&teedev->dev,
-                       "unable to cdev_add() %s, major %d, minor %d, err=%d\n",
-                       teedev->name, MAJOR(teedev->dev.devt),
-                       MINOR(teedev->dev.devt), rc);
-               return rc;
-       }
+       teedev->dev.groups = tee_dev_groups;
 
-       rc = device_add(&teedev->dev);
+       rc = cdev_device_add(&teedev->cdev, &teedev->dev);
        if (rc) {
                dev_err(&teedev->dev,
-                       "unable to device_add() %s, major %d, minor %d, err=%d\n",
+                       "unable to cdev_device_add() %s, major %d, minor %d, err=%d\n",
                        teedev->name, MAJOR(teedev->dev.devt),
                        MINOR(teedev->dev.devt), rc);
-               goto err_device_add;
-       }
-
-       rc = sysfs_create_group(&teedev->dev.kobj, &tee_dev_group);
-       if (rc) {
-               dev_err(&teedev->dev,
-                       "failed to create sysfs attributes, err=%d\n", rc);
-               goto err_sysfs_create_group;
+               return rc;
        }
 
        teedev->flags |= TEE_DEVICE_FLAG_REGISTERED;
        return 0;
-
-err_sysfs_create_group:
-       device_del(&teedev->dev);
-err_device_add:
-       cdev_del(&teedev->cdev);
-       return rc;
 }
 EXPORT_SYMBOL_GPL(tee_device_register);
 
@@ -1060,11 +1051,8 @@ void tee_device_unregister(struct tee_device *teedev)
        if (!teedev)
                return;
 
-       if (teedev->flags & TEE_DEVICE_FLAG_REGISTERED) {
-               sysfs_remove_group(&teedev->dev.kobj, &tee_dev_group);
-               cdev_del(&teedev->cdev);
-               device_del(&teedev->dev);
-       }
+       if (teedev->flags & TEE_DEVICE_FLAG_REGISTERED)
+               cdev_device_del(&teedev->cdev, &teedev->dev);
 
        tee_device_put(teedev);
        wait_for_completion(&teedev->c_no_users);
index 827ac3d..00472f5 100644 (file)
 #include <linux/uio.h>
 #include "tee_private.h"
 
+static void release_registered_pages(struct tee_shm *shm)
+{
+       if (shm->pages) {
+               if (shm->flags & TEE_SHM_USER_MAPPED) {
+                       unpin_user_pages(shm->pages, shm->num_pages);
+               } else {
+                       size_t n;
+
+                       for (n = 0; n < shm->num_pages; n++)
+                               put_page(shm->pages[n]);
+               }
+
+               kfree(shm->pages);
+       }
+}
+
 static void tee_shm_release(struct tee_shm *shm)
 {
        struct tee_device *teedev = shm->ctx->teedev;
@@ -32,17 +48,13 @@ static void tee_shm_release(struct tee_shm *shm)
 
                poolm->ops->free(poolm, shm);
        } else if (shm->flags & TEE_SHM_REGISTER) {
-               size_t n;
                int rc = teedev->desc->ops->shm_unregister(shm->ctx, shm);
 
                if (rc)
                        dev_err(teedev->dev.parent,
                                "unregister shm %p failed: %d", shm, rc);
 
-               for (n = 0; n < shm->num_pages; n++)
-                       put_page(shm->pages[n]);
-
-               kfree(shm->pages);
+               release_registered_pages(shm);
        }
 
        teedev_ctx_put(shm->ctx);
@@ -228,7 +240,7 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
        }
 
        if (flags & TEE_SHM_USER_MAPPED) {
-               rc = get_user_pages_fast(start, num_pages, FOLL_WRITE,
+               rc = pin_user_pages_fast(start, num_pages, FOLL_WRITE,
                                         shm->pages);
        } else {
                struct kvec *kiov;
@@ -292,18 +304,12 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
        return shm;
 err:
        if (shm) {
-               size_t n;
-
                if (shm->id >= 0) {
                        mutex_lock(&teedev->mutex);
                        idr_remove(&teedev->idr, shm->id);
                        mutex_unlock(&teedev->mutex);
                }
-               if (shm->pages) {
-                       for (n = 0; n < shm->num_pages; n++)
-                               put_page(shm->pages[n]);
-                       kfree(shm->pages);
-               }
+               release_registered_pages(shm);
        }
        kfree(shm);
        teedev_ctx_put(ctx);
index 764c2de..681209d 100644 (file)
@@ -34,7 +34,7 @@ extern struct thermal_governor *__governor_thermal_table_end[];
 
 #define THERMAL_TABLE_ENTRY(table, name)                       \
        static typeof(name) *__thermal_table_entry_##name       \
-       __used __section(__##table##_thermal_table) = &name
+       __used __section("__" #table "_thermal_table") = &name
 
 #define THERMAL_GOVERNOR_DECLARE(name) THERMAL_TABLE_ENTRY(governor, name)
 
index 718e010..09baef4 100644 (file)
@@ -50,25 +50,25 @@ static const char serial21285_name[] = "Footbridge UART";
 
 static bool is_enabled(struct uart_port *port, int bit)
 {
-       unsigned long private_data = (unsigned long)port->private_data;
+       unsigned long *private_data = (unsigned long *)&port->private_data;
 
-       if (test_bit(bit, &private_data))
+       if (test_bit(bit, private_data))
                return true;
        return false;
 }
 
 static void enable(struct uart_port *port, int bit)
 {
-       unsigned long private_data = (unsigned long)port->private_data;
+       unsigned long *private_data = (unsigned long *)&port->private_data;
 
-       set_bit(bit, &private_data);
+       set_bit(bit, private_data);
 }
 
 static void disable(struct uart_port *port, int bit)
 {
-       unsigned long private_data = (unsigned long)port->private_data;
+       unsigned long *private_data = (unsigned long *)&port->private_data;
 
-       clear_bit(bit, &private_data);
+       clear_bit(bit, private_data);
 }
 
 #define is_tx_enabled(port)    is_enabled(port, tx_enabled_bit)
index 41f4120..fa876e2 100644 (file)
@@ -317,7 +317,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
         */
        baud = tty_termios_baud_rate(termios);
 
-       serial8250_do_set_termios(port, termios, old);
+       serial8250_do_set_termios(port, termios, NULL);
 
        tty_termios_encode_baud_rate(termios, baud, baud);
 
index 20b98a3..28f22e5 100644 (file)
@@ -236,7 +236,7 @@ config SERIAL_CLPS711X_CONSOLE
 
 config SERIAL_SAMSUNG
        tristate "Samsung SoC serial support"
-       depends on PLAT_SAMSUNG || ARCH_EXYNOS || COMPILE_TEST
+       depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
        select SERIAL_CORE
        help
          Support for the on-chip UARTs on the Samsung S3C24XX series CPUs,
@@ -522,6 +522,7 @@ config SERIAL_IMX_EARLYCON
        depends on OF
        select SERIAL_EARLYCON
        select SERIAL_CORE_CONSOLE
+       default y if SERIAL_IMX_CONSOLE
        help
          If you have enabled the earlycon on the Freescale IMX
          CPU you can make it the earlycon by answering Y to this option.
index ff4b88c..bd047e1 100644 (file)
@@ -314,9 +314,10 @@ MODULE_DEVICE_TABLE(of, lpuart_dt_ids);
 /* Forward declare this for the dma callbacks*/
 static void lpuart_dma_tx_complete(void *arg);
 
-static inline bool is_ls1028a_lpuart(struct lpuart_port *sport)
+static inline bool is_layerscape_lpuart(struct lpuart_port *sport)
 {
-       return sport->devtype == LS1028A_LPUART;
+       return (sport->devtype == LS1021A_LPUART ||
+               sport->devtype == LS1028A_LPUART);
 }
 
 static inline bool is_imx8qxp_lpuart(struct lpuart_port *sport)
@@ -1701,11 +1702,11 @@ static int lpuart32_startup(struct uart_port *port)
                                            UARTFIFO_FIFOSIZE_MASK);
 
        /*
-        * The LS1028A has a fixed length of 16 words. Although it supports the
-        * RX/TXSIZE fields their encoding is different. Eg the reference manual
-        * states 0b101 is 16 words.
+        * The LS1021A and LS1028A have a fixed FIFO depth of 16 words.
+        * Although they support the RX/TXSIZE fields, their encoding is
+        * different. Eg the reference manual states 0b101 is 16 words.
         */
-       if (is_ls1028a_lpuart(sport)) {
+       if (is_layerscape_lpuart(sport)) {
                sport->rxfifo_size = 16;
                sport->txfifo_size = 16;
                sport->port.fifosize = sport->txfifo_size;
index b4d89e3..7a07e72 100644 (file)
@@ -1280,6 +1280,9 @@ static int __init serial_txx9_init(void)
 
 #ifdef ENABLE_SERIAL_TXX9_PCI
        ret = pci_register_driver(&serial_txx9_pci_driver);
+       if (ret) {
+               platform_driver_unregister(&serial_txx9_plat_driver);
+       }
 #endif
        if (ret == 0)
                goto out;
index 7a4c025..9f8b9a5 100644 (file)
@@ -1515,10 +1515,12 @@ static void release_tty(struct tty_struct *tty, int idx)
                tty->ops->shutdown(tty);
        tty_save_termios(tty);
        tty_driver_remove_tty(tty->driver, tty);
-       tty->port->itty = NULL;
+       if (tty->port)
+               tty->port->itty = NULL;
        if (tty->link)
                tty->link->port->itty = NULL;
-       tty_buffer_cancel_work(tty->port);
+       if (tty->port)
+               tty_buffer_cancel_work(tty->port);
        if (tty->link)
                tty_buffer_cancel_work(tty->link->port);
 
index 0db53b5..78acc27 100644 (file)
@@ -743,8 +743,13 @@ static void k_fn(struct vc_data *vc, unsigned char value, char up_flag)
                return;
 
        if ((unsigned)value < ARRAY_SIZE(func_table)) {
+               unsigned long flags;
+
+               spin_lock_irqsave(&func_buf_lock, flags);
                if (func_table[value])
                        puts_queue(vc, func_table[value]);
+               spin_unlock_irqrestore(&func_buf_lock, flags);
+
        } else
                pr_err("k_fn called with value=%d\n", value);
 }
@@ -1991,13 +1996,11 @@ out:
 #undef s
 #undef v
 
-/* FIXME: This one needs untangling and locking */
+/* FIXME: This one needs untangling */
 int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
 {
        struct kbsentry *kbs;
-       char *p;
        u_char *q;
-       u_char __user *up;
        int sz, fnw_sz;
        int delta;
        char *first_free, *fj, *fnw;
@@ -2023,23 +2026,19 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
        i = array_index_nospec(kbs->kb_func, MAX_NR_FUNC);
 
        switch (cmd) {
-       case KDGKBSENT:
-               sz = sizeof(kbs->kb_string) - 1; /* sz should have been
-                                                 a struct member */
-               up = user_kdgkb->kb_string;
-               p = func_table[i];
-               if(p)
-                       for ( ; *p && sz; p++, sz--)
-                               if (put_user(*p, up++)) {
-                                       ret = -EFAULT;
-                                       goto reterr;
-                               }
-               if (put_user('\0', up)) {
-                       ret = -EFAULT;
-                       goto reterr;
-               }
-               kfree(kbs);
-               return ((p && *p) ? -EOVERFLOW : 0);
+       case KDGKBSENT: {
+               /* size should have been a struct member */
+               ssize_t len = sizeof(user_kdgkb->kb_string);
+
+               spin_lock_irqsave(&func_buf_lock, flags);
+               len = strlcpy(kbs->kb_string, func_table[i] ? : "", len);
+               spin_unlock_irqrestore(&func_buf_lock, flags);
+
+               ret = copy_to_user(user_kdgkb->kb_string, kbs->kb_string,
+                               len + 1) ? -EFAULT : 0;
+
+               goto reterr;
+       }
        case KDSKBSENT:
                if (!perm) {
                        ret = -EPERM;
index 9506a76..d04a162 100644 (file)
@@ -4704,27 +4704,6 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op)
        return rc;
 }
 
-static int con_font_copy(struct vc_data *vc, struct console_font_op *op)
-{
-       int con = op->height;
-       int rc;
-
-
-       console_lock();
-       if (vc->vc_mode != KD_TEXT)
-               rc = -EINVAL;
-       else if (!vc->vc_sw->con_font_copy)
-               rc = -ENOSYS;
-       else if (con < 0 || !vc_cons_allocated(con))
-               rc = -ENOTTY;
-       else if (con == vc->vc_num)     /* nothing to do */
-               rc = 0;
-       else
-               rc = vc->vc_sw->con_font_copy(vc, con);
-       console_unlock();
-       return rc;
-}
-
 int con_font_op(struct vc_data *vc, struct console_font_op *op)
 {
        switch (op->op) {
@@ -4735,7 +4714,8 @@ int con_font_op(struct vc_data *vc, struct console_font_op *op)
        case KD_FONT_OP_SET_DEFAULT:
                return con_font_default(vc, op);
        case KD_FONT_OP_COPY:
-               return con_font_copy(vc, op);
+               /* was buggy and never really used */
+               return -EINVAL;
        }
        return -ENOSYS;
 }
index 0a33b8a..5f61b25 100644 (file)
@@ -484,7 +484,7 @@ static int vt_k_ioctl(struct tty_struct *tty, unsigned int cmd,
        return 0;
 }
 
-static inline int do_fontx_ioctl(int cmd,
+static inline int do_fontx_ioctl(struct vc_data *vc, int cmd,
                struct consolefontdesc __user *user_cfd,
                struct console_font_op *op)
 {
@@ -502,15 +502,16 @@ static inline int do_fontx_ioctl(int cmd,
                op->height = cfdarg.charheight;
                op->charcount = cfdarg.charcount;
                op->data = cfdarg.chardata;
-               return con_font_op(vc_cons[fg_console].d, op);
-       case GIO_FONTX: {
+               return con_font_op(vc, op);
+
+       case GIO_FONTX:
                op->op = KD_FONT_OP_GET;
                op->flags = KD_FONT_FLAG_OLD;
                op->width = 8;
                op->height = cfdarg.charheight;
                op->charcount = cfdarg.charcount;
                op->data = cfdarg.chardata;
-               i = con_font_op(vc_cons[fg_console].d, op);
+               i = con_font_op(vc, op);
                if (i)
                        return i;
                cfdarg.charheight = op->height;
@@ -518,12 +519,11 @@ static inline int do_fontx_ioctl(int cmd,
                if (copy_to_user(user_cfd, &cfdarg, sizeof(struct consolefontdesc)))
                        return -EFAULT;
                return 0;
-               }
        }
        return -EINVAL;
 }
 
-static int vt_io_fontreset(struct console_font_op *op)
+static int vt_io_fontreset(struct vc_data *vc, struct console_font_op *op)
 {
        int ret;
 
@@ -537,19 +537,19 @@ static int vt_io_fontreset(struct console_font_op *op)
 
        op->op = KD_FONT_OP_SET_DEFAULT;
        op->data = NULL;
-       ret = con_font_op(vc_cons[fg_console].d, op);
+       ret = con_font_op(vc, op);
        if (ret)
                return ret;
 
        console_lock();
-       con_set_default_unimap(vc_cons[fg_console].d);
+       con_set_default_unimap(vc);
        console_unlock();
 
        return 0;
 }
 
 static inline int do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud,
-               struct vc_data *vc)
+               bool perm, struct vc_data *vc)
 {
        struct unimapdesc tmp;
 
@@ -557,9 +557,11 @@ static inline int do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud,
                return -EFAULT;
        switch (cmd) {
        case PIO_UNIMAP:
+               if (!perm)
+                       return -EPERM;
                return con_set_unimap(vc, tmp.entry_ct, tmp.entries);
        case GIO_UNIMAP:
-               if (fg_console != vc->vc_num)
+               if (!perm && fg_console != vc->vc_num)
                        return -EPERM;
                return con_get_unimap(vc, tmp.entry_ct, &(user_ud->entry_ct),
                                tmp.entries);
@@ -582,7 +584,7 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up,
                op.height = 0;
                op.charcount = 256;
                op.data = up;
-               return con_font_op(vc_cons[fg_console].d, &op);
+               return con_font_op(vc, &op);
 
        case GIO_FONT:
                op.op = KD_FONT_OP_GET;
@@ -591,7 +593,7 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up,
                op.height = 32;
                op.charcount = 256;
                op.data = up;
-               return con_font_op(vc_cons[fg_console].d, &op);
+               return con_font_op(vc, &op);
 
        case PIO_CMAP:
                 if (!perm)
@@ -607,13 +609,13 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up,
 
                fallthrough;
        case GIO_FONTX:
-               return do_fontx_ioctl(cmd, up, &op);
+               return do_fontx_ioctl(vc, cmd, up, &op);
 
        case PIO_FONTRESET:
                if (!perm)
                        return -EPERM;
 
-               return vt_io_fontreset(&op);
+               return vt_io_fontreset(vc, &op);
 
        case PIO_SCRNMAP:
                if (!perm)
@@ -639,10 +641,7 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up,
 
        case PIO_UNIMAP:
        case GIO_UNIMAP:
-               if (!perm)
-                       return -EPERM;
-
-               return do_unimap_ioctl(cmd, up, vc);
+               return do_unimap_ioctl(cmd, up, perm, vc);
 
        default:
                return -ENOIOCTLCMD;
@@ -1067,8 +1066,9 @@ struct compat_consolefontdesc {
 };
 
 static inline int
-compat_fontx_ioctl(int cmd, struct compat_consolefontdesc __user *user_cfd,
-                        int perm, struct console_font_op *op)
+compat_fontx_ioctl(struct vc_data *vc, int cmd,
+                  struct compat_consolefontdesc __user *user_cfd,
+                  int perm, struct console_font_op *op)
 {
        struct compat_consolefontdesc cfdarg;
        int i;
@@ -1086,7 +1086,8 @@ compat_fontx_ioctl(int cmd, struct compat_consolefontdesc __user *user_cfd,
                op->height = cfdarg.charheight;
                op->charcount = cfdarg.charcount;
                op->data = compat_ptr(cfdarg.chardata);
-               return con_font_op(vc_cons[fg_console].d, op);
+               return con_font_op(vc, op);
+
        case GIO_FONTX:
                op->op = KD_FONT_OP_GET;
                op->flags = KD_FONT_FLAG_OLD;
@@ -1094,7 +1095,7 @@ compat_fontx_ioctl(int cmd, struct compat_consolefontdesc __user *user_cfd,
                op->height = cfdarg.charheight;
                op->charcount = cfdarg.charcount;
                op->data = compat_ptr(cfdarg.chardata);
-               i = con_font_op(vc_cons[fg_console].d, op);
+               i = con_font_op(vc, op);
                if (i)
                        return i;
                cfdarg.charheight = op->height;
@@ -1184,7 +1185,7 @@ long vt_compat_ioctl(struct tty_struct *tty,
         */
        case PIO_FONTX:
        case GIO_FONTX:
-               return compat_fontx_ioctl(cmd, up, perm, &op);
+               return compat_fontx_ioctl(vc, cmd, up, perm, &op);
 
        case KDFONTOP:
                return compat_kdfontop_ioctl(up, perm, &op, vc);
index 4761c85..d3121a3 100644 (file)
@@ -137,48 +137,36 @@ static int cdns3_req_ep0_set_configuration(struct cdns3_device *priv_dev,
                                           struct usb_ctrlrequest *ctrl_req)
 {
        enum usb_device_state device_state = priv_dev->gadget.state;
-       struct cdns3_endpoint *priv_ep;
        u32 config = le16_to_cpu(ctrl_req->wValue);
        int result = 0;
-       int i;
 
        switch (device_state) {
        case USB_STATE_ADDRESS:
-               /* Configure non-control EPs */
-               for (i = 0; i < CDNS3_ENDPOINTS_MAX_COUNT; i++) {
-                       priv_ep = priv_dev->eps[i];
-                       if (!priv_ep)
-                               continue;
-
-                       if (priv_ep->flags & EP_CLAIMED)
-                               cdns3_ep_config(priv_ep);
-               }
-
                result = cdns3_ep0_delegate_req(priv_dev, ctrl_req);
 
-               if (result)
-                       return result;
-
-               if (!config) {
-                       cdns3_hw_reset_eps_config(priv_dev);
-                       usb_gadget_set_state(&priv_dev->gadget,
-                                            USB_STATE_ADDRESS);
-               }
+               if (result || !config)
+                       goto reset_config;
 
                break;
        case USB_STATE_CONFIGURED:
                result = cdns3_ep0_delegate_req(priv_dev, ctrl_req);
+               if (!config && !result)
+                       goto reset_config;
 
-               if (!config && !result) {
-                       cdns3_hw_reset_eps_config(priv_dev);
-                       usb_gadget_set_state(&priv_dev->gadget,
-                                            USB_STATE_ADDRESS);
-               }
                break;
        default:
-               result = -EINVAL;
+               return -EINVAL;
        }
 
+       return 0;
+
+reset_config:
+       if (result != USB_GADGET_DELAYED_STATUS)
+               cdns3_hw_reset_eps_config(priv_dev);
+
+       usb_gadget_set_state(&priv_dev->gadget,
+                            USB_STATE_ADDRESS);
+
        return result;
 }
 
@@ -705,6 +693,7 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep,
        unsigned long flags;
        int ret = 0;
        u8 zlp = 0;
+       int i;
 
        spin_lock_irqsave(&priv_dev->lock, flags);
        trace_cdns3_ep0_queue(priv_dev, request);
@@ -720,6 +709,17 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep,
                u32 val;
 
                cdns3_select_ep(priv_dev, 0x00);
+
+               /*
+                * Configure all non-control EPs which are not enabled by class driver
+                */
+               for (i = 0; i < CDNS3_ENDPOINTS_MAX_COUNT; i++) {
+                       priv_ep = priv_dev->eps[i];
+                       if (priv_ep && priv_ep->flags & EP_CLAIMED &&
+                           !(priv_ep->flags & EP_ENABLED))
+                               cdns3_ep_config(priv_ep, 0);
+               }
+
                cdns3_set_hw_configuration(priv_dev);
                cdns3_ep0_complete_setup(priv_dev, 0, 1);
                /* wait until configuration set */
@@ -811,6 +811,7 @@ void cdns3_ep0_config(struct cdns3_device *priv_dev)
        struct cdns3_usb_regs __iomem *regs;
        struct cdns3_endpoint *priv_ep;
        u32 max_packet_size = 64;
+       u32 ep_cfg;
 
        regs = priv_dev->regs;
 
@@ -842,8 +843,10 @@ void cdns3_ep0_config(struct cdns3_device *priv_dev)
                                       BIT(0) | BIT(16));
        }
 
-       writel(EP_CFG_ENABLE | EP_CFG_MAXPKTSIZE(max_packet_size),
-              &regs->ep_cfg);
+       ep_cfg = EP_CFG_ENABLE | EP_CFG_MAXPKTSIZE(max_packet_size);
+
+       if (!(priv_ep->flags & EP_CONFIGURED))
+               writel(ep_cfg, &regs->ep_cfg);
 
        writel(EP_STS_EN_SETUPEN | EP_STS_EN_DESCMISEN | EP_STS_EN_TRBERREN,
               &regs->ep_sts_en);
@@ -851,8 +854,10 @@ void cdns3_ep0_config(struct cdns3_device *priv_dev)
        /* init ep in */
        cdns3_select_ep(priv_dev, USB_DIR_IN);
 
-       writel(EP_CFG_ENABLE | EP_CFG_MAXPKTSIZE(max_packet_size),
-              &regs->ep_cfg);
+       if (!(priv_ep->flags & EP_CONFIGURED))
+               writel(ep_cfg, &regs->ep_cfg);
+
+       priv_ep->flags |= EP_CONFIGURED;
 
        writel(EP_STS_EN_SETUPEN | EP_STS_EN_TRBERREN, &regs->ep_sts_en);
 
index 6e7b70a..66c1e67 100644 (file)
@@ -296,6 +296,8 @@ static void cdns3_ep_stall_flush(struct cdns3_endpoint *priv_ep)
  */
 void cdns3_hw_reset_eps_config(struct cdns3_device *priv_dev)
 {
+       int i;
+
        writel(USB_CONF_CFGRST, &priv_dev->regs->usb_conf);
 
        cdns3_allow_enable_l1(priv_dev, 0);
@@ -304,6 +306,10 @@ void cdns3_hw_reset_eps_config(struct cdns3_device *priv_dev)
        priv_dev->out_mem_is_allocated = 0;
        priv_dev->wait_for_setup = 0;
        priv_dev->using_streams = 0;
+
+       for (i = 0; i < CDNS3_ENDPOINTS_MAX_COUNT; i++)
+               if (priv_dev->eps[i])
+                       priv_dev->eps[i]->flags &= ~EP_CONFIGURED;
 }
 
 /**
@@ -506,7 +512,6 @@ static void cdns3_wa2_descmiss_copy_data(struct cdns3_endpoint *priv_ep,
 
        while (!list_empty(&priv_ep->wa2_descmiss_req_list)) {
                int chunk_end;
-               int length;
 
                descmiss_priv_req =
                        cdns3_next_priv_request(&priv_ep->wa2_descmiss_req_list);
@@ -517,7 +522,6 @@ static void cdns3_wa2_descmiss_copy_data(struct cdns3_endpoint *priv_ep,
                        break;
 
                chunk_end = descmiss_priv_req->flags & REQUEST_INTERNAL_CH;
-               length = request->actual + descmiss_req->actual;
                request->status = descmiss_req->status;
                __cdns3_descmiss_copy_data(request, descmiss_req);
                list_del_init(&descmiss_priv_req->list);
@@ -1746,11 +1750,8 @@ static int cdns3_check_ep_interrupt_proceed(struct cdns3_endpoint *priv_ep)
 
 static void cdns3_disconnect_gadget(struct cdns3_device *priv_dev)
 {
-       if (priv_dev->gadget_driver && priv_dev->gadget_driver->disconnect) {
-               spin_unlock(&priv_dev->lock);
+       if (priv_dev->gadget_driver && priv_dev->gadget_driver->disconnect)
                priv_dev->gadget_driver->disconnect(&priv_dev->gadget);
-               spin_lock(&priv_dev->lock);
-       }
 }
 
 /**
@@ -1761,6 +1762,7 @@ static void cdns3_disconnect_gadget(struct cdns3_device *priv_dev)
  */
 static void cdns3_check_usb_interrupt_proceed(struct cdns3_device *priv_dev,
                                              u32 usb_ists)
+__must_hold(&priv_dev->lock)
 {
        int speed = 0;
 
@@ -1785,7 +1787,9 @@ static void cdns3_check_usb_interrupt_proceed(struct cdns3_device *priv_dev,
 
        /* Disconnection detected */
        if (usb_ists & (USB_ISTS_DIS2I | USB_ISTS_DISI)) {
+               spin_unlock(&priv_dev->lock);
                cdns3_disconnect_gadget(priv_dev);
+               spin_lock(&priv_dev->lock);
                priv_dev->gadget.speed = USB_SPEED_UNKNOWN;
                usb_gadget_set_state(&priv_dev->gadget, USB_STATE_NOTATTACHED);
                cdns3_hw_reset_eps_config(priv_dev);
@@ -1979,27 +1983,6 @@ static int cdns3_ep_onchip_buffer_reserve(struct cdns3_device *priv_dev,
        return 0;
 }
 
-static void cdns3_stream_ep_reconfig(struct cdns3_device *priv_dev,
-                                    struct cdns3_endpoint *priv_ep)
-{
-       if (!priv_ep->use_streams || priv_dev->gadget.speed < USB_SPEED_SUPER)
-               return;
-
-       if (priv_dev->dev_ver >= DEV_VER_V3) {
-               u32 mask = BIT(priv_ep->num + (priv_ep->dir ? 16 : 0));
-
-               /*
-                * Stream capable endpoints are handled by using ep_tdl
-                * register. Other endpoints use TDL from TRB feature.
-                */
-               cdns3_clear_register_bit(&priv_dev->regs->tdl_from_trb, mask);
-       }
-
-       /*  Enable Stream Bit TDL chk and SID chk */
-       cdns3_set_register_bit(&priv_dev->regs->ep_cfg, EP_CFG_STREAM_EN |
-                              EP_CFG_TDL_CHK | EP_CFG_SID_CHK);
-}
-
 static void cdns3_configure_dmult(struct cdns3_device *priv_dev,
                                  struct cdns3_endpoint *priv_ep)
 {
@@ -2037,8 +2020,9 @@ static void cdns3_configure_dmult(struct cdns3_device *priv_dev,
 /**
  * cdns3_ep_config Configure hardware endpoint
  * @priv_ep: extended endpoint object
+ * @enable: set EP_CFG_ENABLE bit in ep_cfg register.
  */
-void cdns3_ep_config(struct cdns3_endpoint *priv_ep)
+int cdns3_ep_config(struct cdns3_endpoint *priv_ep, bool enable)
 {
        bool is_iso_ep = (priv_ep->type == USB_ENDPOINT_XFER_ISOC);
        struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
@@ -2099,7 +2083,7 @@ void cdns3_ep_config(struct cdns3_endpoint *priv_ep)
                break;
        default:
                /* all other speed are not supported */
-               return;
+               return -EINVAL;
        }
 
        if (max_packet_size == 1024)
@@ -2109,11 +2093,33 @@ void cdns3_ep_config(struct cdns3_endpoint *priv_ep)
        else
                priv_ep->trb_burst_size = 16;
 
-       ret = cdns3_ep_onchip_buffer_reserve(priv_dev, buffering + 1,
-                                            !!priv_ep->dir);
-       if (ret) {
-               dev_err(priv_dev->dev, "onchip mem is full, ep is invalid\n");
-               return;
+       /* onchip buffer is only allocated before configuration */
+       if (!priv_dev->hw_configured_flag) {
+               ret = cdns3_ep_onchip_buffer_reserve(priv_dev, buffering + 1,
+                                                    !!priv_ep->dir);
+               if (ret) {
+                       dev_err(priv_dev->dev, "onchip mem is full, ep is invalid\n");
+                       return ret;
+               }
+       }
+
+       if (enable)
+               ep_cfg |= EP_CFG_ENABLE;
+
+       if (priv_ep->use_streams && priv_dev->gadget.speed >= USB_SPEED_SUPER) {
+               if (priv_dev->dev_ver >= DEV_VER_V3) {
+                       u32 mask = BIT(priv_ep->num + (priv_ep->dir ? 16 : 0));
+
+                       /*
+                        * Stream capable endpoints are handled by using ep_tdl
+                        * register. Other endpoints use TDL from TRB feature.
+                        */
+                       cdns3_clear_register_bit(&priv_dev->regs->tdl_from_trb,
+                                                mask);
+               }
+
+               /*  Enable Stream Bit TDL chk and SID chk */
+               ep_cfg |=  EP_CFG_STREAM_EN | EP_CFG_TDL_CHK | EP_CFG_SID_CHK;
        }
 
        ep_cfg |= EP_CFG_MAXPKTSIZE(max_packet_size) |
@@ -2123,9 +2129,12 @@ void cdns3_ep_config(struct cdns3_endpoint *priv_ep)
 
        cdns3_select_ep(priv_dev, bEndpointAddress);
        writel(ep_cfg, &priv_dev->regs->ep_cfg);
+       priv_ep->flags |= EP_CONFIGURED;
 
        dev_dbg(priv_dev->dev, "Configure %s: with val %08x\n",
                priv_ep->name, ep_cfg);
+
+       return 0;
 }
 
 /* Find correct direction for HW endpoint according to description */
@@ -2266,7 +2275,7 @@ static int cdns3_gadget_ep_enable(struct usb_ep *ep,
        u32 bEndpointAddress;
        unsigned long flags;
        int enable = 1;
-       int ret;
+       int ret = 0;
        int val;
 
        priv_ep = ep_to_cdns3_ep(ep);
@@ -2305,6 +2314,17 @@ static int cdns3_gadget_ep_enable(struct usb_ep *ep,
        bEndpointAddress = priv_ep->num | priv_ep->dir;
        cdns3_select_ep(priv_dev, bEndpointAddress);
 
+       /*
+        * For some versions of controller at some point during ISO OUT traffic
+        * DMA reads Transfer Ring for the EP which has never got doorbell.
+        * This issue was detected only on simulation, but to avoid this issue
+        * driver add protection against it. To fix it driver enable ISO OUT
+        * endpoint before setting DRBL. This special treatment of ISO OUT
+        * endpoints are recommended by controller specification.
+        */
+       if (priv_ep->type == USB_ENDPOINT_XFER_ISOC  && !priv_ep->dir)
+               enable = 0;
+
        if (usb_ss_max_streams(comp_desc) && usb_endpoint_xfer_bulk(desc)) {
                /*
                 * Enable stream support (SS mode) related interrupts
@@ -2315,13 +2335,17 @@ static int cdns3_gadget_ep_enable(struct usb_ep *ep,
                                EP_STS_EN_SIDERREN | EP_STS_EN_MD_EXITEN |
                                EP_STS_EN_STREAMREN;
                        priv_ep->use_streams = true;
-                       cdns3_stream_ep_reconfig(priv_dev, priv_ep);
+                       ret = cdns3_ep_config(priv_ep, enable);
                        priv_dev->using_streams |= true;
                }
+       } else {
+               ret = cdns3_ep_config(priv_ep, enable);
        }
 
-       ret = cdns3_allocate_trb_pool(priv_ep);
+       if (ret)
+               goto exit;
 
+       ret = cdns3_allocate_trb_pool(priv_ep);
        if (ret)
                goto exit;
 
@@ -2351,20 +2375,6 @@ static int cdns3_gadget_ep_enable(struct usb_ep *ep,
 
        writel(reg, &priv_dev->regs->ep_sts_en);
 
-       /*
-        * For some versions of controller at some point during ISO OUT traffic
-        * DMA reads Transfer Ring for the EP which has never got doorbell.
-        * This issue was detected only on simulation, but to avoid this issue
-        * driver add protection against it. To fix it driver enable ISO OUT
-        * endpoint before setting DRBL. This special treatment of ISO OUT
-        * endpoints are recommended by controller specification.
-        */
-       if (priv_ep->type == USB_ENDPOINT_XFER_ISOC  && !priv_ep->dir)
-               enable = 0;
-
-       if (enable)
-               cdns3_set_register_bit(&priv_dev->regs->ep_cfg, EP_CFG_ENABLE);
-
        ep->desc = desc;
        priv_ep->flags &= ~(EP_PENDING_REQUEST | EP_STALLED | EP_STALL_PENDING |
                            EP_QUIRK_ISO_OUT_EN | EP_QUIRK_EXTRA_BUF_EN);
@@ -3265,10 +3275,13 @@ err0:
 }
 
 static int cdns3_gadget_suspend(struct cdns3 *cdns, bool do_wakeup)
+__must_hold(&cdns->lock)
 {
        struct cdns3_device *priv_dev = cdns->gadget_dev;
 
+       spin_unlock(&cdns->lock);
        cdns3_disconnect_gadget(priv_dev);
+       spin_lock(&cdns->lock);
 
        priv_dev->gadget.speed = USB_SPEED_UNKNOWN;
        usb_gadget_set_state(&priv_dev->gadget, USB_STATE_NOTATTACHED);
index 1ccecd2..21fa461 100644 (file)
@@ -1072,7 +1072,7 @@ struct cdns3_trb {
 #define TRB_TDL_SS_SIZE_GET(p) (((p) & GENMASK(23, 17)) >> 17)
 
 /* transfer_len bitmasks - bits 31:24 */
-#define TRB_BURST_LEN(p)       (((p) << 24) & GENMASK(31, 24))
+#define TRB_BURST_LEN(p)       ((unsigned int)((p) << 24) & GENMASK(31, 24))
 #define TRB_BURST_LEN_GET(p)   (((p) & GENMASK(31, 24)) >> 24)
 
 /* Data buffer pointer bitmasks*/
@@ -1159,6 +1159,7 @@ struct cdns3_endpoint {
 #define EP_QUIRK_EXTRA_BUF_DET BIT(12)
 #define EP_QUIRK_EXTRA_BUF_EN  BIT(13)
 #define EP_TDLCHK_EN           BIT(15)
+#define EP_CONFIGURED          BIT(16)
        u32                     flags;
 
        struct cdns3_request    *descmis_req;
@@ -1360,7 +1361,7 @@ void cdns3_gadget_giveback(struct cdns3_endpoint *priv_ep,
 int cdns3_init_ep0(struct cdns3_device *priv_dev,
                   struct cdns3_endpoint *priv_ep);
 void cdns3_ep0_config(struct cdns3_device *priv_dev);
-void cdns3_ep_config(struct cdns3_endpoint *priv_ep);
+int cdns3_ep_config(struct cdns3_endpoint *priv_ep, bool enable);
 void cdns3_check_ep0_interrupt_proceed(struct cdns3_device *priv_dev, int dir);
 int __cdns3_gadget_wakeup(struct cdns3_device *priv_dev);
 
index 30ef946..1e75688 100644 (file)
@@ -508,6 +508,7 @@ static void acm_read_bulk_callback(struct urb *urb)
                        "%s - cooling babbling device\n", __func__);
                usb_mark_last_busy(acm->dev);
                set_bit(rb->index, &acm->urbs_in_error_delay);
+               set_bit(ACM_ERROR_DELAY, &acm->flags);
                cooldown = true;
                break;
        default:
@@ -533,7 +534,7 @@ static void acm_read_bulk_callback(struct urb *urb)
 
        if (stopped || stalled || cooldown) {
                if (stalled)
-                       schedule_work(&acm->work);
+                       schedule_delayed_work(&acm->dwork, 0);
                else if (cooldown)
                        schedule_delayed_work(&acm->dwork, HZ / 2);
                return;
@@ -563,13 +564,13 @@ static void acm_write_bulk(struct urb *urb)
        acm_write_done(acm, wb);
        spin_unlock_irqrestore(&acm->write_lock, flags);
        set_bit(EVENT_TTY_WAKEUP, &acm->flags);
-       schedule_work(&acm->work);
+       schedule_delayed_work(&acm->dwork, 0);
 }
 
 static void acm_softint(struct work_struct *work)
 {
        int i;
-       struct acm *acm = container_of(work, struct acm, work);
+       struct acm *acm = container_of(work, struct acm, dwork.work);
 
        if (test_bit(EVENT_RX_STALL, &acm->flags)) {
                smp_mb(); /* against acm_suspend() */
@@ -585,7 +586,7 @@ static void acm_softint(struct work_struct *work)
        if (test_and_clear_bit(ACM_ERROR_DELAY, &acm->flags)) {
                for (i = 0; i < acm->rx_buflimit; i++)
                        if (test_and_clear_bit(i, &acm->urbs_in_error_delay))
-                                       acm_submit_read_urb(acm, i, GFP_NOIO);
+                               acm_submit_read_urb(acm, i, GFP_KERNEL);
        }
 
        if (test_and_clear_bit(EVENT_TTY_WAKEUP, &acm->flags))
@@ -1351,7 +1352,6 @@ made_compressed_probe:
        acm->ctrlsize = ctrlsize;
        acm->readsize = readsize;
        acm->rx_buflimit = num_rx_buf;
-       INIT_WORK(&acm->work, acm_softint);
        INIT_DELAYED_WORK(&acm->dwork, acm_softint);
        init_waitqueue_head(&acm->wioctl);
        spin_lock_init(&acm->write_lock);
@@ -1561,7 +1561,6 @@ static void acm_disconnect(struct usb_interface *intf)
        }
 
        acm_kill_urbs(acm);
-       cancel_work_sync(&acm->work);
        cancel_delayed_work_sync(&acm->dwork);
 
        tty_unregister_device(acm_tty_driver, acm->minor);
@@ -1604,7 +1603,6 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message)
                return 0;
 
        acm_kill_urbs(acm);
-       cancel_work_sync(&acm->work);
        cancel_delayed_work_sync(&acm->dwork);
        acm->urbs_in_error_delay = 0;
 
index 9dce179..8aef5eb 100644 (file)
@@ -112,8 +112,7 @@ struct acm {
 #              define ACM_ERROR_DELAY  3
        unsigned long urbs_in_error_delay;              /* these need to be restarted after a delay */
        struct usb_cdc_line_coding line;                /* bits, stop, parity */
-       struct work_struct work;                        /* work queue entry for various purposes*/
-       struct delayed_work dwork;                      /* for cool downs needed in error recovery */
+       struct delayed_work dwork;                      /* work queue entry for various purposes */
        unsigned int ctrlin;                            /* input control lines (DCD, DSR, RI, break, overruns) */
        unsigned int ctrlout;                           /* output control lines (DTR, RTS) */
        struct async_icount iocount;                    /* counters for control line changes */
index 98b7449..4dfa44d 100644 (file)
@@ -839,6 +839,22 @@ const struct usb_device_id *usb_device_match_id(struct usb_device *udev,
        return NULL;
 }
 
+bool usb_driver_applicable(struct usb_device *udev,
+                          struct usb_device_driver *udrv)
+{
+       if (udrv->id_table && udrv->match)
+               return usb_device_match_id(udev, udrv->id_table) != NULL &&
+                      udrv->match(udev);
+
+       if (udrv->id_table)
+               return usb_device_match_id(udev, udrv->id_table) != NULL;
+
+       if (udrv->match)
+               return udrv->match(udev);
+
+       return false;
+}
+
 static int usb_device_match(struct device *dev, struct device_driver *drv)
 {
        /* devices and interfaces are handled separately */
@@ -853,17 +869,14 @@ static int usb_device_match(struct device *dev, struct device_driver *drv)
                udev = to_usb_device(dev);
                udrv = to_usb_device_driver(drv);
 
-               if (udrv->id_table)
-                       return usb_device_match_id(udev, udrv->id_table) != NULL;
-
-               if (udrv->match)
-                       return udrv->match(udev);
-
                /* If the device driver under consideration does not have a
                 * id_table or a match function, then let the driver's probe
                 * function decide.
                 */
-               return 1;
+               if (!udrv->id_table && !udrv->match)
+                       return 1;
+
+               return usb_driver_applicable(udev, udrv);
 
        } else if (is_usb_interface(dev)) {
                struct usb_interface *intf;
@@ -941,8 +954,7 @@ static int __usb_bus_reprobe_drivers(struct device *dev, void *data)
                return 0;
 
        udev = to_usb_device(dev);
-       if (usb_device_match_id(udev, new_udriver->id_table) == NULL &&
-           (!new_udriver->match || new_udriver->match(udev) == 0))
+       if (!usb_driver_applicable(udev, new_udriver))
                return 0;
 
        ret = device_reprobe(dev);
index 22c887f..26f9fb9 100644 (file)
@@ -205,9 +205,7 @@ static int __check_for_non_generic_match(struct device_driver *drv, void *data)
        udrv = to_usb_device_driver(drv);
        if (udrv == &usb_generic_driver)
                return 0;
-       if (usb_device_match_id(udev, udrv->id_table) != NULL)
-               return 1;
-       return (udrv->match && udrv->match(udev));
+       return usb_driver_applicable(udev, udrv);
 }
 
 static bool usb_generic_driver_match(struct usb_device *udev)
index 10574fa..a1e3a03 100644 (file)
@@ -378,6 +378,9 @@ static const struct usb_device_id usb_quirk_list[] = {
        { USB_DEVICE(0x0926, 0x3333), .driver_info =
                        USB_QUIRK_CONFIG_INTF_STRINGS },
 
+       /* Kingston DataTraveler 3.0 */
+       { USB_DEVICE(0x0951, 0x1666), .driver_info = USB_QUIRK_NO_LPM },
+
        /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */
        { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF },
 
index c893f54..82538da 100644 (file)
@@ -74,6 +74,8 @@ extern int usb_match_device(struct usb_device *dev,
                            const struct usb_device_id *id);
 extern const struct usb_device_id *usb_device_match_id(struct usb_device *udev,
                                const struct usb_device_id *id);
+extern bool usb_driver_applicable(struct usb_device *udev,
+                                 struct usb_device_driver *udrv);
 extern void usb_forced_unbind_intf(struct usb_interface *intf);
 extern void usb_unbind_and_rebind_marked_interfaces(struct usb_device *udev);
 
index e282067..5f18aca 100644 (file)
@@ -608,10 +608,13 @@ static int dwc2_driver_probe(struct platform_device *dev)
 #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
        return 0;
 
+#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \
+       IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
 error_debugfs:
        dwc2_debugfs_exit(hsotg);
        if (hsotg->hcd_enabled)
                dwc2_hcd_remove(hsotg);
+#endif
 error_drd:
        dwc2_drd_exit(hsotg);
 
index bdf0925..841daec 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-/**
+/*
  * core.c - DesignWare USB3 DRD Controller Core file
  *
  * Copyright (C) 2010-2011 Texas Instruments Incorporated - https://www.ti.com
index 74323b1..2f95f08 100644 (file)
@@ -1277,7 +1277,7 @@ struct dwc3_event_type {
 #define DWC3_DEPEVT_EPCMDCMPLT         0x07
 
 /**
- * struct dwc3_event_depvt - Device Endpoint Events
+ * struct dwc3_event_depevt - Device Endpoint Events
  * @one_bit: indicates this is an endpoint event (not used)
  * @endpoint_number: number of the endpoint
  * @endpoint_event: The event we have:
index 242b621..bae6a70 100644 (file)
@@ -40,6 +40,7 @@
 #define PCI_DEVICE_ID_INTEL_TGPLP              0xa0ee
 #define PCI_DEVICE_ID_INTEL_TGPH               0x43ee
 #define PCI_DEVICE_ID_INTEL_JSP                        0x4dee
+#define PCI_DEVICE_ID_INTEL_ADLS               0x7ae1
 
 #define PCI_INTEL_BXT_DSM_GUID         "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
 #define PCI_INTEL_BXT_FUNC_PMU_PWR     4
@@ -367,6 +368,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
        { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_JSP),
          (kernel_ulong_t) &dwc3_pci_intel_properties, },
 
+       { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS),
+         (kernel_ulong_t) &dwc3_pci_intel_properties, },
+
        { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB),
          (kernel_ulong_t) &dwc3_pci_amd_properties, },
        {  }    /* Terminating Entry */
index 7be3903..8b668ef 100644 (file)
@@ -1058,10 +1058,11 @@ void dwc3_ep0_send_delayed_status(struct dwc3 *dwc)
 {
        unsigned int direction = !dwc->ep0_expect_in;
 
+       dwc->delayed_status = false;
+
        if (dwc->ep0state != EP0_STATUS_PHASE)
                return;
 
-       dwc->delayed_status = false;
        __dwc3_ep0_do_control_status(dwc, dwc->eps[direction]);
 }
 
index 05b176c..c6d455f 100644 (file)
@@ -1245,7 +1245,7 @@ int usb_string_id(struct usb_composite_dev *cdev)
 EXPORT_SYMBOL_GPL(usb_string_id);
 
 /**
- * usb_string_ids() - allocate unused string IDs in batch
+ * usb_string_ids_tab() - allocate unused string IDs in batch
  * @cdev: the device whose string descriptor IDs are being allocated
  * @str: an array of usb_string objects to assign numbers to
  * Context: single threaded during gadget setup
index e01e366..062dfac 100644 (file)
@@ -564,9 +564,12 @@ static int raw_ioctl_event_fetch(struct raw_dev *dev, unsigned long value)
                return -ENODEV;
        }
        length = min(arg.length, event->length);
-       if (copy_to_user((void __user *)value, event, sizeof(*event) + length))
+       if (copy_to_user((void __user *)value, event, sizeof(*event) + length)) {
+               kfree(event);
                return -EFAULT;
+       }
 
+       kfree(event);
        return 0;
 }
 
index de528e3..ad6ff9c 100644 (file)
@@ -1051,7 +1051,7 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep)
        u32 bitmask;
        struct ep_queue_head *qh;
 
-       if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF))
+       if (!_ep || !_ep->desc || !(_ep->desc->bEndpointAddress&0xF))
                return -ENODEV;
 
        ep = container_of(_ep, struct fsl_ep, ep);
index 25c1d6a..3e1267d 100644 (file)
@@ -1760,6 +1760,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                goto err;
        }
 
+       pci_set_drvdata(pdev, dev);
        spin_lock_init(&dev->lock);
        dev->pdev = pdev;
        dev->gadget.ops = &goku_ops;
@@ -1793,7 +1794,6 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        }
        dev->regs = (struct goku_udc_regs __iomem *) base;
 
-       pci_set_drvdata(pdev, dev);
        INFO(dev, "%s\n", driver_desc);
        INFO(dev, "version: " DRIVER_VERSION " %s\n", dmastr());
        INFO(dev, "irq %d, pci mem %p\n", pdev->irq, base);
index aaca1b0..7bd5182 100644 (file)
@@ -30,8 +30,6 @@
 #include <linux/regulator/consumer.h>
 #include <linux/pm_runtime.h>
 
-#include <mach/regs-s3c2443-clock.h>
-
 #define S3C_HSUDC_REG(x)       (x)
 
 /* Non-Indexed Registers */
@@ -186,53 +184,6 @@ static inline void __orr32(void __iomem *ptr, u32 val)
        writel(readl(ptr) | val, ptr);
 }
 
-static void s3c_hsudc_init_phy(void)
-{
-       u32 cfg;
-
-       cfg = readl(S3C2443_PWRCFG) | S3C2443_PWRCFG_USBPHY;
-       writel(cfg, S3C2443_PWRCFG);
-
-       cfg = readl(S3C2443_URSTCON);
-       cfg |= (S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST);
-       writel(cfg, S3C2443_URSTCON);
-       mdelay(1);
-
-       cfg = readl(S3C2443_URSTCON);
-       cfg &= ~(S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST);
-       writel(cfg, S3C2443_URSTCON);
-
-       cfg = readl(S3C2443_PHYCTRL);
-       cfg &= ~(S3C2443_PHYCTRL_CLKSEL | S3C2443_PHYCTRL_DSPORT);
-       cfg |= (S3C2443_PHYCTRL_EXTCLK | S3C2443_PHYCTRL_PLLSEL);
-       writel(cfg, S3C2443_PHYCTRL);
-
-       cfg = readl(S3C2443_PHYPWR);
-       cfg &= ~(S3C2443_PHYPWR_FSUSPEND | S3C2443_PHYPWR_PLL_PWRDN |
-               S3C2443_PHYPWR_XO_ON | S3C2443_PHYPWR_PLL_REFCLK |
-               S3C2443_PHYPWR_ANALOG_PD);
-       cfg |= S3C2443_PHYPWR_COMMON_ON;
-       writel(cfg, S3C2443_PHYPWR);
-
-       cfg = readl(S3C2443_UCLKCON);
-       cfg |= (S3C2443_UCLKCON_DETECT_VBUS | S3C2443_UCLKCON_FUNC_CLKEN |
-               S3C2443_UCLKCON_TCLKEN);
-       writel(cfg, S3C2443_UCLKCON);
-}
-
-static void s3c_hsudc_uninit_phy(void)
-{
-       u32 cfg;
-
-       cfg = readl(S3C2443_PWRCFG) & ~S3C2443_PWRCFG_USBPHY;
-       writel(cfg, S3C2443_PWRCFG);
-
-       writel(S3C2443_PHYPWR_FSUSPEND, S3C2443_PHYPWR);
-
-       cfg = readl(S3C2443_UCLKCON) & ~S3C2443_UCLKCON_FUNC_CLKEN;
-       writel(cfg, S3C2443_UCLKCON);
-}
-
 /**
  * s3c_hsudc_complete_request - Complete a transfer request.
  * @hsep: Endpoint to which the request belongs.
@@ -1188,7 +1139,8 @@ static int s3c_hsudc_start(struct usb_gadget *gadget,
 
        pm_runtime_get_sync(hsudc->dev);
 
-       s3c_hsudc_init_phy();
+       if (hsudc->pd->phy_init)
+               hsudc->pd->phy_init();
        if (hsudc->pd->gpio_init)
                hsudc->pd->gpio_init();
 
@@ -1210,7 +1162,8 @@ static int s3c_hsudc_stop(struct usb_gadget *gadget)
 
        spin_lock_irqsave(&hsudc->lock, flags);
        hsudc->gadget.speed = USB_SPEED_UNKNOWN;
-       s3c_hsudc_uninit_phy();
+       if (hsudc->pd->phy_uninit)
+               hsudc->pd->phy_uninit();
 
        pm_runtime_put(hsudc->dev);
 
index e875a0b..f1ea514 100644 (file)
 #include <asm/byteorder.h>
 #include <asm/irq.h>
 #include <asm/unaligned.h>
-#include <mach/irqs.h>
 
-#include <mach/hardware.h>
-
-#include <plat/regs-udc.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
 
-
 #include "s3c2410_udc.h"
+#include "s3c2410_udc_regs.h"
 
 #define DRIVER_DESC    "S3C2410 USB Device Controller Gadget"
 #define DRIVER_AUTHOR  "Herbert Pötzl <herbert@13thfloor.at>, " \
@@ -57,6 +53,7 @@ static struct s3c2410_udc     *the_controller;
 static struct clk              *udc_clock;
 static struct clk              *usb_bus_clock;
 static void __iomem            *base_addr;
+static int                     irq_usbd;
 static u64                     rsrc_start;
 static u64                     rsrc_len;
 static struct dentry           *s3c2410_udc_debugfs_root;
@@ -835,8 +832,6 @@ static void s3c2410_udc_handle_ep(struct s3c2410_ep *ep)
        }
 }
 
-#include <mach/regs-irq.h>
-
 /*
  *     s3c2410_udc_irq - interrupt handler
  */
@@ -977,7 +972,7 @@ static irqreturn_t s3c2410_udc_irq(int dummy, void *_dev)
                }
        }
 
-       dprintk(DEBUG_VERBOSE, "irq: %d s3c2410_udc_done.\n", IRQ_USBD);
+       dprintk(DEBUG_VERBOSE, "irq: %d s3c2410_udc_done.\n", irq_usbd);
 
        /* Restore old index */
        udc_write(idx, S3C2410_UDC_INDEX_REG);
@@ -1777,13 +1772,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
        spin_lock_init(&udc->lock);
        udc_info = dev_get_platdata(&pdev->dev);
 
-       rsrc_start = S3C2410_PA_USBDEV;
-       rsrc_len   = S3C24XX_SZ_USBDEV;
-
-       if (!request_mem_region(rsrc_start, rsrc_len, gadget_name))
-               return -EBUSY;
-
-       base_addr = ioremap(rsrc_start, rsrc_len);
+       base_addr = devm_platform_ioremap_resource(pdev, 0);
        if (!base_addr) {
                retval = -ENOMEM;
                goto err_mem;
@@ -1795,17 +1784,19 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
        s3c2410_udc_disable(udc);
        s3c2410_udc_reinit(udc);
 
+       irq_usbd = platform_get_irq(pdev, 0);
+
        /* irq setup after old hardware state is cleaned up */
-       retval = request_irq(IRQ_USBD, s3c2410_udc_irq,
+       retval = request_irq(irq_usbd, s3c2410_udc_irq,
                             0, gadget_name, udc);
 
        if (retval != 0) {
-               dev_err(dev, "cannot get irq %i, err %d\n", IRQ_USBD, retval);
+               dev_err(dev, "cannot get irq %i, err %d\n", irq_usbd, retval);
                retval = -EBUSY;
                goto err_map;
        }
 
-       dev_dbg(dev, "got irq %i\n", IRQ_USBD);
+       dev_dbg(dev, "got irq %i\n", irq_usbd);
 
        if (udc_info && udc_info->vbus_pin > 0) {
                retval = gpio_request(udc_info->vbus_pin, "udc vbus");
@@ -1872,7 +1863,7 @@ err_gpio_claim:
        if (udc_info && udc_info->vbus_pin > 0)
                gpio_free(udc_info->vbus_pin);
 err_int:
-       free_irq(IRQ_USBD, udc);
+       free_irq(irq_usbd, udc);
 err_map:
        iounmap(base_addr);
 err_mem:
@@ -1906,7 +1897,7 @@ static int s3c2410_udc_remove(struct platform_device *pdev)
                free_irq(irq, udc);
        }
 
-       free_irq(IRQ_USBD, udc);
+       free_irq(irq_usbd, udc);
 
        iounmap(base_addr);
        release_mem_region(rsrc_start, rsrc_len);
index bdcaa8d..68bdf3e 100644 (file)
@@ -90,6 +90,7 @@ struct s3c2410_udc {
        unsigned                        req_pending : 1;
        u8                              vbus;
        struct dentry                   *regs_info;
+       int                             irq;
 };
 #define to_s3c2410(g)  (container_of((g), struct s3c2410_udc, gadget))
 
index e077b2c..869d9c4 100644 (file)
@@ -479,8 +479,8 @@ static int tegra_ehci_probe(struct platform_device *pdev)
        u_phy->otg->host = hcd_to_bus(hcd);
 
        irq = platform_get_irq(pdev, 0);
-       if (!irq) {
-               err = -ENODEV;
+       if (irq < 0) {
+               err = irq;
                goto cleanup_phy;
        }
 
index ae8f60f..44a7e58 100644 (file)
@@ -94,10 +94,13 @@ static struct platform_device *fsl_usb2_device_register(
 
        pdev->dev.coherent_dma_mask = ofdev->dev.coherent_dma_mask;
 
-       if (!pdev->dev.dma_mask)
+       if (!pdev->dev.dma_mask) {
                pdev->dev.dma_mask = &ofdev->dev.coherent_dma_mask;
-       else
-               dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+       } else {
+               retval = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+               if (retval)
+                       goto error;
+       }
 
        retval = platform_device_add_data(pdev, pdata, sizeof(*pdata));
        if (retval)
index fe405cd..138ba45 100644 (file)
@@ -2252,8 +2252,8 @@ static void xhci_create_rhub_port_array(struct xhci_hcd *xhci,
 
        if (!rhub->num_ports)
                return;
-       rhub->ports = kcalloc_node(rhub->num_ports, sizeof(rhub->ports), flags,
-                       dev_to_node(dev));
+       rhub->ports = kcalloc_node(rhub->num_ports, sizeof(*rhub->ports),
+                       flags, dev_to_node(dev));
        for (i = 0; i < HCS_MAX_PORTS(xhci->hcs_params1); i++) {
                if (xhci->hw_ports[i].rhub != rhub ||
                    xhci->hw_ports[i].hcd_portnum == DUPLICATE_ENTRY)
index c26c06e..bf89172 100644 (file)
@@ -23,6 +23,8 @@
 #define SSIC_PORT_CFG2_OFFSET  0x30
 #define PROG_DONE              (1 << 30)
 #define SSIC_PORT_UNUSED       (1 << 31)
+#define SPARSE_DISABLE_BIT     17
+#define SPARSE_CNTL_ENABLE     0xC12C
 
 /* Device for a quirk */
 #define PCI_VENDOR_ID_FRESCO_LOGIC     0x1b73
@@ -161,6 +163,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
            (pdev->device == 0x15e0 || pdev->device == 0x15e1))
                xhci->quirks |= XHCI_SNPS_BROKEN_SUSPEND;
 
+       if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x15e5)
+               xhci->quirks |= XHCI_DISABLE_SPARSE;
+
        if (pdev->vendor == PCI_VENDOR_ID_AMD)
                xhci->quirks |= XHCI_TRUST_TX_LENGTH;
 
@@ -498,6 +503,15 @@ static void xhci_pme_quirk(struct usb_hcd *hcd)
        readl(reg);
 }
 
+static void xhci_sparse_control_quirk(struct usb_hcd *hcd)
+{
+       u32 reg;
+
+       reg = readl(hcd->regs + SPARSE_CNTL_ENABLE);
+       reg &= ~BIT(SPARSE_DISABLE_BIT);
+       writel(reg, hcd->regs + SPARSE_CNTL_ENABLE);
+}
+
 static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 {
        struct xhci_hcd *xhci = hcd_to_xhci(hcd);
@@ -517,6 +531,9 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
        if (xhci->quirks & XHCI_SSIC_PORT_UNUSED)
                xhci_ssic_port_unused_quirk(hcd, true);
 
+       if (xhci->quirks & XHCI_DISABLE_SPARSE)
+               xhci_sparse_control_quirk(hcd);
+
        ret = xhci_suspend(xhci, do_wakeup);
        if (ret && (xhci->quirks & XHCI_SSIC_PORT_UNUSED))
                xhci_ssic_port_unused_quirk(hcd, false);
index 482fe8c..d4a8d0e 100644 (file)
@@ -3533,11 +3533,14 @@ static int xhci_alloc_streams(struct usb_hcd *hcd, struct usb_device *udev,
                xhci_dbg(xhci, "Slot %u ep ctx %u now has streams.\n",
                         udev->slot_id, ep_index);
                vdev->eps[ep_index].ep_state |= EP_HAS_STREAMS;
-               xhci_debugfs_create_stream_files(xhci, vdev, ep_index);
        }
        xhci_free_command(xhci, config_cmd);
        spin_unlock_irqrestore(&xhci->lock, flags);
 
+       for (i = 0; i < num_eps; i++) {
+               ep_index = xhci_get_endpoint_index(&eps[i]->desc);
+               xhci_debugfs_create_stream_files(xhci, vdev, ep_index);
+       }
        /* Subtract 1 for stream 0, which drivers can't use */
        return num_streams - 1;
 
index 8be8837..ebb359e 100644 (file)
@@ -1877,6 +1877,7 @@ struct xhci_hcd {
 #define XHCI_SNPS_BROKEN_SUSPEND    BIT_ULL(35)
 #define XHCI_RENESAS_FW_QUIRK  BIT_ULL(36)
 #define XHCI_SKIP_PHY_INIT     BIT_ULL(37)
+#define XHCI_DISABLE_SPARSE    BIT_ULL(38)
 
        unsigned int            num_active_eps;
        unsigned int            limit_active_eps;
index b403094..9de0171 100644 (file)
@@ -120,8 +120,10 @@ static int apple_mfi_fc_set_property(struct power_supply *psy,
        dev_dbg(&mfi->udev->dev, "prop: %d\n", psp);
 
        ret = pm_runtime_get_sync(&mfi->udev->dev);
-       if (ret < 0)
+       if (ret < 0) {
+               pm_runtime_put_noidle(&mfi->udev->dev);
                return ret;
+       }
 
        switch (psp) {
        case POWER_SUPPLY_PROP_CHARGE_TYPE:
@@ -163,17 +165,23 @@ static const struct power_supply_desc apple_mfi_fc_desc = {
        .property_is_writeable  = apple_mfi_fc_property_is_writeable
 };
 
+static bool mfi_fc_match(struct usb_device *udev)
+{
+       int idProduct;
+
+       idProduct = le16_to_cpu(udev->descriptor.idProduct);
+       /* See comment above mfi_fc_id_table[] */
+       return (idProduct >= 0x1200 && idProduct <= 0x12ff);
+}
+
 static int mfi_fc_probe(struct usb_device *udev)
 {
        struct power_supply_config battery_cfg = {};
        struct mfi_device *mfi = NULL;
-       int err, idProduct;
+       int err;
 
-       idProduct = le16_to_cpu(udev->descriptor.idProduct);
-       /* See comment above mfi_fc_id_table[] */
-       if (idProduct < 0x1200 || idProduct > 0x12ff) {
+       if (!mfi_fc_match(udev))
                return -ENODEV;
-       }
 
        mfi = kzalloc(sizeof(struct mfi_device), GFP_KERNEL);
        if (!mfi) {
@@ -220,6 +228,7 @@ static struct usb_device_driver mfi_fc_driver = {
        .probe =        mfi_fc_probe,
        .disconnect =   mfi_fc_disconnect,
        .id_table =     mfi_fc_id_table,
+       .match =        mfi_fc_match,
        .generic_subclass = 1,
 };
 
index 1de5c9a..38f17d6 100644 (file)
@@ -564,6 +564,7 @@ static int mtu3_gadget_stop(struct usb_gadget *g)
 
        spin_unlock_irqrestore(&mtu->lock, flags);
 
+       synchronize_irq(mtu->irq);
        return 0;
 }
 
index 8219706..2e40908 100644 (file)
@@ -357,11 +357,12 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
        struct device *dev = &port->dev;
        int status = urb->status;
        unsigned long flags;
+       bool resubmitted = false;
 
-       set_bit(0, &port->write_urbs_free);
        if (status) {
                dev_dbg(dev, "%s - nonzero write bulk status received: %d\n",
                        __func__, status);
+               set_bit(0, &port->write_urbs_free);
                return;
        }
 
@@ -394,6 +395,8 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
                        goto exit;
                }
 
+               resubmitted = true;
+
                dev_dbg(dev, "%s - priv->wrsent=%d\n", __func__, priv->wrsent);
                dev_dbg(dev, "%s - priv->wrfilled=%d\n", __func__, priv->wrfilled);
 
@@ -410,6 +413,8 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
 
 exit:
        spin_unlock_irqrestore(&priv->lock, flags);
+       if (!resubmitted)
+               set_bit(0, &port->write_urbs_free);
        usb_serial_port_softint(port);
 }
 
index 2a3bfd6..54ca85c 100644 (file)
@@ -250,6 +250,7 @@ static void option_instat_callback(struct urb *urb);
 #define QUECTEL_PRODUCT_EP06                   0x0306
 #define QUECTEL_PRODUCT_EM12                   0x0512
 #define QUECTEL_PRODUCT_RM500Q                 0x0800
+#define QUECTEL_PRODUCT_EC200T                 0x6026
 
 #define CMOTECH_VENDOR_ID                      0x16d8
 #define CMOTECH_PRODUCT_6001                   0x6001
@@ -1117,6 +1118,7 @@ static const struct usb_device_id option_ids[] = {
        { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) },
        { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10),
          .driver_info = ZLP },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) },
 
        { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
        { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
@@ -1189,6 +1191,8 @@ static const struct usb_device_id option_ids[] = {
          .driver_info = NCTRL(0) | RSVD(1) },
        { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1054, 0xff),    /* Telit FT980-KS */
          .driver_info = NCTRL(2) | RSVD(3) },
+       { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1055, 0xff),    /* Telit FN980 (PCIe) */
+         .driver_info = NCTRL(0) | RSVD(1) },
        { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910),
          .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) },
        { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
@@ -1201,6 +1205,8 @@ static const struct usb_device_id option_ids[] = {
          .driver_info = NCTRL(0) },
        { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
          .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
+       { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1203, 0xff),    /* Telit LE910Cx (RNDIS) */
+         .driver_info = NCTRL(2) | RSVD(3) },
        { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),
          .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) },
        { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
@@ -1215,6 +1221,10 @@ static const struct usb_device_id option_ids[] = {
        { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1213, 0xff) },
        { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1214),
          .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) },
+       { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1230, 0xff),    /* Telit LE910Cx (rmnet) */
+         .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
+       { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1231, 0xff),    /* Telit LE910Cx (RNDIS) */
+         .driver_info = NCTRL(2) | RSVD(3) },
        { USB_DEVICE(TELIT_VENDOR_ID, 0x1260),
          .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
        { USB_DEVICE(TELIT_VENDOR_ID, 0x1261),
index b069a51..cf720e9 100644 (file)
@@ -71,7 +71,7 @@ struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode)
 EXPORT_SYMBOL_GPL(fwnode_typec_switch_get);
 
 /**
- * typec_put_switch - Release USB Type-C orientation switch
+ * typec_switch_put - Release USB Type-C orientation switch
  * @sw: USB Type-C orientation switch
  *
  * Decrement reference count for @sw.
index ce0bd7b..2a618f0 100644 (file)
@@ -544,11 +544,10 @@ static int stusb160x_get_fw_caps(struct stusb160x *chip,
         */
        ret = fwnode_property_read_string(fwnode, "power-role", &cap_str);
        if (!ret) {
-               chip->port_type = typec_find_port_power_role(cap_str);
-               if (chip->port_type < 0) {
-                       ret = chip->port_type;
+               ret = typec_find_port_power_role(cap_str);
+               if (ret < 0)
                        return ret;
-               }
+               chip->port_type = ret;
        }
        chip->capability.type = chip->port_type;
 
@@ -565,15 +564,13 @@ static int stusb160x_get_fw_caps(struct stusb160x *chip,
         */
        ret = fwnode_property_read_string(fwnode, "power-opmode", &cap_str);
        if (!ret) {
-               chip->pwr_opmode = typec_find_pwr_opmode(cap_str);
+               ret = typec_find_pwr_opmode(cap_str);
                /* Power delivery not yet supported */
-               if (chip->pwr_opmode < 0 ||
-                   chip->pwr_opmode == TYPEC_PWR_MODE_PD) {
-                       ret = chip->pwr_opmode < 0 ? chip->pwr_opmode : -EINVAL;
-                       dev_err(chip->dev, "bad power operation mode: %d\n",
-                               chip->pwr_opmode);
-                       return ret;
+               if (ret < 0 || ret == TYPEC_PWR_MODE_PD) {
+                       dev_err(chip->dev, "bad power operation mode: %d\n", ret);
+                       return -EINVAL;
                }
+               chip->pwr_opmode = ret;
        }
 
        return 0;
@@ -632,6 +629,7 @@ static const struct of_device_id stusb160x_of_match[] = {
        { .compatible = "st,stusb1600", .data = &stusb1600_regmap_config},
        {},
 };
+MODULE_DEVICE_TABLE(of, stusb160x_of_match);
 
 static int stusb160x_probe(struct i2c_client *client)
 {
@@ -729,8 +727,8 @@ static int stusb160x_probe(struct i2c_client *client)
        }
 
        chip->port = typec_register_port(chip->dev, &chip->capability);
-       if (!chip->port) {
-               ret = -ENODEV;
+       if (IS_ERR(chip->port)) {
+               ret = PTR_ERR(chip->port);
                goto all_reg_disable;
        }
 
index 55535c4..a6fae1f 100644 (file)
@@ -2890,6 +2890,9 @@ static void tcpm_reset_port(struct tcpm_port *port)
 
 static void tcpm_detach(struct tcpm_port *port)
 {
+       if (tcpm_port_is_disconnected(port))
+               port->hard_reset_count = 0;
+
        if (!port->attached)
                return;
 
@@ -2898,9 +2901,6 @@ static void tcpm_detach(struct tcpm_port *port)
                port->tcpc->set_bist_data(port->tcpc, false);
        }
 
-       if (tcpm_port_is_disconnected(port))
-               port->hard_reset_count = 0;
-
        tcpm_reset_port(port);
 }
 
index ef1c550..4b61956 100644 (file)
@@ -239,7 +239,6 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
        u64 paend;
        struct scatterlist *sg;
        struct device *dma = mvdev->mdev->device;
-       int ret;
 
        for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1);
             map; map = vhost_iotlb_itree_next(map, start, mr->end - 1)) {
@@ -277,8 +276,8 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
 done:
        mr->log_size = log_entity_size;
        mr->nsg = nsg;
-       ret = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
-       if (!ret)
+       err = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
+       if (!err)
                goto err_map;
 
        err = create_direct_mr(mvdev, mr);
index 2629911..6a90fdb 100644 (file)
@@ -38,6 +38,10 @@ static int batch_mapping = 1;
 module_param(batch_mapping, int, 0444);
 MODULE_PARM_DESC(batch_mapping, "Batched mapping 1 -Enable; 0 - Disable");
 
+static char *macaddr;
+module_param(macaddr, charp, 0);
+MODULE_PARM_DESC(macaddr, "Ethernet MAC address");
+
 struct vdpasim_virtqueue {
        struct vringh vring;
        struct vringh_kiov iov;
@@ -60,7 +64,8 @@ struct vdpasim_virtqueue {
 
 static u64 vdpasim_features = (1ULL << VIRTIO_F_ANY_LAYOUT) |
                              (1ULL << VIRTIO_F_VERSION_1)  |
-                             (1ULL << VIRTIO_F_ACCESS_PLATFORM);
+                             (1ULL << VIRTIO_F_ACCESS_PLATFORM) |
+                             (1ULL << VIRTIO_NET_F_MAC);
 
 /* State of each vdpasim device */
 struct vdpasim {
@@ -361,7 +366,9 @@ static struct vdpasim *vdpasim_create(void)
        spin_lock_init(&vdpasim->iommu_lock);
 
        dev = &vdpasim->vdpa.dev;
-       dev->coherent_dma_mask = DMA_BIT_MASK(64);
+       dev->dma_mask = &dev->coherent_dma_mask;
+       if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)))
+               goto err_iommu;
        set_dma_ops(dev, &vdpasim_dma_ops);
 
        vdpasim->iommu = vhost_iotlb_alloc(2048, 0);
@@ -372,7 +379,15 @@ static struct vdpasim *vdpasim_create(void)
        if (!vdpasim->buffer)
                goto err_iommu;
 
-       eth_random_addr(vdpasim->config.mac);
+       if (macaddr) {
+               mac_pton(macaddr, vdpasim->config.mac);
+               if (!is_valid_ether_addr(vdpasim->config.mac)) {
+                       ret = -EADDRNOTAVAIL;
+                       goto err_iommu;
+               }
+       } else {
+               eth_random_addr(vdpasim->config.mac);
+       }
 
        vringh_set_iotlb(&vdpasim->vqs[0].vring, vdpasim->iommu);
        vringh_set_iotlb(&vdpasim->vqs[1].vring, vdpasim->iommu);
@@ -574,6 +589,16 @@ static u32 vdpasim_get_generation(struct vdpa_device *vdpa)
        return vdpasim->generation;
 }
 
+static struct vdpa_iova_range vdpasim_get_iova_range(struct vdpa_device *vdpa)
+{
+       struct vdpa_iova_range range = {
+               .first = 0ULL,
+               .last = ULLONG_MAX,
+       };
+
+       return range;
+}
+
 static int vdpasim_set_map(struct vdpa_device *vdpa,
                           struct vhost_iotlb *iotlb)
 {
@@ -657,6 +682,7 @@ static const struct vdpa_config_ops vdpasim_net_config_ops = {
        .get_config             = vdpasim_get_config,
        .set_config             = vdpasim_set_config,
        .get_generation         = vdpasim_get_generation,
+       .get_iova_range         = vdpasim_get_iova_range,
        .dma_map                = vdpasim_dma_map,
        .dma_unmap              = vdpasim_dma_unmap,
        .free                   = vdpasim_free,
@@ -683,6 +709,7 @@ static const struct vdpa_config_ops vdpasim_net_batch_config_ops = {
        .get_config             = vdpasim_get_config,
        .set_config             = vdpasim_set_config,
        .get_generation         = vdpasim_get_generation,
+       .get_iova_range         = vdpasim_get_iova_range,
        .set_map                = vdpasim_set_map,
        .free                   = vdpasim_free,
 };
index 0113a98..f27e251 100644 (file)
@@ -248,7 +248,9 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd,
                info.size = vdev->regions[info.index].size;
                info.flags = vdev->regions[info.index].flags;
 
-               return copy_to_user((void __user *)arg, &info, minsz);
+               if (copy_to_user((void __user *)arg, &info, minsz))
+                       return -EFAULT;
+               return 0;
        }
        case VFIO_DEVICE_GET_IRQ_INFO:
        {
@@ -267,7 +269,9 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd,
                info.flags = VFIO_IRQ_INFO_EVENTFD;
                info.count = 1;
 
-               return copy_to_user((void __user *)arg, &info, minsz);
+               if (copy_to_user((void __user *)arg, &info, minsz))
+                       return -EFAULT;
+               return 0;
        }
        case VFIO_DEVICE_SET_IRQS:
        {
@@ -468,7 +472,7 @@ static int vfio_fsl_mc_mmap(void *device_data, struct vm_area_struct *vma)
 {
        struct vfio_fsl_mc_device *vdev = device_data;
        struct fsl_mc_device *mc_dev = vdev->mc_dev;
-       int index;
+       unsigned int index;
 
        index = vma->vm_pgoff >> (VFIO_FSL_MC_OFFSET_SHIFT - PAGE_SHIFT);
 
index c80dceb..0d9f300 100644 (file)
@@ -13,7 +13,7 @@
 #include "linux/fsl/mc.h"
 #include "vfio_fsl_mc_private.h"
 
-int vfio_fsl_mc_irqs_allocate(struct vfio_fsl_mc_device *vdev)
+static int vfio_fsl_mc_irqs_allocate(struct vfio_fsl_mc_device *vdev)
 {
        struct fsl_mc_device *mc_dev = vdev->mc_dev;
        struct vfio_fsl_mc_irq *mc_irq;
index fbd2b34..e619017 100644 (file)
@@ -385,7 +385,7 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev)
            pdev->vendor == PCI_VENDOR_ID_INTEL &&
            IS_ENABLED(CONFIG_VFIO_PCI_IGD)) {
                ret = vfio_pci_igd_init(vdev);
-               if (ret) {
+               if (ret && ret != -ENODEV) {
                        pci_warn(pdev, "Failed to setup Intel IGD regions\n");
                        goto disable_exit;
                }
index 9e353c4..a0b5fc8 100644 (file)
@@ -356,34 +356,60 @@ ssize_t vfio_pci_vga_rw(struct vfio_pci_device *vdev, char __user *buf,
        return done;
 }
 
-static int vfio_pci_ioeventfd_handler(void *opaque, void *unused)
+static void vfio_pci_ioeventfd_do_write(struct vfio_pci_ioeventfd *ioeventfd,
+                                       bool test_mem)
 {
-       struct vfio_pci_ioeventfd *ioeventfd = opaque;
-
        switch (ioeventfd->count) {
        case 1:
-               vfio_pci_iowrite8(ioeventfd->vdev, ioeventfd->test_mem,
+               vfio_pci_iowrite8(ioeventfd->vdev, test_mem,
                                  ioeventfd->data, ioeventfd->addr);
                break;
        case 2:
-               vfio_pci_iowrite16(ioeventfd->vdev, ioeventfd->test_mem,
+               vfio_pci_iowrite16(ioeventfd->vdev, test_mem,
                                   ioeventfd->data, ioeventfd->addr);
                break;
        case 4:
-               vfio_pci_iowrite32(ioeventfd->vdev, ioeventfd->test_mem,
+               vfio_pci_iowrite32(ioeventfd->vdev, test_mem,
                                   ioeventfd->data, ioeventfd->addr);
                break;
 #ifdef iowrite64
        case 8:
-               vfio_pci_iowrite64(ioeventfd->vdev, ioeventfd->test_mem,
+               vfio_pci_iowrite64(ioeventfd->vdev, test_mem,
                                   ioeventfd->data, ioeventfd->addr);
                break;
 #endif
        }
+}
+
+static int vfio_pci_ioeventfd_handler(void *opaque, void *unused)
+{
+       struct vfio_pci_ioeventfd *ioeventfd = opaque;
+       struct vfio_pci_device *vdev = ioeventfd->vdev;
+
+       if (ioeventfd->test_mem) {
+               if (!down_read_trylock(&vdev->memory_lock))
+                       return 1; /* Lock contended, use thread */
+               if (!__vfio_pci_memory_enabled(vdev)) {
+                       up_read(&vdev->memory_lock);
+                       return 0;
+               }
+       }
+
+       vfio_pci_ioeventfd_do_write(ioeventfd, false);
+
+       if (ioeventfd->test_mem)
+               up_read(&vdev->memory_lock);
 
        return 0;
 }
 
+static void vfio_pci_ioeventfd_thread(void *opaque, void *unused)
+{
+       struct vfio_pci_ioeventfd *ioeventfd = opaque;
+
+       vfio_pci_ioeventfd_do_write(ioeventfd, ioeventfd->test_mem);
+}
+
 long vfio_pci_ioeventfd(struct vfio_pci_device *vdev, loff_t offset,
                        uint64_t data, int count, int fd)
 {
@@ -457,7 +483,8 @@ long vfio_pci_ioeventfd(struct vfio_pci_device *vdev, loff_t offset,
        ioeventfd->test_mem = vdev->pdev->resource[bar].flags & IORESOURCE_MEM;
 
        ret = vfio_virqfd_enable(ioeventfd, vfio_pci_ioeventfd_handler,
-                                NULL, NULL, &ioeventfd->virqfd, fd);
+                                vfio_pci_ioeventfd_thread, NULL,
+                                &ioeventfd->virqfd, fd);
        if (ret) {
                kfree(ioeventfd);
                goto out_unlock;
index c0771a9..fb4b385 100644 (file)
@@ -267,7 +267,7 @@ static int vfio_platform_open(void *device_data)
 
                ret = pm_runtime_get_sync(vdev->device);
                if (ret < 0)
-                       goto err_pm;
+                       goto err_rst;
 
                ret = vfio_platform_call_reset(vdev, &extra_dbg);
                if (ret && vdev->reset_required) {
@@ -284,7 +284,6 @@ static int vfio_platform_open(void *device_data)
 
 err_rst:
        pm_runtime_put(vdev->device);
-err_pm:
        vfio_platform_irq_cleanup(vdev);
 err_irq:
        vfio_platform_regions_cleanup(vdev);
index bb2684c..67e8276 100644 (file)
@@ -1993,6 +1993,7 @@ static void vfio_iommu_iova_insert_copy(struct vfio_iommu *iommu,
 
        list_splice_tail(iova_copy, iova);
 }
+
 static int vfio_iommu_type1_attach_group(void *iommu_data,
                                         struct iommu_group *iommu_group)
 {
@@ -2009,18 +2010,10 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
 
        mutex_lock(&iommu->lock);
 
-       list_for_each_entry(d, &iommu->domain_list, next) {
-               if (find_iommu_group(d, iommu_group)) {
-                       mutex_unlock(&iommu->lock);
-                       return -EINVAL;
-               }
-       }
-
-       if (iommu->external_domain) {
-               if (find_iommu_group(iommu->external_domain, iommu_group)) {
-                       mutex_unlock(&iommu->lock);
-                       return -EINVAL;
-               }
+       /* Check for duplicates */
+       if (vfio_iommu_find_iommu_group(iommu, iommu_group)) {
+               mutex_unlock(&iommu->lock);
+               return -EINVAL;
        }
 
        group = kzalloc(sizeof(*group), GFP_KERNEL);
index a2dbc85..2754f30 100644 (file)
@@ -47,6 +47,7 @@ struct vhost_vdpa {
        int minor;
        struct eventfd_ctx *config_ctx;
        int in_batch;
+       struct vdpa_iova_range range;
 };
 
 static DEFINE_IDA(vhost_vdpa_ida);
@@ -103,6 +104,9 @@ static void vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, u16 qid)
        vq->call_ctx.producer.token = vq->call_ctx.ctx;
        vq->call_ctx.producer.irq = irq;
        ret = irq_bypass_register_producer(&vq->call_ctx.producer);
+       if (unlikely(ret))
+               dev_info(&v->dev, "vq %u, irq bypass producer (token %p) registration fails, ret =  %d\n",
+                        qid, vq->call_ctx.producer.token, ret);
 }
 
 static void vhost_vdpa_unsetup_vq_irq(struct vhost_vdpa *v, u16 qid)
@@ -337,6 +341,16 @@ static long vhost_vdpa_set_config_call(struct vhost_vdpa *v, u32 __user *argp)
        return 0;
 }
 
+static long vhost_vdpa_get_iova_range(struct vhost_vdpa *v, u32 __user *argp)
+{
+       struct vhost_vdpa_iova_range range = {
+               .first = v->range.first,
+               .last = v->range.last,
+       };
+
+       return copy_to_user(argp, &range, sizeof(range));
+}
+
 static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
                                   void __user *argp)
 {
@@ -421,12 +435,11 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep,
        void __user *argp = (void __user *)arg;
        u64 __user *featurep = argp;
        u64 features;
-       long r;
+       long r = 0;
 
        if (cmd == VHOST_SET_BACKEND_FEATURES) {
-               r = copy_from_user(&features, featurep, sizeof(features));
-               if (r)
-                       return r;
+               if (copy_from_user(&features, featurep, sizeof(features)))
+                       return -EFAULT;
                if (features & ~VHOST_VDPA_BACKEND_FEATURES)
                        return -EOPNOTSUPP;
                vhost_set_backend_features(&v->vdev, features);
@@ -469,7 +482,11 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep,
                break;
        case VHOST_GET_BACKEND_FEATURES:
                features = VHOST_VDPA_BACKEND_FEATURES;
-               r = copy_to_user(featurep, &features, sizeof(features));
+               if (copy_to_user(featurep, &features, sizeof(features)))
+                       r = -EFAULT;
+               break;
+       case VHOST_VDPA_GET_IOVA_RANGE:
+               r = vhost_vdpa_get_iova_range(v, argp);
                break;
        default:
                r = vhost_dev_ioctl(&v->vdev, cmd, argp);
@@ -588,19 +605,25 @@ static int vhost_vdpa_process_iotlb_update(struct vhost_vdpa *v,
        struct vhost_dev *dev = &v->vdev;
        struct vhost_iotlb *iotlb = dev->iotlb;
        struct page **page_list;
-       struct vm_area_struct **vmas;
+       unsigned long list_size = PAGE_SIZE / sizeof(struct page *);
        unsigned int gup_flags = FOLL_LONGTERM;
-       unsigned long map_pfn, last_pfn = 0;
-       unsigned long npages, lock_limit;
-       unsigned long i, nmap = 0;
+       unsigned long npages, cur_base, map_pfn, last_pfn = 0;
+       unsigned long locked, lock_limit, pinned, i;
        u64 iova = msg->iova;
-       long pinned;
        int ret = 0;
 
+       if (msg->iova < v->range.first ||
+           msg->iova + msg->size - 1 > v->range.last)
+               return -EINVAL;
+
        if (vhost_iotlb_itree_first(iotlb, msg->iova,
                                    msg->iova + msg->size - 1))
                return -EEXIST;
 
+       page_list = (struct page **) __get_free_page(GFP_KERNEL);
+       if (!page_list)
+               return -ENOMEM;
+
        if (msg->perm & VHOST_ACCESS_WO)
                gup_flags |= FOLL_WRITE;
 
@@ -608,86 +631,61 @@ static int vhost_vdpa_process_iotlb_update(struct vhost_vdpa *v,
        if (!npages)
                return -EINVAL;
 
-       page_list = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
-       vmas = kvmalloc_array(npages, sizeof(struct vm_area_struct *),
-                             GFP_KERNEL);
-       if (!page_list || !vmas) {
-               ret = -ENOMEM;
-               goto free;
-       }
-
        mmap_read_lock(dev->mm);
 
+       locked = atomic64_add_return(npages, &dev->mm->pinned_vm);
        lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
-       if (npages + atomic64_read(&dev->mm->pinned_vm) > lock_limit) {
-               ret = -ENOMEM;
-               goto unlock;
-       }
 
-       pinned = pin_user_pages(msg->uaddr & PAGE_MASK, npages, gup_flags,
-                               page_list, vmas);
-       if (npages != pinned) {
-               if (pinned < 0) {
-                       ret = pinned;
-               } else {
-                       unpin_user_pages(page_list, pinned);
-                       ret = -ENOMEM;
-               }
-               goto unlock;
+       if (locked > lock_limit) {
+               ret = -ENOMEM;
+               goto out;
        }
 
+       cur_base = msg->uaddr & PAGE_MASK;
        iova &= PAGE_MASK;
-       map_pfn = page_to_pfn(page_list[0]);
-
-       /* One more iteration to avoid extra vdpa_map() call out of loop. */
-       for (i = 0; i <= npages; i++) {
-               unsigned long this_pfn;
-               u64 csize;
-
-               /* The last chunk may have no valid PFN next to it */
-               this_pfn = i < npages ? page_to_pfn(page_list[i]) : -1UL;
-
-               if (last_pfn && (this_pfn == -1UL ||
-                                this_pfn != last_pfn + 1)) {
-                       /* Pin a contiguous chunk of memory */
-                       csize = last_pfn - map_pfn + 1;
-                       ret = vhost_vdpa_map(v, iova, csize << PAGE_SHIFT,
-                                            map_pfn << PAGE_SHIFT,
-                                            msg->perm);
-                       if (ret) {
-                               /*
-                                * Unpin the rest chunks of memory on the
-                                * flight with no corresponding vdpa_map()
-                                * calls having been made yet. On the other
-                                * hand, vdpa_unmap() in the failure path
-                                * is in charge of accounting the number of
-                                * pinned pages for its own.
-                                * This asymmetrical pattern of accounting
-                                * is for efficiency to pin all pages at
-                                * once, while there is no other callsite
-                                * of vdpa_map() than here above.
-                                */
-                               unpin_user_pages(&page_list[nmap],
-                                                npages - nmap);
-                               goto out;
+
+       while (npages) {
+               pinned = min_t(unsigned long, npages, list_size);
+               ret = pin_user_pages(cur_base, pinned,
+                                    gup_flags, page_list, NULL);
+               if (ret != pinned)
+                       goto out;
+
+               if (!last_pfn)
+                       map_pfn = page_to_pfn(page_list[0]);
+
+               for (i = 0; i < ret; i++) {
+                       unsigned long this_pfn = page_to_pfn(page_list[i]);
+                       u64 csize;
+
+                       if (last_pfn && (this_pfn != last_pfn + 1)) {
+                               /* Pin a contiguous chunk of memory */
+                               csize = (last_pfn - map_pfn + 1) << PAGE_SHIFT;
+                               if (vhost_vdpa_map(v, iova, csize,
+                                                  map_pfn << PAGE_SHIFT,
+                                                  msg->perm))
+                                       goto out;
+                               map_pfn = this_pfn;
+                               iova += csize;
                        }
-                       atomic64_add(csize, &dev->mm->pinned_vm);
-                       nmap += csize;
-                       iova += csize << PAGE_SHIFT;
-                       map_pfn = this_pfn;
+
+                       last_pfn = this_pfn;
                }
-               last_pfn = this_pfn;
+
+               cur_base += ret << PAGE_SHIFT;
+               npages -= ret;
        }
 
-       WARN_ON(nmap != npages);
+       /* Pin the rest chunk */
+       ret = vhost_vdpa_map(v, iova, (last_pfn - map_pfn + 1) << PAGE_SHIFT,
+                            map_pfn << PAGE_SHIFT, msg->perm);
 out:
-       if (ret)
+       if (ret) {
                vhost_vdpa_unmap(v, msg->iova, msg->size);
-unlock:
+               atomic64_sub(npages, &dev->mm->pinned_vm);
+       }
        mmap_read_unlock(dev->mm);
-free:
-       kvfree(vmas);
-       kvfree(page_list);
+       free_page((unsigned long)page_list);
        return ret;
 }
 
@@ -783,6 +781,27 @@ static void vhost_vdpa_free_domain(struct vhost_vdpa *v)
        v->domain = NULL;
 }
 
+static void vhost_vdpa_set_iova_range(struct vhost_vdpa *v)
+{
+       struct vdpa_iova_range *range = &v->range;
+       struct iommu_domain_geometry geo;
+       struct vdpa_device *vdpa = v->vdpa;
+       const struct vdpa_config_ops *ops = vdpa->config;
+
+       if (ops->get_iova_range) {
+               *range = ops->get_iova_range(vdpa);
+       } else if (v->domain &&
+                  !iommu_domain_get_attr(v->domain,
+                  DOMAIN_ATTR_GEOMETRY, &geo) &&
+                  geo.force_aperture) {
+               range->first = geo.aperture_start;
+               range->last = geo.aperture_end;
+       } else {
+               range->first = 0;
+               range->last = ULLONG_MAX;
+       }
+}
+
 static int vhost_vdpa_open(struct inode *inode, struct file *filep)
 {
        struct vhost_vdpa *v;
@@ -823,6 +842,8 @@ static int vhost_vdpa_open(struct inode *inode, struct file *filep)
        if (r)
                goto err_init_iotlb;
 
+       vhost_vdpa_set_iova_range(v);
+
        filep->private_data = v;
 
        return 0;
index 02411d8..e36fb1a 100644 (file)
@@ -1114,8 +1114,15 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
 getmem_done:
        remove_conflicting_framebuffers(info->apertures,
                                        KBUILD_MODNAME, false);
-       if (!gen2vm)
+
+       if (gen2vm) {
+               /* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */
+               screen_info.lfb_size = 0;
+               screen_info.lfb_base = 0;
+               screen_info.orig_video_isVGA = 0;
+       } else {
                pci_dev_put(pdev);
+       }
        kfree(info->apertures);
 
        return 0;
similarity index 84%
rename from arch/arm/mach-s3c24xx/include/mach/regs-lcd.h
rename to drivers/video/fbdev/s3c2410fb-regs-lcd.h
index 4c3434f..1e46f7a 100644 (file)
@@ -7,6 +7,13 @@
 #ifndef ___ASM_ARCH_REGS_LCD_H
 #define ___ASM_ARCH_REGS_LCD_H
 
+/*
+ * a couple of values are used as platform data in
+ * include/linux/platform_data/fb-s3c2410.h and not
+ * duplicated here.
+ */
+#include <linux/platform_data/fb-s3c2410.h>
+
 #define S3C2410_LCDREG(x)      (x)
 
 /* LCD control registers */
 #define S3C2410_LCDCON1_STN8BPP           (3<<1)
 #define S3C2410_LCDCON1_STN12BPP   (4<<1)
 
-#define S3C2410_LCDCON1_TFT1BPP           (8<<1)
-#define S3C2410_LCDCON1_TFT2BPP           (9<<1)
-#define S3C2410_LCDCON1_TFT4BPP           (10<<1)
-#define S3C2410_LCDCON1_TFT8BPP           (11<<1)
-#define S3C2410_LCDCON1_TFT16BPP   (12<<1)
-#define S3C2410_LCDCON1_TFT24BPP   (13<<1)
-
 #define S3C2410_LCDCON1_ENVID     (1)
 
 #define S3C2410_LCDCON1_MODEMASK    0x1E
 
 #define S3C2410_LCDCON4_GET_HSPW(x) ( ((x) >>  0) & 0xFF)
 
-#define S3C2410_LCDCON5_BPP24BL            (1<<12)
-#define S3C2410_LCDCON5_FRM565     (1<<11)
-#define S3C2410_LCDCON5_INVVCLK            (1<<10)
-#define S3C2410_LCDCON5_INVVLINE    (1<<9)
-#define S3C2410_LCDCON5_INVVFRAME   (1<<8)
-#define S3C2410_LCDCON5_INVVD      (1<<7)
-#define S3C2410_LCDCON5_INVVDEN            (1<<6)
-#define S3C2410_LCDCON5_INVPWREN    (1<<5)
-#define S3C2410_LCDCON5_INVLEND            (1<<4)
-#define S3C2410_LCDCON5_PWREN      (1<<3)
-#define S3C2410_LCDCON5_ENLEND     (1<<2)
-#define S3C2410_LCDCON5_BSWP       (1<<1)
-#define S3C2410_LCDCON5_HWSWP      (1<<0)
-
 /* framebuffer start addressed */
 #define S3C2410_LCDSADDR1   S3C2410_LCDREG(0x14)
 #define S3C2410_LCDSADDR2   S3C2410_LCDREG(0x18)
index 6f8fa50..d8ae525 100644 (file)
 #include <linux/clk.h>
 #include <linux/cpufreq.h>
 #include <linux/io.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
 #include <asm/div64.h>
 
 #include <asm/mach/map.h>
-#include <mach/regs-lcd.h>
-#include <mach/regs-gpio.h>
-#include <mach/fb.h>
 
 #ifdef CONFIG_PM
 #include <linux/pm.h>
 #endif
 
 #include "s3c2410fb.h"
+#include "s3c2410fb-regs-lcd.h"
 
 /* Debugging stuff */
 static int debug = IS_BUILTIN(CONFIG_FB_S3C2410_DEBUG);
@@ -672,6 +671,9 @@ static inline void modify_gpio(void __iomem *reg,
 {
        unsigned long tmp;
 
+       if (!reg)
+               return;
+
        tmp = readl(reg) & ~mask;
        writel(tmp | set, reg);
 }
@@ -702,10 +704,10 @@ static int s3c2410fb_init_registers(struct fb_info *info)
 
        /* modify the gpio(s) with interrupts set (bjd) */
 
-       modify_gpio(S3C2410_GPCUP,  mach_info->gpcup,  mach_info->gpcup_mask);
-       modify_gpio(S3C2410_GPCCON, mach_info->gpccon, mach_info->gpccon_mask);
-       modify_gpio(S3C2410_GPDUP,  mach_info->gpdup,  mach_info->gpdup_mask);
-       modify_gpio(S3C2410_GPDCON, mach_info->gpdcon, mach_info->gpdcon_mask);
+       modify_gpio(mach_info->gpcup_reg,  mach_info->gpcup,  mach_info->gpcup_mask);
+       modify_gpio(mach_info->gpccon_reg, mach_info->gpccon, mach_info->gpccon_mask);
+       modify_gpio(mach_info->gpdup_reg,  mach_info->gpdup,  mach_info->gpdup_mask);
+       modify_gpio(mach_info->gpdcon_reg, mach_info->gpdcon, mach_info->gpdcon_mask);
 
        local_irq_restore(flags);
 
index 21865e2..fd79686 100644 (file)
@@ -489,16 +489,10 @@ config IXP4XX_WATCHDOG
 
          Say N if you are unsure.
 
-config HAVE_S3C2410_WATCHDOG
-       bool
-       help
-         This will include watchdog timer support for Samsung SoCs. If
-         you want to include watchdog support for any machine, kindly
-         select this in the respective mach-XXXX/Kconfig file.
-
 config S3C2410_WATCHDOG
        tristate "S3C2410 Watchdog"
-       depends on HAVE_S3C2410_WATCHDOG || COMPILE_TEST
+       depends on ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 || ARCH_EXYNOS || \
+                  COMPILE_TEST
        select WATCHDOG_CORE
        select MFD_SYSCON if ARCH_EXYNOS
        help
index fe5ad0e..da87f3a 100644 (file)
@@ -47,10 +47,11 @@ static unsigned evtchn_2l_max_channels(void)
        return EVTCHN_2L_NR_CHANNELS;
 }
 
-static void evtchn_2l_bind_to_cpu(struct irq_info *info, unsigned cpu)
+static void evtchn_2l_bind_to_cpu(evtchn_port_t evtchn, unsigned int cpu,
+                                 unsigned int old_cpu)
 {
-       clear_bit(info->evtchn, BM(per_cpu(cpu_evtchn_mask, info->cpu)));
-       set_bit(info->evtchn, BM(per_cpu(cpu_evtchn_mask, cpu)));
+       clear_bit(evtchn, BM(per_cpu(cpu_evtchn_mask, old_cpu)));
+       set_bit(evtchn, BM(per_cpu(cpu_evtchn_mask, cpu)));
 }
 
 static void evtchn_2l_clear_pending(evtchn_port_t port)
index cc31773..6038c4c 100644 (file)
 #undef MODULE_PARAM_PREFIX
 #define MODULE_PARAM_PREFIX "xen."
 
+/* Interrupt types. */
+enum xen_irq_type {
+       IRQT_UNBOUND = 0,
+       IRQT_PIRQ,
+       IRQT_VIRQ,
+       IRQT_IPI,
+       IRQT_EVTCHN
+};
+
+/*
+ * Packed IRQ information:
+ * type - enum xen_irq_type
+ * event channel - irq->event channel mapping
+ * cpu - cpu this event channel is bound to
+ * index - type-specific information:
+ *    PIRQ - vector, with MSB being "needs EIO", or physical IRQ of the HVM
+ *           guest, or GSI (real passthrough IRQ) of the device.
+ *    VIRQ - virq number
+ *    IPI - IPI vector
+ *    EVTCHN -
+ */
+struct irq_info {
+       struct list_head list;
+       struct list_head eoi_list;
+       short refcnt;
+       short spurious_cnt;
+       enum xen_irq_type type; /* type */
+       unsigned irq;
+       evtchn_port_t evtchn;   /* event channel */
+       unsigned short cpu;     /* cpu bound */
+       unsigned short eoi_cpu; /* EOI must happen on this cpu-1 */
+       unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */
+       u64 eoi_time;           /* Time in jiffies when to EOI. */
+
+       union {
+               unsigned short virq;
+               enum ipi_vector ipi;
+               struct {
+                       unsigned short pirq;
+                       unsigned short gsi;
+                       unsigned char vector;
+                       unsigned char flags;
+                       uint16_t domid;
+               } pirq;
+       } u;
+};
+
+#define PIRQ_NEEDS_EOI (1 << 0)
+#define PIRQ_SHAREABLE (1 << 1)
+#define PIRQ_MSI_GROUP (1 << 2)
+
 static uint __read_mostly event_loop_timeout = 2;
 module_param(event_loop_timeout, uint, 0644);
 
@@ -110,7 +161,7 @@ static DEFINE_PER_CPU(int [NR_VIRQS], virq_to_irq) = {[0 ... NR_VIRQS-1] = -1};
 /* IRQ <-> IPI mapping */
 static DEFINE_PER_CPU(int [XEN_NR_IPIS], ipi_to_irq) = {[0 ... XEN_NR_IPIS-1] = -1};
 
-int **evtchn_to_irq;
+static int **evtchn_to_irq;
 #ifdef CONFIG_X86
 static unsigned long *pirq_eoi_map;
 #endif
@@ -190,7 +241,7 @@ int get_evtchn_to_irq(evtchn_port_t evtchn)
 }
 
 /* Get info for IRQ */
-struct irq_info *info_for_irq(unsigned irq)
+static struct irq_info *info_for_irq(unsigned irq)
 {
        if (irq < nr_legacy_irqs())
                return legacy_info_ptrs[irq];
@@ -228,7 +279,7 @@ static int xen_irq_info_common_setup(struct irq_info *info,
 
        irq_clear_status_flags(irq, IRQ_NOREQUEST|IRQ_NOAUTOEN);
 
-       return xen_evtchn_port_setup(info);
+       return xen_evtchn_port_setup(evtchn);
 }
 
 static int xen_irq_info_evtchn_setup(unsigned irq,
@@ -351,7 +402,7 @@ static enum xen_irq_type type_from_irq(unsigned irq)
        return info_for_irq(irq)->type;
 }
 
-unsigned cpu_from_irq(unsigned irq)
+static unsigned cpu_from_irq(unsigned irq)
 {
        return info_for_irq(irq)->cpu;
 }
@@ -391,7 +442,7 @@ static void bind_evtchn_to_cpu(evtchn_port_t evtchn, unsigned int cpu)
 #ifdef CONFIG_SMP
        cpumask_copy(irq_get_affinity_mask(irq), cpumask_of(cpu));
 #endif
-       xen_evtchn_port_bind_to_cpu(info, cpu);
+       xen_evtchn_port_bind_to_cpu(evtchn, cpu, info->cpu);
 
        info->cpu = cpu;
 }
@@ -745,7 +796,7 @@ static unsigned int __startup_pirq(unsigned int irq)
        info->evtchn = evtchn;
        bind_evtchn_to_cpu(evtchn, 0);
 
-       rc = xen_evtchn_port_setup(info);
+       rc = xen_evtchn_port_setup(evtchn);
        if (rc)
                goto err;
 
@@ -1145,14 +1196,6 @@ static int bind_interdomain_evtchn_to_irq_chip(unsigned int remote_domain,
                                               chip);
 }
 
-int bind_interdomain_evtchn_to_irq(unsigned int remote_domain,
-                                  evtchn_port_t remote_port)
-{
-       return bind_interdomain_evtchn_to_irq_chip(remote_domain, remote_port,
-                                                  &xen_dynamic_chip);
-}
-EXPORT_SYMBOL_GPL(bind_interdomain_evtchn_to_irq);
-
 int bind_interdomain_evtchn_to_irq_lateeoi(unsigned int remote_domain,
                                           evtchn_port_t remote_port)
 {
@@ -1320,19 +1363,6 @@ static int bind_interdomain_evtchn_to_irqhandler_chip(
        return irq;
 }
 
-int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain,
-                                         evtchn_port_t remote_port,
-                                         irq_handler_t handler,
-                                         unsigned long irqflags,
-                                         const char *devname,
-                                         void *dev_id)
-{
-       return bind_interdomain_evtchn_to_irqhandler_chip(remote_domain,
-                               remote_port, handler, irqflags, devname,
-                               dev_id, &xen_dynamic_chip);
-}
-EXPORT_SYMBOL_GPL(bind_interdomain_evtchn_to_irqhandler);
-
 int bind_interdomain_evtchn_to_irqhandler_lateeoi(unsigned int remote_domain,
                                                  evtchn_port_t remote_port,
                                                  irq_handler_t handler,
@@ -2020,8 +2050,8 @@ void xen_setup_callback_vector(void) {}
 static inline void xen_alloc_callback_vector(void) {}
 #endif
 
-static bool fifo_events = true;
-module_param(fifo_events, bool, 0);
+bool xen_fifo_events = true;
+module_param_named(fifo_events, xen_fifo_events, bool, 0);
 
 static int xen_evtchn_cpu_prepare(unsigned int cpu)
 {
@@ -2050,10 +2080,12 @@ void __init xen_init_IRQ(void)
        int ret = -EINVAL;
        evtchn_port_t evtchn;
 
-       if (fifo_events)
+       if (xen_fifo_events)
                ret = xen_evtchn_fifo_init();
-       if (ret < 0)
+       if (ret < 0) {
                xen_evtchn_2l_init();
+               xen_fifo_events = false;
+       }
 
        xen_cpu_init_eoi(smp_processor_id());
 
index 6085a80..b234f17 100644 (file)
@@ -138,9 +138,8 @@ static void init_array_page(event_word_t *array_page)
                array_page[i] = 1 << EVTCHN_FIFO_MASKED;
 }
 
-static int evtchn_fifo_setup(struct irq_info *info)
+static int evtchn_fifo_setup(evtchn_port_t port)
 {
-       evtchn_port_t port = info->evtchn;
        unsigned new_array_pages;
        int ret;
 
@@ -186,7 +185,8 @@ static int evtchn_fifo_setup(struct irq_info *info)
        return ret;
 }
 
-static void evtchn_fifo_bind_to_cpu(struct irq_info *info, unsigned cpu)
+static void evtchn_fifo_bind_to_cpu(evtchn_port_t evtchn, unsigned int cpu, 
+                                   unsigned int old_cpu)
 {
        /* no-op */
 }
@@ -237,6 +237,9 @@ static bool clear_masked_cond(volatile event_word_t *word)
        w = *word;
 
        do {
+               if (!(w & (1 << EVTCHN_FIFO_MASKED)))
+                       return true;
+
                if (w & (1 << EVTCHN_FIFO_PENDING))
                        return false;
 
index 82937d9..0a97c05 100644 (file)
@@ -7,65 +7,15 @@
 #ifndef __EVENTS_INTERNAL_H__
 #define __EVENTS_INTERNAL_H__
 
-/* Interrupt types. */
-enum xen_irq_type {
-       IRQT_UNBOUND = 0,
-       IRQT_PIRQ,
-       IRQT_VIRQ,
-       IRQT_IPI,
-       IRQT_EVTCHN
-};
-
-/*
- * Packed IRQ information:
- * type - enum xen_irq_type
- * event channel - irq->event channel mapping
- * cpu - cpu this event channel is bound to
- * index - type-specific information:
- *    PIRQ - vector, with MSB being "needs EIO", or physical IRQ of the HVM
- *           guest, or GSI (real passthrough IRQ) of the device.
- *    VIRQ - virq number
- *    IPI - IPI vector
- *    EVTCHN -
- */
-struct irq_info {
-       struct list_head list;
-       struct list_head eoi_list;
-       short refcnt;
-       short spurious_cnt;
-       enum xen_irq_type type; /* type */
-       unsigned irq;
-       evtchn_port_t evtchn;   /* event channel */
-       unsigned short cpu;     /* cpu bound */
-       unsigned short eoi_cpu; /* EOI must happen on this cpu */
-       unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */
-       u64 eoi_time;           /* Time in jiffies when to EOI. */
-
-       union {
-               unsigned short virq;
-               enum ipi_vector ipi;
-               struct {
-                       unsigned short pirq;
-                       unsigned short gsi;
-                       unsigned char vector;
-                       unsigned char flags;
-                       uint16_t domid;
-               } pirq;
-       } u;
-};
-
-#define PIRQ_NEEDS_EOI (1 << 0)
-#define PIRQ_SHAREABLE (1 << 1)
-#define PIRQ_MSI_GROUP (1 << 2)
-
 struct evtchn_loop_ctrl;
 
 struct evtchn_ops {
        unsigned (*max_channels)(void);
        unsigned (*nr_channels)(void);
 
-       int (*setup)(struct irq_info *info);
-       void (*bind_to_cpu)(struct irq_info *info, unsigned cpu);
+       int (*setup)(evtchn_port_t port);
+       void (*bind_to_cpu)(evtchn_port_t evtchn, unsigned int cpu,
+                           unsigned int old_cpu);
 
        void (*clear_pending)(evtchn_port_t port);
        void (*set_pending)(evtchn_port_t port);
@@ -83,12 +33,9 @@ struct evtchn_ops {
 
 extern const struct evtchn_ops *evtchn_ops;
 
-extern int **evtchn_to_irq;
 int get_evtchn_to_irq(evtchn_port_t evtchn);
 void handle_irq_for_port(evtchn_port_t port, struct evtchn_loop_ctrl *ctrl);
 
-struct irq_info *info_for_irq(unsigned irq);
-unsigned cpu_from_irq(unsigned irq);
 unsigned int cpu_from_evtchn(evtchn_port_t evtchn);
 
 static inline unsigned xen_evtchn_max_channels(void)
@@ -100,17 +47,18 @@ static inline unsigned xen_evtchn_max_channels(void)
  * Do any ABI specific setup for a bound event channel before it can
  * be unmasked and used.
  */
-static inline int xen_evtchn_port_setup(struct irq_info *info)
+static inline int xen_evtchn_port_setup(evtchn_port_t evtchn)
 {
        if (evtchn_ops->setup)
-               return evtchn_ops->setup(info);
+               return evtchn_ops->setup(evtchn);
        return 0;
 }
 
-static inline void xen_evtchn_port_bind_to_cpu(struct irq_info *info,
-                                              unsigned cpu)
+static inline void xen_evtchn_port_bind_to_cpu(evtchn_port_t evtchn,
+                                              unsigned int cpu,
+                                              unsigned int old_cpu)
 {
-       evtchn_ops->bind_to_cpu(info, cpu);
+       evtchn_ops->bind_to_cpu(evtchn, cpu, old_cpu);
 }
 
 static inline void clear_evtchn(evtchn_port_t port)
index 71ce1b7..2b385c1 100644 (file)
@@ -395,8 +395,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
         */
        trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force);
 
-       map = swiotlb_tbl_map_single(dev, virt_to_phys(xen_io_tlb_start),
-                                    phys, size, size, dir, attrs);
+       map = swiotlb_tbl_map_single(dev, phys, size, size, dir, attrs);
        if (map == (phys_addr_t)DMA_MAPPING_ERROR)
                return DMA_MAPPING_ERROR;
 
index e34fa20..9a21269 100644 (file)
@@ -260,8 +260,7 @@ static int v9fs_statfs(struct dentry *dentry, struct kstatfs *buf)
                        buf->f_bavail = rs.bavail;
                        buf->f_files = rs.files;
                        buf->f_ffree = rs.ffree;
-                       buf->f_fsid.val[0] = rs.fsid & 0xFFFFFFFFUL;
-                       buf->f_fsid.val[1] = (rs.fsid >> 32) & 0xFFFFFFFFUL;
+                       buf->f_fsid = u64_to_fsid(rs.fsid);
                        buf->f_namelen = rs.namelen;
                }
                if (res != -ENOSYS)
index d553bb5..bdbd26e 100644 (file)
@@ -210,8 +210,7 @@ static int adfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_namelen = sbi->s_namelen;
        buf->f_bsize   = sb->s_blocksize;
        buf->f_ffree   = (long)(buf->f_bfree * buf->f_files) / (long)buf->f_blocks;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid    = u64_to_fsid(id);
 
        return 0;
 }
index a100cd9..c6c2a51 100644 (file)
@@ -620,8 +620,7 @@ affs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_blocks  = AFFS_SB(sb)->s_partition_size - AFFS_SB(sb)->s_reserved;
        buf->f_bfree   = free;
        buf->f_bavail  = free;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid    = u64_to_fsid(id);
        buf->f_namelen = AFFSNAMEMAX;
        return 0;
 }
index 52233fa..887b673 100644 (file)
@@ -589,7 +589,7 @@ struct afs_cell *afs_use_cell(struct afs_cell *cell, enum afs_cell_trace reason)
  */
 void afs_unuse_cell(struct afs_net *net, struct afs_cell *cell, enum afs_cell_trace reason)
 {
-       unsigned int debug_id = cell->debug_id;
+       unsigned int debug_id;
        time64_t now, expire_delay;
        int u, a;
 
@@ -604,6 +604,7 @@ void afs_unuse_cell(struct afs_net *net, struct afs_cell *cell, enum afs_cell_tr
        if (cell->vl_servers->nr_servers)
                expire_delay = afs_cell_gc_delay;
 
+       debug_id = cell->debug_id;
        u = atomic_read(&cell->ref);
        a = atomic_dec_return(&cell->active);
        trace_afs_cell(debug_id, u, a, reason);
index 1d2e61e..1bb5b9d 100644 (file)
@@ -281,8 +281,7 @@ retry:
                        if (ret < 0)
                                goto error;
 
-                       set_page_private(req->pages[i], 1);
-                       SetPagePrivate(req->pages[i]);
+                       attach_page_private(req->pages[i], (void *)1);
                        unlock_page(req->pages[i]);
                        i++;
                } else {
@@ -1975,8 +1974,7 @@ static int afs_dir_releasepage(struct page *page, gfp_t gfp_flags)
 
        _enter("{{%llx:%llu}[%lu]}", dvnode->fid.vid, dvnode->fid.vnode, page->index);
 
-       set_page_private(page, 0);
-       ClearPagePrivate(page);
+       detach_page_private(page);
 
        /* The directory will need reloading. */
        if (test_and_clear_bit(AFS_VNODE_DIR_VALID, &dvnode->flags))
@@ -2003,8 +2001,6 @@ static void afs_dir_invalidatepage(struct page *page, unsigned int offset,
                afs_stat_v(dvnode, n_inval);
 
        /* we clean up only if the entire page is being invalidated */
-       if (offset == 0 && length == PAGE_SIZE) {
-               set_page_private(page, 0);
-               ClearPagePrivate(page);
-       }
+       if (offset == 0 && length == PAGE_SIZE)
+               detach_page_private(page);
 }
index b108528..2ffe09a 100644 (file)
@@ -243,10 +243,8 @@ void afs_edit_dir_add(struct afs_vnode *vnode,
                                                   index, gfp);
                        if (!page)
                                goto error;
-                       if (!PagePrivate(page)) {
-                               set_page_private(page, 1);
-                               SetPagePrivate(page);
-                       }
+                       if (!PagePrivate(page))
+                               attach_page_private(page, (void *)1);
                        dir_page = kmap(page);
                }
 
index 371d148..85f5adf 100644 (file)
@@ -33,6 +33,7 @@ const struct file_operations afs_file_operations = {
        .write_iter     = afs_file_write,
        .mmap           = afs_file_mmap,
        .splice_read    = generic_file_splice_read,
+       .splice_write   = iter_file_splice_write,
        .fsync          = afs_fsync,
        .lock           = afs_lock,
        .flock          = afs_flock,
@@ -601,6 +602,63 @@ static int afs_readpages(struct file *file, struct address_space *mapping,
 }
 
 /*
+ * Adjust the dirty region of the page on truncation or full invalidation,
+ * getting rid of the markers altogether if the region is entirely invalidated.
+ */
+static void afs_invalidate_dirty(struct page *page, unsigned int offset,
+                                unsigned int length)
+{
+       struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
+       unsigned long priv;
+       unsigned int f, t, end = offset + length;
+
+       priv = page_private(page);
+
+       /* we clean up only if the entire page is being invalidated */
+       if (offset == 0 && length == thp_size(page))
+               goto full_invalidate;
+
+        /* If the page was dirtied by page_mkwrite(), the PTE stays writable
+         * and we don't get another notification to tell us to expand it
+         * again.
+         */
+       if (afs_is_page_dirty_mmapped(priv))
+               return;
+
+       /* We may need to shorten the dirty region */
+       f = afs_page_dirty_from(priv);
+       t = afs_page_dirty_to(priv);
+
+       if (t <= offset || f >= end)
+               return; /* Doesn't overlap */
+
+       if (f < offset && t > end)
+               return; /* Splits the dirty region - just absorb it */
+
+       if (f >= offset && t <= end)
+               goto undirty;
+
+       if (f < offset)
+               t = offset;
+       else
+               f = end;
+       if (f == t)
+               goto undirty;
+
+       priv = afs_page_dirty(f, t);
+       set_page_private(page, priv);
+       trace_afs_page_dirty(vnode, tracepoint_string("trunc"), page->index, priv);
+       return;
+
+undirty:
+       trace_afs_page_dirty(vnode, tracepoint_string("undirty"), page->index, priv);
+       clear_page_dirty_for_io(page);
+full_invalidate:
+       priv = (unsigned long)detach_page_private(page);
+       trace_afs_page_dirty(vnode, tracepoint_string("inval"), page->index, priv);
+}
+
+/*
  * invalidate part or all of a page
  * - release a page and clean up its private data if offset is 0 (indicating
  *   the entire page)
@@ -608,31 +666,23 @@ static int afs_readpages(struct file *file, struct address_space *mapping,
 static void afs_invalidatepage(struct page *page, unsigned int offset,
                               unsigned int length)
 {
-       struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
-       unsigned long priv;
-
        _enter("{%lu},%u,%u", page->index, offset, length);
 
        BUG_ON(!PageLocked(page));
 
+#ifdef CONFIG_AFS_FSCACHE
        /* we clean up only if the entire page is being invalidated */
        if (offset == 0 && length == PAGE_SIZE) {
-#ifdef CONFIG_AFS_FSCACHE
                if (PageFsCache(page)) {
                        struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
                        fscache_wait_on_page_write(vnode->cache, page);
                        fscache_uncache_page(vnode->cache, page);
                }
+       }
 #endif
 
-               if (PagePrivate(page)) {
-                       priv = page_private(page);
-                       trace_afs_page_dirty(vnode, tracepoint_string("inval"),
-                                            page->index, priv);
-                       set_page_private(page, 0);
-                       ClearPagePrivate(page);
-               }
-       }
+       if (PagePrivate(page))
+               afs_invalidate_dirty(page, offset, length);
 
        _leave("");
 }
@@ -660,11 +710,9 @@ static int afs_releasepage(struct page *page, gfp_t gfp_flags)
 #endif
 
        if (PagePrivate(page)) {
-               priv = page_private(page);
+               priv = (unsigned long)detach_page_private(page);
                trace_afs_page_dirty(vnode, tracepoint_string("rel"),
                                     page->index, priv);
-               set_page_private(page, 0);
-               ClearPagePrivate(page);
        }
 
        /* indicate that the page can be released */
index 81b0485..14d5d75 100644 (file)
@@ -812,6 +812,7 @@ struct afs_operation {
                        pgoff_t         last;           /* last page in mapping to deal with */
                        unsigned        first_offset;   /* offset into mapping[first] */
                        unsigned        last_to;        /* amount of mapping[last] */
+                       bool            laundering;     /* Laundering page, PG_writeback not set */
                } store;
                struct {
                        struct iattr    *attr;
@@ -857,6 +858,62 @@ struct afs_vnode_cache_aux {
        u64                     data_version;
 } __packed;
 
+/*
+ * We use page->private to hold the amount of the page that we've written to,
+ * splitting the field into two parts.  However, we need to represent a range
+ * 0...PAGE_SIZE, so we reduce the resolution if the size of the page
+ * exceeds what we can encode.
+ */
+#ifdef CONFIG_64BIT
+#define __AFS_PAGE_PRIV_MASK   0x7fffffffUL
+#define __AFS_PAGE_PRIV_SHIFT  32
+#define __AFS_PAGE_PRIV_MMAPPED        0x80000000UL
+#else
+#define __AFS_PAGE_PRIV_MASK   0x7fffUL
+#define __AFS_PAGE_PRIV_SHIFT  16
+#define __AFS_PAGE_PRIV_MMAPPED        0x8000UL
+#endif
+
+static inline unsigned int afs_page_dirty_resolution(void)
+{
+       int shift = PAGE_SHIFT - (__AFS_PAGE_PRIV_SHIFT - 1);
+       return (shift > 0) ? shift : 0;
+}
+
+static inline size_t afs_page_dirty_from(unsigned long priv)
+{
+       unsigned long x = priv & __AFS_PAGE_PRIV_MASK;
+
+       /* The lower bound is inclusive */
+       return x << afs_page_dirty_resolution();
+}
+
+static inline size_t afs_page_dirty_to(unsigned long priv)
+{
+       unsigned long x = (priv >> __AFS_PAGE_PRIV_SHIFT) & __AFS_PAGE_PRIV_MASK;
+
+       /* The upper bound is immediately beyond the region */
+       return (x + 1) << afs_page_dirty_resolution();
+}
+
+static inline unsigned long afs_page_dirty(size_t from, size_t to)
+{
+       unsigned int res = afs_page_dirty_resolution();
+       from >>= res;
+       to = (to - 1) >> res;
+       return (to << __AFS_PAGE_PRIV_SHIFT) | from;
+}
+
+static inline unsigned long afs_page_dirty_mmapped(unsigned long priv)
+{
+       return priv | __AFS_PAGE_PRIV_MMAPPED;
+}
+
+static inline bool afs_is_page_dirty_mmapped(unsigned long priv)
+{
+       return priv & __AFS_PAGE_PRIV_MMAPPED;
+}
+
 #include <trace/events/afs.h>
 
 /*****************************************************************************/
index da12abd..5037120 100644 (file)
@@ -76,7 +76,7 @@ static int afs_fill_page(struct afs_vnode *vnode, struct key *key,
  */
 int afs_write_begin(struct file *file, struct address_space *mapping,
                    loff_t pos, unsigned len, unsigned flags,
-                   struct page **pagep, void **fsdata)
+                   struct page **_page, void **fsdata)
 {
        struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
        struct page *page;
@@ -90,11 +90,6 @@ int afs_write_begin(struct file *file, struct address_space *mapping,
        _enter("{%llx:%llu},{%lx},%u,%u",
               vnode->fid.vid, vnode->fid.vnode, index, from, to);
 
-       /* We want to store information about how much of a page is altered in
-        * page->private.
-        */
-       BUILD_BUG_ON(PAGE_SIZE > 32768 && sizeof(page->private) < 8);
-
        page = grab_cache_page_write_begin(mapping, index, flags);
        if (!page)
                return -ENOMEM;
@@ -110,9 +105,6 @@ int afs_write_begin(struct file *file, struct address_space *mapping,
                SetPageUptodate(page);
        }
 
-       /* page won't leak in error case: it eventually gets cleaned off LRU */
-       *pagep = page;
-
 try_again:
        /* See if this page is already partially written in a way that we can
         * merge the new write with.
@@ -120,8 +112,8 @@ try_again:
        t = f = 0;
        if (PagePrivate(page)) {
                priv = page_private(page);
-               f = priv & AFS_PRIV_MAX;
-               t = priv >> AFS_PRIV_SHIFT;
+               f = afs_page_dirty_from(priv);
+               t = afs_page_dirty_to(priv);
                ASSERTCMP(f, <=, t);
        }
 
@@ -138,21 +130,9 @@ try_again:
                if (!test_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags) &&
                    (to < f || from > t))
                        goto flush_conflicting_write;
-               if (from < f)
-                       f = from;
-               if (to > t)
-                       t = to;
-       } else {
-               f = from;
-               t = to;
        }
 
-       priv = (unsigned long)t << AFS_PRIV_SHIFT;
-       priv |= f;
-       trace_afs_page_dirty(vnode, tracepoint_string("begin"),
-                            page->index, priv);
-       SetPagePrivate(page);
-       set_page_private(page, priv);
+       *_page = page;
        _leave(" = 0");
        return 0;
 
@@ -162,17 +142,18 @@ try_again:
 flush_conflicting_write:
        _debug("flush conflict");
        ret = write_one_page(page);
-       if (ret < 0) {
-               _leave(" = %d", ret);
-               return ret;
-       }
+       if (ret < 0)
+               goto error;
 
        ret = lock_page_killable(page);
-       if (ret < 0) {
-               _leave(" = %d", ret);
-               return ret;
-       }
+       if (ret < 0)
+               goto error;
        goto try_again;
+
+error:
+       put_page(page);
+       _leave(" = %d", ret);
+       return ret;
 }
 
 /*
@@ -184,6 +165,9 @@ int afs_write_end(struct file *file, struct address_space *mapping,
 {
        struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
        struct key *key = afs_file_key(file);
+       unsigned long priv;
+       unsigned int f, from = pos & (PAGE_SIZE - 1);
+       unsigned int t, to = from + copied;
        loff_t i_size, maybe_i_size;
        int ret;
 
@@ -215,6 +199,25 @@ int afs_write_end(struct file *file, struct address_space *mapping,
                SetPageUptodate(page);
        }
 
+       if (PagePrivate(page)) {
+               priv = page_private(page);
+               f = afs_page_dirty_from(priv);
+               t = afs_page_dirty_to(priv);
+               if (from < f)
+                       f = from;
+               if (to > t)
+                       t = to;
+               priv = afs_page_dirty(f, t);
+               set_page_private(page, priv);
+               trace_afs_page_dirty(vnode, tracepoint_string("dirty+"),
+                                    page->index, priv);
+       } else {
+               priv = afs_page_dirty(from, to);
+               attach_page_private(page, (void *)priv);
+               trace_afs_page_dirty(vnode, tracepoint_string("dirty"),
+                                    page->index, priv);
+       }
+
        set_page_dirty(page);
        if (PageDirty(page))
                _debug("dirtied");
@@ -334,10 +337,9 @@ static void afs_pages_written_back(struct afs_vnode *vnode,
                ASSERTCMP(pv.nr, ==, count);
 
                for (loop = 0; loop < count; loop++) {
-                       priv = page_private(pv.pages[loop]);
+                       priv = (unsigned long)detach_page_private(pv.pages[loop]);
                        trace_afs_page_dirty(vnode, tracepoint_string("clear"),
                                             pv.pages[loop]->index, priv);
-                       set_page_private(pv.pages[loop], 0);
                        end_page_writeback(pv.pages[loop]);
                }
                first += count;
@@ -396,7 +398,8 @@ static void afs_store_data_success(struct afs_operation *op)
        op->ctime = op->file[0].scb.status.mtime_client;
        afs_vnode_commit_status(op, &op->file[0]);
        if (op->error == 0) {
-               afs_pages_written_back(vnode, op->store.first, op->store.last);
+               if (!op->store.laundering)
+                       afs_pages_written_back(vnode, op->store.first, op->store.last);
                afs_stat_v(vnode, n_stores);
                atomic_long_add((op->store.last * PAGE_SIZE + op->store.last_to) -
                                (op->store.first * PAGE_SIZE + op->store.first_offset),
@@ -415,7 +418,7 @@ static const struct afs_operation_ops afs_store_data_operation = {
  */
 static int afs_store_data(struct address_space *mapping,
                          pgoff_t first, pgoff_t last,
-                         unsigned offset, unsigned to)
+                         unsigned offset, unsigned to, bool laundering)
 {
        struct afs_vnode *vnode = AFS_FS_I(mapping->host);
        struct afs_operation *op;
@@ -448,6 +451,7 @@ static int afs_store_data(struct address_space *mapping,
        op->store.last = last;
        op->store.first_offset = offset;
        op->store.last_to = to;
+       op->store.laundering = laundering;
        op->mtime = vnode->vfs_inode.i_mtime;
        op->flags |= AFS_OPERATION_UNINTR;
        op->ops = &afs_store_data_operation;
@@ -509,8 +513,8 @@ static int afs_write_back_from_locked_page(struct address_space *mapping,
         */
        start = primary_page->index;
        priv = page_private(primary_page);
-       offset = priv & AFS_PRIV_MAX;
-       to = priv >> AFS_PRIV_SHIFT;
+       offset = afs_page_dirty_from(priv);
+       to = afs_page_dirty_to(priv);
        trace_afs_page_dirty(vnode, tracepoint_string("store"),
                             primary_page->index, priv);
 
@@ -555,8 +559,8 @@ static int afs_write_back_from_locked_page(struct address_space *mapping,
                        }
 
                        priv = page_private(page);
-                       f = priv & AFS_PRIV_MAX;
-                       t = priv >> AFS_PRIV_SHIFT;
+                       f = afs_page_dirty_from(priv);
+                       t = afs_page_dirty_to(priv);
                        if (f != 0 &&
                            !test_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags)) {
                                unlock_page(page);
@@ -601,7 +605,7 @@ no_more:
        if (end > i_size)
                to = i_size & ~PAGE_MASK;
 
-       ret = afs_store_data(mapping, first, last, offset, to);
+       ret = afs_store_data(mapping, first, last, offset, to, false);
        switch (ret) {
        case 0:
                ret = count;
@@ -857,12 +861,14 @@ vm_fault_t afs_page_mkwrite(struct vm_fault *vmf)
         */
        wait_on_page_writeback(vmf->page);
 
-       priv = (unsigned long)PAGE_SIZE << AFS_PRIV_SHIFT; /* To */
-       priv |= 0; /* From */
+       priv = afs_page_dirty(0, PAGE_SIZE);
+       priv = afs_page_dirty_mmapped(priv);
        trace_afs_page_dirty(vnode, tracepoint_string("mkwrite"),
                             vmf->page->index, priv);
-       SetPagePrivate(vmf->page);
-       set_page_private(vmf->page, priv);
+       if (PagePrivate(vmf->page))
+               set_page_private(vmf->page, priv);
+       else
+               attach_page_private(vmf->page, (void *)priv);
        file_update_time(file);
 
        sb_end_pagefault(inode->i_sb);
@@ -915,19 +921,18 @@ int afs_launder_page(struct page *page)
                f = 0;
                t = PAGE_SIZE;
                if (PagePrivate(page)) {
-                       f = priv & AFS_PRIV_MAX;
-                       t = priv >> AFS_PRIV_SHIFT;
+                       f = afs_page_dirty_from(priv);
+                       t = afs_page_dirty_to(priv);
                }
 
                trace_afs_page_dirty(vnode, tracepoint_string("launder"),
                                     page->index, priv);
-               ret = afs_store_data(mapping, page->index, page->index, t, f);
+               ret = afs_store_data(mapping, page->index, page->index, t, f, true);
        }
 
+       priv = (unsigned long)detach_page_private(page);
        trace_afs_page_dirty(vnode, tracepoint_string("laundered"),
                             page->index, priv);
-       set_page_private(page, 0);
-       ClearPagePrivate(page);
 
 #ifdef CONFIG_AFS_FSCACHE
        if (PageFsCache(page)) {
index 84f3c4f..95c573d 100644 (file)
@@ -85,7 +85,7 @@ static int afs_xattr_get_acl(const struct xattr_handler *handler,
                        if (acl->size <= size)
                                memcpy(buffer, acl->data, acl->size);
                        else
-                               op->error = -ERANGE;
+                               ret = -ERANGE;
                }
        }
 
@@ -148,11 +148,6 @@ static const struct xattr_handler afs_xattr_afs_acl_handler = {
        .set    = afs_xattr_set_acl,
 };
 
-static void yfs_acl_put(struct afs_operation *op)
-{
-       yfs_free_opaque_acl(op->yacl);
-}
-
 static const struct afs_operation_ops yfs_fetch_opaque_acl_operation = {
        .issue_yfs_rpc  = yfs_fs_fetch_opaque_acl,
        .success        = afs_acl_success,
@@ -246,7 +241,7 @@ error:
 static const struct afs_operation_ops yfs_store_opaque_acl2_operation = {
        .issue_yfs_rpc  = yfs_fs_store_opaque_acl2,
        .success        = afs_acl_success,
-       .put            = yfs_acl_put,
+       .put            = afs_acl_put,
 };
 
 /*
index 3b1239b..bd787e7 100644 (file)
@@ -1990,6 +1990,7 @@ void yfs_fs_store_opaque_acl2(struct afs_operation *op)
        memcpy(bp, acl->data, acl->size);
        if (acl->size != size)
                memset((void *)bp + acl->size, 0, size - acl->size);
+       bp += size / sizeof(__be32);
        yfs_check_req(call, bp);
 
        trace_afs_make_fs_call(call, &vp->fid);
index 2482032..c1ba13d 100644 (file)
@@ -963,8 +963,7 @@ befs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_bavail = buf->f_bfree;
        buf->f_files = 0;       /* UNKNOWN */
        buf->f_ffree = 0;       /* UNKNOWN */
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
        buf->f_namelen = BEFS_NAME_LEN;
 
        befs_debug(sb, "<--- %s", __func__);
index f8ce136..3ac7611 100644 (file)
@@ -229,8 +229,7 @@ static int bfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_bfree = buf->f_bavail = info->si_freeb;
        buf->f_files = info->si_lasti + 1 - BFS_ROOT_INO;
        buf->f_ffree = info->si_freei;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
        buf->f_namelen = BFS_NAMELEN;
        return 0;
 }
index b6b3d05..fa50e89 100644 (file)
@@ -1690,7 +1690,7 @@ struct elf_thread_core_info {
        struct elf_thread_core_info *next;
        struct task_struct *task;
        struct elf_prstatus prstatus;
-       struct memelfnote notes[0];
+       struct memelfnote notes[];
 };
 
 struct elf_note_info {
index b3268f4..771a036 100644 (file)
@@ -544,7 +544,18 @@ static int resolve_indirect_ref(struct btrfs_fs_info *fs_info,
        int level = ref->level;
        struct btrfs_key search_key = ref->key_for_search;
 
-       root = btrfs_get_fs_root(fs_info, ref->root_id, false);
+       /*
+        * If we're search_commit_root we could possibly be holding locks on
+        * other tree nodes.  This happens when qgroups does backref walks when
+        * adding new delayed refs.  To deal with this we need to look in cache
+        * for the root, and if we don't find it then we need to search the
+        * tree_root's commit root, thus the btrfs_get_fs_root_commit_root usage
+        * here.
+        */
+       if (path->search_commit_root)
+               root = btrfs_get_fs_root_commit_root(fs_info, path, ref->root_id);
+       else
+               root = btrfs_get_fs_root(fs_info, ref->root_id, false);
        if (IS_ERR(root)) {
                ret = PTR_ERR(root);
                goto out_free;
index c0f1d68..3ba6f38 100644 (file)
@@ -2024,6 +2024,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)
                key.offset = 0;
                btrfs_release_path(path);
        }
+       btrfs_release_path(path);
 
        list_for_each_entry(space_info, &info->space_info, list) {
                int i;
index 7e1549a..bc920af 100644 (file)
@@ -511,7 +511,8 @@ again:
                                /*DEFAULT_RATELIMIT_BURST*/ 1);
                if (__ratelimit(&_rs))
                        WARN(1, KERN_DEBUG
-                               "BTRFS: block rsv returned %d\n", ret);
+                               "BTRFS: block rsv %d returned %d\n",
+                               block_rsv->type, ret);
        }
 try_reserve:
        ret = btrfs_reserve_metadata_bytes(root, block_rsv, blocksize,
index aac3d6f..0378933 100644 (file)
@@ -3564,6 +3564,8 @@ struct reada_control *btrfs_reada_add(struct btrfs_root *root,
 int btrfs_reada_wait(void *handle);
 void btrfs_reada_detach(void *handle);
 int btree_readahead_hook(struct extent_buffer *eb, int err);
+void btrfs_reada_remove_dev(struct btrfs_device *dev);
+void btrfs_reada_undo_remove_dev(struct btrfs_device *dev);
 
 static inline int is_fstree(u64 rootid)
 {
index 4a0243c..1063853 100644 (file)
@@ -91,6 +91,17 @@ int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info)
        ret = btrfs_search_slot(NULL, dev_root, &key, path, 0, 0);
        if (ret) {
 no_valid_dev_replace_entry_found:
+               /*
+                * We don't have a replace item or it's corrupted.  If there is
+                * a replace target, fail the mount.
+                */
+               if (btrfs_find_device(fs_info->fs_devices,
+                                     BTRFS_DEV_REPLACE_DEVID, NULL, NULL, false)) {
+                       btrfs_err(fs_info,
+                       "found replace target device without a valid replace item");
+                       ret = -EUCLEAN;
+                       goto out;
+               }
                ret = 0;
                dev_replace->replace_state =
                        BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED;
@@ -143,8 +154,19 @@ no_valid_dev_replace_entry_found:
        case BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED:
        case BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED:
        case BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED:
-               dev_replace->srcdev = NULL;
-               dev_replace->tgtdev = NULL;
+               /*
+                * We don't have an active replace item but if there is a
+                * replace target, fail the mount.
+                */
+               if (btrfs_find_device(fs_info->fs_devices,
+                                     BTRFS_DEV_REPLACE_DEVID, NULL, NULL, false)) {
+                       btrfs_err(fs_info,
+                       "replace devid present without an active replace item");
+                       ret = -EUCLEAN;
+               } else {
+                       dev_replace->srcdev = NULL;
+                       dev_replace->tgtdev = NULL;
+               }
                break;
        case BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED:
        case BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED:
@@ -688,6 +710,9 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
        }
        btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
 
+       if (!scrub_ret)
+               btrfs_reada_remove_dev(src_device);
+
        /*
         * We have to use this loop approach because at this point src_device
         * has to be available for transaction commit to complete, yet new
@@ -696,6 +721,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
        while (1) {
                trans = btrfs_start_transaction(root, 0);
                if (IS_ERR(trans)) {
+                       btrfs_reada_undo_remove_dev(src_device);
                        mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
                        return PTR_ERR(trans);
                }
@@ -746,6 +772,7 @@ error:
                up_write(&dev_replace->rwsem);
                mutex_unlock(&fs_info->chunk_mutex);
                mutex_unlock(&fs_info->fs_devices->device_list_mutex);
+               btrfs_reada_undo_remove_dev(src_device);
                btrfs_rm_dev_replace_blocked(fs_info);
                if (tgt_device)
                        btrfs_destroy_dev_replace_tgtdev(tgt_device);
index 8e34386..af97ddc 100644 (file)
@@ -1281,32 +1281,26 @@ int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
        return 0;
 }
 
-struct btrfs_root *btrfs_read_tree_root(struct btrfs_root *tree_root,
-                                       struct btrfs_key *key)
+static struct btrfs_root *read_tree_root_path(struct btrfs_root *tree_root,
+                                             struct btrfs_path *path,
+                                             struct btrfs_key *key)
 {
        struct btrfs_root *root;
        struct btrfs_fs_info *fs_info = tree_root->fs_info;
-       struct btrfs_path *path;
        u64 generation;
        int ret;
        int level;
 
-       path = btrfs_alloc_path();
-       if (!path)
-               return ERR_PTR(-ENOMEM);
-
        root = btrfs_alloc_root(fs_info, key->objectid, GFP_NOFS);
-       if (!root) {
-               ret = -ENOMEM;
-               goto alloc_fail;
-       }
+       if (!root)
+               return ERR_PTR(-ENOMEM);
 
        ret = btrfs_find_root(tree_root, key, path,
                              &root->root_item, &root->root_key);
        if (ret) {
                if (ret > 0)
                        ret = -ENOENT;
-               goto find_fail;
+               goto fail;
        }
 
        generation = btrfs_root_generation(&root->root_item);
@@ -1317,21 +1311,31 @@ struct btrfs_root *btrfs_read_tree_root(struct btrfs_root *tree_root,
        if (IS_ERR(root->node)) {
                ret = PTR_ERR(root->node);
                root->node = NULL;
-               goto find_fail;
+               goto fail;
        } else if (!btrfs_buffer_uptodate(root->node, generation, 0)) {
                ret = -EIO;
-               goto find_fail;
+               goto fail;
        }
        root->commit_root = btrfs_root_node(root);
-out:
-       btrfs_free_path(path);
        return root;
-
-find_fail:
+fail:
        btrfs_put_root(root);
-alloc_fail:
-       root = ERR_PTR(ret);
-       goto out;
+       return ERR_PTR(ret);
+}
+
+struct btrfs_root *btrfs_read_tree_root(struct btrfs_root *tree_root,
+                                       struct btrfs_key *key)
+{
+       struct btrfs_root *root;
+       struct btrfs_path *path;
+
+       path = btrfs_alloc_path();
+       if (!path)
+               return ERR_PTR(-ENOMEM);
+       root = read_tree_root_path(tree_root, path, key);
+       btrfs_free_path(path);
+
+       return root;
 }
 
 /*
@@ -1419,6 +1423,31 @@ static struct btrfs_root *btrfs_lookup_fs_root(struct btrfs_fs_info *fs_info,
        return root;
 }
 
+static struct btrfs_root *btrfs_get_global_root(struct btrfs_fs_info *fs_info,
+                                               u64 objectid)
+{
+       if (objectid == BTRFS_ROOT_TREE_OBJECTID)
+               return btrfs_grab_root(fs_info->tree_root);
+       if (objectid == BTRFS_EXTENT_TREE_OBJECTID)
+               return btrfs_grab_root(fs_info->extent_root);
+       if (objectid == BTRFS_CHUNK_TREE_OBJECTID)
+               return btrfs_grab_root(fs_info->chunk_root);
+       if (objectid == BTRFS_DEV_TREE_OBJECTID)
+               return btrfs_grab_root(fs_info->dev_root);
+       if (objectid == BTRFS_CSUM_TREE_OBJECTID)
+               return btrfs_grab_root(fs_info->csum_root);
+       if (objectid == BTRFS_QUOTA_TREE_OBJECTID)
+               return btrfs_grab_root(fs_info->quota_root) ?
+                       fs_info->quota_root : ERR_PTR(-ENOENT);
+       if (objectid == BTRFS_UUID_TREE_OBJECTID)
+               return btrfs_grab_root(fs_info->uuid_root) ?
+                       fs_info->uuid_root : ERR_PTR(-ENOENT);
+       if (objectid == BTRFS_FREE_SPACE_TREE_OBJECTID)
+               return btrfs_grab_root(fs_info->free_space_root) ?
+                       fs_info->free_space_root : ERR_PTR(-ENOENT);
+       return NULL;
+}
+
 int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info,
                         struct btrfs_root *root)
 {
@@ -1518,25 +1547,9 @@ static struct btrfs_root *btrfs_get_root_ref(struct btrfs_fs_info *fs_info,
        struct btrfs_key key;
        int ret;
 
-       if (objectid == BTRFS_ROOT_TREE_OBJECTID)
-               return btrfs_grab_root(fs_info->tree_root);
-       if (objectid == BTRFS_EXTENT_TREE_OBJECTID)
-               return btrfs_grab_root(fs_info->extent_root);
-       if (objectid == BTRFS_CHUNK_TREE_OBJECTID)
-               return btrfs_grab_root(fs_info->chunk_root);
-       if (objectid == BTRFS_DEV_TREE_OBJECTID)
-               return btrfs_grab_root(fs_info->dev_root);
-       if (objectid == BTRFS_CSUM_TREE_OBJECTID)
-               return btrfs_grab_root(fs_info->csum_root);
-       if (objectid == BTRFS_QUOTA_TREE_OBJECTID)
-               return btrfs_grab_root(fs_info->quota_root) ?
-                       fs_info->quota_root : ERR_PTR(-ENOENT);
-       if (objectid == BTRFS_UUID_TREE_OBJECTID)
-               return btrfs_grab_root(fs_info->uuid_root) ?
-                       fs_info->uuid_root : ERR_PTR(-ENOENT);
-       if (objectid == BTRFS_FREE_SPACE_TREE_OBJECTID)
-               return btrfs_grab_root(fs_info->free_space_root) ?
-                       fs_info->free_space_root : ERR_PTR(-ENOENT);
+       root = btrfs_get_global_root(fs_info, objectid);
+       if (root)
+               return root;
 again:
        root = btrfs_lookup_fs_root(fs_info, objectid);
        if (root) {
@@ -1622,6 +1635,52 @@ struct btrfs_root *btrfs_get_new_fs_root(struct btrfs_fs_info *fs_info,
 }
 
 /*
+ * btrfs_get_fs_root_commit_root - return a root for the given objectid
+ * @fs_info:   the fs_info
+ * @objectid:  the objectid we need to lookup
+ *
+ * This is exclusively used for backref walking, and exists specifically because
+ * of how qgroups does lookups.  Qgroups will do a backref lookup at delayed ref
+ * creation time, which means we may have to read the tree_root in order to look
+ * up a fs root that is not in memory.  If the root is not in memory we will
+ * read the tree root commit root and look up the fs root from there.  This is a
+ * temporary root, it will not be inserted into the radix tree as it doesn't
+ * have the most uptodate information, it'll simply be discarded once the
+ * backref code is finished using the root.
+ */
+struct btrfs_root *btrfs_get_fs_root_commit_root(struct btrfs_fs_info *fs_info,
+                                                struct btrfs_path *path,
+                                                u64 objectid)
+{
+       struct btrfs_root *root;
+       struct btrfs_key key;
+
+       ASSERT(path->search_commit_root && path->skip_locking);
+
+       /*
+        * This can return -ENOENT if we ask for a root that doesn't exist, but
+        * since this is called via the backref walking code we won't be looking
+        * up a root that doesn't exist, unless there's corruption.  So if root
+        * != NULL just return it.
+        */
+       root = btrfs_get_global_root(fs_info, objectid);
+       if (root)
+               return root;
+
+       root = btrfs_lookup_fs_root(fs_info, objectid);
+       if (root)
+               return root;
+
+       key.objectid = objectid;
+       key.type = BTRFS_ROOT_ITEM_KEY;
+       key.offset = (u64)-1;
+       root = read_tree_root_path(fs_info->tree_root, path, &key);
+       btrfs_release_path(path);
+
+       return root;
+}
+
+/*
  * called by the kthread helper functions to finally call the bio end_io
  * functions.  This is where read checksum verification actually happens
  */
index fee69ce..182540b 100644 (file)
@@ -69,6 +69,9 @@ struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info,
                                     u64 objectid, bool check_ref);
 struct btrfs_root *btrfs_get_new_fs_root(struct btrfs_fs_info *fs_info,
                                         u64 objectid, dev_t anon_dev);
+struct btrfs_root *btrfs_get_fs_root_commit_root(struct btrfs_fs_info *fs_info,
+                                                struct btrfs_path *path,
+                                                u64 objectid);
 
 void btrfs_free_fs_info(struct btrfs_fs_info *fs_info);
 int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info);
index 3b21fee..5fd60b1 100644 (file)
@@ -3185,7 +3185,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
                struct btrfs_tree_block_info *bi;
                if (item_size < sizeof(*ei) + sizeof(*bi)) {
                        btrfs_crit(info,
-"invalid extent item size for key (%llu, %u, %llu) owner %llu, has %u expect >= %lu",
+"invalid extent item size for key (%llu, %u, %llu) owner %llu, has %u expect >= %zu",
                                   key.objectid, key.type, key.offset,
                                   owner_objectid, item_size,
                                   sizeof(*ei) + sizeof(*bi));
index 0ff6594..87355a3 100644 (file)
@@ -3628,7 +3628,8 @@ static ssize_t btrfs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
                inode_lock_shared(inode);
                ret = btrfs_direct_IO(iocb, to);
                inode_unlock_shared(inode);
-               if (ret < 0)
+               if (ret < 0 || !iov_iter_count(to) ||
+                   iocb->ki_pos >= i_size_read(file_inode(iocb->ki_filp)))
                        return ret;
        }
 
index 936c313..da58c58 100644 (file)
@@ -9672,10 +9672,16 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
                 * clear_offset by our extent size.
                 */
                clear_offset += ins.offset;
-               btrfs_dec_block_group_reservations(fs_info, ins.objectid);
 
                last_alloc = ins.offset;
                trans = insert_prealloc_file_extent(trans, inode, &ins, cur_offset);
+               /*
+                * Now that we inserted the prealloc extent we can finally
+                * decrement the number of reservations in the block group.
+                * If we did it before, we could race with relocation and have
+                * relocation miss the reserved extent, making it fail later.
+                */
+               btrfs_dec_block_group_reservations(fs_info, ins.objectid);
                if (IS_ERR(trans)) {
                        ret = PTR_ERR(trans);
                        btrfs_free_reserved_extent(fs_info, ins.objectid,
index ab408a2..69a3841 100644 (file)
@@ -1274,6 +1274,7 @@ static int cluster_pages_for_defrag(struct inode *inode,
        u64 page_start;
        u64 page_end;
        u64 page_cnt;
+       u64 start = (u64)start_index << PAGE_SHIFT;
        int ret;
        int i;
        int i_done;
@@ -1290,8 +1291,7 @@ static int cluster_pages_for_defrag(struct inode *inode,
        page_cnt = min_t(u64, (u64)num_pages, (u64)file_end - start_index + 1);
 
        ret = btrfs_delalloc_reserve_space(BTRFS_I(inode), &data_reserved,
-                       start_index << PAGE_SHIFT,
-                       page_cnt << PAGE_SHIFT);
+                       start, page_cnt << PAGE_SHIFT);
        if (ret)
                return ret;
        i_done = 0;
@@ -1380,8 +1380,7 @@ again:
                btrfs_mod_outstanding_extents(BTRFS_I(inode), 1);
                spin_unlock(&BTRFS_I(inode)->lock);
                btrfs_delalloc_release_space(BTRFS_I(inode), data_reserved,
-                               start_index << PAGE_SHIFT,
-                               (page_cnt - i_done) << PAGE_SHIFT, true);
+                               start, (page_cnt - i_done) << PAGE_SHIFT, true);
        }
 
 
@@ -1408,8 +1407,7 @@ out:
                put_page(pages[i]);
        }
        btrfs_delalloc_release_space(BTRFS_I(inode), data_reserved,
-                       start_index << PAGE_SHIFT,
-                       page_cnt << PAGE_SHIFT, true);
+                       start, page_cnt << PAGE_SHIFT, true);
        btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT);
        extent_changeset_free(data_reserved);
        return ret;
index 580899b..77c5474 100644 (file)
@@ -1026,6 +1026,10 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info)
                btrfs_item_key_to_cpu(leaf, &found_key, slot);
 
                if (found_key.type == BTRFS_ROOT_REF_KEY) {
+
+                       /* Release locks on tree_root before we access quota_root */
+                       btrfs_release_path(path);
+
                        ret = add_qgroup_item(trans, quota_root,
                                              found_key.offset);
                        if (ret) {
@@ -1044,6 +1048,20 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info)
                                btrfs_abort_transaction(trans, ret);
                                goto out_free_path;
                        }
+                       ret = btrfs_search_slot_for_read(tree_root, &found_key,
+                                                        path, 1, 0);
+                       if (ret < 0) {
+                               btrfs_abort_transaction(trans, ret);
+                               goto out_free_path;
+                       }
+                       if (ret > 0) {
+                               /*
+                                * Shouldn't happen, but in case it does we
+                                * don't need to do the btrfs_next_item, just
+                                * continue.
+                                */
+                               continue;
+                       }
                }
                ret = btrfs_next_item(tree_root, path);
                if (ret < 0) {
@@ -3417,24 +3435,20 @@ static int qgroup_unreserve_range(struct btrfs_inode *inode,
 {
        struct rb_node *node;
        struct rb_node *next;
-       struct ulist_node *entry = NULL;
+       struct ulist_node *entry;
        int ret = 0;
 
        node = reserved->range_changed.root.rb_node;
+       if (!node)
+               return 0;
        while (node) {
                entry = rb_entry(node, struct ulist_node, rb_node);
                if (entry->val < start)
                        node = node->rb_right;
-               else if (entry)
-                       node = node->rb_left;
                else
-                       break;
+                       node = node->rb_left;
        }
 
-       /* Empty changeset */
-       if (!entry)
-               return 0;
-
        if (entry->val > start && rb_prev(&entry->rb_node))
                entry = rb_entry(rb_prev(&entry->rb_node), struct ulist_node,
                                 rb_node);
index 9d4f531..d9a166e 100644 (file)
@@ -421,6 +421,9 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
                if (!dev->bdev)
                        continue;
 
+               if (test_bit(BTRFS_DEV_STATE_NO_READA, &dev->dev_state))
+                       continue;
+
                if (dev_replace_is_ongoing &&
                    dev == fs_info->dev_replace.tgtdev) {
                        /*
@@ -445,6 +448,8 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
                }
                have_zone = 1;
        }
+       if (!have_zone)
+               radix_tree_delete(&fs_info->reada_tree, index);
        spin_unlock(&fs_info->reada_lock);
        up_read(&fs_info->dev_replace.rwsem);
 
@@ -1020,3 +1025,45 @@ void btrfs_reada_detach(void *handle)
 
        kref_put(&rc->refcnt, reada_control_release);
 }
+
+/*
+ * Before removing a device (device replace or device remove ioctls), call this
+ * function to wait for all existing readahead requests on the device and to
+ * make sure no one queues more readahead requests for the device.
+ *
+ * Must be called without holding neither the device list mutex nor the device
+ * replace semaphore, otherwise it will deadlock.
+ */
+void btrfs_reada_remove_dev(struct btrfs_device *dev)
+{
+       struct btrfs_fs_info *fs_info = dev->fs_info;
+
+       /* Serialize with readahead extent creation at reada_find_extent(). */
+       spin_lock(&fs_info->reada_lock);
+       set_bit(BTRFS_DEV_STATE_NO_READA, &dev->dev_state);
+       spin_unlock(&fs_info->reada_lock);
+
+       /*
+        * There might be readahead requests added to the radix trees which
+        * were not yet added to the readahead work queue. We need to start
+        * them and wait for their completion, otherwise we can end up with
+        * use-after-free problems when dropping the last reference on the
+        * readahead extents and their zones, as they need to access the
+        * device structure.
+        */
+       reada_start_machine(fs_info);
+       btrfs_flush_workqueue(fs_info->readahead_workers);
+}
+
+/*
+ * If when removing a device (device replace or device remove ioctls) an error
+ * happens after calling btrfs_reada_remove_dev(), call this to undo what that
+ * function did. This is safe to call even if btrfs_reada_remove_dev() was not
+ * called before.
+ */
+void btrfs_reada_undo_remove_dev(struct btrfs_device *dev)
+{
+       spin_lock(&dev->fs_info->reada_lock);
+       clear_bit(BTRFS_DEV_STATE_NO_READA, &dev->dev_state);
+       spin_unlock(&dev->fs_info->reada_lock);
+}
index 7f03dbe..78693d3 100644 (file)
@@ -860,6 +860,7 @@ int btrfs_ref_tree_mod(struct btrfs_fs_info *fs_info,
 "dropping a ref for a root that doesn't have a ref on the block");
                        dump_block_entry(fs_info, be);
                        dump_ref_action(fs_info, ra);
+                       kfree(ref);
                        kfree(ra);
                        goto out_unlock;
                }
index 3602806..9ba92d8 100644 (file)
@@ -1648,6 +1648,7 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc,
        struct btrfs_root_item *root_item;
        struct btrfs_path *path;
        struct extent_buffer *leaf;
+       int reserve_level;
        int level;
        int max_level;
        int replaced = 0;
@@ -1696,7 +1697,8 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc,
         * Thus the needed metadata size is at most root_level * nodesize,
         * and * 2 since we have two trees to COW.
         */
-       min_reserved = fs_info->nodesize * btrfs_root_level(root_item) * 2;
+       reserve_level = max_t(int, 1, btrfs_root_level(root_item));
+       min_reserved = fs_info->nodesize * reserve_level * 2;
        memset(&next_key, 0, sizeof(next_key));
 
        while (1) {
index cf63f1e..e71e758 100644 (file)
@@ -3866,8 +3866,9 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
        if (!is_dev_replace && !readonly &&
            !test_bit(BTRFS_DEV_STATE_WRITEABLE, &dev->dev_state)) {
                mutex_unlock(&fs_info->fs_devices->device_list_mutex);
-               btrfs_err_in_rcu(fs_info, "scrub: device %s is not writable",
-                               rcu_str_deref(dev->name));
+               btrfs_err_in_rcu(fs_info,
+                       "scrub on devid %llu: filesystem on %s is not writable",
+                                devid, rcu_str_deref(dev->name));
                ret = -EROFS;
                goto out;
        }
index f0ffd5e..8784b74 100644 (file)
@@ -760,18 +760,36 @@ int btrfs_check_chunk_valid(struct extent_buffer *leaf,
        u64 type;
        u64 features;
        bool mixed = false;
+       int raid_index;
+       int nparity;
+       int ncopies;
 
        length = btrfs_chunk_length(leaf, chunk);
        stripe_len = btrfs_chunk_stripe_len(leaf, chunk);
        num_stripes = btrfs_chunk_num_stripes(leaf, chunk);
        sub_stripes = btrfs_chunk_sub_stripes(leaf, chunk);
        type = btrfs_chunk_type(leaf, chunk);
+       raid_index = btrfs_bg_flags_to_raid_index(type);
+       ncopies = btrfs_raid_array[raid_index].ncopies;
+       nparity = btrfs_raid_array[raid_index].nparity;
 
        if (!num_stripes) {
                chunk_err(leaf, chunk, logical,
                          "invalid chunk num_stripes, have %u", num_stripes);
                return -EUCLEAN;
        }
+       if (num_stripes < ncopies) {
+               chunk_err(leaf, chunk, logical,
+                         "invalid chunk num_stripes < ncopies, have %u < %d",
+                         num_stripes, ncopies);
+               return -EUCLEAN;
+       }
+       if (nparity && num_stripes == nparity) {
+               chunk_err(leaf, chunk, logical,
+                         "invalid chunk num_stripes == nparity, have %u == %d",
+                         num_stripes, nparity);
+               return -EUCLEAN;
+       }
        if (!IS_ALIGNED(logical, fs_info->sectorsize)) {
                chunk_err(leaf, chunk, logical,
                "invalid chunk logical, have %llu should aligned to %u",
index 58b9c41..a6406b3 100644 (file)
@@ -431,7 +431,7 @@ static struct btrfs_device *__alloc_device(struct btrfs_fs_info *fs_info)
 
        atomic_set(&dev->reada_in_flight, 0);
        atomic_set(&dev->dev_stats_ccnt, 0);
-       btrfs_device_data_ordered_init(dev);
+       btrfs_device_data_ordered_init(dev, fs_info);
        INIT_RADIX_TREE(&dev->reada_zones, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
        INIT_RADIX_TREE(&dev->reada_extents, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
        extent_io_tree_init(fs_info, &dev->alloc_state,
@@ -1056,22 +1056,13 @@ static void __btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices,
                        continue;
                }
 
-               if (device->devid == BTRFS_DEV_REPLACE_DEVID) {
-                       /*
-                        * In the first step, keep the device which has
-                        * the correct fsid and the devid that is used
-                        * for the dev_replace procedure.
-                        * In the second step, the dev_replace state is
-                        * read from the device tree and it is known
-                        * whether the procedure is really active or
-                        * not, which means whether this device is
-                        * used or whether it should be removed.
-                        */
-                       if (step == 0 || test_bit(BTRFS_DEV_STATE_REPLACE_TGT,
-                                                 &device->dev_state)) {
-                               continue;
-                       }
-               }
+               /*
+                * We have already validated the presence of BTRFS_DEV_REPLACE_DEVID,
+                * in btrfs_init_dev_replace() so just continue.
+                */
+               if (device->devid == BTRFS_DEV_REPLACE_DEVID)
+                       continue;
+
                if (device->bdev) {
                        blkdev_put(device->bdev, device->mode);
                        device->bdev = NULL;
@@ -1080,9 +1071,6 @@ static void __btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices,
                if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state)) {
                        list_del_init(&device->dev_alloc_list);
                        clear_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state);
-                       if (!test_bit(BTRFS_DEV_STATE_REPLACE_TGT,
-                                     &device->dev_state))
-                               fs_devices->rw_devices--;
                }
                list_del_init(&device->dev_list);
                fs_devices->num_devices--;
@@ -2099,6 +2087,8 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
 
        mutex_unlock(&uuid_mutex);
        ret = btrfs_shrink_device(device, 0);
+       if (!ret)
+               btrfs_reada_remove_dev(device);
        mutex_lock(&uuid_mutex);
        if (ret)
                goto error_undo;
@@ -2179,6 +2169,7 @@ out:
        return ret;
 
 error_undo:
+       btrfs_reada_undo_remove_dev(device);
        if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state)) {
                mutex_lock(&fs_info->chunk_mutex);
                list_add(&device->dev_alloc_list,
index bf27ac0..232f02b 100644 (file)
@@ -39,10 +39,10 @@ struct btrfs_io_geometry {
 #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
 #include <linux/seqlock.h>
 #define __BTRFS_NEED_DEVICE_DATA_ORDERED
-#define btrfs_device_data_ordered_init(device) \
-       seqcount_init(&device->data_seqcount)
+#define btrfs_device_data_ordered_init(device, info)                           \
+       seqcount_mutex_init(&device->data_seqcount, &info->chunk_mutex)
 #else
-#define btrfs_device_data_ordered_init(device) do { } while (0)
+#define btrfs_device_data_ordered_init(device, info) do { } while (0)
 #endif
 
 #define BTRFS_DEV_STATE_WRITEABLE      (0)
@@ -50,6 +50,7 @@ struct btrfs_io_geometry {
 #define BTRFS_DEV_STATE_MISSING                (2)
 #define BTRFS_DEV_STATE_REPLACE_TGT    (3)
 #define BTRFS_DEV_STATE_FLUSH_SENT     (4)
+#define BTRFS_DEV_STATE_NO_READA       (5)
 
 struct btrfs_device {
        struct list_head dev_list; /* device_list_mutex */
@@ -71,7 +72,8 @@ struct btrfs_device {
        blk_status_t last_flush_error;
 
 #ifdef __BTRFS_NEED_DEVICE_DATA_ORDERED
-       seqcount_t data_seqcount;
+       /* A seqcount_t with associated chunk_mutex (for lockdep) */
+       seqcount_mutex_t data_seqcount;
 #endif
 
        /* the internal btrfs device id */
@@ -162,11 +164,9 @@ btrfs_device_get_##name(const struct btrfs_device *dev)                    \
 static inline void                                                     \
 btrfs_device_set_##name(struct btrfs_device *dev, u64 size)            \
 {                                                                      \
-       preempt_disable();                                              \
        write_seqcount_begin(&dev->data_seqcount);                      \
        dev->name = size;                                               \
        write_seqcount_end(&dev->data_seqcount);                        \
-       preempt_enable();                                               \
 }
 #elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPTION)
 #define BTRFS_DEVICE_GETSET_FUNCS(name)                                        \
index 3080cda..8bda092 100644 (file)
@@ -121,7 +121,7 @@ static int cachefiles_read_reissue(struct cachefiles_object *object,
                _debug("reissue read");
                ret = bmapping->a_ops->readpage(NULL, backpage);
                if (ret < 0)
-                       goto unlock_discard;
+                       goto discard;
        }
 
        /* but the page may have been read before the monitor was installed, so
@@ -138,6 +138,7 @@ static int cachefiles_read_reissue(struct cachefiles_object *object,
 
 unlock_discard:
        unlock_page(backpage);
+discard:
        spin_lock_irq(&object->work_lock);
        list_del(&monitor->op_link);
        spin_unlock_irq(&object->work_lock);
index 5027bbd..ded4229 100644 (file)
@@ -4074,7 +4074,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
             vino.snap, inode);
 
        mutex_lock(&session->s_mutex);
-       session->s_seq++;
+       inc_session_sequence(session);
        dout(" mds%d seq %lld cap seq %u\n", session->s_mds, session->s_seq,
             (unsigned)seq);
 
index 08f1c0c..8f1d750 100644 (file)
@@ -4231,7 +4231,7 @@ static void handle_lease(struct ceph_mds_client *mdsc,
             dname.len, dname.name);
 
        mutex_lock(&session->s_mutex);
-       session->s_seq++;
+       inc_session_sequence(session);
 
        if (!inode) {
                dout("handle_lease no inode %llx\n", vino.ino);
@@ -4385,29 +4385,49 @@ static void maybe_recover_session(struct ceph_mds_client *mdsc)
 
 bool check_session_state(struct ceph_mds_session *s)
 {
-       if (s->s_state == CEPH_MDS_SESSION_CLOSING) {
-               dout("resending session close request for mds%d\n",
-                               s->s_mds);
-               request_close_session(s);
-               return false;
-       }
-       if (s->s_ttl && time_after(jiffies, s->s_ttl)) {
-               if (s->s_state == CEPH_MDS_SESSION_OPEN) {
+       switch (s->s_state) {
+       case CEPH_MDS_SESSION_OPEN:
+               if (s->s_ttl && time_after(jiffies, s->s_ttl)) {
                        s->s_state = CEPH_MDS_SESSION_HUNG;
                        pr_info("mds%d hung\n", s->s_mds);
                }
-       }
-       if (s->s_state == CEPH_MDS_SESSION_NEW ||
-           s->s_state == CEPH_MDS_SESSION_RESTARTING ||
-           s->s_state == CEPH_MDS_SESSION_CLOSED ||
-           s->s_state == CEPH_MDS_SESSION_REJECTED)
-               /* this mds is failed or recovering, just wait */
+               break;
+       case CEPH_MDS_SESSION_CLOSING:
+               /* Should never reach this when we're unmounting */
+               WARN_ON_ONCE(true);
+               fallthrough;
+       case CEPH_MDS_SESSION_NEW:
+       case CEPH_MDS_SESSION_RESTARTING:
+       case CEPH_MDS_SESSION_CLOSED:
+       case CEPH_MDS_SESSION_REJECTED:
                return false;
+       }
 
        return true;
 }
 
 /*
+ * If the sequence is incremented while we're waiting on a REQUEST_CLOSE reply,
+ * then we need to retransmit that request.
+ */
+void inc_session_sequence(struct ceph_mds_session *s)
+{
+       lockdep_assert_held(&s->s_mutex);
+
+       s->s_seq++;
+
+       if (s->s_state == CEPH_MDS_SESSION_CLOSING) {
+               int ret;
+
+               dout("resending session close request for mds%d\n", s->s_mds);
+               ret = request_close_session(s);
+               if (ret < 0)
+                       pr_err("unable to close session to mds%d: %d\n",
+                              s->s_mds, ret);
+       }
+}
+
+/*
  * delayed work -- periodically trim expired leases, renew caps with mds
  */
 static void schedule_delayed(struct ceph_mds_client *mdsc)
index cbf8af4..f5adbeb 100644 (file)
@@ -480,6 +480,7 @@ struct ceph_mds_client {
 extern const char *ceph_mds_op_name(int op);
 
 extern bool check_session_state(struct ceph_mds_session *s);
+void inc_session_sequence(struct ceph_mds_session *s);
 
 extern struct ceph_mds_session *
 __ceph_lookup_mds_session(struct ceph_mds_client *, int mds);
index 83cb4f2..9b785f1 100644 (file)
@@ -53,7 +53,7 @@ void ceph_handle_quota(struct ceph_mds_client *mdsc,
 
        /* increment msg sequence number */
        mutex_lock(&session->s_mutex);
-       session->s_seq++;
+       inc_session_sequence(session);
        mutex_unlock(&session->s_mutex);
 
        /* lookup inode */
index 0da39c1..b611f82 100644 (file)
@@ -873,7 +873,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,
             ceph_snap_op_name(op), split, trace_len);
 
        mutex_lock(&session->s_mutex);
-       session->s_seq++;
+       inc_session_sequence(session);
        mutex_unlock(&session->s_mutex);
 
        down_write(&mdsc->snap_rwsem);
index 2516304..33ba6f0 100644 (file)
@@ -104,8 +104,7 @@ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)
               le64_to_cpu(*((__le64 *)&monc->monmap->fsid + 1));
        mutex_unlock(&monc->mutex);
 
-       buf->f_fsid.val[0] = fsid & 0xffffffff;
-       buf->f_fsid.val[1] = fsid >> 32;
+       buf->f_fsid = u64_to_fsid(fsid);
 
        return 0;
 }
index 99b3180..905d038 100644 (file)
@@ -156,5 +156,5 @@ extern int cifs_truncate_page(struct address_space *mapping, loff_t from);
 extern const struct export_operations cifs_export_ops;
 #endif /* CONFIG_CIFS_NFSD_EXPORT */
 
-#define CIFS_VERSION   "2.28"
+#define CIFS_VERSION   "2.29"
 #endif                         /* _CIFSFS_H */
index b6925ae..484ec2d 100644 (file)
@@ -298,6 +298,10 @@ struct smb_version_operations {
        /* query file data from the server */
        int (*query_file_info)(const unsigned int, struct cifs_tcon *,
                               struct cifs_fid *, FILE_ALL_INFO *);
+       /* query reparse tag from srv to determine which type of special file */
+       int (*query_reparse_tag)(const unsigned int xid, struct cifs_tcon *tcon,
+                               struct cifs_sb_info *cifs_sb, const char *path,
+                               __u32 *reparse_tag);
        /* get server index number */
        int (*get_srv_inum)(const unsigned int, struct cifs_tcon *,
                            struct cifs_sb_info *, const char *,
index daec31b..9ee5f30 100644 (file)
@@ -656,7 +656,7 @@ smb311_posix_info_to_fattr(struct cifs_fattr *fattr, struct smb311_posix_qinfo *
 static void
 cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
                       struct super_block *sb, bool adjust_tz,
-                      bool symlink)
+                      bool symlink, u32 reparse_tag)
 {
        struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
        struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
@@ -684,8 +684,22 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
        fattr->cf_createtime = le64_to_cpu(info->CreationTime);
 
        fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks);
-
-       if (symlink) {
+       if (reparse_tag == IO_REPARSE_TAG_LX_SYMLINK) {
+               fattr->cf_mode |= S_IFLNK | cifs_sb->mnt_file_mode;
+               fattr->cf_dtype = DT_LNK;
+       } else if (reparse_tag == IO_REPARSE_TAG_LX_FIFO) {
+               fattr->cf_mode |= S_IFIFO | cifs_sb->mnt_file_mode;
+               fattr->cf_dtype = DT_FIFO;
+       } else if (reparse_tag == IO_REPARSE_TAG_AF_UNIX) {
+               fattr->cf_mode |= S_IFSOCK | cifs_sb->mnt_file_mode;
+               fattr->cf_dtype = DT_SOCK;
+       } else if (reparse_tag == IO_REPARSE_TAG_LX_CHR) {
+               fattr->cf_mode |= S_IFCHR | cifs_sb->mnt_file_mode;
+               fattr->cf_dtype = DT_CHR;
+       } else if (reparse_tag == IO_REPARSE_TAG_LX_BLK) {
+               fattr->cf_mode |= S_IFBLK | cifs_sb->mnt_file_mode;
+               fattr->cf_dtype = DT_BLK;
+       } else if (symlink) { /* TODO add more reparse tag checks */
                fattr->cf_mode = S_IFLNK;
                fattr->cf_dtype = DT_LNK;
        } else if (fattr->cf_cifsattrs & ATTR_DIRECTORY) {
@@ -740,8 +754,9 @@ cifs_get_file_info(struct file *filp)
        rc = server->ops->query_file_info(xid, tcon, &cfile->fid, &find_data);
        switch (rc) {
        case 0:
+               /* TODO: add support to query reparse tag */
                cifs_all_info_to_fattr(&fattr, &find_data, inode->i_sb, false,
-                                      false);
+                                      false, 0 /* no reparse tag */);
                break;
        case -EREMOTE:
                cifs_create_dfs_fattr(&fattr, inode->i_sb);
@@ -910,12 +925,13 @@ cifs_get_inode_info(struct inode **inode,
        struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
        bool adjust_tz = false;
        struct cifs_fattr fattr = {0};
-       bool symlink = false;
+       bool is_reparse_point = false;
        FILE_ALL_INFO *data = in_data;
        FILE_ALL_INFO *tmp_data = NULL;
        void *smb1_backup_rsp_buf = NULL;
        int rc = 0;
        int tmprc = 0;
+       __u32 reparse_tag = 0;
 
        tlink = cifs_sb_tlink(cifs_sb);
        if (IS_ERR(tlink))
@@ -938,8 +954,8 @@ cifs_get_inode_info(struct inode **inode,
                        goto out;
                }
                rc = server->ops->query_path_info(xid, tcon, cifs_sb,
-                                                 full_path, tmp_data,
-                                                 &adjust_tz, &symlink);
+                                                full_path, tmp_data,
+                                                &adjust_tz, &is_reparse_point);
                data = tmp_data;
        }
 
@@ -949,7 +965,19 @@ cifs_get_inode_info(struct inode **inode,
 
        switch (rc) {
        case 0:
-               cifs_all_info_to_fattr(&fattr, data, sb, adjust_tz, symlink);
+               /*
+                * If the file is a reparse point, it is more complicated
+                * since we have to check if its reparse tag matches a known
+                * special file type e.g. symlink or fifo or char etc.
+                */
+               if ((le32_to_cpu(data->Attributes) & ATTR_REPARSE) &&
+                   server->ops->query_reparse_tag) {
+                       rc = server->ops->query_reparse_tag(xid, tcon, cifs_sb,
+                                               full_path, &reparse_tag);
+                       cifs_dbg(FYI, "reparse tag 0x%x\n", reparse_tag);
+               }
+               cifs_all_info_to_fattr(&fattr, data, sb, adjust_tz,
+                                      is_reparse_point, reparse_tag);
                break;
        case -EREMOTE:
                /* DFS link, no metadata available on this server */
index df6212e..1f900b8 100644 (file)
@@ -506,7 +506,7 @@ move_smb2_info_to_cifs(FILE_ALL_INFO *dst, struct smb2_file_all_info *src)
 int
 smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
                     struct cifs_sb_info *cifs_sb, const char *full_path,
-                    FILE_ALL_INFO *data, bool *adjust_tz, bool *symlink)
+                    FILE_ALL_INFO *data, bool *adjust_tz, bool *reparse)
 {
        int rc;
        struct smb2_file_all_info *smb2_data;
@@ -516,7 +516,7 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
        struct cached_fid *cfid = NULL;
 
        *adjust_tz = false;
-       *symlink = false;
+       *reparse = false;
 
        smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX * 2,
                            GFP_KERNEL);
@@ -548,7 +548,7 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
                              FILE_READ_ATTRIBUTES, FILE_OPEN, create_options,
                              ACL_NO_MODE, smb2_data, SMB2_OP_QUERY_INFO, cfile);
        if (rc == -EOPNOTSUPP) {
-               *symlink = true;
+               *reparse = true;
                create_options |= OPEN_REPARSE_POINT;
 
                /* Failed on a symbolic link - query a reparse point info */
@@ -570,7 +570,7 @@ out:
 int
 smb311_posix_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
                     struct cifs_sb_info *cifs_sb, const char *full_path,
-                    struct smb311_posix_qinfo *data, bool *adjust_tz, bool *symlink)
+                    struct smb311_posix_qinfo *data, bool *adjust_tz, bool *reparse)
 {
        int rc;
        __u32 create_options = 0;
@@ -578,7 +578,7 @@ smb311_posix_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
        struct smb311_posix_qinfo *smb2_data;
 
        *adjust_tz = false;
-       *symlink = false;
+       *reparse = false;
 
        /* BB TODO: Make struct larger when add support for parsing owner SIDs */
        smb2_data = kzalloc(sizeof(struct smb311_posix_qinfo),
@@ -599,7 +599,7 @@ smb311_posix_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
                              ACL_NO_MODE, smb2_data, SMB2_OP_POSIX_QUERY_INFO, cfile);
        if (rc == -EOPNOTSUPP) {
                /* BB TODO: When support for special files added to Samba re-verify this path */
-               *symlink = true;
+               *reparse = true;
                create_options |= OPEN_REPARSE_POINT;
 
                /* Failed on a symbolic link - query a reparse point info */
index 3cde719..504766c 100644 (file)
@@ -3034,6 +3034,133 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
        return rc;
 }
 
+int
+smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
+                  struct cifs_sb_info *cifs_sb, const char *full_path,
+                  __u32 *tag)
+{
+       int rc;
+       __le16 *utf16_path = NULL;
+       __u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
+       struct cifs_open_parms oparms;
+       struct cifs_fid fid;
+       struct TCP_Server_Info *server = cifs_pick_channel(tcon->ses);
+       int flags = 0;
+       struct smb_rqst rqst[3];
+       int resp_buftype[3];
+       struct kvec rsp_iov[3];
+       struct kvec open_iov[SMB2_CREATE_IOV_SIZE];
+       struct kvec io_iov[SMB2_IOCTL_IOV_SIZE];
+       struct kvec close_iov[1];
+       struct smb2_ioctl_rsp *ioctl_rsp;
+       struct reparse_data_buffer *reparse_buf;
+       u32 plen;
+
+       cifs_dbg(FYI, "%s: path: %s\n", __func__, full_path);
+
+       if (smb3_encryption_required(tcon))
+               flags |= CIFS_TRANSFORM_REQ;
+
+       memset(rqst, 0, sizeof(rqst));
+       resp_buftype[0] = resp_buftype[1] = resp_buftype[2] = CIFS_NO_BUFFER;
+       memset(rsp_iov, 0, sizeof(rsp_iov));
+
+       utf16_path = cifs_convert_path_to_utf16(full_path, cifs_sb);
+       if (!utf16_path)
+               return -ENOMEM;
+
+       /*
+        * setup smb2open - TODO add optimization to call cifs_get_readable_path
+        * to see if there is a handle already open that we can use
+        */
+       memset(&open_iov, 0, sizeof(open_iov));
+       rqst[0].rq_iov = open_iov;
+       rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
+
+       memset(&oparms, 0, sizeof(oparms));
+       oparms.tcon = tcon;
+       oparms.desired_access = FILE_READ_ATTRIBUTES;
+       oparms.disposition = FILE_OPEN;
+       oparms.create_options = cifs_create_options(cifs_sb, OPEN_REPARSE_POINT);
+       oparms.fid = &fid;
+       oparms.reconnect = false;
+
+       rc = SMB2_open_init(tcon, server,
+                           &rqst[0], &oplock, &oparms, utf16_path);
+       if (rc)
+               goto query_rp_exit;
+       smb2_set_next_command(tcon, &rqst[0]);
+
+
+       /* IOCTL */
+       memset(&io_iov, 0, sizeof(io_iov));
+       rqst[1].rq_iov = io_iov;
+       rqst[1].rq_nvec = SMB2_IOCTL_IOV_SIZE;
+
+       rc = SMB2_ioctl_init(tcon, server,
+                            &rqst[1], fid.persistent_fid,
+                            fid.volatile_fid, FSCTL_GET_REPARSE_POINT,
+                            true /* is_fctl */, NULL, 0,
+                            CIFSMaxBufSize -
+                            MAX_SMB2_CREATE_RESPONSE_SIZE -
+                            MAX_SMB2_CLOSE_RESPONSE_SIZE);
+       if (rc)
+               goto query_rp_exit;
+
+       smb2_set_next_command(tcon, &rqst[1]);
+       smb2_set_related(&rqst[1]);
+
+
+       /* Close */
+       memset(&close_iov, 0, sizeof(close_iov));
+       rqst[2].rq_iov = close_iov;
+       rqst[2].rq_nvec = 1;
+
+       rc = SMB2_close_init(tcon, server,
+                            &rqst[2], COMPOUND_FID, COMPOUND_FID, false);
+       if (rc)
+               goto query_rp_exit;
+
+       smb2_set_related(&rqst[2]);
+
+       rc = compound_send_recv(xid, tcon->ses, server,
+                               flags, 3, rqst,
+                               resp_buftype, rsp_iov);
+
+       ioctl_rsp = rsp_iov[1].iov_base;
+
+       /*
+        * Open was successful and we got an ioctl response.
+        */
+       if (rc == 0) {
+               /* See MS-FSCC 2.3.23 */
+
+               reparse_buf = (struct reparse_data_buffer *)
+                       ((char *)ioctl_rsp +
+                        le32_to_cpu(ioctl_rsp->OutputOffset));
+               plen = le32_to_cpu(ioctl_rsp->OutputCount);
+
+               if (plen + le32_to_cpu(ioctl_rsp->OutputOffset) >
+                   rsp_iov[1].iov_len) {
+                       cifs_tcon_dbg(FYI, "srv returned invalid ioctl len: %d\n",
+                                plen);
+                       rc = -EIO;
+                       goto query_rp_exit;
+               }
+               *tag = le32_to_cpu(reparse_buf->ReparseTag);
+       }
+
+ query_rp_exit:
+       kfree(utf16_path);
+       SMB2_open_free(&rqst[0]);
+       SMB2_ioctl_free(&rqst[1]);
+       SMB2_close_free(&rqst[2]);
+       free_rsp_buf(resp_buftype[0], rsp_iov[0].iov_base);
+       free_rsp_buf(resp_buftype[1], rsp_iov[1].iov_base);
+       free_rsp_buf(resp_buftype[2], rsp_iov[2].iov_base);
+       return rc;
+}
+
 static struct cifs_ntsd *
 get_smb2_acl_by_fid(struct cifs_sb_info *cifs_sb,
                const struct cifs_fid *cifsfid, u32 *pacllen)
@@ -4986,6 +5113,8 @@ struct smb_version_operations smb30_operations = {
        .can_echo = smb2_can_echo,
        .echo = SMB2_echo,
        .query_path_info = smb2_query_path_info,
+       /* WSL tags introduced long after smb2.1, enable for SMB3, 3.11 only */
+       .query_reparse_tag = smb2_query_reparse_tag,
        .get_srv_inum = smb2_get_srv_inum,
        .query_file_info = smb2_query_file_info,
        .set_path_size = smb2_set_path_size,
@@ -5097,6 +5226,7 @@ struct smb_version_operations smb311_operations = {
        .can_echo = smb2_can_echo,
        .echo = SMB2_echo,
        .query_path_info = smb2_query_path_info,
+       .query_reparse_tag = smb2_query_reparse_tag,
        .get_srv_inum = smb2_get_srv_inum,
        .query_file_info = smb2_query_file_info,
        .set_path_size = smb2_set_path_size,
index 171f549..f05f9b1 100644 (file)
@@ -999,6 +999,31 @@ struct copychunk_ioctl_rsp {
        __le32 TotalBytesWritten;
 } __packed;
 
+/* See MS-FSCC 2.3.29 and 2.3.30 */
+struct get_retrieval_pointer_count_req {
+       __le64 StartingVcn; /* virtual cluster number (signed) */
+} __packed;
+
+struct get_retrieval_pointer_count_rsp {
+       __le32 ExtentCount;
+} __packed;
+
+/*
+ * See MS-FSCC 2.3.33 and 2.3.34
+ * request is the same as get_retrieval_point_count_req struct above
+ */
+struct smb3_extents {
+       __le64 NextVcn;
+       __le64 Lcn; /* logical cluster number */
+} __packed;
+
+struct get_retrieval_pointers_refcount_rsp {
+       __le32 ExtentCount;
+       __u32  Reserved;
+       __le64 StartingVcn;
+       struct smb3_extents extents[];
+} __packed;
+
 struct fsctl_set_integrity_information_req {
        __le16  ChecksumAlgorithm;
        __le16  Reserved;
@@ -1640,6 +1665,7 @@ struct smb2_file_rename_info { /* encoding of request for level 10 */
        __u64  RootDirectory;  /* MBZ for network operations (why says spec?) */
        __le32 FileNameLength;
        char   FileName[];     /* New name to be assigned */
+       /* padding - overall struct size must be >= 24 so filename + pad >= 6 */
 } __packed; /* level 10 Set */
 
 struct smb2_file_link_info { /* encoding of request for level 11 */
@@ -1691,6 +1717,11 @@ struct smb2_file_eof_info { /* encoding of request for level 10 */
        __le64 EndOfFile; /* new end of file value */
 } __packed; /* level 20 Set */
 
+struct smb2_file_reparse_point_info {
+       __le64 IndexNumber;
+       __le32 Tag;
+} __packed;
+
 struct smb2_file_network_open_info {
        __le64 CreationTime;
        __le64 LastAccessTime;
index 67c50d7..d411044 100644 (file)
@@ -77,6 +77,9 @@ extern void close_shroot_lease(struct cached_fid *cfid);
 extern void close_shroot_lease_locked(struct cached_fid *cfid);
 extern void move_smb2_info_to_cifs(FILE_ALL_INFO *dst,
                                   struct smb2_file_all_info *src);
+extern int smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
+                               struct cifs_sb_info *cifs_sb, const char *path,
+                               __u32 *reparse_tag);
 extern int smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
                                struct cifs_sb_info *cifs_sb,
                                const char *full_path, FILE_ALL_INFO *data,
index 1ff2852..a0e8474 100644 (file)
 #define FSCTL_SET_ZERO_ON_DEALLOC    0x00090194 /* BB add struct */
 #define FSCTL_SET_SHORT_NAME_BEHAVIOR 0x000901B4 /* BB add struct */
 #define FSCTL_GET_INTEGRITY_INFORMATION 0x0009027C
+#define FSCTL_GET_RETRIEVAL_POINTERS_AND_REFCOUNT 0x000903d3
+#define FSCTL_GET_RETRIEVAL_POINTER_COUNT 0x0009042b
 #define FSCTL_QUERY_ALLOCATED_RANGES 0x000940CF
 #define FSCTL_SET_DEFECT_MANAGEMENT  0x00098134 /* BB add struct */
 #define FSCTL_FILE_LEVEL_TRIM        0x00098208 /* BB add struct */
index 9123086..4b90cfd 100644 (file)
@@ -690,8 +690,7 @@ static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_bavail = 0;
        buf->f_files = CRAMFS_SB(sb)->files;
        buf->f_ffree = 0;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
        buf->f_namelen = CRAMFS_MAXPATHLEN;
        return 0;
 }
index d3c3e5d..d595abb 100644 (file)
@@ -269,9 +269,7 @@ unlock:
         * New inodes may not have an inode number assigned yet.
         * Hashing their inode number is delayed until later.
         */
-       if (ci->ci_inode->i_ino == 0)
-               WARN_ON(!(ci->ci_inode->i_state & I_CREATING));
-       else
+       if (ci->ci_inode->i_ino)
                fscrypt_hash_inode_number(ci, mk);
        return 0;
 }
index a768a09..686e0ad 100644 (file)
@@ -1127,24 +1127,23 @@ static const struct file_operations debugfs_devm_entry_ops = {
  *     file will be created in the root of the debugfs filesystem.
  * @read_fn: function pointer called to print the seq_file content.
  */
-struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
-                                          struct dentry *parent,
-                                          int (*read_fn)(struct seq_file *s,
-                                                         void *data))
+void debugfs_create_devm_seqfile(struct device *dev, const char *name,
+                                struct dentry *parent,
+                                int (*read_fn)(struct seq_file *s, void *data))
 {
        struct debugfs_devm_entry *entry;
 
        if (IS_ERR(parent))
-               return ERR_PTR(-ENOENT);
+               return;
 
        entry = devm_kzalloc(dev, sizeof(*entry), GFP_KERNEL);
        if (!entry)
-               return ERR_PTR(-ENOMEM);
+               return;
 
        entry->read = read_fn;
        entry->dev = dev;
 
-       return debugfs_create_file(name, S_IRUGO, parent, entry,
-                                  &debugfs_devm_entry_ops);
+       debugfs_create_file(name, S_IRUGO, parent, entry,
+                           &debugfs_devm_entry_ops);
 }
 EXPORT_SYMBOL_GPL(debugfs_create_devm_seqfile);
index a4a945d..62b155b 100644 (file)
@@ -342,8 +342,7 @@ static int efs_statfs(struct dentry *dentry, struct kstatfs *buf) {
                        sbi->inode_blocks *
                        (EFS_BLOCKSIZE / sizeof(struct efs_dinode));
        buf->f_ffree   = sbi->inode_free;       /* free inodes */
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid    = u64_to_fsid(id);
        buf->f_namelen = EFS_MAXNAMELEN;        /* max filename length */
 
        return 0;
index 139d0be..3e21c0e 100644 (file)
@@ -107,11 +107,9 @@ static struct page *erofs_read_inode(struct inode *inode,
                i_gid_write(inode, le32_to_cpu(die->i_gid));
                set_nlink(inode, le32_to_cpu(die->i_nlink));
 
-               /* ns timestamp */
-               inode->i_mtime.tv_sec = inode->i_ctime.tv_sec =
-                       le64_to_cpu(die->i_ctime);
-               inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec =
-                       le32_to_cpu(die->i_ctime_nsec);
+               /* extended inode has its own timestamp */
+               inode->i_ctime.tv_sec = le64_to_cpu(die->i_ctime);
+               inode->i_ctime.tv_nsec = le32_to_cpu(die->i_ctime_nsec);
 
                inode->i_size = le64_to_cpu(die->i_size);
 
@@ -149,11 +147,9 @@ static struct page *erofs_read_inode(struct inode *inode,
                i_gid_write(inode, le16_to_cpu(dic->i_gid));
                set_nlink(inode, le16_to_cpu(dic->i_nlink));
 
-               /* use build time to derive all file time */
-               inode->i_mtime.tv_sec = inode->i_ctime.tv_sec =
-                       sbi->build_time;
-               inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec =
-                       sbi->build_time_nsec;
+               /* use build time for compact inodes */
+               inode->i_ctime.tv_sec = sbi->build_time;
+               inode->i_ctime.tv_nsec = sbi->build_time_nsec;
 
                inode->i_size = le32_to_cpu(dic->i_size);
                if (erofs_inode_is_data_compressed(vi->datalayout))
@@ -167,6 +163,11 @@ static struct page *erofs_read_inode(struct inode *inode,
                goto err_out;
        }
 
+       inode->i_mtime.tv_sec = inode->i_ctime.tv_sec;
+       inode->i_atime.tv_sec = inode->i_ctime.tv_sec;
+       inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec;
+       inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec;
+
        if (!nblks)
                /* measure inode.i_blocks as generic filesystems */
                inode->i_blocks = roundup(inode->i_size, EROFS_BLKSIZ) >> 9;
index b9a0980..be10b16 100644 (file)
@@ -561,8 +561,7 @@ static int erofs_statfs(struct dentry *dentry, struct kstatfs *buf)
 
        buf->f_namelen = EROFS_NAME_LEN;
 
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid    = u64_to_fsid(id);
        return 0;
 }
 
index 50912a5..86fd3bf 100644 (file)
@@ -1078,8 +1078,11 @@ out_allocpage:
                cond_resched();
                goto repeat;
        }
-       set_page_private(page, (unsigned long)pcl);
-       SetPagePrivate(page);
+
+       if (tocache) {
+               set_page_private(page, (unsigned long)pcl);
+               SetPagePrivate(page);
+       }
 out:   /* the only exit (for tracing and debugging) */
        return page;
 }
index 3ffdce5..87be5bf 100644 (file)
@@ -89,8 +89,7 @@ static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_blocks = sbi->num_clusters - 2; /* clu 0 & 1 */
        buf->f_bfree = buf->f_blocks - sbi->used_clusters;
        buf->f_bavail = buf->f_bfree;
-       buf->f_fsid.val[0] = (unsigned int)id;
-       buf->f_fsid.val[1] = (unsigned int)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
        /* Unicode utf16 255 characters */
        buf->f_namelen = EXFAT_MAX_FILE_LEN * NLS_MAX_CHARSET_SIZE;
        return 0;
index 7fab2b3..09f1fe6 100644 (file)
@@ -1455,8 +1455,7 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
        buf->f_namelen = EXT2_NAME_LEN;
        fsid = le64_to_cpup((void *)es->s_uuid) ^
               le64_to_cpup((void *)es->s_uuid + sizeof(u64));
-       buf->f_fsid.val[0] = fsid & 0xFFFFFFFFUL;
-       buf->f_fsid.val[1] = (fsid >> 32) & 0xFFFFFFFFUL;
+       buf->f_fsid = u64_to_fsid(fsid);
        spin_unlock(&sbi->s_lock);
        return 0;
 }
index 5b81f3b..ca50c90 100644 (file)
@@ -669,68 +669,8 @@ const struct file_operations ext4_dir_operations = {
 };
 
 #ifdef CONFIG_UNICODE
-static int ext4_d_compare(const struct dentry *dentry, unsigned int len,
-                         const char *str, const struct qstr *name)
-{
-       struct qstr qstr = {.name = str, .len = len };
-       const struct dentry *parent = READ_ONCE(dentry->d_parent);
-       const struct inode *inode = d_inode_rcu(parent);
-       char strbuf[DNAME_INLINE_LEN];
-
-       if (!inode || !IS_CASEFOLDED(inode) ||
-           !EXT4_SB(inode->i_sb)->s_encoding) {
-               if (len != name->len)
-                       return -1;
-               return memcmp(str, name->name, len);
-       }
-
-       /*
-        * If the dentry name is stored in-line, then it may be concurrently
-        * modified by a rename.  If this happens, the VFS will eventually retry
-        * the lookup, so it doesn't matter what ->d_compare() returns.
-        * However, it's unsafe to call utf8_strncasecmp() with an unstable
-        * string.  Therefore, we have to copy the name into a temporary buffer.
-        */
-       if (len <= DNAME_INLINE_LEN - 1) {
-               memcpy(strbuf, str, len);
-               strbuf[len] = 0;
-               qstr.name = strbuf;
-               /* prevent compiler from optimizing out the temporary buffer */
-               barrier();
-       }
-
-       return ext4_ci_compare(inode, name, &qstr, false);
-}
-
-static int ext4_d_hash(const struct dentry *dentry, struct qstr *str)
-{
-       const struct ext4_sb_info *sbi = EXT4_SB(dentry->d_sb);
-       const struct unicode_map *um = sbi->s_encoding;
-       const struct inode *inode = d_inode_rcu(dentry);
-       unsigned char *norm;
-       int len, ret = 0;
-
-       if (!inode || !IS_CASEFOLDED(inode) || !um)
-               return 0;
-
-       norm = kmalloc(PATH_MAX, GFP_ATOMIC);
-       if (!norm)
-               return -ENOMEM;
-
-       len = utf8_casefold(um, str, norm, PATH_MAX);
-       if (len < 0) {
-               if (ext4_has_strict_mode(sbi))
-                       ret = -EINVAL;
-               goto out;
-       }
-       str->hash = full_name_hash(dentry, norm, len);
-out:
-       kfree(norm);
-       return ret;
-}
-
 const struct dentry_operations ext4_dentry_ops = {
-       .d_hash = ext4_d_hash,
-       .d_compare = ext4_d_compare,
+       .d_hash = generic_ci_d_hash,
+       .d_compare = generic_ci_d_compare,
 };
 #endif
index 254d1c2..1b399ca 100644 (file)
@@ -1028,9 +1028,6 @@ struct ext4_inode_info {
                                         * protected by sbi->s_fc_lock.
                                         */
 
-       /* Fast commit subtid when this inode was committed */
-       unsigned int i_fc_committed_subtid;
-
        /* Start of lblk range that needs to be committed in this fast commit */
        ext4_lblk_t i_fc_lblk_start;
 
@@ -1166,10 +1163,6 @@ struct ext4_inode_info {
 #define        EXT4_VALID_FS                   0x0001  /* Unmounted cleanly */
 #define        EXT4_ERROR_FS                   0x0002  /* Errors detected */
 #define        EXT4_ORPHAN_FS                  0x0004  /* Orphans being recovered */
-#define EXT4_FC_INELIGIBLE             0x0008  /* Fast commit ineligible */
-#define EXT4_FC_COMMITTING             0x0010  /* File system underoing a fast
-                                                * commit.
-                                                */
 #define EXT4_FC_REPLAY                 0x0020  /* Fast commit replay ongoing */
 
 /*
@@ -1426,12 +1419,6 @@ struct ext4_super_block {
 
 #ifdef __KERNEL__
 
-/*
- * run-time mount flags
- */
-#define EXT4_MF_MNTDIR_SAMPLED         0x0001
-#define EXT4_MF_FS_ABORTED             0x0002  /* Fatal error detected */
-
 #ifdef CONFIG_FS_ENCRYPTION
 #define DUMMY_ENCRYPTION_ENABLED(sbi) ((sbi)->s_dummy_enc_policy.policy != NULL)
 #else
@@ -1444,14 +1431,6 @@ struct ext4_super_block {
 #define EXT4_ENC_UTF8_12_1     1
 
 /*
- * Flags for ext4_sb_info.s_encoding_flags.
- */
-#define EXT4_ENC_STRICT_MODE_FL        (1 << 0)
-
-#define ext4_has_strict_mode(sbi) \
-       (sbi->s_encoding_flags & EXT4_ENC_STRICT_MODE_FL)
-
-/*
  * fourth extended-fs super-block data in memory
  */
 struct ext4_sb_info {
@@ -1474,7 +1453,7 @@ struct ext4_sb_info {
        struct buffer_head * __rcu *s_group_desc;
        unsigned int s_mount_opt;
        unsigned int s_mount_opt2;
-       unsigned int s_mount_flags;
+       unsigned long s_mount_flags;
        unsigned int s_def_mount_opt;
        ext4_fsblk_t s_sb_block;
        atomic64_t s_resv_clusters;
@@ -1500,10 +1479,6 @@ struct ext4_sb_info {
        struct kobject s_kobj;
        struct completion s_kobj_unregister;
        struct super_block *s_sb;
-#ifdef CONFIG_UNICODE
-       struct unicode_map *s_encoding;
-       __u16 s_encoding_flags;
-#endif
 
        /* Journaling */
        struct journal_s *s_journal;
@@ -1707,6 +1682,34 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
 })
 
 /*
+ * run-time mount flags
+ */
+enum {
+       EXT4_MF_MNTDIR_SAMPLED,
+       EXT4_MF_FS_ABORTED,     /* Fatal error detected */
+       EXT4_MF_FC_INELIGIBLE,  /* Fast commit ineligible */
+       EXT4_MF_FC_COMMITTING   /* File system underoing a fast
+                                * commit.
+                                */
+};
+
+static inline void ext4_set_mount_flag(struct super_block *sb, int bit)
+{
+       set_bit(bit, &EXT4_SB(sb)->s_mount_flags);
+}
+
+static inline void ext4_clear_mount_flag(struct super_block *sb, int bit)
+{
+       clear_bit(bit, &EXT4_SB(sb)->s_mount_flags);
+}
+
+static inline int ext4_test_mount_flag(struct super_block *sb, int bit)
+{
+       return test_bit(bit, &EXT4_SB(sb)->s_mount_flags);
+}
+
+
+/*
  * Simulate_fail codes
  */
 #define EXT4_SIM_BBITMAP_EIO   1
@@ -1875,6 +1878,13 @@ static inline bool ext4_verity_in_progress(struct inode *inode)
 #define EXT4_FEATURE_COMPAT_RESIZE_INODE       0x0010
 #define EXT4_FEATURE_COMPAT_DIR_INDEX          0x0020
 #define EXT4_FEATURE_COMPAT_SPARSE_SUPER2      0x0200
+/*
+ * The reason why "FAST_COMMIT" is a compat feature is that, FS becomes
+ * incompatible only if fast commit blocks are present in the FS. Since we
+ * clear the journal (and thus the fast commit blocks), we don't mark FS as
+ * incompatible. We also have a JBD2 incompat feature, which gets set when
+ * there are fast commit blocks present in the journal.
+ */
 #define EXT4_FEATURE_COMPAT_FAST_COMMIT                0x0400
 #define EXT4_FEATURE_COMPAT_STABLE_INODES      0x0800
 
@@ -2743,12 +2753,16 @@ extern void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate);
 int ext4_fc_info_show(struct seq_file *seq, void *v);
 void ext4_fc_init(struct super_block *sb, journal_t *journal);
 void ext4_fc_init_inode(struct inode *inode);
-void ext4_fc_track_range(struct inode *inode, ext4_lblk_t start,
+void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t start,
                         ext4_lblk_t end);
-void ext4_fc_track_unlink(struct inode *inode, struct dentry *dentry);
-void ext4_fc_track_link(struct inode *inode, struct dentry *dentry);
-void ext4_fc_track_create(struct inode *inode, struct dentry *dentry);
-void ext4_fc_track_inode(struct inode *inode);
+void __ext4_fc_track_unlink(handle_t *handle, struct inode *inode,
+       struct dentry *dentry);
+void __ext4_fc_track_link(handle_t *handle, struct inode *inode,
+       struct dentry *dentry);
+void ext4_fc_track_unlink(handle_t *handle, struct dentry *dentry);
+void ext4_fc_track_link(handle_t *handle, struct dentry *dentry);
+void ext4_fc_track_create(handle_t *handle, struct dentry *dentry);
+void ext4_fc_track_inode(handle_t *handle, struct inode *inode);
 void ext4_fc_mark_ineligible(struct super_block *sb, int reason);
 void ext4_fc_start_ineligible(struct super_block *sb, int reason);
 void ext4_fc_stop_ineligible(struct super_block *sb);
@@ -3464,7 +3478,7 @@ extern int ext4_handle_dirty_dirblock(handle_t *handle, struct inode *inode,
 extern int ext4_ci_compare(const struct inode *parent,
                           const struct qstr *fname,
                           const struct qstr *entry, bool quick);
-extern int __ext4_unlink(struct inode *dir, const struct qstr *d_name,
+extern int __ext4_unlink(handle_t *handle, struct inode *dir, const struct qstr *d_name,
                         struct inode *inode);
 extern int __ext4_link(struct inode *dir, struct inode *inode,
                       struct dentry *dentry);
index 559100f..17d7096 100644 (file)
@@ -1471,16 +1471,16 @@ static int ext4_ext_search_left(struct inode *inode,
 }
 
 /*
- * search the closest allocated block to the right for *logical
- * and returns it at @logical + it's physical address at @phys
- * if *logical is the largest allocated block, the function
- * returns 0 at @phys
- * return value contains 0 (success) or error code
+ * Search the closest allocated block to the right for *logical
+ * and returns it at @logical + it's physical address at @phys.
+ * If not exists, return 0 and @phys is set to 0. We will return
+ * 1 which means we found an allocated block and ret_ex is valid.
+ * Or return a (< 0) error code.
  */
 static int ext4_ext_search_right(struct inode *inode,
                                 struct ext4_ext_path *path,
                                 ext4_lblk_t *logical, ext4_fsblk_t *phys,
-                                struct ext4_extent **ret_ex)
+                                struct ext4_extent *ret_ex)
 {
        struct buffer_head *bh = NULL;
        struct ext4_extent_header *eh;
@@ -1574,10 +1574,11 @@ got_index:
 found_extent:
        *logical = le32_to_cpu(ex->ee_block);
        *phys = ext4_ext_pblock(ex);
-       *ret_ex = ex;
+       if (ret_ex)
+               *ret_ex = *ex;
        if (bh)
                put_bh(bh);
-       return 0;
+       return 1;
 }
 
 /*
@@ -2868,8 +2869,8 @@ again:
                         */
                        lblk = ex_end + 1;
                        err = ext4_ext_search_right(inode, path, &lblk, &pblk,
-                                                   &ex);
-                       if (err)
+                                                   NULL);
+                       if (err < 0)
                                goto out;
                        if (pblk) {
                                partial.pclu = EXT4_B2C(sbi, pblk);
@@ -3723,7 +3724,6 @@ static int ext4_convert_unwritten_extents_endio(handle_t *handle,
        err = ext4_ext_dirty(handle, inode, path + path->p_depth);
 out:
        ext4_ext_show_leaf(inode, path);
-       ext4_fc_track_range(inode, ee_block, ee_block + ee_len - 1);
        return err;
 }
 
@@ -3795,7 +3795,6 @@ convert_initialized_extent(handle_t *handle, struct inode *inode,
        if (*allocated > map->m_len)
                *allocated = map->m_len;
        map->m_len = *allocated;
-       ext4_fc_track_range(inode, ee_block, ee_block + ee_len - 1);
        return 0;
 }
 
@@ -4039,7 +4038,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
                        struct ext4_map_blocks *map, int flags)
 {
        struct ext4_ext_path *path = NULL;
-       struct ext4_extent newex, *ex, *ex2;
+       struct ext4_extent newex, *ex, ex2;
        struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
        ext4_fsblk_t newblock = 0, pblk;
        int err = 0, depth, ret;
@@ -4175,15 +4174,14 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
        if (err)
                goto out;
        ar.lright = map->m_lblk;
-       ex2 = NULL;
        err = ext4_ext_search_right(inode, path, &ar.lright, &ar.pright, &ex2);
-       if (err)
+       if (err < 0)
                goto out;
 
        /* Check if the extent after searching to the right implies a
         * cluster we can use. */
-       if ((sbi->s_cluster_ratio > 1) && ex2 &&
-           get_implied_cluster_alloc(inode->i_sb, map, ex2, path)) {
+       if ((sbi->s_cluster_ratio > 1) && err &&
+           get_implied_cluster_alloc(inode->i_sb, map, &ex2, path)) {
                ar.len = allocated = map->m_len;
                newblock = map->m_pblk;
                goto got_allocated_blocks;
@@ -4329,7 +4327,6 @@ got_allocated_blocks:
        map->m_len = ar.len;
        allocated = map->m_len;
        ext4_ext_show_leaf(inode, path);
-       ext4_fc_track_range(inode, map->m_lblk, map->m_lblk + map->m_len - 1);
 out:
        ext4_ext_drop_refs(path);
        kfree(path);
@@ -4602,7 +4599,7 @@ static long ext4_zero_range(struct file *file, loff_t offset,
        ret = ext4_mark_inode_dirty(handle, inode);
        if (unlikely(ret))
                goto out_handle;
-       ext4_fc_track_range(inode, offset >> inode->i_sb->s_blocksize_bits,
+       ext4_fc_track_range(handle, inode, offset >> inode->i_sb->s_blocksize_bits,
                        (offset + len - 1) >> inode->i_sb->s_blocksize_bits);
        /* Zero out partial block at the edges of the range */
        ret = ext4_zero_partial_blocks(handle, inode, offset, len);
@@ -4651,8 +4648,6 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
                     FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE |
                     FALLOC_FL_INSERT_RANGE))
                return -EOPNOTSUPP;
-       ext4_fc_track_range(inode, offset >> blkbits,
-                       (offset + len - 1) >> blkbits);
 
        ext4_fc_start_update(inode);
 
index 447c8d9..f2033e1 100644 (file)
@@ -83,7 +83,7 @@
  *
  * Atomicity of commits
  * --------------------
- * In order to gaurantee atomicity during the commit operation, fast commit
+ * In order to guarantee atomicity during the commit operation, fast commit
  * uses "EXT4_FC_TAG_TAIL" tag that marks a fast commit as complete. Tail
  * tag contains CRC of the contents and TID of the transaction after which
  * this fast commit should be applied. Recovery code replays fast commit
@@ -152,7 +152,31 @@ void ext4_fc_init_inode(struct inode *inode)
        INIT_LIST_HEAD(&ei->i_fc_list);
        init_waitqueue_head(&ei->i_fc_wait);
        atomic_set(&ei->i_fc_updates, 0);
-       ei->i_fc_committed_subtid = 0;
+}
+
+/* This function must be called with sbi->s_fc_lock held. */
+static void ext4_fc_wait_committing_inode(struct inode *inode)
+__releases(&EXT4_SB(inode->i_sb)->s_fc_lock)
+{
+       wait_queue_head_t *wq;
+       struct ext4_inode_info *ei = EXT4_I(inode);
+
+#if (BITS_PER_LONG < 64)
+       DEFINE_WAIT_BIT(wait, &ei->i_state_flags,
+                       EXT4_STATE_FC_COMMITTING);
+       wq = bit_waitqueue(&ei->i_state_flags,
+                               EXT4_STATE_FC_COMMITTING);
+#else
+       DEFINE_WAIT_BIT(wait, &ei->i_flags,
+                       EXT4_STATE_FC_COMMITTING);
+       wq = bit_waitqueue(&ei->i_flags,
+                               EXT4_STATE_FC_COMMITTING);
+#endif
+       lockdep_assert_held(&EXT4_SB(inode->i_sb)->s_fc_lock);
+       prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
+       spin_unlock(&EXT4_SB(inode->i_sb)->s_fc_lock);
+       schedule();
+       finish_wait(wq, &wait.wq_entry);
 }
 
 /*
@@ -176,22 +200,7 @@ restart:
                goto out;
 
        if (ext4_test_inode_state(inode, EXT4_STATE_FC_COMMITTING)) {
-               wait_queue_head_t *wq;
-#if (BITS_PER_LONG < 64)
-               DEFINE_WAIT_BIT(wait, &ei->i_state_flags,
-                               EXT4_STATE_FC_COMMITTING);
-               wq = bit_waitqueue(&ei->i_state_flags,
-                                  EXT4_STATE_FC_COMMITTING);
-#else
-               DEFINE_WAIT_BIT(wait, &ei->i_flags,
-                               EXT4_STATE_FC_COMMITTING);
-               wq = bit_waitqueue(&ei->i_flags,
-                                  EXT4_STATE_FC_COMMITTING);
-#endif
-               prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
-               spin_unlock(&EXT4_SB(inode->i_sb)->s_fc_lock);
-               schedule();
-               finish_wait(wq, &wait.wq_entry);
+               ext4_fc_wait_committing_inode(inode);
                goto restart;
        }
 out:
@@ -234,26 +243,10 @@ restart:
        }
 
        if (ext4_test_inode_state(inode, EXT4_STATE_FC_COMMITTING)) {
-               wait_queue_head_t *wq;
-#if (BITS_PER_LONG < 64)
-               DEFINE_WAIT_BIT(wait, &ei->i_state_flags,
-                               EXT4_STATE_FC_COMMITTING);
-               wq = bit_waitqueue(&ei->i_state_flags,
-                                  EXT4_STATE_FC_COMMITTING);
-#else
-               DEFINE_WAIT_BIT(wait, &ei->i_flags,
-                               EXT4_STATE_FC_COMMITTING);
-               wq = bit_waitqueue(&ei->i_flags,
-                                  EXT4_STATE_FC_COMMITTING);
-#endif
-               prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
-               spin_unlock(&EXT4_SB(inode->i_sb)->s_fc_lock);
-               schedule();
-               finish_wait(wq, &wait.wq_entry);
+               ext4_fc_wait_committing_inode(inode);
                goto restart;
        }
-       if (!list_empty(&ei->i_fc_list))
-               list_del_init(&ei->i_fc_list);
+       list_del_init(&ei->i_fc_list);
        spin_unlock(&EXT4_SB(inode->i_sb)->s_fc_lock);
 }
 
@@ -269,7 +262,7 @@ void ext4_fc_mark_ineligible(struct super_block *sb, int reason)
            (EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY))
                return;
 
-       sbi->s_mount_state |= EXT4_FC_INELIGIBLE;
+       ext4_set_mount_flag(sb, EXT4_MF_FC_INELIGIBLE);
        WARN_ON(reason >= EXT4_FC_REASON_MAX);
        sbi->s_fc_stats.fc_ineligible_reason_count[reason]++;
 }
@@ -292,7 +285,7 @@ void ext4_fc_start_ineligible(struct super_block *sb, int reason)
 }
 
 /*
- * Stop a fast commit ineligible update. We set EXT4_FC_INELIGIBLE flag here
+ * Stop a fast commit ineligible update. We set EXT4_MF_FC_INELIGIBLE flag here
  * to ensure that after stopping the ineligible update, at least one full
  * commit takes place.
  */
@@ -302,14 +295,14 @@ void ext4_fc_stop_ineligible(struct super_block *sb)
            (EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY))
                return;
 
-       EXT4_SB(sb)->s_mount_state |= EXT4_FC_INELIGIBLE;
+       ext4_set_mount_flag(sb, EXT4_MF_FC_INELIGIBLE);
        atomic_dec(&EXT4_SB(sb)->s_fc_ineligible_updates);
 }
 
 static inline int ext4_fc_is_ineligible(struct super_block *sb)
 {
-       return (EXT4_SB(sb)->s_mount_state & EXT4_FC_INELIGIBLE) ||
-               atomic_read(&EXT4_SB(sb)->s_fc_ineligible_updates);
+       return (ext4_test_mount_flag(sb, EXT4_MF_FC_INELIGIBLE) ||
+               atomic_read(&EXT4_SB(sb)->s_fc_ineligible_updates));
 }
 
 /*
@@ -323,13 +316,14 @@ static inline int ext4_fc_is_ineligible(struct super_block *sb)
  * If enqueue is set, this function enqueues the inode in fast commit list.
  */
 static int ext4_fc_track_template(
-       struct inode *inode, int (*__fc_track_fn)(struct inode *, void *, bool),
+       handle_t *handle, struct inode *inode,
+       int (*__fc_track_fn)(struct inode *, void *, bool),
        void *args, int enqueue)
 {
-       tid_t running_txn_tid;
        bool update = false;
        struct ext4_inode_info *ei = EXT4_I(inode);
        struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+       tid_t tid = 0;
        int ret;
 
        if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) ||
@@ -339,15 +333,13 @@ static int ext4_fc_track_template(
        if (ext4_fc_is_ineligible(inode->i_sb))
                return -EINVAL;
 
-       running_txn_tid = sbi->s_journal ?
-               sbi->s_journal->j_commit_sequence + 1 : 0;
-
+       tid = handle->h_transaction->t_tid;
        mutex_lock(&ei->i_fc_lock);
-       if (running_txn_tid == ei->i_sync_tid) {
+       if (tid == ei->i_sync_tid) {
                update = true;
        } else {
                ext4_fc_reset_inode(inode);
-               ei->i_sync_tid = running_txn_tid;
+               ei->i_sync_tid = tid;
        }
        ret = __fc_track_fn(inode, args, update);
        mutex_unlock(&ei->i_fc_lock);
@@ -358,7 +350,7 @@ static int ext4_fc_track_template(
        spin_lock(&sbi->s_fc_lock);
        if (list_empty(&EXT4_I(inode)->i_fc_list))
                list_add_tail(&EXT4_I(inode)->i_fc_list,
-                               (sbi->s_mount_state & EXT4_FC_COMMITTING) ?
+                               (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_COMMITTING)) ?
                                &sbi->s_fc_q[FC_Q_STAGING] :
                                &sbi->s_fc_q[FC_Q_MAIN]);
        spin_unlock(&sbi->s_fc_lock);
@@ -384,7 +376,7 @@ static int __track_dentry_update(struct inode *inode, void *arg, bool update)
        mutex_unlock(&ei->i_fc_lock);
        node = kmem_cache_alloc(ext4_fc_dentry_cachep, GFP_NOFS);
        if (!node) {
-               ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_MEM);
+               ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_NOMEM);
                mutex_lock(&ei->i_fc_lock);
                return -ENOMEM;
        }
@@ -397,7 +389,7 @@ static int __track_dentry_update(struct inode *inode, void *arg, bool update)
                if (!node->fcd_name.name) {
                        kmem_cache_free(ext4_fc_dentry_cachep, node);
                        ext4_fc_mark_ineligible(inode->i_sb,
-                               EXT4_FC_REASON_MEM);
+                               EXT4_FC_REASON_NOMEM);
                        mutex_lock(&ei->i_fc_lock);
                        return -ENOMEM;
                }
@@ -411,7 +403,7 @@ static int __track_dentry_update(struct inode *inode, void *arg, bool update)
        node->fcd_name.len = dentry->d_name.len;
 
        spin_lock(&sbi->s_fc_lock);
-       if (sbi->s_mount_state & EXT4_FC_COMMITTING)
+       if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_COMMITTING))
                list_add_tail(&node->fcd_list,
                                &sbi->s_fc_dentry_q[FC_Q_STAGING]);
        else
@@ -422,7 +414,8 @@ static int __track_dentry_update(struct inode *inode, void *arg, bool update)
        return 0;
 }
 
-void ext4_fc_track_unlink(struct inode *inode, struct dentry *dentry)
+void __ext4_fc_track_unlink(handle_t *handle,
+               struct inode *inode, struct dentry *dentry)
 {
        struct __track_dentry_update_args args;
        int ret;
@@ -430,12 +423,18 @@ void ext4_fc_track_unlink(struct inode *inode, struct dentry *dentry)
        args.dentry = dentry;
        args.op = EXT4_FC_TAG_UNLINK;
 
-       ret = ext4_fc_track_template(inode, __track_dentry_update,
+       ret = ext4_fc_track_template(handle, inode, __track_dentry_update,
                                        (void *)&args, 0);
        trace_ext4_fc_track_unlink(inode, dentry, ret);
 }
 
-void ext4_fc_track_link(struct inode *inode, struct dentry *dentry)
+void ext4_fc_track_unlink(handle_t *handle, struct dentry *dentry)
+{
+       __ext4_fc_track_unlink(handle, d_inode(dentry), dentry);
+}
+
+void __ext4_fc_track_link(handle_t *handle,
+       struct inode *inode, struct dentry *dentry)
 {
        struct __track_dentry_update_args args;
        int ret;
@@ -443,20 +442,26 @@ void ext4_fc_track_link(struct inode *inode, struct dentry *dentry)
        args.dentry = dentry;
        args.op = EXT4_FC_TAG_LINK;
 
-       ret = ext4_fc_track_template(inode, __track_dentry_update,
+       ret = ext4_fc_track_template(handle, inode, __track_dentry_update,
                                        (void *)&args, 0);
        trace_ext4_fc_track_link(inode, dentry, ret);
 }
 
-void ext4_fc_track_create(struct inode *inode, struct dentry *dentry)
+void ext4_fc_track_link(handle_t *handle, struct dentry *dentry)
+{
+       __ext4_fc_track_link(handle, d_inode(dentry), dentry);
+}
+
+void ext4_fc_track_create(handle_t *handle, struct dentry *dentry)
 {
        struct __track_dentry_update_args args;
+       struct inode *inode = d_inode(dentry);
        int ret;
 
        args.dentry = dentry;
        args.op = EXT4_FC_TAG_CREAT;
 
-       ret = ext4_fc_track_template(inode, __track_dentry_update,
+       ret = ext4_fc_track_template(handle, inode, __track_dentry_update,
                                        (void *)&args, 0);
        trace_ext4_fc_track_create(inode, dentry, ret);
 }
@@ -472,14 +477,20 @@ static int __track_inode(struct inode *inode, void *arg, bool update)
        return 0;
 }
 
-void ext4_fc_track_inode(struct inode *inode)
+void ext4_fc_track_inode(handle_t *handle, struct inode *inode)
 {
        int ret;
 
        if (S_ISDIR(inode->i_mode))
                return;
 
-       ret = ext4_fc_track_template(inode, __track_inode, NULL, 1);
+       if (ext4_should_journal_data(inode)) {
+               ext4_fc_mark_ineligible(inode->i_sb,
+                                       EXT4_FC_REASON_INODE_JOURNAL_DATA);
+               return;
+       }
+
+       ret = ext4_fc_track_template(handle, inode, __track_inode, NULL, 1);
        trace_ext4_fc_track_inode(inode, ret);
 }
 
@@ -515,7 +526,7 @@ static int __track_range(struct inode *inode, void *arg, bool update)
        return 0;
 }
 
-void ext4_fc_track_range(struct inode *inode, ext4_lblk_t start,
+void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t start,
                         ext4_lblk_t end)
 {
        struct __track_range_args args;
@@ -527,7 +538,7 @@ void ext4_fc_track_range(struct inode *inode, ext4_lblk_t start,
        args.start = start;
        args.end = end;
 
-       ret = ext4_fc_track_template(inode,  __track_range, &args, 1);
+       ret = ext4_fc_track_template(handle, inode,  __track_range, &args, 1);
 
        trace_ext4_fc_track_range(inode, start, end, ret);
 }
@@ -537,10 +548,11 @@ static void ext4_fc_submit_bh(struct super_block *sb)
        int write_flags = REQ_SYNC;
        struct buffer_head *bh = EXT4_SB(sb)->s_fc_bh;
 
+       /* TODO: REQ_FUA | REQ_PREFLUSH is unnecessarily expensive. */
        if (test_opt(sb, BARRIER))
                write_flags |= REQ_FUA | REQ_PREFLUSH;
        lock_buffer(bh);
-       clear_buffer_dirty(bh);
+       set_buffer_dirty(bh);
        set_buffer_uptodate(bh);
        bh->b_end_io = ext4_end_buffer_io_sync;
        submit_bh(REQ_OP_WRITE, write_flags, bh);
@@ -846,7 +858,7 @@ static int ext4_fc_submit_inode_data_all(journal_t *journal)
        int ret = 0;
 
        spin_lock(&sbi->s_fc_lock);
-       sbi->s_mount_state |= EXT4_FC_COMMITTING;
+       ext4_set_mount_flag(sb, EXT4_MF_FC_COMMITTING);
        list_for_each(pos, &sbi->s_fc_q[FC_Q_MAIN]) {
                ei = list_entry(pos, struct ext4_inode_info, i_fc_list);
                ext4_set_inode_state(&ei->vfs_inode, EXT4_STATE_FC_COMMITTING);
@@ -900,6 +912,8 @@ static int ext4_fc_wait_inode_data_all(journal_t *journal)
 
 /* Commit all the directory entry updates */
 static int ext4_fc_commit_dentry_updates(journal_t *journal, u32 *crc)
+__acquires(&sbi->s_fc_lock)
+__releases(&sbi->s_fc_lock)
 {
        struct super_block *sb = (struct super_block *)(journal->j_private);
        struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -964,7 +978,6 @@ static int ext4_fc_commit_dentry_updates(journal_t *journal, u32 *crc)
                        fc_dentry->fcd_parent, fc_dentry->fcd_ino,
                        fc_dentry->fcd_name.len,
                        fc_dentry->fcd_name.name, crc)) {
-                       spin_lock(&sbi->s_fc_lock);
                        ret = -ENOSPC;
                        goto lock_and_exit;
                }
@@ -997,6 +1010,13 @@ static int ext4_fc_perform_commit(journal_t *journal)
        if (ret)
                return ret;
 
+       /*
+        * If file system device is different from journal device, issue a cache
+        * flush before we start writing fast commit blocks.
+        */
+       if (journal->j_fs_dev != journal->j_dev)
+               blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS);
+
        blk_start_plug(&plug);
        if (sbi->s_fc_bytes == 0) {
                /*
@@ -1032,8 +1052,6 @@ static int ext4_fc_perform_commit(journal_t *journal)
                if (ret)
                        goto out;
                spin_lock(&sbi->s_fc_lock);
-               EXT4_I(inode)->i_fc_committed_subtid =
-                       atomic_read(&sbi->s_fc_subtid);
        }
        spin_unlock(&sbi->s_fc_lock);
 
@@ -1132,7 +1150,7 @@ out:
                "Fast commit ended with blks = %d, reason = %d, subtid - %d",
                nblks, reason, subtid);
        if (reason == EXT4_FC_REASON_FC_FAILED)
-               return jbd2_fc_end_commit_fallback(journal, commit_tid);
+               return jbd2_fc_end_commit_fallback(journal);
        if (reason == EXT4_FC_REASON_FC_START_FAILED ||
                reason == EXT4_FC_REASON_INELIGIBLE)
                return jbd2_complete_transaction(journal, commit_tid);
@@ -1191,8 +1209,8 @@ static void ext4_fc_cleanup(journal_t *journal, int full)
        list_splice_init(&sbi->s_fc_q[FC_Q_STAGING],
                                &sbi->s_fc_q[FC_Q_STAGING]);
 
-       sbi->s_mount_state &= ~EXT4_FC_COMMITTING;
-       sbi->s_mount_state &= ~EXT4_FC_INELIGIBLE;
+       ext4_clear_mount_flag(sb, EXT4_MF_FC_COMMITTING);
+       ext4_clear_mount_flag(sb, EXT4_MF_FC_INELIGIBLE);
 
        if (full)
                sbi->s_fc_bytes = 0;
@@ -1264,7 +1282,7 @@ static int ext4_fc_replay_unlink(struct super_block *sb, struct ext4_fc_tl *tl)
                return 0;
        }
 
-       ret = __ext4_unlink(old_parent, &entry, inode);
+       ret = __ext4_unlink(NULL, old_parent, &entry, inode);
        /* -ENOENT ok coz it might not exist anymore. */
        if (ret == -ENOENT)
                ret = 0;
@@ -1617,8 +1635,10 @@ static int ext4_fc_replay_add_range(struct super_block *sb,
                if (ret == 0) {
                        /* Range is not mapped */
                        path = ext4_find_extent(inode, cur, NULL, 0);
-                       if (!path)
-                               continue;
+                       if (IS_ERR(path)) {
+                               iput(inode);
+                               return 0;
+                       }
                        memset(&newex, 0, sizeof(newex));
                        newex.ee_block = cpu_to_le32(cur);
                        ext4_ext_store_pblock(
@@ -2087,13 +2107,9 @@ void ext4_fc_init(struct super_block *sb, journal_t *journal)
        if (!test_opt2(sb, JOURNAL_FAST_COMMIT))
                return;
        journal->j_fc_cleanup_callback = ext4_fc_cleanup;
-       if (jbd2_fc_init(journal, EXT4_NUM_FC_BLKS)) {
-               pr_warn("Error while enabling fast commits, turning off.");
-               ext4_clear_feature_fast_commit(sb);
-       }
 }
 
-const char *fc_ineligible_reasons[] = {
+static const char *fc_ineligible_reasons[] = {
        "Extended attributes changed",
        "Cross rename",
        "Journal flag changed",
@@ -2102,6 +2118,7 @@ const char *fc_ineligible_reasons[] = {
        "Resize",
        "Dir renamed",
        "Falloc range op",
+       "Data journalling",
        "FC Commit Failed"
 };
 
index 06907d4..3a6e5a1 100644 (file)
@@ -3,9 +3,6 @@
 #ifndef __FAST_COMMIT_H__
 #define __FAST_COMMIT_H__
 
-/* Number of blocks in journal area to allocate for fast commits */
-#define EXT4_NUM_FC_BLKS               256
-
 /* Fast commit tags */
 #define EXT4_FC_TAG_ADD_RANGE          0x0001
 #define EXT4_FC_TAG_DEL_RANGE          0x0002
@@ -100,11 +97,12 @@ enum {
        EXT4_FC_REASON_XATTR = 0,
        EXT4_FC_REASON_CROSS_RENAME,
        EXT4_FC_REASON_JOURNAL_FLAG_CHANGE,
-       EXT4_FC_REASON_MEM,
+       EXT4_FC_REASON_NOMEM,
        EXT4_FC_REASON_SWAP_BOOT,
        EXT4_FC_REASON_RESIZE,
        EXT4_FC_REASON_RENAME_DIR,
        EXT4_FC_REASON_FALLOC_RANGE,
+       EXT4_FC_REASON_INODE_JOURNAL_DATA,
        EXT4_FC_COMMIT_FAILED,
        EXT4_FC_REASON_MAX
 };
index d85412d..3ed8c04 100644 (file)
@@ -761,7 +761,6 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
        if (!daxdev_mapping_supported(vma, dax_dev))
                return -EOPNOTSUPP;
 
-       ext4_fc_start_update(inode);
        file_accessed(file);
        if (IS_DAX(file_inode(file))) {
                vma->vm_ops = &ext4_dax_vm_ops;
@@ -769,7 +768,6 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
        } else {
                vma->vm_ops = &ext4_file_vm_ops;
        }
-       ext4_fc_stop_update(inode);
        return 0;
 }
 
@@ -782,13 +780,13 @@ static int ext4_sample_last_mounted(struct super_block *sb,
        handle_t *handle;
        int err;
 
-       if (likely(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED))
+       if (likely(ext4_test_mount_flag(sb, EXT4_MF_MNTDIR_SAMPLED)))
                return 0;
 
        if (sb_rdonly(sb) || !sb_start_intwrite_trylock(sb))
                return 0;
 
-       sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED;
+       ext4_set_mount_flag(sb, EXT4_MF_MNTDIR_SAMPLED);
        /*
         * Sample where the filesystem has been mounted and
         * store it in the superblock for sysadmin convenience
index b232c27..4c2a9fe 100644 (file)
@@ -280,7 +280,7 @@ static int ext4_getfsmap_logdev(struct super_block *sb, struct ext4_fsmap *keys,
 
        /* Fabricate an rmap entry for the external log device. */
        irec.fmr_physical = journal->j_blk_offset;
-       irec.fmr_length = journal->j_maxlen;
+       irec.fmr_length = journal->j_total_len;
        irec.fmr_owner = EXT4_FMR_OWN_LOG;
        irec.fmr_flags = 0;
 
index 81a545f..a42ca95 100644 (file)
@@ -143,7 +143,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
        if (sb_rdonly(inode->i_sb)) {
                /* Make sure that we read updated s_mount_flags value */
                smp_rmb();
-               if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
+               if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FS_ABORTED))
                        ret = -EROFS;
                goto out;
        }
index 2924261..a92eb79 100644 (file)
@@ -275,7 +275,7 @@ int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
                   struct dx_hash_info *hinfo)
 {
 #ifdef CONFIG_UNICODE
-       const struct unicode_map *um = EXT4_SB(dir->i_sb)->s_encoding;
+       const struct unicode_map *um = dir->i_sb->s_encoding;
        int r, dlen;
        unsigned char *buff;
        struct qstr qstr = {.name = name, .len = len };
index caa5147..b41512d 100644 (file)
@@ -1880,6 +1880,7 @@ int ext4_inline_data_truncate(struct inode *inode, int *has_inline)
 
        ext4_write_lock_xattr(inode, &no_expand);
        if (!ext4_has_inline_data(inode)) {
+               ext4_write_unlock_xattr(inode, &no_expand);
                *has_inline = 0;
                ext4_journal_stop(handle);
                return 0;
index 03c2253..0d8385a 100644 (file)
@@ -327,6 +327,8 @@ stop_handle:
        ext4_xattr_inode_array_free(ea_inode_array);
        return;
 no_delete:
+       if (!list_empty(&EXT4_I(inode)->i_fc_list))
+               ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_NOMEM);
        ext4_clear_inode(inode);        /* We must guarantee clearing of inode... */
 }
 
@@ -730,7 +732,7 @@ out_sem:
                        if (ret)
                                return ret;
                }
-               ext4_fc_track_range(inode, map->m_lblk,
+               ext4_fc_track_range(handle, inode, map->m_lblk,
                            map->m_lblk + map->m_len - 1);
        }
 
@@ -1918,7 +1920,7 @@ static int __ext4_journalled_writepage(struct page *page,
        }
        if (ret == 0)
                ret = err;
-       err = ext4_jbd2_inode_add_write(handle, inode, 0, len);
+       err = ext4_jbd2_inode_add_write(handle, inode, page_offset(page), len);
        if (ret == 0)
                ret = err;
        EXT4_I(inode)->i_datasync_tid = handle->h_transaction->t_tid;
@@ -2440,7 +2442,7 @@ static int mpage_map_and_submit_extent(handle_t *handle,
                        struct super_block *sb = inode->i_sb;
 
                        if (ext4_forced_shutdown(EXT4_SB(sb)) ||
-                           EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED)
+                           ext4_test_mount_flag(sb, EXT4_MF_FS_ABORTED))
                                goto invalidate_dirty_pages;
                        /*
                         * Let the uper layers retry transient errors.
@@ -2674,7 +2676,7 @@ static int ext4_writepages(struct address_space *mapping,
         * the stack trace.
         */
        if (unlikely(ext4_forced_shutdown(EXT4_SB(mapping->host->i_sb)) ||
-                    sbi->s_mount_flags & EXT4_MF_FS_ABORTED)) {
+                    ext4_test_mount_flag(inode->i_sb, EXT4_MF_FS_ABORTED))) {
                ret = -EROFS;
                goto out_writepages;
        }
@@ -3307,10 +3309,11 @@ static bool ext4_inode_datasync_dirty(struct inode *inode)
 
        if (journal) {
                if (jbd2_transaction_committed(journal,
-                                       EXT4_I(inode)->i_datasync_tid))
-                       return true;
-               return atomic_read(&EXT4_SB(inode->i_sb)->s_fc_subtid) >=
-                       EXT4_I(inode)->i_fc_committed_subtid;
+                       EXT4_I(inode)->i_datasync_tid))
+                       return false;
+               if (test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT))
+                       return !list_empty(&EXT4_I(inode)->i_fc_list);
+               return true;
        }
 
        /* Any metadata buffers to write? */
@@ -4107,7 +4110,7 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
 
                up_write(&EXT4_I(inode)->i_data_sem);
        }
-       ext4_fc_track_range(inode, first_block, stop_block);
+       ext4_fc_track_range(handle, inode, first_block, stop_block);
        if (IS_SYNC(inode))
                ext4_handle_sync(handle);
 
@@ -5440,14 +5443,14 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
                        }
 
                        if (shrink)
-                               ext4_fc_track_range(inode,
+                               ext4_fc_track_range(handle, inode,
                                        (attr->ia_size > 0 ? attr->ia_size - 1 : 0) >>
                                        inode->i_sb->s_blocksize_bits,
                                        (oldsize > 0 ? oldsize - 1 : 0) >>
                                        inode->i_sb->s_blocksize_bits);
                        else
                                ext4_fc_track_range(
-                                       inode,
+                                       handle, inode,
                                        (oldsize > 0 ? oldsize - 1 : oldsize) >>
                                        inode->i_sb->s_blocksize_bits,
                                        (attr->ia_size > 0 ? attr->ia_size - 1 : 0) >>
@@ -5697,7 +5700,7 @@ int ext4_mark_iloc_dirty(handle_t *handle,
                put_bh(iloc->bh);
                return -EIO;
        }
-       ext4_fc_track_inode(inode);
+       ext4_fc_track_inode(handle, inode);
 
        if (IS_I_VERSION(inode))
                inode_inc_iversion(inode);
@@ -6157,7 +6160,8 @@ retry_alloc:
                        if (ext4_walk_page_buffers(handle, page_buffers(page),
                                        0, len, NULL, write_end_fn))
                                goto out_error;
-                       if (ext4_jbd2_inode_add_write(handle, inode, 0, len))
+                       if (ext4_jbd2_inode_add_write(handle, inode,
+                                                     page_offset(page), len))
                                goto out_error;
                        ext4_set_inode_state(inode, EXT4_STATE_JDATA);
                } else {
index 85abbfb..24af9ed 100644 (file)
@@ -4477,7 +4477,7 @@ static inline void ext4_mb_show_pa(struct super_block *sb)
 {
        ext4_group_t i, ngroups;
 
-       if (EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED)
+       if (ext4_test_mount_flag(sb, EXT4_MF_FS_ABORTED))
                return;
 
        ngroups = ext4_get_groups_count(sb);
@@ -4508,7 +4508,7 @@ static void ext4_mb_show_ac(struct ext4_allocation_context *ac)
 {
        struct super_block *sb = ac->ac_sb;
 
-       if (EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED)
+       if (ext4_test_mount_flag(sb, EXT4_MF_FS_ABORTED))
                return;
 
        mb_debug(sb, "Can't allocate:"
@@ -5167,7 +5167,7 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,
        struct super_block *sb = ar->inode->i_sb;
        ext4_group_t group;
        ext4_grpblk_t blkoff;
-       int  i;
+       int i = sb->s_blocksize;
        ext4_fsblk_t goal, block;
        struct ext4_super_block *es = EXT4_SB(sb)->s_es;
 
index 5159830..3350926 100644 (file)
@@ -1285,8 +1285,8 @@ static void dx_insert_block(struct dx_frame *frame, u32 hash, ext4_lblk_t block)
 int ext4_ci_compare(const struct inode *parent, const struct qstr *name,
                    const struct qstr *entry, bool quick)
 {
-       const struct ext4_sb_info *sbi = EXT4_SB(parent->i_sb);
-       const struct unicode_map *um = sbi->s_encoding;
+       const struct super_block *sb = parent->i_sb;
+       const struct unicode_map *um = sb->s_encoding;
        int ret;
 
        if (quick)
@@ -1298,7 +1298,7 @@ int ext4_ci_compare(const struct inode *parent, const struct qstr *name,
                /* Handle invalid character sequence as either an error
                 * or as an opaque byte sequence.
                 */
-               if (ext4_has_strict_mode(sbi))
+               if (sb_has_strict_encoding(sb))
                        return -EINVAL;
 
                if (name->len != entry->len)
@@ -1315,7 +1315,7 @@ void ext4_fname_setup_ci_filename(struct inode *dir, const struct qstr *iname,
 {
        int len;
 
-       if (!IS_CASEFOLDED(dir) || !EXT4_SB(dir->i_sb)->s_encoding) {
+       if (!IS_CASEFOLDED(dir) || !dir->i_sb->s_encoding) {
                cf_name->name = NULL;
                return;
        }
@@ -1324,7 +1324,7 @@ void ext4_fname_setup_ci_filename(struct inode *dir, const struct qstr *iname,
        if (!cf_name->name)
                return;
 
-       len = utf8_casefold(EXT4_SB(dir->i_sb)->s_encoding,
+       len = utf8_casefold(dir->i_sb->s_encoding,
                            iname, cf_name->name,
                            EXT4_NAME_LEN);
        if (len <= 0) {
@@ -1361,7 +1361,7 @@ static inline bool ext4_match(const struct inode *parent,
 #endif
 
 #ifdef CONFIG_UNICODE
-       if (EXT4_SB(parent->i_sb)->s_encoding && IS_CASEFOLDED(parent)) {
+       if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent)) {
                if (fname->cf_name.name) {
                        struct qstr cf = {.name = fname->cf_name.name,
                                          .len = fname->cf_name.len};
@@ -2180,9 +2180,6 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
        struct buffer_head *bh = NULL;
        struct ext4_dir_entry_2 *de;
        struct super_block *sb;
-#ifdef CONFIG_UNICODE
-       struct ext4_sb_info *sbi;
-#endif
        struct ext4_filename fname;
        int     retval;
        int     dx_fallback=0;
@@ -2199,9 +2196,8 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
                return -EINVAL;
 
 #ifdef CONFIG_UNICODE
-       sbi = EXT4_SB(sb);
-       if (ext4_has_strict_mode(sbi) && IS_CASEFOLDED(dir) &&
-           sbi->s_encoding && utf8_validate(sbi->s_encoding, &dentry->d_name))
+       if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) &&
+           sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name))
                return -EINVAL;
 #endif
 
@@ -2610,7 +2606,7 @@ static int ext4_create(struct inode *dir, struct dentry *dentry, umode_t mode,
                       bool excl)
 {
        handle_t *handle;
-       struct inode *inode, *inode_save;
+       struct inode *inode;
        int err, credits, retries = 0;
 
        err = dquot_initialize(dir);
@@ -2628,11 +2624,9 @@ retry:
                inode->i_op = &ext4_file_inode_operations;
                inode->i_fop = &ext4_file_operations;
                ext4_set_aops(inode);
-               inode_save = inode;
-               ihold(inode_save);
                err = ext4_add_nondir(handle, dentry, &inode);
-               ext4_fc_track_create(inode_save, dentry);
-               iput(inode_save);
+               if (!err)
+                       ext4_fc_track_create(handle, dentry);
        }
        if (handle)
                ext4_journal_stop(handle);
@@ -2647,7 +2641,7 @@ static int ext4_mknod(struct inode *dir, struct dentry *dentry,
                      umode_t mode, dev_t rdev)
 {
        handle_t *handle;
-       struct inode *inode, *inode_save;
+       struct inode *inode;
        int err, credits, retries = 0;
 
        err = dquot_initialize(dir);
@@ -2664,12 +2658,9 @@ retry:
        if (!IS_ERR(inode)) {
                init_special_inode(inode, inode->i_mode, rdev);
                inode->i_op = &ext4_special_inode_operations;
-               inode_save = inode;
-               ihold(inode_save);
                err = ext4_add_nondir(handle, dentry, &inode);
                if (!err)
-                       ext4_fc_track_create(inode_save, dentry);
-               iput(inode_save);
+                       ext4_fc_track_create(handle, dentry);
        }
        if (handle)
                ext4_journal_stop(handle);
@@ -2833,7 +2824,6 @@ out_clear_inode:
                iput(inode);
                goto out_retry;
        }
-       ext4_fc_track_create(inode, dentry);
        ext4_inc_count(dir);
 
        ext4_update_dx_flag(dir);
@@ -2841,6 +2831,7 @@ out_clear_inode:
        if (err)
                goto out_clear_inode;
        d_instantiate_new(dentry, inode);
+       ext4_fc_track_create(handle, dentry);
        if (IS_DIRSYNC(dir))
                ext4_handle_sync(handle);
 
@@ -3175,7 +3166,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
                goto end_rmdir;
        ext4_dec_count(dir);
        ext4_update_dx_flag(dir);
-       ext4_fc_track_unlink(inode, dentry);
+       ext4_fc_track_unlink(handle, dentry);
        retval = ext4_mark_inode_dirty(handle, dir);
 
 #ifdef CONFIG_UNICODE
@@ -3196,13 +3187,12 @@ end_rmdir:
        return retval;
 }
 
-int __ext4_unlink(struct inode *dir, const struct qstr *d_name,
+int __ext4_unlink(handle_t *handle, struct inode *dir, const struct qstr *d_name,
                  struct inode *inode)
 {
        int retval = -ENOENT;
        struct buffer_head *bh;
        struct ext4_dir_entry_2 *de;
-       handle_t *handle = NULL;
        int skip_remove_dentry = 0;
 
        bh = ext4_find_entry(dir, d_name, &de, NULL);
@@ -3221,14 +3211,7 @@ int __ext4_unlink(struct inode *dir, const struct qstr *d_name,
                if (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY)
                        skip_remove_dentry = 1;
                else
-                       goto out_bh;
-       }
-
-       handle = ext4_journal_start(dir, EXT4_HT_DIR,
-                                   EXT4_DATA_TRANS_BLOCKS(dir->i_sb));
-       if (IS_ERR(handle)) {
-               retval = PTR_ERR(handle);
-               goto out_bh;
+                       goto out;
        }
 
        if (IS_DIRSYNC(dir))
@@ -3237,12 +3220,12 @@ int __ext4_unlink(struct inode *dir, const struct qstr *d_name,
        if (!skip_remove_dentry) {
                retval = ext4_delete_entry(handle, dir, de, bh);
                if (retval)
-                       goto out_handle;
+                       goto out;
                dir->i_ctime = dir->i_mtime = current_time(dir);
                ext4_update_dx_flag(dir);
                retval = ext4_mark_inode_dirty(handle, dir);
                if (retval)
-                       goto out_handle;
+                       goto out;
        } else {
                retval = 0;
        }
@@ -3256,15 +3239,14 @@ int __ext4_unlink(struct inode *dir, const struct qstr *d_name,
        inode->i_ctime = current_time(inode);
        retval = ext4_mark_inode_dirty(handle, inode);
 
-out_handle:
-       ext4_journal_stop(handle);
-out_bh:
+out:
        brelse(bh);
        return retval;
 }
 
 static int ext4_unlink(struct inode *dir, struct dentry *dentry)
 {
+       handle_t *handle;
        int retval;
 
        if (unlikely(ext4_forced_shutdown(EXT4_SB(dir->i_sb))))
@@ -3282,9 +3264,16 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
        if (retval)
                goto out_trace;
 
-       retval = __ext4_unlink(dir, &dentry->d_name, d_inode(dentry));
+       handle = ext4_journal_start(dir, EXT4_HT_DIR,
+                                   EXT4_DATA_TRANS_BLOCKS(dir->i_sb));
+       if (IS_ERR(handle)) {
+               retval = PTR_ERR(handle);
+               goto out_trace;
+       }
+
+       retval = __ext4_unlink(handle, dir, &dentry->d_name, d_inode(dentry));
        if (!retval)
-               ext4_fc_track_unlink(d_inode(dentry), dentry);
+               ext4_fc_track_unlink(handle, dentry);
 #ifdef CONFIG_UNICODE
        /* VFS negative dentries are incompatible with Encoding and
         * Case-insensitiveness. Eventually we'll want avoid
@@ -3295,6 +3284,8 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
        if (IS_CASEFOLDED(dir))
                d_invalidate(dentry);
 #endif
+       if (handle)
+               ext4_journal_stop(handle);
 
 out_trace:
        trace_ext4_unlink_exit(dentry, retval);
@@ -3451,7 +3442,6 @@ retry:
 
        err = ext4_add_entry(handle, dentry, inode);
        if (!err) {
-               ext4_fc_track_link(inode, dentry);
                err = ext4_mark_inode_dirty(handle, inode);
                /* this can happen only for tmpfile being
                 * linked the first time
@@ -3459,6 +3449,7 @@ retry:
                if (inode->i_nlink == 1)
                        ext4_orphan_del(handle, inode);
                d_instantiate(dentry, inode);
+               ext4_fc_track_link(handle, dentry);
        } else {
                drop_nlink(inode);
                iput(inode);
@@ -3919,9 +3910,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
                        EXT4_FC_REASON_RENAME_DIR);
        } else {
                if (new.inode)
-                       ext4_fc_track_unlink(new.inode, new.dentry);
-               ext4_fc_track_link(old.inode, new.dentry);
-               ext4_fc_track_unlink(old.inode, old.dentry);
+                       ext4_fc_track_unlink(handle, new.dentry);
+               __ext4_fc_track_link(handle, old.inode, new.dentry);
+               __ext4_fc_track_unlink(handle, old.inode, old.dentry);
        }
 
        if (new.inode) {
index 0337347..c3b8645 100644 (file)
@@ -686,7 +686,7 @@ static void ext4_handle_error(struct super_block *sb)
        if (!test_opt(sb, ERRORS_CONT)) {
                journal_t *journal = EXT4_SB(sb)->s_journal;
 
-               EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED;
+               ext4_set_mount_flag(sb, EXT4_MF_FS_ABORTED);
                if (journal)
                        jbd2_journal_abort(journal, -EIO);
        }
@@ -904,7 +904,7 @@ void __ext4_abort(struct super_block *sb, const char *function,
        va_end(args);
 
        if (sb_rdonly(sb) == 0) {
-               EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED;
+               ext4_set_mount_flag(sb, EXT4_MF_FS_ABORTED);
                if (EXT4_SB(sb)->s_journal)
                        jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO);
 
@@ -1288,7 +1288,7 @@ static void ext4_put_super(struct super_block *sb)
        fs_put_dax(sbi->s_daxdev);
        fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);
 #ifdef CONFIG_UNICODE
-       utf8_unload(sbi->s_encoding);
+       utf8_unload(sb->s_encoding);
 #endif
        kfree(sbi);
 }
@@ -1716,11 +1716,10 @@ enum {
        Opt_dioread_nolock, Opt_dioread_lock,
        Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
        Opt_max_dir_size_kb, Opt_nojournal_checksum, Opt_nombcache,
-       Opt_prefetch_block_bitmaps, Opt_no_fc,
+       Opt_prefetch_block_bitmaps,
 #ifdef CONFIG_EXT4_DEBUG
-       Opt_fc_debug_max_replay,
+       Opt_fc_debug_max_replay, Opt_fc_debug_force
 #endif
-       Opt_fc_debug_force
 };
 
 static const match_table_t tokens = {
@@ -1807,9 +1806,8 @@ static const match_table_t tokens = {
        {Opt_init_itable, "init_itable=%u"},
        {Opt_init_itable, "init_itable"},
        {Opt_noinit_itable, "noinit_itable"},
-       {Opt_no_fc, "no_fc"},
-       {Opt_fc_debug_force, "fc_debug_force"},
 #ifdef CONFIG_EXT4_DEBUG
+       {Opt_fc_debug_force, "fc_debug_force"},
        {Opt_fc_debug_max_replay, "fc_debug_max_replay=%u"},
 #endif
        {Opt_max_dir_size_kb, "max_dir_size_kb=%u"},
@@ -2027,8 +2025,8 @@ static const struct mount_opts {
        {Opt_noquota, (EXT4_MOUNT_QUOTA | EXT4_MOUNT_USRQUOTA |
                       EXT4_MOUNT_GRPQUOTA | EXT4_MOUNT_PRJQUOTA),
                                                        MOPT_CLEAR | MOPT_Q},
-       {Opt_usrjquota, 0, MOPT_Q},
-       {Opt_grpjquota, 0, MOPT_Q},
+       {Opt_usrjquota, 0, MOPT_Q | MOPT_STRING},
+       {Opt_grpjquota, 0, MOPT_Q | MOPT_STRING},
        {Opt_offusrjquota, 0, MOPT_Q},
        {Opt_offgrpjquota, 0, MOPT_Q},
        {Opt_jqfmt_vfsold, QFMT_VFS_OLD, MOPT_QFMT},
@@ -2039,11 +2037,9 @@ static const struct mount_opts {
        {Opt_nombcache, EXT4_MOUNT_NO_MBCACHE, MOPT_SET},
        {Opt_prefetch_block_bitmaps, EXT4_MOUNT_PREFETCH_BLOCK_BITMAPS,
         MOPT_SET},
-       {Opt_no_fc, EXT4_MOUNT2_JOURNAL_FAST_COMMIT,
-        MOPT_CLEAR | MOPT_2 | MOPT_EXT4_ONLY},
+#ifdef CONFIG_EXT4_DEBUG
        {Opt_fc_debug_force, EXT4_MOUNT2_JOURNAL_FAST_COMMIT,
         MOPT_SET | MOPT_2 | MOPT_EXT4_ONLY},
-#ifdef CONFIG_EXT4_DEBUG
        {Opt_fc_debug_max_replay, 0, MOPT_GTE0},
 #endif
        {Opt_err, 0, 0}
@@ -2153,7 +2149,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
                ext4_msg(sb, KERN_WARNING, "Ignoring removed %s option", opt);
                return 1;
        case Opt_abort:
-               sbi->s_mount_flags |= EXT4_MF_FS_ABORTED;
+               ext4_set_mount_flag(sb, EXT4_MF_FS_ABORTED);
                return 1;
        case Opt_i_version:
                sb->s_flags |= SB_I_VERSION;
@@ -3976,7 +3972,7 @@ int ext4_calculate_overhead(struct super_block *sb)
         * loaded or not
         */
        if (sbi->s_journal && !sbi->s_journal_bdev)
-               overhead += EXT4_NUM_B2C(sbi, sbi->s_journal->j_maxlen);
+               overhead += EXT4_NUM_B2C(sbi, sbi->s_journal->j_total_len);
        else if (ext4_has_feature_journal(sb) && !sbi->s_journal && j_inum) {
                /* j_inum for internal journal is non-zero */
                j_inode = ext4_get_journal_inode(sb, j_inum);
@@ -4303,7 +4299,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
                goto failed_mount;
 
 #ifdef CONFIG_UNICODE
-       if (ext4_has_feature_casefold(sb) && !sbi->s_encoding) {
+       if (ext4_has_feature_casefold(sb) && !sb->s_encoding) {
                const struct ext4_sb_encodings *encoding_info;
                struct unicode_map *encoding;
                __u16 encoding_flags;
@@ -4334,15 +4330,16 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
                         "%s-%s with flags 0x%hx", encoding_info->name,
                         encoding_info->version?:"\b", encoding_flags);
 
-               sbi->s_encoding = encoding;
-               sbi->s_encoding_flags = encoding_flags;
+               sb->s_encoding = encoding;
+               sb->s_encoding_flags = encoding_flags;
        }
 #endif
 
        if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
-               printk_once(KERN_WARNING "EXT4-fs: Warning: mounting with data=journal disables delayed allocation, dioread_nolock, and O_DIRECT support!\n");
+               printk_once(KERN_WARNING "EXT4-fs: Warning: mounting with data=journal disables delayed allocation, dioread_nolock, O_DIRECT and fast_commit support!\n");
                /* can't mount with both data=journal and dioread_nolock. */
                clear_opt(sb, DIOREAD_NOLOCK);
+               clear_opt2(sb, JOURNAL_FAST_COMMIT);
                if (test_opt2(sb, EXPLICIT_DELALLOC)) {
                        ext4_msg(sb, KERN_ERR, "can't mount with "
                                 "both data=journal and delalloc");
@@ -4777,8 +4774,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
        INIT_LIST_HEAD(&sbi->s_fc_dentry_q[FC_Q_MAIN]);
        INIT_LIST_HEAD(&sbi->s_fc_dentry_q[FC_Q_STAGING]);
        sbi->s_fc_bytes = 0;
-       sbi->s_mount_state &= ~EXT4_FC_INELIGIBLE;
-       sbi->s_mount_state &= ~EXT4_FC_COMMITTING;
+       ext4_clear_mount_flag(sb, EXT4_MF_FC_INELIGIBLE);
+       ext4_clear_mount_flag(sb, EXT4_MF_FC_COMMITTING);
        spin_lock_init(&sbi->s_fc_lock);
        memset(&sbi->s_fc_stats, 0, sizeof(sbi->s_fc_stats));
        sbi->s_fc_replay_state.fc_regions = NULL;
@@ -4857,6 +4854,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
                goto failed_mount_wq;
        }
 
+       if (test_opt2(sb, JOURNAL_FAST_COMMIT) &&
+               !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0,
+                                         JBD2_FEATURE_INCOMPAT_FAST_COMMIT)) {
+               ext4_msg(sb, KERN_ERR,
+                       "Failed to set fast commit journal feature");
+               goto failed_mount_wq;
+       }
+
        /* We have now updated the journal if required, so we can
         * validate the data journaling mode. */
        switch (test_opt(sb, DATA_FLAGS)) {
@@ -4975,7 +4980,7 @@ no_journal:
        }
 
 #ifdef CONFIG_UNICODE
-       if (sbi->s_encoding)
+       if (sb->s_encoding)
                sb->s_d_op = &ext4_dentry_ops;
 #endif
 
@@ -5184,7 +5189,7 @@ failed_mount:
                crypto_free_shash(sbi->s_chksum_driver);
 
 #ifdef CONFIG_UNICODE
-       utf8_unload(sbi->s_encoding);
+       utf8_unload(sb->s_encoding);
 #endif
 
 #ifdef CONFIG_QUOTA
@@ -5872,7 +5877,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
                goto restore_opts;
        }
 
-       if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
+       if (ext4_test_mount_flag(sb, EXT4_MF_FS_ABORTED))
                ext4_abort(sb, EXT4_ERR_ESHUTDOWN, "Abort forced by user");
 
        sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
@@ -5886,7 +5891,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
        }
 
        if ((bool)(*flags & SB_RDONLY) != sb_rdonly(sb)) {
-               if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) {
+               if (ext4_test_mount_flag(sb, EXT4_MF_FS_ABORTED)) {
                        err = -EROFS;
                        goto restore_opts;
                }
@@ -6144,8 +6149,7 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_namelen = EXT4_NAME_LEN;
        fsid = le64_to_cpup((void *)es->s_uuid) ^
               le64_to_cpup((void *)es->s_uuid + sizeof(u64));
-       buf->f_fsid.val[0] = fsid & 0xFFFFFFFFUL;
-       buf->f_fsid.val[1] = (fsid >> 32) & 0xFFFFFFFFUL;
+       buf->f_fsid = u64_to_fsid(fsid);
 
 #ifdef CONFIG_QUOTA
        if (ext4_test_inode_flag(dentry->d_inode, EXT4_INODE_PROJINHERIT) &&
@@ -6561,10 +6565,6 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
        brelse(bh);
 out:
        if (inode->i_size < off + len) {
-               ext4_fc_track_range(inode,
-                       (inode->i_size > 0 ? inode->i_size - 1 : 0)
-                               >> inode->i_sb->s_blocksize_bits,
-                       (off + len) >> inode->i_sb->s_blocksize_bits);
                i_size_write(inode, off + len);
                EXT4_I(inode)->i_disksize = inode->i_size;
                err2 = ext4_mark_inode_dirty(handle, inode);
index 5ff33d1..4e27fe6 100644 (file)
@@ -315,6 +315,7 @@ EXT4_ATTR_FEATURE(casefold);
 EXT4_ATTR_FEATURE(verity);
 #endif
 EXT4_ATTR_FEATURE(metadata_csum_seed);
+EXT4_ATTR_FEATURE(fast_commit);
 
 static struct attribute *ext4_feat_attrs[] = {
        ATTR_LIST(lazy_itable_init),
@@ -331,6 +332,7 @@ static struct attribute *ext4_feat_attrs[] = {
        ATTR_LIST(verity),
 #endif
        ATTR_LIST(metadata_csum_seed),
+       ATTR_LIST(fast_commit),
        NULL,
 };
 ATTRIBUTE_GROUPS(ext4_feat);
index 0c958fe..00eff2f 100644 (file)
@@ -1442,8 +1442,7 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
        }
 
        buf->f_namelen = F2FS_NAME_LEN;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid    = u64_to_fsid(id);
 
 #ifdef CONFIG_QUOTA
        if (is_inode_flag_set(dentry->d_inode, FI_PROJ_INHERIT) &&
index a0cf99d..bab9b20 100644 (file)
@@ -836,8 +836,7 @@ static int fat_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_blocks = sbi->max_cluster - FAT_START_ENT;
        buf->f_bfree = sbi->free_clusters;
        buf->f_bavail = sbi->free_clusters;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
        buf->f_namelen =
                (sbi->options.isvfat ? FAT_LFN_LEN : 12) * NLS_MAX_CHARSET_SIZE;
 
index 5441c17..d98a2e5 100644 (file)
@@ -1078,7 +1078,8 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
 out_free:
        kfree(gl->gl_lksb.sb_lvbptr);
        kmem_cache_free(cachep, gl);
-       atomic_dec(&sdp->sd_glock_disposal);
+       if (atomic_dec_and_test(&sdp->sd_glock_disposal))
+               wake_up(&sdp->sd_glock_wait);
 
 out:
        return ret;
index aa3f523..6c1432d 100644 (file)
@@ -165,6 +165,31 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
 }
 
 /**
+ * gfs2_rgrp_metasync - sync out the metadata of a resource group
+ * @gl: the glock protecting the resource group
+ *
+ */
+
+static int gfs2_rgrp_metasync(struct gfs2_glock *gl)
+{
+       struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
+       struct address_space *metamapping = &sdp->sd_aspace;
+       struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl);
+       const unsigned bsize = sdp->sd_sb.sb_bsize;
+       loff_t start = (rgd->rd_addr * bsize) & PAGE_MASK;
+       loff_t end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1;
+       int error;
+
+       filemap_fdatawrite_range(metamapping, start, end);
+       error = filemap_fdatawait_range(metamapping, start, end);
+       WARN_ON_ONCE(error && !gfs2_withdrawn(sdp));
+       mapping_set_error(metamapping, error);
+       if (error)
+               gfs2_io_error(sdp);
+       return error;
+}
+
+/**
  * rgrp_go_sync - sync out the metadata for this glock
  * @gl: the glock
  *
@@ -176,11 +201,7 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
 static int rgrp_go_sync(struct gfs2_glock *gl)
 {
        struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
-       struct address_space *mapping = &sdp->sd_aspace;
        struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl);
-       const unsigned bsize = sdp->sd_sb.sb_bsize;
-       loff_t start = (rgd->rd_addr * bsize) & PAGE_MASK;
-       loff_t end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1;
        int error;
 
        if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags))
@@ -189,10 +210,7 @@ static int rgrp_go_sync(struct gfs2_glock *gl)
 
        gfs2_log_flush(sdp, gl, GFS2_LOG_HEAD_FLUSH_NORMAL |
                       GFS2_LFC_RGRP_GO_SYNC);
-       filemap_fdatawrite_range(mapping, start, end);
-       error = filemap_fdatawait_range(mapping, start, end);
-       WARN_ON_ONCE(error && !gfs2_withdrawn(sdp));
-       mapping_set_error(mapping, error);
+       error = gfs2_rgrp_metasync(gl);
        if (!error)
                error = gfs2_ail_empty_gl(gl);
        gfs2_free_clones(rgd);
@@ -266,7 +284,24 @@ static void gfs2_clear_glop_pending(struct gfs2_inode *ip)
 }
 
 /**
- * inode_go_sync - Sync the dirty data and/or metadata for an inode glock
+ * gfs2_inode_metasync - sync out the metadata of an inode
+ * @gl: the glock protecting the inode
+ *
+ */
+int gfs2_inode_metasync(struct gfs2_glock *gl)
+{
+       struct address_space *metamapping = gfs2_glock2aspace(gl);
+       int error;
+
+       filemap_fdatawrite(metamapping);
+       error = filemap_fdatawait(metamapping);
+       if (error)
+               gfs2_io_error(gl->gl_name.ln_sbd);
+       return error;
+}
+
+/**
+ * inode_go_sync - Sync the dirty metadata of an inode
  * @gl: the glock protecting the inode
  *
  */
@@ -297,8 +332,7 @@ static int inode_go_sync(struct gfs2_glock *gl)
                error = filemap_fdatawait(mapping);
                mapping_set_error(mapping, error);
        }
-       ret = filemap_fdatawait(metamapping);
-       mapping_set_error(metamapping, ret);
+       ret = gfs2_inode_metasync(gl);
        if (!error)
                error = ret;
        gfs2_ail_empty_gl(gl);
index 2dd192e..695898a 100644 (file)
@@ -22,6 +22,7 @@ extern const struct gfs2_glock_operations gfs2_quota_glops;
 extern const struct gfs2_glock_operations gfs2_journal_glops;
 extern const struct gfs2_glock_operations *gfs2_glops_list[];
 
+extern int gfs2_inode_metasync(struct gfs2_glock *gl);
 extern void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync);
 
 #endif /* __GLOPS_DOT_H__ */
index 6774865..077ccb1 100644 (file)
@@ -180,7 +180,8 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
                error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED, GL_EXACT, &ip->i_iopen_gh);
                if (unlikely(error))
                        goto fail;
-               gfs2_cancel_delete_work(ip->i_iopen_gh.gh_gl);
+               if (blktype != GFS2_BLKST_UNLINKED)
+                       gfs2_cancel_delete_work(ip->i_iopen_gh.gh_gl);
                glock_set_object(ip->i_iopen_gh.gh_gl, ip);
                gfs2_glock_put(io_gl);
                io_gl = NULL;
index ed69298..3922b26 100644 (file)
@@ -22,6 +22,7 @@
 #include "incore.h"
 #include "inode.h"
 #include "glock.h"
+#include "glops.h"
 #include "log.h"
 #include "lops.h"
 #include "meta_io.h"
@@ -817,41 +818,19 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, u32 start,
        return error;
 }
 
-/**
- * gfs2_meta_sync - Sync all buffers associated with a glock
- * @gl: The glock
- *
- */
-
-void gfs2_meta_sync(struct gfs2_glock *gl)
-{
-       struct address_space *mapping = gfs2_glock2aspace(gl);
-       struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
-       int error;
-
-       if (mapping == NULL)
-               mapping = &sdp->sd_aspace;
-
-       filemap_fdatawrite(mapping);
-       error = filemap_fdatawait(mapping);
-
-       if (error)
-               gfs2_io_error(gl->gl_name.ln_sbd);
-}
-
 static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
 {
        struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
        struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
 
        if (error) {
-               gfs2_meta_sync(ip->i_gl);
+               gfs2_inode_metasync(ip->i_gl);
                return;
        }
        if (pass != 1)
                return;
 
-       gfs2_meta_sync(ip->i_gl);
+       gfs2_inode_metasync(ip->i_gl);
 
        fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n",
                jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks);
@@ -1060,14 +1039,14 @@ static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
        struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
 
        if (error) {
-               gfs2_meta_sync(ip->i_gl);
+               gfs2_inode_metasync(ip->i_gl);
                return;
        }
        if (pass != 1)
                return;
 
        /* data sync? */
-       gfs2_meta_sync(ip->i_gl);
+       gfs2_inode_metasync(ip->i_gl);
 
        fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n",
                jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks);
index 4a3d8ae..fbdbb08 100644 (file)
@@ -27,8 +27,6 @@ extern void gfs2_log_submit_bio(struct bio **biop, int opf);
 extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
 extern int gfs2_find_jhead(struct gfs2_jdesc *jd,
                           struct gfs2_log_header_host *head, bool keep_cache);
-extern void gfs2_meta_sync(struct gfs2_glock *gl);
-
 static inline unsigned int buf_limit(struct gfs2_sbd *sdp)
 {
        unsigned int limit;
index 7a7e3c1..61fce59 100644 (file)
@@ -633,8 +633,10 @@ static int init_statfs(struct gfs2_sbd *sdp)
        if (IS_ERR(sdp->sd_statfs_inode)) {
                error = PTR_ERR(sdp->sd_statfs_inode);
                fs_err(sdp, "can't read in statfs inode: %d\n", error);
-               goto fail;
+               goto out;
        }
+       if (sdp->sd_args.ar_spectator)
+               goto out;
 
        pn = gfs2_lookup_simple(master, "per_node");
        if (IS_ERR(pn)) {
@@ -682,15 +684,17 @@ free_local:
        iput(pn);
 put_statfs:
        iput(sdp->sd_statfs_inode);
-fail:
+out:
        return error;
 }
 
 /* Uninitialize and free up memory used by the list of statfs inodes */
 static void uninit_statfs(struct gfs2_sbd *sdp)
 {
-       gfs2_glock_dq_uninit(&sdp->sd_sc_gh);
-       free_local_statfs_inodes(sdp);
+       if (!sdp->sd_args.ar_spectator) {
+               gfs2_glock_dq_uninit(&sdp->sd_sc_gh);
+               free_local_statfs_inodes(sdp);
+       }
        iput(sdp->sd_statfs_inode);
 }
 
@@ -704,7 +708,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
 
        if (undo) {
                jindex = 0;
-               goto fail_jinode_gh;
+               goto fail_statfs;
        }
 
        sdp->sd_jindex = gfs2_lookup_simple(master, "jindex");
index b5cbe21..c26c68e 100644 (file)
@@ -349,7 +349,7 @@ static int update_statfs_inode(struct gfs2_jdesc *jd,
 
        mark_buffer_dirty(bh);
        brelse(bh);
-       gfs2_meta_sync(ip->i_gl);
+       gfs2_inode_metasync(ip->i_gl);
 
 out:
        return error;
index ee491bb..92d799a 100644 (file)
@@ -719,9 +719,9 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
                }
 
                gfs2_free_clones(rgd);
+               return_all_reservations(rgd);
                kfree(rgd->rd_bits);
                rgd->rd_bits = NULL;
-               return_all_reservations(rgd);
                kmem_cache_free(gfs2_rgrpd_cachep, rgd);
        }
 }
@@ -1370,6 +1370,9 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
+       if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
+               return -EROFS;
+
        if (!blk_queue_discard(q))
                return -EOPNOTSUPP;
 
index b285192..b3d951a 100644 (file)
@@ -738,6 +738,7 @@ restart:
        gfs2_jindex_free(sdp);
        /*  Take apart glock structures and buffer lists  */
        gfs2_gl_hash_clear(sdp);
+       truncate_inode_pages_final(&sdp->sd_aspace);
        gfs2_delete_debugfs_file(sdp);
        /*  Unmount the locking protocol  */
        gfs2_lm_unmount(sdp);
index dcc2aab..4ba45ca 100644 (file)
@@ -60,7 +60,7 @@ struct hfs_bnode {
        wait_queue_head_t lock_wq;
        atomic_t refcnt;
        unsigned int page_offset;
-       struct page *page[0];
+       struct page *page[];
 };
 
 #define HFS_BNODE_ERROR                0
index c333246..44d07c9 100644 (file)
@@ -104,8 +104,7 @@ static int hfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_bavail = buf->f_bfree;
        buf->f_files = HFS_SB(sb)->fs_ablocks;
        buf->f_ffree = HFS_SB(sb)->free_ablocks;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
        buf->f_namelen = HFS_NAMELEN;
 
        return 0;
index 3b03fff..a92de51 100644 (file)
@@ -117,7 +117,7 @@ struct hfs_bnode {
        wait_queue_head_t lock_wq;
        atomic_t refcnt;
        unsigned int page_offset;
-       struct page *page[0];
+       struct page *page[];
 };
 
 #define HFS_BNODE_LOCK         0
index 129dca3..807119a 100644 (file)
@@ -320,8 +320,7 @@ static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_bavail = buf->f_bfree;
        buf->f_files = 0xFFFFFFFF;
        buf->f_ffree = 0xFFFFFFFF - sbi->next_cnid;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
        buf->f_namelen = HFSPLUS_MAX_STRLEN;
 
        return 0;
index 0a677a9..a7dbfc8 100644 (file)
@@ -192,8 +192,7 @@ static int hpfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_bavail = sbi->sb_n_free;
        buf->f_files = sbi->sb_dirband_size / 4;
        buf->f_ffree = hpfs_get_free_dnodes(s);
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
        buf->f_namelen = 254;
 
        hpfs_unlock(s);
index 7cb3b4c..b53c055 100644 (file)
@@ -19,7 +19,9 @@
 #include <linux/task_work.h>
 #include <linux/blk-cgroup.h>
 #include <linux/audit.h>
+#include <linux/cpu.h>
 
+#include "../kernel/sched/sched.h"
 #include "io-wq.h"
 
 #define WORKER_IDLE_TIMEOUT    (5 * HZ)
@@ -123,9 +125,13 @@ struct io_wq {
        refcount_t refs;
        struct completion done;
 
+       struct hlist_node cpuhp_node;
+
        refcount_t use_refs;
 };
 
+static enum cpuhp_state io_wq_online;
+
 static bool io_worker_get(struct io_worker *worker)
 {
        return refcount_inc_not_zero(&worker->ref);
@@ -187,7 +193,8 @@ static bool __io_worker_unuse(struct io_wqe *wqe, struct io_worker *worker)
                worker->blkcg_css = NULL;
        }
 #endif
-
+       if (current->signal->rlim[RLIMIT_FSIZE].rlim_cur != RLIM_INFINITY)
+               current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
        return dropped_lock;
 }
 
@@ -475,6 +482,10 @@ static void io_impersonate_work(struct io_worker *worker,
                current->files = work->identity->files;
                current->nsproxy = work->identity->nsproxy;
                task_unlock(current);
+               if (!work->identity->files) {
+                       /* failed grabbing files, ensure work gets cancelled */
+                       work->flags |= IO_WQ_WORK_CANCEL;
+               }
        }
        if ((work->flags & IO_WQ_WORK_FS) && current->fs != work->identity->fs)
                current->fs = work->identity->fs;
@@ -483,7 +494,10 @@ static void io_impersonate_work(struct io_worker *worker,
        if ((work->flags & IO_WQ_WORK_CREDS) &&
            worker->cur_creds != work->identity->creds)
                io_wq_switch_creds(worker, work);
-       current->signal->rlim[RLIMIT_FSIZE].rlim_cur = work->identity->fsize;
+       if (work->flags & IO_WQ_WORK_FSIZE)
+               current->signal->rlim[RLIMIT_FSIZE].rlim_cur = work->identity->fsize;
+       else if (current->signal->rlim[RLIMIT_FSIZE].rlim_cur != RLIM_INFINITY)
+               current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
        io_wq_switch_blkcg(worker, work);
 #ifdef CONFIG_AUDIT
        current->loginuid = work->identity->loginuid;
@@ -1087,10 +1101,12 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
                return ERR_PTR(-ENOMEM);
 
        wq->wqes = kcalloc(nr_node_ids, sizeof(struct io_wqe *), GFP_KERNEL);
-       if (!wq->wqes) {
-               kfree(wq);
-               return ERR_PTR(-ENOMEM);
-       }
+       if (!wq->wqes)
+               goto err_wq;
+
+       ret = cpuhp_state_add_instance_nocalls(io_wq_online, &wq->cpuhp_node);
+       if (ret)
+               goto err_wqes;
 
        wq->free_work = data->free_work;
        wq->do_work = data->do_work;
@@ -1098,6 +1114,7 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
        /* caller must already hold a reference to this */
        wq->user = data->user;
 
+       ret = -ENOMEM;
        for_each_node(node) {
                struct io_wqe *wqe;
                int alloc_node = node;
@@ -1141,9 +1158,12 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
        ret = PTR_ERR(wq->manager);
        complete(&wq->done);
 err:
+       cpuhp_state_remove_instance_nocalls(io_wq_online, &wq->cpuhp_node);
        for_each_node(node)
                kfree(wq->wqes[node]);
+err_wqes:
        kfree(wq->wqes);
+err_wq:
        kfree(wq);
        return ERR_PTR(ret);
 }
@@ -1160,6 +1180,8 @@ static void __io_wq_destroy(struct io_wq *wq)
 {
        int node;
 
+       cpuhp_state_remove_instance_nocalls(io_wq_online, &wq->cpuhp_node);
+
        set_bit(IO_WQ_BIT_EXIT, &wq->state);
        if (wq->manager)
                kthread_stop(wq->manager);
@@ -1187,3 +1209,41 @@ struct task_struct *io_wq_get_task(struct io_wq *wq)
 {
        return wq->manager;
 }
+
+static bool io_wq_worker_affinity(struct io_worker *worker, void *data)
+{
+       struct task_struct *task = worker->task;
+       struct rq_flags rf;
+       struct rq *rq;
+
+       rq = task_rq_lock(task, &rf);
+       do_set_cpus_allowed(task, cpumask_of_node(worker->wqe->node));
+       task->flags |= PF_NO_SETAFFINITY;
+       task_rq_unlock(rq, task, &rf);
+       return false;
+}
+
+static int io_wq_cpu_online(unsigned int cpu, struct hlist_node *node)
+{
+       struct io_wq *wq = hlist_entry_safe(node, struct io_wq, cpuhp_node);
+       int i;
+
+       rcu_read_lock();
+       for_each_node(i)
+               io_wq_for_each_worker(wq->wqes[i], io_wq_worker_affinity, NULL);
+       rcu_read_unlock();
+       return 0;
+}
+
+static __init int io_wq_init(void)
+{
+       int ret;
+
+       ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "io-wq/online",
+                                       io_wq_cpu_online, NULL);
+       if (ret < 0)
+               return ret;
+       io_wq_online = ret;
+       return 0;
+}
+subsys_initcall(io_wq_init);
index be21c50..cba36f0 100644 (file)
@@ -17,6 +17,7 @@ enum {
        IO_WQ_WORK_MM           = 128,
        IO_WQ_WORK_CREDS        = 256,
        IO_WQ_WORK_BLKCG        = 512,
+       IO_WQ_WORK_FSIZE        = 1024,
 
        IO_WQ_HASH_SHIFT        = 24,   /* upper 8 bits are used for hash key */
 };
index 626a9d1..8018c70 100644 (file)
@@ -277,7 +277,7 @@ struct io_ring_ctx {
                unsigned                sq_mask;
                unsigned                sq_thread_idle;
                unsigned                cached_sq_dropped;
-               atomic_t                cached_cq_overflow;
+               unsigned                cached_cq_overflow;
                unsigned long           sq_check_overflow;
 
                struct list_head        defer_list;
@@ -585,6 +585,7 @@ enum {
        REQ_F_BUFFER_SELECTED_BIT,
        REQ_F_NO_FILE_TABLE_BIT,
        REQ_F_WORK_INITIALIZED_BIT,
+       REQ_F_LTIMEOUT_ACTIVE_BIT,
 
        /* not a real bit, just to check we're not overflowing the space */
        __REQ_F_LAST_BIT,
@@ -614,7 +615,7 @@ enum {
        REQ_F_CUR_POS           = BIT(REQ_F_CUR_POS_BIT),
        /* must not punt to workers */
        REQ_F_NOWAIT            = BIT(REQ_F_NOWAIT_BIT),
-       /* has linked timeout */
+       /* has or had linked timeout */
        REQ_F_LINK_TIMEOUT      = BIT(REQ_F_LINK_TIMEOUT_BIT),
        /* regular file */
        REQ_F_ISREG             = BIT(REQ_F_ISREG_BIT),
@@ -628,6 +629,8 @@ enum {
        REQ_F_NO_FILE_TABLE     = BIT(REQ_F_NO_FILE_TABLE_BIT),
        /* io_wq_work is initialized */
        REQ_F_WORK_INITIALIZED  = BIT(REQ_F_WORK_INITIALIZED_BIT),
+       /* linked timeout is active, i.e. prepared by link's head */
+       REQ_F_LTIMEOUT_ACTIVE   = BIT(REQ_F_LTIMEOUT_ACTIVE_BIT),
 };
 
 struct async_poll {
@@ -750,8 +753,6 @@ struct io_op_def {
        unsigned                pollout : 1;
        /* op supports buffer selection */
        unsigned                buffer_select : 1;
-       /* needs rlimit(RLIMIT_FSIZE) assigned */
-       unsigned                needs_fsize : 1;
        /* must always have async data allocated */
        unsigned                needs_async_data : 1;
        /* size of async data needed, if any */
@@ -775,10 +776,10 @@ static const struct io_op_def io_op_defs[] = {
                .hash_reg_file          = 1,
                .unbound_nonreg_file    = 1,
                .pollout                = 1,
-               .needs_fsize            = 1,
                .needs_async_data       = 1,
                .async_size             = sizeof(struct io_async_rw),
-               .work_flags             = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG,
+               .work_flags             = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG |
+                                               IO_WQ_WORK_FSIZE,
        },
        [IORING_OP_FSYNC] = {
                .needs_file             = 1,
@@ -789,16 +790,16 @@ static const struct io_op_def io_op_defs[] = {
                .unbound_nonreg_file    = 1,
                .pollin                 = 1,
                .async_size             = sizeof(struct io_async_rw),
-               .work_flags             = IO_WQ_WORK_BLKCG,
+               .work_flags             = IO_WQ_WORK_BLKCG | IO_WQ_WORK_MM,
        },
        [IORING_OP_WRITE_FIXED] = {
                .needs_file             = 1,
                .hash_reg_file          = 1,
                .unbound_nonreg_file    = 1,
                .pollout                = 1,
-               .needs_fsize            = 1,
                .async_size             = sizeof(struct io_async_rw),
-               .work_flags             = IO_WQ_WORK_BLKCG,
+               .work_flags             = IO_WQ_WORK_BLKCG | IO_WQ_WORK_FSIZE |
+                                               IO_WQ_WORK_MM,
        },
        [IORING_OP_POLL_ADD] = {
                .needs_file             = 1,
@@ -856,8 +857,7 @@ static const struct io_op_def io_op_defs[] = {
        },
        [IORING_OP_FALLOCATE] = {
                .needs_file             = 1,
-               .needs_fsize            = 1,
-               .work_flags             = IO_WQ_WORK_BLKCG,
+               .work_flags             = IO_WQ_WORK_BLKCG | IO_WQ_WORK_FSIZE,
        },
        [IORING_OP_OPENAT] = {
                .work_flags             = IO_WQ_WORK_FILES | IO_WQ_WORK_BLKCG |
@@ -887,9 +887,9 @@ static const struct io_op_def io_op_defs[] = {
                .needs_file             = 1,
                .unbound_nonreg_file    = 1,
                .pollout                = 1,
-               .needs_fsize            = 1,
                .async_size             = sizeof(struct io_async_rw),
-               .work_flags             = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG,
+               .work_flags             = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG |
+                                               IO_WQ_WORK_FSIZE,
        },
        [IORING_OP_FADVISE] = {
                .needs_file             = 1,
@@ -995,20 +995,33 @@ static void io_sq_thread_drop_mm(void)
        if (mm) {
                kthread_unuse_mm(mm);
                mmput(mm);
+               current->mm = NULL;
        }
 }
 
 static int __io_sq_thread_acquire_mm(struct io_ring_ctx *ctx)
 {
-       if (!current->mm) {
-               if (unlikely(!(ctx->flags & IORING_SETUP_SQPOLL) ||
-                            !ctx->sqo_task->mm ||
-                            !mmget_not_zero(ctx->sqo_task->mm)))
-                       return -EFAULT;
-               kthread_use_mm(ctx->sqo_task->mm);
+       struct mm_struct *mm;
+
+       if (current->mm)
+               return 0;
+
+       /* Should never happen */
+       if (unlikely(!(ctx->flags & IORING_SETUP_SQPOLL)))
+               return -EFAULT;
+
+       task_lock(ctx->sqo_task);
+       mm = ctx->sqo_task->mm;
+       if (unlikely(!mm || !mmget_not_zero(mm)))
+               mm = NULL;
+       task_unlock(ctx->sqo_task);
+
+       if (mm) {
+               kthread_use_mm(mm);
+               return 0;
        }
 
-       return 0;
+       return -EFAULT;
 }
 
 static int io_sq_thread_acquire_mm(struct io_ring_ctx *ctx,
@@ -1070,6 +1083,12 @@ static void io_init_identity(struct io_identity *id)
        refcount_set(&id->count, 1);
 }
 
+static inline void __io_req_init_async(struct io_kiocb *req)
+{
+       memset(&req->work, 0, sizeof(req->work));
+       req->flags |= REQ_F_WORK_INITIALIZED;
+}
+
 /*
  * Note: must call io_req_init_async() for the first time you
  * touch any members of io_wq_work.
@@ -1081,8 +1100,7 @@ static inline void io_req_init_async(struct io_kiocb *req)
        if (req->flags & REQ_F_WORK_INITIALIZED)
                return;
 
-       memset(&req->work, 0, sizeof(req->work));
-       req->flags |= REQ_F_WORK_INITIALIZED;
+       __io_req_init_async(req);
 
        /* Grab a ref if this isn't our static identity */
        req->work.identity = tctx->identity;
@@ -1174,7 +1192,7 @@ static bool req_need_defer(struct io_kiocb *req, u32 seq)
                struct io_ring_ctx *ctx = req->ctx;
 
                return seq != ctx->cached_cq_tail
-                               + atomic_read(&ctx->cached_cq_overflow);
+                               + READ_ONCE(ctx->cached_cq_overflow);
        }
 
        return false;
@@ -1269,9 +1287,12 @@ static bool io_identity_cow(struct io_kiocb *req)
        /* add one for this request */
        refcount_inc(&id->count);
 
-       /* drop old identity, assign new one. one ref for req, one for tctx */
-       if (req->work.identity != tctx->identity &&
-           refcount_sub_and_test(2, &req->work.identity->count))
+       /* drop tctx and req identity references, if needed */
+       if (tctx->identity != &tctx->__identity &&
+           refcount_dec_and_test(&tctx->identity->count))
+               kfree(tctx->identity);
+       if (req->work.identity != &tctx->__identity &&
+           refcount_dec_and_test(&req->work.identity->count))
                kfree(req->work.identity);
 
        req->work.identity = id;
@@ -1285,8 +1306,11 @@ static bool io_grab_identity(struct io_kiocb *req)
        struct io_identity *id = req->work.identity;
        struct io_ring_ctx *ctx = req->ctx;
 
-       if (def->needs_fsize && id->fsize != rlimit(RLIMIT_FSIZE))
-               return false;
+       if (def->work_flags & IO_WQ_WORK_FSIZE) {
+               if (id->fsize != rlimit(RLIMIT_FSIZE))
+                       return false;
+               req->work.flags |= IO_WQ_WORK_FSIZE;
+       }
 
        if (!(req->work.flags & IO_WQ_WORK_FILES) &&
            (def->work_flags & IO_WQ_WORK_FILES) &&
@@ -1357,6 +1381,9 @@ static void io_prep_async_work(struct io_kiocb *req)
        io_req_init_async(req);
        id = req->work.identity;
 
+       if (req->flags & REQ_F_FORCE_ASYNC)
+               req->work.flags |= IO_WQ_WORK_CONCURRENT;
+
        if (req->flags & REQ_F_ISREG) {
                if (def->hash_reg_file || (ctx->flags & IORING_SETUP_IOPOLL))
                        io_wq_hash_work(&req->work, file_inode(req->file));
@@ -1566,14 +1593,29 @@ static void io_cqring_mark_overflow(struct io_ring_ctx *ctx)
        }
 }
 
-static inline bool io_match_files(struct io_kiocb *req,
-                                      struct files_struct *files)
+static inline bool __io_match_files(struct io_kiocb *req,
+                                   struct files_struct *files)
+{
+       return ((req->flags & REQ_F_WORK_INITIALIZED) &&
+               (req->work.flags & IO_WQ_WORK_FILES)) &&
+               req->work.identity->files == files;
+}
+
+static bool io_match_files(struct io_kiocb *req,
+                          struct files_struct *files)
 {
+       struct io_kiocb *link;
+
        if (!files)
                return true;
-       if ((req->flags & REQ_F_WORK_INITIALIZED) &&
-           (req->work.flags & IO_WQ_WORK_FILES))
-               return req->work.identity->files == files;
+       if (__io_match_files(req, files))
+               return true;
+       if (req->flags & REQ_F_LINK_HEAD) {
+               list_for_each_entry(link, &req->link_list, link_list) {
+                       if (__io_match_files(link, files))
+                               return true;
+               }
+       }
        return false;
 }
 
@@ -1619,8 +1661,9 @@ static bool io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force,
                        WRITE_ONCE(cqe->res, req->result);
                        WRITE_ONCE(cqe->flags, req->compl.cflags);
                } else {
+                       ctx->cached_cq_overflow++;
                        WRITE_ONCE(ctx->rings->cq_overflow,
-                               atomic_inc_return(&ctx->cached_cq_overflow));
+                                  ctx->cached_cq_overflow);
                }
        }
 
@@ -1656,14 +1699,15 @@ static void __io_cqring_fill_event(struct io_kiocb *req, long res, long cflags)
                WRITE_ONCE(cqe->user_data, req->user_data);
                WRITE_ONCE(cqe->res, res);
                WRITE_ONCE(cqe->flags, cflags);
-       } else if (ctx->cq_overflow_flushed || req->task->io_uring->in_idle) {
+       } else if (ctx->cq_overflow_flushed ||
+                  atomic_read(&req->task->io_uring->in_idle)) {
                /*
                 * If we're in ring overflow flush mode, or in task cancel mode,
                 * then we cannot store the request for later flushing, we need
                 * to drop it on the floor.
                 */
-               WRITE_ONCE(ctx->rings->cq_overflow,
-                               atomic_inc_return(&ctx->cached_cq_overflow));
+               ctx->cached_cq_overflow++;
+               WRITE_ONCE(ctx->rings->cq_overflow, ctx->cached_cq_overflow);
        } else {
                if (list_empty(&ctx->cq_overflow_list)) {
                        set_bit(0, &ctx->sq_check_overflow);
@@ -1826,7 +1870,7 @@ static void __io_free_req(struct io_kiocb *req)
        io_dismantle_req(req);
 
        percpu_counter_dec(&tctx->inflight);
-       if (tctx->in_idle)
+       if (atomic_read(&tctx->in_idle))
                wake_up(&tctx->wait);
        put_task_struct(req->task);
 
@@ -1837,53 +1881,39 @@ static void __io_free_req(struct io_kiocb *req)
        percpu_ref_put(&ctx->refs);
 }
 
-static bool io_link_cancel_timeout(struct io_kiocb *req)
-{
-       struct io_timeout_data *io = req->async_data;
-       struct io_ring_ctx *ctx = req->ctx;
-       int ret;
-
-       ret = hrtimer_try_to_cancel(&io->timer);
-       if (ret != -1) {
-               io_cqring_fill_event(req, -ECANCELED);
-               io_commit_cqring(ctx);
-               req->flags &= ~REQ_F_LINK_HEAD;
-               io_put_req_deferred(req, 1);
-               return true;
-       }
-
-       return false;
-}
-
-static bool __io_kill_linked_timeout(struct io_kiocb *req)
-{
-       struct io_kiocb *link;
-       bool wake_ev;
-
-       if (list_empty(&req->link_list))
-               return false;
-       link = list_first_entry(&req->link_list, struct io_kiocb, link_list);
-       if (link->opcode != IORING_OP_LINK_TIMEOUT)
-               return false;
-
-       list_del_init(&link->link_list);
-       wake_ev = io_link_cancel_timeout(link);
-       req->flags &= ~REQ_F_LINK_TIMEOUT;
-       return wake_ev;
-}
-
 static void io_kill_linked_timeout(struct io_kiocb *req)
 {
        struct io_ring_ctx *ctx = req->ctx;
+       struct io_kiocb *link;
+       bool cancelled = false;
        unsigned long flags;
-       bool wake_ev;
 
        spin_lock_irqsave(&ctx->completion_lock, flags);
-       wake_ev = __io_kill_linked_timeout(req);
+       link = list_first_entry_or_null(&req->link_list, struct io_kiocb,
+                                       link_list);
+       /*
+        * Can happen if a linked timeout fired and link had been like
+        * req -> link t-out -> link t-out [-> ...]
+        */
+       if (link && (link->flags & REQ_F_LTIMEOUT_ACTIVE)) {
+               struct io_timeout_data *io = link->async_data;
+               int ret;
+
+               list_del_init(&link->link_list);
+               ret = hrtimer_try_to_cancel(&io->timer);
+               if (ret != -1) {
+                       io_cqring_fill_event(link, -ECANCELED);
+                       io_commit_cqring(ctx);
+                       cancelled = true;
+               }
+       }
+       req->flags &= ~REQ_F_LINK_TIMEOUT;
        spin_unlock_irqrestore(&ctx->completion_lock, flags);
 
-       if (wake_ev)
+       if (cancelled) {
                io_cqring_ev_posted(ctx);
+               io_put_req(link);
+       }
 }
 
 static struct io_kiocb *io_req_link_next(struct io_kiocb *req)
@@ -1908,10 +1938,12 @@ static struct io_kiocb *io_req_link_next(struct io_kiocb *req)
 /*
  * Called if REQ_F_LINK_HEAD is set, and we fail the head request
  */
-static void __io_fail_links(struct io_kiocb *req)
+static void io_fail_links(struct io_kiocb *req)
 {
        struct io_ring_ctx *ctx = req->ctx;
+       unsigned long flags;
 
+       spin_lock_irqsave(&ctx->completion_lock, flags);
        while (!list_empty(&req->link_list)) {
                struct io_kiocb *link = list_first_entry(&req->link_list,
                                                struct io_kiocb, link_list);
@@ -1933,15 +1965,6 @@ static void __io_fail_links(struct io_kiocb *req)
        }
 
        io_commit_cqring(ctx);
-}
-
-static void io_fail_links(struct io_kiocb *req)
-{
-       struct io_ring_ctx *ctx = req->ctx;
-       unsigned long flags;
-
-       spin_lock_irqsave(&ctx->completion_lock, flags);
-       __io_fail_links(req);
        spin_unlock_irqrestore(&ctx->completion_lock, flags);
 
        io_cqring_ev_posted(ctx);
@@ -3109,9 +3132,10 @@ static inline loff_t *io_kiocb_ppos(struct kiocb *kiocb)
  * For files that don't have ->read_iter() and ->write_iter(), handle them
  * by looping over ->read() or ->write() manually.
  */
-static ssize_t loop_rw_iter(int rw, struct file *file, struct kiocb *kiocb,
-                          struct iov_iter *iter)
+static ssize_t loop_rw_iter(int rw, struct io_kiocb *req, struct iov_iter *iter)
 {
+       struct kiocb *kiocb = &req->rw.kiocb;
+       struct file *file = req->file;
        ssize_t ret = 0;
 
        /*
@@ -3131,11 +3155,8 @@ static ssize_t loop_rw_iter(int rw, struct file *file, struct kiocb *kiocb,
                if (!iov_iter_is_bvec(iter)) {
                        iovec = iov_iter_iovec(iter);
                } else {
-                       /* fixed buffers import bvec */
-                       iovec.iov_base = kmap(iter->bvec->bv_page)
-                                               + iter->iov_offset;
-                       iovec.iov_len = min(iter->count,
-                                       iter->bvec->bv_len - iter->iov_offset);
+                       iovec.iov_base = u64_to_user_ptr(req->rw.addr);
+                       iovec.iov_len = req->rw.len;
                }
 
                if (rw == READ) {
@@ -3146,9 +3167,6 @@ static ssize_t loop_rw_iter(int rw, struct file *file, struct kiocb *kiocb,
                                               iovec.iov_len, io_kiocb_ppos(kiocb));
                }
 
-               if (iov_iter_is_bvec(iter))
-                       kunmap(iter->bvec->bv_page);
-
                if (nr < 0) {
                        if (!ret)
                                ret = nr;
@@ -3157,6 +3175,8 @@ static ssize_t loop_rw_iter(int rw, struct file *file, struct kiocb *kiocb,
                ret += nr;
                if (nr != iovec.iov_len)
                        break;
+               req->rw.len -= nr;
+               req->rw.addr += nr;
                iov_iter_advance(iter, nr);
        }
 
@@ -3346,7 +3366,7 @@ static int io_iter_do_read(struct io_kiocb *req, struct iov_iter *iter)
        if (req->file->f_op->read_iter)
                return call_read_iter(req->file, &req->rw.kiocb, iter);
        else if (req->file->f_op->read)
-               return loop_rw_iter(READ, req->file, &req->rw.kiocb, iter);
+               return loop_rw_iter(READ, req, iter);
        else
                return -EINVAL;
 }
@@ -3537,7 +3557,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
        if (req->file->f_op->write_iter)
                ret2 = call_write_iter(req->file, kiocb, iter);
        else if (req->file->f_op->write)
-               ret2 = loop_rw_iter(WRITE, req->file, kiocb, iter);
+               ret2 = loop_rw_iter(WRITE, req, iter);
        else
                ret2 = -EINVAL;
 
@@ -4927,32 +4947,25 @@ static void io_poll_complete(struct io_kiocb *req, __poll_t mask, int error)
        io_commit_cqring(ctx);
 }
 
-static void io_poll_task_handler(struct io_kiocb *req, struct io_kiocb **nxt)
+static void io_poll_task_func(struct callback_head *cb)
 {
+       struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work);
        struct io_ring_ctx *ctx = req->ctx;
+       struct io_kiocb *nxt;
 
        if (io_poll_rewait(req, &req->poll)) {
                spin_unlock_irq(&ctx->completion_lock);
-               return;
-       }
-
-       hash_del(&req->hash_node);
-       io_poll_complete(req, req->result, 0);
-       spin_unlock_irq(&ctx->completion_lock);
-
-       *nxt = io_put_req_find_next(req);
-       io_cqring_ev_posted(ctx);
-}
+       } else {
+               hash_del(&req->hash_node);
+               io_poll_complete(req, req->result, 0);
+               spin_unlock_irq(&ctx->completion_lock);
 
-static void io_poll_task_func(struct callback_head *cb)
-{
-       struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work);
-       struct io_ring_ctx *ctx = req->ctx;
-       struct io_kiocb *nxt = NULL;
+               nxt = io_put_req_find_next(req);
+               io_cqring_ev_posted(ctx);
+               if (nxt)
+                       __io_req_task_submit(nxt);
+       }
 
-       io_poll_task_handler(req, &nxt);
-       if (nxt)
-               __io_req_task_submit(nxt);
        percpu_ref_put(&ctx->refs);
 }
 
@@ -4979,8 +4992,10 @@ static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode,
                /* make sure double remove sees this as being gone */
                wait->private = NULL;
                spin_unlock(&poll->head->lock);
-               if (!done)
-                       __io_async_wake(req, poll, mask, io_poll_task_func);
+               if (!done) {
+                       /* use wait func handler, so it matches the rq type */
+                       poll->wait.func(&poll->wait, mode, sync, key);
+               }
        }
        refcount_dec(&req->refs);
        return 1;
@@ -5106,6 +5121,7 @@ static __poll_t __io_arm_poll_handler(struct io_kiocb *req,
        struct io_ring_ctx *ctx = req->ctx;
        bool cancel = false;
 
+       INIT_HLIST_NODE(&req->hash_node);
        io_init_poll_iocb(poll, mask, wake_func);
        poll->file = req->file;
        poll->wait.private = req;
@@ -5167,7 +5183,6 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
 
        req->flags |= REQ_F_POLLED;
        req->apoll = apoll;
-       INIT_HLIST_NODE(&req->hash_node);
 
        mask = 0;
        if (def->pollin)
@@ -5349,8 +5364,6 @@ static int io_poll_add_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe
                return -EINVAL;
        if (sqe->addr || sqe->ioprio || sqe->off || sqe->len || sqe->buf_index)
                return -EINVAL;
-       if (!poll->file)
-               return -EBADF;
 
        events = READ_ONCE(sqe->poll32_events);
 #ifdef __BIG_ENDIAN
@@ -5368,7 +5381,6 @@ static int io_poll_add(struct io_kiocb *req)
        struct io_poll_table ipt;
        __poll_t mask;
 
-       INIT_HLIST_NODE(&req->hash_node);
        ipt.pt._qproc = io_poll_queue_proc;
 
        mask = __io_arm_poll_handler(req, &req->poll, &ipt, poll->events,
@@ -6118,10 +6130,9 @@ static enum hrtimer_restart io_link_timeout_fn(struct hrtimer *timer)
        if (!list_empty(&req->link_list)) {
                prev = list_entry(req->link_list.prev, struct io_kiocb,
                                  link_list);
-               if (refcount_inc_not_zero(&prev->refs)) {
+               if (refcount_inc_not_zero(&prev->refs))
                        list_del_init(&req->link_list);
-                       prev->flags &= ~REQ_F_LINK_TIMEOUT;
-               } else
+               else
                        prev = NULL;
        }
 
@@ -6178,6 +6189,7 @@ static struct io_kiocb *io_prep_linked_timeout(struct io_kiocb *req)
        if (!nxt || nxt->opcode != IORING_OP_LINK_TIMEOUT)
                return NULL;
 
+       nxt->flags |= REQ_F_LTIMEOUT_ACTIVE;
        req->flags |= REQ_F_LINK_TIMEOUT;
        return nxt;
 }
@@ -6185,14 +6197,14 @@ static struct io_kiocb *io_prep_linked_timeout(struct io_kiocb *req)
 static void __io_queue_sqe(struct io_kiocb *req, struct io_comp_state *cs)
 {
        struct io_kiocb *linked_timeout;
-       struct io_kiocb *nxt;
        const struct cred *old_creds = NULL;
        int ret;
 
 again:
        linked_timeout = io_prep_linked_timeout(req);
 
-       if ((req->flags & REQ_F_WORK_INITIALIZED) && req->work.identity->creds &&
+       if ((req->flags & REQ_F_WORK_INITIALIZED) &&
+           (req->work.flags & IO_WQ_WORK_CREDS) &&
            req->work.identity->creds != current_cred()) {
                if (old_creds)
                        revert_creds(old_creds);
@@ -6200,7 +6212,6 @@ again:
                        old_creds = NULL; /* restored original creds */
                else
                        old_creds = override_creds(req->work.identity->creds);
-               req->work.flags |= IO_WQ_WORK_CREDS;
        }
 
        ret = io_issue_sqe(req, true, cs);
@@ -6211,7 +6222,6 @@ again:
         */
        if (ret == -EAGAIN && !(req->flags & REQ_F_NOWAIT)) {
                if (!io_arm_poll_handler(req)) {
-punt:
                        /*
                         * Queued up for async execution, worker will release
                         * submit reference when the iocb is actually submitted.
@@ -6221,31 +6231,25 @@ punt:
 
                if (linked_timeout)
                        io_queue_linked_timeout(linked_timeout);
-               goto exit;
-       }
+       } else if (likely(!ret)) {
+               /* drop submission reference */
+               req = io_put_req_find_next(req);
+               if (linked_timeout)
+                       io_queue_linked_timeout(linked_timeout);
 
-       if (unlikely(ret)) {
+               if (req) {
+                       if (!(req->flags & REQ_F_FORCE_ASYNC))
+                               goto again;
+                       io_queue_async_work(req);
+               }
+       } else {
                /* un-prep timeout, so it'll be killed as any other linked */
                req->flags &= ~REQ_F_LINK_TIMEOUT;
                req_set_fail_links(req);
                io_put_req(req);
                io_req_complete(req, ret);
-               goto exit;
        }
 
-       /* drop submission reference */
-       nxt = io_put_req_find_next(req);
-       if (linked_timeout)
-               io_queue_linked_timeout(linked_timeout);
-
-       if (nxt) {
-               req = nxt;
-
-               if (req->flags & REQ_F_FORCE_ASYNC)
-                       goto punt;
-               goto again;
-       }
-exit:
        if (old_creds)
                revert_creds(old_creds);
 }
@@ -6269,13 +6273,6 @@ fail_req:
                        if (unlikely(ret))
                                goto fail_req;
                }
-
-               /*
-                * Never try inline submit of IOSQE_ASYNC is set, go straight
-                * to async execution.
-                */
-               io_req_init_async(req);
-               req->work.flags |= IO_WQ_WORK_CONCURRENT;
                io_queue_async_work(req);
        } else {
                if (sqe) {
@@ -6505,12 +6502,12 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
        if (id) {
                struct io_identity *iod;
 
-               io_req_init_async(req);
                iod = idr_find(&ctx->personality_idr, id);
                if (unlikely(!iod))
                        return -EINVAL;
                refcount_inc(&iod->count);
-               io_put_identity(current->io_uring, req);
+
+               __io_req_init_async(req);
                get_cred(iod->creds);
                req->work.identity = iod;
                req->work.flags |= IO_WQ_WORK_CREDS;
@@ -7730,7 +7727,8 @@ static int io_uring_alloc_task_context(struct task_struct *task)
        xa_init(&tctx->xa);
        init_waitqueue_head(&tctx->wait);
        tctx->last = NULL;
-       tctx->in_idle = 0;
+       atomic_set(&tctx->in_idle, 0);
+       tctx->sqpoll = false;
        io_init_identity(&tctx->__identity);
        tctx->identity = &tctx->__identity;
        task->io_uring = tctx;
@@ -8423,22 +8421,6 @@ static bool io_match_link(struct io_kiocb *preq, struct io_kiocb *req)
        return false;
 }
 
-static bool io_match_link_files(struct io_kiocb *req,
-                               struct files_struct *files)
-{
-       struct io_kiocb *link;
-
-       if (io_match_files(req, files))
-               return true;
-       if (req->flags & REQ_F_LINK_HEAD) {
-               list_for_each_entry(link, &req->link_list, link_list) {
-                       if (io_match_files(link, files))
-                               return true;
-               }
-       }
-       return false;
-}
-
 /*
  * We're looking to cancel 'req' because it's holding on to our files, but
  * 'req' could be a link to another request. See if it is, and cancel that
@@ -8488,7 +8470,21 @@ static bool io_timeout_remove_link(struct io_ring_ctx *ctx,
 
 static bool io_cancel_link_cb(struct io_wq_work *work, void *data)
 {
-       return io_match_link(container_of(work, struct io_kiocb, work), data);
+       struct io_kiocb *req = container_of(work, struct io_kiocb, work);
+       bool ret;
+
+       if (req->flags & REQ_F_LINK_TIMEOUT) {
+               unsigned long flags;
+               struct io_ring_ctx *ctx = req->ctx;
+
+               /* protect against races with linked timeouts */
+               spin_lock_irqsave(&ctx->completion_lock, flags);
+               ret = io_match_link(req, data);
+               spin_unlock_irqrestore(&ctx->completion_lock, flags);
+       } else {
+               ret = io_match_link(req, data);
+       }
+       return ret;
 }
 
 static void io_attempt_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req)
@@ -8514,6 +8510,7 @@ static void io_attempt_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req)
 }
 
 static void io_cancel_defer_files(struct io_ring_ctx *ctx,
+                                 struct task_struct *task,
                                  struct files_struct *files)
 {
        struct io_defer_entry *de = NULL;
@@ -8521,7 +8518,8 @@ static void io_cancel_defer_files(struct io_ring_ctx *ctx,
 
        spin_lock_irq(&ctx->completion_lock);
        list_for_each_entry_reverse(de, &ctx->defer_list, list) {
-               if (io_match_link_files(de->req, files)) {
+               if (io_task_match(de->req, task) &&
+                   io_match_files(de->req, files)) {
                        list_cut_position(&list, &ctx->defer_list, &de->list);
                        break;
                }
@@ -8547,7 +8545,6 @@ static bool io_uring_cancel_files(struct io_ring_ctx *ctx,
        if (list_empty_careful(&ctx->inflight_list))
                return false;
 
-       io_cancel_defer_files(ctx, files);
        /* cancel all at once, should be faster than doing it one by one*/
        io_wq_cancel_cb(ctx->io_wq, io_wq_files_match, files, true);
 
@@ -8633,8 +8630,16 @@ static void io_uring_cancel_task_requests(struct io_ring_ctx *ctx,
 {
        struct task_struct *task = current;
 
-       if ((ctx->flags & IORING_SETUP_SQPOLL) && ctx->sq_data)
+       if ((ctx->flags & IORING_SETUP_SQPOLL) && ctx->sq_data) {
                task = ctx->sq_data->thread;
+               atomic_inc(&task->io_uring->in_idle);
+               io_sq_thread_park(ctx->sq_data);
+       }
+
+       if (files)
+               io_cancel_defer_files(ctx, NULL, files);
+       else
+               io_cancel_defer_files(ctx, task, NULL);
 
        io_cqring_overflow_flush(ctx, true, task, files);
 
@@ -8642,12 +8647,23 @@ static void io_uring_cancel_task_requests(struct io_ring_ctx *ctx,
                io_run_task_work();
                cond_resched();
        }
+
+       if ((ctx->flags & IORING_SETUP_SQPOLL) && ctx->sq_data) {
+               atomic_dec(&task->io_uring->in_idle);
+               /*
+                * If the files that are going away are the ones in the thread
+                * identity, clear them out.
+                */
+               if (task->io_uring->identity->files == files)
+                       task->io_uring->identity->files = NULL;
+               io_sq_thread_unpark(ctx->sq_data);
+       }
 }
 
 /*
  * Note that this task has used io_uring. We use it for cancelation purposes.
  */
-static int io_uring_add_task_file(struct file *file)
+static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file)
 {
        struct io_uring_task *tctx = current->io_uring;
 
@@ -8669,6 +8685,14 @@ static int io_uring_add_task_file(struct file *file)
                tctx->last = file;
        }
 
+       /*
+        * This is race safe in that the task itself is doing this, hence it
+        * cannot be going through the exit/cancel paths at the same time.
+        * This cannot be modified while exit/cancel is running.
+        */
+       if (!tctx->sqpoll && (ctx->flags & IORING_SETUP_SQPOLL))
+               tctx->sqpoll = true;
+
        return 0;
 }
 
@@ -8686,19 +8710,11 @@ static void io_uring_del_task_file(struct file *file)
                fput(file);
 }
 
-static void __io_uring_attempt_task_drop(struct file *file)
-{
-       struct file *old = xa_load(&current->io_uring->xa, (unsigned long)file);
-
-       if (old == file)
-               io_uring_del_task_file(file);
-}
-
 /*
  * Drop task note for this file if we're the only ones that hold it after
  * pending fput()
  */
-static void io_uring_attempt_task_drop(struct file *file, bool exiting)
+static void io_uring_attempt_task_drop(struct file *file)
 {
        if (!current->io_uring)
                return;
@@ -8706,10 +8722,9 @@ static void io_uring_attempt_task_drop(struct file *file, bool exiting)
         * fput() is pending, will be 2 if the only other ref is our potential
         * task file note. If the task is exiting, drop regardless of count.
         */
-       if (!exiting && atomic_long_read(&file->f_count) != 2)
-               return;
-
-       __io_uring_attempt_task_drop(file);
+       if (fatal_signal_pending(current) || (current->flags & PF_EXITING) ||
+           atomic_long_read(&file->f_count) == 2)
+               io_uring_del_task_file(file);
 }
 
 void __io_uring_files_cancel(struct files_struct *files)
@@ -8719,7 +8734,7 @@ void __io_uring_files_cancel(struct files_struct *files)
        unsigned long index;
 
        /* make sure overflow events are dropped */
-       tctx->in_idle = true;
+       atomic_inc(&tctx->in_idle);
 
        xa_for_each(&tctx->xa, index, file) {
                struct io_ring_ctx *ctx = file->private_data;
@@ -8728,6 +8743,35 @@ void __io_uring_files_cancel(struct files_struct *files)
                if (files)
                        io_uring_del_task_file(file);
        }
+
+       atomic_dec(&tctx->in_idle);
+}
+
+static s64 tctx_inflight(struct io_uring_task *tctx)
+{
+       unsigned long index;
+       struct file *file;
+       s64 inflight;
+
+       inflight = percpu_counter_sum(&tctx->inflight);
+       if (!tctx->sqpoll)
+               return inflight;
+
+       /*
+        * If we have SQPOLL rings, then we need to iterate and find them, and
+        * add the pending count for those.
+        */
+       xa_for_each(&tctx->xa, index, file) {
+               struct io_ring_ctx *ctx = file->private_data;
+
+               if (ctx->flags & IORING_SETUP_SQPOLL) {
+                       struct io_uring_task *__tctx = ctx->sqo_task->io_uring;
+
+                       inflight += percpu_counter_sum(&__tctx->inflight);
+               }
+       }
+
+       return inflight;
 }
 
 /*
@@ -8741,11 +8785,11 @@ void __io_uring_task_cancel(void)
        s64 inflight;
 
        /* make sure overflow events are dropped */
-       tctx->in_idle = true;
+       atomic_inc(&tctx->in_idle);
 
        do {
                /* read completions before cancelations */
-               inflight = percpu_counter_sum(&tctx->inflight);
+               inflight = tctx_inflight(tctx);
                if (!inflight)
                        break;
                __io_uring_files_cancel(NULL);
@@ -8756,27 +8800,18 @@ void __io_uring_task_cancel(void)
                 * If we've seen completions, retry. This avoids a race where
                 * a completion comes in before we did prepare_to_wait().
                 */
-               if (inflight != percpu_counter_sum(&tctx->inflight))
+               if (inflight != tctx_inflight(tctx))
                        continue;
                schedule();
        } while (1);
 
        finish_wait(&tctx->wait, &wait);
-       tctx->in_idle = false;
+       atomic_dec(&tctx->in_idle);
 }
 
 static int io_uring_flush(struct file *file, void *data)
 {
-       struct io_ring_ctx *ctx = file->private_data;
-
-       /*
-        * If the task is going away, cancel work it may have pending
-        */
-       if (fatal_signal_pending(current) || (current->flags & PF_EXITING))
-               data = NULL;
-
-       io_uring_cancel_task_requests(ctx, data);
-       io_uring_attempt_task_drop(file, !data);
+       io_uring_attempt_task_drop(file);
        return 0;
 }
 
@@ -8916,7 +8951,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
                        io_sqpoll_wait_sq(ctx);
                submitted = to_submit;
        } else if (to_submit) {
-               ret = io_uring_add_task_file(f.file);
+               ret = io_uring_add_task_file(ctx, f.file);
                if (unlikely(ret))
                        goto out;
                mutex_lock(&ctx->uring_lock);
@@ -8953,7 +8988,8 @@ out_fput:
 #ifdef CONFIG_PROC_FS
 static int io_uring_show_cred(int id, void *p, void *data)
 {
-       const struct cred *cred = p;
+       struct io_identity *iod = p;
+       const struct cred *cred = iod->creds;
        struct seq_file *m = data;
        struct user_namespace *uns = seq_user_ns(m);
        struct group_info *gi;
@@ -9145,7 +9181,7 @@ err_fd:
 #if defined(CONFIG_UNIX)
        ctx->ring_sock->file = file;
 #endif
-       if (unlikely(io_uring_add_task_file(file))) {
+       if (unlikely(io_uring_add_task_file(ctx, file))) {
                file = ERR_PTR(-ENOMEM);
                goto err_fd;
        }
index 8180061..10cc797 100644 (file)
@@ -1374,6 +1374,7 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc,
        WARN_ON_ONCE(!wpc->ioend && !list_empty(&submit_list));
        WARN_ON_ONCE(!PageLocked(page));
        WARN_ON_ONCE(PageWriteback(page));
+       WARN_ON_ONCE(PageDirty(page));
 
        /*
         * We cannot cancel the ioend directly here on error.  We may have
@@ -1382,33 +1383,22 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc,
         * appropriately.
         */
        if (unlikely(error)) {
+               /*
+                * Let the filesystem know what portion of the current page
+                * failed to map. If the page wasn't been added to ioend, it
+                * won't be affected by I/O completion and we must unlock it
+                * now.
+                */
+               if (wpc->ops->discard_page)
+                       wpc->ops->discard_page(page, file_offset);
                if (!count) {
-                       /*
-                        * If the current page hasn't been added to ioend, it
-                        * won't be affected by I/O completions and we must
-                        * discard and unlock it right here.
-                        */
-                       if (wpc->ops->discard_page)
-                               wpc->ops->discard_page(page);
                        ClearPageUptodate(page);
                        unlock_page(page);
                        goto done;
                }
-
-               /*
-                * If the page was not fully cleaned, we need to ensure that the
-                * higher layers come back to it correctly.  That means we need
-                * to keep the page dirty, and for WB_SYNC_ALL writeback we need
-                * to ensure the PAGECACHE_TAG_TOWRITE index mark is not removed
-                * so another attempt to write this page in this writeback sweep
-                * will be made.
-                */
-               set_page_writeback_keepwrite(page);
-       } else {
-               clear_page_dirty_for_io(page);
-               set_page_writeback(page);
        }
 
+       set_page_writeback(page);
        unlock_page(page);
 
        /*
index 78f5c96..ec90773 100644 (file)
@@ -1038,8 +1038,7 @@ static int isofs_statfs (struct dentry *dentry, struct kstatfs *buf)
        buf->f_bavail = 0;
        buf->f_files = ISOFS_SB(sb)->s_ninodes;
        buf->f_ffree = 0;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
        buf->f_namelen = NAME_MAX;
        return 0;
 }
index 1558cf2..ee9660e 100644 (file)
@@ -22,7 +22,7 @@ struct SU_ER_s {
        __u8 len_des;
        __u8 len_src;
        __u8 ext_ver;
-       __u8 data[0];
+       __u8 data[];
 } __attribute__ ((packed));
 
 struct RR_RR_s {
@@ -44,7 +44,7 @@ struct RR_PN_s {
 struct SL_component {
        __u8 flags;
        __u8 len;
-       __u8 text[0];
+       __u8 text[];
 } __attribute__ ((packed));
 
 struct RR_SL_s {
@@ -54,7 +54,7 @@ struct RR_SL_s {
 
 struct RR_NM_s {
        __u8 flags;
-       char name[0];
+       char name[];
 } __attribute__ ((packed));
 
 struct RR_CL_s {
@@ -71,7 +71,7 @@ struct stamp {
 
 struct RR_TF_s {
        __u8 flags;
-       struct stamp times[0];  /* Variable number of these beasts */
+       struct stamp times[];   /* Variable number of these beasts */
 } __attribute__ ((packed));
 
 /* Linux-specific extension for transparent decompression */
index 263f02a..472932b 100644 (file)
@@ -106,6 +106,8 @@ static int __try_to_free_cp_buf(struct journal_head *jh)
  * for a checkpoint to free up some space in the log.
  */
 void __jbd2_log_wait_for_space(journal_t *journal)
+__acquires(&journal->j_state_lock)
+__releases(&journal->j_state_lock)
 {
        int nblocks, space_left;
        /* assert_spin_locked(&journal->j_state_lock); */
index fa688e1..b121d7d 100644 (file)
@@ -450,6 +450,15 @@ void jbd2_journal_commit_transaction(journal_t *journal)
                schedule();
                write_lock(&journal->j_state_lock);
                finish_wait(&journal->j_fc_wait, &wait);
+               /*
+                * TODO: by blocking fast commits here, we are increasing
+                * fsync() latency slightly. Strictly speaking, we don't need
+                * to block fast commits until the transaction enters T_FLUSH
+                * state. So an optimization is possible where we block new fast
+                * commits here and wait for existing ones to complete
+                * just before we enter T_FLUSH. That way, the existing fast
+                * commits and this full commit can proceed parallely.
+                */
        }
        write_unlock(&journal->j_state_lock);
 
@@ -801,7 +810,7 @@ start_journal_io:
                if (first_block < journal->j_tail)
                        freed += journal->j_last - journal->j_first;
                /* Update tail only if we free significant amount of space */
-               if (freed < journal->j_maxlen / 4)
+               if (freed < jbd2_journal_get_max_txn_bufs(journal))
                        update_tail = 0;
        }
        J_ASSERT(commit_transaction->t_state == T_COMMIT);
index 0c7c42b..0c3d5e3 100644 (file)
@@ -727,6 +727,8 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid)
  */
 int jbd2_fc_begin_commit(journal_t *journal, tid_t tid)
 {
+       if (unlikely(is_journal_aborted(journal)))
+               return -EIO;
        /*
         * Fast commits only allowed if at least one full commit has
         * been processed.
@@ -734,10 +736,12 @@ int jbd2_fc_begin_commit(journal_t *journal, tid_t tid)
        if (!journal->j_stats.ts_tid)
                return -EINVAL;
 
-       if (tid <= journal->j_commit_sequence)
+       write_lock(&journal->j_state_lock);
+       if (tid <= journal->j_commit_sequence) {
+               write_unlock(&journal->j_state_lock);
                return -EALREADY;
+       }
 
-       write_lock(&journal->j_state_lock);
        if (journal->j_flags & JBD2_FULL_COMMIT_ONGOING ||
            (journal->j_flags & JBD2_FAST_COMMIT_ONGOING)) {
                DEFINE_WAIT(wait);
@@ -777,13 +781,19 @@ static int __jbd2_fc_end_commit(journal_t *journal, tid_t tid, bool fallback)
 
 int jbd2_fc_end_commit(journal_t *journal)
 {
-       return __jbd2_fc_end_commit(journal, 0, 0);
+       return __jbd2_fc_end_commit(journal, 0, false);
 }
 EXPORT_SYMBOL(jbd2_fc_end_commit);
 
-int jbd2_fc_end_commit_fallback(journal_t *journal, tid_t tid)
+int jbd2_fc_end_commit_fallback(journal_t *journal)
 {
-       return __jbd2_fc_end_commit(journal, tid, 1);
+       tid_t tid;
+
+       read_lock(&journal->j_state_lock);
+       tid = journal->j_running_transaction ?
+               journal->j_running_transaction->t_tid : 0;
+       read_unlock(&journal->j_state_lock);
+       return __jbd2_fc_end_commit(journal, tid, true);
 }
 EXPORT_SYMBOL(jbd2_fc_end_commit_fallback);
 
@@ -865,7 +875,6 @@ int jbd2_fc_get_buf(journal_t *journal, struct buffer_head **bh_out)
        int fc_off;
 
        *bh_out = NULL;
-       write_lock(&journal->j_state_lock);
 
        if (journal->j_fc_off + journal->j_fc_first < journal->j_fc_last) {
                fc_off = journal->j_fc_off;
@@ -874,7 +883,6 @@ int jbd2_fc_get_buf(journal_t *journal, struct buffer_head **bh_out)
        } else {
                ret = -EINVAL;
        }
-       write_unlock(&journal->j_state_lock);
 
        if (ret)
                return ret;
@@ -887,11 +895,7 @@ int jbd2_fc_get_buf(journal_t *journal, struct buffer_head **bh_out)
        if (!bh)
                return -ENOMEM;
 
-       lock_buffer(bh);
 
-       clear_buffer_uptodate(bh);
-       set_buffer_dirty(bh);
-       unlock_buffer(bh);
        journal->j_fc_wbuf[fc_off] = bh;
 
        *bh_out = bh;
@@ -909,9 +913,7 @@ int jbd2_fc_wait_bufs(journal_t *journal, int num_blks)
        struct buffer_head *bh;
        int i, j_fc_off;
 
-       read_lock(&journal->j_state_lock);
        j_fc_off = journal->j_fc_off;
-       read_unlock(&journal->j_state_lock);
 
        /*
         * Wait in reverse order to minimize chances of us being woken up before
@@ -939,9 +941,7 @@ int jbd2_fc_release_bufs(journal_t *journal)
        struct buffer_head *bh;
        int i, j_fc_off;
 
-       read_lock(&journal->j_state_lock);
        j_fc_off = journal->j_fc_off;
-       read_unlock(&journal->j_state_lock);
 
        /*
         * Wait in reverse order to minimize chances of us being woken up before
@@ -1348,23 +1348,16 @@ static journal_t *journal_init_common(struct block_device *bdev,
        journal->j_dev = bdev;
        journal->j_fs_dev = fs_dev;
        journal->j_blk_offset = start;
-       journal->j_maxlen = len;
+       journal->j_total_len = len;
        /* We need enough buffers to write out full descriptor block. */
        n = journal->j_blocksize / jbd2_min_tag_size();
        journal->j_wbufsize = n;
+       journal->j_fc_wbuf = NULL;
        journal->j_wbuf = kmalloc_array(n, sizeof(struct buffer_head *),
                                        GFP_KERNEL);
        if (!journal->j_wbuf)
                goto err_cleanup;
 
-       if (journal->j_fc_wbufsize > 0) {
-               journal->j_fc_wbuf = kmalloc_array(journal->j_fc_wbufsize,
-                                       sizeof(struct buffer_head *),
-                                       GFP_KERNEL);
-               if (!journal->j_fc_wbuf)
-                       goto err_cleanup;
-       }
-
        bh = getblk_unmovable(journal->j_dev, start, journal->j_blocksize);
        if (!bh) {
                pr_err("%s: Cannot get buffer for journal superblock\n",
@@ -1378,23 +1371,11 @@ static journal_t *journal_init_common(struct block_device *bdev,
 
 err_cleanup:
        kfree(journal->j_wbuf);
-       kfree(journal->j_fc_wbuf);
        jbd2_journal_destroy_revoke(journal);
        kfree(journal);
        return NULL;
 }
 
-int jbd2_fc_init(journal_t *journal, int num_fc_blks)
-{
-       journal->j_fc_wbufsize = num_fc_blks;
-       journal->j_fc_wbuf = kmalloc_array(journal->j_fc_wbufsize,
-                               sizeof(struct buffer_head *), GFP_KERNEL);
-       if (!journal->j_fc_wbuf)
-               return -ENOMEM;
-       return 0;
-}
-EXPORT_SYMBOL(jbd2_fc_init);
-
 /* jbd2_journal_init_dev and jbd2_journal_init_inode:
  *
  * Create a journal structure assigned some fixed set of disk blocks to
@@ -1512,16 +1493,7 @@ static int journal_reset(journal_t *journal)
        }
 
        journal->j_first = first;
-
-       if (jbd2_has_feature_fast_commit(journal) &&
-           journal->j_fc_wbufsize > 0) {
-               journal->j_fc_last = last;
-               journal->j_last = last - journal->j_fc_wbufsize;
-               journal->j_fc_first = journal->j_last + 1;
-               journal->j_fc_off = 0;
-       } else {
-               journal->j_last = last;
-       }
+       journal->j_last = last;
 
        journal->j_head = journal->j_first;
        journal->j_tail = journal->j_first;
@@ -1531,7 +1503,14 @@ static int journal_reset(journal_t *journal)
        journal->j_commit_sequence = journal->j_transaction_sequence - 1;
        journal->j_commit_request = journal->j_commit_sequence;
 
-       journal->j_max_transaction_buffers = journal->j_maxlen / 4;
+       journal->j_max_transaction_buffers = jbd2_journal_get_max_txn_bufs(journal);
+
+       /*
+        * Now that journal recovery is done, turn fast commits off here. This
+        * way, if fast commit was enabled before the crash but if now FS has
+        * disabled it, we don't enable fast commits.
+        */
+       jbd2_clear_feature_fast_commit(journal);
 
        /*
         * As a special case, if the on-disk copy is already marked as needing
@@ -1792,15 +1771,15 @@ static int journal_get_superblock(journal_t *journal)
                goto out;
        }
 
-       if (be32_to_cpu(sb->s_maxlen) < journal->j_maxlen)
-               journal->j_maxlen = be32_to_cpu(sb->s_maxlen);
-       else if (be32_to_cpu(sb->s_maxlen) > journal->j_maxlen) {
+       if (be32_to_cpu(sb->s_maxlen) < journal->j_total_len)
+               journal->j_total_len = be32_to_cpu(sb->s_maxlen);
+       else if (be32_to_cpu(sb->s_maxlen) > journal->j_total_len) {
                printk(KERN_WARNING "JBD2: journal file too short\n");
                goto out;
        }
 
        if (be32_to_cpu(sb->s_first) == 0 ||
-           be32_to_cpu(sb->s_first) >= journal->j_maxlen) {
+           be32_to_cpu(sb->s_first) >= journal->j_total_len) {
                printk(KERN_WARNING
                        "JBD2: Invalid start block of journal: %u\n",
                        be32_to_cpu(sb->s_first));
@@ -1872,6 +1851,7 @@ static int load_superblock(journal_t *journal)
 {
        int err;
        journal_superblock_t *sb;
+       int num_fc_blocks;
 
        err = journal_get_superblock(journal);
        if (err)
@@ -1883,15 +1863,17 @@ static int load_superblock(journal_t *journal)
        journal->j_tail = be32_to_cpu(sb->s_start);
        journal->j_first = be32_to_cpu(sb->s_first);
        journal->j_errno = be32_to_cpu(sb->s_errno);
+       journal->j_last = be32_to_cpu(sb->s_maxlen);
 
-       if (jbd2_has_feature_fast_commit(journal) &&
-           journal->j_fc_wbufsize > 0) {
+       if (jbd2_has_feature_fast_commit(journal)) {
                journal->j_fc_last = be32_to_cpu(sb->s_maxlen);
-               journal->j_last = journal->j_fc_last - journal->j_fc_wbufsize;
+               num_fc_blocks = be32_to_cpu(sb->s_num_fc_blks);
+               if (!num_fc_blocks)
+                       num_fc_blocks = JBD2_MIN_FC_BLOCKS;
+               if (journal->j_last - num_fc_blocks >= JBD2_MIN_JOURNAL_BLOCKS)
+                       journal->j_last = journal->j_fc_last - num_fc_blocks;
                journal->j_fc_first = journal->j_last + 1;
                journal->j_fc_off = 0;
-       } else {
-               journal->j_last = be32_to_cpu(sb->s_maxlen);
        }
 
        return 0;
@@ -1954,9 +1936,6 @@ int jbd2_journal_load(journal_t *journal)
         */
        journal->j_flags &= ~JBD2_ABORT;
 
-       if (journal->j_fc_wbufsize > 0)
-               jbd2_journal_set_features(journal, 0, 0,
-                                         JBD2_FEATURE_INCOMPAT_FAST_COMMIT);
        /* OK, we've finished with the dynamic journal bits:
         * reinitialise the dynamic contents of the superblock in memory
         * and reset them on disk. */
@@ -2040,8 +2019,7 @@ int jbd2_journal_destroy(journal_t *journal)
                jbd2_journal_destroy_revoke(journal);
        if (journal->j_chksum_driver)
                crypto_free_shash(journal->j_chksum_driver);
-       if (journal->j_fc_wbufsize > 0)
-               kfree(journal->j_fc_wbuf);
+       kfree(journal->j_fc_wbuf);
        kfree(journal->j_wbuf);
        kfree(journal);
 
@@ -2116,6 +2094,37 @@ int jbd2_journal_check_available_features(journal_t *journal, unsigned long comp
        return 0;
 }
 
+static int
+jbd2_journal_initialize_fast_commit(journal_t *journal)
+{
+       journal_superblock_t *sb = journal->j_superblock;
+       unsigned long long num_fc_blks;
+
+       num_fc_blks = be32_to_cpu(sb->s_num_fc_blks);
+       if (num_fc_blks == 0)
+               num_fc_blks = JBD2_MIN_FC_BLOCKS;
+       if (journal->j_last - num_fc_blks < JBD2_MIN_JOURNAL_BLOCKS)
+               return -ENOSPC;
+
+       /* Are we called twice? */
+       WARN_ON(journal->j_fc_wbuf != NULL);
+       journal->j_fc_wbuf = kmalloc_array(num_fc_blks,
+                               sizeof(struct buffer_head *), GFP_KERNEL);
+       if (!journal->j_fc_wbuf)
+               return -ENOMEM;
+
+       journal->j_fc_wbufsize = num_fc_blks;
+       journal->j_fc_last = journal->j_last;
+       journal->j_last = journal->j_fc_last - num_fc_blks;
+       journal->j_fc_first = journal->j_last + 1;
+       journal->j_fc_off = 0;
+       journal->j_free = journal->j_last - journal->j_first;
+       journal->j_max_transaction_buffers =
+               jbd2_journal_get_max_txn_bufs(journal);
+
+       return 0;
+}
+
 /**
  * int jbd2_journal_set_features() - Mark a given journal feature in the superblock
  * @journal: Journal to act on.
@@ -2159,6 +2168,13 @@ int jbd2_journal_set_features(journal_t *journal, unsigned long compat,
 
        sb = journal->j_superblock;
 
+       if (incompat & JBD2_FEATURE_INCOMPAT_FAST_COMMIT) {
+               if (jbd2_journal_initialize_fast_commit(journal)) {
+                       pr_err("JBD2: Cannot enable fast commits.\n");
+                       return 0;
+               }
+       }
+
        /* Load the checksum driver if necessary */
        if ((journal->j_chksum_driver == NULL) &&
            INCOMPAT_FEATURE_ON(JBD2_FEATURE_INCOMPAT_CSUM_V3)) {
index eb26061..dc0694f 100644 (file)
@@ -74,8 +74,8 @@ static int do_readahead(journal_t *journal, unsigned int start)
 
        /* Do up to 128K of readahead */
        max = start + (128 * 1024 / journal->j_blocksize);
-       if (max > journal->j_maxlen)
-               max = journal->j_maxlen;
+       if (max > journal->j_total_len)
+               max = journal->j_total_len;
 
        /* Do the readahead itself.  We'll submit MAXBUF buffer_heads at
         * a time to the block device IO layer. */
@@ -134,7 +134,7 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
 
        *bhp = NULL;
 
-       if (offset >= journal->j_maxlen) {
+       if (offset >= journal->j_total_len) {
                printk(KERN_ERR "JBD2: corrupted journal superblock\n");
                return -EFSCORRUPTED;
        }
index 4398573..d54f046 100644 (file)
@@ -195,8 +195,10 @@ static void wait_transaction_switching(journal_t *journal)
        DEFINE_WAIT(wait);
 
        if (WARN_ON(!journal->j_running_transaction ||
-                   journal->j_running_transaction->t_state != T_SWITCH))
+                   journal->j_running_transaction->t_state != T_SWITCH)) {
+               read_unlock(&journal->j_state_lock);
                return;
+       }
        prepare_to_wait(&journal->j_wait_transaction_locked, &wait,
                        TASK_UNINTERRUPTIBLE);
        read_unlock(&journal->j_state_lock);
index 7b09a91..34f5464 100644 (file)
@@ -383,8 +383,7 @@ static int minix_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_files = sbi->s_ninodes;
        buf->f_ffree = minix_count_free_inodes(sb);
        buf->f_namelen = sbi->s_namelen;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
 
        return 0;
 }
index f1eb8cc..d4a6dd7 100644 (file)
@@ -1626,7 +1626,8 @@ static const char *pick_link(struct nameidata *nd, struct path *link,
                        return ERR_PTR(error);
        }
 
-       if (unlikely(nd->flags & LOOKUP_NO_SYMLINKS))
+       if (unlikely(nd->flags & LOOKUP_NO_SYMLINKS) ||
+                       unlikely(link->mnt->mnt_flags & MNT_NOSYMFOLLOW))
                return ERR_PTR(-ELOOP);
 
        if (!(nd->flags & LOOKUP_RCU)) {
index 1a75336..cebaa3e 100644 (file)
@@ -3171,6 +3171,8 @@ int path_mount(const char *dev_name, struct path *path,
                mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME);
        if (flags & MS_RDONLY)
                mnt_flags |= MNT_READONLY;
+       if (flags & MS_NOSYMFOLLOW)
+               mnt_flags |= MNT_NOSYMFOLLOW;
 
        /* The default atime for remount is preservation */
        if ((flags & MS_REMOUNT) &&
index cb52db9..4e011ad 100644 (file)
@@ -955,7 +955,6 @@ out:
 
 static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
 {
-       struct inode *inode = file_inode(filp);
        struct nfs_open_dir_context *dir_ctx = filp->private_data;
 
        dfprintk(FILE, "NFS: llseek dir(%pD2, %lld, %d)\n",
@@ -967,15 +966,15 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
        case SEEK_SET:
                if (offset < 0)
                        return -EINVAL;
-               inode_lock(inode);
+               spin_lock(&filp->f_lock);
                break;
        case SEEK_CUR:
                if (offset == 0)
                        return filp->f_pos;
-               inode_lock(inode);
+               spin_lock(&filp->f_lock);
                offset += filp->f_pos;
                if (offset < 0) {
-                       inode_unlock(inode);
+                       spin_unlock(&filp->f_lock);
                        return -EINVAL;
                }
        }
@@ -987,7 +986,7 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
                        dir_ctx->dir_cookie = 0;
                dir_ctx->duped = 0;
        }
-       inode_unlock(inode);
+       spin_unlock(&filp->f_lock);
        return offset;
 }
 
@@ -998,13 +997,9 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
 static int nfs_fsync_dir(struct file *filp, loff_t start, loff_t end,
                         int datasync)
 {
-       struct inode *inode = file_inode(filp);
-
        dfprintk(FILE, "NFS: fsync dir(%pD2) datasync %d\n", filp, datasync);
 
-       inode_lock(inode);
-       nfs_inc_stats(inode, NFSIOS_VFSFSYNC);
-       inode_unlock(inode);
+       nfs_inc_stats(file_inode(filp), NFSIOS_VFSFSYNC);
        return 0;
 }
 
index b51424f..6c2ce79 100644 (file)
@@ -1047,8 +1047,10 @@ out4:
 
 void nfs4_xattr_cache_exit(void)
 {
+       unregister_shrinker(&nfs4_xattr_large_entry_shrinker);
        unregister_shrinker(&nfs4_xattr_entry_shrinker);
        unregister_shrinker(&nfs4_xattr_cache_shrinker);
+       list_lru_destroy(&nfs4_xattr_large_entry_lru);
        list_lru_destroy(&nfs4_xattr_entry_lru);
        list_lru_destroy(&nfs4_xattr_cache_lru);
        kmem_cache_destroy(nfs4_xattr_cache_cachep);
index 0dc31ad..6e060a8 100644 (file)
                                 1 + nfs4_xattr_name_maxsz + 1)
 #define decode_setxattr_maxsz   (op_decode_hdr_maxsz + decode_change_info_maxsz)
 #define encode_listxattrs_maxsz  (op_encode_hdr_maxsz + 2 + 1)
-#define decode_listxattrs_maxsz  (op_decode_hdr_maxsz + 2 + 1 + 1)
+#define decode_listxattrs_maxsz  (op_decode_hdr_maxsz + 2 + 1 + 1 + 1)
 #define encode_removexattr_maxsz (op_encode_hdr_maxsz + 1 + \
                                  nfs4_xattr_name_maxsz)
 #define decode_removexattr_maxsz (op_decode_hdr_maxsz + \
@@ -531,7 +531,7 @@ static void encode_listxattrs(struct xdr_stream *xdr,
 {
        __be32 *p;
 
-       encode_op_hdr(xdr, OP_LISTXATTRS, decode_listxattrs_maxsz + 1, hdr);
+       encode_op_hdr(xdr, OP_LISTXATTRS, decode_listxattrs_maxsz, hdr);
 
        p = reserve_space(xdr, 12);
        if (unlikely(!p))
index 8d32788..fa14830 100644 (file)
 #define NFS_ROOT               "/tftpboot/%s"
 
 /* Default NFSROOT mount options. */
+#if defined(CONFIG_NFS_V2)
 #define NFS_DEF_OPTIONS                "vers=2,tcp,rsize=4096,wsize=4096"
+#elif defined(CONFIG_NFS_V3)
+#define NFS_DEF_OPTIONS                "vers=3,tcp,rsize=4096,wsize=4096"
+#else
+#define NFS_DEF_OPTIONS                "vers=4,tcp,rsize=4096,wsize=4096"
+#endif
 
 /* Parameters passed from the kernel command line */
 static char nfs_root_parms[NFS_MAXPATHLEN + 1] __initdata = "";
index 1446861..a633044 100644 (file)
@@ -316,10 +316,6 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp)
        fh_copy(&resp->dirfh, &argp->fh);
        fh_init(&resp->fh, NFS3_FHSIZE);
 
-       if (argp->ftype == 0 || argp->ftype >= NF3BAD) {
-               resp->status = nfserr_inval;
-               goto out;
-       }
        if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
                rdev = MKDEV(argp->major, argp->minor);
                if (MAJOR(rdev) != argp->major ||
@@ -328,7 +324,7 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp)
                        goto out;
                }
        } else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) {
-               resp->status = nfserr_inval;
+               resp->status = nfserr_badtype;
                goto out;
        }
 
index 9c23b6a..2277f83 100644 (file)
@@ -1114,6 +1114,7 @@ nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p)
 {
        struct nfsd3_pathconfres *resp = rqstp->rq_resp;
 
+       *p++ = resp->status;
        *p++ = xdr_zero;        /* no post_op_attr */
 
        if (resp->status == 0) {
index ad2fa1a..e83b217 100644 (file)
@@ -1299,7 +1299,7 @@ nfsd4_cleanup_inter_ssc(struct vfsmount *ss_mnt, struct nfsd_file *src,
                        struct nfsd_file *dst)
 {
        nfs42_ssc_close(src->nf_file);
-       nfsd_file_put(src);
+       /* 'src' is freed by nfsd4_do_async_copy */
        nfsd_file_put(dst);
        mntput(ss_mnt);
 }
@@ -1486,6 +1486,7 @@ do_callback:
        cb_copy = kzalloc(sizeof(struct nfsd4_copy), GFP_KERNEL);
        if (!cb_copy)
                goto out;
+       refcount_set(&cb_copy->refcount, 1);
        memcpy(&cb_copy->cp_res, &copy->cp_res, sizeof(copy->cp_res));
        cb_copy->cp_clp = copy->cp_clp;
        cb_copy->nfserr = copy->nfserr;
index 2eee5fb..4abd928 100644 (file)
@@ -651,8 +651,7 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_files = nmaxinodes;
        buf->f_ffree = nfreeinodes;
        buf->f_namelen = NILFS_NAME_LEN;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
 
        return 0;
 }
index 7dc3bc6..0d7e948 100644 (file)
@@ -2643,8 +2643,7 @@ static int ntfs_statfs(struct dentry *dentry, struct kstatfs *sfs)
         * the least significant 32-bits in f_fsid[0] and the most significant
         * 32-bits in f_fsid[1].
         */
-       sfs->f_fsid.val[0] = vol->serial_no & 0xffffffff;
-       sfs->f_fsid.val[1] = (vol->serial_no >> 32) & 0xffffffff;
+       sfs->f_fsid = u64_to_fsid(vol->serial_no);
        /* Maximum length of filenames. */
        sfs->f_namelen     = NTFS_MAX_NAME_LEN;
        return 0;
index b9a9d69..db52e84 100644 (file)
@@ -877,7 +877,7 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty)
                goto done;
        }
 
-       trace_ocfs2_journal_init_maxlen(j_journal->j_maxlen);
+       trace_ocfs2_journal_init_maxlen(j_journal->j_total_len);
 
        *dirty = (le32_to_cpu(di->id1.journal1.ij_flags) &
                  OCFS2_JOURNAL_DIRTY_FL);
index b76ec6b..ce93ccc 100644 (file)
@@ -282,8 +282,7 @@ static int omfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_blocks = sbi->s_num_blocks;
        buf->f_files = sbi->s_num_blocks;
        buf->f_namelen = OMFS_NAMELEN;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
 
        buf->f_bfree = buf->f_bavail = buf->f_ffree =
                omfs_count_free(s);
@@ -363,12 +362,11 @@ static int omfs_get_imap(struct super_block *sb)
                bh = sb_bread(sb, block++);
                if (!bh)
                        goto nomem_free;
-               *ptr = kmalloc(sb->s_blocksize, GFP_KERNEL);
+               *ptr = kmemdup(bh->b_data, sb->s_blocksize, GFP_KERNEL);
                if (!*ptr) {
                        brelse(bh);
                        goto nomem_free;
                }
-               memcpy(*ptr, bh->b_data, sb->s_blocksize);
                if (count < sb->s_blocksize)
                        memset((void *)*ptr + count, 0xff,
                                sb->s_blocksize - count);
index 0f70700..b362523 100644 (file)
@@ -1049,6 +1049,8 @@ static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count,
                oom_adj = (task->signal->oom_score_adj * -OOM_DISABLE) /
                          OOM_SCORE_ADJ_MAX;
        put_task_struct(task);
+       if (oom_adj > OOM_ADJUST_MAX)
+               oom_adj = OOM_ADJUST_MAX;
        len = snprintf(buffer, sizeof(buffer), "%d\n", oom_adj);
        return simple_read_from_buffer(buf, count, ppos, buffer, len);
 }
index d0989a4..419760f 100644 (file)
@@ -19,7 +19,7 @@ static int cpuinfo_open(struct inode *inode, struct file *file)
 static const struct proc_ops cpuinfo_proc_ops = {
        .proc_flags     = PROC_ENTRY_PERMANENT,
        .proc_open      = cpuinfo_open,
-       .proc_read      = seq_read,
+       .proc_read_iter = seq_read_iter,
        .proc_lseek     = seq_lseek,
        .proc_release   = seq_release,
 };
index 2f9fa17..b846632 100644 (file)
@@ -590,7 +590,7 @@ static int proc_seq_release(struct inode *inode, struct file *file)
 static const struct proc_ops proc_seq_ops = {
        /* not permanent -- can call into arbitrary seq_operations */
        .proc_open      = proc_seq_open,
-       .proc_read      = seq_read,
+       .proc_read_iter = seq_read_iter,
        .proc_lseek     = seq_lseek,
        .proc_release   = proc_seq_release,
 };
@@ -621,7 +621,7 @@ static int proc_single_open(struct inode *inode, struct file *file)
 static const struct proc_ops proc_single_ops = {
        /* not permanent -- can call into arbitrary ->single_show */
        .proc_open      = proc_single_open,
-       .proc_read      = seq_read,
+       .proc_read_iter = seq_read_iter,
        .proc_lseek     = seq_lseek,
        .proc_release   = single_release,
 };
index 58c075e..bde6b6f 100644 (file)
@@ -597,6 +597,7 @@ static const struct file_operations proc_iter_file_ops = {
        .llseek         = proc_reg_llseek,
        .read_iter      = proc_reg_read_iter,
        .write          = proc_reg_write,
+       .splice_read    = generic_file_splice_read,
        .poll           = proc_reg_poll,
        .unlocked_ioctl = proc_reg_unlocked_ioctl,
        .mmap           = proc_reg_mmap,
@@ -622,6 +623,7 @@ static const struct file_operations proc_reg_file_ops_compat = {
 static const struct file_operations proc_iter_file_ops_compat = {
        .llseek         = proc_reg_llseek,
        .read_iter      = proc_reg_read_iter,
+       .splice_read    = generic_file_splice_read,
        .write          = proc_reg_write,
        .poll           = proc_reg_poll,
        .unlocked_ioctl = proc_reg_unlocked_ioctl,
index 46b3293..4695b6d 100644 (file)
@@ -226,7 +226,7 @@ static int stat_open(struct inode *inode, struct file *file)
 static const struct proc_ops stat_proc_ops = {
        .proc_flags     = PROC_ENTRY_PERMANENT,
        .proc_open      = stat_open,
-       .proc_read      = seq_read,
+       .proc_read_iter = seq_read_iter,
        .proc_lseek     = seq_lseek,
        .proc_release   = single_release,
 };
index 3059a93..e59d4bb 100644 (file)
@@ -70,6 +70,7 @@ static void show_mnt_opts(struct seq_file *m, struct vfsmount *mnt)
                { MNT_NOATIME, ",noatime" },
                { MNT_NODIRATIME, ",nodiratime" },
                { MNT_RELATIME, ",relatime" },
+               { MNT_NOSYMFOLLOW, ",nosymfollow" },
                { 0, NULL }
        };
        const struct proc_fs_opts *fs_infop;
index e8da1cd..3fb7fc8 100644 (file)
@@ -137,8 +137,7 @@ static int qnx4_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_bfree   = qnx4_count_free_blocks(sb);
        buf->f_bavail  = buf->f_bfree;
        buf->f_namelen = QNX4_NAME_MAX;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid    = u64_to_fsid(id);
 
        return 0;
 }
index 755293c..61191f7 100644 (file)
@@ -166,8 +166,7 @@ static int qnx6_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_ffree   = fs32_to_cpu(sbi, sbi->sb->sb_free_inodes);
        buf->f_bavail  = buf->f_bfree;
        buf->f_namelen = QNX6_LONG_NAME_MAX;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid    = u64_to_fsid(id);
 
        return 0;
 }
index b1b7d3f..259f684 100644 (file)
@@ -416,8 +416,7 @@ static int romfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_bfree = buf->f_bavail = buf->f_ffree;
        buf->f_blocks =
                (romfs_maxsize(dentry->d_sb) + ROMBSIZE - 1) >> ROMBSBITS;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
        return 0;
 }
 
index 7aef495..ebfebdf 100644 (file)
@@ -97,7 +97,7 @@ u64 select_estimate_accuracy(struct timespec64 *tv)
 struct poll_table_page {
        struct poll_table_page * next;
        struct poll_table_entry * entry;
-       struct poll_table_entry entries[0];
+       struct poll_table_entry entries[];
 };
 
 #define POLL_TABLE_FULL(table) \
@@ -836,7 +836,7 @@ SYSCALL_DEFINE1(old_select, struct sel_arg_struct __user *, arg)
 struct poll_list {
        struct poll_list *next;
        int len;
-       struct pollfd entries[0];
+       struct pollfd entries[];
 };
 
 #define POLLFD_PER_PAGE  ((PAGE_SIZE-sizeof(struct poll_list)) / sizeof(struct pollfd))
index 31219c1..3b20e21 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/mm.h>
 #include <linux/printk.h>
 #include <linux/string_helpers.h>
+#include <linux/uio.h>
 
 #include <linux/uaccess.h>
 #include <asm/page.h>
@@ -146,7 +147,28 @@ Eoverflow:
  */
 ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
 {
-       struct seq_file *m = file->private_data;
+       struct iovec iov = { .iov_base = buf, .iov_len = size};
+       struct kiocb kiocb;
+       struct iov_iter iter;
+       ssize_t ret;
+
+       init_sync_kiocb(&kiocb, file);
+       iov_iter_init(&iter, READ, &iov, 1, size);
+
+       kiocb.ki_pos = *ppos;
+       ret = seq_read_iter(&kiocb, &iter);
+       *ppos = kiocb.ki_pos;
+       return ret;
+}
+EXPORT_SYMBOL(seq_read);
+
+/*
+ * Ready-made ->f_op->read_iter()
+ */
+ssize_t seq_read_iter(struct kiocb *iocb, struct iov_iter *iter)
+{
+       struct seq_file *m = iocb->ki_filp->private_data;
+       size_t size = iov_iter_count(iter);
        size_t copied = 0;
        size_t n;
        void *p;
@@ -158,14 +180,14 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
         * if request is to read from zero offset, reset iterator to first
         * record as it might have been already advanced by previous requests
         */
-       if (*ppos == 0) {
+       if (iocb->ki_pos == 0) {
                m->index = 0;
                m->count = 0;
        }
 
-       /* Don't assume *ppos is where we left it */
-       if (unlikely(*ppos != m->read_pos)) {
-               while ((err = traverse(m, *ppos)) == -EAGAIN)
+       /* Don't assume ki_pos is where we left it */
+       if (unlikely(iocb->ki_pos != m->read_pos)) {
+               while ((err = traverse(m, iocb->ki_pos)) == -EAGAIN)
                        ;
                if (err) {
                        /* With prejudice... */
@@ -174,7 +196,7 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
                        m->count = 0;
                        goto Done;
                } else {
-                       m->read_pos = *ppos;
+                       m->read_pos = iocb->ki_pos;
                }
        }
 
@@ -187,13 +209,11 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
        /* if not empty - flush it first */
        if (m->count) {
                n = min(m->count, size);
-               err = copy_to_user(buf, m->buf + m->from, n);
-               if (err)
+               if (copy_to_iter(m->buf + m->from, n, iter) != n)
                        goto Efault;
                m->count -= n;
                m->from += n;
                size -= n;
-               buf += n;
                copied += n;
                if (!size)
                        goto Done;
@@ -254,8 +274,7 @@ Fill:
        }
        m->op->stop(m, p);
        n = min(m->count, size);
-       err = copy_to_user(buf, m->buf, n);
-       if (err)
+       if (copy_to_iter(m->buf, n, iter) != n)
                goto Efault;
        copied += n;
        m->count -= n;
@@ -264,7 +283,7 @@ Done:
        if (!copied)
                copied = err;
        else {
-               *ppos += copied;
+               iocb->ki_pos += copied;
                m->read_pos += copied;
        }
        mutex_unlock(&m->lock);
@@ -276,7 +295,7 @@ Efault:
        err = -EFAULT;
        goto Done;
 }
-EXPORT_SYMBOL(seq_read);
+EXPORT_SYMBOL(seq_read_iter);
 
 /**
  *     seq_lseek -     ->llseek() method for sequential files.
index 599b740..866d5c2 100644 (file)
@@ -1005,9 +1005,8 @@ static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe,
 /*
  * Determine where to splice to/from.
  */
-long do_splice(struct file *in, loff_t __user *off_in,
-               struct file *out, loff_t __user *off_out,
-               size_t len, unsigned int flags)
+long do_splice(struct file *in, loff_t *off_in, struct file *out,
+              loff_t *off_out, size_t len, unsigned int flags)
 {
        struct pipe_inode_info *ipipe;
        struct pipe_inode_info *opipe;
@@ -1041,8 +1040,7 @@ long do_splice(struct file *in, loff_t __user *off_in,
                if (off_out) {
                        if (!(out->f_mode & FMODE_PWRITE))
                                return -EINVAL;
-                       if (copy_from_user(&offset, off_out, sizeof(loff_t)))
-                               return -EFAULT;
+                       offset = *off_out;
                } else {
                        offset = out->f_pos;
                }
@@ -1063,8 +1061,8 @@ long do_splice(struct file *in, loff_t __user *off_in,
 
                if (!off_out)
                        out->f_pos = offset;
-               else if (copy_to_user(off_out, &offset, sizeof(loff_t)))
-                       ret = -EFAULT;
+               else
+                       *off_out = offset;
 
                return ret;
        }
@@ -1075,8 +1073,7 @@ long do_splice(struct file *in, loff_t __user *off_in,
                if (off_in) {
                        if (!(in->f_mode & FMODE_PREAD))
                                return -EINVAL;
-                       if (copy_from_user(&offset, off_in, sizeof(loff_t)))
-                               return -EFAULT;
+                       offset = *off_in;
                } else {
                        offset = in->f_pos;
                }
@@ -1100,8 +1097,8 @@ long do_splice(struct file *in, loff_t __user *off_in,
                        wakeup_pipe_readers(opipe);
                if (!off_in)
                        in->f_pos = offset;
-               else if (copy_to_user(off_in, &offset, sizeof(loff_t)))
-                       ret = -EFAULT;
+               else
+                       *off_in = offset;
 
                return ret;
        }
@@ -1109,6 +1106,46 @@ long do_splice(struct file *in, loff_t __user *off_in,
        return -EINVAL;
 }
 
+static long __do_splice(struct file *in, loff_t __user *off_in,
+                       struct file *out, loff_t __user *off_out,
+                       size_t len, unsigned int flags)
+{
+       struct pipe_inode_info *ipipe;
+       struct pipe_inode_info *opipe;
+       loff_t offset, *__off_in = NULL, *__off_out = NULL;
+       long ret;
+
+       ipipe = get_pipe_info(in, true);
+       opipe = get_pipe_info(out, true);
+
+       if (ipipe && off_in)
+               return -ESPIPE;
+       if (opipe && off_out)
+               return -ESPIPE;
+
+       if (off_out) {
+               if (copy_from_user(&offset, off_out, sizeof(loff_t)))
+                       return -EFAULT;
+               __off_out = &offset;
+       }
+       if (off_in) {
+               if (copy_from_user(&offset, off_in, sizeof(loff_t)))
+                       return -EFAULT;
+               __off_in = &offset;
+       }
+
+       ret = do_splice(in, __off_in, out, __off_out, len, flags);
+       if (ret < 0)
+               return ret;
+
+       if (__off_out && copy_to_user(off_out, __off_out, sizeof(loff_t)))
+               return -EFAULT;
+       if (__off_in && copy_to_user(off_in, __off_in, sizeof(loff_t)))
+               return -EFAULT;
+
+       return ret;
+}
+
 static int iter_to_pipe(struct iov_iter *from,
                        struct pipe_inode_info *pipe,
                        unsigned flags)
@@ -1303,8 +1340,8 @@ SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in,
        if (in.file) {
                out = fdget(fd_out);
                if (out.file) {
-                       error = do_splice(in.file, off_in, out.file, off_out,
-                                         len, flags);
+                       error = __do_splice(in.file, off_in, out.file, off_out,
+                                               len, flags);
                        fdput(out);
                }
                fdput(in);
index 0cc4cee..d6c6593 100644 (file)
@@ -380,8 +380,7 @@ static int squashfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_files = msblk->inodes;
        buf->f_ffree = 0;
        buf->f_namelen = SQUASHFS_NAME_LEN;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
 
        return 0;
 }
index 44f8ad3..dacecdd 100644 (file)
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -56,7 +56,7 @@ EXPORT_SYMBOL(generic_fillattr);
  * @path: file to get attributes from
  * @stat: structure to return attributes in
  * @request_mask: STATX_xxx flags indicating what the caller wants
- * @query_flags: Query mode (KSTAT_QUERY_FLAGS)
+ * @query_flags: Query mode (AT_STATX_SYNC_TYPE)
  *
  * Get attributes without calling security_inode_getattr.
  *
@@ -71,7 +71,7 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat,
 
        memset(stat, 0, sizeof(*stat));
        stat->result_mask |= STATX_BASIC_STATS;
-       query_flags &= KSTAT_QUERY_FLAGS;
+       query_flags &= AT_STATX_SYNC_TYPE;
 
        /* allow the fs to override these if it really wants to */
        /* SB_NOATIME means filesystem supplies dummy atime value */
@@ -97,7 +97,7 @@ EXPORT_SYMBOL(vfs_getattr_nosec);
  * @path: The file of interest
  * @stat: Where to return the statistics
  * @request_mask: STATX_xxx flags indicating what the caller wants
- * @query_flags: Query mode (KSTAT_QUERY_FLAGS)
+ * @query_flags: Query mode (AT_STATX_SYNC_TYPE)
  *
  * Ask the filesystem for a file's attributes.  The caller must indicate in
  * request_mask and query_flags to indicate what they want.
@@ -126,53 +126,27 @@ int vfs_getattr(const struct path *path, struct kstat *stat,
 EXPORT_SYMBOL(vfs_getattr);
 
 /**
- * vfs_statx_fd - Get the enhanced basic attributes by file descriptor
+ * vfs_fstat - Get the basic attributes by file descriptor
  * @fd: The file descriptor referring to the file of interest
  * @stat: The result structure to fill in.
- * @request_mask: STATX_xxx flags indicating what the caller wants
- * @query_flags: Query mode (KSTAT_QUERY_FLAGS)
  *
  * This function is a wrapper around vfs_getattr().  The main difference is
  * that it uses a file descriptor to determine the file location.
  *
  * 0 will be returned on success, and a -ve error code if unsuccessful.
  */
-int vfs_statx_fd(unsigned int fd, struct kstat *stat,
-                u32 request_mask, unsigned int query_flags)
+int vfs_fstat(int fd, struct kstat *stat)
 {
        struct fd f;
-       int error = -EBADF;
-
-       if (query_flags & ~KSTAT_QUERY_FLAGS)
-               return -EINVAL;
+       int error;
 
        f = fdget_raw(fd);
-       if (f.file) {
-               error = vfs_getattr(&f.file->f_path, stat,
-                                   request_mask, query_flags);
-               fdput(f);
-       }
+       if (!f.file)
+               return -EBADF;
+       error = vfs_getattr(&f.file->f_path, stat, STATX_BASIC_STATS, 0);
+       fdput(f);
        return error;
 }
-EXPORT_SYMBOL(vfs_statx_fd);
-
-static inline unsigned vfs_stat_set_lookup_flags(unsigned *lookup_flags,
-                                                int flags)
-{
-       if ((flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |
-                      AT_EMPTY_PATH | KSTAT_QUERY_FLAGS)) != 0)
-               return -EINVAL;
-
-       *lookup_flags = LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT;
-       if (flags & AT_SYMLINK_NOFOLLOW)
-               *lookup_flags &= ~LOOKUP_FOLLOW;
-       if (flags & AT_NO_AUTOMOUNT)
-               *lookup_flags &= ~LOOKUP_AUTOMOUNT;
-       if (flags & AT_EMPTY_PATH)
-               *lookup_flags |= LOOKUP_EMPTY;
-
-       return 0;
-}
 
 /**
  * vfs_statx - Get basic and extra attributes by filename
@@ -189,15 +163,24 @@ static inline unsigned vfs_stat_set_lookup_flags(unsigned *lookup_flags,
  *
  * 0 will be returned on success, and a -ve error code if unsuccessful.
  */
-int vfs_statx(int dfd, const char __user *filename, int flags,
+static int vfs_statx(int dfd, const char __user *filename, int flags,
              struct kstat *stat, u32 request_mask)
 {
        struct path path;
-       int error = -EINVAL;
-       unsigned lookup_flags;
+       unsigned lookup_flags = 0;
+       int error;
 
-       if (vfs_stat_set_lookup_flags(&lookup_flags, flags))
+       if (flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT | AT_EMPTY_PATH |
+                     AT_STATX_SYNC_TYPE))
                return -EINVAL;
+
+       if (!(flags & AT_SYMLINK_NOFOLLOW))
+               lookup_flags |= LOOKUP_FOLLOW;
+       if (!(flags & AT_NO_AUTOMOUNT))
+               lookup_flags |= LOOKUP_AUTOMOUNT;
+       if (flags & AT_EMPTY_PATH)
+               lookup_flags |= LOOKUP_EMPTY;
+
 retry:
        error = user_path_at(dfd, filename, lookup_flags, &path);
        if (error)
@@ -217,8 +200,13 @@ retry:
 out:
        return error;
 }
-EXPORT_SYMBOL(vfs_statx);
 
+int vfs_fstatat(int dfd, const char __user *filename,
+                             struct kstat *stat, int flags)
+{
+       return vfs_statx(dfd, filename, flags | AT_NO_AUTOMOUNT,
+                        stat, STATX_BASIC_STATS);
+}
 
 #ifdef __ARCH_WANT_OLD_STAT
 
index 2616424..59f3375 100644 (file)
@@ -29,6 +29,8 @@ static int flags_by_mnt(int mnt_flags)
                flags |= ST_NODIRATIME;
        if (mnt_flags & MNT_RELATIME)
                flags |= ST_RELATIME;
+       if (mnt_flags & MNT_NOSYMFOLLOW)
+               flags |= ST_NOSYMFOLLOW;
        return flags;
 }
 
index 02b1d9d..be47263 100644 (file)
@@ -98,8 +98,7 @@ static int sysv_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_files = sbi->s_ninodes;
        buf->f_ffree = sysv_count_free_inodes(sb);
        buf->f_namelen = SYSV_NAMELEN;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
        return 0;
 }
 
index faf2017..5bef3a6 100644 (file)
@@ -2414,8 +2414,7 @@ static int udf_statfs(struct dentry *dentry, struct kstatfs *buf)
                        + buf->f_bfree;
        buf->f_ffree = buf->f_bfree;
        buf->f_namelen = UDF_NAME_LEN;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
 
        return 0;
 }
index e3b69fb..983558b 100644 (file)
@@ -1431,8 +1431,7 @@ static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf)
                ? (buf->f_bfree - uspi->s_root_blocks) : 0;
        buf->f_files = uspi->s_ncg * uspi->s_ipg;
        buf->f_namelen = UFS_MAXNAMLEN;
-       buf->f_fsid.val[0] = (u32)id;
-       buf->f_fsid.val[1] = (u32)(id >> 32);
+       buf->f_fsid = u64_to_fsid(id);
 
        mutex_unlock(&UFS_SB(sb)->s_lock);
 
index 852b536..1564001 100644 (file)
@@ -2467,6 +2467,7 @@ xfs_defer_agfl_block(
        new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno);
        new->xefi_blockcount = 1;
        new->xefi_oinfo = *oinfo;
+       new->xefi_skip_discard = false;
 
        trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1);
 
index e1bd484..6747e97 100644 (file)
@@ -52,9 +52,9 @@ struct xfs_extent_free_item
 {
        xfs_fsblock_t           xefi_startblock;/* starting fs block number */
        xfs_extlen_t            xefi_blockcount;/* number of blocks in extent */
+       bool                    xefi_skip_discard;
        struct list_head        xefi_list;
        struct xfs_owner_info   xefi_oinfo;     /* extent owner */
-       bool                    xefi_skip_discard;
 };
 
 #define        XFS_BMAP_MAX_NMAP       4
index 3aa85b6..bb25ff1 100644 (file)
@@ -121,8 +121,7 @@ xchk_inode_flags(
                goto bad;
 
        /* rt flags require rt device */
-       if ((flags & (XFS_DIFLAG_REALTIME | XFS_DIFLAG_RTINHERIT)) &&
-           !mp->m_rtdev_targp)
+       if ((flags & XFS_DIFLAG_REALTIME) && !mp->m_rtdev_targp)
                goto bad;
 
        /* new rt bitmap flag only valid for rbmino */
index 55d126d..4304c64 100644 (file)
@@ -346,8 +346,8 @@ xfs_map_blocks(
        ssize_t                 count = i_blocksize(inode);
        xfs_fileoff_t           offset_fsb = XFS_B_TO_FSBT(mp, offset);
        xfs_fileoff_t           end_fsb = XFS_B_TO_FSB(mp, offset + count);
-       xfs_fileoff_t           cow_fsb = NULLFILEOFF;
-       int                     whichfork = XFS_DATA_FORK;
+       xfs_fileoff_t           cow_fsb;
+       int                     whichfork;
        struct xfs_bmbt_irec    imap;
        struct xfs_iext_cursor  icur;
        int                     retries = 0;
@@ -381,6 +381,8 @@ xfs_map_blocks(
         * landed in a hole and we skip the block.
         */
 retry:
+       cow_fsb = NULLFILEOFF;
+       whichfork = XFS_DATA_FORK;
        xfs_ilock(ip, XFS_ILOCK_SHARED);
        ASSERT(ip->i_df.if_format != XFS_DINODE_FMT_BTREE ||
               (ip->i_df.if_flags & XFS_IFEXTENTS));
@@ -527,13 +529,15 @@ xfs_prepare_ioend(
  */
 static void
 xfs_discard_page(
-       struct page             *page)
+       struct page             *page,
+       loff_t                  fileoff)
 {
        struct inode            *inode = page->mapping->host;
        struct xfs_inode        *ip = XFS_I(inode);
        struct xfs_mount        *mp = ip->i_mount;
-       loff_t                  offset = page_offset(page);
-       xfs_fileoff_t           start_fsb = XFS_B_TO_FSBT(mp, offset);
+       unsigned int            pageoff = offset_in_page(fileoff);
+       xfs_fileoff_t           start_fsb = XFS_B_TO_FSBT(mp, fileoff);
+       xfs_fileoff_t           pageoff_fsb = XFS_B_TO_FSBT(mp, pageoff);
        int                     error;
 
        if (XFS_FORCED_SHUTDOWN(mp))
@@ -541,14 +545,14 @@ xfs_discard_page(
 
        xfs_alert_ratelimited(mp,
                "page discard on page "PTR_FMT", inode 0x%llx, offset %llu.",
-                       page, ip->i_ino, offset);
+                       page, ip->i_ino, fileoff);
 
        error = xfs_bmap_punch_delalloc_range(ip, start_fsb,
-                       i_blocks_per_page(inode, page));
+                       i_blocks_per_page(inode, page) - pageoff_fsb);
        if (error && !XFS_FORCED_SHUTDOWN(mp))
                xfs_alert(mp, "page discard unable to remove delalloc mapping.");
 out_invalidate:
-       iomap_invalidatepage(page, 0, PAGE_SIZE);
+       iomap_invalidatepage(page, pageoff, PAGE_SIZE - pageoff);
 }
 
 static const struct iomap_writeback_ops xfs_writeback_ops = {
index f2a8a0e..7371a7f 100644 (file)
@@ -947,11 +947,11 @@ xfs_free_file_space(
        endoffset_fsb = XFS_B_TO_FSBT(mp, offset + len);
 
        /* We can only free complete realtime extents. */
-       if (XFS_IS_REALTIME_INODE(ip)) {
-               xfs_extlen_t    extsz = xfs_get_extsz_hint(ip);
-
-               if ((startoffset_fsb | endoffset_fsb) & (extsz - 1))
-                       return -EINVAL;
+       if (XFS_IS_REALTIME_INODE(ip) && mp->m_sb.sb_rextsize > 1) {
+               startoffset_fsb = roundup_64(startoffset_fsb,
+                                            mp->m_sb.sb_rextsize);
+               endoffset_fsb = rounddown_64(endoffset_fsb,
+                                            mp->m_sb.sb_rextsize);
        }
 
        /*
@@ -1147,14 +1147,6 @@ xfs_insert_file_space(
 
        trace_xfs_insert_file_space(ip);
 
-       /* We can only insert complete realtime extents. */
-       if (XFS_IS_REALTIME_INODE(ip)) {
-               xfs_extlen_t    extsz = xfs_get_extsz_hint(ip);
-
-               if ((stop_fsb | shift_fsb) & (extsz - 1))
-                       return -EINVAL;
-       }
-
        error = xfs_bmap_can_insert_extents(ip, stop_fsb, shift_fsb);
        if (error)
                return error;
index 3d1b951..5b0f93f 100644 (file)
 
 static const struct vm_operations_struct xfs_file_vm_ops;
 
+/*
+ * Decide if the given file range is aligned to the size of the fundamental
+ * allocation unit for the file.
+ */
+static bool
+xfs_is_falloc_aligned(
+       struct xfs_inode        *ip,
+       loff_t                  pos,
+       long long int           len)
+{
+       struct xfs_mount        *mp = ip->i_mount;
+       uint64_t                mask;
+
+       if (XFS_IS_REALTIME_INODE(ip)) {
+               if (!is_power_of_2(mp->m_sb.sb_rextsize)) {
+                       u64     rextbytes;
+                       u32     mod;
+
+                       rextbytes = XFS_FSB_TO_B(mp, mp->m_sb.sb_rextsize);
+                       div_u64_rem(pos, rextbytes, &mod);
+                       if (mod)
+                               return false;
+                       div_u64_rem(len, rextbytes, &mod);
+                       return mod == 0;
+               }
+               mask = XFS_FSB_TO_B(mp, mp->m_sb.sb_rextsize) - 1;
+       } else {
+               mask = mp->m_sb.sb_blocksize - 1;
+       }
+
+       return !((pos | len) & mask);
+}
+
 int
 xfs_update_prealloc_flags(
        struct xfs_inode        *ip,
@@ -850,9 +883,7 @@ xfs_file_fallocate(
                if (error)
                        goto out_unlock;
        } else if (mode & FALLOC_FL_COLLAPSE_RANGE) {
-               unsigned int blksize_mask = i_blocksize(inode) - 1;
-
-               if (offset & blksize_mask || len & blksize_mask) {
+               if (!xfs_is_falloc_aligned(ip, offset, len)) {
                        error = -EINVAL;
                        goto out_unlock;
                }
@@ -872,10 +903,9 @@ xfs_file_fallocate(
                if (error)
                        goto out_unlock;
        } else if (mode & FALLOC_FL_INSERT_RANGE) {
-               unsigned int    blksize_mask = i_blocksize(inode) - 1;
                loff_t          isize = i_size_read(inode);
 
-               if (offset & blksize_mask || len & blksize_mask) {
+               if (!xfs_is_falloc_aligned(ip, offset, len)) {
                        error = -EINVAL;
                        goto out_unlock;
                }
index 5e16545..1414ab7 100644 (file)
@@ -911,6 +911,16 @@ xfs_setattr_size(
                error = iomap_zero_range(inode, oldsize, newsize - oldsize,
                                &did_zeroing, &xfs_buffered_write_iomap_ops);
        } else {
+               /*
+                * iomap won't detect a dirty page over an unwritten block (or a
+                * cow block over a hole) and subsequently skips zeroing the
+                * newly post-EOF portion of the page. Flush the new EOF to
+                * convert the block before the pagecache truncate.
+                */
+               error = filemap_write_and_wait_range(inode->i_mapping, newsize,
+                                                    newsize);
+               if (error)
+                       return error;
                error = iomap_truncate_page(inode, newsize, &did_zeroing,
                                &xfs_buffered_write_iomap_ops);
        }
index ad10097..5b7a1e2 100644 (file)
@@ -175,6 +175,12 @@ static inline xfs_dev_t linux_to_xfs_dev_t(dev_t dev)
 #define xfs_sort(a,n,s,fn)     sort(a,n,s,fn,NULL)
 #define xfs_stack_trace()      dump_stack()
 
+static inline uint64_t rounddown_64(uint64_t x, uint32_t y)
+{
+       do_div(x, y);
+       return x * y;
+}
+
 static inline uint64_t roundup_64(uint64_t x, uint32_t y)
 {
        x += y - 1;
index a8289ad..87886b7 100644 (file)
@@ -3446,6 +3446,14 @@ xlog_recover_finish(
                int     error;
                error = xlog_recover_process_intents(log);
                if (error) {
+                       /*
+                        * Cancel all the unprocessed intent items now so that
+                        * we don't leave them pinned in the AIL.  This can
+                        * cause the AIL to livelock on the pinned item if
+                        * anyone tries to push the AIL (inode reclaim does
+                        * this) before we get around to xfs_log_mount_cancel.
+                        */
+                       xlog_recover_cancel_intents(log);
                        xfs_alert(log->l_mp, "Failed to recover intents");
                        return error;
                }
index 4d9bd6b..3c392b1 100644 (file)
@@ -42,7 +42,7 @@ do {                                                                  \
 
 #define xfs_printk_once(func, dev, fmt, ...)                   \
 ({                                                             \
-       static bool __section(.data.once) __print_once;         \
+       static bool __section(".data.once") __print_once;       \
        bool __ret_print_once = !__print_once;                  \
                                                                \
        if (!__print_once) {                                    \
index 16098dc..6fa05fb 100644 (file)
@@ -1502,7 +1502,8 @@ xfs_reflink_unshare(
                        &xfs_buffered_write_iomap_ops);
        if (error)
                goto out;
-       error = filemap_write_and_wait(inode->i_mapping);
+
+       error = filemap_write_and_wait_range(inode->i_mapping, offset, len);
        if (error)
                goto out;
 
index d1b5f2d..e3e229e 100644 (file)
@@ -794,8 +794,7 @@ xfs_fs_statfs(
        statp->f_namelen = MAXNAMELEN - 1;
 
        id = huge_encode_dev(mp->m_ddev_targp->bt_dev);
-       statp->f_fsid.val[0] = (u32)id;
-       statp->f_fsid.val[1] = (u32)(id >> 32);
+       statp->f_fsid = u64_to_fsid(id);
 
        icount = percpu_counter_sum(&mp->m_icount);
        ifree = percpu_counter_sum(&mp->m_ifree);
index 64cc2a9..ff5930b 100644 (file)
@@ -1116,8 +1116,7 @@ static int zonefs_statfs(struct dentry *dentry, struct kstatfs *buf)
 
        fsid = le64_to_cpup((void *)sbi->s_uuid.b) ^
                le64_to_cpup((void *)sbi->s_uuid.b + sizeof(u64));
-       buf->f_fsid.val[0] = (u32)fsid;
-       buf->f_fsid.val[1] = (u32)(fsid >> 32);
+       buf->f_fsid = u64_to_fsid(fsid);
 
        return 0;
 }
index 18b0f4e..76a10e0 100644 (file)
@@ -141,7 +141,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
 
 #ifndef WARN_ON_ONCE
 #define WARN_ON_ONCE(condition)        ({                              \
-       static bool __section(.data.once) __warned;             \
+       static bool __section(".data.once") __warned;           \
        int __ret_warn_once = !!(condition);                    \
                                                                \
        if (unlikely(__ret_warn_once && !__warned)) {           \
@@ -153,7 +153,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
 #endif
 
 #define WARN_ONCE(condition, format...)        ({                      \
-       static bool __section(.data.once) __warned;             \
+       static bool __section(".data.once") __warned;           \
        int __ret_warn_once = !!(condition);                    \
                                                                \
        if (unlikely(__ret_warn_once && !__warned)) {           \
@@ -164,7 +164,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
 })
 
 #define WARN_TAINT_ONCE(condition, taint, format...)   ({      \
-       static bool __section(.data.once) __warned;             \
+       static bool __section(".data.once") __warned;           \
        int __ret_warn_once = !!(condition);                    \
                                                                \
        if (unlikely(__ret_warn_once && !__warned)) {           \
index 80ca610..7ddd9dc 100644 (file)
@@ -25,7 +25,7 @@ struct pt_regs;
  */
 #define ALLOW_ERROR_INJECTION(fname, _etype)                           \
 static struct error_injection_entry __used                             \
-       __attribute__((__section__("_error_injection_whitelist")))      \
+       __section("_error_injection_whitelist")                         \
        _eil_addr_##fname = {                                           \
                .addr = (unsigned long)fname,                           \
                .etype = EI_ETYPE_##_etype,                             \
index 4a98208..060eab0 100644 (file)
  */
 # define __NOKPROBE_SYMBOL(fname)                              \
 static unsigned long __used                                    \
-       __attribute__((__section__("_kprobe_blacklist")))       \
+       __section("_kprobe_blacklist")                          \
        _kbl_addr_##fname = (unsigned long)fname;
 # define NOKPROBE_SYMBOL(fname)        __NOKPROBE_SYMBOL(fname)
 /* Use this to forbid a kprobes attach on very low level functions */
-# define __kprobes     __attribute__((__section__(".kprobes.text")))
+# define __kprobes     __section(".kprobes.text")
 # define nokprobe_inline       __always_inline
 #else
 # define NOKPROBE_SYMBOL(fname)
index ba68ee4..4973328 100644 (file)
 #include <linux/string.h>
 
 #ifdef CONFIG_UACCESS_MEMCPY
-static inline __must_check unsigned long
-raw_copy_from_user(void *to, const void __user * from, unsigned long n)
+#include <asm/unaligned.h>
+
+static __always_inline int
+__get_user_fn(size_t size, const void __user *from, void *to)
 {
-       if (__builtin_constant_p(n)) {
-               switch(n) {
-               case 1:
-                       *(u8 *)to = *(u8 __force *)from;
-                       return 0;
-               case 2:
-                       *(u16 *)to = *(u16 __force *)from;
-                       return 0;
-               case 4:
-                       *(u32 *)to = *(u32 __force *)from;
-                       return 0;
-#ifdef CONFIG_64BIT
-               case 8:
-                       *(u64 *)to = *(u64 __force *)from;
-                       return 0;
-#endif
-               }
+       BUILD_BUG_ON(!__builtin_constant_p(size));
+
+       switch (size) {
+       case 1:
+               *(u8 *)to = get_unaligned((u8 __force *)from);
+               return 0;
+       case 2:
+               *(u16 *)to = get_unaligned((u16 __force *)from);
+               return 0;
+       case 4:
+               *(u32 *)to = get_unaligned((u32 __force *)from);
+               return 0;
+       case 8:
+               *(u64 *)to = get_unaligned((u64 __force *)from);
+               return 0;
+       default:
+               BUILD_BUG();
+               return 0;
        }
 
+}
+#define __get_user_fn(sz, u, k)        __get_user_fn(sz, u, k)
+
+static __always_inline int
+__put_user_fn(size_t size, void __user *to, void *from)
+{
+       BUILD_BUG_ON(!__builtin_constant_p(size));
+
+       switch (size) {
+       case 1:
+               put_unaligned(*(u8 *)from, (u8 __force *)to);
+               return 0;
+       case 2:
+               put_unaligned(*(u16 *)from, (u16 __force *)to);
+               return 0;
+       case 4:
+               put_unaligned(*(u32 *)from, (u32 __force *)to);
+               return 0;
+       case 8:
+               put_unaligned(*(u64 *)from, (u64 __force *)to);
+               return 0;
+       default:
+               BUILD_BUG();
+               return 0;
+       }
+}
+#define __put_user_fn(sz, u, k)        __put_user_fn(sz, u, k)
+
+#define __get_kernel_nofault(dst, src, type, err_label)                        \
+do {                                                                   \
+       *((type *)dst) = get_unaligned((type *)(src));                  \
+       if (0) /* make sure the label looks used to the compiler */     \
+               goto err_label;                                         \
+} while (0)
+
+#define __put_kernel_nofault(dst, src, type, err_label)                        \
+do {                                                                   \
+       put_unaligned(*((type *)src), (type *)(dst));                   \
+       if (0) /* make sure the label looks used to the compiler */     \
+               goto err_label;                                         \
+} while (0)
+
+#define HAVE_GET_KERNEL_NOFAULT 1
+
+static inline __must_check unsigned long
+raw_copy_from_user(void *to, const void __user * from, unsigned long n)
+{
        memcpy(to, (const void __force *)from, n);
        return 0;
 }
@@ -39,27 +89,6 @@ raw_copy_from_user(void *to, const void __user * from, unsigned long n)
 static inline __must_check unsigned long
 raw_copy_to_user(void __user *to, const void *from, unsigned long n)
 {
-       if (__builtin_constant_p(n)) {
-               switch(n) {
-               case 1:
-                       *(u8 __force *)to = *(u8 *)from;
-                       return 0;
-               case 2:
-                       *(u16 __force *)to = *(u16 *)from;
-                       return 0;
-               case 4:
-                       *(u32 __force *)to = *(u32 *)from;
-                       return 0;
-#ifdef CONFIG_64BIT
-               case 8:
-                       *(u64 __force *)to = *(u64 *)from;
-                       return 0;
-#endif
-               default:
-                       break;
-               }
-       }
-
        memcpy((void __force *)to, from, n);
        return 0;
 }
@@ -67,6 +96,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
 #define INLINE_COPY_TO_USER
 #endif /* CONFIG_UACCESS_MEMCPY */
 
+#ifdef CONFIG_SET_FS
 #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
 
 #ifndef KERNEL_DS
@@ -89,6 +119,7 @@ static inline void set_fs(mm_segment_t fs)
 #ifndef uaccess_kernel
 #define uaccess_kernel() (get_fs().seg == KERNEL_DS.seg)
 #endif
+#endif /* CONFIG_SET_FS */
 
 #define access_ok(addr, size) __access_ok((unsigned long)(addr),(size))
 
index cd14444..b2b3d81 100644 (file)
 #ifdef CONFIG_CONSTRUCTORS
 #define KERNEL_CTORS() . = ALIGN(8);                      \
                        __ctors_start = .;                 \
+                       KEEP(*(SORT(.ctors.*)))            \
                        KEEP(*(.ctors))                    \
                        KEEP(*(SORT(.init_array.*)))       \
                        KEEP(*(.init_array))               \
index da53aeb..a53243a 100644 (file)
@@ -1836,7 +1836,7 @@ static inline void drm_dp_cec_unset_edid(struct drm_dp_aux *aux)
  * @link_rate: Requested Link rate from DPCD 0x219
  * @num_lanes: Number of lanes requested by sing through DPCD 0x220
  * @phy_pattern: DP Phy test pattern from DPCD 0x248
- * @hb2_reset: DP HBR2_COMPLIANCE_SCRAMBLER_RESET from DCPD 0x24A and 0x24B
+ * @hbr2_reset: DP HBR2_COMPLIANCE_SCRAMBLER_RESET from DCPD 0x24A and 0x24B
  * @custom80: DP Test_80BIT_CUSTOM_PATTERN from DPCDs 0x250 through 0x259
  * @enhanced_frame_cap: flag for enhanced frame capability.
  */
index b27a0e2..e97daf6 100644 (file)
@@ -359,13 +359,6 @@ drm_load_edid_firmware(struct drm_connector *connector)
 }
 #endif
 
-/**
- * drm_edid_are_equal - compare two edid blobs.
- * @edid1: pointer to first blob
- * @edid2: pointer to second blob
- * This helper can be used during probing to determine if
- * edid had changed.
- */
 bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2);
 
 int
index 1c94174..f32d179 100644 (file)
@@ -338,7 +338,7 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                 const char *format, ...);
 
 /**
- * Error output.
+ * DRM_DEV_ERROR() - Error output.
  *
  * @dev: device pointer
  * @fmt: printf() like format string.
@@ -347,10 +347,12 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
        drm_dev_printk(dev, KERN_ERR, "*ERROR* " fmt, ##__VA_ARGS__)
 
 /**
- * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
+ * DRM_DEV_ERROR_RATELIMITED() - Rate limited error output.
  *
  * @dev: device pointer
  * @fmt: printf() like format string.
+ *
+ * Like DRM_ERROR() but won't flood the log.
  */
 #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)                       \
 ({                                                                     \
@@ -375,15 +377,27 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
 })
 
 /**
- * Debug output.
+ * DRM_DEV_DEBUG() - Debug output for generic drm code
  *
  * @dev: device pointer
  * @fmt: printf() like format string.
  */
 #define DRM_DEV_DEBUG(dev, fmt, ...)                                   \
        drm_dev_dbg(dev, DRM_UT_CORE, fmt, ##__VA_ARGS__)
+/**
+ * DRM_DEV_DEBUG_DRIVER() - Debug output for vendor specific part of the driver
+ *
+ * @dev: device pointer
+ * @fmt: printf() like format string.
+ */
 #define DRM_DEV_DEBUG_DRIVER(dev, fmt, ...)                            \
        drm_dev_dbg(dev, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
+/**
+ * DRM_DEV_DEBUG_KMS() - Debug output for modesetting code
+ *
+ * @dev: device pointer
+ * @fmt: printf() like format string.
+ */
 #define DRM_DEV_DEBUG_KMS(dev, fmt, ...)                               \
        drm_dev_dbg(dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
 
diff --git a/include/dt-bindings/clock/tegra234-clock.h b/include/dt-bindings/clock/tegra234-clock.h
new file mode 100644 (file)
index 0000000..2c82072
--- /dev/null
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. */
+
+#ifndef DT_BINDINGS_CLOCK_TEGRA234_CLOCK_H
+#define DT_BINDINGS_CLOCK_TEGRA234_CLOCK_H
+
+/** @brief output of gate CLK_ENB_FUSE */
+#define TEGRA234_CLK_FUSE                      40
+/** @brief output of mux controlled by CLK_RST_CONTROLLER_CLK_SOURCE_SDMMC4 */
+#define TEGRA234_CLK_SDMMC4                    123
+/** @brief output of mux controlled by CLK_RST_CONTROLLER_CLK_SOURCE_UARTA */
+#define TEGRA234_CLK_UARTA                     155
+
+#endif
diff --git a/include/dt-bindings/mux/mux-j721e-wiz.h b/include/dt-bindings/mux/mux-j721e-wiz.h
deleted file mode 100644 (file)
index fd1c4ea..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This header provides constants for J721E WIZ.
- */
-
-#ifndef _DT_BINDINGS_J721E_WIZ
-#define _DT_BINDINGS_J721E_WIZ
-
-#define SERDES0_LANE0_QSGMII_LANE1     0x0
-#define SERDES0_LANE0_PCIE0_LANE0      0x1
-#define SERDES0_LANE0_USB3_0_SWAP      0x2
-
-#define SERDES0_LANE1_QSGMII_LANE2     0x0
-#define SERDES0_LANE1_PCIE0_LANE1      0x1
-#define SERDES0_LANE1_USB3_0           0x2
-
-#define SERDES1_LANE0_QSGMII_LANE3     0x0
-#define SERDES1_LANE0_PCIE1_LANE0      0x1
-#define SERDES1_LANE0_USB3_1_SWAP      0x2
-#define SERDES1_LANE0_SGMII_LANE0      0x3
-
-#define SERDES1_LANE1_QSGMII_LANE4     0x0
-#define SERDES1_LANE1_PCIE1_LANE1      0x1
-#define SERDES1_LANE1_USB3_1           0x2
-#define SERDES1_LANE1_SGMII_LANE1      0x3
-
-#define SERDES2_LANE0_PCIE2_LANE0      0x1
-#define SERDES2_LANE0_SGMII_LANE0      0x3
-#define SERDES2_LANE0_USB3_1_SWAP      0x2
-
-#define SERDES2_LANE1_PCIE2_LANE1      0x1
-#define SERDES2_LANE1_USB3_1           0x2
-#define SERDES2_LANE1_SGMII_LANE1      0x3
-
-#define SERDES3_LANE0_PCIE3_LANE0      0x1
-#define SERDES3_LANE0_USB3_0_SWAP      0x2
-
-#define SERDES3_LANE1_PCIE3_LANE1      0x1
-#define SERDES3_LANE1_USB3_0           0x2
-
-#define SERDES4_LANE0_EDP_LANE0                0x0
-#define SERDES4_LANE0_QSGMII_LANE5     0x2
-
-#define SERDES4_LANE1_EDP_LANE1                0x0
-#define SERDES4_LANE1_QSGMII_LANE6     0x2
-
-#define SERDES4_LANE2_EDP_LANE2                0x0
-#define SERDES4_LANE2_QSGMII_LANE7     0x2
-
-#define SERDES4_LANE3_EDP_LANE3                0x0
-#define SERDES4_LANE3_QSGMII_LANE8     0x2
-
-#endif /* _DT_BINDINGS_J721E_WIZ */
diff --git a/include/dt-bindings/mux/ti-serdes.h b/include/dt-bindings/mux/ti-serdes.h
new file mode 100644 (file)
index 0000000..9047ec6
--- /dev/null
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * This header provides constants for SERDES MUX for TI SoCs
+ */
+
+#ifndef _DT_BINDINGS_MUX_TI_SERDES
+#define _DT_BINDINGS_MUX_TI_SERDES
+
+/* J721E */
+
+#define J721E_SERDES0_LANE0_QSGMII_LANE1       0x0
+#define J721E_SERDES0_LANE0_PCIE0_LANE0                0x1
+#define J721E_SERDES0_LANE0_USB3_0_SWAP                0x2
+#define J721E_SERDES0_LANE0_IP4_UNUSED         0x3
+
+#define J721E_SERDES0_LANE1_QSGMII_LANE2       0x0
+#define J721E_SERDES0_LANE1_PCIE0_LANE1                0x1
+#define J721E_SERDES0_LANE1_USB3_0             0x2
+#define J721E_SERDES0_LANE1_IP4_UNUSED         0x3
+
+#define J721E_SERDES1_LANE0_QSGMII_LANE3       0x0
+#define J721E_SERDES1_LANE0_PCIE1_LANE0                0x1
+#define J721E_SERDES1_LANE0_USB3_1_SWAP                0x2
+#define J721E_SERDES1_LANE0_SGMII_LANE0                0x3
+
+#define J721E_SERDES1_LANE1_QSGMII_LANE4       0x0
+#define J721E_SERDES1_LANE1_PCIE1_LANE1                0x1
+#define J721E_SERDES1_LANE1_USB3_1             0x2
+#define J721E_SERDES1_LANE1_SGMII_LANE1                0x3
+
+#define J721E_SERDES2_LANE0_IP1_UNUSED         0x0
+#define J721E_SERDES2_LANE0_PCIE2_LANE0                0x1
+#define J721E_SERDES2_LANE0_USB3_1_SWAP                0x2
+#define J721E_SERDES2_LANE0_SGMII_LANE0                0x3
+
+#define J721E_SERDES2_LANE1_IP1_UNUSED         0x0
+#define J721E_SERDES2_LANE1_PCIE2_LANE1                0x1
+#define J721E_SERDES2_LANE1_USB3_1             0x2
+#define J721E_SERDES2_LANE1_SGMII_LANE1                0x3
+
+#define J721E_SERDES3_LANE0_IP1_UNUSED         0x0
+#define J721E_SERDES3_LANE0_PCIE3_LANE0                0x1
+#define J721E_SERDES3_LANE0_USB3_0_SWAP                0x2
+#define J721E_SERDES3_LANE0_IP4_UNUSED         0x3
+
+#define J721E_SERDES3_LANE1_IP1_UNUSED         0x0
+#define J721E_SERDES3_LANE1_PCIE3_LANE1                0x1
+#define J721E_SERDES3_LANE1_USB3_0             0x2
+#define J721E_SERDES3_LANE1_IP4_UNUSED         0x3
+
+#define J721E_SERDES4_LANE0_EDP_LANE0          0x0
+#define J721E_SERDES4_LANE0_IP2_UNUSED         0x1
+#define J721E_SERDES4_LANE0_QSGMII_LANE5       0x2
+#define J721E_SERDES4_LANE0_IP4_UNUSED         0x3
+
+#define J721E_SERDES4_LANE1_EDP_LANE1          0x0
+#define J721E_SERDES4_LANE1_IP2_UNUSED         0x1
+#define J721E_SERDES4_LANE1_QSGMII_LANE6       0x2
+#define J721E_SERDES4_LANE1_IP4_UNUSED         0x3
+
+#define J721E_SERDES4_LANE2_EDP_LANE2          0x0
+#define J721E_SERDES4_LANE2_IP2_UNUSED         0x1
+#define J721E_SERDES4_LANE2_QSGMII_LANE7       0x2
+#define J721E_SERDES4_LANE2_IP4_UNUSED         0x3
+
+#define J721E_SERDES4_LANE3_EDP_LANE3          0x0
+#define J721E_SERDES4_LANE3_IP2_UNUSED         0x1
+#define J721E_SERDES4_LANE3_QSGMII_LANE8       0x2
+#define J721E_SERDES4_LANE3_IP4_UNUSED         0x3
+
+/* J7200 */
+
+#define J7200_SERDES0_LANE0_QSGMII_LANE3       0x0
+#define J7200_SERDES0_LANE0_PCIE1_LANE0                0x1
+#define J7200_SERDES0_LANE0_IP3_UNUSED         0x2
+#define J7200_SERDES0_LANE0_IP4_UNUSED         0x3
+
+#define J7200_SERDES0_LANE1_QSGMII_LANE4       0x0
+#define J7200_SERDES0_LANE1_PCIE1_LANE1                0x1
+#define J7200_SERDES0_LANE1_IP3_UNUSED         0x2
+#define J7200_SERDES0_LANE1_IP4_UNUSED         0x3
+
+#define J7200_SERDES0_LANE2_QSGMII_LANE1       0x0
+#define J7200_SERDES0_LANE2_PCIE1_LANE2                0x1
+#define J7200_SERDES0_LANE2_IP3_UNUSED         0x2
+#define J7200_SERDES0_LANE2_IP4_UNUSED         0x3
+
+#define J7200_SERDES0_LANE3_QSGMII_LANE2       0x0
+#define J7200_SERDES0_LANE3_PCIE1_LANE3                0x1
+#define J7200_SERDES0_LANE3_USB                        0x2
+#define J7200_SERDES0_LANE3_IP4_UNUSED         0x3
+
+#endif /* _DT_BINDINGS_MUX_TI_SERDES */
index 2d2a8c7..f48245f 100644 (file)
@@ -64,7 +64,7 @@
 #define OMAP3_WKUP_IOPAD(pa, val)      OMAP_IOPAD_OFFSET((pa), 0x2a00) (val)
 #define DM814X_IOPAD(pa, val)          OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
 #define DM816X_IOPAD(pa, val)          OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
-#define AM33XX_IOPAD(pa, val)          OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
+#define AM33XX_IOPAD(pa, val)          OMAP_IOPAD_OFFSET((pa), 0x0800) (val) (0)
 #define AM33XX_PADCONF(pa, conf, mux)  OMAP_IOPAD_OFFSET((pa), 0x0800) (conf) (mux)
 
 /*
diff --git a/include/dt-bindings/power/meson-axg-power.h b/include/dt-bindings/power/meson-axg-power.h
new file mode 100644 (file)
index 0000000..e524388
--- /dev/null
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */
+/*
+ * Copyright (c) 2020 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#ifndef _DT_BINDINGS_MESON_AXG_POWER_H
+#define _DT_BINDINGS_MESON_AXG_POWER_H
+
+#define PWRC_AXG_VPU_ID                        0
+#define PWRC_AXG_ETHERNET_MEM_ID       1
+#define PWRC_AXG_AUDIO_ID              2
+
+#endif
index a5b5707..7058706 100644 (file)
 #define IMX8MQ_RESET_DDRC2_PRST                        47      /* i.MX8MM/i.MX8MN does NOT support */
 #define IMX8MQ_RESET_DDRC2_CORE_RESET          48      /* i.MX8MM/i.MX8MN does NOT support */
 #define IMX8MQ_RESET_DDRC2_PHY_RESET           49      /* i.MX8MM/i.MX8MN does NOT support */
+#define IMX8MQ_RESET_SW_M4C_RST                        50
+#define IMX8MQ_RESET_SW_M4P_RST                        51
+#define IMX8MQ_RESET_M4_ENABLE                 52
 
-#define IMX8MQ_RESET_NUM                       50
+#define IMX8MQ_RESET_NUM                       53
 
 #endif
diff --git a/include/dt-bindings/reset/tegra234-reset.h b/include/dt-bindings/reset/tegra234-reset.h
new file mode 100644 (file)
index 0000000..b3c63be
--- /dev/null
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. */
+
+#ifndef DT_BINDINGS_RESET_TEGRA234_RESET_H
+#define DT_BINDINGS_RESET_TEGRA234_RESET_H
+
+#define TEGRA234_RESET_SDMMC4                  85
+#define TEGRA234_RESET_UARTA                   100
+
+#endif
diff --git a/include/dt-bindings/reset/xlnx-versal-resets.h b/include/dt-bindings/reset/xlnx-versal-resets.h
new file mode 100644 (file)
index 0000000..895424e
--- /dev/null
@@ -0,0 +1,105 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *  Copyright (C) 2020 Xilinx, Inc.
+ */
+
+#ifndef _DT_BINDINGS_VERSAL_RESETS_H
+#define _DT_BINDINGS_VERSAL_RESETS_H
+
+#define VERSAL_RST_PMC_POR                     (0xc30c001U)
+#define VERSAL_RST_PMC                         (0xc410002U)
+#define VERSAL_RST_PS_POR                      (0xc30c003U)
+#define VERSAL_RST_PL_POR                      (0xc30c004U)
+#define VERSAL_RST_NOC_POR                     (0xc30c005U)
+#define VERSAL_RST_FPD_POR                     (0xc30c006U)
+#define VERSAL_RST_ACPU_0_POR                  (0xc30c007U)
+#define VERSAL_RST_ACPU_1_POR                  (0xc30c008U)
+#define VERSAL_RST_OCM2_POR                    (0xc30c009U)
+#define VERSAL_RST_PS_SRST                     (0xc41000aU)
+#define VERSAL_RST_PL_SRST                     (0xc41000bU)
+#define VERSAL_RST_NOC                         (0xc41000cU)
+#define VERSAL_RST_NPI                         (0xc41000dU)
+#define VERSAL_RST_SYS_RST_1                   (0xc41000eU)
+#define VERSAL_RST_SYS_RST_2                   (0xc41000fU)
+#define VERSAL_RST_SYS_RST_3                   (0xc410010U)
+#define VERSAL_RST_FPD                         (0xc410011U)
+#define VERSAL_RST_PL0                         (0xc410012U)
+#define VERSAL_RST_PL1                         (0xc410013U)
+#define VERSAL_RST_PL2                         (0xc410014U)
+#define VERSAL_RST_PL3                         (0xc410015U)
+#define VERSAL_RST_APU                         (0xc410016U)
+#define VERSAL_RST_ACPU_0                      (0xc410017U)
+#define VERSAL_RST_ACPU_1                      (0xc410018U)
+#define VERSAL_RST_ACPU_L2                     (0xc410019U)
+#define VERSAL_RST_ACPU_GIC                    (0xc41001aU)
+#define VERSAL_RST_RPU_ISLAND                  (0xc41001bU)
+#define VERSAL_RST_RPU_AMBA                    (0xc41001cU)
+#define VERSAL_RST_R5_0                                (0xc41001dU)
+#define VERSAL_RST_R5_1                                (0xc41001eU)
+#define VERSAL_RST_SYSMON_PMC_SEQ_RST          (0xc41001fU)
+#define VERSAL_RST_SYSMON_PMC_CFG_RST          (0xc410020U)
+#define VERSAL_RST_SYSMON_FPD_CFG_RST          (0xc410021U)
+#define VERSAL_RST_SYSMON_FPD_SEQ_RST          (0xc410022U)
+#define VERSAL_RST_SYSMON_LPD                  (0xc410023U)
+#define VERSAL_RST_PDMA_RST1                   (0xc410024U)
+#define VERSAL_RST_PDMA_RST0                   (0xc410025U)
+#define VERSAL_RST_ADMA                                (0xc410026U)
+#define VERSAL_RST_TIMESTAMP                   (0xc410027U)
+#define VERSAL_RST_OCM                         (0xc410028U)
+#define VERSAL_RST_OCM2_RST                    (0xc410029U)
+#define VERSAL_RST_IPI                         (0xc41002aU)
+#define VERSAL_RST_SBI                         (0xc41002bU)
+#define VERSAL_RST_LPD                         (0xc41002cU)
+#define VERSAL_RST_QSPI                                (0xc10402dU)
+#define VERSAL_RST_OSPI                                (0xc10402eU)
+#define VERSAL_RST_SDIO_0                      (0xc10402fU)
+#define VERSAL_RST_SDIO_1                      (0xc104030U)
+#define VERSAL_RST_I2C_PMC                     (0xc104031U)
+#define VERSAL_RST_GPIO_PMC                    (0xc104032U)
+#define VERSAL_RST_GEM_0                       (0xc104033U)
+#define VERSAL_RST_GEM_1                       (0xc104034U)
+#define VERSAL_RST_SPARE                       (0xc104035U)
+#define VERSAL_RST_USB_0                       (0xc104036U)
+#define VERSAL_RST_UART_0                      (0xc104037U)
+#define VERSAL_RST_UART_1                      (0xc104038U)
+#define VERSAL_RST_SPI_0                       (0xc104039U)
+#define VERSAL_RST_SPI_1                       (0xc10403aU)
+#define VERSAL_RST_CAN_FD_0                    (0xc10403bU)
+#define VERSAL_RST_CAN_FD_1                    (0xc10403cU)
+#define VERSAL_RST_I2C_0                       (0xc10403dU)
+#define VERSAL_RST_I2C_1                       (0xc10403eU)
+#define VERSAL_RST_GPIO_LPD                    (0xc10403fU)
+#define VERSAL_RST_TTC_0                       (0xc104040U)
+#define VERSAL_RST_TTC_1                       (0xc104041U)
+#define VERSAL_RST_TTC_2                       (0xc104042U)
+#define VERSAL_RST_TTC_3                       (0xc104043U)
+#define VERSAL_RST_SWDT_FPD                    (0xc104044U)
+#define VERSAL_RST_SWDT_LPD                    (0xc104045U)
+#define VERSAL_RST_USB                         (0xc104046U)
+#define VERSAL_RST_DPC                         (0xc208047U)
+#define VERSAL_RST_PMCDBG                      (0xc208048U)
+#define VERSAL_RST_DBG_TRACE                   (0xc208049U)
+#define VERSAL_RST_DBG_FPD                     (0xc20804aU)
+#define VERSAL_RST_DBG_TSTMP                   (0xc20804bU)
+#define VERSAL_RST_RPU0_DBG                    (0xc20804cU)
+#define VERSAL_RST_RPU1_DBG                    (0xc20804dU)
+#define VERSAL_RST_HSDP                                (0xc20804eU)
+#define VERSAL_RST_DBG_LPD                     (0xc20804fU)
+#define VERSAL_RST_CPM_POR                     (0xc30c050U)
+#define VERSAL_RST_CPM                         (0xc410051U)
+#define VERSAL_RST_CPMDBG                      (0xc208052U)
+#define VERSAL_RST_PCIE_CFG                    (0xc410053U)
+#define VERSAL_RST_PCIE_CORE0                  (0xc410054U)
+#define VERSAL_RST_PCIE_CORE1                  (0xc410055U)
+#define VERSAL_RST_PCIE_DMA                    (0xc410056U)
+#define VERSAL_RST_CMN                         (0xc410057U)
+#define VERSAL_RST_L2_0                                (0xc410058U)
+#define VERSAL_RST_L2_1                                (0xc410059U)
+#define VERSAL_RST_ADDR_REMAP                  (0xc41005aU)
+#define VERSAL_RST_CPI0                                (0xc41005bU)
+#define VERSAL_RST_CPI1                                (0xc41005cU)
+#define VERSAL_RST_XRAM                                (0xc30c05dU)
+#define VERSAL_RST_AIE_ARRAY                   (0xc10405eU)
+#define VERSAL_RST_AIE_SHIM                    (0xc10405fU)
+
+#endif
diff --git a/include/dt-bindings/soc/bcm6318-pm.h b/include/dt-bindings/soc/bcm6318-pm.h
new file mode 100644 (file)
index 0000000..05931dc
--- /dev/null
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef __DT_BINDINGS_BMIPS_BCM6318_PM_H
+#define __DT_BINDINGS_BMIPS_BCM6318_PM_H
+
+#define BCM6318_POWER_DOMAIN_PCIE      0
+#define BCM6318_POWER_DOMAIN_USB       1
+#define BCM6318_POWER_DOMAIN_EPHY0     2
+#define BCM6318_POWER_DOMAIN_EPHY1     3
+#define BCM6318_POWER_DOMAIN_EPHY2     4
+#define BCM6318_POWER_DOMAIN_EPHY3     5
+#define BCM6318_POWER_DOMAIN_LDO2P5    6
+#define BCM6318_POWER_DOMAIN_LDO2P9    7
+#define BCM6318_POWER_DOMAIN_SW1P0     8
+#define BCM6318_POWER_DOMAIN_PAD       9
+
+#endif /* __DT_BINDINGS_BMIPS_BCM6318_PM_H */
diff --git a/include/dt-bindings/soc/bcm63268-pm.h b/include/dt-bindings/soc/bcm63268-pm.h
new file mode 100644 (file)
index 0000000..84ded53
--- /dev/null
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef __DT_BINDINGS_BMIPS_BCM63268_PM_H
+#define __DT_BINDINGS_BMIPS_BCM63268_PM_H
+
+#define BCM63268_POWER_DOMAIN_SAR      0
+#define BCM63268_POWER_DOMAIN_IPSEC    1
+#define BCM63268_POWER_DOMAIN_MIPS     2
+#define BCM63268_POWER_DOMAIN_DECT     3
+#define BCM63268_POWER_DOMAIN_USBH     4
+#define BCM63268_POWER_DOMAIN_USBD     5
+#define BCM63268_POWER_DOMAIN_ROBOSW   6
+#define BCM63268_POWER_DOMAIN_PCM      7
+#define BCM63268_POWER_DOMAIN_PERIPH   8
+#define BCM63268_POWER_DOMAIN_VDSL_PHY 9
+#define BCM63268_POWER_DOMAIN_VDSL_MIPS        10
+#define BCM63268_POWER_DOMAIN_FAP      11
+#define BCM63268_POWER_DOMAIN_PCIE     12
+#define BCM63268_POWER_DOMAIN_WLAN_PADS        13
+
+#endif /* __DT_BINDINGS_BMIPS_BCM63268_PM_H */
diff --git a/include/dt-bindings/soc/bcm6328-pm.h b/include/dt-bindings/soc/bcm6328-pm.h
new file mode 100644 (file)
index 0000000..557e1a6
--- /dev/null
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef __DT_BINDINGS_BMIPS_BCM6328_PM_H
+#define __DT_BINDINGS_BMIPS_BCM6328_PM_H
+
+#define BCM6328_POWER_DOMAIN_ADSL2_MIPS        0
+#define BCM6328_POWER_DOMAIN_ADSL2_PHY 1
+#define BCM6328_POWER_DOMAIN_ADSL2_AFE 2
+#define BCM6328_POWER_DOMAIN_SAR       3
+#define BCM6328_POWER_DOMAIN_PCM       4
+#define BCM6328_POWER_DOMAIN_USBD      5
+#define BCM6328_POWER_DOMAIN_USBH      6
+#define BCM6328_POWER_DOMAIN_PCIE      7
+#define BCM6328_POWER_DOMAIN_ROBOSW    8
+#define BCM6328_POWER_DOMAIN_EPHY      9
+
+#endif /* __DT_BINDINGS_BMIPS_BCM6328_PM_H */
diff --git a/include/dt-bindings/soc/bcm6362-pm.h b/include/dt-bindings/soc/bcm6362-pm.h
new file mode 100644 (file)
index 0000000..d087ba6
--- /dev/null
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef __DT_BINDINGS_BMIPS_BCM6362_PM_H
+#define __DT_BINDINGS_BMIPS_BCM6362_PM_H
+
+#define BCM6362_POWER_DOMAIN_SAR       0
+#define BCM6362_POWER_DOMAIN_IPSEC     1
+#define BCM6362_POWER_DOMAIN_MIPS      2
+#define BCM6362_POWER_DOMAIN_DECT      3
+#define BCM6362_POWER_DOMAIN_USBH      4
+#define BCM6362_POWER_DOMAIN_USBD      5
+#define BCM6362_POWER_DOMAIN_ROBOSW    6
+#define BCM6362_POWER_DOMAIN_PCM       7
+#define BCM6362_POWER_DOMAIN_PERIPH    8
+#define BCM6362_POWER_DOMAIN_ADSL_PHY  9
+#define BCM6362_POWER_DOMAIN_GMII_PADS 10
+#define BCM6362_POWER_DOMAIN_FAP       11
+#define BCM6362_POWER_DOMAIN_PCIE      12
+#define BCM6362_POWER_DOMAIN_WLAN_PADS 13
+
+#endif /* __DT_BINDINGS_BMIPS_BCM6362_PM_H */
index a423fff..db1b0ae 100644 (file)
@@ -252,13 +252,14 @@ static inline int kunit_run_all_tests(void)
 }
 #endif /* IS_BUILTIN(CONFIG_KUNIT) */
 
+#ifdef MODULE
 /**
- * kunit_test_suites() - used to register one or more &struct kunit_suite
- *                      with KUnit.
+ * kunit_test_suites_for_module() - used to register one or more
+ *                      &struct kunit_suite with KUnit.
  *
- * @suites_list...: a statically allocated list of &struct kunit_suite.
+ * @__suites: a statically allocated list of &struct kunit_suite.
  *
- * Registers @suites_list with the test framework. See &struct kunit_suite for
+ * Registers @__suites with the test framework. See &struct kunit_suite for
  * more information.
  *
  * If a test suite is built-in, module_init() gets translated into
@@ -267,7 +268,6 @@ static inline int kunit_run_all_tests(void)
  * module_{init|exit} functions for the builtin case when registering
  * suites via kunit_test_suites() below.
  */
-#ifdef MODULE
 #define kunit_test_suites_for_module(__suites)                         \
        static int __init kunit_test_suites_init(void)                  \
        {                                                               \
@@ -288,13 +288,13 @@ static inline int kunit_run_all_tests(void)
        static struct kunit_suite *unique_array[] = { __VA_ARGS__, NULL };     \
        kunit_test_suites_for_module(unique_array);                            \
        static struct kunit_suite **unique_suites                              \
-       __used __section(.kunit_test_suites) = unique_array
+       __used __section(".kunit_test_suites") = unique_array
 
 /**
  * kunit_test_suites() - used to register one or more &struct kunit_suite
  *                      with KUnit.
  *
- * @suites: a statically allocated list of &struct kunit_suite.
+ * @__suites: a statically allocated list of &struct kunit_suite.
  *
  * Registers @suites with the test framework. See &struct kunit_suite for
  * more information.
@@ -308,10 +308,10 @@ static inline int kunit_run_all_tests(void)
  * module.
  *
  */
-#define kunit_test_suites(...)                                         \
+#define kunit_test_suites(__suites...)                                         \
        __kunit_test_suites(__UNIQUE_ID(array),                         \
                            __UNIQUE_ID(suites),                        \
-                           __VA_ARGS__)
+                           ##__suites)
 
 #define kunit_test_suite(suite)        kunit_test_suites(&suite)
 
index 143c6ff..39263c6 100644 (file)
@@ -1153,7 +1153,7 @@ struct acpi_probe_entry {
 #define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable,      \
                                 valid, data, fn)                       \
        static const struct acpi_probe_entry __acpi_probe_##name        \
-               __used __section(__##table##_acpi_probe_table) = {      \
+               __used __section("__" #table "_acpi_probe_table") = {   \
                        .id = table_id,                                 \
                        .type = subtable,                               \
                        .subtable_valid = valid,                        \
@@ -1164,7 +1164,7 @@ struct acpi_probe_entry {
 #define ACPI_DECLARE_SUBTABLE_PROBE_ENTRY(table, name, table_id,       \
                                          subtable, valid, data, fn)    \
        static const struct acpi_probe_entry __acpi_probe_##name        \
-               __used __section(__##table##_acpi_probe_table) = {      \
+               __used __section("__" #table "_acpi_probe_table") = {   \
                        .id = table_id,                                 \
                        .type = subtable,                               \
                        .subtable_valid = valid,                        \
index 885c9ff..f860645 100644 (file)
@@ -87,6 +87,8 @@
                           ARM_SMCCC_SMC_32,                            \
                           0, 0x7fff)
 
+#define SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED   1
+
 /* Paravirtualised time calls (defined by ARM DEN0057A) */
 #define ARM_SMCCC_HV_PV_TIME_FEATURES                          \
        ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                 \
index b23eeca..794b2a3 100644 (file)
@@ -235,6 +235,8 @@ enum hctx_type {
  * @flags:        Zero or more BLK_MQ_F_* flags.
  * @driver_data:   Pointer to data owned by the block driver that created this
  *                tag set.
+ * @active_queues_shared_sbitmap:
+ *                number of active request queues per tag set.
  * @__bitmap_tags: A shared tags sbitmap, used over all hctx's
  * @__breserved_tags:
  *                A shared reserved tags sbitmap, used over all hctx's
index 7d7c132..d9b69bb 100644 (file)
@@ -104,6 +104,24 @@ typedef u8 __bitwise blk_status_t;
  */
 #define BLK_STS_ZONE_RESOURCE  ((__force blk_status_t)14)
 
+/*
+ * BLK_STS_ZONE_OPEN_RESOURCE is returned from the driver in the completion
+ * path if the device returns a status indicating that too many zone resources
+ * are currently open. The same command should be successful if resubmitted
+ * after the number of open zones decreases below the device's limits, which is
+ * reported in the request_queue's max_open_zones.
+ */
+#define BLK_STS_ZONE_OPEN_RESOURCE     ((__force blk_status_t)15)
+
+/*
+ * BLK_STS_ZONE_ACTIVE_RESOURCE is returned from the driver in the completion
+ * path if the device returns a status indicating that too many zone resources
+ * are currently active. The same command should be successful if resubmitted
+ * after the number of active zones decreases below the device's limits, which
+ * is reported in the request_queue's max_active_zones.
+ */
+#define BLK_STS_ZONE_ACTIVE_RESOURCE   ((__force blk_status_t)16)
+
 /**
  * blk_path_error - returns true if error may be path related
  * @error: status the request was completed with
index 1aa8009..d742c57 100644 (file)
@@ -34,7 +34,7 @@
  * but may get written to during init, so can't live in .rodata (via "const").
  */
 #ifndef __ro_after_init
-#define __ro_after_init __attribute__((__section__(".data..ro_after_init")))
+#define __ro_after_init __section(".data..ro_after_init")
 #endif
 
 #ifndef ____cacheline_aligned
index 900b9f4..fc61cf4 100644 (file)
@@ -61,21 +61,17 @@ static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk)
  */
 static inline struct sk_buff *can_create_echo_skb(struct sk_buff *skb)
 {
-       if (skb_shared(skb)) {
-               struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
+       struct sk_buff *nskb;
 
-               if (likely(nskb)) {
-                       can_skb_set_owner(nskb, skb->sk);
-                       consume_skb(skb);
-                       return nskb;
-               } else {
-                       kfree_skb(skb);
-                       return NULL;
-               }
+       nskb = skb_clone(skb, GFP_ATOMIC);
+       if (unlikely(!nskb)) {
+               kfree_skb(skb);
+               return NULL;
        }
 
-       /* we can assume to have an unshared skb with proper owner */
-       return skb;
+       can_skb_set_owner(nskb, skb->sk);
+       consume_skb(skb);
+       return nskb;
 }
 
 #endif /* !_CAN_SKB_H */
diff --git a/include/linux/clk/samsung.h b/include/linux/clk/samsung.h
new file mode 100644 (file)
index 0000000..79097e3
--- /dev/null
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2020 Krzysztof Kozlowski <krzk@kernel.org>
+ */
+
+#ifndef __LINUX_CLK_SAMSUNG_H_
+#define __LINUX_CLK_SAMSUNG_H_
+
+#include <linux/compiler_types.h>
+
+struct device_node;
+
+#ifdef CONFIG_ARCH_S3C64XX
+void s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
+                     unsigned long xusbxti_f, bool s3c6400,
+                     void __iomem *base);
+#else
+static inline void s3c64xx_clk_init(struct device_node *np,
+                                   unsigned long xtal_f,
+                                   unsigned long xusbxti_f,
+                                   bool s3c6400, void __iomem *base) { }
+#endif /* CONFIG_ARCH_S3C64XX */
+
+#ifdef CONFIG_S3C2410_COMMON_CLK
+void s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
+                            int current_soc,
+                            void __iomem *reg_base);
+#else
+static inline void s3c2410_common_clk_init(struct device_node *np,
+                                          unsigned long xti_f,
+                                          int current_soc,
+                                          void __iomem *reg_base) { }
+#endif /* CONFIG_S3C2410_COMMON_CLK */
+
+#ifdef CONFIG_S3C2412_COMMON_CLK
+void s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
+                            unsigned long ext_f, void __iomem *reg_base);
+#else
+static inline void s3c2412_common_clk_init(struct device_node *np,
+                                          unsigned long xti_f,
+                                          unsigned long ext_f,
+                                          void __iomem *reg_base) { }
+#endif /* CONFIG_S3C2412_COMMON_CLK */
+
+#ifdef CONFIG_S3C2443_COMMON_CLK
+void s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
+                            int current_soc,
+                            void __iomem *reg_base);
+#else
+static inline void s3c2443_common_clk_init(struct device_node *np,
+                                          unsigned long xti_f,
+                                          int current_soc,
+                                          void __iomem *reg_base) { }
+#endif /* CONFIG_S3C2443_COMMON_CLK */
+
+#endif /* __LINUX_CLK_SAMSUNG_H_ */
index d1e3c68..5deb370 100644 (file)
 #else
 #define __diag_GCC_8(s)
 #endif
-
-#define __no_fgcse __attribute__((optimize("-fno-gcse")))
index ac45f6d..e512f55 100644 (file)
@@ -24,7 +24,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
                        long ______r;                                   \
                        static struct ftrace_likely_data                \
                                __aligned(4)                            \
-                               __section(_ftrace_annotated_branch)     \
+                               __section("_ftrace_annotated_branch")   \
                                ______f = {                             \
                                .data.func = __func__,                  \
                                .data.file = __FILE__,                  \
@@ -60,7 +60,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 #define __trace_if_value(cond) ({                      \
        static struct ftrace_branch_data                \
                __aligned(4)                            \
-               __section(_ftrace_branch)               \
+               __section("_ftrace_branch")             \
                __if_trace = {                          \
                        .func = __func__,               \
                        .file = __FILE__,               \
@@ -118,7 +118,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
        ".popsection\n\t"
 
 /* Annotate a C jump table to allow objtool to follow the code flow */
-#define __annotate_jump_table __section(.rodata..c_jump_table)
+#define __annotate_jump_table __section(".rodata..c_jump_table")
 
 #else
 #define annotate_reachable()
@@ -206,7 +206,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
  * visible to the compiler.
  */
 #define __ADDRESSABLE(sym) \
-       static void * __section(.discard.addressable) __used \
+       static void * __section(".discard.addressable") __used \
                __UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)&sym;
 
 /**
index ea7b756..b2a3f4f 100644 (file)
  *   gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-section-variable-attribute
  * clang: https://clang.llvm.org/docs/AttributeReference.html#section-declspec-allocate
  */
-#define __section(S)                    __attribute__((__section__(#S)))
+#define __section(section)              __attribute__((__section__(section)))
 
 /*
  *   gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute
index 6e390d5..ac3fa37 100644 (file)
@@ -247,10 +247,6 @@ struct ftrace_likely_data {
 #define asm_inline asm
 #endif
 
-#ifndef __no_fgcse
-# define __no_fgcse
-#endif
-
 /* Are two types/vars the same type (ignoring qualifiers)? */
 #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
 
index 8aa84c0..d6428aa 100644 (file)
@@ -173,7 +173,7 @@ void cpu_startup_entry(enum cpuhp_state state);
 void cpu_idle_poll_ctrl(bool enable);
 
 /* Attach to any functions which should be considered cpuidle. */
-#define __cpuidle      __attribute__((__section__(".cpuidle.text")))
+#define __cpuidle      __section(".cpuidle.text")
 
 bool cpu_in_idle(unsigned long pc);
 
index fa37b1c..acbad3b 100644 (file)
@@ -110,6 +110,12 @@ struct cpufreq_policy {
        bool                    fast_switch_enabled;
 
        /*
+        * Set if the CPUFREQ_GOV_STRICT_TARGET flag is set for the current
+        * governor.
+        */
+       bool                    strict_target;
+
+       /*
         * Preferred average time interval between consecutive invocations of
         * the driver to set the frequency for this policy.  To be set by the
         * scaling driver (0, which is the default, means no preference).
@@ -298,7 +304,7 @@ __ATTR(_name, 0644, show_##_name, store_##_name)
 
 struct cpufreq_driver {
        char            name[CPUFREQ_NAME_LEN];
-       u             flags;
+       u16             flags;
        void            *driver_data;
 
        /* needed by all drivers */
@@ -422,9 +428,18 @@ struct cpufreq_driver {
  */
 #define CPUFREQ_IS_COOLING_DEV                 BIT(7)
 
+/*
+ * Set by drivers that need to update internale upper and lower boundaries along
+ * with the target frequency and so the core and governors should also invoke
+ * the diver if the target frequency does not change, but the policy min or max
+ * may have changed.
+ */
+#define CPUFREQ_NEED_UPDATE_LIMITS             BIT(8)
+
 int cpufreq_register_driver(struct cpufreq_driver *driver_data);
 int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
 
+bool cpufreq_driver_test_flags(u16 flags);
 const char *cpufreq_get_current_driver(void);
 void *cpufreq_get_driver_data(void);
 
@@ -561,12 +576,20 @@ struct cpufreq_governor {
                                         char *buf);
        int     (*store_setspeed)       (struct cpufreq_policy *policy,
                                         unsigned int freq);
-       /* For governors which change frequency dynamically by themselves */
-       bool                    dynamic_switching;
        struct list_head        governor_list;
        struct module           *owner;
+       u8                      flags;
 };
 
+/* Governor flags */
+
+/* For governors which change frequency dynamically by themselves */
+#define CPUFREQ_GOV_DYNAMIC_SWITCHING  BIT(0)
+
+/* For governors wanting the target frequency to be set exactly */
+#define CPUFREQ_GOV_STRICT_TARGET      BIT(1)
+
+
 /* Pass a target to the cpufreq driver */
 unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
                                        unsigned int target_freq);
index ed0da0e..bd605b5 100644 (file)
@@ -271,13 +271,8 @@ struct cpuidle_governor {
        void (*reflect)         (struct cpuidle_device *dev, int index);
 };
 
-#ifdef CONFIG_CPU_IDLE
 extern int cpuidle_register_governor(struct cpuidle_governor *gov);
 extern s64 cpuidle_governor_latency_req(unsigned int cpu);
-#else
-static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
-{return 0;}
-#endif
 
 #define __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter,                  \
                                idx,                                    \
index 851dd1f..d6c4cc9 100644 (file)
@@ -144,10 +144,9 @@ void debugfs_create_u32_array(const char *name, umode_t mode,
                              struct dentry *parent,
                              struct debugfs_u32_array *array);
 
-struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
-                                          struct dentry *parent,
-                                          int (*read_fn)(struct seq_file *s,
-                                                         void *data));
+void debugfs_create_devm_seqfile(struct device *dev, const char *name,
+                                struct dentry *parent,
+                                int (*read_fn)(struct seq_file *s, void *data));
 
 bool debugfs_initialized(void);
 
@@ -327,13 +326,12 @@ static inline void debugfs_create_u32_array(const char *name, umode_t mode,
 {
 }
 
-static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev,
-                                                        const char *name,
-                                                        struct dentry *parent,
-                                          int (*read_fn)(struct seq_file *s,
-                                                         void *data))
+static inline void debugfs_create_devm_seqfile(struct device *dev,
+                                              const char *name,
+                                              struct dentry *parent,
+                                              int (*read_fn)(struct seq_file *s,
+                                                             void *data))
 {
-       return ERR_PTR(-ENODEV);
 }
 
 static inline ssize_t debugfs_read_file_bool(struct file *file,
index 8029f7e..a5f89fc 100644 (file)
@@ -203,6 +203,29 @@ static inline int dma_mmap_from_global_coherent(struct vm_area_struct *vma,
 }
 #endif /* CONFIG_DMA_DECLARE_COHERENT */
 
+int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
+               void *cpu_addr, dma_addr_t dma_addr, size_t size,
+               unsigned long attrs);
+int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
+               void *cpu_addr, dma_addr_t dma_addr, size_t size,
+               unsigned long attrs);
+struct page *dma_common_alloc_pages(struct device *dev, size_t size,
+               dma_addr_t *dma_handle, enum dma_data_direction dir, gfp_t gfp);
+void dma_common_free_pages(struct device *dev, size_t size, struct page *vaddr,
+               dma_addr_t dma_handle, enum dma_data_direction dir);
+
+struct page **dma_common_find_pages(void *cpu_addr);
+void *dma_common_contiguous_remap(struct page *page, size_t size, pgprot_t prot,
+               const void *caller);
+void *dma_common_pages_remap(struct page **pages, size_t size, pgprot_t prot,
+               const void *caller);
+void dma_common_free_remap(void *cpu_addr, size_t size);
+
+struct page *dma_alloc_from_pool(struct device *dev, size_t size,
+               void **cpu_addr, gfp_t flags,
+               bool (*phys_addr_ok)(struct device *, phys_addr_t, size_t));
+bool dma_free_from_pool(struct device *dev, void *start, size_t size);
+
 #ifdef CONFIG_ARCH_HAS_DMA_COHERENCE_H
 #include <asm/dma-coherence.h>
 #elif defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
index 3f029af..9561510 100644 (file)
@@ -389,30 +389,6 @@ static inline void dma_sync_sgtable_for_device(struct device *dev,
 #define dma_get_sgtable(d, t, v, h, s) dma_get_sgtable_attrs(d, t, v, h, s, 0)
 #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, 0)
 
-extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
-               void *cpu_addr, dma_addr_t dma_addr, size_t size,
-               unsigned long attrs);
-struct page *dma_common_alloc_pages(struct device *dev, size_t size,
-               dma_addr_t *dma_handle, enum dma_data_direction dir, gfp_t gfp);
-void dma_common_free_pages(struct device *dev, size_t size, struct page *vaddr,
-               dma_addr_t dma_handle, enum dma_data_direction dir);
-struct page **dma_common_find_pages(void *cpu_addr);
-void *dma_common_contiguous_remap(struct page *page, size_t size,
-                       pgprot_t prot, const void *caller);
-
-void *dma_common_pages_remap(struct page **pages, size_t size,
-                       pgprot_t prot, const void *caller);
-void dma_common_free_remap(void *cpu_addr, size_t size);
-
-struct page *dma_alloc_from_pool(struct device *dev, size_t size,
-               void **cpu_addr, gfp_t flags,
-               bool (*phys_addr_ok)(struct device *, phys_addr_t, size_t));
-bool dma_free_from_pool(struct device *dev, void *start, size_t size);
-
-int
-dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, void *cpu_addr,
-               dma_addr_t dma_addr, size_t size, unsigned long attrs);
-
 static inline void *dma_alloc_coherent(struct device *dev, size_t size,
                dma_addr_t *dma_handle, gfp_t gfp)
 {
index 5896441..efa2f03 100644 (file)
@@ -47,7 +47,7 @@ struct cppi5_host_desc_t {
        u32 buf_info1;
        u32 org_buf_len;
        u64 org_buf_ptr;
-       u32 epib[0];
+       u32 epib[];
 } __packed;
 
 #define CPPI5_DESC_MIN_ALIGN                   (16U)
@@ -139,7 +139,7 @@ struct cppi5_desc_epib_t {
  */
 struct cppi5_monolithic_desc_t {
        struct cppi5_desc_hdr_t hdr;
-       u32 epib[0];
+       u32 epib[];
 };
 
 #define CPPI5_INFO2_MDESC_DATA_OFFSET_SHIFT    (18U)
index 8aa0c7c..a57ee75 100644 (file)
@@ -84,7 +84,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
 
 #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt)               \
        static struct _ddebug  __aligned(8)                     \
-       __section(__dyndbg) name = {                            \
+       __section("__dyndbg") name = {                          \
                .modname = KBUILD_MODNAME,                      \
                .function = __func__,                           \
                .filename = __FILE__,                           \
index 8933ff6..fceb5e8 100644 (file)
@@ -130,7 +130,7 @@ struct kernel_symbol {
  * discarded in the final link stage.
  */
 #define __ksym_marker(sym)     \
-       static int __ksym_marker_##sym[0] __section(.discard.ksym) __used
+       static int __ksym_marker_##sym[0] __section(".discard.ksym") __used
 
 #define __EXPORT_SYMBOL(sym, sec, ns)                                  \
        __ksym_marker(sym);                                             \
index 7bcdcf4..921e750 100644 (file)
@@ -8,7 +8,7 @@
 /* List of all valid flags for the open/openat flags argument: */
 #define VALID_OPEN_FLAGS \
        (O_RDONLY | O_WRONLY | O_RDWR | O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC | \
-        O_APPEND | O_NDELAY | O_NONBLOCK | O_NDELAY | __O_SYNC | O_DSYNC | \
+        O_APPEND | O_NDELAY | O_NONBLOCK | __O_SYNC | O_DSYNC | \
         FASYNC | O_DIRECT | O_LARGEFILE | O_DIRECTORY | O_NOFOLLOW | \
         O_NOATIME | O_CLOEXEC | O_PATH | __O_TMPFILE)
 
index 72d62cb..1b62397 100644 (file)
@@ -558,21 +558,21 @@ struct sk_filter {
 DECLARE_STATIC_KEY_FALSE(bpf_stats_enabled_key);
 
 #define __BPF_PROG_RUN(prog, ctx, dfunc)       ({                      \
-       u32 ret;                                                        \
+       u32 __ret;                                                      \
        cant_migrate();                                                 \
        if (static_branch_unlikely(&bpf_stats_enabled_key)) {           \
-               struct bpf_prog_stats *stats;                           \
-               u64 start = sched_clock();                              \
-               ret = dfunc(ctx, (prog)->insnsi, (prog)->bpf_func);     \
-               stats = this_cpu_ptr(prog->aux->stats);                 \
-               u64_stats_update_begin(&stats->syncp);                  \
-               stats->cnt++;                                           \
-               stats->nsecs += sched_clock() - start;                  \
-               u64_stats_update_end(&stats->syncp);                    \
+               struct bpf_prog_stats *__stats;                         \
+               u64 __start = sched_clock();                            \
+               __ret = dfunc(ctx, (prog)->insnsi, (prog)->bpf_func);   \
+               __stats = this_cpu_ptr(prog->aux->stats);               \
+               u64_stats_update_begin(&__stats->syncp);                \
+               __stats->cnt++;                                         \
+               __stats->nsecs += sched_clock() - __start;              \
+               u64_stats_update_end(&__stats->syncp);                  \
        } else {                                                        \
-               ret = dfunc(ctx, (prog)->insnsi, (prog)->bpf_func);     \
+               __ret = dfunc(ctx, (prog)->insnsi, (prog)->bpf_func);   \
        }                                                               \
-       ret; })
+       __ret; })
 
 #define BPF_PROG_RUN(prog, ctx)                                                \
        __BPF_PROG_RUN(prog, ctx, bpf_dispatcher_nop_func)
index c15acad..84e346a 100644 (file)
@@ -36,7 +36,7 @@ struct builtin_fw {
 
 #define DECLARE_BUILTIN_FIRMWARE_SIZE(name, blob, size)                             \
        static const struct builtin_fw __fw_concat(__builtin_fw,__COUNTER__) \
-       __used __section(.builtin_fw) = { name, blob, size }
+       __used __section(".builtin_fw") = { name, blob, size }
 
 #if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
 int request_firmware(const struct firmware **fw, const char *name,
index 16e3789..21cc971 100644 (file)
@@ -3096,30 +3096,18 @@ extern const struct inode_operations simple_symlink_inode_operations;
 
 extern int iterate_dir(struct file *, struct dir_context *);
 
-extern int vfs_statx(int, const char __user *, int, struct kstat *, u32);
-extern int vfs_statx_fd(unsigned int, struct kstat *, u32, unsigned int);
+int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,
+               int flags);
+int vfs_fstat(int fd, struct kstat *stat);
 
 static inline int vfs_stat(const char __user *filename, struct kstat *stat)
 {
-       return vfs_statx(AT_FDCWD, filename, AT_NO_AUTOMOUNT,
-                        stat, STATX_BASIC_STATS);
+       return vfs_fstatat(AT_FDCWD, filename, stat, 0);
 }
 static inline int vfs_lstat(const char __user *name, struct kstat *stat)
 {
-       return vfs_statx(AT_FDCWD, name, AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT,
-                        stat, STATX_BASIC_STATS);
+       return vfs_fstatat(AT_FDCWD, name, stat, AT_SYMLINK_NOFOLLOW);
 }
-static inline int vfs_fstatat(int dfd, const char __user *filename,
-                             struct kstat *stat, int flags)
-{
-       return vfs_statx(dfd, filename, flags | AT_NO_AUTOMOUNT,
-                        stat, STATX_BASIC_STATS);
-}
-static inline int vfs_fstat(int fd, struct kstat *stat)
-{
-       return vfs_statx_fd(fd, stat, STATX_BASIC_STATS, 0);
-}
-
 
 extern const char *vfs_get_link(struct dentry *, struct delayed_call *);
 extern int vfs_readlink(struct dentry *, char __user *, int);
@@ -3297,7 +3285,7 @@ static inline ino_t parent_ino(struct dentry *dentry)
  */
 struct simple_transaction_argresp {
        ssize_t size;
-       char data[0];
+       char data[];
 };
 
 #define SIMPLE_TRANSACTION_LIMIT (PAGE_SIZE - sizeof(struct simple_transaction_argresp))
index 774f7d3..369221f 100644 (file)
@@ -103,7 +103,7 @@ struct hilse_node {
 
 /* Methods for back-end drivers, e.g. hp_sdc_mlc */
 typedef int    (hil_mlc_cts) (hil_mlc *mlc);
-typedef void   (hil_mlc_out) (hil_mlc *mlc);
+typedef int    (hil_mlc_out) (hil_mlc *mlc);
 typedef int    (hil_mlc_in)  (hil_mlc *mlc, suseconds_t timeout);
 
 struct hil_mlc_devinfo {
index 770408b..5e8cc9c 100644 (file)
@@ -3417,6 +3417,8 @@ struct ieee80211_multiple_bssid_configuration {
 #define WLAN_AKM_SUITE_FT_PSK_SHA384           SUITE(0x000FAC, 19)
 #define WLAN_AKM_SUITE_PSK_SHA384              SUITE(0x000FAC, 20)
 
+#define WLAN_AKM_SUITE_WFA_DPP                 SUITE(WLAN_OUI_WFA, 2)
+
 #define WLAN_MAX_KEY_LEN               32
 
 #define WLAN_PMK_NAME_LEN              16
@@ -3427,6 +3429,7 @@ struct ieee80211_multiple_bssid_configuration {
 
 #define WLAN_OUI_WFA                   0x506f9a
 #define WLAN_OUI_TYPE_WFA_P2P          9
+#define WLAN_OUI_TYPE_WFA_DPP          0x1A
 #define WLAN_OUI_MICROSOFT             0x0050f2
 #define WLAN_OUI_TYPE_MICROSOFT_WPA    1
 #define WLAN_OUI_TYPE_MICROSOFT_WMM    2
index 556caed..b979005 100644 (file)
@@ -25,6 +25,7 @@ struct br_ip {
 #if IS_ENABLED(CONFIG_IPV6)
                struct in6_addr ip6;
 #endif
+               unsigned char   mac_addr[ETH_ALEN];
        } dst;
        __be16          proto;
        __u16           vid;
index 3515ca6..53aa034 100644 (file)
@@ -105,7 +105,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
 
 #define IN_DEV_LOG_MARTIANS(in_dev)    IN_DEV_ORCONF((in_dev), LOG_MARTIANS)
 #define IN_DEV_PROXY_ARP(in_dev)       IN_DEV_ORCONF((in_dev), PROXY_ARP)
-#define IN_DEV_PROXY_ARP_PVLAN(in_dev) IN_DEV_CONF_GET(in_dev, PROXY_ARP_PVLAN)
+#define IN_DEV_PROXY_ARP_PVLAN(in_dev) IN_DEV_ORCONF((in_dev), PROXY_ARP_PVLAN)
 #define IN_DEV_SHARED_MEDIA(in_dev)    IN_DEV_ORCONF((in_dev), SHARED_MEDIA)
 #define IN_DEV_TX_REDIRECTS(in_dev)    IN_DEV_ORCONF((in_dev), SEND_REDIRECTS)
 #define IN_DEV_SEC_REDIRECTS(in_dev)   IN_DEV_ORCONF((in_dev), \
@@ -126,7 +126,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
          IN_DEV_ORCONF((in_dev), ACCEPT_REDIRECTS)))
 
 #define IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev) \
-       IN_DEV_CONF_GET((in_dev), IGNORE_ROUTES_WITH_LINKDOWN)
+       IN_DEV_ORCONF((in_dev), IGNORE_ROUTES_WITH_LINKDOWN)
 
 #define IN_DEV_ARPFILTER(in_dev)       IN_DEV_ORCONF((in_dev), ARPFILTER)
 #define IN_DEV_ARP_ACCEPT(in_dev)      IN_DEV_ORCONF((in_dev), ARP_ACCEPT)
index 212fc9e..7b53cb3 100644 (file)
 
 /* These are for everybody (although not all archs will actually
    discard it in modules) */
-#define __init         __section(.init.text) __cold  __latent_entropy __noinitretpoline
-#define __initdata     __section(.init.data)
-#define __initconst    __section(.init.rodata)
-#define __exitdata     __section(.exit.data)
-#define __exit_call    __used __section(.exitcall.exit)
+#define __init         __section(".init.text") __cold  __latent_entropy __noinitretpoline
+#define __initdata     __section(".init.data")
+#define __initconst    __section(".init.rodata")
+#define __exitdata     __section(".exit.data")
+#define __exit_call    __used __section(".exitcall.exit")
 
 /*
  * modpost check for section mismatches during the kernel build.
@@ -70,9 +70,9 @@
  *
  * The markers follow same syntax rules as __init / __initdata.
  */
-#define __ref            __section(.ref.text) noinline
-#define __refdata        __section(.ref.data)
-#define __refconst       __section(.ref.rodata)
+#define __ref            __section(".ref.text") noinline
+#define __refdata        __section(".ref.data")
+#define __refconst       __section(".ref.rodata")
 
 #ifdef MODULE
 #define __exitused
 #define __exitused  __used
 #endif
 
-#define __exit          __section(.exit.text) __exitused __cold notrace
+#define __exit          __section(".exit.text") __exitused __cold notrace
 
 /* Used for MEMORY_HOTPLUG */
-#define __meminit        __section(.meminit.text) __cold notrace \
+#define __meminit        __section(".meminit.text") __cold notrace \
                                                  __latent_entropy
-#define __meminitdata    __section(.meminit.data)
-#define __meminitconst   __section(.meminit.rodata)
-#define __memexit        __section(.memexit.text) __exitused __cold notrace
-#define __memexitdata    __section(.memexit.data)
-#define __memexitconst   __section(.memexit.rodata)
+#define __meminitdata    __section(".meminit.data")
+#define __meminitconst   __section(".meminit.rodata")
+#define __memexit        __section(".memexit.text") __exitused __cold notrace
+#define __memexitdata    __section(".memexit.data")
+#define __memexitconst   __section(".memexit.rodata")
 
 /* For assembly routines */
 #define __HEAD         .section        ".head.text","ax"
@@ -254,7 +254,7 @@ struct obs_kernel_param {
        static const char __setup_str_##unique_id[] __initconst         \
                __aligned(1) = str;                                     \
        static struct obs_kernel_param __setup_##unique_id              \
-               __used __section(.init.setup)                           \
+               __used __section(".init.setup")                         \
                __attribute__((aligned((sizeof(long)))))                \
                = { __setup_str_##unique_id, fn, early }
 
@@ -298,7 +298,7 @@ void __init parse_early_options(char *cmdline);
 #endif
 
 /* Data marked not to be saved by software suspend */
-#define __nosavedata __section(.data..nosave)
+#define __nosavedata __section(".data..nosave")
 
 #ifdef MODULE
 #define __exit_p(x) x
index 2c620d7..b2412b4 100644 (file)
@@ -40,12 +40,12 @@ extern struct cred init_cred;
 
 /* Attach to the init_task data structure for proper alignment */
 #ifdef CONFIG_ARCH_TASK_STRUCT_ON_STACK
-#define __init_task_data __attribute__((__section__(".data..init_task")))
+#define __init_task_data __section(".data..init_task")
 #else
 #define __init_task_data /**/
 #endif
 
 /* Attach to the thread_info data structure for proper alignment */
-#define __init_thread_info __attribute__((__section__(".data..init_thread_info")))
+#define __init_thread_info __section(".data..init_thread_info")
 
 #endif
index 3582176..50b8398 100644 (file)
@@ -79,8 +79,10 @@ struct rapl_power_limit {
 
 struct rapl_package;
 
+#define RAPL_DOMAIN_NAME_LENGTH 16
+
 struct rapl_domain {
-       const char *name;
+       char name[RAPL_DOMAIN_NAME_LENGTH];
        enum rapl_domain_type id;
        u64 regs[RAPL_DOMAIN_REG_MAX];
        struct powercap_zone power_zone;
@@ -152,7 +154,4 @@ struct rapl_package *rapl_find_package_domain(int cpu, struct rapl_if_priv *priv
 struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv);
 void rapl_remove_package(struct rapl_package *rp);
 
-int rapl_add_platform_domain(struct rapl_if_priv *priv);
-void rapl_remove_platform_domain(struct rapl_if_priv *priv);
-
 #endif /* __INTEL_RAPL_H__ */
index f9aee35..ee8299e 100644 (file)
@@ -792,9 +792,9 @@ extern int arch_early_irq_init(void);
  * We want to know which function is an entrypoint of a hardirq or a softirq.
  */
 #ifndef __irq_entry
-# define __irq_entry    __attribute__((__section__(".irqentry.text")))
+# define __irq_entry    __section(".irqentry.text")
 #endif
 
-#define __softirq_entry  __attribute__((__section__(".softirqentry.text")))
+#define __softirq_entry  __section(".softirqentry.text")
 
 #endif
index 868364c..35b2d84 100644 (file)
@@ -30,7 +30,8 @@ struct io_uring_task {
        struct percpu_counter   inflight;
        struct io_identity      __identity;
        struct io_identity      *identity;
-       bool                    in_idle;
+       atomic_t                in_idle;
+       bool                    sqpoll;
 };
 
 #if defined(CONFIG_IO_URING)
index 1dcd919..0a9dc40 100644 (file)
@@ -106,12 +106,6 @@ struct io_context {
 
        unsigned short ioprio;
 
-       /*
-        * For request batching
-        */
-       int nr_batch_requests;     /* Number of requests left in the batch */
-       unsigned long last_waited; /* Time last woken after wait for request */
-
        struct radix_tree_root  icq_tree;
        struct io_cq __rcu      *icq_hint;
        struct hlist_head       icq_list;
index 172b339..5bd3cac 100644 (file)
@@ -221,7 +221,7 @@ struct iomap_writeback_ops {
         * Optional, allows the file system to discard state on a page where
         * we failed to submit any I/O.
         */
-       void (*discard_page)(struct page *page);
+       void (*discard_page)(struct page *page, loff_t fileoff);
 };
 
 struct iomap_writepage_ctx {
index fb3d71a..1c49fd6 100644 (file)
@@ -68,6 +68,7 @@ extern void *jbd2_alloc(size_t size, gfp_t flags);
 extern void jbd2_free(void *ptr, size_t size);
 
 #define JBD2_MIN_JOURNAL_BLOCKS 1024
+#define JBD2_MIN_FC_BLOCKS     256
 
 #ifdef __KERNEL__
 
@@ -263,7 +264,10 @@ typedef struct journal_superblock_s
 /* 0x0050 */
        __u8    s_checksum_type;        /* checksum type */
        __u8    s_padding2[3];
-       __u32   s_padding[42];
+/* 0x0054 */
+       __be32  s_num_fc_blks;          /* Number of fast commit blocks */
+/* 0x0058 */
+       __u32   s_padding[41];
        __be32  s_checksum;             /* crc32c(superblock) */
 
 /* 0x0100 */
@@ -941,8 +945,9 @@ struct journal_s
        /**
         * @j_fc_off:
         *
-        * Number of fast commit blocks currently allocated.
-        * [j_state_lock].
+        * Number of fast commit blocks currently allocated. Accessed only
+        * during fast commit. Currently only process can do fast commit, so
+        * this field is not protected by any lock.
         */
        unsigned long           j_fc_off;
 
@@ -985,9 +990,9 @@ struct journal_s
        struct block_device     *j_fs_dev;
 
        /**
-        * @j_maxlen: Total maximum capacity of the journal region on disk.
+        * @j_total_len: Total maximum capacity of the journal region on disk.
         */
-       unsigned int            j_maxlen;
+       unsigned int            j_total_len;
 
        /**
         * @j_reserved_credits:
@@ -1105,8 +1110,9 @@ struct journal_s
        struct buffer_head      **j_wbuf;
 
        /**
-        * @j_fc_wbuf: Array of fast commit bhs for
-        * jbd2_journal_commit_transaction.
+        * @j_fc_wbuf: Array of fast commit bhs for fast commit. Accessed only
+        * during a fast commit. Currently only process can do fast commit, so
+        * this field is not protected by any lock.
         */
        struct buffer_head      **j_fc_wbuf;
 
@@ -1253,7 +1259,7 @@ struct journal_s
         */
        void (*j_fc_cleanup_callback)(struct journal_s *journal, int);
 
-       /*
+       /**
         * @j_fc_replay_callback:
         *
         * File-system specific function that performs replay of a fast
@@ -1611,16 +1617,20 @@ extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *);
 extern int jbd2_cleanup_journal_tail(journal_t *);
 
 /* Fast commit related APIs */
-int jbd2_fc_init(journal_t *journal, int num_fc_blks);
 int jbd2_fc_begin_commit(journal_t *journal, tid_t tid);
 int jbd2_fc_end_commit(journal_t *journal);
-int jbd2_fc_end_commit_fallback(journal_t *journal, tid_t tid);
+int jbd2_fc_end_commit_fallback(journal_t *journal);
 int jbd2_fc_get_buf(journal_t *journal, struct buffer_head **bh_out);
 int jbd2_submit_inode_data(struct jbd2_inode *jinode);
 int jbd2_wait_inode_data(journal_t *journal, struct jbd2_inode *jinode);
 int jbd2_fc_wait_bufs(journal_t *journal, int num_blks);
 int jbd2_fc_release_bufs(journal_t *journal);
 
+static inline int jbd2_journal_get_max_txn_bufs(journal_t *journal)
+{
+       return (journal->j_total_len - journal->j_fc_wbufsize) / 4;
+}
+
 /*
  * is_journal_abort
  *
index cfb62e9..ab7f8c1 100644 (file)
@@ -99,6 +99,7 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
        case 2:  a += (u32)k[1]<<8;     fallthrough;
        case 1:  a += k[0];
                 __jhash_final(a, b, c);
+                break;
        case 0: /* Nothing left to add */
                break;
        }
@@ -136,6 +137,7 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
        case 2: b += k[1];      fallthrough;
        case 1: a += k[0];
                __jhash_final(a, b, c);
+               break;
        case 0: /* Nothing left to add */
                break;
        }
index c629215..2f05e91 100644 (file)
@@ -729,7 +729,7 @@ do {                                                        \
 #define do_trace_printk(fmt, args...)                                  \
 do {                                                                   \
        static const char *trace_printk_fmt __used                      \
-               __attribute__((section("__trace_printk_fmt"))) =        \
+               __section("__trace_printk_fmt") =                       \
                __builtin_constant_p(fmt) ? fmt : NULL;                 \
                                                                        \
        __trace_printk_check_format(fmt, ##args);                       \
@@ -773,7 +773,7 @@ int __trace_printk(unsigned long ip, const char *fmt, ...);
 
 #define trace_puts(str) ({                                             \
        static const char *trace_printk_fmt __used                      \
-               __attribute__((section("__trace_printk_fmt"))) =        \
+               __section("__trace_printk_fmt") =                       \
                __builtin_constant_p(str) ? str : NULL;                 \
                                                                        \
        if (__builtin_constant_p(str))                                  \
@@ -795,7 +795,7 @@ extern void trace_dump_stack(int skip);
 do {                                                                   \
        if (__builtin_constant_p(fmt)) {                                \
                static const char *trace_printk_fmt __used              \
-                 __attribute__((section("__trace_printk_fmt"))) =      \
+                 __section("__trace_printk_fmt") =                     \
                        __builtin_constant_p(fmt) ? fmt : NULL;         \
                                                                        \
                __ftrace_vbprintk(_THIS_IP_, trace_printk_fmt, vargs);  \
index d796ec2..5bcfbd9 100644 (file)
@@ -36,8 +36,8 @@
                  __stringify(name))
 #endif
 
-#define __page_aligned_data    __section(.data..page_aligned) __aligned(PAGE_SIZE)
-#define __page_aligned_bss     __section(.bss..page_aligned) __aligned(PAGE_SIZE)
+#define __page_aligned_data    __section(".data..page_aligned") __aligned(PAGE_SIZE)
+#define __page_aligned_bss     __section(".bss..page_aligned") __aligned(PAGE_SIZE)
 
 /*
  * For assembly routines.
index 8814e3d..c503f7a 100644 (file)
@@ -1611,12 +1611,12 @@ extern struct lsm_info __start_early_lsm_info[], __end_early_lsm_info[];
 
 #define DEFINE_LSM(lsm)                                                        \
        static struct lsm_info __lsm_##lsm                              \
-               __used __section(.lsm_info.init)                        \
+               __used __section(".lsm_info.init")                      \
                __aligned(sizeof(unsigned long))
 
 #define DEFINE_EARLY_LSM(lsm)                                          \
        static struct lsm_info __early_lsm_##lsm                        \
-               __used __section(.early_lsm_info.init)                  \
+               __used __section(".early_lsm_info.init")                \
                __aligned(sizeof(unsigned long))
 
 #ifdef CONFIG_SECURITY_SELINUX_DISABLE
index 05eea1a..d5a983d 100644 (file)
@@ -28,8 +28,7 @@
  * bit 16-27: update value
  * bit 31: 1 - update, 0 - no update
  */
-#define CMDQ_WFE_OPTION                        (CMDQ_WFE_UPDATE | CMDQ_WFE_WAIT | \
-                                       CMDQ_WFE_WAIT_VALUE)
+#define CMDQ_WFE_OPTION                        (CMDQ_WFE_WAIT | CMDQ_WFE_WAIT_VALUE)
 
 /** cmdq event maximum */
 #define CMDQ_MAX_EVENT                 0x3ff
@@ -60,6 +59,9 @@ enum cmdq_code {
        CMDQ_CODE_JUMP = 0x10,
        CMDQ_CODE_WFE = 0x20,
        CMDQ_CODE_EOC = 0x40,
+       CMDQ_CODE_READ_S = 0x80,
+       CMDQ_CODE_WRITE_S = 0x90,
+       CMDQ_CODE_WRITE_S_MASK = 0x91,
        CMDQ_CODE_LOGIC = 0xa0,
 };
 
index 9542b41..35ce84c 100644 (file)
@@ -14,7 +14,7 @@
  */
 struct zynqmp_ipi_message {
        size_t len;
-       u8 data[0];
+       u8 data[];
 };
 
 #endif /* _LINUX_ZYNQMP_IPI_MESSAGE_H_ */
index ff7b760..52b1610 100644 (file)
@@ -25,6 +25,9 @@
 #define MARVELL_PHY_ID_88X3310         0x002b09a0
 #define MARVELL_PHY_ID_88E2110         0x002b09b0
 
+/* Marvel 88E1111 in Finisar SFP module with modified PHY ID */
+#define MARVELL_PHY_ID_88E1111_FINISAR 0x01ff0cc0
+
 /* The MV88e6390 Ethernet switch contains embedded PHYs. These PHYs do
  * not have a model ID. So the switch driver traps reads to the ID2
  * register and returns the switch family ID
index d4841e5..b9bb7df 100644 (file)
@@ -737,4 +737,11 @@ int mhi_queue_buf(struct mhi_device *mhi_dev, enum dma_data_direction dir,
 int mhi_queue_skb(struct mhi_device *mhi_dev, enum dma_data_direction dir,
                  struct sk_buff *skb, size_t len, enum mhi_flags mflags);
 
+/**
+ * mhi_queue_is_full - Determine whether queueing new elements is possible
+ * @mhi_dev: Device associated with the channels
+ * @dir: DMA direction for the channel
+ */
+bool mhi_queue_is_full(struct mhi_device *mhi_dev, enum dma_data_direction dir);
+
 #endif /* _MHI_H_ */
diff --git a/include/linux/mic_bus.h b/include/linux/mic_bus.h
deleted file mode 100644 (file)
index e99c789..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * Intel MIC Bus driver.
- *
- * This implementation is very similar to the virtio bus driver
- * implementation @ include/linux/virtio.h.
- */
-#ifndef _MIC_BUS_H_
-#define _MIC_BUS_H_
-/*
- * Everything a mbus driver needs to work with any particular mbus
- * implementation.
- */
-#include <linux/interrupt.h>
-#include <linux/dma-mapping.h>
-
-struct mbus_device_id {
-       __u32 device;
-       __u32 vendor;
-};
-
-#define MBUS_DEV_DMA_HOST 2
-#define MBUS_DEV_DMA_MIC 3
-#define MBUS_DEV_ANY_ID 0xffffffff
-
-/**
- * mbus_device - representation of a device using mbus
- * @mmio_va: virtual address of mmio space
- * @hw_ops: the hardware ops supported by this device.
- * @id: the device type identification (used to match it with a driver).
- * @dev: underlying device.
- * be used to communicate with.
- * @index: unique position on the mbus bus
- */
-struct mbus_device {
-       void __iomem *mmio_va;
-       struct mbus_hw_ops *hw_ops;
-       struct mbus_device_id id;
-       struct device dev;
-       int index;
-};
-
-/**
- * mbus_driver - operations for a mbus I/O driver
- * @driver: underlying device driver (populate name and owner).
- * @id_table: the ids serviced by this driver.
- * @probe: the function to call when a device is found.  Returns 0 or -errno.
- * @remove: the function to call when a device is removed.
- */
-struct mbus_driver {
-       struct device_driver driver;
-       const struct mbus_device_id *id_table;
-       int (*probe)(struct mbus_device *dev);
-       void (*scan)(struct mbus_device *dev);
-       void (*remove)(struct mbus_device *dev);
-};
-
-/**
- * struct mic_irq - opaque pointer used as cookie
- */
-struct mic_irq;
-
-/**
- * mbus_hw_ops - Hardware operations for accessing a MIC device on the MIC bus.
- */
-struct mbus_hw_ops {
-       struct mic_irq* (*request_threaded_irq)(struct mbus_device *mbdev,
-                                               irq_handler_t handler,
-                                               irq_handler_t thread_fn,
-                                               const char *name, void *data,
-                                               int intr_src);
-       void (*free_irq)(struct mbus_device *mbdev,
-                        struct mic_irq *cookie, void *data);
-       void (*ack_interrupt)(struct mbus_device *mbdev, int num);
-};
-
-struct mbus_device *
-mbus_register_device(struct device *pdev, int id, const struct dma_map_ops *dma_ops,
-                    struct mbus_hw_ops *hw_ops, int index,
-                    void __iomem *mmio_va);
-void mbus_unregister_device(struct mbus_device *mbdev);
-
-int mbus_register_driver(struct mbus_driver *drv);
-void mbus_unregister_driver(struct mbus_driver *drv);
-
-static inline struct mbus_device *dev_to_mbus(struct device *_dev)
-{
-       return container_of(_dev, struct mbus_device, dev);
-}
-
-static inline struct mbus_driver *drv_to_mbus(struct device_driver *drv)
-{
-       return container_of(drv, struct mbus_driver, driver);
-}
-
-#endif /* _MIC_BUS_H */
index add8509..0f23e1e 100644 (file)
@@ -1213,4 +1213,22 @@ static inline bool mlx5_is_roce_enabled(struct mlx5_core_dev *dev)
        return val.vbool;
 }
 
+/**
+ * mlx5_core_net - Provide net namespace of the mlx5_core_dev
+ * @dev: mlx5 core device
+ *
+ * mlx5_core_net() returns the net namespace of mlx5 core device.
+ * This can be called only in below described limited context.
+ * (a) When a devlink instance for mlx5_core is registered and
+ *     when devlink reload operation is disabled.
+ *     or
+ * (b) during devlink reload reload_down() and reload_up callbacks
+ *     where it is ensured that devlink instance's net namespace is
+ *     stable.
+ */
+static inline struct net *mlx5_core_net(struct mlx5_core_dev *dev)
+{
+       return devlink_net(priv_to_devlink(dev));
+}
+
 #endif /* MLX5_DRIVER_H */
index 651591a..a092346 100644 (file)
@@ -5823,7 +5823,7 @@ struct mlx5_ifc_alloc_modify_header_context_in_bits {
        u8         reserved_at_68[0x10];
        u8         num_of_actions[0x8];
 
-       union mlx5_ifc_set_add_copy_action_in_auto_bits actions[0];
+       union mlx5_ifc_set_add_copy_action_in_auto_bits actions[];
 };
 
 struct mlx5_ifc_dealloc_modify_header_context_out_bits {
@@ -9761,7 +9761,7 @@ struct mlx5_ifc_mcda_reg_bits {
 
        u8         reserved_at_60[0x20];
 
-       u8         data[0][0x20];
+       u8         data[][0x20];
 };
 
 enum {
index ef360fe..db6ae4d 100644 (file)
@@ -2759,6 +2759,15 @@ static inline vm_fault_t vmf_insert_page(struct vm_area_struct *vma,
        return VM_FAULT_NOPAGE;
 }
 
+#ifndef io_remap_pfn_range
+static inline int io_remap_pfn_range(struct vm_area_struct *vma,
+                                    unsigned long addr, unsigned long pfn,
+                                    unsigned long size, pgprot_t prot)
+{
+       return remap_pfn_range(vma, addr, pfn, size, pgprot_decrypted(prot));
+}
+#endif
+
 static inline vm_fault_t vmf_error(int err)
 {
        if (err == -ENOMEM)
index 20fce25..c4e7a88 100644 (file)
@@ -278,7 +278,7 @@ extern typeof(name) __mod_##type##__##name##_device_table           \
                .version        = _version,                             \
        };                                                              \
        static const struct module_version_attribute                    \
-       __used __attribute__ ((__section__ ("__modver")))               \
+       __used __section("__modver")                                    \
        * __moduleparam_const __modver_attr = &___modver_attr
 #endif
 
@@ -744,7 +744,7 @@ static inline bool within_module(unsigned long addr, const struct module *mod)
 }
 
 /* Get/put a kernel symbol (calls should be symmetric) */
-#define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })
+#define symbol_get(x) ({ extern typeof(x) x __attribute__((weak,visibility("hidden"))); &(x); })
 #define symbol_put(x) do { } while (0)
 #define symbol_put_addr(x) do { } while (0)
 
index 47879fc..6388eb9 100644 (file)
@@ -22,7 +22,7 @@
 
 #define __MODULE_INFO(tag, name, info)                                   \
 static const char __UNIQUE_ID(name)[]                                    \
-  __used __attribute__((section(".modinfo"), unused, aligned(1)))        \
+  __used __section(".modinfo") __attribute__((unused, aligned(1)))       \
   = __MODULE_INFO_PREFIX __stringify(tag) "=" info
 
 #define __MODULE_PARM_TYPE(name, _type)                                          \
@@ -289,7 +289,7 @@ struct kparam_array
        static const char __param_str_##name[] = prefix #name;          \
        static struct kernel_param __moduleparam_const __param_##name   \
        __used                                                          \
-    __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
+    __section("__param") __attribute__ ((unused, aligned(sizeof(void *)))) \
        = { __param_str_##name, THIS_MODULE, ops,                       \
            VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } }
 
index de657bd..aaf343b 100644 (file)
@@ -30,6 +30,7 @@ struct fs_context;
 #define MNT_NODIRATIME 0x10
 #define MNT_RELATIME   0x20
 #define MNT_READONLY   0x40    /* does the user want this to be r/o? */
+#define MNT_NOSYMFOLLOW        0x80
 
 #define MNT_SHRINKABLE 0x100
 #define MNT_WRITE_HOLD 0x200
@@ -46,7 +47,7 @@ struct fs_context;
 #define MNT_SHARED_MASK        (MNT_UNBINDABLE)
 #define MNT_USER_SETTABLE_MASK  (MNT_NOSUID | MNT_NODEV | MNT_NOEXEC \
                                 | MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME \
-                                | MNT_READONLY)
+                                | MNT_READONLY | MNT_NOSYMFOLLOW)
 #define MNT_ATIME_MASK (MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME )
 
 #define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \
index a4e352b..3cac936 100644 (file)
@@ -28,7 +28,7 @@
  * those functions so they get relocated to ram.
  */
 #ifdef CONFIG_XIP_KERNEL
-#define __xipram noinline __attribute__ ((__section__ (".xiptext")))
+#define __xipram noinline __section(".xiptext")
 #endif
 
 /*
index 0b17c43..934de56 100644 (file)
@@ -207,8 +207,8 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
                                 NETIF_F_FSO)
 
 /* List of features with software fallbacks. */
-#define NETIF_F_GSO_SOFTWARE   (NETIF_F_ALL_TSO | \
-                                NETIF_F_GSO_SCTP)
+#define NETIF_F_GSO_SOFTWARE   (NETIF_F_ALL_TSO | NETIF_F_GSO_SCTP |        \
+                                NETIF_F_GSO_UDP_L4 | NETIF_F_GSO_FRAGLIST)
 
 /*
  * If one device supports one of these features, then enable them
index 964b494..7ce648a 100644 (file)
@@ -2557,6 +2557,18 @@ static inline void dev_sw_netstats_rx_add(struct net_device *dev, unsigned int l
        u64_stats_update_end(&tstats->syncp);
 }
 
+static inline void dev_sw_netstats_tx_add(struct net_device *dev,
+                                         unsigned int packets,
+                                         unsigned int len)
+{
+       struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
+
+       u64_stats_update_begin(&tstats->syncp);
+       tstats->tx_bytes += len;
+       tstats->tx_packets += packets;
+       u64_stats_update_end(&tstats->syncp);
+}
+
 static inline void dev_lstats_add(struct net_device *dev, unsigned int len)
 {
        struct pcpu_lstats *lstats = this_cpu_ptr(dev->lstats);
@@ -2584,6 +2596,20 @@ static inline void dev_lstats_add(struct net_device *dev, unsigned int len)
 #define netdev_alloc_pcpu_stats(type)                                  \
        __netdev_alloc_pcpu_stats(type, GFP_KERNEL)
 
+#define devm_netdev_alloc_pcpu_stats(dev, type)                                \
+({                                                                     \
+       typeof(type) __percpu *pcpu_stats = devm_alloc_percpu(dev, type);\
+       if (pcpu_stats) {                                               \
+               int __cpu;                                              \
+               for_each_possible_cpu(__cpu) {                          \
+                       typeof(type) *stat;                             \
+                       stat = per_cpu_ptr(pcpu_stats, __cpu);          \
+                       u64_stats_init(&stat->syncp);                   \
+               }                                                       \
+       }                                                               \
+       pcpu_stats;                                                     \
+})
+
 enum netdev_lag_tx_type {
        NETDEV_LAG_TX_TYPE_UNKNOWN,
        NETDEV_LAG_TX_TYPE_RANDOM,
@@ -4501,6 +4527,7 @@ void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
                             const struct net_device_stats *netdev_stats);
 void dev_fetch_sw_netstats(struct rtnl_link_stats64 *s,
                           const struct pcpu_sw_netstats __percpu *netstats);
+void dev_get_tstats64(struct net_device *dev, struct rtnl_link_stats64 *s);
 
 extern int             netdev_max_backlog;
 extern int             netdev_tstamp_prequeue;
index ab19272..46d9a0c 100644 (file)
@@ -198,6 +198,9 @@ struct ip_set_region {
        u32 elements;           /* Number of elements vs timeout */
 };
 
+/* The max revision number supported by any set type + 1 */
+#define IPSET_REVISION_MAX     9
+
 /* The core set type structure */
 struct ip_set_type {
        struct list_head list;
@@ -215,6 +218,8 @@ struct ip_set_type {
        u8 family;
        /* Type revisions */
        u8 revision_min, revision_max;
+       /* Revision-specific supported (create) flags */
+       u8 create_flags[IPSET_REVISION_MAX+1];
        /* Set features to control swapping */
        u16 features;
 
index 89016d0..f6267e2 100644 (file)
@@ -24,6 +24,12 @@ struct nfnl_callback {
        const u_int16_t attr_count;             /* number of nlattr's */
 };
 
+enum nfnl_abort_action {
+       NFNL_ABORT_NONE         = 0,
+       NFNL_ABORT_AUTOLOAD,
+       NFNL_ABORT_VALIDATE,
+};
+
 struct nfnetlink_subsystem {
        const char *name;
        __u8 subsys_id;                 /* nfnetlink subsystem ID */
@@ -31,7 +37,8 @@ struct nfnetlink_subsystem {
        const struct nfnl_callback *cb; /* callback for individual types */
        struct module *owner;
        int (*commit)(struct net *net, struct sk_buff *skb);
-       int (*abort)(struct net *net, struct sk_buff *skb, bool autoload);
+       int (*abort)(struct net *net, struct sk_buff *skb,
+                    enum nfnl_abort_action action);
        void (*cleanup)(struct net *net);
        bool (*valid_genid)(struct net *net, u32 genid);
 };
index 082e2c4..5b70ca8 100644 (file)
@@ -16,7 +16,7 @@ struct ip_rt_info {
        u_int32_t mark;
 };
 
-int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned addr_type);
+int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned addr_type);
 
 struct nf_queue_entry;
 
index 9b67394..48314ad 100644 (file)
@@ -42,7 +42,7 @@ struct nf_ipv6_ops {
 #if IS_MODULE(CONFIG_IPV6)
        int (*chk_addr)(struct net *net, const struct in6_addr *addr,
                        const struct net_device *dev, int strict);
-       int (*route_me_harder)(struct net *net, struct sk_buff *skb);
+       int (*route_me_harder)(struct net *net, struct sock *sk, struct sk_buff *skb);
        int (*dev_get_saddr)(struct net *net, const struct net_device *dev,
                       const struct in6_addr *daddr, unsigned int srcprefs,
                       struct in6_addr *saddr);
@@ -143,9 +143,9 @@ static inline int nf_br_ip6_fragment(struct net *net, struct sock *sk,
 #endif
 }
 
-int ip6_route_me_harder(struct net *net, struct sk_buff *skb);
+int ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb);
 
-static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb)
+static inline int nf_ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb)
 {
 #if IS_MODULE(CONFIG_IPV6)
        const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
@@ -153,9 +153,9 @@ static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb)
        if (!v6_ops)
                return -EHOSTUNREACH;
 
-       return v6_ops->route_me_harder(net, skb);
+       return v6_ops->route_me_harder(net, sk, skb);
 #elif IS_BUILTIN(CONFIG_IPV6)
-       return ip6_route_me_harder(net, skb);
+       return ip6_route_me_harder(net, sk, skb);
 #else
        return -EHOSTUNREACH;
 #endif
index ab82c79..577f514 100644 (file)
@@ -60,7 +60,7 @@ struct unwind_hint {
  * For more information, see tools/objtool/Documentation/stack-validation.txt.
  */
 #define STACK_FRAME_NON_STANDARD(func) \
-       static void __used __section(.discard.func_stack_frame_non_standard) \
+       static void __used __section(".discard.func_stack_frame_non_standard") \
                *__func_stack_frame_non_standard_##func = func
 
 #else /* __ASSEMBLY__ */
index 481ec04..5d51891 100644 (file)
@@ -1299,7 +1299,7 @@ static inline int of_get_available_child_count(const struct device_node *np)
 #if defined(CONFIG_OF) && !defined(MODULE)
 #define _OF_DECLARE(table, name, compat, fn, fn_type)                  \
        static const struct of_device_id __of_table_##name              \
-               __used __section(__##table##_of_table)                  \
+               __used __section("__" #table "_of_table")               \
                 = { .compatible = compat,                              \
                     .data = (fn == (fn_type)NULL) ? fn : fn  }
 #else
index c77b7c3..e1e19c1 100644 (file)
@@ -344,9 +344,9 @@ static inline struct page *find_get_page_flags(struct address_space *mapping,
 /**
  * find_lock_page - locate, pin and lock a pagecache page
  * @mapping: the address_space to search
- * @offset: the page index
+ * @index: the page index
  *
- * Looks up the page cache entry at @mapping & @offset.  If there is a
+ * Looks up the page cache entry at @mapping & @index.  If there is a
  * page cache page, it is returned locked and with an increased
  * refcount.
  *
@@ -363,9 +363,9 @@ static inline struct page *find_lock_page(struct address_space *mapping,
 /**
  * find_lock_head - Locate, pin and lock a pagecache page.
  * @mapping: The address_space to search.
- * @offset: The page index.
+ * @index: The page index.
  *
- * Looks up the page cache entry at @mapping & @offset.  If there is a
+ * Looks up the page cache entry at @mapping & @index.  If there is a
  * page cache page, its head page is returned locked and with an increased
  * refcount.
  *
index 176bfbd..dff7040 100644 (file)
@@ -51,7 +51,7 @@
        PER_CPU_ATTRIBUTES
 
 #define __PCPU_DUMMY_ATTRS                                             \
-       __attribute__((section(".discard"), unused))
+       __section(".discard") __attribute__((unused))
 
 /*
  * s390 and alpha modules require percpu variables to be defined as
index 38c33ea..71125a4 100644 (file)
@@ -1427,10 +1427,6 @@ typedef unsigned int pgtbl_mod_mask;
 
 #endif /* !__ASSEMBLY__ */
 
-#ifndef io_remap_pfn_range
-#define io_remap_pfn_range remap_pfn_range
-#endif
-
 #ifndef has_transparent_hugepage
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 #define has_transparent_hugepage() 1
index eb3cb1a..8849a00 100644 (file)
@@ -147,16 +147,8 @@ typedef enum {
        PHY_INTERFACE_MODE_MAX,
 } phy_interface_t;
 
-/**
+/*
  * phy_supported_speeds - return all speeds currently supported by a PHY device
- * @phy: The PHY device to return supported speeds of.
- * @speeds: buffer to store supported speeds in.
- * @size: size of speeds buffer.
- *
- * Description: Returns the number of supported speeds, and fills
- * the speeds buffer with the supported speeds. If speeds buffer is
- * too small to contain all currently supported speeds, will return as
- * many speeds as can fit.
  */
 unsigned int phy_supported_speeds(struct phy_device *phy,
                                      unsigned int *speeds,
@@ -1022,14 +1014,9 @@ static inline int __phy_modify_changed(struct phy_device *phydev, u32 regnum,
                                        regnum, mask, set);
 }
 
-/**
+/*
  * phy_read_mmd - Convenience function for reading a register
  * from an MMD on a given PHY.
- * @phydev: The phy_device struct
- * @devad: The MMD to read from
- * @regnum: The register on the MMD to read
- *
- * Same rules as for phy_read();
  */
 int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
 
@@ -1064,38 +1051,21 @@ int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
        __ret; \
 })
 
-/**
+/*
  * __phy_read_mmd - Convenience function for reading a register
  * from an MMD on a given PHY.
- * @phydev: The phy_device struct
- * @devad: The MMD to read from
- * @regnum: The register on the MMD to read
- *
- * Same rules as for __phy_read();
  */
 int __phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
 
-/**
+/*
  * phy_write_mmd - Convenience function for writing a register
  * on an MMD on a given PHY.
- * @phydev: The phy_device struct
- * @devad: The MMD to write to
- * @regnum: The register on the MMD to read
- * @val: value to write to @regnum
- *
- * Same rules as for phy_write();
  */
 int phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val);
 
-/**
+/*
  * __phy_write_mmd - Convenience function for writing a register
  * on an MMD on a given PHY.
- * @phydev: The phy_device struct
- * @devad: The MMD to write to
- * @regnum: The register on the MMD to read
- * @val: value to write to @regnum
- *
- * Same rules as for __phy_write();
  */
 int __phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val);
 
@@ -1510,6 +1480,7 @@ int genphy_suspend(struct phy_device *phydev);
 int genphy_resume(struct phy_device *phydev);
 int genphy_loopback(struct phy_device *phydev, bool enable);
 int genphy_soft_reset(struct phy_device *phydev);
+irqreturn_t genphy_handle_interrupt_no_ack(struct phy_device *phydev);
 
 static inline int genphy_config_aneg(struct phy_device *phydev)
 {
@@ -1570,8 +1541,10 @@ void phy_drivers_unregister(struct phy_driver *drv, int n);
 int phy_driver_register(struct phy_driver *new_driver, struct module *owner);
 int phy_drivers_register(struct phy_driver *new_driver, int n,
                         struct module *owner);
+void phy_error(struct phy_device *phydev);
 void phy_state_machine(struct work_struct *work);
 void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies);
+void phy_trigger_machine(struct phy_device *phydev);
 void phy_mac_interrupt(struct phy_device *phydev);
 void phy_start_machine(struct phy_device *phydev);
 void phy_stop_machine(struct phy_device *phydev);
diff --git a/include/linux/platform_data/clk-s3c2410.h b/include/linux/platform_data/clk-s3c2410.h
new file mode 100644 (file)
index 0000000..7eb1cfa
--- /dev/null
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2020 Krzysztof Kozlowski <krzk@kernel.org>
+ */
+
+#ifndef __LINUX_PLATFORM_DATA_CLK_S3C2410_H_
+#define __LINUX_PLATFORM_DATA_CLK_S3C2410_H_
+
+/**
+ * struct s3c2410_clk_platform_data - platform data for S3C2410 clock driver
+ *
+ * @modify_misccr: Function to modify the MISCCR and return the new value
+ */
+struct s3c2410_clk_platform_data {
+       unsigned int (*modify_misccr)(unsigned int clr, unsigned int chg);
+};
+
+#endif /* __LINUX_PLATFORM_DATA_CLK_S3C2410_H_ */
+
index 1fcfe9e..a3a9a87 100644 (file)
@@ -1419,7 +1419,7 @@ struct ec_response_flash_info_2 {
        uint16_t num_banks_total;
        /* Number of banks described in banks array. */
        uint16_t num_banks_desc;
-       struct ec_flash_bank banks[0];
+       struct ec_flash_bank banks[];
 } __ec_align4;
 
 /*
@@ -2420,12 +2420,12 @@ struct ec_response_motion_sense_fifo_info {
        /* Total amount of vector lost */
        uint16_t total_lost;
        /* Lost events since the last fifo_info, per sensors */
-       uint16_t lost[0];
+       uint16_t lost[];
 } __ec_todo_packed;
 
 struct ec_response_motion_sense_fifo_data {
        uint32_t number_data;
-       struct ec_response_motion_sensor_data data[0];
+       struct ec_response_motion_sensor_data data[];
 } __ec_todo_packed;
 
 /* List supported activity recognition */
@@ -3093,7 +3093,7 @@ struct ec_response_tmp006_get_calibration_v1 {
        uint8_t algorithm;
        uint8_t num_params;
        uint8_t reserved[2];
-       float val[0];
+       float val[];
 } __ec_align4;
 
 struct ec_params_tmp006_set_calibration_v1 {
@@ -3101,7 +3101,7 @@ struct ec_params_tmp006_set_calibration_v1 {
        uint8_t algorithm;
        uint8_t num_params;
        uint8_t reserved;
-       float val[0];
+       float val[];
 } __ec_align4;
 
 
@@ -5076,7 +5076,7 @@ struct ec_response_pd_log {
        uint8_t type;       /* event type : see PD_EVENT_xx below */
        uint8_t size_port;  /* [7:5] port number [4:0] payload size in bytes */
        uint16_t data;      /* type-defined data payload */
-       uint8_t payload[0]; /* optional additional data payload: 0..16 bytes */
+       uint8_t payload[];  /* optional additional data payload: 0..16 bytes */
 } __ec_align4;
 
 /* The timestamp is the microsecond counter shifted to get about a ms. */
@@ -5789,7 +5789,7 @@ struct ec_response_fp_encryption_status {
 
 struct ec_response_tp_frame_info {
        uint32_t n_frames;
-       uint32_t frame_sizes[0];
+       uint32_t frame_sizes[];
 } __ec_align4;
 
 /* Create a snapshot of current frame readings */
index 4a415ae..0259968 100644 (file)
@@ -69,7 +69,7 @@ struct cros_ec_command {
        uint32_t outsize;
        uint32_t insize;
        uint32_t result;
-       uint8_t data[0];
+       uint8_t data[];
 };
 
 /**
similarity index 57%
rename from arch/arm/plat-samsung/include/plat/fb-s3c2410.h
rename to include/linux/platform_data/fb-s3c2410.h
index 614240d..10c11e6 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef __ASM_PLAT_FB_S3C2410_H
 #define __ASM_PLAT_FB_S3C2410_H __FILE__
 
+#include <linux/compiler_types.h>
+
 struct s3c2410fb_hw {
        unsigned long   lcdcon1;
        unsigned long   lcdcon2;
@@ -20,6 +22,17 @@ struct s3c2410fb_hw {
 struct s3c2410fb_display {
        /* LCD type */
        unsigned type;
+#define S3C2410_LCDCON1_DSCAN4    (0<<5)
+#define S3C2410_LCDCON1_STN4      (1<<5)
+#define S3C2410_LCDCON1_STN8      (2<<5)
+#define S3C2410_LCDCON1_TFT       (3<<5)
+
+#define S3C2410_LCDCON1_TFT1BPP           (8<<1)
+#define S3C2410_LCDCON1_TFT2BPP           (9<<1)
+#define S3C2410_LCDCON1_TFT4BPP           (10<<1)
+#define S3C2410_LCDCON1_TFT8BPP           (11<<1)
+#define S3C2410_LCDCON1_TFT16BPP   (12<<1)
+#define S3C2410_LCDCON1_TFT24BPP   (13<<1)
 
        /* Screen size */
        unsigned short width;
@@ -40,6 +53,19 @@ struct s3c2410fb_display {
 
        /* lcd configuration registers */
        unsigned long   lcdcon5;
+#define S3C2410_LCDCON5_BPP24BL            (1<<12)
+#define S3C2410_LCDCON5_FRM565     (1<<11)
+#define S3C2410_LCDCON5_INVVCLK            (1<<10)
+#define S3C2410_LCDCON5_INVVLINE    (1<<9)
+#define S3C2410_LCDCON5_INVVFRAME   (1<<8)
+#define S3C2410_LCDCON5_INVVD      (1<<7)
+#define S3C2410_LCDCON5_INVVDEN            (1<<6)
+#define S3C2410_LCDCON5_INVPWREN    (1<<5)
+#define S3C2410_LCDCON5_INVLEND            (1<<4)
+#define S3C2410_LCDCON5_PWREN      (1<<3)
+#define S3C2410_LCDCON5_ENLEND     (1<<2)
+#define S3C2410_LCDCON5_BSWP       (1<<1)
+#define S3C2410_LCDCON5_HWSWP      (1<<0)
 };
 
 struct s3c2410fb_mach_info {
@@ -59,10 +85,15 @@ struct s3c2410fb_mach_info {
        unsigned long   gpdcon;
        unsigned long   gpdcon_mask;
 
+       void __iomem *  gpccon_reg;
+       void __iomem *  gpcup_reg;
+       void __iomem *  gpdcon_reg;
+       void __iomem *  gpdup_reg;
+
        /* lpc3600 control register */
        unsigned long   lpcsel;
 };
 
-extern void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *);
+extern void s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *);
 
 #endif /* __ASM_PLAT_FB_S3C2410_H */
diff --git a/include/linux/platform_data/hirschmann-hellcreek.h b/include/linux/platform_data/hirschmann-hellcreek.h
new file mode 100644 (file)
index 0000000..3888467
--- /dev/null
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: (GPL-2.0 or MIT) */
+/*
+ * Hirschmann Hellcreek TSN switch platform data.
+ *
+ * Copyright (C) 2020 Linutronix GmbH
+ * Author Kurt Kanzenbach <kurt@linutronix.de>
+ */
+
+#ifndef _HIRSCHMANN_HELLCREEK_H_
+#define _HIRSCHMANN_HELLCREEK_H_
+
+#include <linux/types.h>
+
+struct hellcreek_platform_data {
+       int num_ports;          /* Amount of switch ports */
+       int is_100_mbits;       /* Is it configured to 100 or 1000 mbit/s */
+       int qbv_support;        /* Qbv support on front TSN ports */
+       int qbv_on_cpu_port;    /* Qbv support on the CPU port */
+       int qbu_support;        /* Qbu support on front TSN ports */
+       u16 module_id;          /* Module identificaton */
+};
+
+#endif /* _HIRSCHMANN_HELLCREEK_H_ */
index 33310b1..bacb86d 100644 (file)
@@ -35,6 +35,7 @@ struct s3c24xx_mci_pdata {
        unsigned long   ocr_avail;
        void            (*set_power)(unsigned char power_mode,
                                     unsigned short vdd);
+       struct gpio_desc *bus[6];
 };
 
 /**
@@ -44,6 +45,7 @@ struct s3c24xx_mci_pdata {
  * Copy the platform data supplied by @pdata so that this can be marked
  * __initdata.
  */
+extern void s3c24xx_mci_def_set_power(unsigned char power_mode, unsigned short vdd);
 extern void s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata);
 
 #endif /* _ARCH_NCI_H */
index 644af1d..7037ba7 100644 (file)
@@ -54,11 +54,8 @@ struct am33xx_pm_platform_data {
        void    (*begin_suspend)(void);
        void    (*finish_suspend)(void);
        struct  am33xx_pm_sram_addr *(*get_sram_addrs)(void);
-       void __iomem *(*get_rtc_base_addr)(void);
        void (*save_context)(void);
        void (*restore_context)(void);
-       void (*prepare_rtc_suspend)(void);
-       void (*prepare_rtc_resume)(void);
        int (*check_off_mode_enable)(void);
 };
 
index 4dc9b87..a170939 100644 (file)
@@ -26,6 +26,8 @@ struct s3c24xx_hsudc_platdata {
        unsigned int    epnum;
        void            (*gpio_init)(void);
        void            (*gpio_uninit)(void);
+       void            (*phy_init)(void);
+       void            (*phy_uninit)(void);
 };
 
 #endif /* __LINUX_USB_S3C_HSUDC_H */
index 66f3c5d..1ad0ec4 100644 (file)
@@ -68,6 +68,13 @@ enum gpd_status {
        GENPD_STATE_OFF,        /* PM domain is off */
 };
 
+enum genpd_notication {
+       GENPD_NOTIFY_PRE_OFF = 0,
+       GENPD_NOTIFY_OFF,
+       GENPD_NOTIFY_PRE_ON,
+       GENPD_NOTIFY_ON,
+};
+
 struct dev_power_governor {
        bool (*power_down_ok)(struct dev_pm_domain *domain);
        bool (*suspend_ok)(struct device *dev);
@@ -82,6 +89,8 @@ struct genpd_power_state {
        s64 power_off_latency_ns;
        s64 power_on_latency_ns;
        s64 residency_ns;
+       u64 usage;
+       u64 rejected;
        struct fwnode_handle *fwnode;
        ktime_t idle_time;
        void *data;
@@ -112,6 +121,7 @@ struct generic_pm_domain {
        cpumask_var_t cpus;             /* A cpumask of the attached CPUs */
        int (*power_off)(struct generic_pm_domain *domain);
        int (*power_on)(struct generic_pm_domain *domain);
+       struct raw_notifier_head power_notifiers; /* Power on/off notifiers */
        struct opp_table *opp_table;    /* OPP table of the genpd */
        unsigned int (*opp_to_performance_state)(struct generic_pm_domain *genpd,
                                                 struct dev_pm_opp *opp);
@@ -178,6 +188,7 @@ struct generic_pm_domain_data {
        struct pm_domain_data base;
        struct gpd_timing_data td;
        struct notifier_block nb;
+       struct notifier_block *power_nb;
        int cpu;
        unsigned int performance_state;
        void *data;
@@ -204,6 +215,8 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
                  struct dev_power_governor *gov, bool is_off);
 int pm_genpd_remove(struct generic_pm_domain *genpd);
 int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state);
+int dev_pm_genpd_add_notifier(struct device *dev, struct notifier_block *nb);
+int dev_pm_genpd_remove_notifier(struct device *dev);
 
 extern struct dev_power_governor simple_qos_governor;
 extern struct dev_power_governor pm_domain_always_on_gov;
@@ -251,6 +264,17 @@ static inline int dev_pm_genpd_set_performance_state(struct device *dev,
        return -ENOTSUPP;
 }
 
+static inline int dev_pm_genpd_add_notifier(struct device *dev,
+                                           struct notifier_block *nb)
+{
+       return -ENOTSUPP;
+}
+
+static inline int dev_pm_genpd_remove_notifier(struct device *dev)
+{
+       return -ENOTSUPP;
+}
+
 #define simple_qos_governor            (*(struct dev_power_governor *)(NULL))
 #define pm_domain_always_on_gov                (*(struct dev_power_governor *)(NULL))
 #endif
index 6245caa..4b708f4 100644 (file)
@@ -54,11 +54,10 @@ extern u64 pm_runtime_autosuspend_expiration(struct device *dev);
 extern void pm_runtime_update_max_time_suspended(struct device *dev,
                                                 s64 delta_ns);
 extern void pm_runtime_set_memalloc_noio(struct device *dev, bool enable);
-extern void pm_runtime_clean_up_links(struct device *dev);
 extern void pm_runtime_get_suppliers(struct device *dev);
 extern void pm_runtime_put_suppliers(struct device *dev);
 extern void pm_runtime_new_link(struct device *dev);
-extern void pm_runtime_drop_link(struct device *dev);
+extern void pm_runtime_drop_link(struct device_link *link);
 
 /**
  * pm_runtime_get_if_in_use - Conditionally bump up runtime PM usage counter.
@@ -276,11 +275,10 @@ static inline u64 pm_runtime_autosuspend_expiration(
                                struct device *dev) { return 0; }
 static inline void pm_runtime_set_memalloc_noio(struct device *dev,
                                                bool enable){}
-static inline void pm_runtime_clean_up_links(struct device *dev) {}
 static inline void pm_runtime_get_suppliers(struct device *dev) {}
 static inline void pm_runtime_put_suppliers(struct device *dev) {}
 static inline void pm_runtime_new_link(struct device *dev) {}
-static inline void pm_runtime_drop_link(struct device *dev) {}
+static inline void pm_runtime_drop_link(struct device_link *link) {}
 
 #endif /* !CONFIG_PM */
 
@@ -479,7 +477,7 @@ static inline int pm_runtime_set_active(struct device *dev)
 }
 
 /**
- * pm_runtime_set_suspended - Set runtime PM status to "active".
+ * pm_runtime_set_suspended - Set runtime PM status to "suspended".
  * @dev: Target device.
  *
  * Set the runtime PM status of @dev to %RPM_SUSPENDED and ensure that
index aa16e64..bbf4b4a 100644 (file)
@@ -16,12 +16,62 @@ void prandom_bytes(void *buf, size_t nbytes);
 void prandom_seed(u32 seed);
 void prandom_reseed_late(void);
 
+DECLARE_PER_CPU(unsigned long, net_rand_noise);
+
+#define PRANDOM_ADD_NOISE(a, b, c, d) \
+       prandom_u32_add_noise((unsigned long)(a), (unsigned long)(b), \
+                             (unsigned long)(c), (unsigned long)(d))
+
+#if BITS_PER_LONG == 64
+/*
+ * The core SipHash round function.  Each line can be executed in
+ * parallel given enough CPU resources.
+ */
+#define PRND_SIPROUND(v0, v1, v2, v3) ( \
+       v0 += v1, v1 = rol64(v1, 13),  v2 += v3, v3 = rol64(v3, 16), \
+       v1 ^= v0, v0 = rol64(v0, 32),  v3 ^= v2,                     \
+       v0 += v3, v3 = rol64(v3, 21),  v2 += v1, v1 = rol64(v1, 17), \
+       v3 ^= v0,                      v1 ^= v2, v2 = rol64(v2, 32)  \
+)
+
+#define PRND_K0 (0x736f6d6570736575 ^ 0x6c7967656e657261)
+#define PRND_K1 (0x646f72616e646f6d ^ 0x7465646279746573)
+
+#elif BITS_PER_LONG == 32
+/*
+ * On 32-bit machines, we use HSipHash, a reduced-width version of SipHash.
+ * This is weaker, but 32-bit machines are not used for high-traffic
+ * applications, so there is less output for an attacker to analyze.
+ */
+#define PRND_SIPROUND(v0, v1, v2, v3) ( \
+       v0 += v1, v1 = rol32(v1,  5),  v2 += v3, v3 = rol32(v3,  8), \
+       v1 ^= v0, v0 = rol32(v0, 16),  v3 ^= v2,                     \
+       v0 += v3, v3 = rol32(v3,  7),  v2 += v1, v1 = rol32(v1, 13), \
+       v3 ^= v0,                      v1 ^= v2, v2 = rol32(v2, 16)  \
+)
+#define PRND_K0 0x6c796765
+#define PRND_K1 0x74656462
+
+#else
+#error Unsupported BITS_PER_LONG
+#endif
+
+static inline void prandom_u32_add_noise(unsigned long a, unsigned long b,
+                                        unsigned long c, unsigned long d)
+{
+       /*
+        * This is not used cryptographically; it's just
+        * a convenient 4-word hash function. (3 xor, 2 add, 2 rol)
+        */
+       a ^= raw_cpu_read(net_rand_noise);
+       PRND_SIPROUND(a, b, c, d);
+       raw_cpu_write(net_rand_noise, d);
+}
+
 struct rnd_state {
        __u32 s1, s2, s3, s4;
 };
 
-DECLARE_PER_CPU(struct rnd_state, net_rand_state);
-
 u32 prandom_u32_state(struct rnd_state *state);
 void prandom_bytes_state(struct rnd_state *state, void *buf, size_t nbytes);
 void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state);
@@ -67,6 +117,7 @@ static inline void prandom_seed_state(struct rnd_state *state, u64 seed)
        state->s2 = __seed(i,   8U);
        state->s3 = __seed(i,  16U);
        state->s4 = __seed(i, 128U);
+       PRANDOM_ADD_NOISE(state, i, 0, 0);
 }
 
 /* Pseudo random number generator from numerical recipes. */
index 7847963..fe7eb23 100644 (file)
@@ -437,7 +437,7 @@ extern int kptr_restrict;
 #ifdef CONFIG_PRINTK
 #define printk_once(fmt, ...)                                  \
 ({                                                             \
-       static bool __section(.data.once) __print_once;         \
+       static bool __section(".data.once") __print_once;       \
        bool __ret_print_once = !__print_once;                  \
                                                                \
        if (!__print_once) {                                    \
@@ -448,7 +448,7 @@ extern int kptr_restrict;
 })
 #define printk_deferred_once(fmt, ...)                         \
 ({                                                             \
-       static bool __section(.data.once) __print_once;         \
+       static bool __section(".data.once") __print_once;       \
        bool __ret_print_once = !__print_once;                  \
                                                                \
        if (!__print_once) {                                    \
diff --git a/include/linux/pruss_driver.h b/include/linux/pruss_driver.h
new file mode 100644 (file)
index 0000000..ecfded3
--- /dev/null
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * PRU-ICSS sub-system specific definitions
+ *
+ * Copyright (C) 2014-2020 Texas Instruments Incorporated - http://www.ti.com/
+ *     Suman Anna <s-anna@ti.com>
+ */
+
+#ifndef _PRUSS_DRIVER_H_
+#define _PRUSS_DRIVER_H_
+
+#include <linux/types.h>
+
+/*
+ * enum pruss_mem - PRUSS memory range identifiers
+ */
+enum pruss_mem {
+       PRUSS_MEM_DRAM0 = 0,
+       PRUSS_MEM_DRAM1,
+       PRUSS_MEM_SHRD_RAM2,
+       PRUSS_MEM_MAX,
+};
+
+/**
+ * struct pruss_mem_region - PRUSS memory region structure
+ * @va: kernel virtual address of the PRUSS memory region
+ * @pa: physical (bus) address of the PRUSS memory region
+ * @size: size of the PRUSS memory region
+ */
+struct pruss_mem_region {
+       void __iomem *va;
+       phys_addr_t pa;
+       size_t size;
+};
+
+/**
+ * struct pruss - PRUSS parent structure
+ * @dev: pruss device pointer
+ * @cfg_base: base iomap for CFG region
+ * @cfg_regmap: regmap for config region
+ * @mem_regions: data for each of the PRUSS memory regions
+ * @core_clk_mux: clk handle for PRUSS CORE_CLK_MUX
+ * @iep_clk_mux: clk handle for PRUSS IEP_CLK_MUX
+ */
+struct pruss {
+       struct device *dev;
+       void __iomem *cfg_base;
+       struct regmap *cfg_regmap;
+       struct pruss_mem_region mem_regions[PRUSS_MEM_MAX];
+       struct clk *core_clk_mux;
+       struct clk *iep_clk_mux;
+};
+
+#endif /* _PRUSS_DRIVER_H_ */
index 1c31f26..f7bbea3 100644 (file)
@@ -299,7 +299,7 @@ static inline void geni_se_setup_m_cmd(struct geni_se *se, u32 cmd, u32 params)
        u32 m_cmd;
 
        m_cmd = (cmd << M_OPCODE_SHFT) | (params & M_PARAMS_MSK);
-       writel_relaxed(m_cmd, se->base + SE_GENI_M_CMD0);
+       writel(m_cmd, se->base + SE_GENI_M_CMD0);
 }
 
 /**
@@ -319,7 +319,7 @@ static inline void geni_se_setup_s_cmd(struct geni_se *se, u32 cmd, u32 params)
        s_cmd &= ~(S_OPCODE_MSK | S_PARAMS_MSK);
        s_cmd |= (cmd << S_OPCODE_SHFT);
        s_cmd |= (params & S_PARAMS_MSK);
-       writel_relaxed(s_cmd, se->base + SE_GENI_S_CMD0);
+       writel(s_cmd, se->base + SE_GENI_S_CMD0);
 }
 
 /**
index 7c1ceff..6cdd015 100644 (file)
@@ -299,7 +299,7 @@ static inline int rcu_read_lock_any_held(void)
  */
 #define RCU_LOCKDEP_WARN(c, s)                                         \
        do {                                                            \
-               static bool __section(.data.unlikely) __warned;         \
+               static bool __section(".data.unlikely") __warned;       \
                if (debug_lockdep_rcu_enabled() && !__warned && (c)) {  \
                        __warned = true;                                \
                        lockdep_rcu_suspicious(__FILE__, __LINE__, s);  \
index 7fabb1a..497990c 100644 (file)
@@ -147,24 +147,6 @@ static inline unsigned int refcount_read(const refcount_t *r)
        return atomic_read(&r->refs);
 }
 
-/**
- * refcount_add_not_zero - add a value to a refcount unless it is 0
- * @i: the value to add to the refcount
- * @r: the refcount
- *
- * Will saturate at REFCOUNT_SATURATED and WARN.
- *
- * Provides no memory ordering, it is assumed the caller has guaranteed the
- * object memory to be stable (RCU, etc.). It does provide a control dependency
- * and thereby orders future stores. See the comment on top.
- *
- * Use of this function is not recommended for the normal reference counting
- * use case in which references are taken and released one at a time.  In these
- * cases, refcount_inc(), or one of its variants, should instead be used to
- * increment a reference count.
- *
- * Return: false if the passed refcount is 0, true otherwise
- */
 static inline __must_check bool __refcount_add_not_zero(int i, refcount_t *r, int *oldp)
 {
        int old = refcount_read(r);
@@ -183,17 +165,12 @@ static inline __must_check bool __refcount_add_not_zero(int i, refcount_t *r, in
        return old;
 }
 
-static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r)
-{
-       return __refcount_add_not_zero(i, r, NULL);
-}
-
 /**
- * refcount_add - add a value to a refcount
+ * refcount_add_not_zero - add a value to a refcount unless it is 0
  * @i: the value to add to the refcount
  * @r: the refcount
  *
- * Similar to atomic_add(), but will saturate at REFCOUNT_SATURATED and WARN.
+ * Will saturate at REFCOUNT_SATURATED and WARN.
  *
  * Provides no memory ordering, it is assumed the caller has guaranteed the
  * object memory to be stable (RCU, etc.). It does provide a control dependency
@@ -203,7 +180,14 @@ static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r)
  * use case in which references are taken and released one at a time.  In these
  * cases, refcount_inc(), or one of its variants, should instead be used to
  * increment a reference count.
+ *
+ * Return: false if the passed refcount is 0, true otherwise
  */
+static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r)
+{
+       return __refcount_add_not_zero(i, r, NULL);
+}
+
 static inline void __refcount_add(int i, refcount_t *r, int *oldp)
 {
        int old = atomic_fetch_add_relaxed(i, &r->refs);
@@ -217,11 +201,32 @@ static inline void __refcount_add(int i, refcount_t *r, int *oldp)
                refcount_warn_saturate(r, REFCOUNT_ADD_OVF);
 }
 
+/**
+ * refcount_add - add a value to a refcount
+ * @i: the value to add to the refcount
+ * @r: the refcount
+ *
+ * Similar to atomic_add(), but will saturate at REFCOUNT_SATURATED and WARN.
+ *
+ * Provides no memory ordering, it is assumed the caller has guaranteed the
+ * object memory to be stable (RCU, etc.). It does provide a control dependency
+ * and thereby orders future stores. See the comment on top.
+ *
+ * Use of this function is not recommended for the normal reference counting
+ * use case in which references are taken and released one at a time.  In these
+ * cases, refcount_inc(), or one of its variants, should instead be used to
+ * increment a reference count.
+ */
 static inline void refcount_add(int i, refcount_t *r)
 {
        __refcount_add(i, r, NULL);
 }
 
+static inline __must_check bool __refcount_inc_not_zero(refcount_t *r, int *oldp)
+{
+       return __refcount_add_not_zero(1, r, oldp);
+}
+
 /**
  * refcount_inc_not_zero - increment a refcount unless it is 0
  * @r: the refcount to increment
@@ -235,14 +240,14 @@ static inline void refcount_add(int i, refcount_t *r)
  *
  * Return: true if the increment was successful, false otherwise
  */
-static inline __must_check bool __refcount_inc_not_zero(refcount_t *r, int *oldp)
+static inline __must_check bool refcount_inc_not_zero(refcount_t *r)
 {
-       return __refcount_add_not_zero(1, r, oldp);
+       return __refcount_inc_not_zero(r, NULL);
 }
 
-static inline __must_check bool refcount_inc_not_zero(refcount_t *r)
+static inline void __refcount_inc(refcount_t *r, int *oldp)
 {
-       return __refcount_inc_not_zero(r, NULL);
+       __refcount_add(1, r, oldp);
 }
 
 /**
@@ -257,14 +262,27 @@ static inline __must_check bool refcount_inc_not_zero(refcount_t *r)
  * Will WARN if the refcount is 0, as this represents a possible use-after-free
  * condition.
  */
-static inline void __refcount_inc(refcount_t *r, int *oldp)
+static inline void refcount_inc(refcount_t *r)
 {
-       __refcount_add(1, r, oldp);
+       __refcount_inc(r, NULL);
 }
 
-static inline void refcount_inc(refcount_t *r)
+static inline __must_check bool __refcount_sub_and_test(int i, refcount_t *r, int *oldp)
 {
-       __refcount_inc(r, NULL);
+       int old = atomic_fetch_sub_release(i, &r->refs);
+
+       if (oldp)
+               *oldp = old;
+
+       if (old == i) {
+               smp_acquire__after_ctrl_dep();
+               return true;
+       }
+
+       if (unlikely(old < 0 || old - i < 0))
+               refcount_warn_saturate(r, REFCOUNT_SUB_UAF);
+
+       return false;
 }
 
 /**
@@ -287,27 +305,14 @@ static inline void refcount_inc(refcount_t *r)
  *
  * Return: true if the resulting refcount is 0, false otherwise
  */
-static inline __must_check bool __refcount_sub_and_test(int i, refcount_t *r, int *oldp)
+static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r)
 {
-       int old = atomic_fetch_sub_release(i, &r->refs);
-
-       if (oldp)
-               *oldp = old;
-
-       if (old == i) {
-               smp_acquire__after_ctrl_dep();
-               return true;
-       }
-
-       if (unlikely(old < 0 || old - i < 0))
-               refcount_warn_saturate(r, REFCOUNT_SUB_UAF);
-
-       return false;
+       return __refcount_sub_and_test(i, r, NULL);
 }
 
-static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r)
+static inline __must_check bool __refcount_dec_and_test(refcount_t *r, int *oldp)
 {
-       return __refcount_sub_and_test(i, r, NULL);
+       return __refcount_sub_and_test(1, r, oldp);
 }
 
 /**
@@ -323,26 +328,11 @@ static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r)
  *
  * Return: true if the resulting refcount is 0, false otherwise
  */
-static inline __must_check bool __refcount_dec_and_test(refcount_t *r, int *oldp)
-{
-       return __refcount_sub_and_test(1, r, oldp);
-}
-
 static inline __must_check bool refcount_dec_and_test(refcount_t *r)
 {
        return __refcount_dec_and_test(r, NULL);
 }
 
-/**
- * refcount_dec - decrement a refcount
- * @r: the refcount
- *
- * Similar to atomic_dec(), it will WARN on underflow and fail to decrement
- * when saturated at REFCOUNT_SATURATED.
- *
- * Provides release memory ordering, such that prior loads and stores are done
- * before.
- */
 static inline void __refcount_dec(refcount_t *r, int *oldp)
 {
        int old = atomic_fetch_sub_release(1, &r->refs);
@@ -354,6 +344,16 @@ static inline void __refcount_dec(refcount_t *r, int *oldp)
                refcount_warn_saturate(r, REFCOUNT_DEC_LEAK);
 }
 
+/**
+ * refcount_dec - decrement a refcount
+ * @r: the refcount
+ *
+ * Similar to atomic_dec(), it will WARN on underflow and fail to decrement
+ * when saturated at REFCOUNT_SATURATED.
+ *
+ * Provides release memory ordering, such that prior loads and stores are done
+ * before.
+ */
 static inline void refcount_dec(refcount_t *r)
 {
        __refcount_dec(r, NULL);
index 8ed37f9..ab7eea0 100644 (file)
@@ -102,15 +102,16 @@ struct rmi_2d_sensor_platform_data {
 };
 
 /**
- * struct rmi_f30_data - overrides defaults for a single F30 GPIOs/LED chip.
+ * struct rmi_gpio_data - overrides defaults for a single F30/F3A GPIOs/LED
+ * chip.
  * @buttonpad - the touchpad is a buttonpad, so enable only the first actual
  * button that is found.
- * @trackstick_buttons - Set when the function 30 is handling the physical
+ * @trackstick_buttons - Set when the function 30 or 3a is handling the physical
  * buttons of the trackstick (as a PS/2 passthrough device).
- * @disable - the touchpad incorrectly reports F30 and it should be ignored.
+ * @disable - the touchpad incorrectly reports F30/F3A and it should be ignored.
  * This is a special case which is due to misconfigured firmware.
  */
-struct rmi_f30_data {
+struct rmi_gpio_data {
        bool buttonpad;
        bool trackstick_buttons;
        bool disable;
@@ -218,7 +219,7 @@ struct rmi_device_platform_data {
        /* function handler pdata */
        struct rmi_2d_sensor_platform_data sensor_pdata;
        struct rmi_f01_power_management power_management;
-       struct rmi_f30_data f30_data;
+       struct rmi_gpio_data gpio_data;
 };
 
 /**
index 00c45a0..ae51f45 100644 (file)
@@ -43,7 +43,7 @@ extern void proc_sched_set_task(struct task_struct *p);
 #endif
 
 /* Attach to any functions which should be ignored in wchan output. */
-#define __sched                __attribute__((__section__(".sched.text")))
+#define __sched                __section(".sched.text")
 
 /* Linker adds these: start and end of __sched functions */
 extern char __sched_text_start[], __sched_text_end[];
diff --git a/include/linux/scif.h b/include/linux/scif.h
deleted file mode 100644 (file)
index 329e695..0000000
+++ /dev/null
@@ -1,1339 +0,0 @@
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License 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.
- *
- * BSD LICENSE
- *
- * Copyright(c) 2014 Intel Corporation.
- *
- * 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 Intel 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.
- *
- * Intel SCIF driver.
- *
- */
-#ifndef __SCIF_H__
-#define __SCIF_H__
-
-#include <linux/types.h>
-#include <linux/poll.h>
-#include <linux/device.h>
-#include <linux/scif_ioctl.h>
-
-#define SCIF_ACCEPT_SYNC       1
-#define SCIF_SEND_BLOCK                1
-#define SCIF_RECV_BLOCK                1
-
-enum {
-       SCIF_PROT_READ = (1 << 0),
-       SCIF_PROT_WRITE = (1 << 1)
-};
-
-enum {
-       SCIF_MAP_FIXED = 0x10,
-       SCIF_MAP_KERNEL = 0x20,
-};
-
-enum {
-       SCIF_FENCE_INIT_SELF = (1 << 0),
-       SCIF_FENCE_INIT_PEER = (1 << 1),
-       SCIF_SIGNAL_LOCAL = (1 << 4),
-       SCIF_SIGNAL_REMOTE = (1 << 5)
-};
-
-enum {
-       SCIF_RMA_USECPU = (1 << 0),
-       SCIF_RMA_USECACHE = (1 << 1),
-       SCIF_RMA_SYNC = (1 << 2),
-       SCIF_RMA_ORDERED = (1 << 3)
-};
-
-/* End of SCIF Admin Reserved Ports */
-#define SCIF_ADMIN_PORT_END    1024
-
-/* End of SCIF Reserved Ports */
-#define SCIF_PORT_RSVD         1088
-
-typedef struct scif_endpt *scif_epd_t;
-typedef struct scif_pinned_pages *scif_pinned_pages_t;
-
-/**
- * struct scif_range - SCIF registered range used in kernel mode
- * @cookie: cookie used internally by SCIF
- * @nr_pages: number of pages of PAGE_SIZE
- * @prot_flags: R/W protection
- * @phys_addr: Array of bus addresses
- * @va: Array of kernel virtual addresses backed by the pages in the phys_addr
- *     array. The va is populated only when called on the host for a remote
- *     SCIF connection on MIC. This is required to support the use case of DMA
- *     between MIC and another device which is not a SCIF node e.g., an IB or
- *     ethernet NIC.
- */
-struct scif_range {
-       void *cookie;
-       int nr_pages;
-       int prot_flags;
-       dma_addr_t *phys_addr;
-       void __iomem **va;
-};
-
-/**
- * struct scif_pollepd - SCIF endpoint to be monitored via scif_poll
- * @epd: SCIF endpoint
- * @events: requested events
- * @revents: returned events
- */
-struct scif_pollepd {
-       scif_epd_t epd;
-       __poll_t events;
-       __poll_t revents;
-};
-
-/**
- * scif_peer_dev - representation of a peer SCIF device
- *
- * Peer devices show up as PCIe devices for the mgmt node but not the cards.
- * The mgmt node discovers all the cards on the PCIe bus and informs the other
- * cards about their peers. Upon notification of a peer a node adds a peer
- * device to the peer bus to maintain symmetry in the way devices are
- * discovered across all nodes in the SCIF network.
- *
- * @dev: underlying device
- * @dnode - The destination node which this device will communicate with.
- */
-struct scif_peer_dev {
-       struct device dev;
-       u8 dnode;
-};
-
-/**
- * scif_client - representation of a SCIF client
- * @name: client name
- * @probe - client method called when a peer device is registered
- * @remove - client method called when a peer device is unregistered
- * @si - subsys_interface used internally for implementing SCIF clients
- */
-struct scif_client {
-       const char *name;
-       void (*probe)(struct scif_peer_dev *spdev);
-       void (*remove)(struct scif_peer_dev *spdev);
-       struct subsys_interface si;
-};
-
-#define SCIF_OPEN_FAILED ((scif_epd_t)-1)
-#define SCIF_REGISTER_FAILED ((off_t)-1)
-#define SCIF_MMAP_FAILED ((void *)-1)
-
-/**
- * scif_open() - Create an endpoint
- *
- * Return:
- * Upon successful completion, scif_open() returns an endpoint descriptor to
- * be used in subsequent SCIF functions calls to refer to that endpoint;
- * otherwise in user mode SCIF_OPEN_FAILED (that is ((scif_epd_t)-1)) is
- * returned and errno is set to indicate the error; in kernel mode a NULL
- * scif_epd_t is returned.
- *
- * Errors:
- * ENOMEM - Insufficient kernel memory was available
- */
-scif_epd_t scif_open(void);
-
-/**
- * scif_bind() - Bind an endpoint to a port
- * @epd:       endpoint descriptor
- * @pn:                port number
- *
- * scif_bind() binds endpoint epd to port pn, where pn is a port number on the
- * local node. If pn is zero, a port number greater than or equal to
- * SCIF_PORT_RSVD is assigned and returned. Each endpoint may be bound to
- * exactly one local port. Ports less than 1024 when requested can only be bound
- * by system (or root) processes or by processes executed by privileged users.
- *
- * Return:
- * Upon successful completion, scif_bind() returns the port number to which epd
- * is bound; otherwise in user mode -1 is returned and errno is set to
- * indicate the error; in kernel mode the negative of one of the following
- * errors is returned.
- *
- * Errors:
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * EINVAL - the endpoint or the port is already bound
- * EISCONN - The endpoint is already connected
- * ENOSPC - No port number available for assignment
- * EACCES - The port requested is protected and the user is not the superuser
- */
-int scif_bind(scif_epd_t epd, u16 pn);
-
-/**
- * scif_listen() - Listen for connections on an endpoint
- * @epd:       endpoint descriptor
- * @backlog:   maximum pending connection requests
- *
- * scif_listen() marks the endpoint epd as a listening endpoint - that is, as
- * an endpoint that will be used to accept incoming connection requests. Once
- * so marked, the endpoint is said to be in the listening state and may not be
- * used as the endpoint of a connection.
- *
- * The endpoint, epd, must have been bound to a port.
- *
- * The backlog argument defines the maximum length to which the queue of
- * pending connections for epd may grow. If a connection request arrives when
- * the queue is full, the client may receive an error with an indication that
- * the connection was refused.
- *
- * Return:
- * Upon successful completion, scif_listen() returns 0; otherwise in user mode
- * -1 is returned and errno is set to indicate the error; in kernel mode the
- * negative of one of the following errors is returned.
- *
- * Errors:
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * EINVAL - the endpoint is not bound to a port
- * EISCONN - The endpoint is already connected or listening
- */
-int scif_listen(scif_epd_t epd, int backlog);
-
-/**
- * scif_connect() - Initiate a connection on a port
- * @epd:       endpoint descriptor
- * @dst:       global id of port to which to connect
- *
- * The scif_connect() function requests the connection of endpoint epd to remote
- * port dst. If the connection is successful, a peer endpoint, bound to dst, is
- * created on node dst.node. On successful return, the connection is complete.
- *
- * If the endpoint epd has not already been bound to a port, scif_connect()
- * will bind it to an unused local port.
- *
- * A connection is terminated when an endpoint of the connection is closed,
- * either explicitly by scif_close(), or when a process that owns one of the
- * endpoints of the connection is terminated.
- *
- * In user space, scif_connect() supports an asynchronous connection mode
- * if the application has set the O_NONBLOCK flag on the endpoint via the
- * fcntl() system call. Setting this flag will result in the calling process
- * not to wait during scif_connect().
- *
- * Return:
- * Upon successful completion, scif_connect() returns the port ID to which the
- * endpoint, epd, is bound; otherwise in user mode -1 is returned and errno is
- * set to indicate the error; in kernel mode the negative of one of the
- * following errors is returned.
- *
- * Errors:
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * ECONNREFUSED - The destination was not listening for connections or refused
- * the connection request
- * EINVAL - dst.port is not a valid port ID
- * EISCONN - The endpoint is already connected
- * ENOMEM - No buffer space is available
- * ENODEV - The destination node does not exist, or the node is lost or existed,
- * but is not currently in the network since it may have crashed
- * ENOSPC - No port number available for assignment
- * EOPNOTSUPP - The endpoint is listening and cannot be connected
- */
-int scif_connect(scif_epd_t epd, struct scif_port_id *dst);
-
-/**
- * scif_accept() - Accept a connection on an endpoint
- * @epd:       endpoint descriptor
- * @peer:      global id of port to which connected
- * @newepd:    new connected endpoint descriptor
- * @flags:     flags
- *
- * The scif_accept() call extracts the first connection request from the queue
- * of pending connections for the port on which epd is listening. scif_accept()
- * creates a new endpoint, bound to the same port as epd, and allocates a new
- * SCIF endpoint descriptor, returned in newepd, for the endpoint. The new
- * endpoint is connected to the endpoint through which the connection was
- * requested. epd is unaffected by this call, and remains in the listening
- * state.
- *
- * On successful return, peer holds the global port identifier (node id and
- * local port number) of the port which requested the connection.
- *
- * A connection is terminated when an endpoint of the connection is closed,
- * either explicitly by scif_close(), or when a process that owns one of the
- * endpoints of the connection is terminated.
- *
- * The number of connections that can (subsequently) be accepted on epd is only
- * limited by system resources (memory).
- *
- * The flags argument is formed by OR'ing together zero or more of the
- * following values.
- * SCIF_ACCEPT_SYNC - block until a connection request is presented. If
- *                     SCIF_ACCEPT_SYNC is not in flags, and no pending
- *                     connections are present on the queue, scif_accept()
- *                     fails with an EAGAIN error
- *
- * In user mode, the select() and poll() functions can be used to determine
- * when there is a connection request. In kernel mode, the scif_poll()
- * function may be used for this purpose. A readable event will be delivered
- * when a connection is requested.
- *
- * Return:
- * Upon successful completion, scif_accept() returns 0; otherwise in user mode
- * -1 is returned and errno is set to indicate the error; in kernel mode the
- *     negative of one of the following errors is returned.
- *
- * Errors:
- * EAGAIN - SCIF_ACCEPT_SYNC is not set and no connections are present to be
- * accepted or SCIF_ACCEPT_SYNC is not set and remote node failed to complete
- * its connection request
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * EINTR - Interrupted function
- * EINVAL - epd is not a listening endpoint, or flags is invalid, or peer is
- * NULL, or newepd is NULL
- * ENODEV - The requesting node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOMEM - Not enough space
- * ENOENT - Secondary part of epd registration failed
- */
-int scif_accept(scif_epd_t epd, struct scif_port_id *peer, scif_epd_t
-               *newepd, int flags);
-
-/**
- * scif_close() - Close an endpoint
- * @epd:       endpoint descriptor
- *
- * scif_close() closes an endpoint and performs necessary teardown of
- * facilities associated with that endpoint.
- *
- * If epd is a listening endpoint then it will no longer accept connection
- * requests on the port to which it is bound. Any pending connection requests
- * are rejected.
- *
- * If epd is a connected endpoint, then its peer endpoint is also closed. RMAs
- * which are in-process through epd or its peer endpoint will complete before
- * scif_close() returns. Registered windows of the local and peer endpoints are
- * released as if scif_unregister() was called against each window.
- *
- * Closing a SCIF endpoint does not affect local registered memory mapped by
- * a SCIF endpoint on a remote node. The local memory remains mapped by the peer
- * SCIF endpoint explicitly removed by calling munmap(..) by the peer.
- *
- * If the peer endpoint's receive queue is not empty at the time that epd is
- * closed, then the peer endpoint can be passed as the endpoint parameter to
- * scif_recv() until the receive queue is empty.
- *
- * epd is freed and may no longer be accessed.
- *
- * Return:
- * Upon successful completion, scif_close() returns 0; otherwise in user mode
- * -1 is returned and errno is set to indicate the error; in kernel mode the
- * negative of one of the following errors is returned.
- *
- * Errors:
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- */
-int scif_close(scif_epd_t epd);
-
-/**
- * scif_send() - Send a message
- * @epd:       endpoint descriptor
- * @msg:       message buffer address
- * @len:       message length
- * @flags:     blocking mode flags
- *
- * scif_send() sends data to the peer of endpoint epd. Up to len bytes of data
- * are copied from memory starting at address msg. On successful execution the
- * return value of scif_send() is the number of bytes that were sent, and is
- * zero if no bytes were sent because len was zero. scif_send() may be called
- * only when the endpoint is in a connected state.
- *
- * If a scif_send() call is non-blocking, then it sends only those bytes which
- * can be sent without waiting, up to a maximum of len bytes.
- *
- * If a scif_send() call is blocking, then it normally returns after sending
- * all len bytes. If a blocking call is interrupted or the connection is
- * reset, the call is considered successful if some bytes were sent or len is
- * zero, otherwise the call is considered unsuccessful.
- *
- * In user mode, the select() and poll() functions can be used to determine
- * when the send queue is not full. In kernel mode, the scif_poll() function
- * may be used for this purpose.
- *
- * It is recommended that scif_send()/scif_recv() only be used for short
- * control-type message communication between SCIF endpoints. The SCIF RMA
- * APIs are expected to provide better performance for transfer sizes of
- * 1024 bytes or longer for the current MIC hardware and software
- * implementation.
- *
- * scif_send() will block until the entire message is sent if SCIF_SEND_BLOCK
- * is passed as the flags argument.
- *
- * Return:
- * Upon successful completion, scif_send() returns the number of bytes sent;
- * otherwise in user mode -1 is returned and errno is set to indicate the
- * error; in kernel mode the negative of one of the following errors is
- * returned.
- *
- * Errors:
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * ECONNRESET - Connection reset by peer
- * EINVAL - flags is invalid, or len is negative
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOMEM - Not enough space
- * ENOTCONN - The endpoint is not connected
- */
-int scif_send(scif_epd_t epd, void *msg, int len, int flags);
-
-/**
- * scif_recv() - Receive a message
- * @epd:       endpoint descriptor
- * @msg:       message buffer address
- * @len:       message buffer length
- * @flags:     blocking mode flags
- *
- * scif_recv() receives data from the peer of endpoint epd. Up to len bytes of
- * data are copied to memory starting at address msg. On successful execution
- * the return value of scif_recv() is the number of bytes that were received,
- * and is zero if no bytes were received because len was zero. scif_recv() may
- * be called only when the endpoint is in a connected state.
- *
- * If a scif_recv() call is non-blocking, then it receives only those bytes
- * which can be received without waiting, up to a maximum of len bytes.
- *
- * If a scif_recv() call is blocking, then it normally returns after receiving
- * all len bytes. If the blocking call was interrupted due to a disconnection,
- * subsequent calls to scif_recv() will copy all bytes received upto the point
- * of disconnection.
- *
- * In user mode, the select() and poll() functions can be used to determine
- * when data is available to be received. In kernel mode, the scif_poll()
- * function may be used for this purpose.
- *
- * It is recommended that scif_send()/scif_recv() only be used for short
- * control-type message communication between SCIF endpoints. The SCIF RMA
- * APIs are expected to provide better performance for transfer sizes of
- * 1024 bytes or longer for the current MIC hardware and software
- * implementation.
- *
- * scif_recv() will block until the entire message is received if
- * SCIF_RECV_BLOCK is passed as the flags argument.
- *
- * Return:
- * Upon successful completion, scif_recv() returns the number of bytes
- * received; otherwise in user mode -1 is returned and errno is set to
- * indicate the error; in kernel mode the negative of one of the following
- * errors is returned.
- *
- * Errors:
- * EAGAIN - The destination node is returning from a low power state
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * ECONNRESET - Connection reset by peer
- * EINVAL - flags is invalid, or len is negative
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOMEM - Not enough space
- * ENOTCONN - The endpoint is not connected
- */
-int scif_recv(scif_epd_t epd, void *msg, int len, int flags);
-
-/**
- * scif_register() - Mark a memory region for remote access.
- * @epd:               endpoint descriptor
- * @addr:              starting virtual address
- * @len:               length of range
- * @offset:            offset of window
- * @prot_flags:                read/write protection flags
- * @map_flags:         mapping flags
- *
- * The scif_register() function opens a window, a range of whole pages of the
- * registered address space of the endpoint epd, starting at offset po and
- * continuing for len bytes. The value of po, further described below, is a
- * function of the parameters offset and len, and the value of map_flags. Each
- * page of the window represents the physical memory page which backs the
- * corresponding page of the range of virtual address pages starting at addr
- * and continuing for len bytes. addr and len are constrained to be multiples
- * of the page size. A successful scif_register() call returns po.
- *
- * When SCIF_MAP_FIXED is set in the map_flags argument, po will be offset
- * exactly, and offset is constrained to be a multiple of the page size. The
- * mapping established by scif_register() will not replace any existing
- * registration; an error is returned if any page within the range [offset,
- * offset + len - 1] intersects an existing window.
- *
- * When SCIF_MAP_FIXED is not set, the implementation uses offset in an
- * implementation-defined manner to arrive at po. The po value so chosen will
- * be an area of the registered address space that the implementation deems
- * suitable for a mapping of len bytes. An offset value of 0 is interpreted as
- * granting the implementation complete freedom in selecting po, subject to
- * constraints described below. A non-zero value of offset is taken to be a
- * suggestion of an offset near which the mapping should be placed. When the
- * implementation selects a value for po, it does not replace any extant
- * window. In all cases, po will be a multiple of the page size.
- *
- * The physical pages which are so represented by a window are available for
- * access in calls to mmap(), scif_readfrom(), scif_writeto(),
- * scif_vreadfrom(), and scif_vwriteto(). While a window is registered, the
- * physical pages represented by the window will not be reused by the memory
- * subsystem for any other purpose. Note that the same physical page may be
- * represented by multiple windows.
- *
- * Subsequent operations which change the memory pages to which virtual
- * addresses are mapped (such as mmap(), munmap()) have no effect on
- * existing window.
- *
- * If the process will fork(), it is recommended that the registered
- * virtual address range be marked with MADV_DONTFORK. Doing so will prevent
- * problems due to copy-on-write semantics.
- *
- * The prot_flags argument is formed by OR'ing together one or more of the
- * following values.
- * SCIF_PROT_READ - allow read operations from the window
- * SCIF_PROT_WRITE - allow write operations to the window
- *
- * Return:
- * Upon successful completion, scif_register() returns the offset at which the
- * mapping was placed (po); otherwise in user mode SCIF_REGISTER_FAILED (that
- * is (off_t *)-1) is returned and errno is set to indicate the error; in
- * kernel mode the negative of one of the following errors is returned.
- *
- * Errors:
- * EADDRINUSE - SCIF_MAP_FIXED is set in map_flags, and pages in the range
- * [offset, offset + len -1] are already registered
- * EAGAIN - The mapping could not be performed due to lack of resources
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * ECONNRESET - Connection reset by peer
- * EINVAL - map_flags is invalid, or prot_flags is invalid, or SCIF_MAP_FIXED is
- * set in flags, and offset is not a multiple of the page size, or addr is not a
- * multiple of the page size, or len is not a multiple of the page size, or is
- * 0, or offset is negative
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOMEM - Not enough space
- * ENOTCONN -The endpoint is not connected
- */
-off_t scif_register(scif_epd_t epd, void *addr, size_t len, off_t offset,
-                   int prot_flags, int map_flags);
-
-/**
- * scif_unregister() - Mark a memory region for remote access.
- * @epd:       endpoint descriptor
- * @offset:    start of range to unregister
- * @len:       length of range to unregister
- *
- * The scif_unregister() function closes those previously registered windows
- * which are entirely within the range [offset, offset + len - 1]. It is an
- * error to specify a range which intersects only a subrange of a window.
- *
- * On a successful return, pages within the window may no longer be specified
- * in calls to mmap(), scif_readfrom(), scif_writeto(), scif_vreadfrom(),
- * scif_vwriteto(), scif_get_pages, and scif_fence_signal(). The window,
- * however, continues to exist until all previous references against it are
- * removed. A window is referenced if there is a mapping to it created by
- * mmap(), or if scif_get_pages() was called against the window
- * (and the pages have not been returned via scif_put_pages()). A window is
- * also referenced while an RMA, in which some range of the window is a source
- * or destination, is in progress. Finally a window is referenced while some
- * offset in that window was specified to scif_fence_signal(), and the RMAs
- * marked by that call to scif_fence_signal() have not completed. While a
- * window is in this state, its registered address space pages are not
- * available for use in a new registered window.
- *
- * When all such references to the window have been removed, its references to
- * all the physical pages which it represents are removed. Similarly, the
- * registered address space pages of the window become available for
- * registration in a new window.
- *
- * Return:
- * Upon successful completion, scif_unregister() returns 0; otherwise in user
- * mode -1 is returned and errno is set to indicate the error; in kernel mode
- * the negative of one of the following errors is returned. In the event of an
- * error, no windows are unregistered.
- *
- * Errors:
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * ECONNRESET - Connection reset by peer
- * EINVAL - the range [offset, offset + len - 1] intersects a subrange of a
- * window, or offset is negative
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOTCONN - The endpoint is not connected
- * ENXIO - Offsets in the range [offset, offset + len - 1] are invalid for the
- * registered address space of epd
- */
-int scif_unregister(scif_epd_t epd, off_t offset, size_t len);
-
-/**
- * scif_readfrom() - Copy from a remote address space
- * @epd:       endpoint descriptor
- * @loffset:   offset in local registered address space to
- *             which to copy
- * @len:       length of range to copy
- * @roffset:   offset in remote registered address space
- *             from which to copy
- * @rma_flags: transfer mode flags
- *
- * scif_readfrom() copies len bytes from the remote registered address space of
- * the peer of endpoint epd, starting at the offset roffset to the local
- * registered address space of epd, starting at the offset loffset.
- *
- * Each of the specified ranges [loffset, loffset + len - 1] and [roffset,
- * roffset + len - 1] must be within some registered window or windows of the
- * local and remote nodes. A range may intersect multiple registered windows,
- * but only if those windows are contiguous in the registered address space.
- *
- * If rma_flags includes SCIF_RMA_USECPU, then the data is copied using
- * programmed read/writes. Otherwise the data is copied using DMA. If rma_-
- * flags includes SCIF_RMA_SYNC, then scif_readfrom() will return after the
- * transfer is complete. Otherwise, the transfer may be performed asynchron-
- * ously. The order in which any two asynchronous RMA operations complete
- * is non-deterministic. The synchronization functions, scif_fence_mark()/
- * scif_fence_wait() and scif_fence_signal(), can be used to synchronize to
- * the completion of asynchronous RMA operations on the same endpoint.
- *
- * The DMA transfer of individual bytes is not guaranteed to complete in
- * address order. If rma_flags includes SCIF_RMA_ORDERED, then the last
- * cacheline or partial cacheline of the source range will become visible on
- * the destination node after all other transferred data in the source
- * range has become visible on the destination node.
- *
- * The optimal DMA performance will likely be realized if both
- * loffset and roffset are cacheline aligned (are a multiple of 64). Lower
- * performance will likely be realized if loffset and roffset are not
- * cacheline aligned but are separated by some multiple of 64. The lowest level
- * of performance is likely if loffset and roffset are not separated by a
- * multiple of 64.
- *
- * The rma_flags argument is formed by ORing together zero or more of the
- * following values.
- * SCIF_RMA_USECPU - perform the transfer using the CPU, otherwise use the DMA
- *     engine.
- * SCIF_RMA_SYNC - perform the transfer synchronously, returning after the
- *             transfer has completed. Passing this flag results in the
- *             current implementation busy waiting and consuming CPU cycles
- *             while the DMA transfer is in progress for best performance by
- *             avoiding the interrupt latency.
- * SCIF_RMA_ORDERED - ensure that the last cacheline or partial cacheline of
- *             the source range becomes visible on the destination node
- *             after all other transferred data in the source range has
- *             become visible on the destination
- *
- * Return:
- * Upon successful completion, scif_readfrom() returns 0; otherwise in user
- * mode -1 is returned and errno is set to indicate the error; in kernel mode
- * the negative of one of the following errors is returned.
- *
- * Errors:
- * EACCES - Attempt to write to a read-only range
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * ECONNRESET - Connection reset by peer
- * EINVAL - rma_flags is invalid
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOTCONN - The endpoint is not connected
- * ENXIO - The range [loffset, loffset + len - 1] is invalid for the registered
- * address space of epd, or, The range [roffset, roffset + len - 1] is invalid
- * for the registered address space of the peer of epd, or loffset or roffset
- * is negative
- */
-int scif_readfrom(scif_epd_t epd, off_t loffset, size_t len, off_t
-                 roffset, int rma_flags);
-
-/**
- * scif_writeto() - Copy to a remote address space
- * @epd:       endpoint descriptor
- * @loffset:   offset in local registered address space
- *             from which to copy
- * @len:       length of range to copy
- * @roffset:   offset in remote registered address space to
- *             which to copy
- * @rma_flags: transfer mode flags
- *
- * scif_writeto() copies len bytes from the local registered address space of
- * epd, starting at the offset loffset to the remote registered address space
- * of the peer of endpoint epd, starting at the offset roffset.
- *
- * Each of the specified ranges [loffset, loffset + len - 1] and [roffset,
- * roffset + len - 1] must be within some registered window or windows of the
- * local and remote nodes. A range may intersect multiple registered windows,
- * but only if those windows are contiguous in the registered address space.
- *
- * If rma_flags includes SCIF_RMA_USECPU, then the data is copied using
- * programmed read/writes. Otherwise the data is copied using DMA. If rma_-
- * flags includes SCIF_RMA_SYNC, then scif_writeto() will return after the
- * transfer is complete. Otherwise, the transfer may be performed asynchron-
- * ously. The order in which any two asynchronous RMA operations complete
- * is non-deterministic. The synchronization functions, scif_fence_mark()/
- * scif_fence_wait() and scif_fence_signal(), can be used to synchronize to
- * the completion of asynchronous RMA operations on the same endpoint.
- *
- * The DMA transfer of individual bytes is not guaranteed to complete in
- * address order. If rma_flags includes SCIF_RMA_ORDERED, then the last
- * cacheline or partial cacheline of the source range will become visible on
- * the destination node after all other transferred data in the source
- * range has become visible on the destination node.
- *
- * The optimal DMA performance will likely be realized if both
- * loffset and roffset are cacheline aligned (are a multiple of 64). Lower
- * performance will likely be realized if loffset and roffset are not cacheline
- * aligned but are separated by some multiple of 64. The lowest level of
- * performance is likely if loffset and roffset are not separated by a multiple
- * of 64.
- *
- * The rma_flags argument is formed by ORing together zero or more of the
- * following values.
- * SCIF_RMA_USECPU - perform the transfer using the CPU, otherwise use the DMA
- *                     engine.
- * SCIF_RMA_SYNC - perform the transfer synchronously, returning after the
- *             transfer has completed. Passing this flag results in the
- *             current implementation busy waiting and consuming CPU cycles
- *             while the DMA transfer is in progress for best performance by
- *             avoiding the interrupt latency.
- * SCIF_RMA_ORDERED - ensure that the last cacheline or partial cacheline of
- *             the source range becomes visible on the destination node
- *             after all other transferred data in the source range has
- *             become visible on the destination
- *
- * Return:
- * Upon successful completion, scif_readfrom() returns 0; otherwise in user
- * mode -1 is returned and errno is set to indicate the error; in kernel mode
- * the negative of one of the following errors is returned.
- *
- * Errors:
- * EACCES - Attempt to write to a read-only range
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * ECONNRESET - Connection reset by peer
- * EINVAL - rma_flags is invalid
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOTCONN - The endpoint is not connected
- * ENXIO - The range [loffset, loffset + len - 1] is invalid for the registered
- * address space of epd, or, The range [roffset , roffset + len -1] is invalid
- * for the registered address space of the peer of epd, or loffset or roffset
- * is negative
- */
-int scif_writeto(scif_epd_t epd, off_t loffset, size_t len, off_t
-                roffset, int rma_flags);
-
-/**
- * scif_vreadfrom() - Copy from a remote address space
- * @epd:       endpoint descriptor
- * @addr:      address to which to copy
- * @len:       length of range to copy
- * @roffset:   offset in remote registered address space
- *             from which to copy
- * @rma_flags: transfer mode flags
- *
- * scif_vreadfrom() copies len bytes from the remote registered address
- * space of the peer of endpoint epd, starting at the offset roffset, to local
- * memory, starting at addr.
- *
- * The specified range [roffset, roffset + len - 1] must be within some
- * registered window or windows of the remote nodes. The range may
- * intersect multiple registered windows, but only if those windows are
- * contiguous in the registered address space.
- *
- * If rma_flags includes SCIF_RMA_USECPU, then the data is copied using
- * programmed read/writes. Otherwise the data is copied using DMA. If rma_-
- * flags includes SCIF_RMA_SYNC, then scif_vreadfrom() will return after the
- * transfer is complete. Otherwise, the transfer may be performed asynchron-
- * ously. The order in which any two asynchronous RMA operations complete
- * is non-deterministic. The synchronization functions, scif_fence_mark()/
- * scif_fence_wait() and scif_fence_signal(), can be used to synchronize to
- * the completion of asynchronous RMA operations on the same endpoint.
- *
- * The DMA transfer of individual bytes is not guaranteed to complete in
- * address order. If rma_flags includes SCIF_RMA_ORDERED, then the last
- * cacheline or partial cacheline of the source range will become visible on
- * the destination node after all other transferred data in the source
- * range has become visible on the destination node.
- *
- * If rma_flags includes SCIF_RMA_USECACHE, then the physical pages which back
- * the specified local memory range may be remain in a pinned state even after
- * the specified transfer completes. This may reduce overhead if some or all of
- * the same virtual address range is referenced in a subsequent call of
- * scif_vreadfrom() or scif_vwriteto().
- *
- * The optimal DMA performance will likely be realized if both
- * addr and roffset are cacheline aligned (are a multiple of 64). Lower
- * performance will likely be realized if addr and roffset are not
- * cacheline aligned but are separated by some multiple of 64. The lowest level
- * of performance is likely if addr and roffset are not separated by a
- * multiple of 64.
- *
- * The rma_flags argument is formed by ORing together zero or more of the
- * following values.
- * SCIF_RMA_USECPU - perform the transfer using the CPU, otherwise use the DMA
- *     engine.
- * SCIF_RMA_USECACHE - enable registration caching
- * SCIF_RMA_SYNC - perform the transfer synchronously, returning after the
- *             transfer has completed. Passing this flag results in the
- *             current implementation busy waiting and consuming CPU cycles
- *             while the DMA transfer is in progress for best performance by
- *             avoiding the interrupt latency.
- * SCIF_RMA_ORDERED - ensure that the last cacheline or partial cacheline of
- *     the source range becomes visible on the destination node
- *     after all other transferred data in the source range has
- *     become visible on the destination
- *
- * Return:
- * Upon successful completion, scif_vreadfrom() returns 0; otherwise in user
- * mode -1 is returned and errno is set to indicate the error; in kernel mode
- * the negative of one of the following errors is returned.
- *
- * Errors:
- * EACCES - Attempt to write to a read-only range
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * ECONNRESET - Connection reset by peer
- * EINVAL - rma_flags is invalid
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOTCONN - The endpoint is not connected
- * ENXIO - Offsets in the range [roffset, roffset + len - 1] are invalid for the
- * registered address space of epd
- */
-int scif_vreadfrom(scif_epd_t epd, void *addr, size_t len, off_t roffset,
-                  int rma_flags);
-
-/**
- * scif_vwriteto() - Copy to a remote address space
- * @epd:       endpoint descriptor
- * @addr:      address from which to copy
- * @len:       length of range to copy
- * @roffset:   offset in remote registered address space to
- *             which to copy
- * @rma_flags: transfer mode flags
- *
- * scif_vwriteto() copies len bytes from the local memory, starting at addr, to
- * the remote registered address space of the peer of endpoint epd, starting at
- * the offset roffset.
- *
- * The specified range [roffset, roffset + len - 1] must be within some
- * registered window or windows of the remote nodes. The range may intersect
- * multiple registered windows, but only if those windows are contiguous in the
- * registered address space.
- *
- * If rma_flags includes SCIF_RMA_USECPU, then the data is copied using
- * programmed read/writes. Otherwise the data is copied using DMA. If rma_-
- * flags includes SCIF_RMA_SYNC, then scif_vwriteto() will return after the
- * transfer is complete. Otherwise, the transfer may be performed asynchron-
- * ously. The order in which any two asynchronous RMA operations complete
- * is non-deterministic. The synchronization functions, scif_fence_mark()/
- * scif_fence_wait() and scif_fence_signal(), can be used to synchronize to
- * the completion of asynchronous RMA operations on the same endpoint.
- *
- * The DMA transfer of individual bytes is not guaranteed to complete in
- * address order. If rma_flags includes SCIF_RMA_ORDERED, then the last
- * cacheline or partial cacheline of the source range will become visible on
- * the destination node after all other transferred data in the source
- * range has become visible on the destination node.
- *
- * If rma_flags includes SCIF_RMA_USECACHE, then the physical pages which back
- * the specified local memory range may be remain in a pinned state even after
- * the specified transfer completes. This may reduce overhead if some or all of
- * the same virtual address range is referenced in a subsequent call of
- * scif_vreadfrom() or scif_vwriteto().
- *
- * The optimal DMA performance will likely be realized if both
- * addr and offset are cacheline aligned (are a multiple of 64). Lower
- * performance will likely be realized if addr and offset are not cacheline
- * aligned but are separated by some multiple of 64. The lowest level of
- * performance is likely if addr and offset are not separated by a multiple of
- * 64.
- *
- * The rma_flags argument is formed by ORing together zero or more of the
- * following values.
- * SCIF_RMA_USECPU - perform the transfer using the CPU, otherwise use the DMA
- *     engine.
- * SCIF_RMA_USECACHE - allow registration caching
- * SCIF_RMA_SYNC - perform the transfer synchronously, returning after the
- *             transfer has completed. Passing this flag results in the
- *             current implementation busy waiting and consuming CPU cycles
- *             while the DMA transfer is in progress for best performance by
- *             avoiding the interrupt latency.
- * SCIF_RMA_ORDERED - ensure that the last cacheline or partial cacheline of
- *             the source range becomes visible on the destination node
- *             after all other transferred data in the source range has
- *             become visible on the destination
- *
- * Return:
- * Upon successful completion, scif_vwriteto() returns 0; otherwise in user
- * mode -1 is returned and errno is set to indicate the error; in kernel mode
- * the negative of one of the following errors is returned.
- *
- * Errors:
- * EACCES - Attempt to write to a read-only range
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * ECONNRESET - Connection reset by peer
- * EINVAL - rma_flags is invalid
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOTCONN - The endpoint is not connected
- * ENXIO - Offsets in the range [roffset, roffset + len - 1] are invalid for the
- * registered address space of epd
- */
-int scif_vwriteto(scif_epd_t epd, void *addr, size_t len, off_t roffset,
-                 int rma_flags);
-
-/**
- * scif_fence_mark() - Mark previously issued RMAs
- * @epd:       endpoint descriptor
- * @flags:     control flags
- * @mark:      marked value returned as output.
- *
- * scif_fence_mark() returns after marking the current set of all uncompleted
- * RMAs initiated through the endpoint epd or the current set of all
- * uncompleted RMAs initiated through the peer of endpoint epd. The RMAs are
- * marked with a value returned at mark. The application may subsequently call
- * scif_fence_wait(), passing the value returned at mark, to await completion
- * of all RMAs so marked.
- *
- * The flags argument has exactly one of the following values.
- * SCIF_FENCE_INIT_SELF - RMA operations initiated through endpoint
- *     epd are marked
- * SCIF_FENCE_INIT_PEER - RMA operations initiated through the peer
- *     of endpoint epd are marked
- *
- * Return:
- * Upon successful completion, scif_fence_mark() returns 0; otherwise in user
- * mode -1 is returned and errno is set to indicate the error; in kernel mode
- * the negative of one of the following errors is returned.
- *
- * Errors:
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * ECONNRESET - Connection reset by peer
- * EINVAL - flags is invalid
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOTCONN - The endpoint is not connected
- * ENOMEM - Insufficient kernel memory was available
- */
-int scif_fence_mark(scif_epd_t epd, int flags, int *mark);
-
-/**
- * scif_fence_wait() - Wait for completion of marked RMAs
- * @epd:       endpoint descriptor
- * @mark:      mark request
- *
- * scif_fence_wait() returns after all RMAs marked with mark have completed.
- * The value passed in mark must have been obtained in a previous call to
- * scif_fence_mark().
- *
- * Return:
- * Upon successful completion, scif_fence_wait() returns 0; otherwise in user
- * mode -1 is returned and errno is set to indicate the error; in kernel mode
- * the negative of one of the following errors is returned.
- *
- * Errors:
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * ECONNRESET - Connection reset by peer
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOTCONN - The endpoint is not connected
- * ENOMEM - Insufficient kernel memory was available
- */
-int scif_fence_wait(scif_epd_t epd, int mark);
-
-/**
- * scif_fence_signal() - Request a memory update on completion of RMAs
- * @epd:       endpoint descriptor
- * @loff:      local offset
- * @lval:      local value to write to loffset
- * @roff:      remote offset
- * @rval:      remote value to write to roffset
- * @flags:     flags
- *
- * scif_fence_signal() returns after marking the current set of all uncompleted
- * RMAs initiated through the endpoint epd or marking the current set of all
- * uncompleted RMAs initiated through the peer of endpoint epd.
- *
- * If flags includes SCIF_SIGNAL_LOCAL, then on completion of the RMAs in the
- * marked set, lval is written to memory at the address corresponding to offset
- * loff in the local registered address space of epd. loff must be within a
- * registered window. If flags includes SCIF_SIGNAL_REMOTE, then on completion
- * of the RMAs in the marked set, rval is written to memory at the address
- * corresponding to offset roff in the remote registered address space of epd.
- * roff must be within a remote registered window of the peer of epd. Note
- * that any specified offset must be DWORD (4 byte / 32 bit) aligned.
- *
- * The flags argument is formed by OR'ing together the following.
- * Exactly one of the following values.
- * SCIF_FENCE_INIT_SELF - RMA operations initiated through endpoint
- *     epd are marked
- * SCIF_FENCE_INIT_PEER - RMA operations initiated through the peer
- *     of endpoint epd are marked
- * One or more of the following values.
- * SCIF_SIGNAL_LOCAL - On completion of the marked set of RMAs, write lval to
- *     memory at the address corresponding to offset loff in the local
- *     registered address space of epd.
- * SCIF_SIGNAL_REMOTE - On completion of the marked set of RMAs, write rval to
- *     memory at the address corresponding to offset roff in the remote
- *     registered address space of epd.
- *
- * Return:
- * Upon successful completion, scif_fence_signal() returns 0; otherwise in
- * user mode -1 is returned and errno is set to indicate the error; in kernel
- * mode the negative of one of the following errors is returned.
- *
- * Errors:
- * EBADF, ENOTTY - epd is not a valid endpoint descriptor
- * ECONNRESET - Connection reset by peer
- * EINVAL - flags is invalid, or loff or roff are not DWORD aligned
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOTCONN - The endpoint is not connected
- * ENXIO - loff is invalid for the registered address of epd, or roff is invalid
- * for the registered address space, of the peer of epd
- */
-int scif_fence_signal(scif_epd_t epd, off_t loff, u64 lval, off_t roff,
-                     u64 rval, int flags);
-
-/**
- * scif_get_node_ids() - Return information about online nodes
- * @nodes:     array in which to return online node IDs
- * @len:       number of entries in the nodes array
- * @self:      address to place the node ID of the local node
- *
- * scif_get_node_ids() fills in the nodes array with up to len node IDs of the
- * nodes in the SCIF network. If there is not enough space in nodes, as
- * indicated by the len parameter, only len node IDs are returned in nodes. The
- * return value of scif_get_node_ids() is the total number of nodes currently in
- * the SCIF network. By checking the return value against the len parameter,
- * the user may determine if enough space for nodes was allocated.
- *
- * The node ID of the local node is returned at self.
- *
- * Return:
- * Upon successful completion, scif_get_node_ids() returns the actual number of
- * online nodes in the SCIF network including 'self'; otherwise in user mode
- * -1 is returned and errno is set to indicate the error; in kernel mode no
- * errors are returned.
- */
-int scif_get_node_ids(u16 *nodes, int len, u16 *self);
-
-/**
- * scif_pin_pages() - Pin a set of pages
- * @addr:              Virtual address of range to pin
- * @len:               Length of range to pin
- * @prot_flags:                Page protection flags
- * @map_flags:         Page classification flags
- * @pinned_pages:      Handle to pinned pages
- *
- * scif_pin_pages() pins (locks in physical memory) the physical pages which
- * back the range of virtual address pages starting at addr and continuing for
- * len bytes. addr and len are constrained to be multiples of the page size. A
- * successful scif_pin_pages() call returns a handle to pinned_pages which may
- * be used in subsequent calls to scif_register_pinned_pages().
- *
- * The pages will remain pinned as long as there is a reference against the
- * scif_pinned_pages_t value returned by scif_pin_pages() and until
- * scif_unpin_pages() is called, passing the scif_pinned_pages_t value. A
- * reference is added to a scif_pinned_pages_t value each time a window is
- * created by calling scif_register_pinned_pages() and passing the
- * scif_pinned_pages_t value. A reference is removed from a
- * scif_pinned_pages_t value each time such a window is deleted.
- *
- * Subsequent operations which change the memory pages to which virtual
- * addresses are mapped (such as mmap(), munmap()) have no effect on the
- * scif_pinned_pages_t value or windows created against it.
- *
- * If the process will fork(), it is recommended that the registered
- * virtual address range be marked with MADV_DONTFORK. Doing so will prevent
- * problems due to copy-on-write semantics.
- *
- * The prot_flags argument is formed by OR'ing together one or more of the
- * following values.
- * SCIF_PROT_READ - allow read operations against the pages
- * SCIF_PROT_WRITE - allow write operations against the pages
- * The map_flags argument can be set as SCIF_MAP_KERNEL to interpret addr as a
- * kernel space address. By default, addr is interpreted as a user space
- * address.
- *
- * Return:
- * Upon successful completion, scif_pin_pages() returns 0; otherwise the
- * negative of one of the following errors is returned.
- *
- * Errors:
- * EINVAL - prot_flags is invalid, map_flags is invalid, or offset is negative
- * ENOMEM - Not enough space
- */
-int scif_pin_pages(void *addr, size_t len, int prot_flags, int map_flags,
-                  scif_pinned_pages_t *pinned_pages);
-
-/**
- * scif_unpin_pages() - Unpin a set of pages
- * @pinned_pages:      Handle to pinned pages to be unpinned
- *
- * scif_unpin_pages() prevents scif_register_pinned_pages() from registering new
- * windows against pinned_pages. The physical pages represented by pinned_pages
- * will remain pinned until all windows previously registered against
- * pinned_pages are deleted (the window is scif_unregister()'d and all
- * references to the window are removed (see scif_unregister()).
- *
- * pinned_pages must have been obtain from a previous call to scif_pin_pages().
- * After calling scif_unpin_pages(), it is an error to pass pinned_pages to
- * scif_register_pinned_pages().
- *
- * Return:
- * Upon successful completion, scif_unpin_pages() returns 0; otherwise the
- * negative of one of the following errors is returned.
- *
- * Errors:
- * EINVAL - pinned_pages is not valid
- */
-int scif_unpin_pages(scif_pinned_pages_t pinned_pages);
-
-/**
- * scif_register_pinned_pages() - Mark a memory region for remote access.
- * @epd:               endpoint descriptor
- * @pinned_pages:      Handle to pinned pages
- * @offset:            Registered address space offset
- * @map_flags:         Flags which control where pages are mapped
- *
- * The scif_register_pinned_pages() function opens a window, a range of whole
- * pages of the registered address space of the endpoint epd, starting at
- * offset po. The value of po, further described below, is a function of the
- * parameters offset and pinned_pages, and the value of map_flags. Each page of
- * the window represents a corresponding physical memory page of the range
- * represented by pinned_pages; the length of the window is the same as the
- * length of range represented by pinned_pages. A successful
- * scif_register_pinned_pages() call returns po as the return value.
- *
- * When SCIF_MAP_FIXED is set in the map_flags argument, po will be offset
- * exactly, and offset is constrained to be a multiple of the page size. The
- * mapping established by scif_register_pinned_pages() will not replace any
- * existing registration; an error is returned if any page of the new window
- * would intersect an existing window.
- *
- * When SCIF_MAP_FIXED is not set, the implementation uses offset in an
- * implementation-defined manner to arrive at po. The po so chosen will be an
- * area of the registered address space that the implementation deems suitable
- * for a mapping of the required size. An offset value of 0 is interpreted as
- * granting the implementation complete freedom in selecting po, subject to
- * constraints described below. A non-zero value of offset is taken to be a
- * suggestion of an offset near which the mapping should be placed. When the
- * implementation selects a value for po, it does not replace any extant
- * window. In all cases, po will be a multiple of the page size.
- *
- * The physical pages which are so represented by a window are available for
- * access in calls to scif_get_pages(), scif_readfrom(), scif_writeto(),
- * scif_vreadfrom(), and scif_vwriteto(). While a window is registered, the
- * physical pages represented by the window will not be reused by the memory
- * subsystem for any other purpose. Note that the same physical page may be
- * represented by multiple windows.
- *
- * Windows created by scif_register_pinned_pages() are unregistered by
- * scif_unregister().
- *
- * The map_flags argument can be set to SCIF_MAP_FIXED which interprets a
- * fixed offset.
- *
- * Return:
- * Upon successful completion, scif_register_pinned_pages() returns the offset
- * at which the mapping was placed (po); otherwise the negative of one of the
- * following errors is returned.
- *
- * Errors:
- * EADDRINUSE - SCIF_MAP_FIXED is set in map_flags and pages in the new window
- * would intersect an existing window
- * EAGAIN - The mapping could not be performed due to lack of resources
- * ECONNRESET - Connection reset by peer
- * EINVAL - map_flags is invalid, or SCIF_MAP_FIXED is set in map_flags, and
- * offset is not a multiple of the page size, or offset is negative
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOMEM - Not enough space
- * ENOTCONN - The endpoint is not connected
- */
-off_t scif_register_pinned_pages(scif_epd_t epd,
-                                scif_pinned_pages_t pinned_pages,
-                                off_t offset, int map_flags);
-
-/**
- * scif_get_pages() - Add references to remote registered pages
- * @epd:       endpoint descriptor
- * @offset:    remote registered offset
- * @len:       length of range of pages
- * @pages:     returned scif_range structure
- *
- * scif_get_pages() returns the addresses of the physical pages represented by
- * those pages of the registered address space of the peer of epd, starting at
- * offset and continuing for len bytes. offset and len are constrained to be
- * multiples of the page size.
- *
- * All of the pages in the specified range [offset, offset + len - 1] must be
- * within a single window of the registered address space of the peer of epd.
- *
- * The addresses are returned as a virtually contiguous array pointed to by the
- * phys_addr component of the scif_range structure whose address is returned in
- * pages. The nr_pages component of scif_range is the length of the array. The
- * prot_flags component of scif_range holds the protection flag value passed
- * when the pages were registered.
- *
- * Each physical page whose address is returned by scif_get_pages() remains
- * available and will not be released for reuse until the scif_range structure
- * is returned in a call to scif_put_pages(). The scif_range structure returned
- * by scif_get_pages() must be unmodified.
- *
- * It is an error to call scif_close() on an endpoint on which a scif_range
- * structure of that endpoint has not been returned to scif_put_pages().
- *
- * Return:
- * Upon successful completion, scif_get_pages() returns 0; otherwise the
- * negative of one of the following errors is returned.
- * Errors:
- * ECONNRESET - Connection reset by peer.
- * EINVAL - offset is not a multiple of the page size, or offset is negative, or
- * len is not a multiple of the page size
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOTCONN - The endpoint is not connected
- * ENXIO - Offsets in the range [offset, offset + len - 1] are invalid
- * for the registered address space of the peer epd
- */
-int scif_get_pages(scif_epd_t epd, off_t offset, size_t len,
-                  struct scif_range **pages);
-
-/**
- * scif_put_pages() - Remove references from remote registered pages
- * @pages:     pages to be returned
- *
- * scif_put_pages() releases a scif_range structure previously obtained by
- * calling scif_get_pages(). The physical pages represented by pages may
- * be reused when the window which represented those pages is unregistered.
- * Therefore, those pages must not be accessed after calling scif_put_pages().
- *
- * Return:
- * Upon successful completion, scif_put_pages() returns 0; otherwise the
- * negative of one of the following errors is returned.
- * Errors:
- * EINVAL - pages does not point to a valid scif_range structure, or
- * the scif_range structure pointed to by pages was already returned
- * ENODEV - The remote node is lost or existed, but is not currently in the
- * network since it may have crashed
- * ENOTCONN - The endpoint is not connected
- */
-int scif_put_pages(struct scif_range *pages);
-
-/**
- * scif_poll() - Wait for some event on an endpoint
- * @epds:      Array of endpoint descriptors
- * @nepds:     Length of epds
- * @timeout:   Upper limit on time for which scif_poll() will block
- *
- * scif_poll() waits for one of a set of endpoints to become ready to perform
- * an I/O operation.
- *
- * The epds argument specifies the endpoint descriptors to be examined and the
- * events of interest for each endpoint descriptor. epds is a pointer to an
- * array with one member for each open endpoint descriptor of interest.
- *
- * The number of items in the epds array is specified in nepds. The epd field
- * of scif_pollepd is an endpoint descriptor of an open endpoint. The field
- * events is a bitmask specifying the events which the application is
- * interested in. The field revents is an output parameter, filled by the
- * kernel with the events that actually occurred. The bits returned in revents
- * can include any of those specified in events, or one of the values EPOLLERR,
- * EPOLLHUP, or EPOLLNVAL. (These three bits are meaningless in the events
- * field, and will be set in the revents field whenever the corresponding
- * condition is true.)
- *
- * If none of the events requested (and no error) has occurred for any of the
- * endpoint descriptors, then scif_poll() blocks until one of the events occurs.
- *
- * The timeout argument specifies an upper limit on the time for which
- * scif_poll() will block, in milliseconds. Specifying a negative value in
- * timeout means an infinite timeout.
- *
- * The following bits may be set in events and returned in revents.
- * EPOLLIN - Data may be received without blocking. For a connected
- * endpoint, this means that scif_recv() may be called without blocking. For a
- * listening endpoint, this means that scif_accept() may be called without
- * blocking.
- * EPOLLOUT - Data may be sent without blocking. For a connected endpoint, this
- * means that scif_send() may be called without blocking. EPOLLOUT may also be
- * used to block waiting for a non-blocking connect to complete. This bit value
- * has no meaning for a listening endpoint and is ignored if specified.
- *
- * The following bits are only returned in revents, and are ignored if set in
- * events.
- * EPOLLERR - An error occurred on the endpoint
- * EPOLLHUP - The connection to the peer endpoint was disconnected
- * EPOLLNVAL - The specified endpoint descriptor is invalid.
- *
- * Return:
- * Upon successful completion, scif_poll() returns a non-negative value. A
- * positive value indicates the total number of endpoint descriptors that have
- * been selected (that is, endpoint descriptors for which the revents member is
- * non-zero). A value of 0 indicates that the call timed out and no endpoint
- * descriptors have been selected. Otherwise in user mode -1 is returned and
- * errno is set to indicate the error; in kernel mode the negative of one of
- * the following errors is returned.
- *
- * Errors:
- * EINTR - A signal occurred before any requested event
- * EINVAL - The nepds argument is greater than {OPEN_MAX}
- * ENOMEM - There was no space to allocate file descriptor tables
- */
-int scif_poll(struct scif_pollepd *epds, unsigned int nepds, long timeout);
-
-/**
- * scif_client_register() - Register a SCIF client
- * @client:    client to be registered
- *
- * scif_client_register() registers a SCIF client. The probe() method
- * of the client is called when SCIF peer devices come online and the
- * remove() method is called when the peer devices disappear.
- *
- * Return:
- * Upon successful completion, scif_client_register() returns a non-negative
- * value. Otherwise the return value is the same as subsys_interface_register()
- * in the kernel.
- */
-int scif_client_register(struct scif_client *client);
-
-/**
- * scif_client_unregister() - Unregister a SCIF client
- * @client:    client to be unregistered
- *
- * scif_client_unregister() unregisters a SCIF client.
- *
- * Return:
- * None
- */
-void scif_client_unregister(struct scif_client *client);
-
-#endif /* __SCIF_H__ */
index 7e5dd7d..9cd312a 100644 (file)
@@ -279,12 +279,12 @@ struct scmi_notify_ops {
 struct scmi_handle {
        struct device *dev;
        struct scmi_revision_info *version;
-       struct scmi_perf_ops *perf_ops;
-       struct scmi_clk_ops *clk_ops;
-       struct scmi_power_ops *power_ops;
-       struct scmi_sensor_ops *sensor_ops;
-       struct scmi_reset_ops *reset_ops;
-       struct scmi_notify_ops *notify_ops;
+       const struct scmi_perf_ops *perf_ops;
+       const struct scmi_clk_ops *clk_ops;
+       const struct scmi_power_ops *power_ops;
+       const struct scmi_sensor_ops *sensor_ops;
+       const struct scmi_reset_ops *reset_ops;
+       const struct scmi_notify_ops *notify_ops;
        /* for protocol internal use */
        void *perf_priv;
        void *clk_priv;
@@ -292,6 +292,7 @@ struct scmi_handle {
        void *sensor_priv;
        void *reset_priv;
        void *notify_priv;
+       void *system_priv;
 };
 
 enum scmi_std_protocol {
@@ -304,6 +305,15 @@ enum scmi_std_protocol {
        SCMI_PROTOCOL_RESET = 0x16,
 };
 
+enum scmi_system_events {
+       SCMI_SYSTEM_SHUTDOWN,
+       SCMI_SYSTEM_COLDRESET,
+       SCMI_SYSTEM_WARMRESET,
+       SCMI_SYSTEM_POWERUP,
+       SCMI_SYSTEM_SUSPEND,
+       SCMI_SYSTEM_MAX
+};
+
 struct scmi_device {
        u32 id;
        u8 protocol_id;
@@ -335,7 +345,7 @@ struct scmi_driver {
 
 #define to_scmi_driver(d) container_of(d, struct scmi_driver, driver)
 
-#ifdef CONFIG_ARM_SCMI_PROTOCOL
+#if IS_REACHABLE(CONFIG_ARM_SCMI_PROTOCOL)
 int scmi_driver_register(struct scmi_driver *driver,
                         struct module *owner, const char *mod_name);
 void scmi_driver_unregister(struct scmi_driver *driver);
@@ -378,6 +388,7 @@ enum scmi_notification_events {
        SCMI_EVENT_SENSOR_TRIP_POINT_EVENT = 0x0,
        SCMI_EVENT_RESET_ISSUED = 0x0,
        SCMI_EVENT_BASE_ERROR_EVENT = 0x0,
+       SCMI_EVENT_SYSTEM_POWER_STATE_NOTIFIER = 0x0,
 };
 
 struct scmi_power_state_changed_report {
@@ -387,6 +398,13 @@ struct scmi_power_state_changed_report {
        unsigned int    power_state;
 };
 
+struct scmi_system_power_state_notifier_report {
+       ktime_t         timestamp;
+       unsigned int    agent_id;
+       unsigned int    flags;
+       unsigned int    system_state;
+};
+
 struct scmi_perf_limits_report {
        ktime_t         timestamp;
        unsigned int    agent_id;
index 7673123..bb19265 100644 (file)
@@ -482,11 +482,13 @@ enum sctp_error {
         *  11  Restart of an association with new addresses
         *  12  User Initiated Abort
         *  13  Protocol Violation
+        *  14  Restart of an Association with New Encapsulation Port
         */
 
        SCTP_ERROR_RESTART         = cpu_to_be16(0x0b),
        SCTP_ERROR_USER_ABORT      = cpu_to_be16(0x0c),
        SCTP_ERROR_PROTO_VIOLATION = cpu_to_be16(0x0d),
+       SCTP_ERROR_NEW_ENCAP_PORT  = cpu_to_be16(0x0e),
 
        /* ADDIP Section 3.3  New Error Causes
         *
@@ -793,4 +795,22 @@ enum {
        SCTP_FLOWLABEL_VAL_MASK = 0xfffff
 };
 
+/* UDP Encapsulation
+ * draft-tuexen-tsvwg-sctp-udp-encaps-cons-03.html#section-4-4
+ *
+ *   The error cause indicating an "Restart of an Association with
+ *   New Encapsulation Port"
+ *
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |        Cause Code = 14        |       Cause Length = 8        |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |   Current Encapsulation Port  |     New Encapsulation Port    |
+ * +-------------------------------+-------------------------------+
+ */
+struct sctp_new_encap_port_hdr {
+       __be16 cur_port;
+       __be16 new_port;
+};
+
 #endif /* __LINUX_SCTP_H__ */
index 813614d..b83b3ae 100644 (file)
@@ -107,6 +107,7 @@ void seq_pad(struct seq_file *m, char c);
 char *mangle_path(char *s, const char *p, const char *esc);
 int seq_open(struct file *, const struct seq_operations *);
 ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
+ssize_t seq_read_iter(struct kiocb *iocb, struct iov_iter *iter);
 loff_t seq_lseek(struct file *, loff_t, int);
 int seq_release(struct inode *, struct file *);
 int seq_write(struct seq_file *seq, const void *data, size_t len);
index ac5b07f..cbfc78b 100644 (file)
@@ -154,7 +154,7 @@ static inline void seqcount_lockdep_reader_access(const seqcount_t *s)
 #define __SEQ_LOCK(expr)
 #endif
 
-/**
+/*
  * typedef seqcount_LOCKNAME_t - sequence counter with LOCKNAME associated
  * @seqcount:  The real sequence counter
  * @lock:      Pointer to the associated lock
index 8a99279..ff63c29 100644 (file)
@@ -373,7 +373,7 @@ extern const struct earlycon_id *__earlycon_table_end[];
                    .compatible = compat,                               \
                    .setup = fn  };                                     \
        static const struct earlycon_id EARLYCON_USED_OR_UNUSED         \
-               __section(__earlycon_table)                             \
+               __section("__earlycon_table")                           \
                * const __PASTE(__p, unique_id) = &unique_id
 
 #define OF_EARLYCON_DECLARE(_name, compat, fn)                         \
index 7bbc0e9..b256f9c 100644 (file)
@@ -238,6 +238,7 @@ static inline void siginitset(sigset_t *set, unsigned long mask)
                memset(&set->sig[1], 0, sizeof(long)*(_NSIG_WORDS-1));
                break;
        case 2: set->sig[1] = 0;
+               break;
        case 1: ;
        }
 }
@@ -250,6 +251,7 @@ static inline void siginitsetinv(sigset_t *set, unsigned long mask)
                memset(&set->sig[1], -1, sizeof(long)*(_NSIG_WORDS-1));
                break;
        case 2: set->sig[1] = -1;
+               break;
        case 1: ;
        }
 }
index a828cf9..2d01b2b 100644 (file)
@@ -4151,6 +4151,9 @@ enum skb_ext_id {
 #if IS_ENABLED(CONFIG_MPTCP)
        SKB_EXT_MPTCP,
 #endif
+#if IS_ENABLED(CONFIG_KCOV)
+       SKB_EXT_KCOV_HANDLE,
+#endif
        SKB_EXT_NUM, /* must be last */
 };
 
@@ -4605,5 +4608,35 @@ static inline void skb_reset_redirect(struct sk_buff *skb)
 #endif
 }
 
+#ifdef CONFIG_KCOV
+static inline void skb_set_kcov_handle(struct sk_buff *skb,
+                                      const u64 kcov_handle)
+{
+       /* Do not allocate skb extensions only to set kcov_handle to zero
+        * (as it is zero by default). However, if the extensions are
+        * already allocated, update kcov_handle anyway since
+        * skb_set_kcov_handle can be called to zero a previously set
+        * value.
+        */
+       if (skb_has_extensions(skb) || kcov_handle) {
+               u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE);
+
+               if (kcov_handle_ptr)
+                       *kcov_handle_ptr = kcov_handle;
+       }
+}
+
+static inline u64 skb_get_kcov_handle(struct sk_buff *skb)
+{
+       u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE);
+
+       return kcov_handle ? *kcov_handle : 0;
+}
+#else
+static inline void skb_set_kcov_handle(struct sk_buff *skb,
+                                      const u64 kcov_handle) { }
+static inline u64 skb_get_kcov_handle(struct sk_buff *skb) { return 0; }
+#endif /* CONFIG_KCOV */
+
 #endif /* __KERNEL__ */
 #endif /* _LINUX_SKBUFF_H */
index 9e155cc..dd6897f 100644 (file)
@@ -187,8 +187,6 @@ void kfree_sensitive(const void *);
 size_t __ksize(const void *);
 size_t ksize(const void *);
 
-#define kzfree(x)      kfree_sensitive(x)      /* For backward compatibility */
-
 #ifdef CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR
 void __check_heap_object(const void *ptr, unsigned long n, struct page *page,
                        bool to_user);
index 2249eca..960704d 100644 (file)
@@ -12,6 +12,8 @@
 #include <linux/timer.h>
 
 #define CMDQ_NO_TIMEOUT                0xffffffffu
+#define CMDQ_ADDR_HIGH(addr)   ((u32)(((addr) >> 16) & GENMASK(31, 0)))
+#define CMDQ_ADDR_LOW(addr)    ((u16)(addr) | BIT(1))
 
 struct cmdq_pkt;
 
@@ -102,14 +104,90 @@ int cmdq_pkt_write(struct cmdq_pkt *pkt, u8 subsys, u16 offset, u32 value);
 int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys,
                        u16 offset, u32 value, u32 mask);
 
+/*
+ * cmdq_pkt_read_s() - append read_s command to the CMDQ packet
+ * @pkt:       the CMDQ packet
+ * @high_addr_reg_idx: internal register ID which contains high address of pa
+ * @addr_low:  low address of pa
+ * @reg_idx:   the CMDQ internal register ID to cache read data
+ *
+ * Return: 0 for success; else the error code is returned
+ */
+int cmdq_pkt_read_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, u16 addr_low,
+                   u16 reg_idx);
+
+/**
+ * cmdq_pkt_write_s() - append write_s command to the CMDQ packet
+ * @pkt:       the CMDQ packet
+ * @high_addr_reg_idx: internal register ID which contains high address of pa
+ * @addr_low:  low address of pa
+ * @src_reg_idx:       the CMDQ internal register ID which cache source value
+ *
+ * Return: 0 for success; else the error code is returned
+ *
+ * Support write value to physical address without subsys. Use CMDQ_ADDR_HIGH()
+ * to get high address and call cmdq_pkt_assign() to assign value into internal
+ * reg. Also use CMDQ_ADDR_LOW() to get low address for addr_low parameter when
+ * call to this function.
+ */
+int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
+                    u16 addr_low, u16 src_reg_idx);
+
+/**
+ * cmdq_pkt_write_s_mask() - append write_s with mask command to the CMDQ packet
+ * @pkt:       the CMDQ packet
+ * @high_addr_reg_idx: internal register ID which contains high address of pa
+ * @addr_low:  low address of pa
+ * @src_reg_idx:       the CMDQ internal register ID which cache source value
+ * @mask:      the specified target address mask, use U32_MAX if no need
+ *
+ * Return: 0 for success; else the error code is returned
+ *
+ * Support write value to physical address without subsys. Use CMDQ_ADDR_HIGH()
+ * to get high address and call cmdq_pkt_assign() to assign value into internal
+ * reg. Also use CMDQ_ADDR_LOW() to get low address for addr_low parameter when
+ * call to this function.
+ */
+int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
+                         u16 addr_low, u16 src_reg_idx, u32 mask);
+
+/**
+ * cmdq_pkt_write_s_value() - append write_s command to the CMDQ packet which
+ *                           write value to a physical address
+ * @pkt:       the CMDQ packet
+ * @high_addr_reg_idx: internal register ID which contains high address of pa
+ * @addr_low:  low address of pa
+ * @value:     the specified target value
+ *
+ * Return: 0 for success; else the error code is returned
+ */
+int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
+                          u16 addr_low, u32 value);
+
+/**
+ * cmdq_pkt_write_s_mask_value() - append write_s command with mask to the CMDQ
+ *                                packet which write value to a physical
+ *                                address
+ * @pkt:       the CMDQ packet
+ * @high_addr_reg_idx: internal register ID which contains high address of pa
+ * @addr_low:  low address of pa
+ * @value:     the specified target value
+ * @mask:      the specified target mask
+ *
+ * Return: 0 for success; else the error code is returned
+ */
+int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
+                               u16 addr_low, u32 value, u32 mask);
+
 /**
  * cmdq_pkt_wfe() - append wait for event command to the CMDQ packet
  * @pkt:       the CMDQ packet
- * @event:     the desired event type to "wait and CLEAR"
+ * @event:     the desired event type to wait
+ * @clear:     clear event or not after event arrive
  *
  * Return: 0 for success; else the error code is returned
  */
-int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event);
+int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear);
 
 /**
  * cmdq_pkt_clear_event() - append clear event command to the CMDQ packet
@@ -176,6 +254,17 @@ int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys,
 int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value);
 
 /**
+ * cmdq_pkt_jump() - Append jump command to the CMDQ packet, ask GCE
+ *                  to execute an instruction that change current thread PC to
+ *                  a physical address which should contains more instruction.
+ * @pkt:        the CMDQ packet
+ * @addr:       physical address of target instruction buffer
+ *
+ * Return: 0 for success; else the error code is returned
+ */
+int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr);
+
+/**
  * cmdq_pkt_finalize() - Append EOC and jump command to pkt.
  * @pkt:       the CMDQ packet
  *
similarity index 85%
rename from arch/arm/plat-samsung/include/plat/adc.h
rename to include/linux/soc/samsung/s3c-adc.h
index 74d1a46..591c94e 100644 (file)
@@ -7,8 +7,8 @@
  * S3C ADC driver information
  */
 
-#ifndef __ASM_PLAT_ADC_H
-#define __ASM_PLAT_ADC_H __FILE__
+#ifndef __LINUX_SOC_SAMSUNG_S3C_ADC_H
+#define __LINUX_SOC_SAMSUNG_S3C_ADC_H __FILE__
 
 struct s3c_adc_client;
 struct platform_device;
@@ -29,4 +29,4 @@ extern struct s3c_adc_client *
 
 extern void s3c_adc_release(struct s3c_adc_client *client);
 
-#endif /* __ASM_PLAT_ADC_H */
+#endif /* __LINUX_SOC_SAMSUNG_S3C_ADC_H */
similarity index 97%
rename from arch/arm/plat-samsung/include/plat/cpu-freq.h
rename to include/linux/soc/samsung/s3c-cpu-freq.h
index 558892b..63e88fd 100644 (file)
@@ -6,6 +6,8 @@
  *
  * S3C CPU frequency scaling support - driver and board
  */
+#ifndef __LINUX_SOC_SAMSUNG_S3C_CPU_FREQ_H
+#define __LINUX_SOC_SAMSUNG_S3C_CPU_FREQ_H
 
 #include <linux/cpufreq.h>
 
@@ -139,3 +141,5 @@ static inline int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board)
        return 0;
 }
 #endif  /* CONFIG_ARM_S3C_CPUFREQ */
+
+#endif
@@ -6,8 +6,10 @@
  *
  * S3C CPU frequency scaling support - core support
  */
+#ifndef __LINUX_SOC_SAMSUNG_S3C_CPUFREQ_CORE_H
+#define __LINUX_SOC_SAMSUNG_S3C_CPUFREQ_CORE_H
 
-#include <plat/cpu-freq.h>
+#include <linux/soc/samsung/s3c-cpu-freq.h>
 
 struct seq_file;
 
@@ -246,6 +248,7 @@ extern int s3c2412_iotiming_calc(struct s3c_cpufreq_config *cfg,
 
 extern void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg,
                                 struct s3c_iotimings *iot);
+extern void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg);
 #else
 #define s3c2412_iotiming_debugfs NULL
 #define s3c2412_iotiming_calc NULL
@@ -285,3 +288,12 @@ static inline int s3c_cpufreq_addfreq(struct cpufreq_frequency_table *table,
 
        return index + 1;
 }
+
+u32 s3c2440_read_camdivn(void);
+void s3c2440_write_camdivn(u32 camdiv);
+u32 s3c24xx_read_clkdivn(void);
+void s3c24xx_write_clkdivn(u32 clkdiv);
+u32 s3c24xx_read_mpllcon(void);
+void s3c24xx_write_locktime(u32 locktime);
+
+#endif
similarity index 55%
rename from arch/arm/plat-samsung/include/plat/pm-common.h
rename to include/linux/soc/samsung/s3c-pm.h
index 1268bae..f916455 100644 (file)
@@ -7,34 +7,10 @@
  *     Written by Ben Dooks, <ben@simtec.co.uk>
  */
 
-#ifndef __PLAT_SAMSUNG_PM_COMMON_H
-#define __PLAT_SAMSUNG_PM_COMMON_H __FILE__
+#ifndef __LINUX_SOC_SAMSUNG_S3C_PM_H
+#define __LINUX_SOC_SAMSUNG_S3C_PM_H __FILE__
 
-#include <linux/irq.h>
-
-/* sleep save info */
-
-/**
- * struct sleep_save - save information for shared peripherals.
- * @reg: Pointer to the register to save.
- * @val: Holder for the value saved from reg.
- *
- * This describes a list of registers which is used by the pm core and
- * other subsystem to save and restore register values over suspend.
- */
-struct sleep_save {
-       void __iomem    *reg;
-       unsigned long   val;
-};
-
-#define SAVE_ITEM(x) \
-       { .reg = (x) }
-
-/* helper functions to save/restore lists of registers. */
-
-extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
-extern void s3c_pm_do_restore(const struct sleep_save *ptr, int count);
-extern void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count);
+#include <linux/types.h>
 
 /* PM debug functions */
 
@@ -69,25 +45,26 @@ struct pm_uart_save {
  */
 extern void s3c_pm_dbg(const char *msg, ...);
 
-/**
- * s3c_pm_debug_init() - suspend/resume low level debug initialization.
- * @base: Virtual base of UART to use for suspend/resume debugging.
- *
- * This function needs to be called before S3C_PMDBG() can be used, to set up
- * UART port base address and configuration.
- */
-extern void s3c_pm_debug_init(void);
-
 #define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
 
-extern void s3c_pm_save_uarts(void);
-extern void s3c_pm_restore_uarts(void);
+extern void s3c_pm_save_uarts(bool is_s3c24xx);
+extern void s3c_pm_restore_uarts(bool is_s3c24xx);
+
+#ifdef CONFIG_ARCH_S3C64XX
+extern void s3c_pm_arch_update_uart(void __iomem *regs,
+                                   struct pm_uart_save *save);
+#else
+static inline void
+s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save)
+{
+}
+#endif
+
 #else
 #define S3C_PMDBG(fmt...) pr_debug(fmt)
-#define s3c_pm_debug_init() do { } while (0)
 
-static inline void s3c_pm_save_uarts(void) { }
-static inline void s3c_pm_restore_uarts(void) { }
+static inline void s3c_pm_save_uarts(bool is_s3c24xx) { }
+static inline void s3c_pm_restore_uarts(bool is_s3c24xx) { }
 #endif
 
 /* suspend memory checking */
@@ -104,4 +81,14 @@ extern void s3c_pm_check_store(void);
 #define s3c_pm_check_store()   do { } while (0)
 #endif
 
+/* system device subsystems */
+
+extern struct bus_type s3c2410_subsys;
+extern struct bus_type s3c2410a_subsys;
+extern struct bus_type s3c2412_subsys;
+extern struct bus_type s3c2416_subsys;
+extern struct bus_type s3c2440_subsys;
+extern struct bus_type s3c2442_subsys;
+extern struct bus_type s3c2443_subsys;
+
 #endif
similarity index 66%
rename from drivers/spi/spi-s3c24xx-fiq.h
rename to include/linux/spi/s3c24xx-fiq.h
index 7786b0e..d2842ac 100644 (file)
@@ -7,11 +7,19 @@
  * S3C24XX SPI - FIQ pseudo-DMA transfer support
 */
 
+#ifndef __LINUX_SPI_S3C24XX_FIQ_H
+#define __LINUX_SPI_S3C24XX_FIQ_H __FILE__
+
 /* We have R8 through R13 to play with */
 
 #ifdef __ASSEMBLY__
 #define __REG_NR(x)     r##x
 #else
+
+extern struct spi_fiq_code s3c24xx_spi_fiq_txrx;
+extern struct spi_fiq_code s3c24xx_spi_fiq_tx;
+extern struct spi_fiq_code s3c24xx_spi_fiq_rx;
+
 #define __REG_NR(x)     (x)
 #endif
 
@@ -21,3 +29,5 @@
 #define fiq_rtx                __REG_NR(11)
 #define fiq_rcount     __REG_NR(12)
 #define fiq_rirq       __REG_NR(13)
+
+#endif /* __LINUX_SPI_S3C24XX_FIQ_H */
index c91d10b..440a715 100644 (file)
@@ -20,6 +20,6 @@ struct s3c2410_spi_info {
        void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
 };
 
-extern int s3c24xx_set_fiq(unsigned int irq, bool on);
+extern int s3c24xx_set_fiq(unsigned int irq, u32 *ack_ptr, bool on);
 
 #endif /* __LINUX_SPI_S3C24XX_H */
index f2f12d7..7989784 100644 (file)
@@ -76,7 +76,7 @@
 #define LOCK_SECTION_END                        \
         ".previous\n\t"
 
-#define __lockfunc __attribute__((section(".spinlock.text")))
+#define __lockfunc __section(".spinlock.text")
 
 /*
  * Pull the arch_spinlock_t and arch_rwlock_t definitions:
index 5c47013..a55179f 100644 (file)
@@ -78,8 +78,8 @@ extern ssize_t add_to_pipe(struct pipe_inode_info *,
                              struct pipe_buffer *);
 extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
                                      splice_direct_actor *);
-extern long do_splice(struct file *in, loff_t __user *off_in,
-                     struct file *out, loff_t __user *off_out,
+extern long do_splice(struct file *in, loff_t *off_in,
+                     struct file *out, loff_t *off_out,
                      size_t len, unsigned int flags);
 
 extern long do_tee(struct file *in, struct file *out, size_t len,
index 56614af..fff27e6 100644 (file)
@@ -19,8 +19,6 @@
 #include <linux/time.h>
 #include <linux/uidgid.h>
 
-#define KSTAT_QUERY_FLAGS (AT_STATX_SYNC_TYPE)
-
 struct kstat {
        u32             result_mask;    /* What fields the user got */
        umode_t         mode;
index 9bc69ed..20f695b 100644 (file)
@@ -40,8 +40,14 @@ struct kstatfs {
 #define ST_NOATIME     0x0400  /* do not update access times */
 #define ST_NODIRATIME  0x0800  /* do not update directory access times */
 #define ST_RELATIME    0x1000  /* update atime relative to mtime/ctime */
+#define ST_NOSYMFOLLOW 0x2000  /* do not follow symlinks */
 
 struct dentry;
 extern int vfs_get_fsid(struct dentry *dentry, __kernel_fsid_t *fsid);
 
+static inline __kernel_fsid_t u64_to_fsid(u64 v)
+{
+       return (__kernel_fsid_t){.val = {(u32)v, (u32)(v>>32)}};
+}
+
 #endif
index 513913f..3bb7226 100644 (file)
@@ -45,13 +45,9 @@ enum dma_sync_target {
        SYNC_FOR_DEVICE = 1,
 };
 
-extern phys_addr_t swiotlb_tbl_map_single(struct device *hwdev,
-                                         dma_addr_t tbl_dma_addr,
-                                         phys_addr_t phys,
-                                         size_t mapping_size,
-                                         size_t alloc_size,
-                                         enum dma_data_direction dir,
-                                         unsigned long attrs);
+phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, phys_addr_t phys,
+               size_t mapping_size, size_t alloc_size,
+               enum dma_data_direction dir, unsigned long attrs);
 
 extern void swiotlb_tbl_unmap_single(struct device *hwdev,
                                     phys_addr_t tlb_addr,
index 2eda767..37bea07 100644 (file)
@@ -144,7 +144,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
                .flags                  = TRACE_EVENT_FL_CAP_ANY,       \
        };                                                              \
        static struct trace_event_call __used                           \
-         __attribute__((section("_ftrace_events")))                    \
+         __section("_ftrace_events")                                   \
         *__event_enter_##sname = &event_enter_##sname;
 
 #define SYSCALL_TRACE_EXIT_EVENT(sname)                                        \
@@ -160,7 +160,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
                .flags                  = TRACE_EVENT_FL_CAP_ANY,       \
        };                                                              \
        static struct trace_event_call __used                           \
-         __attribute__((section("_ftrace_events")))                    \
+         __section("_ftrace_events")                                   \
        *__event_exit_##sname = &event_exit_##sname;
 
 #define SYSCALL_METADATA(sname, nb, ...)                       \
@@ -184,7 +184,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
                .enter_fields   = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \
        };                                                      \
        static struct syscall_metadata __used                   \
-         __attribute__((section("__syscalls_metadata")))       \
+         __section("__syscalls_metadata")                      \
         *__p_syscall_meta_##sname = &__syscall_meta_##sname;
 
 static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
index d074302..cdd049a 100644 (file)
@@ -47,6 +47,8 @@ struct tee_shm_pool;
  *              and just return with an error code. It is needed for requests
  *              that arises from TEE based kernel drivers that should be
  *              non-blocking in nature.
+ * @cap_memref_null: flag indicating if the TEE Client support shared
+ *                   memory buffer with a NULL pointer.
  */
 struct tee_context {
        struct tee_device *teedev;
@@ -54,6 +56,7 @@ struct tee_context {
        struct kref refcount;
        bool releasing;
        bool supp_nowait;
+       bool cap_memref_null;
 };
 
 struct tee_param_memref {
index c9dcb3e..5117cb5 100644 (file)
@@ -124,6 +124,10 @@ static inline bool timespec64_valid_settod(const struct timespec64 *ts)
  */
 static inline s64 timespec64_to_ns(const struct timespec64 *ts)
 {
+       /* Prevent multiplication overflow */
+       if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX)
+               return KTIME_MAX;
+
        return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
 }
 
index 5c69433..d321fe5 100644 (file)
@@ -709,7 +709,7 @@ do {                                                                        \
        tracing_record_cmdline(current);                                \
        if (__builtin_constant_p(fmt)) {                                \
                static const char *trace_printk_fmt                     \
-                 __attribute__((section("__trace_printk_fmt"))) =      \
+                 __section("__trace_printk_fmt") =                     \
                        __builtin_constant_p(fmt) ? fmt : NULL;         \
                                                                        \
                __trace_bprintk(ip, trace_printk_fmt, ##args);          \
index 81fa0b2..0f21617 100644 (file)
@@ -119,7 +119,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 
 #define __TRACEPOINT_ENTRY(name)                                        \
        static tracepoint_ptr_t __tracepoint_ptr_##name __used           \
-       __section(__tracepoints_ptrs) = &__tracepoint_##name
+       __section("__tracepoints_ptrs") = &__tracepoint_##name
 #endif
 
 #endif /* _LINUX_TRACEPOINT_H */
@@ -286,11 +286,11 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
  */
 #define DEFINE_TRACE_FN(_name, _reg, _unreg, proto, args)              \
        static const char __tpstrtab_##_name[]                          \
-       __section(__tracepoints_strings) = #_name;                      \
+       __section("__tracepoints_strings") = #_name;                    \
        extern struct static_call_key STATIC_CALL_KEY(tp_func_##_name); \
        int __traceiter_##_name(void *__data, proto);                   \
        struct tracepoint __tracepoint_##_name  __used                  \
-       __section(__tracepoints) = {                                    \
+       __section("__tracepoints") = {                                  \
                .name = __tpstrtab_##_name,                             \
                .key = STATIC_KEY_INIT_FALSE,                           \
                .static_call_key = &STATIC_CALL_KEY(tp_func_##_name),   \
@@ -396,7 +396,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
                static const char *___tp_str __tracepoint_string = str; \
                ___tp_str;                                              \
        })
-#define __tracepoint_string    __used __section(__tracepoint_str)
+#define __tracepoint_string    __used __section("__tracepoint_str")
 #else
 /*
  * tracepoint_string() is used to save the string address for userspace
index b21a2de..c7c6e8b 100644 (file)
@@ -33,6 +33,10 @@ typedef struct {
        /* empty dummy */
 } mm_segment_t;
 
+#ifndef TASK_SIZE_MAX
+#define TASK_SIZE_MAX                  TASK_SIZE
+#endif
+
 #define uaccess_kernel()               (false)
 #define user_addr_max()                        (TASK_SIZE_MAX)
 
index 2040696..a2d229a 100644 (file)
@@ -437,7 +437,7 @@ static inline struct usb_composite_driver *to_cdriver(
 #define OS_STRING_IDX                  0xEE
 
 /**
- * struct usb_composite_device - represents one composite usb gadget
+ * struct usb_composite_dev - represents one composite usb gadget
  * @gadget: read-only, abstracts the gadget's usb peripheral controller
  * @req: used for control responses; buffer is pre-allocated
  * @os_desc_req: used for OS descriptors responses; buffer is pre-allocated
diff --git a/include/linux/usb/r8152.h b/include/linux/usb/r8152.h
new file mode 100644 (file)
index 0000000..20d88b1
--- /dev/null
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ *  Copyright (c) 2020 Realtek Semiconductor Corp. All rights reserved.
+ */
+
+#ifndef        __LINUX_R8152_H
+#define __LINUX_R8152_H
+
+#define RTL8152_REQT_READ              0xc0
+#define RTL8152_REQT_WRITE             0x40
+#define RTL8152_REQ_GET_REGS           0x05
+#define RTL8152_REQ_SET_REGS           0x05
+
+#define BYTE_EN_DWORD                  0xff
+#define BYTE_EN_WORD                   0x33
+#define BYTE_EN_BYTE                   0x11
+#define BYTE_EN_SIX_BYTES              0x3f
+#define BYTE_EN_START_MASK             0x0f
+#define BYTE_EN_END_MASK               0xf0
+
+#define MCU_TYPE_PLA                   0x0100
+#define MCU_TYPE_USB                   0x0000
+
+/* Define these values to match your device */
+#define VENDOR_ID_REALTEK              0x0bda
+#define VENDOR_ID_MICROSOFT            0x045e
+#define VENDOR_ID_SAMSUNG              0x04e8
+#define VENDOR_ID_LENOVO               0x17ef
+#define VENDOR_ID_LINKSYS              0x13b1
+#define VENDOR_ID_NVIDIA               0x0955
+#define VENDOR_ID_TPLINK               0x2357
+
+#if IS_REACHABLE(CONFIG_USB_RTL8152)
+extern u8 rtl8152_get_version(struct usb_interface *intf);
+#endif
+
+#endif /* __LINUX_R8152_H */
index 2e4f772..88a7673 100644 (file)
@@ -65,8 +65,6 @@ struct usbnet {
        struct usb_anchor       deferred;
        struct tasklet_struct   bh;
 
-       struct pcpu_sw_netstats __percpu *stats64;
-
        struct work_struct      kevent;
        unsigned long           flags;
 #              define EVENT_TX_HALT    0
@@ -285,7 +283,5 @@ extern int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags);
 extern void usbnet_status_stop(struct usbnet *dev);
 
 extern void usbnet_update_max_qlen(struct usbnet *dev);
-extern void usbnet_get_stats64(struct net_device *dev,
-                              struct rtnl_link_stats64 *stats);
 
 #endif /* __LINUX_USB_USBNET_H */
index eae0bfd..30bc7a7 100644 (file)
@@ -53,6 +53,16 @@ struct vdpa_device {
 };
 
 /**
+ * vDPA IOVA range - the IOVA range support by the device
+ * @first: start of the IOVA range
+ * @last: end of the IOVA range
+ */
+struct vdpa_iova_range {
+       u64 first;
+       u64 last;
+};
+
+/**
  * vDPA_config_ops - operations for configuring a vDPA device.
  * Note: vDPA device drivers are required to implement all of the
  * operations unless it is mentioned to be optional in the following
@@ -151,6 +161,10 @@ struct vdpa_device {
  * @get_generation:            Get device config generation (optional)
  *                             @vdev: vdpa device
  *                             Returns u32: device generation
+ * @get_iova_range:            Get supported iova range (optional)
+ *                             @vdev: vdpa device
+ *                             Returns the iova range supported by
+ *                             the device.
  * @set_map:                   Set device memory mapping (optional)
  *                             Needed for device that using device
  *                             specific DMA translation (on-chip IOMMU)
@@ -216,6 +230,7 @@ struct vdpa_config_ops {
        void (*set_config)(struct vdpa_device *vdev, unsigned int offset,
                           const void *buf, unsigned int len);
        u32 (*get_generation)(struct vdpa_device *vdev);
+       struct vdpa_iova_range (*get_iova_range)(struct vdpa_device *vdev);
 
        /* DMA ops */
        int (*set_map)(struct vdpa_device *vdev, struct vhost_iotlb *iotlb);
index d1200b4..f746851 100644 (file)
@@ -35,8 +35,4 @@ struct s3c_camif_plat_data {
        int (*gpio_put)(void);
 };
 
-/* Platform default helper functions */
-int s3c_camif_gpio_get(void);
-int s3c_camif_gpio_put(void);
-
 #endif /* MEDIA_S3C_CAMIF_ */
index 661edfc..ab249ca 100644 (file)
@@ -1008,6 +1008,21 @@ struct survey_info {
  * @sae_pwd: password for SAE authentication (for devices supporting SAE
  *     offload)
  * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
+ * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
+ *
+ *     NL80211_SAE_PWE_UNSPECIFIED
+ *       Not-specified, used to indicate userspace did not specify any
+ *       preference. The driver should follow its internal policy in
+ *       such a scenario.
+ *
+ *     NL80211_SAE_PWE_HUNT_AND_PECK
+ *       Allow hunting-and-pecking loop only
+ *
+ *     NL80211_SAE_PWE_HASH_TO_ELEMENT
+ *       Allow hash-to-element only
+ *
+ *     NL80211_SAE_PWE_BOTH
+ *       Allow either hunting-and-pecking loop or hash-to-element
  */
 struct cfg80211_crypto_settings {
        u32 wpa_versions;
@@ -1026,6 +1041,7 @@ struct cfg80211_crypto_settings {
        const u8 *psk;
        const u8 *sae_pwd;
        u8 sae_pwd_len;
+       enum nl80211_sae_pwe_mechanism sae_pwe;
 };
 
 /**
@@ -1444,7 +1460,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
                                  enum cfg80211_station_type statype);
 
 /**
- * enum station_info_rate_flags - bitrate info flags
+ * enum rate_info_flags - bitrate info flags
  *
  * Used by the driver to indicate the specific rate transmission
  * type for 802.11n transmissions.
@@ -1517,7 +1533,7 @@ struct rate_info {
 };
 
 /**
- * enum station_info_rate_flags - bitrate info flags
+ * enum bss_param_flags - bitrate info flags
  *
  * Used by the driver to indicate the specific rate transmission
  * type for 802.11n transmissions.
@@ -3736,8 +3752,6 @@ struct mgmt_frame_regs {
  * @get_tx_power: store the current TX power into the dbm variable;
  *     return 0 if successful
  *
- * @set_wds_peer: set the WDS peer for a WDS interface
- *
  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
  *     functions to adjust rfkill hw state
  *
@@ -4058,9 +4072,6 @@ struct cfg80211_ops {
        int     (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
                                int *dbm);
 
-       int     (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
-                               const u8 *addr);
-
        void    (*rfkill_poll)(struct wiphy *wiphy);
 
 #ifdef CONFIG_NL80211_TESTMODE
@@ -6467,7 +6478,8 @@ void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
                          struct ieee80211_channel *channel, gfp_t gfp);
 
 /**
- * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
+ * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
+ *                                     candidate
  *
  * @dev: network device
  * @macaddr: the MAC address of the new candidate
@@ -7606,7 +7618,7 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate);
 void cfg80211_unregister_wdev(struct wireless_dev *wdev);
 
 /**
- * struct cfg80211_ft_event - FT Information Elements
+ * struct cfg80211_ft_event_params - FT Information Elements
  * @ies: FT IEs
  * @ies_len: length of the FT IE in bytes
  * @target_ap: target AP's MAC address
index 35429a1..4e60d26 100644 (file)
@@ -45,6 +45,7 @@ struct phylink_link_state;
 #define DSA_TAG_PROTO_OCELOT_VALUE             15
 #define DSA_TAG_PROTO_AR9331_VALUE             16
 #define DSA_TAG_PROTO_RTL4_A_VALUE             17
+#define DSA_TAG_PROTO_HELLCREEK_VALUE          18
 
 enum dsa_tag_protocol {
        DSA_TAG_PROTO_NONE              = DSA_TAG_PROTO_NONE_VALUE,
@@ -65,6 +66,7 @@ enum dsa_tag_protocol {
        DSA_TAG_PROTO_OCELOT            = DSA_TAG_PROTO_OCELOT_VALUE,
        DSA_TAG_PROTO_AR9331            = DSA_TAG_PROTO_AR9331_VALUE,
        DSA_TAG_PROTO_RTL4_A            = DSA_TAG_PROTO_RTL4_A_VALUE,
+       DSA_TAG_PROTO_HELLCREEK         = DSA_TAG_PROTO_HELLCREEK_VALUE,
 };
 
 struct packet_type;
@@ -535,6 +537,12 @@ struct dsa_switch_ops {
                            struct ethtool_regs *regs, void *p);
 
        /*
+        * Upper device tracking.
+        */
+       int     (*port_prechangeupper)(struct dsa_switch *ds, int port,
+                                      struct netdev_notifier_changeupper_info *info);
+
+       /*
         * Bridge integration
         */
        int     (*set_ageing_time)(struct dsa_switch *ds, unsigned int msecs);
index 8ea8812..10f0a83 100644 (file)
@@ -400,14 +400,12 @@ static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, co
 static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst,
                                                     struct sk_buff *skb)
 {
-       struct neighbour *n = NULL;
+       struct neighbour *n;
 
-       /* The packets from tunnel devices (eg bareudp) may have only
-        * metadata in the dst pointer of skb. Hence a pointer check of
-        * neigh_lookup is needed.
-        */
-       if (dst->ops->neigh_lookup)
-               n = dst->ops->neigh_lookup(dst, skb, NULL);
+       if (WARN_ON_ONCE(!dst->ops->neigh_lookup))
+               return NULL;
+
+       n = dst->ops->neigh_lookup(dst, skb, NULL);
 
        return IS_ERR(n) ? NULL : n;
 }
index 19c00d1..c085493 100644 (file)
@@ -118,6 +118,7 @@ enum ieee80211_radiotap_tx_flags {
        IEEE80211_RADIOTAP_F_TX_RTS = 0x0004,
        IEEE80211_RADIOTAP_F_TX_NOACK = 0x0008,
        IEEE80211_RADIOTAP_F_TX_NOSEQNO = 0x0010,
+       IEEE80211_RADIOTAP_F_TX_ORDER = 0x0020,
 };
 
 /* for IEEE80211_RADIOTAP_MCS "have" flags */
index 2d6b985..e208740 100644 (file)
@@ -99,7 +99,7 @@ static inline void ipcm_init_sk(struct ipcm_cookie *ipcm,
 #define PKTINFO_SKB_CB(skb) ((struct in_pktinfo *)((skb)->cb))
 
 /* return enslaved device index if relevant */
-static inline int inet_sdif(struct sk_buff *skb)
+static inline int inet_sdif(const struct sk_buff *skb)
 {
 #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV)
        if (skb && ipv4_l3mdev_skb(IPCB(skb)->flags))
index 02ccd32..1b7905e 100644 (file)
@@ -274,8 +274,6 @@ int ip_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
 int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict);
 int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
 
-void ip_tunnel_get_stats64(struct net_device *dev,
-                          struct rtnl_link_stats64 *tot);
 struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
                                   int link, __be16 flags,
                                   __be32 remote, __be32 local,
index e8e295d..05c7524 100644 (file)
@@ -621,7 +621,8 @@ struct ieee80211_fils_discovery {
  *     nontransmitted BSSIDs
  * @profile_periodicity: the least number of beacon frames need to be received
  *     in order to discover all the nontransmitted BSSIDs in the set.
- * @he_oper: HE operation information of the AP we are connected to
+ * @he_oper: HE operation information of the BSS (AP/Mesh) or of the AP we are
+ *     connected to (STA)
  * @he_obss_pd: OBSS Packet Detection parameters.
  * @he_bss_color: BSS coloring settings, if BSS supports HE
  * @fils_discovery: FILS discovery configuration
@@ -856,6 +857,9 @@ enum mac80211_tx_info_flags {
  *     it can be sent out.
  * @IEEE80211_TX_CTRL_NO_SEQNO: Do not overwrite the sequence number that
  *     has already been assigned to this frame.
+ * @IEEE80211_TX_CTRL_DONT_REORDER: This frame should not be reordered
+ *     relative to other frames that have this flag set, independent
+ *     of their QoS TID or other priority field values.
  *
  * These flags are used in tx_info->control.flags.
  */
@@ -868,6 +872,7 @@ enum mac80211_tx_control_flags {
        IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP     = BIT(5),
        IEEE80211_TX_INTCFL_NEED_TXPROCESSING   = BIT(6),
        IEEE80211_TX_CTRL_NO_SEQNO              = BIT(7),
+       IEEE80211_TX_CTRL_DONT_REORDER          = BIT(8),
 };
 
 /*
@@ -3311,7 +3316,7 @@ enum ieee80211_roc_type {
 };
 
 /**
- * enum ieee80211_reconfig_complete_type - reconfig type
+ * enum ieee80211_reconfig_type - reconfig type
  *
  * This enum is used by the reconfig_complete() callback to indicate what
  * reconfiguration type was completed.
@@ -6334,7 +6339,8 @@ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
                              int band, struct ieee80211_sta **sta);
 
 /**
- * Sanity-check and parse the radiotap header of injected frames
+ * ieee80211_parse_tx_radiotap - Sanity-check and parse the radiotap header
+ *                              of injected frames
  * @skb: packet injected by userspace
  * @dev: the &struct device of this 802.11 device
  */
@@ -6389,7 +6395,7 @@ int ieee80211_parse_p2p_noa(const struct ieee80211_p2p_noa_attr *attr,
 void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf);
 
 /**
- * ieee80211_tdls_oper - request userspace to perform a TDLS operation
+ * ieee80211_tdls_oper_request - request userspace to perform a TDLS operation
  * @vif: virtual interface
  * @peer: the peer's destination address
  * @oper: the requested TDLS operation
index 753ba7e..6e706d8 100644 (file)
@@ -29,7 +29,8 @@ struct mptcp_ext {
                        use_ack:1,
                        ack64:1,
                        mpc_map:1,
-                       __unused:2;
+                       frozen:1,
+                       __unused:1;
        /* one byte hole */
 };
 
@@ -106,6 +107,19 @@ static inline void mptcp_skb_ext_move(struct sk_buff *to,
        from->active_extensions = 0;
 }
 
+static inline void mptcp_skb_ext_copy(struct sk_buff *to,
+                                     struct sk_buff *from)
+{
+       struct mptcp_ext *from_ext;
+
+       from_ext = skb_ext_find(from, SKB_EXT_MPTCP);
+       if (!from_ext)
+               return;
+
+       from_ext->frozen = 1;
+       skb_ext_copy(to, from);
+}
+
 static inline bool mptcp_ext_matches(const struct mptcp_ext *to_ext,
                                     const struct mptcp_ext *from_ext)
 {
@@ -193,6 +207,11 @@ static inline void mptcp_skb_ext_move(struct sk_buff *to,
 {
 }
 
+static inline void mptcp_skb_ext_copy(struct sk_buff *to,
+                                     struct sk_buff *from)
+{
+}
+
 static inline bool mptcp_skb_can_collapse(const struct sk_buff *to,
                                          const struct sk_buff *from)
 {
index 40e0e06..0d8ff84 100644 (file)
@@ -18,4 +18,14 @@ struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb,
 void nf_reject_ip_tcphdr_put(struct sk_buff *nskb, const struct sk_buff *oldskb,
                             const struct tcphdr *oth);
 
+struct sk_buff *nf_reject_skb_v4_unreach(struct net *net,
+                                         struct sk_buff *oldskb,
+                                         const struct net_device *dev,
+                                         int hook, u8 code);
+struct sk_buff *nf_reject_skb_v4_tcp_reset(struct net *net,
+                                          struct sk_buff *oldskb,
+                                          const struct net_device *dev,
+                                          int hook);
+
+
 #endif /* _IPV4_NF_REJECT_H */
index 4a3ef9e..edcf6d1 100644 (file)
@@ -20,4 +20,13 @@ void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb,
                              const struct sk_buff *oldskb,
                              const struct tcphdr *oth, unsigned int otcplen);
 
+struct sk_buff *nf_reject_skb_v6_tcp_reset(struct net *net,
+                                          struct sk_buff *oldskb,
+                                          const struct net_device *dev,
+                                          int hook);
+struct sk_buff *nf_reject_skb_v6_unreach(struct net *net,
+                                        struct sk_buff *oldskb,
+                                        const struct net_device *dev,
+                                        int hook, u8 code);
+
 #endif /* _IPV6_NF_REJECT_H */
index d8d02e4..a0f315e 100644 (file)
@@ -22,6 +22,14 @@ struct netns_sctp {
         */
        struct sock *ctl_sock;
 
+       /* UDP tunneling listening sock. */
+       struct sock *udp4_sock;
+       struct sock *udp6_sock;
+       /* UDP tunneling listening port. */
+       int udp_port;
+       /* UDP tunneling remote encap port. */
+       int encap_port;
+
        /* This is the global local address list.
         * We actively maintain this complete list of addresses on
         * the system by catching address add/delete events.
index 2fd76a9..226930d 100644 (file)
@@ -105,11 +105,49 @@ struct nexthop {
 };
 
 enum nexthop_event_type {
-       NEXTHOP_EVENT_DEL
+       NEXTHOP_EVENT_DEL,
+       NEXTHOP_EVENT_REPLACE,
 };
 
-int register_nexthop_notifier(struct net *net, struct notifier_block *nb);
+struct nh_notifier_single_info {
+       struct net_device *dev;
+       u8 gw_family;
+       union {
+               __be32 ipv4;
+               struct in6_addr ipv6;
+       };
+       u8 is_reject:1,
+          is_fdb:1,
+          has_encap:1;
+};
+
+struct nh_notifier_grp_entry_info {
+       u8 weight;
+       u32 id;
+       struct nh_notifier_single_info nh;
+};
+
+struct nh_notifier_grp_info {
+       u16 num_nh;
+       bool is_fdb;
+       struct nh_notifier_grp_entry_info nh_entries[];
+};
+
+struct nh_notifier_info {
+       struct net *net;
+       struct netlink_ext_ack *extack;
+       u32 id;
+       bool is_grp;
+       union {
+               struct nh_notifier_single_info *nh;
+               struct nh_notifier_grp_info *nh_grp;
+       };
+};
+
+int register_nexthop_notifier(struct net *net, struct notifier_block *nb,
+                             struct netlink_ext_ack *extack);
 int unregister_nexthop_notifier(struct net *net, struct notifier_block *nb);
+void nexthop_set_hw_flags(struct net *net, u32 id, bool offload, bool trap);
 
 /* caller is holding rcu or rtnl; no reference taken to nexthop */
 struct nexthop *nexthop_find_by_id(struct net *net, u32 id);
index 4ed32e6..15b1b30 100644 (file)
@@ -24,6 +24,11 @@ static inline void *qdisc_priv(struct Qdisc *q)
        return &q->privdata;
 }
 
+static inline struct Qdisc *qdisc_from_priv(void *priv)
+{
+       return container_of(priv, struct Qdisc, privdata);
+}
+
 /* 
    Timer resolution MUST BE < 10% of min_schedulable_packet_size/bandwidth
    
index 122d9e2..14a0d22 100644 (file)
@@ -286,6 +286,8 @@ enum { SCTP_MAX_GABS = 16 };
                                 * functions simpler to write.
                                 */
 
+#define SCTP_DEFAULT_UDP_PORT 9899     /* default UDP tunneling port */
+
 /* These are the values for pf exposure, UNUSED is to keep compatible with old
  * applications by default.
  */
index 4fc747b..86f74f2 100644 (file)
@@ -84,6 +84,8 @@ int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *addr,
 struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
 int sctp_register_pf(struct sctp_pf *, sa_family_t);
 void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
+int sctp_udp_sock_start(struct net *net);
+void sctp_udp_sock_stop(struct net *net);
 
 /*
  * sctp/socket.c
@@ -576,10 +578,13 @@ static inline __u32 sctp_mtu_payload(const struct sctp_sock *sp,
 {
        __u32 overhead = sizeof(struct sctphdr) + extra;
 
-       if (sp)
+       if (sp) {
                overhead += sp->pf->af->net_header_len;
-       else
+               if (sp->udp_port)
+                       overhead += sizeof(struct udphdr);
+       } else {
                overhead += sizeof(struct ipv6hdr);
+       }
 
        if (WARN_ON_ONCE(mtu && mtu <= overhead))
                mtu = overhead;
index 5c491a3..fd223c9 100644 (file)
@@ -221,6 +221,9 @@ struct sctp_chunk *sctp_make_violation_paramlen(
 struct sctp_chunk *sctp_make_violation_max_retrans(
                                        const struct sctp_association *asoc,
                                        const struct sctp_chunk *chunk);
+struct sctp_chunk *sctp_make_new_encap_port(
+                                       const struct sctp_association *asoc,
+                                       const struct sctp_chunk *chunk);
 struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *asoc,
                                       const struct sctp_transport *transport);
 struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *asoc,
@@ -380,6 +383,7 @@ sctp_vtag_verify(const struct sctp_chunk *chunk,
         if (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag)
                 return 1;
 
+       chunk->transport->encap_port = SCTP_INPUT_CB(chunk->skb)->encap_port;
        return 0;
 }
 
index 0bdff38..1aa5852 100644 (file)
@@ -178,6 +178,9 @@ struct sctp_sock {
         */
        __u32 hbinterval;
 
+       __be16 udp_port;
+       __be16 encap_port;
+
        /* This is the max_retrans value for new associations. */
        __u16 pathmaxrxt;
 
@@ -877,6 +880,8 @@ struct sctp_transport {
         */
        unsigned long last_time_ecne_reduced;
 
+       __be16 encap_port;
+
        /* This is the max_retrans value for the transport and will
         * be initialized from the assocs value.  This can be changed
         * using the SCTP_SET_PEER_ADDR_PARAMS socket option.
@@ -1117,13 +1122,14 @@ static inline void sctp_outq_cork(struct sctp_outq *q)
  */
 struct sctp_input_cb {
        union {
-               struct inet_skb_parm    h4;
+               struct inet_skb_parm    h4;
 #if IS_ENABLED(CONFIG_IPV6)
-               struct inet6_skb_parm   h6;
+               struct inet6_skb_parm   h6;
 #endif
        } header;
        struct sctp_chunk *chunk;
        struct sctp_af *af;
+       __be16 encap_port;
 };
 #define SCTP_INPUT_CB(__skb)   ((struct sctp_input_cb *)&((__skb)->cb[0]))
 
@@ -1790,6 +1796,8 @@ struct sctp_association {
         */
        unsigned long hbinterval;
 
+       __be16 encap_port;
+
        /* This is the max_retrans value for new transports in the
         * association.
         */
index d4ef5bf..4aba0f0 100644 (file)
@@ -386,7 +386,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
 int tcp_child_process(struct sock *parent, struct sock *child,
                      struct sk_buff *skb);
 void tcp_enter_loss(struct sock *sk);
-void tcp_cwnd_reduction(struct sock *sk, int newly_acked_sacked, int flag);
+void tcp_cwnd_reduction(struct sock *sk, int newly_acked_sacked, int newly_lost, int flag);
 void tcp_clear_retrans(struct tcp_sock *tp);
 void tcp_update_metrics(struct sock *sk);
 void tcp_init_metrics(struct sock *sk);
index 295d52a..877832b 100644 (file)
@@ -164,7 +164,7 @@ static inline void udp_csum_pull_header(struct sk_buff *skb)
        UDP_SKB_CB(skb)->cscov -= sizeof(struct udphdr);
 }
 
-typedef struct sock *(*udp_lookup_t)(struct sk_buff *skb, __be16 sport,
+typedef struct sock *(*udp_lookup_t)(const struct sk_buff *skb, __be16 sport,
                                     __be16 dport);
 
 INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp4_gro_receive(struct list_head *,
@@ -313,7 +313,7 @@ struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
 struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
                               __be32 daddr, __be16 dport, int dif, int sdif,
                               struct udp_table *tbl, struct sk_buff *skb);
-struct sock *udp4_lib_lookup_skb(struct sk_buff *skb,
+struct sock *udp4_lib_lookup_skb(const struct sk_buff *skb,
                                 __be16 sport, __be16 dport);
 struct sock *udp6_lib_lookup(struct net *net,
                             const struct in6_addr *saddr, __be16 sport,
@@ -324,7 +324,7 @@ struct sock *__udp6_lib_lookup(struct net *net,
                               const struct in6_addr *daddr, __be16 dport,
                               int dif, int sdif, struct udp_table *tbl,
                               struct sk_buff *skb);
-struct sock *udp6_lib_lookup_skb(struct sk_buff *skb,
+struct sock *udp6_lib_lookup_skb(const struct sk_buff *skb,
                                 __be16 sport, __be16 dport);
 
 /* UDP uses skb->dev_scratch to cache as much information as possible and avoid
index 0140d08..01755b8 100644 (file)
@@ -86,7 +86,7 @@ int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_umem *umem,
 void xp_destroy(struct xsk_buff_pool *pool);
 void xp_release(struct xdp_buff_xsk *xskb);
 void xp_get_pool(struct xsk_buff_pool *pool);
-void xp_put_pool(struct xsk_buff_pool *pool);
+bool xp_put_pool(struct xsk_buff_pool *pool);
 void xp_clear_dev(struct xsk_buff_pool *pool);
 void xp_add_xsk(struct xsk_buff_pool *pool, struct xdp_sock *xs);
 void xp_del_xsk(struct xsk_buff_pool *pool, struct xdp_sock *xs);
index c672ae1..32a67af 100644 (file)
@@ -227,19 +227,9 @@ void rdma_destroy_qp(struct rdma_cm_id *id);
 int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
                       int *qp_attr_mask);
 
-/**
- * rdma_connect - Initiate an active connection request.
- * @id: Connection identifier to connect.
- * @conn_param: Connection information used for connected QPs.
- *
- * Users must have resolved a route for the rdma_cm_id to connect with
- * by having called rdma_resolve_route before calling this routine.
- *
- * This call will either connect to a remote QP or obtain remote QP
- * information for unconnected rdma_cm_id's.  The actual operation is
- * based on the rdma_cm_id's port space.
- */
 int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
+int rdma_connect_locked(struct rdma_cm_id *id,
+                       struct rdma_conn_param *conn_param);
 
 int rdma_connect_ece(struct rdma_cm_id *id, struct rdma_conn_param *conn_param,
                     struct rdma_ucm_ece *ece);
index e76bac4..69ade4f 100644 (file)
@@ -165,7 +165,8 @@ extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,
                                 size_t *offset, size_t *len);
 extern void scsi_kunmap_atomic_sg(void *virt);
 
-extern blk_status_t scsi_init_io(struct scsi_cmnd *cmd);
+blk_status_t scsi_alloc_sgtables(struct scsi_cmnd *cmd);
+void scsi_free_sgtables(struct scsi_cmnd *cmd);
 
 #ifdef CONFIG_SCSI_DMA
 extern int scsi_dma_map(struct scsi_cmnd *cmd);
index cfe00e0..59eeba3 100644 (file)
@@ -256,7 +256,7 @@ struct qm_dqrr_entry {
        __be32 context_b;
        struct qm_fd fd;
        u8 __reserved4[32];
-} __packed;
+} __packed __aligned(64);
 #define QM_DQRR_VERB_VBIT              0x80
 #define QM_DQRR_VERB_MASK              0x7f    /* where the verb contains; */
 #define QM_DQRR_VERB_FRAME_DEQUEUE     0x60    /* "this format" */
@@ -289,7 +289,7 @@ union qm_mr_entry {
                __be32 tag;
                struct qm_fd fd;
                u8 __reserved1[32];
-       } __packed ern;
+       } __packed __aligned(64) ern;
        struct {
                u8 verb;
                u8 fqs;         /* Frame Queue Status */
@@ -689,7 +689,8 @@ enum qman_cb_dqrr_result {
 };
 typedef enum qman_cb_dqrr_result (*qman_cb_dqrr)(struct qman_portal *qm,
                                        struct qman_fq *fq,
-                                       const struct qm_dqrr_entry *dqrr);
+                                       const struct qm_dqrr_entry *dqrr,
+                                       bool sched_napi);
 
 /*
  * This callback type is used when handling ERNs, FQRNs and FQRLs via MR. They
index 1e9db95..ea1de18 100644 (file)
@@ -571,18 +571,21 @@ struct ocelot_vcap_block {
        int pol_lpr;
 };
 
+struct ocelot_vlan {
+       bool valid;
+       u16 vid;
+};
+
 struct ocelot_port {
        struct ocelot                   *ocelot;
 
        struct regmap                   *target;
 
        bool                            vlan_aware;
-
-       /* Ingress default VLAN (pvid) */
-       u16                             pvid;
-
-       /* Egress default VLAN (vid) */
-       u16                             vid;
+       /* VLAN that untagged frames are classified to, on ingress */
+       struct ocelot_vlan              pvid_vlan;
+       /* The VLAN ID that will be transmitted as untagged, on egress */
+       struct ocelot_vlan              native_vlan;
 
        u8                              ptp_cmd;
        struct sk_buff_head             tx_skbs;
@@ -632,6 +635,7 @@ struct ocelot {
        u32                             *lags;
 
        struct list_head                multicast;
+       struct list_head                pgids;
 
        struct list_head                dummy_rules;
        struct ocelot_vcap_block        block[3];
@@ -743,6 +747,8 @@ int ocelot_fdb_add(struct ocelot *ocelot, int port,
                   const unsigned char *addr, u16 vid);
 int ocelot_fdb_del(struct ocelot *ocelot, int port,
                   const unsigned char *addr, u16 vid);
+int ocelot_vlan_prepare(struct ocelot *ocelot, int port, u16 vid, bool pvid,
+                       bool untagged);
 int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
                    bool untagged);
 int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid);
index 1097fec..c702bd2 100644 (file)
@@ -14,6 +14,7 @@
 #define TEGRA210       0x21
 #define TEGRA186       0x18
 #define TEGRA194       0x19
+#define TEGRA234       0x23
 
 #define TEGRA_FUSE_SKU_CALIB_0 0xf0
 #define TEGRA30_FUSE_SATA_CALIB        0x124
@@ -23,6 +24,8 @@
 
 u32 tegra_read_chipid(void);
 u8 tegra_get_chip_id(void);
+u8 tegra_get_platform(void);
+bool tegra_is_silicon(void);
 
 enum tegra_revision {
        TEGRA_REVISION_UNKNOWN = 0,
index e128cff..77d9fa1 100644 (file)
@@ -42,7 +42,7 @@ struct snd_kcontrol_new {
        snd_ctl_elem_iface_t iface;     /* interface identifier */
        unsigned int device;            /* device/client number */
        unsigned int subdevice;         /* subdevice (substream) number */
-       const unsigned char *name;      /* ASCII name of item */
+       const char *name;               /* ASCII name of item */
        unsigned int index;             /* index of item */
        unsigned int access;            /* access rights */
        unsigned int count;             /* count of same elements */
index 381a010..0462c57 100644 (file)
@@ -332,7 +332,8 @@ void __snd_printk(unsigned int level, const char *file, int line,
 #define snd_BUG()              WARN(1, "BUG?\n")
 
 /**
- * Suppress high rates of output when CONFIG_SND_DEBUG is enabled.
+ * snd_printd_ratelimit - Suppress high rates of output when
+ *                       CONFIG_SND_DEBUG is enabled.
  */
 #define snd_printd_ratelimit() printk_ratelimit()
 
index 2ba5df2..2336bf9 100644 (file)
@@ -1284,8 +1284,8 @@ snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
 }
 
 /**
- * snd_pcm_sgbuf_chunk_size - Compute the max size that fits within the contig.
- * page from the given size
+ * snd_pcm_sgbuf_get_chunk_size - Compute the max size that fits within the
+ * contig. page from the given size
  * @substream: PCM substream
  * @ofs: byte offset
  * @size: byte size to examine
index 1ce3be6..cd74bff 100644 (file)
@@ -79,7 +79,7 @@ static union {                                                                \
        struct bpf_raw_event_map event;                                 \
        btf_trace_##call handler;                                       \
 } __bpf_trace_tp_map_##call __used                                     \
-__attribute__((section("__bpf_raw_tp_map"))) = {                       \
+__section("__bpf_raw_tp_map") = {                                      \
        .event = {                                                      \
                .tp             = &__tracepoint_##call,                 \
                .bpf_func       = __bpf_trace_##template,               \
index 8eb4923..4eef374 100644 (file)
@@ -966,19 +966,6 @@ TRACE_EVENT(afs_dir_check_failed,
                      __entry->vnode, __entry->off, __entry->i_size)
            );
 
-/*
- * We use page->private to hold the amount of the page that we've written to,
- * splitting the field into two parts.  However, we need to represent a range
- * 0...PAGE_SIZE inclusive, so we can't support 64K pages on a 32-bit system.
- */
-#if PAGE_SIZE > 32768
-#define AFS_PRIV_MAX   0xffffffff
-#define AFS_PRIV_SHIFT 32
-#else
-#define AFS_PRIV_MAX   0xffff
-#define AFS_PRIV_SHIFT 16
-#endif
-
 TRACE_EVENT(afs_page_dirty,
            TP_PROTO(struct afs_vnode *vnode, const char *where,
                     pgoff_t page, unsigned long priv),
@@ -999,10 +986,11 @@ TRACE_EVENT(afs_page_dirty,
                    __entry->priv = priv;
                           ),
 
-           TP_printk("vn=%p %lx %s %lu-%lu",
+           TP_printk("vn=%p %lx %s %zx-%zx%s",
                      __entry->vnode, __entry->page, __entry->where,
-                     __entry->priv & AFS_PRIV_MAX,
-                     __entry->priv >> AFS_PRIV_SHIFT)
+                     afs_page_dirty_from(__entry->priv),
+                     afs_page_dirty_to(__entry->priv),
+                     afs_is_page_dirty_mmapped(__entry->priv) ? " M" : "")
            );
 
 TRACE_EVENT(afs_call_state,
index b14314f..70ae549 100644 (file)
@@ -100,11 +100,12 @@ TRACE_DEFINE_ENUM(ES_REFERENCED_B);
                { EXT4_FC_REASON_XATTR,         "XATTR"},               \
                { EXT4_FC_REASON_CROSS_RENAME,  "CROSS_RENAME"},        \
                { EXT4_FC_REASON_JOURNAL_FLAG_CHANGE, "JOURNAL_FLAG_CHANGE"}, \
-               { EXT4_FC_REASON_MEM,   "NO_MEM"},                      \
+               { EXT4_FC_REASON_NOMEM, "NO_MEM"},                      \
                { EXT4_FC_REASON_SWAP_BOOT,     "SWAP_BOOT"},           \
                { EXT4_FC_REASON_RESIZE,        "RESIZE"},              \
                { EXT4_FC_REASON_RENAME_DIR,    "RENAME_DIR"},          \
-               { EXT4_FC_REASON_FALLOC_RANGE,  "FALLOC_RANGE"})
+               { EXT4_FC_REASON_FALLOC_RANGE,  "FALLOC_RANGE"},        \
+               { EXT4_FC_REASON_INODE_JOURNAL_DATA,    "INODE_JOURNAL_DATA"})
 
 TRACE_EVENT(ext4_other_inode_update_time,
        TP_PROTO(struct inode *inode, ino_t orig_ino),
@@ -2917,17 +2918,18 @@ TRACE_EVENT(ext4_fc_stats,
                    ),
 
            TP_printk("dev %d:%d fc ineligible reasons:\n"
-                     "%s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s,%d; "
+                     "%s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d; "
                      "num_commits:%ld, ineligible: %ld, numblks: %ld",
                      MAJOR(__entry->dev), MINOR(__entry->dev),
                      FC_REASON_NAME_STAT(EXT4_FC_REASON_XATTR),
                      FC_REASON_NAME_STAT(EXT4_FC_REASON_CROSS_RENAME),
                      FC_REASON_NAME_STAT(EXT4_FC_REASON_JOURNAL_FLAG_CHANGE),
-                     FC_REASON_NAME_STAT(EXT4_FC_REASON_MEM),
+                     FC_REASON_NAME_STAT(EXT4_FC_REASON_NOMEM),
                      FC_REASON_NAME_STAT(EXT4_FC_REASON_SWAP_BOOT),
                      FC_REASON_NAME_STAT(EXT4_FC_REASON_RESIZE),
                      FC_REASON_NAME_STAT(EXT4_FC_REASON_RENAME_DIR),
                      FC_REASON_NAME_STAT(EXT4_FC_REASON_FALLOC_RANGE),
+                     FC_REASON_NAME_STAT(EXT4_FC_REASON_INODE_JOURNAL_DATA),
                      __entry->sbi->s_fc_stats.fc_num_commits,
                      __entry->sbi->s_fc_stats.fc_ineligible_commits,
                      __entry->sbi->s_fc_stats.fc_numblks)
index f45b3c0..2477014 100644 (file)
@@ -655,10 +655,10 @@ TRACE_EVENT(rpc_xdr_overflow,
                __field(size_t, tail_len)
                __field(unsigned int, page_len)
                __field(unsigned int, len)
-               __string(progname,
-                        xdr->rqst->rq_task->tk_client->cl_program->name)
-               __string(procedure,
-                        xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
+               __string(progname, xdr->rqst ?
+                        xdr->rqst->rq_task->tk_client->cl_program->name : "unknown")
+               __string(procedure, xdr->rqst ?
+                        xdr->rqst->rq_task->tk_msg.rpc_proc->p_name : "unknown")
        ),
 
        TP_fast_assign(
index 1bc3e7b..7785961 100644 (file)
@@ -45,7 +45,7 @@ TRACE_MAKE_SYSTEM_STR();
                .eval_value = a                         \
        };                                              \
        static struct trace_eval_map __used             \
-       __attribute__((section("_ftrace_eval_map")))    \
+       __section("_ftrace_eval_map")                   \
        *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a
 
 #undef TRACE_DEFINE_SIZEOF
@@ -58,7 +58,7 @@ TRACE_MAKE_SYSTEM_STR();
                .eval_value = sizeof(a)                 \
        };                                              \
        static struct trace_eval_map __used             \
-       __attribute__((section("_ftrace_eval_map")))    \
+       __section("_ftrace_eval_map")                   \
        *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a
 
 /*
@@ -607,7 +607,7 @@ static inline notrace int trace_event_get_offsets_##call(           \
  * // its only safe to use pointers when doing linker tricks to
  * // create an array.
  * static struct trace_event_call __used
- * __attribute__((section("_ftrace_events"))) *__event_<call> = &event_<call>;
+ * __section("_ftrace_events") *__event_<call> = &event_<call>;
  *
  */
 
@@ -755,7 +755,7 @@ static struct trace_event_call __used event_##call = {                      \
        .flags                  = TRACE_EVENT_FL_TRACEPOINT,            \
 };                                                                     \
 static struct trace_event_call __used                                  \
-__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
+__section("_ftrace_events") *__event_##call = &event_##call
 
 #undef DEFINE_EVENT_PRINT
 #define DEFINE_EVENT_PRINT(template, call, proto, args, print)         \
@@ -772,6 +772,6 @@ static struct trace_event_call __used event_##call = {                      \
        .flags                  = TRACE_EVENT_FL_TRACEPOINT,            \
 };                                                                     \
 static struct trace_event_call __used                                  \
-__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
+__section("_ftrace_events") *__event_##call = &event_##call
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
diff --git a/include/uapi/linux/cfm_bridge.h b/include/uapi/linux/cfm_bridge.h
new file mode 100644 (file)
index 0000000..3c1cbd1
--- /dev/null
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
+
+#ifndef _UAPI_LINUX_CFM_BRIDGE_H_
+#define _UAPI_LINUX_CFM_BRIDGE_H_
+
+#include <linux/types.h>
+#include <linux/if_ether.h>
+
+#define ETHER_HEADER_LENGTH            (6+6+4+2)
+#define CFM_MAID_LENGTH                        48
+#define CFM_CCM_PDU_LENGTH             75
+#define CFM_PORT_STATUS_TLV_LENGTH     4
+#define CFM_IF_STATUS_TLV_LENGTH       4
+#define CFM_IF_STATUS_TLV_TYPE         4
+#define CFM_PORT_STATUS_TLV_TYPE       2
+#define CFM_ENDE_TLV_TYPE              0
+#define CFM_CCM_MAX_FRAME_LENGTH       (ETHER_HEADER_LENGTH+\
+                                        CFM_CCM_PDU_LENGTH+\
+                                        CFM_PORT_STATUS_TLV_LENGTH+\
+                                        CFM_IF_STATUS_TLV_LENGTH)
+#define CFM_FRAME_PRIO                 7
+#define CFM_CCM_TLV_OFFSET             70
+#define CFM_CCM_PDU_MAID_OFFSET                10
+#define CFM_CCM_PDU_MEPID_OFFSET       8
+#define CFM_CCM_PDU_SEQNR_OFFSET       4
+#define CFM_CCM_PDU_TLV_OFFSET         74
+#define CFM_CCM_ITU_RESERVED_SIZE      16
+
+struct br_cfm_common_hdr {
+       __u8 mdlevel_version;
+       __u8 opcode;
+       __u8 flags;
+       __u8 tlv_offset;
+};
+
+enum br_cfm_opcodes {
+       BR_CFM_OPCODE_CCM = 0x1,
+};
+
+/* MEP domain */
+enum br_cfm_domain {
+       BR_CFM_PORT,
+       BR_CFM_VLAN,
+};
+
+/* MEP direction */
+enum br_cfm_mep_direction {
+       BR_CFM_MEP_DIRECTION_DOWN,
+       BR_CFM_MEP_DIRECTION_UP,
+};
+
+/* CCM interval supported. */
+enum br_cfm_ccm_interval {
+       BR_CFM_CCM_INTERVAL_NONE,
+       BR_CFM_CCM_INTERVAL_3_3_MS,
+       BR_CFM_CCM_INTERVAL_10_MS,
+       BR_CFM_CCM_INTERVAL_100_MS,
+       BR_CFM_CCM_INTERVAL_1_SEC,
+       BR_CFM_CCM_INTERVAL_10_SEC,
+       BR_CFM_CCM_INTERVAL_1_MIN,
+       BR_CFM_CCM_INTERVAL_10_MIN,
+};
+
+#endif
index c1661fe..0564fd7 100644 (file)
@@ -138,6 +138,7 @@ struct icmp6hdr {
 #define ICMPV6_HDR_FIELD               0
 #define ICMPV6_UNK_NEXTHDR             1
 #define ICMPV6_UNK_OPTION              2
+#define ICMPV6_HDR_INCOMP              3
 
 /*
  *     constants for (set|get)sockopt
index 4c68768..13d59c5 100644 (file)
@@ -121,6 +121,7 @@ enum {
        IFLA_BRIDGE_VLAN_INFO,
        IFLA_BRIDGE_VLAN_TUNNEL_INFO,
        IFLA_BRIDGE_MRP,
+       IFLA_BRIDGE_CFM,
        __IFLA_BRIDGE_MAX,
 };
 #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
@@ -328,6 +329,130 @@ struct br_mrp_start_in_test {
        __u16 in_id;
 };
 
+enum {
+       IFLA_BRIDGE_CFM_UNSPEC,
+       IFLA_BRIDGE_CFM_MEP_CREATE,
+       IFLA_BRIDGE_CFM_MEP_DELETE,
+       IFLA_BRIDGE_CFM_MEP_CONFIG,
+       IFLA_BRIDGE_CFM_CC_CONFIG,
+       IFLA_BRIDGE_CFM_CC_PEER_MEP_ADD,
+       IFLA_BRIDGE_CFM_CC_PEER_MEP_REMOVE,
+       IFLA_BRIDGE_CFM_CC_RDI,
+       IFLA_BRIDGE_CFM_CC_CCM_TX,
+       IFLA_BRIDGE_CFM_MEP_CREATE_INFO,
+       IFLA_BRIDGE_CFM_MEP_CONFIG_INFO,
+       IFLA_BRIDGE_CFM_CC_CONFIG_INFO,
+       IFLA_BRIDGE_CFM_CC_RDI_INFO,
+       IFLA_BRIDGE_CFM_CC_CCM_TX_INFO,
+       IFLA_BRIDGE_CFM_CC_PEER_MEP_INFO,
+       IFLA_BRIDGE_CFM_MEP_STATUS_INFO,
+       IFLA_BRIDGE_CFM_CC_PEER_STATUS_INFO,
+       __IFLA_BRIDGE_CFM_MAX,
+};
+
+#define IFLA_BRIDGE_CFM_MAX (__IFLA_BRIDGE_CFM_MAX - 1)
+
+enum {
+       IFLA_BRIDGE_CFM_MEP_CREATE_UNSPEC,
+       IFLA_BRIDGE_CFM_MEP_CREATE_INSTANCE,
+       IFLA_BRIDGE_CFM_MEP_CREATE_DOMAIN,
+       IFLA_BRIDGE_CFM_MEP_CREATE_DIRECTION,
+       IFLA_BRIDGE_CFM_MEP_CREATE_IFINDEX,
+       __IFLA_BRIDGE_CFM_MEP_CREATE_MAX,
+};
+
+#define IFLA_BRIDGE_CFM_MEP_CREATE_MAX (__IFLA_BRIDGE_CFM_MEP_CREATE_MAX - 1)
+
+enum {
+       IFLA_BRIDGE_CFM_MEP_DELETE_UNSPEC,
+       IFLA_BRIDGE_CFM_MEP_DELETE_INSTANCE,
+       __IFLA_BRIDGE_CFM_MEP_DELETE_MAX,
+};
+
+#define IFLA_BRIDGE_CFM_MEP_DELETE_MAX (__IFLA_BRIDGE_CFM_MEP_DELETE_MAX - 1)
+
+enum {
+       IFLA_BRIDGE_CFM_MEP_CONFIG_UNSPEC,
+       IFLA_BRIDGE_CFM_MEP_CONFIG_INSTANCE,
+       IFLA_BRIDGE_CFM_MEP_CONFIG_UNICAST_MAC,
+       IFLA_BRIDGE_CFM_MEP_CONFIG_MDLEVEL,
+       IFLA_BRIDGE_CFM_MEP_CONFIG_MEPID,
+       __IFLA_BRIDGE_CFM_MEP_CONFIG_MAX,
+};
+
+#define IFLA_BRIDGE_CFM_MEP_CONFIG_MAX (__IFLA_BRIDGE_CFM_MEP_CONFIG_MAX - 1)
+
+enum {
+       IFLA_BRIDGE_CFM_CC_CONFIG_UNSPEC,
+       IFLA_BRIDGE_CFM_CC_CONFIG_INSTANCE,
+       IFLA_BRIDGE_CFM_CC_CONFIG_ENABLE,
+       IFLA_BRIDGE_CFM_CC_CONFIG_EXP_INTERVAL,
+       IFLA_BRIDGE_CFM_CC_CONFIG_EXP_MAID,
+       __IFLA_BRIDGE_CFM_CC_CONFIG_MAX,
+};
+
+#define IFLA_BRIDGE_CFM_CC_CONFIG_MAX (__IFLA_BRIDGE_CFM_CC_CONFIG_MAX - 1)
+
+enum {
+       IFLA_BRIDGE_CFM_CC_PEER_MEP_UNSPEC,
+       IFLA_BRIDGE_CFM_CC_PEER_MEP_INSTANCE,
+       IFLA_BRIDGE_CFM_CC_PEER_MEPID,
+       __IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX,
+};
+
+#define IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX (__IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX - 1)
+
+enum {
+       IFLA_BRIDGE_CFM_CC_RDI_UNSPEC,
+       IFLA_BRIDGE_CFM_CC_RDI_INSTANCE,
+       IFLA_BRIDGE_CFM_CC_RDI_RDI,
+       __IFLA_BRIDGE_CFM_CC_RDI_MAX,
+};
+
+#define IFLA_BRIDGE_CFM_CC_RDI_MAX (__IFLA_BRIDGE_CFM_CC_RDI_MAX - 1)
+
+enum {
+       IFLA_BRIDGE_CFM_CC_CCM_TX_UNSPEC,
+       IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE,
+       IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC,
+       IFLA_BRIDGE_CFM_CC_CCM_TX_SEQ_NO_UPDATE,
+       IFLA_BRIDGE_CFM_CC_CCM_TX_PERIOD,
+       IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV,
+       IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV_VALUE,
+       IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV,
+       IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV_VALUE,
+       __IFLA_BRIDGE_CFM_CC_CCM_TX_MAX,
+};
+
+#define IFLA_BRIDGE_CFM_CC_CCM_TX_MAX (__IFLA_BRIDGE_CFM_CC_CCM_TX_MAX - 1)
+
+enum {
+       IFLA_BRIDGE_CFM_MEP_STATUS_UNSPEC,
+       IFLA_BRIDGE_CFM_MEP_STATUS_INSTANCE,
+       IFLA_BRIDGE_CFM_MEP_STATUS_OPCODE_UNEXP_SEEN,
+       IFLA_BRIDGE_CFM_MEP_STATUS_VERSION_UNEXP_SEEN,
+       IFLA_BRIDGE_CFM_MEP_STATUS_RX_LEVEL_LOW_SEEN,
+       __IFLA_BRIDGE_CFM_MEP_STATUS_MAX,
+};
+
+#define IFLA_BRIDGE_CFM_MEP_STATUS_MAX (__IFLA_BRIDGE_CFM_MEP_STATUS_MAX - 1)
+
+enum {
+       IFLA_BRIDGE_CFM_CC_PEER_STATUS_UNSPEC,
+       IFLA_BRIDGE_CFM_CC_PEER_STATUS_INSTANCE,
+       IFLA_BRIDGE_CFM_CC_PEER_STATUS_PEER_MEPID,
+       IFLA_BRIDGE_CFM_CC_PEER_STATUS_CCM_DEFECT,
+       IFLA_BRIDGE_CFM_CC_PEER_STATUS_RDI,
+       IFLA_BRIDGE_CFM_CC_PEER_STATUS_PORT_TLV_VALUE,
+       IFLA_BRIDGE_CFM_CC_PEER_STATUS_IF_TLV_VALUE,
+       IFLA_BRIDGE_CFM_CC_PEER_STATUS_SEEN,
+       IFLA_BRIDGE_CFM_CC_PEER_STATUS_TLV_SEEN,
+       IFLA_BRIDGE_CFM_CC_PEER_STATUS_SEQ_UNEXP_SEEN,
+       __IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX,
+};
+
+#define IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX (__IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX - 1)
+
 struct bridge_stp_xstats {
        __u64 transition_blk;
        __u64 transition_fwd;
@@ -526,6 +651,7 @@ struct br_mdb_entry {
                union {
                        __be32  ip4;
                        struct in6_addr ip6;
+                       unsigned char mac_addr[ETH_ALEN];
                } u;
                __be16          proto;
        } addr;
index d6de2b1..a0b6379 100644 (file)
@@ -99,6 +99,7 @@
 #define ETH_P_1588     0x88F7          /* IEEE 1588 Timesync */
 #define ETH_P_NCSI     0x88F8          /* NCSI protocol                */
 #define ETH_P_PRP      0x88FB          /* IEC 62439-3 PRP/HSRv0        */
+#define ETH_P_CFM      0x8902          /* Connectivity Fault Management */
 #define ETH_P_FCOE     0x8906          /* Fibre Channel over Ethernet  */
 #define ETH_P_IBOE     0x8915          /* Infiniband over Ethernet     */
 #define ETH_P_TDLS     0x890D          /* TDLS */
index 3d884d6..c07caf7 100644 (file)
@@ -2,6 +2,7 @@
 #ifndef __LINUX_IF_PACKET_H
 #define __LINUX_IF_PACKET_H
 
+#include <asm/byteorder.h>
 #include <linux/types.h>
 
 struct sockaddr_pkt {
@@ -296,6 +297,17 @@ struct packet_mreq {
        unsigned char   mr_address[8];
 };
 
+struct fanout_args {
+#if defined(__LITTLE_ENDIAN_BITFIELD)
+       __u16           id;
+       __u16           type_flags;
+#else
+       __u16           type_flags;
+       __u16           id;
+#endif
+       __u32           max_num_members;
+};
+
 #define PACKET_MR_MULTICAST    0
 #define PACKET_MR_PROMISC      1
 #define PACKET_MR_ALLMULTI     2
index 0c2e27d..ee93428 100644 (file)
 #define KEY_10CHANNELSUP       0x1b8   /* 10 channels up (10+) */
 #define KEY_10CHANNELSDOWN     0x1b9   /* 10 channels down (10-) */
 #define KEY_IMAGES             0x1ba   /* AL Image Browser */
+#define KEY_NOTIFICATION_CENTER        0x1bc   /* Show/hide the notification center */
+#define KEY_PICKUP_PHONE       0x1bd   /* Answer incoming call */
+#define KEY_HANGUP_PHONE       0x1be   /* Decline incoming call */
 
 #define KEY_DEL_EOL            0x1c0
 #define KEY_DEL_EOS            0x1c1
 #define KEY_FN_F               0x1e2
 #define KEY_FN_S               0x1e3
 #define KEY_FN_B               0x1e4
+#define KEY_FN_RIGHT_SHIFT     0x1e5
 
 #define KEY_BRL_DOT1           0x1f1
 #define KEY_BRL_DOT2           0x1f2
diff --git a/include/uapi/linux/mic_common.h b/include/uapi/linux/mic_common.h
deleted file mode 100644 (file)
index 504e523..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * 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.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Intel MIC driver.
- *
- */
-#ifndef __MIC_COMMON_H_
-#define __MIC_COMMON_H_
-
-#include <linux/virtio_ring.h>
-
-#define __mic_align(a, x) (((a) + (x) - 1) & ~((x) - 1))
-
-/**
- * struct mic_device_desc: Virtio device information shared between the
- * virtio driver and userspace backend
- *
- * @type: Device type: console/network/disk etc.  Type 0/-1 terminates.
- * @num_vq: Number of virtqueues.
- * @feature_len: Number of bytes of feature bits.  Multiply by 2: one for
-   host features and one for guest acknowledgements.
- * @config_len: Number of bytes of the config array after virtqueues.
- * @status: A status byte, written by the Guest.
- * @config: Start of the following variable length config.
- */
-struct mic_device_desc {
-       __s8 type;
-       __u8 num_vq;
-       __u8 feature_len;
-       __u8 config_len;
-       __u8 status;
-       __le64 config[0];
-} __attribute__ ((aligned(8)));
-
-/**
- * struct mic_device_ctrl: Per virtio device information in the device page
- * used internally by the host and card side drivers.
- *
- * @vdev: Used for storing MIC vdev information by the guest.
- * @config_change: Set to 1 by host when a config change is requested.
- * @vdev_reset: Set to 1 by guest to indicate virtio device has been reset.
- * @guest_ack: Set to 1 by guest to ack a command.
- * @host_ack: Set to 1 by host to ack a command.
- * @used_address_updated: Set to 1 by guest when the used address should be
- * updated.
- * @c2h_vdev_db: The doorbell number to be used by guest. Set by host.
- * @h2c_vdev_db: The doorbell number to be used by host. Set by guest.
- */
-struct mic_device_ctrl {
-       __le64 vdev;
-       __u8 config_change;
-       __u8 vdev_reset;
-       __u8 guest_ack;
-       __u8 host_ack;
-       __u8 used_address_updated;
-       __s8 c2h_vdev_db;
-       __s8 h2c_vdev_db;
-} __attribute__ ((aligned(8)));
-
-/**
- * struct mic_bootparam: Virtio device independent information in device page
- *
- * @magic: A magic value used by the card to ensure it can see the host
- * @h2c_config_db: Host to Card Virtio config doorbell set by card
- * @node_id: Unique id of the node
- * @h2c_scif_db - Host to card SCIF doorbell set by card
- * @c2h_scif_db - Card to host SCIF doorbell set by host
- * @scif_host_dma_addr - SCIF host queue pair DMA address
- * @scif_card_dma_addr - SCIF card queue pair DMA address
- */
-struct mic_bootparam {
-       __le32 magic;
-       __s8 h2c_config_db;
-       __u8 node_id;
-       __u8 h2c_scif_db;
-       __u8 c2h_scif_db;
-       __u64 scif_host_dma_addr;
-       __u64 scif_card_dma_addr;
-} __attribute__ ((aligned(8)));
-
-/**
- * struct mic_device_page: High level representation of the device page
- *
- * @bootparam: The bootparam structure is used for sharing information and
- * status updates between MIC host and card drivers.
- * @desc: Array of MIC virtio device descriptors.
- */
-struct mic_device_page {
-       struct mic_bootparam bootparam;
-       struct mic_device_desc desc[0];
-};
-/**
- * struct mic_vqconfig: This is how we expect the device configuration field
- * for a virtqueue to be laid out in config space.
- *
- * @address: Guest/MIC physical address of the virtio ring
- * (avail and desc rings)
- * @used_address: Guest/MIC physical address of the used ring
- * @num: The number of entries in the virtio_ring
- */
-struct mic_vqconfig {
-       __le64 address;
-       __le64 used_address;
-       __le16 num;
-} __attribute__ ((aligned(8)));
-
-/*
- * The alignment to use between consumer and producer parts of vring.
- * This is pagesize for historical reasons.
- */
-#define MIC_VIRTIO_RING_ALIGN          4096
-
-#define MIC_MAX_VRINGS                 4
-#define MIC_VRING_ENTRIES              128
-
-/*
- * Max vring entries (power of 2) to ensure desc and avail rings
- * fit in a single page
- */
-#define MIC_MAX_VRING_ENTRIES          128
-
-/**
- * Max size of the desc block in bytes: includes:
- *     - struct mic_device_desc
- *     - struct mic_vqconfig (num_vq of these)
- *     - host and guest features
- *     - virtio device config space
- */
-#define MIC_MAX_DESC_BLK_SIZE          256
-
-/**
- * struct _mic_vring_info - Host vring info exposed to userspace backend
- * for the avail index and magic for the card.
- *
- * @avail_idx: host avail idx
- * @magic: A magic debug cookie.
- */
-struct _mic_vring_info {
-       __u16 avail_idx;
-       __le32 magic;
-};
-
-/**
- * struct mic_vring - Vring information.
- *
- * @vr: The virtio ring.
- * @info: Host vring information exposed to the userspace backend for the
- * avail index and magic for the card.
- * @va: The va for the buffer allocated for vr and info.
- * @len: The length of the buffer required for allocating vr and info.
- */
-struct mic_vring {
-       struct vring vr;
-       struct _mic_vring_info *info;
-       void *va;
-       int len;
-};
-
-#define mic_aligned_desc_size(d) __mic_align(mic_desc_size(d), 8)
-
-#ifndef INTEL_MIC_CARD
-static inline unsigned mic_desc_size(const struct mic_device_desc *desc)
-{
-       return sizeof(*desc) + desc->num_vq * sizeof(struct mic_vqconfig)
-               + desc->feature_len * 2 + desc->config_len;
-}
-
-static inline struct mic_vqconfig *
-mic_vq_config(const struct mic_device_desc *desc)
-{
-       return (struct mic_vqconfig *)(desc + 1);
-}
-
-static inline __u8 *mic_vq_features(const struct mic_device_desc *desc)
-{
-       return (__u8 *)(mic_vq_config(desc) + desc->num_vq);
-}
-
-static inline __u8 *mic_vq_configspace(const struct mic_device_desc *desc)
-{
-       return mic_vq_features(desc) + desc->feature_len * 2;
-}
-static inline unsigned mic_total_desc_size(struct mic_device_desc *desc)
-{
-       return mic_aligned_desc_size(desc) + sizeof(struct mic_device_ctrl);
-}
-#endif
-
-/* Device page size */
-#define MIC_DP_SIZE 4096
-
-#define MIC_MAGIC 0xc0ffee00
-
-/**
- * enum mic_states - MIC states.
- */
-enum mic_states {
-       MIC_READY = 0,
-       MIC_BOOTING,
-       MIC_ONLINE,
-       MIC_SHUTTING_DOWN,
-       MIC_RESETTING,
-       MIC_RESET_FAILED,
-       MIC_LAST
-};
-
-/**
- * enum mic_status - MIC status reported by card after
- * a host or card initiated shutdown or a card crash.
- */
-enum mic_status {
-       MIC_NOP = 0,
-       MIC_CRASHED,
-       MIC_HALTED,
-       MIC_POWER_OFF,
-       MIC_RESTART,
-       MIC_STATUS_LAST
-};
-
-#endif
diff --git a/include/uapi/linux/mic_ioctl.h b/include/uapi/linux/mic_ioctl.h
deleted file mode 100644 (file)
index 687b9cd..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * 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.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Intel MIC Host driver.
- *
- */
-#ifndef _MIC_IOCTL_H_
-#define _MIC_IOCTL_H_
-
-#include <linux/types.h>
-
-/*
- * mic_copy - MIC virtio descriptor copy.
- *
- * @iov: An array of IOVEC structures containing user space buffers.
- * @iovcnt: Number of IOVEC structures in iov.
- * @vr_idx: The vring index.
- * @update_used: A non zero value results in used index being updated.
- * @out_len: The aggregate of the total length written to or read from
- *     the virtio device.
- */
-struct mic_copy_desc {
-#ifdef __KERNEL__
-       struct iovec __user *iov;
-#else
-       struct iovec *iov;
-#endif
-       __u32 iovcnt;
-       __u8 vr_idx;
-       __u8 update_used;
-       __u32 out_len;
-};
-
-/*
- * Add a new virtio device
- * The (struct mic_device_desc *) pointer points to a device page entry
- *     for the virtio device consisting of:
- *     - struct mic_device_desc
- *     - struct mic_vqconfig (num_vq of these)
- *     - host and guest features
- *     - virtio device config space
- * The total size referenced by the pointer should equal the size returned
- * by desc_size() in mic_common.h
- */
-#define MIC_VIRTIO_ADD_DEVICE _IOWR('s', 1, struct mic_device_desc *)
-
-/*
- * Copy the number of entries in the iovec and update the used index
- * if requested by the user.
- */
-#define MIC_VIRTIO_COPY_DESC   _IOWR('s', 2, struct mic_copy_desc *)
-
-/*
- * Notify virtio device of a config change
- * The (__u8 *) pointer points to config space values for the device
- * as they should be written into the device page. The total size
- * referenced by the pointer should equal the config_len field of struct
- * mic_device_desc.
- */
-#define MIC_VIRTIO_CONFIG_CHANGE _IOWR('s', 5, __u8 *)
-
-#endif
index 96a0240..dd8306e 100644 (file)
@@ -16,6 +16,7 @@
 #define MS_REMOUNT     32      /* Alter flags of a mounted FS */
 #define MS_MANDLOCK    64      /* Allow mandatory locks on an FS */
 #define MS_DIRSYNC     128     /* Directory modifications are synchronous */
+#define MS_NOSYMFOLLOW 256     /* Do not follow symlinks */
 #define MS_NOATIME     1024    /* Do not update access times. */
 #define MS_NODIRATIME  2048    /* Do not update directory access times */
 #define MS_BIND                4096
index 11a72a9..6397d75 100644 (file)
@@ -92,11 +92,11 @@ enum {
        /* Reserve empty slots */
        IPSET_ATTR_CADT_MAX = 16,
        /* Create-only specific attributes */
-       IPSET_ATTR_GC,
+       IPSET_ATTR_INITVAL,     /* was unused IPSET_ATTR_GC */
        IPSET_ATTR_HASHSIZE,
        IPSET_ATTR_MAXELEM,
        IPSET_ATTR_NETMASK,
-       IPSET_ATTR_PROBES,
+       IPSET_ATTR_BUCKETSIZE,  /* was unused IPSET_ATTR_PROBES */
        IPSET_ATTR_RESIZE,
        IPSET_ATTR_SIZE,
        /* Kernel-only */
@@ -214,6 +214,8 @@ enum ipset_cadt_flags {
 enum ipset_create_flags {
        IPSET_CREATE_FLAG_BIT_FORCEADD = 0,
        IPSET_CREATE_FLAG_FORCEADD = (1 << IPSET_CREATE_FLAG_BIT_FORCEADD),
+       IPSET_CREATE_FLAG_BIT_BUCKETSIZE = 1,
+       IPSET_CREATE_FLAG_BUCKETSIZE = (1 << IPSET_CREATE_FLAG_BIT_BUCKETSIZE),
        IPSET_CREATE_FLAG_BIT_MAX = 7,
 };
 
index 47700a2..3e0d4a0 100644 (file)
  *     of any other interfaces, and other interfaces will again take
  *     precedence when they are used.
  *
- * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface.
+ * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface
+ *     (no longer supported).
  *
  * @NL80211_CMD_SET_MULTICAST_TO_UNICAST: Configure if this AP should perform
  *     multicast to unicast conversion. When enabled, all multicast packets
@@ -1750,8 +1751,9 @@ enum nl80211_commands {
  *     specify just a single bitrate, which is to be used for the beacon.
  *     The driver must also specify support for this with the extended
  *     features NL80211_EXT_FEATURE_BEACON_RATE_LEGACY,
- *     NL80211_EXT_FEATURE_BEACON_RATE_HT and
- *     NL80211_EXT_FEATURE_BEACON_RATE_VHT.
+ *     NL80211_EXT_FEATURE_BEACON_RATE_HT,
+ *     NL80211_EXT_FEATURE_BEACON_RATE_VHT and
+ *     NL80211_EXT_FEATURE_BEACON_RATE_HE.
  *
  * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain
  *     at least one byte, currently used with @NL80211_CMD_REGISTER_FRAME.
@@ -2527,6 +2529,11 @@ enum nl80211_commands {
  *     override mask. Used with NL80211_ATTR_S1G_CAPABILITY in
  *     NL80211_CMD_ASSOCIATE or NL80211_CMD_CONNECT.
  *
+ * @NL80211_ATTR_SAE_PWE: Indicates the mechanism(s) allowed for SAE PWE
+ *     derivation in WPA3-Personal networks which are using SAE authentication.
+ *     This is a u8 attribute that encapsulates one of the values from
+ *     &enum nl80211_sae_pwe_mechanism.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3016,6 +3023,8 @@ enum nl80211_attrs {
        NL80211_ATTR_S1G_CAPABILITY,
        NL80211_ATTR_S1G_CAPABILITY_MASK,
 
+       NL80211_ATTR_SAE_PWE,
+
        /* add attributes here, update the policy in nl80211.c */
 
        __NL80211_ATTR_AFTER_LAST,
@@ -5896,6 +5905,9 @@ enum nl80211_feature_flags {
  * @NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP: Driver/device supports
  *     unsolicited broadcast probe response transmission
  *
+ * @NL80211_EXT_FEATURE_BEACON_RATE_HE: Driver supports beacon rate
+ *     configuration (AP/mesh) with HE rates.
+ *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  */
@@ -5956,6 +5968,7 @@ enum nl80211_ext_feature_index {
        NL80211_EXT_FEATURE_SAE_OFFLOAD_AP,
        NL80211_EXT_FEATURE_FILS_DISCOVERY,
        NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP,
+       NL80211_EXT_FEATURE_BEACON_RATE_HE,
 
        /* add new features before the definition below */
        NUM_NL80211_EXT_FEATURES,
@@ -7124,4 +7137,23 @@ enum nl80211_unsol_bcast_probe_resp_attributes {
        NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_MAX =
                __NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_LAST - 1
 };
+
+/**
+ * enum nl80211_sae_pwe_mechanism - The mechanism(s) allowed for SAE PWE
+ *     derivation. Applicable only when WPA3-Personal SAE authentication is
+ *     used.
+ *
+ * @NL80211_SAE_PWE_UNSPECIFIED: not specified, used internally to indicate that
+ *     attribute is not present from userspace.
+ * @NL80211_SAE_PWE_HUNT_AND_PECK: hunting-and-pecking loop only
+ * @NL80211_SAE_PWE_HASH_TO_ELEMENT: hash-to-element only
+ * @NL80211_SAE_PWE_BOTH: both hunting-and-pecking loop and hash-to-element
+ *     can be used.
+ */
+enum nl80211_sae_pwe_mechanism {
+       NL80211_SAE_PWE_UNSPECIFIED,
+       NL80211_SAE_PWE_HUNT_AND_PECK,
+       NL80211_SAE_PWE_HASH_TO_ELEMENT,
+       NL80211_SAE_PWE_BOTH,
+};
 #endif /* __LINUX_NL80211_H */
index 077e7ee..b95d3c4 100644 (file)
@@ -1196,7 +1196,7 @@ union perf_mem_data_src {
 
 #define PERF_MEM_SNOOPX_FWD    0x01 /* forward */
 /* 1 free */
-#define PERF_MEM_SNOOPX_SHIFT  37
+#define PERF_MEM_SNOOPX_SHIFT  38
 
 /* locked instruction */
 #define PERF_MEM_LOCK_NA       0x01 /* not available */
index 9b814c9..2ffbef5 100644 (file)
@@ -396,11 +396,13 @@ struct rtnexthop {
 #define RTNH_F_DEAD            1       /* Nexthop is dead (used by multipath)  */
 #define RTNH_F_PERVASIVE       2       /* Do recursive gateway lookup  */
 #define RTNH_F_ONLINK          4       /* Gateway is forced on link    */
-#define RTNH_F_OFFLOAD         8       /* offloaded route */
+#define RTNH_F_OFFLOAD         8       /* Nexthop is offloaded */
 #define RTNH_F_LINKDOWN                16      /* carrier-down on nexthop */
 #define RTNH_F_UNRESOLVED      32      /* The entry is unresolved (ipmr) */
+#define RTNH_F_TRAP            64      /* Nexthop is trapping packets */
 
-#define RTNH_COMPARE_MASK      (RTNH_F_DEAD | RTNH_F_LINKDOWN | RTNH_F_OFFLOAD)
+#define RTNH_COMPARE_MASK      (RTNH_F_DEAD | RTNH_F_LINKDOWN | \
+                                RTNH_F_OFFLOAD | RTNH_F_TRAP)
 
 /* Macros to handle hexthops */
 
@@ -770,8 +772,12 @@ enum {
  * actions in a dump. All dump responses will contain the number of actions
  * being dumped stored in for user app's consumption in TCA_ROOT_COUNT
  *
+ * TCA_FLAG_TERSE_DUMP user->kernel to request terse (brief) dump that only
+ * includes essential action info (kind, index, etc.)
+ *
  */
 #define TCA_FLAG_LARGE_DUMP_ON         (1 << 0)
+#define TCA_FLAG_TERSE_DUMP            (1 << 1)
 
 /* New extended info filters for IFLA_EXT_MASK */
 #define RTEXT_FILTER_VF                (1 << 0)
@@ -779,6 +785,8 @@ enum {
 #define RTEXT_FILTER_BRVLAN_COMPRESSED (1 << 2)
 #define        RTEXT_FILTER_SKIP_STATS (1 << 3)
 #define RTEXT_FILTER_MRP       (1 << 4)
+#define RTEXT_FILTER_CFM_CONFIG        (1 << 5)
+#define RTEXT_FILTER_CFM_STATUS        (1 << 6)
 
 /* End of information exported to user level */
 
index 28ad40d..cb78e7a 100644 (file)
@@ -140,6 +140,7 @@ typedef __s32 sctp_assoc_t;
 #define SCTP_ECN_SUPPORTED     130
 #define SCTP_EXPOSE_POTENTIALLY_FAILED_STATE   131
 #define SCTP_EXPOSE_PF_STATE   SCTP_EXPOSE_POTENTIALLY_FAILED_STATE
+#define SCTP_REMOTE_UDP_ENCAPS_PORT    132
 
 /* PR-SCTP policies */
 #define SCTP_PR_SCTP_NONE      0x0000
@@ -1197,6 +1198,12 @@ struct sctp_event {
        uint8_t se_on;
 };
 
+struct sctp_udpencaps {
+       sctp_assoc_t sue_assoc_id;
+       struct sockaddr_storage sue_address;
+       uint16_t sue_port;
+};
+
 /* SCTP Stream schedulers */
 enum sctp_sched_type {
        SCTP_SS_FCFS,
index f84e7bc..26fc60c 100644 (file)
@@ -159,6 +159,7 @@ enum
        UDP_MIB_SNDBUFERRORS,                   /* SndbufErrors */
        UDP_MIB_CSUMERRORS,                     /* InCsumErrors */
        UDP_MIB_IGNOREDMULTI,                   /* IgnoredMulti */
+       UDP_MIB_MEMERRORS,                      /* MemErrors */
        __UDP_MIB_MAX
 };
 
index b619f37..d67cadf 100644 (file)
@@ -51,6 +51,9 @@
 #define TEE_GEN_CAP_GP         (1 << 0)/* GlobalPlatform compliant TEE */
 #define TEE_GEN_CAP_PRIVILEGED (1 << 1)/* Privileged device (for supplicant) */
 #define TEE_GEN_CAP_REG_MEM    (1 << 2)/* Supports registering shared memory */
+#define TEE_GEN_CAP_MEMREF_NULL        (1 << 3)/* NULL MemRef support */
+
+#define TEE_MEMREF_NULL                (__u64)(-1) /* NULL MemRef Buffer */
 
 /*
  * TEE Implementation ID
@@ -200,6 +203,16 @@ struct tee_ioctl_buf_data {
  * a part of a shared memory by specifying an offset (@a) and size (@b) of
  * the object. To supply the entire shared memory object set the offset
  * (@a) to 0 and size (@b) to the previously returned size of the object.
+ *
+ * A client may need to present a NULL pointer in the argument
+ * passed to a trusted application in the TEE.
+ * This is also a requirement in GlobalPlatform Client API v1.0c
+ * (section 3.2.5 memory references), which can be found at
+ * http://www.globalplatform.org/specificationsdevice.asp
+ *
+ * If a NULL pointer is passed to a TA in the TEE, the (@c)
+ * IOCTL parameters value must be set to TEE_MEMREF_NULL indicating a NULL
+ * memory reference.
  */
 struct tee_ioctl_param {
        __u64 attr;
index 7523218..c998860 100644 (file)
 
 /* Set event fd for config interrupt*/
 #define VHOST_VDPA_SET_CONFIG_CALL     _IOW(VHOST_VIRTIO, 0x77, int)
+
+/* Get the valid iova range */
+#define VHOST_VDPA_GET_IOVA_RANGE      _IOR(VHOST_VIRTIO, 0x78, \
+                                            struct vhost_vdpa_iova_range)
 #endif
index 9a269a8..f7f6a3a 100644 (file)
@@ -138,6 +138,15 @@ struct vhost_vdpa_config {
        __u8 buf[0];
 };
 
+/* vhost vdpa IOVA range
+ * @first: First address that can be mapped by vhost-vDPA
+ * @last: Last address that can be mapped by vhost-vDPA
+ */
+struct vhost_vdpa_iova_range {
+       __u64 first;
+       __u64 last;
+};
+
 /* Feature bits */
 /* Log all write descriptors. Can be changed while device is active. */
 #define VHOST_F_LOG_ALL 26
index 7184265..9555f31 100644 (file)
@@ -144,7 +144,7 @@ struct snd_compr_metadata {
         __u32 value[8];
 } __attribute__((packed, aligned(4)));
 
-/**
+/*
  * compress path ioctl definitions
  * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP
  * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec
index 06b0b57..d1b3889 100644 (file)
@@ -484,9 +484,6 @@ int ipu_smfc_set_watermark(struct ipu_smfc *smfc, u32 set_level, u32 clr_level);
 
 enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc);
 enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat);
-enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code);
-int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat);
-bool ipu_pixelformat_is_planar(u32 pixelformat);
 int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees,
                            bool hflip, bool vflip);
 int ipu_rot_mode_to_degrees(int *degrees, enum ipu_rotate_mode mode,
index 3b8155c..8ec418e 100644 (file)
@@ -35,16 +35,8 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
                           unsigned long irqflags,
                           const char *devname,
                           void *dev_id);
-int bind_interdomain_evtchn_to_irq(unsigned int remote_domain,
-                                  evtchn_port_t remote_port);
 int bind_interdomain_evtchn_to_irq_lateeoi(unsigned int remote_domain,
                                           evtchn_port_t remote_port);
-int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain,
-                                         evtchn_port_t remote_port,
-                                         irq_handler_t handler,
-                                         unsigned long irqflags,
-                                         const char *devname,
-                                         void *dev_id);
 int bind_interdomain_evtchn_to_irqhandler_lateeoi(unsigned int remote_domain,
                                                  evtchn_port_t remote_port,
                                                  irq_handler_t handler,
index f0b93ce..d124934 100644 (file)
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-y := core.o
-CFLAGS_core.o += $(call cc-disable-warning, override-init)
+ifneq ($(CONFIG_BPF_JIT_ALWAYS_ON),y)
+# ___bpf_prog_run() needs GCSE disabled on x86; see 3193c0836f203 for details
+cflags-nogcse-$(CONFIG_X86)$(CONFIG_CC_IS_GCC) := -fno-gcse
+endif
+CFLAGS_core.o += $(call cc-disable-warning, override-init) $(cflags-nogcse-yy)
 
 obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o bpf_iter.o map_iter.o task_iter.o prog_iter.o
 obj-$(CONFIG_BPF_SYSCALL) += hashtab.o arraymap.o percpu_freelist.o bpf_lru_list.o lpm_trie.o map_in_map.o
index aed74b8..553107f 100644 (file)
@@ -27,7 +27,11 @@ noinline RET bpf_lsm_##NAME(__VA_ARGS__)     \
 #include <linux/lsm_hook_defs.h>
 #undef LSM_HOOK
 
-#define BPF_LSM_SYM_PREFX  "bpf_lsm_"
+#define LSM_HOOK(RET, DEFAULT, NAME, ...) BTF_ID(func, bpf_lsm_##NAME)
+BTF_SET_START(bpf_lsm_hooks)
+#include <linux/lsm_hook_defs.h>
+#undef LSM_HOOK
+BTF_SET_END(bpf_lsm_hooks)
 
 int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog,
                        const struct bpf_prog *prog)
@@ -38,8 +42,7 @@ int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog,
                return -EINVAL;
        }
 
-       if (strncmp(BPF_LSM_SYM_PREFX, prog->aux->attach_func_name,
-                   sizeof(BPF_LSM_SYM_PREFX) - 1)) {
+       if (!btf_id_set_contains(&bpf_lsm_hooks, prog->aux->attach_btf_id)) {
                bpf_log(vlog, "attach_btf_id %u points to wrong type name %s\n",
                        prog->aux->attach_btf_id, prog->aux->attach_func_name);
                return -EINVAL;
index 9268d77..55454d2 100644 (file)
@@ -1369,7 +1369,7 @@ u64 __weak bpf_probe_read_kernel(void *dst, u32 size, const void *unsafe_ptr)
  *
  * Decode and execute eBPF instructions.
  */
-static u64 __no_fgcse ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack)
+static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack)
 {
 #define BPF_INSN_2_LBL(x, y)    [BPF_##x | BPF_##y] = &&x##_##y
 #define BPF_INSN_3_LBL(x, y, z) [BPF_##x | BPF_##y | BPF_##z] = &&x##_##y##_##z
index 7bf18d9..ec46266 100644 (file)
@@ -855,6 +855,32 @@ static void pcpu_copy_value(struct bpf_htab *htab, void __percpu *pptr,
        }
 }
 
+static void pcpu_init_value(struct bpf_htab *htab, void __percpu *pptr,
+                           void *value, bool onallcpus)
+{
+       /* When using prealloc and not setting the initial value on all cpus,
+        * zero-fill element values for other cpus (just as what happens when
+        * not using prealloc). Otherwise, bpf program has no way to ensure
+        * known initial values for cpus other than current one
+        * (onallcpus=false always when coming from bpf prog).
+        */
+       if (htab_is_prealloc(htab) && !onallcpus) {
+               u32 size = round_up(htab->map.value_size, 8);
+               int current_cpu = raw_smp_processor_id();
+               int cpu;
+
+               for_each_possible_cpu(cpu) {
+                       if (cpu == current_cpu)
+                               bpf_long_memcpy(per_cpu_ptr(pptr, cpu), value,
+                                               size);
+                       else
+                               memset(per_cpu_ptr(pptr, cpu), 0, size);
+               }
+       } else {
+               pcpu_copy_value(htab, pptr, value, onallcpus);
+       }
+}
+
 static bool fd_htab_map_needs_adjust(const struct bpf_htab *htab)
 {
        return htab->map.map_type == BPF_MAP_TYPE_HASH_OF_MAPS &&
@@ -925,7 +951,7 @@ static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key,
                        }
                }
 
-               pcpu_copy_value(htab, pptr, value, onallcpus);
+               pcpu_init_value(htab, pptr, value, onallcpus);
 
                if (!prealloc)
                        htab_elem_set_ptr(l_new, key_size, pptr);
@@ -1225,7 +1251,7 @@ static int __htab_lru_percpu_map_update_elem(struct bpf_map *map, void *key,
                pcpu_copy_value(htab, htab_elem_get_ptr(l_old, key_size),
                                value, onallcpus);
        } else {
-               pcpu_copy_value(htab, htab_elem_get_ptr(l_new, key_size),
+               pcpu_init_value(htab, htab_elem_get_ptr(l_new, key_size),
                                value, onallcpus);
                hlist_nulls_add_head_rcu(&l_new->hash_node, head);
                l_new = NULL;
index ace4911..26bced2 100644 (file)
@@ -6,6 +6,7 @@ config USERMODE_DRIVER
 menuconfig BPF_PRELOAD
        bool "Preload BPF file system with kernel specific program and map iterators"
        depends on BPF
+       depends on BPF_SYSCALL
        # The dependency on !COMPILE_TEST prevents it from being enabled
        # in allmodconfig or allyesconfig configurations
        depends on !COMPILE_TEST
index 7c59b09..de7eac9 100644 (file)
@@ -418,7 +418,7 @@ EXPORT_SYMBOL(ns_capable_noaudit);
 /**
  * ns_capable_setid - Determine if the current task has a superior capability
  * in effect, while signalling that this check is being done from within a
- * setid syscall.
+ * setid or setgroups syscall.
  * @ns:  The usernamespace we want the capability in
  * @cap: The capability to be tested for
  *
index 78b23f0..905c3fa 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Copyright (c) 2014 The Linux Foundation
  */
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 
index b4eea0a..781b9dc 100644 (file)
@@ -229,6 +229,7 @@ int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose)
                io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
        }
        io_tlb_index = 0;
+       no_iotlb_memory = false;
 
        if (verbose)
                swiotlb_print_info();
@@ -260,9 +261,11 @@ swiotlb_init(int verbose)
        if (vstart && !swiotlb_init_with_tbl(vstart, io_tlb_nslabs, verbose))
                return;
 
-       if (io_tlb_start)
+       if (io_tlb_start) {
                memblock_free_early(io_tlb_start,
                                    PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
+               io_tlb_start = 0;
+       }
        pr_warn("Cannot allocate buffer");
        no_iotlb_memory = true;
 }
@@ -360,6 +363,7 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs)
                io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
        }
        io_tlb_index = 0;
+       no_iotlb_memory = false;
 
        swiotlb_print_info();
 
@@ -441,14 +445,11 @@ static void swiotlb_bounce(phys_addr_t orig_addr, phys_addr_t tlb_addr,
        }
 }
 
-phys_addr_t swiotlb_tbl_map_single(struct device *hwdev,
-                                  dma_addr_t tbl_dma_addr,
-                                  phys_addr_t orig_addr,
-                                  size_t mapping_size,
-                                  size_t alloc_size,
-                                  enum dma_data_direction dir,
-                                  unsigned long attrs)
+phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, phys_addr_t orig_addr,
+               size_t mapping_size, size_t alloc_size,
+               enum dma_data_direction dir, unsigned long attrs)
 {
+       dma_addr_t tbl_dma_addr = phys_to_dma_unencrypted(hwdev, io_tlb_start);
        unsigned long flags;
        phys_addr_t tlb_addr;
        unsigned int nslots, stride, index, wrap;
@@ -667,9 +668,8 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t paddr, size_t size,
        trace_swiotlb_bounced(dev, phys_to_dma(dev, paddr), size,
                              swiotlb_force);
 
-       swiotlb_addr = swiotlb_tbl_map_single(dev,
-                       phys_to_dma_unencrypted(dev, io_tlb_start),
-                       paddr, size, size, dir, attrs);
+       swiotlb_addr = swiotlb_tbl_map_single(dev, paddr, size, size, dir,
+                       attrs);
        if (swiotlb_addr == (phys_addr_t)DMA_MAPPING_ERROR)
                return DMA_MAPPING_ERROR;
 
index 2b83666..e9e2df3 100644 (file)
@@ -337,10 +337,10 @@ noinstr irqentry_state_t irqentry_enter(struct pt_regs *regs)
         * already contains a warning when RCU is not watching, so no point
         * in having another one here.
         */
+       lockdep_hardirqs_off(CALLER_ADDR0);
        instrumentation_begin();
        rcu_irq_enter_check_tick();
-       /* Use the combo lockdep/tracing function */
-       trace_hardirqs_off();
+       trace_hardirqs_off_finish();
        instrumentation_end();
 
        return ret;
index da467e1..5a29ab0 100644 (file)
@@ -10085,6 +10085,7 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr,
                        if (token == IF_SRC_FILE || token == IF_SRC_FILEADDR) {
                                int fpos = token == IF_SRC_FILE ? 2 : 1;
 
+                               kfree(filename);
                                filename = match_strdup(&args[fpos]);
                                if (!filename) {
                                        ret = -ENOMEM;
@@ -10131,16 +10132,13 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr,
                                 */
                                ret = -EOPNOTSUPP;
                                if (!event->ctx->task)
-                                       goto fail_free_name;
+                                       goto fail;
 
                                /* look up the path and grab its inode */
                                ret = kern_path(filename, LOOKUP_FOLLOW,
                                                &filter->path);
                                if (ret)
-                                       goto fail_free_name;
-
-                               kfree(filename);
-                               filename = NULL;
+                                       goto fail;
 
                                ret = -EINVAL;
                                if (!filter->path.dentry ||
@@ -10160,13 +10158,13 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr,
        if (state != IF_STATE_ACTION)
                goto fail;
 
+       kfree(filename);
        kfree(orig);
 
        return 0;
 
-fail_free_name:
-       kfree(filename);
 fail:
+       kfree(filename);
        free_filters_list(filters);
        kfree(orig);
 
index 87a2d51..1f236ed 100644 (file)
@@ -454,7 +454,10 @@ static void exit_mm(void)
                mmap_read_unlock(mm);
 
                self.task = current;
-               self.next = xchg(&core_state->dumper.next, &self);
+               if (self.task->flags & PF_SIGNALED)
+                       self.next = xchg(&core_state->dumper.next, &self);
+               else
+                       self.task = NULL;
                /*
                 * Implies mb(), the result of xchg() must be visible
                 * to core_state->dumper.
index 32083db..6d26638 100644 (file)
@@ -2167,14 +2167,9 @@ static __latent_entropy struct task_struct *copy_process(
        /* ok, now we should be set up.. */
        p->pid = pid_nr(pid);
        if (clone_flags & CLONE_THREAD) {
-               p->exit_signal = -1;
                p->group_leader = current->group_leader;
                p->tgid = current->tgid;
        } else {
-               if (clone_flags & CLONE_PARENT)
-                       p->exit_signal = current->group_leader->exit_signal;
-               else
-                       p->exit_signal = args->exit_signal;
                p->group_leader = p;
                p->tgid = p->pid;
        }
@@ -2218,9 +2213,14 @@ static __latent_entropy struct task_struct *copy_process(
        if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
                p->real_parent = current->real_parent;
                p->parent_exec_id = current->parent_exec_id;
+               if (clone_flags & CLONE_THREAD)
+                       p->exit_signal = -1;
+               else
+                       p->exit_signal = current->group_leader->exit_signal;
        } else {
                p->real_parent = current;
                p->parent_exec_id = current->self_exec_id;
+               p->exit_signal = args->exit_signal;
        }
 
        klp_copy_process(p);
index 680854d..ac32887 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/freezer.h>
 #include <linux/memblock.h>
 #include <linux/fault-inject.h>
+#include <linux/time_namespace.h>
 
 #include <asm/futex.h>
 
@@ -1502,8 +1503,10 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_pi_state *pi_
         */
        newval = FUTEX_WAITERS | task_pid_vnr(new_owner);
 
-       if (unlikely(should_fail_futex(true)))
+       if (unlikely(should_fail_futex(true))) {
                ret = -EFAULT;
+               goto out_unlock;
+       }
 
        ret = cmpxchg_futex_value_locked(&curval, uaddr, uval, newval);
        if (!ret && (curval != uval)) {
@@ -2377,10 +2380,22 @@ retry:
                }
 
                /*
-                * Since we just failed the trylock; there must be an owner.
+                * The trylock just failed, so either there is an owner or
+                * there is a higher priority waiter than this one.
                 */
                newowner = rt_mutex_owner(&pi_state->pi_mutex);
-               BUG_ON(!newowner);
+               /*
+                * If the higher priority waiter has not yet taken over the
+                * rtmutex then newowner is NULL. We can't return here with
+                * that state because it's inconsistent vs. the user space
+                * state. So drop the locks and try again. It's a valid
+                * situation and not any different from the other retry
+                * conditions.
+                */
+               if (unlikely(!newowner)) {
+                       err = -EAGAIN;
+                       goto handle_err;
+               }
        } else {
                WARN_ON_ONCE(argowner != current);
                if (oldowner == current) {
@@ -3797,6 +3812,8 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
                t = timespec64_to_ktime(ts);
                if (cmd == FUTEX_WAIT)
                        t = ktime_add_safe(ktime_get(), t);
+               else if (!(op & FUTEX_CLOCK_REALTIME))
+                       t = timens_ktime_to_host(CLOCK_MONOTONIC, t);
                tp = &t;
        }
        /*
@@ -3989,6 +4006,8 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val,
                t = timespec64_to_ktime(ts);
                if (cmd == FUTEX_WAIT)
                        t = ktime_add_safe(ktime_get(), t);
+               else if (!(op & FUTEX_CLOCK_REALTIME))
+                       t = timens_ktime_to_host(CLOCK_MONOTONIC, t);
                tp = &t;
        }
        if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE ||
index 6ee6691..fe7e638 100644 (file)
@@ -178,7 +178,7 @@ bool may_setgroups(void)
 {
        struct user_namespace *user_ns = current_user_ns();
 
-       return ns_capable(user_ns, CAP_SETGID) &&
+       return ns_capable_setid(user_ns, CAP_SETGID) &&
                userns_may_setgroups(user_ns);
 }
 
index ce76f49..396ebae 100644 (file)
@@ -225,8 +225,7 @@ static long hung_timeout_jiffies(unsigned long last_checked,
  * Process updating of timeout sysctl
  */
 int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
-                                 void __user *buffer,
-                                 size_t *lenp, loff_t *ppos)
+                                 void *buffer, size_t *lenp, loff_t *ppos)
 {
        int ret;
 
index 10a5aff..164a031 100644 (file)
@@ -82,6 +82,7 @@ config IRQ_FASTEOI_HIERARCHY_HANDLERS
 # Generic IRQ IPI support
 config GENERIC_IRQ_IPI
        bool
+       select IRQ_DOMAIN_HIERARCHY
 
 # Generic MSI interrupt support
 config GENERIC_MSI_IRQ
index 4fb15fa..fe9de06 100644 (file)
@@ -40,10 +40,10 @@ extern const u8 kallsyms_names[] __weak;
  * has one (eg: FRV).
  */
 extern const unsigned int kallsyms_num_syms
-__attribute__((weak, section(".rodata")));
+__section(".rodata") __attribute__((weak));
 
 extern const unsigned long kallsyms_relative_base
-__attribute__((weak, section(".rodata")));
+__section(".rodata") __attribute__((weak));
 
 extern const char kallsyms_token_table[] __weak;
 extern const u16 kallsyms_token_index[] __weak;
index 6b8368b..80bfe71 100644 (file)
@@ -1023,6 +1023,8 @@ EXPORT_SYMBOL(kcov_remote_stop);
 /* See the comment before kcov_remote_start() for usage details. */
 u64 kcov_common_handle(void)
 {
+       if (!in_task())
+               return 0;
        return current->kcov_handle;
 }
 EXPORT_SYMBOL(kcov_common_handle);
index 8a12a25..41fdbb7 100644 (file)
@@ -1249,7 +1249,13 @@ __acquires(hlist_lock)
 
        *head = &kretprobe_inst_table[hash];
        hlist_lock = kretprobe_table_lock_ptr(hash);
-       raw_spin_lock_irqsave(hlist_lock, *flags);
+       /*
+        * Nested is a workaround that will soon not be needed.
+        * There's other protections that make sure the same lock
+        * is not taken on the same CPU that lockdep is unaware of.
+        * Differentiate when it is taken in NMI context.
+        */
+       raw_spin_lock_irqsave_nested(hlist_lock, *flags, !!in_nmi());
 }
 NOKPROBE_SYMBOL(kretprobe_hash_lock);
 
@@ -1258,7 +1264,13 @@ static void kretprobe_table_lock(unsigned long hash,
 __acquires(hlist_lock)
 {
        raw_spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
-       raw_spin_lock_irqsave(hlist_lock, *flags);
+       /*
+        * Nested is a workaround that will soon not be needed.
+        * There's other protections that make sure the same lock
+        * is not taken on the same CPU that lockdep is unaware of.
+        * Differentiate when it is taken in NMI context.
+        */
+       raw_spin_lock_irqsave_nested(hlist_lock, *flags, !!in_nmi());
 }
 NOKPROBE_SYMBOL(kretprobe_table_lock);
 
@@ -2028,7 +2040,12 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs)
 
        /* TODO: consider to only swap the RA after the last pre_handler fired */
        hash = hash_ptr(current, KPROBE_HASH_BITS);
-       raw_spin_lock_irqsave(&rp->lock, flags);
+       /*
+        * Nested is a workaround that will soon not be needed.
+        * There's other protections that make sure the same lock
+        * is not taken on the same CPU that lockdep is unaware of.
+        */
+       raw_spin_lock_irqsave_nested(&rp->lock, flags, 1);
        if (!hlist_empty(&rp->free_instances)) {
                ri = hlist_entry(rp->free_instances.first,
                                struct kretprobe_instance, hlist);
@@ -2039,7 +2056,7 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs)
                ri->task = current;
 
                if (rp->entry_handler && rp->entry_handler(ri, regs)) {
-                       raw_spin_lock_irqsave(&rp->lock, flags);
+                       raw_spin_lock_irqsave_nested(&rp->lock, flags, 1);
                        hlist_add_head(&ri->hlist, &rp->free_instances);
                        raw_spin_unlock_irqrestore(&rp->lock, flags);
                        return 0;
index e29773c..933a625 100644 (file)
@@ -897,7 +897,8 @@ void kthread_delayed_work_timer_fn(struct timer_list *t)
        /* Move the work from worker->delayed_work_list. */
        WARN_ON_ONCE(list_empty(&work->node));
        list_del_init(&work->node);
-       kthread_insert_work(worker, work, &worker->work_list);
+       if (!work->canceling)
+               kthread_insert_work(worker, work, &worker->work_list);
 
        raw_spin_unlock_irqrestore(&worker->lock, flags);
 }
index 3e99dfe..b71ad8d 100644 (file)
@@ -84,7 +84,7 @@ static inline bool lockdep_enabled(void)
        if (!debug_locks)
                return false;
 
-       if (raw_cpu_read(lockdep_recursion))
+       if (this_cpu_read(lockdep_recursion))
                return false;
 
        if (current->lockdep_recursion)
@@ -4057,7 +4057,7 @@ void lockdep_hardirqs_on_prepare(unsigned long ip)
        if (unlikely(in_nmi()))
                return;
 
-       if (unlikely(__this_cpu_read(lockdep_recursion)))
+       if (unlikely(this_cpu_read(lockdep_recursion)))
                return;
 
        if (unlikely(lockdep_hardirqs_enabled())) {
@@ -4126,7 +4126,7 @@ void noinstr lockdep_hardirqs_on(unsigned long ip)
                goto skip_checks;
        }
 
-       if (unlikely(__this_cpu_read(lockdep_recursion)))
+       if (unlikely(this_cpu_read(lockdep_recursion)))
                return;
 
        if (lockdep_hardirqs_enabled()) {
@@ -4396,6 +4396,9 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
        if (unlikely(hlock_class(this)->usage_mask & new_mask))
                goto unlock;
 
+       if (!hlock_class(this)->usage_mask)
+               debug_atomic_dec(nr_unused_locks);
+
        hlock_class(this)->usage_mask |= new_mask;
 
        if (new_bit < LOCK_TRACE_STATES) {
@@ -4403,19 +4406,10 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
                        return 0;
        }
 
-       switch (new_bit) {
-       case 0 ... LOCK_USED-1:
+       if (new_bit < LOCK_USED) {
                ret = mark_lock_irq(curr, this, new_bit);
                if (!ret)
                        return 0;
-               break;
-
-       case LOCK_USED:
-               debug_atomic_dec(nr_unused_locks);
-               break;
-
-       default:
-               break;
        }
 
 unlock:
index 3835fb8..164d793 100644 (file)
@@ -530,7 +530,7 @@ struct module_param_attrs
 {
        unsigned int num;
        struct attribute_group grp;
-       struct param_attribute attrs[0];
+       struct param_attribute attrs[];
 };
 
 #ifdef CONFIG_SYSFS
index 4b6a54d..45b054b 100644 (file)
@@ -146,7 +146,7 @@ int freeze_processes(void)
        BUG_ON(in_atomic());
 
        /*
-        * Now that the whole userspace is frozen we need to disbale
+        * Now that the whole userspace is frozen we need to disable
         * the OOM killer to disallow any further interference with
         * killable tasks. There is no guarantee oom victims will
         * ever reach a point they go away we have to wait with a timeout.
index 24a960a..6b15256 100644 (file)
@@ -345,7 +345,7 @@ DESC_ID((id) - DESCS_COUNT(desc_ring))
  */
 struct prb_data_block {
        unsigned long   id;
-       char            data[0];
+       char            data[];
 };
 
 /*
index 06895ef..2a52f42 100644 (file)
@@ -409,7 +409,7 @@ bool rcu_eqs_special_set(int cpu)
  *
  * The caller must have disabled interrupts and must not be idle.
  */
-void rcu_momentary_dyntick_idle(void)
+notrace void rcu_momentary_dyntick_idle(void)
 {
        int special;
 
index 8160ab5..d2003a7 100644 (file)
@@ -44,7 +44,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(sched_update_nr_running_tp);
 
 DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
 
-#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL)
+#ifdef CONFIG_SCHED_DEBUG
 /*
  * Debugging: various feature bits
  *
index 5ae7b4e..97d318b 100644 (file)
@@ -102,8 +102,12 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time)
 static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time,
                                   unsigned int next_freq)
 {
-       if (sg_policy->next_freq == next_freq)
-               return false;
+       if (!sg_policy->need_freq_update) {
+               if (sg_policy->next_freq == next_freq)
+                       return false;
+       } else {
+               sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
+       }
 
        sg_policy->next_freq = next_freq;
        sg_policy->last_freq_update_time = time;
@@ -164,7 +168,6 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
        if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update)
                return sg_policy->next_freq;
 
-       sg_policy->need_freq_update = false;
        sg_policy->cached_raw_freq = freq;
        return cpufreq_driver_resolve_freq(policy, freq);
 }
@@ -440,7 +443,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
        struct sugov_policy *sg_policy = sg_cpu->sg_policy;
        unsigned long util, max;
        unsigned int next_f;
-       bool busy;
+       unsigned int cached_freq = sg_policy->cached_raw_freq;
 
        sugov_iowait_boost(sg_cpu, time, flags);
        sg_cpu->last_update = time;
@@ -450,9 +453,6 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
        if (!sugov_should_update_freq(sg_policy, time))
                return;
 
-       /* Limits may have changed, don't skip frequency update */
-       busy = !sg_policy->need_freq_update && sugov_cpu_is_busy(sg_cpu);
-
        util = sugov_get_util(sg_cpu);
        max = sg_cpu->max;
        util = sugov_iowait_apply(sg_cpu, time, util, max);
@@ -461,11 +461,11 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
         * Do not reduce the frequency if the CPU has not been idle
         * recently, as the reduction is likely to be premature then.
         */
-       if (busy && next_f < sg_policy->next_freq) {
+       if (sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq) {
                next_f = sg_policy->next_freq;
 
-               /* Reset cached freq as next_freq has changed */
-               sg_policy->cached_raw_freq = 0;
+               /* Restore cached freq as next_freq has changed */
+               sg_policy->cached_raw_freq = cached_freq;
        }
 
        /*
@@ -826,9 +826,10 @@ static int sugov_start(struct cpufreq_policy *policy)
        sg_policy->next_freq                    = 0;
        sg_policy->work_in_progress             = false;
        sg_policy->limits_changed               = false;
-       sg_policy->need_freq_update             = false;
        sg_policy->cached_raw_freq              = 0;
 
+       sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
+
        for_each_cpu(cpu, policy->cpus) {
                struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu);
 
@@ -880,7 +881,7 @@ static void sugov_limits(struct cpufreq_policy *policy)
 struct cpufreq_governor schedutil_gov = {
        .name                   = "schedutil",
        .owner                  = THIS_MODULE,
-       .dynamic_switching      = true,
+       .flags                  = CPUFREQ_GOV_DYNAMIC_SWITCHING,
        .init                   = sugov_init,
        .exit                   = sugov_exit,
        .start                  = sugov_start,
index 6d93f45..f232305 100644 (file)
@@ -2504,7 +2504,7 @@ static void prio_changed_dl(struct rq *rq, struct task_struct *p,
 }
 
 const struct sched_class dl_sched_class
-       __attribute__((section("__dl_sched_class"))) = {
+       __section("__dl_sched_class") = {
        .enqueue_task           = enqueue_task_dl,
        .dequeue_task           = dequeue_task_dl,
        .yield_task             = yield_task_dl,
index e17012b..290f9e3 100644 (file)
@@ -11159,7 +11159,7 @@ static unsigned int get_rr_interval_fair(struct rq *rq, struct task_struct *task
  * All the scheduling class methods:
  */
 const struct sched_class fair_sched_class
-       __attribute__((section("__fair_sched_class"))) = {
+       __section("__fair_sched_class") = {
        .enqueue_task           = enqueue_task_fair,
        .dequeue_task           = dequeue_task_fair,
        .yield_task             = yield_task_fair,
index f324dc3..24d0ee2 100644 (file)
@@ -458,7 +458,7 @@ static void update_curr_idle(struct rq *rq)
  * Simple, special scheduling class for the per-CPU idle tasks:
  */
 const struct sched_class idle_sched_class
-       __attribute__((section("__idle_sched_class"))) = {
+       __section("__idle_sched_class") = {
        /* no enqueue/yield_task for idle tasks */
 
        /* dequeue is not valid, we print a debug message there: */
index f215eea..49ec096 100644 (file)
@@ -2430,7 +2430,7 @@ static unsigned int get_rr_interval_rt(struct rq *rq, struct task_struct *task)
 }
 
 const struct sched_class rt_sched_class
-       __attribute__((section("__rt_sched_class"))) = {
+       __section("__rt_sched_class") = {
        .enqueue_task           = enqueue_task_rt,
        .dequeue_task           = dequeue_task_rt,
        .yield_task             = yield_task_rt,
index 28709f6..df80bfc 100644 (file)
@@ -1471,7 +1471,7 @@ struct sched_group_capacity {
        int                     id;
 #endif
 
-       unsigned long           cpumask[0];             /* Balance mask */
+       unsigned long           cpumask[];              /* Balance mask */
 };
 
 struct sched_group {
@@ -1629,7 +1629,7 @@ enum {
 
 #undef SCHED_FEAT
 
-#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL)
+#ifdef CONFIG_SCHED_DEBUG
 
 /*
  * To support run-time toggling of sched features, all the translation units
@@ -1637,6 +1637,7 @@ enum {
  */
 extern const_debug unsigned int sysctl_sched_features;
 
+#ifdef CONFIG_JUMP_LABEL
 #define SCHED_FEAT(name, enabled)                                      \
 static __always_inline bool static_branch_##name(struct static_key *key) \
 {                                                                      \
@@ -1649,7 +1650,13 @@ static __always_inline bool static_branch_##name(struct static_key *key) \
 extern struct static_key sched_feat_keys[__SCHED_FEAT_NR];
 #define sched_feat(x) (static_branch_##x(&sched_feat_keys[__SCHED_FEAT_##x]))
 
-#else /* !(SCHED_DEBUG && CONFIG_JUMP_LABEL) */
+#else /* !CONFIG_JUMP_LABEL */
+
+#define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
+
+#endif /* CONFIG_JUMP_LABEL */
+
+#else /* !SCHED_DEBUG */
 
 /*
  * Each translation unit has its own copy of sysctl_sched_features to allow
@@ -1665,7 +1672,7 @@ static const_debug __maybe_unused unsigned int sysctl_sched_features =
 
 #define sched_feat(x) !!(sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
 
-#endif /* SCHED_DEBUG && CONFIG_JUMP_LABEL */
+#endif /* SCHED_DEBUG */
 
 extern struct static_key_false sched_numa_balancing;
 extern struct static_key_false sched_schedstats;
index 394bc81..ceb5b6b 100644 (file)
@@ -110,7 +110,7 @@ static void update_curr_stop(struct rq *rq)
  * Simple, special scheduling class for the per-CPU stop tasks:
  */
 const struct sched_class stop_sched_class
-       __attribute__((section("__stop_sched_class"))) = {
+       __section("__stop_sched_class") = {
 
        .enqueue_task           = enqueue_task_stop,
        .dequeue_task           = dequeue_task_stop,
index a38b3ed..ef8f2a2 100644 (file)
@@ -391,16 +391,17 @@ static bool task_participate_group_stop(struct task_struct *task)
 
 void task_join_group_stop(struct task_struct *task)
 {
+       unsigned long mask = current->jobctl & JOBCTL_STOP_SIGMASK;
+       struct signal_struct *sig = current->signal;
+
+       if (sig->group_stop_count) {
+               sig->group_stop_count++;
+               mask |= JOBCTL_STOP_CONSUME;
+       } else if (!(sig->flags & SIGNAL_STOP_STOPPED))
+               return;
+
        /* Have the new thread join an on-going signal group stop */
-       unsigned long jobctl = current->jobctl;
-       if (jobctl & JOBCTL_STOP_PENDING) {
-               struct signal_struct *sig = current->signal;
-               unsigned long signr = jobctl & JOBCTL_STOP_SIGMASK;
-               unsigned long gstop = JOBCTL_STOP_PENDING | JOBCTL_STOP_CONSUME;
-               if (task_set_jobctl_pending(task, signr | gstop)) {
-                       sig->group_stop_count++;
-               }
-       }
+       task_set_jobctl_pending(task, mask | JOBCTL_STOP_PENDING);
 }
 
 /*
index 865bb02..890b79c 100644 (file)
@@ -178,7 +178,7 @@ static void ack_state(struct multi_stop_data *msdata)
                set_state(msdata, msdata->state + 1);
 }
 
-void __weak stop_machine_yield(const struct cpumask *cpumask)
+notrace void __weak stop_machine_yield(const struct cpumask *cpumask)
 {
        cpu_relax();
 }
index 6401880..a730c03 100644 (file)
@@ -373,7 +373,7 @@ long __sys_setregid(gid_t rgid, gid_t egid)
        if (rgid != (gid_t) -1) {
                if (gid_eq(old->gid, krgid) ||
                    gid_eq(old->egid, krgid) ||
-                   ns_capable(old->user_ns, CAP_SETGID))
+                   ns_capable_setid(old->user_ns, CAP_SETGID))
                        new->gid = krgid;
                else
                        goto error;
@@ -382,7 +382,7 @@ long __sys_setregid(gid_t rgid, gid_t egid)
                if (gid_eq(old->gid, kegid) ||
                    gid_eq(old->egid, kegid) ||
                    gid_eq(old->sgid, kegid) ||
-                   ns_capable(old->user_ns, CAP_SETGID))
+                   ns_capable_setid(old->user_ns, CAP_SETGID))
                        new->egid = kegid;
                else
                        goto error;
@@ -432,7 +432,7 @@ long __sys_setgid(gid_t gid)
        old = current_cred();
 
        retval = -EPERM;
-       if (ns_capable(old->user_ns, CAP_SETGID))
+       if (ns_capable_setid(old->user_ns, CAP_SETGID))
                new->gid = new->egid = new->sgid = new->fsgid = kgid;
        else if (gid_eq(kgid, old->gid) || gid_eq(kgid, old->sgid))
                new->egid = new->fsgid = kgid;
@@ -744,7 +744,7 @@ long __sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid)
        old = current_cred();
 
        retval = -EPERM;
-       if (!ns_capable(old->user_ns, CAP_SETGID)) {
+       if (!ns_capable_setid(old->user_ns, CAP_SETGID)) {
                if (rgid != (gid_t) -1        && !gid_eq(krgid, old->gid) &&
                    !gid_eq(krgid, old->egid) && !gid_eq(krgid, old->sgid))
                        goto error;
@@ -871,7 +871,7 @@ long __sys_setfsgid(gid_t gid)
 
        if (gid_eq(kgid, old->gid)  || gid_eq(kgid, old->egid)  ||
            gid_eq(kgid, old->sgid) || gid_eq(kgid, old->fsgid) ||
-           ns_capable(old->user_ns, CAP_SETGID)) {
+           ns_capable_setid(old->user_ns, CAP_SETGID)) {
                if (!gid_eq(kgid, old->fsgid)) {
                        new->fsgid = kgid;
                        if (security_task_fix_setgid(new,old,LSM_SETID_FS) == 0)
@@ -2238,12 +2238,12 @@ out:
 }
 
 #ifdef CONFIG_CHECKPOINT_RESTORE
-static int prctl_get_tid_address(struct task_struct *me, int __user **tid_addr)
+static int prctl_get_tid_address(struct task_struct *me, int __user * __user *tid_addr)
 {
        return put_user(me->clear_child_tid, tid_addr);
 }
 #else
-static int prctl_get_tid_address(struct task_struct *me, int __user **tid_addr)
+static int prctl_get_tid_address(struct task_struct *me, int __user * __user *tid_addr)
 {
        return -EINVAL;
 }
@@ -2427,7 +2427,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
                error = prctl_set_mm(arg2, arg3, arg4, arg5);
                break;
        case PR_GET_TID_ADDRESS:
-               error = prctl_get_tid_address(me, (int __user **)arg2);
+               error = prctl_get_tid_address(me, (int __user * __user *)arg2);
                break;
        case PR_SET_CHILD_SUBREAPER:
                me->signal->is_child_subreaper = !!arg2;
index 3624b9b..387b4be 100644 (file)
@@ -425,11 +425,6 @@ static inline void debug_hrtimer_deactivate(struct hrtimer *timer)
        debug_object_deactivate(timer, &hrtimer_debug_descr);
 }
 
-static inline void debug_hrtimer_free(struct hrtimer *timer)
-{
-       debug_object_free(timer, &hrtimer_debug_descr);
-}
-
 static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
                           enum hrtimer_mode mode);
 
index ca4e6d5..00629e6 100644 (file)
@@ -172,10 +172,6 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id,
        u64 oval, nval, ointerval, ninterval;
        struct cpu_itimer *it = &tsk->signal->it[clock_id];
 
-       /*
-        * Use the to_ktime conversion because that clamps the maximum
-        * value to KTIME_MAX and avoid multiplication overflows.
-        */
        nval = timespec64_to_ns(&value->it_value);
        ninterval = timespec64_to_ns(&value->it_interval);
 
index 0642013..b1b9b12 100644 (file)
@@ -68,13 +68,13 @@ static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift)
        return (cyc * mult) >> shift;
 }
 
-struct clock_read_data *sched_clock_read_begin(unsigned int *seq)
+notrace struct clock_read_data *sched_clock_read_begin(unsigned int *seq)
 {
        *seq = raw_read_seqcount_latch(&cd.seq);
        return cd.read_data + (*seq & 1);
 }
 
-int sched_clock_read_retry(unsigned int seq)
+notrace int sched_clock_read_retry(unsigned int seq)
 {
        return read_seqcount_latch_retry(&cd.seq, seq);
 }
index dda05f4..c3ad64f 100644 (file)
@@ -732,11 +732,6 @@ static inline void debug_timer_deactivate(struct timer_list *timer)
        debug_object_deactivate(timer, &timer_debug_descr);
 }
 
-static inline void debug_timer_free(struct timer_list *timer)
-{
-       debug_object_free(timer, &timer_debug_descr);
-}
-
 static inline void debug_timer_assert_init(struct timer_list *timer)
 {
        debug_object_assert_init(timer, &timer_debug_descr);
@@ -1706,6 +1701,8 @@ void update_process_times(int user_tick)
 {
        struct task_struct *p = current;
 
+       PRANDOM_ADD_NOISE(jiffies, user_tick, p, 0);
+
        /* Note: this timer irq context must be accounted for as well. */
        account_process_tick(p, user_tick);
        run_local_timers();
@@ -1717,13 +1714,6 @@ void update_process_times(int user_tick)
        scheduler_tick();
        if (IS_ENABLED(CONFIG_POSIX_TIMERS))
                run_posix_cpu_timers();
-
-       /* The current CPU might make use of net randoms without receiving IRQs
-        * to renew them often enough. Let's update the net_rand_state from a
-        * non-constant value that's not affine to the number of calls to make
-        * sure it's updated when there's some activity (we don't care in idle).
-        */
-       this_cpu_add(net_rand_state.s1, rol32(jiffies, 24) + user_tick);
 }
 
 /**
index 15bf28b..dc83b3f 100644 (file)
@@ -438,14 +438,16 @@ enum {
 };
 /*
  * Used for which event context the event is in.
- *  NMI     = 0
- *  IRQ     = 1
- *  SOFTIRQ = 2
- *  NORMAL  = 3
+ *  TRANSITION = 0
+ *  NMI     = 1
+ *  IRQ     = 2
+ *  SOFTIRQ = 3
+ *  NORMAL  = 4
  *
  * See trace_recursive_lock() comment below for more details.
  */
 enum {
+       RB_CTX_TRANSITION,
        RB_CTX_NMI,
        RB_CTX_IRQ,
        RB_CTX_SOFTIRQ,
@@ -793,7 +795,7 @@ static void rb_wake_up_waiters(struct irq_work *work)
  * ring_buffer_wait - wait for input to the ring buffer
  * @buffer: buffer to wait on
  * @cpu: the cpu buffer to wait on
- * @full: wait until a full page is available, if @cpu != RING_BUFFER_ALL_CPUS
+ * @full: wait until the percentage of pages are available, if @cpu != RING_BUFFER_ALL_CPUS
  *
  * If @cpu == RING_BUFFER_ALL_CPUS then the task will wake up as soon
  * as data is added to any of the @buffer's cpu buffers. Otherwise
@@ -1952,18 +1954,18 @@ int ring_buffer_resize(struct trace_buffer *buffer, unsigned long size,
 {
        struct ring_buffer_per_cpu *cpu_buffer;
        unsigned long nr_pages;
-       int cpu, err = 0;
+       int cpu, err;
 
        /*
         * Always succeed at resizing a non-existent buffer:
         */
        if (!buffer)
-               return size;
+               return 0;
 
        /* Make sure the requested buffer exists */
        if (cpu_id != RING_BUFFER_ALL_CPUS &&
            !cpumask_test_cpu(cpu_id, buffer->cpumask))
-               return size;
+               return 0;
 
        nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
 
@@ -2119,7 +2121,7 @@ int ring_buffer_resize(struct trace_buffer *buffer, unsigned long size,
        }
 
        mutex_unlock(&buffer->mutex);
-       return size;
+       return 0;
 
  out_err:
        for_each_buffer_cpu(buffer, cpu) {
@@ -3014,10 +3016,10 @@ rb_wakeups(struct trace_buffer *buffer, struct ring_buffer_per_cpu *cpu_buffer)
  * a bit of overhead in something as critical as function tracing,
  * we use a bitmask trick.
  *
- *  bit 0 =  NMI context
- *  bit 1 =  IRQ context
- *  bit 2 =  SoftIRQ context
- *  bit 3 =  normal context.
+ *  bit 1 =  NMI context
+ *  bit 2 =  IRQ context
+ *  bit 3 =  SoftIRQ context
+ *  bit 4 =  normal context.
  *
  * This works because this is the order of contexts that can
  * preempt other contexts. A SoftIRQ never preempts an IRQ
@@ -3040,6 +3042,30 @@ rb_wakeups(struct trace_buffer *buffer, struct ring_buffer_per_cpu *cpu_buffer)
  * The least significant bit can be cleared this way, and it
  * just so happens that it is the same bit corresponding to
  * the current context.
+ *
+ * Now the TRANSITION bit breaks the above slightly. The TRANSITION bit
+ * is set when a recursion is detected at the current context, and if
+ * the TRANSITION bit is already set, it will fail the recursion.
+ * This is needed because there's a lag between the changing of
+ * interrupt context and updating the preempt count. In this case,
+ * a false positive will be found. To handle this, one extra recursion
+ * is allowed, and this is done by the TRANSITION bit. If the TRANSITION
+ * bit is already set, then it is considered a recursion and the function
+ * ends. Otherwise, the TRANSITION bit is set, and that bit is returned.
+ *
+ * On the trace_recursive_unlock(), the TRANSITION bit will be the first
+ * to be cleared. Even if it wasn't the context that set it. That is,
+ * if an interrupt comes in while NORMAL bit is set and the ring buffer
+ * is called before preempt_count() is updated, since the check will
+ * be on the NORMAL bit, the TRANSITION bit will then be set. If an
+ * NMI then comes in, it will set the NMI bit, but when the NMI code
+ * does the trace_recursive_unlock() it will clear the TRANSTION bit
+ * and leave the NMI bit set. But this is fine, because the interrupt
+ * code that set the TRANSITION bit will then clear the NMI bit when it
+ * calls trace_recursive_unlock(). If another NMI comes in, it will
+ * set the TRANSITION bit and continue.
+ *
+ * Note: The TRANSITION bit only handles a single transition between context.
  */
 
 static __always_inline int
@@ -3055,8 +3081,16 @@ trace_recursive_lock(struct ring_buffer_per_cpu *cpu_buffer)
                bit = pc & NMI_MASK ? RB_CTX_NMI :
                        pc & HARDIRQ_MASK ? RB_CTX_IRQ : RB_CTX_SOFTIRQ;
 
-       if (unlikely(val & (1 << (bit + cpu_buffer->nest))))
-               return 1;
+       if (unlikely(val & (1 << (bit + cpu_buffer->nest)))) {
+               /*
+                * It is possible that this was called by transitioning
+                * between interrupt context, and preempt_count() has not
+                * been updated yet. In this case, use the TRANSITION bit.
+                */
+               bit = RB_CTX_TRANSITION;
+               if (val & (1 << (bit + cpu_buffer->nest)))
+                       return 1;
+       }
 
        val |= (1 << (bit + cpu_buffer->nest));
        cpu_buffer->current_context = val;
@@ -3071,8 +3105,8 @@ trace_recursive_unlock(struct ring_buffer_per_cpu *cpu_buffer)
                cpu_buffer->current_context - (1 << cpu_buffer->nest);
 }
 
-/* The recursive locking above uses 4 bits */
-#define NESTED_BITS 4
+/* The recursive locking above uses 5 bits */
+#define NESTED_BITS 5
 
 /**
  * ring_buffer_nest_start - Allow to trace while nested
index 5289717..410cfeb 100644 (file)
@@ -2750,7 +2750,7 @@ trace_event_buffer_lock_reserve(struct trace_buffer **current_rb,
        /*
         * If tracing is off, but we have triggers enabled
         * we still need to look at the event data. Use the temp_buffer
-        * to store the trace event for the tigger to use. It's recusive
+        * to store the trace event for the trigger to use. It's recursive
         * safe and will not be recorded anywhere.
         */
        if (!entry && trace_file->flags & EVENT_FILE_FL_TRIGGER_COND) {
@@ -2952,7 +2952,7 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer,
        stackidx = __this_cpu_inc_return(ftrace_stack_reserve) - 1;
 
        /* This should never happen. If it does, yell once and skip */
-       if (WARN_ON_ONCE(stackidx > FTRACE_KSTACK_NESTING))
+       if (WARN_ON_ONCE(stackidx >= FTRACE_KSTACK_NESTING))
                goto out;
 
        /*
@@ -3132,7 +3132,7 @@ static char *get_trace_buf(void)
 
        /* Interrupts must see nesting incremented before we use the buffer */
        barrier();
-       return &buffer->buffer[buffer->nesting][0];
+       return &buffer->buffer[buffer->nesting - 1][0];
 }
 
 static void put_trace_buf(void)
index 34e0c4d..1dadef4 100644 (file)
@@ -99,7 +99,7 @@ enum trace_type {
 
 /* Use this for memory failure errors */
 #define MEM_FAIL(condition, fmt, ...) ({                       \
-       static bool __section(.data.once) __warned;             \
+       static bool __section(".data.once") __warned;           \
        int __ret_warn_once = !!(condition);                    \
                                                                \
        if (unlikely(__ret_warn_once && !__warned)) {           \
@@ -637,6 +637,12 @@ enum {
         * function is called to clear it.
         */
        TRACE_GRAPH_NOTRACE_BIT,
+
+       /*
+        * When transitioning between context, the preempt_count() may
+        * not be correct. Allow for a single recursion to cover this case.
+        */
+       TRACE_TRANSITION_BIT,
 };
 
 #define trace_recursion_set(bit)       do { (current)->trace_recursion |= (1<<(bit)); } while (0)
@@ -691,14 +697,27 @@ static __always_inline int trace_test_and_set_recursion(int start, int max)
                return 0;
 
        bit = trace_get_context_bit() + start;
-       if (unlikely(val & (1 << bit)))
-               return -1;
+       if (unlikely(val & (1 << bit))) {
+               /*
+                * It could be that preempt_count has not been updated during
+                * a switch between contexts. Allow for a single recursion.
+                */
+               bit = TRACE_TRANSITION_BIT;
+               if (trace_recursion_test(bit))
+                       return -1;
+               trace_recursion_set(bit);
+               barrier();
+               return bit + 1;
+       }
+
+       /* Normal check passed, clear the transition to allow it again */
+       trace_recursion_clear(TRACE_TRANSITION_BIT);
 
        val |= 1 << bit;
        current->trace_recursion = val;
        barrier();
 
-       return bit;
+       return bit + 1;
 }
 
 static __always_inline void trace_clear_recursion(int bit)
@@ -708,6 +727,7 @@ static __always_inline void trace_clear_recursion(int bit)
        if (!bit)
                return;
 
+       bit--;
        bit = 1 << bit;
        val &= ~bit;
 
index 3212e2c..881df99 100644 (file)
@@ -584,7 +584,8 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,
 {
        struct synth_field *field;
        const char *prefix = NULL, *field_type = argv[0], *field_name, *array;
-       int len, ret = 0;
+       int len, ret = -ENOMEM;
+       struct seq_buf s;
        ssize_t size;
 
        if (field_type[0] == ';')
@@ -616,10 +617,9 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,
                len--;
 
        field->name = kmemdup_nul(field_name, len, GFP_KERNEL);
-       if (!field->name) {
-               ret = -ENOMEM;
+       if (!field->name)
                goto free;
-       }
+
        if (!is_good_name(field->name)) {
                synth_err(SYNTH_ERR_BAD_NAME, errpos(field_name));
                ret = -EINVAL;
@@ -630,29 +630,29 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,
                field_type++;
        len = strlen(field_type) + 1;
 
-        if (array) {
-                int l = strlen(array);
+       if (array)
+               len += strlen(array);
 
-                if (l && array[l - 1] == ';')
-                        l--;
-                len += l;
-        }
        if (prefix)
                len += strlen(prefix);
 
        field->type = kzalloc(len, GFP_KERNEL);
-       if (!field->type) {
-               ret = -ENOMEM;
+       if (!field->type)
                goto free;
-       }
+
+       seq_buf_init(&s, field->type, len);
        if (prefix)
-               strcat(field->type, prefix);
-       strcat(field->type, field_type);
+               seq_buf_puts(&s, prefix);
+       seq_buf_puts(&s, field_type);
        if (array) {
-               strcat(field->type, array);
-               if (field->type[len - 1] == ';')
-                       field->type[len - 1] = '\0';
+               seq_buf_puts(&s, array);
+               if (s.buffer[s.len - 1] == ';')
+                       s.len--;
        }
+       if (WARN_ON_ONCE(!seq_buf_buffer_left(&s)))
+               goto free;
+
+       s.buffer[s.len] = '\0';
 
        size = synth_field_size(field->type);
        if (size < 0) {
@@ -663,14 +663,19 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,
                if (synth_field_is_string(field->type)) {
                        char *type;
 
-                       type = kzalloc(sizeof("__data_loc ") + strlen(field->type) + 1, GFP_KERNEL);
-                       if (!type) {
-                               ret = -ENOMEM;
+                       len = sizeof("__data_loc ") + strlen(field->type) + 1;
+                       type = kzalloc(len, GFP_KERNEL);
+                       if (!type)
                                goto free;
-                       }
 
-                       strcat(type, "__data_loc ");
-                       strcat(type, field->type);
+                       seq_buf_init(&s, type, len);
+                       seq_buf_puts(&s, "__data_loc ");
+                       seq_buf_puts(&s, field->type);
+
+                       if (WARN_ON_ONCE(!seq_buf_buffer_left(&s)))
+                               goto free;
+                       s.buffer[s.len] = '\0';
+
                        kfree(field->type);
                        field->type = type;
 
index 70d3d0a..90f81d3 100644 (file)
@@ -176,7 +176,7 @@ struct trace_event_call __used event_##call = {                             \
        .flags                  = TRACE_EVENT_FL_IGNORE_ENABLE,         \
 };                                                                     \
 static struct trace_event_call __used                                          \
-__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call;
+__section("_ftrace_events") *__event_##call = &event_##call;
 
 #undef FTRACE_ENTRY
 #define FTRACE_ENTRY(call, struct_name, etype, tstruct, print)         \
index b5e3496..4738ad4 100644 (file)
@@ -492,8 +492,13 @@ trace_selftest_function_recursion(void)
        unregister_ftrace_function(&test_rec_probe);
 
        ret = -1;
-       if (trace_selftest_recursion_cnt != 1) {
-               pr_cont("*callback not called once (%d)* ",
+       /*
+        * Recursion allows for transitions between context,
+        * and may call the callback twice.
+        */
+       if (trace_selftest_recursion_cnt != 1 &&
+           trace_selftest_recursion_cnt != 2) {
+               pr_cont("*callback not called once (or twice) (%d)* ",
                        trace_selftest_recursion_cnt);
                goto out;
        }
index 26efd22..3f659f8 100644 (file)
@@ -50,7 +50,7 @@ static bool ok_to_free_tracepoints;
  */
 struct tp_probes {
        struct rcu_head rcu;
-       struct tracepoint_func probes[0];
+       struct tracepoint_func probes[];
 };
 
 static inline void *allocate_probes(int count)
index 1e78faa..826a205 100644 (file)
@@ -1879,6 +1879,7 @@ config KCOV
        depends on CC_HAS_SANCOV_TRACE_PC || GCC_PLUGINS
        select DEBUG_FS
        select GCC_PLUGIN_SANCOV if !CC_HAS_SANCOV_TRACE_PC
+       select SKB_EXTENSIONS if NET
        help
          KCOV exposes kernel code coverage information in a form suitable
          for coverage-guided fuzzing (randomized testing).
@@ -2455,4 +2456,6 @@ config HYPERV_TESTING
 
 endmenu # "Kernel Testing and Coverage"
 
+source "Documentation/Kconfig"
+
 endmenu # Kernel hacking
index 97d6a57..61ddce2 100644 (file)
@@ -683,7 +683,6 @@ static int __init crc32c_test(void)
 
        /* reduce OS noise */
        local_irq_save(flags);
-       local_irq_disable();
 
        nsec = ktime_get_ns();
        for (i = 0; i < 100; i++) {
@@ -694,7 +693,6 @@ static int __init crc32c_test(void)
        nsec = ktime_get_ns() - nsec;
 
        local_irq_restore(flags);
-       local_irq_enable();
 
        pr_info("crc32c: CRC_LE_BITS = %d\n", CRC_LE_BITS);
 
@@ -768,7 +766,6 @@ static int __init crc32_test(void)
 
        /* reduce OS noise */
        local_irq_save(flags);
-       local_irq_disable();
 
        nsec = ktime_get_ns();
        for (i = 0; i < 100; i++) {
@@ -783,7 +780,6 @@ static int __init crc32_test(void)
        nsec = ktime_get_ns() - nsec;
 
        local_irq_restore(flags);
-       local_irq_enable();
 
        pr_info("crc32: CRC_LE_BITS = %d, CRC_BE BITS = %d\n",
                 CRC_LE_BITS, CRC_BE_BITS);
index 0e2deac..e02f9df 100644 (file)
@@ -8,7 +8,7 @@
 
 #define FONTDATAMAX 9216
 
-static struct font_data fontdata_10x18 = {
+static const struct font_data fontdata_10x18 = {
        { 0, 0, FONTDATAMAX, 0 }, {
        /* 0 0x00 '^@' */
        0x00, 0x00, /* 0000000000 */
index 87da8ac..6e3c4b7 100644 (file)
@@ -3,7 +3,7 @@
 
 #define FONTDATAMAX 2560
 
-static struct font_data fontdata_6x10 = {
+static const struct font_data fontdata_6x10 = {
        { 0, 0, FONTDATAMAX, 0 }, {
        /* 0 0x00 '^@' */
        0x00, /* 00000000 */
index 5e975df..2d22a24 100644 (file)
@@ -9,7 +9,7 @@
 
 #define FONTDATAMAX (11*256)
 
-static struct font_data fontdata_6x11 = {
+static const struct font_data fontdata_6x11 = {
        { 0, 0, FONTDATAMAX, 0 }, {
        /* 0 0x00 '^@' */
        0x00, /* 00000000 */
index e064477..e7442a0 100644 (file)
@@ -3,8 +3,8 @@
 
 #define FONTDATAMAX 2048
 
-static const unsigned char fontdata_6x8[FONTDATAMAX] = {
-
+static const struct font_data fontdata_6x8 = {
+       { 0, 0, FONTDATAMAX, 0 }, {
        /* 0 0x00 '^@' */
        0x00, /* 000000 */
        0x00, /* 000000 */
@@ -2564,13 +2564,13 @@ static const unsigned char fontdata_6x8[FONTDATAMAX] = {
        0x00, /* 000000 */
        0x00, /* 000000 */
        0x00, /* 000000 */
-};
+} };
 
 const struct font_desc font_6x8 = {
        .idx    = FONT6x8_IDX,
        .name   = "6x8",
        .width  = 6,
        .height = 8,
-       .data   = fontdata_6x8,
+       .data   = fontdata_6x8.data,
        .pref   = 0,
 };
index 86d298f..9cc7ae2 100644 (file)
@@ -8,7 +8,7 @@
 
 #define FONTDATAMAX 3584
 
-static struct font_data fontdata_7x14 = {
+static const struct font_data fontdata_7x14 = {
        { 0, 0, FONTDATAMAX, 0 }, {
        /* 0 0x00 '^@' */
        0x00, /* 0000000 */
index 37cedd3..bab25dc 100644 (file)
@@ -10,7 +10,7 @@
 
 #define FONTDATAMAX 4096
 
-static struct font_data fontdata_8x16 = {
+static const struct font_data fontdata_8x16 = {
        { 0, 0, FONTDATAMAX, 0 }, {
        /* 0 0x00 '^@' */
        0x00, /* 00000000 */
index 8ab6955..109d057 100644 (file)
@@ -9,7 +9,7 @@
 
 #define FONTDATAMAX 2048
 
-static struct font_data fontdata_8x8 = {
+static const struct font_data fontdata_8x8 = {
        { 0, 0, FONTDATAMAX, 0 }, {
        /* 0 0x00 '^@' */
        0x00, /* 00000000 */
index 069b3e8..fb395f0 100644 (file)
@@ -5,7 +5,7 @@
 
 #define FONTDATAMAX 2048
 
-static struct font_data acorndata_8x8 = {
+static const struct font_data acorndata_8x8 = {
 { 0, 0, FONTDATAMAX, 0 }, {
 /* 00 */  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */
 /* 01 */  0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, /* ^A */
index 1449876..592774a 100644 (file)
@@ -43,7 +43,7 @@ __END__;
 
 #define FONTDATAMAX 1536
 
-static struct font_data fontdata_mini_4x6 = {
+static const struct font_data fontdata_mini_4x6 = {
        { 0, 0, FONTDATAMAX, 0 }, {
        /*{*/
                /*   Char 0: ' '  */
index 32d6555..a6f95eb 100644 (file)
@@ -14,7 +14,7 @@
 
 #define FONTDATAMAX 2048
 
-static struct font_data fontdata_pearl8x8 = {
+static const struct font_data fontdata_pearl8x8 = {
    { 0, 0, FONTDATAMAX, 0 }, {
    /* 0 0x00 '^@' */
    0x00, /* 00000000 */
index 641a6b4..a5b65bd 100644 (file)
@@ -3,7 +3,7 @@
 
 #define FONTDATAMAX 11264
 
-static struct font_data fontdata_sun12x22 = {
+static const struct font_data fontdata_sun12x22 = {
        { 0, 0, FONTDATAMAX, 0 }, {
        /* 0 0x00 '^@' */
        0x00, 0x00, /* 000000000000 */
index 193fe6d..e577e76 100644 (file)
@@ -3,7 +3,7 @@
 
 #define FONTDATAMAX 4096
 
-static struct font_data fontdata_sun8x16 = {
+static const struct font_data fontdata_sun8x16 = {
 { 0, 0, FONTDATAMAX, 0 }, {
 /* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 /* */ 0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00,
index 91b9c28..f7c3abb 100644 (file)
@@ -4,7 +4,7 @@
 
 #define FONTDATAMAX 16384
 
-static struct font_data fontdata_ter16x32 = {
+static const struct font_data fontdata_ter16x32 = {
        { 0, 0, FONTDATAMAX, 0 }, {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x7f, 0xfc, 0x7f, 0xfc,
index dfb9981..4d0e05e 100644 (file)
 #include <linux/jiffies.h>
 #include <linux/random.h>
 #include <linux/sched.h>
+#include <linux/bitops.h>
 #include <asm/unaligned.h>
 #include <trace/events/random.h>
 
-#ifdef CONFIG_RANDOM32_SELFTEST
-static void __init prandom_state_selftest(void);
-#else
-static inline void prandom_state_selftest(void)
-{
-}
-#endif
-
-DEFINE_PER_CPU(struct rnd_state, net_rand_state)  __latent_entropy;
-
 /**
  *     prandom_u32_state - seeded pseudo-random number generator.
  *     @state: pointer to state structure holding seeded state.
@@ -71,26 +62,6 @@ u32 prandom_u32_state(struct rnd_state *state)
 EXPORT_SYMBOL(prandom_u32_state);
 
 /**
- *     prandom_u32 - pseudo random number generator
- *
- *     A 32 bit pseudo-random number is generated using a fast
- *     algorithm suitable for simulation. This algorithm is NOT
- *     considered safe for cryptographic use.
- */
-u32 prandom_u32(void)
-{
-       struct rnd_state *state = &get_cpu_var(net_rand_state);
-       u32 res;
-
-       res = prandom_u32_state(state);
-       trace_prandom_u32(res);
-       put_cpu_var(net_rand_state);
-
-       return res;
-}
-EXPORT_SYMBOL(prandom_u32);
-
-/**
  *     prandom_bytes_state - get the requested number of pseudo-random bytes
  *
  *     @state: pointer to state structure holding seeded state.
@@ -121,20 +92,6 @@ void prandom_bytes_state(struct rnd_state *state, void *buf, size_t bytes)
 }
 EXPORT_SYMBOL(prandom_bytes_state);
 
-/**
- *     prandom_bytes - get the requested number of pseudo-random bytes
- *     @buf: where to copy the pseudo-random bytes to
- *     @bytes: the requested number of bytes
- */
-void prandom_bytes(void *buf, size_t bytes)
-{
-       struct rnd_state *state = &get_cpu_var(net_rand_state);
-
-       prandom_bytes_state(state, buf, bytes);
-       put_cpu_var(net_rand_state);
-}
-EXPORT_SYMBOL(prandom_bytes);
-
 static void prandom_warmup(struct rnd_state *state)
 {
        /* Calling RNG ten times to satisfy recurrence condition */
@@ -150,96 +107,6 @@ static void prandom_warmup(struct rnd_state *state)
        prandom_u32_state(state);
 }
 
-static u32 __extract_hwseed(void)
-{
-       unsigned int val = 0;
-
-       (void)(arch_get_random_seed_int(&val) ||
-              arch_get_random_int(&val));
-
-       return val;
-}
-
-static void prandom_seed_early(struct rnd_state *state, u32 seed,
-                              bool mix_with_hwseed)
-{
-#define LCG(x)  ((x) * 69069U) /* super-duper LCG */
-#define HWSEED() (mix_with_hwseed ? __extract_hwseed() : 0)
-       state->s1 = __seed(HWSEED() ^ LCG(seed),        2U);
-       state->s2 = __seed(HWSEED() ^ LCG(state->s1),   8U);
-       state->s3 = __seed(HWSEED() ^ LCG(state->s2),  16U);
-       state->s4 = __seed(HWSEED() ^ LCG(state->s3), 128U);
-}
-
-/**
- *     prandom_seed - add entropy to pseudo random number generator
- *     @entropy: entropy value
- *
- *     Add some additional entropy to the prandom pool.
- */
-void prandom_seed(u32 entropy)
-{
-       int i;
-       /*
-        * No locking on the CPUs, but then somewhat random results are, well,
-        * expected.
-        */
-       for_each_possible_cpu(i) {
-               struct rnd_state *state = &per_cpu(net_rand_state, i);
-
-               state->s1 = __seed(state->s1 ^ entropy, 2U);
-               prandom_warmup(state);
-       }
-}
-EXPORT_SYMBOL(prandom_seed);
-
-/*
- *     Generate some initially weak seeding values to allow
- *     to start the prandom_u32() engine.
- */
-static int __init prandom_init(void)
-{
-       int i;
-
-       prandom_state_selftest();
-
-       for_each_possible_cpu(i) {
-               struct rnd_state *state = &per_cpu(net_rand_state, i);
-               u32 weak_seed = (i + jiffies) ^ random_get_entropy();
-
-               prandom_seed_early(state, weak_seed, true);
-               prandom_warmup(state);
-       }
-
-       return 0;
-}
-core_initcall(prandom_init);
-
-static void __prandom_timer(struct timer_list *unused);
-
-static DEFINE_TIMER(seed_timer, __prandom_timer);
-
-static void __prandom_timer(struct timer_list *unused)
-{
-       u32 entropy;
-       unsigned long expires;
-
-       get_random_bytes(&entropy, sizeof(entropy));
-       prandom_seed(entropy);
-
-       /* reseed every ~60 seconds, in [40 .. 80) interval with slack */
-       expires = 40 + prandom_u32_max(40);
-       seed_timer.expires = jiffies + msecs_to_jiffies(expires * MSEC_PER_SEC);
-
-       add_timer(&seed_timer);
-}
-
-static void __init __prandom_start_seed_timer(void)
-{
-       seed_timer.expires = jiffies + msecs_to_jiffies(40 * MSEC_PER_SEC);
-       add_timer(&seed_timer);
-}
-
 void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state)
 {
        int i;
@@ -259,51 +126,6 @@ void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state)
 }
 EXPORT_SYMBOL(prandom_seed_full_state);
 
-/*
- *     Generate better values after random number generator
- *     is fully initialized.
- */
-static void __prandom_reseed(bool late)
-{
-       unsigned long flags;
-       static bool latch = false;
-       static DEFINE_SPINLOCK(lock);
-
-       /* Asking for random bytes might result in bytes getting
-        * moved into the nonblocking pool and thus marking it
-        * as initialized. In this case we would double back into
-        * this function and attempt to do a late reseed.
-        * Ignore the pointless attempt to reseed again if we're
-        * already waiting for bytes when the nonblocking pool
-        * got initialized.
-        */
-
-       /* only allow initial seeding (late == false) once */
-       if (!spin_trylock_irqsave(&lock, flags))
-               return;
-
-       if (latch && !late)
-               goto out;
-
-       latch = true;
-       prandom_seed_full_state(&net_rand_state);
-out:
-       spin_unlock_irqrestore(&lock, flags);
-}
-
-void prandom_reseed_late(void)
-{
-       __prandom_reseed(true);
-}
-
-static int __init prandom_reseed(void)
-{
-       __prandom_reseed(false);
-       __prandom_start_seed_timer();
-       return 0;
-}
-late_initcall(prandom_reseed);
-
 #ifdef CONFIG_RANDOM32_SELFTEST
 static struct prandom_test1 {
        u32 seed;
@@ -423,7 +245,28 @@ static struct prandom_test2 {
        {  407983964U, 921U,  728767059U },
 };
 
-static void __init prandom_state_selftest(void)
+static u32 __extract_hwseed(void)
+{
+       unsigned int val = 0;
+
+       (void)(arch_get_random_seed_int(&val) ||
+              arch_get_random_int(&val));
+
+       return val;
+}
+
+static void prandom_seed_early(struct rnd_state *state, u32 seed,
+                              bool mix_with_hwseed)
+{
+#define LCG(x)  ((x) * 69069U) /* super-duper LCG */
+#define HWSEED() (mix_with_hwseed ? __extract_hwseed() : 0)
+       state->s1 = __seed(HWSEED() ^ LCG(seed),        2U);
+       state->s2 = __seed(HWSEED() ^ LCG(state->s1),   8U);
+       state->s3 = __seed(HWSEED() ^ LCG(state->s2),  16U);
+       state->s4 = __seed(HWSEED() ^ LCG(state->s3), 128U);
+}
+
+static int __init prandom_state_selftest(void)
 {
        int i, j, errors = 0, runs = 0;
        bool error = false;
@@ -463,5 +306,327 @@ static void __init prandom_state_selftest(void)
                pr_warn("prandom: %d/%d self tests failed\n", errors, runs);
        else
                pr_info("prandom: %d self tests passed\n", runs);
+       return 0;
 }
+core_initcall(prandom_state_selftest);
 #endif
+
+/*
+ * The prandom_u32() implementation is now completely separate from the
+ * prandom_state() functions, which are retained (for now) for compatibility.
+ *
+ * Because of (ab)use in the networking code for choosing random TCP/UDP port
+ * numbers, which open DoS possibilities if guessable, we want something
+ * stronger than a standard PRNG.  But the performance requirements of
+ * the network code do not allow robust crypto for this application.
+ *
+ * So this is a homebrew Junior Spaceman implementation, based on the
+ * lowest-latency trustworthy crypto primitive available, SipHash.
+ * (The authors of SipHash have not been consulted about this abuse of
+ * their work.)
+ *
+ * Standard SipHash-2-4 uses 2n+4 rounds to hash n words of input to
+ * one word of output.  This abbreviated version uses 2 rounds per word
+ * of output.
+ */
+
+struct siprand_state {
+       unsigned long v0;
+       unsigned long v1;
+       unsigned long v2;
+       unsigned long v3;
+};
+
+static DEFINE_PER_CPU(struct siprand_state, net_rand_state) __latent_entropy;
+DEFINE_PER_CPU(unsigned long, net_rand_noise);
+EXPORT_PER_CPU_SYMBOL(net_rand_noise);
+
+/*
+ * This is the core CPRNG function.  As "pseudorandom", this is not used
+ * for truly valuable things, just intended to be a PITA to guess.
+ * For maximum speed, we do just two SipHash rounds per word.  This is
+ * the same rate as 4 rounds per 64 bits that SipHash normally uses,
+ * so hopefully it's reasonably secure.
+ *
+ * There are two changes from the official SipHash finalization:
+ * - We omit some constants XORed with v2 in the SipHash spec as irrelevant;
+ *   they are there only to make the output rounds distinct from the input
+ *   rounds, and this application has no input rounds.
+ * - Rather than returning v0^v1^v2^v3, return v1+v3.
+ *   If you look at the SipHash round, the last operation on v3 is
+ *   "v3 ^= v0", so "v0 ^ v3" just undoes that, a waste of time.
+ *   Likewise "v1 ^= v2".  (The rotate of v2 makes a difference, but
+ *   it still cancels out half of the bits in v2 for no benefit.)
+ *   Second, since the last combining operation was xor, continue the
+ *   pattern of alternating xor/add for a tiny bit of extra non-linearity.
+ */
+static inline u32 siprand_u32(struct siprand_state *s)
+{
+       unsigned long v0 = s->v0, v1 = s->v1, v2 = s->v2, v3 = s->v3;
+       unsigned long n = raw_cpu_read(net_rand_noise);
+
+       v3 ^= n;
+       PRND_SIPROUND(v0, v1, v2, v3);
+       PRND_SIPROUND(v0, v1, v2, v3);
+       v0 ^= n;
+       s->v0 = v0;  s->v1 = v1;  s->v2 = v2;  s->v3 = v3;
+       return v1 + v3;
+}
+
+
+/**
+ *     prandom_u32 - pseudo random number generator
+ *
+ *     A 32 bit pseudo-random number is generated using a fast
+ *     algorithm suitable for simulation. This algorithm is NOT
+ *     considered safe for cryptographic use.
+ */
+u32 prandom_u32(void)
+{
+       struct siprand_state *state = get_cpu_ptr(&net_rand_state);
+       u32 res = siprand_u32(state);
+
+       trace_prandom_u32(res);
+       put_cpu_ptr(&net_rand_state);
+       return res;
+}
+EXPORT_SYMBOL(prandom_u32);
+
+/**
+ *     prandom_bytes - get the requested number of pseudo-random bytes
+ *     @buf: where to copy the pseudo-random bytes to
+ *     @bytes: the requested number of bytes
+ */
+void prandom_bytes(void *buf, size_t bytes)
+{
+       struct siprand_state *state = get_cpu_ptr(&net_rand_state);
+       u8 *ptr = buf;
+
+       while (bytes >= sizeof(u32)) {
+               put_unaligned(siprand_u32(state), (u32 *)ptr);
+               ptr += sizeof(u32);
+               bytes -= sizeof(u32);
+       }
+
+       if (bytes > 0) {
+               u32 rem = siprand_u32(state);
+
+               do {
+                       *ptr++ = (u8)rem;
+                       rem >>= BITS_PER_BYTE;
+               } while (--bytes > 0);
+       }
+       put_cpu_ptr(&net_rand_state);
+}
+EXPORT_SYMBOL(prandom_bytes);
+
+/**
+ *     prandom_seed - add entropy to pseudo random number generator
+ *     @entropy: entropy value
+ *
+ *     Add some additional seed material to the prandom pool.
+ *     The "entropy" is actually our IP address (the only caller is
+ *     the network code), not for unpredictability, but to ensure that
+ *     different machines are initialized differently.
+ */
+void prandom_seed(u32 entropy)
+{
+       int i;
+
+       add_device_randomness(&entropy, sizeof(entropy));
+
+       for_each_possible_cpu(i) {
+               struct siprand_state *state = per_cpu_ptr(&net_rand_state, i);
+               unsigned long v0 = state->v0, v1 = state->v1;
+               unsigned long v2 = state->v2, v3 = state->v3;
+
+               do {
+                       v3 ^= entropy;
+                       PRND_SIPROUND(v0, v1, v2, v3);
+                       PRND_SIPROUND(v0, v1, v2, v3);
+                       v0 ^= entropy;
+               } while (unlikely(!v0 || !v1 || !v2 || !v3));
+
+               WRITE_ONCE(state->v0, v0);
+               WRITE_ONCE(state->v1, v1);
+               WRITE_ONCE(state->v2, v2);
+               WRITE_ONCE(state->v3, v3);
+       }
+}
+EXPORT_SYMBOL(prandom_seed);
+
+/*
+ *     Generate some initially weak seeding values to allow
+ *     the prandom_u32() engine to be started.
+ */
+static int __init prandom_init_early(void)
+{
+       int i;
+       unsigned long v0, v1, v2, v3;
+
+       if (!arch_get_random_long(&v0))
+               v0 = jiffies;
+       if (!arch_get_random_long(&v1))
+               v1 = random_get_entropy();
+       v2 = v0 ^ PRND_K0;
+       v3 = v1 ^ PRND_K1;
+
+       for_each_possible_cpu(i) {
+               struct siprand_state *state;
+
+               v3 ^= i;
+               PRND_SIPROUND(v0, v1, v2, v3);
+               PRND_SIPROUND(v0, v1, v2, v3);
+               v0 ^= i;
+
+               state = per_cpu_ptr(&net_rand_state, i);
+               state->v0 = v0;  state->v1 = v1;
+               state->v2 = v2;  state->v3 = v3;
+       }
+
+       return 0;
+}
+core_initcall(prandom_init_early);
+
+
+/* Stronger reseeding when available, and periodically thereafter. */
+static void prandom_reseed(struct timer_list *unused);
+
+static DEFINE_TIMER(seed_timer, prandom_reseed);
+
+static void prandom_reseed(struct timer_list *unused)
+{
+       unsigned long expires;
+       int i;
+
+       /*
+        * Reinitialize each CPU's PRNG with 128 bits of key.
+        * No locking on the CPUs, but then somewhat random results are,
+        * well, expected.
+        */
+       for_each_possible_cpu(i) {
+               struct siprand_state *state;
+               unsigned long v0 = get_random_long(), v2 = v0 ^ PRND_K0;
+               unsigned long v1 = get_random_long(), v3 = v1 ^ PRND_K1;
+#if BITS_PER_LONG == 32
+               int j;
+
+               /*
+                * On 32-bit machines, hash in two extra words to
+                * approximate 128-bit key length.  Not that the hash
+                * has that much security, but this prevents a trivial
+                * 64-bit brute force.
+                */
+               for (j = 0; j < 2; j++) {
+                       unsigned long m = get_random_long();
+
+                       v3 ^= m;
+                       PRND_SIPROUND(v0, v1, v2, v3);
+                       PRND_SIPROUND(v0, v1, v2, v3);
+                       v0 ^= m;
+               }
+#endif
+               /*
+                * Probably impossible in practice, but there is a
+                * theoretical risk that a race between this reseeding
+                * and the target CPU writing its state back could
+                * create the all-zero SipHash fixed point.
+                *
+                * To ensure that never happens, ensure the state
+                * we write contains no zero words.
+                */
+               state = per_cpu_ptr(&net_rand_state, i);
+               WRITE_ONCE(state->v0, v0 ? v0 : -1ul);
+               WRITE_ONCE(state->v1, v1 ? v1 : -1ul);
+               WRITE_ONCE(state->v2, v2 ? v2 : -1ul);
+               WRITE_ONCE(state->v3, v3 ? v3 : -1ul);
+       }
+
+       /* reseed every ~60 seconds, in [40 .. 80) interval with slack */
+       expires = round_jiffies(jiffies + 40 * HZ + prandom_u32_max(40 * HZ));
+       mod_timer(&seed_timer, expires);
+}
+
+/*
+ * The random ready callback can be called from almost any interrupt.
+ * To avoid worrying about whether it's safe to delay that interrupt
+ * long enough to seed all CPUs, just schedule an immediate timer event.
+ */
+static void prandom_timer_start(struct random_ready_callback *unused)
+{
+       mod_timer(&seed_timer, jiffies);
+}
+
+#ifdef CONFIG_RANDOM32_SELFTEST
+/* Principle: True 32-bit random numbers will all have 16 differing bits on
+ * average. For each 32-bit number, there are 601M numbers differing by 16
+ * bits, and 89% of the numbers differ by at least 12 bits. Note that more
+ * than 16 differing bits also implies a correlation with inverted bits. Thus
+ * we take 1024 random numbers and compare each of them to the other ones,
+ * counting the deviation of correlated bits to 16. Constants report 32,
+ * counters 32-log2(TEST_SIZE), and pure randoms, around 6 or lower. With the
+ * u32 total, TEST_SIZE may be as large as 4096 samples.
+ */
+#define TEST_SIZE 1024
+static int __init prandom32_state_selftest(void)
+{
+       unsigned int x, y, bits, samples;
+       u32 xor, flip;
+       u32 total;
+       u32 *data;
+
+       data = kmalloc(sizeof(*data) * TEST_SIZE, GFP_KERNEL);
+       if (!data)
+               return 0;
+
+       for (samples = 0; samples < TEST_SIZE; samples++)
+               data[samples] = prandom_u32();
+
+       flip = total = 0;
+       for (x = 0; x < samples; x++) {
+               for (y = 0; y < samples; y++) {
+                       if (x == y)
+                               continue;
+                       xor = data[x] ^ data[y];
+                       flip |= xor;
+                       bits = hweight32(xor);
+                       total += (bits - 16) * (bits - 16);
+               }
+       }
+
+       /* We'll return the average deviation as 2*sqrt(corr/samples), which
+        * is also sqrt(4*corr/samples) which provides a better resolution.
+        */
+       bits = int_sqrt(total / (samples * (samples - 1)) * 4);
+       if (bits > 6)
+               pr_warn("prandom32: self test failed (at least %u bits"
+                       " correlated, fixed_mask=%#x fixed_value=%#x\n",
+                       bits, ~flip, data[0] & ~flip);
+       else
+               pr_info("prandom32: self test passed (less than %u bits"
+                       " correlated)\n",
+                       bits+1);
+       kfree(data);
+       return 0;
+}
+core_initcall(prandom32_state_selftest);
+#endif /*  CONFIG_RANDOM32_SELFTEST */
+
+/*
+ * Start periodic full reseeding as soon as strong
+ * random numbers are available.
+ */
+static int __init prandom_init_late(void)
+{
+       static struct random_ready_callback random_ready = {
+               .func = prandom_timer_start
+       };
+       int ret = add_random_ready_callback(&random_ready);
+
+       if (ret == -EALREADY) {
+               prandom_timer_start(&random_ready);
+               ret = 0;
+       }
+       return ret;
+}
+late_initcall(prandom_init_late);
index 9a4992d..a597789 100644 (file)
@@ -595,7 +595,7 @@ struct scatterlist *sgl_alloc_order(unsigned long long length,
                elem_len = min_t(u64, length, PAGE_SIZE << order);
                page = alloc_pages(gfp, order);
                if (!page) {
-                       sgl_free(sgl);
+                       sgl_free_order(sgl, order);
                        return NULL;
                }
 
@@ -933,7 +933,7 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,
        sg_miter_start(&miter, sgl, nents, sg_flags);
 
        if (!sg_miter_skip(&miter, skip))
-               return false;
+               return 0;
 
        while ((offset < buflen) && sg_miter_next(&miter)) {
                unsigned int len;
index 63c2617..662f862 100644 (file)
@@ -216,6 +216,12 @@ static void kmalloc_oob_16(struct kunit *test)
                u64 words[2];
        } *ptr1, *ptr2;
 
+       /* This test is specifically crafted for the generic mode. */
+       if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
+               kunit_info(test, "CONFIG_KASAN_GENERIC required\n");
+               return;
+       }
+
        ptr1 = kmalloc(sizeof(*ptr1) - 3, GFP_KERNEL);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1);
 
@@ -227,6 +233,23 @@ static void kmalloc_oob_16(struct kunit *test)
        kfree(ptr2);
 }
 
+static void kmalloc_uaf_16(struct kunit *test)
+{
+       struct {
+               u64 words[2];
+       } *ptr1, *ptr2;
+
+       ptr1 = kmalloc(sizeof(*ptr1), GFP_KERNEL);
+       KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1);
+
+       ptr2 = kmalloc(sizeof(*ptr2), GFP_KERNEL);
+       KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2);
+       kfree(ptr2);
+
+       KUNIT_EXPECT_KASAN_FAIL(test, *ptr1 = *ptr2);
+       kfree(ptr1);
+}
+
 static void kmalloc_oob_memset_2(struct kunit *test)
 {
        char *ptr;
@@ -429,6 +452,12 @@ static void kasan_global_oob(struct kunit *test)
        volatile int i = 3;
        char *p = &global_array[ARRAY_SIZE(global_array) + i];
 
+       /* Only generic mode instruments globals. */
+       if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
+               kunit_info(test, "CONFIG_KASAN_GENERIC required");
+               return;
+       }
+
        KUNIT_EXPECT_KASAN_FAIL(test, *(volatile char *)p);
 }
 
@@ -467,6 +496,12 @@ static void kasan_alloca_oob_left(struct kunit *test)
        char alloca_array[i];
        char *p = alloca_array - 1;
 
+       /* Only generic mode instruments dynamic allocas. */
+       if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
+               kunit_info(test, "CONFIG_KASAN_GENERIC required");
+               return;
+       }
+
        if (!IS_ENABLED(CONFIG_KASAN_STACK)) {
                kunit_info(test, "CONFIG_KASAN_STACK is not enabled");
                return;
@@ -481,6 +516,12 @@ static void kasan_alloca_oob_right(struct kunit *test)
        char alloca_array[i];
        char *p = alloca_array + i;
 
+       /* Only generic mode instruments dynamic allocas. */
+       if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
+               kunit_info(test, "CONFIG_KASAN_GENERIC required");
+               return;
+       }
+
        if (!IS_ENABLED(CONFIG_KASAN_STACK)) {
                kunit_info(test, "CONFIG_KASAN_STACK is not enabled");
                return;
@@ -551,6 +592,9 @@ static void kasan_memchr(struct kunit *test)
                return;
        }
 
+       if (OOB_TAG_OFF)
+               size = round_up(size, OOB_TAG_OFF);
+
        ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
 
@@ -573,6 +617,9 @@ static void kasan_memcmp(struct kunit *test)
                return;
        }
 
+       if (OOB_TAG_OFF)
+               size = round_up(size, OOB_TAG_OFF);
+
        ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
        memset(arr, 0, sizeof(arr));
@@ -619,13 +666,50 @@ static void kasan_strings(struct kunit *test)
        KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = strnlen(ptr, 1));
 }
 
-static void kasan_bitops(struct kunit *test)
+static void kasan_bitops_modify(struct kunit *test, int nr, void *addr)
+{
+       KUNIT_EXPECT_KASAN_FAIL(test, set_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __set_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, clear_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, clear_bit_unlock(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit_unlock(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, change_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __change_bit(nr, addr));
+}
+
+static void kasan_bitops_test_and_modify(struct kunit *test, int nr, void *addr)
+{
+       KUNIT_EXPECT_KASAN_FAIL(test, test_and_set_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __test_and_set_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, test_and_set_bit_lock(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, test_and_clear_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __test_and_clear_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, test_and_change_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __test_and_change_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = test_bit(nr, addr));
+
+#if defined(clear_bit_unlock_is_negative_byte)
+       KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result =
+                               clear_bit_unlock_is_negative_byte(nr, addr));
+#endif
+}
+
+static void kasan_bitops_generic(struct kunit *test)
 {
+       long *bits;
+
+       /* This test is specifically crafted for the generic mode. */
+       if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
+               kunit_info(test, "CONFIG_KASAN_GENERIC required\n");
+               return;
+       }
+
        /*
         * Allocate 1 more byte, which causes kzalloc to round up to 16-bytes;
         * this way we do not actually corrupt other memory.
         */
-       long *bits = kzalloc(sizeof(*bits) + 1, GFP_KERNEL);
+       bits = kzalloc(sizeof(*bits) + 1, GFP_KERNEL);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, bits);
 
        /*
@@ -633,55 +717,34 @@ static void kasan_bitops(struct kunit *test)
         * below accesses are still out-of-bounds, since bitops are defined to
         * operate on the whole long the bit is in.
         */
-       KUNIT_EXPECT_KASAN_FAIL(test, set_bit(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, __set_bit(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, clear_bit(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, clear_bit_unlock(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit_unlock(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, change_bit(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, __change_bit(BITS_PER_LONG, bits));
+       kasan_bitops_modify(test, BITS_PER_LONG, bits);
 
        /*
         * Below calls try to access bit beyond allocated memory.
         */
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               test_and_set_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               __test_and_set_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               test_and_set_bit_lock(BITS_PER_LONG + BITS_PER_BYTE, bits));
+       kasan_bitops_test_and_modify(test, BITS_PER_LONG + BITS_PER_BYTE, bits);
 
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               test_and_clear_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
+       kfree(bits);
+}
 
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               __test_and_clear_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
+static void kasan_bitops_tags(struct kunit *test)
+{
+       long *bits;
 
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               test_and_change_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
+       /* This test is specifically crafted for the tag-based mode. */
+       if (IS_ENABLED(CONFIG_KASAN_GENERIC)) {
+               kunit_info(test, "CONFIG_KASAN_SW_TAGS required\n");
+               return;
+       }
 
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               __test_and_change_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
+       /* Allocation size will be rounded to up granule size, which is 16. */
+       bits = kzalloc(sizeof(*bits), GFP_KERNEL);
+       KUNIT_ASSERT_NOT_ERR_OR_NULL(test, bits);
 
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               kasan_int_result =
-                       test_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
+       /* Do the accesses past the 16 allocated bytes. */
+       kasan_bitops_modify(test, BITS_PER_LONG, &bits[1]);
+       kasan_bitops_test_and_modify(test, BITS_PER_LONG + BITS_PER_BYTE, &bits[1]);
 
-#if defined(clear_bit_unlock_is_negative_byte)
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               kasan_int_result = clear_bit_unlock_is_negative_byte(
-                       BITS_PER_LONG + BITS_PER_BYTE, bits));
-#endif
        kfree(bits);
 }
 
@@ -728,6 +791,7 @@ static struct kunit_case kasan_kunit_test_cases[] = {
        KUNIT_CASE(kmalloc_oob_krealloc_more),
        KUNIT_CASE(kmalloc_oob_krealloc_less),
        KUNIT_CASE(kmalloc_oob_16),
+       KUNIT_CASE(kmalloc_uaf_16),
        KUNIT_CASE(kmalloc_oob_in_memset),
        KUNIT_CASE(kmalloc_oob_memset_2),
        KUNIT_CASE(kmalloc_oob_memset_4),
@@ -751,7 +815,8 @@ static struct kunit_case kasan_kunit_test_cases[] = {
        KUNIT_CASE(kasan_memchr),
        KUNIT_CASE(kasan_memcmp),
        KUNIT_CASE(kasan_strings),
-       KUNIT_CASE(kasan_bitops),
+       KUNIT_CASE(kasan_bitops_generic),
+       KUNIT_CASE(kasan_bitops_tags),
        KUNIT_CASE(kmalloc_double_kzfree),
        KUNIT_CASE(vmalloc_oob),
        {}
index fe76f8f..5a620f6 100644 (file)
@@ -648,6 +648,8 @@ retry:
                        }
 
                        del += t - f;
+                       hugetlb_cgroup_uncharge_file_region(
+                               resv, rg, t - f);
 
                        /* New entry for end of split region */
                        nrg->from = t;
@@ -660,9 +662,6 @@ retry:
                        /* Original entry is trimmed */
                        rg->to = f;
 
-                       hugetlb_cgroup_uncharge_file_region(
-                               resv, rg, nrg->to - nrg->from);
-
                        list_add(&nrg->link, &rg->link);
                        nrg = NULL;
                        break;
@@ -678,17 +677,17 @@ retry:
                }
 
                if (f <= rg->from) {    /* Trim beginning of region */
-                       del += t - rg->from;
-                       rg->from = t;
-
                        hugetlb_cgroup_uncharge_file_region(resv, rg,
                                                            t - rg->from);
-               } else {                /* Trim end of region */
-                       del += rg->to - f;
-                       rg->to = f;
 
+                       del += t - rg->from;
+                       rg->from = t;
+               } else {                /* Trim end of region */
                        hugetlb_cgroup_uncharge_file_region(resv, rg,
                                                            rg->to - f);
+
+                       del += rg->to - f;
+                       rg->to = f;
                }
        }
 
@@ -2443,6 +2442,9 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
 
                rsv_adjust = hugepage_subpool_put_pages(spool, 1);
                hugetlb_acct_memory(h, -rsv_adjust);
+               if (deferred_reserve)
+                       hugetlb_cgroup_uncharge_page_rsvd(hstate_index(h),
+                                       pages_per_huge_page(h), page);
        }
        return page;
 
index 3a24e3b..3dcbf24 100644 (file)
@@ -4110,11 +4110,17 @@ static int memcg_stat_show(struct seq_file *m, void *v)
                           (u64)memsw * PAGE_SIZE);
 
        for (i = 0; i < ARRAY_SIZE(memcg1_stats); i++) {
+               unsigned long nr;
+
                if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
                        continue;
+               nr = memcg_page_state(memcg, memcg1_stats[i]);
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+               if (memcg1_stats[i] == NR_ANON_THPS)
+                       nr *= HPAGE_PMD_NR;
+#endif
                seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i],
-                          (u64)memcg_page_state(memcg, memcg1_stats[i]) *
-                          PAGE_SIZE);
+                                               (u64)nr * PAGE_SIZE);
        }
 
        for (i = 0; i < ARRAY_SIZE(memcg1_events); i++)
@@ -5339,17 +5345,22 @@ mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
                memcg->swappiness = mem_cgroup_swappiness(parent);
                memcg->oom_kill_disable = parent->oom_kill_disable;
        }
-       if (parent && parent->use_hierarchy) {
+       if (!parent) {
+               page_counter_init(&memcg->memory, NULL);
+               page_counter_init(&memcg->swap, NULL);
+               page_counter_init(&memcg->kmem, NULL);
+               page_counter_init(&memcg->tcpmem, NULL);
+       } else if (parent->use_hierarchy) {
                memcg->use_hierarchy = true;
                page_counter_init(&memcg->memory, &parent->memory);
                page_counter_init(&memcg->swap, &parent->swap);
                page_counter_init(&memcg->kmem, &parent->kmem);
                page_counter_init(&memcg->tcpmem, &parent->tcpmem);
        } else {
-               page_counter_init(&memcg->memory, NULL);
-               page_counter_init(&memcg->swap, NULL);
-               page_counter_init(&memcg->kmem, NULL);
-               page_counter_init(&memcg->tcpmem, NULL);
+               page_counter_init(&memcg->memory, &root_mem_cgroup->memory);
+               page_counter_init(&memcg->swap, &root_mem_cgroup->swap);
+               page_counter_init(&memcg->kmem, &root_mem_cgroup->kmem);
+               page_counter_init(&memcg->tcpmem, &root_mem_cgroup->tcpmem);
                /*
                 * Deeper hierachy with use_hierarchy == false doesn't make
                 * much sense so let cgroup subsystem know about this
index 3fde772..3ca4898 100644 (file)
@@ -525,7 +525,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
        unsigned long flags = qp->flags;
        int ret;
        bool has_unmovable = false;
-       pte_t *pte;
+       pte_t *pte, *mapped_pte;
        spinlock_t *ptl;
 
        ptl = pmd_trans_huge_lock(pmd, vma);
@@ -539,7 +539,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
        if (pmd_trans_unstable(pmd))
                return 0;
 
-       pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
+       mapped_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
        for (; addr != end; pte++, addr += PAGE_SIZE) {
                if (!pte_present(*pte))
                        continue;
@@ -571,7 +571,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
                } else
                        break;
        }
-       pte_unmap_unlock(pte - 1, ptl);
+       pte_unmap_unlock(mapped_pte, ptl);
        cond_resched();
 
        if (has_unmovable)
index 73a206d..16b2fb4 100644 (file)
@@ -41,28 +41,24 @@ EXPORT_SYMBOL_GPL(memremap_compat_align);
 DEFINE_STATIC_KEY_FALSE(devmap_managed_key);
 EXPORT_SYMBOL(devmap_managed_key);
 
-static void devmap_managed_enable_put(void)
+static void devmap_managed_enable_put(struct dev_pagemap *pgmap)
 {
-       static_branch_dec(&devmap_managed_key);
+       if (pgmap->type == MEMORY_DEVICE_PRIVATE ||
+           pgmap->type == MEMORY_DEVICE_FS_DAX)
+               static_branch_dec(&devmap_managed_key);
 }
 
-static int devmap_managed_enable_get(struct dev_pagemap *pgmap)
+static void devmap_managed_enable_get(struct dev_pagemap *pgmap)
 {
-       if (pgmap->type == MEMORY_DEVICE_PRIVATE &&
-           (!pgmap->ops || !pgmap->ops->page_free)) {
-               WARN(1, "Missing page_free method\n");
-               return -EINVAL;
-       }
-
-       static_branch_inc(&devmap_managed_key);
-       return 0;
+       if (pgmap->type == MEMORY_DEVICE_PRIVATE ||
+           pgmap->type == MEMORY_DEVICE_FS_DAX)
+               static_branch_inc(&devmap_managed_key);
 }
 #else
-static int devmap_managed_enable_get(struct dev_pagemap *pgmap)
+static void devmap_managed_enable_get(struct dev_pagemap *pgmap)
 {
-       return -EINVAL;
 }
-static void devmap_managed_enable_put(void)
+static void devmap_managed_enable_put(struct dev_pagemap *pgmap)
 {
 }
 #endif /* CONFIG_DEV_PAGEMAP_OPS */
@@ -169,7 +165,7 @@ void memunmap_pages(struct dev_pagemap *pgmap)
                pageunmap_range(pgmap, i);
 
        WARN_ONCE(pgmap->altmap.alloc, "failed to free all reserved pages\n");
-       devmap_managed_enable_put();
+       devmap_managed_enable_put(pgmap);
 }
 EXPORT_SYMBOL_GPL(memunmap_pages);
 
@@ -307,7 +303,6 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
                .pgprot = PAGE_KERNEL,
        };
        const int nr_range = pgmap->nr_range;
-       bool need_devmap_managed = true;
        int error, i;
 
        if (WARN_ONCE(!nr_range, "nr_range must be specified\n"))
@@ -323,6 +318,10 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
                        WARN(1, "Missing migrate_to_ram method\n");
                        return ERR_PTR(-EINVAL);
                }
+               if (!pgmap->ops->page_free) {
+                       WARN(1, "Missing page_free method\n");
+                       return ERR_PTR(-EINVAL);
+               }
                if (!pgmap->owner) {
                        WARN(1, "Missing owner\n");
                        return ERR_PTR(-EINVAL);
@@ -336,11 +335,9 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
                }
                break;
        case MEMORY_DEVICE_GENERIC:
-               need_devmap_managed = false;
                break;
        case MEMORY_DEVICE_PCI_P2PDMA:
                params.pgprot = pgprot_noncached(params.pgprot);
-               need_devmap_managed = false;
                break;
        default:
                WARN(1, "Invalid pgmap type %d\n", pgmap->type);
@@ -364,11 +361,7 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
                }
        }
 
-       if (need_devmap_managed) {
-               error = devmap_managed_enable_get(pgmap);
-               if (error)
-                       return ERR_PTR(error);
-       }
+       devmap_managed_enable_get(pgmap);
 
        /*
         * Clear the pgmap nr_range as it will be incremented for each
index fd12da8..702250f 100644 (file)
@@ -5,6 +5,7 @@
  * Copyright (C) 2010-2011 Christopher Yeoh <cyeoh@au1.ibm.com>, IBM Corp.
  */
 
+#include <linux/compat.h>
 #include <linux/mm.h>
 #include <linux/uio.h>
 #include <linux/sched.h>
@@ -273,7 +274,8 @@ static ssize_t process_vm_rw(pid_t pid,
                return rc;
        if (!iov_iter_count(&iter))
                goto free_iov_l;
-       iov_r = iovec_from_user(rvec, riovcnt, UIO_FASTIOV, iovstack_r, false);
+       iov_r = iovec_from_user(rvec, riovcnt, UIO_FASTIOV, iovstack_r,
+                               in_compat_syscall());
        if (IS_ERR(iov_r)) {
                rc = PTR_ERR(iov_r);
                goto free_iov_l;
index 18cec39..960edf5 100644 (file)
@@ -528,7 +528,7 @@ void truncate_inode_pages_final(struct address_space *mapping)
 }
 EXPORT_SYMBOL(truncate_inode_pages_final);
 
-unsigned long __invalidate_mapping_pages(struct address_space *mapping,
+static unsigned long __invalidate_mapping_pages(struct address_space *mapping,
                pgoff_t start, pgoff_t end, unsigned long *nr_pagevec)
 {
        pgoff_t indices[PAGEVEC_SIZE];
index 09f1ec5..785a7bb 100644 (file)
@@ -412,8 +412,9 @@ static void p9_tag_cleanup(struct p9_client *c)
 
 /**
  * p9_client_cb - call back from transport to client
- * c: client state
- * req: request received
+ * @c: client state
+ * @req: request received
+ * @status: request status, one of REQ_STATUS_*
  *
  */
 void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status)
@@ -555,6 +556,7 @@ out_err:
  * p9_check_zc_errors - check 9p packet for error return and process it
  * @c: current client instance
  * @req: request to parse and check for error conditions
+ * @uidata: external buffer containing error
  * @in_hdrlen: Size of response protocol buffer.
  *
  * returns error code if one is discovered, otherwise returns 0
index 3dff68f..6ea5ea5 100644 (file)
@@ -17,7 +17,9 @@
 #include "trans_common.h"
 
 /**
- *  p9_release_pages - Release pages after the transaction.
+ * p9_release_pages - Release pages after the transaction.
+ * @pages: array of pages to be put
+ * @nr_pages: size of array
  */
 void p9_release_pages(struct page **pages, int nr_pages)
 {
index 8f528e7..fa15839 100644 (file)
@@ -45,7 +45,7 @@ static struct p9_trans_module p9_fd_trans;
  * @rfd: file descriptor for reading (trans=fd)
  * @wfd: file descriptor for writing (trans=fd)
  * @port: port to connect to (trans=tcp)
- *
+ * @privport: port is privileged
  */
 
 struct p9_fd_opts {
@@ -95,6 +95,8 @@ struct p9_poll_wait {
  * @err: error state
  * @req_list: accounting for requests which have been sent
  * @unsent_req_list: accounting for requests that haven't been sent
+ * @rreq: read request
+ * @wreq: write request
  * @req: current request being processed (if any)
  * @tmp_buf: temporary buffer to read in header
  * @rc: temporary fcall for reading current frame
index 2885ff9..af0a8a6 100644 (file)
@@ -99,6 +99,7 @@ struct p9_rdma_req;
 /**
  * struct p9_rdma_context - Keeps track of in-process WR
  *
+ * @cqe: completion queue entry
  * @busa: Bus address to unmap when the WR completes
  * @req: Keeps track of requests (send)
  * @rc: Keepts track of replies (receive)
@@ -115,6 +116,7 @@ struct p9_rdma_context {
 /**
  * struct p9_rdma_opts - Collection of mount options
  * @port: port of connection
+ * @privport: Whether a privileged port may be used
  * @sq_depth: The requested depth of the SQ. This really doesn't need
  * to be any deeper than the number of threads used in the client
  * @rq_depth: The depth of the RQ. Should be greater than or equal to SQ depth
index a3cd90a..93f2f86 100644 (file)
@@ -50,7 +50,11 @@ static atomic_t vp_pinned = ATOMIC_INIT(0);
  * @client: client instance
  * @vdev: virtio dev associated with this channel
  * @vq: virtio queue associated with this channel
+ * @ring_bufs_avail: flag to indicate there is some available in the ring buf
+ * @vc_wq: wait queue for waiting for thing to be added to ring buf
+ * @p9_max_pages: maximum number of pinned pages
  * @sg: scatter gather list which is used to pack a request (protected?)
+ * @chan_list: linked list of channels
  *
  * We keep all per-channel information in a structure.
  * This structure is allocated within the devices dev->mem space.
@@ -74,8 +78,8 @@ struct virtio_chan {
        unsigned long p9_max_pages;
        /* Scatterlist: can be too big for stack. */
        struct scatterlist sg[VIRTQUEUE_NUM];
-       /*
-        * tag name to identify a mount null terminated
+       /**
+        * @tag: name to identify a mount null terminated
         */
        char *tag;
 
@@ -204,6 +208,7 @@ static int p9_virtio_cancelled(struct p9_client *client, struct p9_req_t *req)
  * this takes a list of pages.
  * @sg: scatter/gather list to pack into
  * @start: which segment of the sg_list to start at
+ * @limit: maximum number of pages in sg list.
  * @pdata: a list of pages to add into sg.
  * @nr_pages: number of pages to pack into the scatter/gather list
  * @offs: amount of data in the beginning of first page _not_ to pack
index d656716..f4c32d9 100644 (file)
@@ -386,8 +386,6 @@ source "net/mac80211/Kconfig"
 
 endif # WIRELESS
 
-source "net/wimax/Kconfig"
-
 source "net/rfkill/Kconfig"
 source "net/9p/Kconfig"
 source "net/caif/Kconfig"
index 5744bf1..d96b0aa 100644 (file)
@@ -66,7 +66,6 @@ obj-$(CONFIG_MAC802154)               += mac802154/
 ifeq ($(CONFIG_NET),y)
 obj-$(CONFIG_SYSCTL)           += sysctl_net.o
 endif
-obj-$(CONFIG_WIMAX)            += wimax/
 obj-$(CONFIG_DNS_RESOLVER)     += dns_resolver/
 obj-$(CONFIG_CEPH_LIB)         += ceph/
 obj-$(CONFIG_BATMAN_ADV)       += batman-adv/
index 45f5841..be18af4 100644 (file)
@@ -44,15 +44,15 @@ int sysctl_aarp_resolve_time = AARP_RESOLVE_TIME;
 /* Lists of aarp entries */
 /**
  *     struct aarp_entry - AARP entry
- *     @last_sent - Last time we xmitted the aarp request
- *     @packet_queue - Queue of frames wait for resolution
- *     @status - Used for proxy AARP
- *     expires_at - Entry expiry time
- *     target_addr - DDP Address
- *     dev - Device to use
- *     hwaddr - Physical i/f address of target/router
- *     xmit_count - When this hits 10 we give up
- *     next - Next entry in chain
+ *     @last_sent: Last time we xmitted the aarp request
+ *     @packet_queue: Queue of frames wait for resolution
+ *     @status: Used for proxy AARP
+ *     @expires_at: Entry expiry time
+ *     @target_addr: DDP Address
+ *     @dev:  Device to use
+ *     @hwaddr:  Physical i/f address of target/router
+ *     @xmit_count:  When this hits 10 we give up
+ *     @next: Next entry in chain
  */
 struct aarp_entry {
        /* These first two are only used for unresolved entries */
index 1d48708..ca1a0d0 100644 (file)
@@ -1407,9 +1407,10 @@ drop:
 
 /**
  *     atalk_rcv - Receive a packet (in skb) from device dev
- *     @skb - packet received
- *     @dev - network device where the packet comes from
- *     @pt - packet type
+ *     @skb: packet received
+ *     @dev: network device where the packet comes from
+ *     @pt: packet type
+ *     @orig_dev: the original receive net device
  *
  *     Receive a packet (in skb) from device dev. This has come from the SNAP
  *     decoder, and on entry skb->transport_header is the DDP header, skb->len
index dbabb65..7226c78 100644 (file)
@@ -954,9 +954,8 @@ static void *lec_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
        struct lec_state *state = seq->private;
 
-       v = lec_get_idx(state, 1);
-       *pos += !!PTR_ERR(v);
-       return v;
+       ++*pos;
+       return lec_get_idx(state, 1);
 }
 
 static int lec_seq_show(struct seq_file *seq, void *v)
index 8579bfe..4b39534 100644 (file)
 struct msft_cp_read_supported_features {
        __u8   sub_opcode;
 } __packed;
+
 struct msft_rp_read_supported_features {
        __u8   status;
        __u8   sub_opcode;
        __le64 features;
        __u8   evt_prefix_len;
-       __u8   evt_prefix[0];
+       __u8   evt_prefix[];
 } __packed;
 
 struct msft_data {
index 8087919..3c8ded7 100644 (file)
@@ -73,3 +73,14 @@ config BRIDGE_MRP
          Say N to exclude this support and reduce the binary size.
 
          If unsure, say N.
+
+config BRIDGE_CFM
+       bool "CFM protocol"
+       depends on BRIDGE
+       help
+         If you say Y here, then the Ethernet bridge will be able to run CFM
+         protocol according to 802.1Q section 12.14
+
+         Say N to exclude this support and reduce the binary size.
+
+         If unsure, say N.
index ccb3942..4702702 100644 (file)
@@ -27,3 +27,5 @@ bridge-$(CONFIG_NET_SWITCHDEV) += br_switchdev.o
 obj-$(CONFIG_NETFILTER) += netfilter/
 
 bridge-$(CONFIG_BRIDGE_MRP)    += br_mrp_switchdev.o br_mrp.o br_mrp_netlink.o
+
+bridge-$(CONFIG_BRIDGE_CFM)    += br_cfm.o br_cfm_netlink.o
diff --git a/net/bridge/br_cfm.c b/net/bridge/br_cfm.c
new file mode 100644 (file)
index 0000000..001064f
--- /dev/null
@@ -0,0 +1,867 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <linux/cfm_bridge.h>
+#include <uapi/linux/cfm_bridge.h>
+#include "br_private_cfm.h"
+
+static struct br_cfm_mep *br_mep_find(struct net_bridge *br, u32 instance)
+{
+       struct br_cfm_mep *mep;
+
+       hlist_for_each_entry(mep, &br->mep_list, head)
+               if (mep->instance == instance)
+                       return mep;
+
+       return NULL;
+}
+
+static struct br_cfm_mep *br_mep_find_ifindex(struct net_bridge *br,
+                                             u32 ifindex)
+{
+       struct br_cfm_mep *mep;
+
+       hlist_for_each_entry_rcu(mep, &br->mep_list, head,
+                                lockdep_rtnl_is_held())
+               if (mep->create.ifindex == ifindex)
+                       return mep;
+
+       return NULL;
+}
+
+static struct br_cfm_peer_mep *br_peer_mep_find(struct br_cfm_mep *mep,
+                                               u32 mepid)
+{
+       struct br_cfm_peer_mep *peer_mep;
+
+       hlist_for_each_entry_rcu(peer_mep, &mep->peer_mep_list, head,
+                                lockdep_rtnl_is_held())
+               if (peer_mep->mepid == mepid)
+                       return peer_mep;
+
+       return NULL;
+}
+
+static struct net_bridge_port *br_mep_get_port(struct net_bridge *br,
+                                              u32 ifindex)
+{
+       struct net_bridge_port *port;
+
+       list_for_each_entry(port, &br->port_list, list)
+               if (port->dev->ifindex == ifindex)
+                       return port;
+
+       return NULL;
+}
+
+/* Calculate the CCM interval in us. */
+static u32 interval_to_us(enum br_cfm_ccm_interval interval)
+{
+       switch (interval) {
+       case BR_CFM_CCM_INTERVAL_NONE:
+               return 0;
+       case BR_CFM_CCM_INTERVAL_3_3_MS:
+               return 3300;
+       case BR_CFM_CCM_INTERVAL_10_MS:
+               return 10 * 1000;
+       case BR_CFM_CCM_INTERVAL_100_MS:
+               return 100 * 1000;
+       case BR_CFM_CCM_INTERVAL_1_SEC:
+               return 1000 * 1000;
+       case BR_CFM_CCM_INTERVAL_10_SEC:
+               return 10 * 1000 * 1000;
+       case BR_CFM_CCM_INTERVAL_1_MIN:
+               return 60 * 1000 * 1000;
+       case BR_CFM_CCM_INTERVAL_10_MIN:
+               return 10 * 60 * 1000 * 1000;
+       }
+       return 0;
+}
+
+/* Convert the interface interval to CCM PDU value. */
+static u32 interval_to_pdu(enum br_cfm_ccm_interval interval)
+{
+       switch (interval) {
+       case BR_CFM_CCM_INTERVAL_NONE:
+               return 0;
+       case BR_CFM_CCM_INTERVAL_3_3_MS:
+               return 1;
+       case BR_CFM_CCM_INTERVAL_10_MS:
+               return 2;
+       case BR_CFM_CCM_INTERVAL_100_MS:
+               return 3;
+       case BR_CFM_CCM_INTERVAL_1_SEC:
+               return 4;
+       case BR_CFM_CCM_INTERVAL_10_SEC:
+               return 5;
+       case BR_CFM_CCM_INTERVAL_1_MIN:
+               return 6;
+       case BR_CFM_CCM_INTERVAL_10_MIN:
+               return 7;
+       }
+       return 0;
+}
+
+/* Convert the CCM PDU value to interval on interface. */
+static u32 pdu_to_interval(u32 value)
+{
+       switch (value) {
+       case 0:
+               return BR_CFM_CCM_INTERVAL_NONE;
+       case 1:
+               return BR_CFM_CCM_INTERVAL_3_3_MS;
+       case 2:
+               return BR_CFM_CCM_INTERVAL_10_MS;
+       case 3:
+               return BR_CFM_CCM_INTERVAL_100_MS;
+       case 4:
+               return BR_CFM_CCM_INTERVAL_1_SEC;
+       case 5:
+               return BR_CFM_CCM_INTERVAL_10_SEC;
+       case 6:
+               return BR_CFM_CCM_INTERVAL_1_MIN;
+       case 7:
+               return BR_CFM_CCM_INTERVAL_10_MIN;
+       }
+       return BR_CFM_CCM_INTERVAL_NONE;
+}
+
+static void ccm_rx_timer_start(struct br_cfm_peer_mep *peer_mep)
+{
+       u32 interval_us;
+
+       interval_us = interval_to_us(peer_mep->mep->cc_config.exp_interval);
+       /* Function ccm_rx_dwork must be called with 1/4
+        * of the configured CC 'expected_interval'
+        * in order to detect CCM defect after 3.25 interval.
+        */
+       queue_delayed_work(system_wq, &peer_mep->ccm_rx_dwork,
+                          usecs_to_jiffies(interval_us / 4));
+}
+
+static void br_cfm_notify(int event, const struct net_bridge_port *port)
+{
+       u32 filter = RTEXT_FILTER_CFM_STATUS;
+
+       return br_info_notify(event, port->br, NULL, filter);
+}
+
+static void cc_peer_enable(struct br_cfm_peer_mep *peer_mep)
+{
+       memset(&peer_mep->cc_status, 0, sizeof(peer_mep->cc_status));
+       peer_mep->ccm_rx_count_miss = 0;
+
+       ccm_rx_timer_start(peer_mep);
+}
+
+static void cc_peer_disable(struct br_cfm_peer_mep *peer_mep)
+{
+       cancel_delayed_work_sync(&peer_mep->ccm_rx_dwork);
+}
+
+static struct sk_buff *ccm_frame_build(struct br_cfm_mep *mep,
+                                      const struct br_cfm_cc_ccm_tx_info *const tx_info)
+
+{
+       struct br_cfm_common_hdr *common_hdr;
+       struct net_bridge_port *b_port;
+       struct br_cfm_maid *maid;
+       u8 *itu_reserved, *e_tlv;
+       struct ethhdr *eth_hdr;
+       struct sk_buff *skb;
+       __be32 *status_tlv;
+       __be32 *snumber;
+       __be16 *mepid;
+
+       skb = dev_alloc_skb(CFM_CCM_MAX_FRAME_LENGTH);
+       if (!skb)
+               return NULL;
+
+       rcu_read_lock();
+       b_port = rcu_dereference(mep->b_port);
+       if (!b_port) {
+               kfree_skb(skb);
+               rcu_read_unlock();
+               return NULL;
+       }
+       skb->dev = b_port->dev;
+       rcu_read_unlock();
+       /* The device cannot be deleted until the work_queue functions has
+        * completed. This function is called from ccm_tx_work_expired()
+        * that is a work_queue functions.
+        */
+
+       skb->protocol = htons(ETH_P_CFM);
+       skb->priority = CFM_FRAME_PRIO;
+
+       /* Ethernet header */
+       eth_hdr = skb_put(skb, sizeof(*eth_hdr));
+       ether_addr_copy(eth_hdr->h_dest, tx_info->dmac.addr);
+       ether_addr_copy(eth_hdr->h_source, mep->config.unicast_mac.addr);
+       eth_hdr->h_proto = htons(ETH_P_CFM);
+
+       /* Common CFM Header */
+       common_hdr = skb_put(skb, sizeof(*common_hdr));
+       common_hdr->mdlevel_version = mep->config.mdlevel << 5;
+       common_hdr->opcode = BR_CFM_OPCODE_CCM;
+       common_hdr->flags = (mep->rdi << 7) |
+                           interval_to_pdu(mep->cc_config.exp_interval);
+       common_hdr->tlv_offset = CFM_CCM_TLV_OFFSET;
+
+       /* Sequence number */
+       snumber = skb_put(skb, sizeof(*snumber));
+       if (tx_info->seq_no_update) {
+               *snumber = cpu_to_be32(mep->ccm_tx_snumber);
+               mep->ccm_tx_snumber += 1;
+       } else {
+               *snumber = 0;
+       }
+
+       mepid = skb_put(skb, sizeof(*mepid));
+       *mepid = cpu_to_be16((u16)mep->config.mepid);
+
+       maid = skb_put(skb, sizeof(*maid));
+       memcpy(maid->data, mep->cc_config.exp_maid.data, sizeof(maid->data));
+
+       /* ITU reserved (CFM_CCM_ITU_RESERVED_SIZE octets) */
+       itu_reserved = skb_put(skb, CFM_CCM_ITU_RESERVED_SIZE);
+       memset(itu_reserved, 0, CFM_CCM_ITU_RESERVED_SIZE);
+
+       /* Generel CFM TLV format:
+        * TLV type:            one byte
+        * TLV value length:    two bytes
+        * TLV value:           'TLV value length' bytes
+        */
+
+       /* Port status TLV. The value length is 1. Total of 4 bytes. */
+       if (tx_info->port_tlv) {
+               status_tlv = skb_put(skb, sizeof(*status_tlv));
+               *status_tlv = cpu_to_be32((CFM_PORT_STATUS_TLV_TYPE << 24) |
+                                         (1 << 8) |    /* Value length */
+                                         (tx_info->port_tlv_value & 0xFF));
+       }
+
+       /* Interface status TLV. The value length is 1. Total of 4 bytes. */
+       if (tx_info->if_tlv) {
+               status_tlv = skb_put(skb, sizeof(*status_tlv));
+               *status_tlv = cpu_to_be32((CFM_IF_STATUS_TLV_TYPE << 24) |
+                                         (1 << 8) |    /* Value length */
+                                         (tx_info->if_tlv_value & 0xFF));
+       }
+
+       /* End TLV */
+       e_tlv = skb_put(skb, sizeof(*e_tlv));
+       *e_tlv = CFM_ENDE_TLV_TYPE;
+
+       return skb;
+}
+
+static void ccm_frame_tx(struct sk_buff *skb)
+{
+       skb_reset_network_header(skb);
+       dev_queue_xmit(skb);
+}
+
+/* This function is called with the configured CC 'expected_interval'
+ * in order to drive CCM transmission when enabled.
+ */
+static void ccm_tx_work_expired(struct work_struct *work)
+{
+       struct delayed_work *del_work;
+       struct br_cfm_mep *mep;
+       struct sk_buff *skb;
+       u32 interval_us;
+
+       del_work = to_delayed_work(work);
+       mep = container_of(del_work, struct br_cfm_mep, ccm_tx_dwork);
+
+       if (time_before_eq(mep->ccm_tx_end, jiffies)) {
+               /* Transmission period has ended */
+               mep->cc_ccm_tx_info.period = 0;
+               return;
+       }
+
+       skb = ccm_frame_build(mep, &mep->cc_ccm_tx_info);
+       if (skb)
+               ccm_frame_tx(skb);
+
+       interval_us = interval_to_us(mep->cc_config.exp_interval);
+       queue_delayed_work(system_wq, &mep->ccm_tx_dwork,
+                          usecs_to_jiffies(interval_us));
+}
+
+/* This function is called with 1/4 of the configured CC 'expected_interval'
+ * in order to detect CCM defect after 3.25 interval.
+ */
+static void ccm_rx_work_expired(struct work_struct *work)
+{
+       struct br_cfm_peer_mep *peer_mep;
+       struct net_bridge_port *b_port;
+       struct delayed_work *del_work;
+
+       del_work = to_delayed_work(work);
+       peer_mep = container_of(del_work, struct br_cfm_peer_mep, ccm_rx_dwork);
+
+       /* After 13 counts (4 * 3,25) then 3.25 intervals are expired */
+       if (peer_mep->ccm_rx_count_miss < 13) {
+               /* 3.25 intervals are NOT expired without CCM reception */
+               peer_mep->ccm_rx_count_miss++;
+
+               /* Start timer again */
+               ccm_rx_timer_start(peer_mep);
+       } else {
+               /* 3.25 intervals are expired without CCM reception.
+                * CCM defect detected
+                */
+               peer_mep->cc_status.ccm_defect = true;
+
+               /* Change in CCM defect status - notify */
+               rcu_read_lock();
+               b_port = rcu_dereference(peer_mep->mep->b_port);
+               if (b_port)
+                       br_cfm_notify(RTM_NEWLINK, b_port);
+               rcu_read_unlock();
+       }
+}
+
+static u32 ccm_tlv_extract(struct sk_buff *skb, u32 index,
+                          struct br_cfm_peer_mep *peer_mep)
+{
+       __be32 *s_tlv;
+       __be32 _s_tlv;
+       u32 h_s_tlv;
+       u8 *e_tlv;
+       u8 _e_tlv;
+
+       e_tlv = skb_header_pointer(skb, index, sizeof(_e_tlv), &_e_tlv);
+       if (!e_tlv)
+               return 0;
+
+       /* TLV is present - get the status TLV */
+       s_tlv = skb_header_pointer(skb,
+                                  index,
+                                  sizeof(_s_tlv), &_s_tlv);
+       if (!s_tlv)
+               return 0;
+
+       h_s_tlv = ntohl(*s_tlv);
+       if ((h_s_tlv >> 24) == CFM_IF_STATUS_TLV_TYPE) {
+               /* Interface status TLV */
+               peer_mep->cc_status.tlv_seen = true;
+               peer_mep->cc_status.if_tlv_value = (h_s_tlv & 0xFF);
+       }
+
+       if ((h_s_tlv >> 24) == CFM_PORT_STATUS_TLV_TYPE) {
+               /* Port status TLV */
+               peer_mep->cc_status.tlv_seen = true;
+               peer_mep->cc_status.port_tlv_value = (h_s_tlv & 0xFF);
+       }
+
+       /* The Sender ID TLV is not handled */
+       /* The Organization-Specific TLV is not handled */
+
+       /* Return the length of this tlv.
+        * This is the length of the value field plus 3 bytes for size of type
+        * field and length field
+        */
+       return ((h_s_tlv >> 8) & 0xFFFF) + 3;
+}
+
+/* note: already called with rcu_read_lock */
+static int br_cfm_frame_rx(struct net_bridge_port *port, struct sk_buff *skb)
+{
+       u32 mdlevel, interval, size, index, max;
+       const struct br_cfm_common_hdr *hdr;
+       struct br_cfm_peer_mep *peer_mep;
+       const struct br_cfm_maid *maid;
+       struct br_cfm_common_hdr _hdr;
+       struct br_cfm_maid _maid;
+       struct br_cfm_mep *mep;
+       struct net_bridge *br;
+       __be32 *snumber;
+       __be32 _snumber;
+       __be16 *mepid;
+       __be16 _mepid;
+
+       if (port->state == BR_STATE_DISABLED)
+               return 0;
+
+       hdr = skb_header_pointer(skb, 0, sizeof(_hdr), &_hdr);
+       if (!hdr)
+               return 1;
+
+       br = port->br;
+       mep = br_mep_find_ifindex(br, port->dev->ifindex);
+       if (unlikely(!mep))
+               /* No MEP on this port - must be forwarded */
+               return 0;
+
+       mdlevel = hdr->mdlevel_version >> 5;
+       if (mdlevel > mep->config.mdlevel)
+               /* The level is above this MEP level - must be forwarded */
+               return 0;
+
+       if ((hdr->mdlevel_version & 0x1F) != 0) {
+               /* Invalid version */
+               mep->status.version_unexp_seen = true;
+               return 1;
+       }
+
+       if (mdlevel < mep->config.mdlevel) {
+               /* The level is below this MEP level */
+               mep->status.rx_level_low_seen = true;
+               return 1;
+       }
+
+       if (hdr->opcode == BR_CFM_OPCODE_CCM) {
+               /* CCM PDU received. */
+               /* MA ID is after common header + sequence number + MEP ID */
+               maid = skb_header_pointer(skb,
+                                         CFM_CCM_PDU_MAID_OFFSET,
+                                         sizeof(_maid), &_maid);
+               if (!maid)
+                       return 1;
+               if (memcmp(maid->data, mep->cc_config.exp_maid.data,
+                          sizeof(maid->data)))
+                       /* MA ID not as expected */
+                       return 1;
+
+               /* MEP ID is after common header + sequence number */
+               mepid = skb_header_pointer(skb,
+                                          CFM_CCM_PDU_MEPID_OFFSET,
+                                          sizeof(_mepid), &_mepid);
+               if (!mepid)
+                       return 1;
+               peer_mep = br_peer_mep_find(mep, (u32)ntohs(*mepid));
+               if (!peer_mep)
+                       return 1;
+
+               /* Interval is in common header flags */
+               interval = hdr->flags & 0x07;
+               if (mep->cc_config.exp_interval != pdu_to_interval(interval))
+                       /* Interval not as expected */
+                       return 1;
+
+               /* A valid CCM frame is received */
+               if (peer_mep->cc_status.ccm_defect) {
+                       peer_mep->cc_status.ccm_defect = false;
+
+                       /* Change in CCM defect status - notify */
+                       br_cfm_notify(RTM_NEWLINK, port);
+
+                       /* Start CCM RX timer */
+                       ccm_rx_timer_start(peer_mep);
+               }
+
+               peer_mep->cc_status.seen = true;
+               peer_mep->ccm_rx_count_miss = 0;
+
+               /* RDI is in common header flags */
+               peer_mep->cc_status.rdi = (hdr->flags & 0x80) ? true : false;
+
+               /* Sequence number is after common header */
+               snumber = skb_header_pointer(skb,
+                                            CFM_CCM_PDU_SEQNR_OFFSET,
+                                            sizeof(_snumber), &_snumber);
+               if (!snumber)
+                       return 1;
+               if (ntohl(*snumber) != (mep->ccm_rx_snumber + 1))
+                       /* Unexpected sequence number */
+                       peer_mep->cc_status.seq_unexp_seen = true;
+
+               mep->ccm_rx_snumber = ntohl(*snumber);
+
+               /* TLV end is after common header + sequence number + MEP ID +
+                * MA ID + ITU reserved
+                */
+               index = CFM_CCM_PDU_TLV_OFFSET;
+               max = 0;
+               do { /* Handle all TLVs */
+                       size = ccm_tlv_extract(skb, index, peer_mep);
+                       index += size;
+                       max += 1;
+               } while (size != 0 && max < 4); /* Max four TLVs possible */
+
+               return 1;
+       }
+
+       mep->status.opcode_unexp_seen = true;
+
+       return 1;
+}
+
+static struct br_frame_type cfm_frame_type __read_mostly = {
+       .type = cpu_to_be16(ETH_P_CFM),
+       .frame_handler = br_cfm_frame_rx,
+};
+
+int br_cfm_mep_create(struct net_bridge *br,
+                     const u32 instance,
+                     struct br_cfm_mep_create *const create,
+                     struct netlink_ext_ack *extack)
+{
+       struct net_bridge_port *p;
+       struct br_cfm_mep *mep;
+
+       ASSERT_RTNL();
+
+       if (create->domain == BR_CFM_VLAN) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "VLAN domain not supported");
+               return -EINVAL;
+       }
+       if (create->domain != BR_CFM_PORT) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "Invalid domain value");
+               return -EINVAL;
+       }
+       if (create->direction == BR_CFM_MEP_DIRECTION_UP) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "Up-MEP not supported");
+               return -EINVAL;
+       }
+       if (create->direction != BR_CFM_MEP_DIRECTION_DOWN) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "Invalid direction value");
+               return -EINVAL;
+       }
+       p = br_mep_get_port(br, create->ifindex);
+       if (!p) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "Port is not related to bridge");
+               return -EINVAL;
+       }
+       mep = br_mep_find(br, instance);
+       if (mep) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "MEP instance already exists");
+               return -EEXIST;
+       }
+
+       /* In PORT domain only one instance can be created per port */
+       if (create->domain == BR_CFM_PORT) {
+               mep = br_mep_find_ifindex(br, create->ifindex);
+               if (mep) {
+                       NL_SET_ERR_MSG_MOD(extack,
+                                          "Only one Port MEP on a port allowed");
+                       return -EINVAL;
+               }
+       }
+
+       mep = kzalloc(sizeof(*mep), GFP_KERNEL);
+       if (!mep)
+               return -ENOMEM;
+
+       mep->create = *create;
+       mep->instance = instance;
+       rcu_assign_pointer(mep->b_port, p);
+
+       INIT_HLIST_HEAD(&mep->peer_mep_list);
+       INIT_DELAYED_WORK(&mep->ccm_tx_dwork, ccm_tx_work_expired);
+
+       if (hlist_empty(&br->mep_list))
+               br_add_frame(br, &cfm_frame_type);
+
+       hlist_add_tail_rcu(&mep->head, &br->mep_list);
+
+       return 0;
+}
+
+static void mep_delete_implementation(struct net_bridge *br,
+                                     struct br_cfm_mep *mep)
+{
+       struct br_cfm_peer_mep *peer_mep;
+       struct hlist_node *n_store;
+
+       ASSERT_RTNL();
+
+       /* Empty and free peer MEP list */
+       hlist_for_each_entry_safe(peer_mep, n_store, &mep->peer_mep_list, head) {
+               cancel_delayed_work_sync(&peer_mep->ccm_rx_dwork);
+               hlist_del_rcu(&peer_mep->head);
+               kfree_rcu(peer_mep, rcu);
+       }
+
+       cancel_delayed_work_sync(&mep->ccm_tx_dwork);
+
+       RCU_INIT_POINTER(mep->b_port, NULL);
+       hlist_del_rcu(&mep->head);
+       kfree_rcu(mep, rcu);
+
+       if (hlist_empty(&br->mep_list))
+               br_del_frame(br, &cfm_frame_type);
+}
+
+int br_cfm_mep_delete(struct net_bridge *br,
+                     const u32 instance,
+                     struct netlink_ext_ack *extack)
+{
+       struct br_cfm_mep *mep;
+
+       ASSERT_RTNL();
+
+       mep = br_mep_find(br, instance);
+       if (!mep) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "MEP instance does not exists");
+               return -ENOENT;
+       }
+
+       mep_delete_implementation(br, mep);
+
+       return 0;
+}
+
+int br_cfm_mep_config_set(struct net_bridge *br,
+                         const u32 instance,
+                         const struct br_cfm_mep_config *const config,
+                         struct netlink_ext_ack *extack)
+{
+       struct br_cfm_mep *mep;
+
+       ASSERT_RTNL();
+
+       mep = br_mep_find(br, instance);
+       if (!mep) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "MEP instance does not exists");
+               return -ENOENT;
+       }
+
+       mep->config = *config;
+
+       return 0;
+}
+
+int br_cfm_cc_config_set(struct net_bridge *br,
+                        const u32 instance,
+                        const struct br_cfm_cc_config *const config,
+                        struct netlink_ext_ack *extack)
+{
+       struct br_cfm_peer_mep *peer_mep;
+       struct br_cfm_mep *mep;
+
+       ASSERT_RTNL();
+
+       mep = br_mep_find(br, instance);
+       if (!mep) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "MEP instance does not exists");
+               return -ENOENT;
+       }
+
+       /* Check for no change in configuration */
+       if (memcmp(config, &mep->cc_config, sizeof(*config)) == 0)
+               return 0;
+
+       if (config->enable && !mep->cc_config.enable)
+               /* CC is enabled */
+               hlist_for_each_entry(peer_mep, &mep->peer_mep_list, head)
+                       cc_peer_enable(peer_mep);
+
+       if (!config->enable && mep->cc_config.enable)
+               /* CC is disabled */
+               hlist_for_each_entry(peer_mep, &mep->peer_mep_list, head)
+                       cc_peer_disable(peer_mep);
+
+       mep->cc_config = *config;
+       mep->ccm_rx_snumber = 0;
+       mep->ccm_tx_snumber = 1;
+
+       return 0;
+}
+
+int br_cfm_cc_peer_mep_add(struct net_bridge *br, const u32 instance,
+                          u32 mepid,
+                          struct netlink_ext_ack *extack)
+{
+       struct br_cfm_peer_mep *peer_mep;
+       struct br_cfm_mep *mep;
+
+       ASSERT_RTNL();
+
+       mep = br_mep_find(br, instance);
+       if (!mep) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "MEP instance does not exists");
+               return -ENOENT;
+       }
+
+       peer_mep = br_peer_mep_find(mep, mepid);
+       if (peer_mep) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "Peer MEP-ID already exists");
+               return -EEXIST;
+       }
+
+       peer_mep = kzalloc(sizeof(*peer_mep), GFP_KERNEL);
+       if (!peer_mep)
+               return -ENOMEM;
+
+       peer_mep->mepid = mepid;
+       peer_mep->mep = mep;
+       INIT_DELAYED_WORK(&peer_mep->ccm_rx_dwork, ccm_rx_work_expired);
+
+       if (mep->cc_config.enable)
+               cc_peer_enable(peer_mep);
+
+       hlist_add_tail_rcu(&peer_mep->head, &mep->peer_mep_list);
+
+       return 0;
+}
+
+int br_cfm_cc_peer_mep_remove(struct net_bridge *br, const u32 instance,
+                             u32 mepid,
+                             struct netlink_ext_ack *extack)
+{
+       struct br_cfm_peer_mep *peer_mep;
+       struct br_cfm_mep *mep;
+
+       ASSERT_RTNL();
+
+       mep = br_mep_find(br, instance);
+       if (!mep) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "MEP instance does not exists");
+               return -ENOENT;
+       }
+
+       peer_mep = br_peer_mep_find(mep, mepid);
+       if (!peer_mep) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "Peer MEP-ID does not exists");
+               return -ENOENT;
+       }
+
+       cc_peer_disable(peer_mep);
+
+       hlist_del_rcu(&peer_mep->head);
+       kfree_rcu(peer_mep, rcu);
+
+       return 0;
+}
+
+int br_cfm_cc_rdi_set(struct net_bridge *br, const u32 instance,
+                     const bool rdi, struct netlink_ext_ack *extack)
+{
+       struct br_cfm_mep *mep;
+
+       ASSERT_RTNL();
+
+       mep = br_mep_find(br, instance);
+       if (!mep) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "MEP instance does not exists");
+               return -ENOENT;
+       }
+
+       mep->rdi = rdi;
+
+       return 0;
+}
+
+int br_cfm_cc_ccm_tx(struct net_bridge *br, const u32 instance,
+                    const struct br_cfm_cc_ccm_tx_info *const tx_info,
+                    struct netlink_ext_ack *extack)
+{
+       struct br_cfm_mep *mep;
+
+       ASSERT_RTNL();
+
+       mep = br_mep_find(br, instance);
+       if (!mep) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "MEP instance does not exists");
+               return -ENOENT;
+       }
+
+       if (memcmp(tx_info, &mep->cc_ccm_tx_info, sizeof(*tx_info)) == 0) {
+               /* No change in tx_info. */
+               if (mep->cc_ccm_tx_info.period == 0)
+                       /* Transmission is not enabled - just return */
+                       return 0;
+
+               /* Transmission is ongoing, the end time is recalculated */
+               mep->ccm_tx_end = jiffies +
+                                 usecs_to_jiffies(tx_info->period * 1000000);
+               return 0;
+       }
+
+       if (tx_info->period == 0 && mep->cc_ccm_tx_info.period == 0)
+               /* Some change in info and transmission is not ongoing */
+               goto save;
+
+       if (tx_info->period != 0 && mep->cc_ccm_tx_info.period != 0) {
+               /* Some change in info and transmission is ongoing
+                * The end time is recalculated
+                */
+               mep->ccm_tx_end = jiffies +
+                                 usecs_to_jiffies(tx_info->period * 1000000);
+
+               goto save;
+       }
+
+       if (tx_info->period == 0 && mep->cc_ccm_tx_info.period != 0) {
+               cancel_delayed_work_sync(&mep->ccm_tx_dwork);
+               goto save;
+       }
+
+       /* Start delayed work to transmit CCM frames. It is done with zero delay
+        * to send first frame immediately
+        */
+       mep->ccm_tx_end = jiffies + usecs_to_jiffies(tx_info->period * 1000000);
+       queue_delayed_work(system_wq, &mep->ccm_tx_dwork, 0);
+
+save:
+       mep->cc_ccm_tx_info = *tx_info;
+
+       return 0;
+}
+
+int br_cfm_mep_count(struct net_bridge *br, u32 *count)
+{
+       struct br_cfm_mep *mep;
+
+       *count = 0;
+
+       rcu_read_lock();
+       hlist_for_each_entry_rcu(mep, &br->mep_list, head)
+               *count += 1;
+       rcu_read_unlock();
+
+       return 0;
+}
+
+int br_cfm_peer_mep_count(struct net_bridge *br, u32 *count)
+{
+       struct br_cfm_peer_mep *peer_mep;
+       struct br_cfm_mep *mep;
+
+       *count = 0;
+
+       rcu_read_lock();
+       hlist_for_each_entry_rcu(mep, &br->mep_list, head)
+               hlist_for_each_entry_rcu(peer_mep, &mep->peer_mep_list, head)
+                       *count += 1;
+       rcu_read_unlock();
+
+       return 0;
+}
+
+bool br_cfm_created(struct net_bridge *br)
+{
+       return !hlist_empty(&br->mep_list);
+}
+
+/* Deletes the CFM instances on a specific bridge port
+ */
+void br_cfm_port_del(struct net_bridge *br, struct net_bridge_port *port)
+{
+       struct hlist_node *n_store;
+       struct br_cfm_mep *mep;
+
+       ASSERT_RTNL();
+
+       hlist_for_each_entry_safe(mep, n_store, &br->mep_list, head)
+               if (mep->create.ifindex == port->dev->ifindex)
+                       mep_delete_implementation(br, mep);
+}
diff --git a/net/bridge/br_cfm_netlink.c b/net/bridge/br_cfm_netlink.c
new file mode 100644 (file)
index 0000000..5c4c369
--- /dev/null
@@ -0,0 +1,726 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <net/genetlink.h>
+
+#include "br_private.h"
+#include "br_private_cfm.h"
+
+static const struct nla_policy
+br_cfm_mep_create_policy[IFLA_BRIDGE_CFM_MEP_CREATE_MAX + 1] = {
+       [IFLA_BRIDGE_CFM_MEP_CREATE_UNSPEC]     = { .type = NLA_REJECT },
+       [IFLA_BRIDGE_CFM_MEP_CREATE_INSTANCE]   = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_MEP_CREATE_DOMAIN]     = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_MEP_CREATE_DIRECTION]  = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_MEP_CREATE_IFINDEX]    = { .type = NLA_U32 },
+};
+
+static const struct nla_policy
+br_cfm_mep_delete_policy[IFLA_BRIDGE_CFM_MEP_DELETE_MAX + 1] = {
+       [IFLA_BRIDGE_CFM_MEP_DELETE_UNSPEC]     = { .type = NLA_REJECT },
+       [IFLA_BRIDGE_CFM_MEP_DELETE_INSTANCE]   = { .type = NLA_U32 },
+};
+
+static const struct nla_policy
+br_cfm_mep_config_policy[IFLA_BRIDGE_CFM_MEP_CONFIG_MAX + 1] = {
+       [IFLA_BRIDGE_CFM_MEP_CONFIG_UNSPEC]      = { .type = NLA_REJECT },
+       [IFLA_BRIDGE_CFM_MEP_CONFIG_INSTANCE]    = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_MEP_CONFIG_UNICAST_MAC] = NLA_POLICY_ETH_ADDR,
+       [IFLA_BRIDGE_CFM_MEP_CONFIG_MDLEVEL]     = NLA_POLICY_MAX(NLA_U32, 7),
+       [IFLA_BRIDGE_CFM_MEP_CONFIG_MEPID]       = NLA_POLICY_MAX(NLA_U32, 0x1FFF),
+};
+
+static const struct nla_policy
+br_cfm_cc_config_policy[IFLA_BRIDGE_CFM_CC_CONFIG_MAX + 1] = {
+       [IFLA_BRIDGE_CFM_CC_CONFIG_UNSPEC]       = { .type = NLA_REJECT },
+       [IFLA_BRIDGE_CFM_CC_CONFIG_INSTANCE]     = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_CC_CONFIG_ENABLE]       = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_CC_CONFIG_EXP_INTERVAL] = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_CC_CONFIG_EXP_MAID]     = {
+       .type = NLA_BINARY, .len = CFM_MAID_LENGTH },
+};
+
+static const struct nla_policy
+br_cfm_cc_peer_mep_policy[IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX + 1] = {
+       [IFLA_BRIDGE_CFM_CC_PEER_MEP_UNSPEC]    = { .type = NLA_REJECT },
+       [IFLA_BRIDGE_CFM_CC_PEER_MEP_INSTANCE]  = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_CC_PEER_MEPID]         = NLA_POLICY_MAX(NLA_U32, 0x1FFF),
+};
+
+static const struct nla_policy
+br_cfm_cc_rdi_policy[IFLA_BRIDGE_CFM_CC_RDI_MAX + 1] = {
+       [IFLA_BRIDGE_CFM_CC_RDI_UNSPEC]         = { .type = NLA_REJECT },
+       [IFLA_BRIDGE_CFM_CC_RDI_INSTANCE]       = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_CC_RDI_RDI]            = { .type = NLA_U32 },
+};
+
+static const struct nla_policy
+br_cfm_cc_ccm_tx_policy[IFLA_BRIDGE_CFM_CC_CCM_TX_MAX + 1] = {
+       [IFLA_BRIDGE_CFM_CC_CCM_TX_UNSPEC]         = { .type = NLA_REJECT },
+       [IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE]       = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC]           = NLA_POLICY_ETH_ADDR,
+       [IFLA_BRIDGE_CFM_CC_CCM_TX_SEQ_NO_UPDATE]  = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_CC_CCM_TX_PERIOD]         = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV]         = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV_VALUE]   = { .type = NLA_U8 },
+       [IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV]       = { .type = NLA_U32 },
+       [IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV_VALUE] = { .type = NLA_U8 },
+};
+
+static const struct nla_policy
+br_cfm_policy[IFLA_BRIDGE_CFM_MAX + 1] = {
+       [IFLA_BRIDGE_CFM_UNSPEC]                = { .type = NLA_REJECT },
+       [IFLA_BRIDGE_CFM_MEP_CREATE]            =
+                               NLA_POLICY_NESTED(br_cfm_mep_create_policy),
+       [IFLA_BRIDGE_CFM_MEP_DELETE]            =
+                               NLA_POLICY_NESTED(br_cfm_mep_delete_policy),
+       [IFLA_BRIDGE_CFM_MEP_CONFIG]            =
+                               NLA_POLICY_NESTED(br_cfm_mep_config_policy),
+       [IFLA_BRIDGE_CFM_CC_CONFIG]             =
+                               NLA_POLICY_NESTED(br_cfm_cc_config_policy),
+       [IFLA_BRIDGE_CFM_CC_PEER_MEP_ADD]       =
+                               NLA_POLICY_NESTED(br_cfm_cc_peer_mep_policy),
+       [IFLA_BRIDGE_CFM_CC_PEER_MEP_REMOVE]    =
+                               NLA_POLICY_NESTED(br_cfm_cc_peer_mep_policy),
+       [IFLA_BRIDGE_CFM_CC_RDI]                =
+                               NLA_POLICY_NESTED(br_cfm_cc_rdi_policy),
+       [IFLA_BRIDGE_CFM_CC_CCM_TX]             =
+                               NLA_POLICY_NESTED(br_cfm_cc_ccm_tx_policy),
+};
+
+static int br_mep_create_parse(struct net_bridge *br, struct nlattr *attr,
+                              struct netlink_ext_ack *extack)
+{
+       struct nlattr *tb[IFLA_BRIDGE_CFM_MEP_CREATE_MAX + 1];
+       struct br_cfm_mep_create create;
+       u32 instance;
+       int err;
+
+       err = nla_parse_nested(tb, IFLA_BRIDGE_CFM_MEP_CREATE_MAX, attr,
+                              br_cfm_mep_create_policy, extack);
+       if (err)
+               return err;
+
+       if (!tb[IFLA_BRIDGE_CFM_MEP_CREATE_INSTANCE]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing INSTANCE attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_MEP_CREATE_DOMAIN]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing DOMAIN attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_MEP_CREATE_DIRECTION]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing DIRECTION attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_MEP_CREATE_IFINDEX]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing IFINDEX attribute");
+               return -EINVAL;
+       }
+
+       memset(&create, 0, sizeof(create));
+
+       instance =  nla_get_u32(tb[IFLA_BRIDGE_CFM_MEP_CREATE_INSTANCE]);
+       create.domain = nla_get_u32(tb[IFLA_BRIDGE_CFM_MEP_CREATE_DOMAIN]);
+       create.direction = nla_get_u32(tb[IFLA_BRIDGE_CFM_MEP_CREATE_DIRECTION]);
+       create.ifindex = nla_get_u32(tb[IFLA_BRIDGE_CFM_MEP_CREATE_IFINDEX]);
+
+       return br_cfm_mep_create(br, instance, &create, extack);
+}
+
+static int br_mep_delete_parse(struct net_bridge *br, struct nlattr *attr,
+                              struct netlink_ext_ack *extack)
+{
+       struct nlattr *tb[IFLA_BRIDGE_CFM_MEP_DELETE_MAX + 1];
+       u32 instance;
+       int err;
+
+       err = nla_parse_nested(tb, IFLA_BRIDGE_CFM_MEP_DELETE_MAX, attr,
+                              br_cfm_mep_delete_policy, extack);
+       if (err)
+               return err;
+
+       if (!tb[IFLA_BRIDGE_CFM_MEP_DELETE_INSTANCE]) {
+               NL_SET_ERR_MSG_MOD(extack,
+                                  "Missing INSTANCE attribute");
+               return -EINVAL;
+       }
+
+       instance =  nla_get_u32(tb[IFLA_BRIDGE_CFM_MEP_DELETE_INSTANCE]);
+
+       return br_cfm_mep_delete(br, instance, extack);
+}
+
+static int br_mep_config_parse(struct net_bridge *br, struct nlattr *attr,
+                              struct netlink_ext_ack *extack)
+{
+       struct nlattr *tb[IFLA_BRIDGE_CFM_MEP_CONFIG_MAX + 1];
+       struct br_cfm_mep_config config;
+       u32 instance;
+       int err;
+
+       err = nla_parse_nested(tb, IFLA_BRIDGE_CFM_MEP_CONFIG_MAX, attr,
+                              br_cfm_mep_config_policy, extack);
+       if (err)
+               return err;
+
+       if (!tb[IFLA_BRIDGE_CFM_MEP_CONFIG_INSTANCE]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing INSTANCE attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_MEP_CONFIG_UNICAST_MAC]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing UNICAST_MAC attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_MEP_CONFIG_MDLEVEL]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing MDLEVEL attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_MEP_CONFIG_MEPID]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing MEPID attribute");
+               return -EINVAL;
+       }
+
+       memset(&config, 0, sizeof(config));
+
+       instance =  nla_get_u32(tb[IFLA_BRIDGE_CFM_MEP_CONFIG_INSTANCE]);
+       nla_memcpy(&config.unicast_mac.addr,
+                  tb[IFLA_BRIDGE_CFM_MEP_CONFIG_UNICAST_MAC],
+                  sizeof(config.unicast_mac.addr));
+       config.mdlevel = nla_get_u32(tb[IFLA_BRIDGE_CFM_MEP_CONFIG_MDLEVEL]);
+       config.mepid = nla_get_u32(tb[IFLA_BRIDGE_CFM_MEP_CONFIG_MEPID]);
+
+       return br_cfm_mep_config_set(br, instance, &config, extack);
+}
+
+static int br_cc_config_parse(struct net_bridge *br, struct nlattr *attr,
+                             struct netlink_ext_ack *extack)
+{
+       struct nlattr *tb[IFLA_BRIDGE_CFM_CC_CONFIG_MAX + 1];
+       struct br_cfm_cc_config config;
+       u32 instance;
+       int err;
+
+       err = nla_parse_nested(tb, IFLA_BRIDGE_CFM_CC_CONFIG_MAX, attr,
+                              br_cfm_cc_config_policy, extack);
+       if (err)
+               return err;
+
+       if (!tb[IFLA_BRIDGE_CFM_CC_CONFIG_INSTANCE]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing INSTANCE attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_CONFIG_ENABLE]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing ENABLE attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_CONFIG_EXP_INTERVAL]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing INTERVAL attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_CONFIG_EXP_MAID]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing MAID attribute");
+               return -EINVAL;
+       }
+
+       memset(&config, 0, sizeof(config));
+
+       instance =  nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_CONFIG_INSTANCE]);
+       config.enable = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_CONFIG_ENABLE]);
+       config.exp_interval = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_CONFIG_EXP_INTERVAL]);
+       nla_memcpy(&config.exp_maid.data, tb[IFLA_BRIDGE_CFM_CC_CONFIG_EXP_MAID],
+                  sizeof(config.exp_maid.data));
+
+       return br_cfm_cc_config_set(br, instance, &config, extack);
+}
+
+static int br_cc_peer_mep_add_parse(struct net_bridge *br, struct nlattr *attr,
+                                   struct netlink_ext_ack *extack)
+{
+       struct nlattr *tb[IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX + 1];
+       u32 instance, peer_mep_id;
+       int err;
+
+       err = nla_parse_nested(tb, IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX, attr,
+                              br_cfm_cc_peer_mep_policy, extack);
+       if (err)
+               return err;
+
+       if (!tb[IFLA_BRIDGE_CFM_CC_PEER_MEP_INSTANCE]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing INSTANCE attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_PEER_MEPID]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing PEER_MEP_ID attribute");
+               return -EINVAL;
+       }
+
+       instance =  nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_PEER_MEP_INSTANCE]);
+       peer_mep_id =  nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_PEER_MEPID]);
+
+       return br_cfm_cc_peer_mep_add(br, instance, peer_mep_id, extack);
+}
+
+static int br_cc_peer_mep_remove_parse(struct net_bridge *br, struct nlattr *attr,
+                                      struct netlink_ext_ack *extack)
+{
+       struct nlattr *tb[IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX + 1];
+       u32 instance, peer_mep_id;
+       int err;
+
+       err = nla_parse_nested(tb, IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX, attr,
+                              br_cfm_cc_peer_mep_policy, extack);
+       if (err)
+               return err;
+
+       if (!tb[IFLA_BRIDGE_CFM_CC_PEER_MEP_INSTANCE]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing INSTANCE attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_PEER_MEPID]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing PEER_MEP_ID attribute");
+               return -EINVAL;
+       }
+
+       instance =  nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_PEER_MEP_INSTANCE]);
+       peer_mep_id =  nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_PEER_MEPID]);
+
+       return br_cfm_cc_peer_mep_remove(br, instance, peer_mep_id, extack);
+}
+
+static int br_cc_rdi_parse(struct net_bridge *br, struct nlattr *attr,
+                          struct netlink_ext_ack *extack)
+{
+       struct nlattr *tb[IFLA_BRIDGE_CFM_CC_RDI_MAX + 1];
+       u32 instance, rdi;
+       int err;
+
+       err = nla_parse_nested(tb, IFLA_BRIDGE_CFM_CC_RDI_MAX, attr,
+                              br_cfm_cc_rdi_policy, extack);
+       if (err)
+               return err;
+
+       if (!tb[IFLA_BRIDGE_CFM_CC_RDI_INSTANCE]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing INSTANCE attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_RDI_RDI]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing RDI attribute");
+               return -EINVAL;
+       }
+
+       instance =  nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_RDI_INSTANCE]);
+       rdi =  nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_RDI_RDI]);
+
+       return br_cfm_cc_rdi_set(br, instance, rdi, extack);
+}
+
+static int br_cc_ccm_tx_parse(struct net_bridge *br, struct nlattr *attr,
+                             struct netlink_ext_ack *extack)
+{
+       struct nlattr *tb[IFLA_BRIDGE_CFM_CC_CCM_TX_MAX + 1];
+       struct br_cfm_cc_ccm_tx_info tx_info;
+       u32 instance;
+       int err;
+
+       err = nla_parse_nested(tb, IFLA_BRIDGE_CFM_CC_CCM_TX_MAX, attr,
+                              br_cfm_cc_ccm_tx_policy, extack);
+       if (err)
+               return err;
+
+       if (!tb[IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing INSTANCE attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing DMAC attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_CCM_TX_SEQ_NO_UPDATE]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing SEQ_NO_UPDATE attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_CCM_TX_PERIOD]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing PERIOD attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing IF_TLV attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV_VALUE]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing IF_TLV_VALUE attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing PORT_TLV attribute");
+               return -EINVAL;
+       }
+       if (!tb[IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV_VALUE]) {
+               NL_SET_ERR_MSG_MOD(extack, "Missing PORT_TLV_VALUE attribute");
+               return -EINVAL;
+       }
+
+       memset(&tx_info, 0, sizeof(tx_info));
+
+       instance = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_RDI_INSTANCE]);
+       nla_memcpy(&tx_info.dmac.addr,
+                  tb[IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC],
+                  sizeof(tx_info.dmac.addr));
+       tx_info.seq_no_update = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_CCM_TX_SEQ_NO_UPDATE]);
+       tx_info.period = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_CCM_TX_PERIOD]);
+       tx_info.if_tlv = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV]);
+       tx_info.if_tlv_value = nla_get_u8(tb[IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV_VALUE]);
+       tx_info.port_tlv = nla_get_u32(tb[IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV]);
+       tx_info.port_tlv_value = nla_get_u8(tb[IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV_VALUE]);
+
+       return br_cfm_cc_ccm_tx(br, instance, &tx_info, extack);
+}
+
+int br_cfm_parse(struct net_bridge *br, struct net_bridge_port *p,
+                struct nlattr *attr, int cmd, struct netlink_ext_ack *extack)
+{
+       struct nlattr *tb[IFLA_BRIDGE_CFM_MAX + 1];
+       int err;
+
+       /* When this function is called for a port then the br pointer is
+        * invalid, therefor set the br to point correctly
+        */
+       if (p)
+               br = p->br;
+
+       err = nla_parse_nested(tb, IFLA_BRIDGE_CFM_MAX, attr,
+                              br_cfm_policy, extack);
+       if (err)
+               return err;
+
+       if (tb[IFLA_BRIDGE_CFM_MEP_CREATE]) {
+               err = br_mep_create_parse(br, tb[IFLA_BRIDGE_CFM_MEP_CREATE],
+                                         extack);
+               if (err)
+                       return err;
+       }
+
+       if (tb[IFLA_BRIDGE_CFM_MEP_DELETE]) {
+               err = br_mep_delete_parse(br, tb[IFLA_BRIDGE_CFM_MEP_DELETE],
+                                         extack);
+               if (err)
+                       return err;
+       }
+
+       if (tb[IFLA_BRIDGE_CFM_MEP_CONFIG]) {
+               err = br_mep_config_parse(br, tb[IFLA_BRIDGE_CFM_MEP_CONFIG],
+                                         extack);
+               if (err)
+                       return err;
+       }
+
+       if (tb[IFLA_BRIDGE_CFM_CC_CONFIG]) {
+               err = br_cc_config_parse(br, tb[IFLA_BRIDGE_CFM_CC_CONFIG],
+                                        extack);
+               if (err)
+                       return err;
+       }
+
+       if (tb[IFLA_BRIDGE_CFM_CC_PEER_MEP_ADD]) {
+               err = br_cc_peer_mep_add_parse(br, tb[IFLA_BRIDGE_CFM_CC_PEER_MEP_ADD],
+                                              extack);
+               if (err)
+                       return err;
+       }
+
+       if (tb[IFLA_BRIDGE_CFM_CC_PEER_MEP_REMOVE]) {
+               err = br_cc_peer_mep_remove_parse(br, tb[IFLA_BRIDGE_CFM_CC_PEER_MEP_REMOVE],
+                                                 extack);
+               if (err)
+                       return err;
+       }
+
+       if (tb[IFLA_BRIDGE_CFM_CC_RDI]) {
+               err = br_cc_rdi_parse(br, tb[IFLA_BRIDGE_CFM_CC_RDI],
+                                     extack);
+               if (err)
+                       return err;
+       }
+
+       if (tb[IFLA_BRIDGE_CFM_CC_CCM_TX]) {
+               err = br_cc_ccm_tx_parse(br, tb[IFLA_BRIDGE_CFM_CC_CCM_TX],
+                                        extack);
+               if (err)
+                       return err;
+       }
+
+       return 0;
+}
+
+int br_cfm_config_fill_info(struct sk_buff *skb, struct net_bridge *br)
+{
+       struct br_cfm_peer_mep *peer_mep;
+       struct br_cfm_mep *mep;
+       struct nlattr *tb;
+
+       hlist_for_each_entry_rcu(mep, &br->mep_list, head) {
+               tb = nla_nest_start(skb, IFLA_BRIDGE_CFM_MEP_CREATE_INFO);
+               if (!tb)
+                       goto nla_info_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_MEP_CREATE_INSTANCE,
+                               mep->instance))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_MEP_CREATE_DOMAIN,
+                               mep->create.domain))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_MEP_CREATE_DIRECTION,
+                               mep->create.direction))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_MEP_CREATE_IFINDEX,
+                               mep->create.ifindex))
+                       goto nla_put_failure;
+
+               nla_nest_end(skb, tb);
+
+               tb = nla_nest_start(skb, IFLA_BRIDGE_CFM_MEP_CONFIG_INFO);
+
+               if (!tb)
+                       goto nla_info_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_MEP_CONFIG_INSTANCE,
+                               mep->instance))
+                       goto nla_put_failure;
+
+               if (nla_put(skb, IFLA_BRIDGE_CFM_MEP_CONFIG_UNICAST_MAC,
+                           sizeof(mep->config.unicast_mac.addr),
+                           mep->config.unicast_mac.addr))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_MEP_CONFIG_MDLEVEL,
+                               mep->config.mdlevel))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_MEP_CONFIG_MEPID,
+                               mep->config.mepid))
+                       goto nla_put_failure;
+
+               nla_nest_end(skb, tb);
+
+               tb = nla_nest_start(skb, IFLA_BRIDGE_CFM_CC_CONFIG_INFO);
+
+               if (!tb)
+                       goto nla_info_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_CC_CONFIG_INSTANCE,
+                               mep->instance))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_CC_CONFIG_ENABLE,
+                               mep->cc_config.enable))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_CC_CONFIG_EXP_INTERVAL,
+                               mep->cc_config.exp_interval))
+                       goto nla_put_failure;
+
+               if (nla_put(skb, IFLA_BRIDGE_CFM_CC_CONFIG_EXP_MAID,
+                           sizeof(mep->cc_config.exp_maid.data),
+                           mep->cc_config.exp_maid.data))
+                       goto nla_put_failure;
+
+               nla_nest_end(skb, tb);
+
+               tb = nla_nest_start(skb, IFLA_BRIDGE_CFM_CC_RDI_INFO);
+
+               if (!tb)
+                       goto nla_info_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_CC_RDI_INSTANCE,
+                               mep->instance))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_CC_RDI_RDI,
+                               mep->rdi))
+                       goto nla_put_failure;
+
+               nla_nest_end(skb, tb);
+
+               tb = nla_nest_start(skb, IFLA_BRIDGE_CFM_CC_CCM_TX_INFO);
+
+               if (!tb)
+                       goto nla_info_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE,
+                               mep->instance))
+                       goto nla_put_failure;
+
+               if (nla_put(skb, IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC,
+                           sizeof(mep->cc_ccm_tx_info.dmac),
+                           mep->cc_ccm_tx_info.dmac.addr))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_CC_CCM_TX_SEQ_NO_UPDATE,
+                               mep->cc_ccm_tx_info.seq_no_update))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_CC_CCM_TX_PERIOD,
+                               mep->cc_ccm_tx_info.period))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV,
+                               mep->cc_ccm_tx_info.if_tlv))
+                       goto nla_put_failure;
+
+               if (nla_put_u8(skb, IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV_VALUE,
+                              mep->cc_ccm_tx_info.if_tlv_value))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV,
+                               mep->cc_ccm_tx_info.port_tlv))
+                       goto nla_put_failure;
+
+               if (nla_put_u8(skb, IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV_VALUE,
+                              mep->cc_ccm_tx_info.port_tlv_value))
+                       goto nla_put_failure;
+
+               nla_nest_end(skb, tb);
+
+               hlist_for_each_entry_rcu(peer_mep, &mep->peer_mep_list, head) {
+                       tb = nla_nest_start(skb,
+                                           IFLA_BRIDGE_CFM_CC_PEER_MEP_INFO);
+
+                       if (!tb)
+                               goto nla_info_failure;
+
+                       if (nla_put_u32(skb,
+                                       IFLA_BRIDGE_CFM_CC_PEER_MEP_INSTANCE,
+                                       mep->instance))
+                               goto nla_put_failure;
+
+                       if (nla_put_u32(skb, IFLA_BRIDGE_CFM_CC_PEER_MEPID,
+                                       peer_mep->mepid))
+                               goto nla_put_failure;
+
+                       nla_nest_end(skb, tb);
+               }
+       }
+
+       return 0;
+
+nla_put_failure:
+       nla_nest_cancel(skb, tb);
+
+nla_info_failure:
+       return -EMSGSIZE;
+}
+
+int br_cfm_status_fill_info(struct sk_buff *skb,
+                           struct net_bridge *br,
+                           bool getlink)
+{
+       struct br_cfm_peer_mep *peer_mep;
+       struct br_cfm_mep *mep;
+       struct nlattr *tb;
+
+       hlist_for_each_entry_rcu(mep, &br->mep_list, head) {
+               tb = nla_nest_start(skb, IFLA_BRIDGE_CFM_MEP_STATUS_INFO);
+               if (!tb)
+                       goto nla_info_failure;
+
+               if (nla_put_u32(skb, IFLA_BRIDGE_CFM_MEP_STATUS_INSTANCE,
+                               mep->instance))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb,
+                               IFLA_BRIDGE_CFM_MEP_STATUS_OPCODE_UNEXP_SEEN,
+                               mep->status.opcode_unexp_seen))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb,
+                               IFLA_BRIDGE_CFM_MEP_STATUS_VERSION_UNEXP_SEEN,
+                               mep->status.version_unexp_seen))
+                       goto nla_put_failure;
+
+               if (nla_put_u32(skb,
+                               IFLA_BRIDGE_CFM_MEP_STATUS_RX_LEVEL_LOW_SEEN,
+                               mep->status.rx_level_low_seen))
+                       goto nla_put_failure;
+
+               /* Only clear if this is a GETLINK */
+               if (getlink) {
+                       /* Clear all 'seen' indications */
+                       mep->status.opcode_unexp_seen = false;
+                       mep->status.version_unexp_seen = false;
+                       mep->status.rx_level_low_seen = false;
+               }
+
+               nla_nest_end(skb, tb);
+
+               hlist_for_each_entry_rcu(peer_mep, &mep->peer_mep_list, head) {
+                       tb = nla_nest_start(skb,
+                                           IFLA_BRIDGE_CFM_CC_PEER_STATUS_INFO);
+                       if (!tb)
+                               goto nla_info_failure;
+
+                       if (nla_put_u32(skb,
+                                       IFLA_BRIDGE_CFM_CC_PEER_STATUS_INSTANCE,
+                                       mep->instance))
+                               goto nla_put_failure;
+
+                       if (nla_put_u32(skb,
+                                       IFLA_BRIDGE_CFM_CC_PEER_STATUS_PEER_MEPID,
+                                       peer_mep->mepid))
+                               goto nla_put_failure;
+
+                       if (nla_put_u32(skb,
+                                       IFLA_BRIDGE_CFM_CC_PEER_STATUS_CCM_DEFECT,
+                                       peer_mep->cc_status.ccm_defect))
+                               goto nla_put_failure;
+
+                       if (nla_put_u32(skb, IFLA_BRIDGE_CFM_CC_PEER_STATUS_RDI,
+                                       peer_mep->cc_status.rdi))
+                               goto nla_put_failure;
+
+                       if (nla_put_u8(skb,
+                                      IFLA_BRIDGE_CFM_CC_PEER_STATUS_PORT_TLV_VALUE,
+                                      peer_mep->cc_status.port_tlv_value))
+                               goto nla_put_failure;
+
+                       if (nla_put_u8(skb,
+                                      IFLA_BRIDGE_CFM_CC_PEER_STATUS_IF_TLV_VALUE,
+                                      peer_mep->cc_status.if_tlv_value))
+                               goto nla_put_failure;
+
+                       if (nla_put_u32(skb,
+                                       IFLA_BRIDGE_CFM_CC_PEER_STATUS_SEEN,
+                                       peer_mep->cc_status.seen))
+                               goto nla_put_failure;
+
+                       if (nla_put_u32(skb,
+                                       IFLA_BRIDGE_CFM_CC_PEER_STATUS_TLV_SEEN,
+                                       peer_mep->cc_status.tlv_seen))
+                               goto nla_put_failure;
+
+                       if (nla_put_u32(skb,
+                                       IFLA_BRIDGE_CFM_CC_PEER_STATUS_SEQ_UNEXP_SEEN,
+                                       peer_mep->cc_status.seq_unexp_seen))
+                               goto nla_put_failure;
+
+                       if (getlink) { /* Only clear if this is a GETLINK */
+                               /* Clear all 'seen' indications */
+                               peer_mep->cc_status.seen = false;
+                               peer_mep->cc_status.tlv_seen = false;
+                               peer_mep->cc_status.seq_unexp_seen = false;
+                       }
+
+                       nla_nest_end(skb, tb);
+               }
+       }
+
+       return 0;
+
+nla_put_failure:
+       nla_nest_cancel(skb, tb);
+
+nla_info_failure:
+       return -EMSGSIZE;
+}
index 6f742fe..3874039 100644 (file)
@@ -93,7 +93,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
 
                mdst = br_mdb_get(br, skb, vid);
                if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) &&
-                   br_multicast_querier_exists(br, eth_hdr(skb)))
+                   br_multicast_querier_exists(br, eth_hdr(skb), mdst))
                        br_multicast_flood(mdst, skb, false, true);
                else
                        br_flood(br, skb, BR_PKT_MULTICAST, false, true);
@@ -454,8 +454,12 @@ void br_dev_setup(struct net_device *dev)
        spin_lock_init(&br->lock);
        INIT_LIST_HEAD(&br->port_list);
        INIT_HLIST_HEAD(&br->fdb_list);
+       INIT_HLIST_HEAD(&br->frame_type_list);
 #if IS_ENABLED(CONFIG_BRIDGE_MRP)
-       INIT_LIST_HEAD(&br->mrp_list);
+       INIT_HLIST_HEAD(&br->mrp_list);
+#endif
+#if IS_ENABLED(CONFIG_BRIDGE_CFM)
+       INIT_HLIST_HEAD(&br->mep_list);
 #endif
        spin_lock_init(&br->hash_lock);
 
index a0e9a79..f7d2f47 100644 (file)
@@ -334,6 +334,7 @@ static void del_nbp(struct net_bridge_port *p)
        spin_unlock_bh(&br->lock);
 
        br_mrp_port_del(br, p);
+       br_cfm_port_del(br, p);
 
        br_ifinfo_notify(RTM_DELLINK, NULL, p);
 
index 59a318b..2180898 100644 (file)
@@ -134,7 +134,7 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb
        case BR_PKT_MULTICAST:
                mdst = br_mdb_get(br, skb, vid);
                if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) &&
-                   br_multicast_querier_exists(br, eth_hdr(skb))) {
+                   br_multicast_querier_exists(br, eth_hdr(skb), mdst)) {
                        if ((mdst && mdst->host_joined) ||
                            br_multicast_is_router(br)) {
                                local_rcv = true;
@@ -254,6 +254,21 @@ frame_finish:
        return RX_HANDLER_CONSUMED;
 }
 
+/* Return 0 if the frame was not processed otherwise 1
+ * note: already called with rcu_read_lock
+ */
+static int br_process_frame_type(struct net_bridge_port *p,
+                                struct sk_buff *skb)
+{
+       struct br_frame_type *tmp;
+
+       hlist_for_each_entry_rcu(tmp, &p->br->frame_type_list, list)
+               if (unlikely(tmp->type == skb->protocol))
+                       return tmp->frame_handler(p, skb);
+
+       return 0;
+}
+
 /*
  * Return NULL if skb is handled
  * note: already called with rcu_read_lock
@@ -343,7 +358,7 @@ static rx_handler_result_t br_handle_frame(struct sk_buff **pskb)
                }
        }
 
-       if (unlikely(br_mrp_process(p, skb)))
+       if (unlikely(br_process_frame_type(p, skb)))
                return RX_HANDLER_PASS;
 
 forward:
@@ -380,3 +395,19 @@ rx_handler_func_t *br_get_rx_handler(const struct net_device *dev)
 
        return br_handle_frame;
 }
+
+void br_add_frame(struct net_bridge *br, struct br_frame_type *ft)
+{
+       hlist_add_head_rcu(&ft->list, &br->frame_type_list);
+}
+
+void br_del_frame(struct net_bridge *br, struct br_frame_type *ft)
+{
+       struct br_frame_type *tmp;
+
+       hlist_for_each_entry(tmp, &br->frame_type_list, list)
+               if (ft == tmp) {
+                       hlist_del_rcu(&ft->list);
+                       return;
+               }
+}
index e15bab1..8846c5b 100644 (file)
@@ -87,6 +87,8 @@ static void __mdb_entry_to_br_ip(struct br_mdb_entry *entry, struct br_ip *ip,
                        ip->src.ip6 = nla_get_in6_addr(mdb_attrs[MDBE_ATTR_SOURCE]);
                break;
 #endif
+       default:
+               ether_addr_copy(ip->dst.mac_addr, entry->addr.u.mac_addr);
        }
 
 }
@@ -174,9 +176,11 @@ static int __mdb_fill_info(struct sk_buff *skb,
        if (mp->addr.proto == htons(ETH_P_IP))
                e.addr.u.ip4 = mp->addr.dst.ip4;
 #if IS_ENABLED(CONFIG_IPV6)
-       if (mp->addr.proto == htons(ETH_P_IPV6))
+       else if (mp->addr.proto == htons(ETH_P_IPV6))
                e.addr.u.ip6 = mp->addr.dst.ip6;
 #endif
+       else
+               ether_addr_copy(e.addr.u.mac_addr, mp->addr.dst.mac_addr);
        e.addr.proto = mp->addr.proto;
        nest_ent = nla_nest_start_noflag(skb,
                                         MDBA_MDB_ENTRY_INFO);
@@ -210,6 +214,8 @@ static int __mdb_fill_info(struct sk_buff *skb,
                }
                break;
 #endif
+       default:
+               ether_addr_copy(e.addr.u.mac_addr, mp->addr.dst.mac_addr);
        }
        if (p) {
                if (nla_put_u8(skb, MDBA_MDB_EATTR_RTPROT, p->rt_protocol))
@@ -562,9 +568,12 @@ void br_mdb_notify(struct net_device *dev,
                if (mp->addr.proto == htons(ETH_P_IP))
                        ip_eth_mc_map(mp->addr.dst.ip4, mdb.addr);
 #if IS_ENABLED(CONFIG_IPV6)
-               else
+               else if (mp->addr.proto == htons(ETH_P_IPV6))
                        ipv6_eth_mc_map(&mp->addr.dst.ip6, mdb.addr);
 #endif
+               else
+                       ether_addr_copy(mdb.addr, mp->addr.dst.mac_addr);
+
                mdb.obj.orig_dev = pg->key.port->dev;
                switch (type) {
                case RTM_NEWMDB:
@@ -693,6 +702,12 @@ static bool is_valid_mdb_entry(struct br_mdb_entry *entry,
                        return false;
                }
 #endif
+       } else if (entry->addr.proto == 0) {
+               /* L2 mdb */
+               if (!is_multicast_ether_addr(entry->addr.u.mac_addr)) {
+                       NL_SET_ERR_MSG_MOD(extack, "L2 entry group is not multicast");
+                       return false;
+               }
        } else {
                NL_SET_ERR_MSG_MOD(extack, "Unknown entry protocol");
                return false;
@@ -831,6 +846,7 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port,
        struct net_bridge_port_group __rcu **pp;
        struct br_ip group, star_group;
        unsigned long now = jiffies;
+       unsigned char flags = 0;
        u8 filter_mode;
        int err;
 
@@ -849,6 +865,11 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port,
                }
        }
 
+       if (br_group_is_l2(&group) && entry->state != MDB_PERMANENT) {
+               NL_SET_ERR_MSG_MOD(extack, "Only permanent L2 entries allowed");
+               return -EINVAL;
+       }
+
        mp = br_mdb_ip_get(br, &group);
        if (!mp) {
                mp = br_multicast_new_group(br, &group);
@@ -884,7 +905,10 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port,
        filter_mode = br_multicast_is_star_g(&group) ? MCAST_EXCLUDE :
                                                       MCAST_INCLUDE;
 
-       p = br_multicast_new_port_group(port, &group, *pp, entry->state, NULL,
+       if (entry->state == MDB_PERMANENT)
+               flags |= MDB_PG_FLAGS_PERMANENT;
+
+       p = br_multicast_new_port_group(port, &group, *pp, flags, NULL,
                                        filter_mode, RTPROT_STATIC);
        if (unlikely(!p)) {
                NL_SET_ERR_MSG_MOD(extack, "Couldn't allocate new port group");
index b36689e..bb12fbf 100644 (file)
@@ -6,6 +6,13 @@
 static const u8 mrp_test_dmac[ETH_ALEN] = { 0x1, 0x15, 0x4e, 0x0, 0x0, 0x1 };
 static const u8 mrp_in_test_dmac[ETH_ALEN] = { 0x1, 0x15, 0x4e, 0x0, 0x0, 0x3 };
 
+static int br_mrp_process(struct net_bridge_port *p, struct sk_buff *skb);
+
+static struct br_frame_type mrp_frame_type __read_mostly = {
+       .type = cpu_to_be16(ETH_P_MRP),
+       .frame_handler = br_mrp_process,
+};
+
 static bool br_mrp_is_ring_port(struct net_bridge_port *p_port,
                                struct net_bridge_port *s_port,
                                struct net_bridge_port *port)
@@ -47,8 +54,8 @@ static struct br_mrp *br_mrp_find_id(struct net_bridge *br, u32 ring_id)
        struct br_mrp *res = NULL;
        struct br_mrp *mrp;
 
-       list_for_each_entry_rcu(mrp, &br->mrp_list, list,
-                               lockdep_rtnl_is_held()) {
+       hlist_for_each_entry_rcu(mrp, &br->mrp_list, list,
+                                lockdep_rtnl_is_held()) {
                if (mrp->ring_id == ring_id) {
                        res = mrp;
                        break;
@@ -63,8 +70,8 @@ static struct br_mrp *br_mrp_find_in_id(struct net_bridge *br, u32 in_id)
        struct br_mrp *res = NULL;
        struct br_mrp *mrp;
 
-       list_for_each_entry_rcu(mrp, &br->mrp_list, list,
-                               lockdep_rtnl_is_held()) {
+       hlist_for_each_entry_rcu(mrp, &br->mrp_list, list,
+                                lockdep_rtnl_is_held()) {
                if (mrp->in_id == in_id) {
                        res = mrp;
                        break;
@@ -78,8 +85,8 @@ static bool br_mrp_unique_ifindex(struct net_bridge *br, u32 ifindex)
 {
        struct br_mrp *mrp;
 
-       list_for_each_entry_rcu(mrp, &br->mrp_list, list,
-                               lockdep_rtnl_is_held()) {
+       hlist_for_each_entry_rcu(mrp, &br->mrp_list, list,
+                                lockdep_rtnl_is_held()) {
                struct net_bridge_port *p;
 
                p = rtnl_dereference(mrp->p_port);
@@ -104,8 +111,8 @@ static struct br_mrp *br_mrp_find_port(struct net_bridge *br,
        struct br_mrp *res = NULL;
        struct br_mrp *mrp;
 
-       list_for_each_entry_rcu(mrp, &br->mrp_list, list,
-                               lockdep_rtnl_is_held()) {
+       hlist_for_each_entry_rcu(mrp, &br->mrp_list, list,
+                                lockdep_rtnl_is_held()) {
                if (rcu_access_pointer(mrp->p_port) == p ||
                    rcu_access_pointer(mrp->s_port) == p ||
                    rcu_access_pointer(mrp->i_port) == p) {
@@ -443,8 +450,11 @@ static void br_mrp_del_impl(struct net_bridge *br, struct br_mrp *mrp)
                rcu_assign_pointer(mrp->i_port, NULL);
        }
 
-       list_del_rcu(&mrp->list);
+       hlist_del_rcu(&mrp->list);
        kfree_rcu(mrp, rcu);
+
+       if (hlist_empty(&br->mrp_list))
+               br_del_frame(br, &mrp_frame_type);
 }
 
 /* Adds a new MRP instance.
@@ -493,9 +503,12 @@ int br_mrp_add(struct net_bridge *br, struct br_mrp_instance *instance)
        spin_unlock_bh(&br->lock);
        rcu_assign_pointer(mrp->s_port, p);
 
+       if (hlist_empty(&br->mrp_list))
+               br_add_frame(br, &mrp_frame_type);
+
        INIT_DELAYED_WORK(&mrp->test_work, br_mrp_test_work_expired);
        INIT_DELAYED_WORK(&mrp->in_test_work, br_mrp_in_test_work_expired);
-       list_add_tail_rcu(&mrp->list, &br->mrp_list);
+       hlist_add_tail_rcu(&mrp->list, &br->mrp_list);
 
        err = br_mrp_switchdev_add(br, mrp);
        if (err)
@@ -1172,20 +1185,18 @@ no_forward:
  * normal forwarding.
  * note: already called with rcu_read_lock
  */
-int br_mrp_process(struct net_bridge_port *p, struct sk_buff *skb)
+static int br_mrp_process(struct net_bridge_port *p, struct sk_buff *skb)
 {
        /* If there is no MRP instance do normal forwarding */
        if (likely(!(p->flags & BR_MRP_AWARE)))
                goto out;
 
-       if (unlikely(skb->protocol == htons(ETH_P_MRP)))
-               return br_mrp_rcv(p, skb, p->dev);
-
+       return br_mrp_rcv(p, skb, p->dev);
 out:
        return 0;
 }
 
 bool br_mrp_enabled(struct net_bridge *br)
 {
-       return !list_empty(&br->mrp_list);
+       return !hlist_empty(&br->mrp_list);
 }
index 2a2fdf3..ce6f63c 100644 (file)
@@ -453,7 +453,7 @@ int br_mrp_fill_info(struct sk_buff *skb, struct net_bridge *br)
        if (!mrp_tb)
                return -EMSGSIZE;
 
-       list_for_each_entry_rcu(mrp, &br->mrp_list, list) {
+       hlist_for_each_entry_rcu(mrp, &br->mrp_list, list) {
                struct net_bridge_port *p;
 
                tb = nla_nest_start_noflag(skb, IFLA_BRIDGE_MRP_INFO);
index eae898c..484820c 100644 (file)
@@ -179,7 +179,8 @@ struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br,
                break;
 #endif
        default:
-               return NULL;
+               ip.proto = 0;
+               ether_addr_copy(ip.dst.mac_addr, eth_hdr(skb)->h_dest);
        }
 
        return br_mdb_ip_get_rcu(br, &ip);
@@ -1203,6 +1204,10 @@ void br_multicast_host_join(struct net_bridge_mdb_entry *mp, bool notify)
                if (notify)
                        br_mdb_notify(mp->br->dev, mp, NULL, RTM_NEWMDB);
        }
+
+       if (br_group_is_l2(&mp->addr))
+               return;
+
        mod_timer(&mp->timer, jiffies + mp->br->multicast_membership_interval);
 }
 
@@ -1254,8 +1259,8 @@ __br_multicast_add_group(struct net_bridge *br,
                        break;
        }
 
-       p = br_multicast_new_port_group(port, group, *pp, 0, src, filter_mode,
-                                       RTPROT_KERNEL);
+       p = br_multicast_new_port_group(port, group, *pp, 0, src,
+                                       filter_mode, RTPROT_KERNEL);
        if (unlikely(!p)) {
                p = ERR_PTR(-ENOMEM);
                goto out;
@@ -3690,7 +3695,7 @@ bool br_multicast_has_querier_anywhere(struct net_device *dev, int proto)
        memset(&eth, 0, sizeof(eth));
        eth.h_proto = htons(proto);
 
-       ret = br_multicast_querier_exists(br, &eth);
+       ret = br_multicast_querier_exists(br, &eth, NULL);
 
 unlock:
        rcu_read_unlock();
index 92d64ab..6952d48 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "br_private.h"
 #include "br_private_stp.h"
+#include "br_private_cfm.h"
 #include "br_private_tunnel.h"
 
 static int __get_num_vlan_infos(struct net_bridge_vlan_group *vg,
@@ -93,9 +94,11 @@ static size_t br_get_link_af_size_filtered(const struct net_device *dev,
 {
        struct net_bridge_vlan_group *vg = NULL;
        struct net_bridge_port *p = NULL;
-       struct net_bridge *br;
-       int num_vlan_infos;
+       struct net_bridge *br = NULL;
+       u32 num_cfm_peer_mep_infos;
+       u32 num_cfm_mep_infos;
        size_t vinfo_sz = 0;
+       int num_vlan_infos;
 
        rcu_read_lock();
        if (netif_is_bridge_port(dev)) {
@@ -114,6 +117,49 @@ static size_t br_get_link_af_size_filtered(const struct net_device *dev,
        /* Each VLAN is returned in bridge_vlan_info along with flags */
        vinfo_sz += num_vlan_infos * nla_total_size(sizeof(struct bridge_vlan_info));
 
+       if (!(filter_mask & RTEXT_FILTER_CFM_STATUS))
+               return vinfo_sz;
+
+       if (!br)
+               return vinfo_sz;
+
+       /* CFM status info must be added */
+       br_cfm_mep_count(br, &num_cfm_mep_infos);
+       br_cfm_peer_mep_count(br, &num_cfm_peer_mep_infos);
+
+       vinfo_sz += nla_total_size(0);  /* IFLA_BRIDGE_CFM */
+       /* For each status struct the MEP instance (u32) is added */
+       /* MEP instance (u32) + br_cfm_mep_status */
+       vinfo_sz += num_cfm_mep_infos *
+                    /*IFLA_BRIDGE_CFM_MEP_STATUS_INSTANCE */
+                   (nla_total_size(sizeof(u32))
+                    /* IFLA_BRIDGE_CFM_MEP_STATUS_OPCODE_UNEXP_SEEN */
+                    + nla_total_size(sizeof(u32))
+                    /* IFLA_BRIDGE_CFM_MEP_STATUS_VERSION_UNEXP_SEEN */
+                    + nla_total_size(sizeof(u32))
+                    /* IFLA_BRIDGE_CFM_MEP_STATUS_RX_LEVEL_LOW_SEEN */
+                    + nla_total_size(sizeof(u32)));
+       /* MEP instance (u32) + br_cfm_cc_peer_status */
+       vinfo_sz += num_cfm_peer_mep_infos *
+                    /* IFLA_BRIDGE_CFM_CC_PEER_STATUS_INSTANCE */
+                   (nla_total_size(sizeof(u32))
+                    /* IFLA_BRIDGE_CFM_CC_PEER_STATUS_PEER_MEPID */
+                    + nla_total_size(sizeof(u32))
+                    /* IFLA_BRIDGE_CFM_CC_PEER_STATUS_CCM_DEFECT */
+                    + nla_total_size(sizeof(u32))
+                    /* IFLA_BRIDGE_CFM_CC_PEER_STATUS_RDI */
+                    + nla_total_size(sizeof(u32))
+                    /* IFLA_BRIDGE_CFM_CC_PEER_STATUS_PORT_TLV_VALUE */
+                    + nla_total_size(sizeof(u8))
+                    /* IFLA_BRIDGE_CFM_CC_PEER_STATUS_IF_TLV_VALUE */
+                    + nla_total_size(sizeof(u8))
+                    /* IFLA_BRIDGE_CFM_CC_PEER_STATUS_SEEN */
+                    + nla_total_size(sizeof(u32))
+                    /* IFLA_BRIDGE_CFM_CC_PEER_STATUS_TLV_SEEN */
+                    + nla_total_size(sizeof(u32))
+                    /* IFLA_BRIDGE_CFM_CC_PEER_STATUS_SEQ_UNEXP_SEEN */
+                    + nla_total_size(sizeof(u32)));
+
        return vinfo_sz;
 }
 
@@ -377,7 +423,8 @@ nla_put_failure:
 static int br_fill_ifinfo(struct sk_buff *skb,
                          const struct net_bridge_port *port,
                          u32 pid, u32 seq, int event, unsigned int flags,
-                         u32 filter_mask, const struct net_device *dev)
+                         u32 filter_mask, const struct net_device *dev,
+                         bool getlink)
 {
        u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN;
        struct nlattr *af = NULL;
@@ -426,7 +473,9 @@ static int br_fill_ifinfo(struct sk_buff *skb,
 
        if (filter_mask & (RTEXT_FILTER_BRVLAN |
                           RTEXT_FILTER_BRVLAN_COMPRESSED |
-                          RTEXT_FILTER_MRP)) {
+                          RTEXT_FILTER_MRP |
+                          RTEXT_FILTER_CFM_CONFIG |
+                          RTEXT_FILTER_CFM_STATUS)) {
                af = nla_nest_start_noflag(skb, IFLA_AF_SPEC);
                if (!af)
                        goto nla_put_failure;
@@ -475,6 +524,36 @@ static int br_fill_ifinfo(struct sk_buff *skb,
                        goto nla_put_failure;
        }
 
+       if (filter_mask & (RTEXT_FILTER_CFM_CONFIG | RTEXT_FILTER_CFM_STATUS)) {
+               struct nlattr *cfm_nest = NULL;
+               int err;
+
+               if (!br_cfm_created(br) || port)
+                       goto done;
+
+               cfm_nest = nla_nest_start(skb, IFLA_BRIDGE_CFM);
+               if (!cfm_nest)
+                       goto nla_put_failure;
+
+               if (filter_mask & RTEXT_FILTER_CFM_CONFIG) {
+                       rcu_read_lock();
+                       err = br_cfm_config_fill_info(skb, br);
+                       rcu_read_unlock();
+                       if (err)
+                               goto nla_put_failure;
+               }
+
+               if (filter_mask & RTEXT_FILTER_CFM_STATUS) {
+                       rcu_read_lock();
+                       err = br_cfm_status_fill_info(skb, br, getlink);
+                       rcu_read_unlock();
+                       if (err)
+                               goto nla_put_failure;
+               }
+
+               nla_nest_end(skb, cfm_nest);
+       }
+
 done:
        if (af)
                nla_nest_end(skb, af);
@@ -486,11 +565,9 @@ nla_put_failure:
        return -EMSGSIZE;
 }
 
-/* Notify listeners of a change in bridge or port information */
-void br_ifinfo_notify(int event, const struct net_bridge *br,
-                     const struct net_bridge_port *port)
+void br_info_notify(int event, const struct net_bridge *br,
+                   const struct net_bridge_port *port, u32 filter)
 {
-       u32 filter = RTEXT_FILTER_BRVLAN_COMPRESSED;
        struct net_device *dev;
        struct sk_buff *skb;
        int err = -ENOBUFS;
@@ -515,7 +592,7 @@ void br_ifinfo_notify(int event, const struct net_bridge *br,
        if (skb == NULL)
                goto errout;
 
-       err = br_fill_ifinfo(skb, port, 0, 0, event, 0, filter, dev);
+       err = br_fill_ifinfo(skb, port, 0, 0, event, 0, filter, dev, false);
        if (err < 0) {
                /* -EMSGSIZE implies BUG in br_nlmsg_size() */
                WARN_ON(err == -EMSGSIZE);
@@ -528,6 +605,15 @@ errout:
        rtnl_set_sk_err(net, RTNLGRP_LINK, err);
 }
 
+/* Notify listeners of a change in bridge or port information */
+void br_ifinfo_notify(int event, const struct net_bridge *br,
+                     const struct net_bridge_port *port)
+{
+       u32 filter = RTEXT_FILTER_BRVLAN_COMPRESSED;
+
+       return br_info_notify(event, br, port, filter);
+}
+
 /*
  * Dump information about all ports, in response to GETLINK
  */
@@ -538,11 +624,13 @@ int br_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 
        if (!port && !(filter_mask & RTEXT_FILTER_BRVLAN) &&
            !(filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED) &&
-           !(filter_mask & RTEXT_FILTER_MRP))
+           !(filter_mask & RTEXT_FILTER_MRP) &&
+           !(filter_mask & RTEXT_FILTER_CFM_CONFIG) &&
+           !(filter_mask & RTEXT_FILTER_CFM_STATUS))
                return 0;
 
        return br_fill_ifinfo(skb, port, pid, seq, RTM_NEWLINK, nlflags,
-                             filter_mask, dev);
+                             filter_mask, dev, true);
 }
 
 static int br_vlan_info(struct net_bridge *br, struct net_bridge_port *p,
@@ -700,6 +788,11 @@ static int br_afspec(struct net_bridge *br,
                        if (err)
                                return err;
                        break;
+               case IFLA_BRIDGE_CFM:
+                       err = br_cfm_parse(br, p, attr, cmd, extack);
+                       if (err)
+                               return err;
+                       break;
                }
        }
 
index 345118e..6f2818c 100644 (file)
@@ -383,7 +383,7 @@ enum net_bridge_opts {
 struct net_bridge {
        spinlock_t                      lock;
        spinlock_t                      hash_lock;
-       struct list_head                port_list;
+       struct hlist_head               frame_type_list;
        struct net_device               *dev;
        struct pcpu_sw_netstats         __percpu *stats;
        unsigned long                   options;
@@ -395,6 +395,7 @@ struct net_bridge {
 #endif
 
        struct rhashtable               fdb_hash_tbl;
+       struct list_head                port_list;
 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
        union {
                struct rtable           fake_rtable;
@@ -481,7 +482,10 @@ struct net_bridge {
        struct hlist_head               fdb_list;
 
 #if IS_ENABLED(CONFIG_BRIDGE_MRP)
-       struct list_head                mrp_list;
+       struct hlist_head               mrp_list;
+#endif
+#if IS_ENABLED(CONFIG_BRIDGE_CFM)
+       struct hlist_head               mep_list;
 #endif
 };
 
@@ -755,6 +759,16 @@ int nbp_backup_change(struct net_bridge_port *p, struct net_device *backup_dev);
 int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb);
 rx_handler_func_t *br_get_rx_handler(const struct net_device *dev);
 
+struct br_frame_type {
+       __be16                  type;
+       int                     (*frame_handler)(struct net_bridge_port *port,
+                                                struct sk_buff *skb);
+       struct hlist_node       list;
+};
+
+void br_add_frame(struct net_bridge *br, struct br_frame_type *ft);
+void br_del_frame(struct net_bridge *br, struct br_frame_type *ft);
+
 static inline bool br_rx_handler_check_rcu(const struct net_device *dev)
 {
        return rcu_dereference(dev->rx_handler) == br_get_rx_handler(dev);
@@ -840,6 +854,11 @@ void br_multicast_star_g_handle_mode(struct net_bridge_port_group *pg,
 void br_multicast_sg_add_exclude_ports(struct net_bridge_mdb_entry *star_mp,
                                       struct net_bridge_port_group *sg);
 
+static inline bool br_group_is_l2(const struct br_ip *group)
+{
+       return group->proto == 0;
+}
+
 #define mlock_dereference(X, br) \
        rcu_dereference_protected(X, lockdep_is_held(&br->multicast_lock))
 
@@ -871,7 +890,8 @@ __br_multicast_querier_exists(struct net_bridge *br,
 }
 
 static inline bool br_multicast_querier_exists(struct net_bridge *br,
-                                              struct ethhdr *eth)
+                                              struct ethhdr *eth,
+                                              const struct net_bridge_mdb_entry *mdb)
 {
        switch (eth->h_proto) {
        case (htons(ETH_P_IP)):
@@ -883,7 +903,7 @@ static inline bool br_multicast_querier_exists(struct net_bridge *br,
                        &br->ip6_other_query, true);
 #endif
        default:
-               return false;
+               return !!mdb && br_group_is_l2(&mdb->addr);
        }
 }
 
@@ -993,7 +1013,8 @@ static inline bool br_multicast_is_router(struct net_bridge *br)
 }
 
 static inline bool br_multicast_querier_exists(struct net_bridge *br,
-                                              struct ethhdr *eth)
+                                              struct ethhdr *eth,
+                                              const struct net_bridge_mdb_entry *mdb)
 {
        return false;
 }
@@ -1417,7 +1438,6 @@ extern int (*br_fdb_test_addr_hook)(struct net_device *dev, unsigned char *addr)
 #if IS_ENABLED(CONFIG_BRIDGE_MRP)
 int br_mrp_parse(struct net_bridge *br, struct net_bridge_port *p,
                 struct nlattr *attr, int cmd, struct netlink_ext_ack *extack);
-int br_mrp_process(struct net_bridge_port *p, struct sk_buff *skb);
 bool br_mrp_enabled(struct net_bridge *br);
 void br_mrp_port_del(struct net_bridge *br, struct net_bridge_port *p);
 int br_mrp_fill_info(struct sk_buff *skb, struct net_bridge *br);
@@ -1429,11 +1449,6 @@ static inline int br_mrp_parse(struct net_bridge *br, struct net_bridge_port *p,
        return -EOPNOTSUPP;
 }
 
-static inline int br_mrp_process(struct net_bridge_port *p, struct sk_buff *skb)
-{
-       return 0;
-}
-
 static inline bool br_mrp_enabled(struct net_bridge *br)
 {
        return false;
@@ -1451,12 +1466,67 @@ static inline int br_mrp_fill_info(struct sk_buff *skb, struct net_bridge *br)
 
 #endif
 
+/* br_cfm.c */
+#if IS_ENABLED(CONFIG_BRIDGE_CFM)
+int br_cfm_parse(struct net_bridge *br, struct net_bridge_port *p,
+                struct nlattr *attr, int cmd, struct netlink_ext_ack *extack);
+bool br_cfm_created(struct net_bridge *br);
+void br_cfm_port_del(struct net_bridge *br, struct net_bridge_port *p);
+int br_cfm_config_fill_info(struct sk_buff *skb, struct net_bridge *br);
+int br_cfm_status_fill_info(struct sk_buff *skb,
+                           struct net_bridge *br,
+                           bool getlink);
+int br_cfm_mep_count(struct net_bridge *br, u32 *count);
+int br_cfm_peer_mep_count(struct net_bridge *br, u32 *count);
+#else
+static inline int br_cfm_parse(struct net_bridge *br, struct net_bridge_port *p,
+                              struct nlattr *attr, int cmd,
+                              struct netlink_ext_ack *extack)
+{
+       return -EOPNOTSUPP;
+}
+
+static inline bool br_cfm_created(struct net_bridge *br)
+{
+       return false;
+}
+
+static inline void br_cfm_port_del(struct net_bridge *br,
+                                  struct net_bridge_port *p)
+{
+}
+
+static inline int br_cfm_config_fill_info(struct sk_buff *skb, struct net_bridge *br)
+{
+       return -EOPNOTSUPP;
+}
+
+static inline int br_cfm_status_fill_info(struct sk_buff *skb,
+                                         struct net_bridge *br,
+                                         bool getlink)
+{
+       return -EOPNOTSUPP;
+}
+
+static inline int br_cfm_mep_count(struct net_bridge *br, u32 *count)
+{
+       return -EOPNOTSUPP;
+}
+
+static inline int br_cfm_peer_mep_count(struct net_bridge *br, u32 *count)
+{
+       return -EOPNOTSUPP;
+}
+#endif
+
 /* br_netlink.c */
 extern struct rtnl_link_ops br_link_ops;
 int br_netlink_init(void);
 void br_netlink_fini(void);
 void br_ifinfo_notify(int event, const struct net_bridge *br,
                      const struct net_bridge_port *port);
+void br_info_notify(int event, const struct net_bridge *br,
+                   const struct net_bridge_port *port, u32 filter);
 int br_setlink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags,
               struct netlink_ext_ack *extack);
 int br_dellink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags);
diff --git a/net/bridge/br_private_cfm.h b/net/bridge/br_private_cfm.h
new file mode 100644 (file)
index 0000000..a43a5e7
--- /dev/null
@@ -0,0 +1,147 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef _BR_PRIVATE_CFM_H_
+#define _BR_PRIVATE_CFM_H_
+
+#include "br_private.h"
+#include <uapi/linux/cfm_bridge.h>
+
+struct br_cfm_mep_create {
+       enum br_cfm_domain domain; /* Domain for this MEP */
+       enum br_cfm_mep_direction direction; /* Up or Down MEP direction */
+       u32 ifindex; /* Residence port */
+};
+
+int br_cfm_mep_create(struct net_bridge *br,
+                     const u32 instance,
+                     struct br_cfm_mep_create *const create,
+                     struct netlink_ext_ack *extack);
+
+int br_cfm_mep_delete(struct net_bridge *br,
+                     const u32 instance,
+                     struct netlink_ext_ack *extack);
+
+struct br_cfm_mep_config {
+       u32 mdlevel;
+       u32 mepid; /* MEPID for this MEP */
+       struct mac_addr unicast_mac; /* The MEP unicast MAC */
+};
+
+int br_cfm_mep_config_set(struct net_bridge *br,
+                         const u32 instance,
+                         const struct br_cfm_mep_config *const config,
+                         struct netlink_ext_ack *extack);
+
+struct br_cfm_maid {
+       u8 data[CFM_MAID_LENGTH];
+};
+
+struct br_cfm_cc_config {
+       /* Expected received CCM PDU MAID. */
+       struct br_cfm_maid exp_maid;
+
+       /* Expected received CCM PDU interval. */
+       /* Transmitting CCM PDU interval when CCM tx is enabled. */
+       enum br_cfm_ccm_interval exp_interval;
+
+       bool enable; /* Enable/disable CCM PDU handling */
+};
+
+int br_cfm_cc_config_set(struct net_bridge *br,
+                        const u32 instance,
+                        const struct br_cfm_cc_config *const config,
+                        struct netlink_ext_ack *extack);
+
+int br_cfm_cc_peer_mep_add(struct net_bridge *br, const u32 instance,
+                          u32 peer_mep_id,
+                          struct netlink_ext_ack *extack);
+int br_cfm_cc_peer_mep_remove(struct net_bridge *br, const u32 instance,
+                             u32 peer_mep_id,
+                             struct netlink_ext_ack *extack);
+
+/* Transmitted CCM Remote Defect Indication status set.
+ * This RDI is inserted in transmitted CCM PDUs if CCM transmission is enabled.
+ * See br_cfm_cc_ccm_tx() with interval != BR_CFM_CCM_INTERVAL_NONE
+ */
+int br_cfm_cc_rdi_set(struct net_bridge *br, const u32 instance,
+                     const bool rdi, struct netlink_ext_ack *extack);
+
+/* OAM PDU Tx information */
+struct br_cfm_cc_ccm_tx_info {
+       struct mac_addr dmac;
+       /* The CCM will be transmitted for this period in seconds.
+        * Call br_cfm_cc_ccm_tx before timeout to keep transmission alive.
+        * When period is zero any ongoing transmission will be stopped.
+        */
+       u32 period;
+
+       bool seq_no_update; /* Update Tx CCM sequence number */
+       bool if_tlv; /* Insert Interface Status TLV */
+       u8 if_tlv_value; /* Interface Status TLV value */
+       bool port_tlv; /* Insert Port Status TLV */
+       u8 port_tlv_value; /* Port Status TLV value */
+       /* Sender ID TLV ??
+        * Organization-Specific TLV ??
+        */
+};
+
+int br_cfm_cc_ccm_tx(struct net_bridge *br, const u32 instance,
+                    const struct br_cfm_cc_ccm_tx_info *const tx_info,
+                    struct netlink_ext_ack *extack);
+
+struct br_cfm_mep_status {
+       /* Indications that an OAM PDU has been seen. */
+       bool opcode_unexp_seen; /* RX of OAM PDU with unexpected opcode */
+       bool version_unexp_seen; /* RX of OAM PDU with unexpected version */
+       bool rx_level_low_seen; /* Rx of OAM PDU with level low */
+};
+
+struct br_cfm_cc_peer_status {
+       /* This CCM related status is based on the latest received CCM PDU. */
+       u8 port_tlv_value; /* Port Status TLV value */
+       u8 if_tlv_value; /* Interface Status TLV value */
+
+       /* CCM has not been received for 3.25 intervals */
+       u8 ccm_defect:1;
+
+       /* (RDI == 1) for last received CCM PDU */
+       u8 rdi:1;
+
+       /* Indications that a CCM PDU has been seen. */
+       u8 seen:1; /* CCM PDU received */
+       u8 tlv_seen:1; /* CCM PDU with TLV received */
+       /* CCM PDU with unexpected sequence number received */
+       u8 seq_unexp_seen:1;
+};
+
+struct br_cfm_mep {
+       /* list header of MEP instances */
+       struct hlist_node               head;
+       u32                             instance;
+       struct br_cfm_mep_create        create;
+       struct br_cfm_mep_config        config;
+       struct br_cfm_cc_config         cc_config;
+       struct br_cfm_cc_ccm_tx_info    cc_ccm_tx_info;
+       /* List of multiple peer MEPs */
+       struct hlist_head               peer_mep_list;
+       struct net_bridge_port __rcu    *b_port;
+       unsigned long                   ccm_tx_end;
+       struct delayed_work             ccm_tx_dwork;
+       u32                             ccm_tx_snumber;
+       u32                             ccm_rx_snumber;
+       struct br_cfm_mep_status        status;
+       bool                            rdi;
+       struct rcu_head                 rcu;
+};
+
+struct br_cfm_peer_mep {
+       struct hlist_node               head;
+       struct br_cfm_mep               *mep;
+       struct delayed_work             ccm_rx_dwork;
+       u32                             mepid;
+       struct br_cfm_cc_peer_status    cc_status;
+       u32                             ccm_rx_count_miss;
+       struct rcu_head                 rcu;
+};
+
+#endif /* _BR_PRIVATE_CFM_H_ */
index af0e9ef..1883118 100644 (file)
@@ -8,7 +8,7 @@
 
 struct br_mrp {
        /* list of mrp instances */
-       struct list_head                list;
+       struct hlist_node               list;
 
        struct net_bridge_port __rcu    *p_port;
        struct net_bridge_port __rcu    *s_port;
index 5040fe4..e4d287a 100644 (file)
@@ -17,7 +17,7 @@ config NFT_BRIDGE_META
 
 config NFT_BRIDGE_REJECT
        tristate "Netfilter nf_tables bridge reject support"
-       depends on NFT_REJECT && NFT_REJECT_IPV4 && NFT_REJECT_IPV6
+       depends on NFT_REJECT
        help
          Add support to reject packets.
 
index deae2c9..eba0efe 100644 (file)
@@ -39,30 +39,6 @@ static void nft_reject_br_push_etherhdr(struct sk_buff *oldskb,
        }
 }
 
-static int nft_bridge_iphdr_validate(struct sk_buff *skb)
-{
-       struct iphdr *iph;
-       u32 len;
-
-       if (!pskb_may_pull(skb, sizeof(struct iphdr)))
-               return 0;
-
-       iph = ip_hdr(skb);
-       if (iph->ihl < 5 || iph->version != 4)
-               return 0;
-
-       len = ntohs(iph->tot_len);
-       if (skb->len < len)
-               return 0;
-       else if (len < (iph->ihl*4))
-               return 0;
-
-       if (!pskb_may_pull(skb, iph->ihl*4))
-               return 0;
-
-       return 1;
-}
-
 /* We cannot use oldskb->dev, it can be either bridge device (NF_BRIDGE INPUT)
  * or the bridge port (NF_BRIDGE PREROUTING).
  */
@@ -72,29 +48,11 @@ static void nft_reject_br_send_v4_tcp_reset(struct net *net,
                                            int hook)
 {
        struct sk_buff *nskb;
-       struct iphdr *niph;
-       const struct tcphdr *oth;
-       struct tcphdr _oth;
 
-       if (!nft_bridge_iphdr_validate(oldskb))
-               return;
-
-       oth = nf_reject_ip_tcphdr_get(oldskb, &_oth, hook);
-       if (!oth)
-               return;
-
-       nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct tcphdr) +
-                        LL_MAX_HEADER, GFP_ATOMIC);
+       nskb = nf_reject_skb_v4_tcp_reset(net, oldskb, dev, hook);
        if (!nskb)
                return;
 
-       skb_reserve(nskb, LL_MAX_HEADER);
-       niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_TCP,
-                                  net->ipv4.sysctl_ip_default_ttl);
-       nf_reject_ip_tcphdr_put(nskb, oldskb, oth);
-       niph->tot_len = htons(nskb->len);
-       ip_send_check(niph);
-
        nft_reject_br_push_etherhdr(oldskb, nskb);
 
        br_forward(br_port_get_rcu(dev), nskb, false, true);
@@ -106,139 +64,32 @@ static void nft_reject_br_send_v4_unreach(struct net *net,
                                          int hook, u8 code)
 {
        struct sk_buff *nskb;
-       struct iphdr *niph;
-       struct icmphdr *icmph;
-       unsigned int len;
-       __wsum csum;
-       u8 proto;
-
-       if (!nft_bridge_iphdr_validate(oldskb))
-               return;
-
-       /* IP header checks: fragment. */
-       if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET))
-               return;
-
-       /* RFC says return as much as we can without exceeding 576 bytes. */
-       len = min_t(unsigned int, 536, oldskb->len);
-
-       if (!pskb_may_pull(oldskb, len))
-               return;
-
-       if (pskb_trim_rcsum(oldskb, ntohs(ip_hdr(oldskb)->tot_len)))
-               return;
-
-       proto = ip_hdr(oldskb)->protocol;
-
-       if (!skb_csum_unnecessary(oldskb) &&
-           nf_reject_verify_csum(proto) &&
-           nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), proto))
-               return;
 
-       nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct icmphdr) +
-                        LL_MAX_HEADER + len, GFP_ATOMIC);
+       nskb = nf_reject_skb_v4_unreach(net, oldskb, dev, hook, code);
        if (!nskb)
                return;
 
-       skb_reserve(nskb, LL_MAX_HEADER);
-       niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_ICMP,
-                                  net->ipv4.sysctl_ip_default_ttl);
-
-       skb_reset_transport_header(nskb);
-       icmph = skb_put_zero(nskb, sizeof(struct icmphdr));
-       icmph->type     = ICMP_DEST_UNREACH;
-       icmph->code     = code;
-
-       skb_put_data(nskb, skb_network_header(oldskb), len);
-
-       csum = csum_partial((void *)icmph, len + sizeof(struct icmphdr), 0);
-       icmph->checksum = csum_fold(csum);
-
-       niph->tot_len   = htons(nskb->len);
-       ip_send_check(niph);
-
        nft_reject_br_push_etherhdr(oldskb, nskb);
 
        br_forward(br_port_get_rcu(dev), nskb, false, true);
 }
 
-static int nft_bridge_ip6hdr_validate(struct sk_buff *skb)
-{
-       struct ipv6hdr *hdr;
-       u32 pkt_len;
-
-       if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
-               return 0;
-
-       hdr = ipv6_hdr(skb);
-       if (hdr->version != 6)
-               return 0;
-
-       pkt_len = ntohs(hdr->payload_len);
-       if (pkt_len + sizeof(struct ipv6hdr) > skb->len)
-               return 0;
-
-       return 1;
-}
-
 static void nft_reject_br_send_v6_tcp_reset(struct net *net,
                                            struct sk_buff *oldskb,
                                            const struct net_device *dev,
                                            int hook)
 {
        struct sk_buff *nskb;
-       const struct tcphdr *oth;
-       struct tcphdr _oth;
-       unsigned int otcplen;
-       struct ipv6hdr *nip6h;
 
-       if (!nft_bridge_ip6hdr_validate(oldskb))
-               return;
-
-       oth = nf_reject_ip6_tcphdr_get(oldskb, &_oth, &otcplen, hook);
-       if (!oth)
-               return;
-
-       nskb = alloc_skb(sizeof(struct ipv6hdr) + sizeof(struct tcphdr) +
-                        LL_MAX_HEADER, GFP_ATOMIC);
+       nskb = nf_reject_skb_v6_tcp_reset(net, oldskb, dev, hook);
        if (!nskb)
                return;
 
-       skb_reserve(nskb, LL_MAX_HEADER);
-       nip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_TCP,
-                                    net->ipv6.devconf_all->hop_limit);
-       nf_reject_ip6_tcphdr_put(nskb, oldskb, oth, otcplen);
-       nip6h->payload_len = htons(nskb->len - sizeof(struct ipv6hdr));
-
        nft_reject_br_push_etherhdr(oldskb, nskb);
 
        br_forward(br_port_get_rcu(dev), nskb, false, true);
 }
 
-static bool reject6_br_csum_ok(struct sk_buff *skb, int hook)
-{
-       const struct ipv6hdr *ip6h = ipv6_hdr(skb);
-       int thoff;
-       __be16 fo;
-       u8 proto = ip6h->nexthdr;
-
-       if (skb_csum_unnecessary(skb))
-               return true;
-
-       if (ip6h->payload_len &&
-           pskb_trim_rcsum(skb, ntohs(ip6h->payload_len) + sizeof(*ip6h)))
-               return false;
-
-       ip6h = ipv6_hdr(skb);
-       thoff = ipv6_skip_exthdr(skb, ((u8*)(ip6h+1) - skb->data), &proto, &fo);
-       if (thoff < 0 || thoff >= skb->len || (fo & htons(~0x7)) != 0)
-               return false;
-
-       if (!nf_reject_verify_csum(proto))
-               return true;
-
-       return nf_ip6_checksum(skb, hook, thoff, proto) == 0;
-}
 
 static void nft_reject_br_send_v6_unreach(struct net *net,
                                          struct sk_buff *oldskb,
@@ -246,49 +97,11 @@ static void nft_reject_br_send_v6_unreach(struct net *net,
                                          int hook, u8 code)
 {
        struct sk_buff *nskb;
-       struct ipv6hdr *nip6h;
-       struct icmp6hdr *icmp6h;
-       unsigned int len;
-
-       if (!nft_bridge_ip6hdr_validate(oldskb))
-               return;
 
-       /* Include "As much of invoking packet as possible without the ICMPv6
-        * packet exceeding the minimum IPv6 MTU" in the ICMP payload.
-        */
-       len = min_t(unsigned int, 1220, oldskb->len);
-
-       if (!pskb_may_pull(oldskb, len))
-               return;
-
-       if (!reject6_br_csum_ok(oldskb, hook))
-               return;
-
-       nskb = alloc_skb(sizeof(struct ipv6hdr) + sizeof(struct icmp6hdr) +
-                        LL_MAX_HEADER + len, GFP_ATOMIC);
+       nskb = nf_reject_skb_v6_unreach(net, oldskb, dev, hook, code);
        if (!nskb)
                return;
 
-       skb_reserve(nskb, LL_MAX_HEADER);
-       nip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_ICMPV6,
-                                    net->ipv6.devconf_all->hop_limit);
-
-       skb_reset_transport_header(nskb);
-       icmp6h = skb_put_zero(nskb, sizeof(struct icmp6hdr));
-       icmp6h->icmp6_type = ICMPV6_DEST_UNREACH;
-       icmp6h->icmp6_code = code;
-
-       skb_put_data(nskb, skb_network_header(oldskb), len);
-       nip6h->payload_len = htons(nskb->len - sizeof(struct ipv6hdr));
-
-       icmp6h->icmp6_cksum =
-               csum_ipv6_magic(&nip6h->saddr, &nip6h->daddr,
-                               nskb->len - sizeof(struct ipv6hdr),
-                               IPPROTO_ICMPV6,
-                               csum_partial(icmp6h,
-                                            nskb->len - sizeof(struct ipv6hdr),
-                                            0));
-
        nft_reject_br_push_etherhdr(oldskb, nskb);
 
        br_forward(br_port_get_rcu(dev), nskb, false, true);
@@ -364,69 +177,13 @@ static int nft_reject_bridge_validate(const struct nft_ctx *ctx,
                                                    (1 << NF_BR_LOCAL_IN));
 }
 
-static int nft_reject_bridge_init(const struct nft_ctx *ctx,
-                                 const struct nft_expr *expr,
-                                 const struct nlattr * const tb[])
-{
-       struct nft_reject *priv = nft_expr_priv(expr);
-       int icmp_code;
-
-       if (tb[NFTA_REJECT_TYPE] == NULL)
-               return -EINVAL;
-
-       priv->type = ntohl(nla_get_be32(tb[NFTA_REJECT_TYPE]));
-       switch (priv->type) {
-       case NFT_REJECT_ICMP_UNREACH:
-       case NFT_REJECT_ICMPX_UNREACH:
-               if (tb[NFTA_REJECT_ICMP_CODE] == NULL)
-                       return -EINVAL;
-
-               icmp_code = nla_get_u8(tb[NFTA_REJECT_ICMP_CODE]);
-               if (priv->type == NFT_REJECT_ICMPX_UNREACH &&
-                   icmp_code > NFT_REJECT_ICMPX_MAX)
-                       return -EINVAL;
-
-               priv->icmp_code = icmp_code;
-               break;
-       case NFT_REJECT_TCP_RST:
-               break;
-       default:
-               return -EINVAL;
-       }
-       return 0;
-}
-
-static int nft_reject_bridge_dump(struct sk_buff *skb,
-                                 const struct nft_expr *expr)
-{
-       const struct nft_reject *priv = nft_expr_priv(expr);
-
-       if (nla_put_be32(skb, NFTA_REJECT_TYPE, htonl(priv->type)))
-               goto nla_put_failure;
-
-       switch (priv->type) {
-       case NFT_REJECT_ICMP_UNREACH:
-       case NFT_REJECT_ICMPX_UNREACH:
-               if (nla_put_u8(skb, NFTA_REJECT_ICMP_CODE, priv->icmp_code))
-                       goto nla_put_failure;
-               break;
-       default:
-               break;
-       }
-
-       return 0;
-
-nla_put_failure:
-       return -1;
-}
-
 static struct nft_expr_type nft_reject_bridge_type;
 static const struct nft_expr_ops nft_reject_bridge_ops = {
        .type           = &nft_reject_bridge_type,
        .size           = NFT_EXPR_SIZE(sizeof(struct nft_reject)),
        .eval           = nft_reject_bridge_eval,
-       .init           = nft_reject_bridge_init,
-       .dump           = nft_reject_bridge_dump,
+       .init           = nft_reject_init,
+       .dump           = nft_reject_dump,
        .validate       = nft_reject_bridge_validate,
 };
 
index 224e5e0..7c9958d 100644 (file)
@@ -62,8 +62,9 @@ config CAN_ISOTP
          communication between CAN nodes via two defined CAN Identifiers.
          As CAN frames can only transport a small amount of data bytes
          (max. 8 bytes for 'classic' CAN and max. 64 bytes for CAN FD) this
-         segmentation is needed to transport longer PDUs as needed e.g. for
-         vehicle diagnosis (UDS, ISO 14229) or IP-over-CAN traffic.
+         segmentation is needed to transport longer Protocol Data Units (PDU)
+         as needed e.g. for vehicle diagnosis (UDS, ISO 14229) or IP-over-CAN
+         traffic.
          This protocol driver implements data transfers according to
          ISO 15765-2:2016 for 'classic' CAN and CAN FD frame types.
          If you want to perform automotive vehicle diagnostic services (UDS),
index 4c20628..d78ab13 100644 (file)
@@ -252,14 +252,16 @@ static void isotp_rcv_skb(struct sk_buff *skb, struct sock *sk)
 
 static u8 padlen(u8 datalen)
 {
-       const u8 plen[] = {8, 8, 8, 8, 8, 8, 8, 8, 8,           /* 0 - 8 */
-                          12, 12, 12, 12,                      /* 9 - 12 */
-                          16, 16, 16, 16,                      /* 13 - 16 */
-                          20, 20, 20, 20,                      /* 17 - 20 */
-                          24, 24, 24, 24,                      /* 21 - 24 */
-                          32, 32, 32, 32, 32, 32, 32, 32,      /* 25 - 32 */
-                          48, 48, 48, 48, 48, 48, 48, 48,      /* 33 - 40 */
-                          48, 48, 48, 48, 48, 48, 48, 48};     /* 41 - 48 */
+       static const u8 plen[] = {
+               8, 8, 8, 8, 8, 8, 8, 8, 8,      /* 0 - 8 */
+               12, 12, 12, 12,                 /* 9 - 12 */
+               16, 16, 16, 16,                 /* 13 - 16 */
+               20, 20, 20, 20,                 /* 17 - 20 */
+               24, 24, 24, 24,                 /* 21 - 24 */
+               32, 32, 32, 32, 32, 32, 32, 32, /* 25 - 32 */
+               48, 48, 48, 48, 48, 48, 48, 48, /* 33 - 40 */
+               48, 48, 48, 48, 48, 48, 48, 48  /* 41 - 48 */
+       };
 
        if (datalen > 48)
                return 64;
@@ -569,10 +571,6 @@ static int isotp_rcv_cf(struct sock *sk, struct canfd_frame *cf, int ae,
                return 0;
        }
 
-       /* no creation of flow control frames */
-       if (so->opt.flags & CAN_ISOTP_LISTEN_MODE)
-               return 0;
-
        /* perform blocksize handling, if enabled */
        if (!so->rxfc.bs || ++so->rx.bs < so->rxfc.bs) {
                /* start rx timeout watchdog */
@@ -581,6 +579,10 @@ static int isotp_rcv_cf(struct sock *sk, struct canfd_frame *cf, int ae,
                return 0;
        }
 
+       /* no creation of flow control frames */
+       if (so->opt.flags & CAN_ISOTP_LISTEN_MODE)
+               return 0;
+
        /* we reached the specified blocksize so->rxfc.bs */
        isotp_send_fc(sk, ae, ISOTP_FC_CTS);
        return 0;
index 1be4c89..f239665 100644 (file)
@@ -475,6 +475,12 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len)
                        goto out_release_sock;
                }
 
+               if (!(ndev->flags & IFF_UP)) {
+                       dev_put(ndev);
+                       ret = -ENETDOWN;
+                       goto out_release_sock;
+               }
+
                priv = j1939_netdev_start(ndev);
                dev_put(ndev);
                if (IS_ERR(priv)) {
index 550928b..5ea8695 100644 (file)
@@ -462,6 +462,9 @@ void can_init_proc(struct net *net)
  */
 void can_remove_proc(struct net *net)
 {
+       if (!net->can.proc_dir)
+               return;
+
        if (net->can.pde_stats)
                remove_proc_entry(CAN_PROC_STATS, net->can.proc_dir);
 
@@ -486,6 +489,5 @@ void can_remove_proc(struct net *net)
        if (net->can.pde_rcvlist_sff)
                remove_proc_entry(CAN_PROC_RCVLIST_SFF, net->can.proc_dir);
 
-       if (net->can.proc_dir)
-               remove_proc_entry("can", net->proc_net);
+       remove_proc_entry("can", net->proc_net);
 }
index 9499a41..60d325b 100644 (file)
 #include <linux/indirect_call_wrapper.h>
 #include <net/devlink.h>
 #include <linux/pm_runtime.h>
+#include <linux/prandom.h>
 
 #include "net-sysfs.h"
 
@@ -3205,7 +3206,7 @@ int skb_checksum_help(struct sk_buff *skb)
        if (skb->ip_summed == CHECKSUM_COMPLETE)
                goto out_set_summed;
 
-       if (unlikely(skb_shinfo(skb)->gso_size)) {
+       if (unlikely(skb_is_gso(skb))) {
                skb_warn_bad_offload(skb);
                return -EINVAL;
        }
@@ -3558,6 +3559,7 @@ static int xmit_one(struct sk_buff *skb, struct net_device *dev,
                dev_queue_xmit_nit(skb, dev);
 
        len = skb->len;
+       PRANDOM_ADD_NOISE(skb, dev, txq, len + jiffies);
        trace_net_dev_start_xmit(skb, dev);
        rc = netdev_start_xmit(skb, dev, txq, more);
        trace_net_dev_xmit(skb, rc, dev, len);
@@ -4130,6 +4132,7 @@ static int __dev_queue_xmit(struct sk_buff *skb, struct net_device *sb_dev)
                        if (!skb)
                                goto out;
 
+                       PRANDOM_ADD_NOISE(skb, dev, txq, jiffies);
                        HARD_TX_LOCK(dev, txq, cpu);
 
                        if (!netif_xmit_stopped(txq)) {
@@ -4195,6 +4198,7 @@ int dev_direct_xmit(struct sk_buff *skb, u16 queue_id)
 
        skb_set_queue_mapping(skb, queue_id);
        txq = skb_get_tx_queue(dev, skb);
+       PRANDOM_ADD_NOISE(skb, dev, txq, jiffies);
 
        local_bh_disable();
 
@@ -8898,7 +8902,7 @@ static bpf_op_t dev_xdp_bpf_op(struct net_device *dev, enum bpf_xdp_mode mode)
                return dev->netdev_ops->ndo_bpf;
        default:
                return NULL;
-       };
+       }
 }
 
 static struct bpf_xdp_link *dev_xdp_link(struct net_device *dev,
@@ -10362,6 +10366,21 @@ void dev_fetch_sw_netstats(struct rtnl_link_stats64 *s,
 }
 EXPORT_SYMBOL_GPL(dev_fetch_sw_netstats);
 
+/**
+ *     dev_get_tstats64 - ndo_get_stats64 implementation
+ *     @dev: device to get statistics from
+ *     @s: place to store stats
+ *
+ *     Populate @s from dev->stats and dev->tstats. Can be used as
+ *     ndo_get_stats64() callback.
+ */
+void dev_get_tstats64(struct net_device *dev, struct rtnl_link_stats64 *s)
+{
+       netdev_stats_to_stats64(s, &dev->stats);
+       dev_fetch_sw_netstats(s, dev->tstats);
+}
+EXPORT_SYMBOL_GPL(dev_get_tstats64);
+
 struct netdev_queue *dev_ingress_queue_create(struct net_device *dev)
 {
        struct netdev_queue *queue = dev_ingress_queue(dev);
index 205e92e..db8a0ff 100644 (file)
@@ -230,7 +230,7 @@ static int dev_do_ioctl(struct net_device *dev,
                        struct ifreq *ifr, unsigned int cmd)
 {
        const struct net_device_ops *ops = dev->netdev_ops;
-       int err = -EOPNOTSUPP;
+       int err;
 
        err = dsa_ndo_do_ioctl(dev, ifr, cmd);
        if (err == 0 || err != -EOPNOTSUPP)
index a578634..ab4b136 100644 (file)
@@ -4213,10 +4213,12 @@ static int devlink_nl_region_fill(struct sk_buff *msg, struct devlink *devlink,
        if (err)
                goto nla_put_failure;
 
-       if (region->port)
-               if (nla_put_u32(msg, DEVLINK_ATTR_PORT_INDEX,
-                               region->port->index))
+       if (region->port) {
+               err = nla_put_u32(msg, DEVLINK_ATTR_PORT_INDEX,
+                                 region->port->index);
+               if (err)
                        goto nla_put_failure;
+       }
 
        err = nla_put_string(msg, DEVLINK_ATTR_REGION_NAME, region->ops->name);
        if (err)
@@ -4265,10 +4267,12 @@ devlink_nl_region_notify_build(struct devlink_region *region,
        if (err)
                goto out_cancel_msg;
 
-       if (region->port)
-               if (nla_put_u32(msg, DEVLINK_ATTR_PORT_INDEX,
-                               region->port->index))
+       if (region->port) {
+               err = nla_put_u32(msg, DEVLINK_ATTR_PORT_INDEX,
+                                 region->port->index);
+               if (err)
                        goto out_cancel_msg;
+       }
 
        err = nla_put_string(msg, DEVLINK_ATTR_REGION_NAME,
                             region->ops->name);
@@ -4915,8 +4919,10 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb,
                index = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_INDEX]);
 
                port = devlink_port_get_by_index(devlink, index);
-               if (!port)
-                       return -ENODEV;
+               if (!port) {
+                       err = -ENODEV;
+                       goto out_unlock;
+               }
        }
 
        region_name = nla_data(attrs[DEVLINK_ATTR_REGION_NAME]);
@@ -4962,10 +4968,12 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb,
        if (err)
                goto nla_put_failure;
 
-       if (region->port)
-               if (nla_put_u32(skb, DEVLINK_ATTR_PORT_INDEX,
-                               region->port->index))
+       if (region->port) {
+               err = nla_put_u32(skb, DEVLINK_ATTR_PORT_INDEX,
+                                 region->port->index);
+               if (err)
                        goto nla_put_failure;
+       }
 
        err = nla_put_string(skb, DEVLINK_ATTR_REGION_NAME, region_name);
        if (err)
@@ -8246,8 +8254,6 @@ static int __devlink_port_attrs_set(struct devlink_port *devlink_port,
 {
        struct devlink_port_attrs *attrs = &devlink_port->attrs;
 
-       if (WARN_ON(devlink_port->registered))
-               return -EEXIST;
        devlink_port->attrs_set = true;
        attrs->flavour = flavour;
        if (attrs->switch_id.id_len) {
@@ -8271,6 +8277,8 @@ void devlink_port_attrs_set(struct devlink_port *devlink_port,
 {
        int ret;
 
+       if (WARN_ON(devlink_port->registered))
+               return;
        devlink_port->attrs = *attrs;
        ret = __devlink_port_attrs_set(devlink_port, attrs->flavour);
        if (ret)
@@ -8293,6 +8301,8 @@ void devlink_port_attrs_pci_pf_set(struct devlink_port *devlink_port, u32 contro
        struct devlink_port_attrs *attrs = &devlink_port->attrs;
        int ret;
 
+       if (WARN_ON(devlink_port->registered))
+               return;
        ret = __devlink_port_attrs_set(devlink_port,
                                       DEVLINK_PORT_FLAVOUR_PCI_PF);
        if (ret)
@@ -8318,6 +8328,8 @@ void devlink_port_attrs_pci_vf_set(struct devlink_port *devlink_port, u32 contro
        struct devlink_port_attrs *attrs = &devlink_port->attrs;
        int ret;
 
+       if (WARN_ON(devlink_port->registered))
+               return;
        ret = __devlink_port_attrs_set(devlink_port,
                                       DEVLINK_PORT_FLAVOUR_PCI_VF);
        if (ret)
index e21950a..6f1adba 100644 (file)
@@ -48,7 +48,7 @@ void skb_flow_dissector_init(struct flow_dissector *flow_dissector,
        memset(flow_dissector, 0, sizeof(*flow_dissector));
 
        for (i = 0; i < key_count; i++, key++) {
-               /* User should make sure that every key target offset is withing
+               /* User should make sure that every key target offset is within
                 * boundaries of unsigned short.
                 */
                BUG_ON(key->offset > USHRT_MAX);
index 1ba8f01..c9a5a3c 100644 (file)
@@ -249,6 +249,9 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
 
                fclones->skb2.fclone = SKB_FCLONE_CLONE;
        }
+
+       skb_set_kcov_handle(skb, kcov_common_handle());
+
 out:
        return skb;
 nodata:
@@ -282,6 +285,8 @@ static struct sk_buff *__build_skb_around(struct sk_buff *skb,
        memset(shinfo, 0, offsetof(struct skb_shared_info, dataref));
        atomic_set(&shinfo->dataref, 1);
 
+       skb_set_kcov_handle(skb, kcov_common_handle());
+
        return skb;
 }
 
@@ -4203,6 +4208,9 @@ static const u8 skb_ext_type_len[] = {
 #if IS_ENABLED(CONFIG_MPTCP)
        [SKB_EXT_MPTCP] = SKB_EXT_CHUNKSIZEOF(struct mptcp_ext),
 #endif
+#if IS_ENABLED(CONFIG_KCOV)
+       [SKB_EXT_KCOV_HANDLE] = SKB_EXT_CHUNKSIZEOF(u64),
+#endif
 };
 
 static __always_inline unsigned int skb_ext_total_length(void)
@@ -4220,6 +4228,9 @@ static __always_inline unsigned int skb_ext_total_length(void)
 #if IS_ENABLED(CONFIG_MPTCP)
                skb_ext_type_len[SKB_EXT_MPTCP] +
 #endif
+#if IS_ENABLED(CONFIG_KCOV)
+               skb_ext_type_len[SKB_EXT_KCOV_HANDLE] +
+#endif
                0;
 }
 
@@ -5430,7 +5441,8 @@ struct sk_buff *skb_vlan_untag(struct sk_buff *skb)
                goto err_free;
 
        skb_reset_network_header(skb);
-       skb_reset_transport_header(skb);
+       if (!skb_transport_header_was_set(skb))
+               skb_reset_transport_header(skb);
        skb_reset_mac_len(skb);
 
        return skb;
index 16014ad..084e159 100644 (file)
@@ -1827,6 +1827,8 @@ static int dcb_app_add(const struct dcb_app *app, int ifindex)
 
 /**
  * dcb_getapp - retrieve the DCBX application user priority
+ * @dev: network interface
+ * @app: application to get user priority of
  *
  * On success returns a non-zero 802.1p user priority bitmap
  * otherwise returns 0 as the invalid user priority bitmap to
@@ -1849,6 +1851,8 @@ EXPORT_SYMBOL(dcb_getapp);
 
 /**
  * dcb_setapp - add CEE dcb application data to app list
+ * @dev: network interface
+ * @new: application data to add
  *
  * Priority 0 is an invalid priority in CEE spec. This routine
  * removes applications from the app list if the priority is
@@ -1890,6 +1894,8 @@ EXPORT_SYMBOL(dcb_setapp);
 
 /**
  * dcb_ieee_getapp_mask - retrieve the IEEE DCB application priority
+ * @dev: network interface
+ * @app: where to store the retrieve application data
  *
  * Helper routine which on success returns a non-zero 802.1Qaz user
  * priority bitmap otherwise returns 0 to indicate the dcb_app was
@@ -1912,6 +1918,8 @@ EXPORT_SYMBOL(dcb_ieee_getapp_mask);
 
 /**
  * dcb_ieee_setapp - add IEEE dcb application data to app list
+ * @dev: network interface
+ * @new: application data to add
  *
  * This adds Application data to the list. Multiple application
  * entries may exists for the same selector and protocol as long
@@ -1946,6 +1954,8 @@ EXPORT_SYMBOL(dcb_ieee_setapp);
 
 /**
  * dcb_ieee_delapp - delete IEEE dcb application data from list
+ * @dev: network interface
+ * @del: application data to delete
  *
  * This removes a matching APP data from the APP list
  */
@@ -1975,7 +1985,7 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del)
 }
 EXPORT_SYMBOL(dcb_ieee_delapp);
 
-/**
+/*
  * dcb_ieee_getapp_prio_dscp_mask_map - For a given device, find mapping from
  * priorities to the DSCP values assigned to that priority. Initialize p_map
  * such that each map element holds a bit mask of DSCP values configured for
@@ -2004,7 +2014,7 @@ void dcb_ieee_getapp_prio_dscp_mask_map(const struct net_device *dev,
 }
 EXPORT_SYMBOL(dcb_ieee_getapp_prio_dscp_mask_map);
 
-/**
+/*
  * dcb_ieee_getapp_dscp_prio_mask_map - For a given device, find mapping from
  * DSCP values to the priorities assigned to that DSCP value. Initialize p_map
  * such that each map element holds a bit mask of priorities configured for a
@@ -2031,7 +2041,7 @@ dcb_ieee_getapp_dscp_prio_mask_map(const struct net_device *dev,
 }
 EXPORT_SYMBOL(dcb_ieee_getapp_dscp_prio_mask_map);
 
-/**
+/*
  * Per 802.1Q-2014, the selector value of 1 is used for matching on Ethernet
  * type, with valid PID values >= 1536. A special meaning is then assigned to
  * protocol value of 0: "default priority. For use when priority is not
index 8f3dd3b..c4bbac9 100644 (file)
@@ -242,6 +242,8 @@ static void dccp_ackvec_add_new(struct dccp_ackvec *av, u32 num_packets,
 
 /**
  * dccp_ackvec_input  -  Register incoming packet in the buffer
+ * @av: Ack Vector to register packet to
+ * @skb: Packet to register
  */
 void dccp_ackvec_input(struct dccp_ackvec *av, struct sk_buff *skb)
 {
@@ -273,6 +275,9 @@ void dccp_ackvec_input(struct dccp_ackvec *av, struct sk_buff *skb)
 
 /**
  * dccp_ackvec_clear_state  -  Perform house-keeping / garbage-collection
+ * @av: Ack Vector record to clean
+ * @ackno: last Ack Vector which has been acknowledged
+ *
  * This routine is called when the peer acknowledges the receipt of Ack Vectors
  * up to and including @ackno. While based on section A.3 of RFC 4340, here
  * are additional precautions to prevent corrupted buffer state. In particular,
index 1e9bb12..6beac5d 100644 (file)
@@ -76,7 +76,7 @@ int ccid_getsockopt_builtin_ccids(struct sock *sk, int len,
        return err;
 }
 
-static struct kmem_cache *ccid_kmem_cache_create(int obj_size, char *slab_name_fmt, const char *fmt,...)
+static __printf(3, 4) struct kmem_cache *ccid_kmem_cache_create(int obj_size, char *slab_name_fmt, const char *fmt,...)
 {
        struct kmem_cache *slab;
        va_list args;
index 3da1f77..4d9823d 100644 (file)
@@ -181,6 +181,9 @@ MODULE_PARM_DESC(ccid2_do_cwv, "Perform RFC2861 Congestion Window Validation");
 
 /**
  * ccid2_update_used_window  -  Track how much of cwnd is actually used
+ * @hc: socket to update window
+ * @new_wnd: new window values to add into the filter
+ *
  * This is done in addition to CWV. The sender needs to have an idea of how many
  * packets may be in flight, to set the local Sequence Window value accordingly
  * (RFC 4340, 7.5.2). The CWV mechanism is exploited to keep track of the
@@ -349,6 +352,8 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, unsigned int len)
 
 /**
  * ccid2_rtt_estimator - Sample RTT and compute RTO using RFC2988 algorithm
+ * @sk: socket to perform estimator on
+ *
  * This code is almost identical with TCP's tcp_rtt_estimator(), since
  * - it has a higher sampling frequency (recommended by RFC 1323),
  * - the RTO does not collapse into RTT due to RTTVAR going towards zero,
index b9ee1a4..ca8670f 100644 (file)
@@ -79,6 +79,8 @@ static inline u64 rfc3390_initial_rate(struct sock *sk)
 
 /**
  * ccid3_update_send_interval  -  Calculate new t_ipi = s / X_inst
+ * @hc: socket to have the send interval updated
+ *
  * This respects the granularity of X_inst (64 * bytes/second).
  */
 static void ccid3_update_send_interval(struct ccid3_hc_tx_sock *hc)
@@ -99,6 +101,7 @@ static u32 ccid3_hc_tx_idle_rtt(struct ccid3_hc_tx_sock *hc, ktime_t now)
 
 /**
  * ccid3_hc_tx_update_x  -  Update allowed sending rate X
+ * @sk: socket to be updated
  * @stamp: most recent time if available - can be left NULL.
  *
  * This function tracks draft rfc3448bis, check there for latest details.
@@ -151,6 +154,7 @@ static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp)
 
 /**
  *     ccid3_hc_tx_update_s - Track the mean packet size `s'
+ *     @hc: socket to be updated
  *     @len: DCCP packet payload size in bytes
  *
  *     cf. RFC 4342, 5.3 and  RFC 3448, 4.1
@@ -259,6 +263,7 @@ out:
 
 /**
  * ccid3_hc_tx_send_packet  -  Delay-based dequeueing of TX packets
+ * @sk: socket to send packet from
  * @skb: next packet candidate to send on @sk
  *
  * This function uses the convention of ccid_packet_dequeue_eval() and
@@ -655,6 +660,7 @@ static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb)
 
 /**
  * ccid3_first_li  -  Implements [RFC 5348, 6.3.1]
+ * @sk: socket to calculate loss interval for
  *
  * Determine the length of the first loss interval via inverse lookup.
  * Assume that X_recv can be computed by the throughput equation
index 67abad6..da95319 100644 (file)
@@ -79,6 +79,9 @@ static void tfrc_lh_calc_i_mean(struct tfrc_loss_hist *lh)
 
 /**
  * tfrc_lh_update_i_mean  -  Update the `open' loss interval I_0
+ * @lh: histogram to update
+ * @skb: received socket triggering loss interval update
+ *
  * For recomputing p: returns `true' if p > p_prev  <=>  1/p < 1/p_prev
  */
 u8 tfrc_lh_update_i_mean(struct tfrc_loss_hist *lh, struct sk_buff *skb)
index af08e2d..0cdda3c 100644 (file)
@@ -385,6 +385,9 @@ static inline struct tfrc_rx_hist_entry *
 
 /**
  * tfrc_rx_hist_sample_rtt  -  Sample RTT from timestamp / CCVal
+ * @h: receive histogram
+ * @skb: packet containing timestamp.
+ *
  * Based on ideas presented in RFC 4342, 8.1. Returns 0 if it was not able
  * to compute a sample with given data - calling function should check this.
  */
index 788dd62..305f568 100644 (file)
@@ -996,6 +996,8 @@ int dccp_feat_finalise_settings(struct dccp_sock *dp)
 
 /**
  * dccp_feat_server_ccid_dependencies  -  Resolve CCID-dependent features
+ * @dreq: server socket to resolve
+ *
  * It is the server which resolves the dependencies once the CCID has been
  * fully negotiated. If no CCID has been negotiated, it uses the default CCID.
  */
@@ -1033,6 +1035,10 @@ static int dccp_feat_preflist_match(u8 *servlist, u8 slen, u8 *clilist, u8 clen)
 
 /**
  * dccp_feat_prefer  -  Move preferred entry to the start of array
+ * @preferred_value: entry to move to start of array
+ * @array: array of preferred entries
+ * @array_len: size of the array
+ *
  * Reorder the @array_len elements in @array so that @preferred_value comes
  * first. Returns >0 to indicate that @preferred_value does occur in @array.
  */
index 50e6d56..b8a2473 100644 (file)
@@ -143,6 +143,8 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
 
 /**
  * dccp_determine_ccmps  -  Find out about CCID-specific packet-size limits
+ * @dp: socket to find packet size limits of
+ *
  * We only consider the HC-sender CCID for setting the CCMPS (RFC 4340, 14.),
  * since the RX CCID is restricted to feedback packets (Acks), which are small
  * in comparison with the data traffic. A value of 0 means "no current CCMPS".
@@ -236,6 +238,8 @@ static int dccp_wait_for_ccid(struct sock *sk, unsigned long delay)
 
 /**
  * dccp_xmit_packet  -  Send data packet under control of CCID
+ * @sk: socket to send data packet on
+ *
  * Transmits next-queued payload and informs CCID to account for the packet.
  */
 static void dccp_xmit_packet(struct sock *sk)
@@ -296,6 +300,9 @@ static void dccp_xmit_packet(struct sock *sk)
 
 /**
  * dccp_flush_write_queue  -  Drain queue at end of connection
+ * @sk: socket to be drained
+ * @time_budget: time allowed to drain the queue
+ *
  * Since dccp_sendmsg queues packets without waiting for them to be sent, it may
  * happen that the TX queue is not empty at the end of a connection. We give the
  * HC-sender CCID a grace period of up to @time_budget jiffies. If this function
@@ -367,6 +374,8 @@ void dccp_write_xmit(struct sock *sk)
 
 /**
  * dccp_retransmit_skb  -  Retransmit Request, Close, or CloseReq packets
+ * @sk: socket to perform retransmit on
+ *
  * There are only four retransmittable packet types in DCCP:
  * - Request  in client-REQUEST  state (sec. 8.1.1),
  * - CloseReq in server-CLOSEREQ state (sec. 8.3),
index db2448c..5ba204e 100644 (file)
@@ -65,14 +65,16 @@ static bool qpolicy_prio_full(struct sock *sk)
  * @push: add a new @skb to the write queue
  * @full: indicates that no more packets will be admitted
  * @top:  peeks at whatever the queueing policy defines as its `top'
+ * @params: parameter passed to policy operation
  */
-static struct dccp_qpolicy_operations {
+struct dccp_qpolicy_operations {
        void            (*push) (struct sock *sk, struct sk_buff *skb);
        bool            (*full) (struct sock *sk);
        struct sk_buff* (*top)  (struct sock *sk);
        __be32          params;
+};
 
-} qpol_table[DCCPQ_POLICY_MAX] = {
+static struct dccp_qpolicy_operations qpol_table[DCCPQ_POLICY_MAX] = {
        [DCCPQ_POLICY_SIMPLE] = {
                .push   = qpolicy_simple_push,
                .full   = qpolicy_simple_full,
index a934d29..db768f2 100644 (file)
@@ -215,13 +215,14 @@ out:
 
 /**
  * dccp_write_xmitlet  -  Workhorse for CCID packet dequeueing interface
- * @data: Socket to act on
+ * @t: pointer to the tasklet associated with this handler
  *
  * See the comments above %ccid_dequeueing_decision for supported modes.
  */
-static void dccp_write_xmitlet(unsigned long data)
+static void dccp_write_xmitlet(struct tasklet_struct *t)
 {
-       struct sock *sk = (struct sock *)data;
+       struct dccp_sock *dp = from_tasklet(dp, t, dccps_xmitlet);
+       struct sock *sk = &dp->dccps_inet_connection.icsk_inet.sk;
 
        bh_lock_sock(sk);
        if (sock_owned_by_user(sk))
@@ -235,16 +236,15 @@ static void dccp_write_xmitlet(unsigned long data)
 static void dccp_write_xmit_timer(struct timer_list *t)
 {
        struct dccp_sock *dp = from_timer(dp, t, dccps_xmit_timer);
-       struct sock *sk = &dp->dccps_inet_connection.icsk_inet.sk;
 
-       dccp_write_xmitlet((unsigned long)sk);
+       dccp_write_xmitlet(&dp->dccps_xmitlet);
 }
 
 void dccp_init_xmit_timers(struct sock *sk)
 {
        struct dccp_sock *dp = dccp_sk(sk);
 
-       tasklet_init(&dp->dccps_xmitlet, dccp_write_xmitlet, (unsigned long)sk);
+       tasklet_setup(&dp->dccps_xmitlet, dccp_write_xmitlet);
        timer_setup(&dp->dccps_xmit_timer, dccp_write_xmit_timer, 0);
        inet_csk_init_xmit_timers(sk, &dccp_write_timer, &dccp_delack_timer,
                                  &dccp_keepalive_timer);
index 1f9b9b1..d975614 100644 (file)
@@ -56,6 +56,12 @@ config NET_DSA_TAG_BRCM_PREPEND
          Broadcom switches which places the tag before the Ethernet header
          (prepended).
 
+config NET_DSA_TAG_HELLCREEK
+       tristate "Tag driver for Hirschmann Hellcreek TSN switches"
+       help
+         Say Y or M if you want to enable support for tagging frames
+         for the Hirschmann Hellcreek TSN switches.
+
 config NET_DSA_TAG_GSWIP
        tristate "Tag driver for Lantiq / Intel GSWIP switches"
        help
index 4f47b20..e25d545 100644 (file)
@@ -10,6 +10,7 @@ obj-$(CONFIG_NET_DSA_TAG_BRCM_COMMON) += tag_brcm.o
 obj-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
 obj-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
 obj-$(CONFIG_NET_DSA_TAG_GSWIP) += tag_gswip.o
+obj-$(CONFIG_NET_DSA_TAG_HELLCREEK) += tag_hellcreek.o
 obj-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o
 obj-$(CONFIG_NET_DSA_TAG_RTL4_A) += tag_rtl4_a.o
 obj-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o
index 2131bf2..a1b1dc8 100644 (file)
@@ -201,7 +201,6 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
 {
        struct dsa_port *cpu_dp = dev->dsa_ptr;
        struct sk_buff *nskb = NULL;
-       struct pcpu_sw_netstats *s;
        struct dsa_slave_priv *p;
 
        if (unlikely(!cpu_dp)) {
@@ -234,11 +233,7 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
                skb = nskb;
        }
 
-       s = this_cpu_ptr(p->stats64);
-       u64_stats_update_begin(&s->syncp);
-       s->rx_packets++;
-       s->rx_bytes += skb->len;
-       u64_stats_update_end(&s->syncp);
+       dev_sw_netstats_rx_add(skb->dev, skb->len);
 
        if (dsa_skb_defer_rx_timestamp(p, skb))
                return 0;
index 12998bf..7c96aae 100644 (file)
@@ -78,8 +78,6 @@ struct dsa_slave_priv {
        struct sk_buff *        (*xmit)(struct sk_buff *skb,
                                        struct net_device *dev);
 
-       struct pcpu_sw_netstats __percpu *stats64;
-
        struct gro_cells        gcells;
 
        /* DSA port data, such as switch, port index, etc. */
index 3bc5ca4..ff2266d 100644 (file)
@@ -548,17 +548,36 @@ netdev_tx_t dsa_enqueue_skb(struct sk_buff *skb, struct net_device *dev)
 }
 EXPORT_SYMBOL_GPL(dsa_enqueue_skb);
 
+static int dsa_realloc_skb(struct sk_buff *skb, struct net_device *dev)
+{
+       int needed_headroom = dev->needed_headroom;
+       int needed_tailroom = dev->needed_tailroom;
+
+       /* For tail taggers, we need to pad short frames ourselves, to ensure
+        * that the tail tag does not fail at its role of being at the end of
+        * the packet, once the master interface pads the frame. Account for
+        * that pad length here, and pad later.
+        */
+       if (unlikely(needed_tailroom && skb->len < ETH_ZLEN))
+               needed_tailroom += ETH_ZLEN - skb->len;
+       /* skb_headroom() returns unsigned int... */
+       needed_headroom = max_t(int, needed_headroom - skb_headroom(skb), 0);
+       needed_tailroom = max_t(int, needed_tailroom - skb_tailroom(skb), 0);
+
+       if (likely(!needed_headroom && !needed_tailroom && !skb_cloned(skb)))
+               /* No reallocation needed, yay! */
+               return 0;
+
+       return pskb_expand_head(skb, needed_headroom, needed_tailroom,
+                               GFP_ATOMIC);
+}
+
 static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct dsa_slave_priv *p = netdev_priv(dev);
-       struct pcpu_sw_netstats *s;
        struct sk_buff *nskb;
 
-       s = this_cpu_ptr(p->stats64);
-       u64_stats_update_begin(&s->syncp);
-       s->tx_packets++;
-       s->tx_bytes += skb->len;
-       u64_stats_update_end(&s->syncp);
+       dev_sw_netstats_tx_add(dev, 1, skb->len);
 
        DSA_SKB_CB(skb)->clone = NULL;
 
@@ -567,6 +586,17 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
         */
        dsa_skb_tx_timestamp(p, skb);
 
+       if (dsa_realloc_skb(skb, dev)) {
+               dev_kfree_skb_any(skb);
+               return NETDEV_TX_OK;
+       }
+
+       /* needed_tailroom should still be 'warm' in the cache line from
+        * dsa_realloc_skb(), which has also ensured that padding is safe.
+        */
+       if (dev->needed_tailroom)
+               eth_skb_pad(skb);
+
        /* Transmit function may have to reallocate the original SKB,
         * in which case it must have freed it. Only free it here on error.
         */
@@ -679,7 +709,6 @@ static void dsa_slave_get_ethtool_stats(struct net_device *dev,
                                        uint64_t *data)
 {
        struct dsa_port *dp = dsa_slave_to_port(dev);
-       struct dsa_slave_priv *p = netdev_priv(dev);
        struct dsa_switch *ds = dp->ds;
        struct pcpu_sw_netstats *s;
        unsigned int start;
@@ -688,7 +717,7 @@ static void dsa_slave_get_ethtool_stats(struct net_device *dev,
        for_each_possible_cpu(i) {
                u64 tx_packets, tx_bytes, rx_packets, rx_bytes;
 
-               s = per_cpu_ptr(p->stats64, i);
+               s = per_cpu_ptr(dev->tstats, i);
                do {
                        start = u64_stats_fetch_begin_irq(&s->syncp);
                        tx_packets = s->tx_packets;
@@ -1217,15 +1246,6 @@ static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
        return ds->ops->port_setup_tc(ds, dp->index, type, type_data);
 }
 
-static void dsa_slave_get_stats64(struct net_device *dev,
-                                 struct rtnl_link_stats64 *stats)
-{
-       struct dsa_slave_priv *p = netdev_priv(dev);
-
-       netdev_stats_to_stats64(stats, &dev->stats);
-       dev_fetch_sw_netstats(stats, p->stats64);
-}
-
 static int dsa_slave_get_rxnfc(struct net_device *dev,
                               struct ethtool_rxnfc *nfc, u32 *rule_locs)
 {
@@ -1601,7 +1621,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
 #endif
        .ndo_get_phys_port_name = dsa_slave_get_phys_port_name,
        .ndo_setup_tc           = dsa_slave_setup_tc,
-       .ndo_get_stats64        = dsa_slave_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_get_port_parent_id = dsa_slave_get_port_parent_id,
        .ndo_vlan_rx_add_vid    = dsa_slave_vlan_rx_add_vid,
        .ndo_vlan_rx_kill_vid   = dsa_slave_vlan_rx_kill_vid,
@@ -1791,6 +1811,16 @@ int dsa_slave_create(struct dsa_port *port)
        slave_dev->netdev_ops = &dsa_slave_netdev_ops;
        if (ds->ops->port_max_mtu)
                slave_dev->max_mtu = ds->ops->port_max_mtu(ds, port->index);
+       if (cpu_dp->tag_ops->tail_tag)
+               slave_dev->needed_tailroom = cpu_dp->tag_ops->overhead;
+       else
+               slave_dev->needed_headroom = cpu_dp->tag_ops->overhead;
+       /* Try to save one extra realloc later in the TX path (in the master)
+        * by also inheriting the master's needed headroom and tailroom.
+        * The 8021q driver also does this.
+        */
+       slave_dev->needed_headroom += master->needed_headroom;
+       slave_dev->needed_tailroom += master->needed_tailroom;
        SET_NETDEV_DEVTYPE(slave_dev, &dsa_type);
 
        netdev_for_each_tx_queue(slave_dev, dsa_slave_set_lockdep_class_one,
@@ -1801,8 +1831,8 @@ int dsa_slave_create(struct dsa_port *port)
        slave_dev->vlan_features = master->vlan_features;
 
        p = netdev_priv(slave_dev);
-       p->stats64 = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
-       if (!p->stats64) {
+       slave_dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
+       if (!slave_dev->tstats) {
                free_netdev(slave_dev);
                return -ENOMEM;
        }
@@ -1864,7 +1894,7 @@ out_phy:
 out_gcells:
        gro_cells_destroy(&p->gcells);
 out_free:
-       free_percpu(p->stats64);
+       free_percpu(slave_dev->tstats);
        free_netdev(slave_dev);
        port->slave = NULL;
        return ret;
@@ -1886,7 +1916,7 @@ void dsa_slave_destroy(struct net_device *slave_dev)
        dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER);
        phylink_destroy(dp->pl);
        gro_cells_destroy(&p->gcells);
-       free_percpu(p->stats64);
+       free_percpu(slave_dev->tstats);
        free_netdev(slave_dev);
 }
 
@@ -1987,10 +2017,22 @@ static int dsa_slave_netdevice_event(struct notifier_block *nb,
        switch (event) {
        case NETDEV_PRECHANGEUPPER: {
                struct netdev_notifier_changeupper_info *info = ptr;
+               struct dsa_switch *ds;
+               struct dsa_port *dp;
+               int err;
 
                if (!dsa_slave_dev_check(dev))
                        return dsa_prevent_bridging_8021q_upper(dev, ptr);
 
+               dp = dsa_slave_to_port(dev);
+               ds = dp->ds;
+
+               if (ds->ops->port_prechangeupper) {
+                       err = ds->ops->port_prechangeupper(ds, dp->index, info);
+                       if (err)
+                               return notifier_from_errno(err);
+               }
+
                if (is_vlan_dev(info->upper_dev))
                        return dsa_slave_check_8021q_upper(dev, ptr);
                break;
index 55b0069..002cf7f 100644 (file)
@@ -31,9 +31,6 @@ static struct sk_buff *ar9331_tag_xmit(struct sk_buff *skb,
        __le16 *phdr;
        u16 hdr;
 
-       if (skb_cow_head(skb, AR9331_HDR_LEN) < 0)
-               return NULL;
-
        phdr = skb_push(skb, AR9331_HDR_LEN);
 
        hdr = FIELD_PREP(AR9331_HDR_VERSION_MASK, AR9331_HDR_VERSION);
index ad72dff..e934dac 100644 (file)
@@ -66,9 +66,6 @@ static struct sk_buff *brcm_tag_xmit_ll(struct sk_buff *skb,
        u16 queue = skb_get_queue_mapping(skb);
        u8 *brcm_tag;
 
-       if (skb_cow_head(skb, BRCM_TAG_LEN) < 0)
-               return NULL;
-
        /* The Ethernet switch we are interfaced with needs packets to be at
         * least 64 bytes (including FCS) otherwise they will be discarded when
         * they enter the switch port logic. When Broadcom tags are enabled, we
index 0b756fa..63d690a 100644 (file)
@@ -23,9 +23,6 @@ static struct sk_buff *dsa_xmit(struct sk_buff *skb, struct net_device *dev)
         * the ethertype field for untagged packets.
         */
        if (skb->protocol == htons(ETH_P_8021Q)) {
-               if (skb_cow_head(skb, 0) < 0)
-                       return NULL;
-
                /*
                 * Construct tagged FROM_CPU DSA tag from 802.1q tag.
                 */
@@ -41,8 +38,6 @@ static struct sk_buff *dsa_xmit(struct sk_buff *skb, struct net_device *dev)
                        dsa_header[2] &= ~0x10;
                }
        } else {
-               if (skb_cow_head(skb, DSA_HLEN) < 0)
-                       return NULL;
                skb_push(skb, DSA_HLEN);
 
                memmove(skb->data, skb->data + DSA_HLEN, 2 * ETH_ALEN);
index 1206142..abf70a2 100644 (file)
@@ -35,8 +35,6 @@ static struct sk_buff *edsa_xmit(struct sk_buff *skb, struct net_device *dev)
         * current ethertype field if the packet is untagged.
         */
        if (skb->protocol == htons(ETH_P_8021Q)) {
-               if (skb_cow_head(skb, DSA_HLEN) < 0)
-                       return NULL;
                skb_push(skb, DSA_HLEN);
 
                memmove(skb->data, skb->data + DSA_HLEN, 2 * ETH_ALEN);
@@ -60,8 +58,6 @@ static struct sk_buff *edsa_xmit(struct sk_buff *skb, struct net_device *dev)
                        edsa_header[6] &= ~0x10;
                }
        } else {
-               if (skb_cow_head(skb, EDSA_HLEN) < 0)
-                       return NULL;
                skb_push(skb, EDSA_HLEN);
 
                memmove(skb->data, skb->data + EDSA_HLEN, 2 * ETH_ALEN);
index 408d4af..2f5bd5e 100644 (file)
@@ -60,13 +60,8 @@ static struct sk_buff *gswip_tag_xmit(struct sk_buff *skb,
                                      struct net_device *dev)
 {
        struct dsa_port *dp = dsa_slave_to_port(dev);
-       int err;
        u8 *gswip_tag;
 
-       err = skb_cow_head(skb, GSWIP_TX_HEADER_LEN);
-       if (err)
-               return NULL;
-
        skb_push(skb, GSWIP_TX_HEADER_LEN);
 
        gswip_tag = skb->data;
diff --git a/net/dsa/tag_hellcreek.c b/net/dsa/tag_hellcreek.c
new file mode 100644 (file)
index 0000000..2061de0
--- /dev/null
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * net/dsa/tag_hellcreek.c - Hirschmann Hellcreek switch tag format handling
+ *
+ * Copyright (C) 2019,2020 Linutronix GmbH
+ * Author Kurt Kanzenbach <kurt@linutronix.de>
+ *
+ * Based on tag_ksz.c.
+ */
+
+#include <linux/etherdevice.h>
+#include <linux/list.h>
+#include <linux/slab.h>
+#include <net/dsa.h>
+
+#include "dsa_priv.h"
+
+#define HELLCREEK_TAG_LEN      1
+
+static struct sk_buff *hellcreek_xmit(struct sk_buff *skb,
+                                     struct net_device *dev)
+{
+       struct dsa_port *dp = dsa_slave_to_port(dev);
+       u8 *tag;
+
+       /* Tag encoding */
+       tag  = skb_put(skb, HELLCREEK_TAG_LEN);
+       *tag = BIT(dp->index);
+
+       return skb;
+}
+
+static struct sk_buff *hellcreek_rcv(struct sk_buff *skb,
+                                    struct net_device *dev,
+                                    struct packet_type *pt)
+{
+       /* Tag decoding */
+       u8 *tag = skb_tail_pointer(skb) - HELLCREEK_TAG_LEN;
+       unsigned int port = tag[0] & 0x03;
+
+       skb->dev = dsa_master_find_slave(dev, 0, port);
+       if (!skb->dev) {
+               netdev_warn(dev, "Failed to get source port: %d\n", port);
+               return NULL;
+       }
+
+       pskb_trim_rcsum(skb, skb->len - HELLCREEK_TAG_LEN);
+
+       skb->offload_fwd_mark = true;
+
+       return skb;
+}
+
+static const struct dsa_device_ops hellcreek_netdev_ops = {
+       .name     = "hellcreek",
+       .proto    = DSA_TAG_PROTO_HELLCREEK,
+       .xmit     = hellcreek_xmit,
+       .rcv      = hellcreek_rcv,
+       .overhead = HELLCREEK_TAG_LEN,
+       .tail_tag = true,
+};
+
+MODULE_LICENSE("Dual MIT/GPL");
+MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_HELLCREEK);
+
+module_dsa_tag_driver(hellcreek_netdev_ops);
index 0a5aa98..4820dbc 100644 (file)
 #define KSZ_EGRESS_TAG_LEN             1
 #define KSZ_INGRESS_TAG_LEN            1
 
-static struct sk_buff *ksz_common_xmit(struct sk_buff *skb,
-                                      struct net_device *dev, int len)
-{
-       struct sk_buff *nskb;
-       int padlen;
-
-       padlen = (skb->len >= ETH_ZLEN) ? 0 : ETH_ZLEN - skb->len;
-
-       if (skb_tailroom(skb) >= padlen + len) {
-               /* Let dsa_slave_xmit() free skb */
-               if (__skb_put_padto(skb, skb->len + padlen, false))
-                       return NULL;
-
-               nskb = skb;
-       } else {
-               nskb = alloc_skb(NET_IP_ALIGN + skb->len +
-                                padlen + len, GFP_ATOMIC);
-               if (!nskb)
-                       return NULL;
-               skb_reserve(nskb, NET_IP_ALIGN);
-
-               skb_reset_mac_header(nskb);
-               skb_set_network_header(nskb,
-                                      skb_network_header(skb) - skb->head);
-               skb_set_transport_header(nskb,
-                                        skb_transport_header(skb) - skb->head);
-               skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len));
-
-               /* Let skb_put_padto() free nskb, and let dsa_slave_xmit() free
-                * skb
-                */
-               if (skb_put_padto(nskb, nskb->len + padlen))
-                       return NULL;
-
-               consume_skb(skb);
-       }
-
-       return nskb;
-}
-
 static struct sk_buff *ksz_common_rcv(struct sk_buff *skb,
                                      struct net_device *dev,
                                      unsigned int port, unsigned int len)
@@ -90,23 +50,18 @@ static struct sk_buff *ksz_common_rcv(struct sk_buff *skb,
 static struct sk_buff *ksz8795_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct dsa_port *dp = dsa_slave_to_port(dev);
-       struct sk_buff *nskb;
        u8 *tag;
        u8 *addr;
 
-       nskb = ksz_common_xmit(skb, dev, KSZ_INGRESS_TAG_LEN);
-       if (!nskb)
-               return NULL;
-
        /* Tag encoding */
-       tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN);
-       addr = skb_mac_header(nskb);
+       tag = skb_put(skb, KSZ_INGRESS_TAG_LEN);
+       addr = skb_mac_header(skb);
 
        *tag = 1 << dp->index;
        if (is_link_local_ether_addr(addr))
                *tag |= KSZ8795_TAIL_TAG_OVERRIDE;
 
-       return nskb;
+       return skb;
 }
 
 static struct sk_buff *ksz8795_rcv(struct sk_buff *skb, struct net_device *dev,
@@ -156,18 +111,13 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
                                    struct net_device *dev)
 {
        struct dsa_port *dp = dsa_slave_to_port(dev);
-       struct sk_buff *nskb;
        __be16 *tag;
        u8 *addr;
        u16 val;
 
-       nskb = ksz_common_xmit(skb, dev, KSZ9477_INGRESS_TAG_LEN);
-       if (!nskb)
-               return NULL;
-
        /* Tag encoding */
-       tag = skb_put(nskb, KSZ9477_INGRESS_TAG_LEN);
-       addr = skb_mac_header(nskb);
+       tag = skb_put(skb, KSZ9477_INGRESS_TAG_LEN);
+       addr = skb_mac_header(skb);
 
        val = BIT(dp->index);
 
@@ -176,7 +126,7 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
 
        *tag = cpu_to_be16(val);
 
-       return nskb;
+       return skb;
 }
 
 static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev,
@@ -213,24 +163,19 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb,
                                    struct net_device *dev)
 {
        struct dsa_port *dp = dsa_slave_to_port(dev);
-       struct sk_buff *nskb;
        u8 *addr;
        u8 *tag;
 
-       nskb = ksz_common_xmit(skb, dev, KSZ_INGRESS_TAG_LEN);
-       if (!nskb)
-               return NULL;
-
        /* Tag encoding */
-       tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN);
-       addr = skb_mac_header(nskb);
+       tag = skb_put(skb, KSZ_INGRESS_TAG_LEN);
+       addr = skb_mac_header(skb);
 
        *tag = BIT(dp->index);
 
        if (is_link_local_ether_addr(addr))
                *tag |= KSZ9893_TAIL_TAG_OVERRIDE;
 
-       return nskb;
+       return skb;
 }
 
 static const struct dsa_device_ops ksz9893_netdev_ops = {
index ccfb6f6..aa1318d 100644 (file)
@@ -58,15 +58,6 @@ static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev)
        __be16 *lan9303_tag;
        u16 tag;
 
-       /* insert a special VLAN tag between the MAC addresses
-        * and the current ethertype field.
-        */
-       if (skb_cow_head(skb, LAN9303_TAG_LEN) < 0) {
-               dev_dbg(&dev->dev,
-                       "Cannot make room for the special tag. Dropping packet\n");
-               return NULL;
-       }
-
        /* provide 'LAN9303_TAG_LEN' bytes additional space */
        skb_push(skb, LAN9303_TAG_LEN);
 
index 4cdd9cf..38dcdde 100644 (file)
@@ -34,9 +34,6 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
         * table with VID.
         */
        if (!skb_vlan_tagged(skb)) {
-               if (skb_cow_head(skb, MTK_HDR_LEN) < 0)
-                       return NULL;
-
                skb_push(skb, MTK_HDR_LEN);
                memmove(skb->data, skb->data + MTK_HDR_LEN, 2 * ETH_ALEN);
                is_vlan_skb = false;
index 3b468ac..16a1afd 100644 (file)
@@ -143,13 +143,6 @@ static struct sk_buff *ocelot_xmit(struct sk_buff *skb,
        struct ocelot_port *ocelot_port;
        u8 *prefix, *injection;
        u64 qos_class, rew_op;
-       int err;
-
-       err = skb_cow_head(skb, OCELOT_TOTAL_TAG_LEN);
-       if (unlikely(err < 0)) {
-               netdev_err(netdev, "Cannot make room for tag.\n");
-               return NULL;
-       }
 
        ocelot_port = ocelot->ports[dp->index];
 
index 1b9e850..88181b5 100644 (file)
@@ -34,9 +34,6 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev)
        __be16 *phdr;
        u16 hdr;
 
-       if (skb_cow_head(skb, QCA_HDR_LEN) < 0)
-               return NULL;
-
        skb_push(skb, QCA_HDR_LEN);
 
        memmove(skb->data, skb->data + QCA_HDR_LEN, 2 * ETH_ALEN);
index 3a1cc24..5b97ede 100644 (file)
 static struct sk_buff *trailer_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct dsa_port *dp = dsa_slave_to_port(dev);
-       struct sk_buff *nskb;
-       int padlen;
        u8 *trailer;
 
-       /*
-        * We have to make sure that the trailer ends up as the very
-        * last 4 bytes of the packet.  This means that we have to pad
-        * the packet to the minimum ethernet frame size, if necessary,
-        * before adding the trailer.
-        */
-       padlen = 0;
-       if (skb->len < 60)
-               padlen = 60 - skb->len;
-
-       nskb = alloc_skb(NET_IP_ALIGN + skb->len + padlen + 4, GFP_ATOMIC);
-       if (!nskb)
-               return NULL;
-       skb_reserve(nskb, NET_IP_ALIGN);
-
-       skb_reset_mac_header(nskb);
-       skb_set_network_header(nskb, skb_network_header(skb) - skb->head);
-       skb_set_transport_header(nskb, skb_transport_header(skb) - skb->head);
-       skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len));
-       consume_skb(skb);
-
-       if (padlen) {
-               skb_put_zero(nskb, padlen);
-       }
-
-       trailer = skb_put(nskb, 4);
+       trailer = skb_put(skb, 4);
        trailer[0] = 0x80;
        trailer[1] = 1 << dp->index;
        trailer[2] = 0x10;
        trailer[3] = 0x00;
 
-       return nskb;
+       return skb;
 }
 
 static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev,
index 8ee4cdb..1c9f4df 100644 (file)
@@ -280,7 +280,7 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info)
                                          active_diff_mask, compact);
        }
        if (mod)
-               ethtool_notify(dev, ETHTOOL_MSG_FEATURES_NTF, NULL);
+               netdev_features_change(dev);
 
 out_rtnl:
        rtnl_unlock();
index ec2cd7a..771688e 100644 (file)
@@ -2433,7 +2433,7 @@ static int noinline_for_stack ethtool_set_per_queue(struct net_device *dev,
                return ethtool_set_per_queue_coalesce(dev, useraddr, &per_queue_opt);
        default:
                return -EOPNOTSUPP;
-       };
+       }
 }
 
 static int ethtool_phy_tunable_valid(const struct ethtool_tunable *tuna)
index 123a6d3..43e0438 100644 (file)
@@ -650,8 +650,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh,
        struct in_device *in_dev;
        struct ifaddrmsg *ifm;
        struct in_ifaddr *ifa;
-
-       int err = -EINVAL;
+       int err;
 
        ASSERT_RTNL();
 
index 1f75dc6..7612ff6 100644 (file)
@@ -1641,9 +1641,8 @@ int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc,
                break;
        }
 
-       *flags |= (nhc->nhc_flags & RTNH_F_ONLINK);
-       if (nhc->nhc_flags & RTNH_F_OFFLOAD)
-               *flags |= RTNH_F_OFFLOAD;
+       *flags |= (nhc->nhc_flags &
+                  (RTNH_F_ONLINK | RTNH_F_OFFLOAD | RTNH_F_TRAP));
 
        if (!skip_oif && nhc->nhc_dev &&
            nla_put_u32(skb, RTA_OIF, nhc->nhc_dev->ifindex))
index ffc5332..28117c0 100644 (file)
@@ -2100,15 +2100,6 @@ static void __fib_info_notify_update(struct net *net, struct fib_table *tb,
                        rtmsg_fib(RTM_NEWROUTE, htonl(n->key), fa,
                                  KEYLENGTH - fa->fa_slen, tb->tb_id,
                                  info, NLM_F_REPLACE);
-
-                       /* call_fib_entry_notifiers will be removed when
-                        * in-kernel notifier is implemented and supported
-                        * for nexthop objects
-                        */
-                       call_fib_entry_notifiers(net, FIB_EVENT_ENTRY_REPLACE,
-                                                n->key,
-                                                KEYLENGTH - fa->fa_slen, fa,
-                                                NULL);
                }
        }
 }
index e702917..a68bf4c 100644 (file)
@@ -920,7 +920,7 @@ static const struct net_device_ops ipgre_netdev_ops = {
        .ndo_start_xmit         = ipgre_xmit,
        .ndo_do_ioctl           = ip_tunnel_ioctl,
        .ndo_change_mtu         = ip_tunnel_change_mtu,
-       .ndo_get_stats64        = ip_tunnel_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_get_iflink         = ip_tunnel_get_iflink,
        .ndo_tunnel_ctl         = ipgre_tunnel_ctl,
 };
@@ -1275,7 +1275,7 @@ static const struct net_device_ops gre_tap_netdev_ops = {
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_change_mtu         = ip_tunnel_change_mtu,
-       .ndo_get_stats64        = ip_tunnel_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_get_iflink         = ip_tunnel_get_iflink,
        .ndo_fill_metadata_dst  = gre_fill_metadata_dst,
 };
@@ -1308,7 +1308,7 @@ static const struct net_device_ops erspan_netdev_ops = {
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_change_mtu         = ip_tunnel_change_mtu,
-       .ndo_get_stats64        = ip_tunnel_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_get_iflink         = ip_tunnel_get_iflink,
        .ndo_fill_metadata_dst  = gre_fill_metadata_dst,
 };
index 8b04d1d..ee65c92 100644 (file)
@@ -608,9 +608,6 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
                        ttl = ip4_dst_hoplimit(&rt->dst);
        }
 
-       if (!df && skb->protocol == htons(ETH_P_IP))
-               df = inner_iph->frag_off & htons(IP_DF);
-
        headroom += LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len;
        if (headroom > dev->needed_headroom)
                dev->needed_headroom = headroom;
index 25f1caf..7ca338f 100644 (file)
@@ -263,7 +263,7 @@ static int iptunnel_pmtud_check_icmp(struct sk_buff *skb, int mtu)
        const struct icmphdr *icmph = icmp_hdr(skb);
        const struct iphdr *iph = ip_hdr(skb);
 
-       if (mtu <= 576 || iph->frag_off != htons(IP_DF))
+       if (mtu < 576 || iph->frag_off != htons(IP_DF))
                return 0;
 
        if (ipv4_is_lbcast(iph->daddr)  || ipv4_is_multicast(iph->daddr) ||
@@ -359,7 +359,7 @@ static int iptunnel_pmtud_check_icmpv6(struct sk_buff *skb, int mtu)
        __be16 frag_off;
        int offset;
 
-       if (mtu <= IPV6_MIN_MTU)
+       if (mtu < IPV6_MIN_MTU)
                return 0;
 
        if (stype == IPV6_ADDR_ANY || stype == IPV6_ADDR_MULTICAST ||
@@ -429,15 +429,6 @@ int skb_tunnel_check_pmtu(struct sk_buff *skb, struct dst_entry *encap_dst,
 }
 EXPORT_SYMBOL(skb_tunnel_check_pmtu);
 
-/* Often modified stats are per cpu, other are shared (netdev->stats) */
-void ip_tunnel_get_stats64(struct net_device *dev,
-                          struct rtnl_link_stats64 *tot)
-{
-       netdev_stats_to_stats64(tot, &dev->stats);
-       dev_fetch_sw_netstats(tot, dev->tstats);
-}
-EXPORT_SYMBOL_GPL(ip_tunnel_get_stats64);
-
 static const struct nla_policy ip_tun_policy[LWTUNNEL_IP_MAX + 1] = {
        [LWTUNNEL_IP_UNSPEC]    = { .strict_start_type = LWTUNNEL_IP_OPTS },
        [LWTUNNEL_IP_ID]        = { .type = NLA_U64 },
index b957cbe..abc171e 100644 (file)
@@ -404,7 +404,7 @@ static const struct net_device_ops vti_netdev_ops = {
        .ndo_start_xmit = vti_tunnel_xmit,
        .ndo_do_ioctl   = ip_tunnel_ioctl,
        .ndo_change_mtu = ip_tunnel_change_mtu,
-       .ndo_get_stats64 = ip_tunnel_get_stats64,
+       .ndo_get_stats64 = dev_get_tstats64,
        .ndo_get_iflink = ip_tunnel_get_iflink,
        .ndo_tunnel_ctl = vti_tunnel_ctl,
 };
index 561f15b..3cd13e1 100644 (file)
@@ -1441,7 +1441,7 @@ static int __init ip_auto_config(void)
        int retries = CONF_OPEN_RETRIES;
 #endif
        int err;
-       unsigned int i;
+       unsigned int i, count;
 
        /* Initialise all name servers and NTP servers to NONE (but only if the
         * "ip=" or "nfsaddrs=" kernel command line parameters weren't decoded,
@@ -1575,7 +1575,7 @@ static int __init ip_auto_config(void)
        if (ic_dev_mtu)
                pr_cont(", mtu=%d", ic_dev_mtu);
        /* Name servers (if any): */
-       for (i = 0; i < CONF_NAMESERVERS_MAX; i++) {
+       for (i = 0, count = 0; i < CONF_NAMESERVERS_MAX; i++) {
                if (ic_nameservers[i] != NONE) {
                        if (i == 0)
                                pr_info("     nameserver%u=%pI4",
@@ -1583,12 +1583,14 @@ static int __init ip_auto_config(void)
                        else
                                pr_cont(", nameserver%u=%pI4",
                                        i, &ic_nameservers[i]);
+
+                       count++;
                }
-               if (i + 1 == CONF_NAMESERVERS_MAX)
+               if ((i + 1 == CONF_NAMESERVERS_MAX) && count > 0)
                        pr_cont("\n");
        }
        /* NTP servers (if any): */
-       for (i = 0; i < CONF_NTP_SERVERS_MAX; i++) {
+       for (i = 0, count = 0; i < CONF_NTP_SERVERS_MAX; i++) {
                if (ic_ntp_servers[i] != NONE) {
                        if (i == 0)
                                pr_info("     ntpserver%u=%pI4",
@@ -1596,8 +1598,10 @@ static int __init ip_auto_config(void)
                        else
                                pr_cont(", ntpserver%u=%pI4",
                                        i, &ic_ntp_servers[i]);
+
+                       count++;
                }
-               if (i + 1 == CONF_NTP_SERVERS_MAX)
+               if ((i + 1 == CONF_NTP_SERVERS_MAX) && count > 0)
                        pr_cont("\n");
        }
 #endif /* !SILENT */
index 75d35e7..d5bfa08 100644 (file)
@@ -347,7 +347,7 @@ static const struct net_device_ops ipip_netdev_ops = {
        .ndo_start_xmit = ipip_tunnel_xmit,
        .ndo_do_ioctl   = ip_tunnel_ioctl,
        .ndo_change_mtu = ip_tunnel_change_mtu,
-       .ndo_get_stats64 = ip_tunnel_get_stats64,
+       .ndo_get_stats64 = dev_get_tstats64,
        .ndo_get_iflink = ip_tunnel_get_iflink,
        .ndo_tunnel_ctl = ipip_tunnel_ctl,
 };
index a058213..7c84103 100644 (file)
 #include <net/netfilter/nf_queue.h>
 
 /* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue */
-int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned int addr_type)
+int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned int addr_type)
 {
        const struct iphdr *iph = ip_hdr(skb);
        struct rtable *rt;
        struct flowi4 fl4 = {};
        __be32 saddr = iph->saddr;
-       const struct sock *sk = skb_to_full_sk(skb);
-       __u8 flags = sk ? inet_sk_flowi_flags(sk) : 0;
+       __u8 flags;
        struct net_device *dev = skb_dst(skb)->dev;
        unsigned int hh_len;
 
+       sk = sk_to_full_sk(sk);
+       flags = sk ? inet_sk_flowi_flags(sk) : 0;
+
        if (addr_type == RTN_UNSPEC)
                addr_type = inet_addr_type_dev_table(net, dev, saddr);
        if (addr_type == RTN_LOCAL || addr_type == RTN_UNICAST)
index f703a71..8330795 100644 (file)
@@ -62,7 +62,7 @@ ipt_mangle_out(struct sk_buff *skb, const struct nf_hook_state *state)
                    iph->daddr != daddr ||
                    skb->mark != mark ||
                    iph->tos != tos) {
-                       err = ip_route_me_harder(state->net, skb, RTN_UNSPEC);
+                       err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC);
                        if (err < 0)
                                ret = NF_DROP_ERR(err);
                }
index 9dcfa4e..4109055 100644 (file)
 #include <linux/netfilter_ipv4.h>
 #include <linux/netfilter_bridge.h>
 
+static int nf_reject_iphdr_validate(struct sk_buff *skb)
+{
+       struct iphdr *iph;
+       u32 len;
+
+       if (!pskb_may_pull(skb, sizeof(struct iphdr)))
+               return 0;
+
+       iph = ip_hdr(skb);
+       if (iph->ihl < 5 || iph->version != 4)
+               return 0;
+
+       len = ntohs(iph->tot_len);
+       if (skb->len < len)
+               return 0;
+       else if (len < (iph->ihl*4))
+               return 0;
+
+       if (!pskb_may_pull(skb, iph->ihl*4))
+               return 0;
+
+       return 1;
+}
+
+struct sk_buff *nf_reject_skb_v4_tcp_reset(struct net *net,
+                                          struct sk_buff *oldskb,
+                                          const struct net_device *dev,
+                                          int hook)
+{
+       const struct tcphdr *oth;
+       struct sk_buff *nskb;
+       struct iphdr *niph;
+       struct tcphdr _oth;
+
+       if (!nf_reject_iphdr_validate(oldskb))
+               return NULL;
+
+       oth = nf_reject_ip_tcphdr_get(oldskb, &_oth, hook);
+       if (!oth)
+               return NULL;
+
+       nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct tcphdr) +
+                        LL_MAX_HEADER, GFP_ATOMIC);
+       if (!nskb)
+               return NULL;
+
+       nskb->dev = (struct net_device *)dev;
+
+       skb_reserve(nskb, LL_MAX_HEADER);
+       niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_TCP,
+                                  net->ipv4.sysctl_ip_default_ttl);
+       nf_reject_ip_tcphdr_put(nskb, oldskb, oth);
+       niph->tot_len = htons(nskb->len);
+       ip_send_check(niph);
+
+       return nskb;
+}
+EXPORT_SYMBOL_GPL(nf_reject_skb_v4_tcp_reset);
+
+struct sk_buff *nf_reject_skb_v4_unreach(struct net *net,
+                                        struct sk_buff *oldskb,
+                                        const struct net_device *dev,
+                                        int hook, u8 code)
+{
+       struct sk_buff *nskb;
+       struct iphdr *niph;
+       struct icmphdr *icmph;
+       unsigned int len;
+       __wsum csum;
+       u8 proto;
+
+       if (!nf_reject_iphdr_validate(oldskb))
+               return NULL;
+
+       /* IP header checks: fragment. */
+       if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET))
+               return NULL;
+
+       /* RFC says return as much as we can without exceeding 576 bytes. */
+       len = min_t(unsigned int, 536, oldskb->len);
+
+       if (!pskb_may_pull(oldskb, len))
+               return NULL;
+
+       if (pskb_trim_rcsum(oldskb, ntohs(ip_hdr(oldskb)->tot_len)))
+               return NULL;
+
+       proto = ip_hdr(oldskb)->protocol;
+
+       if (!skb_csum_unnecessary(oldskb) &&
+           nf_reject_verify_csum(proto) &&
+           nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), proto))
+               return NULL;
+
+       nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct icmphdr) +
+                        LL_MAX_HEADER + len, GFP_ATOMIC);
+       if (!nskb)
+               return NULL;
+
+       nskb->dev = (struct net_device *)dev;
+
+       skb_reserve(nskb, LL_MAX_HEADER);
+       niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_ICMP,
+                                  net->ipv4.sysctl_ip_default_ttl);
+
+       skb_reset_transport_header(nskb);
+       icmph = skb_put_zero(nskb, sizeof(struct icmphdr));
+       icmph->type     = ICMP_DEST_UNREACH;
+       icmph->code     = code;
+
+       skb_put_data(nskb, skb_network_header(oldskb), len);
+
+       csum = csum_partial((void *)icmph, len + sizeof(struct icmphdr), 0);
+       icmph->checksum = csum_fold(csum);
+
+       niph->tot_len   = htons(nskb->len);
+       ip_send_check(niph);
+
+       return nskb;
+}
+EXPORT_SYMBOL_GPL(nf_reject_skb_v4_unreach);
+
 const struct tcphdr *nf_reject_ip_tcphdr_get(struct sk_buff *oldskb,
                                             struct tcphdr *_oth, int hook)
 {
@@ -124,7 +246,8 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook)
        if (!oth)
                return;
 
-       if (hook == NF_INET_PRE_ROUTING && nf_reject_fill_skb_dst(oldskb))
+       if ((hook == NF_INET_PRE_ROUTING || hook == NF_INET_INGRESS) &&
+           nf_reject_fill_skb_dst(oldskb) < 0)
                return;
 
        if (skb_rtable(oldskb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
@@ -145,7 +268,7 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook)
                                   ip4_dst_hoplimit(skb_dst(nskb)));
        nf_reject_ip_tcphdr_put(nskb, oldskb, oth);
 
-       if (ip_route_me_harder(net, nskb, RTN_UNSPEC))
+       if (ip_route_me_harder(net, nskb->sk, nskb, RTN_UNSPEC))
                goto free_nskb;
 
        niph = ip_hdr(nskb);
@@ -193,7 +316,8 @@ void nf_send_unreach(struct sk_buff *skb_in, int code, int hook)
        if (iph->frag_off & htons(IP_OFFSET))
                return;
 
-       if (hook == NF_INET_PRE_ROUTING && nf_reject_fill_skb_dst(skb_in))
+       if ((hook == NF_INET_PRE_ROUTING || hook == NF_INET_INGRESS) &&
+           nf_reject_fill_skb_dst(skb_in) < 0)
                return;
 
        if (skb_csum_unnecessary(skb_in) || !nf_reject_verify_csum(proto)) {
index 0dc43ad..5e1b22d 100644 (file)
@@ -36,14 +36,145 @@ static const struct nla_policy rtm_nh_policy[NHA_MAX + 1] = {
        [NHA_FDB]               = { .type = NLA_FLAG },
 };
 
+static bool nexthop_notifiers_is_empty(struct net *net)
+{
+       return !net->nexthop.notifier_chain.head;
+}
+
+static void
+__nh_notifier_single_info_init(struct nh_notifier_single_info *nh_info,
+                              const struct nexthop *nh)
+{
+       struct nh_info *nhi = rtnl_dereference(nh->nh_info);
+
+       nh_info->dev = nhi->fib_nhc.nhc_dev;
+       nh_info->gw_family = nhi->fib_nhc.nhc_gw_family;
+       if (nh_info->gw_family == AF_INET)
+               nh_info->ipv4 = nhi->fib_nhc.nhc_gw.ipv4;
+       else if (nh_info->gw_family == AF_INET6)
+               nh_info->ipv6 = nhi->fib_nhc.nhc_gw.ipv6;
+
+       nh_info->is_reject = nhi->reject_nh;
+       nh_info->is_fdb = nhi->fdb_nh;
+       nh_info->has_encap = !!nhi->fib_nhc.nhc_lwtstate;
+}
+
+static int nh_notifier_single_info_init(struct nh_notifier_info *info,
+                                       const struct nexthop *nh)
+{
+       info->nh = kzalloc(sizeof(*info->nh), GFP_KERNEL);
+       if (!info->nh)
+               return -ENOMEM;
+
+       __nh_notifier_single_info_init(info->nh, nh);
+
+       return 0;
+}
+
+static void nh_notifier_single_info_fini(struct nh_notifier_info *info)
+{
+       kfree(info->nh);
+}
+
+static int nh_notifier_grp_info_init(struct nh_notifier_info *info,
+                                    const struct nexthop *nh)
+{
+       struct nh_group *nhg = rtnl_dereference(nh->nh_grp);
+       u16 num_nh = nhg->num_nh;
+       int i;
+
+       info->nh_grp = kzalloc(struct_size(info->nh_grp, nh_entries, num_nh),
+                              GFP_KERNEL);
+       if (!info->nh_grp)
+               return -ENOMEM;
+
+       info->nh_grp->num_nh = num_nh;
+       info->nh_grp->is_fdb = nhg->fdb_nh;
+
+       for (i = 0; i < num_nh; i++) {
+               struct nh_grp_entry *nhge = &nhg->nh_entries[i];
+
+               info->nh_grp->nh_entries[i].id = nhge->nh->id;
+               info->nh_grp->nh_entries[i].weight = nhge->weight;
+               __nh_notifier_single_info_init(&info->nh_grp->nh_entries[i].nh,
+                                              nhge->nh);
+       }
+
+       return 0;
+}
+
+static void nh_notifier_grp_info_fini(struct nh_notifier_info *info)
+{
+       kfree(info->nh_grp);
+}
+
+static int nh_notifier_info_init(struct nh_notifier_info *info,
+                                const struct nexthop *nh)
+{
+       info->id = nh->id;
+       info->is_grp = nh->is_group;
+
+       if (info->is_grp)
+               return nh_notifier_grp_info_init(info, nh);
+       else
+               return nh_notifier_single_info_init(info, nh);
+}
+
+static void nh_notifier_info_fini(struct nh_notifier_info *info)
+{
+       if (info->is_grp)
+               nh_notifier_grp_info_fini(info);
+       else
+               nh_notifier_single_info_fini(info);
+}
+
 static int call_nexthop_notifiers(struct net *net,
                                  enum nexthop_event_type event_type,
-                                 struct nexthop *nh)
+                                 struct nexthop *nh,
+                                 struct netlink_ext_ack *extack)
 {
+       struct nh_notifier_info info = {
+               .net = net,
+               .extack = extack,
+       };
        int err;
 
+       ASSERT_RTNL();
+
+       if (nexthop_notifiers_is_empty(net))
+               return 0;
+
+       err = nh_notifier_info_init(&info, nh);
+       if (err) {
+               NL_SET_ERR_MSG(extack, "Failed to initialize nexthop notifier info");
+               return err;
+       }
+
        err = blocking_notifier_call_chain(&net->nexthop.notifier_chain,
-                                          event_type, nh);
+                                          event_type, &info);
+       nh_notifier_info_fini(&info);
+
+       return notifier_to_errno(err);
+}
+
+static int call_nexthop_notifier(struct notifier_block *nb, struct net *net,
+                                enum nexthop_event_type event_type,
+                                struct nexthop *nh,
+                                struct netlink_ext_ack *extack)
+{
+       struct nh_notifier_info info = {
+               .net = net,
+               .extack = extack,
+       };
+       int err;
+
+       err = nh_notifier_info_init(&info, nh);
+       if (err)
+               return err;
+
+       err = nb->notifier_call(nb, event_type, &info);
+       nh_notifier_info_fini(&info);
+
        return notifier_to_errno(err);
 }
 
@@ -782,9 +913,10 @@ static void remove_nh_grp_entry(struct net *net, struct nh_grp_entry *nhge,
 {
        struct nh_grp_entry *nhges, *new_nhges;
        struct nexthop *nhp = nhge->nh_parent;
+       struct netlink_ext_ack extack;
        struct nexthop *nh = nhge->nh;
        struct nh_group *nhg, *newg;
-       int i, j;
+       int i, j, err;
 
        WARN_ON(!nh);
 
@@ -832,6 +964,10 @@ static void remove_nh_grp_entry(struct net *net, struct nh_grp_entry *nhge,
        list_del(&nhge->nh_list);
        nexthop_put(nhge->nh);
 
+       err = call_nexthop_notifiers(net, NEXTHOP_EVENT_REPLACE, nhp, &extack);
+       if (err)
+               pr_err("%s\n", extack._msg);
+
        if (nlinfo)
                nexthop_notify(RTM_NEWNEXTHOP, nhp, nlinfo);
 }
@@ -907,7 +1043,7 @@ static void __remove_nexthop(struct net *net, struct nexthop *nh,
 static void remove_nexthop(struct net *net, struct nexthop *nh,
                           struct nl_info *nlinfo)
 {
-       call_nexthop_notifiers(net, NEXTHOP_EVENT_DEL, nh);
+       call_nexthop_notifiers(net, NEXTHOP_EVENT_DEL, nh, NULL);
 
        /* remove from the tree */
        rb_erase(&nh->rb_node, &net->nexthop.rb_root);
@@ -940,13 +1076,17 @@ static int replace_nexthop_grp(struct net *net, struct nexthop *old,
                               struct netlink_ext_ack *extack)
 {
        struct nh_group *oldg, *newg;
-       int i;
+       int i, err;
 
        if (!new->is_group) {
                NL_SET_ERR_MSG(extack, "Can not replace a nexthop group with a nexthop.");
                return -EINVAL;
        }
 
+       err = call_nexthop_notifiers(net, NEXTHOP_EVENT_REPLACE, new, extack);
+       if (err)
+               return err;
+
        oldg = rtnl_dereference(old->nh_grp);
        newg = rtnl_dereference(new->nh_grp);
 
@@ -985,31 +1125,54 @@ static int replace_nexthop_single(struct net *net, struct nexthop *old,
                                  struct nexthop *new,
                                  struct netlink_ext_ack *extack)
 {
+       u8 old_protocol, old_nh_flags;
        struct nh_info *oldi, *newi;
+       struct nh_grp_entry *nhge;
+       int err;
 
        if (new->is_group) {
                NL_SET_ERR_MSG(extack, "Can not replace a nexthop with a nexthop group.");
                return -EINVAL;
        }
 
+       err = call_nexthop_notifiers(net, NEXTHOP_EVENT_REPLACE, new, extack);
+       if (err)
+               return err;
+
+       /* Hardware flags were set on 'old' as 'new' is not in the red-black
+        * tree. Therefore, inherit the flags from 'old' to 'new'.
+        */
+       new->nh_flags |= old->nh_flags & (RTNH_F_OFFLOAD | RTNH_F_TRAP);
+
        oldi = rtnl_dereference(old->nh_info);
        newi = rtnl_dereference(new->nh_info);
 
        newi->nh_parent = old;
        oldi->nh_parent = new;
 
+       old_protocol = old->protocol;
+       old_nh_flags = old->nh_flags;
+
        old->protocol = new->protocol;
        old->nh_flags = new->nh_flags;
 
        rcu_assign_pointer(old->nh_info, newi);
        rcu_assign_pointer(new->nh_info, oldi);
 
+       /* Send a replace notification for all the groups using the nexthop. */
+       list_for_each_entry(nhge, &old->grp_list, nh_list) {
+               struct nexthop *nhp = nhge->nh_parent;
+
+               err = call_nexthop_notifiers(net, NEXTHOP_EVENT_REPLACE, nhp,
+                                            extack);
+               if (err)
+                       goto err_notify;
+       }
+
        /* When replacing an IPv4 nexthop with an IPv6 nexthop, potentially
         * update IPv4 indication in all the groups using the nexthop.
         */
        if (oldi->family == AF_INET && newi->family == AF_INET6) {
-               struct nh_grp_entry *nhge;
-
                list_for_each_entry(nhge, &old->grp_list, nh_list) {
                        struct nexthop *nhp = nhge->nh_parent;
                        struct nh_group *nhg;
@@ -1020,6 +1183,21 @@ static int replace_nexthop_single(struct net *net, struct nexthop *old,
        }
 
        return 0;
+
+err_notify:
+       rcu_assign_pointer(new->nh_info, newi);
+       rcu_assign_pointer(old->nh_info, oldi);
+       old->nh_flags = old_nh_flags;
+       old->protocol = old_protocol;
+       oldi->nh_parent = old;
+       newi->nh_parent = new;
+       list_for_each_entry_continue_reverse(nhge, &old->grp_list, nh_list) {
+               struct nexthop *nhp = nhge->nh_parent;
+
+               call_nexthop_notifiers(net, NEXTHOP_EVENT_REPLACE, nhp, extack);
+       }
+       call_nexthop_notifiers(net, NEXTHOP_EVENT_REPLACE, old, extack);
+       return err;
 }
 
 static void __nexthop_replace_notify(struct net *net, struct nexthop *nh,
@@ -1168,7 +1346,11 @@ static int insert_nexthop(struct net *net, struct nexthop *new_nh,
 
        rb_link_node_rcu(&new_nh->rb_node, parent, pp);
        rb_insert_color(&new_nh->rb_node, root);
-       rc = 0;
+
+       rc = call_nexthop_notifiers(net, NEXTHOP_EVENT_REPLACE, new_nh, extack);
+       if (rc)
+               rb_erase(&new_nh->rb_node, &net->nexthop.rb_root);
+
 out:
        if (!rc) {
                nh_base_seq_inc(net);
@@ -1957,10 +2139,40 @@ static struct notifier_block nh_netdev_notifier = {
        .notifier_call = nh_netdev_event,
 };
 
-int register_nexthop_notifier(struct net *net, struct notifier_block *nb)
+static int nexthops_dump(struct net *net, struct notifier_block *nb,
+                        struct netlink_ext_ack *extack)
+{
+       struct rb_root *root = &net->nexthop.rb_root;
+       struct rb_node *node;
+       int err = 0;
+
+       for (node = rb_first(root); node; node = rb_next(node)) {
+               struct nexthop *nh;
+
+               nh = rb_entry(node, struct nexthop, rb_node);
+               err = call_nexthop_notifier(nb, net, NEXTHOP_EVENT_REPLACE, nh,
+                                           extack);
+               if (err)
+                       break;
+       }
+
+       return err;
+}
+
+int register_nexthop_notifier(struct net *net, struct notifier_block *nb,
+                             struct netlink_ext_ack *extack)
 {
-       return blocking_notifier_chain_register(&net->nexthop.notifier_chain,
-                                               nb);
+       int err;
+
+       rtnl_lock();
+       err = nexthops_dump(net, nb, extack);
+       if (err)
+               goto unlock;
+       err = blocking_notifier_chain_register(&net->nexthop.notifier_chain,
+                                              nb);
+unlock:
+       rtnl_unlock();
+       return err;
 }
 EXPORT_SYMBOL(register_nexthop_notifier);
 
@@ -1971,6 +2183,27 @@ int unregister_nexthop_notifier(struct net *net, struct notifier_block *nb)
 }
 EXPORT_SYMBOL(unregister_nexthop_notifier);
 
+void nexthop_set_hw_flags(struct net *net, u32 id, bool offload, bool trap)
+{
+       struct nexthop *nexthop;
+
+       rcu_read_lock();
+
+       nexthop = nexthop_find_by_id(net, id);
+       if (!nexthop)
+               goto out;
+
+       nexthop->nh_flags &= ~(RTNH_F_OFFLOAD | RTNH_F_TRAP);
+       if (offload)
+               nexthop->nh_flags |= RTNH_F_OFFLOAD;
+       if (trap)
+               nexthop->nh_flags |= RTNH_F_TRAP;
+
+out:
+       rcu_read_unlock();
+}
+EXPORT_SYMBOL(nexthop_set_hw_flags);
+
 static void __net_exit nexthop_net_exit(struct net *net)
 {
        rtnl_lock();
index 8d5e169..63cd370 100644 (file)
@@ -167,6 +167,7 @@ static const struct snmp_mib snmp4_udp_list[] = {
        SNMP_MIB_ITEM("SndbufErrors", UDP_MIB_SNDBUFERRORS),
        SNMP_MIB_ITEM("InCsumErrors", UDP_MIB_CSUMERRORS),
        SNMP_MIB_ITEM("IgnoredMulti", UDP_MIB_IGNOREDMULTI),
+       SNMP_MIB_ITEM("MemErrors", UDP_MIB_MEMERRORS),
        SNMP_MIB_SENTINEL
 };
 
index dc2a399..a3b60c4 100644 (file)
@@ -1741,7 +1741,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
                flags |= RTCF_LOCAL;
 
        rth = rt_dst_alloc(dev_net(dev)->loopback_dev, flags, RTN_MULTICAST,
-                          IN_DEV_CONF_GET(in_dev, NOPOLICY), false);
+                          IN_DEV_ORCONF(in_dev, NOPOLICY), false);
        if (!rth)
                return -ENOBUFS;
 
@@ -1857,8 +1857,8 @@ static int __mkroute_input(struct sk_buff *skb,
        }
 
        rth = rt_dst_alloc(out_dev->dev, 0, res->type,
-                          IN_DEV_CONF_GET(in_dev, NOPOLICY),
-                          IN_DEV_CONF_GET(out_dev, NOXFRM));
+                          IN_DEV_ORCONF(in_dev, NOPOLICY),
+                          IN_DEV_ORCONF(out_dev, NOXFRM));
        if (!rth) {
                err = -ENOBUFS;
                goto cleanup;
@@ -2227,7 +2227,7 @@ local_input:
 
        rth = rt_dst_alloc(l3mdev_master_dev_rcu(dev) ? : net->loopback_dev,
                           flags | RTCF_LOCAL, res->type,
-                          IN_DEV_CONF_GET(in_dev, NOPOLICY), false);
+                          IN_DEV_ORCONF(in_dev, NOPOLICY), false);
        if (!rth)
                goto e_nobufs;
 
@@ -2450,8 +2450,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
 
 add:
        rth = rt_dst_alloc(dev_out, flags, type,
-                          IN_DEV_CONF_GET(in_dev, NOPOLICY),
-                          IN_DEV_CONF_GET(in_dev, NOXFRM));
+                          IN_DEV_ORCONF(in_dev, NOPOLICY),
+                          IN_DEV_ORCONF(in_dev, NOXFRM));
        if (!rth)
                return ERR_PTR(-ENOBUFS);
 
index 6ac473b..00dc3f9 100644 (file)
@@ -331,7 +331,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
        __u32 cookie = ntohl(th->ack_seq) - 1;
        struct sock *ret = sk;
        struct request_sock *req;
-       int mss;
+       int full_space, mss;
        struct rtable *rt;
        __u8 rcv_wscale;
        struct flowi4 fl4;
@@ -427,8 +427,13 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
 
        /* Try to redo what tcp_v4_send_synack did. */
        req->rsk_window_clamp = tp->window_clamp ? :dst_metric(&rt->dst, RTAX_WINDOW);
+       /* limit the window selection if the user enforce a smaller rx buffer */
+       full_space = tcp_full_space(sk);
+       if (sk->sk_userlocks & SOCK_RCVBUF_LOCK &&
+           (req->rsk_window_clamp > full_space || req->rsk_window_clamp == 0))
+               req->rsk_window_clamp = full_space;
 
-       tcp_select_initial_window(sk, tcp_full_space(sk), req->mss,
+       tcp_select_initial_window(sk, full_space, req->mss,
                                  &req->rsk_rcv_wnd, &req->rsk_window_clamp,
                                  ireq->wscale_ok, &rcv_wscale,
                                  dst_metric(&rt->dst, RTAX_INITRWND));
index bae4284..b2bc3d7 100644 (file)
@@ -485,6 +485,8 @@ static inline bool tcp_stream_is_readable(const struct tcp_sock *tp,
                        return true;
                if (tcp_rmem_pressure(sk))
                        return true;
+               if (tcp_receive_window(tp) <= inet_csk(sk)->icsk_ack.rcv_mss)
+                       return true;
        }
        if (sk->sk_prot->stream_memory_read)
                return sk->sk_prot->stream_memory_read(sk);
index fc44583..fb3a775 100644 (file)
@@ -2546,7 +2546,7 @@ static bool tcp_try_undo_loss(struct sock *sk, bool frto_undo)
  *   1) If the packets in flight is larger than ssthresh, PRR spreads the
  *     cwnd reductions across a full RTT.
  *   2) Otherwise PRR uses packet conservation to send as much as delivered.
- *      But when the retransmits are acked without further losses, PRR
+ *      But when SND_UNA is acked without further losses,
  *      slow starts cwnd up to ssthresh to speed up the recovery.
  */
 static void tcp_init_cwnd_reduction(struct sock *sk)
@@ -2563,7 +2563,7 @@ static void tcp_init_cwnd_reduction(struct sock *sk)
        tcp_ecn_queue_cwr(tp);
 }
 
-void tcp_cwnd_reduction(struct sock *sk, int newly_acked_sacked, int flag)
+void tcp_cwnd_reduction(struct sock *sk, int newly_acked_sacked, int newly_lost, int flag)
 {
        struct tcp_sock *tp = tcp_sk(sk);
        int sndcnt = 0;
@@ -2577,8 +2577,7 @@ void tcp_cwnd_reduction(struct sock *sk, int newly_acked_sacked, int flag)
                u64 dividend = (u64)tp->snd_ssthresh * tp->prr_delivered +
                               tp->prior_cwnd - 1;
                sndcnt = div_u64(dividend, tp->prior_cwnd) - tp->prr_out;
-       } else if ((flag & (FLAG_RETRANS_DATA_ACKED | FLAG_LOST_RETRANS)) ==
-                  FLAG_RETRANS_DATA_ACKED) {
+       } else if (flag & FLAG_SND_UNA_ADVANCED && !newly_lost) {
                sndcnt = min_t(int, delta,
                               max_t(int, tp->prr_delivered - tp->prr_out,
                                     newly_acked_sacked) + 1);
@@ -3419,7 +3418,7 @@ static void tcp_cong_control(struct sock *sk, u32 ack, u32 acked_sacked,
 
        if (tcp_in_cwnd_reduction(sk)) {
                /* Reduce cwnd if state mandates */
-               tcp_cwnd_reduction(sk, acked_sacked, flag);
+               tcp_cwnd_reduction(sk, acked_sacked, rs->losses, flag);
        } else if (tcp_may_raise_cwnd(sk, flag)) {
                /* Advance cwnd if state allows */
                tcp_cong_avoid(sk, ack, acked_sacked);
@@ -4908,7 +4907,8 @@ void tcp_data_ready(struct sock *sk)
        int avail = tp->rcv_nxt - tp->copied_seq;
 
        if (avail < sk->sk_rcvlowat && !tcp_rmem_pressure(sk) &&
-           !sock_flag(sk, SOCK_DONE))
+           !sock_flag(sk, SOCK_DONE) &&
+           tcp_receive_window(tp) > inet_csk(sk)->icsk_ack.rcv_mss)
                return;
 
        sk->sk_data_ready(sk);
index 8c643a4..e645953 100644 (file)
@@ -89,6 +89,7 @@ struct lp {
 
 /**
  * tcp_lp_init
+ * @sk: socket to initialize congestion control algorithm for
  *
  * Init all required variables.
  * Clone the handling from Vegas module implementation.
@@ -111,6 +112,7 @@ static void tcp_lp_init(struct sock *sk)
 
 /**
  * tcp_lp_cong_avoid
+ * @sk: socket to avoid congesting
  *
  * Implementation of cong_avoid.
  * Will only call newReno CA when away from inference.
@@ -126,6 +128,7 @@ static void tcp_lp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
 
 /**
  * tcp_lp_remote_hz_estimator
+ * @sk: socket which needs an estimate for the remote HZs
  *
  * Estimate remote HZ.
  * We keep on updating the estimated value, where original TCP-LP
@@ -176,6 +179,7 @@ static u32 tcp_lp_remote_hz_estimator(struct sock *sk)
 
 /**
  * tcp_lp_owd_calculator
+ * @sk: socket to calculate one way delay for
  *
  * Calculate one way delay (in relative format).
  * Original implement OWD as minus of remote time difference to local time
@@ -210,6 +214,8 @@ static u32 tcp_lp_owd_calculator(struct sock *sk)
 
 /**
  * tcp_lp_rtt_sample
+ * @sk: socket to add a rtt sample to
+ * @rtt: round trip time, which is ignored!
  *
  * Implementation or rtt_sample.
  * Will take the following action,
@@ -254,6 +260,7 @@ static void tcp_lp_rtt_sample(struct sock *sk, u32 rtt)
 
 /**
  * tcp_lp_pkts_acked
+ * @sk: socket requiring congestion avoidance calculations
  *
  * Implementation of pkts_acked.
  * Deal with active drop under Early Congestion Indication.
index bf48cd7..99905bc 100644 (file)
@@ -1038,9 +1038,9 @@ static void tcp_tsq_handler(struct sock *sk)
  * transferring tsq->head because tcp_wfree() might
  * interrupt us (non NAPI drivers)
  */
-static void tcp_tasklet_func(unsigned long data)
+static void tcp_tasklet_func(struct tasklet_struct *t)
 {
-       struct tsq_tasklet *tsq = (struct tsq_tasklet *)data;
+       struct tsq_tasklet *tsq = from_tasklet(tsq,  t, tasklet);
        LIST_HEAD(list);
        unsigned long flags;
        struct list_head *q, *n;
@@ -1125,9 +1125,7 @@ void __init tcp_tasklet_init(void)
                struct tsq_tasklet *tsq = &per_cpu(tsq_tasklet, i);
 
                INIT_LIST_HEAD(&tsq->head);
-               tasklet_init(&tsq->tasklet,
-                            tcp_tasklet_func,
-                            (unsigned long)tsq);
+               tasklet_setup(&tsq->tasklet, tcp_tasklet_func);
        }
 }
 
@@ -1569,6 +1567,7 @@ int tcp_fragment(struct sock *sk, enum tcp_queue tcp_queue,
        if (!buff)
                return -ENOMEM; /* We'll just try again later. */
        skb_copy_decrypted(buff, skb);
+       mptcp_skb_ext_copy(buff, skb);
 
        sk_wmem_queued_add(sk, buff->truesize);
        sk_mem_charge(sk, buff->truesize);
@@ -2123,6 +2122,7 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len,
        if (unlikely(!buff))
                return -ENOMEM;
        skb_copy_decrypted(buff, skb);
+       mptcp_skb_ext_copy(buff, skb);
 
        sk_wmem_queued_add(sk, buff->truesize);
        sk_mem_charge(sk, buff->truesize);
@@ -2393,6 +2393,7 @@ static int tcp_mtu_probe(struct sock *sk)
 
        skb = tcp_send_head(sk);
        skb_copy_decrypted(nskb, skb);
+       mptcp_skb_ext_copy(nskb, skb);
 
        TCP_SKB_CB(nskb)->seq = TCP_SKB_CB(skb)->seq;
        TCP_SKB_CB(nskb)->end_seq = TCP_SKB_CB(skb)->seq + probe_size;
index f65a3dd..177307a 100644 (file)
@@ -153,6 +153,7 @@ void tcp_rack_reo_timeout(struct sock *sk)
 {
        struct tcp_sock *tp = tcp_sk(sk);
        u32 timeout, prior_inflight;
+       u32 lost = tp->lost;
 
        prior_inflight = tcp_packets_in_flight(tp);
        tcp_rack_detect_loss(sk, &timeout);
@@ -160,7 +161,7 @@ void tcp_rack_reo_timeout(struct sock *sk)
                if (inet_csk(sk)->icsk_ca_state != TCP_CA_Recovery) {
                        tcp_enter_recovery(sk, false);
                        if (!inet_csk(sk)->icsk_ca_ops->cong_control)
-                               tcp_cwnd_reduction(sk, 1, 0);
+                               tcp_cwnd_reduction(sk, 1, tp->lost - lost, 0);
                }
                tcp_xmit_retransmit_queue(sk);
        }
index 09f0a23..c732f5a 100644 (file)
@@ -541,7 +541,7 @@ static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb,
                                 inet_sdif(skb), udptable, skb);
 }
 
-struct sock *udp4_lib_lookup_skb(struct sk_buff *skb,
+struct sock *udp4_lib_lookup_skb(const struct sk_buff *skb,
                                 __be16 sport, __be16 dport)
 {
        const struct iphdr *iph = ip_hdr(skb);
@@ -702,7 +702,7 @@ int __udp4_lib_err(struct sk_buff *skb, u32 info, struct udp_table *udptable)
        sk = __udp4_lib_lookup(net, iph->daddr, uh->dest,
                               iph->saddr, uh->source, skb->dev->ifindex,
                               inet_sdif(skb), udptable, NULL);
-       if (!sk) {
+       if (!sk || udp_sk(sk)->encap_type) {
                /* No socket for error: try tunnels before discarding */
                sk = ERR_PTR(-ENOENT);
                if (static_branch_unlikely(&udp_encap_needed_key)) {
@@ -874,7 +874,7 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4,
        struct sock *sk = skb->sk;
        struct inet_sock *inet = inet_sk(sk);
        struct udphdr *uh;
-       int err = 0;
+       int err;
        int is_udplite = IS_UDPLITE(sk);
        int offset = skb_transport_offset(skb);
        int len = skb->len - offset;
@@ -2038,6 +2038,9 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
                if (rc == -ENOMEM)
                        UDP_INC_STATS(sock_net(sk), UDP_MIB_RCVBUFERRORS,
                                        is_udplite);
+               else
+                       UDP_INC_STATS(sock_net(sk), UDP_MIB_MEMERRORS,
+                                     is_udplite);
                UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
                kfree_skb(skb);
                trace_udp_fail_queue_rcv_skb(rc, sk);
index 1dbece3..b2cee9a 100644 (file)
@@ -30,7 +30,7 @@ static int udp_dump_one(struct udp_table *tbl,
                        const struct inet_diag_req_v2 *req)
 {
        struct sk_buff *in_skb = cb->skb;
-       int err = -EINVAL;
+       int err;
        struct sock *sk = NULL;
        struct sk_buff *rep;
        struct net *net = sock_net(in_skb->sk);
index e67a66f..ff39e94 100644 (file)
@@ -49,6 +49,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb,
        __skb_pull(skb, tnl_hlen);
        skb_reset_mac_header(skb);
        skb_set_network_header(skb, skb_inner_network_offset(skb));
+       skb_set_transport_header(skb, skb_inner_transport_offset(skb));
        skb->mac_len = skb_inner_network_offset(skb);
        skb->protocol = new_protocol;
 
@@ -67,6 +68,8 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb,
                                      (NETIF_F_HW_CSUM | NETIF_F_IP_CSUM))));
 
        features &= skb->dev->hw_enc_features;
+       /* CRC checksum can't be handled by HW when it's a UDP tunneling packet. */
+       features &= ~NETIF_F_SCTP_CRC;
 
        /* The only checksum offload we care about from here on out is the
         * outer one so strip the existing checksum feature flags and
@@ -366,7 +369,7 @@ out:
 static struct sk_buff *udp_gro_receive_segment(struct list_head *head,
                                               struct sk_buff *skb)
 {
-       struct udphdr *uh = udp_hdr(skb);
+       struct udphdr *uh = udp_gro_udphdr(skb);
        struct sk_buff *pp = NULL;
        struct udphdr *uh2;
        struct sk_buff *p;
@@ -500,12 +503,22 @@ out:
 }
 EXPORT_SYMBOL(udp_gro_receive);
 
+static struct sock *udp4_gro_lookup_skb(struct sk_buff *skb, __be16 sport,
+                                       __be16 dport)
+{
+       const struct iphdr *iph = skb_gro_network_header(skb);
+
+       return __udp4_lib_lookup(dev_net(skb->dev), iph->saddr, sport,
+                                iph->daddr, dport, inet_iif(skb),
+                                inet_sdif(skb), &udp_table, NULL);
+}
+
 INDIRECT_CALLABLE_SCOPE
 struct sk_buff *udp4_gro_receive(struct list_head *head, struct sk_buff *skb)
 {
        struct udphdr *uh = udp_gro_udphdr(skb);
+       struct sock *sk = NULL;
        struct sk_buff *pp;
-       struct sock *sk;
 
        if (unlikely(!uh))
                goto flush;
@@ -523,7 +536,10 @@ struct sk_buff *udp4_gro_receive(struct list_head *head, struct sk_buff *skb)
 skip:
        NAPI_GRO_CB(skb)->is_ipv6 = 0;
        rcu_read_lock();
-       sk = static_branch_unlikely(&udp_encap_needed_key) ? udp4_lib_lookup_skb(skb, uh->source, uh->dest) : NULL;
+
+       if (static_branch_unlikely(&udp_encap_needed_key))
+               sk = udp4_gro_lookup_skb(skb, uh->source, uh->dest);
+
        pp = udp_gro_receive(head, skb, uh, sk);
        rcu_read_unlock();
        return pp;
@@ -551,8 +567,8 @@ int udp_gro_complete(struct sk_buff *skb, int nhoff,
 {
        __be16 newlen = htons(skb->len - nhoff);
        struct udphdr *uh = (struct udphdr *)(skb->data + nhoff);
-       int err = -ENOSYS;
        struct sock *sk;
+       int err;
 
        uh->len = newlen;
 
index dc19aff..fb0648e 100644 (file)
@@ -64,14 +64,14 @@ static int xfrm_tunnel_err(struct sk_buff *skb, u32 info)
 static struct xfrm_tunnel xfrm_tunnel_handler __read_mostly = {
        .handler        =       xfrm_tunnel_rcv,
        .err_handler    =       xfrm_tunnel_err,
-       .priority       =       3,
+       .priority       =       4,
 };
 
 #if IS_ENABLED(CONFIG_IPV6)
 static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = {
        .handler        =       xfrm_tunnel_rcv,
        .err_handler    =       xfrm_tunnel_err,
-       .priority       =       2,
+       .priority       =       3,
 };
 #endif
 
index 01146b6..4211e96 100644 (file)
@@ -1997,6 +1997,7 @@ EXPORT_SYMBOL(ipv6_chk_prefix);
  * ipv6_dev_find - find the first device with a given source address.
  * @net: the net namespace
  * @addr: the source address
+ * @dev: used to find the L3 domain of interest
  *
  * The caller should be protected by RCU, or RTNL.
  */
index 78f7660..51184a7 100644 (file)
@@ -423,7 +423,7 @@ static void calipso_doi_free_rcu(struct rcu_head *entry)
 /**
  * calipso_doi_remove - Remove an existing DOI from the CALIPSO protocol engine
  * @doi: the DOI value
- * @audit_secid: the LSM secid to use in the audit message
+ * @audit_info: NetLabel audit information
  *
  * Description:
  * Removes a DOI definition from the CALIPSO engine.  The NetLabel routines will
@@ -1226,7 +1226,7 @@ static int calipso_req_setattr(struct request_sock *req,
 
 /**
  * calipso_req_delattr - Delete the CALIPSO option from a request socket
- * @reg: the request socket
+ * @req: the request socket
  *
  * Description:
  * Removes the CALIPSO option from a request socket, if present.
index ec448b7..8956144 100644 (file)
@@ -158,7 +158,13 @@ static bool is_ineligible(const struct sk_buff *skb)
                tp = skb_header_pointer(skb,
                        ptr+offsetof(struct icmp6hdr, icmp6_type),
                        sizeof(_type), &_type);
-               if (!tp || !(*tp & ICMPV6_INFOMSG_MASK))
+
+               /* Based on RFC 8200, Section 4.5 Fragment Header, return
+                * false if this is a fragment packet with no icmp header info.
+                */
+               if (!tp && frag_off != 0)
+                       return false;
+               else if (!tp || !(*tp & ICMPV6_INFOMSG_MASK))
                        return true;
        }
        return false;
index 931b186..8cf6599 100644 (file)
@@ -1391,7 +1391,7 @@ static const struct net_device_ops ip6gre_netdev_ops = {
        .ndo_start_xmit         = ip6gre_tunnel_xmit,
        .ndo_do_ioctl           = ip6gre_tunnel_ioctl,
        .ndo_change_mtu         = ip6_tnl_change_mtu,
-       .ndo_get_stats64        = ip_tunnel_get_stats64,
+       .ndo_get_stats64        = dev_get_tstats64,
        .ndo_get_iflink         = ip6_tnl_get_iflink,
 };
 
@@ -1828,7 +1828,7 @@ static const struct net_device_ops ip6gre_tap_netdev_ops = {
        .ndo_set_mac_address = eth_mac_addr,
        .ndo_validate_addr = eth_validate_addr,
        .ndo_change_mtu = ip6_tnl_change_mtu,
-       .ndo_get_stats64 = ip_tunnel_get_stats64,
+       .ndo_get_stats64 = dev_get_tstats64,
        .ndo_get_iflink = ip6_tnl_get_iflink,
 };
 
@@ -1896,7 +1896,7 @@ static const struct net_device_ops ip6erspan_netdev_ops = {
        .ndo_set_mac_address =  eth_mac_addr,
        .ndo_validate_addr =    eth_validate_addr,
        .ndo_change_mtu =       ip6_tnl_change_mtu,
-       .ndo_get_stats64 =      ip_tunnel_get_stats64,
+       .ndo_get_stats64 =      dev_get_tstats64,
        .ndo_get_iflink =       ip6_tnl_get_iflink,
 };
 
index a0217e5..a7950ba 100644 (file)
@@ -94,36 +94,6 @@ static inline int ip6_tnl_mpls_supported(void)
        return IS_ENABLED(CONFIG_MPLS);
 }
 
-static struct net_device_stats *ip6_get_stats(struct net_device *dev)
-{
-       struct pcpu_sw_netstats tmp, sum = { 0 };
-       int i;
-
-       for_each_possible_cpu(i) {
-               unsigned int start;
-               const struct pcpu_sw_netstats *tstats =
-                                                  per_cpu_ptr(dev->tstats, i);
-
-               do {
-                       start = u64_stats_fetch_begin_irq(&tstats->syncp);
-                       tmp.rx_packets = tstats->rx_packets;
-                       tmp.rx_bytes = tstats->rx_bytes;
-                       tmp.tx_packets = tstats->tx_packets;
-                       tmp.tx_bytes =  tstats->tx_bytes;
-               } while (u64_stats_fetch_retry_irq(&tstats->syncp, start));
-
-               sum.rx_packets += tmp.rx_packets;
-               sum.rx_bytes   += tmp.rx_bytes;
-               sum.tx_packets += tmp.tx_packets;
-               sum.tx_bytes   += tmp.tx_bytes;
-       }
-       dev->stats.rx_packets = sum.rx_packets;
-       dev->stats.rx_bytes   = sum.rx_bytes;
-       dev->stats.tx_packets = sum.tx_packets;
-       dev->stats.tx_bytes   = sum.tx_bytes;
-       return &dev->stats;
-}
-
 #define for_each_ip6_tunnel_rcu(start) \
        for (t = rcu_dereference(start); t; t = rcu_dereference(t->next))
 
@@ -204,6 +174,7 @@ ip6_tnl_lookup(struct net *net, int link,
 
 /**
  * ip6_tnl_bucket - get head of list matching given tunnel parameters
+ *   @ip6n: the private data for ip6_vti in the netns
  *   @p: parameters containing tunnel end-points
  *
  * Description:
@@ -230,6 +201,7 @@ ip6_tnl_bucket(struct ip6_tnl_net *ip6n, const struct __ip6_tnl_parm *p)
 
 /**
  * ip6_tnl_link - add tunnel to hash table
+ *   @ip6n: the private data for ip6_vti in the netns
  *   @t: tunnel to be added
  **/
 
@@ -246,6 +218,7 @@ ip6_tnl_link(struct ip6_tnl_net *ip6n, struct ip6_tnl *t)
 
 /**
  * ip6_tnl_unlink - remove tunnel from hash table
+ *   @ip6n: the private data for ip6_vti in the netns
  *   @t: tunnel to be removed
  **/
 
@@ -417,6 +390,7 @@ ip6_tnl_dev_uninit(struct net_device *dev)
 /**
  * parse_tvl_tnl_enc_lim - handle encapsulation limit option
  *   @skb: received socket buffer
+ *   @raw: the ICMPv6 error message data
  *
  * Return:
  *   0 if none was found,
@@ -485,14 +459,9 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw)
 }
 EXPORT_SYMBOL(ip6_tnl_parse_tlv_enc_lim);
 
-/**
- * ip6_tnl_err - tunnel error handler
- *
- * Description:
- *   ip6_tnl_err() should handle errors in the tunnel according
- *   to the specifications in RFC 2473.
- **/
-
+/* ip6_tnl_err() should handle errors in the tunnel according to the
+ * specifications in RFC 2473.
+ */
 static int
 ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
            u8 *type, u8 *code, int *msg, __u32 *info, int offset)
@@ -1271,6 +1240,8 @@ route_lookup:
        if (max_headroom > dev->needed_headroom)
                dev->needed_headroom = max_headroom;
 
+       skb_set_inner_ipproto(skb, proto);
+
        err = ip6_tnl_encap(skb, t, &proto, fl6);
        if (err)
                return err;
@@ -1280,8 +1251,6 @@ route_lookup:
                ipv6_push_frag_opts(skb, &opt.ops, &proto);
        }
 
-       skb_set_inner_ipproto(skb, proto);
-
        skb_push(skb, sizeof(struct ipv6hdr));
        skb_reset_network_header(skb);
        ipv6h = ipv6_hdr(skb);
@@ -1835,7 +1804,7 @@ static const struct net_device_ops ip6_tnl_netdev_ops = {
        .ndo_start_xmit = ip6_tnl_start_xmit,
        .ndo_do_ioctl   = ip6_tnl_ioctl,
        .ndo_change_mtu = ip6_tnl_change_mtu,
-       .ndo_get_stats  = ip6_get_stats,
+       .ndo_get_stats64 = dev_get_tstats64,
        .ndo_get_iflink = ip6_tnl_get_iflink,
 };
 
index 5f9c4fd..0225fd6 100644 (file)
@@ -125,6 +125,7 @@ vti6_tnl_lookup(struct net *net, const struct in6_addr *remote,
 
 /**
  * vti6_tnl_bucket - get head of list matching given tunnel parameters
+ *   @ip6n: the private data for ip6_vti in the netns
  *   @p: parameters containing tunnel end-points
  *
  * Description:
@@ -889,7 +890,7 @@ static const struct net_device_ops vti6_netdev_ops = {
        .ndo_uninit     = vti6_dev_uninit,
        .ndo_start_xmit = vti6_tnl_xmit,
        .ndo_do_ioctl   = vti6_ioctl,
-       .ndo_get_stats64 = ip_tunnel_get_stats64,
+       .ndo_get_stats64 = dev_get_tstats64,
        .ndo_get_iflink = ip6_tnl_get_iflink,
 };
 
index 8cd2782..6c86043 100644 (file)
@@ -548,7 +548,7 @@ done:
 }
 
 int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
-       struct sockaddr_storage *p)
+                 struct sockaddr_storage __user *p)
 {
        int err, i, count, copycount;
        const struct in6_addr *group;
index 6d0e942..ab9a279 100644 (file)
 #include <net/netfilter/ipv6/nf_defrag_ipv6.h>
 #include "../bridge/br_private.h"
 
-int ip6_route_me_harder(struct net *net, struct sk_buff *skb)
+int ip6_route_me_harder(struct net *net, struct sock *sk_partial, struct sk_buff *skb)
 {
        const struct ipv6hdr *iph = ipv6_hdr(skb);
-       struct sock *sk = sk_to_full_sk(skb->sk);
+       struct sock *sk = sk_to_full_sk(sk_partial);
        unsigned int hh_len;
        struct dst_entry *dst;
        int strict = (ipv6_addr_type(&iph->daddr) &
@@ -84,7 +84,7 @@ static int nf_ip6_reroute(struct sk_buff *skb,
                if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) ||
                    !ipv6_addr_equal(&iph->saddr, &rt_info->saddr) ||
                    skb->mark != rt_info->mark)
-                       return ip6_route_me_harder(entry->state.net, skb);
+                       return ip6_route_me_harder(entry->state.net, entry->state.sk, skb);
        }
        return 0;
 }
index 1a27486..cee7480 100644 (file)
@@ -57,7 +57,7 @@ ip6t_mangle_out(struct sk_buff *skb, const struct nf_hook_state *state)
             skb->mark != mark ||
             ipv6_hdr(skb)->hop_limit != hop_limit ||
             flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) {
-               err = ip6_route_me_harder(state->net, skb);
+               err = ip6_route_me_harder(state->net, state->sk, skb);
                if (err < 0)
                        ret = NF_DROP_ERR(err);
        }
index 4aef6ba..aa35e6e 100644 (file)
 #include <linux/netfilter_ipv6.h>
 #include <linux/netfilter_bridge.h>
 
+static bool nf_reject_v6_csum_ok(struct sk_buff *skb, int hook)
+{
+       const struct ipv6hdr *ip6h = ipv6_hdr(skb);
+       int thoff;
+       __be16 fo;
+       u8 proto = ip6h->nexthdr;
+
+       if (skb_csum_unnecessary(skb))
+               return true;
+
+       if (ip6h->payload_len &&
+           pskb_trim_rcsum(skb, ntohs(ip6h->payload_len) + sizeof(*ip6h)))
+               return false;
+
+       ip6h = ipv6_hdr(skb);
+       thoff = ipv6_skip_exthdr(skb, ((u8*)(ip6h+1) - skb->data), &proto, &fo);
+       if (thoff < 0 || thoff >= skb->len || (fo & htons(~0x7)) != 0)
+               return false;
+
+       if (!nf_reject_verify_csum(proto))
+               return true;
+
+       return nf_ip6_checksum(skb, hook, thoff, proto) == 0;
+}
+
+static int nf_reject_ip6hdr_validate(struct sk_buff *skb)
+{
+       struct ipv6hdr *hdr;
+       u32 pkt_len;
+
+       if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
+               return 0;
+
+       hdr = ipv6_hdr(skb);
+       if (hdr->version != 6)
+               return 0;
+
+       pkt_len = ntohs(hdr->payload_len);
+       if (pkt_len + sizeof(struct ipv6hdr) > skb->len)
+               return 0;
+
+       return 1;
+}
+
+struct sk_buff *nf_reject_skb_v6_tcp_reset(struct net *net,
+                                          struct sk_buff *oldskb,
+                                          const struct net_device *dev,
+                                          int hook)
+{
+       struct sk_buff *nskb;
+       const struct tcphdr *oth;
+       struct tcphdr _oth;
+       unsigned int otcplen;
+       struct ipv6hdr *nip6h;
+
+       if (!nf_reject_ip6hdr_validate(oldskb))
+               return NULL;
+
+       oth = nf_reject_ip6_tcphdr_get(oldskb, &_oth, &otcplen, hook);
+       if (!oth)
+               return NULL;
+
+       nskb = alloc_skb(sizeof(struct ipv6hdr) + sizeof(struct tcphdr) +
+                        LL_MAX_HEADER, GFP_ATOMIC);
+       if (!nskb)
+               return NULL;
+
+       nskb->dev = (struct net_device *)dev;
+
+       skb_reserve(nskb, LL_MAX_HEADER);
+       nip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_TCP,
+                                    net->ipv6.devconf_all->hop_limit);
+       nf_reject_ip6_tcphdr_put(nskb, oldskb, oth, otcplen);
+       nip6h->payload_len = htons(nskb->len - sizeof(struct ipv6hdr));
+
+       return nskb;
+}
+EXPORT_SYMBOL_GPL(nf_reject_skb_v6_tcp_reset);
+
+struct sk_buff *nf_reject_skb_v6_unreach(struct net *net,
+                                        struct sk_buff *oldskb,
+                                        const struct net_device *dev,
+                                        int hook, u8 code)
+{
+       struct sk_buff *nskb;
+       struct ipv6hdr *nip6h;
+       struct icmp6hdr *icmp6h;
+       unsigned int len;
+
+       if (!nf_reject_ip6hdr_validate(oldskb))
+               return NULL;
+
+       /* Include "As much of invoking packet as possible without the ICMPv6
+        * packet exceeding the minimum IPv6 MTU" in the ICMP payload.
+        */
+       len = min_t(unsigned int, 1220, oldskb->len);
+
+       if (!pskb_may_pull(oldskb, len))
+               return NULL;
+
+       if (!nf_reject_v6_csum_ok(oldskb, hook))
+               return NULL;
+
+       nskb = alloc_skb(sizeof(struct ipv6hdr) + sizeof(struct icmp6hdr) +
+                        LL_MAX_HEADER + len, GFP_ATOMIC);
+       if (!nskb)
+               return NULL;
+
+       nskb->dev = (struct net_device *)dev;
+
+       skb_reserve(nskb, LL_MAX_HEADER);
+       nip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_ICMPV6,
+                                    net->ipv6.devconf_all->hop_limit);
+
+       skb_reset_transport_header(nskb);
+       icmp6h = skb_put_zero(nskb, sizeof(struct icmp6hdr));
+       icmp6h->icmp6_type = ICMPV6_DEST_UNREACH;
+       icmp6h->icmp6_code = code;
+
+       skb_put_data(nskb, skb_network_header(oldskb), len);
+       nip6h->payload_len = htons(nskb->len - sizeof(struct ipv6hdr));
+
+       icmp6h->icmp6_cksum =
+               csum_ipv6_magic(&nip6h->saddr, &nip6h->daddr,
+                               nskb->len - sizeof(struct ipv6hdr),
+                               IPPROTO_ICMPV6,
+                               csum_partial(icmp6h,
+                                            nskb->len - sizeof(struct ipv6hdr),
+                                            0));
+
+       return nskb;
+}
+EXPORT_SYMBOL_GPL(nf_reject_skb_v6_unreach);
+
 const struct tcphdr *nf_reject_ip6_tcphdr_get(struct sk_buff *oldskb,
                                              struct tcphdr *otcph,
                                              unsigned int *otcplen, int hook)
@@ -170,7 +304,7 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook)
        fl6.fl6_sport = otcph->dest;
        fl6.fl6_dport = otcph->source;
 
-       if (hook == NF_INET_PRE_ROUTING) {
+       if (hook == NF_INET_PRE_ROUTING || hook == NF_INET_INGRESS) {
                nf_ip6_route(net, &dst, flowi6_to_flowi(&fl6), false);
                if (!dst)
                        return;
@@ -268,7 +402,8 @@ void nf_send_unreach6(struct net *net, struct sk_buff *skb_in,
        if (hooknum == NF_INET_LOCAL_OUT && skb_in->dev == NULL)
                skb_in->dev = net->loopback_dev;
 
-       if (hooknum == NF_INET_PRE_ROUTING && nf_reject6_fill_skb_dst(skb_in))
+       if ((hooknum == NF_INET_PRE_ROUTING || hooknum == NF_INET_INGRESS) &&
+           nf_reject6_fill_skb_dst(skb_in) < 0)
                return;
 
        icmpv6_send(skb_in, ICMPV6_DEST_UNREACH, code, 0);
index bbff3e0..d6306aa 100644 (file)
@@ -126,6 +126,7 @@ static const struct snmp_mib snmp6_udp6_list[] = {
        SNMP_MIB_ITEM("Udp6SndbufErrors", UDP_MIB_SNDBUFERRORS),
        SNMP_MIB_ITEM("Udp6InCsumErrors", UDP_MIB_CSUMERRORS),
        SNMP_MIB_ITEM("Udp6IgnoredMulti", UDP_MIB_IGNOREDMULTI),
+       SNMP_MIB_ITEM("Udp6MemErrors", UDP_MIB_MEMERRORS),
        SNMP_MIB_SENTINEL
 };
 
@@ -137,6 +138,7 @@ static const struct snmp_mib snmp6_udplite6_list[] = {
        SNMP_MIB_ITEM("UdpLite6RcvbufErrors", UDP_MIB_RCVBUFERRORS),
        SNMP_MIB_ITEM("UdpLite6SndbufErrors", UDP_MIB_SNDBUFERRORS),
        SNMP_MIB_ITEM("UdpLite6InCsumErrors", UDP_MIB_CSUMERRORS),
+       SNMP_MIB_ITEM("UdpLite6MemErrors", UDP_MIB_MEMERRORS),
        SNMP_MIB_SENTINEL
 };
 
index 1f5d4d1..c8cf1bb 100644 (file)
@@ -42,6 +42,8 @@
 #include <linux/skbuff.h>
 #include <linux/slab.h>
 #include <linux/export.h>
+#include <linux/tcp.h>
+#include <linux/udp.h>
 
 #include <net/sock.h>
 #include <net/snmp.h>
@@ -322,7 +324,9 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
        struct frag_queue *fq;
        const struct ipv6hdr *hdr = ipv6_hdr(skb);
        struct net *net = dev_net(skb_dst(skb)->dev);
-       int iif;
+       __be16 frag_off;
+       int iif, offset;
+       u8 nexthdr;
 
        if (IP6CB(skb)->flags & IP6SKB_FRAGMENTED)
                goto fail_hdr;
@@ -351,6 +355,33 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
                return 1;
        }
 
+       /* RFC 8200, Section 4.5 Fragment Header:
+        * If the first fragment does not include all headers through an
+        * Upper-Layer header, then that fragment should be discarded and
+        * an ICMP Parameter Problem, Code 3, message should be sent to
+        * the source of the fragment, with the Pointer field set to zero.
+        */
+       nexthdr = hdr->nexthdr;
+       offset = ipv6_skip_exthdr(skb, skb_transport_offset(skb), &nexthdr, &frag_off);
+       if (offset >= 0) {
+               /* Check some common protocols' header */
+               if (nexthdr == IPPROTO_TCP)
+                       offset += sizeof(struct tcphdr);
+               else if (nexthdr == IPPROTO_UDP)
+                       offset += sizeof(struct udphdr);
+               else if (nexthdr == IPPROTO_ICMPV6)
+                       offset += sizeof(struct icmp6hdr);
+               else
+                       offset += 1;
+
+               if (!(frag_off & htons(IP6_OFFSET)) && offset > skb->len) {
+                       __IP6_INC_STATS(net, __in6_dev_get_safely(skb->dev),
+                                       IPSTATS_MIB_INHDRERRORS);
+                       icmpv6_param_prob(skb, ICMPV6_HDR_INCOMP, 0);
+                       return -1;
+               }
+       }
+
        iif = skb->dev ? skb->dev->ifindex : 0;
        fq = fq_find(net, fhdr->identification, hdr, iif);
        if (fq) {
index 7e0ce7a..f91a689 100644 (file)
@@ -6039,11 +6039,6 @@ void fib6_rt_update(struct net *net, struct fib6_info *rt,
        struct sk_buff *skb;
        int err = -ENOBUFS;
 
-       /* call_fib6_entry_notifiers will be removed when in-kernel notifier
-        * is implemented and supported for nexthop objects
-        */
-       call_fib6_entry_notifiers(net, FIB_EVENT_ENTRY_REPLACE, rt, NULL);
-
        skb = nlmsg_new(rt6_nlmsg_size(rt), gfp_any());
        if (!skb)
                goto errout;
index 307f336..488aec9 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/**
+/*
  * Authors:
  * (C) 2020 Alexander Aring <alex.aring@gmail.com>
  */
index 5fdf3eb..233da43 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/**
+/*
  * Authors:
  * (C) 2020 Alexander Aring <alex.aring@gmail.com>
  */
index 5e2c34c..2da0ee7 100644 (file)
@@ -1128,7 +1128,6 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev)
        if (tdev && !netif_is_l3_master(tdev)) {
                int t_hlen = tunnel->hlen + sizeof(struct iphdr);
 
-               dev->hard_header_len = tdev->hard_header_len + sizeof(struct iphdr);
                dev->mtu = tdev->mtu - t_hlen;
                if (dev->mtu < IPV6_MIN_MTU)
                        dev->mtu = IPV6_MIN_MTU;
@@ -1396,7 +1395,7 @@ static const struct net_device_ops ipip6_netdev_ops = {
        .ndo_uninit     = ipip6_tunnel_uninit,
        .ndo_start_xmit = sit_tunnel_xmit,
        .ndo_do_ioctl   = ipip6_tunnel_ioctl,
-       .ndo_get_stats64 = ip_tunnel_get_stats64,
+       .ndo_get_stats64 = dev_get_tstats64,
        .ndo_get_iflink = ip_tunnel_get_iflink,
        .ndo_tunnel_ctl = ipip6_tunnel_ctl,
 };
@@ -1426,7 +1425,6 @@ static void ipip6_tunnel_setup(struct net_device *dev)
        dev->priv_destructor    = ipip6_dev_free;
 
        dev->type               = ARPHRD_SIT;
-       dev->hard_header_len    = LL_MAX_HEADER + t_hlen;
        dev->mtu                = ETH_DATA_LEN - t_hlen;
        dev->min_mtu            = IPV6_MIN_MTU;
        dev->max_mtu            = IP6_MAX_MTU - t_hlen;
index e796a64..9b6cae1 100644 (file)
@@ -136,7 +136,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
        __u32 cookie = ntohl(th->ack_seq) - 1;
        struct sock *ret = sk;
        struct request_sock *req;
-       int mss;
+       int full_space, mss;
        struct dst_entry *dst;
        __u8 rcv_wscale;
        u32 tsoff = 0;
@@ -241,7 +241,13 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
        }
 
        req->rsk_window_clamp = tp->window_clamp ? :dst_metric(dst, RTAX_WINDOW);
-       tcp_select_initial_window(sk, tcp_full_space(sk), req->mss,
+       /* limit the window selection if the user enforce a smaller rx buffer */
+       full_space = tcp_full_space(sk);
+       if (sk->sk_userlocks & SOCK_RCVBUF_LOCK &&
+           (req->rsk_window_clamp > full_space || req->rsk_window_clamp == 0))
+               req->rsk_window_clamp = full_space;
+
+       tcp_select_initial_window(sk, full_space, req->mss,
                                  &req->rsk_rcv_wnd, &req->rsk_window_clamp,
                                  ireq->wscale_ok, &rcv_wscale,
                                  dst_metric(dst, RTAX_INITRWND));
index 29d9691..e152f80 100644 (file)
@@ -276,7 +276,7 @@ static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb,
                                 inet6_sdif(skb), udptable, skb);
 }
 
-struct sock *udp6_lib_lookup_skb(struct sk_buff *skb,
+struct sock *udp6_lib_lookup_skb(const struct sk_buff *skb,
                                 __be16 sport, __be16 dport)
 {
        const struct ipv6hdr *iph = ipv6_hdr(skb);
@@ -560,7 +560,7 @@ int __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 
        sk = __udp6_lib_lookup(net, daddr, uh->dest, saddr, uh->source,
                               inet6_iif(skb), inet6_sdif(skb), udptable, NULL);
-       if (!sk) {
+       if (!sk || udp_sk(sk)->encap_type) {
                /* No socket for error: try tunnels before discarding */
                sk = ERR_PTR(-ENOENT);
                if (static_branch_unlikely(&udpv6_encap_needed_key)) {
@@ -637,6 +637,9 @@ static int __udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
                if (rc == -ENOMEM)
                        UDP6_INC_STATS(sock_net(sk),
                                         UDP_MIB_RCVBUFERRORS, is_udplite);
+               else
+                       UDP6_INC_STATS(sock_net(sk),
+                                      UDP_MIB_MEMERRORS, is_udplite);
                UDP6_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
                kfree_skb(skb);
                return -1;
index 584157a..c7bd7b1 100644 (file)
@@ -28,10 +28,6 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
        int tnl_hlen;
        int err;
 
-       mss = skb_shinfo(skb)->gso_size;
-       if (unlikely(skb->len <= mss))
-               goto out;
-
        if (skb->encapsulation && skb_shinfo(skb)->gso_type &
            (SKB_GSO_UDP_TUNNEL|SKB_GSO_UDP_TUNNEL_CSUM))
                segs = skb_udp_tunnel_segment(skb, features, true);
@@ -48,6 +44,10 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
                if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)
                        return __udp_gso_segment(skb, features);
 
+               mss = skb_shinfo(skb)->gso_size;
+               if (unlikely(skb->len <= mss))
+                       goto out;
+
                /* Do software UFO. Complete and fill in the UDP checksum as HW cannot
                 * do checksum of UDP packets sent as multiple IP fragments.
                 */
@@ -111,12 +111,22 @@ out:
        return segs;
 }
 
+static struct sock *udp6_gro_lookup_skb(struct sk_buff *skb, __be16 sport,
+                                       __be16 dport)
+{
+       const struct ipv6hdr *iph = skb_gro_network_header(skb);
+
+       return __udp6_lib_lookup(dev_net(skb->dev), &iph->saddr, sport,
+                                &iph->daddr, dport, inet6_iif(skb),
+                                inet6_sdif(skb), &udp_table, NULL);
+}
+
 INDIRECT_CALLABLE_SCOPE
 struct sk_buff *udp6_gro_receive(struct list_head *head, struct sk_buff *skb)
 {
        struct udphdr *uh = udp_gro_udphdr(skb);
+       struct sock *sk = NULL;
        struct sk_buff *pp;
-       struct sock *sk;
 
        if (unlikely(!uh))
                goto flush;
@@ -135,7 +145,10 @@ struct sk_buff *udp6_gro_receive(struct list_head *head, struct sk_buff *skb)
 skip:
        NAPI_GRO_CB(skb)->is_ipv6 = 1;
        rcu_read_lock();
-       sk = static_branch_unlikely(&udpv6_encap_needed_key) ? udp6_lib_lookup_skb(skb, uh->source, uh->dest) : NULL;
+
+       if (static_branch_unlikely(&udpv6_encap_needed_key))
+               sk = udp6_gro_lookup_skb(skb, uh->source, uh->dest);
+
        pp = udp_gro_receive(head, skb, uh, sk);
        rcu_read_unlock();
        return pp;
index 25b7ebd..f696d46 100644 (file)
@@ -303,13 +303,13 @@ static const struct xfrm_type xfrm6_tunnel_type = {
 static struct xfrm6_tunnel xfrm6_tunnel_handler __read_mostly = {
        .handler        = xfrm6_tunnel_rcv,
        .err_handler    = xfrm6_tunnel_err,
-       .priority       = 2,
+       .priority       = 3,
 };
 
 static struct xfrm6_tunnel xfrm46_tunnel_handler __read_mostly = {
        .handler        = xfrm6_tunnel_rcv,
        .err_handler    = xfrm6_tunnel_err,
-       .priority       = 2,
+       .priority       = 3,
 };
 
 static int __net_init xfrm6_tunnel_net_init(struct net *net)
index d805720..047238f 100644 (file)
@@ -1434,7 +1434,8 @@ static int iucv_sock_shutdown(struct socket *sock, int how)
                break;
        }
 
-       if (how == SEND_SHUTDOWN || how == SHUTDOWN_MASK) {
+       if ((how == SEND_SHUTDOWN || how == SHUTDOWN_MASK) &&
+           sk->sk_state == IUCV_CONNECTED) {
                if (iucv->transport == AF_IUCV_TRANS_IUCV) {
                        txmsg.class = 0;
                        txmsg.tag = 0;
index 864326f..ad7730b 100644 (file)
@@ -241,6 +241,7 @@ EXPORT_SYMBOL_GPL(l3mdev_link_scope_lookup);
  *                             L3 master device
  *     @net: network namespace for device index lookup
  *     @fl:  flow struct
+ *     @arg: store the table the rule matched with here
  */
 
 int l3mdev_fib_rule_match(struct net *net, struct flowi *fl,
index 1144cda..912aa9b 100644 (file)
@@ -909,6 +909,8 @@ static void llc_sk_init(struct sock *sk)
  *     @net: network namespace
  *     @family: upper layer protocol family
  *     @priority: for allocation (%GFP_KERNEL, %GFP_ATOMIC, etc)
+ *     @prot: struct proto associated with this new sock instance
+ *     @kern: is this to be a kernel socket?
  *
  *     Allocates a LLC sock and initializes it. Returns the new LLC sock
  *     or %NULL if there's no memory available for one
index 7276e66..454432c 100644 (file)
@@ -2708,16 +2708,6 @@ static int ieee80211_get_tx_power(struct wiphy *wiphy,
        return 0;
 }
 
-static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
-                                 const u8 *addr)
-{
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-
-       memcpy(&sdata->u.wds.remote_addr, addr, ETH_ALEN);
-
-       return 0;
-}
-
 static void ieee80211_rfkill_poll(struct wiphy *wiphy)
 {
        struct ieee80211_local *local = wiphy_priv(wiphy);
@@ -4138,7 +4128,6 @@ const struct cfg80211_ops mac80211_config_ops = {
        .set_wiphy_params = ieee80211_set_wiphy_params,
        .set_tx_power = ieee80211_set_tx_power,
        .get_tx_power = ieee80211_get_tx_power,
-       .set_wds_peer = ieee80211_set_wds_peer,
        .rfkill_poll = ieee80211_rfkill_poll,
        CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
        CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump)
index 8f48aff..b6c80a4 100644 (file)
@@ -275,11 +275,11 @@ ieee80211_get_chanctx_max_required_bw(struct ieee80211_local *local,
                case NL80211_IFTYPE_NAN:
                        continue;
                case NL80211_IFTYPE_ADHOC:
-               case NL80211_IFTYPE_WDS:
                case NL80211_IFTYPE_MESH_POINT:
                case NL80211_IFTYPE_OCB:
                        width = vif->bss_conf.chandef.width;
                        break;
+               case NL80211_IFTYPE_WDS:
                case NL80211_IFTYPE_UNSPECIFIED:
                case NUM_NL80211_IFTYPES:
                case NL80211_IFTYPE_MONITOR:
@@ -743,7 +743,6 @@ void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
                        continue;
                case NL80211_IFTYPE_AP:
                case NL80211_IFTYPE_ADHOC:
-               case NL80211_IFTYPE_WDS:
                case NL80211_IFTYPE_MESH_POINT:
                case NL80211_IFTYPE_OCB:
                        break;
index fe8a7a8..9fc8ce2 100644 (file)
@@ -574,9 +574,6 @@ static ssize_t ieee80211_if_parse_tsf(
 IEEE80211_IF_FILE_RW(tsf);
 
 
-/* WDS attributes */
-IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC);
-
 #ifdef CONFIG_MAC80211_MESH
 IEEE80211_IF_FILE(estab_plinks, u.mesh.estab_plinks, ATOMIC);
 
@@ -701,11 +698,6 @@ static void add_ibss_files(struct ieee80211_sub_if_data *sdata)
        DEBUGFS_ADD_MODE(tsf, 0600);
 }
 
-static void add_wds_files(struct ieee80211_sub_if_data *sdata)
-{
-       DEBUGFS_ADD(peer);
-}
-
 #ifdef CONFIG_MAC80211_MESH
 
 static void add_mesh_files(struct ieee80211_sub_if_data *sdata)
@@ -805,9 +797,6 @@ static void add_files(struct ieee80211_sub_if_data *sdata)
        case NL80211_IFTYPE_AP_VLAN:
                add_vlan_files(sdata);
                break;
-       case NL80211_IFTYPE_WDS:
-               add_wds_files(sdata);
-               break;
        default:
                break;
        }
index 829dcad..6a51b8b 100644 (file)
@@ -274,7 +274,7 @@ static ssize_t sta_aql_read(struct file *file, char __user *userbuf,
                "Q limit[low/high]: VO: %u/%u VI: %u/%u BE: %u/%u BK: %u/%u\n",
                q_depth[0], q_depth[1], q_depth[2], q_depth[3],
                q_limit_l[0], q_limit_h[0], q_limit_l[1], q_limit_h[1],
-               q_limit_l[2], q_limit_h[2], q_limit_l[3], q_limit_h[3]),
+               q_limit_l[2], q_limit_h[2], q_limit_l[3], q_limit_h[3]);
 
        rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
        kfree(buf);
index 2a21226..cde2e3f 100644 (file)
@@ -311,11 +311,6 @@ struct ieee80211_if_ap {
        bool multicast_to_unicast;
 };
 
-struct ieee80211_if_wds {
-       struct sta_info *sta;
-       u8 remote_addr[ETH_ALEN];
-};
-
 struct ieee80211_if_vlan {
        struct list_head list; /* write-protected with RTNL and local->mtx */
 
@@ -985,7 +980,6 @@ struct ieee80211_sub_if_data {
 
        union {
                struct ieee80211_if_ap ap;
-               struct ieee80211_if_wds wds;
                struct ieee80211_if_vlan vlan;
                struct ieee80211_if_managed mgd;
                struct ieee80211_if_ibss ibss;
@@ -1795,7 +1789,7 @@ static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
 
 /* tx handling */
 void ieee80211_clear_tx_pending(struct ieee80211_local *local);
-void ieee80211_tx_pending(unsigned long data);
+void ieee80211_tx_pending(struct tasklet_struct *t);
 netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
                                         struct net_device *dev);
 netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
@@ -2146,7 +2140,7 @@ void ieee80211_txq_remove_vlan(struct ieee80211_local *local,
                               struct ieee80211_sub_if_data *sdata);
 void ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats,
                              struct txq_info *txqi);
-void ieee80211_wake_txqs(unsigned long data);
+void ieee80211_wake_txqs(struct tasklet_struct *t);
 void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
                         u16 transaction, u16 auth_alg, u16 status,
                         const u8 *extra, size_t extra_len, const u8 *bssid,
index 1be7759..f5d4ceb 100644 (file)
@@ -230,10 +230,6 @@ static inline int identical_mac_addr_allowed(int type1, int type2)
                type2 == NL80211_IFTYPE_MONITOR ||
                type1 == NL80211_IFTYPE_P2P_DEVICE ||
                type2 == NL80211_IFTYPE_P2P_DEVICE ||
-               (type1 == NL80211_IFTYPE_AP && type2 == NL80211_IFTYPE_WDS) ||
-               (type1 == NL80211_IFTYPE_WDS &&
-                       (type2 == NL80211_IFTYPE_WDS ||
-                        type2 == NL80211_IFTYPE_AP)) ||
                (type1 == NL80211_IFTYPE_AP && type2 == NL80211_IFTYPE_AP_VLAN) ||
                (type1 == NL80211_IFTYPE_AP_VLAN &&
                        (type2 == NL80211_IFTYPE_AP ||
@@ -417,15 +413,12 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
         * (because if we remove a STA after ops->remove_interface()
         * the driver will have removed the vif info already!)
         *
-        * In WDS mode a station must exist here and be flushed, for
-        * AP_VLANs stations may exist since there's nothing else that
+        * For AP_VLANs stations may exist since there's nothing else that
         * would have removed them, but in other modes there shouldn't
         * be any stations.
         */
        flushed = sta_info_flush(sdata);
-       WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
-                    ((sdata->vif.type != NL80211_IFTYPE_WDS && flushed > 0) ||
-                     (sdata->vif.type == NL80211_IFTYPE_WDS && flushed != 1)));
+       WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_AP_VLAN && flushed > 0);
 
        /* don't count this interface for allmulti while it is down */
        if (sdata->flags & IEEE80211_SDATA_ALLMULTI)
@@ -552,8 +545,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
                 * When we get here, the interface is marked down.
                 * Free the remaining keys, if there are any
                 * (which can happen in AP mode if userspace sets
-                * keys before the interface is operating, and maybe
-                * also in WDS mode)
+                * keys before the interface is operating)
                 *
                 * Force the key freeing to always synchronize_net()
                 * to wait for the RX path in case it is using this
@@ -1020,16 +1012,11 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
        struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
        struct net_device *dev = wdev->netdev;
        struct ieee80211_local *local = sdata->local;
-       struct sta_info *sta;
        u32 changed = 0;
        int res;
        u32 hw_reconf_flags = 0;
 
        switch (sdata->vif.type) {
-       case NL80211_IFTYPE_WDS:
-               if (!is_valid_ether_addr(sdata->u.wds.remote_addr))
-                       return -ENOLINK;
-               break;
        case NL80211_IFTYPE_AP_VLAN: {
                struct ieee80211_sub_if_data *master;
 
@@ -1078,6 +1065,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
        case NUM_NL80211_IFTYPES:
        case NL80211_IFTYPE_P2P_CLIENT:
        case NL80211_IFTYPE_P2P_GO:
+       case NL80211_IFTYPE_WDS:
                /* cannot happen */
                WARN_ON(1);
                break;
@@ -1196,7 +1184,6 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
                case NL80211_IFTYPE_OCB:
                        netif_carrier_off(dev);
                        break;
-               case NL80211_IFTYPE_WDS:
                case NL80211_IFTYPE_P2P_DEVICE:
                case NL80211_IFTYPE_NAN:
                        break;
@@ -1218,28 +1205,6 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
        set_bit(SDATA_STATE_RUNNING, &sdata->state);
 
        switch (sdata->vif.type) {
-       case NL80211_IFTYPE_WDS:
-               /* Create STA entry for the WDS peer */
-               sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
-                                    GFP_KERNEL);
-               if (!sta) {
-                       res = -ENOMEM;
-                       goto err_del_interface;
-               }
-
-               sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
-               sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
-               sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
-
-               res = sta_info_insert(sta);
-               if (res) {
-                       /* STA has been freed */
-                       goto err_del_interface;
-               }
-
-               rate_control_rate_init(sta);
-               netif_carrier_on(dev);
-               break;
        case NL80211_IFTYPE_P2P_DEVICE:
                rcu_assign_pointer(local->p2p_sdata, sdata);
                break;
@@ -1356,6 +1321,7 @@ static void ieee80211_iface_work(struct work_struct *work)
        while ((skb = skb_dequeue(&sdata->skb_queue))) {
                struct ieee80211_mgmt *mgmt = (void *)skb->data;
 
+               kcov_remote_start_common(skb_get_kcov_handle(skb));
                if (ieee80211_is_action(mgmt->frame_control) &&
                    mgmt->u.action.category == WLAN_CATEGORY_BACK) {
                        int len = skb->len;
@@ -1465,6 +1431,7 @@ static void ieee80211_iface_work(struct work_struct *work)
                }
 
                kfree_skb(skb);
+               kcov_remote_stop();
        }
 
        /* then other type-dependent work */
@@ -1574,9 +1541,6 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
                sdata->u.mntr.flags = MONITOR_FLAG_CONTROL |
                                      MONITOR_FLAG_OTHER_BSS;
                break;
-       case NL80211_IFTYPE_WDS:
-               sdata->vif.bss_conf.bssid = NULL;
-               break;
        case NL80211_IFTYPE_NAN:
                idr_init(&sdata->u.nan.function_inst_ids);
                spin_lock_init(&sdata->u.nan.func_lock);
@@ -1587,6 +1551,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
                sdata->vif.bss_conf.bssid = sdata->vif.addr;
                break;
        case NL80211_IFTYPE_UNSPECIFIED:
+       case NL80211_IFTYPE_WDS:
        case NUM_NL80211_IFTYPES:
                WARN_ON(1);
                break;
@@ -1631,9 +1596,7 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
        case NL80211_IFTYPE_OCB:
                /*
                 * Could probably support everything
-                * but WDS here (WDS do_open can fail
-                * under memory pressure, which this
-                * code isn't prepared to handle).
+                * but here.
                 */
                break;
        case NL80211_IFTYPE_P2P_CLIENT:
@@ -1726,7 +1689,6 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
        case NL80211_IFTYPE_MONITOR:
                /* doesn't matter */
                break;
-       case NL80211_IFTYPE_WDS:
        case NL80211_IFTYPE_AP_VLAN:
                /* match up with an AP interface */
                list_for_each_entry(sdata, &local->interfaces, list) {
index 523380a..dee88ec 100644 (file)
@@ -220,9 +220,9 @@ u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata)
               BSS_CHANGED_ERP_SLOT;
 }
 
-static void ieee80211_tasklet_handler(unsigned long data)
+static void ieee80211_tasklet_handler(struct tasklet_struct *t)
 {
-       struct ieee80211_local *local = (struct ieee80211_local *) data;
+       struct ieee80211_local *local = from_tasklet(local, t, tasklet);
        struct sk_buff *skb;
 
        while ((skb = skb_dequeue(&local->skb_queue)) ||
@@ -733,16 +733,12 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
                skb_queue_head_init(&local->pending[i]);
                atomic_set(&local->agg_queue_stop[i], 0);
        }
-       tasklet_init(&local->tx_pending_tasklet, ieee80211_tx_pending,
-                    (unsigned long)local);
+       tasklet_setup(&local->tx_pending_tasklet, ieee80211_tx_pending);
 
        if (ops->wake_tx_queue)
-               tasklet_init(&local->wake_txqs_tasklet, ieee80211_wake_txqs,
-                            (unsigned long)local);
+               tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs);
 
-       tasklet_init(&local->tasklet,
-                    ieee80211_tasklet_handler,
-                    (unsigned long) local);
+       tasklet_setup(&local->tasklet, ieee80211_tasklet_handler);
 
        skb_queue_head_init(&local->skb_queue);
        skb_queue_head_init(&local->skb_queue_unreliable);
@@ -935,14 +931,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
                                return -EINVAL;
                }
        } else {
-               /*
-                * WDS is currently prohibited when channel contexts are used
-                * because there's no clear definition of which channel WDS
-                * type interfaces use
-                */
-               if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS))
-                       return -EINVAL;
-
                /* DFS is not supported with multi-channel combinations yet */
                for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
                        const struct ieee80211_iface_combination *comb;
index ce5825d..97095b7 100644 (file)
@@ -667,6 +667,35 @@ void ieee80211_mesh_root_setup(struct ieee80211_if_mesh *ifmsh)
        }
 }
 
+static void
+ieee80211_mesh_update_bss_params(struct ieee80211_sub_if_data *sdata,
+                                u8 *ie, u8 ie_len)
+{
+       struct ieee80211_supported_band *sband;
+       const u8 *cap;
+       const struct ieee80211_he_operation *he_oper = NULL;
+
+       sband = ieee80211_get_sband(sdata);
+       if (!sband)
+               return;
+
+       if (!ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_MESH_POINT) ||
+           sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
+           sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
+           sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
+               return;
+
+       sdata->vif.bss_conf.he_support = true;
+
+       cap = cfg80211_find_ext_ie(WLAN_EID_EXT_HE_OPERATION, ie, ie_len);
+       if (cap && cap[1] >= ieee80211_he_oper_size(&cap[3]))
+               he_oper = (void *)(cap + 3);
+
+       if (he_oper)
+               sdata->vif.bss_conf.he_oper.params =
+                       __le32_to_cpu(he_oper->he_oper_params);
+}
+
 /**
  * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame
  * @hdr:       802.11 frame header
@@ -943,6 +972,7 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
 
        bcn->tail_len = skb->len;
        memcpy(bcn->tail, skb->data, bcn->tail_len);
+       ieee80211_mesh_update_bss_params(sdata, bcn->tail, bcn->tail_len);
        bcn->meshconf = (struct ieee80211_meshconf_ie *)
                                        (bcn->tail + ifmsh->meshconf_offset);
 
index f400240..6adfcb9 100644 (file)
@@ -5464,6 +5464,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
                        struct cfg80211_assoc_request *req)
 {
        bool is_6ghz = req->bss->channel->band == NL80211_BAND_6GHZ;
+       bool is_5ghz = req->bss->channel->band == NL80211_BAND_5GHZ;
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
        struct ieee80211_bss *bss = (void *)req->bss->priv;
@@ -5616,7 +5617,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
        if (vht_ie && vht_ie[1] >= sizeof(struct ieee80211_vht_cap))
                memcpy(&assoc_data->ap_vht_cap, vht_ie + 2,
                       sizeof(struct ieee80211_vht_cap));
-       else if (!is_6ghz)
+       else if (is_5ghz)
                ifmgd->flags |= IEEE80211_STA_DISABLE_VHT |
                                IEEE80211_STA_DISABLE_HE;
        rcu_read_unlock();
index 38c45e1..ae378a4 100644 (file)
@@ -150,21 +150,6 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
                case NL80211_IFTYPE_STATION:
                        ieee80211_mgd_quiesce(sdata);
                        break;
-               case NL80211_IFTYPE_WDS:
-                       /* tear down aggregation sessions and remove STAs */
-                       mutex_lock(&local->sta_mtx);
-                       sta = sdata->u.wds.sta;
-                       if (sta && sta->uploaded) {
-                               enum ieee80211_sta_state state;
-
-                               state = sta->sta_state;
-                               for (; state > IEEE80211_STA_NOTEXIST; state--)
-                                       WARN_ON(drv_sta_state(local, sta->sdata,
-                                                             sta, state,
-                                                             state - 1));
-                       }
-                       mutex_unlock(&local->sta_mtx);
-                       break;
                default:
                        break;
                }
index 1e2e5a4..062c2b4 100644 (file)
@@ -1477,7 +1477,6 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
        if (unlikely((ieee80211_is_data(hdr->frame_control) ||
                      ieee80211_is_pspoll(hdr->frame_control)) &&
                     rx->sdata->vif.type != NL80211_IFTYPE_ADHOC &&
-                    rx->sdata->vif.type != NL80211_IFTYPE_WDS &&
                     rx->sdata->vif.type != NL80211_IFTYPE_OCB &&
                     (!rx->sta || !test_sta_flag(rx->sta, WLAN_STA_ASSOC)))) {
                /*
@@ -4080,10 +4079,6 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
                        return false;
 
                return true;
-       case NL80211_IFTYPE_WDS:
-               if (bssid || !ieee80211_is_data(hdr->frame_control))
-                       return false;
-               return ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2);
        case NL80211_IFTYPE_P2P_DEVICE:
                return ieee80211_is_public_action(hdr, skb->len) ||
                       ieee80211_is_probe_req(hdr->frame_control) ||
@@ -4742,6 +4737,8 @@ void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta,
 
        status->rx_flags = 0;
 
+       kcov_remote_start_common(skb_get_kcov_handle(skb));
+
        /*
         * Frames with failed FCS/PLCP checksum are not returned,
         * all other frames are returned without radiotap header
@@ -4749,15 +4746,15 @@ void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta,
         * Also, frames with less than 16 bytes are dropped.
         */
        skb = ieee80211_rx_monitor(local, skb, rate);
-       if (!skb)
-               return;
-
-       ieee80211_tpt_led_trig_rx(local,
-                       ((struct ieee80211_hdr *)skb->data)->frame_control,
-                       skb->len);
+       if (skb) {
+               ieee80211_tpt_led_trig_rx(local,
+                                         ((struct ieee80211_hdr *)skb->data)->frame_control,
+                                         skb->len);
 
-       __ieee80211_rx_handle_packet(hw, pubsta, skb, list);
+               __ieee80211_rx_handle_packet(hw, pubsta, skb, list);
+       }
 
+       kcov_remote_stop();
        return;
  drop:
        kfree_skb(skb);
index fb4f2b9..4fe284f 100644 (file)
@@ -258,6 +258,24 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
  */
 void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
 {
+       /*
+        * If we had used sta_info_pre_move_state() then we might not
+        * have gone through the state transitions down again, so do
+        * it here now (and warn if it's inserted).
+        *
+        * This will clear state such as fast TX/RX that may have been
+        * allocated during state transitions.
+        */
+       while (sta->sta_state > IEEE80211_STA_NONE) {
+               int ret;
+
+               WARN_ON_ONCE(test_sta_flag(sta, WLAN_STA_INSERTED));
+
+               ret = sta_info_move_state(sta, sta->sta_state - 1);
+               if (WARN_ONCE(ret, "sta_info_move_state() returned %d\n", ret))
+                       break;
+       }
+
        if (sta->rate_ctrl)
                rate_control_free_sta(sta);
 
index 00ae81e..7afd076 100644 (file)
@@ -785,7 +785,7 @@ int sta_info_init(struct ieee80211_local *local);
 void sta_info_stop(struct ieee80211_local *local);
 
 /**
- * sta_info_flush - flush matching STA entries from the STA table
+ * __sta_info_flush - flush matching STA entries from the STA table
  *
  * Returns the number of removed STA entries.
  *
@@ -794,6 +794,13 @@ void sta_info_stop(struct ieee80211_local *local);
  */
 int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans);
 
+/**
+ * sta_info_flush - flush matching STA entries from the STA table
+ *
+ * Returns the number of removed STA entries.
+ *
+ * @sdata: sdata to remove all stations from
+ */
 static inline int sta_info_flush(struct ieee80211_sub_if_data *sdata)
 {
        return __sta_info_flush(sdata, false);
index 8ba10a4..01eb085 100644 (file)
@@ -319,9 +319,6 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
        if (tx->sdata->vif.type == NL80211_IFTYPE_OCB)
                return TX_CONTINUE;
 
-       if (tx->sdata->vif.type == NL80211_IFTYPE_WDS)
-               return TX_CONTINUE;
-
        if (tx->flags & IEEE80211_TX_PS_BUFFERED)
                return TX_CONTINUE;
 
@@ -1942,19 +1939,24 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
 
 /* device xmit handlers */
 
+enum ieee80211_encrypt {
+       ENCRYPT_NO,
+       ENCRYPT_MGMT,
+       ENCRYPT_DATA,
+};
+
 static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata,
                                struct sk_buff *skb,
-                               int head_need, bool may_encrypt)
+                               int head_need,
+                               enum ieee80211_encrypt encrypt)
 {
        struct ieee80211_local *local = sdata->local;
-       struct ieee80211_hdr *hdr;
        bool enc_tailroom;
        int tail_need = 0;
 
-       hdr = (struct ieee80211_hdr *) skb->data;
-       enc_tailroom = may_encrypt &&
-                      (sdata->crypto_tx_tailroom_needed_cnt ||
-                       ieee80211_is_mgmt(hdr->frame_control));
+       enc_tailroom = encrypt == ENCRYPT_MGMT ||
+                      (encrypt == ENCRYPT_DATA &&
+                       sdata->crypto_tx_tailroom_needed_cnt);
 
        if (enc_tailroom) {
                tail_need = IEEE80211_ENCRYPT_TAILROOM;
@@ -1985,23 +1987,29 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
 {
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-       struct ieee80211_hdr *hdr;
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
        int headroom;
-       bool may_encrypt;
+       enum ieee80211_encrypt encrypt;
 
-       may_encrypt = !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT);
+       if (info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)
+               encrypt = ENCRYPT_NO;
+       else if (ieee80211_is_mgmt(hdr->frame_control))
+               encrypt = ENCRYPT_MGMT;
+       else
+               encrypt = ENCRYPT_DATA;
 
        headroom = local->tx_headroom;
-       if (may_encrypt)
+       if (encrypt != ENCRYPT_NO)
                headroom += sdata->encrypt_headroom;
        headroom -= skb_headroom(skb);
        headroom = max_t(int, 0, headroom);
 
-       if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) {
+       if (ieee80211_skb_resize(sdata, skb, headroom, encrypt)) {
                ieee80211_free_txskb(&local->hw, skb);
                return;
        }
 
+       /* reload after potential resize */
        hdr = (struct ieee80211_hdr *) skb->data;
        info->control.vif = &sdata->vif;
 
@@ -2102,6 +2110,9 @@ bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
                                info->flags |= IEEE80211_TX_CTL_NO_ACK;
                        if (txflags & IEEE80211_RADIOTAP_F_TX_NOSEQNO)
                                info->control.flags |= IEEE80211_TX_CTRL_NO_SEQNO;
+                       if (txflags & IEEE80211_RADIOTAP_F_TX_ORDER)
+                               info->control.flags |=
+                                       IEEE80211_TX_CTRL_DONT_REORDER;
                        break;
 
                case IEEE80211_RADIOTAP_RATE:
@@ -2268,11 +2279,13 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
                                                    payload[7]);
        }
 
-       /*
-        * Initialize skb->priority for QoS frames. This is put in the TID field
-        * of the frame before passing it to the driver.
+       /* Initialize skb->priority for QoS frames. If the DONT_REORDER flag
+        * is set, stick to the default value for skb->priority to assure
+        * frames injected with this flag are not reordered relative to each
+        * other.
         */
-       if (ieee80211_is_data_qos(hdr->frame_control)) {
+       if (ieee80211_is_data_qos(hdr->frame_control) &&
+           !(info->control.flags & IEEE80211_TX_CTRL_DONT_REORDER)) {
                u8 *p = ieee80211_get_qos_ctl(hdr);
                skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK;
        }
@@ -2284,8 +2297,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
         * we handle as though they are non-injected frames.
         * This code here isn't entirely correct, the local MAC address
         * isn't always enough to find the interface to use; for proper
-        * VLAN/WDS support we will need a different mechanism (which
-        * likely isn't going to be monitor interfaces).
+        * VLAN support we have an nl80211-based mechanism.
         *
         * This is necessary, for example, for old hostapd versions that
         * don't use nl80211-based management TX/RX.
@@ -2296,8 +2308,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
                if (!ieee80211_sdata_running(tmp_sdata))
                        continue;
                if (tmp_sdata->vif.type == NL80211_IFTYPE_MONITOR ||
-                   tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
-                   tmp_sdata->vif.type == NL80211_IFTYPE_WDS)
+                   tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
                        continue;
                if (ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) {
                        sdata = tmp_sdata;
@@ -2391,9 +2402,6 @@ int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
                }
                sta = sta_info_get_bss(sdata, skb->data);
                break;
-       case NL80211_IFTYPE_WDS:
-               sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
-               break;
 #ifdef CONFIG_MAC80211_MESH
        case NL80211_IFTYPE_MESH_POINT:
                /* determined much later */
@@ -2569,20 +2577,6 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
                hdrlen = 24;
                band = chanctx_conf->def.chan->band;
                break;
-       case NL80211_IFTYPE_WDS:
-               fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS);
-               /* RA TA DA SA */
-               memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN);
-               memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN);
-               memcpy(hdr.addr3, skb->data, ETH_ALEN);
-               memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN);
-               hdrlen = 30;
-               /*
-                * This is the exception! WDS style interfaces are prohibited
-                * when channel contexts are in used so this must be valid
-                */
-               band = local->hw.conf.chandef.chan->band;
-               break;
 #ifdef CONFIG_MAC80211_MESH
        case NL80211_IFTYPE_MESH_POINT:
                if (!is_multicast_ether_addr(skb->data)) {
@@ -2828,7 +2822,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
                head_need += sdata->encrypt_headroom;
                head_need += local->tx_headroom;
                head_need = max_t(int, 0, head_need);
-               if (ieee80211_skb_resize(sdata, skb, head_need, true)) {
+               if (ieee80211_skb_resize(sdata, skb, head_need, ENCRYPT_DATA)) {
                        ieee80211_free_txskb(&local->hw, skb);
                        skb = NULL;
                        return ERR_PTR(-ENOMEM);
@@ -3502,7 +3496,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
        if (unlikely(ieee80211_skb_resize(sdata, skb,
                                          max_t(int, extra_head + hw_headroom -
                                                     skb_headroom(skb), 0),
-                                         false))) {
+                                         ENCRYPT_NO))) {
                kfree_skb(skb);
                return true;
        }
@@ -3619,13 +3613,14 @@ begin:
        tx.skb = skb;
        tx.sdata = vif_to_sdata(info->control.vif);
 
-       if (txq->sta && !(info->flags & IEEE80211_TX_CTL_INJECTED)) {
+       if (txq->sta) {
                tx.sta = container_of(txq->sta, struct sta_info, sta);
                /*
                 * Drop unicast frames to unauthorised stations unless they are
-                * EAPOL frames from the local station.
+                * injected frames or EAPOL frames from the local station.
                 */
-               if (unlikely(ieee80211_is_data(hdr->frame_control) &&
+               if (unlikely(!(info->flags & IEEE80211_TX_CTL_INJECTED) &&
+                            ieee80211_is_data(hdr->frame_control) &&
                             !ieee80211_vif_is_mesh(&tx.sdata->vif) &&
                             tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
                             !is_multicast_ether_addr(hdr->addr1) &&
@@ -4406,9 +4401,10 @@ static bool ieee80211_tx_pending_skb(struct ieee80211_local *local,
 /*
  * Transmit all pending packets. Called from tasklet.
  */
-void ieee80211_tx_pending(unsigned long data)
+void ieee80211_tx_pending(struct tasklet_struct *t)
 {
-       struct ieee80211_local *local = (struct ieee80211_local *)data;
+       struct ieee80211_local *local = from_tasklet(local, t,
+                                                    tx_pending_tasklet);
        unsigned long flags;
        int i;
        bool txok;
index 4934206..8c3c01a 100644 (file)
@@ -386,9 +386,10 @@ _ieee80211_wake_txqs(struct ieee80211_local *local, unsigned long *flags)
        rcu_read_unlock();
 }
 
-void ieee80211_wake_txqs(unsigned long data)
+void ieee80211_wake_txqs(struct tasklet_struct *t)
 {
-       struct ieee80211_local *local = (struct ieee80211_local *)data;
+       struct ieee80211_local *local = from_tasklet(local, t,
+                                                    wake_txqs_tasklet);
        unsigned long flags;
 
        spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
@@ -2513,7 +2514,6 @@ int ieee80211_reconfig(struct ieee80211_local *local)
                                return res;
                        }
                        break;
-               case NL80211_IFTYPE_WDS:
                case NL80211_IFTYPE_AP_VLAN:
                case NL80211_IFTYPE_MONITOR:
                case NL80211_IFTYPE_P2P_DEVICE:
@@ -2523,6 +2523,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
                case NUM_NL80211_IFTYPES:
                case NL80211_IFTYPE_P2P_CLIENT:
                case NL80211_IFTYPE_P2P_GO:
+               case NL80211_IFTYPE_WDS:
                        WARN_ON(1);
                        break;
                }
index 2fb9932..9ea6004 100644 (file)
@@ -118,9 +118,11 @@ u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata,
                                 struct ieee80211_hdr *hdr)
 {
        struct ieee80211_local *local = sdata->local;
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
        u8 *p;
 
-       if (local->hw.queues < IEEE80211_NUM_ACS)
+       if ((info->control.flags & IEEE80211_TX_CTRL_DONT_REORDER) ||
+           local->hw.queues < IEEE80211_NUM_ACS)
                return 0;
 
        if (!ieee80211_is_data(hdr->frame_control)) {
@@ -141,6 +143,7 @@ u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata,
 u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
                             struct sta_info *sta, struct sk_buff *skb)
 {
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
        struct mac80211_qos_map *qos_map;
        bool qos;
 
@@ -153,7 +156,7 @@ u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
        else
                qos = false;
 
-       if (!qos) {
+       if (!qos || (info->control.flags & IEEE80211_TX_CTRL_DONT_REORDER)) {
                skb->priority = 0; /* required for correct WPA/11i MIC */
                return IEEE80211_AC_BE;
        }
@@ -202,9 +205,6 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
        case NL80211_IFTYPE_AP:
                ra = skb->data;
                break;
-       case NL80211_IFTYPE_WDS:
-               ra = sdata->u.wds.remote_addr;
-               break;
        case NL80211_IFTYPE_STATION:
                /* might be a TDLS station */
                sta = sta_info_get(sdata, skb->data);
@@ -249,6 +249,14 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,
 
        p = ieee80211_get_qos_ctl(hdr);
 
+       /* don't overwrite the QoS field of injected frames */
+       if (info->flags & IEEE80211_TX_CTL_INJECTED) {
+               /* do take into account Ack policy of injected frames */
+               if (*p & IEEE80211_QOS_CTL_ACK_POLICY_NOACK)
+                       info->flags |= IEEE80211_TX_CTL_NO_ACK;
+               return;
+       }
+
        /* set up the first byte */
 
        /*
index 06ea0f8..520cedc 100644 (file)
@@ -20,9 +20,9 @@
 #include "ieee802154_i.h"
 #include "cfg.h"
 
-static void ieee802154_tasklet_handler(unsigned long data)
+static void ieee802154_tasklet_handler(struct tasklet_struct *t)
 {
-       struct ieee802154_local *local = (struct ieee802154_local *)data;
+       struct ieee802154_local *local = from_tasklet(local, t, tasklet);
        struct sk_buff *skb;
 
        while ((skb = skb_dequeue(&local->skb_queue))) {
@@ -91,9 +91,7 @@ ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops)
        INIT_LIST_HEAD(&local->interfaces);
        mutex_init(&local->iflist_mtx);
 
-       tasklet_init(&local->tasklet,
-                    ieee802154_tasklet_handler,
-                    (unsigned long)local);
+       tasklet_setup(&local->tasklet, ieee802154_tasklet_handler);
 
        skb_queue_head_init(&local->skb_queue);
 
index f2868a8..47bab70 100644 (file)
@@ -377,6 +377,8 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev,
        if (!pskb_may_pull(skb, sizeof(*hdr)))
                goto err;
 
+       skb_dst_drop(skb);
+
        /* Read and decode the label */
        hdr = mpls_hdr(skb);
        dec = mpls_entry_decode(hdr);
index 54b888f..96ba616 100644 (file)
@@ -18,6 +18,7 @@ struct mptcp_pernet {
        struct ctl_table_header *ctl_table_hdr;
 
        int mptcp_enabled;
+       unsigned int add_addr_timeout;
 };
 
 static struct mptcp_pernet *mptcp_get_pernet(struct net *net)
@@ -30,6 +31,11 @@ int mptcp_is_enabled(struct net *net)
        return mptcp_get_pernet(net)->mptcp_enabled;
 }
 
+unsigned int mptcp_get_add_addr_timeout(struct net *net)
+{
+       return mptcp_get_pernet(net)->add_addr_timeout;
+}
+
 static struct ctl_table mptcp_sysctl_table[] = {
        {
                .procname = "enabled",
@@ -40,12 +46,19 @@ static struct ctl_table mptcp_sysctl_table[] = {
                 */
                .proc_handler = proc_dointvec,
        },
+       {
+               .procname = "add_addr_timeout",
+               .maxlen = sizeof(unsigned int),
+               .mode = 0644,
+               .proc_handler = proc_dointvec_jiffies,
+       },
        {}
 };
 
 static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet)
 {
        pernet->mptcp_enabled = 1;
+       pernet->add_addr_timeout = TCP_RTO_MAX;
 }
 
 static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
@@ -61,6 +74,7 @@ static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
        }
 
        table[0].data = &pernet->mptcp_enabled;
+       table[1].data = &pernet->add_addr_timeout;
 
        hdr = register_net_sysctl(net, MPTCP_SYSCTL_PATH, table);
        if (!hdr)
index 0d6f3d9..446ef8f 100644 (file)
@@ -232,7 +232,8 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
        }
 
        if (entry->retrans_times < ADD_ADDR_RETRANS_MAX)
-               sk_reset_timer(sk, timer, jiffies + TCP_RTO_MAX);
+               sk_reset_timer(sk, timer,
+                              jiffies + mptcp_get_add_addr_timeout(sock_net(sk)));
 
        spin_unlock_bh(&msk->pm.lock);
 
@@ -264,6 +265,7 @@ static bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
 {
        struct mptcp_pm_add_entry *add_entry = NULL;
        struct sock *sk = (struct sock *)msk;
+       struct net *net = sock_net(sk);
 
        if (lookup_anno_list_by_saddr(msk, &entry->addr))
                return false;
@@ -279,7 +281,8 @@ static bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
        add_entry->retrans_times = 0;
 
        timer_setup(&add_entry->add_timer, mptcp_pm_add_timer, 0);
-       sk_reset_timer(sk, &add_entry->add_timer, jiffies + TCP_RTO_MAX);
+       sk_reset_timer(sk, &add_entry->add_timer,
+                      jiffies + mptcp_get_add_addr_timeout(net));
 
        return true;
 }
index 185dacb..eaa61e2 100644 (file)
@@ -274,6 +274,15 @@ static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk,
        skb_ext_reset(skb);
        skb_orphan(skb);
 
+       /* try to fetch required memory from subflow */
+       if (!sk_rmem_schedule(sk, skb, skb->truesize)) {
+               if (ssk->sk_forward_alloc < skb->truesize)
+                       goto drop;
+               __sk_mem_reclaim(ssk, skb->truesize);
+               if (!sk_rmem_schedule(sk, skb, skb->truesize))
+                       goto drop;
+       }
+
        /* the skb map_seq accounts for the skb offset:
         * mptcp_subflow_get_mapped_dsn() is based on the current tp->copied_seq
         * value
@@ -301,6 +310,7 @@ static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk,
         * will retransmit as needed, if needed.
         */
        MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA);
+drop:
        mptcp_drop(sk, skb);
        return false;
 }
@@ -456,6 +466,18 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk,
        struct tcp_sock *tp;
        u32 old_copied_seq;
        bool done = false;
+       int sk_rbuf;
+
+       sk_rbuf = READ_ONCE(sk->sk_rcvbuf);
+
+       if (!(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) {
+               int ssk_rbuf = READ_ONCE(ssk->sk_rcvbuf);
+
+               if (unlikely(ssk_rbuf > sk_rbuf)) {
+                       WRITE_ONCE(sk->sk_rcvbuf, ssk_rbuf);
+                       sk_rbuf = ssk_rbuf;
+               }
+       }
 
        pr_debug("msk=%p ssk=%p", msk, ssk);
        tp = tcp_sk(ssk);
@@ -518,7 +540,7 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk,
                WRITE_ONCE(tp->copied_seq, seq);
                more_data_avail = mptcp_subflow_data_available(ssk);
 
-               if (atomic_read(&sk->sk_rmem_alloc) > READ_ONCE(sk->sk_rcvbuf)) {
+               if (atomic_read(&sk->sk_rmem_alloc) > sk_rbuf) {
                        done = true;
                        break;
                }
@@ -612,6 +634,7 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk)
 {
        struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
        struct mptcp_sock *msk = mptcp_sk(sk);
+       int sk_rbuf, ssk_rbuf;
        bool wake;
 
        /* move_skbs_to_msk below can legitly clear the data_avail flag,
@@ -622,12 +645,16 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk)
        if (wake)
                set_bit(MPTCP_DATA_READY, &msk->flags);
 
-       if (atomic_read(&sk->sk_rmem_alloc) < READ_ONCE(sk->sk_rcvbuf) &&
-           move_skbs_to_msk(msk, ssk))
+       ssk_rbuf = READ_ONCE(ssk->sk_rcvbuf);
+       sk_rbuf = READ_ONCE(sk->sk_rcvbuf);
+       if (unlikely(ssk_rbuf > sk_rbuf))
+               sk_rbuf = ssk_rbuf;
+
+       /* over limit? can't append more skbs to msk */
+       if (atomic_read(&sk->sk_rmem_alloc) > sk_rbuf)
                goto wake;
 
-       /* don't schedule if mptcp sk is (still) over limit */
-       if (atomic_read(&sk->sk_rmem_alloc) > READ_ONCE(sk->sk_rcvbuf))
+       if (move_skbs_to_msk(msk, ssk))
                goto wake;
 
        /* mptcp socket is owned, release_cb should retry */
@@ -744,8 +771,11 @@ static bool mptcp_skb_can_collapse_to(u64 write_seq,
        if (!tcp_skb_can_collapse_to(skb))
                return false;
 
-       /* can collapse only if MPTCP level sequence is in order */
-       return mpext && mpext->data_seq + mpext->data_len == write_seq;
+       /* can collapse only if MPTCP level sequence is in order and this
+        * mapping has not been xmitted yet
+        */
+       return mpext && mpext->data_seq + mpext->data_len == write_seq &&
+              !mpext->frozen;
 }
 
 static bool mptcp_frag_can_collapse_to(const struct mptcp_sock *msk,
@@ -823,19 +853,25 @@ static void mptcp_clean_una(struct sock *sk)
        }
 
 out:
-       if (cleaned) {
+       if (cleaned)
                sk_mem_reclaim_partial(sk);
+}
 
-               /* Only wake up writers if a subflow is ready */
-               if (mptcp_is_writeable(msk)) {
-                       set_bit(MPTCP_SEND_SPACE, &mptcp_sk(sk)->flags);
-                       smp_mb__after_atomic();
+static void mptcp_clean_una_wakeup(struct sock *sk)
+{
+       struct mptcp_sock *msk = mptcp_sk(sk);
 
-                       /* set SEND_SPACE before sk_stream_write_space clears
-                        * NOSPACE
-                        */
-                       sk_stream_write_space(sk);
-               }
+       mptcp_clean_una(sk);
+
+       /* Only wake up writers if a subflow is ready */
+       if (mptcp_is_writeable(msk)) {
+               set_bit(MPTCP_SEND_SPACE, &msk->flags);
+               smp_mb__after_atomic();
+
+               /* set SEND_SPACE before sk_stream_write_space clears
+                * NOSPACE
+                */
+               sk_stream_write_space(sk);
        }
 }
 
@@ -1466,13 +1502,14 @@ static bool __mptcp_move_skbs(struct mptcp_sock *msk)
        __mptcp_flush_join_list(msk);
        do {
                struct sock *ssk = mptcp_subflow_recv_lookup(msk);
+               bool slowpath;
 
                if (!ssk)
                        break;
 
-               lock_sock(ssk);
+               slowpath = lock_sock_fast(ssk);
                done = __mptcp_move_skbs_from_subflow(msk, ssk, &moved);
-               release_sock(ssk);
+               unlock_sock_fast(ssk, slowpath);
        } while (!done);
 
        if (mptcp_ofo_queue(msk) || moved > 0) {
@@ -1738,7 +1775,7 @@ static void mptcp_worker(struct work_struct *work)
        long timeo = 0;
 
        lock_sock(sk);
-       mptcp_clean_una(sk);
+       mptcp_clean_una_wakeup(sk);
        mptcp_check_data_fin_ack(sk);
        __mptcp_flush_join_list(msk);
        if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags))
@@ -2457,6 +2494,7 @@ static struct proto mptcp_prot = {
        .memory_pressure        = &tcp_memory_pressure,
        .stream_memory_free     = mptcp_memory_free,
        .sysctl_wmem_offset     = offsetof(struct net, ipv4.sysctl_tcp_wmem),
+       .sysctl_rmem_offset     = offsetof(struct net, ipv4.sysctl_tcp_rmem),
        .sysctl_mem     = sysctl_tcp_mem,
        .obj_size       = sizeof(struct mptcp_sock),
        .slab_flags     = SLAB_TYPESAFE_BY_RCU,
index 13ab89d..278c88c 100644 (file)
@@ -362,6 +362,7 @@ mptcp_subflow_get_mapped_dsn(const struct mptcp_subflow_context *subflow)
 }
 
 int mptcp_is_enabled(struct net *net);
+unsigned int mptcp_get_add_addr_timeout(struct net *net);
 void mptcp_subflow_fully_established(struct mptcp_subflow_context *subflow,
                                     struct mptcp_options_received *mp_opt);
 bool mptcp_subflow_data_available(struct sock *sk);
index 8b47c4b..feb4b9f 100644 (file)
@@ -291,7 +291,7 @@ struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot,
 {
        struct mptcp_sock *ret = NULL;
        struct hlist_nulls_node *pos;
-       int slot, num;
+       int slot, num = 0;
 
        for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) {
                struct token_bucket *bucket = &token_hash[slot];
index 5237021..49fbef0 100644 (file)
@@ -682,6 +682,16 @@ config NFT_FIB_NETDEV
          The lookup will be delegated to the IPv4 or IPv6 FIB depending
          on the protocol of the packet.
 
+config NFT_REJECT_NETDEV
+       depends on NFT_REJECT_IPV4
+       depends on NFT_REJECT_IPV6
+       tristate "Netfilter nf_tables netdev REJECT support"
+       help
+         This option enables the REJECT support from the netdev table.
+         The return packet generation will be delegated to the IPv4
+         or IPv6 ICMP or TCP RST implementation depending on the
+         protocol of the packet.
+
 endif # NF_TABLES_NETDEV
 
 endif # NF_TABLES
index 0e0ded8..33da7bf 100644 (file)
@@ -101,6 +101,7 @@ obj-$(CONFIG_NFT_QUEUE)             += nft_queue.o
 obj-$(CONFIG_NFT_QUOTA)                += nft_quota.o
 obj-$(CONFIG_NFT_REJECT)       += nft_reject.o
 obj-$(CONFIG_NFT_REJECT_INET)  += nft_reject_inet.o
+obj-$(CONFIG_NFT_REJECT_NETDEV)        += nft_reject_netdev.o
 obj-$(CONFIG_NFT_TUNNEL)       += nft_tunnel.o
 obj-$(CONFIG_NFT_COUNTER)      += nft_counter.o
 obj-$(CONFIG_NFT_LOG)          += nft_log.o
index 6f35832..c7eaa37 100644 (file)
@@ -637,13 +637,14 @@ ip_set_match_extensions(struct ip_set *set, const struct ip_set_ext *ext,
        if (SET_WITH_COUNTER(set)) {
                struct ip_set_counter *counter = ext_counter(data, set);
 
+               ip_set_update_counter(counter, ext, flags);
+
                if (flags & IPSET_FLAG_MATCH_COUNTERS &&
                    !(ip_set_match_counter(ip_set_get_packets(counter),
                                mext->packets, mext->packets_op) &&
                      ip_set_match_counter(ip_set_get_bytes(counter),
                                mext->bytes, mext->bytes_op)))
                        return false;
-               ip_set_update_counter(counter, ext, flags);
        }
        if (SET_WITH_SKBINFO(set))
                ip_set_get_skbinfo(ext_skbinfo(data, set),
@@ -1109,6 +1110,8 @@ static int ip_set_create(struct net *net, struct sock *ctnl,
                ret = -IPSET_ERR_PROTOCOL;
                goto put_out;
        }
+       /* Set create flags depending on the type revision */
+       set->flags |= set->type->create_flags[revision];
 
        ret = set->type->create(net, set, tb, flags);
        if (ret != 0)
@@ -1239,10 +1242,12 @@ static int ip_set_destroy(struct net *net, struct sock *ctnl,
                /* Modified by ip_set_destroy() only, which is serialized */
                inst->is_destroyed = false;
        } else {
+               u32 flags = flag_exist(nlh);
                s = find_set_and_id(inst, nla_data(attr[IPSET_ATTR_SETNAME]),
                                    &i);
                if (!s) {
-                       ret = -ENOENT;
+                       if (!(flags & IPSET_FLAG_EXIST))
+                               ret = -ENOENT;
                        goto out;
                } else if (s->ref || s->ref_netlink) {
                        ret = -IPSET_ERR_BUSY;
index 521e970..5f1208a 100644 (file)
  */
 
 /* Number of elements to store in an initial array block */
-#define AHASH_INIT_SIZE                        4
+#define AHASH_INIT_SIZE                        2
 /* Max number of elements to store in an array block */
-#define AHASH_MAX_SIZE                 (3 * AHASH_INIT_SIZE)
+#define AHASH_MAX_SIZE                 (6 * AHASH_INIT_SIZE)
 /* Max muber of elements in the array block when tuned */
 #define AHASH_MAX_TUNED                        64
 
+#define AHASH_MAX(h)                   ((h)->bucketsize)
+
 /* Max number of elements can be tuned */
 #ifdef IP_SET_HASH_WITH_MULTI
-#define AHASH_MAX(h)                   ((h)->ahash_max)
-
 static u8
-tune_ahash_max(u8 curr, u32 multi)
+tune_bucketsize(u8 curr, u32 multi)
 {
        u32 n;
 
@@ -61,12 +61,10 @@ tune_ahash_max(u8 curr, u32 multi)
         */
        return n > curr && n <= AHASH_MAX_TUNED ? n : curr;
 }
-
-#define TUNE_AHASH_MAX(h, multi)       \
-       ((h)->ahash_max = tune_ahash_max((h)->ahash_max, multi))
+#define TUNE_BUCKETSIZE(h, multi)      \
+       ((h)->bucketsize = tune_bucketsize((h)->bucketsize, multi))
 #else
-#define AHASH_MAX(h)                   AHASH_MAX_SIZE
-#define TUNE_AHASH_MAX(h, multi)
+#define TUNE_BUCKETSIZE(h, multi)
 #endif
 
 /* A hash bucket */
@@ -321,9 +319,7 @@ struct htype {
 #ifdef IP_SET_HASH_WITH_MARKMASK
        u32 markmask;           /* markmask value for mark mask to store */
 #endif
-#ifdef IP_SET_HASH_WITH_MULTI
-       u8 ahash_max;           /* max elements in an array block */
-#endif
+       u8 bucketsize;          /* max elements in an array block */
 #ifdef IP_SET_HASH_WITH_NETMASK
        u8 netmask;             /* netmask value for subnets to store */
 #endif
@@ -950,7 +946,7 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,
                goto set_full;
        /* Create a new slot */
        if (n->pos >= n->size) {
-               TUNE_AHASH_MAX(h, multi);
+               TUNE_BUCKETSIZE(h, multi);
                if (n->size >= AHASH_MAX(h)) {
                        /* Trigger rehashing */
                        mtype_data_next(&h->next, d);
@@ -1305,6 +1301,11 @@ mtype_head(struct ip_set *set, struct sk_buff *skb)
        if (nla_put_u32(skb, IPSET_ATTR_MARKMASK, h->markmask))
                goto nla_put_failure;
 #endif
+       if (set->flags & IPSET_CREATE_FLAG_BUCKETSIZE) {
+               if (nla_put_u8(skb, IPSET_ATTR_BUCKETSIZE, h->bucketsize) ||
+                   nla_put_net32(skb, IPSET_ATTR_INITVAL, htonl(h->initval)))
+                       goto nla_put_failure;
+       }
        if (nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref)) ||
            nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)) ||
            nla_put_net32(skb, IPSET_ATTR_ELEMENTS, htonl(elements)))
@@ -1547,8 +1548,20 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set,
 #ifdef IP_SET_HASH_WITH_MARKMASK
        h->markmask = markmask;
 #endif
-       get_random_bytes(&h->initval, sizeof(h->initval));
-
+       if (tb[IPSET_ATTR_INITVAL])
+               h->initval = ntohl(nla_get_be32(tb[IPSET_ATTR_INITVAL]));
+       else
+               get_random_bytes(&h->initval, sizeof(h->initval));
+       h->bucketsize = AHASH_MAX_SIZE;
+       if (tb[IPSET_ATTR_BUCKETSIZE]) {
+               h->bucketsize = nla_get_u8(tb[IPSET_ATTR_BUCKETSIZE]);
+               if (h->bucketsize < AHASH_INIT_SIZE)
+                       h->bucketsize = AHASH_INIT_SIZE;
+               else if (h->bucketsize > AHASH_MAX_SIZE)
+                       h->bucketsize = AHASH_MAX_SIZE;
+               else if (h->bucketsize % 2)
+                       h->bucketsize += 1;
+       }
        t->htable_bits = hbits;
        t->maxelem = h->maxelem / ahash_numof_locks(hbits);
        RCU_INIT_POINTER(h->table, t);
index 5d6d68e..d1bef23 100644 (file)
@@ -23,7 +23,8 @@
 /*                             1          Counters support */
 /*                             2          Comments support */
 /*                             3          Forceadd support */
-#define IPSET_TYPE_REV_MAX     4       /* skbinfo support  */
+/*                             4          skbinfo support */
+#define IPSET_TYPE_REV_MAX     5       /* bucketsize, initval support  */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
@@ -277,11 +278,13 @@ static struct ip_set_type hash_ip_type __read_mostly = {
        .family         = NFPROTO_UNSPEC,
        .revision_min   = IPSET_TYPE_REV_MIN,
        .revision_max   = IPSET_TYPE_REV_MAX,
+       .create_flags[IPSET_TYPE_REV_MAX] = IPSET_CREATE_FLAG_BUCKETSIZE,
        .create         = hash_ip_create,
        .create_policy  = {
                [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
                [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
-               [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
+               [IPSET_ATTR_INITVAL]    = { .type = NLA_U32 },
+               [IPSET_ATTR_BUCKETSIZE] = { .type = NLA_U8 },
                [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
                [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
                [IPSET_ATTR_NETMASK]    = { .type = NLA_U8  },
index eceb7bc..467c59a 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/netfilter/ipset/ip_set_hash.h>
 
 #define IPSET_TYPE_REV_MIN     0
-#define IPSET_TYPE_REV_MAX     0
+#define IPSET_TYPE_REV_MAX     1       /* bucketsize, initval support  */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Tomasz Chilinski <tomasz.chilinski@chilan.com>");
@@ -268,11 +268,13 @@ static struct ip_set_type hash_ipmac_type __read_mostly = {
        .family         = NFPROTO_UNSPEC,
        .revision_min   = IPSET_TYPE_REV_MIN,
        .revision_max   = IPSET_TYPE_REV_MAX,
+       .create_flags[IPSET_TYPE_REV_MAX] = IPSET_CREATE_FLAG_BUCKETSIZE,
        .create         = hash_ipmac_create,
        .create_policy  = {
                [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
                [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
-               [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
+               [IPSET_ATTR_INITVAL]    = { .type = NLA_U32 },
+               [IPSET_ATTR_BUCKETSIZE] = { .type = NLA_U8 },
                [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
                [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
                [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
index aba1df6..18346d1 100644 (file)
@@ -21,7 +21,8 @@
 
 #define IPSET_TYPE_REV_MIN     0
 /*                             1          Forceadd support */
-#define IPSET_TYPE_REV_MAX     2       /* skbinfo support  */
+/*                             2          skbinfo support */
+#define IPSET_TYPE_REV_MAX     3       /* bucketsize, initval support  */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Vytas Dauksa <vytas.dauksa@smoothwall.net>");
@@ -274,12 +275,14 @@ static struct ip_set_type hash_ipmark_type __read_mostly = {
        .family         = NFPROTO_UNSPEC,
        .revision_min   = IPSET_TYPE_REV_MIN,
        .revision_max   = IPSET_TYPE_REV_MAX,
+       .create_flags[IPSET_TYPE_REV_MAX] = IPSET_CREATE_FLAG_BUCKETSIZE,
        .create         = hash_ipmark_create,
        .create_policy  = {
                [IPSET_ATTR_MARKMASK]   = { .type = NLA_U32 },
                [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
                [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
-               [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
+               [IPSET_ATTR_INITVAL]    = { .type = NLA_U32 },
+               [IPSET_ATTR_BUCKETSIZE] = { .type = NLA_U8 },
                [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
                [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
                [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
index 1ff2287..e1ca111 100644 (file)
@@ -25,7 +25,8 @@
 /*                             2    Counters support added */
 /*                             3    Comments support added */
 /*                             4    Forceadd support added */
-#define IPSET_TYPE_REV_MAX     5 /* skbinfo support added */
+/*                             5    skbinfo support added */
+#define IPSET_TYPE_REV_MAX     6 /* bucketsize, initval support added */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
@@ -341,11 +342,13 @@ static struct ip_set_type hash_ipport_type __read_mostly = {
        .family         = NFPROTO_UNSPEC,
        .revision_min   = IPSET_TYPE_REV_MIN,
        .revision_max   = IPSET_TYPE_REV_MAX,
+       .create_flags[IPSET_TYPE_REV_MAX] = IPSET_CREATE_FLAG_BUCKETSIZE,
        .create         = hash_ipport_create,
        .create_policy  = {
                [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
                [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
-               [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
+               [IPSET_ATTR_INITVAL]    = { .type = NLA_U32 },
+               [IPSET_ATTR_BUCKETSIZE] = { .type = NLA_U8 },
                [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
                [IPSET_ATTR_PROTO]      = { .type = NLA_U8 },
                [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
index fa88afd..ab179e0 100644 (file)
@@ -25,7 +25,8 @@
 /*                             2    Counters support added */
 /*                             3    Comments support added */
 /*                             4    Forceadd support added */
-#define IPSET_TYPE_REV_MAX     5 /* skbinfo support added */
+/*                             5    skbinfo support added */
+#define IPSET_TYPE_REV_MAX     6 /* bucketsize, initval support added */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
@@ -356,11 +357,13 @@ static struct ip_set_type hash_ipportip_type __read_mostly = {
        .family         = NFPROTO_UNSPEC,
        .revision_min   = IPSET_TYPE_REV_MIN,
        .revision_max   = IPSET_TYPE_REV_MAX,
+       .create_flags[IPSET_TYPE_REV_MAX] = IPSET_CREATE_FLAG_BUCKETSIZE,
        .create         = hash_ipportip_create,
        .create_policy  = {
                [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
                [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
-               [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
+               [IPSET_ATTR_INITVAL]    = { .type = NLA_U32 },
+               [IPSET_ATTR_BUCKETSIZE] = { .type = NLA_U8 },
                [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
                [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
                [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
index eef6ecf..8f075b4 100644 (file)
@@ -27,7 +27,8 @@
 /*                             4    Counters support added */
 /*                             5    Comments support added */
 /*                             6    Forceadd support added */
-#define IPSET_TYPE_REV_MAX     7 /* skbinfo support added */
+/*                             7    skbinfo support added */
+#define IPSET_TYPE_REV_MAX     8 /* bucketsize, initval support added */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
@@ -513,11 +514,13 @@ static struct ip_set_type hash_ipportnet_type __read_mostly = {
        .family         = NFPROTO_UNSPEC,
        .revision_min   = IPSET_TYPE_REV_MIN,
        .revision_max   = IPSET_TYPE_REV_MAX,
+       .create_flags[IPSET_TYPE_REV_MAX] = IPSET_CREATE_FLAG_BUCKETSIZE,
        .create         = hash_ipportnet_create,
        .create_policy  = {
                [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
                [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
-               [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
+               [IPSET_ATTR_INITVAL]    = { .type = NLA_U32 },
+               [IPSET_ATTR_BUCKETSIZE] = { .type = NLA_U8 },
                [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
                [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
                [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
index 0b61593..7188147 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/netfilter/ipset/ip_set_hash.h>
 
 #define IPSET_TYPE_REV_MIN     0
-#define IPSET_TYPE_REV_MAX     0
+#define IPSET_TYPE_REV_MAX     1       /* bucketsize, initval support */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
@@ -125,11 +125,13 @@ static struct ip_set_type hash_mac_type __read_mostly = {
        .family         = NFPROTO_UNSPEC,
        .revision_min   = IPSET_TYPE_REV_MIN,
        .revision_max   = IPSET_TYPE_REV_MAX,
+       .create_flags[IPSET_TYPE_REV_MAX] = IPSET_CREATE_FLAG_BUCKETSIZE,
        .create         = hash_mac_create,
        .create_policy  = {
                [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
                [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
-               [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
+               [IPSET_ATTR_INITVAL]    = { .type = NLA_U32 },
+               [IPSET_ATTR_BUCKETSIZE] = { .type = NLA_U8 },
                [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
                [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
                [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
index 136cf07..c1a11f0 100644 (file)
@@ -24,7 +24,8 @@
 /*                             3    Counters support added */
 /*                             4    Comments support added */
 /*                             5    Forceadd support added */
-#define IPSET_TYPE_REV_MAX     6 /* skbinfo mapping support added */
+/*                             6    skbinfo support added */
+#define IPSET_TYPE_REV_MAX     7 /* bucketsize, initval support added */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
@@ -354,11 +355,13 @@ static struct ip_set_type hash_net_type __read_mostly = {
        .family         = NFPROTO_UNSPEC,
        .revision_min   = IPSET_TYPE_REV_MIN,
        .revision_max   = IPSET_TYPE_REV_MAX,
+       .create_flags[IPSET_TYPE_REV_MAX] = IPSET_CREATE_FLAG_BUCKETSIZE,
        .create         = hash_net_create,
        .create_policy  = {
                [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
                [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
-               [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
+               [IPSET_ATTR_INITVAL]    = { .type = NLA_U32 },
+               [IPSET_ATTR_BUCKETSIZE] = { .type = NLA_U8 },
                [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
                [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
                [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
index be5e95a..3d74169 100644 (file)
@@ -26,7 +26,8 @@
 /*                             4    Comments support added */
 /*                             5    Forceadd support added */
 /*                             6    skbinfo support added */
-#define IPSET_TYPE_REV_MAX     7 /* interface wildcard support added */
+/*                             7    interface wildcard support added */
+#define IPSET_TYPE_REV_MAX     8 /* bucketsize, initval support added */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
@@ -470,11 +471,13 @@ static struct ip_set_type hash_netiface_type __read_mostly = {
        .family         = NFPROTO_UNSPEC,
        .revision_min   = IPSET_TYPE_REV_MIN,
        .revision_max   = IPSET_TYPE_REV_MAX,
+       .create_flags[IPSET_TYPE_REV_MAX] = IPSET_CREATE_FLAG_BUCKETSIZE,
        .create         = hash_netiface_create,
        .create_policy  = {
                [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
                [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
-               [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
+               [IPSET_ATTR_INITVAL]    = { .type = NLA_U32 },
+               [IPSET_ATTR_BUCKETSIZE] = { .type = NLA_U8 },
                [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
                [IPSET_ATTR_PROTO]      = { .type = NLA_U8 },
                [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
index da4ef91..6532f05 100644 (file)
@@ -22,7 +22,8 @@
 
 #define IPSET_TYPE_REV_MIN     0
 /*                             1          Forceadd support added */
-#define IPSET_TYPE_REV_MAX     2       /* skbinfo support added */
+/*                             2          skbinfo support added */
+#define IPSET_TYPE_REV_MAX     3       /* bucketsize, initval support added */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>");
@@ -459,11 +460,13 @@ static struct ip_set_type hash_netnet_type __read_mostly = {
        .family         = NFPROTO_UNSPEC,
        .revision_min   = IPSET_TYPE_REV_MIN,
        .revision_max   = IPSET_TYPE_REV_MAX,
+       .create_flags[IPSET_TYPE_REV_MAX] = IPSET_CREATE_FLAG_BUCKETSIZE,
        .create         = hash_netnet_create,
        .create_policy  = {
                [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
                [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
-               [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
+               [IPSET_ATTR_INITVAL]    = { .type = NLA_U32 },
+               [IPSET_ATTR_BUCKETSIZE] = { .type = NLA_U8 },
                [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
                [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
                [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
index 34448df..ec1564a 100644 (file)
@@ -26,7 +26,8 @@
 /*                             4    Counters support added */
 /*                             5    Comments support added */
 /*                             6    Forceadd support added */
-#define IPSET_TYPE_REV_MAX     7 /* skbinfo support added */
+/*                             7    skbinfo support added */
+#define IPSET_TYPE_REV_MAX     8 /* bucketsize, initval support added */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
@@ -460,11 +461,13 @@ static struct ip_set_type hash_netport_type __read_mostly = {
        .family         = NFPROTO_UNSPEC,
        .revision_min   = IPSET_TYPE_REV_MIN,
        .revision_max   = IPSET_TYPE_REV_MAX,
+       .create_flags[IPSET_TYPE_REV_MAX] = IPSET_CREATE_FLAG_BUCKETSIZE,
        .create         = hash_netport_create,
        .create_policy  = {
                [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
                [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
-               [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
+               [IPSET_ATTR_INITVAL]    = { .type = NLA_U32 },
+               [IPSET_ATTR_BUCKETSIZE] = { .type = NLA_U8 },
                [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
                [IPSET_ATTR_PROTO]      = { .type = NLA_U8 },
                [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
index 934c171..0e91d1e 100644 (file)
@@ -23,7 +23,8 @@
 #define IPSET_TYPE_REV_MIN     0
 /*                             0    Comments support added */
 /*                             1    Forceadd support added */
-#define IPSET_TYPE_REV_MAX     2 /* skbinfo support added */
+/*                             2    skbinfo support added */
+#define IPSET_TYPE_REV_MAX     3 /* bucketsize, initval support added */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>");
@@ -558,11 +559,13 @@ static struct ip_set_type hash_netportnet_type __read_mostly = {
        .family         = NFPROTO_UNSPEC,
        .revision_min   = IPSET_TYPE_REV_MIN,
        .revision_max   = IPSET_TYPE_REV_MAX,
+       .create_flags[IPSET_TYPE_REV_MAX] = IPSET_CREATE_FLAG_BUCKETSIZE,
        .create         = hash_netportnet_create,
        .create_policy  = {
                [IPSET_ATTR_HASHSIZE]   = { .type = NLA_U32 },
                [IPSET_ATTR_MAXELEM]    = { .type = NLA_U32 },
-               [IPSET_ATTR_PROBES]     = { .type = NLA_U8 },
+               [IPSET_ATTR_INITVAL]    = { .type = NLA_U32 },
+               [IPSET_ATTR_BUCKETSIZE] = { .type = NLA_U8 },
                [IPSET_ATTR_RESIZE]     = { .type = NLA_U8  },
                [IPSET_ATTR_TIMEOUT]    = { .type = NLA_U32 },
                [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
index cc3c275..c0b8215 100644 (file)
@@ -742,12 +742,12 @@ static int ip_vs_route_me_harder(struct netns_ipvs *ipvs, int af,
                struct dst_entry *dst = skb_dst(skb);
 
                if (dst->dev && !(dst->dev->flags & IFF_LOOPBACK) &&
-                   ip6_route_me_harder(ipvs->net, skb) != 0)
+                   ip6_route_me_harder(ipvs->net, skb->sk, skb) != 0)
                        return 1;
        } else
 #endif
                if (!(skb_rtable(skb)->rt_flags & RTCF_LOCAL) &&
-                   ip_route_me_harder(ipvs->net, skb, RTN_LOCAL) != 0)
+                   ip_route_me_harder(ipvs->net, skb->sk, skb, RTN_LOCAL) != 0)
                        return 1;
 
        return 0;
index 59151dc..e87b6bd 100644 (file)
@@ -715,7 +715,7 @@ nf_nat_ipv4_local_fn(void *priv, struct sk_buff *skb,
 
                if (ct->tuplehash[dir].tuple.dst.u3.ip !=
                    ct->tuplehash[!dir].tuple.src.u3.ip) {
-                       err = ip_route_me_harder(state->net, skb, RTN_UNSPEC);
+                       err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC);
                        if (err < 0)
                                ret = NF_DROP_ERR(err);
                }
@@ -953,7 +953,7 @@ nf_nat_ipv6_local_fn(void *priv, struct sk_buff *skb,
 
                if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.dst.u3,
                                      &ct->tuplehash[!dir].tuple.src.u3)) {
-                       err = nf_ip6_route_me_harder(state->net, skb);
+                       err = nf_ip6_route_me_harder(state->net, state->sk, skb);
                        if (err < 0)
                                ret = NF_DROP_ERR(err);
                }
index 9cca35d..d7d34a6 100644 (file)
@@ -446,7 +446,7 @@ synproxy_send_tcp(struct net *net,
 
        skb_dst_set_noref(nskb, skb_dst(skb));
        nskb->protocol = htons(ETH_P_IP);
-       if (ip_route_me_harder(net, nskb, RTN_UNSPEC))
+       if (ip_route_me_harder(net, nskb->sk, nskb, RTN_UNSPEC))
                goto free_nskb;
 
        if (nfct) {
index 65cb8e3..bd0e12b 100644 (file)
@@ -581,7 +581,8 @@ struct nft_module_request {
 };
 
 #ifdef CONFIG_MODULES
-static int nft_request_module(struct net *net, const char *fmt, ...)
+static __printf(2, 3) int nft_request_module(struct net *net, const char *fmt,
+                                            ...)
 {
        char module_name[MODULE_NAME_LEN];
        struct nft_module_request *req;
@@ -7137,7 +7138,7 @@ static void nf_tables_flowtable_notify(struct nft_ctx *ctx,
                        GFP_KERNEL);
        kfree(buf);
 
-       if (ctx->report &&
+       if (!ctx->report &&
            !nfnetlink_has_listeners(ctx->net, NFNLGRP_NFTABLES))
                return;
 
@@ -7259,7 +7260,7 @@ static void nf_tables_gen_notify(struct net *net, struct sk_buff *skb,
        audit_log_nfcfg("?:0;?:0", 0, net->nft.base_seq,
                        AUDIT_NFT_OP_GEN_REGISTER, GFP_KERNEL);
 
-       if (nlmsg_report(nlh) &&
+       if (!nlmsg_report(nlh) &&
            !nfnetlink_has_listeners(net, NFNLGRP_NFTABLES))
                return;
 
@@ -8053,12 +8054,16 @@ static void nf_tables_abort_release(struct nft_trans *trans)
        kfree(trans);
 }
 
-static int __nf_tables_abort(struct net *net, bool autoload)
+static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
 {
        struct nft_trans *trans, *next;
        struct nft_trans_elem *te;
        struct nft_hook *hook;
 
+       if (action == NFNL_ABORT_VALIDATE &&
+           nf_tables_validate(net) < 0)
+               return -EAGAIN;
+
        list_for_each_entry_safe_reverse(trans, next, &net->nft.commit_list,
                                         list) {
                switch (trans->msg_type) {
@@ -8190,7 +8195,7 @@ static int __nf_tables_abort(struct net *net, bool autoload)
                nf_tables_abort_release(trans);
        }
 
-       if (autoload)
+       if (action == NFNL_ABORT_AUTOLOAD)
                nf_tables_module_autoload(net);
        else
                nf_tables_module_autoload_cleanup(net);
@@ -8203,9 +8208,10 @@ static void nf_tables_cleanup(struct net *net)
        nft_validate_state_update(net, NFT_VALIDATE_SKIP);
 }
 
-static int nf_tables_abort(struct net *net, struct sk_buff *skb, bool autoload)
+static int nf_tables_abort(struct net *net, struct sk_buff *skb,
+                          enum nfnl_abort_action action)
 {
-       int ret = __nf_tables_abort(net, autoload);
+       int ret = __nf_tables_abort(net, action);
 
        mutex_unlock(&net->nft.commit_mutex);
 
@@ -8836,7 +8842,7 @@ static void __net_exit nf_tables_exit_net(struct net *net)
 {
        mutex_lock(&net->nft.commit_mutex);
        if (!list_empty(&net->nft.commit_list))
-               __nf_tables_abort(net, false);
+               __nf_tables_abort(net, NFNL_ABORT_NONE);
        __nft_release_tables(net);
        mutex_unlock(&net->nft.commit_mutex);
        WARN_ON_ONCE(!list_empty(&net->nft.tables));
index 2daa1f6..d3df66a 100644 (file)
@@ -333,7 +333,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
                return netlink_ack(skb, nlh, -EINVAL, NULL);
 replay:
        status = 0;
-
+replay_abort:
        skb = netlink_skb_clone(oskb, GFP_KERNEL);
        if (!skb)
                return netlink_ack(oskb, nlh, -ENOMEM, NULL);
@@ -499,7 +499,7 @@ ack:
        }
 done:
        if (status & NFNL_BATCH_REPLAY) {
-               ss->abort(net, oskb, true);
+               ss->abort(net, oskb, NFNL_ABORT_AUTOLOAD);
                nfnl_err_reset(&err_list);
                kfree_skb(skb);
                module_put(ss->owner);
@@ -510,11 +510,25 @@ done:
                        status |= NFNL_BATCH_REPLAY;
                        goto done;
                } else if (err) {
-                       ss->abort(net, oskb, false);
+                       ss->abort(net, oskb, NFNL_ABORT_NONE);
                        netlink_ack(oskb, nlmsg_hdr(oskb), err, NULL);
                }
        } else {
-               ss->abort(net, oskb, false);
+               enum nfnl_abort_action abort_action;
+
+               if (status & NFNL_BATCH_FAILURE)
+                       abort_action = NFNL_ABORT_NONE;
+               else
+                       abort_action = NFNL_ABORT_VALIDATE;
+
+               err = ss->abort(net, oskb, abort_action);
+               if (err == -EAGAIN) {
+                       nfnl_err_reset(&err_list);
+                       kfree_skb(skb);
+                       module_put(ss->owner);
+                       status |= NFNL_BATCH_FAILURE;
+                       goto replay_abort;
+               }
        }
        if (ss->cleanup)
                ss->cleanup(net);
index 8826bbe..edd02cd 100644 (file)
@@ -42,7 +42,7 @@ static unsigned int nf_route_table_hook4(void *priv,
                    iph->daddr != daddr ||
                    skb->mark != mark ||
                    iph->tos != tos) {
-                       err = ip_route_me_harder(state->net, skb, RTN_UNSPEC);
+                       err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC);
                        if (err < 0)
                                ret = NF_DROP_ERR(err);
                }
@@ -92,7 +92,7 @@ static unsigned int nf_route_table_hook6(void *priv,
             skb->mark != mark ||
             ipv6_hdr(skb)->hop_limit != hop_limit ||
             flowlabel != *((u32 *)ipv6_hdr(skb)))) {
-               err = nf_ip6_route_me_harder(state->net, skb);
+               err = nf_ip6_route_me_harder(state->net, state->sk, skb);
                if (err < 0)
                        ret = NF_DROP_ERR(err);
        }
index 61fb7e8..927ff84 100644 (file)
@@ -40,6 +40,7 @@ int nft_reject_init(const struct nft_ctx *ctx,
                    const struct nlattr * const tb[])
 {
        struct nft_reject *priv = nft_expr_priv(expr);
+       int icmp_code;
 
        if (tb[NFTA_REJECT_TYPE] == NULL)
                return -EINVAL;
@@ -47,9 +48,17 @@ int nft_reject_init(const struct nft_ctx *ctx,
        priv->type = ntohl(nla_get_be32(tb[NFTA_REJECT_TYPE]));
        switch (priv->type) {
        case NFT_REJECT_ICMP_UNREACH:
+       case NFT_REJECT_ICMPX_UNREACH:
                if (tb[NFTA_REJECT_ICMP_CODE] == NULL)
                        return -EINVAL;
-               priv->icmp_code = nla_get_u8(tb[NFTA_REJECT_ICMP_CODE]);
+
+               icmp_code = nla_get_u8(tb[NFTA_REJECT_ICMP_CODE]);
+               if (priv->type == NFT_REJECT_ICMPX_UNREACH &&
+                   icmp_code > NFT_REJECT_ICMPX_MAX)
+                       return -EINVAL;
+
+               priv->icmp_code = icmp_code;
+               break;
        case NFT_REJECT_TCP_RST:
                break;
        default:
@@ -69,6 +78,7 @@ int nft_reject_dump(struct sk_buff *skb, const struct nft_expr *expr)
 
        switch (priv->type) {
        case NFT_REJECT_ICMP_UNREACH:
+       case NFT_REJECT_ICMPX_UNREACH:
                if (nla_put_u8(skb, NFTA_REJECT_ICMP_CODE, priv->icmp_code))
                        goto nla_put_failure;
                break;
index cf8f264..32f3ea3 100644 (file)
@@ -58,60 +58,16 @@ static void nft_reject_inet_eval(const struct nft_expr *expr,
        regs->verdict.code = NF_DROP;
 }
 
-static int nft_reject_inet_init(const struct nft_ctx *ctx,
-                               const struct nft_expr *expr,
-                               const struct nlattr * const tb[])
+static int nft_reject_inet_validate(const struct nft_ctx *ctx,
+                                   const struct nft_expr *expr,
+                                   const struct nft_data **data)
 {
-       struct nft_reject *priv = nft_expr_priv(expr);
-       int icmp_code;
-
-       if (tb[NFTA_REJECT_TYPE] == NULL)
-               return -EINVAL;
-
-       priv->type = ntohl(nla_get_be32(tb[NFTA_REJECT_TYPE]));
-       switch (priv->type) {
-       case NFT_REJECT_ICMP_UNREACH:
-       case NFT_REJECT_ICMPX_UNREACH:
-               if (tb[NFTA_REJECT_ICMP_CODE] == NULL)
-                       return -EINVAL;
-
-               icmp_code = nla_get_u8(tb[NFTA_REJECT_ICMP_CODE]);
-               if (priv->type == NFT_REJECT_ICMPX_UNREACH &&
-                   icmp_code > NFT_REJECT_ICMPX_MAX)
-                       return -EINVAL;
-
-               priv->icmp_code = icmp_code;
-               break;
-       case NFT_REJECT_TCP_RST:
-               break;
-       default:
-               return -EINVAL;
-       }
-       return 0;
-}
-
-static int nft_reject_inet_dump(struct sk_buff *skb,
-                               const struct nft_expr *expr)
-{
-       const struct nft_reject *priv = nft_expr_priv(expr);
-
-       if (nla_put_be32(skb, NFTA_REJECT_TYPE, htonl(priv->type)))
-               goto nla_put_failure;
-
-       switch (priv->type) {
-       case NFT_REJECT_ICMP_UNREACH:
-       case NFT_REJECT_ICMPX_UNREACH:
-               if (nla_put_u8(skb, NFTA_REJECT_ICMP_CODE, priv->icmp_code))
-                       goto nla_put_failure;
-               break;
-       default:
-               break;
-       }
-
-       return 0;
-
-nla_put_failure:
-       return -1;
+       return nft_chain_validate_hooks(ctx->chain,
+                                       (1 << NF_INET_LOCAL_IN) |
+                                       (1 << NF_INET_FORWARD) |
+                                       (1 << NF_INET_LOCAL_OUT) |
+                                       (1 << NF_INET_PRE_ROUTING) |
+                                       (1 << NF_INET_INGRESS));
 }
 
 static struct nft_expr_type nft_reject_inet_type;
@@ -119,9 +75,9 @@ static const struct nft_expr_ops nft_reject_inet_ops = {
        .type           = &nft_reject_inet_type,
        .size           = NFT_EXPR_SIZE(sizeof(struct nft_reject)),
        .eval           = nft_reject_inet_eval,
-       .init           = nft_reject_inet_init,
-       .dump           = nft_reject_inet_dump,
-       .validate       = nft_reject_validate,
+       .init           = nft_reject_init,
+       .dump           = nft_reject_dump,
+       .validate       = nft_reject_inet_validate,
 };
 
 static struct nft_expr_type nft_reject_inet_type __read_mostly = {
diff --git a/net/netfilter/nft_reject_netdev.c b/net/netfilter/nft_reject_netdev.c
new file mode 100644 (file)
index 0000000..d89f687
--- /dev/null
@@ -0,0 +1,189 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2020 Laura Garcia Liebana <nevola@gmail.com>
+ * Copyright (c) 2020 Jose M. Guisado <guigom@riseup.net>
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/netlink.h>
+#include <linux/netfilter.h>
+#include <linux/netfilter/nf_tables.h>
+#include <net/netfilter/nf_tables.h>
+#include <net/netfilter/nft_reject.h>
+#include <net/netfilter/ipv4/nf_reject.h>
+#include <net/netfilter/ipv6/nf_reject.h>
+
+static void nft_reject_queue_xmit(struct sk_buff *nskb, struct sk_buff *oldskb)
+{
+       dev_hard_header(nskb, nskb->dev, ntohs(oldskb->protocol),
+                       eth_hdr(oldskb)->h_source, eth_hdr(oldskb)->h_dest,
+                       nskb->len);
+       dev_queue_xmit(nskb);
+}
+
+static void nft_reject_netdev_send_v4_tcp_reset(struct net *net,
+                                               struct sk_buff *oldskb,
+                                               const struct net_device *dev,
+                                               int hook)
+{
+       struct sk_buff *nskb;
+
+       nskb = nf_reject_skb_v4_tcp_reset(net, oldskb, dev, hook);
+       if (!nskb)
+               return;
+
+       nft_reject_queue_xmit(nskb, oldskb);
+}
+
+static void nft_reject_netdev_send_v4_unreach(struct net *net,
+                                             struct sk_buff *oldskb,
+                                             const struct net_device *dev,
+                                             int hook, u8 code)
+{
+       struct sk_buff *nskb;
+
+       nskb = nf_reject_skb_v4_unreach(net, oldskb, dev, hook, code);
+       if (!nskb)
+               return;
+
+       nft_reject_queue_xmit(nskb, oldskb);
+}
+
+static void nft_reject_netdev_send_v6_tcp_reset(struct net *net,
+                                               struct sk_buff *oldskb,
+                                               const struct net_device *dev,
+                                               int hook)
+{
+       struct sk_buff *nskb;
+
+       nskb = nf_reject_skb_v6_tcp_reset(net, oldskb, dev, hook);
+       if (!nskb)
+               return;
+
+       nft_reject_queue_xmit(nskb, oldskb);
+}
+
+
+static void nft_reject_netdev_send_v6_unreach(struct net *net,
+                                             struct sk_buff *oldskb,
+                                             const struct net_device *dev,
+                                             int hook, u8 code)
+{
+       struct sk_buff *nskb;
+
+       nskb = nf_reject_skb_v6_unreach(net, oldskb, dev, hook, code);
+       if (!nskb)
+               return;
+
+       nft_reject_queue_xmit(nskb, oldskb);
+}
+
+static void nft_reject_netdev_eval(const struct nft_expr *expr,
+                                  struct nft_regs *regs,
+                                  const struct nft_pktinfo *pkt)
+{
+       struct ethhdr *eth = eth_hdr(pkt->skb);
+       struct nft_reject *priv = nft_expr_priv(expr);
+       const unsigned char *dest = eth->h_dest;
+
+       if (is_broadcast_ether_addr(dest) ||
+           is_multicast_ether_addr(dest))
+               goto out;
+
+       switch (eth->h_proto) {
+       case htons(ETH_P_IP):
+               switch (priv->type) {
+               case NFT_REJECT_ICMP_UNREACH:
+                       nft_reject_netdev_send_v4_unreach(nft_net(pkt), pkt->skb,
+                                                         nft_in(pkt),
+                                                         nft_hook(pkt),
+                                                         priv->icmp_code);
+                       break;
+               case NFT_REJECT_TCP_RST:
+                       nft_reject_netdev_send_v4_tcp_reset(nft_net(pkt), pkt->skb,
+                                                           nft_in(pkt),
+                                                           nft_hook(pkt));
+                       break;
+               case NFT_REJECT_ICMPX_UNREACH:
+                       nft_reject_netdev_send_v4_unreach(nft_net(pkt), pkt->skb,
+                                                         nft_in(pkt),
+                                                         nft_hook(pkt),
+                                                         nft_reject_icmp_code(priv->icmp_code));
+                       break;
+               }
+               break;
+       case htons(ETH_P_IPV6):
+               switch (priv->type) {
+               case NFT_REJECT_ICMP_UNREACH:
+                       nft_reject_netdev_send_v6_unreach(nft_net(pkt), pkt->skb,
+                                                         nft_in(pkt),
+                                                         nft_hook(pkt),
+                                                         priv->icmp_code);
+                       break;
+               case NFT_REJECT_TCP_RST:
+                       nft_reject_netdev_send_v6_tcp_reset(nft_net(pkt), pkt->skb,
+                                                           nft_in(pkt),
+                                                           nft_hook(pkt));
+                       break;
+               case NFT_REJECT_ICMPX_UNREACH:
+                       nft_reject_netdev_send_v6_unreach(nft_net(pkt), pkt->skb,
+                                                         nft_in(pkt),
+                                                         nft_hook(pkt),
+                                                         nft_reject_icmpv6_code(priv->icmp_code));
+                       break;
+               }
+               break;
+       default:
+               /* No explicit way to reject this protocol, drop it. */
+               break;
+       }
+out:
+       regs->verdict.code = NF_DROP;
+}
+
+static int nft_reject_netdev_validate(const struct nft_ctx *ctx,
+                                     const struct nft_expr *expr,
+                                     const struct nft_data **data)
+{
+       return nft_chain_validate_hooks(ctx->chain, (1 << NF_NETDEV_INGRESS));
+}
+
+static struct nft_expr_type nft_reject_netdev_type;
+static const struct nft_expr_ops nft_reject_netdev_ops = {
+       .type           = &nft_reject_netdev_type,
+       .size           = NFT_EXPR_SIZE(sizeof(struct nft_reject)),
+       .eval           = nft_reject_netdev_eval,
+       .init           = nft_reject_init,
+       .dump           = nft_reject_dump,
+       .validate       = nft_reject_netdev_validate,
+};
+
+static struct nft_expr_type nft_reject_netdev_type __read_mostly = {
+       .family         = NFPROTO_NETDEV,
+       .name           = "reject",
+       .ops            = &nft_reject_netdev_ops,
+       .policy         = nft_reject_policy,
+       .maxattr        = NFTA_REJECT_MAX,
+       .owner          = THIS_MODULE,
+};
+
+static int __init nft_reject_netdev_module_init(void)
+{
+       return nft_register_expr(&nft_reject_netdev_type);
+}
+
+static void __exit nft_reject_netdev_module_exit(void)
+{
+       nft_unregister_expr(&nft_reject_netdev_type);
+}
+
+module_init(nft_reject_netdev_module_init);
+module_exit(nft_reject_netdev_module_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Laura Garcia Liebana <nevola@gmail.com>");
+MODULE_AUTHOR("Jose M. Guisado <guigom@riseup.net>");
+MODULE_DESCRIPTION("Reject packets from netdev via nftables");
+MODULE_ALIAS_NFT_AF_EXPR(5, "reject");
index cedf47a..2182d36 100644 (file)
@@ -191,8 +191,8 @@ static int nf_ip_reroute(struct sk_buff *skb, const struct nf_queue_entry *entry
                      skb->mark == rt_info->mark &&
                      iph->daddr == rt_info->daddr &&
                      iph->saddr == rt_info->saddr))
-                       return ip_route_me_harder(entry->state.net, skb,
-                                                 RTN_UNSPEC);
+                       return ip_route_me_harder(entry->state.net, entry->state.sk,
+                                                 skb, RTN_UNSPEC);
        }
 #endif
        return 0;
index 4e62f2a..f28c894 100644 (file)
@@ -366,6 +366,7 @@ static const struct netlbl_calipso_ops *calipso_ops;
 
 /**
  * netlbl_calipso_ops_register - Register the CALIPSO operations
+ * @ops: ops to register
  *
  * Description:
  * Register the CALIPSO packet engine operations.
index 2e8e3f7..fc55c91 100644 (file)
@@ -1166,12 +1166,13 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
        struct netlbl_unlhsh_walk_arg cb_arg;
        u32 skip_bkt = cb->args[0];
        u32 skip_chain = cb->args[1];
-       u32 iter_bkt;
-       u32 iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0;
+       u32 skip_addr4 = cb->args[2];
+       u32 iter_bkt, iter_chain, iter_addr4 = 0, iter_addr6 = 0;
        struct netlbl_unlhsh_iface *iface;
        struct list_head *iter_list;
        struct netlbl_af4list *addr4;
 #if IS_ENABLED(CONFIG_IPV6)
+       u32 skip_addr6 = cb->args[3];
        struct netlbl_af6list *addr6;
 #endif
 
@@ -1182,7 +1183,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
        rcu_read_lock();
        for (iter_bkt = skip_bkt;
             iter_bkt < rcu_dereference(netlbl_unlhsh)->size;
-            iter_bkt++, iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0) {
+            iter_bkt++) {
                iter_list = &rcu_dereference(netlbl_unlhsh)->tbl[iter_bkt];
                list_for_each_entry_rcu(iface, iter_list, list) {
                        if (!iface->valid ||
@@ -1190,7 +1191,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
                                continue;
                        netlbl_af4list_foreach_rcu(addr4,
                                                   &iface->addr4_list) {
-                               if (iter_addr4++ < cb->args[2])
+                               if (iter_addr4++ < skip_addr4)
                                        continue;
                                if (netlbl_unlabel_staticlist_gen(
                                              NLBL_UNLABEL_C_STATICLIST,
@@ -1203,10 +1204,12 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
                                        goto unlabel_staticlist_return;
                                }
                        }
+                       iter_addr4 = 0;
+                       skip_addr4 = 0;
 #if IS_ENABLED(CONFIG_IPV6)
                        netlbl_af6list_foreach_rcu(addr6,
                                                   &iface->addr6_list) {
-                               if (iter_addr6++ < cb->args[3])
+                               if (iter_addr6++ < skip_addr6)
                                        continue;
                                if (netlbl_unlabel_staticlist_gen(
                                              NLBL_UNLABEL_C_STATICLIST,
@@ -1219,8 +1222,12 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
                                        goto unlabel_staticlist_return;
                                }
                        }
+                       iter_addr6 = 0;
+                       skip_addr6 = 0;
 #endif /* IPv6 */
                }
+               iter_chain = 0;
+               skip_chain = 0;
        }
 
 unlabel_staticlist_return:
index eb377f8..573c80c 100644 (file)
@@ -189,7 +189,8 @@ static const struct rfkill_ops nfc_rfkill_ops = {
  * nfc_start_poll - start polling for nfc targets
  *
  * @dev: The nfc device that must start polling
- * @protocols: bitset of nfc protocols that must be used for polling
+ * @im_protocols: bitset of nfc initiator protocols to be used for polling
+ * @tm_protocols: bitset of nfc transport protocols to be used for polling
  *
  * The device remains polling for targets until a target is found or
  * the nfc_stop_poll function is called.
@@ -436,6 +437,7 @@ error:
  *
  * @dev: The nfc device that found the target
  * @target_idx: index of the target that must be deactivated
+ * @mode: idle or sleep?
  */
 int nfc_deactivate_target(struct nfc_dev *dev, u32 target_idx, u8 mode)
 {
@@ -703,7 +705,11 @@ EXPORT_SYMBOL(nfc_tm_deactivated);
 /**
  * nfc_alloc_send_skb - allocate a skb for data exchange responses
  *
+ * @dev: device sending the response
+ * @sk: socket sending the response
+ * @flags: MSG_DONTWAIT flag
  * @size: size to allocate
+ * @err: pointer to memory to store the error code
  */
 struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk,
                                   unsigned int flags, unsigned int size,
@@ -1039,6 +1045,8 @@ struct nfc_dev *nfc_get_device(unsigned int idx)
  *
  * @ops: device operations
  * @supported_protocols: NFC protocols supported by the device
+ * @tx_headroom: reserved space at beginning of skb
+ * @tx_tailroom: reserved space at end of skb
  */
 struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
                                    u32 supported_protocols,
index e3599ed..da7e211 100644 (file)
@@ -458,6 +458,9 @@ static void digital_add_poll_tech(struct nfc_digital_dev *ddev, u8 rf_tech,
 
 /**
  * start_poll operation
+ * @nfc_dev: device to be polled
+ * @im_protocols: bitset of nfc initiator protocols to be used for polling
+ * @tm_protocols: bitset of nfc transport protocols to be used for polling
  *
  * For every supported protocol, the corresponding polling function is added
  * to the table of polling technologies (ddev->poll_techs[]) using
index 741da8f..4953ee5 100644 (file)
@@ -1112,6 +1112,8 @@ static struct nfc_ops nci_nfc_ops = {
  *
  * @ops: device operations
  * @supported_protocols: NFC protocols supported by the device
+ * @tx_headroom: Reserved space at beginning of skb
+ * @tx_tailroom: Reserved space at end of skb
  */
 struct nci_dev *nci_allocate_device(struct nci_ops *ops,
                                    __u32 supported_protocols,
index 832f898..9d6ef6c 100644 (file)
@@ -1703,13 +1703,13 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
        parms.port_no = OVSP_LOCAL;
        parms.upcall_portids = a[OVS_DP_ATTR_UPCALL_PID];
 
-       err = ovs_dp_change(dp, a);
-       if (err)
-               goto err_destroy_meters;
-
        /* So far only local changes have been made, now need the lock. */
        ovs_lock();
 
+       err = ovs_dp_change(dp, a);
+       if (err)
+               goto err_unlock_and_destroy_meters;
+
        vport = new_vport(&parms);
        if (IS_ERR(vport)) {
                err = PTR_ERR(vport);
@@ -1725,8 +1725,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
                                ovs_dp_reset_user_features(skb, info);
                }
 
-               ovs_unlock();
-               goto err_destroy_meters;
+               goto err_unlock_and_destroy_meters;
        }
 
        err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid,
@@ -1741,7 +1740,8 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
        ovs_notify(&dp_datapath_genl_family, reply, info);
        return 0;
 
-err_destroy_meters:
+err_unlock_and_destroy_meters:
+       ovs_unlock();
        ovs_meters_exit(dp);
 err_destroy_ports:
        kfree(dp->ports);
index b03d142..c7f34d6 100644 (file)
@@ -294,6 +294,10 @@ static bool icmp6hdr_ok(struct sk_buff *skb)
 
 /**
  * Parse vlan tag from vlan header.
+ * @skb: skb containing frame to parse
+ * @key_vh: pointer to parsed vlan tag
+ * @untag_vlan: should the vlan header be removed from the frame
+ *
  * Returns ERROR on memory error.
  * Returns 0 if it encounters a non-vlan or incomplete packet.
  * Returns 1 after successfully parsing vlan tag.
index f3486a3..c89c8da 100644 (file)
@@ -390,7 +390,7 @@ static struct mask_cache *tbl_mask_cache_alloc(u32 size)
 }
 int ovs_flow_tbl_masks_cache_resize(struct flow_table *table, u32 size)
 {
-       struct mask_cache *mc = rcu_dereference(table->mask_cache);
+       struct mask_cache *mc = rcu_dereference_ovsl(table->mask_cache);
        struct mask_cache *new;
 
        if (size == mc->cache_size)
index 8fbefd5..15424d2 100644 (file)
@@ -423,7 +423,7 @@ static int ovs_meter_cmd_set(struct sk_buff *skb, struct genl_info *info)
                return -EINVAL;
 
        meter = dp_meter_create(a);
-       if (IS_ERR_OR_NULL(meter))
+       if (IS_ERR(meter))
                return PTR_ERR(meter);
 
        reply = ovs_meter_cmd_reply_start(info, OVS_METER_CMD_SET,
index 82d801f..4ed7e52 100644 (file)
@@ -111,10 +111,12 @@ struct vport *ovs_vport_locate(const struct net *net, const char *name)
  *
  * @priv_size: Size of private data area to allocate.
  * @ops: vport device ops
+ * @parms: information about new vport.
  *
  * Allocate and initialize a new vport defined by @ops.  The vport will contain
  * a private data area of size @priv_size that can be accessed using
- * vport_priv().  vports that are no longer needed should be released with
+ * vport_priv().  Some parameters of the vport will be initialized from @parms.
+ * @vports that are no longer needed should be released with
  * vport_free().
  */
 struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
index cefbd50..62ebfaa 100644 (file)
@@ -1636,13 +1636,15 @@ static bool fanout_find_new_id(struct sock *sk, u16 *new_id)
        return false;
 }
 
-static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
+static int fanout_add(struct sock *sk, struct fanout_args *args)
 {
        struct packet_rollover *rollover = NULL;
        struct packet_sock *po = pkt_sk(sk);
+       u16 type_flags = args->type_flags;
        struct packet_fanout *f, *match;
        u8 type = type_flags & 0xff;
        u8 flags = type_flags >> 8;
+       u16 id = args->id;
        int err;
 
        switch (type) {
@@ -1700,11 +1702,21 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
                }
        }
        err = -EINVAL;
-       if (match && match->flags != flags)
-               goto out;
-       if (!match) {
+       if (match) {
+               if (match->flags != flags)
+                       goto out;
+               if (args->max_num_members &&
+                   args->max_num_members != match->max_num_members)
+                       goto out;
+       } else {
+               if (args->max_num_members > PACKET_FANOUT_MAX)
+                       goto out;
+               if (!args->max_num_members)
+                       /* legacy PACKET_FANOUT_MAX */
+                       args->max_num_members = 256;
                err = -ENOMEM;
-               match = kzalloc(sizeof(*match), GFP_KERNEL);
+               match = kvzalloc(struct_size(match, arr, args->max_num_members),
+                                GFP_KERNEL);
                if (!match)
                        goto out;
                write_pnet(&match->net, sock_net(sk));
@@ -1720,6 +1732,7 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
                match->prot_hook.func = packet_rcv_fanout;
                match->prot_hook.af_packet_priv = match;
                match->prot_hook.id_match = match_fanout_group;
+               match->max_num_members = args->max_num_members;
                list_add(&match->list, &fanout_list);
        }
        err = -EINVAL;
@@ -1730,7 +1743,7 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
            match->prot_hook.type == po->prot_hook.type &&
            match->prot_hook.dev == po->prot_hook.dev) {
                err = -ENOSPC;
-               if (refcount_read(&match->sk_ref) < PACKET_FANOUT_MAX) {
+               if (refcount_read(&match->sk_ref) < match->max_num_members) {
                        __dev_remove_pack(&po->prot_hook);
                        po->fanout = match;
                        po->rollover = rollover;
@@ -1744,7 +1757,7 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
 
        if (err && !refcount_read(&match->sk_ref)) {
                list_del(&match->list);
-               kfree(match);
+               kvfree(match);
        }
 
 out:
@@ -3075,7 +3088,7 @@ static int packet_release(struct socket *sock)
        kfree(po->rollover);
        if (f) {
                fanout_release_data(f);
-               kfree(f);
+               kvfree(f);
        }
        /*
         *      Now the socket is dead. No more input will appear.
@@ -3866,14 +3879,14 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval,
        }
        case PACKET_FANOUT:
        {
-               int val;
+               struct fanout_args args = { 0 };
 
-               if (optlen != sizeof(val))
+               if (optlen != sizeof(int) && optlen != sizeof(args))
                        return -EINVAL;
-               if (copy_from_sockptr(&val, optval, sizeof(val)))
+               if (copy_from_sockptr(&args, optval, optlen))
                        return -EFAULT;
 
-               return fanout_add(sk, val & 0xffff, val >> 16);
+               return fanout_add(sk, &args);
        }
        case PACKET_FANOUT_DATA:
        {
index fd41ecb..baafc3f 100644 (file)
@@ -77,11 +77,12 @@ struct packet_ring_buffer {
 };
 
 extern struct mutex fanout_mutex;
-#define PACKET_FANOUT_MAX      256
+#define PACKET_FANOUT_MAX      (1 << 16)
 
 struct packet_fanout {
        possible_net_t          net;
        unsigned int            num_members;
+       u32                     max_num_members;
        u16                     id;
        u8                      type;
        u8                      flags;
@@ -90,10 +91,10 @@ struct packet_fanout {
                struct bpf_prog __rcu   *bpf_prog;
        };
        struct list_head        list;
-       struct sock             *arr[PACKET_FANOUT_MAX];
        spinlock_t              lock;
        refcount_t              sk_ref;
        struct packet_type      prot_hook ____cacheline_aligned_in_smp;
+       struct sock             *arr[];
 };
 
 struct packet_rollover {
index b8559c8..56aaf8c 100644 (file)
@@ -517,10 +517,6 @@ static int ctrl_cmd_new_server(struct sockaddr_qrtr *from,
                port = from->sq_port;
        }
 
-       /* Don't accept spoofed messages */
-       if (from->sq_node != node_id)
-               return -EINVAL;
-
        srv = server_add(service, instance, node_id, port);
        if (!srv)
                return -EINVAL;
@@ -559,10 +555,6 @@ static int ctrl_cmd_del_server(struct sockaddr_qrtr *from,
                port = from->sq_port;
        }
 
-       /* Don't accept spoofed messages */
-       if (from->sq_node != node_id)
-               return -EINVAL;
-
        /* Local servers may only unregister themselves */
        if (from->sq_node == qrtr_ns.local_node && from->sq_port != port)
                return -EINVAL;
index 957aa92..f4ab3ca 100644 (file)
@@ -171,8 +171,13 @@ static void __qrtr_node_release(struct kref *kref)
        void __rcu **slot;
 
        spin_lock_irqsave(&qrtr_nodes_lock, flags);
-       if (node->nid != QRTR_EP_NID_AUTO)
-               radix_tree_delete(&qrtr_nodes, node->nid);
+       /* If the node is a bridge for other nodes, there are possibly
+        * multiple entries pointing to our released node, delete them all.
+        */
+       radix_tree_for_each_slot(slot, &qrtr_nodes, &iter, 0) {
+               if (*slot == node)
+                       radix_tree_iter_delete(&qrtr_nodes, &iter, slot);
+       }
        spin_unlock_irqrestore(&qrtr_nodes_lock, flags);
 
        list_del(&node->item);
@@ -347,7 +352,7 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb,
        hdr->src_port_id = cpu_to_le32(from->sq_port);
        if (to->sq_port == QRTR_PORT_CTRL) {
                hdr->dst_node_id = cpu_to_le32(node->nid);
-               hdr->dst_port_id = cpu_to_le32(QRTR_NODE_BCAST);
+               hdr->dst_port_id = cpu_to_le32(QRTR_PORT_CTRL);
        } else {
                hdr->dst_node_id = cpu_to_le32(to->sq_node);
                hdr->dst_port_id = cpu_to_le32(to->sq_port);
@@ -401,12 +406,13 @@ static void qrtr_node_assign(struct qrtr_node *node, unsigned int nid)
 {
        unsigned long flags;
 
-       if (node->nid != QRTR_EP_NID_AUTO || nid == QRTR_EP_NID_AUTO)
+       if (nid == QRTR_EP_NID_AUTO)
                return;
 
        spin_lock_irqsave(&qrtr_nodes_lock, flags);
        radix_tree_insert(&qrtr_nodes, nid, node);
-       node->nid = nid;
+       if (node->nid == QRTR_EP_NID_AUTO)
+               node->nid = nid;
        spin_unlock_irqrestore(&qrtr_nodes_lock, flags);
 }
 
@@ -494,6 +500,13 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len)
 
        qrtr_node_assign(node, cb->src_node);
 
+       if (cb->type == QRTR_TYPE_NEW_SERVER) {
+               /* Remote node endpoint can bridge other distant nodes */
+               const struct qrtr_ctrl_pkt *pkt = data + hdrlen;
+
+               qrtr_node_assign(node, le32_to_cpu(pkt->server.node));
+       }
+
        if (cb->type == QRTR_TYPE_RESUME_TX) {
                qrtr_tx_resume(node, skb);
        } else {
@@ -519,18 +532,20 @@ EXPORT_SYMBOL_GPL(qrtr_endpoint_post);
 /**
  * qrtr_alloc_ctrl_packet() - allocate control packet skb
  * @pkt: reference to qrtr_ctrl_pkt pointer
+ * @flags: the type of memory to allocate
  *
  * Returns newly allocated sk_buff, or NULL on failure
  *
  * This function allocates a sk_buff large enough to carry a qrtr_ctrl_pkt and
  * on success returns a reference to the control packet in @pkt.
  */
-static struct sk_buff *qrtr_alloc_ctrl_packet(struct qrtr_ctrl_pkt **pkt)
+static struct sk_buff *qrtr_alloc_ctrl_packet(struct qrtr_ctrl_pkt **pkt,
+                                             gfp_t flags)
 {
        const int pkt_len = sizeof(struct qrtr_ctrl_pkt);
        struct sk_buff *skb;
 
-       skb = alloc_skb(QRTR_HDR_MAX_SIZE + pkt_len, GFP_KERNEL);
+       skb = alloc_skb(QRTR_HDR_MAX_SIZE + pkt_len, flags);
        if (!skb)
                return NULL;
 
@@ -592,6 +607,7 @@ void qrtr_endpoint_unregister(struct qrtr_endpoint *ep)
        struct qrtr_ctrl_pkt *pkt;
        struct qrtr_tx_flow *flow;
        struct sk_buff *skb;
+       unsigned long flags;
        void __rcu **slot;
 
        mutex_lock(&node->ep_lock);
@@ -599,11 +615,18 @@ void qrtr_endpoint_unregister(struct qrtr_endpoint *ep)
        mutex_unlock(&node->ep_lock);
 
        /* Notify the local controller about the event */
-       skb = qrtr_alloc_ctrl_packet(&pkt);
-       if (skb) {
-               pkt->cmd = cpu_to_le32(QRTR_TYPE_BYE);
-               qrtr_local_enqueue(NULL, skb, QRTR_TYPE_BYE, &src, &dst);
+       spin_lock_irqsave(&qrtr_nodes_lock, flags);
+       radix_tree_for_each_slot(slot, &qrtr_nodes, &iter, 0) {
+               if (*slot != node)
+                       continue;
+               src.sq_node = iter.index;
+               skb = qrtr_alloc_ctrl_packet(&pkt, GFP_ATOMIC);
+               if (skb) {
+                       pkt->cmd = cpu_to_le32(QRTR_TYPE_BYE);
+                       qrtr_local_enqueue(NULL, skb, QRTR_TYPE_BYE, &src, &dst);
+               }
        }
+       spin_unlock_irqrestore(&qrtr_nodes_lock, flags);
 
        /* Wake up any transmitters waiting for resume-tx from the node */
        mutex_lock(&node->qrtr_tx_lock);
@@ -656,7 +679,7 @@ static void qrtr_port_remove(struct qrtr_sock *ipc)
        to.sq_node = QRTR_NODE_BCAST;
        to.sq_port = QRTR_PORT_CTRL;
 
-       skb = qrtr_alloc_ctrl_packet(&pkt);
+       skb = qrtr_alloc_ctrl_packet(&pkt, GFP_KERNEL);
        if (skb) {
                pkt->cmd = cpu_to_le32(QRTR_TYPE_DEL_CLIENT);
                pkt->client.node = cpu_to_le32(ipc->us.sq_node);
@@ -982,7 +1005,7 @@ static int qrtr_send_resume_tx(struct qrtr_cb *cb)
        if (!node)
                return -EINVAL;
 
-       skb = qrtr_alloc_ctrl_packet(&pkt);
+       skb = qrtr_alloc_ctrl_packet(&pkt, GFP_KERNEL);
        if (!skb)
                return -ENOMEM;
 
index 06603dd..b36b606 100644 (file)
@@ -956,9 +956,10 @@ int rds_ib_cm_initiate_connect(struct rdma_cm_id *cm_id, bool isv6)
        rds_ib_cm_fill_conn_param(conn, &conn_param, &dp,
                                  conn->c_proposed_version,
                                  UINT_MAX, UINT_MAX, isv6);
-       ret = rdma_connect(cm_id, &conn_param);
+       ret = rdma_connect_locked(cm_id, &conn_param);
        if (ret)
-               rds_ib_conn_error(conn, "rdma_connect failed (%d)\n", ret);
+               rds_ib_conn_error(conn, "rdma_connect_locked failed (%d)\n",
+                                 ret);
 
 out:
        /* Beware - returning non-zero tells the rdma_cm to destroy
index f66417d..60e1572 100644 (file)
@@ -215,6 +215,36 @@ static size_t tcf_action_fill_size(const struct tc_action *act)
        return sz;
 }
 
+static int
+tcf_action_dump_terse(struct sk_buff *skb, struct tc_action *a, bool from_act)
+{
+       unsigned char *b = skb_tail_pointer(skb);
+       struct tc_cookie *cookie;
+
+       if (nla_put_string(skb, TCA_KIND, a->ops->kind))
+               goto nla_put_failure;
+       if (tcf_action_copy_stats(skb, a, 0))
+               goto nla_put_failure;
+       if (from_act && nla_put_u32(skb, TCA_ACT_INDEX, a->tcfa_index))
+               goto nla_put_failure;
+
+       rcu_read_lock();
+       cookie = rcu_dereference(a->act_cookie);
+       if (cookie) {
+               if (nla_put(skb, TCA_ACT_COOKIE, cookie->len, cookie->data)) {
+                       rcu_read_unlock();
+                       goto nla_put_failure;
+               }
+       }
+       rcu_read_unlock();
+
+       return 0;
+
+nla_put_failure:
+       nlmsg_trim(skb, b);
+       return -1;
+}
+
 static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
                           struct netlink_callback *cb)
 {
@@ -248,7 +278,9 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
                        index--;
                        goto nla_put_failure;
                }
-               err = tcf_action_dump_1(skb, p, 0, 0);
+               err = (act_flags & TCA_FLAG_TERSE_DUMP) ?
+                       tcf_action_dump_terse(skb, p, true) :
+                       tcf_action_dump_1(skb, p, 0, 0);
                if (err < 0) {
                        index--;
                        nlmsg_trim(skb, nest);
@@ -651,7 +683,7 @@ static struct tc_action_ops *tc_lookup_action(struct nlattr *kind)
        return res;
 }
 
-/*TCA_ACT_MAX_PRIO is 32, there count upto 32 */
+/*TCA_ACT_MAX_PRIO is 32, there count up to 32 */
 #define TCA_ACT_MAX_PRIO_MASK 0x1FF
 int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions,
                    int nr_actions, struct tcf_result *res)
@@ -752,34 +784,6 @@ tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
        return a->ops->dump(skb, a, bind, ref);
 }
 
-static int
-tcf_action_dump_terse(struct sk_buff *skb, struct tc_action *a)
-{
-       unsigned char *b = skb_tail_pointer(skb);
-       struct tc_cookie *cookie;
-
-       if (nla_put_string(skb, TCA_KIND, a->ops->kind))
-               goto nla_put_failure;
-       if (tcf_action_copy_stats(skb, a, 0))
-               goto nla_put_failure;
-
-       rcu_read_lock();
-       cookie = rcu_dereference(a->act_cookie);
-       if (cookie) {
-               if (nla_put(skb, TCA_ACT_COOKIE, cookie->len, cookie->data)) {
-                       rcu_read_unlock();
-                       goto nla_put_failure;
-               }
-       }
-       rcu_read_unlock();
-
-       return 0;
-
-nla_put_failure:
-       nlmsg_trim(skb, b);
-       return -1;
-}
-
 int
 tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
 {
@@ -787,7 +791,7 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
        unsigned char *b = skb_tail_pointer(skb);
        struct nlattr *nest;
 
-       if (tcf_action_dump_terse(skb, a))
+       if (tcf_action_dump_terse(skb, a, false))
                goto nla_put_failure;
 
        if (a->hw_stats != TCA_ACT_HW_STATS_ANY &&
@@ -832,7 +836,7 @@ int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[],
                nest = nla_nest_start_noflag(skb, i + 1);
                if (nest == NULL)
                        goto nla_put_failure;
-               err = terse ? tcf_action_dump_terse(skb, a) :
+               err = terse ? tcf_action_dump_terse(skb, a, false) :
                        tcf_action_dump_1(skb, a, bind, ref);
                if (err < 0)
                        goto errout;
@@ -1469,7 +1473,8 @@ static int tcf_action_add(struct net *net, struct nlattr *nla,
 }
 
 static const struct nla_policy tcaa_policy[TCA_ROOT_MAX + 1] = {
-       [TCA_ROOT_FLAGS] = NLA_POLICY_BITFIELD32(TCA_FLAG_LARGE_DUMP_ON),
+       [TCA_ROOT_FLAGS] = NLA_POLICY_BITFIELD32(TCA_FLAG_LARGE_DUMP_ON |
+                                                TCA_FLAG_TERSE_DUMP),
        [TCA_ROOT_TIME_DELTA]      = { .type = NLA_U32 },
 };
 
index a4c7ba3..e48e980 100644 (file)
@@ -65,7 +65,7 @@ static int tcf_bpf_act(struct sk_buff *skb, const struct tc_action *act,
         * In case a different well-known TC_ACT opcode has been
         * returned, it will overwrite the default one.
         *
-        * For everything else that is unkown, TC_ACT_UNSPEC is
+        * For everything else that is unknown, TC_ACT_UNSPEC is
         * returned.
         */
        switch (filter_res) {
index f40bf97..5c7456e 100644 (file)
@@ -426,6 +426,7 @@ static void __exit mpls_cleanup_module(void)
 module_init(mpls_init_module);
 module_exit(mpls_cleanup_module);
 
+MODULE_SOFTDEP("post: mpls_gso");
 MODULE_AUTHOR("Netronome Systems <oss-drivers@netronome.com>");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("MPLS manipulation actions");
index faeabff..ba0715e 100644 (file)
@@ -652,12 +652,12 @@ static void tc_block_indr_cleanup(struct flow_block_cb *block_cb)
                               block_cb->indr.binder_type,
                               &block->flow_block, tcf_block_shared(block),
                               &extack);
+       rtnl_lock();
        down_write(&block->cb_lock);
        list_del(&block_cb->driver_list);
        list_move(&block_cb->list, &bo.cb_list);
-       up_write(&block->cb_lock);
-       rtnl_lock();
        tcf_block_unbind(block, &bo);
+       up_write(&block->cb_lock);
        rtnl_unlock();
 }
 
@@ -2940,7 +2940,6 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb)
        struct tcf_chain *chain;
        long index_start;
        long index;
-       u32 parent;
        int err;
 
        if (nlmsg_len(cb->nlh) < sizeof(*tcm))
@@ -2955,13 +2954,6 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb)
                block = tcf_block_refcnt_get(net, tcm->tcm_block_index);
                if (!block)
                        goto out;
-               /* If we work with block index, q is NULL and parent value
-                * will never be used in the following code. The check
-                * in tcf_fill_node prevents it. However, compiler does not
-                * see that far, so set parent to zero to silence the warning
-                * about parent being uninitialized.
-                */
-               parent = 0;
        } else {
                const struct Qdisc_class_ops *cops;
                struct net_device *dev;
@@ -2971,13 +2963,11 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb)
                if (!dev)
                        return skb->len;
 
-               parent = tcm->tcm_parent;
-               if (!parent) {
+               if (!tcm->tcm_parent)
                        q = dev->qdisc;
-                       parent = q->handle;
-               } else {
+               else
                        q = qdisc_lookup(dev, TC_H_MAJ(tcm->tcm_parent));
-               }
+
                if (!q)
                        goto out;
                cops = q->ops->cl_ops;
index d36949d..2e288f8 100644 (file)
@@ -238,7 +238,7 @@ static void rsvp_replace(struct tcf_proto *tp, struct rsvp_filter *n, u32 h)
                }
        }
 
-       /* Something went wrong if we are trying to replace a non-existant
+       /* Something went wrong if we are trying to replace a non-existent
         * node. Mind as well halt instead of silently failing.
         */
        BUG_ON(1);
index a4d09b1..f17b049 100644 (file)
@@ -41,7 +41,7 @@ static int em_cmp_match(struct sk_buff *skb, struct tcf_ematch *em,
                break;
 
        case TCF_EM_ALIGN_U32:
-               /* Worth checking boundries? The branching seems
+               /* Worth checking boundaries? The branching seems
                 * to get worse. Visit again.
                 */
                val = get_unaligned_be32(ptr);
index 1c281cc..007bd2d 100644 (file)
@@ -466,10 +466,10 @@ drop: __maybe_unused
  * non-ATM interfaces.
  */
 
-static void sch_atm_dequeue(unsigned long data)
+static void sch_atm_dequeue(struct tasklet_struct *t)
 {
-       struct Qdisc *sch = (struct Qdisc *)data;
-       struct atm_qdisc_data *p = qdisc_priv(sch);
+       struct atm_qdisc_data *p = from_tasklet(p, t, task);
+       struct Qdisc *sch = qdisc_from_priv(p);
        struct atm_flow_data *flow;
        struct sk_buff *skb;
 
@@ -563,7 +563,7 @@ static int atm_tc_init(struct Qdisc *sch, struct nlattr *opt,
        if (err)
                return err;
 
-       tasklet_init(&p->task, sch_atm_dequeue, (unsigned long)sch);
+       tasklet_setup(&p->task, sch_atm_dequeue);
        return 0;
 }
 
index 84f8277..0c345e4 100644 (file)
@@ -330,7 +330,7 @@ static s64 tabledist(s64 mu, s32 sigma,
 
        /* default uniform distribution */
        if (dist == NULL)
-               return ((rnd % (2 * sigma)) + mu) - sigma;
+               return ((rnd % (2 * (u32)sigma)) + mu) - sigma;
 
        t = dist->table[rnd % dist->size];
        x = (sigma % NETEM_DIST_SCALE) * t;
@@ -812,6 +812,10 @@ static void get_slot(struct netem_sched_data *q, const struct nlattr *attr)
                q->slot_config.max_packets = INT_MAX;
        if (q->slot_config.max_bytes == 0)
                q->slot_config.max_bytes = INT_MAX;
+
+       /* capping dist_jitter to the range acceptable by tabledist() */
+       q->slot_config.dist_jitter = min_t(__s64, INT_MAX, abs(q->slot_config.dist_jitter));
+
        q->slot.packets_left = q->slot_config.max_packets;
        q->slot.bytes_left = q->slot_config.max_bytes;
        if (q->slot_config.min_delay | q->slot_config.max_delay |
@@ -1037,6 +1041,9 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt,
        if (tb[TCA_NETEM_SLOT])
                get_slot(q, tb[TCA_NETEM_SLOT]);
 
+       /* capping jitter to the range acceptable by tabledist() */
+       q->jitter = min_t(s64, abs(q->jitter), INT_MAX);
+
        return ret;
 
 get_table_failure:
index c65077f..5a457ff 100644 (file)
@@ -405,7 +405,7 @@ void pie_calculate_probability(struct pie_params *params, struct pie_vars *vars,
        /* We restart the measurement cycle if the following conditions are met
         * 1. If the delay has been low for 2 consecutive Tupdate periods
         * 2. Calculated drop probability is zero
-        * 3. If average dq_rate_estimator is enabled, we have atleast one
+        * 3. If average dq_rate_estimator is enabled, we have at least one
         *    estimate for the avg_dq_rate ie., is a non-zero value
         */
        if ((vars->qdelay < params->target / 2) &&
index 39d7fa9..5da599f 100644 (file)
@@ -11,6 +11,7 @@ menuconfig IP_SCTP
        select CRYPTO_HMAC
        select CRYPTO_SHA1
        select LIBCRC32C
+       select NET_UDP_TUNNEL
        help
          Stream Control Transmission Protocol
 
index fdb69d4..336df4b 100644 (file)
@@ -99,6 +99,8 @@ static struct sctp_association *sctp_association_init(
         */
        asoc->hbinterval = msecs_to_jiffies(sp->hbinterval);
 
+       asoc->encap_port = sp->encap_port;
+
        /* Initialize path max retrans value. */
        asoc->pathmaxrxt = sp->pathmaxrxt;
 
@@ -624,6 +626,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
         */
        peer->hbinterval = asoc->hbinterval;
 
+       peer->encap_port = asoc->encap_port;
+
        /* Set the path max_retrans.  */
        peer->pathmaxrxt = asoc->pathmaxrxt;
 
index 8a58f42..c3e89c7 100644 (file)
@@ -55,6 +55,7 @@
 #include <net/inet_common.h>
 #include <net/inet_ecn.h>
 #include <net/sctp/sctp.h>
+#include <net/udp_tunnel.h>
 
 #include <linux/uaccess.h>
 
@@ -191,33 +192,53 @@ out:
        return ret;
 }
 
-static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
+static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *t)
 {
+       struct dst_entry *dst = dst_clone(t->dst);
+       struct flowi6 *fl6 = &t->fl.u.ip6;
        struct sock *sk = skb->sk;
        struct ipv6_pinfo *np = inet6_sk(sk);
-       struct flowi6 *fl6 = &transport->fl.u.ip6;
        __u8 tclass = np->tclass;
-       int res;
+       __be32 label;
 
        pr_debug("%s: skb:%p, len:%d, src:%pI6 dst:%pI6\n", __func__, skb,
                 skb->len, &fl6->saddr, &fl6->daddr);
 
-       if (transport->dscp & SCTP_DSCP_SET_MASK)
-               tclass = transport->dscp & SCTP_DSCP_VAL_MASK;
+       if (t->dscp & SCTP_DSCP_SET_MASK)
+               tclass = t->dscp & SCTP_DSCP_VAL_MASK;
 
        if (INET_ECN_is_capable(tclass))
                IP6_ECN_flow_xmit(sk, fl6->flowlabel);
 
-       if (!(transport->param_flags & SPP_PMTUD_ENABLE))
+       if (!(t->param_flags & SPP_PMTUD_ENABLE))
                skb->ignore_df = 1;
 
        SCTP_INC_STATS(sock_net(sk), SCTP_MIB_OUTSCTPPACKS);
 
-       rcu_read_lock();
-       res = ip6_xmit(sk, skb, fl6, sk->sk_mark, rcu_dereference(np->opt),
-                      tclass, sk->sk_priority);
-       rcu_read_unlock();
-       return res;
+       if (!t->encap_port || !sctp_sk(sk)->udp_port) {
+               int res;
+
+               skb_dst_set(skb, dst);
+               rcu_read_lock();
+               res = ip6_xmit(sk, skb, fl6, sk->sk_mark,
+                              rcu_dereference(np->opt),
+                              tclass, sk->sk_priority);
+               rcu_read_unlock();
+               return res;
+       }
+
+       if (skb_is_gso(skb))
+               skb_shinfo(skb)->gso_type |= SKB_GSO_UDP_TUNNEL_CSUM;
+
+       skb->encapsulation = 1;
+       skb_reset_inner_mac_header(skb);
+       skb_reset_inner_transport_header(skb);
+       skb_set_inner_ipproto(skb, IPPROTO_SCTP);
+       label = ip6_make_flowlabel(sock_net(sk), skb, fl6->flowlabel, true, fl6);
+
+       return udp_tunnel6_xmit_skb(dst, sk, skb, NULL, &fl6->saddr,
+                                   &fl6->daddr, tclass, ip6_dst_hoplimit(dst),
+                                   label, sctp_sk(sk)->udp_port, t->encap_port, false);
 }
 
 /* Returns the dst cache entry for the given source and destination ip
@@ -1053,6 +1074,7 @@ static struct inet_protosw sctpv6_stream_protosw = {
 
 static int sctp6_rcv(struct sk_buff *skb)
 {
+       SCTP_INPUT_CB(skb)->encap_port = 0;
        return sctp_rcv(skb) ? -1 : 0;
 }
 
index 74847d6..ce281a9 100644 (file)
@@ -27,7 +27,11 @@ static __le32 sctp_gso_make_checksum(struct sk_buff *skb)
 {
        skb->ip_summed = CHECKSUM_NONE;
        skb->csum_not_inet = 0;
-       gso_reset_checksum(skb, ~0);
+       /* csum and csum_start in GSO CB may be needed to do the UDP
+        * checksum when it's a UDP tunneling packet.
+        */
+       SKB_GSO_CB(skb)->csum = (__force __wsum)~0;
+       SKB_GSO_CB(skb)->csum_start = skb_headroom(skb) + skb->len;
        return sctp_compute_cksum(skb, skb_transport_offset(skb));
 }
 
index 1441eaf..6614c9f 100644 (file)
@@ -508,20 +508,14 @@ merge:
                                        sizeof(struct inet6_skb_parm)));
                skb_shinfo(head)->gso_segs = pkt_count;
                skb_shinfo(head)->gso_size = GSO_BY_FRAGS;
-               rcu_read_lock();
-               if (skb_dst(head) != tp->dst) {
-                       dst_hold(tp->dst);
-                       sk_setup_caps(sk, tp->dst);
-               }
-               rcu_read_unlock();
                goto chksum;
        }
 
        if (sctp_checksum_disable)
                return 1;
 
-       if (!(skb_dst(head)->dev->features & NETIF_F_SCTP_CRC) ||
-           dst_xfrm(skb_dst(head)) || packet->ipfragok) {
+       if (!(tp->dst->dev->features & NETIF_F_SCTP_CRC) ||
+           dst_xfrm(tp->dst) || packet->ipfragok || tp->encap_port) {
                struct sctphdr *sh =
                        (struct sctphdr *)skb_transport_header(head);
 
@@ -548,7 +542,6 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)
        struct sctp_association *asoc = tp->asoc;
        struct sctp_chunk *chunk, *tmp;
        int pkt_count, gso = 0;
-       struct dst_entry *dst;
        struct sk_buff *head;
        struct sctphdr *sh;
        struct sock *sk;
@@ -585,13 +578,18 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)
        sh->checksum = 0;
 
        /* drop packet if no dst */
-       dst = dst_clone(tp->dst);
-       if (!dst) {
+       if (!tp->dst) {
                IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTNOROUTES);
                kfree_skb(head);
                goto out;
        }
-       skb_dst_set(head, dst);
+
+       rcu_read_lock();
+       if (__sk_dst_get(sk) != tp->dst) {
+               dst_hold(tp->dst);
+               sk_setup_caps(sk, tp->dst);
+       }
+       rcu_read_unlock();
 
        /* pack up chunks */
        pkt_count = sctp_packet_pack(packet, head, gso, gfp);
index 2583323..6f2bbfe 100644 (file)
@@ -44,6 +44,7 @@
 #include <net/addrconf.h>
 #include <net/inet_common.h>
 #include <net/inet_ecn.h>
+#include <net/udp_tunnel.h>
 
 #define MAX_SCTP_PORT_HASH_ENTRIES (64 * 1024)
 
@@ -840,6 +841,92 @@ static int sctp_ctl_sock_init(struct net *net)
        return 0;
 }
 
+static int sctp_udp_rcv(struct sock *sk, struct sk_buff *skb)
+{
+       SCTP_INPUT_CB(skb)->encap_port = udp_hdr(skb)->source;
+
+       skb_set_transport_header(skb, sizeof(struct udphdr));
+       sctp_rcv(skb);
+       return 0;
+}
+
+static int sctp_udp_err_lookup(struct sock *sk, struct sk_buff *skb)
+{
+       struct sctp_association *asoc;
+       struct sctp_transport *t;
+       int family;
+
+       skb->transport_header += sizeof(struct udphdr);
+       family = (ip_hdr(skb)->version == 4) ? AF_INET : AF_INET6;
+       sk = sctp_err_lookup(dev_net(skb->dev), family, skb, sctp_hdr(skb),
+                            &asoc, &t);
+       if (!sk)
+               return -ENOENT;
+
+       sctp_err_finish(sk, t);
+       return 0;
+}
+
+int sctp_udp_sock_start(struct net *net)
+{
+       struct udp_tunnel_sock_cfg tuncfg = {NULL};
+       struct udp_port_cfg udp_conf = {0};
+       struct socket *sock;
+       int err;
+
+       udp_conf.family = AF_INET;
+       udp_conf.local_ip.s_addr = htonl(INADDR_ANY);
+       udp_conf.local_udp_port = htons(net->sctp.udp_port);
+       err = udp_sock_create(net, &udp_conf, &sock);
+       if (err) {
+               pr_err("Failed to create the SCTP UDP tunneling v4 sock\n");
+               return err;
+       }
+
+       tuncfg.encap_type = 1;
+       tuncfg.encap_rcv = sctp_udp_rcv;
+       tuncfg.encap_err_lookup = sctp_udp_err_lookup;
+       setup_udp_tunnel_sock(net, sock, &tuncfg);
+       net->sctp.udp4_sock = sock->sk;
+
+#if IS_ENABLED(CONFIG_IPV6)
+       memset(&udp_conf, 0, sizeof(udp_conf));
+
+       udp_conf.family = AF_INET6;
+       udp_conf.local_ip6 = in6addr_any;
+       udp_conf.local_udp_port = htons(net->sctp.udp_port);
+       udp_conf.use_udp6_rx_checksums = true;
+       udp_conf.ipv6_v6only = true;
+       err = udp_sock_create(net, &udp_conf, &sock);
+       if (err) {
+               pr_err("Failed to create the SCTP UDP tunneling v6 sock\n");
+               udp_tunnel_sock_release(net->sctp.udp4_sock->sk_socket);
+               net->sctp.udp4_sock = NULL;
+               return err;
+       }
+
+       tuncfg.encap_type = 1;
+       tuncfg.encap_rcv = sctp_udp_rcv;
+       tuncfg.encap_err_lookup = sctp_udp_err_lookup;
+       setup_udp_tunnel_sock(net, sock, &tuncfg);
+       net->sctp.udp6_sock = sock->sk;
+#endif
+
+       return 0;
+}
+
+void sctp_udp_sock_stop(struct net *net)
+{
+       if (net->sctp.udp4_sock) {
+               udp_tunnel_sock_release(net->sctp.udp4_sock->sk_socket);
+               net->sctp.udp4_sock = NULL;
+       }
+       if (net->sctp.udp6_sock) {
+               udp_tunnel_sock_release(net->sctp.udp6_sock->sk_socket);
+               net->sctp.udp6_sock = NULL;
+       }
+}
+
 /* Register address family specific functions. */
 int sctp_register_af(struct sctp_af *af)
 {
@@ -971,25 +1058,44 @@ static int sctp_inet_supported_addrs(const struct sctp_sock *opt,
 }
 
 /* Wrapper routine that calls the ip transmit routine. */
-static inline int sctp_v4_xmit(struct sk_buff *skb,
-                              struct sctp_transport *transport)
+static inline int sctp_v4_xmit(struct sk_buff *skb, struct sctp_transport *t)
 {
-       struct inet_sock *inet = inet_sk(skb->sk);
+       struct dst_entry *dst = dst_clone(t->dst);
+       struct flowi4 *fl4 = &t->fl.u.ip4;
+       struct sock *sk = skb->sk;
+       struct inet_sock *inet = inet_sk(sk);
        __u8 dscp = inet->tos;
+       __be16 df = 0;
 
        pr_debug("%s: skb:%p, len:%d, src:%pI4, dst:%pI4\n", __func__, skb,
-                skb->len, &transport->fl.u.ip4.saddr,
-                &transport->fl.u.ip4.daddr);
+                skb->len, &fl4->saddr, &fl4->daddr);
 
-       if (transport->dscp & SCTP_DSCP_SET_MASK)
-               dscp = transport->dscp & SCTP_DSCP_VAL_MASK;
+       if (t->dscp & SCTP_DSCP_SET_MASK)
+               dscp = t->dscp & SCTP_DSCP_VAL_MASK;
+
+       inet->pmtudisc = t->param_flags & SPP_PMTUD_ENABLE ? IP_PMTUDISC_DO
+                                                          : IP_PMTUDISC_DONT;
+       SCTP_INC_STATS(sock_net(sk), SCTP_MIB_OUTSCTPPACKS);
 
-       inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ?
-                        IP_PMTUDISC_DO : IP_PMTUDISC_DONT;
+       if (!t->encap_port || !sctp_sk(sk)->udp_port) {
+               skb_dst_set(skb, dst);
+               return __ip_queue_xmit(sk, skb, &t->fl, dscp);
+       }
 
-       SCTP_INC_STATS(sock_net(&inet->sk), SCTP_MIB_OUTSCTPPACKS);
+       if (skb_is_gso(skb))
+               skb_shinfo(skb)->gso_type |= SKB_GSO_UDP_TUNNEL_CSUM;
 
-       return __ip_queue_xmit(&inet->sk, skb, &transport->fl, dscp);
+       if (ip_dont_fragment(sk, dst) && !skb->ignore_df)
+               df = htons(IP_DF);
+
+       skb->encapsulation = 1;
+       skb_reset_inner_mac_header(skb);
+       skb_reset_inner_transport_header(skb);
+       skb_set_inner_ipproto(skb, IPPROTO_SCTP);
+       udp_tunnel_xmit_skb((struct rtable *)dst, sk, skb, fl4->saddr,
+                           fl4->daddr, dscp, ip4_dst_hoplimit(dst), df,
+                           sctp_sk(sk)->udp_port, t->encap_port, false, false);
+       return 0;
 }
 
 static struct sctp_af sctp_af_inet;
@@ -1054,9 +1160,15 @@ static struct inet_protosw sctp_stream_protosw = {
        .flags      = SCTP_PROTOSW_FLAG
 };
 
+static int sctp4_rcv(struct sk_buff *skb)
+{
+       SCTP_INPUT_CB(skb)->encap_port = 0;
+       return sctp_rcv(skb);
+}
+
 /* Register with IP layer.  */
 static const struct net_protocol sctp_protocol = {
-       .handler     = sctp_rcv,
+       .handler     = sctp4_rcv,
        .err_handler = sctp_v4_err,
        .no_policy   = 1,
        .netns_ok    = 1,
@@ -1271,6 +1383,12 @@ static int __net_init sctp_defaults_init(struct net *net)
        /* Enable ECN by default. */
        net->sctp.ecn_enable = 1;
 
+       /* Set UDP tunneling listening port to 0 by default */
+       net->sctp.udp_port = 0;
+
+       /* Set remote encap port to 0 by default */
+       net->sctp.encap_port = 0;
+
        /* Set SCOPE policy to enabled */
        net->sctp.scope_policy = SCTP_SCOPE_POLICY_ENABLE;
 
index 9a56ae2..f77484d 100644 (file)
@@ -1142,6 +1142,26 @@ nodata:
        return retval;
 }
 
+struct sctp_chunk *sctp_make_new_encap_port(const struct sctp_association *asoc,
+                                           const struct sctp_chunk *chunk)
+{
+       struct sctp_new_encap_port_hdr nep;
+       struct sctp_chunk *retval;
+
+       retval = sctp_make_abort(asoc, chunk,
+                                sizeof(struct sctp_errhdr) + sizeof(nep));
+       if (!retval)
+               goto nodata;
+
+       sctp_init_cause(retval, SCTP_ERROR_NEW_ENCAP_PORT, sizeof(nep));
+       nep.cur_port = SCTP_INPUT_CB(chunk->skb)->encap_port;
+       nep.new_port = chunk->transport->encap_port;
+       sctp_addto_chunk(retval, sizeof(nep), &nep);
+
+nodata:
+       return retval;
+}
+
 /* Make a HEARTBEAT chunk.  */
 struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *asoc,
                                       const struct sctp_transport *transport)
@@ -2321,6 +2341,7 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
         * added as the primary transport.  The source address seems to
         * be a better choice than any of the embedded addresses.
         */
+       asoc->encap_port = SCTP_INPUT_CB(chunk->skb)->encap_port;
        if (!sctp_assoc_add_peer(asoc, peer_addr, gfp, SCTP_ACTIVE))
                goto nomem;
 
index aa821e7..813d307 100644 (file)
@@ -1601,12 +1601,12 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type,
                        break;
 
                case SCTP_CMD_INIT_FAILED:
-                       sctp_cmd_init_failed(commands, asoc, cmd->obj.u32);
+                       sctp_cmd_init_failed(commands, asoc, cmd->obj.u16);
                        break;
 
                case SCTP_CMD_ASSOC_FAILED:
                        sctp_cmd_assoc_failed(commands, asoc, event_type,
-                                             subtype, chunk, cmd->obj.u32);
+                                             subtype, chunk, cmd->obj.u16);
                        break;
 
                case SCTP_CMD_INIT_COUNTER_INC:
index c669f8b..af2b704 100644 (file)
@@ -87,6 +87,13 @@ static enum sctp_disposition sctp_sf_tabort_8_4_8(
                                        const union sctp_subtype type,
                                        void *arg,
                                        struct sctp_cmd_seq *commands);
+static enum sctp_disposition sctp_sf_new_encap_port(
+                                       struct net *net,
+                                       const struct sctp_endpoint *ep,
+                                       const struct sctp_association *asoc,
+                                       const union sctp_subtype type,
+                                       void *arg,
+                                       struct sctp_cmd_seq *commands);
 static struct sctp_sackhdr *sctp_sm_pull_sack(struct sctp_chunk *chunk);
 
 static enum sctp_disposition sctp_stop_t1_and_abort(
@@ -1493,6 +1500,10 @@ static enum sctp_disposition sctp_sf_do_unexpected_init(
        if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_init_chunk)))
                return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
                                                  commands);
+
+       if (SCTP_INPUT_CB(chunk->skb)->encap_port != chunk->transport->encap_port)
+               return sctp_sf_new_encap_port(net, ep, asoc, type, arg, commands);
+
        /* Grab the INIT header.  */
        chunk->subh.init_hdr = (struct sctp_inithdr *)chunk->skb->data;
 
@@ -3392,6 +3403,45 @@ static enum sctp_disposition sctp_sf_tabort_8_4_8(
 
        sctp_packet_append_chunk(packet, abort);
 
+       sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT, SCTP_PACKET(packet));
+
+       SCTP_INC_STATS(net, SCTP_MIB_OUTCTRLCHUNKS);
+
+       sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
+       return SCTP_DISPOSITION_CONSUME;
+}
+
+/* Handling of SCTP Packets Containing an INIT Chunk Matching an
+ * Existing Associations when the UDP encap port is incorrect.
+ *
+ * From Section 4 at draft-tuexen-tsvwg-sctp-udp-encaps-cons-03.
+ */
+static enum sctp_disposition sctp_sf_new_encap_port(
+                                       struct net *net,
+                                       const struct sctp_endpoint *ep,
+                                       const struct sctp_association *asoc,
+                                       const union sctp_subtype type,
+                                       void *arg,
+                                       struct sctp_cmd_seq *commands)
+{
+       struct sctp_packet *packet = NULL;
+       struct sctp_chunk *chunk = arg;
+       struct sctp_chunk *abort;
+
+       packet = sctp_ootb_pkt_new(net, asoc, chunk);
+       if (!packet)
+               return SCTP_DISPOSITION_NOMEM;
+
+       abort = sctp_make_new_encap_port(asoc, chunk);
+       if (!abort) {
+               sctp_ootb_pkt_free(packet);
+               return SCTP_DISPOSITION_NOMEM;
+       }
+
+       abort->skb->sk = ep->base.sk;
+
+       sctp_packet_append_chunk(packet, abort);
+
        sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT,
                        SCTP_PACKET(packet));
 
@@ -6268,6 +6318,8 @@ static struct sctp_packet *sctp_ootb_pkt_new(
        if (!transport)
                goto nomem;
 
+       transport->encap_port = SCTP_INPUT_CB(chunk->skb)->encap_port;
+
        /* Cache a route for the transport with the chunk's destination as
         * the source address.
         */
index 53d0a41..a710917 100644 (file)
@@ -4417,6 +4417,55 @@ out:
        return retval;
 }
 
+static int sctp_setsockopt_encap_port(struct sock *sk,
+                                     struct sctp_udpencaps *encap,
+                                     unsigned int optlen)
+{
+       struct sctp_association *asoc;
+       struct sctp_transport *t;
+       __be16 encap_port;
+
+       if (optlen != sizeof(*encap))
+               return -EINVAL;
+
+       /* If an address other than INADDR_ANY is specified, and
+        * no transport is found, then the request is invalid.
+        */
+       encap_port = (__force __be16)encap->sue_port;
+       if (!sctp_is_any(sk, (union sctp_addr *)&encap->sue_address)) {
+               t = sctp_addr_id2transport(sk, &encap->sue_address,
+                                          encap->sue_assoc_id);
+               if (!t)
+                       return -EINVAL;
+
+               t->encap_port = encap_port;
+               return 0;
+       }
+
+       /* Get association, if assoc_id != SCTP_FUTURE_ASSOC and the
+        * socket is a one to many style socket, and an association
+        * was not found, then the id was invalid.
+        */
+       asoc = sctp_id2assoc(sk, encap->sue_assoc_id);
+       if (!asoc && encap->sue_assoc_id != SCTP_FUTURE_ASSOC &&
+           sctp_style(sk, UDP))
+               return -EINVAL;
+
+       /* If changes are for association, also apply encap_port to
+        * each transport.
+        */
+       if (asoc) {
+               list_for_each_entry(t, &asoc->peer.transport_addr_list,
+                                   transports)
+                       t->encap_port = encap_port;
+
+               return 0;
+       }
+
+       sctp_sk(sk)->encap_port = encap_port;
+       return 0;
+}
+
 /* API 6.2 setsockopt(), getsockopt()
  *
  * Applications use setsockopt() and getsockopt() to set or retrieve
@@ -4636,6 +4685,9 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
        case SCTP_EXPOSE_POTENTIALLY_FAILED_STATE:
                retval = sctp_setsockopt_pf_expose(sk, kopt, optlen);
                break;
+       case SCTP_REMOTE_UDP_ENCAPS_PORT:
+               retval = sctp_setsockopt_encap_port(sk, kopt, optlen);
+               break;
        default:
                retval = -ENOPROTOOPT;
                break;
@@ -4876,6 +4928,8 @@ static int sctp_init_sock(struct sock *sk)
         * be modified via SCTP_PEER_ADDR_PARAMS
         */
        sp->hbinterval  = net->sctp.hb_interval;
+       sp->udp_port    = htons(net->sctp.udp_port);
+       sp->encap_port  = htons(net->sctp.encap_port);
        sp->pathmaxrxt  = net->sctp.max_retrans_path;
        sp->pf_retrans  = net->sctp.pf_retrans;
        sp->ps_retrans  = net->sctp.ps_retrans;
@@ -7790,6 +7844,65 @@ out:
        return retval;
 }
 
+static int sctp_getsockopt_encap_port(struct sock *sk, int len,
+                                     char __user *optval, int __user *optlen)
+{
+       struct sctp_association *asoc;
+       struct sctp_udpencaps encap;
+       struct sctp_transport *t;
+       __be16 encap_port;
+
+       if (len < sizeof(encap))
+               return -EINVAL;
+
+       len = sizeof(encap);
+       if (copy_from_user(&encap, optval, len))
+               return -EFAULT;
+
+       /* If an address other than INADDR_ANY is specified, and
+        * no transport is found, then the request is invalid.
+        */
+       if (!sctp_is_any(sk, (union sctp_addr *)&encap.sue_address)) {
+               t = sctp_addr_id2transport(sk, &encap.sue_address,
+                                          encap.sue_assoc_id);
+               if (!t) {
+                       pr_debug("%s: failed no transport\n", __func__);
+                       return -EINVAL;
+               }
+
+               encap_port = t->encap_port;
+               goto out;
+       }
+
+       /* Get association, if assoc_id != SCTP_FUTURE_ASSOC and the
+        * socket is a one to many style socket, and an association
+        * was not found, then the id was invalid.
+        */
+       asoc = sctp_id2assoc(sk, encap.sue_assoc_id);
+       if (!asoc && encap.sue_assoc_id != SCTP_FUTURE_ASSOC &&
+           sctp_style(sk, UDP)) {
+               pr_debug("%s: failed no association\n", __func__);
+               return -EINVAL;
+       }
+
+       if (asoc) {
+               encap_port = asoc->encap_port;
+               goto out;
+       }
+
+       encap_port = sctp_sk(sk)->encap_port;
+
+out:
+       encap.sue_port = (__force uint16_t)encap_port;
+       if (copy_to_user(optval, &encap, len))
+               return -EFAULT;
+
+       if (put_user(len, optlen))
+               return -EFAULT;
+
+       return 0;
+}
+
 static int sctp_getsockopt(struct sock *sk, int level, int optname,
                           char __user *optval, int __user *optlen)
 {
@@ -8010,6 +8123,9 @@ static int sctp_getsockopt(struct sock *sk, int level, int optname,
        case SCTP_EXPOSE_POTENTIALLY_FAILED_STATE:
                retval = sctp_getsockopt_pf_expose(sk, len, optval, optlen);
                break;
+       case SCTP_REMOTE_UDP_ENCAPS_PORT:
+               retval = sctp_getsockopt_encap_port(sk, len, optval, optlen);
+               break;
        default:
                retval = -ENOPROTOOPT;
                break;
index c16c809..e92df77 100644 (file)
@@ -36,6 +36,7 @@ static int rto_alpha_max = 1000;
 static int rto_beta_max = 1000;
 static int pf_expose_max = SCTP_PF_EXPOSE_MAX;
 static int ps_retrans_max = SCTP_PS_RETRANS_MAX;
+static int udp_port_max = 65535;
 
 static unsigned long max_autoclose_min = 0;
 static unsigned long max_autoclose_max =
@@ -48,6 +49,8 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,
                                void *buffer, size_t *lenp, loff_t *ppos);
 static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, void *buffer,
                                size_t *lenp, loff_t *ppos);
+static int proc_sctp_do_udp_port(struct ctl_table *ctl, int write, void *buffer,
+                                size_t *lenp, loff_t *ppos);
 static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write,
                                   void *buffer, size_t *lenp, loff_t *ppos);
 static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
@@ -291,6 +294,24 @@ static struct ctl_table sctp_net_table[] = {
                .proc_handler   = proc_dointvec,
        },
        {
+               .procname       = "udp_port",
+               .data           = &init_net.sctp.udp_port,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_sctp_do_udp_port,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = &udp_port_max,
+       },
+       {
+               .procname       = "encap_port",
+               .data           = &init_net.sctp.encap_port,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = &udp_port_max,
+       },
+       {
                .procname       = "addr_scope_policy",
                .data           = &init_net.sctp.scope_policy,
                .maxlen         = sizeof(int),
@@ -477,6 +498,47 @@ static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
        return ret;
 }
 
+static int proc_sctp_do_udp_port(struct ctl_table *ctl, int write,
+                                void *buffer, size_t *lenp, loff_t *ppos)
+{
+       struct net *net = current->nsproxy->net_ns;
+       unsigned int min = *(unsigned int *)ctl->extra1;
+       unsigned int max = *(unsigned int *)ctl->extra2;
+       struct ctl_table tbl;
+       int ret, new_value;
+
+       memset(&tbl, 0, sizeof(struct ctl_table));
+       tbl.maxlen = sizeof(unsigned int);
+
+       if (write)
+               tbl.data = &new_value;
+       else
+               tbl.data = &net->sctp.udp_port;
+
+       ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
+       if (write && ret == 0) {
+               struct sock *sk = net->sctp.ctl_sock;
+
+               if (new_value > max || new_value < min)
+                       return -EINVAL;
+
+               net->sctp.udp_port = new_value;
+               sctp_udp_sock_stop(net);
+               if (new_value) {
+                       ret = sctp_udp_sock_start(net);
+                       if (ret)
+                               net->sctp.udp_port = 0;
+               }
+
+               /* Update the value in the control socket */
+               lock_sock(sk);
+               sctp_sk(sk)->udp_port = htons(net->sctp.udp_port);
+               release_sock(sk);
+       }
+
+       return ret;
+}
+
 int sctp_sysctl_net_register(struct net *net)
 {
        struct ctl_table *table;
index 82be0bd..527185a 100644 (file)
@@ -1317,10 +1317,10 @@ static void smc_listen_out_err(struct smc_sock *new_smc)
 
 /* listen worker: decline and fall back if possible */
 static void smc_listen_decline(struct smc_sock *new_smc, int reason_code,
-                              struct smc_init_info *ini, u8 version)
+                              int local_first, u8 version)
 {
        /* RDMA setup failed, switch back to TCP */
-       if (ini->first_contact_local)
+       if (local_first)
                smc_lgr_cleanup_early(&new_smc->conn);
        else
                smc_conn_free(&new_smc->conn);
@@ -1346,6 +1346,7 @@ static int smc_listen_v2_check(struct smc_sock *new_smc,
 {
        struct smc_clc_smcd_v2_extension *pclc_smcd_v2_ext;
        struct smc_clc_v2_extension *pclc_v2_ext;
+       int rc = SMC_CLC_DECL_PEERNOSMC;
 
        ini->smc_type_v1 = pclc->hdr.typev1;
        ini->smc_type_v2 = pclc->hdr.typev2;
@@ -1353,29 +1354,30 @@ static int smc_listen_v2_check(struct smc_sock *new_smc,
        if (pclc->hdr.version > SMC_V1)
                ini->smcd_version |=
                                ini->smc_type_v2 != SMC_TYPE_N ? SMC_V2 : 0;
+       if (!(ini->smcd_version & SMC_V2)) {
+               rc = SMC_CLC_DECL_PEERNOSMC;
+               goto out;
+       }
        if (!smc_ism_v2_capable) {
                ini->smcd_version &= ~SMC_V2;
+               rc = SMC_CLC_DECL_NOISM2SUPP;
                goto out;
        }
        pclc_v2_ext = smc_get_clc_v2_ext(pclc);
        if (!pclc_v2_ext) {
                ini->smcd_version &= ~SMC_V2;
+               rc = SMC_CLC_DECL_NOV2EXT;
                goto out;
        }
        pclc_smcd_v2_ext = smc_get_clc_smcd_v2_ext(pclc_v2_ext);
-       if (!pclc_smcd_v2_ext)
+       if (!pclc_smcd_v2_ext) {
                ini->smcd_version &= ~SMC_V2;
+               rc = SMC_CLC_DECL_NOV2DEXT;
+       }
 
 out:
-       if (!ini->smcd_version) {
-               if (pclc->hdr.typev1 == SMC_TYPE_B ||
-                   pclc->hdr.typev2 == SMC_TYPE_B)
-                       return SMC_CLC_DECL_NOSMCDEV;
-               if (pclc->hdr.typev1 == SMC_TYPE_D ||
-                   pclc->hdr.typev2 == SMC_TYPE_D)
-                       return SMC_CLC_DECL_NOSMCDDEV;
-               return SMC_CLC_DECL_NOSMCRDEV;
-       }
+       if (!ini->smcd_version)
+               return rc;
 
        return 0;
 }
@@ -1473,6 +1475,12 @@ static void smc_check_ism_v2_match(struct smc_init_info *ini,
        }
 }
 
+static void smc_find_ism_store_rc(u32 rc, struct smc_init_info *ini)
+{
+       if (!ini->rc)
+               ini->rc = rc;
+}
+
 static void smc_find_ism_v2_device_serv(struct smc_sock *new_smc,
                                        struct smc_clc_msg_proposal *pclc,
                                        struct smc_init_info *ini)
@@ -1483,7 +1491,7 @@ static void smc_find_ism_v2_device_serv(struct smc_sock *new_smc,
        unsigned int matches = 0;
        u8 smcd_version;
        u8 *eid = NULL;
-       int i;
+       int i, rc;
 
        if (!(ini->smcd_version & SMC_V2) || !smcd_indicated(ini->smc_type_v2))
                goto not_found;
@@ -1492,8 +1500,10 @@ static void smc_find_ism_v2_device_serv(struct smc_sock *new_smc,
        smc_v2_ext = smc_get_clc_v2_ext(pclc);
        smcd_v2_ext = smc_get_clc_smcd_v2_ext(smc_v2_ext);
        if (!smcd_v2_ext ||
-           !smc_v2_ext->hdr.flag.seid) /* no system EID support for SMCD */
+           !smc_v2_ext->hdr.flag.seid) { /* no system EID support for SMCD */
+               smc_find_ism_store_rc(SMC_CLC_DECL_NOSEID, ini);
                goto not_found;
+       }
 
        mutex_lock(&smcd_dev_list.mutex);
        if (pclc_smcd->ism.chid)
@@ -1525,9 +1535,12 @@ static void smc_find_ism_v2_device_serv(struct smc_sock *new_smc,
                ini->smcd_version = SMC_V2;
                ini->is_smcd = true;
                ini->ism_selected = i;
-               if (smc_listen_ism_init(new_smc, ini))
+               rc = smc_listen_ism_init(new_smc, ini);
+               if (rc) {
+                       smc_find_ism_store_rc(rc, ini);
                        /* try next active ISM device */
                        continue;
+               }
                return; /* matching and usable V2 ISM device found */
        }
        /* no V2 ISM device could be initialized */
@@ -1544,19 +1557,23 @@ static void smc_find_ism_v1_device_serv(struct smc_sock *new_smc,
                                        struct smc_init_info *ini)
 {
        struct smc_clc_msg_smcd *pclc_smcd = smc_get_clc_msg_smcd(pclc);
+       int rc = 0;
 
        /* check if ISM V1 is available */
        if (!(ini->smcd_version & SMC_V1) || !smcd_indicated(ini->smc_type_v1))
                goto not_found;
        ini->is_smcd = true; /* prepare ISM check */
        ini->ism_peer_gid[0] = ntohll(pclc_smcd->ism.gid);
-       if (smc_find_ism_device(new_smc, ini))
+       rc = smc_find_ism_device(new_smc, ini);
+       if (rc)
                goto not_found;
        ini->ism_selected = 0;
-       if (!smc_listen_ism_init(new_smc, ini))
+       rc = smc_listen_ism_init(new_smc, ini);
+       if (!rc)
                return;         /* V1 ISM device found */
 
 not_found:
+       smc_find_ism_store_rc(rc, ini);
        ini->ism_dev[0] = NULL;
        ini->is_smcd = false;
 }
@@ -1613,16 +1630,16 @@ static int smc_listen_find_device(struct smc_sock *new_smc,
                return 0;
 
        if (!(ini->smcd_version & SMC_V1))
-               return SMC_CLC_DECL_NOSMCDEV;
+               return ini->rc ?: SMC_CLC_DECL_NOSMCD2DEV;
 
        /* check for matching IP prefix and subnet length */
        rc = smc_listen_prfx_check(new_smc, pclc);
        if (rc)
-               return rc;
+               return ini->rc ?: rc;
 
        /* get vlan id from IP device */
        if (smc_vlan_by_tcpsk(new_smc->clcsock, ini))
-               return SMC_CLC_DECL_GETVLANERR;
+               return ini->rc ?: SMC_CLC_DECL_GETVLANERR;
 
        /* check for ISM device matching V1 proposed device */
        smc_find_ism_v1_device_serv(new_smc, pclc, ini);
@@ -1630,10 +1647,14 @@ static int smc_listen_find_device(struct smc_sock *new_smc,
                return 0;
 
        if (pclc->hdr.typev1 == SMC_TYPE_D)
-               return SMC_CLC_DECL_NOSMCDDEV; /* skip RDMA and decline */
+               /* skip RDMA and decline */
+               return ini->rc ?: SMC_CLC_DECL_NOSMCDDEV;
 
        /* check if RDMA is available */
-       return smc_find_rdma_v1_device_serv(new_smc, pclc, ini);
+       rc = smc_find_rdma_v1_device_serv(new_smc, pclc, ini);
+       smc_find_ism_store_rc(rc, ini);
+
+       return (!rc) ? 0 : ini->rc;
 }
 
 /* listen worker: finish RDMA setup */
@@ -1768,7 +1789,8 @@ static void smc_listen_work(struct work_struct *work)
 out_unlock:
        mutex_unlock(&smc_server_lgr_pending);
 out_decl:
-       smc_listen_decline(new_smc, rc, ini, version);
+       smc_listen_decline(new_smc, rc, ini ? ini->first_contact_local : 0,
+                          version);
 out_free:
        kfree(ini);
        kfree(buf);
index b1ce6cc..f23f558 100644 (file)
@@ -389,9 +389,9 @@ static void smc_cdc_msg_recv(struct smc_sock *smc, struct smc_cdc_msg *cdc)
  * Context:
  * - tasklet context
  */
-static void smcd_cdc_rx_tsklet(unsigned long data)
+static void smcd_cdc_rx_tsklet(struct tasklet_struct *t)
 {
-       struct smc_connection *conn = (struct smc_connection *)data;
+       struct smc_connection *conn = from_tasklet(conn, t, rx_tsklet);
        struct smcd_cdc_msg *data_cdc;
        struct smcd_cdc_msg cdc;
        struct smc_sock *smc;
@@ -411,7 +411,7 @@ static void smcd_cdc_rx_tsklet(unsigned long data)
  */
 void smcd_cdc_rx_init(struct smc_connection *conn)
 {
-       tasklet_init(&conn->rx_tsklet, smcd_cdc_rx_tsklet, (unsigned long)conn);
+       tasklet_setup(&conn->rx_tsklet, smcd_cdc_rx_tsklet);
 }
 
 /***************************** init, exit, misc ******************************/
index b3f46ab..49752c9 100644 (file)
 #define SMC_CLC_DECL_NOSMCDEV  0x03030000  /* no SMC device found (R or D)   */
 #define SMC_CLC_DECL_NOSMCDDEV 0x03030001  /* no SMC-D device found          */
 #define SMC_CLC_DECL_NOSMCRDEV 0x03030002  /* no SMC-R device found          */
+#define SMC_CLC_DECL_NOISM2SUPP        0x03030003  /* hardware has no ISMv2 support  */
+#define SMC_CLC_DECL_NOV2EXT   0x03030004  /* peer sent no clc v2 extension  */
+#define SMC_CLC_DECL_NOV2DEXT  0x03030005  /* peer sent no clc SMC-Dv2 ext.  */
+#define SMC_CLC_DECL_NOSEID    0x03030006  /* peer sent no SEID              */
+#define SMC_CLC_DECL_NOSMCD2DEV        0x03030007  /* no SMC-Dv2 device found        */
 #define SMC_CLC_DECL_MODEUNSUPP        0x03040000  /* smc modes do not match (R or D)*/
 #define SMC_CLC_DECL_RMBE_EC   0x03050000  /* peer has eyecatcher in RMBE    */
 #define SMC_CLC_DECL_OPTUNSUPP 0x03060000  /* fastopen sockopt not supported */
@@ -124,7 +129,7 @@ struct smc_clc_v2_extension {
        struct smc_clnt_opts_area_hdr hdr;
        u8 roce[16];            /* RoCEv2 GID */
        u8 reserved[16];
-       u8 user_eids[0][SMC_MAX_EID_LEN];
+       u8 user_eids[][SMC_MAX_EID_LEN];
 };
 
 struct smc_clc_msg_proposal_prefix {   /* prefix part of clc proposal message*/
@@ -143,7 +148,7 @@ struct smc_clc_msg_smcd {   /* SMC-D GID information */
 struct smc_clc_smcd_v2_extension {
        u8 system_eid[SMC_MAX_EID_LEN];
        u8 reserved[16];
-       struct smc_clc_smcd_gid_chid gidchid[0];
+       struct smc_clc_smcd_gid_chid gidchid[];
 };
 
 struct smc_clc_msg_proposal {  /* clc proposal message sent by Linux */
index d790c43..2b19863 100644 (file)
@@ -1615,8 +1615,11 @@ static struct smc_buf_desc *smcd_new_buf_create(struct smc_link_group *lgr,
                rc = smc_ism_register_dmb(lgr, bufsize, buf_desc);
                if (rc) {
                        kfree(buf_desc);
-                       return (rc == -ENOMEM) ? ERR_PTR(-EAGAIN) :
-                                                ERR_PTR(-EIO);
+                       if (rc == -ENOMEM)
+                               return ERR_PTR(-EAGAIN);
+                       if (rc == -ENOSPC)
+                               return ERR_PTR(-ENOSPC);
+                       return ERR_PTR(-EIO);
                }
                buf_desc->pages = virt_to_page(buf_desc->cpu_addr);
                /* CDC header stored in buf. So, pretend it was smaller */
index f1e867c..9aee54a 100644 (file)
@@ -301,6 +301,7 @@ struct smc_init_info {
        u8                      first_contact_peer;
        u8                      first_contact_local;
        unsigned short          vlan_id;
+       u32                     rc;
        /* SMC-R */
        struct smc_clc_msg_local *ib_lcl;
        struct smc_ib_device    *ib_dev;
index 1e23cdd..cbc73a7 100644 (file)
@@ -131,9 +131,9 @@ static inline void smc_wr_tx_process_cqe(struct ib_wc *wc)
        wake_up(&link->wr_tx_wait);
 }
 
-static void smc_wr_tx_tasklet_fn(unsigned long data)
+static void smc_wr_tx_tasklet_fn(struct tasklet_struct *t)
 {
-       struct smc_ib_device *dev = (struct smc_ib_device *)data;
+       struct smc_ib_device *dev = from_tasklet(dev, t, send_tasklet);
        struct ib_wc wc[SMC_WR_MAX_POLL_CQE];
        int i = 0, rc;
        int polled = 0;
@@ -435,9 +435,9 @@ static inline void smc_wr_rx_process_cqes(struct ib_wc wc[], int num)
        }
 }
 
-static void smc_wr_rx_tasklet_fn(unsigned long data)
+static void smc_wr_rx_tasklet_fn(struct tasklet_struct *t)
 {
-       struct smc_ib_device *dev = (struct smc_ib_device *)data;
+       struct smc_ib_device *dev = from_tasklet(dev, t, recv_tasklet);
        struct ib_wc wc[SMC_WR_MAX_POLL_CQE];
        int polled = 0;
        int rc;
@@ -698,10 +698,8 @@ void smc_wr_remove_dev(struct smc_ib_device *smcibdev)
 
 void smc_wr_add_dev(struct smc_ib_device *smcibdev)
 {
-       tasklet_init(&smcibdev->recv_tasklet, smc_wr_rx_tasklet_fn,
-                    (unsigned long)smcibdev);
-       tasklet_init(&smcibdev->send_tasklet, smc_wr_tx_tasklet_fn,
-                    (unsigned long)smcibdev);
+       tasklet_setup(&smcibdev->recv_tasklet, smc_wr_rx_tasklet_fn);
+       tasklet_setup(&smcibdev->send_tasklet, smc_wr_tx_tasklet_fn);
 }
 
 int smc_wr_create_link(struct smc_link *lnk)
index a18b36b..3aad6ef 100644 (file)
@@ -63,19 +63,20 @@ static int proc_do_xprt(struct ctl_table *table, int write,
                        void *buffer, size_t *lenp, loff_t *ppos)
 {
        char tmpbuf[256];
-       size_t len;
+       ssize_t len;
 
-       if ((*ppos && !write) || !*lenp) {
+       if (write || *ppos) {
                *lenp = 0;
                return 0;
        }
        len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
-       *lenp = memory_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
+       len = memory_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
 
-       if (*lenp < 0) {
+       if (len < 0) {
                *lenp = 0;
                return -EINVAL;
        }
+       *lenp = len;
        return 0;
 }
 
index 6504141..2241d5a 100644 (file)
@@ -139,10 +139,7 @@ static int bearer_name_validate(const char *name,
        u32 if_len;
 
        /* copy bearer name & ensure length is OK */
-       name_copy[TIPC_MAX_BEARER_NAME - 1] = 0;
-       /* need above in case non-Posix strncpy() doesn't pad with nulls */
-       strncpy(name_copy, name, TIPC_MAX_BEARER_NAME);
-       if (name_copy[TIPC_MAX_BEARER_NAME - 1] != 0)
+       if (strscpy(name_copy, name, TIPC_MAX_BEARER_NAME) < 0)
                return 0;
 
        /* ensure all component parts of bearer name are present */
index c2ff429..5cc1f03 100644 (file)
@@ -81,8 +81,6 @@ static int __net_init tipc_init_net(struct net *net)
        if (err)
                goto out_nametbl;
 
-       INIT_LIST_HEAD(&tn->dist_queue);
-
        err = tipc_bcast_init(net);
        if (err)
                goto out_bclink;
index 1d57a4d..df34dcd 100644 (file)
@@ -132,9 +132,6 @@ struct tipc_net {
        spinlock_t nametbl_lock;
        struct name_table *nametbl;
 
-       /* Name dist queue */
-       struct list_head dist_queue;
-
        /* Topology subscription server */
        struct tipc_topsrv *topsrv;
        atomic_t subscription_count;
index 40c4410..740ab9a 100644 (file)
@@ -418,7 +418,7 @@ static void tipc_aead_free(struct rcu_head *rp)
                kfree(head);
        }
        free_percpu(aead->tfm_entry);
-       kzfree(aead->key);
+       kfree_sensitive(aead->key);
        kfree(aead);
 }
 
@@ -2452,7 +2452,7 @@ static void tipc_crypto_work_tx(struct work_struct *work)
                     tipc_crypto_key_init(tx, skey, PER_NODE_KEY, false);
                if (likely(rc > 0))
                        rc = tipc_crypto_key_distr(tx, rc, NULL);
-               kzfree(skey);
+               kfree_sensitive(skey);
        }
 
        if (unlikely(rc))
index 06b880d..97b1c6b 100644 (file)
@@ -1260,7 +1260,7 @@ static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb,
                pr_warn("Dropping received illegal msg type\n");
                kfree_skb(skb);
                return true;
-       };
+       }
 }
 
 /* tipc_link_input - process packet that has passed link protocol check
index 2a78aa7..32c79c5 100644 (file)
@@ -150,12 +150,11 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
        if (fragid == FIRST_FRAGMENT) {
                if (unlikely(head))
                        goto err;
-               if (skb_cloned(frag))
-                       frag = skb_copy(frag, GFP_ATOMIC);
+               *buf = NULL;
+               frag = skb_unshare(frag, GFP_ATOMIC);
                if (unlikely(!frag))
                        goto err;
                head = *headbuf = frag;
-               *buf = NULL;
                TIPC_SKB_CB(head)->tail = NULL;
                if (skb_is_nonlinear(head)) {
                        skb_walk_frags(head, tail) {
index fe4edce..4cd90d5 100644 (file)
@@ -244,24 +244,6 @@ static void tipc_publ_purge(struct net *net, struct publication *publ, u32 addr)
                kfree_rcu(p, rcu);
 }
 
-/**
- * tipc_dist_queue_purge - remove deferred updates from a node that went down
- */
-static void tipc_dist_queue_purge(struct net *net, u32 addr)
-{
-       struct tipc_net *tn = net_generic(net, tipc_net_id);
-       struct distr_queue_item *e, *tmp;
-
-       spin_lock_bh(&tn->nametbl_lock);
-       list_for_each_entry_safe(e, tmp, &tn->dist_queue, next) {
-               if (e->node != addr)
-                       continue;
-               list_del(&e->next);
-               kfree(e);
-       }
-       spin_unlock_bh(&tn->nametbl_lock);
-}
-
 void tipc_publ_notify(struct net *net, struct list_head *nsub_list,
                      u32 addr, u16 capabilities)
 {
@@ -272,7 +254,6 @@ void tipc_publ_notify(struct net *net, struct list_head *nsub_list,
 
        list_for_each_entry_safe(publ, tmp, nsub_list, binding_node)
                tipc_publ_purge(net, publ, addr);
-       tipc_dist_queue_purge(net, addr);
        spin_lock_bh(&tn->nametbl_lock);
        if (!(capabilities & TIPC_NAMED_BCAST))
                nt->rc_dests--;
index 1c7aa51..5c6206c 100644 (file)
@@ -118,7 +118,8 @@ static void tipc_tlv_init(struct sk_buff *skb, u16 type)
        skb_put(skb, sizeof(struct tlv_desc));
 }
 
-static int tipc_tlv_sprintf(struct sk_buff *skb, const char *fmt, ...)
+static __printf(2, 3) int tipc_tlv_sprintf(struct sk_buff *skb,
+                                          const char *fmt, ...)
 {
        int n;
        u16 len;
@@ -588,7 +589,7 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg,
                return 0;
 
        tipc_tlv_sprintf(msg->rep, "\nLink <%s>\n",
-                        nla_data(link[TIPC_NLA_LINK_NAME]));
+                        (char *)nla_data(link[TIPC_NLA_LINK_NAME]));
 
        if (link[TIPC_NLA_LINK_BROADCAST]) {
                __fill_bc_link_stat(msg, prop, stats);
index d269ebe..cd67b7d 100644 (file)
@@ -1638,7 +1638,7 @@ static void tipc_lxc_xmit(struct net *peer_net, struct sk_buff_head *list)
                return;
        default:
                return;
-       };
+       }
 }
 
 /**
index e795a8a..69c4b16 100644 (file)
@@ -658,8 +658,8 @@ static int tipc_release(struct socket *sock)
  * NOTE: This routine doesn't need to take the socket lock since it doesn't
  *       access any non-constant socket information.
  */
-static int tipc_bind(struct socket *sock, struct sockaddr *uaddr,
-                    int uaddr_len)
+
+int tipc_sk_bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
 {
        struct sock *sk = sock->sk;
        struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr;
@@ -691,13 +691,6 @@ static int tipc_bind(struct socket *sock, struct sockaddr *uaddr,
                goto exit;
        }
 
-       if ((addr->addr.nameseq.type < TIPC_RESERVED_TYPES) &&
-           (addr->addr.nameseq.type != TIPC_TOP_SRV) &&
-           (addr->addr.nameseq.type != TIPC_CFG_SRV)) {
-               res = -EACCES;
-               goto exit;
-       }
-
        res = (addr->scope >= 0) ?
                tipc_sk_publish(tsk, addr->scope, &addr->addr.nameseq) :
                tipc_sk_withdraw(tsk, -addr->scope, &addr->addr.nameseq);
@@ -706,6 +699,22 @@ exit:
        return res;
 }
 
+static int tipc_bind(struct socket *sock, struct sockaddr *skaddr, int alen)
+{
+       struct sockaddr_tipc *addr = (struct sockaddr_tipc *)skaddr;
+
+       if (alen) {
+               if (alen < sizeof(struct sockaddr_tipc))
+                       return -EINVAL;
+               if (addr->addr.nameseq.type < TIPC_RESERVED_TYPES) {
+                       pr_warn_once("Can't bind to reserved service type %u\n",
+                                    addr->addr.nameseq.type);
+                       return -EACCES;
+               }
+       }
+       return tipc_sk_bind(sock, skaddr, alen);
+}
+
 /**
  * tipc_getname - get port ID of socket or peer socket
  * @sock: socket structure
index b11575a..02cdf16 100644 (file)
@@ -74,7 +74,7 @@ int tipc_dump_done(struct netlink_callback *cb);
 u32 tipc_sock_get_portid(struct sock *sk);
 bool tipc_sk_overlimit1(struct sock *sk, struct sk_buff *skb);
 bool tipc_sk_overlimit2(struct sock *sk, struct sk_buff *skb);
-
+int tipc_sk_bind(struct socket *sock, struct sockaddr *skaddr, int alen);
 int tsk_set_importance(struct sock *sk, int imp);
 
 #endif
index 5f6f860..88ad39e 100644 (file)
@@ -520,12 +520,12 @@ static int tipc_topsrv_create_listener(struct tipc_topsrv *srv)
 
        saddr.family                    = AF_TIPC;
        saddr.addrtype                  = TIPC_ADDR_NAMESEQ;
-       saddr.addr.nameseq.type         = TIPC_TOP_SRV;
+       saddr.addr.nameseq.type         = TIPC_TOP_SRV;
        saddr.addr.nameseq.lower        = TIPC_TOP_SRV;
        saddr.addr.nameseq.upper        = TIPC_TOP_SRV;
        saddr.scope                     = TIPC_NODE_SCOPE;
 
-       rc = kernel_bind(lsock, (struct sockaddr *)&saddr, sizeof(saddr));
+       rc = tipc_sk_bind(lsock, (struct sockaddr *)&saddr, sizeof(saddr));
        if (rc < 0)
                goto err;
        rc = kernel_listen(lsock, 0);
@@ -664,12 +664,18 @@ static int tipc_topsrv_start(struct net *net)
 
        ret = tipc_topsrv_work_start(srv);
        if (ret < 0)
-               return ret;
+               goto err_start;
 
        ret = tipc_topsrv_create_listener(srv);
        if (ret < 0)
-               tipc_topsrv_work_stop(srv);
+               goto err_create;
 
+       return 0;
+
+err_create:
+       tipc_topsrv_work_stop(srv);
+err_start:
+       kfree(srv);
        return ret;
 }
 
index 9e93bc2..35613ef 100644 (file)
@@ -739,7 +739,7 @@ static struct sock *__vsock_create(struct net *net,
                vsk->buffer_min_size = psk->buffer_min_size;
                vsk->buffer_max_size = psk->buffer_max_size;
        } else {
-               vsk->trusted = capable(CAP_NET_ADMIN);
+               vsk->trusted = ns_capable_noaudit(&init_user_ns, CAP_NET_ADMIN);
                vsk->owner = get_current_cred();
                vsk->connect_timeout = VSOCK_DEFAULT_CONNECT_TIMEOUT;
                vsk->buffer_size = VSOCK_DEFAULT_BUFFER_SIZE;
@@ -2072,8 +2072,7 @@ static long vsock_dev_do_ioctl(struct file *filp,
                break;
 
        default:
-               pr_err("Unknown ioctl %d\n", cmd);
-               retval = -EINVAL;
+               retval = -ENOIOCTLCMD;
        }
 
        return retval;
index 22d1779..e4030f1 100644 (file)
@@ -530,10 +530,10 @@ int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
        case NL80211_IFTYPE_P2P_CLIENT:
        case NL80211_IFTYPE_MONITOR:
        case NL80211_IFTYPE_AP_VLAN:
-       case NL80211_IFTYPE_WDS:
        case NL80211_IFTYPE_P2P_DEVICE:
        case NL80211_IFTYPE_NAN:
                break;
+       case NL80211_IFTYPE_WDS:
        case NL80211_IFTYPE_UNSPECIFIED:
        case NUM_NL80211_IFTYPES:
                WARN_ON(1);
@@ -677,12 +677,12 @@ bool cfg80211_beaconing_iface_active(struct wireless_dev *wdev)
        case NL80211_IFTYPE_P2P_CLIENT:
        case NL80211_IFTYPE_MONITOR:
        case NL80211_IFTYPE_AP_VLAN:
-       case NL80211_IFTYPE_WDS:
        case NL80211_IFTYPE_P2P_DEVICE:
        /* Can NAN type be considered as beaconing interface? */
        case NL80211_IFTYPE_NAN:
                break;
        case NL80211_IFTYPE_UNSPECIFIED:
+       case NL80211_IFTYPE_WDS:
        case NUM_NL80211_IFTYPES:
                WARN_ON(1);
        }
@@ -1324,12 +1324,12 @@ cfg80211_get_chan_state(struct wireless_dev *wdev,
                break;
        case NL80211_IFTYPE_MONITOR:
        case NL80211_IFTYPE_AP_VLAN:
-       case NL80211_IFTYPE_WDS:
        case NL80211_IFTYPE_P2P_DEVICE:
        case NL80211_IFTYPE_NAN:
                /* these interface types don't really have a channel */
                return;
        case NL80211_IFTYPE_UNSPECIFIED:
+       case NL80211_IFTYPE_WDS:
        case NUM_NL80211_IFTYPES:
                WARN_ON(1);
        }
index 9f23923..4b1f35e 100644 (file)
@@ -631,10 +631,8 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)
                                return -EINVAL;
                }
 
-#ifndef CONFIG_WIRELESS_WDS
                if (WARN_ON(all_iftypes & BIT(NL80211_IFTYPE_WDS)))
                        return -EINVAL;
-#endif
 
                /* You can't even choose that many! */
                if (WARN_ON(cnt < c->max_interfaces))
@@ -675,10 +673,8 @@ int wiphy_register(struct wiphy *wiphy)
                     !(wiphy->nan_supported_bands & BIT(NL80211_BAND_2GHZ)))))
                return -EINVAL;
 
-#ifndef CONFIG_WIRELESS_WDS
        if (WARN_ON(wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS)))
                return -EINVAL;
-#endif
 
        if (WARN_ON(wiphy->pmsr_capa && !wiphy->pmsr_capa->ftm.supported))
                return -EINVAL;
@@ -1202,9 +1198,6 @@ void __cfg80211_leave(struct cfg80211_registered_device *rdev,
        case NL80211_IFTYPE_OCB:
                __cfg80211_leave_ocb(rdev, dev);
                break;
-       case NL80211_IFTYPE_WDS:
-               /* must be handled by mac80211/driver, has no APIs */
-               break;
        case NL80211_IFTYPE_P2P_DEVICE:
        case NL80211_IFTYPE_NAN:
                /* cannot happen, has no netdev */
@@ -1214,6 +1207,7 @@ void __cfg80211_leave(struct cfg80211_registered_device *rdev,
                /* nothing to do */
                break;
        case NL80211_IFTYPE_UNSPECIFIED:
+       case NL80211_IFTYPE_WDS:
        case NUM_NL80211_IFTYPES:
                /* invalid */
                break;
@@ -1250,8 +1244,7 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
 }
 EXPORT_SYMBOL(cfg80211_stop_iface);
 
-void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
-                       struct wireless_dev *wdev)
+void cfg80211_init_wdev(struct wireless_dev *wdev)
 {
        mutex_init(&wdev->mtx);
        INIT_LIST_HEAD(&wdev->event_list);
@@ -1262,6 +1255,30 @@ void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
        spin_lock_init(&wdev->pmsr_lock);
        INIT_WORK(&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk);
 
+#ifdef CONFIG_CFG80211_WEXT
+       wdev->wext.default_key = -1;
+       wdev->wext.default_mgmt_key = -1;
+       wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
+#endif
+
+       if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT)
+               wdev->ps = true;
+       else
+               wdev->ps = false;
+       /* allow mac80211 to determine the timeout */
+       wdev->ps_timeout = -1;
+
+       if ((wdev->iftype == NL80211_IFTYPE_STATION ||
+            wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
+            wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
+               wdev->netdev->priv_flags |= IFF_DONT_BRIDGE;
+
+       INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk);
+}
+
+void cfg80211_register_wdev(struct cfg80211_registered_device *rdev,
+                           struct wireless_dev *wdev)
+{
        /*
         * We get here also when the interface changes network namespaces,
         * as it's registered into the new one, but we don't want it to
@@ -1295,6 +1312,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
        switch (state) {
        case NETDEV_POST_INIT:
                SET_NETDEV_DEVTYPE(dev, &wiphy_type);
+               wdev->netdev = dev;
+               /* can only change netns with wiphy */
+               dev->features |= NETIF_F_NETNS_LOCAL;
+
+               cfg80211_init_wdev(wdev);
                break;
        case NETDEV_REGISTER:
                /*
@@ -1302,35 +1324,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
                 * called within code protected by it when interfaces
                 * are added with nl80211.
                 */
-               /* can only change netns with wiphy */
-               dev->features |= NETIF_F_NETNS_LOCAL;
-
                if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj,
                                      "phy80211")) {
                        pr_err("failed to add phy80211 symlink to netdev!\n");
                }
-               wdev->netdev = dev;
-#ifdef CONFIG_CFG80211_WEXT
-               wdev->wext.default_key = -1;
-               wdev->wext.default_mgmt_key = -1;
-               wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
-#endif
-
-               if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT)
-                       wdev->ps = true;
-               else
-                       wdev->ps = false;
-               /* allow mac80211 to determine the timeout */
-               wdev->ps_timeout = -1;
-
-               if ((wdev->iftype == NL80211_IFTYPE_STATION ||
-                    wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
-                    wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
-                       dev->priv_flags |= IFF_DONT_BRIDGE;
-
-               INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk);
 
-               cfg80211_init_wdev(rdev, wdev);
+               cfg80211_register_wdev(rdev, wdev);
                break;
        case NETDEV_GOING_DOWN:
                cfg80211_leave(rdev, wdev);
index e1ec9ac..e3e9686 100644 (file)
@@ -209,8 +209,9 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx);
 int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
                          struct net *net);
 
-void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
-                       struct wireless_dev *wdev);
+void cfg80211_init_wdev(struct wireless_dev *wdev);
+void cfg80211_register_wdev(struct cfg80211_registered_device *rdev,
+                           struct wireless_dev *wdev);
 
 static inline void wdev_lock(struct wireless_dev *wdev)
        __acquires(wdev)
index 554796a..8811a4b 100644 (file)
@@ -715,6 +715,9 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
                NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN),
        [NL80211_ATTR_S1G_CAPABILITY_MASK] =
                NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN),
+       [NL80211_ATTR_SAE_PWE] =
+               NLA_POLICY_RANGE(NLA_U8, NL80211_SAE_PWE_HUNT_AND_PECK,
+                                NL80211_SAE_PWE_BOTH),
 };
 
 /* policy for the key attributes */
@@ -1882,7 +1885,6 @@ static int nl80211_add_commands_unsplit(struct cfg80211_registered_device *rdev,
                if (nla_put_u32(msg, i, NL80211_CMD_SET_CHANNEL))
                        goto nla_put_failure;
        }
-       CMD(set_wds_peer, SET_WDS_PEER);
        if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) {
                CMD(tdls_mgmt, TDLS_MGMT);
                CMD(tdls_oper, TDLS_OPER);
@@ -2860,8 +2862,8 @@ static int parse_txq_params(struct nlattr *tb[],
 static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev)
 {
        /*
-        * You can only set the channel explicitly for WDS interfaces,
-        * all others have their channel managed via their respective
+        * You can only set the channel explicitly for some interfaces,
+        * most have their channel managed via their respective
         * "establish a connection" command (connect, join, ...)
         *
         * For AP/GO and mesh mode, the channel can be set with the
@@ -3066,29 +3068,6 @@ static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info)
        return __nl80211_set_channel(rdev, netdev, info);
 }
 
-static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info)
-{
-       struct cfg80211_registered_device *rdev = info->user_ptr[0];
-       struct net_device *dev = info->user_ptr[1];
-       struct wireless_dev *wdev = dev->ieee80211_ptr;
-       const u8 *bssid;
-
-       if (!info->attrs[NL80211_ATTR_MAC])
-               return -EINVAL;
-
-       if (netif_running(dev))
-               return -EBUSY;
-
-       if (!rdev->ops->set_wds_peer)
-               return -EOPNOTSUPP;
-
-       if (wdev->iftype != NL80211_IFTYPE_WDS)
-               return -EOPNOTSUPP;
-
-       bssid = nla_data(info->attrs[NL80211_ATTR_MAC]);
-       return rdev_set_wds_peer(rdev, dev, bssid);
-}
-
 static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
 {
        struct cfg80211_registered_device *rdev;
@@ -3885,7 +3864,8 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
                 * P2P Device and NAN do not have a netdev, so don't go
                 * through the netdev notifier and must be added here
                 */
-               cfg80211_init_wdev(rdev, wdev);
+               cfg80211_init_wdev(wdev);
+               cfg80211_register_wdev(rdev, wdev);
                break;
        default:
                break;
@@ -4594,7 +4574,8 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info,
                                         struct nlattr *attrs[],
                                         enum nl80211_attrs attr,
                                         struct cfg80211_bitrate_mask *mask,
-                                        struct net_device *dev)
+                                        struct net_device *dev,
+                                        bool default_all_enabled)
 {
        struct nlattr *tb[NL80211_TXRATE_MAX + 1];
        struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -4609,6 +4590,9 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info,
        for (i = 0; i < NUM_NL80211_BANDS; i++) {
                const struct ieee80211_sta_he_cap *he_cap;
 
+               if (!default_all_enabled)
+                       break;
+
                sband = rdev->wiphy.bands[i];
 
                if (!sband)
@@ -4676,6 +4660,7 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info,
                                        mask->control[band].ht_mcs))
                                return -EINVAL;
                }
+
                if (tb[NL80211_TXRATE_VHT]) {
                        if (!vht_set_mcs_mask(
                                        sband,
@@ -4683,6 +4668,7 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info,
                                        mask->control[band].vht_mcs))
                                return -EINVAL;
                }
+
                if (tb[NL80211_TXRATE_GI]) {
                        mask->control[band].gi =
                                nla_get_u8(tb[NL80211_TXRATE_GI]);
@@ -4694,6 +4680,7 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info,
                                     nla_data(tb[NL80211_TXRATE_HE]),
                                     mask->control[band].he_mcs))
                        return -EINVAL;
+
                if (tb[NL80211_TXRATE_HE_GI])
                        mask->control[band].he_gi =
                                nla_get_u8(tb[NL80211_TXRATE_HE_GI]);
@@ -4735,7 +4722,7 @@ static int validate_beacon_tx_rate(struct cfg80211_registered_device *rdev,
                                   enum nl80211_band band,
                                   struct cfg80211_bitrate_mask *beacon_rate)
 {
-       u32 count_ht, count_vht, i;
+       u32 count_ht, count_vht, count_he, i;
        u32 rate = beacon_rate->control[band].legacy;
 
        /* Allow only one rate */
@@ -4768,7 +4755,21 @@ static int validate_beacon_tx_rate(struct cfg80211_registered_device *rdev,
                        return -EINVAL;
        }
 
-       if ((count_ht && count_vht) || (!rate && !count_ht && !count_vht))
+       count_he = 0;
+       for (i = 0; i < NL80211_HE_NSS_MAX; i++) {
+               if (hweight16(beacon_rate->control[band].he_mcs[i]) > 1) {
+                       return -EINVAL;
+               } else if (beacon_rate->control[band].he_mcs[i]) {
+                       count_he++;
+                       if (count_he > 1)
+                               return -EINVAL;
+               }
+               if (count_he && rate)
+                       return -EINVAL;
+       }
+
+       if ((count_ht && count_vht && count_he) ||
+           (!rate && !count_ht && !count_vht && !count_he))
                return -EINVAL;
 
        if (rate &&
@@ -4783,6 +4784,10 @@ static int validate_beacon_tx_rate(struct cfg80211_registered_device *rdev,
            !wiphy_ext_feature_isset(&rdev->wiphy,
                                     NL80211_EXT_FEATURE_BEACON_RATE_VHT))
                return -EINVAL;
+       if (count_he &&
+           !wiphy_ext_feature_isset(&rdev->wiphy,
+                                    NL80211_EXT_FEATURE_BEACON_RATE_HE))
+               return -EINVAL;
 
        return 0;
 }
@@ -5243,7 +5248,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
                err = nl80211_parse_tx_bitrate_mask(info, info->attrs,
                                                    NL80211_ATTR_TX_RATES,
                                                    &params.beacon_rate,
-                                                   dev);
+                                                   dev, false);
                if (err)
                        return err;
 
@@ -9731,6 +9736,12 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
                        nla_len(info->attrs[NL80211_ATTR_SAE_PASSWORD]);
        }
 
+       if (info->attrs[NL80211_ATTR_SAE_PWE])
+               settings->sae_pwe =
+                       nla_get_u8(info->attrs[NL80211_ATTR_SAE_PWE]);
+       else
+               settings->sae_pwe = NL80211_SAE_PWE_UNSPECIFIED;
+
        return 0;
 }
 
@@ -11087,7 +11098,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
 
        err = nl80211_parse_tx_bitrate_mask(info, info->attrs,
                                            NL80211_ATTR_TX_RATES, &mask,
-                                           dev);
+                                           dev, true);
        if (err)
                return err;
 
@@ -11696,7 +11707,7 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
                err = nl80211_parse_tx_bitrate_mask(info, info->attrs,
                                                    NL80211_ATTR_TX_RATES,
                                                    &setup.beacon_rate,
-                                                   dev);
+                                                   dev, false);
                if (err)
                        return err;
 
@@ -14476,7 +14487,8 @@ static int parse_tid_conf(struct cfg80211_registered_device *rdev,
                if (tid_conf->txrate_type != NL80211_TX_RATE_AUTOMATIC) {
                        attr = NL80211_TID_CONFIG_ATTR_TX_RATE;
                        err = nl80211_parse_tx_bitrate_mask(info, attrs, attr,
-                                                   &tid_conf->txrate_mask, dev);
+                                                   &tid_conf->txrate_mask, dev,
+                                                   true);
                        if (err)
                                return err;
 
@@ -15139,14 +15151,6 @@ static const struct genl_small_ops nl80211_small_ops[] = {
                                  NL80211_FLAG_NEED_RTNL,
        },
        {
-               .cmd = NL80211_CMD_SET_WDS_PEER,
-               .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
-               .doit = nl80211_set_wds_peer,
-               .flags = GENL_UNS_ADMIN_PERM,
-               .internal_flags = NL80211_FLAG_NEED_NETDEV |
-                                 NL80211_FLAG_NEED_RTNL,
-       },
-       {
                .cmd = NL80211_CMD_JOIN_MESH,
                .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
                .doit = nl80211_join_mesh,
index 950d574..5e2f349 100644 (file)
@@ -582,16 +582,6 @@ static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev,
        return ret;
 }
 
-static inline int rdev_set_wds_peer(struct cfg80211_registered_device *rdev,
-                                   struct net_device *dev, const u8 *addr)
-{
-       int ret;
-       trace_rdev_set_wds_peer(&rdev->wiphy, dev, addr);
-       ret = rdev->ops->set_wds_peer(&rdev->wiphy, dev, addr);
-       trace_rdev_return_int(&rdev->wiphy, ret);
-       return ret;
-}
-
 static inline int
 rdev_set_multicast_to_unicast(struct cfg80211_registered_device *rdev,
                              struct net_device *dev,
index 3dab859..a04fdfb 100644 (file)
@@ -3616,7 +3616,7 @@ static void print_rd_rules(const struct ieee80211_regdomain *rd)
                power_rule = &reg_rule->power_rule;
 
                if (reg_rule->flags & NL80211_RRF_AUTO_BW)
-                       snprintf(bw, sizeof(bw), "%d KHz, %d KHz AUTO",
+                       snprintf(bw, sizeof(bw), "%d KHz, %u KHz AUTO",
                                 freq_range->max_bandwidth_khz,
                                 reg_get_max_bandwidth(rd, reg_rule));
                else
index 8d0e49c..3409f37 100644 (file)
@@ -694,7 +694,7 @@ static  void cfg80211_scan_req_add_chan(struct cfg80211_scan_request *request,
 static bool cfg80211_find_ssid_match(struct cfg80211_colocated_ap *ap,
                                     struct cfg80211_scan_request *request)
 {
-       u8 i;
+       int i;
        u32 s_ssid;
 
        for (i = 0; i < request->n_ssids; i++) {
index 6e218a0..817c6fe 100644 (file)
@@ -838,11 +838,6 @@ DEFINE_EVENT(wiphy_netdev_mac_evt, rdev_del_mpath,
        TP_ARGS(wiphy, netdev, mac)
 );
 
-DEFINE_EVENT(wiphy_netdev_mac_evt, rdev_set_wds_peer,
-       TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *mac),
-       TP_ARGS(wiphy, netdev, mac)
-);
-
 TRACE_EVENT(rdev_dump_station,
        TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int _idx,
                 u8 *mac),
index f017468..5af8803 100644 (file)
@@ -550,8 +550,7 @@ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
                        return -1;
                break;
        case cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS):
-               if (unlikely(iftype != NL80211_IFTYPE_WDS &&
-                            iftype != NL80211_IFTYPE_MESH_POINT &&
+               if (unlikely(iftype != NL80211_IFTYPE_MESH_POINT &&
                             iftype != NL80211_IFTYPE_AP_VLAN &&
                             iftype != NL80211_IFTYPE_STATION))
                        return -1;
@@ -1051,7 +1050,6 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
                case NL80211_IFTYPE_P2P_GO:
                case NL80211_IFTYPE_AP:
                case NL80211_IFTYPE_AP_VLAN:
-               case NL80211_IFTYPE_WDS:
                case NL80211_IFTYPE_MESH_POINT:
                        /* bridging OK */
                        break;
@@ -1063,6 +1061,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
                        /* not happening */
                        break;
                case NL80211_IFTYPE_P2P_DEVICE:
+               case NL80211_IFTYPE_WDS:
                case NL80211_IFTYPE_NAN:
                        WARN_ON(1);
                        break;
@@ -1276,20 +1275,22 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate)
 
 static u32 cfg80211_calculate_bitrate_he(struct rate_info *rate)
 {
-#define SCALE 2048
-       u16 mcs_divisors[12] = {
-               34133, /* 16.666666... */
-               17067, /*  8.333333... */
-               11378, /*  5.555555... */
-                8533, /*  4.166666... */
-                5689, /*  2.777777... */
-                4267, /*  2.083333... */
-                3923, /*  1.851851... */
-                3413, /*  1.666666... */
-                2844, /*  1.388888... */
-                2560, /*  1.250000... */
-                2276, /*  1.111111... */
-                2048, /*  1.000000... */
+#define SCALE 6144
+       u32 mcs_divisors[14] = {
+               102399, /* 16.666666... */
+                51201, /*  8.333333... */
+                34134, /*  5.555555... */
+                25599, /*  4.166666... */
+                17067, /*  2.777777... */
+                12801, /*  2.083333... */
+                11769, /*  1.851851... */
+                10239, /*  1.666666... */
+                 8532, /*  1.388888... */
+                 7680, /*  1.250000... */
+                 6828, /*  1.111111... */
+                 6144, /*  1.000000... */
+                 5690, /*  0.926106... */
+                 5120, /*  0.833333... */
        };
        u32 rates_160M[3] = { 960777777, 907400000, 816666666 };
        u32 rates_969[3] =  { 480388888, 453700000, 408333333 };
@@ -1301,7 +1302,7 @@ static u32 cfg80211_calculate_bitrate_he(struct rate_info *rate)
        u64 tmp;
        u32 result;
 
-       if (WARN_ON_ONCE(rate->mcs > 11))
+       if (WARN_ON_ONCE(rate->mcs > 13))
                return 0;
 
        if (WARN_ON_ONCE(rate->he_gi > NL80211_RATE_INFO_HE_GI_3_2))
index 78f2927..b84a345 100644 (file)
@@ -49,9 +49,6 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
        case IW_MODE_ADHOC:
                type = NL80211_IFTYPE_ADHOC;
                break;
-       case IW_MODE_REPEAT:
-               type = NL80211_IFTYPE_WDS;
-               break;
        case IW_MODE_MONITOR:
                type = NL80211_IFTYPE_MONITOR;
                break;
@@ -1150,50 +1147,6 @@ static int cfg80211_wext_giwpower(struct net_device *dev,
        return 0;
 }
 
-static int cfg80211_wds_wext_siwap(struct net_device *dev,
-                                  struct iw_request_info *info,
-                                  struct sockaddr *addr, char *extra)
-{
-       struct wireless_dev *wdev = dev->ieee80211_ptr;
-       struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
-       int err;
-
-       if (WARN_ON(wdev->iftype != NL80211_IFTYPE_WDS))
-               return -EINVAL;
-
-       if (addr->sa_family != ARPHRD_ETHER)
-               return -EINVAL;
-
-       if (netif_running(dev))
-               return -EBUSY;
-
-       if (!rdev->ops->set_wds_peer)
-               return -EOPNOTSUPP;
-
-       err = rdev_set_wds_peer(rdev, dev, (u8 *)&addr->sa_data);
-       if (err)
-               return err;
-
-       memcpy(&wdev->wext.bssid, (u8 *) &addr->sa_data, ETH_ALEN);
-
-       return 0;
-}
-
-static int cfg80211_wds_wext_giwap(struct net_device *dev,
-                                  struct iw_request_info *info,
-                                  struct sockaddr *addr, char *extra)
-{
-       struct wireless_dev *wdev = dev->ieee80211_ptr;
-
-       if (WARN_ON(wdev->iftype != NL80211_IFTYPE_WDS))
-               return -EINVAL;
-
-       addr->sa_family = ARPHRD_ETHER;
-       memcpy(&addr->sa_data, wdev->wext.bssid, ETH_ALEN);
-
-       return 0;
-}
-
 static int cfg80211_wext_siwrate(struct net_device *dev,
                                 struct iw_request_info *info,
                                 struct iw_param *rate, char *extra)
@@ -1371,8 +1324,6 @@ static int cfg80211_wext_siwap(struct net_device *dev,
                return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
        case NL80211_IFTYPE_STATION:
                return cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
-       case NL80211_IFTYPE_WDS:
-               return cfg80211_wds_wext_siwap(dev, info, ap_addr, extra);
        default:
                return -EOPNOTSUPP;
        }
@@ -1389,8 +1340,6 @@ static int cfg80211_wext_giwap(struct net_device *dev,
                return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra);
        case NL80211_IFTYPE_STATION:
                return cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra);
-       case NL80211_IFTYPE_WDS:
-               return cfg80211_wds_wext_giwap(dev, info, ap_addr, extra);
        default:
                return -EOPNOTSUPP;
        }
index 0bbb283..046d3fe 100644 (file)
@@ -825,7 +825,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr,
        sock->state = SS_CONNECTED;
        rc = 0;
 out_put_neigh:
-       if (rc) {
+       if (rc && x25->neighbour) {
                read_lock_bh(&x25_list_lock);
                x25_neigh_put(x25->neighbour);
                x25->neighbour = NULL;
index b71a32e..cfbec39 100644 (file)
@@ -1146,7 +1146,8 @@ static void xsk_destruct(struct sock *sk)
        if (!sock_flag(sk, SOCK_DEAD))
                return;
 
-       xp_put_pool(xs->pool);
+       if (!xp_put_pool(xs->pool))
+               xdp_put_umem(xs->umem);
 
        sk_refcnt_debug_dec(sk);
 }
index 64c9e55..8a3bf4e 100644 (file)
@@ -251,15 +251,18 @@ void xp_get_pool(struct xsk_buff_pool *pool)
        refcount_inc(&pool->users);
 }
 
-void xp_put_pool(struct xsk_buff_pool *pool)
+bool xp_put_pool(struct xsk_buff_pool *pool)
 {
        if (!pool)
-               return;
+               return false;
 
        if (refcount_dec_and_test(&pool->users)) {
                INIT_WORK(&pool->work, xp_release_deferred);
                schedule_work(&pool->work);
+               return true;
        }
+
+       return false;
 }
 
 static struct xsk_dma_map *xp_find_dma_map(struct xsk_buff_pool *pool)
index 37456d0..be6351e 100644 (file)
@@ -760,9 +760,9 @@ int xfrm_input_resume(struct sk_buff *skb, int nexthdr)
 }
 EXPORT_SYMBOL(xfrm_input_resume);
 
-static void xfrm_trans_reinject(unsigned long data)
+static void xfrm_trans_reinject(struct tasklet_struct *t)
 {
-       struct xfrm_trans_tasklet *trans = (void *)data;
+       struct xfrm_trans_tasklet *trans = from_tasklet(trans, t, tasklet);
        struct sk_buff_head queue;
        struct sk_buff *skb;
 
@@ -818,7 +818,6 @@ void __init xfrm_input_init(void)
 
                trans = &per_cpu(xfrm_trans_tasklet, i);
                __skb_queue_head_init(&trans->queue);
-               tasklet_init(&trans->tasklet, xfrm_trans_reinject,
-                            (unsigned long)trans);
+               tasklet_setup(&trans->tasklet, xfrm_trans_reinject);
        }
 }
index aa4cdcf..9b8e292 100644 (file)
@@ -803,14 +803,14 @@ static struct xfrm6_tunnel xfrmi_ipv6_handler __read_mostly = {
        .handler        =       xfrmi6_rcv_tunnel,
        .cb_handler     =       xfrmi_rcv_cb,
        .err_handler    =       xfrmi6_err,
-       .priority       =       -1,
+       .priority       =       2,
 };
 
 static struct xfrm6_tunnel xfrmi_ip6ip_handler __read_mostly = {
        .handler        =       xfrmi6_rcv_tunnel,
        .cb_handler     =       xfrmi_rcv_cb,
        .err_handler    =       xfrmi6_err,
-       .priority       =       -1,
+       .priority       =       2,
 };
 #endif
 
@@ -848,14 +848,14 @@ static struct xfrm_tunnel xfrmi_ipip_handler __read_mostly = {
        .handler        =       xfrmi4_rcv_tunnel,
        .cb_handler     =       xfrmi_rcv_cb,
        .err_handler    =       xfrmi4_err,
-       .priority       =       -1,
+       .priority       =       3,
 };
 
 static struct xfrm_tunnel xfrmi_ipip6_handler __read_mostly = {
        .handler        =       xfrmi4_rcv_tunnel,
        .cb_handler     =       xfrmi_rcv_cb,
        .err_handler    =       xfrmi4_err,
-       .priority       =       -1,
+       .priority       =       2,
 };
 #endif
 
index bbd4643..a77da7a 100644 (file)
@@ -2004,6 +2004,7 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high)
        int err = -ENOENT;
        __be32 minspi = htonl(low);
        __be32 maxspi = htonl(high);
+       __be32 newspi = 0;
        u32 mark = x->mark.v & x->mark.m;
 
        spin_lock_bh(&x->lock);
@@ -2022,21 +2023,22 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high)
                        xfrm_state_put(x0);
                        goto unlock;
                }
-               x->id.spi = minspi;
+               newspi = minspi;
        } else {
                u32 spi = 0;
                for (h = 0; h < high-low+1; h++) {
                        spi = low + prandom_u32()%(high-low+1);
                        x0 = xfrm_state_lookup(net, mark, &x->id.daddr, htonl(spi), x->id.proto, x->props.family);
                        if (x0 == NULL) {
-                               x->id.spi = htonl(spi);
+                               newspi = htonl(spi);
                                break;
                        }
                        xfrm_state_put(x0);
                }
        }
-       if (x->id.spi) {
+       if (newspi) {
                spin_lock_bh(&net->xfrm.xfrm_state_lock);
+               x->id.spi = newspi;
                h = xfrm_spi_hash(net, &x->id.daddr, x->id.spi, x->id.proto, x->props.family);
                hlist_add_head_rcu(&x->byspi, net->xfrm.state_byspi + h);
                spin_unlock_bh(&net->xfrm.xfrm_state_lock);
index 4a74531..b68bd2f 100644 (file)
@@ -290,7 +290,7 @@ static int test_debug_fs_uprobe(char *binary_path, long offset, bool is_return)
 
 int main(int argc, char **argv)
 {
-       struct rlimit r = {1024*1024, RLIM_INFINITY};
+       struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
        extern char __executable_start;
        char filename[256], buf[256];
        __u64 uprobe_file_offset;
index 3e36b3e..3d6eab7 100644 (file)
@@ -116,7 +116,7 @@ static void int_exit(int sig)
 
 int main(int ac, char **argv)
 {
-       struct rlimit r = {1024*1024, RLIM_INFINITY};
+       struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
        long key, next_key, value;
        struct bpf_link *links[2];
        struct bpf_program *prog;
index 70e9877..83e0fec 100644 (file)
@@ -107,7 +107,7 @@ static void print_hist(int fd)
 
 int main(int ac, char **argv)
 {
-       struct rlimit r = {1024*1024, RLIM_INFINITY};
+       struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
        struct bpf_link *links[2];
        struct bpf_program *prog;
        struct bpf_object *obj;
index 6fb8dbd..f78cb18 100644 (file)
@@ -765,7 +765,7 @@ static int load_cpumap_prog(char *file_name, char *prog_name,
 
 int main(int argc, char **argv)
 {
-       struct rlimit r = {10 * 1024 * 1024, RLIM_INFINITY};
+       struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
        char *prog_name = "xdp_cpu_map5_lb_hash_ip_pairs";
        char *mprog_filename = "xdp_redirect_kern.o";
        char *redir_interface = NULL, *redir_map = NULL;
index caa4e7f..93fa1bc 100644 (file)
@@ -450,7 +450,7 @@ static void stats_poll(int interval, int action, __u32 cfg_opt)
 int main(int argc, char **argv)
 {
        __u32 cfg_options= NO_TOUCH ; /* Default: Don't touch packet memory */
-       struct rlimit r = {10 * 1024 * 1024, RLIM_INFINITY};
+       struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
        struct bpf_prog_load_attr prog_load_attr = {
                .prog_type      = BPF_PROG_TYPE_XDP,
        };
diff --git a/samples/mic/mpssd/.gitignore b/samples/mic/mpssd/.gitignore
deleted file mode 100644 (file)
index aa03f1e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-mpssd
diff --git a/samples/mic/mpssd/Makefile b/samples/mic/mpssd/Makefile
deleted file mode 100644 (file)
index a7a6e0c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-ifndef CROSS_COMPILE
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
-
-ifeq ($(ARCH),x86)
-
-PROGS := mpssd
-CC = $(CROSS_COMPILE)gcc
-CFLAGS := -I../../../usr/include -I../../../tools/include
-
-ifdef DEBUG
-CFLAGS += -DDEBUG=$(DEBUG)
-endif
-
-all: $(PROGS)
-mpssd: mpssd.c sysfs.c
-       $(CC) $(CFLAGS) mpssd.c sysfs.c -o mpssd -lpthread
-
-install:
-       install mpssd /usr/sbin/mpssd
-       install micctrl /usr/sbin/micctrl
-
-clean:
-       rm -fr $(PROGS)
-
-endif
-endif
diff --git a/samples/mic/mpssd/micctrl b/samples/mic/mpssd/micctrl
deleted file mode 100755 (executable)
index 030a60b..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: GPL-2.0-only
-# Intel MIC Platform Software Stack (MPSS)
-#
-# Copyright(c) 2013 Intel Corporation.
-#
-# Intel MIC User Space Tools.
-#
-# micctrl - Controls MIC boot/start/stop.
-#
-# chkconfig: 2345 95 05
-# description: start MPSS stack processing.
-#
-### BEGIN INIT INFO
-# Provides: micctrl
-### END INIT INFO
-
-# Source function library.
-. /etc/init.d/functions
-
-sysfs="/sys/class/mic"
-
-_status()
-{
-       f=$sysfs/$1
-       echo -e $1 state: "`cat $f/state`" shutdown_status: "`cat $f/shutdown_status`"
-}
-
-status()
-{
-       if [ "`echo $1 | head -c3`" == "mic" ]; then
-               _status $1
-               return $?
-       fi
-       for f in $sysfs/*
-       do
-               _status `basename $f`
-               RETVAL=$?
-               [ $RETVAL -ne 0 ] && return $RETVAL
-       done
-       return 0
-}
-
-_reset()
-{
-       f=$sysfs/$1
-       echo reset > $f/state
-}
-
-reset()
-{
-       if [ "`echo $1 | head -c3`" == "mic" ]; then
-               _reset $1
-               return $?
-       fi
-       for f in $sysfs/*
-       do
-               _reset `basename $f`
-               RETVAL=$?
-               [ $RETVAL -ne 0 ] && return $RETVAL
-       done
-       return 0
-}
-
-_boot()
-{
-       f=$sysfs/$1
-       echo "linux" > $f/bootmode
-       echo "mic/uos.img" > $f/firmware
-       echo "mic/$1.image" > $f/ramdisk
-       echo "boot" > $f/state
-}
-
-boot()
-{
-       if [ "`echo $1 | head -c3`" == "mic" ]; then
-               _boot $1
-               return $?
-       fi
-       for f in $sysfs/*
-       do
-               _boot `basename $f`
-               RETVAL=$?
-               [ $RETVAL -ne 0 ] && return $RETVAL
-       done
-       return 0
-}
-
-_shutdown()
-{
-       f=$sysfs/$1
-       echo shutdown > $f/state
-}
-
-shutdown()
-{
-       if [ "`echo $1 | head -c3`" == "mic" ]; then
-               _shutdown $1
-               return $?
-       fi
-       for f in $sysfs/*
-       do
-               _shutdown `basename $f`
-               RETVAL=$?
-               [ $RETVAL -ne 0 ] && return $RETVAL
-       done
-       return 0
-}
-
-_wait()
-{
-       f=$sysfs/$1
-       while [ "`cat $f/state`" != "offline" -a "`cat $f/state`" != "online" ]
-       do
-               sleep 1
-               echo -e "Waiting for $1 to go offline"
-       done
-}
-
-wait()
-{
-       if [ "`echo $1 | head -c3`" == "mic" ]; then
-               _wait $1
-               return $?
-       fi
-       # Wait for the cards to go offline
-       for f in $sysfs/*
-       do
-               _wait `basename $f`
-               RETVAL=$?
-               [ $RETVAL -ne 0 ] && return $RETVAL
-       done
-       return 0
-}
-
-if [ ! -d "$sysfs" ]; then
-       echo -e $"Module unloaded "
-       exit 3
-fi
-
-case $1 in
-       -s)
-               status $2
-               ;;
-       -r)
-               reset $2
-               ;;
-       -b)
-               boot $2
-               ;;
-       -S)
-               shutdown $2
-               ;;
-       -w)
-               wait $2
-               ;;
-       *)
-               echo $"Usage: $0 {-s (status) |-r (reset) |-b (boot) |-S (shutdown) |-w (wait)}"
-               exit 2
-esac
-
-exit $?
diff --git a/samples/mic/mpssd/mpss b/samples/mic/mpssd/mpss
deleted file mode 100755 (executable)
index 248ac73..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: GPL-2.0-only
-# Intel MIC Platform Software Stack (MPSS)
-#
-# Copyright(c) 2013 Intel Corporation.
-#
-# Intel MIC User Space Tools.
-#
-# mpss Start mpssd.
-#
-# chkconfig: 2345 95 05
-# description: start MPSS stack processing.
-#
-### BEGIN INIT INFO
-# Provides: mpss
-# Required-Start:
-# Required-Stop:
-# Short-Description: MPSS stack control
-# Description: MPSS stack control
-### END INIT INFO
-
-# Source function library.
-. /etc/init.d/functions
-
-exec=/usr/sbin/mpssd
-sysfs="/sys/class/mic"
-mic_modules="mic_host mic_x100_dma scif vop"
-
-start()
-{
-       [ -x $exec ] || exit 5
-
-       if [ "`ps -e | awk '{print $4}' | grep mpssd | head -1`" = "mpssd" ]; then
-               echo -e $"MPSSD already running! "
-               success
-               echo
-               return 0
-       fi
-
-       echo -e $"Starting MPSS Stack"
-       echo -e $"Loading MIC drivers:" $mic_modules
-
-       modprobe -a $mic_modules
-       RETVAL=$?
-       if [ $RETVAL -ne 0 ]; then
-               failure
-               echo
-               return $RETVAL
-       fi
-
-       # Start the daemon
-       echo -n $"Starting MPSSD "
-       $exec
-       RETVAL=$?
-       if [ $RETVAL -ne 0 ]; then
-               failure
-               echo
-               return $RETVAL
-       fi
-       success
-       echo
-
-       sleep 5
-
-       # Boot the cards
-       micctrl -b
-
-       # Wait till ping works
-       for f in $sysfs/*
-       do
-               count=100
-               ipaddr=`cat $f/cmdline`
-               ipaddr=${ipaddr#*address,}
-               ipaddr=`echo $ipaddr | cut -d, -f1 | cut -d\; -f1`
-               while [ $count -ge 0 ]
-               do
-                       echo -e "Pinging "`basename $f`" "
-                       ping -c 1 $ipaddr &> /dev/null
-                       RETVAL=$?
-                       if [ $RETVAL -eq 0 ]; then
-                               success
-                               break
-                       fi
-                       sleep 1
-                       count=`expr $count - 1`
-               done
-               [ $RETVAL -ne 0 ] && failure || success
-               echo
-       done
-       return $RETVAL
-}
-
-stop()
-{
-       echo -e $"Shutting down MPSS Stack: "
-
-       # Bail out if module is unloaded
-       if [ ! -d "$sysfs" ]; then
-               echo -n $"Module unloaded "
-               success
-               echo
-               return 0
-       fi
-
-       # Shut down the cards.
-       micctrl -S
-
-       # Wait for the cards to go offline
-       for f in $sysfs/*
-       do
-               while [ "`cat $f/state`" != "ready" ]
-               do
-                       sleep 1
-                       echo -e "Waiting for "`basename $f`" to become ready"
-               done
-       done
-
-       # Display the status of the cards
-       micctrl -s
-
-       # Kill MPSSD now
-       echo -n $"Killing MPSSD"
-       killall -9 mpssd 2>/dev/null
-       RETVAL=$?
-       [ $RETVAL -ne 0 ] && failure || success
-       echo
-       return $RETVAL
-}
-
-restart()
-{
-       stop
-       sleep 5
-       start
-}
-
-status()
-{
-       micctrl -s
-       if [ "`ps -e | awk '{print $4}' | grep mpssd | head -n 1`" = "mpssd" ]; then
-               echo "mpssd is running"
-       else
-               echo "mpssd is stopped"
-       fi
-       return 0
-}
-
-unload()
-{
-       if [ ! -d "$sysfs" ]; then
-               echo -n $"No MIC_HOST Module: "
-               success
-               echo
-               return
-       fi
-
-       stop
-
-       sleep 5
-       echo -n $"Removing MIC drivers:" $mic_modules
-       modprobe -r $mic_modules
-       RETVAL=$?
-       [ $RETVAL -ne 0 ] && failure || success
-       echo
-       return $RETVAL
-}
-
-case $1 in
-       start)
-               start
-               ;;
-       stop)
-               stop
-               ;;
-       restart)
-               restart
-               ;;
-       status)
-               status
-               ;;
-       unload)
-               unload
-               ;;
-       *)
-               echo $"Usage: $0 {start|stop|restart|status|unload}"
-               exit 2
-esac
-
-exit $?
diff --git a/samples/mic/mpssd/mpssd.c b/samples/mic/mpssd/mpssd.c
deleted file mode 100644 (file)
index c03a05d..0000000
+++ /dev/null
@@ -1,1815 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC User Space Tools.
- */
-
-#define _GNU_SOURCE
-
-#include <stdlib.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <assert.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <signal.h>
-#include <poll.h>
-#include <features.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/socket.h>
-#include <linux/virtio_ring.h>
-#include <linux/virtio_net.h>
-#include <linux/virtio_console.h>
-#include <linux/virtio_blk.h>
-#include <linux/version.h>
-#include "mpssd.h"
-#include <linux/mic_ioctl.h>
-#include <linux/mic_common.h>
-#include <tools/endian.h>
-
-static void *init_mic(void *arg);
-
-static FILE *logfp;
-static struct mic_info mic_list;
-
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
-#define min_t(type, x, y) ({                           \
-               type __min1 = (x);                      \
-               type __min2 = (y);                      \
-               __min1 < __min2 ? __min1 : __min2; })
-
-/* align addr on a size boundary - adjust address up/down if needed */
-#define _ALIGN_DOWN(addr, size)  ((addr)&(~((size)-1)))
-#define _ALIGN_UP(addr, size)    _ALIGN_DOWN(addr + size - 1, size)
-
-/* align addr on a size boundary - adjust address up if needed */
-#define _ALIGN(addr, size)     _ALIGN_UP(addr, size)
-
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)        _ALIGN(addr, PAGE_SIZE)
-
-#define READ_ONCE(x) (*(volatile typeof(x) *)&(x))
-
-#define GSO_ENABLED            1
-#define MAX_GSO_SIZE           (64 * 1024)
-#define ETH_H_LEN              14
-#define MAX_NET_PKT_SIZE       (_ALIGN_UP(MAX_GSO_SIZE + ETH_H_LEN, 64))
-#define MIC_DEVICE_PAGE_END    0x1000
-
-#ifndef VIRTIO_NET_HDR_F_DATA_VALID
-#define VIRTIO_NET_HDR_F_DATA_VALID    2       /* Csum is valid */
-#endif
-
-static struct {
-       struct mic_device_desc dd;
-       struct mic_vqconfig vqconfig[2];
-       __u32 host_features, guest_acknowledgements;
-       struct virtio_console_config cons_config;
-} virtcons_dev_page = {
-       .dd = {
-               .type = VIRTIO_ID_CONSOLE,
-               .num_vq = ARRAY_SIZE(virtcons_dev_page.vqconfig),
-               .feature_len = sizeof(virtcons_dev_page.host_features),
-               .config_len = sizeof(virtcons_dev_page.cons_config),
-       },
-       .vqconfig[0] = {
-               .num = htole16(MIC_VRING_ENTRIES),
-       },
-       .vqconfig[1] = {
-               .num = htole16(MIC_VRING_ENTRIES),
-       },
-};
-
-static struct {
-       struct mic_device_desc dd;
-       struct mic_vqconfig vqconfig[2];
-       __u32 host_features, guest_acknowledgements;
-       struct virtio_net_config net_config;
-} virtnet_dev_page = {
-       .dd = {
-               .type = VIRTIO_ID_NET,
-               .num_vq = ARRAY_SIZE(virtnet_dev_page.vqconfig),
-               .feature_len = sizeof(virtnet_dev_page.host_features),
-               .config_len = sizeof(virtnet_dev_page.net_config),
-       },
-       .vqconfig[0] = {
-               .num = htole16(MIC_VRING_ENTRIES),
-       },
-       .vqconfig[1] = {
-               .num = htole16(MIC_VRING_ENTRIES),
-       },
-#if GSO_ENABLED
-       .host_features = htole32(
-               1 << VIRTIO_NET_F_CSUM |
-               1 << VIRTIO_NET_F_GSO |
-               1 << VIRTIO_NET_F_GUEST_TSO4 |
-               1 << VIRTIO_NET_F_GUEST_TSO6 |
-               1 << VIRTIO_NET_F_GUEST_ECN),
-#else
-               .host_features = 0,
-#endif
-};
-
-static const char *mic_config_dir = "/etc/mpss";
-static const char *virtblk_backend = "VIRTBLK_BACKEND";
-static struct {
-       struct mic_device_desc dd;
-       struct mic_vqconfig vqconfig[1];
-       __u32 host_features, guest_acknowledgements;
-       struct virtio_blk_config blk_config;
-} virtblk_dev_page = {
-       .dd = {
-               .type = VIRTIO_ID_BLOCK,
-               .num_vq = ARRAY_SIZE(virtblk_dev_page.vqconfig),
-               .feature_len = sizeof(virtblk_dev_page.host_features),
-               .config_len = sizeof(virtblk_dev_page.blk_config),
-       },
-       .vqconfig[0] = {
-               .num = htole16(MIC_VRING_ENTRIES),
-       },
-       .host_features =
-               htole32(1<<VIRTIO_BLK_F_SEG_MAX),
-       .blk_config = {
-               .seg_max = htole32(MIC_VRING_ENTRIES - 2),
-               .capacity = htole64(0),
-        }
-};
-
-static char *myname;
-
-static int
-tap_configure(struct mic_info *mic, char *dev)
-{
-       pid_t pid;
-       char *ifargv[7];
-       char ipaddr[IFNAMSIZ];
-       int ret = 0;
-
-       pid = fork();
-       if (pid == 0) {
-               ifargv[0] = "ip";
-               ifargv[1] = "link";
-               ifargv[2] = "set";
-               ifargv[3] = dev;
-               ifargv[4] = "up";
-               ifargv[5] = NULL;
-               mpsslog("Configuring %s\n", dev);
-               ret = execvp("ip", ifargv);
-               if (ret < 0) {
-                       mpsslog("%s execvp failed errno %s\n",
-                               mic->name, strerror(errno));
-                       return ret;
-               }
-       }
-       if (pid < 0) {
-               mpsslog("%s fork failed errno %s\n",
-                       mic->name, strerror(errno));
-               return ret;
-       }
-
-       ret = waitpid(pid, NULL, 0);
-       if (ret < 0) {
-               mpsslog("%s waitpid failed errno %s\n",
-                       mic->name, strerror(errno));
-               return ret;
-       }
-
-       snprintf(ipaddr, IFNAMSIZ, "172.31.%d.254/24", mic->id + 1);
-
-       pid = fork();
-       if (pid == 0) {
-               ifargv[0] = "ip";
-               ifargv[1] = "addr";
-               ifargv[2] = "add";
-               ifargv[3] = ipaddr;
-               ifargv[4] = "dev";
-               ifargv[5] = dev;
-               ifargv[6] = NULL;
-               mpsslog("Configuring %s ipaddr %s\n", dev, ipaddr);
-               ret = execvp("ip", ifargv);
-               if (ret < 0) {
-                       mpsslog("%s execvp failed errno %s\n",
-                               mic->name, strerror(errno));
-                       return ret;
-               }
-       }
-       if (pid < 0) {
-               mpsslog("%s fork failed errno %s\n",
-                       mic->name, strerror(errno));
-               return ret;
-       }
-
-       ret = waitpid(pid, NULL, 0);
-       if (ret < 0) {
-               mpsslog("%s waitpid failed errno %s\n",
-                       mic->name, strerror(errno));
-               return ret;
-       }
-       mpsslog("MIC name %s %s %d DONE!\n",
-               mic->name, __func__, __LINE__);
-       return 0;
-}
-
-static int tun_alloc(struct mic_info *mic, char *dev)
-{
-       struct ifreq ifr;
-       int fd, err;
-#if GSO_ENABLED
-       unsigned offload;
-#endif
-       fd = open("/dev/net/tun", O_RDWR);
-       if (fd < 0) {
-               mpsslog("Could not open /dev/net/tun %s\n", strerror(errno));
-               goto done;
-       }
-
-       memset(&ifr, 0, sizeof(ifr));
-
-       ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_VNET_HDR;
-       if (*dev)
-               strncpy(ifr.ifr_name, dev, IFNAMSIZ);
-
-       err = ioctl(fd, TUNSETIFF, (void *)&ifr);
-       if (err < 0) {
-               mpsslog("%s %s %d TUNSETIFF failed %s\n",
-                       mic->name, __func__, __LINE__, strerror(errno));
-               close(fd);
-               return err;
-       }
-#if GSO_ENABLED
-       offload = TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 | TUN_F_TSO_ECN;
-
-       err = ioctl(fd, TUNSETOFFLOAD, offload);
-       if (err < 0) {
-               mpsslog("%s %s %d TUNSETOFFLOAD failed %s\n",
-                       mic->name, __func__, __LINE__, strerror(errno));
-               close(fd);
-               return err;
-       }
-#endif
-       strcpy(dev, ifr.ifr_name);
-       mpsslog("Created TAP %s\n", dev);
-done:
-       return fd;
-}
-
-#define NET_FD_VIRTIO_NET 0
-#define NET_FD_TUN 1
-#define MAX_NET_FD 2
-
-static void set_dp(struct mic_info *mic, int type, void *dp)
-{
-       switch (type) {
-       case VIRTIO_ID_CONSOLE:
-               mic->mic_console.console_dp = dp;
-               return;
-       case VIRTIO_ID_NET:
-               mic->mic_net.net_dp = dp;
-               return;
-       case VIRTIO_ID_BLOCK:
-               mic->mic_virtblk.block_dp = dp;
-               return;
-       }
-       mpsslog("%s %s %d not found\n", mic->name, __func__, type);
-       assert(0);
-}
-
-static void *get_dp(struct mic_info *mic, int type)
-{
-       switch (type) {
-       case VIRTIO_ID_CONSOLE:
-               return mic->mic_console.console_dp;
-       case VIRTIO_ID_NET:
-               return mic->mic_net.net_dp;
-       case VIRTIO_ID_BLOCK:
-               return mic->mic_virtblk.block_dp;
-       }
-       mpsslog("%s %s %d not found\n", mic->name, __func__, type);
-       assert(0);
-       return NULL;
-}
-
-static struct mic_device_desc *get_device_desc(struct mic_info *mic, int type)
-{
-       struct mic_device_desc *d;
-       int i;
-       void *dp = get_dp(mic, type);
-
-       for (i = sizeof(struct mic_bootparam); i < PAGE_SIZE;
-               i += mic_total_desc_size(d)) {
-               d = dp + i;
-
-               /* End of list */
-               if (d->type == 0)
-                       break;
-
-               if (d->type == -1)
-                       continue;
-
-               mpsslog("%s %s d-> type %d d %p\n",
-                       mic->name, __func__, d->type, d);
-
-               if (d->type == (__u8)type)
-                       return d;
-       }
-       mpsslog("%s %s %d not found\n", mic->name, __func__, type);
-       return NULL;
-}
-
-/* See comments in vhost.c for explanation of next_desc() */
-static unsigned next_desc(struct vring_desc *desc)
-{
-       unsigned int next;
-
-       if (!(le16toh(desc->flags) & VRING_DESC_F_NEXT))
-               return -1U;
-       next = le16toh(desc->next);
-       return next;
-}
-
-/* Sum up all the IOVEC length */
-static ssize_t
-sum_iovec_len(struct mic_copy_desc *copy)
-{
-       ssize_t sum = 0;
-       unsigned int i;
-
-       for (i = 0; i < copy->iovcnt; i++)
-               sum += copy->iov[i].iov_len;
-       return sum;
-}
-
-static inline void verify_out_len(struct mic_info *mic,
-       struct mic_copy_desc *copy)
-{
-       if (copy->out_len != sum_iovec_len(copy)) {
-               mpsslog("%s %s %d BUG copy->out_len 0x%x len 0x%zx\n",
-                       mic->name, __func__, __LINE__,
-                       copy->out_len, sum_iovec_len(copy));
-               assert(copy->out_len == sum_iovec_len(copy));
-       }
-}
-
-/* Display an iovec */
-static void
-disp_iovec(struct mic_info *mic, struct mic_copy_desc *copy,
-          const char *s, int line)
-{
-       unsigned int i;
-
-       for (i = 0; i < copy->iovcnt; i++)
-               mpsslog("%s %s %d copy->iov[%d] addr %p len 0x%zx\n",
-                       mic->name, s, line, i,
-                       copy->iov[i].iov_base, copy->iov[i].iov_len);
-}
-
-static inline __u16 read_avail_idx(struct mic_vring *vr)
-{
-       return READ_ONCE(vr->info->avail_idx);
-}
-
-static inline void txrx_prepare(int type, bool tx, struct mic_vring *vr,
-                               struct mic_copy_desc *copy, ssize_t len)
-{
-       copy->vr_idx = tx ? 0 : 1;
-       copy->update_used = true;
-       if (type == VIRTIO_ID_NET)
-               copy->iov[1].iov_len = len - sizeof(struct virtio_net_hdr);
-       else
-               copy->iov[0].iov_len = len;
-}
-
-/* Central API which triggers the copies */
-static int
-mic_virtio_copy(struct mic_info *mic, int fd,
-               struct mic_vring *vr, struct mic_copy_desc *copy)
-{
-       int ret;
-
-       ret = ioctl(fd, MIC_VIRTIO_COPY_DESC, copy);
-       if (ret) {
-               mpsslog("%s %s %d errno %s ret %d\n",
-                       mic->name, __func__, __LINE__,
-                       strerror(errno), ret);
-       }
-       return ret;
-}
-
-static inline unsigned _vring_size(unsigned int num, unsigned long align)
-{
-       return _ALIGN_UP(((sizeof(struct vring_desc) * num + sizeof(__u16) * (3 + num)
-                               + align - 1) & ~(align - 1))
-               + sizeof(__u16) * 3 + sizeof(struct vring_used_elem) * num, 4);
-}
-
-/*
- * This initialization routine requires at least one
- * vring i.e. vr0. vr1 is optional.
- */
-static void *
-init_vr(struct mic_info *mic, int fd, int type,
-       struct mic_vring *vr0, struct mic_vring *vr1, int num_vq)
-{
-       int vr_size;
-       char *va;
-
-       vr_size = PAGE_ALIGN(_vring_size(MIC_VRING_ENTRIES,
-                                        MIC_VIRTIO_RING_ALIGN) +
-                            sizeof(struct _mic_vring_info));
-       va = mmap(NULL, MIC_DEVICE_PAGE_END + vr_size * num_vq,
-               PROT_READ, MAP_SHARED, fd, 0);
-       if (MAP_FAILED == va) {
-               mpsslog("%s %s %d mmap failed errno %s\n",
-                       mic->name, __func__, __LINE__,
-                       strerror(errno));
-               goto done;
-       }
-       set_dp(mic, type, va);
-       vr0->va = (struct mic_vring *)&va[MIC_DEVICE_PAGE_END];
-       vr0->info = vr0->va +
-               _vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN);
-       vring_init(&vr0->vr,
-                  MIC_VRING_ENTRIES, vr0->va, MIC_VIRTIO_RING_ALIGN);
-       mpsslog("%s %s vr0 %p vr0->info %p vr_size 0x%x vring 0x%x ",
-               __func__, mic->name, vr0->va, vr0->info, vr_size,
-               _vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN));
-       mpsslog("magic 0x%x expected 0x%x\n",
-               le32toh(vr0->info->magic), MIC_MAGIC + type);
-       assert(le32toh(vr0->info->magic) == MIC_MAGIC + type);
-       if (vr1) {
-               vr1->va = (struct mic_vring *)
-                       &va[MIC_DEVICE_PAGE_END + vr_size];
-               vr1->info = vr1->va + _vring_size(MIC_VRING_ENTRIES,
-                       MIC_VIRTIO_RING_ALIGN);
-               vring_init(&vr1->vr,
-                          MIC_VRING_ENTRIES, vr1->va, MIC_VIRTIO_RING_ALIGN);
-               mpsslog("%s %s vr1 %p vr1->info %p vr_size 0x%x vring 0x%x ",
-                       __func__, mic->name, vr1->va, vr1->info, vr_size,
-                       _vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN));
-               mpsslog("magic 0x%x expected 0x%x\n",
-                       le32toh(vr1->info->magic), MIC_MAGIC + type + 1);
-               assert(le32toh(vr1->info->magic) == MIC_MAGIC + type + 1);
-       }
-done:
-       return va;
-}
-
-static int
-wait_for_card_driver(struct mic_info *mic, int fd, int type)
-{
-       struct pollfd pollfd;
-       int err;
-       struct mic_device_desc *desc = get_device_desc(mic, type);
-       __u8 prev_status;
-
-       if (!desc)
-               return -ENODEV;
-       prev_status = desc->status;
-       pollfd.fd = fd;
-       mpsslog("%s %s Waiting .... desc-> type %d status 0x%x\n",
-               mic->name, __func__, type, desc->status);
-
-       while (1) {
-               pollfd.events = POLLIN;
-               pollfd.revents = 0;
-               err = poll(&pollfd, 1, -1);
-               if (err < 0) {
-                       mpsslog("%s %s poll failed %s\n",
-                               mic->name, __func__, strerror(errno));
-                       continue;
-               }
-
-               if (pollfd.revents) {
-                       if (desc->status != prev_status) {
-                               mpsslog("%s %s Waiting... desc-> type %d "
-                                       "status 0x%x\n",
-                                       mic->name, __func__, type,
-                                       desc->status);
-                               prev_status = desc->status;
-                       }
-                       if (desc->status & VIRTIO_CONFIG_S_DRIVER_OK) {
-                               mpsslog("%s %s poll.revents %d\n",
-                                       mic->name, __func__, pollfd.revents);
-                               mpsslog("%s %s desc-> type %d status 0x%x\n",
-                                       mic->name, __func__, type,
-                                       desc->status);
-                               break;
-                       }
-               }
-       }
-       return 0;
-}
-
-/* Spin till we have some descriptors */
-static void
-spin_for_descriptors(struct mic_info *mic, struct mic_vring *vr)
-{
-       __u16 avail_idx = read_avail_idx(vr);
-
-       while (avail_idx == le16toh(READ_ONCE(vr->vr.avail->idx))) {
-#ifdef DEBUG
-               mpsslog("%s %s waiting for desc avail %d info_avail %d\n",
-                       mic->name, __func__,
-                       le16toh(vr->vr.avail->idx), vr->info->avail_idx);
-#endif
-               sched_yield();
-       }
-}
-
-static void *
-virtio_net(void *arg)
-{
-       static __u8 vnet_hdr[2][sizeof(struct virtio_net_hdr)];
-       static __u8 vnet_buf[2][MAX_NET_PKT_SIZE] __attribute__ ((aligned(64)));
-       struct iovec vnet_iov[2][2] = {
-               { { .iov_base = vnet_hdr[0], .iov_len = sizeof(vnet_hdr[0]) },
-                 { .iov_base = vnet_buf[0], .iov_len = sizeof(vnet_buf[0]) } },
-               { { .iov_base = vnet_hdr[1], .iov_len = sizeof(vnet_hdr[1]) },
-                 { .iov_base = vnet_buf[1], .iov_len = sizeof(vnet_buf[1]) } },
-       };
-       struct iovec *iov0 = vnet_iov[0], *iov1 = vnet_iov[1];
-       struct mic_info *mic = (struct mic_info *)arg;
-       char if_name[IFNAMSIZ];
-       struct pollfd net_poll[MAX_NET_FD];
-       struct mic_vring tx_vr, rx_vr;
-       struct mic_copy_desc copy;
-       struct mic_device_desc *desc;
-       int err;
-
-       snprintf(if_name, IFNAMSIZ, "mic%d", mic->id);
-       mic->mic_net.tap_fd = tun_alloc(mic, if_name);
-       if (mic->mic_net.tap_fd < 0)
-               goto done;
-
-       if (tap_configure(mic, if_name))
-               goto done;
-       mpsslog("MIC name %s id %d\n", mic->name, mic->id);
-
-       net_poll[NET_FD_VIRTIO_NET].fd = mic->mic_net.virtio_net_fd;
-       net_poll[NET_FD_VIRTIO_NET].events = POLLIN;
-       net_poll[NET_FD_TUN].fd = mic->mic_net.tap_fd;
-       net_poll[NET_FD_TUN].events = POLLIN;
-
-       if (MAP_FAILED == init_vr(mic, mic->mic_net.virtio_net_fd,
-                                 VIRTIO_ID_NET, &tx_vr, &rx_vr,
-               virtnet_dev_page.dd.num_vq)) {
-               mpsslog("%s init_vr failed %s\n",
-                       mic->name, strerror(errno));
-               goto done;
-       }
-
-       copy.iovcnt = 2;
-       desc = get_device_desc(mic, VIRTIO_ID_NET);
-
-       while (1) {
-               ssize_t len;
-
-               net_poll[NET_FD_VIRTIO_NET].revents = 0;
-               net_poll[NET_FD_TUN].revents = 0;
-
-               /* Start polling for data from tap and virtio net */
-               err = poll(net_poll, 2, -1);
-               if (err < 0) {
-                       mpsslog("%s poll failed %s\n",
-                               __func__, strerror(errno));
-                       continue;
-               }
-               if (!(desc->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
-                       err = wait_for_card_driver(mic,
-                                                  mic->mic_net.virtio_net_fd,
-                                                  VIRTIO_ID_NET);
-                       if (err) {
-                               mpsslog("%s %s %d Exiting...\n",
-                                       mic->name, __func__, __LINE__);
-                               break;
-                       }
-               }
-               /*
-                * Check if there is data to be read from TUN and write to
-                * virtio net fd if there is.
-                */
-               if (net_poll[NET_FD_TUN].revents & POLLIN) {
-                       copy.iov = iov0;
-                       len = readv(net_poll[NET_FD_TUN].fd,
-                               copy.iov, copy.iovcnt);
-                       if (len > 0) {
-                               struct virtio_net_hdr *hdr
-                                       = (struct virtio_net_hdr *)vnet_hdr[0];
-
-                               /* Disable checksums on the card since we are on
-                                  a reliable PCIe link */
-                               hdr->flags |= VIRTIO_NET_HDR_F_DATA_VALID;
-#ifdef DEBUG
-                               mpsslog("%s %s %d hdr->flags 0x%x ", mic->name,
-                                       __func__, __LINE__, hdr->flags);
-                               mpsslog("copy.out_len %d hdr->gso_type 0x%x\n",
-                                       copy.out_len, hdr->gso_type);
-#endif
-#ifdef DEBUG
-                               disp_iovec(mic, &copy, __func__, __LINE__);
-                               mpsslog("%s %s %d read from tap 0x%lx\n",
-                                       mic->name, __func__, __LINE__,
-                                       len);
-#endif
-                               spin_for_descriptors(mic, &tx_vr);
-                               txrx_prepare(VIRTIO_ID_NET, 1, &tx_vr, &copy,
-                                            len);
-
-                               err = mic_virtio_copy(mic,
-                                       mic->mic_net.virtio_net_fd, &tx_vr,
-                                       &copy);
-                               if (err < 0) {
-                                       mpsslog("%s %s %d mic_virtio_copy %s\n",
-                                               mic->name, __func__, __LINE__,
-                                               strerror(errno));
-                               }
-                               if (!err)
-                                       verify_out_len(mic, &copy);
-#ifdef DEBUG
-                               disp_iovec(mic, &copy, __func__, __LINE__);
-                               mpsslog("%s %s %d wrote to net 0x%lx\n",
-                                       mic->name, __func__, __LINE__,
-                                       sum_iovec_len(&copy));
-#endif
-                               /* Reinitialize IOV for next run */
-                               iov0[1].iov_len = MAX_NET_PKT_SIZE;
-                       } else if (len < 0) {
-                               disp_iovec(mic, &copy, __func__, __LINE__);
-                               mpsslog("%s %s %d read failed %s ", mic->name,
-                                       __func__, __LINE__, strerror(errno));
-                               mpsslog("cnt %d sum %zd\n",
-                                       copy.iovcnt, sum_iovec_len(&copy));
-                       }
-               }
-
-               /*
-                * Check if there is data to be read from virtio net and
-                * write to TUN if there is.
-                */
-               if (net_poll[NET_FD_VIRTIO_NET].revents & POLLIN) {
-                       while (rx_vr.info->avail_idx !=
-                               le16toh(rx_vr.vr.avail->idx)) {
-                               copy.iov = iov1;
-                               txrx_prepare(VIRTIO_ID_NET, 0, &rx_vr, &copy,
-                                            MAX_NET_PKT_SIZE
-                                       + sizeof(struct virtio_net_hdr));
-
-                               err = mic_virtio_copy(mic,
-                                       mic->mic_net.virtio_net_fd, &rx_vr,
-                                       &copy);
-                               if (!err) {
-#ifdef DEBUG
-                                       struct virtio_net_hdr *hdr
-                                               = (struct virtio_net_hdr *)
-                                                       vnet_hdr[1];
-
-                                       mpsslog("%s %s %d hdr->flags 0x%x, ",
-                                               mic->name, __func__, __LINE__,
-                                               hdr->flags);
-                                       mpsslog("out_len %d gso_type 0x%x\n",
-                                               copy.out_len,
-                                               hdr->gso_type);
-#endif
-                                       /* Set the correct output iov_len */
-                                       iov1[1].iov_len = copy.out_len -
-                                               sizeof(struct virtio_net_hdr);
-                                       verify_out_len(mic, &copy);
-#ifdef DEBUG
-                                       disp_iovec(mic, &copy, __func__,
-                                                  __LINE__);
-                                       mpsslog("%s %s %d ",
-                                               mic->name, __func__, __LINE__);
-                                       mpsslog("read from net 0x%lx\n",
-                                               sum_iovec_len(&copy));
-#endif
-                                       len = writev(net_poll[NET_FD_TUN].fd,
-                                               copy.iov, copy.iovcnt);
-                                       if (len != sum_iovec_len(&copy)) {
-                                               mpsslog("Tun write failed %s ",
-                                                       strerror(errno));
-                                               mpsslog("len 0x%zx ", len);
-                                               mpsslog("read_len 0x%zx\n",
-                                                       sum_iovec_len(&copy));
-                                       } else {
-#ifdef DEBUG
-                                               disp_iovec(mic, &copy, __func__,
-                                                          __LINE__);
-                                               mpsslog("%s %s %d ",
-                                                       mic->name, __func__,
-                                                       __LINE__);
-                                               mpsslog("wrote to tap 0x%lx\n",
-                                                       len);
-#endif
-                                       }
-                               } else {
-                                       mpsslog("%s %s %d mic_virtio_copy %s\n",
-                                               mic->name, __func__, __LINE__,
-                                               strerror(errno));
-                                       break;
-                               }
-                       }
-               }
-               if (net_poll[NET_FD_VIRTIO_NET].revents & POLLERR)
-                       mpsslog("%s: %s: POLLERR\n", __func__, mic->name);
-       }
-done:
-       pthread_exit(NULL);
-}
-
-/* virtio_console */
-#define VIRTIO_CONSOLE_FD 0
-#define MONITOR_FD (VIRTIO_CONSOLE_FD + 1)
-#define MAX_CONSOLE_FD (MONITOR_FD + 1)  /* must be the last one + 1 */
-#define MAX_BUFFER_SIZE PAGE_SIZE
-
-static void *
-virtio_console(void *arg)
-{
-       static __u8 vcons_buf[2][PAGE_SIZE];
-       struct iovec vcons_iov[2] = {
-               { .iov_base = vcons_buf[0], .iov_len = sizeof(vcons_buf[0]) },
-               { .iov_base = vcons_buf[1], .iov_len = sizeof(vcons_buf[1]) },
-       };
-       struct iovec *iov0 = &vcons_iov[0], *iov1 = &vcons_iov[1];
-       struct mic_info *mic = (struct mic_info *)arg;
-       int err;
-       struct pollfd console_poll[MAX_CONSOLE_FD];
-       int pty_fd;
-       char *pts_name;
-       ssize_t len;
-       struct mic_vring tx_vr, rx_vr;
-       struct mic_copy_desc copy;
-       struct mic_device_desc *desc;
-
-       pty_fd = posix_openpt(O_RDWR);
-       if (pty_fd < 0) {
-               mpsslog("can't open a pseudoterminal master device: %s\n",
-                       strerror(errno));
-               goto _return;
-       }
-       pts_name = ptsname(pty_fd);
-       if (pts_name == NULL) {
-               mpsslog("can't get pts name\n");
-               goto _close_pty;
-       }
-       printf("%s console message goes to %s\n", mic->name, pts_name);
-       mpsslog("%s console message goes to %s\n", mic->name, pts_name);
-       err = grantpt(pty_fd);
-       if (err < 0) {
-               mpsslog("can't grant access: %s %s\n",
-                       pts_name, strerror(errno));
-               goto _close_pty;
-       }
-       err = unlockpt(pty_fd);
-       if (err < 0) {
-               mpsslog("can't unlock a pseudoterminal: %s %s\n",
-                       pts_name, strerror(errno));
-               goto _close_pty;
-       }
-       console_poll[MONITOR_FD].fd = pty_fd;
-       console_poll[MONITOR_FD].events = POLLIN;
-
-       console_poll[VIRTIO_CONSOLE_FD].fd = mic->mic_console.virtio_console_fd;
-       console_poll[VIRTIO_CONSOLE_FD].events = POLLIN;
-
-       if (MAP_FAILED == init_vr(mic, mic->mic_console.virtio_console_fd,
-                                 VIRTIO_ID_CONSOLE, &tx_vr, &rx_vr,
-               virtcons_dev_page.dd.num_vq)) {
-               mpsslog("%s init_vr failed %s\n",
-                       mic->name, strerror(errno));
-               goto _close_pty;
-       }
-
-       copy.iovcnt = 1;
-       desc = get_device_desc(mic, VIRTIO_ID_CONSOLE);
-
-       for (;;) {
-               console_poll[MONITOR_FD].revents = 0;
-               console_poll[VIRTIO_CONSOLE_FD].revents = 0;
-               err = poll(console_poll, MAX_CONSOLE_FD, -1);
-               if (err < 0) {
-                       mpsslog("%s %d: poll failed: %s\n", __func__, __LINE__,
-                               strerror(errno));
-                       continue;
-               }
-               if (!(desc->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
-                       err = wait_for_card_driver(mic,
-                                       mic->mic_console.virtio_console_fd,
-                                       VIRTIO_ID_CONSOLE);
-                       if (err) {
-                               mpsslog("%s %s %d Exiting...\n",
-                                       mic->name, __func__, __LINE__);
-                               break;
-                       }
-               }
-
-               if (console_poll[MONITOR_FD].revents & POLLIN) {
-                       copy.iov = iov0;
-                       len = readv(pty_fd, copy.iov, copy.iovcnt);
-                       if (len > 0) {
-#ifdef DEBUG
-                               disp_iovec(mic, &copy, __func__, __LINE__);
-                               mpsslog("%s %s %d read from tap 0x%lx\n",
-                                       mic->name, __func__, __LINE__,
-                                       len);
-#endif
-                               spin_for_descriptors(mic, &tx_vr);
-                               txrx_prepare(VIRTIO_ID_CONSOLE, 1, &tx_vr,
-                                            &copy, len);
-
-                               err = mic_virtio_copy(mic,
-                                       mic->mic_console.virtio_console_fd,
-                                       &tx_vr, &copy);
-                               if (err < 0) {
-                                       mpsslog("%s %s %d mic_virtio_copy %s\n",
-                                               mic->name, __func__, __LINE__,
-                                               strerror(errno));
-                               }
-                               if (!err)
-                                       verify_out_len(mic, &copy);
-#ifdef DEBUG
-                               disp_iovec(mic, &copy, __func__, __LINE__);
-                               mpsslog("%s %s %d wrote to net 0x%lx\n",
-                                       mic->name, __func__, __LINE__,
-                                       sum_iovec_len(&copy));
-#endif
-                               /* Reinitialize IOV for next run */
-                               iov0->iov_len = PAGE_SIZE;
-                       } else if (len < 0) {
-                               disp_iovec(mic, &copy, __func__, __LINE__);
-                               mpsslog("%s %s %d read failed %s ",
-                                       mic->name, __func__, __LINE__,
-                                       strerror(errno));
-                               mpsslog("cnt %d sum %zd\n",
-                                       copy.iovcnt, sum_iovec_len(&copy));
-                       }
-               }
-
-               if (console_poll[VIRTIO_CONSOLE_FD].revents & POLLIN) {
-                       while (rx_vr.info->avail_idx !=
-                               le16toh(rx_vr.vr.avail->idx)) {
-                               copy.iov = iov1;
-                               txrx_prepare(VIRTIO_ID_CONSOLE, 0, &rx_vr,
-                                            &copy, PAGE_SIZE);
-
-                               err = mic_virtio_copy(mic,
-                                       mic->mic_console.virtio_console_fd,
-                                       &rx_vr, &copy);
-                               if (!err) {
-                                       /* Set the correct output iov_len */
-                                       iov1->iov_len = copy.out_len;
-                                       verify_out_len(mic, &copy);
-#ifdef DEBUG
-                                       disp_iovec(mic, &copy, __func__,
-                                                  __LINE__);
-                                       mpsslog("%s %s %d ",
-                                               mic->name, __func__, __LINE__);
-                                       mpsslog("read from net 0x%lx\n",
-                                               sum_iovec_len(&copy));
-#endif
-                                       len = writev(pty_fd,
-                                               copy.iov, copy.iovcnt);
-                                       if (len != sum_iovec_len(&copy)) {
-                                               mpsslog("Tun write failed %s ",
-                                                       strerror(errno));
-                                               mpsslog("len 0x%zx ", len);
-                                               mpsslog("read_len 0x%zx\n",
-                                                       sum_iovec_len(&copy));
-                                       } else {
-#ifdef DEBUG
-                                               disp_iovec(mic, &copy, __func__,
-                                                          __LINE__);
-                                               mpsslog("%s %s %d ",
-                                                       mic->name, __func__,
-                                                       __LINE__);
-                                               mpsslog("wrote to tap 0x%lx\n",
-                                                       len);
-#endif
-                                       }
-                               } else {
-                                       mpsslog("%s %s %d mic_virtio_copy %s\n",
-                                               mic->name, __func__, __LINE__,
-                                               strerror(errno));
-                                       break;
-                               }
-                       }
-               }
-               if (console_poll[NET_FD_VIRTIO_NET].revents & POLLERR)
-                       mpsslog("%s: %s: POLLERR\n", __func__, mic->name);
-       }
-_close_pty:
-       close(pty_fd);
-_return:
-       pthread_exit(NULL);
-}
-
-static void
-add_virtio_device(struct mic_info *mic, struct mic_device_desc *dd)
-{
-       char path[PATH_MAX];
-       int fd, err;
-
-       snprintf(path, PATH_MAX, "/dev/vop_virtio%d", mic->id);
-       fd = open(path, O_RDWR);
-       if (fd < 0) {
-               mpsslog("Could not open %s %s\n", path, strerror(errno));
-               return;
-       }
-
-       err = ioctl(fd, MIC_VIRTIO_ADD_DEVICE, dd);
-       if (err < 0) {
-               mpsslog("Could not add %d %s\n", dd->type, strerror(errno));
-               close(fd);
-               return;
-       }
-       switch (dd->type) {
-       case VIRTIO_ID_NET:
-               mic->mic_net.virtio_net_fd = fd;
-               mpsslog("Added VIRTIO_ID_NET for %s\n", mic->name);
-               break;
-       case VIRTIO_ID_CONSOLE:
-               mic->mic_console.virtio_console_fd = fd;
-               mpsslog("Added VIRTIO_ID_CONSOLE for %s\n", mic->name);
-               break;
-       case VIRTIO_ID_BLOCK:
-               mic->mic_virtblk.virtio_block_fd = fd;
-               mpsslog("Added VIRTIO_ID_BLOCK for %s\n", mic->name);
-               break;
-       }
-}
-
-static bool
-set_backend_file(struct mic_info *mic)
-{
-       FILE *config;
-       char buff[PATH_MAX], *line, *evv, *p;
-
-       snprintf(buff, PATH_MAX, "%s/mpssd%03d.conf", mic_config_dir, mic->id);
-       config = fopen(buff, "r");
-       if (config == NULL)
-               return false;
-       do {  /* look for "virtblk_backend=XXXX" */
-               line = fgets(buff, PATH_MAX, config);
-               if (line == NULL)
-                       break;
-               if (*line == '#')
-                       continue;
-               p = strchr(line, '\n');
-               if (p)
-                       *p = '\0';
-       } while (strncmp(line, virtblk_backend, strlen(virtblk_backend)) != 0);
-       fclose(config);
-       if (line == NULL)
-               return false;
-       evv = strchr(line, '=');
-       if (evv == NULL)
-               return false;
-       mic->mic_virtblk.backend_file = malloc(strlen(evv) + 1);
-       if (mic->mic_virtblk.backend_file == NULL) {
-               mpsslog("%s %d can't allocate memory\n", mic->name, mic->id);
-               return false;
-       }
-       strcpy(mic->mic_virtblk.backend_file, evv + 1);
-       return true;
-}
-
-#define SECTOR_SIZE 512
-static bool
-set_backend_size(struct mic_info *mic)
-{
-       mic->mic_virtblk.backend_size = lseek(mic->mic_virtblk.backend, 0,
-               SEEK_END);
-       if (mic->mic_virtblk.backend_size < 0) {
-               mpsslog("%s: can't seek: %s\n",
-                       mic->name, mic->mic_virtblk.backend_file);
-               return false;
-       }
-       virtblk_dev_page.blk_config.capacity =
-               mic->mic_virtblk.backend_size / SECTOR_SIZE;
-       if ((mic->mic_virtblk.backend_size % SECTOR_SIZE) != 0)
-               virtblk_dev_page.blk_config.capacity++;
-
-       virtblk_dev_page.blk_config.capacity =
-               htole64(virtblk_dev_page.blk_config.capacity);
-
-       return true;
-}
-
-static bool
-open_backend(struct mic_info *mic)
-{
-       if (!set_backend_file(mic))
-               goto _error_exit;
-       mic->mic_virtblk.backend = open(mic->mic_virtblk.backend_file, O_RDWR);
-       if (mic->mic_virtblk.backend < 0) {
-               mpsslog("%s: can't open: %s\n", mic->name,
-                       mic->mic_virtblk.backend_file);
-               goto _error_free;
-       }
-       if (!set_backend_size(mic))
-               goto _error_close;
-       mic->mic_virtblk.backend_addr = mmap(NULL,
-               mic->mic_virtblk.backend_size,
-               PROT_READ|PROT_WRITE, MAP_SHARED,
-               mic->mic_virtblk.backend, 0L);
-       if (mic->mic_virtblk.backend_addr == MAP_FAILED) {
-               mpsslog("%s: can't map: %s %s\n",
-                       mic->name, mic->mic_virtblk.backend_file,
-                       strerror(errno));
-               goto _error_close;
-       }
-       return true;
-
- _error_close:
-       close(mic->mic_virtblk.backend);
- _error_free:
-       free(mic->mic_virtblk.backend_file);
- _error_exit:
-       return false;
-}
-
-static void
-close_backend(struct mic_info *mic)
-{
-       munmap(mic->mic_virtblk.backend_addr, mic->mic_virtblk.backend_size);
-       close(mic->mic_virtblk.backend);
-       free(mic->mic_virtblk.backend_file);
-}
-
-static bool
-start_virtblk(struct mic_info *mic, struct mic_vring *vring)
-{
-       if (((unsigned long)&virtblk_dev_page.blk_config % 8) != 0) {
-               mpsslog("%s: blk_config is not 8 byte aligned.\n",
-                       mic->name);
-               return false;
-       }
-       add_virtio_device(mic, &virtblk_dev_page.dd);
-       if (MAP_FAILED == init_vr(mic, mic->mic_virtblk.virtio_block_fd,
-                                 VIRTIO_ID_BLOCK, vring, NULL,
-                                 virtblk_dev_page.dd.num_vq)) {
-               mpsslog("%s init_vr failed %s\n",
-                       mic->name, strerror(errno));
-               return false;
-       }
-       return true;
-}
-
-static void
-stop_virtblk(struct mic_info *mic)
-{
-       int vr_size, ret;
-
-       vr_size = PAGE_ALIGN(_vring_size(MIC_VRING_ENTRIES,
-                                        MIC_VIRTIO_RING_ALIGN) +
-                            sizeof(struct _mic_vring_info));
-       ret = munmap(mic->mic_virtblk.block_dp,
-               MIC_DEVICE_PAGE_END + vr_size * virtblk_dev_page.dd.num_vq);
-       if (ret < 0)
-               mpsslog("%s munmap errno %d\n", mic->name, errno);
-       close(mic->mic_virtblk.virtio_block_fd);
-}
-
-static __u8
-header_error_check(struct vring_desc *desc)
-{
-       if (le32toh(desc->len) != sizeof(struct virtio_blk_outhdr)) {
-               mpsslog("%s() %d: length is not sizeof(virtio_blk_outhd)\n",
-                       __func__, __LINE__);
-               return -EIO;
-       }
-       if (!(le16toh(desc->flags) & VRING_DESC_F_NEXT)) {
-               mpsslog("%s() %d: alone\n",
-                       __func__, __LINE__);
-               return -EIO;
-       }
-       if (le16toh(desc->flags) & VRING_DESC_F_WRITE) {
-               mpsslog("%s() %d: not read\n",
-                       __func__, __LINE__);
-               return -EIO;
-       }
-       return 0;
-}
-
-static int
-read_header(int fd, struct virtio_blk_outhdr *hdr, __u32 desc_idx)
-{
-       struct iovec iovec;
-       struct mic_copy_desc copy;
-
-       iovec.iov_len = sizeof(*hdr);
-       iovec.iov_base = hdr;
-       copy.iov = &iovec;
-       copy.iovcnt = 1;
-       copy.vr_idx = 0;  /* only one vring on virtio_block */
-       copy.update_used = false;  /* do not update used index */
-       return ioctl(fd, MIC_VIRTIO_COPY_DESC, &copy);
-}
-
-static int
-transfer_blocks(int fd, struct iovec *iovec, __u32 iovcnt)
-{
-       struct mic_copy_desc copy;
-
-       copy.iov = iovec;
-       copy.iovcnt = iovcnt;
-       copy.vr_idx = 0;  /* only one vring on virtio_block */
-       copy.update_used = false;  /* do not update used index */
-       return ioctl(fd, MIC_VIRTIO_COPY_DESC, &copy);
-}
-
-static __u8
-status_error_check(struct vring_desc *desc)
-{
-       if (le32toh(desc->len) != sizeof(__u8)) {
-               mpsslog("%s() %d: length is not sizeof(status)\n",
-                       __func__, __LINE__);
-               return -EIO;
-       }
-       return 0;
-}
-
-static int
-write_status(int fd, __u8 *status)
-{
-       struct iovec iovec;
-       struct mic_copy_desc copy;
-
-       iovec.iov_base = status;
-       iovec.iov_len = sizeof(*status);
-       copy.iov = &iovec;
-       copy.iovcnt = 1;
-       copy.vr_idx = 0;  /* only one vring on virtio_block */
-       copy.update_used = true; /* Update used index */
-       return ioctl(fd, MIC_VIRTIO_COPY_DESC, &copy);
-}
-
-#ifndef VIRTIO_BLK_T_GET_ID
-#define VIRTIO_BLK_T_GET_ID    8
-#endif
-
-static void *
-virtio_block(void *arg)
-{
-       struct mic_info *mic = (struct mic_info *)arg;
-       int ret;
-       struct pollfd block_poll;
-       struct mic_vring vring;
-       __u16 avail_idx;
-       __u32 desc_idx;
-       struct vring_desc *desc;
-       struct iovec *iovec, *piov;
-       __u8 status;
-       __u32 buffer_desc_idx;
-       struct virtio_blk_outhdr hdr;
-       void *fos;
-
-       for (;;) {  /* forever */
-               if (!open_backend(mic)) { /* No virtblk */
-                       for (mic->mic_virtblk.signaled = 0;
-                               !mic->mic_virtblk.signaled;)
-                               sleep(1);
-                       continue;
-               }
-
-               /* backend file is specified. */
-               if (!start_virtblk(mic, &vring))
-                       goto _close_backend;
-               iovec = malloc(sizeof(*iovec) *
-                       le32toh(virtblk_dev_page.blk_config.seg_max));
-               if (!iovec) {
-                       mpsslog("%s: can't alloc iovec: %s\n",
-                               mic->name, strerror(ENOMEM));
-                       goto _stop_virtblk;
-               }
-
-               block_poll.fd = mic->mic_virtblk.virtio_block_fd;
-               block_poll.events = POLLIN;
-               for (mic->mic_virtblk.signaled = 0;
-                    !mic->mic_virtblk.signaled;) {
-                       block_poll.revents = 0;
-                                       /* timeout in 1 sec to see signaled */
-                       ret = poll(&block_poll, 1, 1000);
-                       if (ret < 0) {
-                               mpsslog("%s %d: poll failed: %s\n",
-                                       __func__, __LINE__,
-                                       strerror(errno));
-                               continue;
-                       }
-
-                       if (!(block_poll.revents & POLLIN)) {
-#ifdef DEBUG
-                               mpsslog("%s %d: block_poll.revents=0x%x\n",
-                                       __func__, __LINE__, block_poll.revents);
-#endif
-                               continue;
-                       }
-
-                       /* POLLIN */
-                       while (vring.info->avail_idx !=
-                               le16toh(vring.vr.avail->idx)) {
-                               /* read header element */
-                               avail_idx =
-                                       vring.info->avail_idx &
-                                       (vring.vr.num - 1);
-                               desc_idx = le16toh(
-                                       vring.vr.avail->ring[avail_idx]);
-                               desc = &vring.vr.desc[desc_idx];
-#ifdef DEBUG
-                               mpsslog("%s() %d: avail_idx=%d ",
-                                       __func__, __LINE__,
-                                       vring.info->avail_idx);
-                               mpsslog("vring.vr.num=%d desc=%p\n",
-                                       vring.vr.num, desc);
-#endif
-                               status = header_error_check(desc);
-                               ret = read_header(
-                                       mic->mic_virtblk.virtio_block_fd,
-                                       &hdr, desc_idx);
-                               if (ret < 0) {
-                                       mpsslog("%s() %d %s: ret=%d %s\n",
-                                               __func__, __LINE__,
-                                               mic->name, ret,
-                                               strerror(errno));
-                                       break;
-                               }
-                               /* buffer element */
-                               piov = iovec;
-                               status = 0;
-                               fos = mic->mic_virtblk.backend_addr +
-                                       (hdr.sector * SECTOR_SIZE);
-                               buffer_desc_idx = next_desc(desc);
-                               desc_idx = buffer_desc_idx;
-                               for (desc = &vring.vr.desc[buffer_desc_idx];
-                                    desc->flags & VRING_DESC_F_NEXT;
-                                    desc_idx = next_desc(desc),
-                                            desc = &vring.vr.desc[desc_idx]) {
-                                       piov->iov_len = desc->len;
-                                       piov->iov_base = fos;
-                                       piov++;
-                                       fos += desc->len;
-                               }
-                               /* Returning NULLs for VIRTIO_BLK_T_GET_ID. */
-                               if (hdr.type & ~(VIRTIO_BLK_T_OUT |
-                                       VIRTIO_BLK_T_GET_ID)) {
-                                       /*
-                                         VIRTIO_BLK_T_IN - does not do
-                                         anything. Probably for documenting.
-                                         VIRTIO_BLK_T_SCSI_CMD - for
-                                         virtio_scsi.
-                                         VIRTIO_BLK_T_FLUSH - turned off in
-                                         config space.
-                                         VIRTIO_BLK_T_BARRIER - defined but not
-                                         used in anywhere.
-                                       */
-                                       mpsslog("%s() %d: type %x ",
-                                               __func__, __LINE__,
-                                               hdr.type);
-                                       mpsslog("is not supported\n");
-                                       status = -ENOTSUP;
-
-                               } else {
-                                       ret = transfer_blocks(
-                                       mic->mic_virtblk.virtio_block_fd,
-                                               iovec,
-                                               piov - iovec);
-                                       if (ret < 0 &&
-                                           status != 0)
-                                               status = ret;
-                               }
-                               /* write status and update used pointer */
-                               if (status != 0)
-                                       status = status_error_check(desc);
-                               ret = write_status(
-                                       mic->mic_virtblk.virtio_block_fd,
-                                       &status);
-#ifdef DEBUG
-                               mpsslog("%s() %d: write status=%d on desc=%p\n",
-                                       __func__, __LINE__,
-                                       status, desc);
-#endif
-                       }
-               }
-               free(iovec);
-_stop_virtblk:
-               stop_virtblk(mic);
-_close_backend:
-               close_backend(mic);
-       }  /* forever */
-
-       pthread_exit(NULL);
-}
-
-static void
-reset(struct mic_info *mic)
-{
-#define RESET_TIMEOUT 120
-       int i = RESET_TIMEOUT;
-       setsysfs(mic->name, "state", "reset");
-       while (i) {
-               char *state;
-               state = readsysfs(mic->name, "state");
-               if (!state)
-                       goto retry;
-               mpsslog("%s: %s %d state %s\n",
-                       mic->name, __func__, __LINE__, state);
-
-               if (!strcmp(state, "ready")) {
-                       free(state);
-                       break;
-               }
-               free(state);
-retry:
-               sleep(1);
-               i--;
-       }
-}
-
-static int
-get_mic_shutdown_status(struct mic_info *mic, char *shutdown_status)
-{
-       if (!strcmp(shutdown_status, "nop"))
-               return MIC_NOP;
-       if (!strcmp(shutdown_status, "crashed"))
-               return MIC_CRASHED;
-       if (!strcmp(shutdown_status, "halted"))
-               return MIC_HALTED;
-       if (!strcmp(shutdown_status, "poweroff"))
-               return MIC_POWER_OFF;
-       if (!strcmp(shutdown_status, "restart"))
-               return MIC_RESTART;
-       mpsslog("%s: BUG invalid status %s\n", mic->name, shutdown_status);
-       /* Invalid state */
-       assert(0);
-};
-
-static int get_mic_state(struct mic_info *mic)
-{
-       char *state = NULL;
-       enum mic_states mic_state;
-
-       while (!state) {
-               state = readsysfs(mic->name, "state");
-               sleep(1);
-       }
-       mpsslog("%s: %s %d state %s\n",
-               mic->name, __func__, __LINE__, state);
-
-       if (!strcmp(state, "ready")) {
-               mic_state = MIC_READY;
-       } else if (!strcmp(state, "booting")) {
-               mic_state = MIC_BOOTING;
-       } else if (!strcmp(state, "online")) {
-               mic_state = MIC_ONLINE;
-       } else if (!strcmp(state, "shutting_down")) {
-               mic_state = MIC_SHUTTING_DOWN;
-       } else if (!strcmp(state, "reset_failed")) {
-               mic_state = MIC_RESET_FAILED;
-       } else if (!strcmp(state, "resetting")) {
-               mic_state = MIC_RESETTING;
-       } else {
-               mpsslog("%s: BUG invalid state %s\n", mic->name, state);
-               assert(0);
-       }
-
-       free(state);
-       return mic_state;
-};
-
-static void mic_handle_shutdown(struct mic_info *mic)
-{
-#define SHUTDOWN_TIMEOUT 60
-       int i = SHUTDOWN_TIMEOUT;
-       char *shutdown_status;
-       while (i) {
-               shutdown_status = readsysfs(mic->name, "shutdown_status");
-               if (!shutdown_status) {
-                       sleep(1);
-                       continue;
-               }
-               mpsslog("%s: %s %d shutdown_status %s\n",
-                       mic->name, __func__, __LINE__, shutdown_status);
-               switch (get_mic_shutdown_status(mic, shutdown_status)) {
-               case MIC_RESTART:
-                       mic->restart = 1;
-               case MIC_HALTED:
-               case MIC_POWER_OFF:
-               case MIC_CRASHED:
-                       free(shutdown_status);
-                       goto reset;
-               default:
-                       break;
-               }
-               free(shutdown_status);
-               sleep(1);
-               i--;
-       }
-reset:
-       if (!i)
-               mpsslog("%s: %s %d timing out waiting for shutdown_status %s\n",
-                       mic->name, __func__, __LINE__, shutdown_status);
-       reset(mic);
-}
-
-static int open_state_fd(struct mic_info *mic)
-{
-       char pathname[PATH_MAX];
-       int fd;
-
-       snprintf(pathname, PATH_MAX - 1, "%s/%s/%s",
-                MICSYSFSDIR, mic->name, "state");
-
-       fd = open(pathname, O_RDONLY);
-       if (fd < 0)
-               mpsslog("%s: opening file %s failed %s\n",
-                       mic->name, pathname, strerror(errno));
-       return fd;
-}
-
-static int block_till_state_change(int fd, struct mic_info *mic)
-{
-       struct pollfd ufds[1];
-       char value[PAGE_SIZE];
-       int ret;
-
-       ufds[0].fd = fd;
-       ufds[0].events = POLLERR | POLLPRI;
-       ret = poll(ufds, 1, -1);
-       if (ret < 0) {
-               mpsslog("%s: %s %d poll failed %s\n",
-                       mic->name, __func__, __LINE__, strerror(errno));
-               return ret;
-       }
-
-       ret = lseek(fd, 0, SEEK_SET);
-       if (ret < 0) {
-               mpsslog("%s: %s %d Failed to seek to 0: %s\n",
-                       mic->name, __func__, __LINE__, strerror(errno));
-               return ret;
-       }
-
-       ret = read(fd, value, sizeof(value));
-       if (ret < 0) {
-               mpsslog("%s: %s %d Failed to read sysfs entry: %s\n",
-                       mic->name, __func__, __LINE__, strerror(errno));
-               return ret;
-       }
-
-       return 0;
-}
-
-static void *
-mic_config(void *arg)
-{
-       struct mic_info *mic = (struct mic_info *)arg;
-       int fd, ret, stat = 0;
-
-       fd = open_state_fd(mic);
-       if (fd < 0) {
-               mpsslog("%s: %s %d open state fd failed %s\n",
-                       mic->name, __func__, __LINE__, strerror(errno));
-               goto exit;
-       }
-
-       do {
-               ret = block_till_state_change(fd, mic);
-               if (ret < 0) {
-                       mpsslog("%s: %s %d block_till_state_change error %s\n",
-                               mic->name, __func__, __LINE__, strerror(errno));
-                       goto close_exit;
-               }
-
-               switch (get_mic_state(mic)) {
-               case MIC_SHUTTING_DOWN:
-                       mic_handle_shutdown(mic);
-                       break;
-               case MIC_READY:
-               case MIC_RESET_FAILED:
-                       ret = kill(mic->pid, SIGTERM);
-                       mpsslog("%s: %s %d kill pid %d ret %d\n",
-                               mic->name, __func__, __LINE__,
-                               mic->pid, ret);
-                       if (!ret) {
-                               ret = waitpid(mic->pid, &stat,
-                                             WIFSIGNALED(stat));
-                               mpsslog("%s: %s %d waitpid ret %d pid %d\n",
-                                       mic->name, __func__, __LINE__,
-                                       ret, mic->pid);
-                       }
-                       if (mic->boot_on_resume) {
-                               setsysfs(mic->name, "state", "boot");
-                               mic->boot_on_resume = 0;
-                       }
-                       goto close_exit;
-               default:
-                       break;
-               }
-       } while (1);
-
-close_exit:
-       close(fd);
-exit:
-       init_mic(mic);
-       pthread_exit(NULL);
-}
-
-static void
-set_cmdline(struct mic_info *mic)
-{
-       char buffer[PATH_MAX];
-       int len;
-
-       len = snprintf(buffer, PATH_MAX,
-               "clocksource=tsc highres=off nohz=off ");
-       len += snprintf(buffer + len, PATH_MAX - len,
-               "cpufreq_on;corec6_off;pc3_off;pc6_off ");
-       len += snprintf(buffer + len, PATH_MAX - len,
-               "ifcfg=static;address,172.31.%d.1;netmask,255.255.255.0",
-               mic->id + 1);
-
-       setsysfs(mic->name, "cmdline", buffer);
-       mpsslog("%s: Command line: \"%s\"\n", mic->name, buffer);
-       snprintf(buffer, PATH_MAX, "172.31.%d.1", mic->id + 1);
-       mpsslog("%s: IPADDR: \"%s\"\n", mic->name, buffer);
-}
-
-static void
-set_log_buf_info(struct mic_info *mic)
-{
-       int fd;
-       off_t len;
-       char system_map[] = "/lib/firmware/mic/System.map";
-       char *map, *temp, log_buf[17] = {'\0'};
-
-       fd = open(system_map, O_RDONLY);
-       if (fd < 0) {
-               mpsslog("%s: Opening System.map failed: %d\n",
-                       mic->name, errno);
-               return;
-       }
-       len = lseek(fd, 0, SEEK_END);
-       if (len < 0) {
-               mpsslog("%s: Reading System.map size failed: %d\n",
-                       mic->name, errno);
-               close(fd);
-               return;
-       }
-       map = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
-       if (map == MAP_FAILED) {
-               mpsslog("%s: mmap of System.map failed: %d\n",
-                       mic->name, errno);
-               close(fd);
-               return;
-       }
-       temp = strstr(map, "__log_buf");
-       if (!temp) {
-               mpsslog("%s: __log_buf not found: %d\n", mic->name, errno);
-               munmap(map, len);
-               close(fd);
-               return;
-       }
-       strncpy(log_buf, temp - 19, 16);
-       setsysfs(mic->name, "log_buf_addr", log_buf);
-       mpsslog("%s: log_buf_addr: %s\n", mic->name, log_buf);
-       temp = strstr(map, "log_buf_len");
-       if (!temp) {
-               mpsslog("%s: log_buf_len not found: %d\n", mic->name, errno);
-               munmap(map, len);
-               close(fd);
-               return;
-       }
-       strncpy(log_buf, temp - 19, 16);
-       setsysfs(mic->name, "log_buf_len", log_buf);
-       mpsslog("%s: log_buf_len: %s\n", mic->name, log_buf);
-       munmap(map, len);
-       close(fd);
-}
-
-static void
-change_virtblk_backend(int x, siginfo_t *siginfo, void *p)
-{
-       struct mic_info *mic;
-
-       for (mic = mic_list.next; mic != NULL; mic = mic->next)
-               mic->mic_virtblk.signaled = 1/* true */;
-}
-
-static void
-set_mic_boot_params(struct mic_info *mic)
-{
-       set_log_buf_info(mic);
-       set_cmdline(mic);
-}
-
-static void *
-init_mic(void *arg)
-{
-       struct mic_info *mic = (struct mic_info *)arg;
-       struct sigaction ignore = {
-               .sa_flags = 0,
-               .sa_handler = SIG_IGN
-       };
-       struct sigaction act = {
-               .sa_flags = SA_SIGINFO,
-               .sa_sigaction = change_virtblk_backend,
-       };
-       char buffer[PATH_MAX];
-       int err, fd;
-
-       /*
-        * Currently, one virtio block device is supported for each MIC card
-        * at a time. Any user (or test) can send a SIGUSR1 to the MIC daemon.
-        * The signal informs the virtio block backend about a change in the
-        * configuration file which specifies the virtio backend file name on
-        * the host. Virtio block backend then re-reads the configuration file
-        * and switches to the new block device. This signalling mechanism may
-        * not be required once multiple virtio block devices are supported by
-        * the MIC daemon.
-        */
-       sigaction(SIGUSR1, &ignore, NULL);
-retry:
-       fd = open_state_fd(mic);
-       if (fd < 0) {
-               mpsslog("%s: %s %d open state fd failed %s\n",
-                       mic->name, __func__, __LINE__, strerror(errno));
-               sleep(2);
-               goto retry;
-       }
-
-       if (mic->restart) {
-               snprintf(buffer, PATH_MAX, "boot");
-               setsysfs(mic->name, "state", buffer);
-               mpsslog("%s restarting mic %d\n",
-                       mic->name, mic->restart);
-               mic->restart = 0;
-       }
-
-       while (1) {
-               while (block_till_state_change(fd, mic)) {
-                       mpsslog("%s: %s %d block_till_state_change error %s\n",
-                               mic->name, __func__, __LINE__, strerror(errno));
-                       sleep(2);
-                       continue;
-               }
-
-               if (get_mic_state(mic) == MIC_BOOTING)
-                       break;
-       }
-
-       mic->pid = fork();
-       switch (mic->pid) {
-       case 0:
-               add_virtio_device(mic, &virtcons_dev_page.dd);
-               add_virtio_device(mic, &virtnet_dev_page.dd);
-               err = pthread_create(&mic->mic_console.console_thread, NULL,
-                       virtio_console, mic);
-               if (err)
-                       mpsslog("%s virtcons pthread_create failed %s\n",
-                               mic->name, strerror(err));
-               err = pthread_create(&mic->mic_net.net_thread, NULL,
-                       virtio_net, mic);
-               if (err)
-                       mpsslog("%s virtnet pthread_create failed %s\n",
-                               mic->name, strerror(err));
-               err = pthread_create(&mic->mic_virtblk.block_thread, NULL,
-                       virtio_block, mic);
-               if (err)
-                       mpsslog("%s virtblk pthread_create failed %s\n",
-                               mic->name, strerror(err));
-               sigemptyset(&act.sa_mask);
-               err = sigaction(SIGUSR1, &act, NULL);
-               if (err)
-                       mpsslog("%s sigaction SIGUSR1 failed %s\n",
-                               mic->name, strerror(errno));
-               while (1)
-                       sleep(60);
-       case -1:
-               mpsslog("fork failed MIC name %s id %d errno %d\n",
-                       mic->name, mic->id, errno);
-               break;
-       default:
-               err = pthread_create(&mic->config_thread, NULL,
-                                    mic_config, mic);
-               if (err)
-                       mpsslog("%s mic_config pthread_create failed %s\n",
-                               mic->name, strerror(err));
-       }
-
-       return NULL;
-}
-
-static void
-start_daemon(void)
-{
-       struct mic_info *mic;
-       int err;
-
-       for (mic = mic_list.next; mic; mic = mic->next) {
-               set_mic_boot_params(mic);
-               err = pthread_create(&mic->init_thread, NULL, init_mic, mic);
-               if (err)
-                       mpsslog("%s init_mic pthread_create failed %s\n",
-                               mic->name, strerror(err));
-       }
-
-       while (1)
-               sleep(60);
-}
-
-static int
-init_mic_list(void)
-{
-       struct mic_info *mic = &mic_list;
-       struct dirent *file;
-       DIR *dp;
-       int cnt = 0;
-
-       dp = opendir(MICSYSFSDIR);
-       if (!dp)
-               return 0;
-
-       while ((file = readdir(dp)) != NULL) {
-               if (!strncmp(file->d_name, "mic", 3)) {
-                       mic->next = calloc(1, sizeof(struct mic_info));
-                       if (mic->next) {
-                               mic = mic->next;
-                               mic->id = atoi(&file->d_name[3]);
-                               mic->name = malloc(strlen(file->d_name) + 16);
-                               if (mic->name)
-                                       strcpy(mic->name, file->d_name);
-                               mpsslog("MIC name %s id %d\n", mic->name,
-                                       mic->id);
-                               cnt++;
-                       }
-               }
-       }
-
-       closedir(dp);
-       return cnt;
-}
-
-void
-mpsslog(char *format, ...)
-{
-       va_list args;
-       char buffer[4096];
-       char ts[52], *ts1;
-       time_t t;
-
-       if (logfp == NULL)
-               return;
-
-       va_start(args, format);
-       vsprintf(buffer, format, args);
-       va_end(args);
-
-       time(&t);
-       ts1 = ctime_r(&t, ts);
-       ts1[strlen(ts1) - 1] = '\0';
-       fprintf(logfp, "%s: %s", ts1, buffer);
-
-       fflush(logfp);
-}
-
-int
-main(int argc, char *argv[])
-{
-       int cnt;
-       pid_t pid;
-
-       myname = argv[0];
-
-       logfp = fopen(LOGFILE_NAME, "a+");
-       if (!logfp) {
-               fprintf(stderr, "cannot open logfile '%s'\n", LOGFILE_NAME);
-               exit(1);
-       }
-       pid = fork();
-       switch (pid) {
-       case 0:
-               break;
-       case -1:
-               exit(2);
-       default:
-               exit(0);
-       }
-
-       mpsslog("MIC Daemon start\n");
-
-       cnt = init_mic_list();
-       if (cnt == 0) {
-               mpsslog("MIC module not loaded\n");
-               exit(3);
-       }
-       mpsslog("MIC found %d devices\n", cnt);
-
-       start_daemon();
-
-       exit(0);
-}
diff --git a/samples/mic/mpssd/mpssd.h b/samples/mic/mpssd/mpssd.h
deleted file mode 100644 (file)
index 5f98bda..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC User Space Tools.
- */
-#ifndef _MPSSD_H_
-#define _MPSSD_H_
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <libgen.h>
-#include <pthread.h>
-#include <stdarg.h>
-#include <time.h>
-#include <errno.h>
-#include <sys/dir.h>
-#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/utsname.h>
-#include <sys/wait.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <signal.h>
-#include <limits.h>
-#include <syslog.h>
-#include <getopt.h>
-#include <net/if.h>
-#include <linux/if_tun.h>
-#include <linux/virtio_ids.h>
-
-#define MICSYSFSDIR "/sys/class/mic"
-#define LOGFILE_NAME "/var/log/mpssd"
-#define PAGE_SIZE 4096
-
-struct mic_console_info {
-       pthread_t       console_thread;
-       int             virtio_console_fd;
-       void            *console_dp;
-};
-
-struct mic_net_info {
-       pthread_t       net_thread;
-       int             virtio_net_fd;
-       int             tap_fd;
-       void            *net_dp;
-};
-
-struct mic_virtblk_info {
-       pthread_t       block_thread;
-       int             virtio_block_fd;
-       void            *block_dp;
-       volatile sig_atomic_t   signaled;
-       char            *backend_file;
-       int             backend;
-       void            *backend_addr;
-       long            backend_size;
-};
-
-struct mic_info {
-       int             id;
-       char            *name;
-       pthread_t       config_thread;
-       pthread_t       init_thread;
-       pid_t           pid;
-       struct mic_console_info mic_console;
-       struct mic_net_info     mic_net;
-       struct mic_virtblk_info mic_virtblk;
-       int             restart;
-       int             boot_on_resume;
-       struct mic_info *next;
-};
-
-__attribute__((format(printf, 1, 2)))
-void mpsslog(char *format, ...);
-char *readsysfs(char *dir, char *entry);
-int setsysfs(char *dir, char *entry, char *value);
-#endif
diff --git a/samples/mic/mpssd/sysfs.c b/samples/mic/mpssd/sysfs.c
deleted file mode 100644 (file)
index 3fb08eb..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel MIC Platform Software Stack (MPSS)
- *
- * Copyright(c) 2013 Intel Corporation.
- *
- * Intel MIC User Space Tools.
- */
-
-#include "mpssd.h"
-
-#define PAGE_SIZE 4096
-
-char *
-readsysfs(char *dir, char *entry)
-{
-       char filename[PATH_MAX];
-       char value[PAGE_SIZE];
-       char *string = NULL;
-       int fd;
-       int len;
-
-       if (dir == NULL)
-               snprintf(filename, PATH_MAX, "%s/%s", MICSYSFSDIR, entry);
-       else
-               snprintf(filename, PATH_MAX,
-                        "%s/%s/%s", MICSYSFSDIR, dir, entry);
-
-       fd = open(filename, O_RDONLY);
-       if (fd < 0) {
-               mpsslog("Failed to open sysfs entry '%s': %s\n",
-                       filename, strerror(errno));
-               return NULL;
-       }
-
-       len = read(fd, value, sizeof(value));
-       if (len < 0) {
-               mpsslog("Failed to read sysfs entry '%s': %s\n",
-                       filename, strerror(errno));
-               goto readsys_ret;
-       }
-       if (len == 0)
-               goto readsys_ret;
-
-       value[len - 1] = '\0';
-
-       string = malloc(strlen(value) + 1);
-       if (string)
-               strcpy(string, value);
-
-readsys_ret:
-       close(fd);
-       return string;
-}
-
-int
-setsysfs(char *dir, char *entry, char *value)
-{
-       char filename[PATH_MAX];
-       char *oldvalue;
-       int fd, ret = 0;
-
-       if (dir == NULL)
-               snprintf(filename, PATH_MAX, "%s/%s", MICSYSFSDIR, entry);
-       else
-               snprintf(filename, PATH_MAX, "%s/%s/%s",
-                        MICSYSFSDIR, dir, entry);
-
-       oldvalue = readsysfs(dir, entry);
-
-       fd = open(filename, O_RDWR);
-       if (fd < 0) {
-               ret = errno;
-               mpsslog("Failed to open sysfs entry '%s': %s\n",
-                       filename, strerror(errno));
-               goto done;
-       }
-
-       if (!oldvalue || strcmp(value, oldvalue)) {
-               if (write(fd, value, strlen(value)) < 0) {
-                       ret = errno;
-                       mpsslog("Failed to write new sysfs entry '%s': %s\n",
-                               filename, strerror(errno));
-               }
-       }
-       close(fd);
-done:
-       if (oldvalue)
-               free(oldvalue);
-       return ret;
-}
index 6769caa..3148437 100755 (executable)
@@ -408,6 +408,7 @@ class PrinterHelpers(Printer):
             'struct bpf_perf_event_data',
             'struct bpf_perf_event_value',
             'struct bpf_pidns_info',
+            'struct bpf_redir_neigh',
             'struct bpf_sock',
             'struct bpf_sock_addr',
             'struct bpf_sock_ops',
index 4223a9a..fab38b4 100755 (executable)
@@ -43,6 +43,8 @@ my $list_types = 0;
 my $fix = 0;
 my $fix_inplace = 0;
 my $root;
+my $gitroot = $ENV{'GIT_DIR'};
+$gitroot = ".git" if !defined($gitroot);
 my %debug;
 my %camelcase = ();
 my %use_type = ();
@@ -908,7 +910,7 @@ sub is_maintained_obsolete {
 sub is_SPDX_License_valid {
        my ($license) = @_;
 
-       return 1 if (!$tree || which("python") eq "" || !(-e "$root/scripts/spdxcheck.py") || !(-e "$root/.git"));
+       return 1 if (!$tree || which("python") eq "" || !(-e "$root/scripts/spdxcheck.py") || !(-e "$gitroot"));
 
        my $root_path = abs_path($root);
        my $status = `cd "$root_path"; echo "$license" | python scripts/spdxcheck.py -`;
@@ -926,7 +928,7 @@ sub seed_camelcase_includes {
 
        $camelcase_seeded = 1;
 
-       if (-e ".git") {
+       if (-e "$gitroot") {
                my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
                chomp $git_last_include_commit;
                $camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
@@ -954,7 +956,7 @@ sub seed_camelcase_includes {
                return;
        }
 
-       if (-e ".git") {
+       if (-e "$gitroot") {
                $files = `${git_command} ls-files "include/*.h"`;
                @include_files = split('\n', $files);
        }
@@ -987,7 +989,7 @@ sub git_is_single_file {
 sub git_commit_info {
        my ($commit, $id, $desc) = @_;
 
-       return ($id, $desc) if ((which("git") eq "") || !(-e ".git"));
+       return ($id, $desc) if ((which("git") eq "") || !(-e "$gitroot"));
 
        my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
        $output =~ s/^\s*//gm;
@@ -1026,7 +1028,7 @@ my $fixlinenr = -1;
 
 # If input is git commits, extract all commits from the commit expressions.
 # For example, HEAD-3 means we need check 'HEAD, HEAD~1, HEAD~2'.
-die "$P: No git repository found\n" if ($git && !-e ".git");
+die "$P: No git repository found\n" if ($git && !-e "$gitroot");
 
 if ($git) {
        my @commits = ();
index c738cb7..68dab82 100755 (executable)
@@ -2,18 +2,28 @@
 # SPDX-License-Identifier: GPL-2.0
 
 use strict;
+use warnings;
+use utf8;
 use Pod::Usage;
 use Getopt::Long;
 use File::Find;
 use Fcntl ':mode';
 
-my $help;
-my $man;
-my $debug;
+my $help = 0;
+my $man = 0;
+my $debug = 0;
+my $enable_lineno = 0;
 my $prefix="Documentation/ABI";
 
+#
+# If true, assumes that the description is formatted with ReST
+#
+my $description_is_rst = 1;
+
 GetOptions(
        "debug|d+" => \$debug,
+       "enable-lineno" => \$enable_lineno,
+       "rst-source!" => \$description_is_rst,
        "dir=s" => \$prefix,
        'help|?' => \$help,
        man => \$man
@@ -32,6 +42,7 @@ pod2usage(2) if ($cmd eq "search" && !$arg);
 require Data::Dumper if ($debug);
 
 my %data;
+my %symbols;
 
 #
 # Displays an error message, printing file name and line
@@ -39,7 +50,15 @@ my %data;
 sub parse_error($$$$) {
        my ($file, $ln, $msg, $data) = @_;
 
-       print STDERR "file $file#$ln: $msg at\n\t$data";
+       $data =~ s/\s+$/\n/;
+
+       print STDERR "Warning: file $file#$ln:\n\t$msg";
+
+       if ($data ne "") {
+               print STDERR ". Line\n\t\t$data";
+       } else {
+           print STDERR "\n";
+       }
 }
 
 #
@@ -55,24 +74,28 @@ sub parse_abi {
        my $name = $file;
        $name =~ s,.*/,,;
 
-       my $nametag = "File $name";
+       my $fn = $file;
+       $fn =~ s,Documentation/ABI/,,;
+
+       my $nametag = "File $fn";
        $data{$nametag}->{what} = "File $name";
        $data{$nametag}->{type} = "File";
        $data{$nametag}->{file} = $name;
        $data{$nametag}->{filepath} = $file;
        $data{$nametag}->{is_file} = 1;
+       $data{$nametag}->{line_no} = 1;
 
        my $type = $file;
        $type =~ s,.*/(.*)/.*,$1,;
 
        my $what;
        my $new_what;
-       my $tag;
+       my $tag = "";
        my $ln;
        my $xrefs;
        my $space;
        my @labels;
-       my $label;
+       my $label = "";
 
        print STDERR "Opening $file\n" if ($debug > 1);
        open IN, $file;
@@ -95,16 +118,26 @@ sub parse_abi {
 
                        # Invalid, but it is a common mistake
                        if ($new_tag eq "where") {
-                               parse_error($file, $ln, "tag 'Where' is invalid. Should be 'What:' instead", $_);
+                               parse_error($file, $ln, "tag 'Where' is invalid. Should be 'What:' instead", "");
                                $new_tag = "what";
                        }
 
                        if ($new_tag =~ m/what/) {
                                $space = "";
+                               $content =~ s/[,.;]$//;
+
+                               push @{$symbols{$content}->{file}}, " $file:" . ($ln - 1);
+
                                if ($tag =~ m/what/) {
                                        $what .= ", " . $content;
                                } else {
-                                       parse_error($file, $ln, "What '$what' doesn't have a description", "") if ($what && !$data{$what}->{description});
+                                       if ($what) {
+                                               parse_error($file, $ln, "What '$what' doesn't have a description", "") if (!$data{$what}->{description});
+
+                                               foreach my $w(split /, /, $what) {
+                                                       $symbols{$w}->{xref} = $what;
+                                               };
+                                       }
 
                                        $what = $content;
                                        $label = $content;
@@ -113,7 +146,7 @@ sub parse_abi {
                                push @labels, [($content, $label)];
                                $tag = $new_tag;
 
-                               push @{$data{$nametag}->{xrefs}}, [($content, $label)] if ($data{$nametag}->{what});
+                               push @{$data{$nametag}->{symbols}}, $content if ($data{$nametag}->{what});
                                next;
                        }
 
@@ -121,30 +154,44 @@ sub parse_abi {
                                $tag = $new_tag;
 
                                if ($new_what) {
-                                       @{$data{$what}->{label}} = @labels if ($data{$nametag}->{what});
+                                       @{$data{$what}->{label_list}} = @labels if ($data{$nametag}->{what});
                                        @labels = ();
                                        $label = "";
                                        $new_what = 0;
 
                                        $data{$what}->{type} = $type;
-                                       $data{$what}->{file} = $name;
-                                       $data{$what}->{filepath} = $file;
+                                       if (!defined($data{$what}->{file})) {
+                                               $data{$what}->{file} = $name;
+                                               $data{$what}->{filepath} = $file;
+                                       } else {
+                                               if ($name ne $data{$what}->{file}) {
+                                                       $data{$what}->{file} .= " " . $name;
+                                                       $data{$what}->{filepath} .= " " . $file;
+                                               }
+                                       }
                                        print STDERR "\twhat: $what\n" if ($debug > 1);
+                                       $data{$what}->{line_no} = $ln;
+                               } else {
+                                       $data{$what}->{line_no} = $ln if (!defined($data{$what}->{line_no}));
                                }
 
                                if (!$what) {
                                        parse_error($file, $ln, "'What:' should come first:", $_);
                                        next;
                                }
-                               if ($tag eq "description") {
-                                       next if ($content =~ m/^\s*$/);
-                                       if ($content =~ m/^(\s*)(.*)/) {
-                                               my $new_content = $2;
-                                               $space = $new_tag . $sep . $1;
-                                               while ($space =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
-                                               $space =~ s/./ /g;
-                                               $data{$what}->{$tag} .= "$new_content\n";
+                               if ($new_tag eq "description") {
+                                       $sep =~ s,:, ,;
+                                       $content = ' ' x length($new_tag) . $sep . $content;
+                                       while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
+                                       if ($content =~ m/^(\s*)(\S.*)$/) {
+                                               # Preserve initial spaces for the first line
+                                               $space = $1;
+                                               $content = "$2\n";
+                                               $data{$what}->{$tag} .= $content;
+                                       } else {
+                                               undef($space);
                                        }
+
                                } else {
                                        $data{$what}->{$tag} = $content;
                                }
@@ -159,29 +206,24 @@ sub parse_abi {
                }
 
                if ($tag eq "description") {
-                       if (!$data{$what}->{description}) {
-                               next if (m/^\s*\n/);
-                               if (m/^(\s*)(.*)/) {
+                       my $content = $_;
+                       while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
+                       if (m/^\s*\n/) {
+                               $data{$what}->{$tag} .= "\n";
+                               next;
+                       }
+
+                       if (!defined($space)) {
+                               # Preserve initial spaces for the first line
+                               if ($content =~ m/^(\s*)(\S.*)$/) {
                                        $space = $1;
-                                       while ($space =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
-                                       $data{$what}->{$tag} .= "$2\n";
+                                       $content = "$2\n";
                                }
                        } else {
-                               my $content = $_;
-                               if (m/^\s*\n/) {
-                                       $data{$what}->{$tag} .= $content;
-                                       next;
-                               }
-
-                               while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
                                $space = "" if (!($content =~ s/^($space)//));
-
-                               # Compress spaces with tabs
-                               $content =~ s<^ {8}> <\t>;
-                               $content =~ s<^ {1,7}\t> <\t>;
-                               $content =~ s< {1,7}\t> <\t>;
-                               $data{$what}->{$tag} .= $content;
                        }
+                       $data{$what}->{$tag} .= $content;
+
                        next;
                }
                if (m/^\s*(.*)/) {
@@ -191,32 +233,26 @@ sub parse_abi {
                }
 
                # Everything else is error
-               parse_error($file, $ln, "Unexpected line:", $_);
+               parse_error($file, $ln, "Unexpected content", $_);
+       }
+       $data{$nametag}->{description} =~ s/^\n+// if ($data{$nametag}->{description});
+       if ($what) {
+               parse_error($file, $ln, "What '$what' doesn't have a description", "") if (!$data{$what}->{description});
+
+               foreach my $w(split /, /,$what) {
+                       $symbols{$w}->{xref} = $what;
+               };
        }
-       $data{$nametag}->{description} =~ s/^\n+//;
        close IN;
 }
 
-#
-# Outputs the book on ReST format
-#
+sub create_labels {
+       my %labels;
 
-my %labels;
+       foreach my $what (keys %data) {
+               next if ($data{$what}->{file} eq "File");
 
-sub output_rest {
-       foreach my $what (sort {
-                               ($data{$a}->{type} eq "File") cmp ($data{$b}->{type} eq "File") ||
-                               $a cmp $b
-                              } keys %data) {
-               my $type = $data{$what}->{type};
-               my $file = $data{$what}->{file};
-               my $filepath = $data{$what}->{filepath};
-
-               my $w = $what;
-               $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g;
-
-
-               foreach my $p (@{$data{$what}->{label}}) {
+               foreach my $p (@{$data{$what}->{label_list}}) {
                        my ($content, $label) = @{$p};
                        $label = "abi_" . $label . " ";
                        $label =~ tr/A-Z/a-z/;
@@ -233,81 +269,167 @@ sub output_rest {
                        }
                        $labels{$label} = 1;
 
-                       $data{$what}->{label} .= $label;
-
-                       printf ".. _%s:\n\n", $label;
+                       $data{$what}->{label} = $label;
 
                        # only one label is enough
                        last;
                }
+       }
+}
 
+#
+# Outputs the book on ReST format
+#
 
-               $filepath =~ s,.*/(.*/.*),\1,;;
-               $filepath =~ s,[/\-],_,g;;
-               my $fileref = "abi_file_".$filepath;
+# \b doesn't work well with paths. So, we need to define something else
+my $bondary = qr { (?<![\w\/\`\{])(?=[\w\/\`\{])|(?<=[\w\/\`\{])(?![\w\/\`\{]) }x;
 
-               if ($type eq "File") {
-                       my $bar = $w;
-                       $bar =~ s/./-/g;
+sub output_rest {
+       create_labels();
 
-                       print ".. _$fileref:\n\n";
-                       print "$w\n$bar\n\n";
-               } else {
-                       my @names = split /\s*,\s*/,$w;
+       my $part = "";
+
+       foreach my $what (sort {
+                               ($data{$a}->{type} eq "File") cmp ($data{$b}->{type} eq "File") ||
+                               $a cmp $b
+                              } keys %data) {
+               my $type = $data{$what}->{type};
+
+               my @file = split / /, $data{$what}->{file};
+               my @filepath = split / /, $data{$what}->{filepath};
+
+               if ($enable_lineno) {
+                       printf "#define LINENO %s%s#%s\n\n",
+                              $prefix, $file[0],
+                              $data{$what}->{line_no};
+               }
+
+               my $w = $what;
+               $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g;
+
+               if ($type ne "File") {
+                       my $cur_part = $what;
+                       if ($what =~ '/') {
+                               if ($what =~ m#^(\/?(?:[\w\-]+\/?){1,2})#) {
+                                       $cur_part = "Symbols under $1";
+                                       $cur_part =~ s,/$,,;
+                               }
+                       }
+
+                       if ($cur_part ne "" && $part ne $cur_part) {
+                           $part = $cur_part;
+                           my $bar = $part;
+                           $bar =~ s/./-/g;
+                           print "$part\n$bar\n\n";
+                       }
+
+                       printf ".. _%s:\n\n", $data{$what}->{label};
 
+                       my @names = split /, /,$w;
                        my $len = 0;
 
                        foreach my $name (@names) {
+                               $name = "**$name**";
                                $len = length($name) if (length($name) > $len);
                        }
 
-                       print "What:\n\n";
-
                        print "+-" . "-" x $len . "-+\n";
                        foreach my $name (@names) {
                                printf "| %s", $name . " " x ($len - length($name)) . " |\n";
                                print "+-" . "-" x $len . "-+\n";
                        }
+
                        print "\n";
                }
 
-               print "Defined on file :ref:`$file <$fileref>`\n\n" if ($type ne "File");
+               for (my $i = 0; $i < scalar(@filepath); $i++) {
+                       my $path = $filepath[$i];
+                       my $f = $file[$i];
+
+                       $path =~ s,.*/(.*/.*),$1,;;
+                       $path =~ s,[/\-],_,g;;
+                       my $fileref = "abi_file_".$path;
+
+                       if ($type eq "File") {
+                               print ".. _$fileref:\n\n";
+                       } else {
+                               print "Defined on file :ref:`$f <$fileref>`\n\n";
+                       }
+               }
 
-               my $desc = $data{$what}->{description};
-               $desc =~ s/^\s+//;
+               if ($type eq "File") {
+                       my $bar = $w;
+                       $bar =~ s/./-/g;
+                       print "$w\n$bar\n\n";
+               }
 
-               # Remove title markups from the description, as they won't work
-               $desc =~ s/\n[\-\*\=\^\~]+\n/\n/g;
+               my $desc = "";
+               $desc = $data{$what}->{description} if (defined($data{$what}->{description}));
+               $desc =~ s/\s+$/\n/;
 
                if (!($desc =~ /^\s*$/)) {
-                       if ($desc =~ m/\:\n/ || $desc =~ m/\n[\t ]+/  || $desc =~ m/[\x00-\x08\x0b-\x1f\x7b-\xff]/) {
-                               # put everything inside a code block
-                               $desc =~ s/\n/\n /g;
+                       if ($description_is_rst) {
+                               # Remove title markups from the description
+                               # Having titles inside ABI files will only work if extra
+                               # care would be taken in order to strictly follow the same
+                               # level order for each markup.
+                               $desc =~ s/\n[\-\*\=\^\~]+\n/\n\n/g;
+
+                               # Enrich text by creating cross-references
+
+                               $desc =~ s,Documentation/(?!devicetree)(\S+)\.rst,:doc:`/$1`,g;
+
+                               my @matches = $desc =~ m,Documentation/ABI/([\w\/\-]+),;
+                               foreach my $f (@matches) {
+                                       my $xref = $f;
+                                       my $path = $f;
+                                       $path =~ s,.*/(.*/.*),$1,;;
+                                       $path =~ s,[/\-],_,g;;
+                                       $xref .= " <abi_file_" . $path . ">";
+                                       $desc =~ s,\bDocumentation/ABI/$f\b,:ref:`$xref`,g;
+                               }
 
-                               print "::\n\n";
-                               print " $desc\n\n";
-                       } else {
-                               # Escape any special chars from description
-                               $desc =~s/([\x00-\x08\x0b-\x1f\x21-\x2a\x2d\x2f\x3c-\x40\x5c\x5e-\x60\x7b-\xff])/\\$1/g;
+                               @matches = $desc =~ m,$bondary(/sys/[^\s\.\,\;\:\*\s\`\'\(\)]+)$bondary,;
+
+                               foreach my $s (@matches) {
+                                       if (defined($data{$s}) && defined($data{$s}->{label})) {
+                                               my $xref = $s;
+
+                                               $xref =~ s/([\x00-\x1f\x21-\x2f\x3a-\x40\x7b-\xff])/\\$1/g;
+                                               $xref = ":ref:`$xref <" . $data{$s}->{label} . ">`";
+
+                                               $desc =~ s,$bondary$s$bondary,$xref,g;
+                                       }
+                               }
 
                                print "$desc\n\n";
+                       } else {
+                               $desc =~ s/^\s+//;
+
+                               # Remove title markups from the description, as they won't work
+                               $desc =~ s/\n[\-\*\=\^\~]+\n/\n\n/g;
+
+                               if ($desc =~ m/\:\n/ || $desc =~ m/\n[\t ]+/  || $desc =~ m/[\x00-\x08\x0b-\x1f\x7b-\xff]/) {
+                                       # put everything inside a code block
+                                       $desc =~ s/\n/\n /g;
+
+                                       print "::\n\n";
+                                       print " $desc\n\n";
+                               } else {
+                                       # Escape any special chars from description
+                                       $desc =~s/([\x00-\x08\x0b-\x1f\x21-\x2a\x2d\x2f\x3c-\x40\x5c\x5e-\x60\x7b-\xff])/\\$1/g;
+                                       print "$desc\n\n";
+                               }
                        }
                } else {
                        print "DESCRIPTION MISSING for $what\n\n" if (!$data{$what}->{is_file});
                }
 
-               if ($data{$what}->{xrefs}) {
+               if ($data{$what}->{symbols}) {
                        printf "Has the following ABI:\n\n";
 
-                       foreach my $p(@{$data{$what}->{xrefs}}) {
-                               my ($content, $label) = @{$p};
-                               $label = "abi_" . $label . " ";
-                               $label =~ tr/A-Z/a-z/;
-
-                               # Convert special chars to "_"
-                               $label =~s/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xff])/_/g;
-                               $label =~ s,_+,_,g;
-                               $label =~ s,_$,,;
+                       foreach my $content(@{$data{$what}->{symbols}}) {
+                               my $label = $data{$symbols{$content}->{xref}}->{label};
 
                                # Escape special chars from content
                                $content =~s/([\x00-\x1f\x21-\x2f\x3a-\x40\x7b-\xff])/\\$1/g;
@@ -315,6 +437,14 @@ sub output_rest {
                                print "- :ref:`$content <$label>`\n\n";
                        }
                }
+
+               if (defined($data{$what}->{users})) {
+                       my $users = $data{$what}->{users};
+
+                       $users =~ s/\n/\n\t/g;
+                       printf "Users:\n\t%s\n\n", $users if ($users ne "");
+               }
+
        }
 }
 
@@ -335,27 +465,34 @@ sub search_symbols {
 
                print "\n$what\n$bar\n\n";
 
-               my $kernelversion = $data{$what}->{kernelversion};
-               my $contact = $data{$what}->{contact};
-               my $users = $data{$what}->{users};
-               my $date = $data{$what}->{date};
-               my $desc = $data{$what}->{description};
-               $kernelversion =~ s/^\s+//;
-               $contact =~ s/^\s+//;
-               $users =~ s/^\s+//;
-               $users =~ s/\n//g;
-               $date =~ s/^\s+//;
-               $desc =~ s/^\s+//;
+               my $kernelversion = $data{$what}->{kernelversion} if (defined($data{$what}->{kernelversion}));
+               my $contact = $data{$what}->{contact} if (defined($data{$what}->{contact}));
+               my $users = $data{$what}->{users} if (defined($data{$what}->{users}));
+               my $date = $data{$what}->{date} if (defined($data{$what}->{date}));
+               my $desc = $data{$what}->{description} if (defined($data{$what}->{description}));
+
+               $kernelversion =~ s/^\s+// if ($kernelversion);
+               $contact =~ s/^\s+// if ($contact);
+               if ($users) {
+                       $users =~ s/^\s+//;
+                       $users =~ s/\n//g;
+               }
+               $date =~ s/^\s+// if ($date);
+               $desc =~ s/^\s+// if ($desc);
 
                printf "Kernel version:\t\t%s\n", $kernelversion if ($kernelversion);
                printf "Date:\t\t\t%s\n", $date if ($date);
                printf "Contact:\t\t%s\n", $contact if ($contact);
                printf "Users:\t\t\t%s\n", $users if ($users);
-               print "Defined on file:\t$file\n\n";
+               print "Defined on file(s):\t$file\n\n";
                print "Description:\n\n$desc";
        }
 }
 
+# Ensure that the prefix will always end with a slash
+# While this is not needed for find, it makes the patch nicer
+# with --enable-lineno
+$prefix =~ s,/?$,/,;
 
 #
 # Parses all ABI files located at $prefix dir
@@ -367,12 +504,23 @@ print STDERR Data::Dumper->Dump([\%data], [qw(*data)]) if ($debug);
 #
 # Handles the command
 #
-if ($cmd eq "rest") {
-       output_rest;
-} elsif ($cmd eq "search") {
+if ($cmd eq "search") {
        search_symbols;
-}
+} else {
+       if ($cmd eq "rest") {
+               output_rest;
+       }
+
+       # Warn about duplicated ABI entries
+       foreach my $what(sort keys %symbols) {
+               my @files = @{$symbols{$what}->{file}};
 
+               next if (scalar(@files) == 1);
+
+               printf STDERR "Warning: $what is defined %d times: @files\n",
+                   scalar(@files);
+       }
+}
 
 __END__
 
@@ -382,7 +530,8 @@ abi_book.pl - parse the Linux ABI files and produce a ReST book.
 
 =head1 SYNOPSIS
 
-B<abi_book.pl> [--debug] [--man] [--help] [--dir=<dir>] <COMAND> [<ARGUMENT>]
+B<abi_book.pl> [--debug] [--enable-lineno] [--man] [--help]
+              [--(no-)rst-source] [--dir=<dir>] <COMAND> [<ARGUMENT>]
 
 Where <COMMAND> can be:
 
@@ -405,6 +554,17 @@ B<validate>              - validate the ABI contents
 Changes the location of the ABI search. By default, it uses
 the Documentation/ABI directory.
 
+=item B<--rst-source> and B<--no-rst-source>
+
+The input file may be using ReST syntax or not. Those two options allow
+selecting between a rst-compliant source ABI (--rst-source), or a
+plain text that may be violating ReST spec, so it requres some escaping
+logic (--no-rst-source).
+
+=item B<--enable-lineno>
+
+Enable output of #define LINENO lines.
+
 =item B<--debug>
 
 Put the script in verbose mode, useful for debugging. Can be called multiple
index c8f6b11..f699cf0 100755 (executable)
@@ -1092,7 +1092,11 @@ sub output_struct_rst(%) {
        print "\n\n.. c:type:: " . $name . "\n\n";
     } else {
        my $name = $args{'struct'};
-       print "\n\n.. c:struct:: " . $name . "\n\n";
+       if ($args{'type'} eq 'union') {
+           print "\n\n.. c:union:: " . $name . "\n\n";
+       } else {
+           print "\n\n.. c:struct:: " . $name . "\n\n";
+       }
     }
     print_lineno($declaration_start_line);
     $lineprefix = "   ";
@@ -1427,20 +1431,25 @@ sub dump_enum($$) {
     }
 }
 
+my $typedef_type = qr { ((?:\s+[\w\*]+){1,8})\s* }x;
+my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x;
+my $typedef_args = qr { \s*\((.*)\); }x;
+
+my $typedef1 = qr { typedef$typedef_type\($typedef_ident\)$typedef_args }x;
+my $typedef2 = qr { typedef$typedef_type$typedef_ident$typedef_args }x;
+
 sub dump_typedef($$) {
     my $x = shift;
     my $file = shift;
 
     $x =~ s@/\*.*?\*/@@gos;    # strip comments.
 
-    # Parse function prototypes
-    if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ ||
-       $x =~ /typedef\s+(\w+)\s*(\w\S+)\s*\s*\((.*)\);/) {
-
-       # Function typedefs
+    # Parse function typedef prototypes
+    if ($x =~ $typedef1 || $x =~ $typedef2) {
        $return_type = $1;
        $declaration_name = $2;
        my $args = $3;
+       $return_type =~ s/^\s+//;
 
        create_parameterlist($args, ',', $file, $declaration_name);
 
index 69341b3..f882ce0 100644 (file)
@@ -2254,7 +2254,7 @@ static void add_header(struct buffer *b, struct module *mod)
        buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n");
        buf_printf(b, "\n");
        buf_printf(b, "__visible struct module __this_module\n");
-       buf_printf(b, "__section(.gnu.linkonce.this_module) = {\n");
+       buf_printf(b, "__section(\".gnu.linkonce.this_module\") = {\n");
        buf_printf(b, "\t.name = KBUILD_MODNAME,\n");
        if (mod->has_init)
                buf_printf(b, "\t.init = init_module,\n");
@@ -2308,7 +2308,7 @@ static int add_versions(struct buffer *b, struct module *mod)
 
        buf_printf(b, "\n");
        buf_printf(b, "static const struct modversion_info ____versions[]\n");
-       buf_printf(b, "__used __section(__versions) = {\n");
+       buf_printf(b, "__used __section(\"__versions\") = {\n");
 
        for (s = mod->unres; s; s = s->next) {
                if (!s->module)
index 3804307..6ebefec 100644 (file)
@@ -101,7 +101,7 @@ struct ima_template_entry {
        struct tpm_digest *digests;
        struct ima_template_desc *template_desc; /* template descriptor */
        u32 template_data_len;
-       struct ima_field_data template_data[0]; /* template related data */
+       struct ima_field_data template_data[];  /* template related data */
 };
 
 struct ima_queue_entry {
index 7760019..8a176b6 100644 (file)
 /* Flag indicating whether initialization completed */
 int safesetid_initialized;
 
-struct setuid_ruleset __rcu *safesetid_setuid_rules;
+struct setid_ruleset __rcu *safesetid_setuid_rules;
+struct setid_ruleset __rcu *safesetid_setgid_rules;
+
 
 /* Compute a decision for a transition from @src to @dst under @policy. */
-enum sid_policy_type _setuid_policy_lookup(struct setuid_ruleset *policy,
-               kuid_t src, kuid_t dst)
+enum sid_policy_type _setid_policy_lookup(struct setid_ruleset *policy,
+               kid_t src, kid_t dst)
 {
-       struct setuid_rule *rule;
+       struct setid_rule *rule;
        enum sid_policy_type result = SIDPOL_DEFAULT;
 
-       hash_for_each_possible(policy->rules, rule, next, __kuid_val(src)) {
-               if (!uid_eq(rule->src_uid, src))
-                       continue;
-               if (uid_eq(rule->dst_uid, dst))
-                       return SIDPOL_ALLOWED;
+       if (policy->type == UID) {
+               hash_for_each_possible(policy->rules, rule, next, __kuid_val(src.uid)) {
+                       if (!uid_eq(rule->src_id.uid, src.uid))
+                               continue;
+                       if (uid_eq(rule->dst_id.uid, dst.uid))
+                               return SIDPOL_ALLOWED;
+                       result = SIDPOL_CONSTRAINED;
+               }
+       } else if (policy->type == GID) {
+               hash_for_each_possible(policy->rules, rule, next, __kgid_val(src.gid)) {
+                       if (!gid_eq(rule->src_id.gid, src.gid))
+                               continue;
+                       if (gid_eq(rule->dst_id.gid, dst.gid)){
+                               return SIDPOL_ALLOWED;
+                       }
+                       result = SIDPOL_CONSTRAINED;
+               }
+       } else {
+               /* Should not reach here, report the ID as contrainsted */
                result = SIDPOL_CONSTRAINED;
        }
        return result;
@@ -47,15 +63,26 @@ enum sid_policy_type _setuid_policy_lookup(struct setuid_ruleset *policy,
  * Compute a decision for a transition from @src to @dst under the active
  * policy.
  */
-static enum sid_policy_type setuid_policy_lookup(kuid_t src, kuid_t dst)
+static enum sid_policy_type setid_policy_lookup(kid_t src, kid_t dst, enum setid_type new_type)
 {
        enum sid_policy_type result = SIDPOL_DEFAULT;
-       struct setuid_ruleset *pol;
+       struct setid_ruleset *pol;
 
        rcu_read_lock();
-       pol = rcu_dereference(safesetid_setuid_rules);
-       if (pol)
-               result = _setuid_policy_lookup(pol, src, dst);
+       if (new_type == UID)
+               pol = rcu_dereference(safesetid_setuid_rules);
+       else if (new_type == GID)
+               pol = rcu_dereference(safesetid_setgid_rules);
+       else { /* Should not reach here */
+               result = SIDPOL_CONSTRAINED;
+               rcu_read_unlock();
+               return result;
+       }
+
+       if (pol) {
+               pol->type = new_type;
+               result = _setid_policy_lookup(pol, src, dst);
+       }
        rcu_read_unlock();
        return result;
 }
@@ -65,57 +92,101 @@ static int safesetid_security_capable(const struct cred *cred,
                                      int cap,
                                      unsigned int opts)
 {
-       /* We're only interested in CAP_SETUID. */
-       if (cap != CAP_SETUID)
+       /* We're only interested in CAP_SETUID and CAP_SETGID. */
+       if (cap != CAP_SETUID && cap != CAP_SETGID)
                return 0;
 
        /*
-        * If CAP_SETUID is currently used for a set*uid() syscall, we want to
+        * If CAP_SET{U/G}ID is currently used for a setid() syscall, we want to
         * let it go through here; the real security check happens later, in the
-        * task_fix_setuid hook.
+        * task_fix_set{u/g}id hook.
+         *
+         * NOTE:
+         * Until we add support for restricting setgroups() calls, GID security
+         * policies offer no meaningful security since we always return 0 here
+         * when called from within the setgroups() syscall and there is no
+         * additional hook later on to enforce security policies for setgroups().
         */
        if ((opts & CAP_OPT_INSETID) != 0)
                return 0;
 
-       /*
-        * If no policy applies to this task, allow the use of CAP_SETUID for
-        * other purposes.
-        */
-       if (setuid_policy_lookup(cred->uid, INVALID_UID) == SIDPOL_DEFAULT)
+       switch (cap) {
+       case CAP_SETUID:
+               /*
+               * If no policy applies to this task, allow the use of CAP_SETUID for
+               * other purposes.
+               */
+               if (setid_policy_lookup((kid_t){.uid = cred->uid}, INVALID_ID, UID) == SIDPOL_DEFAULT)
+                       return 0;
+               /*
+                * Reject use of CAP_SETUID for functionality other than calling
+                * set*uid() (e.g. setting up userns uid mappings).
+                */
+               pr_warn("Operation requires CAP_SETUID, which is not available to UID %u for operations besides approved set*uid transitions\n",
+                       __kuid_val(cred->uid));
+               return -EPERM;
+               break;
+       case CAP_SETGID:
+               /*
+               * If no policy applies to this task, allow the use of CAP_SETGID for
+               * other purposes.
+               */
+               if (setid_policy_lookup((kid_t){.gid = cred->gid}, INVALID_ID, GID) == SIDPOL_DEFAULT)
+                       return 0;
+               /*
+                * Reject use of CAP_SETUID for functionality other than calling
+                * set*gid() (e.g. setting up userns gid mappings).
+                */
+               pr_warn("Operation requires CAP_SETGID, which is not available to GID %u for operations besides approved set*gid transitions\n",
+                       __kuid_val(cred->uid));
+               return -EPERM;
+               break;
+       default:
+               /* Error, the only capabilities were checking for is CAP_SETUID/GID */
                return 0;
-
-       /*
-        * Reject use of CAP_SETUID for functionality other than calling
-        * set*uid() (e.g. setting up userns uid mappings).
-        */
-       pr_warn("Operation requires CAP_SETUID, which is not available to UID %u for operations besides approved set*uid transitions\n",
-               __kuid_val(cred->uid));
-       return -EPERM;
+               break;
+       }
+       return 0;
 }
 
 /*
  * Check whether a caller with old credentials @old is allowed to switch to
- * credentials that contain @new_uid.
+ * credentials that contain @new_id.
  */
-static bool uid_permitted_for_cred(const struct cred *old, kuid_t new_uid)
+static bool id_permitted_for_cred(const struct cred *old, kid_t new_id, enum setid_type new_type)
 {
        bool permitted;
 
-       /* If our old creds already had this UID in it, it's fine. */
-       if (uid_eq(new_uid, old->uid) || uid_eq(new_uid, old->euid) ||
-           uid_eq(new_uid, old->suid))
-               return true;
+       /* If our old creds already had this ID in it, it's fine. */
+       if (new_type == UID) {
+               if (uid_eq(new_id.uid, old->uid) || uid_eq(new_id.uid, old->euid) ||
+                       uid_eq(new_id.uid, old->suid))
+                       return true;
+       } else if (new_type == GID){
+               if (gid_eq(new_id.gid, old->gid) || gid_eq(new_id.gid, old->egid) ||
+                       gid_eq(new_id.gid, old->sgid))
+                       return true;
+       } else /* Error, new_type is an invalid type */
+               return false;
 
        /*
         * Transitions to new UIDs require a check against the policy of the old
         * RUID.
         */
        permitted =
-           setuid_policy_lookup(old->uid, new_uid) != SIDPOL_CONSTRAINED;
+           setid_policy_lookup((kid_t){.uid = old->uid}, new_id, new_type) != SIDPOL_CONSTRAINED;
+
        if (!permitted) {
-               pr_warn("UID transition ((%d,%d,%d) -> %d) blocked\n",
-                       __kuid_val(old->uid), __kuid_val(old->euid),
-                       __kuid_val(old->suid), __kuid_val(new_uid));
+               if (new_type == UID) {
+                       pr_warn("UID transition ((%d,%d,%d) -> %d) blocked\n",
+                               __kuid_val(old->uid), __kuid_val(old->euid),
+                               __kuid_val(old->suid), __kuid_val(new_id.uid));
+               } else if (new_type == GID) {
+                       pr_warn("GID transition ((%d,%d,%d) -> %d) blocked\n",
+                               __kgid_val(old->gid), __kgid_val(old->egid),
+                               __kgid_val(old->sgid), __kgid_val(new_id.gid));
+               } else /* Error, new_type is an invalid type */
+                       return false;
        }
        return permitted;
 }
@@ -131,18 +202,42 @@ static int safesetid_task_fix_setuid(struct cred *new,
 {
 
        /* Do nothing if there are no setuid restrictions for our old RUID. */
-       if (setuid_policy_lookup(old->uid, INVALID_UID) == SIDPOL_DEFAULT)
+       if (setid_policy_lookup((kid_t){.uid = old->uid}, INVALID_ID, UID) == SIDPOL_DEFAULT)
+               return 0;
+
+       if (id_permitted_for_cred(old, (kid_t){.uid = new->uid}, UID) &&
+           id_permitted_for_cred(old, (kid_t){.uid = new->euid}, UID) &&
+           id_permitted_for_cred(old, (kid_t){.uid = new->suid}, UID) &&
+           id_permitted_for_cred(old, (kid_t){.uid = new->fsuid}, UID))
+               return 0;
+
+       /*
+        * Kill this process to avoid potential security vulnerabilities
+        * that could arise from a missing allowlist entry preventing a
+        * privileged process from dropping to a lesser-privileged one.
+        */
+       force_sig(SIGKILL);
+       return -EACCES;
+}
+
+static int safesetid_task_fix_setgid(struct cred *new,
+                                    const struct cred *old,
+                                    int flags)
+{
+
+       /* Do nothing if there are no setgid restrictions for our old RGID. */
+       if (setid_policy_lookup((kid_t){.gid = old->gid}, INVALID_ID, GID) == SIDPOL_DEFAULT)
                return 0;
 
-       if (uid_permitted_for_cred(old, new->uid) &&
-           uid_permitted_for_cred(old, new->euid) &&
-           uid_permitted_for_cred(old, new->suid) &&
-           uid_permitted_for_cred(old, new->fsuid))
+       if (id_permitted_for_cred(old, (kid_t){.gid = new->gid}, GID) &&
+           id_permitted_for_cred(old, (kid_t){.gid = new->egid}, GID) &&
+           id_permitted_for_cred(old, (kid_t){.gid = new->sgid}, GID) &&
+           id_permitted_for_cred(old, (kid_t){.gid = new->fsgid}, GID))
                return 0;
 
        /*
         * Kill this process to avoid potential security vulnerabilities
-        * that could arise from a missing whitelist entry preventing a
+        * that could arise from a missing allowlist entry preventing a
         * privileged process from dropping to a lesser-privileged one.
         */
        force_sig(SIGKILL);
@@ -151,6 +246,7 @@ static int safesetid_task_fix_setuid(struct cred *new,
 
 static struct security_hook_list safesetid_security_hooks[] = {
        LSM_HOOK_INIT(task_fix_setuid, safesetid_task_fix_setuid),
+       LSM_HOOK_INIT(task_fix_setgid, safesetid_task_fix_setgid),
        LSM_HOOK_INIT(capable, safesetid_security_capable)
 };
 
index db6d16e..bde8c43 100644 (file)
@@ -27,27 +27,47 @@ enum sid_policy_type {
        SIDPOL_ALLOWED /* target ID explicitly allowed */
 };
 
+typedef union {
+       kuid_t uid;
+       kgid_t gid;
+} kid_t;
+
+enum setid_type {
+       UID,
+       GID
+};
+
 /*
- * Hash table entry to store safesetid policy signifying that 'src_uid'
- * can setuid to 'dst_uid'.
+ * Hash table entry to store safesetid policy signifying that 'src_id'
+ * can set*id to 'dst_id'.
  */
-struct setuid_rule {
+struct setid_rule {
        struct hlist_node next;
-       kuid_t src_uid;
-       kuid_t dst_uid;
+       kid_t src_id;
+       kid_t dst_id;
+
+       /* Flag to signal if rule is for UID's or GID's */
+       enum setid_type type;
 };
 
 #define SETID_HASH_BITS 8 /* 256 buckets in hash table */
 
-struct setuid_ruleset {
+/* Extension of INVALID_UID/INVALID_GID for kid_t type */
+#define INVALID_ID (kid_t){.uid = INVALID_UID}
+
+struct setid_ruleset {
        DECLARE_HASHTABLE(rules, SETID_HASH_BITS);
        char *policy_str;
        struct rcu_head rcu;
+
+       //Flag to signal if ruleset is for UID's or GID's
+       enum setid_type type;
 };
 
-enum sid_policy_type _setuid_policy_lookup(struct setuid_ruleset *policy,
-               kuid_t src, kuid_t dst);
+enum sid_policy_type _setid_policy_lookup(struct setid_ruleset *policy,
+               kid_t src, kid_t dst);
 
-extern struct setuid_ruleset __rcu *safesetid_setuid_rules;
+extern struct setid_ruleset __rcu *safesetid_setuid_rules;
+extern struct setid_ruleset __rcu *safesetid_setgid_rules;
 
 #endif /* _SAFESETID_H */
index f8bc574..2531046 100644 (file)
 
 #include "lsm.h"
 
-static DEFINE_MUTEX(policy_update_lock);
+static DEFINE_MUTEX(uid_policy_update_lock);
+static DEFINE_MUTEX(gid_policy_update_lock);
 
 /*
- * In the case the input buffer contains one or more invalid UIDs, the kuid_t
+ * In the case the input buffer contains one or more invalid IDs, the kid_t
  * variables pointed to by @parent and @child will get updated but this
  * function will return an error.
  * Contents of @buf may be modified.
  */
 static int parse_policy_line(struct file *file, char *buf,
-       struct setuid_rule *rule)
+       struct setid_rule *rule)
 {
        char *child_str;
        int ret;
        u32 parsed_parent, parsed_child;
 
-       /* Format of |buf| string should be <UID>:<UID>. */
+       /* Format of |buf| string should be <UID>:<UID> or <GID>:<GID> */
        child_str = strchr(buf, ':');
        if (child_str == NULL)
                return -EINVAL;
@@ -49,20 +50,29 @@ static int parse_policy_line(struct file *file, char *buf,
        if (ret)
                return ret;
 
-       rule->src_uid = make_kuid(file->f_cred->user_ns, parsed_parent);
-       rule->dst_uid = make_kuid(file->f_cred->user_ns, parsed_child);
-       if (!uid_valid(rule->src_uid) || !uid_valid(rule->dst_uid))
+       if (rule->type == UID){
+               rule->src_id.uid = make_kuid(file->f_cred->user_ns, parsed_parent);
+               rule->dst_id.uid = make_kuid(file->f_cred->user_ns, parsed_child);
+               if (!uid_valid(rule->src_id.uid) || !uid_valid(rule->dst_id.uid))
+                       return -EINVAL;
+       } else if (rule->type == GID){
+               rule->src_id.gid = make_kgid(file->f_cred->user_ns, parsed_parent);
+               rule->dst_id.gid = make_kgid(file->f_cred->user_ns, parsed_child);
+               if (!gid_valid(rule->src_id.gid) || !gid_valid(rule->dst_id.gid))
+                       return -EINVAL;
+       } else {
+               /* Error, rule->type is an invalid type */
                return -EINVAL;
-
+       }
        return 0;
 }
 
 static void __release_ruleset(struct rcu_head *rcu)
 {
-       struct setuid_ruleset *pol =
-               container_of(rcu, struct setuid_ruleset, rcu);
+       struct setid_ruleset *pol =
+               container_of(rcu, struct setid_ruleset, rcu);
        int bucket;
-       struct setuid_rule *rule;
+       struct setid_rule *rule;
        struct hlist_node *tmp;
 
        hash_for_each_safe(pol->rules, bucket, tmp, rule, next)
@@ -71,36 +81,55 @@ static void __release_ruleset(struct rcu_head *rcu)
        kfree(pol);
 }
 
-static void release_ruleset(struct setuid_ruleset *pol)
-{
+static void release_ruleset(struct setid_ruleset *pol){
        call_rcu(&pol->rcu, __release_ruleset);
 }
 
-static void insert_rule(struct setuid_ruleset *pol, struct setuid_rule *rule)
+static void insert_rule(struct setid_ruleset *pol, struct setid_rule *rule)
 {
-       hash_add(pol->rules, &rule->next, __kuid_val(rule->src_uid));
+       if (pol->type == UID)
+               hash_add(pol->rules, &rule->next, __kuid_val(rule->src_id.uid));
+       else if (pol->type == GID)
+               hash_add(pol->rules, &rule->next, __kgid_val(rule->src_id.gid));
+       else /* Error, pol->type is neither UID or GID */
+               return;
 }
 
-static int verify_ruleset(struct setuid_ruleset *pol)
+static int verify_ruleset(struct setid_ruleset *pol)
 {
        int bucket;
-       struct setuid_rule *rule, *nrule;
+       struct setid_rule *rule, *nrule;
        int res = 0;
 
        hash_for_each(pol->rules, bucket, rule, next) {
-               if (_setuid_policy_lookup(pol, rule->dst_uid, INVALID_UID) ==
-                   SIDPOL_DEFAULT) {
-                       pr_warn("insecure policy detected: uid %d is constrained but transitively unconstrained through uid %d\n",
-                               __kuid_val(rule->src_uid),
-                               __kuid_val(rule->dst_uid));
+               if (_setid_policy_lookup(pol, rule->dst_id, INVALID_ID) == SIDPOL_DEFAULT) {
+                       if (pol->type == UID) {
+                               pr_warn("insecure policy detected: uid %d is constrained but transitively unconstrained through uid %d\n",
+                                       __kuid_val(rule->src_id.uid),
+                                       __kuid_val(rule->dst_id.uid));
+                       } else if (pol->type == GID) {
+                               pr_warn("insecure policy detected: gid %d is constrained but transitively unconstrained through gid %d\n",
+                                       __kgid_val(rule->src_id.gid),
+                                       __kgid_val(rule->dst_id.gid));
+                       } else { /* pol->type is an invalid type */
+                               res = -EINVAL;
+                               return res;
+                       }
                        res = -EINVAL;
 
                        /* fix it up */
-                       nrule = kmalloc(sizeof(struct setuid_rule), GFP_KERNEL);
+                       nrule = kmalloc(sizeof(struct setid_rule), GFP_KERNEL);
                        if (!nrule)
                                return -ENOMEM;
-                       nrule->src_uid = rule->dst_uid;
-                       nrule->dst_uid = rule->dst_uid;
+                       if (pol->type == UID){
+                               nrule->src_id.uid = rule->dst_id.uid;
+                               nrule->dst_id.uid = rule->dst_id.uid;
+                               nrule->type = UID;
+                       } else { /* pol->type must be GID if we've made it to here */
+                               nrule->src_id.gid = rule->dst_id.gid;
+                               nrule->dst_id.gid = rule->dst_id.gid;
+                               nrule->type = GID;
+                       }
                        insert_rule(pol, nrule);
                }
        }
@@ -108,16 +137,17 @@ static int verify_ruleset(struct setuid_ruleset *pol)
 }
 
 static ssize_t handle_policy_update(struct file *file,
-                                   const char __user *ubuf, size_t len)
+                                   const char __user *ubuf, size_t len, enum setid_type policy_type)
 {
-       struct setuid_ruleset *pol;
+       struct setid_ruleset *pol;
        char *buf, *p, *end;
        int err;
 
-       pol = kmalloc(sizeof(struct setuid_ruleset), GFP_KERNEL);
+       pol = kmalloc(sizeof(struct setid_ruleset), GFP_KERNEL);
        if (!pol)
                return -ENOMEM;
        pol->policy_str = NULL;
+       pol->type = policy_type;
        hash_init(pol->rules);
 
        p = buf = memdup_user_nul(ubuf, len);
@@ -133,7 +163,7 @@ static ssize_t handle_policy_update(struct file *file,
 
        /* policy lines, including the last one, end with \n */
        while (*p != '\0') {
-               struct setuid_rule *rule;
+               struct setid_rule *rule;
 
                end = strchr(p, '\n');
                if (end == NULL) {
@@ -142,18 +172,18 @@ static ssize_t handle_policy_update(struct file *file,
                }
                *end = '\0';
 
-               rule = kmalloc(sizeof(struct setuid_rule), GFP_KERNEL);
+               rule = kmalloc(sizeof(struct setid_rule), GFP_KERNEL);
                if (!rule) {
                        err = -ENOMEM;
                        goto out_free_buf;
                }
 
+               rule->type = policy_type;
                err = parse_policy_line(file, p, rule);
                if (err)
                        goto out_free_rule;
 
-               if (_setuid_policy_lookup(pol, rule->src_uid, rule->dst_uid) ==
-                   SIDPOL_ALLOWED) {
+               if (_setid_policy_lookup(pol, rule->src_id, rule->dst_id) == SIDPOL_ALLOWED) {
                        pr_warn("bad policy: duplicate entry\n");
                        err = -EEXIST;
                        goto out_free_rule;
@@ -178,21 +208,31 @@ out_free_rule:
         * What we really want here is an xchg() wrapper for RCU, but since that
         * doesn't currently exist, just use a spinlock for now.
         */
-       mutex_lock(&policy_update_lock);
-       pol = rcu_replace_pointer(safesetid_setuid_rules, pol,
-                                 lockdep_is_held(&policy_update_lock));
-       mutex_unlock(&policy_update_lock);
+       if (policy_type == UID) {
+               mutex_lock(&uid_policy_update_lock);
+               pol = rcu_replace_pointer(safesetid_setuid_rules, pol,
+                                         lockdep_is_held(&uid_policy_update_lock));
+               mutex_unlock(&uid_policy_update_lock);
+       } else if (policy_type == GID) {
+               mutex_lock(&gid_policy_update_lock);
+               pol = rcu_replace_pointer(safesetid_setgid_rules, pol,
+                                         lockdep_is_held(&gid_policy_update_lock));
+               mutex_unlock(&gid_policy_update_lock);
+       } else {
+               /* Error, policy type is neither UID or GID */
+               pr_warn("error: bad policy type");
+       }
        err = len;
 
 out_free_buf:
        kfree(buf);
 out_free_pol:
        if (pol)
-                release_ruleset(pol);
+               release_ruleset(pol);
        return err;
 }
 
-static ssize_t safesetid_file_write(struct file *file,
+static ssize_t safesetid_uid_file_write(struct file *file,
                                    const char __user *buf,
                                    size_t len,
                                    loff_t *ppos)
@@ -203,38 +243,74 @@ static ssize_t safesetid_file_write(struct file *file,
        if (*ppos != 0)
                return -EINVAL;
 
-       return handle_policy_update(file, buf, len);
+       return handle_policy_update(file, buf, len, UID);
+}
+
+static ssize_t safesetid_gid_file_write(struct file *file,
+                                   const char __user *buf,
+                                   size_t len,
+                                   loff_t *ppos)
+{
+       if (!file_ns_capable(file, &init_user_ns, CAP_MAC_ADMIN))
+               return -EPERM;
+
+       if (*ppos != 0)
+               return -EINVAL;
+
+       return handle_policy_update(file, buf, len, GID);
 }
 
 static ssize_t safesetid_file_read(struct file *file, char __user *buf,
-                                  size_t len, loff_t *ppos)
+                                  size_t len, loff_t *ppos, struct mutex *policy_update_lock, struct __rcu setid_ruleset* ruleset)
 {
        ssize_t res = 0;
-       struct setuid_ruleset *pol;
+       struct setid_ruleset *pol;
        const char *kbuf;
 
-       mutex_lock(&policy_update_lock);
-       pol = rcu_dereference_protected(safesetid_setuid_rules,
-                                       lockdep_is_held(&policy_update_lock));
+       mutex_lock(policy_update_lock);
+       pol = rcu_dereference_protected(ruleset, lockdep_is_held(policy_update_lock));
        if (pol) {
                kbuf = pol->policy_str;
                res = simple_read_from_buffer(buf, len, ppos,
                                              kbuf, strlen(kbuf));
        }
-       mutex_unlock(&policy_update_lock);
+       mutex_unlock(policy_update_lock);
+
        return res;
 }
 
-static const struct file_operations safesetid_file_fops = {
-       .read = safesetid_file_read,
-       .write = safesetid_file_write,
+static ssize_t safesetid_uid_file_read(struct file *file, char __user *buf,
+                                  size_t len, loff_t *ppos)
+{
+       return safesetid_file_read(file, buf, len, ppos,
+                                  &uid_policy_update_lock, safesetid_setuid_rules);
+}
+
+static ssize_t safesetid_gid_file_read(struct file *file, char __user *buf,
+                                  size_t len, loff_t *ppos)
+{
+       return safesetid_file_read(file, buf, len, ppos,
+                                  &gid_policy_update_lock, safesetid_setgid_rules);
+}
+
+
+
+static const struct file_operations safesetid_uid_file_fops = {
+       .read = safesetid_uid_file_read,
+       .write = safesetid_uid_file_write,
+};
+
+static const struct file_operations safesetid_gid_file_fops = {
+       .read = safesetid_gid_file_read,
+       .write = safesetid_gid_file_write,
 };
 
 static int __init safesetid_init_securityfs(void)
 {
        int ret;
        struct dentry *policy_dir;
-       struct dentry *policy_file;
+       struct dentry *uid_policy_file;
+       struct dentry *gid_policy_file;
 
        if (!safesetid_initialized)
                return 0;
@@ -245,13 +321,21 @@ static int __init safesetid_init_securityfs(void)
                goto error;
        }
 
-       policy_file = securityfs_create_file("whitelist_policy", 0600,
-                       policy_dir, NULL, &safesetid_file_fops);
-       if (IS_ERR(policy_file)) {
-               ret = PTR_ERR(policy_file);
+       uid_policy_file = securityfs_create_file("uid_allowlist_policy", 0600,
+                       policy_dir, NULL, &safesetid_uid_file_fops);
+       if (IS_ERR(uid_policy_file)) {
+               ret = PTR_ERR(uid_policy_file);
                goto error;
        }
 
+       gid_policy_file = securityfs_create_file("gid_allowlist_policy", 0600,
+                       policy_dir, NULL, &safesetid_gid_file_fops);
+       if (IS_ERR(gid_policy_file)) {
+               ret = PTR_ERR(gid_policy_file);
+               goto error;
+       }
+
+
        return 0;
 
 error:
index 421ddc7..4373de4 100644 (file)
@@ -1925,8 +1925,8 @@ EXPORT_SYMBOL(snd_ctl_unregister_ioctl);
 
 #ifdef CONFIG_COMPAT
 /**
- * snd_ctl_unregister_ioctl - de-register the device-specific compat 32bit
- * control-ioctls
+ * snd_ctl_unregister_ioctl_compat - de-register the device-specific compat
+ * 32bit control-ioctls
  * @fcn: ioctl callback function to unregister
  */
 int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn)
index 4d059ff..4d0e8fe 100644 (file)
@@ -356,7 +356,8 @@ int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream)
 EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close);
 
 /**
- * snd_dmaengine_pcm_release_chan_close - Close a dmaengine based PCM substream and release channel
+ * snd_dmaengine_pcm_close_release_chan - Close a dmaengine based PCM
+ *                                       substream and release channel
  * @substream: PCM substream
  *
  * Releases the DMA channel associated with the PCM substream.
index d531e1b..bda3514 100644 (file)
@@ -490,7 +490,7 @@ void snd_pcm_set_ops(struct snd_pcm *pcm, int direction,
 EXPORT_SYMBOL(snd_pcm_set_ops);
 
 /**
- * snd_pcm_sync - set the PCM sync id
+ * snd_pcm_set_sync - set the PCM sync id
  * @substream: the pcm substream
  *
  * Sets the PCM sync identifier for the card.
index 9e0b2d7..47b155a 100644 (file)
@@ -112,7 +112,7 @@ void snd_pcm_stream_lock(struct snd_pcm_substream *substream)
 EXPORT_SYMBOL_GPL(snd_pcm_stream_lock);
 
 /**
- * snd_pcm_stream_lock - Unlock the PCM stream
+ * snd_pcm_stream_unlock - Unlock the PCM stream
  * @substream: PCM substream
  *
  * This unlocks the PCM stream that has been locked via snd_pcm_stream_lock().
@@ -595,7 +595,7 @@ static void snd_pcm_sync_stop(struct snd_pcm_substream *substream)
 }
 
 /**
- * snd_pcm_hw_param_choose - choose a configuration defined by @params
+ * snd_pcm_hw_params_choose - choose a configuration defined by @params
  * @pcm: PCM instance
  * @params: the hw_params instance
  *
index 4d060d5..b0c0ef8 100644 (file)
@@ -148,6 +148,8 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus,
                return NULL;
        if (bus->idx != bus_idx)
                return NULL;
+       if (addr < 0 || addr > 31)
+               return NULL;
 
        list_for_each_entry(hlink, &bus->hlink_list, list) {
                for (i = 0; i < HDA_MAX_CODECS; i++) {
index a356c21..4bb58e8 100644 (file)
@@ -2934,7 +2934,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
        snd_hdac_leave_pm(&codec->core);
 }
 
-static int hda_codec_runtime_suspend(struct device *dev)
+static int hda_codec_suspend(struct device *dev)
 {
        struct hda_codec *codec = dev_to_hda_codec(dev);
        unsigned int state;
@@ -2953,7 +2953,7 @@ static int hda_codec_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int hda_codec_runtime_resume(struct device *dev)
+static int hda_codec_resume(struct device *dev)
 {
        struct hda_codec *codec = dev_to_hda_codec(dev);
 
@@ -2967,57 +2967,70 @@ static int hda_codec_runtime_resume(struct device *dev)
        pm_runtime_mark_last_busy(dev);
        return 0;
 }
+
+static int hda_codec_runtime_suspend(struct device *dev)
+{
+       return hda_codec_suspend(dev);
+}
+
+static int hda_codec_runtime_resume(struct device *dev)
+{
+       return hda_codec_resume(dev);
+}
+
 #endif /* CONFIG_PM */
 
 #ifdef CONFIG_PM_SLEEP
-static int hda_codec_force_resume(struct device *dev)
+static int hda_codec_pm_prepare(struct device *dev)
+{
+       return pm_runtime_suspended(dev);
+}
+
+static void hda_codec_pm_complete(struct device *dev)
 {
        struct hda_codec *codec = dev_to_hda_codec(dev);
-       int ret;
 
-       ret = pm_runtime_force_resume(dev);
-       /* schedule jackpoll work for jack detection update */
-       if (codec->jackpoll_interval ||
-           (pm_runtime_suspended(dev) && hda_codec_need_resume(codec)))
-               schedule_delayed_work(&codec->jackpoll_work,
-                                     codec->jackpoll_interval);
-       return ret;
+       if (pm_runtime_suspended(dev) && (codec->jackpoll_interval ||
+           hda_codec_need_resume(codec) || codec->forced_resume))
+               pm_request_resume(dev);
 }
 
 static int hda_codec_pm_suspend(struct device *dev)
 {
        dev->power.power_state = PMSG_SUSPEND;
-       return pm_runtime_force_suspend(dev);
+       return hda_codec_suspend(dev);
 }
 
 static int hda_codec_pm_resume(struct device *dev)
 {
        dev->power.power_state = PMSG_RESUME;
-       return hda_codec_force_resume(dev);
+       return hda_codec_resume(dev);
 }
 
 static int hda_codec_pm_freeze(struct device *dev)
 {
        dev->power.power_state = PMSG_FREEZE;
-       return pm_runtime_force_suspend(dev);
+       return hda_codec_suspend(dev);
 }
 
 static int hda_codec_pm_thaw(struct device *dev)
 {
        dev->power.power_state = PMSG_THAW;
-       return hda_codec_force_resume(dev);
+       return hda_codec_resume(dev);
 }
 
 static int hda_codec_pm_restore(struct device *dev)
 {
        dev->power.power_state = PMSG_RESTORE;
-       return hda_codec_force_resume(dev);
+       return hda_codec_resume(dev);
 }
 #endif /* CONFIG_PM_SLEEP */
 
 /* referred in hda_bind.c */
 const struct dev_pm_ops hda_codec_driver_pm = {
 #ifdef CONFIG_PM_SLEEP
+       .prepare = hda_codec_pm_prepare,
+       .complete = hda_codec_pm_complete,
        .suspend = hda_codec_pm_suspend,
        .resume = hda_codec_pm_resume,
        .freeze = hda_codec_pm_freeze,
index be63ead..68f9668 100644 (file)
@@ -41,7 +41,7 @@
 /* 24 unused */
 #define AZX_DCAPS_COUNT_LPIB_DELAY  (1 << 25)  /* Take LPIB as delay */
 #define AZX_DCAPS_PM_RUNTIME   (1 << 26)       /* runtime PM support */
-#define AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP (1 << 27) /* Workaround for spurious wakeups after suspend */
+/* 27 unused */
 #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28)  /* CORBRP clears itself after reset */
 #define AZX_DCAPS_NO_MSI64      (1 << 29)      /* Stick to 32-bit MSIs */
 #define AZX_DCAPS_SEPARATE_STREAM_TAG  (1 << 30) /* capture and playback use separate stream tag */
@@ -143,6 +143,7 @@ struct azx {
        unsigned int align_buffer_size:1;
        unsigned int region_requested:1;
        unsigned int disabled:1; /* disabled by vga_switcheroo */
+       unsigned int pm_prepared:1;
 
        /* GTS present */
        unsigned int gts_present:1;
index 749b880..d539f52 100644 (file)
@@ -297,8 +297,7 @@ enum {
 /* PCH for HSW/BDW; with runtime PM */
 /* no i915 binding for this as HSW/BDW has another controller for HDMI */
 #define AZX_DCAPS_INTEL_PCH \
-       (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\
-        AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP)
+       (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME)
 
 /* HSW HDMI */
 #define AZX_DCAPS_INTEL_HASWELL \
@@ -985,7 +984,7 @@ static void __azx_runtime_suspend(struct azx *chip)
        display_power(chip, false);
 }
 
-static void __azx_runtime_resume(struct azx *chip, bool from_rt)
+static void __azx_runtime_resume(struct azx *chip)
 {
        struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
        struct hdac_bus *bus = azx_bus(chip);
@@ -1002,7 +1001,8 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt)
        azx_init_pci(chip);
        hda_intel_init_chip(chip, true);
 
-       if (from_rt) {
+       /* Avoid codec resume if runtime resume is for system suspend */
+       if (!chip->pm_prepared) {
                list_for_each_codec(codec, &chip->bus) {
                        if (codec->relaxed_resume)
                                continue;
@@ -1018,6 +1018,29 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt)
 }
 
 #ifdef CONFIG_PM_SLEEP
+static int azx_prepare(struct device *dev)
+{
+       struct snd_card *card = dev_get_drvdata(dev);
+       struct azx *chip;
+
+       chip = card->private_data;
+       chip->pm_prepared = 1;
+
+       /* HDA controller always requires different WAKEEN for runtime suspend
+        * and system suspend, so don't use direct-complete here.
+        */
+       return 0;
+}
+
+static void azx_complete(struct device *dev)
+{
+       struct snd_card *card = dev_get_drvdata(dev);
+       struct azx *chip;
+
+       chip = card->private_data;
+       chip->pm_prepared = 0;
+}
+
 static int azx_suspend(struct device *dev)
 {
        struct snd_card *card = dev_get_drvdata(dev);
@@ -1029,15 +1052,7 @@ static int azx_suspend(struct device *dev)
 
        chip = card->private_data;
        bus = azx_bus(chip);
-       snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
-       /* An ugly workaround: direct call of __azx_runtime_suspend() and
-        * __azx_runtime_resume() for old Intel platforms that suffer from
-        * spurious wakeups after S3 suspend
-        */
-       if (chip->driver_caps & AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP)
-               __azx_runtime_suspend(chip);
-       else
-               pm_runtime_force_suspend(dev);
+       __azx_runtime_suspend(chip);
        if (bus->irq >= 0) {
                free_irq(bus->irq, chip);
                bus->irq = -1;
@@ -1066,11 +1081,7 @@ static int azx_resume(struct device *dev)
        if (azx_acquire_irq(chip, 1) < 0)
                return -EIO;
 
-       if (chip->driver_caps & AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP)
-               __azx_runtime_resume(chip, false);
-       else
-               pm_runtime_force_resume(dev);
-       snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+       __azx_runtime_resume(chip);
 
        trace_azx_resume(chip);
        return 0;
@@ -1118,10 +1129,7 @@ static int azx_runtime_suspend(struct device *dev)
        chip = card->private_data;
 
        /* enable controller wake up event */
-       if (snd_power_get_state(card) == SNDRV_CTL_POWER_D0) {
-               azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
-                          STATESTS_INT_MASK);
-       }
+       azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | STATESTS_INT_MASK);
 
        __azx_runtime_suspend(chip);
        trace_azx_runtime_suspend(chip);
@@ -1132,18 +1140,14 @@ static int azx_runtime_resume(struct device *dev)
 {
        struct snd_card *card = dev_get_drvdata(dev);
        struct azx *chip;
-       bool from_rt = snd_power_get_state(card) == SNDRV_CTL_POWER_D0;
 
        if (!azx_is_pm_ready(card))
                return 0;
        chip = card->private_data;
-       __azx_runtime_resume(chip, from_rt);
+       __azx_runtime_resume(chip);
 
        /* disable controller Wake Up event*/
-       if (from_rt) {
-               azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &
-                          ~STATESTS_INT_MASK);
-       }
+       azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & ~STATESTS_INT_MASK);
 
        trace_azx_runtime_resume(chip);
        return 0;
@@ -1177,6 +1181,8 @@ static int azx_runtime_idle(struct device *dev)
 static const struct dev_pm_ops azx_pm = {
        SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume)
 #ifdef CONFIG_PM_SLEEP
+       .prepare = azx_prepare,
+       .complete = azx_complete,
        .freeze_noirq = azx_freeze_noirq,
        .thaw_noirq = azx_thaw_noirq,
 #endif
@@ -2356,6 +2362,7 @@ static int azx_probe_continue(struct azx *chip)
 
        if (azx_has_pm_runtime(chip)) {
                pm_runtime_use_autosuspend(&pci->dev);
+               pm_runtime_allow(&pci->dev);
                pm_runtime_put_autosuspend(&pci->dev);
        }
 
index ded4813..5880594 100644 (file)
@@ -275,16 +275,21 @@ int snd_hda_jack_detect_state_mst(struct hda_codec *codec,
 }
 EXPORT_SYMBOL_GPL(snd_hda_jack_detect_state_mst);
 
-static bool func_is_already_in_callback_list(struct hda_jack_tbl *jack,
-                                            hda_jack_callback_fn func)
+static struct hda_jack_callback *
+find_callback_from_list(struct hda_jack_tbl *jack,
+                       hda_jack_callback_fn func)
 {
        struct hda_jack_callback *cb;
 
+       if (!func)
+               return NULL;
+
        for (cb = jack->callback; cb; cb = cb->next) {
                if (cb->func == func)
-                       return true;
+                       return cb;
        }
-       return false;
+
+       return NULL;
 }
 
 /**
@@ -309,7 +314,10 @@ snd_hda_jack_detect_enable_callback_mst(struct hda_codec *codec, hda_nid_t nid,
        jack = snd_hda_jack_tbl_new(codec, nid, dev_id);
        if (!jack)
                return ERR_PTR(-ENOMEM);
-       if (func && !func_is_already_in_callback_list(jack, func)) {
+
+       callback = find_callback_from_list(jack, func);
+
+       if (func && !callback) {
                callback = kzalloc(sizeof(*callback), GFP_KERNEL);
                if (!callback)
                        return ERR_PTR(-ENOMEM);
index 2b38b2a..e0c38f2 100644 (file)
@@ -7910,8 +7910,12 @@ static void ae7_post_dsp_asi_stream_setup(struct hda_codec *codec)
 
 static void ae7_post_dsp_pll_setup(struct hda_codec *codec)
 {
-       const unsigned int addr[] = { 0x41, 0x45, 0x40, 0x43, 0x51 };
-       const unsigned int data[] = { 0xc8, 0xcc, 0xcb, 0xc7, 0x8d };
+       static const unsigned int addr[] = {
+               0x41, 0x45, 0x40, 0x43, 0x51
+       };
+       static const unsigned int data[] = {
+               0xc8, 0xcc, 0xcb, 0xc7, 0x8d
+       };
        unsigned int i;
 
        for (i = 0; i < ARRAY_SIZE(addr); i++) {
@@ -7925,10 +7929,12 @@ static void ae7_post_dsp_pll_setup(struct hda_codec *codec)
 static void ae7_post_dsp_asi_setup_ports(struct hda_codec *codec)
 {
        struct ca0132_spec *spec = codec->spec;
-       const unsigned int target[] = { 0x0b, 0x04, 0x06, 0x0a, 0x0c, 0x11,
-                                       0x12, 0x13, 0x14 };
-       const unsigned int data[]   = { 0x12, 0x00, 0x48, 0x05, 0x5f, 0xff,
-                                       0xff, 0xff, 0x7f };
+       static const unsigned int target[] = {
+               0x0b, 0x04, 0x06, 0x0a, 0x0c, 0x11, 0x12, 0x13, 0x14
+       };
+       static const unsigned int data[] = {
+               0x12, 0x00, 0x48, 0x05, 0x5f, 0xff, 0xff, 0xff, 0x7f
+       };
        unsigned int i;
 
        mutex_lock(&spec->chipio_mutex);
index f239872..6899089 100644 (file)
@@ -6008,6 +6008,27 @@ static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
        snd_hda_override_wcaps(codec, 0x03, 0);
 }
 
+static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
+{
+       switch (codec->core.vendor_id) {
+       case 0x10ec0274:
+       case 0x10ec0294:
+       case 0x10ec0225:
+       case 0x10ec0295:
+       case 0x10ec0299:
+               alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
+               alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
+               break;
+       case 0x10ec0235:
+       case 0x10ec0236:
+       case 0x10ec0255:
+       case 0x10ec0256:
+               alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
+               alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
+               break;
+       }
+}
+
 static void alc295_fixup_chromebook(struct hda_codec *codec,
                                    const struct hda_fixup *fix, int action)
 {
@@ -6018,16 +6039,7 @@ static void alc295_fixup_chromebook(struct hda_codec *codec,
                spec->ultra_low_power = true;
                break;
        case HDA_FIXUP_ACT_INIT:
-               switch (codec->core.vendor_id) {
-               case 0x10ec0295:
-                       alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
-                       alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
-                       break;
-               case 0x10ec0236:
-                       alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
-                       alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
-                       break;
-               }
+               alc_combo_jack_hp_jd_restart(codec);
                break;
        }
 }
@@ -6083,6 +6095,16 @@ static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
        alc_write_coef_idx(codec, 0x65, 0x0);
 }
 
+static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
+                                   const struct hda_fixup *fix, int action)
+{
+       switch (action) {
+       case HDA_FIXUP_ACT_INIT:
+               alc_combo_jack_hp_jd_restart(codec);
+               break;
+       }
+}
+
 /* for hda_fixup_thinkpad_acpi() */
 #include "thinkpad_helper.c"
 
@@ -6277,6 +6299,8 @@ enum {
        ALC256_FIXUP_INTEL_NUC8_RUGGED,
        ALC255_FIXUP_XIAOMI_HEADSET_MIC,
        ALC274_FIXUP_HP_MIC,
+       ALC274_FIXUP_HP_HEADSET_MIC,
+       ALC256_FIXUP_ASUS_HPE,
 };
 
 static const struct hda_fixup alc269_fixups[] = {
@@ -7664,6 +7688,23 @@ static const struct hda_fixup alc269_fixups[] = {
                        { }
                },
        },
+       [ALC274_FIXUP_HP_HEADSET_MIC] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc274_fixup_hp_headset_mic,
+               .chained = true,
+               .chain_id = ALC274_FIXUP_HP_MIC
+       },
+       [ALC256_FIXUP_ASUS_HPE] = {
+               .type = HDA_FIXUP_VERBS,
+               .v.verbs = (const struct hda_verb[]) {
+                       /* Set EAPD high */
+                       { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
+                       { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
+                       { }
+               },
+               .chained = true,
+               .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
+       },
 };
 
 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7815,7 +7856,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
        SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
        SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
-       SND_PCI_QUIRK(0x103c, 0x874e, "HP", ALC274_FIXUP_HP_MIC),
        SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
        SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
        SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
@@ -7848,6 +7888,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
        SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
+       SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
        SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
        SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
        SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
@@ -8339,6 +8380,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
                {0x1a, 0x90a70130},
                {0x1b, 0x90170110},
                {0x21, 0x03211020}),
+       SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
+               {0x17, 0x90170110},
+               {0x19, 0x03a11030},
+               {0x21, 0x03211020}),
        SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
                {0x12, 0x90a60130},
                {0x14, 0x90170110},
index 82c1eec..3bd350a 100644 (file)
@@ -487,7 +487,6 @@ static int mchp_spdiftx_hw_params(struct snd_pcm_substream *substream,
        }
        mchp_spdiftx_channel_status_write(dev);
        spin_unlock_irqrestore(&ctrl->lock, flags);
-       mr |= SPDIFTX_MR_VALID1 | SPDIFTX_MR_VALID2;
 
        if (dev->gclk_enabled) {
                clk_disable_unprepare(dev->gclk);
index 097c4e8..c61b17d 100644 (file)
@@ -254,8 +254,28 @@ static const struct snd_soc_dapm_widget cs42l51_dapm_widgets[] = {
                &cs42l51_adcr_mux_controls),
 };
 
+static int mclk_event(struct snd_soc_dapm_widget *w,
+                     struct snd_kcontrol *kcontrol, int event)
+{
+       struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm);
+       struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(comp);
+
+       switch (event) {
+       case SND_SOC_DAPM_PRE_PMU:
+               return clk_prepare_enable(cs42l51->mclk_handle);
+       case SND_SOC_DAPM_POST_PMD:
+               /* Delay mclk shutdown to fulfill power-down sequence requirements */
+               msleep(20);
+               clk_disable_unprepare(cs42l51->mclk_handle);
+               break;
+       }
+
+       return 0;
+}
+
 static const struct snd_soc_dapm_widget cs42l51_dapm_mclk_widgets[] = {
-       SND_SOC_DAPM_CLOCK_SUPPLY("MCLK")
+       SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0, mclk_event,
+                           SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
 };
 
 static const struct snd_soc_dapm_route cs42l51_routes[] = {
index f2d9d52..4d2b1ec 100644 (file)
@@ -618,7 +618,7 @@ static const char * const sb_tx8_mux_text[] = {
        "ZERO", "RX_MIX_TX8", "DEC8", "DEC8_192"
 };
 
-static const DECLARE_TLV_DB_SCALE(digital_gain, 0, 1, 0);
+static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400);
 static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1);
 static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1);
 static const DECLARE_TLV_DB_SCALE(ear_pa_gain, 0, 150, 0);
index 35697b0..40f682f 100644 (file)
@@ -551,7 +551,7 @@ struct wcd_iir_filter_ctl {
        struct soc_bytes_ext bytes_ext;
 };
 
-static const DECLARE_TLV_DB_SCALE(digital_gain, 0, 1, 0);
+static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400);
 static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1);
 static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1);
 static const DECLARE_TLV_DB_SCALE(ear_pa_gain, 0, 150, 0);
index 68e774e..4530b74 100644 (file)
@@ -1026,6 +1026,8 @@ static struct snd_soc_dai_driver wsa881x_dais[] = {
                .id = 0,
                .playback = {
                        .stream_name = "SPKR Playback",
+                       .rates = SNDRV_PCM_RATE_48000,
+                       .formats = SNDRV_PCM_FMTBIT_S16_LE,
                        .rate_max = 48000,
                        .rate_min = 48000,
                        .channels_min = 1,
index d5bae5d..a5b446d 100644 (file)
@@ -15,22 +15,6 @@ config SND_SOC_INTEL_SST_TOPLEVEL
 
 if SND_SOC_INTEL_SST_TOPLEVEL
 
-config SND_SST_IPC
-       tristate
-       # This option controls the IPC core for HiFi2 platforms
-
-config SND_SST_IPC_PCI
-       tristate
-       select SND_SST_IPC
-       # This option controls the PCI-based IPC for HiFi2 platforms
-       #  (Medfield, Merrifield).
-
-config SND_SST_IPC_ACPI
-       tristate
-       select SND_SST_IPC
-       # This option controls the ACPI-based IPC for HiFi2 platforms
-       # (Baytrail, Cherrytrail)
-
 config SND_SOC_INTEL_SST
        tristate
 
@@ -57,7 +41,6 @@ config SND_SST_ATOM_HIFI2_PLATFORM
 config SND_SST_ATOM_HIFI2_PLATFORM_PCI
        tristate "PCI HiFi2 (Merrifield) Platforms"
        depends on X86 && PCI
-       select SND_SST_IPC_PCI
        select SND_SST_ATOM_HIFI2_PLATFORM
        help
          If you have a Intel Merrifield/Edison platform, then
@@ -70,7 +53,6 @@ config SND_SST_ATOM_HIFI2_PLATFORM_ACPI
        tristate "ACPI HiFi2 (Baytrail, Cherrytrail) Platforms"
        default ACPI
        depends on X86 && ACPI && PCI
-       select SND_SST_IPC_ACPI
        select SND_SST_ATOM_HIFI2_PLATFORM
        select SND_SOC_ACPI_INTEL_MATCH
        select IOSF_MBI
index a9326d5..c66f03f 100644 (file)
@@ -6,4 +6,4 @@ snd-soc-sst-atom-hifi2-platform-objs := sst-mfld-platform-pcm.o \
 obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM) += snd-soc-sst-atom-hifi2-platform.o
 
 # DSP driver
-obj-$(CONFIG_SND_SST_IPC) += sst/
+obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM) += sst/
index f17c905..5761d30 100644 (file)
@@ -3,6 +3,6 @@ snd-intel-sst-core-objs := sst.o sst_ipc.o sst_stream.o sst_drv_interface.o sst_
 snd-intel-sst-pci-objs += sst_pci.o
 snd-intel-sst-acpi-objs += sst_acpi.o
 
-obj-$(CONFIG_SND_SST_IPC) += snd-intel-sst-core.o
-obj-$(CONFIG_SND_SST_IPC_PCI) += snd-intel-sst-pci.o
-obj-$(CONFIG_SND_SST_IPC_ACPI) += snd-intel-sst-acpi.o
+obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM) += snd-intel-sst-core.o
+obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_PCI) += snd-intel-sst-pci.o
+obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI) += snd-intel-sst-acpi.o
index 3ea4602..9a4b3d0 100644 (file)
@@ -401,17 +401,40 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
        struct snd_interval *chan = hw_param_interval(params,
                        SNDRV_PCM_HW_PARAM_CHANNELS);
        struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
-       struct snd_soc_dpcm *dpcm = container_of(
-                       params, struct snd_soc_dpcm, hw_params);
-       struct snd_soc_dai_link *fe_dai_link = dpcm->fe->dai_link;
-       struct snd_soc_dai_link *be_dai_link = dpcm->be->dai_link;
+       struct snd_soc_dpcm *dpcm, *rtd_dpcm = NULL;
+
+       /*
+        * The following loop will be called only for playback stream
+        * In this platform, there is only one playback device on every SSP
+        */
+       for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) {
+               rtd_dpcm = dpcm;
+               break;
+       }
+
+       /*
+        * This following loop will be called only for capture stream
+        * In this platform, there is only one capture device on every SSP
+        */
+       for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_CAPTURE, dpcm) {
+               rtd_dpcm = dpcm;
+               break;
+       }
+
+       if (!rtd_dpcm)
+               return -EINVAL;
+
+       /*
+        * The above 2 loops are mutually exclusive based on the stream direction,
+        * thus rtd_dpcm variable will never be overwritten
+        */
 
        /*
         * The ADSP will convert the FE rate to 48k, stereo, 24 bit
         */
-       if (!strcmp(fe_dai_link->name, "Kbl Audio Port") ||
-           !strcmp(fe_dai_link->name, "Kbl Audio Headset Playback") ||
-           !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) {
+       if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Port") ||
+           !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Headset Playback") ||
+           !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Capture Port")) {
                rate->min = rate->max = 48000;
                chan->min = chan->max = 2;
                snd_mask_none(fmt);
@@ -421,7 +444,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
         * The speaker on the SSP0 supports S16_LE and not S24_LE.
         * thus changing the mask here
         */
-       if (!strcmp(be_dai_link->name, "SSP0-Codec"))
+       if (!strcmp(rtd_dpcm->be->dai_link->name, "SSP0-Codec"))
                snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
 
        return 0;
index 7d29685..9e807b9 100644 (file)
@@ -267,9 +267,12 @@ static int catpt_dsp_select_lpclock(struct catpt_dev *cdev, bool lp, bool waiti)
                                            reg, (reg & CATPT_ISD_DCPWM),
                                            500, 10000);
                if (ret) {
-                       dev_err(cdev->dev, "await WAITI timeout\n");
-                       mutex_unlock(&cdev->clk_mutex);
-                       return ret;
+                       dev_warn(cdev->dev, "await WAITI timeout\n");
+                       /* no signal - only high clock selection allowed */
+                       if (lp) {
+                               mutex_unlock(&cdev->clk_mutex);
+                               return 0;
+                       }
                }
        }
 
index f78018c..ba653eb 100644 (file)
@@ -667,7 +667,17 @@ static int catpt_dai_pcm_new(struct snd_soc_pcm_runtime *rtm,
                break;
        }
 
+       /* see if this is a new configuration */
+       if (!memcmp(&cdev->devfmt[devfmt.iface], &devfmt, sizeof(devfmt)))
+               return 0;
+
+       pm_runtime_get_sync(cdev->dev);
+
        ret = catpt_ipc_set_device_format(cdev, &devfmt);
+
+       pm_runtime_mark_last_busy(cdev->dev);
+       pm_runtime_put_autosuspend(cdev->dev);
+
        if (ret)
                return CATPT_IPC_ERROR(ret);
 
index c2c1eb1..26e7d9a 100644 (file)
@@ -630,15 +630,34 @@ static struct snd_soc_codec_conf mt8183_da7219_rt1015_codec_conf[] = {
        },
 };
 
+static const struct snd_kcontrol_new mt8183_da7219_rt1015_snd_controls[] = {
+       SOC_DAPM_PIN_SWITCH("Left Spk"),
+       SOC_DAPM_PIN_SWITCH("Right Spk"),
+};
+
+static const
+struct snd_soc_dapm_widget mt8183_da7219_rt1015_dapm_widgets[] = {
+       SND_SOC_DAPM_SPK("Left Spk", NULL),
+       SND_SOC_DAPM_SPK("Right Spk", NULL),
+       SND_SOC_DAPM_PINCTRL("TDM_OUT_PINCTRL",
+                            "aud_tdm_out_on", "aud_tdm_out_off"),
+};
+
+static const struct snd_soc_dapm_route mt8183_da7219_rt1015_dapm_routes[] = {
+       {"Left Spk", NULL, "Left SPO"},
+       {"Right Spk", NULL, "Right SPO"},
+       {"I2S Playback", NULL, "TDM_OUT_PINCTRL"},
+};
+
 static struct snd_soc_card mt8183_da7219_rt1015_card = {
        .name = "mt8183_da7219_rt1015",
        .owner = THIS_MODULE,
-       .controls = mt8183_da7219_max98357_snd_controls,
-       .num_controls = ARRAY_SIZE(mt8183_da7219_max98357_snd_controls),
-       .dapm_widgets = mt8183_da7219_max98357_dapm_widgets,
-       .num_dapm_widgets = ARRAY_SIZE(mt8183_da7219_max98357_dapm_widgets),
-       .dapm_routes = mt8183_da7219_max98357_dapm_routes,
-       .num_dapm_routes = ARRAY_SIZE(mt8183_da7219_max98357_dapm_routes),
+       .controls = mt8183_da7219_rt1015_snd_controls,
+       .num_controls = ARRAY_SIZE(mt8183_da7219_rt1015_snd_controls),
+       .dapm_widgets = mt8183_da7219_rt1015_dapm_widgets,
+       .num_dapm_widgets = ARRAY_SIZE(mt8183_da7219_rt1015_dapm_widgets),
+       .dapm_routes = mt8183_da7219_rt1015_dapm_routes,
+       .num_dapm_routes = ARRAY_SIZE(mt8183_da7219_rt1015_dapm_routes),
        .dai_link = mt8183_da7219_dai_links,
        .num_links = ARRAY_SIZE(mt8183_da7219_dai_links),
        .aux_dev = &mt8183_da7219_max98357_headset_dev,
index ba2aca3..9d17c87 100644 (file)
@@ -80,6 +80,12 @@ static int lpass_cpu_daiops_startup(struct snd_pcm_substream *substream,
                dev_err(dai->dev, "error in enabling mi2s osr clk: %d\n", ret);
                return ret;
        }
+       ret = clk_prepare(drvdata->mi2s_bit_clk[dai->driver->id]);
+       if (ret) {
+               dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret);
+               clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]);
+               return ret;
+       }
        return 0;
 }
 
@@ -88,9 +94,8 @@ static void lpass_cpu_daiops_shutdown(struct snd_pcm_substream *substream,
 {
        struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
 
-       clk_disable_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]);
-
        clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]);
+       clk_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]);
 }
 
 static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream,
@@ -303,10 +308,10 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
                        dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
                                ret);
 
-               ret = clk_prepare_enable(drvdata->mi2s_bit_clk[id]);
+               ret = clk_enable(drvdata->mi2s_bit_clk[id]);
                if (ret) {
                        dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret);
-                       clk_disable_unprepare(drvdata->mi2s_osr_clk[id]);
+                       clk_disable(drvdata->mi2s_osr_clk[id]);
                        return ret;
                }
 
@@ -324,6 +329,7 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
                if (ret)
                        dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
                                ret);
+               clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
                break;
        }
 
index c6292f9..bc998d5 100644 (file)
@@ -188,7 +188,7 @@ static struct lpass_variant sc7180_data = {
        .micmode                = REG_FIELD_ID(0x1000, 4, 8, 3, 0x1000),
        .micmono                = REG_FIELD_ID(0x1000, 3, 3, 3, 0x1000),
        .wssrc                  = REG_FIELD_ID(0x1000, 2, 2, 3, 0x1000),
-       .bitwidth               = REG_FIELD_ID(0x1000, 0, 0, 3, 0x1000),
+       .bitwidth               = REG_FIELD_ID(0x1000, 0, 1, 3, 0x1000),
 
        .rdma_dyncclk           = REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000),
        .rdma_bursten           = REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000),
index ab1bf23..6c2760e 100644 (file)
@@ -17,6 +17,7 @@
 #include "qdsp6/q6afe.h"
 #include "../codecs/rt5663.h"
 
+#define DRIVER_NAME    "sdm845"
 #define DEFAULT_SAMPLE_RATE_48K                48000
 #define DEFAULT_MCLK_RATE              24576000
 #define TDM_BCLK_RATE          6144000
@@ -552,6 +553,7 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev)
        if (!data)
                return -ENOMEM;
 
+       card->driver_name = DRIVER_NAME;
        card->dapm_widgets = sdm845_snd_widgets;
        card->num_dapm_widgets = ARRAY_SIZE(sdm845_snd_widgets);
        card->dev = dev;
index 1431be4..a2221eb 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 menuconfig SND_SOC_SAMSUNG
        tristate "ASoC support for Samsung"
-       depends on PLAT_SAMSUNG || ARCH_EXYNOS || COMPILE_TEST
+       depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
        depends on COMMON_CLK
        select SND_SOC_GENERIC_DMAENGINE_PCM
        help
index edfa9d1..81f416a 100644 (file)
@@ -19,9 +19,6 @@
 #include <sound/soc.h>
 #include <sound/pcm_params.h>
 
-#include <mach/gpio-samsung.h>
-#include <plat/gpio-cfg.h>
-
 #include "dma.h"
 #include "regs-i2s-v2.h"
 #include "s3c2412-i2s.h"
@@ -70,10 +67,6 @@ static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
        if (ret)
                goto err;
 
-       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
-       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
-                             S3C_GPIO_PULL_NONE);
-
        return 0;
 
 err:
index 60bfaed..50c0800 100644 (file)
 #include <sound/soc.h>
 #include <sound/pcm_params.h>
 
-#include <mach/gpio-samsung.h>
-#include <plat/gpio-cfg.h>
 #include "regs-iis.h"
-
 #include "dma.h"
 #include "s3c24xx-i2s.h"
 
@@ -348,10 +345,6 @@ static int s3c24xx_i2s_probe(struct snd_soc_dai *dai)
        if (ret)
                return ret;
 
-       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
-       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
-                             S3C_GPIO_PULL_NONE);
-
        writel(S3C2410_IISCON_IISEN, s3c24xx_i2s.regs + S3C2410_IISCON);
 
        s3c24xx_snd_txctrl(0);
index ea3986a..05a085f 100644 (file)
@@ -2341,7 +2341,7 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component,
 }
 
 /**
- * snd_soc_unregister_dai - Unregister DAIs from the ASoC core
+ * snd_soc_unregister_dais - Unregister DAIs from the ASoC core
  *
  * @component: The component for which the DAIs should be unregistered
  */
index 980f2c3..7f87b44 100644 (file)
@@ -1276,7 +1276,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
 }
 
 /**
- * snd_soc_dapm_get_connected_widgets - query audio path and it's widgets.
+ * snd_soc_dapm_dai_get_connected_widgets - query audio path and it's widgets.
  * @dai: the soc DAI.
  * @stream: stream direction.
  * @list: list of active widgets for this stream.
index 68ed454..ba9ed66 100644 (file)
@@ -118,6 +118,11 @@ int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 bar, u32 offset)
                case SOF_IPC_EXT_CC_INFO:
                        ret = get_cc_info(sdev, ext_hdr);
                        break;
+               case SOF_IPC_EXT_UNUSED:
+               case SOF_IPC_EXT_PROBE_INFO:
+               case SOF_IPC_EXT_USER_ABI_INFO:
+                       /* They are supported but we don't do anything here */
+                       break;
                default:
                        dev_warn(sdev->dev, "warning: unknown ext header type %d size 0x%x\n",
                                 ext_hdr->type, ext_hdr->hdr.size);
index 913adc8..5a6fb66 100644 (file)
@@ -620,7 +620,7 @@ A circular command buffer is used here. A new command is being added
 while another can be executed. The scheme works by adding two WAIT commands
 after each sent batch of commands. When the next batch is prepared it is
 added after the WAIT commands then the WAITs are replaced with single JUMP
-command to the new batch. The the DBRI is forced to reread the last WAIT
+command to the new batch. Then the DBRI is forced to reread the last WAIT
 command (replaced by the JUMP by then). If the DBRI is still executing
 previous commands the request to reread the WAIT command is ignored.
 
index 1b28d01..3bfead3 100644 (file)
@@ -406,6 +406,7 @@ static int line6_parse_audio_format_rates_quirk(struct snd_usb_audio *chip,
        case USB_ID(0x0e41, 0x4242): /* Line6 Helix Rack */
        case USB_ID(0x0e41, 0x4244): /* Line6 Helix LT */
        case USB_ID(0x0e41, 0x4246): /* Line6 HX-Stomp */
+       case USB_ID(0x0e41, 0x4247): /* Line6 Pod Go */
        case USB_ID(0x0e41, 0x4248): /* Line6 Helix >= fw 2.82 */
        case USB_ID(0x0e41, 0x4249): /* Line6 Helix Rack >= fw 2.82 */
        case USB_ID(0x0e41, 0x424a): /* Line6 Helix LT >= fw 2.82 */
index b401ee8..a860303 100644 (file)
@@ -336,6 +336,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
        switch (subs->stream->chip->usb_id) {
        case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */
        case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */
+       case USB_ID(0x22f0, 0x0006): /* Allen&Heath Qu-16 */
                ep = 0x81;
                ifnum = 3;
                goto add_sync_ep_from_ifnum;
@@ -345,6 +346,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
                ifnum = 2;
                goto add_sync_ep_from_ifnum;
        case USB_ID(0x2466, 0x8003): /* Fractal Audio Axe-Fx II */
+       case USB_ID(0x0499, 0x172a): /* Yamaha MODX */
                ep = 0x86;
                ifnum = 2;
                goto add_sync_ep_from_ifnum;
@@ -352,6 +354,10 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
                ep = 0x81;
                ifnum = 2;
                goto add_sync_ep_from_ifnum;
+       case USB_ID(0x1686, 0xf029): /* Zoom UAC-2 */
+               ep = 0x82;
+               ifnum = 2;
+               goto add_sync_ep_from_ifnum;
        case USB_ID(0x1397, 0x0001): /* Behringer UFX1604 */
        case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */
                ep = 0x81;
index b4fa80e..c989ad8 100644 (file)
@@ -1800,6 +1800,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
        case 0x278b:  /* Rotel? */
        case 0x292b:  /* Gustard/Ess based devices */
        case 0x2ab6:  /* T+A devices */
+       case 0x3353:  /* Khadas devices */
        case 0x3842:  /* EVGA */
        case 0xc502:  /* HiBy devices */
                if (fp->dsd_raw)
index ba85bb2..1c17c3a 100644 (file)
@@ -159,6 +159,21 @@ struct kvm_sync_regs {
 struct kvm_arch_memory_slot {
 };
 
+/*
+ * PMU filter structure. Describe a range of events with a particular
+ * action. To be used with KVM_ARM_VCPU_PMU_V3_FILTER.
+ */
+struct kvm_pmu_event_filter {
+       __u16   base_event;
+       __u16   nevents;
+
+#define KVM_PMU_EVENT_ALLOW    0
+#define KVM_PMU_EVENT_DENY     1
+
+       __u8    action;
+       __u8    pad[3];
+};
+
 /* for KVM_GET/SET_VCPU_EVENTS */
 struct kvm_vcpu_events {
        struct {
@@ -242,6 +257,15 @@ struct kvm_vcpu_events {
 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL          0
 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL              1
 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED       2
+
+/*
+ * Only two states can be presented by the host kernel:
+ * - NOT_REQUIRED: the guest doesn't need to do anything
+ * - NOT_AVAIL: the guest isn't mitigated (it can still use SSBS if available)
+ *
+ * All the other values are deprecated. The host still accepts all
+ * values (they are ABI), but will narrow them to the above two.
+ */
 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2    KVM_REG_ARM_FW_REG(2)
 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL          0
 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN            1
@@ -329,6 +353,7 @@ struct kvm_vcpu_events {
 #define KVM_ARM_VCPU_PMU_V3_CTRL       0
 #define   KVM_ARM_VCPU_PMU_V3_IRQ      0
 #define   KVM_ARM_VCPU_PMU_V3_INIT     1
+#define   KVM_ARM_VCPU_PMU_V3_FILTER   2
 #define KVM_ARM_VCPU_TIMER_CTRL                1
 #define   KVM_ARM_VCPU_TIMER_IRQ_VTIMER                0
 #define   KVM_ARM_VCPU_TIMER_IRQ_PTIMER                1
index 6ca1e68..ede3186 100644 (file)
@@ -29,7 +29,7 @@
        { 0x13, "SIGP conditional emergency signal" },          \
        { 0x15, "SIGP sense running" },                         \
        { 0x16, "SIGP set multithreading"},                     \
-       { 0x17, "SIGP store additional status ait address"}
+       { 0x17, "SIGP store additional status at address"}
 
 #define icpt_prog_codes                                                \
        { 0x0001, "Prog Operation" },                           \
index 2901d5d..dad350d 100644 (file)
@@ -96,7 +96,7 @@
 #define X86_FEATURE_SYSCALL32          ( 3*32+14) /* "" syscall in IA32 userspace */
 #define X86_FEATURE_SYSENTER32         ( 3*32+15) /* "" sysenter in IA32 userspace */
 #define X86_FEATURE_REP_GOOD           ( 3*32+16) /* REP microcode works well */
-/* free                                        ( 3*32+17) */
+#define X86_FEATURE_SME_COHERENT       ( 3*32+17) /* "" AMD hardware-enforced cache coherency */
 #define X86_FEATURE_LFENCE_RDTSC       ( 3*32+18) /* "" LFENCE synchronizes RDTSC */
 #define X86_FEATURE_ACC_POWER          ( 3*32+19) /* AMD Accumulated Power Mechanism */
 #define X86_FEATURE_NOPL               ( 3*32+20) /* The NOPL (0F 1F) instructions */
 #define X86_FEATURE_EPT_AD             ( 8*32+17) /* Intel Extended Page Table access-dirty bit */
 #define X86_FEATURE_VMCALL             ( 8*32+18) /* "" Hypervisor supports the VMCALL instruction */
 #define X86_FEATURE_VMW_VMMCALL                ( 8*32+19) /* "" VMware prefers VMMCALL hypercall instruction */
+#define X86_FEATURE_SEV_ES             ( 8*32+20) /* AMD Secure Encrypted Virtualization - Encrypted State */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */
 #define X86_FEATURE_FSGSBASE           ( 9*32+ 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/
 #define X86_FEATURE_FENCE_SWAPGS_USER  (11*32+ 4) /* "" LFENCE in user entry SWAPGS path */
 #define X86_FEATURE_FENCE_SWAPGS_KERNEL        (11*32+ 5) /* "" LFENCE in kernel entry SWAPGS path */
 #define X86_FEATURE_SPLIT_LOCK_DETECT  (11*32+ 6) /* #AC for split lock */
+#define X86_FEATURE_PER_THREAD_MBA     (11*32+ 7) /* "" Per-thread Memory Bandwidth Allocation */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
 #define X86_FEATURE_AVX512_BF16                (12*32+ 5) /* AVX512 BFLOAT16 instructions */
 #define X86_FEATURE_CLDEMOTE           (16*32+25) /* CLDEMOTE instruction */
 #define X86_FEATURE_MOVDIRI            (16*32+27) /* MOVDIRI instruction */
 #define X86_FEATURE_MOVDIR64B          (16*32+28) /* MOVDIR64B instruction */
+#define X86_FEATURE_ENQCMD             (16*32+29) /* ENQCMD and ENQCMDS instructions */
 
 /* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */
 #define X86_FEATURE_OVERFLOW_RECOV     (17*32+ 0) /* MCA overflow recovery support */
 #define X86_FEATURE_MD_CLEAR           (18*32+10) /* VERW clears CPU buffers */
 #define X86_FEATURE_TSX_FORCE_ABORT    (18*32+13) /* "" TSX_FORCE_ABORT */
 #define X86_FEATURE_SERIALIZE          (18*32+14) /* SERIALIZE instruction */
+#define X86_FEATURE_TSXLDTRK           (18*32+16) /* TSX Suspend Load Address Tracking */
 #define X86_FEATURE_PCONFIG            (18*32+18) /* Intel PCONFIG */
 #define X86_FEATURE_ARCH_LBR           (18*32+19) /* Intel ARCH LBR */
 #define X86_FEATURE_SPEC_CTRL          (18*32+26) /* "" Speculation Control (IBRS + IBPB) */
index 4ea8584..5861d34 100644 (file)
 # define DISABLE_PTI           (1 << (X86_FEATURE_PTI & 31))
 #endif
 
+#ifdef CONFIG_IOMMU_SUPPORT
+# define DISABLE_ENQCMD        0
+#else
+# define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31))
+#endif
+
 /*
  * Make sure to add features to the correct mask
  */
@@ -75,7 +81,8 @@
 #define DISABLED_MASK13        0
 #define DISABLED_MASK14        0
 #define DISABLED_MASK15        0
-#define DISABLED_MASK16        (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP)
+#define DISABLED_MASK16        (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP| \
+                        DISABLE_ENQCMD)
 #define DISABLED_MASK17        0
 #define DISABLED_MASK18        0
 #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19)
index 2859ee4..972a34d 100644 (file)
 #define MSR_IA32_LASTINTFROMIP         0x000001dd
 #define MSR_IA32_LASTINTTOIP           0x000001de
 
+#define MSR_IA32_PASID                 0x00000d93
+#define MSR_IA32_PASID_VALID           BIT_ULL(31)
+
 /* DEBUGCTLMSR bits (others vary by model): */
 #define DEBUGCTLMSR_LBR                        (1UL <<  0) /* last branch recording */
 #define DEBUGCTLMSR_BTF_SHIFT          1
 #define MSR_AMD64_IBSOP_REG_MASK       ((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1)
 #define MSR_AMD64_IBSCTL               0xc001103a
 #define MSR_AMD64_IBSBRTARGET          0xc001103b
+#define MSR_AMD64_ICIBSEXTDCTL         0xc001103c
 #define MSR_AMD64_IBSOPDATA4           0xc001103d
 #define MSR_AMD64_IBS_REG_COUNT_MAX    8 /* includes MSR_AMD64_IBSBRTARGET */
+#define MSR_AMD64_SEV_ES_GHCB          0xc0010130
 #define MSR_AMD64_SEV                  0xc0010131
 #define MSR_AMD64_SEV_ENABLED_BIT      0
+#define MSR_AMD64_SEV_ES_ENABLED_BIT   1
 #define MSR_AMD64_SEV_ENABLED          BIT_ULL(MSR_AMD64_SEV_ENABLED_BIT)
+#define MSR_AMD64_SEV_ES_ENABLED       BIT_ULL(MSR_AMD64_SEV_ES_ENABLED_BIT)
 
 #define MSR_AMD64_VIRT_SPEC_CTRL       0xc001011f
 
 #define MSR_CORE_PERF_FIXED_CTR0       0x00000309
 #define MSR_CORE_PERF_FIXED_CTR1       0x0000030a
 #define MSR_CORE_PERF_FIXED_CTR2       0x0000030b
+#define MSR_CORE_PERF_FIXED_CTR3       0x0000030c
 #define MSR_CORE_PERF_FIXED_CTR_CTRL   0x0000038d
 #define MSR_CORE_PERF_GLOBAL_STATUS    0x0000038e
 #define MSR_CORE_PERF_GLOBAL_CTRL      0x0000038f
 #define MSR_CORE_PERF_GLOBAL_OVF_CTRL  0x00000390
 
+#define MSR_PERF_METRICS               0x00000329
+
 /* PERF_GLOBAL_OVF_CTL bits */
 #define MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT       55
 #define MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI           (1ULL << MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT)
index 6847d85..3ff0d48 100644 (file)
@@ -54,7 +54,7 @@
 #endif
 
 #ifdef CONFIG_X86_64
-#ifdef CONFIG_PARAVIRT
+#ifdef CONFIG_PARAVIRT_XXL
 /* Paravirtualized systems may not have PSE or PGE available */
 #define NEED_PSE       0
 #define NEED_PGE       0
index 0780f97..89e5f3d 100644 (file)
@@ -192,6 +192,26 @@ struct kvm_msr_list {
        __u32 indices[0];
 };
 
+/* Maximum size of any access bitmap in bytes */
+#define KVM_MSR_FILTER_MAX_BITMAP_SIZE 0x600
+
+/* for KVM_X86_SET_MSR_FILTER */
+struct kvm_msr_filter_range {
+#define KVM_MSR_FILTER_READ  (1 << 0)
+#define KVM_MSR_FILTER_WRITE (1 << 1)
+       __u32 flags;
+       __u32 nmsrs; /* number of msrs in bitmap */
+       __u32 base;  /* MSR index the bitmap starts at */
+       __u8 *bitmap; /* a 1 bit allows the operations in flags, 0 denies */
+};
+
+#define KVM_MSR_FILTER_MAX_RANGES 16
+struct kvm_msr_filter {
+#define KVM_MSR_FILTER_DEFAULT_ALLOW (0 << 0)
+#define KVM_MSR_FILTER_DEFAULT_DENY  (1 << 0)
+       __u32 flags;
+       struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES];
+};
 
 struct kvm_cpuid_entry {
        __u32 function;
index 2e8a30f..f1d8307 100644 (file)
@@ -29,6 +29,7 @@
 #define SVM_EXIT_WRITE_DR6     0x036
 #define SVM_EXIT_WRITE_DR7     0x037
 #define SVM_EXIT_EXCP_BASE     0x040
+#define SVM_EXIT_LAST_EXCP     0x05f
 #define SVM_EXIT_INTR          0x060
 #define SVM_EXIT_NMI           0x061
 #define SVM_EXIT_SMI           0x062
 #define SVM_EXIT_MWAIT_COND    0x08c
 #define SVM_EXIT_XSETBV        0x08d
 #define SVM_EXIT_RDPRU         0x08e
+#define SVM_EXIT_INVPCID       0x0a2
 #define SVM_EXIT_NPF           0x400
 #define SVM_EXIT_AVIC_INCOMPLETE_IPI           0x401
 #define SVM_EXIT_AVIC_UNACCELERATED_ACCESS     0x402
 
+/* SEV-ES software-defined VMGEXIT events */
+#define SVM_VMGEXIT_MMIO_READ                  0x80000001
+#define SVM_VMGEXIT_MMIO_WRITE                 0x80000002
+#define SVM_VMGEXIT_NMI_COMPLETE               0x80000003
+#define SVM_VMGEXIT_AP_HLT_LOOP                        0x80000004
+#define SVM_VMGEXIT_AP_JUMP_TABLE              0x80000005
+#define SVM_VMGEXIT_SET_AP_JUMP_TABLE          0
+#define SVM_VMGEXIT_GET_AP_JUMP_TABLE          1
+#define SVM_VMGEXIT_UNSUPPORTED_EVENT          0x8000ffff
+
 #define SVM_EXIT_ERR           -1
 
 #define SVM_EXIT_REASONS \
        { SVM_EXIT_MONITOR,     "monitor" }, \
        { SVM_EXIT_MWAIT,       "mwait" }, \
        { SVM_EXIT_XSETBV,      "xsetbv" }, \
+       { SVM_EXIT_INVPCID,     "invpcid" }, \
        { SVM_EXIT_NPF,         "npf" }, \
        { SVM_EXIT_AVIC_INCOMPLETE_IPI,         "avic_incomplete_ipi" }, \
        { SVM_EXIT_AVIC_UNACCELERATED_ACCESS,   "avic_unaccelerated_access" }, \
index a43a6f1..359960a 100644 (file)
@@ -843,9 +843,14 @@ static int handle_perms(void)
                else
                        p_err("missing %s%s%s%s%s%s%s%srequired for full feature probing; run as root or use 'unprivileged'",
                              capability_msg(bpf_caps, 0),
+#ifdef CAP_BPF
                              capability_msg(bpf_caps, 1),
                              capability_msg(bpf_caps, 2),
-                             capability_msg(bpf_caps, 3));
+                             capability_msg(bpf_caps, 3)
+#else
+                               "", "", "", "", "", ""
+#endif /* CAP_BPF */
+                               );
                goto exit_free;
        }
 
index d942c1e..acdb2c2 100644 (file)
@@ -940,7 +940,7 @@ static int parse_attach_detach_args(int argc, char **argv, int *progfd,
        }
 
        if (*attach_type == BPF_FLOW_DISSECTOR) {
-               *mapfd = -1;
+               *mapfd = 0;
                return 0;
        }
 
index 4e3512f..ce5b65e 100644 (file)
@@ -70,7 +70,7 @@ int BPF_PROG(fentry_XXX)
 static inline void
 fexit_update_maps(u32 id, struct bpf_perf_event_value *after)
 {
-       struct bpf_perf_event_value *before, diff, *accum;
+       struct bpf_perf_event_value *before, diff;
 
        before = bpf_map_lookup_elem(&fentry_readings, &id);
        /* only account samples with a valid fentry_reading */
@@ -95,7 +95,7 @@ int BPF_PROG(fexit_XXX)
 {
        struct bpf_perf_event_value readings[MAX_NUM_MATRICS];
        u32 cpu = bpf_get_smp_processor_id();
-       u32 i, one = 1, zero = 0;
+       u32 i, zero = 0;
        int err;
        u64 *count;
 
index a04e813..4648738 100644 (file)
@@ -185,7 +185,6 @@ int main(int argc, char *argv[])
        main_test_libperl();
        main_test_hello();
        main_test_libelf();
-       main_test_libelf_mmap();
        main_test_get_current_dir_name();
        main_test_gettid();
        main_test_glibc();
index b9d4322..95c072b 100644 (file)
 #define  __pure                __attribute__((pure))
 #endif
 #define  noinline      __attribute__((noinline))
-#ifdef __has_attribute
-#if __has_attribute(disable_tail_calls)
-#define __no_tail_call __attribute__((disable_tail_calls))
-#endif
-#endif
-#ifndef __no_tail_call
-#if GCC_VERSION > 40201
-#define __no_tail_call __attribute__((optimize("no-optimize-sibling-calls")))
-#else
-#define __no_tail_call
-#endif
-#endif
 #ifndef __packed
 #define __packed       __attribute__((packed))
 #endif
index 2b3f735..d22a974 100644 (file)
@@ -47,9 +47,6 @@
 #ifndef noinline
 #define noinline
 #endif
-#ifndef __no_tail_call
-#define __no_tail_call
-#endif
 
 /* Are two types/vars the same type (ignoring qualifiers)? */
 #ifndef __same_type
index ab82c79..577f514 100644 (file)
@@ -60,7 +60,7 @@ struct unwind_hint {
  * For more information, see tools/objtool/Documentation/stack-validation.txt.
  */
 #define STACK_FRAME_NON_STANDARD(func) \
-       static void __used __section(.discard.func_stack_frame_non_standard) \
+       static void __used __section(".discard.func_stack_frame_non_standard") \
                *__func_stack_frame_non_standard_##func = func
 
 #else /* __ASSEMBLY__ */
index f2b5d72..2056318 100644 (file)
@@ -857,9 +857,11 @@ __SYSCALL(__NR_openat2, sys_openat2)
 __SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd)
 #define __NR_faccessat2 439
 __SYSCALL(__NR_faccessat2, sys_faccessat2)
+#define __NR_process_madvise 440
+__SYSCALL(__NR_process_madvise, sys_process_madvise)
 
 #undef __NR_syscalls
-#define __NR_syscalls 440
+#define __NR_syscalls 441
 
 /*
  * 32 bit systems traditionally used different
index 0054606..fa1f3d6 100644 (file)
@@ -619,6 +619,12 @@ typedef struct drm_i915_irq_wait {
  */
 #define I915_PARAM_PERF_REVISION       54
 
+/* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of
+ * timeline syncobj through drm_i915_gem_execbuffer_ext_timeline_fences. See
+ * I915_EXEC_USE_EXTENSIONS.
+ */
+#define I915_PARAM_HAS_EXEC_TIMELINE_FENCES 55
+
 /* Must be kept compact -- no holes and well documented */
 
 typedef struct drm_i915_getparam {
@@ -1046,6 +1052,38 @@ struct drm_i915_gem_exec_fence {
        __u32 flags;
 };
 
+/**
+ * See drm_i915_gem_execbuffer_ext_timeline_fences.
+ */
+#define DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES 0
+
+/**
+ * This structure describes an array of drm_syncobj and associated points for
+ * timeline variants of drm_syncobj. It is invalid to append this structure to
+ * the execbuf if I915_EXEC_FENCE_ARRAY is set.
+ */
+struct drm_i915_gem_execbuffer_ext_timeline_fences {
+       struct i915_user_extension base;
+
+       /**
+        * Number of element in the handles_ptr & value_ptr arrays.
+        */
+       __u64 fence_count;
+
+       /**
+        * Pointer to an array of struct drm_i915_gem_exec_fence of length
+        * fence_count.
+        */
+       __u64 handles_ptr;
+
+       /**
+        * Pointer to an array of u64 values of length fence_count. Values
+        * must be 0 for a binary drm_syncobj. A Value of 0 for a timeline
+        * drm_syncobj is invalid as it turns a drm_syncobj into a binary one.
+        */
+       __u64 values_ptr;
+};
+
 struct drm_i915_gem_execbuffer2 {
        /**
         * List of gem_exec_object2 structs
@@ -1062,8 +1100,14 @@ struct drm_i915_gem_execbuffer2 {
        __u32 num_cliprects;
        /**
         * This is a struct drm_clip_rect *cliprects if I915_EXEC_FENCE_ARRAY
-        * is not set.  If I915_EXEC_FENCE_ARRAY is set, then this is a
-        * struct drm_i915_gem_exec_fence *fences.
+        * & I915_EXEC_USE_EXTENSIONS are not set.
+        *
+        * If I915_EXEC_FENCE_ARRAY is set, then this is a pointer to an array
+        * of struct drm_i915_gem_exec_fence and num_cliprects is the length
+        * of the array.
+        *
+        * If I915_EXEC_USE_EXTENSIONS is set, then this is a pointer to a
+        * single struct i915_user_extension and num_cliprects is 0.
         */
        __u64 cliprects_ptr;
 #define I915_EXEC_RING_MASK              (0x3f)
@@ -1181,7 +1225,16 @@ struct drm_i915_gem_execbuffer2 {
  */
 #define I915_EXEC_FENCE_SUBMIT         (1 << 20)
 
-#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SUBMIT << 1))
+/*
+ * Setting I915_EXEC_USE_EXTENSIONS implies that
+ * drm_i915_gem_execbuffer2.cliprects_ptr is treated as a pointer to an linked
+ * list of i915_user_extension. Each i915_user_extension node is the base of a
+ * larger structure. The list of supported structures are listed in the
+ * drm_i915_gem_execbuffer_ext enum.
+ */
+#define I915_EXEC_USE_EXTENSIONS       (1 << 21)
+
+#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_USE_EXTENSIONS << 1))
 
 #define I915_EXEC_CONTEXT_ID_MASK      (0xffffffff)
 #define i915_execbuffer2_set_context_id(eb2, context) \
index 7875709..e5de603 100644 (file)
@@ -45,7 +45,6 @@ struct fscrypt_policy_v1 {
        __u8 flags;
        __u8 master_key_descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE];
 };
-#define fscrypt_policy fscrypt_policy_v1
 
 /*
  * Process-subscribed "logon" key description prefix and payload format.
@@ -156,9 +155,9 @@ struct fscrypt_get_key_status_arg {
        __u32 __out_reserved[13];
 };
 
-#define FS_IOC_SET_ENCRYPTION_POLICY           _IOR('f', 19, struct fscrypt_policy)
+#define FS_IOC_SET_ENCRYPTION_POLICY           _IOR('f', 19, struct fscrypt_policy_v1)
 #define FS_IOC_GET_ENCRYPTION_PWSALT           _IOW('f', 20, __u8[16])
-#define FS_IOC_GET_ENCRYPTION_POLICY           _IOW('f', 21, struct fscrypt_policy)
+#define FS_IOC_GET_ENCRYPTION_POLICY           _IOW('f', 21, struct fscrypt_policy_v1)
 #define FS_IOC_GET_ENCRYPTION_POLICY_EX                _IOWR('f', 22, __u8[9]) /* size + version */
 #define FS_IOC_ADD_ENCRYPTION_KEY              _IOWR('f', 23, struct fscrypt_add_key_arg)
 #define FS_IOC_REMOVE_ENCRYPTION_KEY           _IOWR('f', 24, struct fscrypt_remove_key_arg)
@@ -170,6 +169,7 @@ struct fscrypt_get_key_status_arg {
 
 /* old names; don't add anything new here! */
 #ifndef __KERNEL__
+#define fscrypt_policy                 fscrypt_policy_v1
 #define FS_KEY_DESCRIPTOR_SIZE         FSCRYPT_KEY_DESCRIPTOR_SIZE
 #define FS_POLICY_FLAGS_PAD_4          FSCRYPT_POLICY_FLAGS_PAD_4
 #define FS_POLICY_FLAGS_PAD_8          FSCRYPT_POLICY_FLAGS_PAD_8
index 7d8eced..ca41220 100644 (file)
@@ -248,6 +248,8 @@ struct kvm_hyperv_exit {
 #define KVM_EXIT_IOAPIC_EOI       26
 #define KVM_EXIT_HYPERV           27
 #define KVM_EXIT_ARM_NISV         28
+#define KVM_EXIT_X86_RDMSR        29
+#define KVM_EXIT_X86_WRMSR        30
 
 /* For KVM_EXIT_INTERNAL_ERROR */
 /* Emulate instruction failed. */
@@ -413,6 +415,17 @@ struct kvm_run {
                        __u64 esr_iss;
                        __u64 fault_ipa;
                } arm_nisv;
+               /* KVM_EXIT_X86_RDMSR / KVM_EXIT_X86_WRMSR */
+               struct {
+                       __u8 error; /* user -> kernel */
+                       __u8 pad[7];
+#define KVM_MSR_EXIT_REASON_INVAL      (1 << 0)
+#define KVM_MSR_EXIT_REASON_UNKNOWN    (1 << 1)
+#define KVM_MSR_EXIT_REASON_FILTER     (1 << 2)
+                       __u32 reason; /* kernel -> user */
+                       __u32 index; /* kernel -> user */
+                       __u64 data; /* kernel <-> user */
+               } msr;
                /* Fix the size of the union. */
                char padding[256];
        };
@@ -1037,6 +1050,9 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_SMALLER_MAXPHYADDR 185
 #define KVM_CAP_S390_DIAG318 186
 #define KVM_CAP_STEAL_TIME 187
+#define KVM_CAP_X86_USER_SPACE_MSR 188
+#define KVM_CAP_X86_MSR_FILTER 189
+#define KVM_CAP_ENFORCE_PV_FEATURE_CPUID 190
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
@@ -1538,6 +1554,9 @@ struct kvm_pv_cmd {
 /* Available with KVM_CAP_S390_PROTECTED */
 #define KVM_S390_PV_COMMAND            _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd)
 
+/* Available with KVM_CAP_X86_MSR_FILTER */
+#define KVM_X86_SET_MSR_FILTER _IOW(KVMIO,  0xc6, struct kvm_msr_filter)
+
 /* Secure Encrypted Virtualization command */
 enum sev_cmd_id {
        /* Guest initialization commands */
index 923cc16..f55bc68 100644 (file)
@@ -27,6 +27,7 @@
 #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
 #define MAP_HUGE_MASK  HUGETLB_FLAG_ENCODE_MASK
 
+#define MAP_HUGE_16KB  HUGETLB_FLAG_ENCODE_16KB
 #define MAP_HUGE_64KB  HUGETLB_FLAG_ENCODE_64KB
 #define MAP_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB
 #define MAP_HUGE_1MB   HUGETLB_FLAG_ENCODE_1MB
index 96a0240..dd8306e 100644 (file)
@@ -16,6 +16,7 @@
 #define MS_REMOUNT     32      /* Alter flags of a mounted FS */
 #define MS_MANDLOCK    64      /* Allow mandatory locks on an FS */
 #define MS_DIRSYNC     128     /* Directory modifications are synchronous */
+#define MS_NOSYMFOLLOW 256     /* Do not follow symlinks */
 #define MS_NOATIME     1024    /* Do not update access times. */
 #define MS_NODIRATIME  2048    /* Do not update directory access times */
 #define MS_BIND                4096
index 3e5dcdd..b95d3c4 100644 (file)
@@ -1196,7 +1196,7 @@ union perf_mem_data_src {
 
 #define PERF_MEM_SNOOPX_FWD    0x01 /* forward */
 /* 1 free */
-#define PERF_MEM_SNOOPX_SHIFT  38
+#define PERF_MEM_SNOOPX_SHIFT  38
 
 /* locked instruction */
 #define PERF_MEM_LOCK_NA       0x01 /* not available */
index 07b4f81..7f08277 100644 (file)
@@ -233,6 +233,15 @@ struct prctl_mm_map {
 #define PR_SET_TAGGED_ADDR_CTRL                55
 #define PR_GET_TAGGED_ADDR_CTRL                56
 # define PR_TAGGED_ADDR_ENABLE         (1UL << 0)
+/* MTE tag check fault modes */
+# define PR_MTE_TCF_SHIFT              1
+# define PR_MTE_TCF_NONE               (0UL << PR_MTE_TCF_SHIFT)
+# define PR_MTE_TCF_SYNC               (1UL << PR_MTE_TCF_SHIFT)
+# define PR_MTE_TCF_ASYNC              (2UL << PR_MTE_TCF_SHIFT)
+# define PR_MTE_TCF_MASK               (3UL << PR_MTE_TCF_SHIFT)
+/* MTE tag inclusion mask */
+# define PR_MTE_TAG_SHIFT              3
+# define PR_MTE_TAG_MASK               (0xffffUL << PR_MTE_TAG_SHIFT)
 
 /* Control reclaim behavior when allocating memory */
 #define PR_SET_IO_FLUSHER              57
index 7523218..c998860 100644 (file)
 
 /* Set event fd for config interrupt*/
 #define VHOST_VDPA_SET_CONFIG_CALL     _IOW(VHOST_VIRTIO, 0x77, int)
+
+/* Get the valid iova range */
+#define VHOST_VDPA_GET_IOVA_RANGE      _IOR(VHOST_VIRTIO, 0x78, \
+                                            struct vhost_vdpa_iova_range)
 #endif
index d9b385f..10a4c4c 100644 (file)
@@ -15,6 +15,9 @@
 static inline size_t hash_bits(size_t h, int bits)
 {
        /* shuffle bits and return requested number of upper bits */
+       if (bits == 0)
+               return 0;
+
 #if (__SIZEOF_SIZE_T__ == __SIZEOF_LONG_LONG__)
        /* LP64 case */
        return (h * 11400714819323198485llu) >> (__SIZEOF_LONG_LONG__ * 8 - bits);
@@ -174,17 +177,17 @@ bool hashmap__find(const struct hashmap *map, const void *key, void **value);
  * @key: key to iterate entries for
  */
 #define hashmap__for_each_key_entry(map, cur, _key)                        \
-       for (cur = ({ size_t bkt = hash_bits(map->hash_fn((_key), map->ctx),\
-                                            map->cap_bits);                \
-                    map->buckets ? map->buckets[bkt] : NULL; });           \
+       for (cur = map->buckets                                             \
+                    ? map->buckets[hash_bits(map->hash_fn((_key), map->ctx), map->cap_bits)] \
+                    : NULL;                                                \
             cur;                                                           \
             cur = cur->next)                                               \
                if (map->equal_fn(cur->key, (_key), map->ctx))
 
 #define hashmap__for_each_key_entry_safe(map, cur, tmp, _key)              \
-       for (cur = ({ size_t bkt = hash_bits(map->hash_fn((_key), map->ctx),\
-                                            map->cap_bits);                \
-                    cur = map->buckets ? map->buckets[bkt] : NULL; });     \
+       for (cur = map->buckets                                             \
+                    ? map->buckets[hash_bits(map->hash_fn((_key), map->ctx), map->cap_bits)] \
+                    : NULL;                                                \
             cur && ({ tmp = cur->next; true; });                           \
             cur = tmp)                                                     \
                if (map->equal_fn(cur->key, (_key), map->ctx))
index e3c98c0..9bc537d 100644 (file)
@@ -891,13 +891,16 @@ int xsk_umem__delete(struct xsk_umem *umem)
 void xsk_socket__delete(struct xsk_socket *xsk)
 {
        size_t desc_sz = sizeof(struct xdp_desc);
-       struct xsk_ctx *ctx = xsk->ctx;
        struct xdp_mmap_offsets off;
+       struct xsk_umem *umem;
+       struct xsk_ctx *ctx;
        int err;
 
        if (!xsk)
                return;
 
+       ctx = xsk->ctx;
+       umem = ctx->umem;
        if (ctx->prog_fd != -1) {
                xsk_delete_bpf_maps(xsk);
                close(ctx->prog_fd);
@@ -917,11 +920,11 @@ void xsk_socket__delete(struct xsk_socket *xsk)
 
        xsk_put_ctx(ctx);
 
-       ctx->umem->refcount--;
+       umem->refcount--;
        /* Do not close an fd that also has an associated umem connected
         * to it.
         */
-       if (xsk->fd != ctx->umem->fd)
+       if (xsk->fd != umem->fd)
                close(xsk->fd);
        free(xsk);
 }
index 6890fc4..ce8516e 100644 (file)
@@ -749,6 +749,7 @@ else
   PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
   PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
   PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
+  PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
   PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
   FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
 
index 3478096..3798192 100644 (file)
 437    common  openat2                 sys_openat2
 438    common  pidfd_getfd             sys_pidfd_getfd
 439    common  faccessat2              sys_faccessat2
+440    common  process_madvise         sys_process_madvise
 
 #
-# x32-specific system call numbers start at 512 to avoid cache impact
-# for native 64-bit operation. The __x32_compat_sys stubs are created
-# on-the-fly for compat_sys_*() compatibility system calls if X86_X32
-# is defined.
+# Due to a historical design error, certain syscalls are numbered differently
+# in x32 as compared to native x86_64.  These syscalls have numbers 512-547.
+# Do not add new syscalls to this range.  Numbers 548 and above are available
+# for non-x32 use.
 #
 512    x32     rt_sigaction            compat_sys_rt_sigaction
 513    x32     rt_sigreturn            compat_sys_x32_rt_sigreturn
 545    x32     execveat                compat_sys_execveat
 546    x32     preadv2                 compat_sys_preadv64v2
 547    x32     pwritev2                compat_sys_pwritev64v2
+# This is the end of the legacy x32 range.  Numbers 548 and above are
+# not special and are not to be used for x32-specific syscalls.
index 44a75f2..de80534 100644 (file)
@@ -4639,9 +4639,9 @@ do_concat:
        err = 0;
 
        if (lists[0]) {
-               struct option o = OPT_CALLBACK('e', "event", &trace->evlist, "event",
-                                              "event selector. use 'perf list' to list available events",
-                                              parse_events_option);
+               struct option o = {
+                       .value = &trace->evlist,
+               };
                err = parse_events_option(&o, lists[0], 0);
        }
 out:
@@ -4655,9 +4655,12 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int u
 {
        struct trace *trace = opt->value;
 
-       if (!list_empty(&trace->evlist->core.entries))
-               return parse_cgroups(opt, str, unset);
-
+       if (!list_empty(&trace->evlist->core.entries)) {
+               struct option o = {
+                       .value = &trace->evlist,
+               };
+               return parse_cgroups(&o, str, unset);
+       }
        trace->cgroup = evlist__findnew_cgroup(trace->evlist, str);
 
        return 0;
index de31935..00f4fcf 100644 (file)
     },
     {
         "BriefDescription": "Average external Memory Bandwidth Use for reads and writes [GB / sec]",
-        "MetricExpr": "( 64 * ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) / 1000000000 ) / duration_time",
+        "MetricExpr": "( ( ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) * 1048576 ) / 1000000000 ) / duration_time",
         "MetricGroup": "Memory_BW;SoC",
         "MetricName": "DRAM_BW_Use"
     },
index f31794d..0dd8b13 100644 (file)
     },
     {
         "BriefDescription": "Average external Memory Bandwidth Use for reads and writes [GB / sec]",
-        "MetricExpr": "( 64 * ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) / 1000000000 ) / duration_time",
+        "MetricExpr": "( ( ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) * 1048576 ) / 1000000000 ) / duration_time",
         "MetricGroup": "Memory_BW;SoC",
         "MetricName": "DRAM_BW_Use"
     },
index 2491d16..8363809 100644 (file)
@@ -95,7 +95,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
        return strcmp((const char *) symbol, funcs[idx]);
 }
 
-__no_tail_call noinline int test_dwarf_unwind__thread(struct thread *thread)
+noinline int test_dwarf_unwind__thread(struct thread *thread)
 {
        struct perf_sample sample;
        unsigned long cnt = 0;
@@ -126,7 +126,7 @@ __no_tail_call noinline int test_dwarf_unwind__thread(struct thread *thread)
 
 static int global_unwind_retval = -INT_MAX;
 
-__no_tail_call noinline int test_dwarf_unwind__compare(void *p1, void *p2)
+noinline int test_dwarf_unwind__compare(void *p1, void *p2)
 {
        /* Any possible value should be 'thread' */
        struct thread *thread = *(struct thread **)p1;
@@ -145,7 +145,7 @@ __no_tail_call noinline int test_dwarf_unwind__compare(void *p1, void *p2)
        return p1 - p2;
 }
 
-__no_tail_call noinline int test_dwarf_unwind__krava_3(struct thread *thread)
+noinline int test_dwarf_unwind__krava_3(struct thread *thread)
 {
        struct thread *array[2] = {thread, thread};
        void *fp = &bsearch;
@@ -164,12 +164,12 @@ __no_tail_call noinline int test_dwarf_unwind__krava_3(struct thread *thread)
        return global_unwind_retval;
 }
 
-__no_tail_call noinline int test_dwarf_unwind__krava_2(struct thread *thread)
+noinline int test_dwarf_unwind__krava_2(struct thread *thread)
 {
        return test_dwarf_unwind__krava_3(thread);
 }
 
-__no_tail_call noinline int test_dwarf_unwind__krava_1(struct thread *thread)
+noinline int test_dwarf_unwind__krava_1(struct thread *thread)
 {
        return test_dwarf_unwind__krava_2(thread);
 }
index a07626f..b0e1880 100644 (file)
@@ -2963,7 +2963,7 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,
        struct popup_action actions[MAX_OPTIONS];
        int nr_options = 0;
        int key = -1;
-       char buf[64];
+       char buf[128];
        int delay_secs = hbt ? hbt->refresh : 0;
 
 #define HIST_BROWSER_HELP_COMMON                                       \
index 8763772..6b410c3 100644 (file)
@@ -102,6 +102,8 @@ int build_id__sprintf(const struct build_id *build_id, char *bf)
        const u8 *raw = build_id->data;
        size_t i;
 
+       bf[0] = 0x0;
+
        for (i = 0; i < build_id->size; ++i) {
                sprintf(bid, "%02x", *raw);
                ++raw;
index a405dad..3c20b12 100644 (file)
@@ -15,6 +15,9 @@
 /* make sure libbpf doesn't use kernel-only integer typedefs */
 #pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
 
+/* prevent accidental re-addition of reallocarray() */
+#pragma GCC poison reallocarray
+
 /* start with 4 buckets */
 #define HASHMAP_MIN_CAP_BITS 2
 
index e0af36b..d9b385f 100644 (file)
@@ -25,6 +25,18 @@ static inline size_t hash_bits(size_t h, int bits)
 #endif
 }
 
+/* generic C-string hashing function */
+static inline size_t str_hash(const char *s)
+{
+       size_t h = 0;
+
+       while (*s) {
+               h = h * 31 + *s;
+               s++;
+       }
+       return h;
+}
+
 typedef size_t (*hashmap_hash_fn)(const void *key, void *ctx);
 typedef bool (*hashmap_equal_fn)(const void *key1, const void *key2, void *ctx);
 
index 7d4194f..15385ea 100644 (file)
@@ -786,11 +786,20 @@ static int machine__process_ksymbol_unregister(struct machine *machine,
                                               union perf_event *event,
                                               struct perf_sample *sample __maybe_unused)
 {
+       struct symbol *sym;
        struct map *map;
 
        map = maps__find(&machine->kmaps, event->ksymbol.addr);
-       if (map)
+       if (!map)
+               return 0;
+
+       if (map != machine->vmlinux_map)
                maps__remove(&machine->kmaps, map);
+       else {
+               sym = dso__find_symbol(map->dso, map->map_ip(map, map->start));
+               if (sym)
+                       dso__delete_symbol(map->dso, sym);
+       }
 
        return 0;
 }
index 7cbd024..c83c2c6 100644 (file)
@@ -1592,7 +1592,6 @@ static void _free_command_line(wchar_t **command_line, int num)
 static int python_start_script(const char *script, int argc, const char **argv)
 {
        struct tables *tables = &tables_global;
-       PyMODINIT_FUNC (*initfunc)(void);
 #if PY_MAJOR_VERSION < 3
        const char **command_line;
 #else
@@ -1607,20 +1606,18 @@ static int python_start_script(const char *script, int argc, const char **argv)
        FILE *fp;
 
 #if PY_MAJOR_VERSION < 3
-       initfunc = initperf_trace_context;
        command_line = malloc((argc + 1) * sizeof(const char *));
        command_line[0] = script;
        for (i = 1; i < argc + 1; i++)
                command_line[i] = argv[i - 1];
+       PyImport_AppendInittab(name, initperf_trace_context);
 #else
-       initfunc = PyInit_perf_trace_context;
        command_line = malloc((argc + 1) * sizeof(wchar_t *));
        command_line[0] = Py_DecodeLocale(script, NULL);
        for (i = 1; i < argc + 1; i++)
                command_line[i] = Py_DecodeLocale(argv[i - 1], NULL);
+       PyImport_AppendInittab(name, PyInit_perf_trace_context);
 #endif
-
-       PyImport_AppendInittab(name, initfunc);
        Py_Initialize();
 
 #if PY_MAJOR_VERSION < 3
index 7a5f037..0980802 100644 (file)
@@ -595,6 +595,7 @@ static void perf_event__mmap2_swap(union perf_event *event,
        event->mmap2.maj   = bswap_32(event->mmap2.maj);
        event->mmap2.min   = bswap_32(event->mmap2.min);
        event->mmap2.ino   = bswap_64(event->mmap2.ino);
+       event->mmap2.ino_generation = bswap_64(event->mmap2.ino_generation);
 
        if (sample_id_all) {
                void *data = &event->mmap2.filename;
@@ -710,6 +711,18 @@ static void perf_event__namespaces_swap(union perf_event *event,
                swap_sample_id_all(event, &event->namespaces.link_info[i]);
 }
 
+static void perf_event__cgroup_swap(union perf_event *event, bool sample_id_all)
+{
+       event->cgroup.id = bswap_64(event->cgroup.id);
+
+       if (sample_id_all) {
+               void *data = &event->cgroup.path;
+
+               data += PERF_ALIGN(strlen(data) + 1, sizeof(u64));
+               swap_sample_id_all(event, data);
+       }
+}
+
 static u8 revbyte(u8 b)
 {
        int rev = (b >> 4) | ((b & 0xf) << 4);
@@ -952,6 +965,7 @@ static perf_event__swap_op perf_event__swap_ops[] = {
        [PERF_RECORD_SWITCH]              = perf_event__switch_swap,
        [PERF_RECORD_SWITCH_CPU_WIDE]     = perf_event__switch_swap,
        [PERF_RECORD_NAMESPACES]          = perf_event__namespaces_swap,
+       [PERF_RECORD_CGROUP]              = perf_event__cgroup_swap,
        [PERF_RECORD_TEXT_POKE]           = perf_event__text_poke_swap,
        [PERF_RECORD_HEADER_ATTR]         = perf_event__hdr_attr_swap,
        [PERF_RECORD_HEADER_EVENT_TYPE]   = perf_event__event_type_swap,
index 6138866..0d14abd 100644 (file)
@@ -515,6 +515,13 @@ void dso__insert_symbol(struct dso *dso, struct symbol *sym)
        }
 }
 
+void dso__delete_symbol(struct dso *dso, struct symbol *sym)
+{
+       rb_erase_cached(&sym->rb_node, &dso->symbols);
+       symbol__delete(sym);
+       dso__reset_find_symbol_cache(dso);
+}
+
 struct symbol *dso__find_symbol(struct dso *dso, u64 addr)
 {
        if (dso->last_find_result.addr != addr || dso->last_find_result.symbol == NULL) {
index f4801c4..954d6a0 100644 (file)
@@ -131,6 +131,8 @@ int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map);
 
 void dso__insert_symbol(struct dso *dso,
                        struct symbol *sym);
+void dso__delete_symbol(struct dso *dso,
+                       struct symbol *sym);
 
 struct symbol *dso__find_symbol(struct dso *dso, u64 addr);
 struct symbol *dso__find_symbol_by_name(struct dso *dso, const char *name);
index c862249..c7bcddb 100644 (file)
@@ -51,7 +51,7 @@ DESTDIR ?=
 # Package-related definitions. Distributions can modify the version
 # and _should_ modify the PACKAGE_BUGREPORT definition
 
-VERSION                      $(shell ./utils/version-gen.sh)
+VERSION:=                      $(shell ./utils/version-gen.sh)
 LIB_MAJ=                       0.0.1
 LIB_MIN=                       0
 
index e5e926f..befd837 100644 (file)
@@ -71,7 +71,7 @@ int main (void)
                printf("\tsmi_cmd=0x?? smi_port=0x?? smi_sig=1\n");
                printf("\nUnfortunately, you have to know what exactly are "
                       "smi_cmd and smi_port, and this\nis system "
-                      "dependant.\n");
+                      "dependent.\n");
        }
        return 1;
 }
index 2b65512..f3e3c94 100644 (file)
@@ -12,11 +12,12 @@ turbostat : turbostat.c
 override CFLAGS +=     -O2 -Wall -I../../../include
 override CFLAGS +=     -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
 override CFLAGS +=     -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"'
+override CFLAGS +=     -D_FILE_OFFSET_BITS=64
 override CFLAGS +=     -D_FORTIFY_SOURCE=2
 
 %: %.c
        @mkdir -p $(BUILD_OUTPUT)
-       $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS) -lcap
+       $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS) -lcap -lrt
 
 .PHONY : clean
 clean :
index a6db83a..f6b7e85 100644 (file)
@@ -335,7 +335,7 @@ that they count at TSC rate, which is true on all processors tested to date.
 
 .SH REFERENCES
 Volume 3B: System Programming Guide"
-http://www.intel.com/products/processor/manuals/
+https://www.intel.com/products/processor/manuals/
 
 .SH FILES
 .ta
index 33b3708..f3a1746 100644 (file)
@@ -79,6 +79,7 @@ unsigned long long  gfx_cur_rc6_ms;
 unsigned long long cpuidle_cur_cpu_lpi_us;
 unsigned long long cpuidle_cur_sys_lpi_us;
 unsigned int gfx_cur_mhz;
+unsigned int gfx_act_mhz;
 unsigned int tcc_activation_temp;
 unsigned int tcc_activation_temp_override;
 double rapl_power_units, rapl_time_units;
@@ -210,13 +211,14 @@ struct pkg_data {
        unsigned long long pkg_both_core_gfxe_c0;
        long long gfx_rc6_ms;
        unsigned int gfx_mhz;
+       unsigned int gfx_act_mhz;
        unsigned int package_id;
-       unsigned int energy_pkg;        /* MSR_PKG_ENERGY_STATUS */
-       unsigned int energy_dram;       /* MSR_DRAM_ENERGY_STATUS */
-       unsigned int energy_cores;      /* MSR_PP0_ENERGY_STATUS */
-       unsigned int energy_gfx;        /* MSR_PP1_ENERGY_STATUS */
-       unsigned int rapl_pkg_perf_status;      /* MSR_PKG_PERF_STATUS */
-       unsigned int rapl_dram_perf_status;     /* MSR_DRAM_PERF_STATUS */
+       unsigned long long energy_pkg;  /* MSR_PKG_ENERGY_STATUS */
+       unsigned long long energy_dram; /* MSR_DRAM_ENERGY_STATUS */
+       unsigned long long energy_cores;        /* MSR_PP0_ENERGY_STATUS */
+       unsigned long long energy_gfx;  /* MSR_PP1_ENERGY_STATUS */
+       unsigned long long rapl_pkg_perf_status;        /* MSR_PKG_PERF_STATUS */
+       unsigned long long rapl_dram_perf_status;       /* MSR_DRAM_PERF_STATUS */
        unsigned int pkg_temp_c;
        unsigned long long counter[MAX_ADDED_COUNTERS];
 } *package_even, *package_odd;
@@ -259,6 +261,113 @@ struct msr_counter {
 #define        SYSFS_PERCPU    (1 << 1)
 };
 
+/*
+ * The accumulated sum of MSR is defined as a monotonic
+ * increasing MSR, it will be accumulated periodically,
+ * despite its register's bit width.
+ */
+enum {
+       IDX_PKG_ENERGY,
+       IDX_DRAM_ENERGY,
+       IDX_PP0_ENERGY,
+       IDX_PP1_ENERGY,
+       IDX_PKG_PERF,
+       IDX_DRAM_PERF,
+       IDX_COUNT,
+};
+
+int get_msr_sum(int cpu, off_t offset, unsigned long long *msr);
+
+struct msr_sum_array {
+       /* get_msr_sum() = sum + (get_msr() - last) */
+       struct {
+               /*The accumulated MSR value is updated by the timer*/
+               unsigned long long sum;
+               /*The MSR footprint recorded in last timer*/
+               unsigned long long last;
+       } entries[IDX_COUNT];
+};
+
+/* The percpu MSR sum array.*/
+struct msr_sum_array *per_cpu_msr_sum;
+
+int idx_to_offset(int idx)
+{
+       int offset;
+
+       switch (idx) {
+       case IDX_PKG_ENERGY:
+               offset = MSR_PKG_ENERGY_STATUS;
+               break;
+       case IDX_DRAM_ENERGY:
+               offset = MSR_DRAM_ENERGY_STATUS;
+               break;
+       case IDX_PP0_ENERGY:
+               offset = MSR_PP0_ENERGY_STATUS;
+               break;
+       case IDX_PP1_ENERGY:
+               offset = MSR_PP1_ENERGY_STATUS;
+               break;
+       case IDX_PKG_PERF:
+               offset = MSR_PKG_PERF_STATUS;
+               break;
+       case IDX_DRAM_PERF:
+               offset = MSR_DRAM_PERF_STATUS;
+               break;
+       default:
+               offset = -1;
+       }
+       return offset;
+}
+
+int offset_to_idx(int offset)
+{
+       int idx;
+
+       switch (offset) {
+       case MSR_PKG_ENERGY_STATUS:
+               idx = IDX_PKG_ENERGY;
+               break;
+       case MSR_DRAM_ENERGY_STATUS:
+               idx = IDX_DRAM_ENERGY;
+               break;
+       case MSR_PP0_ENERGY_STATUS:
+               idx = IDX_PP0_ENERGY;
+               break;
+       case MSR_PP1_ENERGY_STATUS:
+               idx = IDX_PP1_ENERGY;
+               break;
+       case MSR_PKG_PERF_STATUS:
+               idx = IDX_PKG_PERF;
+               break;
+       case MSR_DRAM_PERF_STATUS:
+               idx = IDX_DRAM_PERF;
+               break;
+       default:
+               idx = -1;
+       }
+       return idx;
+}
+
+int idx_valid(int idx)
+{
+       switch (idx) {
+       case IDX_PKG_ENERGY:
+               return do_rapl & RAPL_PKG;
+       case IDX_DRAM_ENERGY:
+               return do_rapl & RAPL_DRAM;
+       case IDX_PP0_ENERGY:
+               return do_rapl & RAPL_CORES_ENERGY_STATUS;
+       case IDX_PP1_ENERGY:
+               return do_rapl & RAPL_GFX;
+       case IDX_PKG_PERF:
+               return do_rapl & RAPL_PKG_PERF_STATUS;
+       case IDX_DRAM_PERF:
+               return do_rapl & RAPL_DRAM_PERF_STATUS;
+       default:
+               return 0;
+       }
+}
 struct sys_counters {
        unsigned int added_thread_counters;
        unsigned int added_core_counters;
@@ -451,6 +560,7 @@ struct msr_counter bic[] = {
        { 0x0, "APIC" },
        { 0x0, "X2APIC" },
        { 0x0, "Die" },
+       { 0x0, "GFXAMHz" },
 };
 
 #define MAX_BIC (sizeof(bic) / sizeof(struct msr_counter))
@@ -505,6 +615,7 @@ struct msr_counter bic[] = {
 #define        BIC_APIC        (1ULL << 48)
 #define        BIC_X2APIC      (1ULL << 49)
 #define        BIC_Die         (1ULL << 50)
+#define        BIC_GFXACTMHz   (1ULL << 51)
 
 #define BIC_DISABLED_BY_DEFAULT        (BIC_USEC | BIC_TOD | BIC_APIC | BIC_X2APIC)
 
@@ -724,6 +835,9 @@ void print_header(char *delim)
        if (DO_BIC(BIC_GFXMHz))
                outp += sprintf(outp, "%sGFXMHz", (printed++ ? delim : ""));
 
+       if (DO_BIC(BIC_GFXACTMHz))
+               outp += sprintf(outp, "%sGFXAMHz", (printed++ ? delim : ""));
+
        if (DO_BIC(BIC_Totl_c0))
                outp += sprintf(outp, "%sTotl%%C0", (printed++ ? delim : ""));
        if (DO_BIC(BIC_Any_c0))
@@ -858,13 +972,13 @@ int dump_counters(struct thread_data *t, struct core_data *c,
                outp += sprintf(outp, "pc10: %016llX\n", p->pc10);
                outp += sprintf(outp, "cpu_lpi: %016llX\n", p->cpu_lpi);
                outp += sprintf(outp, "sys_lpi: %016llX\n", p->sys_lpi);
-               outp += sprintf(outp, "Joules PKG: %0X\n", p->energy_pkg);
-               outp += sprintf(outp, "Joules COR: %0X\n", p->energy_cores);
-               outp += sprintf(outp, "Joules GFX: %0X\n", p->energy_gfx);
-               outp += sprintf(outp, "Joules RAM: %0X\n", p->energy_dram);
-               outp += sprintf(outp, "Throttle PKG: %0X\n",
+               outp += sprintf(outp, "Joules PKG: %0llX\n", p->energy_pkg);
+               outp += sprintf(outp, "Joules COR: %0llX\n", p->energy_cores);
+               outp += sprintf(outp, "Joules GFX: %0llX\n", p->energy_gfx);
+               outp += sprintf(outp, "Joules RAM: %0llX\n", p->energy_dram);
+               outp += sprintf(outp, "Throttle PKG: %0llX\n",
                        p->rapl_pkg_perf_status);
-               outp += sprintf(outp, "Throttle RAM: %0X\n",
+               outp += sprintf(outp, "Throttle RAM: %0llX\n",
                        p->rapl_dram_perf_status);
                outp += sprintf(outp, "PTM: %dC\n", p->pkg_temp_c);
 
@@ -1062,14 +1176,7 @@ int format_counters(struct thread_data *t, struct core_data *c,
                }
        }
 
-       /*
-        * If measurement interval exceeds minimum RAPL Joule Counter range,
-        * indicate that results are suspect by printing "**" in fraction place.
-        */
-       if (interval_float < rapl_joule_counter_range)
-               fmt8 = "%s%.2f";
-       else
-               fmt8 = "%6.0f**";
+       fmt8 = "%s%.2f";
 
        if (DO_BIC(BIC_CorWatt) && (do_rapl & RAPL_PER_CORE_ENERGY))
                outp += sprintf(outp, fmt8, (printed++ ? delim : ""), c->core_energy * rapl_energy_units / interval_float);
@@ -1098,6 +1205,10 @@ int format_counters(struct thread_data *t, struct core_data *c,
        if (DO_BIC(BIC_GFXMHz))
                outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), p->gfx_mhz);
 
+       /* GFXACTMHz */
+       if (DO_BIC(BIC_GFXACTMHz))
+               outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), p->gfx_act_mhz);
+
        /* Totl%C0, Any%C0 GFX%C0 CPUGFX% */
        if (DO_BIC(BIC_Totl_c0))
                outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_wtd_core_c0/tsc);
@@ -1210,11 +1321,7 @@ void format_all_counters(struct thread_data *t, struct core_data *c, struct pkg_
 }
 
 #define DELTA_WRAP32(new, old)                 \
-       if (new > old) {                        \
-               old = new - old;                \
-       } else {                                \
-               old = 0x100000000 + new - old;  \
-       }
+       old = ((((unsigned long long)new << 32) - ((unsigned long long)old << 32)) >> 32);
 
 int
 delta_package(struct pkg_data *new, struct pkg_data *old)
@@ -1253,13 +1360,14 @@ delta_package(struct pkg_data *new, struct pkg_data *old)
                old->gfx_rc6_ms = new->gfx_rc6_ms - old->gfx_rc6_ms;
 
        old->gfx_mhz = new->gfx_mhz;
+       old->gfx_act_mhz = new->gfx_act_mhz;
 
-       DELTA_WRAP32(new->energy_pkg, old->energy_pkg);
-       DELTA_WRAP32(new->energy_cores, old->energy_cores);
-       DELTA_WRAP32(new->energy_gfx, old->energy_gfx);
-       DELTA_WRAP32(new->energy_dram, old->energy_dram);
-       DELTA_WRAP32(new->rapl_pkg_perf_status, old->rapl_pkg_perf_status);
-       DELTA_WRAP32(new->rapl_dram_perf_status, old->rapl_dram_perf_status);
+       old->energy_pkg = new->energy_pkg - old->energy_pkg;
+       old->energy_cores = new->energy_cores - old->energy_cores;
+       old->energy_gfx = new->energy_gfx - old->energy_gfx;
+       old->energy_dram = new->energy_dram - old->energy_dram;
+       old->rapl_pkg_perf_status = new->rapl_pkg_perf_status - old->rapl_pkg_perf_status;
+       old->rapl_dram_perf_status = new->rapl_dram_perf_status - old->rapl_dram_perf_status;
 
        for (i = 0, mp = sys.pp; mp; i++, mp = mp->next) {
                if (mp->format == FORMAT_RAW)
@@ -1469,6 +1577,7 @@ void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data
 
        p->gfx_rc6_ms = 0;
        p->gfx_mhz = 0;
+       p->gfx_act_mhz = 0;
        for (i = 0, mp = sys.tp; mp; i++, mp = mp->next)
                t->counter[i] = 0;
 
@@ -1564,6 +1673,7 @@ int sum_counters(struct thread_data *t, struct core_data *c,
 
        average.packages.gfx_rc6_ms = p->gfx_rc6_ms;
        average.packages.gfx_mhz = p->gfx_mhz;
+       average.packages.gfx_act_mhz = p->gfx_act_mhz;
 
        average.packages.pkg_temp_c = MAX(average.packages.pkg_temp_c, p->pkg_temp_c);
 
@@ -1784,7 +1894,7 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
        int i;
 
        if (cpu_migrate(cpu)) {
-               fprintf(outf, "Could not migrate to CPU %d\n", cpu);
+               fprintf(outf, "get_counters: Could not migrate to CPU %d\n", cpu);
                return -1;
        }
 
@@ -1966,39 +2076,39 @@ retry:
                p->sys_lpi = cpuidle_cur_sys_lpi_us;
 
        if (do_rapl & RAPL_PKG) {
-               if (get_msr(cpu, MSR_PKG_ENERGY_STATUS, &msr))
+               if (get_msr_sum(cpu, MSR_PKG_ENERGY_STATUS, &msr))
                        return -13;
-               p->energy_pkg = msr & 0xFFFFFFFF;
+               p->energy_pkg = msr;
        }
        if (do_rapl & RAPL_CORES_ENERGY_STATUS) {
-               if (get_msr(cpu, MSR_PP0_ENERGY_STATUS, &msr))
+               if (get_msr_sum(cpu, MSR_PP0_ENERGY_STATUS, &msr))
                        return -14;
-               p->energy_cores = msr & 0xFFFFFFFF;
+               p->energy_cores = msr;
        }
        if (do_rapl & RAPL_DRAM) {
-               if (get_msr(cpu, MSR_DRAM_ENERGY_STATUS, &msr))
+               if (get_msr_sum(cpu, MSR_DRAM_ENERGY_STATUS, &msr))
                        return -15;
-               p->energy_dram = msr & 0xFFFFFFFF;
+               p->energy_dram = msr;
        }
        if (do_rapl & RAPL_GFX) {
-               if (get_msr(cpu, MSR_PP1_ENERGY_STATUS, &msr))
+               if (get_msr_sum(cpu, MSR_PP1_ENERGY_STATUS, &msr))
                        return -16;
-               p->energy_gfx = msr & 0xFFFFFFFF;
+               p->energy_gfx = msr;
        }
        if (do_rapl & RAPL_PKG_PERF_STATUS) {
-               if (get_msr(cpu, MSR_PKG_PERF_STATUS, &msr))
+               if (get_msr_sum(cpu, MSR_PKG_PERF_STATUS, &msr))
                        return -16;
-               p->rapl_pkg_perf_status = msr & 0xFFFFFFFF;
+               p->rapl_pkg_perf_status = msr;
        }
        if (do_rapl & RAPL_DRAM_PERF_STATUS) {
-               if (get_msr(cpu, MSR_DRAM_PERF_STATUS, &msr))
+               if (get_msr_sum(cpu, MSR_DRAM_PERF_STATUS, &msr))
                        return -16;
-               p->rapl_dram_perf_status = msr & 0xFFFFFFFF;
+               p->rapl_dram_perf_status = msr;
        }
        if (do_rapl & RAPL_AMD_F17H) {
-               if (get_msr(cpu, MSR_PKG_ENERGY_STAT, &msr))
+               if (get_msr_sum(cpu, MSR_PKG_ENERGY_STAT, &msr))
                        return -13;
-               p->energy_pkg = msr & 0xFFFFFFFF;
+               p->energy_pkg = msr;
        }
        if (DO_BIC(BIC_PkgTmp)) {
                if (get_msr(cpu, MSR_IA32_PACKAGE_THERM_STATUS, &msr))
@@ -2012,6 +2122,9 @@ retry:
        if (DO_BIC(BIC_GFXMHz))
                p->gfx_mhz = gfx_cur_mhz;
 
+       if (DO_BIC(BIC_GFXACTMHz))
+               p->gfx_act_mhz = gfx_act_mhz;
+
        for (i = 0, mp = sys.pp; mp; i++, mp = mp->next) {
                if (get_mp(cpu, mp, &p->counter[i]))
                        return -10;
@@ -2173,6 +2286,7 @@ int has_turbo_ratio_group_limits(int family, int model)
        case INTEL_FAM6_ATOM_GOLDMONT:
        case INTEL_FAM6_SKYLAKE_X:
        case INTEL_FAM6_ATOM_GOLDMONT_D:
+       case INTEL_FAM6_ATOM_TREMONT_D:
                return 1;
        }
        return 0;
@@ -2650,7 +2764,12 @@ int get_thread_siblings(struct cpu_topology *thiscpu)
 
        sprintf(path,
                "/sys/devices/system/cpu/cpu%d/topology/thread_siblings", cpu);
-       filep = fopen_or_die(path, "r");
+       filep = fopen(path, "r");
+
+       if (!filep) {
+               warnx("%s: open failed", path);
+               return -1;
+       }
        do {
                offset -= BITMASK_SIZE;
                if (fscanf(filep, "%lx%c", &map, &character) != 2)
@@ -2763,18 +2882,25 @@ void re_initialize(void)
 {
        free_all_buffers();
        setup_all_buffers();
-       printf("turbostat: re-initialized with num_cpus %d\n", topo.num_cpus);
+       fprintf(outf, "turbostat: re-initialized with num_cpus %d\n", topo.num_cpus);
 }
 
 void set_max_cpu_num(void)
 {
        FILE *filep;
+       int base_cpu;
        unsigned long dummy;
+       char pathname[64];
+
+       base_cpu = sched_getcpu();
+       if (base_cpu < 0)
+               err(1, "cannot find calling cpu ID");
+       sprintf(pathname,
+               "/sys/devices/system/cpu/cpu%d/topology/thread_siblings",
+               base_cpu);
 
+       filep = fopen_or_die(pathname, "r");
        topo.max_cpu_num = 0;
-       filep = fopen_or_die(
-                       "/sys/devices/system/cpu/cpu0/topology/thread_siblings",
-                       "r");
        while (fscanf(filep, "%lx,", &dummy) == 1)
                topo.max_cpu_num += BITMASK_SIZE;
        fclose(filep);
@@ -2916,6 +3042,33 @@ int snapshot_gfx_mhz(void)
 }
 
 /*
+ * snapshot_gfx_cur_mhz()
+ *
+ * record snapshot of
+ * /sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz
+ *
+ * return 1 if config change requires a restart, else return 0
+ */
+int snapshot_gfx_act_mhz(void)
+{
+       static FILE *fp;
+       int retval;
+
+       if (fp == NULL)
+               fp = fopen_or_die("/sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz", "r");
+       else {
+               rewind(fp);
+               fflush(fp);
+       }
+
+       retval = fscanf(fp, "%d", &gfx_act_mhz);
+       if (retval != 1)
+               err(1, "GFX ACT MHz");
+
+       return 0;
+}
+
+/*
  * snapshot_cpu_lpi()
  *
  * record snapshot of
@@ -2980,6 +3133,9 @@ int snapshot_proc_sysfs_files(void)
        if (DO_BIC(BIC_GFXMHz))
                snapshot_gfx_mhz();
 
+       if (DO_BIC(BIC_GFXACTMHz))
+               snapshot_gfx_act_mhz();
+
        if (DO_BIC(BIC_CPU_LPI))
                snapshot_cpu_lpi_us();
 
@@ -3057,6 +3213,111 @@ void do_sleep(void)
        }
 }
 
+int get_msr_sum(int cpu, off_t offset, unsigned long long *msr)
+{
+       int ret, idx;
+       unsigned long long msr_cur, msr_last;
+
+       if (!per_cpu_msr_sum)
+               return 1;
+
+       idx = offset_to_idx(offset);
+       if (idx < 0)
+               return idx;
+       /* get_msr_sum() = sum + (get_msr() - last) */
+       ret = get_msr(cpu, offset, &msr_cur);
+       if (ret)
+               return ret;
+       msr_last = per_cpu_msr_sum[cpu].entries[idx].last;
+       DELTA_WRAP32(msr_cur, msr_last);
+       *msr = msr_last + per_cpu_msr_sum[cpu].entries[idx].sum;
+
+       return 0;
+}
+
+timer_t timerid;
+
+/* Timer callback, update the sum of MSRs periodically. */
+static int update_msr_sum(struct thread_data *t, struct core_data *c, struct pkg_data *p)
+{
+       int i, ret;
+       int cpu = t->cpu_id;
+
+       for (i = IDX_PKG_ENERGY; i < IDX_COUNT; i++) {
+               unsigned long long msr_cur, msr_last;
+               int offset;
+
+               if (!idx_valid(i))
+                       continue;
+               offset = idx_to_offset(i);
+               if (offset < 0)
+                       continue;
+               ret = get_msr(cpu, offset, &msr_cur);
+               if (ret) {
+                       fprintf(outf, "Can not update msr(0x%x)\n", offset);
+                       continue;
+               }
+
+               msr_last = per_cpu_msr_sum[cpu].entries[i].last;
+               per_cpu_msr_sum[cpu].entries[i].last = msr_cur & 0xffffffff;
+
+               DELTA_WRAP32(msr_cur, msr_last);
+               per_cpu_msr_sum[cpu].entries[i].sum += msr_last;
+       }
+       return 0;
+}
+
+static void
+msr_record_handler(union sigval v)
+{
+       for_all_cpus(update_msr_sum, EVEN_COUNTERS);
+}
+
+void msr_sum_record(void)
+{
+       struct itimerspec its;
+       struct sigevent sev;
+
+       per_cpu_msr_sum = calloc(topo.max_cpu_num + 1, sizeof(struct msr_sum_array));
+       if (!per_cpu_msr_sum) {
+               fprintf(outf, "Can not allocate memory for long time MSR.\n");
+               return;
+       }
+       /*
+        * Signal handler might be restricted, so use thread notifier instead.
+        */
+       memset(&sev, 0, sizeof(struct sigevent));
+       sev.sigev_notify = SIGEV_THREAD;
+       sev.sigev_notify_function = msr_record_handler;
+
+       sev.sigev_value.sival_ptr = &timerid;
+       if (timer_create(CLOCK_REALTIME, &sev, &timerid) == -1) {
+               fprintf(outf, "Can not create timer.\n");
+               goto release_msr;
+       }
+
+       its.it_value.tv_sec = 0;
+       its.it_value.tv_nsec = 1;
+       /*
+        * A wraparound time has been calculated early.
+        * Some sources state that the peak power for a
+        * microprocessor is usually 1.5 times the TDP rating,
+        * use 2 * TDP for safety.
+        */
+       its.it_interval.tv_sec = rapl_joule_counter_range / 2;
+       its.it_interval.tv_nsec = 0;
+
+       if (timer_settime(timerid, 0, &its, NULL) == -1) {
+               fprintf(outf, "Can not set timer.\n");
+               goto release_timer;
+       }
+       return;
+
+ release_timer:
+       timer_delete(timerid);
+ release_msr:
+       free(per_cpu_msr_sum);
+}
 
 void turbostat_loop()
 {
@@ -3075,7 +3336,7 @@ restart:
        if (retval < -1) {
                exit(retval);
        } else if (retval == -1) {
-               if (restarted > 1) {
+               if (restarted > 10) {
                        exit(retval);
                }
                re_initialize();
@@ -3279,6 +3540,7 @@ int probe_nhm_msrs(unsigned int family, unsigned int model)
        case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
        case INTEL_FAM6_ATOM_GOLDMONT_D:        /* DNV */
        case INTEL_FAM6_ATOM_TREMONT:   /* EHL */
+       case INTEL_FAM6_ATOM_TREMONT_D: /* JVL */
                pkg_cstate_limits = glm_pkg_cstate_limits;
                break;
        default:
@@ -3361,6 +3623,17 @@ int is_ehl(unsigned int family, unsigned int model)
        }
        return 0;
 }
+int is_jvl(unsigned int family, unsigned int model)
+{
+       if (!genuine_intel)
+               return 0;
+
+       switch (model) {
+       case INTEL_FAM6_ATOM_TREMONT_D:
+               return 1;
+       }
+       return 0;
+}
 
 int has_turbo_ratio_limit(unsigned int family, unsigned int model)
 {
@@ -3475,6 +3748,20 @@ int has_config_tdp(unsigned int family, unsigned int model)
 }
 
 static void
+remove_underbar(char *s)
+{
+       char *to = s;
+
+       while (*s) {
+               if (*s != '_')
+                       *to++ = *s;
+               s++;
+       }
+
+       *to = 0;
+}
+
+static void
 dump_cstate_pstate_config_info(unsigned int family, unsigned int model)
 {
        if (!do_nhm_platform_info)
@@ -3530,9 +3817,6 @@ dump_sysfs_cstate_config(void)
        int state;
        char *sp;
 
-       if (!DO_BIC(BIC_sysfs))
-               return;
-
        if (access("/sys/devices/system/cpu/cpuidle", R_OK)) {
                fprintf(outf, "cpuidle not loaded\n");
                return;
@@ -3559,6 +3843,8 @@ dump_sysfs_cstate_config(void)
                *sp = '\0';
                fclose(input);
 
+               remove_underbar(name_buf);
+
                sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/desc",
                        base_cpu, state);
                input = fopen(path, "r");
@@ -3645,7 +3931,7 @@ int print_epb(struct thread_data *t, struct core_data *c, struct pkg_data *p)
                return 0;
 
        if (cpu_migrate(cpu)) {
-               fprintf(outf, "Could not migrate to CPU %d\n", cpu);
+               fprintf(outf, "print_epb: Could not migrate to CPU %d\n", cpu);
                return -1;
        }
 
@@ -3689,7 +3975,7 @@ int print_hwp(struct thread_data *t, struct core_data *c, struct pkg_data *p)
                return 0;
 
        if (cpu_migrate(cpu)) {
-               fprintf(outf, "Could not migrate to CPU %d\n", cpu);
+               fprintf(outf, "print_hwp: Could not migrate to CPU %d\n", cpu);
                return -1;
        }
 
@@ -3777,7 +4063,7 @@ int print_perf_limit(struct thread_data *t, struct core_data *c, struct pkg_data
                return 0;
 
        if (cpu_migrate(cpu)) {
-               fprintf(outf, "Could not migrate to CPU %d\n", cpu);
+               fprintf(outf, "print_perf_limit: Could not migrate to CPU %d\n", cpu);
                return -1;
        }
 
@@ -3881,13 +4167,8 @@ double get_tdp_intel(unsigned int model)
 
 double get_tdp_amd(unsigned int family)
 {
-       switch (family) {
-       case 0x17:
-       case 0x18:
-       default:
-               /* This is the max stock TDP of HEDT/Server Fam17h chips */
-               return 250.0;
-       }
+       /* This is the max stock TDP of HEDT/Server Fam17h+ chips */
+       return 280.0;
 }
 
 /*
@@ -3959,6 +4240,14 @@ void rapl_probe_intel(unsigned int family, unsigned int model)
                        BIC_PRESENT(BIC_GFXWatt);
                }
                break;
+       case INTEL_FAM6_ATOM_TREMONT_D: /* JVL */
+               do_rapl = RAPL_PKG | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO;
+               BIC_PRESENT(BIC_PKG__);
+               if (rapl_joules)
+                       BIC_PRESENT(BIC_Pkg_J);
+               else
+                       BIC_PRESENT(BIC_PkgWatt);
+               break;
        case INTEL_FAM6_SKYLAKE_L:      /* SKL */
        case INTEL_FAM6_CANNONLAKE_L:   /* CNL */
                do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_GFX | RAPL_PKG_POWER_INFO;
@@ -4069,27 +4358,20 @@ void rapl_probe_amd(unsigned int family, unsigned int model)
 
        if (max_extended_level >= 0x80000007) {
                __cpuid(0x80000007, eax, ebx, ecx, edx);
-               /* RAPL (Fam 17h) */
+               /* RAPL (Fam 17h+) */
                has_rapl = edx & (1 << 14);
        }
 
-       if (!has_rapl)
+       if (!has_rapl || family < 0x17)
                return;
 
-       switch (family) {
-       case 0x17: /* Zen, Zen+ */
-       case 0x18: /* Hygon Dhyana */
-               do_rapl = RAPL_AMD_F17H | RAPL_PER_CORE_ENERGY;
-               if (rapl_joules) {
-                       BIC_PRESENT(BIC_Pkg_J);
-                       BIC_PRESENT(BIC_Cor_J);
-               } else {
-                       BIC_PRESENT(BIC_PkgWatt);
-                       BIC_PRESENT(BIC_CorWatt);
-               }
-               break;
-       default:
-               return;
+       do_rapl = RAPL_AMD_F17H | RAPL_PER_CORE_ENERGY;
+       if (rapl_joules) {
+               BIC_PRESENT(BIC_Pkg_J);
+               BIC_PRESENT(BIC_Cor_J);
+       } else {
+               BIC_PRESENT(BIC_PkgWatt);
+               BIC_PRESENT(BIC_CorWatt);
        }
 
        if (get_msr(base_cpu, MSR_RAPL_PWR_UNIT, &msr))
@@ -4162,7 +4444,7 @@ int print_thermal(struct thread_data *t, struct core_data *c, struct pkg_data *p
                return 0;
 
        if (cpu_migrate(cpu)) {
-               fprintf(outf, "Could not migrate to CPU %d\n", cpu);
+               fprintf(outf, "print_thermal: Could not migrate to CPU %d\n", cpu);
                return -1;
        }
 
@@ -4234,7 +4516,7 @@ int print_rapl(struct thread_data *t, struct core_data *c, struct pkg_data *p)
 
        cpu = t->cpu_id;
        if (cpu_migrate(cpu)) {
-               fprintf(outf, "Could not migrate to CPU %d\n", cpu);
+               fprintf(outf, "print_rapl: Could not migrate to CPU %d\n", cpu);
                return -1;
        }
 
@@ -4361,6 +4643,7 @@ int has_snb_msrs(unsigned int family, unsigned int model)
        case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
        case INTEL_FAM6_ATOM_GOLDMONT_D:        /* DNV */
        case INTEL_FAM6_ATOM_TREMONT:           /* EHL */
+       case INTEL_FAM6_ATOM_TREMONT_D:         /* JVL */
                return 1;
        }
        return 0;
@@ -4507,12 +4790,33 @@ double discover_bclk(unsigned int family, unsigned int model)
  * below this value, including the Digital Thermal Sensor (DTS),
  * Package Thermal Management Sensor (PTM), and thermal event thresholds.
  */
-int set_temperature_target(struct thread_data *t, struct core_data *c, struct pkg_data *p)
+int read_tcc_activation_temp()
 {
        unsigned long long msr;
-       unsigned int target_c_local;
-       int cpu;
+       unsigned int tcc, target_c, offset_c;
 
+       /* Temperature Target MSR is Nehalem and newer only */
+       if (!do_nhm_platform_info)
+               return 0;
+
+       if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr))
+               return 0;
+
+       target_c = (msr >> 16) & 0xFF;
+
+       offset_c = (msr >> 24) & 0xF;
+
+       tcc = target_c - offset_c;
+
+       if (!quiet)
+               fprintf(outf, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C) (%d default - %d offset)\n",
+                       base_cpu, msr, tcc, target_c, offset_c);
+
+       return tcc;
+}
+
+int set_temperature_target(struct thread_data *t, struct core_data *c, struct pkg_data *p)
+{
        /* tcc_activation_temp is used only for dts or ptm */
        if (!(do_dts || do_ptm))
                return 0;
@@ -4521,43 +4825,18 @@ int set_temperature_target(struct thread_data *t, struct core_data *c, struct pk
        if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE) || !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
                return 0;
 
-       cpu = t->cpu_id;
-       if (cpu_migrate(cpu)) {
-               fprintf(outf, "Could not migrate to CPU %d\n", cpu);
-               return -1;
-       }
-
        if (tcc_activation_temp_override != 0) {
                tcc_activation_temp = tcc_activation_temp_override;
-               fprintf(outf, "cpu%d: Using cmdline TCC Target (%d C)\n",
-                       cpu, tcc_activation_temp);
+               fprintf(outf, "Using cmdline TCC Target (%d C)\n", tcc_activation_temp);
                return 0;
        }
 
-       /* Temperature Target MSR is Nehalem and newer only */
-       if (!do_nhm_platform_info)
-               goto guess;
-
-       if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr))
-               goto guess;
-
-       target_c_local = (msr >> 16) & 0xFF;
-
-       if (!quiet)
-               fprintf(outf, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C)\n",
-                       cpu, msr, target_c_local);
-
-       if (!target_c_local)
-               goto guess;
-
-       tcc_activation_temp = target_c_local;
-
-       return 0;
+       tcc_activation_temp = read_tcc_activation_temp();
+       if (tcc_activation_temp)
+               return 0;
 
-guess:
        tcc_activation_temp = TJMAX_DEFAULT;
-       fprintf(outf, "cpu%d: Guessing tjMax %d C, Please use -T to specify\n",
-               cpu, tcc_activation_temp);
+       fprintf(outf, "Guessing tjMax %d C, Please use -T to specify\n", tcc_activation_temp);
 
        return 0;
 }
@@ -4685,19 +4964,46 @@ unsigned int intel_model_duplicates(unsigned int model)
        case INTEL_FAM6_ICELAKE_NNPI:
        case INTEL_FAM6_TIGERLAKE_L:
        case INTEL_FAM6_TIGERLAKE:
+       case INTEL_FAM6_ROCKETLAKE:
+       case INTEL_FAM6_LAKEFIELD:
+       case INTEL_FAM6_ALDERLAKE:
                return INTEL_FAM6_CANNONLAKE_L;
 
-       case INTEL_FAM6_ATOM_TREMONT_D:
-               return INTEL_FAM6_ATOM_GOLDMONT_D;
-
        case INTEL_FAM6_ATOM_TREMONT_L:
                return INTEL_FAM6_ATOM_TREMONT;
 
        case INTEL_FAM6_ICELAKE_X:
+       case INTEL_FAM6_SAPPHIRERAPIDS_X:
                return INTEL_FAM6_SKYLAKE_X;
        }
        return model;
 }
+
+void print_dev_latency(void)
+{
+       char *path = "/dev/cpu_dma_latency";
+       int fd;
+       int value;
+       int retval;
+
+       fd = open(path, O_RDONLY);
+       if (fd < 0) {
+               warn("fopen %s\n", path);
+               return;
+       }
+
+       retval = read(fd, (void *)&value, sizeof(int));
+       if (retval != sizeof(int)) {
+               warn("read %s\n", path);
+               close(fd);
+               return;
+       }
+       fprintf(outf, "/dev/cpu_dma_latency: %d usec (%s)\n",
+               value, value == 2000000000 ? "default" : "constrained");
+
+       close(fd);
+}
+
 void process_cpuid()
 {
        unsigned int eax, ebx, ecx, edx;
@@ -4916,6 +5222,14 @@ void process_cpuid()
                BIC_PRESENT(BIC_Mod_c6);
                use_c1_residency_msr = 1;
        }
+       if (is_jvl(family, model)) {
+               BIC_NOT_PRESENT(BIC_CPU_c3);
+               BIC_NOT_PRESENT(BIC_CPU_c7);
+               BIC_NOT_PRESENT(BIC_Pkgpc2);
+               BIC_NOT_PRESENT(BIC_Pkgpc3);
+               BIC_NOT_PRESENT(BIC_Pkgpc6);
+               BIC_NOT_PRESENT(BIC_Pkgpc7);
+       }
        if (is_dnv(family, model)) {
                BIC_PRESENT(BIC_CPU_c1);
                BIC_NOT_PRESENT(BIC_CPU_c3);
@@ -4935,9 +5249,12 @@ void process_cpuid()
                BIC_NOT_PRESENT(BIC_Pkgpc7);
        }
        if (has_c8910_msrs(family, model)) {
-               BIC_PRESENT(BIC_Pkgpc8);
-               BIC_PRESENT(BIC_Pkgpc9);
-               BIC_PRESENT(BIC_Pkgpc10);
+               if (pkg_cstate_limit >= PCL__8)
+                       BIC_PRESENT(BIC_Pkgpc8);
+               if (pkg_cstate_limit >= PCL__9)
+                       BIC_PRESENT(BIC_Pkgpc9);
+               if (pkg_cstate_limit >= PCL_10)
+                       BIC_PRESENT(BIC_Pkgpc10);
        }
        do_irtl_hsw = has_c8910_msrs(family, model);
        if (has_skl_msrs(family, model)) {
@@ -4967,6 +5284,8 @@ void process_cpuid()
                dump_cstate_pstate_config_info(family, model);
 
        if (!quiet)
+               print_dev_latency();
+       if (!quiet)
                dump_sysfs_cstate_config();
        if (!quiet)
                dump_sysfs_pstate_config();
@@ -4980,6 +5299,9 @@ void process_cpuid()
        if (!access("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", R_OK))
                BIC_PRESENT(BIC_GFXMHz);
 
+       if (!access("/sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz", R_OK))
+               BIC_PRESENT(BIC_GFXACTMHz);
+
        if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", R_OK))
                BIC_PRESENT(BIC_CPU_LPI);
        else
@@ -5390,7 +5712,7 @@ int get_and_dump_counters(void)
 }
 
 void print_version() {
-       fprintf(outf, "turbostat version 20.03.20"
+       fprintf(outf, "turbostat version 20.09.30"
                " - Len Brown <lenb@kernel.org>\n");
 }
 
@@ -5597,6 +5919,8 @@ void probe_sysfs(void)
                *sp = '%';
                *(sp + 1) = '\0';
 
+               remove_underbar(name_buf);
+
                fclose(input);
 
                sprintf(path, "cpuidle/state%d/time", state);
@@ -5624,6 +5948,8 @@ void probe_sysfs(void)
                *sp = '\0';
                fclose(input);
 
+               remove_underbar(name_buf);
+
                sprintf(path, "cpuidle/state%d/usage", state);
 
                if (is_deferred_skip(name_buf))
@@ -5868,6 +6194,7 @@ int main(int argc, char **argv)
                return 0;
        }
 
+       msr_sum_record();
        /*
         * if any params left, it must be a command to fork
         */
index 3fe1eed..ff6c666 100644 (file)
@@ -622,6 +622,57 @@ void cmdline(int argc, char **argv)
        }
 }
 
+/*
+ * Open a file, and exit on failure
+ */
+FILE *fopen_or_die(const char *path, const char *mode)
+{
+       FILE *filep = fopen(path, "r");
+
+       if (!filep)
+               err(1, "%s: open failed", path);
+       return filep;
+}
+
+void err_on_hypervisor(void)
+{
+       FILE *cpuinfo;
+       char *flags, *hypervisor;
+       char *buffer;
+
+       /* On VMs /proc/cpuinfo contains a "flags" entry for hypervisor */
+       cpuinfo = fopen_or_die("/proc/cpuinfo", "ro");
+
+       buffer = malloc(4096);
+       if (!buffer) {
+               fclose(cpuinfo);
+               err(-ENOMEM, "buffer malloc fail");
+       }
+
+       if (!fread(buffer, 1024, 1, cpuinfo)) {
+               fclose(cpuinfo);
+               free(buffer);
+               err(1, "Reading /proc/cpuinfo failed");
+       }
+
+       flags = strstr(buffer, "flags");
+       rewind(cpuinfo);
+       fseek(cpuinfo, flags - buffer, SEEK_SET);
+       if (!fgets(buffer, 4096, cpuinfo)) {
+               fclose(cpuinfo);
+               free(buffer);
+               err(1, "Reading /proc/cpuinfo failed");
+       }
+       fclose(cpuinfo);
+
+       hypervisor = strstr(buffer, "hypervisor");
+
+       free(buffer);
+
+       if (hypervisor)
+               err(-1,
+                   "not supported on this virtual machine");
+}
 
 int get_msr(int cpu, int offset, unsigned long long *msr)
 {
@@ -635,8 +686,10 @@ int get_msr(int cpu, int offset, unsigned long long *msr)
                err(-1, "%s open failed, try chown or chmod +r /dev/cpu/*/msr, or run as root", pathname);
 
        retval = pread(fd, msr, sizeof(*msr), offset);
-       if (retval != sizeof(*msr))
+       if (retval != sizeof(*msr)) {
+               err_on_hypervisor();
                err(-1, "%s offset 0x%llx read failed", pathname, (unsigned long long)offset);
+       }
 
        if (debug > 1)
                fprintf(stderr, "get_msr(cpu%d, 0x%X, 0x%llX)\n", cpu, offset, *msr);
@@ -1086,18 +1139,6 @@ int update_cpu_msrs(int cpu)
        return 0;
 }
 
-/*
- * Open a file, and exit on failure
- */
-FILE *fopen_or_die(const char *path, const char *mode)
-{
-       FILE *filep = fopen(path, "r");
-
-       if (!filep)
-               err(1, "%s: open failed", path);
-       return filep;
-}
-
 unsigned int get_pkg_num(int cpu)
 {
        FILE *fp;
index 8019e3d..84a1af2 100644 (file)
@@ -66,7 +66,6 @@ def isolate_kunit_output(kernel_output):
 def raw_output(kernel_output):
        for line in kernel_output:
                print(line)
-               yield line
 
 DIVIDER = '=' * 60
 
@@ -242,7 +241,7 @@ def parse_test_suite(lines: List[str], expected_suite_index: int) -> TestSuite:
                return None
        test_suite.name = name
        expected_test_case_num = parse_subtest_plan(lines)
-       if not expected_test_case_num:
+       if expected_test_case_num is None:
                return None
        while expected_test_case_num > 0:
                test_case = parse_test_case(lines)
index 99c3c56..0b60855 100755 (executable)
@@ -179,7 +179,7 @@ class KUnitParserTest(unittest.TestCase):
                print_mock = mock.patch('builtins.print').start()
                result = kunit_parser.parse_run_tests(
                        kunit_parser.isolate_kunit_output(file.readlines()))
-               print_mock.assert_any_call(StrContains("no kunit output detected"))
+               print_mock.assert_any_call(StrContains('no tests run!'))
                print_mock.stop()
                file.close()
 
@@ -198,39 +198,57 @@ class KUnitParserTest(unittest.TestCase):
                        'test_data/test_config_printk_time.log')
                with open(prefix_log) as file:
                        result = kunit_parser.parse_run_tests(file.readlines())
-               self.assertEqual('kunit-resource-test', result.suites[0].name)
+                       self.assertEqual(
+                               kunit_parser.TestStatus.SUCCESS,
+                               result.status)
+                       self.assertEqual('kunit-resource-test', result.suites[0].name)
 
        def test_ignores_multiple_prefixes(self):
                prefix_log = get_absolute_path(
                        'test_data/test_multiple_prefixes.log')
                with open(prefix_log) as file:
                        result = kunit_parser.parse_run_tests(file.readlines())
-               self.assertEqual('kunit-resource-test', result.suites[0].name)
+                       self.assertEqual(
+                               kunit_parser.TestStatus.SUCCESS,
+                               result.status)
+                       self.assertEqual('kunit-resource-test', result.suites[0].name)
 
        def test_prefix_mixed_kernel_output(self):
                mixed_prefix_log = get_absolute_path(
                        'test_data/test_interrupted_tap_output.log')
                with open(mixed_prefix_log) as file:
                        result = kunit_parser.parse_run_tests(file.readlines())
-               self.assertEqual('kunit-resource-test', result.suites[0].name)
+                       self.assertEqual(
+                               kunit_parser.TestStatus.SUCCESS,
+                               result.status)
+                       self.assertEqual('kunit-resource-test', result.suites[0].name)
 
        def test_prefix_poundsign(self):
                pound_log = get_absolute_path('test_data/test_pound_sign.log')
                with open(pound_log) as file:
                        result = kunit_parser.parse_run_tests(file.readlines())
-               self.assertEqual('kunit-resource-test', result.suites[0].name)
+                       self.assertEqual(
+                               kunit_parser.TestStatus.SUCCESS,
+                               result.status)
+                       self.assertEqual('kunit-resource-test', result.suites[0].name)
 
        def test_kernel_panic_end(self):
                panic_log = get_absolute_path('test_data/test_kernel_panic_interrupt.log')
                with open(panic_log) as file:
                        result = kunit_parser.parse_run_tests(file.readlines())
-               self.assertEqual('kunit-resource-test', result.suites[0].name)
+                       self.assertEqual(
+                               kunit_parser.TestStatus.TEST_CRASHED,
+                               result.status)
+                       self.assertEqual('kunit-resource-test', result.suites[0].name)
 
        def test_pound_no_prefix(self):
                pound_log = get_absolute_path('test_data/test_pound_no_prefix.log')
                with open(pound_log) as file:
                        result = kunit_parser.parse_run_tests(file.readlines())
-               self.assertEqual('kunit-resource-test', result.suites[0].name)
+                       self.assertEqual(
+                               kunit_parser.TestStatus.SUCCESS,
+                               result.status)
+                       self.assertEqual('kunit-resource-test', result.suites[0].name)
 
 class KUnitJsonTest(unittest.TestCase):
 
index c02ca77..6bdb57f 100644 (file)
@@ -1,6 +1,7 @@
 [    0.060000] printk: console [mc-1] enabled
 [    0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
 [    0.060000] TAP version 14
+[    0.060000] 1..3
 [    0.060000]         # Subtest: kunit-resource-test
 [    0.060000]         1..5
 [    0.060000]         ok 1 - kunit_resource_test_init_resources
@@ -28,4 +29,4 @@
 [    0.060000] Stack:
 [    0.060000]  602086f8 601bc260 705c0000 705c0000
 [    0.060000]  602086f8 6005fcec 705c0000 6002c6ab
-[    0.060000]  6005fcec 601bc260 705c0000 3000000010
\ No newline at end of file
+[    0.060000]  6005fcec 601bc260 705c0000 3000000010
index 5c73fb3..1fb6777 100644 (file)
@@ -1,6 +1,7 @@
 [    0.060000] printk: console [mc-1] enabled
 [    0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
 [    0.060000] TAP version 14
+[    0.060000] 1..3
 [    0.060000]         # Subtest: kunit-resource-test
 [    0.060000]         1..5
 [    0.060000]         ok 1 - kunit_resource_test_init_resources
@@ -34,4 +35,4 @@
 [    0.060000] Stack:
 [    0.060000]  602086f8 601bc260 705c0000 705c0000
 [    0.060000]  602086f8 6005fcec 705c0000 6002c6ab
-[    0.060000]  6005fcec 601bc260 705c0000 3000000010
\ No newline at end of file
+[    0.060000]  6005fcec 601bc260 705c0000 3000000010
index c045eee..a014ffe 100644 (file)
@@ -1,6 +1,7 @@
 [    0.060000] printk: console [mc-1] enabled
 [    0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
 [    0.060000] TAP version 14
+[    0.060000] 1..3
 [    0.060000]         # Subtest: kunit-resource-test
 [    0.060000]         1..5
 [    0.060000]         ok 1 - kunit_resource_test_init_resources
@@ -22,4 +23,4 @@
 [    0.060000] Stack:
 [    0.060000]  602086f8 601bc260 705c0000 705c0000
 [    0.060000]  602086f8 6005fcec 705c0000 6002c6ab
-[    0.060000]  6005fcec 601bc260 705c0000 3000000010
\ No newline at end of file
+[    0.060000]  6005fcec 601bc260 705c0000 3000000010
index bc48407..0ad7848 100644 (file)
@@ -1,6 +1,7 @@
 [    0.060000][    T1] printk: console [mc-1] enabled
 [    0.060000][    T1] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
 [    0.060000][    T1] TAP version 14
+[    0.060000][    T1] 1..3
 [    0.060000][    T1]         # Subtest: kunit-resource-test
 [    0.060000][    T1]         1..5
 [    0.060000][    T1]         ok 1 - kunit_resource_test_init_resources
@@ -28,4 +29,4 @@
 [    0.060000][    T1] Stack:
 [    0.060000][    T1]  602086f8 601bc260 705c0000 705c0000
 [    0.060000][    T1]  602086f8 6005fcec 705c0000 6002c6ab
-[    0.060000][    T1]  6005fcec 601bc260 705c0000 3000000010
\ No newline at end of file
+[    0.060000][    T1]  6005fcec 601bc260 705c0000 3000000010
index 2ceb360..dc4cf09 100644 (file)
@@ -1,6 +1,7 @@
  printk: console [mc-1] enabled
  random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
  TAP version 14
+ 1..3
        # Subtest: kunit-resource-test
        1..5
        ok 1 - kunit_resource_test_init_resources
@@ -30,4 +31,4 @@
  Stack:
   602086f8 601bc260 705c0000 705c0000
   602086f8 6005fcec 705c0000 6002c6ab
-  6005fcec 601bc260 705c0000 3000000010
\ No newline at end of file
+  6005fcec 601bc260 705c0000 3000000010
index 28ffa5b..3f358e3 100644 (file)
@@ -1,6 +1,7 @@
 [    0.060000] printk: console [mc-1] enabled
 [    0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
 [    0.060000] TAP version 14
+[    0.060000] 1..3
 [    0.060000]         # Subtest: kunit-resource-test
 [    0.060000]         1..5
 [    0.060000]         ok 1 - kunit_resource_test_init_resources
index 242635d..c9fa141 100644 (file)
@@ -417,6 +417,9 @@ int main(int argc, char *argv[])
        /* Register SIGSEGV handler */
        mte_register_signal(SIGSEGV, mte_default_handler);
 
+       /* Set test plan */
+       ksft_set_plan(20);
+
        /* Buffer by byte tests */
        evaluate_test(check_buffer_by_byte(USE_MMAP, MTE_SYNC_ERR),
        "Check buffer correctness by byte with sync err mode and mmap memory\n");
index 97bebde..43bd94f 100644 (file)
@@ -163,6 +163,9 @@ int main(int argc, char *argv[])
        mte_register_signal(SIGSEGV, mte_default_handler);
        mte_register_signal(SIGBUS, mte_default_handler);
 
+       /* Set test plan */
+       ksft_set_plan(12);
+
        evaluate_test(check_child_memory_mapping(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE),
                "Check child anonymous memory with private mapping, precise mode and mmap memory\n");
        evaluate_test(check_child_memory_mapping(USE_MMAP, MTE_SYNC_ERR, MAP_SHARED),
index bc41ae6..3b23c4d 100644 (file)
@@ -140,6 +140,10 @@ int main(int argc, char *argv[])
        /* Register signal handlers */
        mte_register_signal(SIGBUS, mte_default_handler);
        mte_register_signal(SIGSEGV, mte_default_handler);
+
+       /* Set test plan */
+       ksft_set_plan(4);
+
        /* Enable KSM */
        mte_ksm_setup();
 
index 33b13b8..a04b12c 100644 (file)
@@ -205,7 +205,11 @@ int main(int argc, char *argv[])
        mte_register_signal(SIGBUS, mte_default_handler);
        mte_register_signal(SIGSEGV, mte_default_handler);
 
+       /* Set test plan */
+       ksft_set_plan(22);
+
        mte_enable_pstate_tco();
+
        evaluate_test(check_anonymous_memory_mapping(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, TAG_CHECK_OFF),
        "Check anonymous memory with private mapping, sync error mode, mmap memory and tag check off\n");
        evaluate_test(check_file_memory_mapping(USE_MPROTECT, MTE_SYNC_ERR, MAP_PRIVATE, TAG_CHECK_OFF),
index 94d245a..deaef1f 100644 (file)
@@ -170,6 +170,9 @@ int main(int argc, char *argv[])
        /* Register SIGSEGV handler */
        mte_register_signal(SIGSEGV, mte_default_handler);
 
+       /* Set test plan */
+       ksft_set_plan(4);
+
        evaluate_test(check_single_included_tags(USE_MMAP, MTE_SYNC_ERR),
                      "Check an included tag value with sync mode\n");
        evaluate_test(check_multiple_included_tags(USE_MMAP, MTE_SYNC_ERR),
index 594e98e..4bfa80f 100644 (file)
@@ -92,9 +92,13 @@ int main(int argc, char *argv[])
        err = mte_default_setup();
        if (err)
                return err;
+
        /* Register signal handlers */
        mte_register_signal(SIGSEGV, mte_default_handler);
 
+       /* Set test plan */
+       ksft_set_plan(4);
+
        evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE),
                "Check memory access from kernel in sync mode, private mapping and mmap memory\n");
        evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_SHARED),
diff --git a/tools/testing/selftests/bpf/prog_tests/map_init.c b/tools/testing/selftests/bpf/prog_tests/map_init.c
new file mode 100644 (file)
index 0000000..14a3110
--- /dev/null
@@ -0,0 +1,214 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Copyright (c) 2020 Tessares SA <http://www.tessares.net> */
+
+#include <test_progs.h>
+#include "test_map_init.skel.h"
+
+#define TEST_VALUE 0x1234
+#define FILL_VALUE 0xdeadbeef
+
+static int nr_cpus;
+static int duration;
+
+typedef unsigned long long map_key_t;
+typedef unsigned long long map_value_t;
+typedef struct {
+       map_value_t v; /* padding */
+} __bpf_percpu_val_align pcpu_map_value_t;
+
+
+static int map_populate(int map_fd, int num)
+{
+       pcpu_map_value_t value[nr_cpus];
+       int i, err;
+       map_key_t key;
+
+       for (i = 0; i < nr_cpus; i++)
+               bpf_percpu(value, i) = FILL_VALUE;
+
+       for (key = 1; key <= num; key++) {
+               err = bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST);
+               if (!ASSERT_OK(err, "bpf_map_update_elem"))
+                       return -1;
+       }
+
+       return 0;
+}
+
+static struct test_map_init *setup(enum bpf_map_type map_type, int map_sz,
+                           int *map_fd, int populate)
+{
+       struct test_map_init *skel;
+       int err;
+
+       skel = test_map_init__open();
+       if (!ASSERT_OK_PTR(skel, "skel_open"))
+               return NULL;
+
+       err = bpf_map__set_type(skel->maps.hashmap1, map_type);
+       if (!ASSERT_OK(err, "bpf_map__set_type"))
+               goto error;
+
+       err = bpf_map__set_max_entries(skel->maps.hashmap1, map_sz);
+       if (!ASSERT_OK(err, "bpf_map__set_max_entries"))
+               goto error;
+
+       err = test_map_init__load(skel);
+       if (!ASSERT_OK(err, "skel_load"))
+               goto error;
+
+       *map_fd = bpf_map__fd(skel->maps.hashmap1);
+       if (CHECK(*map_fd < 0, "bpf_map__fd", "failed\n"))
+               goto error;
+
+       err = map_populate(*map_fd, populate);
+       if (!ASSERT_OK(err, "map_populate"))
+               goto error_map;
+
+       return skel;
+
+error_map:
+       close(*map_fd);
+error:
+       test_map_init__destroy(skel);
+       return NULL;
+}
+
+/* executes bpf program that updates map with key, value */
+static int prog_run_insert_elem(struct test_map_init *skel, map_key_t key,
+                               map_value_t value)
+{
+       struct test_map_init__bss *bss;
+
+       bss = skel->bss;
+
+       bss->inKey = key;
+       bss->inValue = value;
+       bss->inPid = getpid();
+
+       if (!ASSERT_OK(test_map_init__attach(skel), "skel_attach"))
+               return -1;
+
+       /* Let tracepoint trigger */
+       syscall(__NR_getpgid);
+
+       test_map_init__detach(skel);
+
+       return 0;
+}
+
+static int check_values_one_cpu(pcpu_map_value_t *value, map_value_t expected)
+{
+       int i, nzCnt = 0;
+       map_value_t val;
+
+       for (i = 0; i < nr_cpus; i++) {
+               val = bpf_percpu(value, i);
+               if (val) {
+                       if (CHECK(val != expected, "map value",
+                                 "unexpected for cpu %d: 0x%llx\n", i, val))
+                               return -1;
+                       nzCnt++;
+               }
+       }
+
+       if (CHECK(nzCnt != 1, "map value", "set for %d CPUs instead of 1!\n",
+                 nzCnt))
+               return -1;
+
+       return 0;
+}
+
+/* Add key=1 elem with values set for all CPUs
+ * Delete elem key=1
+ * Run bpf prog that inserts new key=1 elem with value=0x1234
+ *   (bpf prog can only set value for current CPU)
+ * Lookup Key=1 and check value is as expected for all CPUs:
+ *   value set by bpf prog for one CPU, 0 for all others
+ */
+static void test_pcpu_map_init(void)
+{
+       pcpu_map_value_t value[nr_cpus];
+       struct test_map_init *skel;
+       int map_fd, err;
+       map_key_t key;
+
+       /* max 1 elem in map so insertion is forced to reuse freed entry */
+       skel = setup(BPF_MAP_TYPE_PERCPU_HASH, 1, &map_fd, 1);
+       if (!ASSERT_OK_PTR(skel, "prog_setup"))
+               return;
+
+       /* delete element so the entry can be re-used*/
+       key = 1;
+       err = bpf_map_delete_elem(map_fd, &key);
+       if (!ASSERT_OK(err, "bpf_map_delete_elem"))
+               goto cleanup;
+
+       /* run bpf prog that inserts new elem, re-using the slot just freed */
+       err = prog_run_insert_elem(skel, key, TEST_VALUE);
+       if (!ASSERT_OK(err, "prog_run_insert_elem"))
+               goto cleanup;
+
+       /* check that key=1 was re-created by bpf prog */
+       err = bpf_map_lookup_elem(map_fd, &key, value);
+       if (!ASSERT_OK(err, "bpf_map_lookup_elem"))
+               goto cleanup;
+
+       /* and has expected values */
+       check_values_one_cpu(value, TEST_VALUE);
+
+cleanup:
+       test_map_init__destroy(skel);
+}
+
+/* Add key=1 and key=2 elems with values set for all CPUs
+ * Run bpf prog that inserts new key=3 elem
+ *   (only for current cpu; other cpus should have initial value = 0)
+ * Lookup Key=1 and check value is as expected for all CPUs
+ */
+static void test_pcpu_lru_map_init(void)
+{
+       pcpu_map_value_t value[nr_cpus];
+       struct test_map_init *skel;
+       int map_fd, err;
+       map_key_t key;
+
+       /* Set up LRU map with 2 elements, values filled for all CPUs.
+        * With these 2 elements, the LRU map is full
+        */
+       skel = setup(BPF_MAP_TYPE_LRU_PERCPU_HASH, 2, &map_fd, 2);
+       if (!ASSERT_OK_PTR(skel, "prog_setup"))
+               return;
+
+       /* run bpf prog that inserts new key=3 element, re-using LRU slot */
+       key = 3;
+       err = prog_run_insert_elem(skel, key, TEST_VALUE);
+       if (!ASSERT_OK(err, "prog_run_insert_elem"))
+               goto cleanup;
+
+       /* check that key=3 replaced one of earlier elements */
+       err = bpf_map_lookup_elem(map_fd, &key, value);
+       if (!ASSERT_OK(err, "bpf_map_lookup_elem"))
+               goto cleanup;
+
+       /* and has expected values */
+       check_values_one_cpu(value, TEST_VALUE);
+
+cleanup:
+       test_map_init__destroy(skel);
+}
+
+void test_map_init(void)
+{
+       nr_cpus = bpf_num_possible_cpus();
+       if (nr_cpus <= 1) {
+               printf("%s:SKIP: >1 cpu needed for this test\n", __func__);
+               test__skip();
+               return;
+       }
+
+       if (test__start_subtest("pcpu_map_init"))
+               test_pcpu_map_init();
+       if (test__start_subtest("pcpu_lru_map_init"))
+               test_pcpu_lru_map_init();
+}
index 0057831..30982a7 100644 (file)
@@ -243,7 +243,10 @@ static ino_t get_inode_from_kernfs(struct kernfs_node* node)
        }
 }
 
-int pids_cgrp_id = 1;
+extern bool CONFIG_CGROUP_PIDS __kconfig __weak;
+enum cgroup_subsys_id___local {
+       pids_cgrp_id___local = 123, /* value doesn't matter */
+};
 
 static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
                                         struct task_struct* task,
@@ -253,7 +256,9 @@ static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
                BPF_CORE_READ(task, nsproxy, cgroup_ns, root_cset, dfl_cgrp, kn);
        struct kernfs_node* proc_kernfs = BPF_CORE_READ(task, cgroups, dfl_cgrp, kn);
 
-       if (ENABLE_CGROUP_V1_RESOLVER) {
+       if (ENABLE_CGROUP_V1_RESOLVER && CONFIG_CGROUP_PIDS) {
+               int cgrp_id = bpf_core_enum_value(enum cgroup_subsys_id___local,
+                                                 pids_cgrp_id___local);
 #ifdef UNROLL
 #pragma unroll
 #endif
@@ -262,7 +267,7 @@ static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
                                BPF_CORE_READ(task, cgroups, subsys[i]);
                        if (subsys != NULL) {
                                int subsys_id = BPF_CORE_READ(subsys, ss, id);
-                               if (subsys_id == pids_cgrp_id) {
+                               if (subsys_id == cgrp_id) {
                                        proc_kernfs = BPF_CORE_READ(subsys, cgroup, kn);
                                        root_kernfs = BPF_CORE_READ(subsys, ss, root, kf_root, kn);
                                        break;
diff --git a/tools/testing/selftests/bpf/progs/test_map_init.c b/tools/testing/selftests/bpf/progs/test_map_init.c
new file mode 100644 (file)
index 0000000..c89d28e
--- /dev/null
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2020 Tessares SA <http://www.tessares.net> */
+
+#include "vmlinux.h"
+#include <bpf/bpf_helpers.h>
+
+__u64 inKey = 0;
+__u64 inValue = 0;
+__u32 inPid = 0;
+
+struct {
+       __uint(type, BPF_MAP_TYPE_PERCPU_HASH);
+       __uint(max_entries, 2);
+       __type(key, __u64);
+       __type(value, __u64);
+} hashmap1 SEC(".maps");
+
+
+SEC("tp/syscalls/sys_enter_getpgid")
+int sysenter_getpgid(const void *ctx)
+{
+       /* Just do it for once, when called from our own test prog. This
+        * ensures the map value is only updated for a single CPU.
+        */
+       int cur_pid = bpf_get_current_pid_tgid() >> 32;
+
+       if (cur_pid == inPid)
+               bpf_map_update_elem(&hashmap1, &inKey, &inValue, BPF_NOEXIST);
+
+       return 0;
+}
+
+char _license[] SEC("license") = "GPL";
index 55bd387..52d3f03 100644 (file)
@@ -145,7 +145,7 @@ TEST(clone3_cap_checkpoint_restore)
        test_clone3_supported();
 
        EXPECT_EQ(getuid(), 0)
-               XFAIL(return, "Skipping all tests as non-root\n");
+               SKIP(return, "Skipping all tests as non-root");
 
        memset(&set_tid, 0, sizeof(set_tid));
 
index c99b98b..575b391 100644 (file)
@@ -44,7 +44,7 @@ TEST(close_range)
                fd = open("/dev/null", O_RDONLY | O_CLOEXEC);
                ASSERT_GE(fd, 0) {
                        if (errno == ENOENT)
-                               XFAIL(return, "Skipping test since /dev/null does not exist");
+                               SKIP(return, "Skipping test since /dev/null does not exist");
                }
 
                open_fds[i] = fd;
@@ -52,7 +52,7 @@ TEST(close_range)
 
        EXPECT_EQ(-1, sys_close_range(open_fds[0], open_fds[100], -1)) {
                if (errno == ENOSYS)
-                       XFAIL(return, "close_range() syscall not supported");
+                       SKIP(return, "close_range() syscall not supported");
        }
 
        EXPECT_EQ(0, sys_close_range(open_fds[0], open_fds[50], 0));
@@ -108,7 +108,7 @@ TEST(close_range_unshare)
                fd = open("/dev/null", O_RDONLY | O_CLOEXEC);
                ASSERT_GE(fd, 0) {
                        if (errno == ENOENT)
-                               XFAIL(return, "Skipping test since /dev/null does not exist");
+                               SKIP(return, "Skipping test since /dev/null does not exist");
                }
 
                open_fds[i] = fd;
@@ -197,7 +197,7 @@ TEST(close_range_unshare_capped)
                fd = open("/dev/null", O_RDONLY | O_CLOEXEC);
                ASSERT_GE(fd, 0) {
                        if (errno == ENOENT)
-                               XFAIL(return, "Skipping test since /dev/null does not exist");
+                               SKIP(return, "Skipping test since /dev/null does not exist");
                }
 
                open_fds[i] = fd;
diff --git a/tools/testing/selftests/drivers/net/netdevsim/nexthop.sh b/tools/testing/selftests/drivers/net/netdevsim/nexthop.sh
new file mode 100755 (executable)
index 0000000..be0c1b5
--- /dev/null
@@ -0,0 +1,436 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# This test is for checking the nexthop offload API. It makes use of netdevsim
+# which registers a listener to the nexthop notification chain.
+
+lib_dir=$(dirname $0)/../../../net/forwarding
+
+ALL_TESTS="
+       nexthop_single_add_test
+       nexthop_single_add_err_test
+       nexthop_group_add_test
+       nexthop_group_add_err_test
+       nexthop_group_replace_test
+       nexthop_group_replace_err_test
+       nexthop_single_replace_test
+       nexthop_single_replace_err_test
+       nexthop_single_in_group_replace_test
+       nexthop_single_in_group_replace_err_test
+       nexthop_single_in_group_delete_test
+       nexthop_single_in_group_delete_err_test
+       nexthop_replay_test
+       nexthop_replay_err_test
+"
+NETDEVSIM_PATH=/sys/bus/netdevsim/
+DEV_ADDR=1337
+DEV=netdevsim${DEV_ADDR}
+DEVLINK_DEV=netdevsim/${DEV}
+SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV/net/
+NUM_NETIFS=0
+source $lib_dir/lib.sh
+source $lib_dir/devlink_lib.sh
+
+nexthop_check()
+{
+       local nharg="$1"; shift
+       local expected="$1"; shift
+
+       out=$($IP nexthop show ${nharg} | sed -e 's/ *$//')
+       if [[ "$out" != "$expected" ]]; then
+               return 1
+       fi
+
+       return 0
+}
+
+nexthop_resource_check()
+{
+       local expected_occ=$1; shift
+
+       occ=$($DEVLINK -jp resource show $DEVLINK_DEV \
+               | jq '.[][][] | select(.name=="nexthops") | .["occ"]')
+
+       if [ $expected_occ -ne $occ ]; then
+               return 1
+       fi
+
+       return 0
+}
+
+nexthop_resource_set()
+{
+       local size=$1; shift
+
+       $DEVLINK resource set $DEVLINK_DEV path nexthops size $size
+       $DEVLINK dev reload $DEVLINK_DEV
+}
+
+nexthop_single_add_test()
+{
+       RET=0
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+       nexthop_check "id 1" "id 1 via 192.0.2.2 dev dummy1 scope link trap"
+       check_err $? "Unexpected nexthop entry"
+
+       nexthop_resource_check 1
+       check_err $? "Wrong nexthop occupancy"
+
+       $IP nexthop del id 1
+       nexthop_resource_check 0
+       check_err $? "Wrong nexthop occupancy after delete"
+
+       log_test "Single nexthop add and delete"
+}
+
+nexthop_single_add_err_test()
+{
+       RET=0
+
+       nexthop_resource_set 1
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+
+       $IP nexthop add id 2 via 192.0.2.3 dev dummy1 &> /dev/null
+       check_fail $? "Nexthop addition succeeded when should fail"
+
+       nexthop_resource_check 1
+       check_err $? "Wrong nexthop occupancy"
+
+       log_test "Single nexthop add failure"
+
+       $IP nexthop flush &> /dev/null
+       nexthop_resource_set 9999
+}
+
+nexthop_group_add_test()
+{
+       RET=0
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+       $IP nexthop add id 2 via 192.0.2.3 dev dummy1
+
+       $IP nexthop add id 10 group 1/2
+       nexthop_check "id 10" "id 10 group 1/2 trap"
+       check_err $? "Unexpected nexthop group entry"
+
+       nexthop_resource_check 4
+       check_err $? "Wrong nexthop occupancy"
+
+       $IP nexthop del id 10
+       nexthop_resource_check 2
+       check_err $? "Wrong nexthop occupancy after delete"
+
+       $IP nexthop add id 10 group 1,20/2,39
+       nexthop_check "id 10" "id 10 group 1,20/2,39 trap"
+       check_err $? "Unexpected weighted nexthop group entry"
+
+       nexthop_resource_check 61
+       check_err $? "Wrong weighted nexthop occupancy"
+
+       $IP nexthop del id 10
+       nexthop_resource_check 2
+       check_err $? "Wrong nexthop occupancy after delete"
+
+       log_test "Nexthop group add and delete"
+
+       $IP nexthop flush &> /dev/null
+}
+
+nexthop_group_add_err_test()
+{
+       RET=0
+
+       nexthop_resource_set 2
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+       $IP nexthop add id 2 via 192.0.2.3 dev dummy1
+
+       $IP nexthop add id 10 group 1/2 &> /dev/null
+       check_fail $? "Nexthop group addition succeeded when should fail"
+
+       nexthop_resource_check 2
+       check_err $? "Wrong nexthop occupancy"
+
+       log_test "Nexthop group add failure"
+
+       $IP nexthop flush &> /dev/null
+       nexthop_resource_set 9999
+}
+
+nexthop_group_replace_test()
+{
+       RET=0
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+       $IP nexthop add id 2 via 192.0.2.3 dev dummy1
+       $IP nexthop add id 3 via 192.0.2.4 dev dummy1
+       $IP nexthop add id 10 group 1/2
+
+       $IP nexthop replace id 10 group 1/2/3
+       nexthop_check "id 10" "id 10 group 1/2/3 trap"
+       check_err $? "Unexpected nexthop group entry"
+
+       nexthop_resource_check 6
+       check_err $? "Wrong nexthop occupancy"
+
+       log_test "Nexthop group replace"
+
+       $IP nexthop flush &> /dev/null
+}
+
+nexthop_group_replace_err_test()
+{
+       RET=0
+
+       nexthop_resource_set 5
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+       $IP nexthop add id 2 via 192.0.2.3 dev dummy1
+       $IP nexthop add id 3 via 192.0.2.4 dev dummy1
+       $IP nexthop add id 10 group 1/2
+
+       $IP nexthop replace id 10 group 1/2/3 &> /dev/null
+       check_fail $? "Nexthop group replacement succeeded when should fail"
+
+       nexthop_check "id 10" "id 10 group 1/2 trap"
+       check_err $? "Unexpected nexthop group entry after failure"
+
+       nexthop_resource_check 5
+       check_err $? "Wrong nexthop occupancy after failure"
+
+       log_test "Nexthop group replace failure"
+
+       $IP nexthop flush &> /dev/null
+       nexthop_resource_set 9999
+}
+
+nexthop_single_replace_test()
+{
+       RET=0
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+
+       $IP nexthop replace id 1 via 192.0.2.3 dev dummy1
+       nexthop_check "id 1" "id 1 via 192.0.2.3 dev dummy1 scope link trap"
+       check_err $? "Unexpected nexthop entry"
+
+       nexthop_resource_check 1
+       check_err $? "Wrong nexthop occupancy"
+
+       log_test "Single nexthop replace"
+
+       $IP nexthop flush &> /dev/null
+}
+
+nexthop_single_replace_err_test()
+{
+       RET=0
+
+       # This is supposed to cause the replace to fail because the new nexthop
+       # is programmed before deleting the replaced one.
+       nexthop_resource_set 1
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+
+       $IP nexthop replace id 1 via 192.0.2.3 dev dummy1 &> /dev/null
+       check_fail $? "Nexthop replace succeeded when should fail"
+
+       nexthop_check "id 1" "id 1 via 192.0.2.2 dev dummy1 scope link trap"
+       check_err $? "Unexpected nexthop entry after failure"
+
+       nexthop_resource_check 1
+       check_err $? "Wrong nexthop occupancy after failure"
+
+       log_test "Single nexthop replace failure"
+
+       $IP nexthop flush &> /dev/null
+       nexthop_resource_set 9999
+}
+
+nexthop_single_in_group_replace_test()
+{
+       RET=0
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+       $IP nexthop add id 2 via 192.0.2.3 dev dummy1
+       $IP nexthop add id 10 group 1/2
+
+       $IP nexthop replace id 1 via 192.0.2.4 dev dummy1
+       check_err $? "Failed to replace nexthop when should not"
+
+       nexthop_check "id 10" "id 10 group 1/2 trap"
+       check_err $? "Unexpected nexthop group entry"
+
+       nexthop_resource_check 4
+       check_err $? "Wrong nexthop occupancy"
+
+       log_test "Single nexthop replace while in group"
+
+       $IP nexthop flush &> /dev/null
+}
+
+nexthop_single_in_group_replace_err_test()
+{
+       RET=0
+
+       nexthop_resource_set 5
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+       $IP nexthop add id 2 via 192.0.2.3 dev dummy1
+       $IP nexthop add id 10 group 1/2
+
+       $IP nexthop replace id 1 via 192.0.2.4 dev dummy1 &> /dev/null
+       check_fail $? "Nexthop replacement succeeded when should fail"
+
+       nexthop_check "id 1" "id 1 via 192.0.2.2 dev dummy1 scope link trap"
+       check_err $? "Unexpected nexthop entry after failure"
+
+       nexthop_check "id 10" "id 10 group 1/2 trap"
+       check_err $? "Unexpected nexthop group entry after failure"
+
+       nexthop_resource_check 4
+       check_err $? "Wrong nexthop occupancy"
+
+       log_test "Single nexthop replace while in group failure"
+
+       $IP nexthop flush &> /dev/null
+       nexthop_resource_set 9999
+}
+
+nexthop_single_in_group_delete_test()
+{
+       RET=0
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+       $IP nexthop add id 2 via 192.0.2.3 dev dummy1
+       $IP nexthop add id 10 group 1/2
+
+       $IP nexthop del id 1
+       nexthop_check "id 10" "id 10 group 2 trap"
+       check_err $? "Unexpected nexthop group entry"
+
+       nexthop_resource_check 2
+       check_err $? "Wrong nexthop occupancy"
+
+       log_test "Single nexthop delete while in group"
+
+       $IP nexthop flush &> /dev/null
+}
+
+nexthop_single_in_group_delete_err_test()
+{
+       RET=0
+
+       # First, nexthop 1 will be deleted, which will reduce the occupancy to
+       # 5. Afterwards, a replace notification will be sent for nexthop group
+       # 10 with only two nexthops. Since the new group is allocated before
+       # the old is deleted, the replacement will fail as it will result in an
+       # occupancy of 7.
+       nexthop_resource_set 6
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+       $IP nexthop add id 2 via 192.0.2.3 dev dummy1
+       $IP nexthop add id 3 via 192.0.2.4 dev dummy1
+       $IP nexthop add id 10 group 1/2/3
+
+       $IP nexthop del id 1
+
+       nexthop_resource_check 5
+       check_err $? "Wrong nexthop occupancy"
+
+       log_test "Single nexthop delete while in group failure"
+
+       $IP nexthop flush &> /dev/null
+       nexthop_resource_set 9999
+}
+
+nexthop_replay_test()
+{
+       RET=0
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+       $IP nexthop add id 2 via 192.0.2.3 dev dummy1
+       $IP nexthop add id 10 group 1/2
+
+       $DEVLINK dev reload $DEVLINK_DEV
+       check_err $? "Failed to reload when should not"
+
+       nexthop_check "id 1" "id 1 via 192.0.2.2 dev dummy1 scope link trap"
+       check_err $? "Unexpected nexthop entry after reload"
+
+       nexthop_check "id 2" "id 2 via 192.0.2.3 dev dummy1 scope link trap"
+       check_err $? "Unexpected nexthop entry after reload"
+
+       nexthop_check "id 10" "id 10 group 1/2 trap"
+       check_err $? "Unexpected nexthop group entry after reload"
+
+       nexthop_resource_check 4
+       check_err $? "Wrong nexthop occupancy"
+
+       log_test "Nexthop replay"
+
+       $IP nexthop flush &> /dev/null
+}
+
+nexthop_replay_err_test()
+{
+       RET=0
+
+       $IP nexthop add id 1 via 192.0.2.2 dev dummy1
+       $IP nexthop add id 2 via 192.0.2.3 dev dummy1
+       $IP nexthop add id 10 group 1/2
+
+       # Reduce size of nexthop resource so that reload will fail.
+       $DEVLINK resource set $DEVLINK_DEV path nexthops size 3
+       $DEVLINK dev reload $DEVLINK_DEV &> /dev/null
+       check_fail $? "Reload succeeded when should fail"
+
+       $DEVLINK resource set $DEVLINK_DEV path nexthops size 9999
+       $DEVLINK dev reload $DEVLINK_DEV
+       check_err $? "Failed to reload when should not"
+
+       log_test "Nexthop replay failure"
+
+       $IP nexthop flush &> /dev/null
+}
+
+setup_prepare()
+{
+       local netdev
+
+       modprobe netdevsim &> /dev/null
+
+       echo "$DEV_ADDR 1" > ${NETDEVSIM_PATH}/new_device
+       while [ ! -d $SYSFS_NET_DIR ] ; do :; done
+
+       set -e
+
+       ip netns add testns1
+       devlink dev reload $DEVLINK_DEV netns testns1
+
+       IP="ip -netns testns1"
+       DEVLINK="devlink -N testns1"
+
+       $IP link add name dummy1 up type dummy
+       $IP address add 192.0.2.1/24 dev dummy1
+
+       set +e
+}
+
+cleanup()
+{
+       pre_cleanup
+       ip netns del testns1
+       echo "$DEV_ADDR" > ${NETDEVSIM_PATH}/del_device
+       modprobe -r netdevsim &> /dev/null
+}
+
+trap cleanup EXIT
+
+setup_prepare
+
+tests_run
+
+exit $EXIT_STATUS
index 1d27f52..477cbb0 100644 (file)
@@ -74,7 +74,7 @@ static int __do_binderfs_test(struct __test_metadata *_metadata)
        ret = mount(NULL, binderfs_mntpt, "binder", 0, 0);
        EXPECT_EQ(ret, 0) {
                if (errno == ENODEV)
-                       XFAIL(goto out, "binderfs missing");
+                       SKIP(goto out, "binderfs missing");
                TH_LOG("%s - Failed to mount binderfs", strerror(errno));
                goto rmdir;
        }
@@ -475,10 +475,10 @@ TEST(binderfs_stress)
 TEST(binderfs_test_privileged)
 {
        if (geteuid() != 0)
-               XFAIL(return, "Tests are not run as root. Skipping privileged tests");
+               SKIP(return, "Tests are not run as root. Skipping privileged tests");
 
        if (__do_binderfs_test(_metadata))
-               XFAIL(return, "The Android binderfs filesystem is not available");
+               SKIP(return, "The Android binderfs filesystem is not available");
 }
 
 TEST(binderfs_test_unprivileged)
@@ -511,7 +511,7 @@ TEST(binderfs_test_unprivileged)
        ret = wait_for_pid(pid);
        if (ret) {
                if (ret == 2)
-                       XFAIL(return, "The Android binderfs filesystem is not available");
+                       SKIP(return, "The Android binderfs filesystem is not available");
                ASSERT_EQ(ret, 0) {
                        TH_LOG("wait_for_pid() failed");
                }
index d979ff1..8f82f99 100644 (file)
@@ -3282,4 +3282,99 @@ TEST(epoll60)
        close(ctx.epfd);
 }
 
+struct epoll61_ctx {
+       int epfd;
+       int evfd;
+};
+
+static void *epoll61_write_eventfd(void *ctx_)
+{
+       struct epoll61_ctx *ctx = ctx_;
+       int64_t l = 1;
+
+       usleep(10950);
+       write(ctx->evfd, &l, sizeof(l));
+       return NULL;
+}
+
+static void *epoll61_epoll_with_timeout(void *ctx_)
+{
+       struct epoll61_ctx *ctx = ctx_;
+       struct epoll_event events[1];
+       int n;
+
+       n = epoll_wait(ctx->epfd, events, 1, 11);
+       /*
+        * If epoll returned the eventfd, write on the eventfd to wake up the
+        * blocking poller.
+        */
+       if (n == 1) {
+               int64_t l = 1;
+
+               write(ctx->evfd, &l, sizeof(l));
+       }
+       return NULL;
+}
+
+static void *epoll61_blocking_epoll(void *ctx_)
+{
+       struct epoll61_ctx *ctx = ctx_;
+       struct epoll_event events[1];
+
+       epoll_wait(ctx->epfd, events, 1, -1);
+       return NULL;
+}
+
+TEST(epoll61)
+{
+       struct epoll61_ctx ctx;
+       struct epoll_event ev;
+       int i, r;
+
+       ctx.epfd = epoll_create1(0);
+       ASSERT_GE(ctx.epfd, 0);
+       ctx.evfd = eventfd(0, EFD_NONBLOCK);
+       ASSERT_GE(ctx.evfd, 0);
+
+       ev.events = EPOLLIN | EPOLLET | EPOLLERR | EPOLLHUP;
+       ev.data.ptr = NULL;
+       r = epoll_ctl(ctx.epfd, EPOLL_CTL_ADD, ctx.evfd, &ev);
+       ASSERT_EQ(r, 0);
+
+       /*
+        * We are testing a race.  Repeat the test case 1000 times to make it
+        * more likely to fail in case of a bug.
+        */
+       for (i = 0; i < 1000; i++) {
+               pthread_t threads[3];
+               int n;
+
+               /*
+                * Start 3 threads:
+                * Thread 1 sleeps for 10.9ms and writes to the evenfd.
+                * Thread 2 calls epoll with a timeout of 11ms.
+                * Thread 3 calls epoll with a timeout of -1.
+                *
+                * The eventfd write by Thread 1 should either wakeup Thread 2
+                * or Thread 3.  If it wakes up Thread 2, Thread 2 writes on the
+                * eventfd to wake up Thread 3.
+                *
+                * If no events are missed, all three threads should eventually
+                * be joinable.
+                */
+               ASSERT_EQ(pthread_create(&threads[0], NULL,
+                                        epoll61_write_eventfd, &ctx), 0);
+               ASSERT_EQ(pthread_create(&threads[1], NULL,
+                                        epoll61_epoll_with_timeout, &ctx), 0);
+               ASSERT_EQ(pthread_create(&threads[2], NULL,
+                                        epoll61_blocking_epoll, &ctx), 0);
+
+               for (n = 0; n < ARRAY_SIZE(threads); ++n)
+                       ASSERT_EQ(pthread_join(threads[n], NULL), 0);
+       }
+
+       close(ctx.epfd);
+       close(ctx.evfd);
+}
+
 TEST_HARNESS_MAIN
index 3bcd4c3..b4da41d 100644 (file)
@@ -6,7 +6,7 @@
 echo 0 > events/enable
 echo > dynamic_events
 
-PLACE=kernel_clone
+PLACE=$FUNCTION_FORK
 
 echo "p:myevent1 $PLACE" >> dynamic_events
 echo "r:myevent2 $PLACE" >> dynamic_events
index 4389619..3a0e288 100644 (file)
@@ -6,7 +6,7 @@
 echo 0 > events/enable
 echo > dynamic_events
 
-PLACE=kernel_clone
+PLACE=$FUNCTION_FORK
 
 setup_events() {
 echo "p:myevent1 $PLACE" >> dynamic_events
index a8603bd..d3e138e 100644 (file)
@@ -6,7 +6,7 @@
 echo 0 > events/enable
 echo > dynamic_events
 
-PLACE=kernel_clone
+PLACE=$FUNCTION_FORK
 
 setup_events() {
 echo "p:myevent1 $PLACE" >> dynamic_events
index acb17ce..8054196 100644 (file)
@@ -39,7 +39,7 @@ do_test() {
     disable_tracing
 
     echo do_execve* > set_ftrace_filter
-    echo *do_fork >> set_ftrace_filter
+    echo $FUNCTION_FORK >> set_ftrace_filter
 
     echo $PID > set_ftrace_notrace_pid
     echo function > current_tracer
index 9f0a968..2f72112 100644 (file)
@@ -39,7 +39,7 @@ do_test() {
     disable_tracing
 
     echo do_execve* > set_ftrace_filter
-    echo *do_fork >> set_ftrace_filter
+    echo $FUNCTION_FORK >> set_ftrace_filter
 
     echo $PID > set_ftrace_pid
     echo function > current_tracer
index 98305d7..191d116 100644 (file)
@@ -4,9 +4,9 @@
 # requires: set_ftrace_filter
 # flags: instance
 
-echo kernel_clone:stacktrace >> set_ftrace_filter
+echo $FUNCTION_FORK:stacktrace >> set_ftrace_filter
 
-grep -q "kernel_clone:stacktrace:unlimited" set_ftrace_filter
+grep -q "$FUNCTION_FORK:stacktrace:unlimited" set_ftrace_filter
 
 (echo "forked"; sleep 1)
 
index c5dec55..a6fac92 100644 (file)
@@ -133,6 +133,13 @@ yield() {
     ping $LOCALHOST -c 1 || sleep .001 || usleep 1 || sleep 1
 }
 
+# The fork function in the kernel was renamed from "_do_fork" to
+# "kernel_fork". As older tests should still work with older kernels
+# as well as newer kernels, check which version of fork is used on this
+# kernel so that the tests can use the fork function for the running kernel.
+FUNCTION_FORK=`(if grep '\bkernel_clone\b' /proc/kallsyms > /dev/null; then
+                echo kernel_clone; else echo '_do_fork'; fi)`
+
 # Since probe event command may include backslash, explicitly use printf "%s"
 # to NOT interpret it.
 ftrace_errlog_check() { # err-prefix command-with-error-pos-by-^ command-file
index 9737cd0..2428a3e 100644 (file)
@@ -3,7 +3,7 @@
 # description: Kprobe dynamic event - adding and removing
 # requires: kprobe_events
 
-echo p:myevent kernel_clone > kprobe_events
+echo p:myevent $FUNCTION_FORK > kprobe_events
 grep myevent kprobe_events
 test -d events/kprobes/myevent
 echo > kprobe_events
index f9a40af..010a8b1 100644 (file)
@@ -3,7 +3,7 @@
 # description: Kprobe dynamic event - busy event check
 # requires: kprobe_events
 
-echo p:myevent kernel_clone > kprobe_events
+echo p:myevent $FUNCTION_FORK > kprobe_events
 test -d events/kprobes/myevent
 echo 1 > events/kprobes/myevent/enable
 echo > kprobe_events && exit_fail # this must fail
index eb543d3..a96a1dc 100644 (file)
@@ -3,13 +3,13 @@
 # description: Kprobe dynamic event with arguments
 # requires: kprobe_events
 
-echo 'p:testprobe kernel_clone $stack $stack0 +0($stack)' > kprobe_events
+echo "p:testprobe $FUNCTION_FORK \$stack \$stack0 +0(\$stack)" > kprobe_events
 grep testprobe kprobe_events | grep -q 'arg1=\$stack arg2=\$stack0 arg3=+0(\$stack)'
 test -d events/kprobes/testprobe
 
 echo 1 > events/kprobes/testprobe/enable
 ( echo "forked")
-grep testprobe trace | grep 'kernel_clone' | \
+grep testprobe trace | grep "$FUNCTION_FORK" | \
   grep -q 'arg1=0x[[:xdigit:]]* arg2=0x[[:xdigit:]]* arg3=0x[[:xdigit:]]*$'
 
 echo 0 > events/kprobes/testprobe/enable
index 4e5b63b..a053ee2 100644 (file)
@@ -5,7 +5,7 @@
 
 grep -A1 "fetcharg:" README | grep -q "\$comm" || exit_unsupported # this is too old
 
-echo 'p:testprobe kernel_clone comm=$comm ' > kprobe_events
+echo "p:testprobe $FUNCTION_FORK comm=\$comm " > kprobe_events
 grep testprobe kprobe_events | grep -q 'comm=$comm'
 test -d events/kprobes/testprobe
 
index a1d7058..84285a6 100644 (file)
@@ -30,13 +30,13 @@ esac
 : "Test get argument (1)"
 echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events
 echo 1 > events/kprobes/testprobe/enable
-echo "p:test kernel_clone" >> kprobe_events
+echo "p:test $FUNCTION_FORK" >> kprobe_events
 grep -qe "testprobe.* arg1=\"test\"" trace
 
 echo 0 > events/kprobes/testprobe/enable
 : "Test get argument (2)"
 echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
 echo 1 > events/kprobes/testprobe/enable
-echo "p:test kernel_clone" >> kprobe_events
+echo "p:test $FUNCTION_FORK" >> kprobe_events
 grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace
 
index bd25dd0..717130e 100644 (file)
@@ -14,12 +14,12 @@ elif ! grep "$SYMBOL\$" /proc/kallsyms; then
 fi
 
 : "Test get basic types symbol argument"
-echo "p:testprobe_u kernel_clone arg1=@linux_proc_banner:u64 arg2=@linux_proc_banner:u32 arg3=@linux_proc_banner:u16 arg4=@linux_proc_banner:u8" > kprobe_events
-echo "p:testprobe_s kernel_clone arg1=@linux_proc_banner:s64 arg2=@linux_proc_banner:s32 arg3=@linux_proc_banner:s16 arg4=@linux_proc_banner:s8" >> kprobe_events
+echo "p:testprobe_u $FUNCTION_FORK arg1=@linux_proc_banner:u64 arg2=@linux_proc_banner:u32 arg3=@linux_proc_banner:u16 arg4=@linux_proc_banner:u8" > kprobe_events
+echo "p:testprobe_s $FUNCTION_FORK arg1=@linux_proc_banner:s64 arg2=@linux_proc_banner:s32 arg3=@linux_proc_banner:s16 arg4=@linux_proc_banner:s8" >> kprobe_events
 if grep -q "x8/16/32/64" README; then
-  echo "p:testprobe_x kernel_clone arg1=@linux_proc_banner:x64 arg2=@linux_proc_banner:x32 arg3=@linux_proc_banner:x16 arg4=@linux_proc_banner:x8" >> kprobe_events
+  echo "p:testprobe_x $FUNCTION_FORK arg1=@linux_proc_banner:x64 arg2=@linux_proc_banner:x32 arg3=@linux_proc_banner:x16 arg4=@linux_proc_banner:x8" >> kprobe_events
 fi
-echo "p:testprobe_bf kernel_clone arg1=@linux_proc_banner:b8@4/32" >> kprobe_events
+echo "p:testprobe_bf $FUNCTION_FORK arg1=@linux_proc_banner:b8@4/32" >> kprobe_events
 echo 1 > events/kprobes/enable
 (echo "forked")
 echo 0 > events/kprobes/enable
@@ -27,7 +27,7 @@ grep "testprobe_[usx]:.* arg1=.* arg2=.* arg3=.* arg4=.*" trace
 grep "testprobe_bf:.* arg1=.*" trace
 
 : "Test get string symbol argument"
-echo "p:testprobe_str kernel_clone arg1=@linux_proc_banner:string" > kprobe_events
+echo "p:testprobe_str $FUNCTION_FORK arg1=@linux_proc_banner:string" > kprobe_events
 echo 1 > events/kprobes/enable
 (echo "forked")
 echo 0 > events/kprobes/enable
index 91fcce1..25b7708 100644 (file)
@@ -4,7 +4,7 @@
 # requires: kprobe_events "x8/16/32/64":README
 
 gen_event() { # Bitsize
-  echo "p:testprobe kernel_clone \$stack0:s$1 \$stack0:u$1 \$stack0:x$1 \$stack0:b4@4/$1"
+  echo "p:testprobe $FUNCTION_FORK \$stack0:s$1 \$stack0:u$1 \$stack0:x$1 \$stack0:b4@4/$1"
 }
 
 check_types() { # s-type u-type x-type bf-type width
index a30a9c0..d25d01a 100644 (file)
@@ -9,12 +9,16 @@ grep -A10 "fetcharg:" README | grep -q '\[u\]<offset>' || exit_unsupported
 :;: "user-memory access syntax and ustring working on user memory";:
 echo 'p:myevent do_sys_open path=+0($arg2):ustring path2=+u0($arg2):string' \
        > kprobe_events
+echo 'p:myevent2 do_sys_openat2 path=+0($arg2):ustring path2=+u0($arg2):string' \
+       >> kprobe_events
 
 grep myevent kprobe_events | \
        grep -q 'path=+0($arg2):ustring path2=+u0($arg2):string'
 echo 1 > events/kprobes/myevent/enable
+echo 1 > events/kprobes/myevent2/enable
 echo > /dev/null
 echo 0 > events/kprobes/myevent/enable
+echo 0 > events/kprobes/myevent2/enable
 
 grep myevent trace | grep -q 'path="/dev/null" path2="/dev/null"'
 
index 0d17909..5556292 100644 (file)
@@ -5,29 +5,29 @@
 
 # prepare
 echo nop > current_tracer
-echo kernel_clone > set_ftrace_filter
-echo 'p:testprobe kernel_clone' > kprobe_events
+echo $FUNCTION_FORK > set_ftrace_filter
+echo "p:testprobe $FUNCTION_FORK" > kprobe_events
 
 # kprobe on / ftrace off
 echo 1 > events/kprobes/testprobe/enable
 echo > trace
 ( echo "forked")
 grep testprobe trace
-! grep 'kernel_clone <-' trace
+! grep "$FUNCTION_FORK <-" trace
 
 # kprobe on / ftrace on
 echo function > current_tracer
 echo > trace
 ( echo "forked")
 grep testprobe trace
-grep 'kernel_clone <-' trace
+grep "$FUNCTION_FORK <-" trace
 
 # kprobe off / ftrace on
 echo 0 > events/kprobes/testprobe/enable
 echo > trace
 ( echo "forked")
 ! grep testprobe trace
-grep 'kernel_clone <-' trace
+grep "$FUNCTION_FORK <-" trace
 
 # kprobe on / ftrace on
 echo 1 > events/kprobes/testprobe/enable
@@ -35,11 +35,11 @@ echo function > current_tracer
 echo > trace
 ( echo "forked")
 grep testprobe trace
-grep 'kernel_clone <-' trace
+grep "$FUNCTION_FORK <-" trace
 
 # kprobe on / ftrace off
 echo nop > current_tracer
 echo > trace
 ( echo "forked")
 grep testprobe trace
-! grep 'kernel_clone <-' trace
+! grep "$FUNCTION_FORK <-" trace
index 45d90b6..f0d5b77 100644 (file)
@@ -4,7 +4,7 @@
 # requires: kprobe_events "Create/append/":README
 
 # Choose 2 symbols for target
-SYM1=kernel_clone
+SYM1=$FUNCTION_FORK
 SYM2=do_exit
 EVENT_NAME=kprobes/testevent
 
index 1b5550e..fa928b4 100644 (file)
@@ -86,15 +86,15 @@ esac
 
 # multiprobe errors
 if grep -q "Create/append/" README && grep -q "imm-value" README; then
-echo 'p:kprobes/testevent kernel_clone' > kprobe_events
+echo "p:kprobes/testevent $FUNCTION_FORK" > kprobe_events
 check_error '^r:kprobes/testevent do_exit'     # DIFF_PROBE_TYPE
 
 # Explicitly use printf "%s" to not interpret \1
-printf "%s" 'p:kprobes/testevent kernel_clone abcd=\1' > kprobe_events
-check_error 'p:kprobes/testevent kernel_clone ^bcd=\1' # DIFF_ARG_TYPE
-check_error 'p:kprobes/testevent kernel_clone ^abcd=\1:u8'     # DIFF_ARG_TYPE
-check_error 'p:kprobes/testevent kernel_clone ^abcd=\"foo"'    # DIFF_ARG_TYPE
-check_error '^p:kprobes/testevent kernel_clone abcd=\1'        # SAME_PROBE
+printf "%s" "p:kprobes/testevent $FUNCTION_FORK abcd=\\1" > kprobe_events
+check_error "p:kprobes/testevent $FUNCTION_FORK ^bcd=\\1"      # DIFF_ARG_TYPE
+check_error "p:kprobes/testevent $FUNCTION_FORK ^abcd=\\1:u8"  # DIFF_ARG_TYPE
+check_error "p:kprobes/testevent $FUNCTION_FORK ^abcd=\\\"foo\"" # DIFF_ARG_TYPE
+check_error "^p:kprobes/testevent $FUNCTION_FORK abcd=\\1"     # SAME_PROBE
 fi
 
 # %return suffix errors
index 7ae492c..197cc2a 100644 (file)
@@ -4,14 +4,14 @@
 # requires: kprobe_events
 
 # Add new kretprobe event
-echo 'r:testprobe2 kernel_clone $retval' > kprobe_events
+echo "r:testprobe2 $FUNCTION_FORK \$retval" > kprobe_events
 grep testprobe2 kprobe_events | grep -q 'arg1=\$retval'
 test -d events/kprobes/testprobe2
 
 echo 1 > events/kprobes/testprobe2/enable
 ( echo "forked")
 
-cat trace | grep testprobe2 | grep -q '<- kernel_clone'
+cat trace | grep testprobe2 | grep -q "<- $FUNCTION_FORK"
 
 echo 0 > events/kprobes/testprobe2/enable
 echo '-:testprobe2' >> kprobe_events
index c4093fc..98166fa 100644 (file)
@@ -4,7 +4,7 @@
 # requires: kprobe_events
 
 ! grep -q 'myevent' kprobe_profile
-echo p:myevent kernel_clone > kprobe_events
+echo "p:myevent $FUNCTION_FORK" > kprobe_events
 grep -q 'myevent[[:space:]]*0[[:space:]]*0$' kprobe_profile
 echo 1 > events/kprobes/myevent/enable
 ( echo "forked" )
index f19804d..edce854 100644 (file)
        snprintf(_metadata->results->reason, \
                 sizeof(_metadata->results->reason), fmt, ##__VA_ARGS__); \
        if (TH_LOG_ENABLED) { \
-               fprintf(TH_LOG_STREAM, "#      SKIP     %s\n", \
+               fprintf(TH_LOG_STREAM, "#      SKIP      %s\n", \
                        _metadata->results->reason); \
        } \
        _metadata->passed = 1; \
  */
 
 /**
- * ASSERT_EQ(expected, seen)
+ * ASSERT_EQ()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, ==, 1)
 
 /**
- * ASSERT_NE(expected, seen)
+ * ASSERT_NE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, !=, 1)
 
 /**
- * ASSERT_LT(expected, seen)
+ * ASSERT_LT()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, <, 1)
 
 /**
- * ASSERT_LE(expected, seen)
+ * ASSERT_LE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, <=, 1)
 
 /**
- * ASSERT_GT(expected, seen)
+ * ASSERT_GT()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, >, 1)
 
 /**
- * ASSERT_GE(expected, seen)
+ * ASSERT_GE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, >=, 1)
 
 /**
- * ASSERT_NULL(seen)
+ * ASSERT_NULL()
  *
  * @seen: measured value
  *
        __EXPECT(NULL, "NULL", seen, #seen, ==, 1)
 
 /**
- * ASSERT_TRUE(seen)
+ * ASSERT_TRUE()
  *
  * @seen: measured value
  *
        __EXPECT(0, "0", seen, #seen, !=, 1)
 
 /**
- * ASSERT_FALSE(seen)
+ * ASSERT_FALSE()
  *
  * @seen: measured value
  *
        __EXPECT(0, "0", seen, #seen, ==, 1)
 
 /**
- * ASSERT_STREQ(expected, seen)
+ * ASSERT_STREQ()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT_STR(expected, seen, ==, 1)
 
 /**
- * ASSERT_STRNE(expected, seen)
+ * ASSERT_STRNE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT_STR(expected, seen, !=, 1)
 
 /**
- * EXPECT_EQ(expected, seen)
+ * EXPECT_EQ()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, ==, 0)
 
 /**
- * EXPECT_NE(expected, seen)
+ * EXPECT_NE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, !=, 0)
 
 /**
- * EXPECT_LT(expected, seen)
+ * EXPECT_LT()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, <, 0)
 
 /**
- * EXPECT_LE(expected, seen)
+ * EXPECT_LE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, <=, 0)
 
 /**
- * EXPECT_GT(expected, seen)
+ * EXPECT_GT()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, >, 0)
 
 /**
- * EXPECT_GE(expected, seen)
+ * EXPECT_GE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, >=, 0)
 
 /**
- * EXPECT_NULL(seen)
+ * EXPECT_NULL()
  *
  * @seen: measured value
  *
        __EXPECT(NULL, "NULL", seen, #seen, ==, 0)
 
 /**
- * EXPECT_TRUE(seen)
+ * EXPECT_TRUE()
  *
  * @seen: measured value
  *
        __EXPECT(0, "0", seen, #seen, !=, 0)
 
 /**
- * EXPECT_FALSE(seen)
+ * EXPECT_FALSE()
  *
  * @seen: measured value
  *
        __EXPECT(0, "0", seen, #seen, ==, 0)
 
 /**
- * EXPECT_STREQ(expected, seen)
+ * EXPECT_STREQ()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT_STR(expected, seen, ==, 0)
 
 /**
- * EXPECT_STRNE(expected, seen)
+ * EXPECT_STRNE()
  *
  * @expected: expected value
  * @seen: measured value
index 307ceaa..7a2c242 100644 (file)
@@ -1,10 +1,13 @@
 # SPDX-License-Identifier: GPL-2.0-only
+/aarch64/get-reg-list
+/aarch64/get-reg-list-sve
 /s390x/memop
 /s390x/resets
 /s390x/sync_regs_test
 /x86_64/cr4_cpuid_sync_test
 /x86_64/debug_regs
 /x86_64/evmcs_test
+/x86_64/kvm_pv_test
 /x86_64/hyperv_cpuid
 /x86_64/mmio_warning_test
 /x86_64/platform_info_test
@@ -15,6 +18,7 @@
 /x86_64/vmx_preemption_timer_test
 /x86_64/svm_vmcall_test
 /x86_64/sync_regs_test
+/x86_64/vmx_apic_access_test
 /x86_64/vmx_close_while_nested_test
 /x86_64/vmx_dirty_log_test
 /x86_64/vmx_set_nested_state_test
@@ -23,6 +27,7 @@
 /clear_dirty_log_test
 /demand_paging_test
 /dirty_log_test
+/dirty_log_perf_test
 /kvm_create_max_vcpus
 /set_memory_region_test
 /steal_time
index 7ebe71f..3d14ef7 100644 (file)
@@ -34,13 +34,14 @@ ifeq ($(ARCH),s390)
 endif
 
 LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/sparsebit.c lib/test_util.c
-LIBKVM_x86_64 = lib/x86_64/processor.c lib/x86_64/vmx.c lib/x86_64/svm.c lib/x86_64/ucall.c
+LIBKVM_x86_64 = lib/x86_64/processor.c lib/x86_64/vmx.c lib/x86_64/svm.c lib/x86_64/ucall.c lib/x86_64/handlers.S
 LIBKVM_aarch64 = lib/aarch64/processor.c lib/aarch64/ucall.c
 LIBKVM_s390x = lib/s390x/processor.c lib/s390x/ucall.c
 
 TEST_GEN_PROGS_x86_64 = x86_64/cr4_cpuid_sync_test
 TEST_GEN_PROGS_x86_64 += x86_64/evmcs_test
 TEST_GEN_PROGS_x86_64 += x86_64/hyperv_cpuid
+TEST_GEN_PROGS_x86_64 += x86_64/kvm_pv_test
 TEST_GEN_PROGS_x86_64 += x86_64/mmio_warning_test
 TEST_GEN_PROGS_x86_64 += x86_64/platform_info_test
 TEST_GEN_PROGS_x86_64 += x86_64/set_sregs_test
@@ -49,6 +50,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/state_test
 TEST_GEN_PROGS_x86_64 += x86_64/vmx_preemption_timer_test
 TEST_GEN_PROGS_x86_64 += x86_64/svm_vmcall_test
 TEST_GEN_PROGS_x86_64 += x86_64/sync_regs_test
+TEST_GEN_PROGS_x86_64 += x86_64/vmx_apic_access_test
 TEST_GEN_PROGS_x86_64 += x86_64/vmx_close_while_nested_test
 TEST_GEN_PROGS_x86_64 += x86_64/vmx_dirty_log_test
 TEST_GEN_PROGS_x86_64 += x86_64/vmx_set_nested_state_test
@@ -57,14 +59,15 @@ TEST_GEN_PROGS_x86_64 += x86_64/xss_msr_test
 TEST_GEN_PROGS_x86_64 += x86_64/debug_regs
 TEST_GEN_PROGS_x86_64 += x86_64/tsc_msrs_test
 TEST_GEN_PROGS_x86_64 += x86_64/user_msr_test
-TEST_GEN_PROGS_x86_64 += clear_dirty_log_test
 TEST_GEN_PROGS_x86_64 += demand_paging_test
 TEST_GEN_PROGS_x86_64 += dirty_log_test
+TEST_GEN_PROGS_x86_64 += dirty_log_perf_test
 TEST_GEN_PROGS_x86_64 += kvm_create_max_vcpus
 TEST_GEN_PROGS_x86_64 += set_memory_region_test
 TEST_GEN_PROGS_x86_64 += steal_time
 
-TEST_GEN_PROGS_aarch64 += clear_dirty_log_test
+TEST_GEN_PROGS_aarch64 += aarch64/get-reg-list
+TEST_GEN_PROGS_aarch64 += aarch64/get-reg-list-sve
 TEST_GEN_PROGS_aarch64 += demand_paging_test
 TEST_GEN_PROGS_aarch64 += dirty_log_test
 TEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus
@@ -110,14 +113,21 @@ LDFLAGS += -pthread $(no-pie-option) $(pgste-option)
 include ../lib.mk
 
 STATIC_LIBS := $(OUTPUT)/libkvm.a
-LIBKVM_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM))
-EXTRA_CLEAN += $(LIBKVM_OBJ) $(STATIC_LIBS) cscope.*
+LIBKVM_C := $(filter %.c,$(LIBKVM))
+LIBKVM_S := $(filter %.S,$(LIBKVM))
+LIBKVM_C_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM_C))
+LIBKVM_S_OBJ := $(patsubst %.S, $(OUTPUT)/%.o, $(LIBKVM_S))
+EXTRA_CLEAN += $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ) $(STATIC_LIBS) cscope.*
+
+x := $(shell mkdir -p $(sort $(dir $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ))))
+$(LIBKVM_C_OBJ): $(OUTPUT)/%.o: %.c
+       $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
-x := $(shell mkdir -p $(sort $(dir $(LIBKVM_OBJ))))
-$(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c
+$(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S
        $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
-$(OUTPUT)/libkvm.a: $(LIBKVM_OBJ)
+LIBKVM_OBJS = $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ)
+$(OUTPUT)/libkvm.a: $(LIBKVM_OBJS)
        $(AR) crs $@ $^
 
 x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list-sve.c b/tools/testing/selftests/kvm/aarch64/get-reg-list-sve.c
new file mode 100644 (file)
index 0000000..efba766
--- /dev/null
@@ -0,0 +1,3 @@
+// SPDX-License-Identifier: GPL-2.0
+#define REG_LIST_SVE
+#include "get-reg-list.c"
diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
new file mode 100644 (file)
index 0000000..33218a3
--- /dev/null
@@ -0,0 +1,841 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Check for KVM_GET_REG_LIST regressions.
+ *
+ * Copyright (C) 2020, Red Hat, Inc.
+ *
+ * When attempting to migrate from a host with an older kernel to a host
+ * with a newer kernel we allow the newer kernel on the destination to
+ * list new registers with get-reg-list. We assume they'll be unused, at
+ * least until the guest reboots, and so they're relatively harmless.
+ * However, if the destination host with the newer kernel is missing
+ * registers which the source host with the older kernel has, then that's
+ * a regression in get-reg-list. This test checks for that regression by
+ * checking the current list against a blessed list. We should never have
+ * missing registers, but if new ones appear then they can probably be
+ * added to the blessed list. A completely new blessed list can be created
+ * by running the test with the --list command line argument.
+ *
+ * Note, the blessed list should be created from the oldest possible
+ * kernel. We can't go older than v4.15, though, because that's the first
+ * release to expose the ID system registers in KVM_GET_REG_LIST, see
+ * commit 93390c0a1b20 ("arm64: KVM: Hide unsupported AArch64 CPU features
+ * from guests"). Also, one must use the --core-reg-fixup command line
+ * option when running on an older kernel that doesn't include df205b5c6328
+ * ("KVM: arm64: Filter out invalid core register IDs in KVM_GET_REG_LIST")
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "kvm_util.h"
+#include "test_util.h"
+#include "processor.h"
+
+#ifdef REG_LIST_SVE
+#define reg_list_sve() (true)
+#else
+#define reg_list_sve() (false)
+#endif
+
+#define REG_MASK (KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_COPROC_MASK)
+
+#define for_each_reg(i)                                                                \
+       for ((i) = 0; (i) < reg_list->n; ++(i))
+
+#define for_each_missing_reg(i)                                                        \
+       for ((i) = 0; (i) < blessed_n; ++(i))                                   \
+               if (!find_reg(reg_list->reg, reg_list->n, blessed_reg[i]))
+
+#define for_each_new_reg(i)                                                    \
+       for ((i) = 0; (i) < reg_list->n; ++(i))                                 \
+               if (!find_reg(blessed_reg, blessed_n, reg_list->reg[i]))
+
+
+static struct kvm_reg_list *reg_list;
+
+static __u64 base_regs[], vregs[], sve_regs[], rejects_set[];
+static __u64 base_regs_n, vregs_n, sve_regs_n, rejects_set_n;
+static __u64 *blessed_reg, blessed_n;
+
+static bool find_reg(__u64 regs[], __u64 nr_regs, __u64 reg)
+{
+       int i;
+
+       for (i = 0; i < nr_regs; ++i)
+               if (reg == regs[i])
+                       return true;
+       return false;
+}
+
+static const char *str_with_index(const char *template, __u64 index)
+{
+       char *str, *p;
+       int n;
+
+       str = strdup(template);
+       p = strstr(str, "##");
+       n = sprintf(p, "%lld", index);
+       strcat(p + n, strstr(template, "##") + 2);
+
+       return (const char *)str;
+}
+
+#define CORE_REGS_XX_NR_WORDS  2
+#define CORE_SPSR_XX_NR_WORDS  2
+#define CORE_FPREGS_XX_NR_WORDS        4
+
+static const char *core_id_to_str(__u64 id)
+{
+       __u64 core_off = id & ~REG_MASK, idx;
+
+       /*
+        * core_off is the offset into struct kvm_regs
+        */
+       switch (core_off) {
+       case KVM_REG_ARM_CORE_REG(regs.regs[0]) ...
+            KVM_REG_ARM_CORE_REG(regs.regs[30]):
+               idx = (core_off - KVM_REG_ARM_CORE_REG(regs.regs[0])) / CORE_REGS_XX_NR_WORDS;
+               TEST_ASSERT(idx < 31, "Unexpected regs.regs index: %lld", idx);
+               return str_with_index("KVM_REG_ARM_CORE_REG(regs.regs[##])", idx);
+       case KVM_REG_ARM_CORE_REG(regs.sp):
+               return "KVM_REG_ARM_CORE_REG(regs.sp)";
+       case KVM_REG_ARM_CORE_REG(regs.pc):
+               return "KVM_REG_ARM_CORE_REG(regs.pc)";
+       case KVM_REG_ARM_CORE_REG(regs.pstate):
+               return "KVM_REG_ARM_CORE_REG(regs.pstate)";
+       case KVM_REG_ARM_CORE_REG(sp_el1):
+               return "KVM_REG_ARM_CORE_REG(sp_el1)";
+       case KVM_REG_ARM_CORE_REG(elr_el1):
+               return "KVM_REG_ARM_CORE_REG(elr_el1)";
+       case KVM_REG_ARM_CORE_REG(spsr[0]) ...
+            KVM_REG_ARM_CORE_REG(spsr[KVM_NR_SPSR - 1]):
+               idx = (core_off - KVM_REG_ARM_CORE_REG(spsr[0])) / CORE_SPSR_XX_NR_WORDS;
+               TEST_ASSERT(idx < KVM_NR_SPSR, "Unexpected spsr index: %lld", idx);
+               return str_with_index("KVM_REG_ARM_CORE_REG(spsr[##])", idx);
+       case KVM_REG_ARM_CORE_REG(fp_regs.vregs[0]) ...
+            KVM_REG_ARM_CORE_REG(fp_regs.vregs[31]):
+               idx = (core_off - KVM_REG_ARM_CORE_REG(fp_regs.vregs[0])) / CORE_FPREGS_XX_NR_WORDS;
+               TEST_ASSERT(idx < 32, "Unexpected fp_regs.vregs index: %lld", idx);
+               return str_with_index("KVM_REG_ARM_CORE_REG(fp_regs.vregs[##])", idx);
+       case KVM_REG_ARM_CORE_REG(fp_regs.fpsr):
+               return "KVM_REG_ARM_CORE_REG(fp_regs.fpsr)";
+       case KVM_REG_ARM_CORE_REG(fp_regs.fpcr):
+               return "KVM_REG_ARM_CORE_REG(fp_regs.fpcr)";
+       }
+
+       TEST_FAIL("Unknown core reg id: 0x%llx", id);
+       return NULL;
+}
+
+static const char *sve_id_to_str(__u64 id)
+{
+       __u64 sve_off, n, i;
+
+       if (id == KVM_REG_ARM64_SVE_VLS)
+               return "KVM_REG_ARM64_SVE_VLS";
+
+       sve_off = id & ~(REG_MASK | ((1ULL << 5) - 1));
+       i = id & (KVM_ARM64_SVE_MAX_SLICES - 1);
+
+       TEST_ASSERT(i == 0, "Currently we don't expect slice > 0, reg id 0x%llx", id);
+
+       switch (sve_off) {
+       case KVM_REG_ARM64_SVE_ZREG_BASE ...
+            KVM_REG_ARM64_SVE_ZREG_BASE + (1ULL << 5) * KVM_ARM64_SVE_NUM_ZREGS - 1:
+               n = (id >> 5) & (KVM_ARM64_SVE_NUM_ZREGS - 1);
+               TEST_ASSERT(id == KVM_REG_ARM64_SVE_ZREG(n, 0),
+                           "Unexpected bits set in SVE ZREG id: 0x%llx", id);
+               return str_with_index("KVM_REG_ARM64_SVE_ZREG(##, 0)", n);
+       case KVM_REG_ARM64_SVE_PREG_BASE ...
+            KVM_REG_ARM64_SVE_PREG_BASE + (1ULL << 5) * KVM_ARM64_SVE_NUM_PREGS - 1:
+               n = (id >> 5) & (KVM_ARM64_SVE_NUM_PREGS - 1);
+               TEST_ASSERT(id == KVM_REG_ARM64_SVE_PREG(n, 0),
+                           "Unexpected bits set in SVE PREG id: 0x%llx", id);
+               return str_with_index("KVM_REG_ARM64_SVE_PREG(##, 0)", n);
+       case KVM_REG_ARM64_SVE_FFR_BASE:
+               TEST_ASSERT(id == KVM_REG_ARM64_SVE_FFR(0),
+                           "Unexpected bits set in SVE FFR id: 0x%llx", id);
+               return "KVM_REG_ARM64_SVE_FFR(0)";
+       }
+
+       return NULL;
+}
+
+static void print_reg(__u64 id)
+{
+       unsigned op0, op1, crn, crm, op2;
+       const char *reg_size = NULL;
+
+       TEST_ASSERT((id & KVM_REG_ARCH_MASK) == KVM_REG_ARM64,
+                   "KVM_REG_ARM64 missing in reg id: 0x%llx", id);
+
+       switch (id & KVM_REG_SIZE_MASK) {
+       case KVM_REG_SIZE_U8:
+               reg_size = "KVM_REG_SIZE_U8";
+               break;
+       case KVM_REG_SIZE_U16:
+               reg_size = "KVM_REG_SIZE_U16";
+               break;
+       case KVM_REG_SIZE_U32:
+               reg_size = "KVM_REG_SIZE_U32";
+               break;
+       case KVM_REG_SIZE_U64:
+               reg_size = "KVM_REG_SIZE_U64";
+               break;
+       case KVM_REG_SIZE_U128:
+               reg_size = "KVM_REG_SIZE_U128";
+               break;
+       case KVM_REG_SIZE_U256:
+               reg_size = "KVM_REG_SIZE_U256";
+               break;
+       case KVM_REG_SIZE_U512:
+               reg_size = "KVM_REG_SIZE_U512";
+               break;
+       case KVM_REG_SIZE_U1024:
+               reg_size = "KVM_REG_SIZE_U1024";
+               break;
+       case KVM_REG_SIZE_U2048:
+               reg_size = "KVM_REG_SIZE_U2048";
+               break;
+       default:
+               TEST_FAIL("Unexpected reg size: 0x%llx in reg id: 0x%llx",
+                         (id & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT, id);
+       }
+
+       switch (id & KVM_REG_ARM_COPROC_MASK) {
+       case KVM_REG_ARM_CORE:
+               printf("\tKVM_REG_ARM64 | %s | KVM_REG_ARM_CORE | %s,\n", reg_size, core_id_to_str(id));
+               break;
+       case KVM_REG_ARM_DEMUX:
+               TEST_ASSERT(!(id & ~(REG_MASK | KVM_REG_ARM_DEMUX_ID_MASK | KVM_REG_ARM_DEMUX_VAL_MASK)),
+                           "Unexpected bits set in DEMUX reg id: 0x%llx", id);
+               printf("\tKVM_REG_ARM64 | %s | KVM_REG_ARM_DEMUX | KVM_REG_ARM_DEMUX_ID_CCSIDR | %lld,\n",
+                      reg_size, id & KVM_REG_ARM_DEMUX_VAL_MASK);
+               break;
+       case KVM_REG_ARM64_SYSREG:
+               op0 = (id & KVM_REG_ARM64_SYSREG_OP0_MASK) >> KVM_REG_ARM64_SYSREG_OP0_SHIFT;
+               op1 = (id & KVM_REG_ARM64_SYSREG_OP1_MASK) >> KVM_REG_ARM64_SYSREG_OP1_SHIFT;
+               crn = (id & KVM_REG_ARM64_SYSREG_CRN_MASK) >> KVM_REG_ARM64_SYSREG_CRN_SHIFT;
+               crm = (id & KVM_REG_ARM64_SYSREG_CRM_MASK) >> KVM_REG_ARM64_SYSREG_CRM_SHIFT;
+               op2 = (id & KVM_REG_ARM64_SYSREG_OP2_MASK) >> KVM_REG_ARM64_SYSREG_OP2_SHIFT;
+               TEST_ASSERT(id == ARM64_SYS_REG(op0, op1, crn, crm, op2),
+                           "Unexpected bits set in SYSREG reg id: 0x%llx", id);
+               printf("\tARM64_SYS_REG(%d, %d, %d, %d, %d),\n", op0, op1, crn, crm, op2);
+               break;
+       case KVM_REG_ARM_FW:
+               TEST_ASSERT(id == KVM_REG_ARM_FW_REG(id & 0xffff),
+                           "Unexpected bits set in FW reg id: 0x%llx", id);
+               printf("\tKVM_REG_ARM_FW_REG(%lld),\n", id & 0xffff);
+               break;
+       case KVM_REG_ARM64_SVE:
+               if (reg_list_sve())
+                       printf("\t%s,\n", sve_id_to_str(id));
+               else
+                       TEST_FAIL("KVM_REG_ARM64_SVE is an unexpected coproc type in reg id: 0x%llx", id);
+               break;
+       default:
+               TEST_FAIL("Unexpected coproc type: 0x%llx in reg id: 0x%llx",
+                         (id & KVM_REG_ARM_COPROC_MASK) >> KVM_REG_ARM_COPROC_SHIFT, id);
+       }
+}
+
+/*
+ * Older kernels listed each 32-bit word of CORE registers separately.
+ * For 64 and 128-bit registers we need to ignore the extra words. We
+ * also need to fixup the sizes, because the older kernels stated all
+ * registers were 64-bit, even when they weren't.
+ */
+static void core_reg_fixup(void)
+{
+       struct kvm_reg_list *tmp;
+       __u64 id, core_off;
+       int i;
+
+       tmp = calloc(1, sizeof(*tmp) + reg_list->n * sizeof(__u64));
+
+       for (i = 0; i < reg_list->n; ++i) {
+               id = reg_list->reg[i];
+
+               if ((id & KVM_REG_ARM_COPROC_MASK) != KVM_REG_ARM_CORE) {
+                       tmp->reg[tmp->n++] = id;
+                       continue;
+               }
+
+               core_off = id & ~REG_MASK;
+
+               switch (core_off) {
+               case 0x52: case 0xd2: case 0xd6:
+                       /*
+                        * These offsets are pointing at padding.
+                        * We need to ignore them too.
+                        */
+                       continue;
+               case KVM_REG_ARM_CORE_REG(fp_regs.vregs[0]) ...
+                    KVM_REG_ARM_CORE_REG(fp_regs.vregs[31]):
+                       if (core_off & 3)
+                               continue;
+                       id &= ~KVM_REG_SIZE_MASK;
+                       id |= KVM_REG_SIZE_U128;
+                       tmp->reg[tmp->n++] = id;
+                       continue;
+               case KVM_REG_ARM_CORE_REG(fp_regs.fpsr):
+               case KVM_REG_ARM_CORE_REG(fp_regs.fpcr):
+                       id &= ~KVM_REG_SIZE_MASK;
+                       id |= KVM_REG_SIZE_U32;
+                       tmp->reg[tmp->n++] = id;
+                       continue;
+               default:
+                       if (core_off & 1)
+                               continue;
+                       tmp->reg[tmp->n++] = id;
+                       break;
+               }
+       }
+
+       free(reg_list);
+       reg_list = tmp;
+}
+
+static void prepare_vcpu_init(struct kvm_vcpu_init *init)
+{
+       if (reg_list_sve())
+               init->features[0] |= 1 << KVM_ARM_VCPU_SVE;
+}
+
+static void finalize_vcpu(struct kvm_vm *vm, uint32_t vcpuid)
+{
+       int feature;
+
+       if (reg_list_sve()) {
+               feature = KVM_ARM_VCPU_SVE;
+               vcpu_ioctl(vm, vcpuid, KVM_ARM_VCPU_FINALIZE, &feature);
+       }
+}
+
+static void check_supported(void)
+{
+       if (reg_list_sve() && !kvm_check_cap(KVM_CAP_ARM_SVE)) {
+               fprintf(stderr, "SVE not available, skipping tests\n");
+               exit(KSFT_SKIP);
+       }
+}
+
+int main(int ac, char **av)
+{
+       struct kvm_vcpu_init init = { .target = -1, };
+       int new_regs = 0, missing_regs = 0, i;
+       int failed_get = 0, failed_set = 0, failed_reject = 0;
+       bool print_list = false, fixup_core_regs = false;
+       struct kvm_vm *vm;
+       __u64 *vec_regs;
+
+       check_supported();
+
+       for (i = 1; i < ac; ++i) {
+               if (strcmp(av[i], "--core-reg-fixup") == 0)
+                       fixup_core_regs = true;
+               else if (strcmp(av[i], "--list") == 0)
+                       print_list = true;
+               else
+                       fprintf(stderr, "Ignoring unknown option: %s\n", av[i]);
+       }
+
+       vm = vm_create(VM_MODE_DEFAULT, DEFAULT_GUEST_PHY_PAGES, O_RDWR);
+       prepare_vcpu_init(&init);
+       aarch64_vcpu_add_default(vm, 0, &init, NULL);
+       finalize_vcpu(vm, 0);
+
+       reg_list = vcpu_get_reg_list(vm, 0);
+
+       if (fixup_core_regs)
+               core_reg_fixup();
+
+       if (print_list) {
+               putchar('\n');
+               for_each_reg(i)
+                       print_reg(reg_list->reg[i]);
+               putchar('\n');
+               return 0;
+       }
+
+       /*
+        * We only test that we can get the register and then write back the
+        * same value. Some registers may allow other values to be written
+        * back, but others only allow some bits to be changed, and at least
+        * for ID registers set will fail if the value does not exactly match
+        * what was returned by get. If registers that allow other values to
+        * be written need to have the other values tested, then we should
+        * create a new set of tests for those in a new independent test
+        * executable.
+        */
+       for_each_reg(i) {
+               uint8_t addr[2048 / 8];
+               struct kvm_one_reg reg = {
+                       .id = reg_list->reg[i],
+                       .addr = (__u64)&addr,
+               };
+               int ret;
+
+               ret = _vcpu_ioctl(vm, 0, KVM_GET_ONE_REG, &reg);
+               if (ret) {
+                       puts("Failed to get ");
+                       print_reg(reg.id);
+                       putchar('\n');
+                       ++failed_get;
+               }
+
+               /* rejects_set registers are rejected after KVM_ARM_VCPU_FINALIZE */
+               if (find_reg(rejects_set, rejects_set_n, reg.id)) {
+                       ret = _vcpu_ioctl(vm, 0, KVM_SET_ONE_REG, &reg);
+                       if (ret != -1 || errno != EPERM) {
+                               printf("Failed to reject (ret=%d, errno=%d) ", ret, errno);
+                               print_reg(reg.id);
+                               putchar('\n');
+                               ++failed_reject;
+                       }
+                       continue;
+               }
+
+               ret = _vcpu_ioctl(vm, 0, KVM_SET_ONE_REG, &reg);
+               if (ret) {
+                       puts("Failed to set ");
+                       print_reg(reg.id);
+                       putchar('\n');
+                       ++failed_set;
+               }
+       }
+
+       if (reg_list_sve()) {
+               blessed_n = base_regs_n + sve_regs_n;
+               vec_regs = sve_regs;
+       } else {
+               blessed_n = base_regs_n + vregs_n;
+               vec_regs = vregs;
+       }
+
+       blessed_reg = calloc(blessed_n, sizeof(__u64));
+       for (i = 0; i < base_regs_n; ++i)
+               blessed_reg[i] = base_regs[i];
+       for (i = 0; i < blessed_n - base_regs_n; ++i)
+               blessed_reg[base_regs_n + i] = vec_regs[i];
+
+       for_each_new_reg(i)
+               ++new_regs;
+
+       for_each_missing_reg(i)
+               ++missing_regs;
+
+       if (new_regs || missing_regs) {
+               printf("Number blessed registers: %5lld\n", blessed_n);
+               printf("Number registers:         %5lld\n", reg_list->n);
+       }
+
+       if (new_regs) {
+               printf("\nThere are %d new registers.\n"
+                      "Consider adding them to the blessed reg "
+                      "list with the following lines:\n\n", new_regs);
+               for_each_new_reg(i)
+                       print_reg(reg_list->reg[i]);
+               putchar('\n');
+       }
+
+       if (missing_regs) {
+               printf("\nThere are %d missing registers.\n"
+                      "The following lines are missing registers:\n\n", missing_regs);
+               for_each_missing_reg(i)
+                       print_reg(blessed_reg[i]);
+               putchar('\n');
+       }
+
+       TEST_ASSERT(!missing_regs && !failed_get && !failed_set && !failed_reject,
+                   "There are %d missing registers; "
+                   "%d registers failed get; %d registers failed set; %d registers failed reject",
+                   missing_regs, failed_get, failed_set, failed_reject);
+
+       return 0;
+}
+
+/*
+ * The current blessed list was primed with the output of kernel version
+ * v4.15 with --core-reg-fixup and then later updated with new registers.
+ */
+static __u64 base_regs[] = {
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[0]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[1]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[2]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[3]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[4]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[5]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[6]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[7]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[8]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[9]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[10]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[11]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[12]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[13]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[14]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[15]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[16]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[17]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[18]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[19]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[20]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[21]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[22]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[23]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[24]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[25]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[26]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[27]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[28]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[29]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[30]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.sp),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.pc),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.pstate),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(sp_el1),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(elr_el1),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(spsr[0]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(spsr[1]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(spsr[2]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(spsr[3]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(spsr[4]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U32 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.fpsr),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U32 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.fpcr),
+       KVM_REG_ARM_FW_REG(0),
+       KVM_REG_ARM_FW_REG(1),
+       KVM_REG_ARM_FW_REG(2),
+       ARM64_SYS_REG(3, 3, 14, 3, 1),  /* CNTV_CTL_EL0 */
+       ARM64_SYS_REG(3, 3, 14, 3, 2),  /* CNTV_CVAL_EL0 */
+       ARM64_SYS_REG(3, 3, 14, 0, 2),
+       ARM64_SYS_REG(3, 0, 0, 0, 0),   /* MIDR_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 0, 6),   /* REVIDR_EL1 */
+       ARM64_SYS_REG(3, 1, 0, 0, 1),   /* CLIDR_EL1 */
+       ARM64_SYS_REG(3, 1, 0, 0, 7),   /* AIDR_EL1 */
+       ARM64_SYS_REG(3, 3, 0, 0, 1),   /* CTR_EL0 */
+       ARM64_SYS_REG(2, 0, 0, 0, 4),
+       ARM64_SYS_REG(2, 0, 0, 0, 5),
+       ARM64_SYS_REG(2, 0, 0, 0, 6),
+       ARM64_SYS_REG(2, 0, 0, 0, 7),
+       ARM64_SYS_REG(2, 0, 0, 1, 4),
+       ARM64_SYS_REG(2, 0, 0, 1, 5),
+       ARM64_SYS_REG(2, 0, 0, 1, 6),
+       ARM64_SYS_REG(2, 0, 0, 1, 7),
+       ARM64_SYS_REG(2, 0, 0, 2, 0),   /* MDCCINT_EL1 */
+       ARM64_SYS_REG(2, 0, 0, 2, 2),   /* MDSCR_EL1 */
+       ARM64_SYS_REG(2, 0, 0, 2, 4),
+       ARM64_SYS_REG(2, 0, 0, 2, 5),
+       ARM64_SYS_REG(2, 0, 0, 2, 6),
+       ARM64_SYS_REG(2, 0, 0, 2, 7),
+       ARM64_SYS_REG(2, 0, 0, 3, 4),
+       ARM64_SYS_REG(2, 0, 0, 3, 5),
+       ARM64_SYS_REG(2, 0, 0, 3, 6),
+       ARM64_SYS_REG(2, 0, 0, 3, 7),
+       ARM64_SYS_REG(2, 0, 0, 4, 4),
+       ARM64_SYS_REG(2, 0, 0, 4, 5),
+       ARM64_SYS_REG(2, 0, 0, 4, 6),
+       ARM64_SYS_REG(2, 0, 0, 4, 7),
+       ARM64_SYS_REG(2, 0, 0, 5, 4),
+       ARM64_SYS_REG(2, 0, 0, 5, 5),
+       ARM64_SYS_REG(2, 0, 0, 5, 6),
+       ARM64_SYS_REG(2, 0, 0, 5, 7),
+       ARM64_SYS_REG(2, 0, 0, 6, 4),
+       ARM64_SYS_REG(2, 0, 0, 6, 5),
+       ARM64_SYS_REG(2, 0, 0, 6, 6),
+       ARM64_SYS_REG(2, 0, 0, 6, 7),
+       ARM64_SYS_REG(2, 0, 0, 7, 4),
+       ARM64_SYS_REG(2, 0, 0, 7, 5),
+       ARM64_SYS_REG(2, 0, 0, 7, 6),
+       ARM64_SYS_REG(2, 0, 0, 7, 7),
+       ARM64_SYS_REG(2, 0, 0, 8, 4),
+       ARM64_SYS_REG(2, 0, 0, 8, 5),
+       ARM64_SYS_REG(2, 0, 0, 8, 6),
+       ARM64_SYS_REG(2, 0, 0, 8, 7),
+       ARM64_SYS_REG(2, 0, 0, 9, 4),
+       ARM64_SYS_REG(2, 0, 0, 9, 5),
+       ARM64_SYS_REG(2, 0, 0, 9, 6),
+       ARM64_SYS_REG(2, 0, 0, 9, 7),
+       ARM64_SYS_REG(2, 0, 0, 10, 4),
+       ARM64_SYS_REG(2, 0, 0, 10, 5),
+       ARM64_SYS_REG(2, 0, 0, 10, 6),
+       ARM64_SYS_REG(2, 0, 0, 10, 7),
+       ARM64_SYS_REG(2, 0, 0, 11, 4),
+       ARM64_SYS_REG(2, 0, 0, 11, 5),
+       ARM64_SYS_REG(2, 0, 0, 11, 6),
+       ARM64_SYS_REG(2, 0, 0, 11, 7),
+       ARM64_SYS_REG(2, 0, 0, 12, 4),
+       ARM64_SYS_REG(2, 0, 0, 12, 5),
+       ARM64_SYS_REG(2, 0, 0, 12, 6),
+       ARM64_SYS_REG(2, 0, 0, 12, 7),
+       ARM64_SYS_REG(2, 0, 0, 13, 4),
+       ARM64_SYS_REG(2, 0, 0, 13, 5),
+       ARM64_SYS_REG(2, 0, 0, 13, 6),
+       ARM64_SYS_REG(2, 0, 0, 13, 7),
+       ARM64_SYS_REG(2, 0, 0, 14, 4),
+       ARM64_SYS_REG(2, 0, 0, 14, 5),
+       ARM64_SYS_REG(2, 0, 0, 14, 6),
+       ARM64_SYS_REG(2, 0, 0, 14, 7),
+       ARM64_SYS_REG(2, 0, 0, 15, 4),
+       ARM64_SYS_REG(2, 0, 0, 15, 5),
+       ARM64_SYS_REG(2, 0, 0, 15, 6),
+       ARM64_SYS_REG(2, 0, 0, 15, 7),
+       ARM64_SYS_REG(2, 4, 0, 7, 0),   /* DBGVCR32_EL2 */
+       ARM64_SYS_REG(3, 0, 0, 0, 5),   /* MPIDR_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 1, 0),   /* ID_PFR0_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 1, 1),   /* ID_PFR1_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 1, 2),   /* ID_DFR0_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 1, 3),   /* ID_AFR0_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 1, 4),   /* ID_MMFR0_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 1, 5),   /* ID_MMFR1_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 1, 6),   /* ID_MMFR2_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 1, 7),   /* ID_MMFR3_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 2, 0),   /* ID_ISAR0_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 2, 1),   /* ID_ISAR1_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 2, 2),   /* ID_ISAR2_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 2, 3),   /* ID_ISAR3_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 2, 4),   /* ID_ISAR4_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 2, 5),   /* ID_ISAR5_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 2, 6),   /* ID_MMFR4_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 2, 7),   /* ID_ISAR6_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 3, 0),   /* MVFR0_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 3, 1),   /* MVFR1_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 3, 2),   /* MVFR2_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 3, 3),
+       ARM64_SYS_REG(3, 0, 0, 3, 4),   /* ID_PFR2_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 3, 5),   /* ID_DFR1_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 3, 6),   /* ID_MMFR5_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 3, 7),
+       ARM64_SYS_REG(3, 0, 0, 4, 0),   /* ID_AA64PFR0_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 4, 1),   /* ID_AA64PFR1_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 4, 2),
+       ARM64_SYS_REG(3, 0, 0, 4, 3),
+       ARM64_SYS_REG(3, 0, 0, 4, 4),   /* ID_AA64ZFR0_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 4, 5),
+       ARM64_SYS_REG(3, 0, 0, 4, 6),
+       ARM64_SYS_REG(3, 0, 0, 4, 7),
+       ARM64_SYS_REG(3, 0, 0, 5, 0),   /* ID_AA64DFR0_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 5, 1),   /* ID_AA64DFR1_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 5, 2),
+       ARM64_SYS_REG(3, 0, 0, 5, 3),
+       ARM64_SYS_REG(3, 0, 0, 5, 4),   /* ID_AA64AFR0_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 5, 5),   /* ID_AA64AFR1_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 5, 6),
+       ARM64_SYS_REG(3, 0, 0, 5, 7),
+       ARM64_SYS_REG(3, 0, 0, 6, 0),   /* ID_AA64ISAR0_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 6, 1),   /* ID_AA64ISAR1_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 6, 2),
+       ARM64_SYS_REG(3, 0, 0, 6, 3),
+       ARM64_SYS_REG(3, 0, 0, 6, 4),
+       ARM64_SYS_REG(3, 0, 0, 6, 5),
+       ARM64_SYS_REG(3, 0, 0, 6, 6),
+       ARM64_SYS_REG(3, 0, 0, 6, 7),
+       ARM64_SYS_REG(3, 0, 0, 7, 0),   /* ID_AA64MMFR0_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 7, 1),   /* ID_AA64MMFR1_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 7, 2),   /* ID_AA64MMFR2_EL1 */
+       ARM64_SYS_REG(3, 0, 0, 7, 3),
+       ARM64_SYS_REG(3, 0, 0, 7, 4),
+       ARM64_SYS_REG(3, 0, 0, 7, 5),
+       ARM64_SYS_REG(3, 0, 0, 7, 6),
+       ARM64_SYS_REG(3, 0, 0, 7, 7),
+       ARM64_SYS_REG(3, 0, 1, 0, 0),   /* SCTLR_EL1 */
+       ARM64_SYS_REG(3, 0, 1, 0, 1),   /* ACTLR_EL1 */
+       ARM64_SYS_REG(3, 0, 1, 0, 2),   /* CPACR_EL1 */
+       ARM64_SYS_REG(3, 0, 2, 0, 0),   /* TTBR0_EL1 */
+       ARM64_SYS_REG(3, 0, 2, 0, 1),   /* TTBR1_EL1 */
+       ARM64_SYS_REG(3, 0, 2, 0, 2),   /* TCR_EL1 */
+       ARM64_SYS_REG(3, 0, 5, 1, 0),   /* AFSR0_EL1 */
+       ARM64_SYS_REG(3, 0, 5, 1, 1),   /* AFSR1_EL1 */
+       ARM64_SYS_REG(3, 0, 5, 2, 0),   /* ESR_EL1 */
+       ARM64_SYS_REG(3, 0, 6, 0, 0),   /* FAR_EL1 */
+       ARM64_SYS_REG(3, 0, 7, 4, 0),   /* PAR_EL1 */
+       ARM64_SYS_REG(3, 0, 9, 14, 1),  /* PMINTENSET_EL1 */
+       ARM64_SYS_REG(3, 0, 9, 14, 2),  /* PMINTENCLR_EL1 */
+       ARM64_SYS_REG(3, 0, 10, 2, 0),  /* MAIR_EL1 */
+       ARM64_SYS_REG(3, 0, 10, 3, 0),  /* AMAIR_EL1 */
+       ARM64_SYS_REG(3, 0, 12, 0, 0),  /* VBAR_EL1 */
+       ARM64_SYS_REG(3, 0, 12, 1, 1),  /* DISR_EL1 */
+       ARM64_SYS_REG(3, 0, 13, 0, 1),  /* CONTEXTIDR_EL1 */
+       ARM64_SYS_REG(3, 0, 13, 0, 4),  /* TPIDR_EL1 */
+       ARM64_SYS_REG(3, 0, 14, 1, 0),  /* CNTKCTL_EL1 */
+       ARM64_SYS_REG(3, 2, 0, 0, 0),   /* CSSELR_EL1 */
+       ARM64_SYS_REG(3, 3, 9, 12, 0),  /* PMCR_EL0 */
+       ARM64_SYS_REG(3, 3, 9, 12, 1),  /* PMCNTENSET_EL0 */
+       ARM64_SYS_REG(3, 3, 9, 12, 2),  /* PMCNTENCLR_EL0 */
+       ARM64_SYS_REG(3, 3, 9, 12, 3),  /* PMOVSCLR_EL0 */
+       ARM64_SYS_REG(3, 3, 9, 12, 4),  /* PMSWINC_EL0 */
+       ARM64_SYS_REG(3, 3, 9, 12, 5),  /* PMSELR_EL0 */
+       ARM64_SYS_REG(3, 3, 9, 13, 0),  /* PMCCNTR_EL0 */
+       ARM64_SYS_REG(3, 3, 9, 14, 0),  /* PMUSERENR_EL0 */
+       ARM64_SYS_REG(3, 3, 9, 14, 3),  /* PMOVSSET_EL0 */
+       ARM64_SYS_REG(3, 3, 13, 0, 2),  /* TPIDR_EL0 */
+       ARM64_SYS_REG(3, 3, 13, 0, 3),  /* TPIDRRO_EL0 */
+       ARM64_SYS_REG(3, 3, 14, 8, 0),
+       ARM64_SYS_REG(3, 3, 14, 8, 1),
+       ARM64_SYS_REG(3, 3, 14, 8, 2),
+       ARM64_SYS_REG(3, 3, 14, 8, 3),
+       ARM64_SYS_REG(3, 3, 14, 8, 4),
+       ARM64_SYS_REG(3, 3, 14, 8, 5),
+       ARM64_SYS_REG(3, 3, 14, 8, 6),
+       ARM64_SYS_REG(3, 3, 14, 8, 7),
+       ARM64_SYS_REG(3, 3, 14, 9, 0),
+       ARM64_SYS_REG(3, 3, 14, 9, 1),
+       ARM64_SYS_REG(3, 3, 14, 9, 2),
+       ARM64_SYS_REG(3, 3, 14, 9, 3),
+       ARM64_SYS_REG(3, 3, 14, 9, 4),
+       ARM64_SYS_REG(3, 3, 14, 9, 5),
+       ARM64_SYS_REG(3, 3, 14, 9, 6),
+       ARM64_SYS_REG(3, 3, 14, 9, 7),
+       ARM64_SYS_REG(3, 3, 14, 10, 0),
+       ARM64_SYS_REG(3, 3, 14, 10, 1),
+       ARM64_SYS_REG(3, 3, 14, 10, 2),
+       ARM64_SYS_REG(3, 3, 14, 10, 3),
+       ARM64_SYS_REG(3, 3, 14, 10, 4),
+       ARM64_SYS_REG(3, 3, 14, 10, 5),
+       ARM64_SYS_REG(3, 3, 14, 10, 6),
+       ARM64_SYS_REG(3, 3, 14, 10, 7),
+       ARM64_SYS_REG(3, 3, 14, 11, 0),
+       ARM64_SYS_REG(3, 3, 14, 11, 1),
+       ARM64_SYS_REG(3, 3, 14, 11, 2),
+       ARM64_SYS_REG(3, 3, 14, 11, 3),
+       ARM64_SYS_REG(3, 3, 14, 11, 4),
+       ARM64_SYS_REG(3, 3, 14, 11, 5),
+       ARM64_SYS_REG(3, 3, 14, 11, 6),
+       ARM64_SYS_REG(3, 3, 14, 12, 0),
+       ARM64_SYS_REG(3, 3, 14, 12, 1),
+       ARM64_SYS_REG(3, 3, 14, 12, 2),
+       ARM64_SYS_REG(3, 3, 14, 12, 3),
+       ARM64_SYS_REG(3, 3, 14, 12, 4),
+       ARM64_SYS_REG(3, 3, 14, 12, 5),
+       ARM64_SYS_REG(3, 3, 14, 12, 6),
+       ARM64_SYS_REG(3, 3, 14, 12, 7),
+       ARM64_SYS_REG(3, 3, 14, 13, 0),
+       ARM64_SYS_REG(3, 3, 14, 13, 1),
+       ARM64_SYS_REG(3, 3, 14, 13, 2),
+       ARM64_SYS_REG(3, 3, 14, 13, 3),
+       ARM64_SYS_REG(3, 3, 14, 13, 4),
+       ARM64_SYS_REG(3, 3, 14, 13, 5),
+       ARM64_SYS_REG(3, 3, 14, 13, 6),
+       ARM64_SYS_REG(3, 3, 14, 13, 7),
+       ARM64_SYS_REG(3, 3, 14, 14, 0),
+       ARM64_SYS_REG(3, 3, 14, 14, 1),
+       ARM64_SYS_REG(3, 3, 14, 14, 2),
+       ARM64_SYS_REG(3, 3, 14, 14, 3),
+       ARM64_SYS_REG(3, 3, 14, 14, 4),
+       ARM64_SYS_REG(3, 3, 14, 14, 5),
+       ARM64_SYS_REG(3, 3, 14, 14, 6),
+       ARM64_SYS_REG(3, 3, 14, 14, 7),
+       ARM64_SYS_REG(3, 3, 14, 15, 0),
+       ARM64_SYS_REG(3, 3, 14, 15, 1),
+       ARM64_SYS_REG(3, 3, 14, 15, 2),
+       ARM64_SYS_REG(3, 3, 14, 15, 3),
+       ARM64_SYS_REG(3, 3, 14, 15, 4),
+       ARM64_SYS_REG(3, 3, 14, 15, 5),
+       ARM64_SYS_REG(3, 3, 14, 15, 6),
+       ARM64_SYS_REG(3, 3, 14, 15, 7), /* PMCCFILTR_EL0 */
+       ARM64_SYS_REG(3, 4, 3, 0, 0),   /* DACR32_EL2 */
+       ARM64_SYS_REG(3, 4, 5, 0, 1),   /* IFSR32_EL2 */
+       ARM64_SYS_REG(3, 4, 5, 3, 0),   /* FPEXC32_EL2 */
+       KVM_REG_ARM64 | KVM_REG_SIZE_U32 | KVM_REG_ARM_DEMUX | KVM_REG_ARM_DEMUX_ID_CCSIDR | 0,
+       KVM_REG_ARM64 | KVM_REG_SIZE_U32 | KVM_REG_ARM_DEMUX | KVM_REG_ARM_DEMUX_ID_CCSIDR | 1,
+       KVM_REG_ARM64 | KVM_REG_SIZE_U32 | KVM_REG_ARM_DEMUX | KVM_REG_ARM_DEMUX_ID_CCSIDR | 2,
+};
+static __u64 base_regs_n = ARRAY_SIZE(base_regs);
+
+static __u64 vregs[] = {
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[0]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[1]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[2]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[3]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[4]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[5]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[6]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[7]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[8]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[9]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[10]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[11]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[12]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[13]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[14]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[15]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[16]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[17]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[18]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[19]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[20]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[21]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[22]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[23]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[24]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[25]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[26]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[27]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[28]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[29]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[30]),
+       KVM_REG_ARM64 | KVM_REG_SIZE_U128 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(fp_regs.vregs[31]),
+};
+static __u64 vregs_n = ARRAY_SIZE(vregs);
+
+static __u64 sve_regs[] = {
+       KVM_REG_ARM64_SVE_VLS,
+       KVM_REG_ARM64_SVE_ZREG(0, 0),
+       KVM_REG_ARM64_SVE_ZREG(1, 0),
+       KVM_REG_ARM64_SVE_ZREG(2, 0),
+       KVM_REG_ARM64_SVE_ZREG(3, 0),
+       KVM_REG_ARM64_SVE_ZREG(4, 0),
+       KVM_REG_ARM64_SVE_ZREG(5, 0),
+       KVM_REG_ARM64_SVE_ZREG(6, 0),
+       KVM_REG_ARM64_SVE_ZREG(7, 0),
+       KVM_REG_ARM64_SVE_ZREG(8, 0),
+       KVM_REG_ARM64_SVE_ZREG(9, 0),
+       KVM_REG_ARM64_SVE_ZREG(10, 0),
+       KVM_REG_ARM64_SVE_ZREG(11, 0),
+       KVM_REG_ARM64_SVE_ZREG(12, 0),
+       KVM_REG_ARM64_SVE_ZREG(13, 0),
+       KVM_REG_ARM64_SVE_ZREG(14, 0),
+       KVM_REG_ARM64_SVE_ZREG(15, 0),
+       KVM_REG_ARM64_SVE_ZREG(16, 0),
+       KVM_REG_ARM64_SVE_ZREG(17, 0),
+       KVM_REG_ARM64_SVE_ZREG(18, 0),
+       KVM_REG_ARM64_SVE_ZREG(19, 0),
+       KVM_REG_ARM64_SVE_ZREG(20, 0),
+       KVM_REG_ARM64_SVE_ZREG(21, 0),
+       KVM_REG_ARM64_SVE_ZREG(22, 0),
+       KVM_REG_ARM64_SVE_ZREG(23, 0),
+       KVM_REG_ARM64_SVE_ZREG(24, 0),
+       KVM_REG_ARM64_SVE_ZREG(25, 0),
+       KVM_REG_ARM64_SVE_ZREG(26, 0),
+       KVM_REG_ARM64_SVE_ZREG(27, 0),
+       KVM_REG_ARM64_SVE_ZREG(28, 0),
+       KVM_REG_ARM64_SVE_ZREG(29, 0),
+       KVM_REG_ARM64_SVE_ZREG(30, 0),
+       KVM_REG_ARM64_SVE_ZREG(31, 0),
+       KVM_REG_ARM64_SVE_PREG(0, 0),
+       KVM_REG_ARM64_SVE_PREG(1, 0),
+       KVM_REG_ARM64_SVE_PREG(2, 0),
+       KVM_REG_ARM64_SVE_PREG(3, 0),
+       KVM_REG_ARM64_SVE_PREG(4, 0),
+       KVM_REG_ARM64_SVE_PREG(5, 0),
+       KVM_REG_ARM64_SVE_PREG(6, 0),
+       KVM_REG_ARM64_SVE_PREG(7, 0),
+       KVM_REG_ARM64_SVE_PREG(8, 0),
+       KVM_REG_ARM64_SVE_PREG(9, 0),
+       KVM_REG_ARM64_SVE_PREG(10, 0),
+       KVM_REG_ARM64_SVE_PREG(11, 0),
+       KVM_REG_ARM64_SVE_PREG(12, 0),
+       KVM_REG_ARM64_SVE_PREG(13, 0),
+       KVM_REG_ARM64_SVE_PREG(14, 0),
+       KVM_REG_ARM64_SVE_PREG(15, 0),
+       KVM_REG_ARM64_SVE_FFR(0),
+       ARM64_SYS_REG(3, 0, 1, 2, 0),   /* ZCR_EL1 */
+};
+static __u64 sve_regs_n = ARRAY_SIZE(sve_regs);
+
+static __u64 rejects_set[] = {
+#ifdef REG_LIST_SVE
+       KVM_REG_ARM64_SVE_VLS,
+#endif
+};
+static __u64 rejects_set_n = ARRAY_SIZE(rejects_set);
diff --git a/tools/testing/selftests/kvm/clear_dirty_log_test.c b/tools/testing/selftests/kvm/clear_dirty_log_test.c
deleted file mode 100644 (file)
index 11672ec..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#define USE_CLEAR_DIRTY_LOG
-#define KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE (1 << 0)
-#define KVM_DIRTY_LOG_INITIALLY_SET         (1 << 1)
-#define KVM_DIRTY_LOG_MANUAL_CAPS   (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | \
-               KVM_DIRTY_LOG_INITIALLY_SET)
-#include "dirty_log_test.c"
index 360cd3e..3d96a7b 100644 (file)
 #include <linux/bitops.h>
 #include <linux/userfaultfd.h>
 
-#include "test_util.h"
-#include "kvm_util.h"
+#include "perf_test_util.h"
 #include "processor.h"
+#include "test_util.h"
 
 #ifdef __NR_userfaultfd
 
-/* The memory slot index demand page */
-#define TEST_MEM_SLOT_INDEX            1
-
-/* Default guest test virtual memory offset */
-#define DEFAULT_GUEST_TEST_MEM         0xc0000000
-
-#define DEFAULT_GUEST_TEST_MEM_SIZE (1 << 30) /* 1G */
-
 #ifdef PRINT_PER_PAGE_UPDATES
 #define PER_PAGE_DEBUG(...) printf(__VA_ARGS__)
 #else
 #define PER_VCPU_DEBUG(...) _no_printf(__VA_ARGS__)
 #endif
 
-#define MAX_VCPUS 512
-
-/*
- * Guest/Host shared variables. Ensure addr_gva2hva() and/or
- * sync_global_to/from_guest() are used when accessing from
- * the host. READ/WRITE_ONCE() should also be used with anything
- * that may change.
- */
-static uint64_t host_page_size;
-static uint64_t guest_page_size;
-
 static char *guest_data_prototype;
 
-/*
- * Guest physical memory offset of the testing memory slot.
- * This will be set to the topmost valid physical address minus
- * the test memory size.
- */
-static uint64_t guest_test_phys_mem;
-
-/*
- * Guest virtual memory offset of the testing memory slot.
- * Must not conflict with identity mapped test code.
- */
-static uint64_t guest_test_virt_mem = DEFAULT_GUEST_TEST_MEM;
-
-struct vcpu_args {
-       uint64_t gva;
-       uint64_t pages;
-
-       /* Only used by the host userspace part of the vCPU thread */
-       int vcpu_id;
-       struct kvm_vm *vm;
-};
-
-static struct vcpu_args vcpu_args[MAX_VCPUS];
-
-/*
- * Continuously write to the first 8 bytes of each page in the demand paging
- * memory region.
- */
-static void guest_code(uint32_t vcpu_id)
-{
-       uint64_t gva;
-       uint64_t pages;
-       int i;
-
-       /* Make sure vCPU args data structure is not corrupt. */
-       GUEST_ASSERT(vcpu_args[vcpu_id].vcpu_id == vcpu_id);
-
-       gva = vcpu_args[vcpu_id].gva;
-       pages = vcpu_args[vcpu_id].pages;
-
-       for (i = 0; i < pages; i++) {
-               uint64_t addr = gva + (i * guest_page_size);
-
-               addr &= ~(host_page_size - 1);
-               *(uint64_t *)addr = 0x0123456789ABCDEF;
-       }
-
-       GUEST_SYNC(1);
-}
-
 static void *vcpu_worker(void *data)
 {
        int ret;
-       struct vcpu_args *args = (struct vcpu_args *)data;
-       struct kvm_vm *vm = args->vm;
-       int vcpu_id = args->vcpu_id;
+       struct vcpu_args *vcpu_args = (struct vcpu_args *)data;
+       int vcpu_id = vcpu_args->vcpu_id;
+       struct kvm_vm *vm = perf_test_args.vm;
        struct kvm_run *run;
-       struct timespec start, end, ts_diff;
+       struct timespec start;
+       struct timespec ts_diff;
 
        vcpu_args_set(vm, vcpu_id, 1, vcpu_id);
        run = vcpu_state(vm, vcpu_id);
@@ -133,52 +65,18 @@ static void *vcpu_worker(void *data)
                            exit_reason_str(run->exit_reason));
        }
 
-       clock_gettime(CLOCK_MONOTONIC, &end);
-       ts_diff = timespec_sub(end, start);
+       ts_diff = timespec_diff_now(start);
        PER_VCPU_DEBUG("vCPU %d execution time: %ld.%.9lds\n", vcpu_id,
                       ts_diff.tv_sec, ts_diff.tv_nsec);
 
        return NULL;
 }
 
-#define PAGE_SHIFT_4K  12
-#define PTES_PER_4K_PT 512
-
-static struct kvm_vm *create_vm(enum vm_guest_mode mode, int vcpus,
-                               uint64_t vcpu_memory_bytes)
-{
-       struct kvm_vm *vm;
-       uint64_t pages = DEFAULT_GUEST_PHY_PAGES;
-
-       /* Account for a few pages per-vCPU for stacks */
-       pages += DEFAULT_STACK_PGS * vcpus;
-
-       /*
-        * Reserve twice the ammount of memory needed to map the test region and
-        * the page table / stacks region, at 4k, for page tables. Do the
-        * calculation with 4K page size: the smallest of all archs. (e.g., 64K
-        * page size guest will need even less memory for page tables).
-        */
-       pages += (2 * pages) / PTES_PER_4K_PT;
-       pages += ((2 * vcpus * vcpu_memory_bytes) >> PAGE_SHIFT_4K) /
-                PTES_PER_4K_PT;
-       pages = vm_adjust_num_guest_pages(mode, pages);
-
-       pr_info("Testing guest mode: %s\n", vm_guest_mode_string(mode));
-
-       vm = _vm_create(mode, pages, O_RDWR);
-       kvm_vm_elf_load(vm, program_invocation_name, 0, 0);
-#ifdef __x86_64__
-       vm_create_irqchip(vm);
-#endif
-       return vm;
-}
-
 static int handle_uffd_page_request(int uffd, uint64_t addr)
 {
        pid_t tid;
        struct timespec start;
-       struct timespec end;
+       struct timespec ts_diff;
        struct uffdio_copy copy;
        int r;
 
@@ -186,7 +84,7 @@ static int handle_uffd_page_request(int uffd, uint64_t addr)
 
        copy.src = (uint64_t)guest_data_prototype;
        copy.dst = addr;
-       copy.len = host_page_size;
+       copy.len = perf_test_args.host_page_size;
        copy.mode = 0;
 
        clock_gettime(CLOCK_MONOTONIC, &start);
@@ -198,12 +96,12 @@ static int handle_uffd_page_request(int uffd, uint64_t addr)
                return r;
        }
 
-       clock_gettime(CLOCK_MONOTONIC, &end);
+       ts_diff = timespec_diff_now(start);
 
        PER_PAGE_DEBUG("UFFDIO_COPY %d \t%ld ns\n", tid,
-                      timespec_to_ns(timespec_sub(end, start)));
+                      timespec_to_ns(ts_diff));
        PER_PAGE_DEBUG("Paged in %ld bytes at 0x%lx from thread %d\n",
-                      host_page_size, addr, tid);
+                      perf_test_args.host_page_size, addr, tid);
 
        return 0;
 }
@@ -223,7 +121,8 @@ static void *uffd_handler_thread_fn(void *arg)
        int pipefd = uffd_args->pipefd;
        useconds_t delay = uffd_args->delay;
        int64_t pages = 0;
-       struct timespec start, end, ts_diff;
+       struct timespec start;
+       struct timespec ts_diff;
 
        clock_gettime(CLOCK_MONOTONIC, &start);
        while (!quit_uffd_thread) {
@@ -292,8 +191,7 @@ static void *uffd_handler_thread_fn(void *arg)
                pages++;
        }
 
-       clock_gettime(CLOCK_MONOTONIC, &end);
-       ts_diff = timespec_sub(end, start);
+       ts_diff = timespec_diff_now(start);
        PER_VCPU_DEBUG("userfaulted %ld pages over %ld.%.9lds. (%f/sec)\n",
                       pages, ts_diff.tv_sec, ts_diff.tv_nsec,
                       pages / ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / 100000000.0));
@@ -351,99 +249,54 @@ static int setup_demand_paging(struct kvm_vm *vm,
 }
 
 static void run_test(enum vm_guest_mode mode, bool use_uffd,
-                    useconds_t uffd_delay, int vcpus,
-                    uint64_t vcpu_memory_bytes)
+                    useconds_t uffd_delay)
 {
        pthread_t *vcpu_threads;
        pthread_t *uffd_handler_threads = NULL;
        struct uffd_handler_args *uffd_args = NULL;
-       struct timespec start, end, ts_diff;
+       struct timespec start;
+       struct timespec ts_diff;
        int *pipefds = NULL;
        struct kvm_vm *vm;
-       uint64_t guest_num_pages;
        int vcpu_id;
        int r;
 
-       vm = create_vm(mode, vcpus, vcpu_memory_bytes);
-
-       guest_page_size = vm_get_page_size(vm);
-
-       TEST_ASSERT(vcpu_memory_bytes % guest_page_size == 0,
-                   "Guest memory size is not guest page size aligned.");
-
-       guest_num_pages = (vcpus * vcpu_memory_bytes) / guest_page_size;
-       guest_num_pages = vm_adjust_num_guest_pages(mode, guest_num_pages);
-
-       /*
-        * If there should be more memory in the guest test region than there
-        * can be pages in the guest, it will definitely cause problems.
-        */
-       TEST_ASSERT(guest_num_pages < vm_get_max_gfn(vm),
-                   "Requested more guest memory than address space allows.\n"
-                   "    guest pages: %lx max gfn: %x vcpus: %d wss: %lx]\n",
-                   guest_num_pages, vm_get_max_gfn(vm), vcpus,
-                   vcpu_memory_bytes);
-
-       host_page_size = getpagesize();
-       TEST_ASSERT(vcpu_memory_bytes % host_page_size == 0,
-                   "Guest memory size is not host page size aligned.");
+       vm = create_vm(mode, nr_vcpus, guest_percpu_mem_size);
 
-       guest_test_phys_mem = (vm_get_max_gfn(vm) - guest_num_pages) *
-                             guest_page_size;
-       guest_test_phys_mem &= ~(host_page_size - 1);
+       perf_test_args.wr_fract = 1;
 
-#ifdef __s390x__
-       /* Align to 1M (segment size) */
-       guest_test_phys_mem &= ~((1 << 20) - 1);
-#endif
-
-       pr_info("guest physical test memory offset: 0x%lx\n", guest_test_phys_mem);
-
-       /* Add an extra memory slot for testing demand paging */
-       vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS,
-                                   guest_test_phys_mem,
-                                   TEST_MEM_SLOT_INDEX,
-                                   guest_num_pages, 0);
-
-       /* Do mapping for the demand paging memory slot */
-       virt_map(vm, guest_test_virt_mem, guest_test_phys_mem, guest_num_pages, 0);
-
-       ucall_init(vm, NULL);
-
-       guest_data_prototype = malloc(host_page_size);
+       guest_data_prototype = malloc(perf_test_args.host_page_size);
        TEST_ASSERT(guest_data_prototype,
                    "Failed to allocate buffer for guest data pattern");
-       memset(guest_data_prototype, 0xAB, host_page_size);
+       memset(guest_data_prototype, 0xAB, perf_test_args.host_page_size);
 
-       vcpu_threads = malloc(vcpus * sizeof(*vcpu_threads));
+       vcpu_threads = malloc(nr_vcpus * sizeof(*vcpu_threads));
        TEST_ASSERT(vcpu_threads, "Memory allocation failed");
 
+       add_vcpus(vm, nr_vcpus, guest_percpu_mem_size);
+
        if (use_uffd) {
                uffd_handler_threads =
-                       malloc(vcpus * sizeof(*uffd_handler_threads));
+                       malloc(nr_vcpus * sizeof(*uffd_handler_threads));
                TEST_ASSERT(uffd_handler_threads, "Memory allocation failed");
 
-               uffd_args = malloc(vcpus * sizeof(*uffd_args));
+               uffd_args = malloc(nr_vcpus * sizeof(*uffd_args));
                TEST_ASSERT(uffd_args, "Memory allocation failed");
 
-               pipefds = malloc(sizeof(int) * vcpus * 2);
+               pipefds = malloc(sizeof(int) * nr_vcpus * 2);
                TEST_ASSERT(pipefds, "Unable to allocate memory for pipefd");
-       }
-
-       for (vcpu_id = 0; vcpu_id < vcpus; vcpu_id++) {
-               vm_paddr_t vcpu_gpa;
-               void *vcpu_hva;
 
-               vm_vcpu_add_default(vm, vcpu_id, guest_code);
+               for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) {
+                       vm_paddr_t vcpu_gpa;
+                       void *vcpu_hva;
 
-               vcpu_gpa = guest_test_phys_mem + (vcpu_id * vcpu_memory_bytes);
-               PER_VCPU_DEBUG("Added VCPU %d with test mem gpa [%lx, %lx)\n",
-                              vcpu_id, vcpu_gpa, vcpu_gpa + vcpu_memory_bytes);
+                       vcpu_gpa = guest_test_phys_mem + (vcpu_id * guest_percpu_mem_size);
+                       PER_VCPU_DEBUG("Added VCPU %d with test mem gpa [%lx, %lx)\n",
+                                      vcpu_id, vcpu_gpa, vcpu_gpa + guest_percpu_mem_size);
 
-               /* Cache the HVA pointer of the region */
-               vcpu_hva = addr_gpa2hva(vm, vcpu_gpa);
+                       /* Cache the HVA pointer of the region */
+                       vcpu_hva = addr_gpa2hva(vm, vcpu_gpa);
 
-               if (use_uffd) {
                        /*
                         * Set up user fault fd to handle demand paging
                         * requests.
@@ -456,53 +309,41 @@ static void run_test(enum vm_guest_mode mode, bool use_uffd,
                                                &uffd_handler_threads[vcpu_id],
                                                pipefds[vcpu_id * 2],
                                                uffd_delay, &uffd_args[vcpu_id],
-                                               vcpu_hva, vcpu_memory_bytes);
+                                               vcpu_hva, guest_percpu_mem_size);
                        if (r < 0)
                                exit(-r);
                }
-
-#ifdef __x86_64__
-               vcpu_set_cpuid(vm, vcpu_id, kvm_get_supported_cpuid());
-#endif
-
-               vcpu_args[vcpu_id].vm = vm;
-               vcpu_args[vcpu_id].vcpu_id = vcpu_id;
-               vcpu_args[vcpu_id].gva = guest_test_virt_mem +
-                                        (vcpu_id * vcpu_memory_bytes);
-               vcpu_args[vcpu_id].pages = vcpu_memory_bytes / guest_page_size;
        }
 
        /* Export the shared variables to the guest */
-       sync_global_to_guest(vm, host_page_size);
-       sync_global_to_guest(vm, guest_page_size);
-       sync_global_to_guest(vm, vcpu_args);
+       sync_global_to_guest(vm, perf_test_args);
 
        pr_info("Finished creating vCPUs and starting uffd threads\n");
 
        clock_gettime(CLOCK_MONOTONIC, &start);
 
-       for (vcpu_id = 0; vcpu_id < vcpus; vcpu_id++) {
+       for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) {
                pthread_create(&vcpu_threads[vcpu_id], NULL, vcpu_worker,
-                              &vcpu_args[vcpu_id]);
+                              &perf_test_args.vcpu_args[vcpu_id]);
        }
 
        pr_info("Started all vCPUs\n");
 
        /* Wait for the vcpu threads to quit */
-       for (vcpu_id = 0; vcpu_id < vcpus; vcpu_id++) {
+       for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) {
                pthread_join(vcpu_threads[vcpu_id], NULL);
                PER_VCPU_DEBUG("Joined thread for vCPU %d\n", vcpu_id);
        }
 
-       pr_info("All vCPU threads joined\n");
+       ts_diff = timespec_diff_now(start);
 
-       clock_gettime(CLOCK_MONOTONIC, &end);
+       pr_info("All vCPU threads joined\n");
 
        if (use_uffd) {
                char c;
 
                /* Tell the user fault fd handler threads to quit */
-               for (vcpu_id = 0; vcpu_id < vcpus; vcpu_id++) {
+               for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) {
                        r = write(pipefds[vcpu_id * 2 + 1], &c, 1);
                        TEST_ASSERT(r == 1, "Unable to write to pipefd");
 
@@ -510,11 +351,11 @@ static void run_test(enum vm_guest_mode mode, bool use_uffd,
                }
        }
 
-       ts_diff = timespec_sub(end, start);
        pr_info("Total guest execution time: %ld.%.9lds\n",
                ts_diff.tv_sec, ts_diff.tv_nsec);
        pr_info("Overall demand paging rate: %f pgs/sec\n",
-               guest_num_pages / ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / 100000000.0));
+               perf_test_args.vcpu_args[0].pages * nr_vcpus /
+               ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / 100000000.0));
 
        ucall_uninit(vm);
        kvm_vm_free(vm);
@@ -568,9 +409,8 @@ static void help(char *name)
 
 int main(int argc, char *argv[])
 {
+       int max_vcpus = kvm_check_cap(KVM_CAP_MAX_VCPUS);
        bool mode_selected = false;
-       uint64_t vcpu_memory_bytes = DEFAULT_GUEST_TEST_MEM_SIZE;
-       int vcpus = 1;
        unsigned int mode;
        int opt, i;
        bool use_uffd = false;
@@ -619,15 +459,12 @@ int main(int argc, char *argv[])
                                    "A negative UFFD delay is not supported.");
                        break;
                case 'b':
-                       vcpu_memory_bytes = parse_size(optarg);
+                       guest_percpu_mem_size = parse_size(optarg);
                        break;
                case 'v':
-                       vcpus = atoi(optarg);
-                       TEST_ASSERT(vcpus > 0,
-                                   "Must have a positive number of vCPUs");
-                       TEST_ASSERT(vcpus <= MAX_VCPUS,
-                                   "This test does not currently support\n"
-                                   "more than %d vCPUs.", MAX_VCPUS);
+                       nr_vcpus = atoi(optarg);
+                       TEST_ASSERT(nr_vcpus > 0 && nr_vcpus <= max_vcpus,
+                                   "Invalid number of vcpus, must be between 1 and %d", max_vcpus);
                        break;
                case 'h':
                default:
@@ -642,7 +479,7 @@ int main(int argc, char *argv[])
                TEST_ASSERT(guest_modes[i].supported,
                            "Guest mode ID %d (%s) not supported.",
                            i, vm_guest_mode_string(i));
-               run_test(i, use_uffd, uffd_delay, vcpus, vcpu_memory_bytes);
+               run_test(i, use_uffd, uffd_delay);
        }
 
        return 0;
diff --git a/tools/testing/selftests/kvm/dirty_log_perf_test.c b/tools/testing/selftests/kvm/dirty_log_perf_test.c
new file mode 100644 (file)
index 0000000..85c9b8f
--- /dev/null
@@ -0,0 +1,376 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * KVM dirty page logging performance test
+ *
+ * Based on dirty_log_test.c
+ *
+ * Copyright (C) 2018, Red Hat, Inc.
+ * Copyright (C) 2020, Google, Inc.
+ */
+
+#define _GNU_SOURCE /* for program_invocation_name */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <time.h>
+#include <pthread.h>
+#include <linux/bitmap.h>
+#include <linux/bitops.h>
+
+#include "kvm_util.h"
+#include "perf_test_util.h"
+#include "processor.h"
+#include "test_util.h"
+
+/* How many host loops to run by default (one KVM_GET_DIRTY_LOG for each loop)*/
+#define TEST_HOST_LOOP_N               2UL
+
+/* Host variables */
+static bool host_quit;
+static uint64_t iteration;
+static uint64_t vcpu_last_completed_iteration[MAX_VCPUS];
+
+static void *vcpu_worker(void *data)
+{
+       int ret;
+       struct kvm_vm *vm = perf_test_args.vm;
+       uint64_t pages_count = 0;
+       struct kvm_run *run;
+       struct timespec start;
+       struct timespec ts_diff;
+       struct timespec total = (struct timespec){0};
+       struct timespec avg;
+       struct vcpu_args *vcpu_args = (struct vcpu_args *)data;
+       int vcpu_id = vcpu_args->vcpu_id;
+
+       vcpu_args_set(vm, vcpu_id, 1, vcpu_id);
+       run = vcpu_state(vm, vcpu_id);
+
+       while (!READ_ONCE(host_quit)) {
+               uint64_t current_iteration = READ_ONCE(iteration);
+
+               clock_gettime(CLOCK_MONOTONIC, &start);
+               ret = _vcpu_run(vm, vcpu_id);
+               ts_diff = timespec_diff_now(start);
+
+               TEST_ASSERT(ret == 0, "vcpu_run failed: %d\n", ret);
+               TEST_ASSERT(get_ucall(vm, vcpu_id, NULL) == UCALL_SYNC,
+                           "Invalid guest sync status: exit_reason=%s\n",
+                           exit_reason_str(run->exit_reason));
+
+               pr_debug("Got sync event from vCPU %d\n", vcpu_id);
+               vcpu_last_completed_iteration[vcpu_id] = current_iteration;
+               pr_debug("vCPU %d updated last completed iteration to %lu\n",
+                        vcpu_id, vcpu_last_completed_iteration[vcpu_id]);
+
+               if (current_iteration) {
+                       pages_count += vcpu_args->pages;
+                       total = timespec_add(total, ts_diff);
+                       pr_debug("vCPU %d iteration %lu dirty memory time: %ld.%.9lds\n",
+                               vcpu_id, current_iteration, ts_diff.tv_sec,
+                               ts_diff.tv_nsec);
+               } else {
+                       pr_debug("vCPU %d iteration %lu populate memory time: %ld.%.9lds\n",
+                               vcpu_id, current_iteration, ts_diff.tv_sec,
+                               ts_diff.tv_nsec);
+               }
+
+               while (current_iteration == READ_ONCE(iteration) &&
+                      !READ_ONCE(host_quit)) {}
+       }
+
+       avg = timespec_div(total, vcpu_last_completed_iteration[vcpu_id]);
+       pr_debug("\nvCPU %d dirtied 0x%lx pages over %lu iterations in %ld.%.9lds. (Avg %ld.%.9lds/iteration)\n",
+               vcpu_id, pages_count, vcpu_last_completed_iteration[vcpu_id],
+               total.tv_sec, total.tv_nsec, avg.tv_sec, avg.tv_nsec);
+
+       return NULL;
+}
+
+#ifdef USE_CLEAR_DIRTY_LOG
+static u64 dirty_log_manual_caps;
+#endif
+
+static void run_test(enum vm_guest_mode mode, unsigned long iterations,
+                    uint64_t phys_offset, int wr_fract)
+{
+       pthread_t *vcpu_threads;
+       struct kvm_vm *vm;
+       unsigned long *bmap;
+       uint64_t guest_num_pages;
+       uint64_t host_num_pages;
+       int vcpu_id;
+       struct timespec start;
+       struct timespec ts_diff;
+       struct timespec get_dirty_log_total = (struct timespec){0};
+       struct timespec vcpu_dirty_total = (struct timespec){0};
+       struct timespec avg;
+#ifdef USE_CLEAR_DIRTY_LOG
+       struct kvm_enable_cap cap = {};
+       struct timespec clear_dirty_log_total = (struct timespec){0};
+#endif
+
+       vm = create_vm(mode, nr_vcpus, guest_percpu_mem_size);
+
+       perf_test_args.wr_fract = wr_fract;
+
+       guest_num_pages = (nr_vcpus * guest_percpu_mem_size) >> vm_get_page_shift(vm);
+       guest_num_pages = vm_adjust_num_guest_pages(mode, guest_num_pages);
+       host_num_pages = vm_num_host_pages(mode, guest_num_pages);
+       bmap = bitmap_alloc(host_num_pages);
+
+#ifdef USE_CLEAR_DIRTY_LOG
+       cap.cap = KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2;
+       cap.args[0] = dirty_log_manual_caps;
+       vm_enable_cap(vm, &cap);
+#endif
+
+       vcpu_threads = malloc(nr_vcpus * sizeof(*vcpu_threads));
+       TEST_ASSERT(vcpu_threads, "Memory allocation failed");
+
+       add_vcpus(vm, nr_vcpus, guest_percpu_mem_size);
+
+       sync_global_to_guest(vm, perf_test_args);
+
+       /* Start the iterations */
+       iteration = 0;
+       host_quit = false;
+
+       clock_gettime(CLOCK_MONOTONIC, &start);
+       for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) {
+               pthread_create(&vcpu_threads[vcpu_id], NULL, vcpu_worker,
+                              &perf_test_args.vcpu_args[vcpu_id]);
+       }
+
+       /* Allow the vCPU to populate memory */
+       pr_debug("Starting iteration %lu - Populating\n", iteration);
+       while (READ_ONCE(vcpu_last_completed_iteration[vcpu_id]) != iteration)
+               pr_debug("Waiting for vcpu_last_completed_iteration == %lu\n",
+                       iteration);
+
+       ts_diff = timespec_diff_now(start);
+       pr_info("Populate memory time: %ld.%.9lds\n",
+               ts_diff.tv_sec, ts_diff.tv_nsec);
+
+       /* Enable dirty logging */
+       clock_gettime(CLOCK_MONOTONIC, &start);
+       vm_mem_region_set_flags(vm, TEST_MEM_SLOT_INDEX,
+                               KVM_MEM_LOG_DIRTY_PAGES);
+       ts_diff = timespec_diff_now(start);
+       pr_info("Enabling dirty logging time: %ld.%.9lds\n\n",
+               ts_diff.tv_sec, ts_diff.tv_nsec);
+
+       while (iteration < iterations) {
+               /*
+                * Incrementing the iteration number will start the vCPUs
+                * dirtying memory again.
+                */
+               clock_gettime(CLOCK_MONOTONIC, &start);
+               iteration++;
+
+               pr_debug("Starting iteration %lu\n", iteration);
+               for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) {
+                       while (READ_ONCE(vcpu_last_completed_iteration[vcpu_id]) != iteration)
+                               pr_debug("Waiting for vCPU %d vcpu_last_completed_iteration == %lu\n",
+                                        vcpu_id, iteration);
+               }
+
+               ts_diff = timespec_diff_now(start);
+               vcpu_dirty_total = timespec_add(vcpu_dirty_total, ts_diff);
+               pr_info("Iteration %lu dirty memory time: %ld.%.9lds\n",
+                       iteration, ts_diff.tv_sec, ts_diff.tv_nsec);
+
+               clock_gettime(CLOCK_MONOTONIC, &start);
+               kvm_vm_get_dirty_log(vm, TEST_MEM_SLOT_INDEX, bmap);
+
+               ts_diff = timespec_diff_now(start);
+               get_dirty_log_total = timespec_add(get_dirty_log_total,
+                                                  ts_diff);
+               pr_info("Iteration %lu get dirty log time: %ld.%.9lds\n",
+                       iteration, ts_diff.tv_sec, ts_diff.tv_nsec);
+
+#ifdef USE_CLEAR_DIRTY_LOG
+               clock_gettime(CLOCK_MONOTONIC, &start);
+               kvm_vm_clear_dirty_log(vm, TEST_MEM_SLOT_INDEX, bmap, 0,
+                                      host_num_pages);
+
+               ts_diff = timespec_diff_now(start);
+               clear_dirty_log_total = timespec_add(clear_dirty_log_total,
+                                                    ts_diff);
+               pr_info("Iteration %lu clear dirty log time: %ld.%.9lds\n",
+                       iteration, ts_diff.tv_sec, ts_diff.tv_nsec);
+#endif
+       }
+
+       /* Tell the vcpu thread to quit */
+       host_quit = true;
+       for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++)
+               pthread_join(vcpu_threads[vcpu_id], NULL);
+
+       /* Disable dirty logging */
+       clock_gettime(CLOCK_MONOTONIC, &start);
+       vm_mem_region_set_flags(vm, TEST_MEM_SLOT_INDEX, 0);
+       ts_diff = timespec_diff_now(start);
+       pr_info("Disabling dirty logging time: %ld.%.9lds\n",
+               ts_diff.tv_sec, ts_diff.tv_nsec);
+
+       avg = timespec_div(get_dirty_log_total, iterations);
+       pr_info("Get dirty log over %lu iterations took %ld.%.9lds. (Avg %ld.%.9lds/iteration)\n",
+               iterations, get_dirty_log_total.tv_sec,
+               get_dirty_log_total.tv_nsec, avg.tv_sec, avg.tv_nsec);
+
+#ifdef USE_CLEAR_DIRTY_LOG
+       avg = timespec_div(clear_dirty_log_total, iterations);
+       pr_info("Clear dirty log over %lu iterations took %ld.%.9lds. (Avg %ld.%.9lds/iteration)\n",
+               iterations, clear_dirty_log_total.tv_sec,
+               clear_dirty_log_total.tv_nsec, avg.tv_sec, avg.tv_nsec);
+#endif
+
+       free(bmap);
+       free(vcpu_threads);
+       ucall_uninit(vm);
+       kvm_vm_free(vm);
+}
+
+struct guest_mode {
+       bool supported;
+       bool enabled;
+};
+static struct guest_mode guest_modes[NUM_VM_MODES];
+
+#define guest_mode_init(mode, supported, enabled) ({ \
+       guest_modes[mode] = (struct guest_mode){ supported, enabled }; \
+})
+
+static void help(char *name)
+{
+       int i;
+
+       puts("");
+       printf("usage: %s [-h] [-i iterations] [-p offset] "
+              "[-m mode] [-b vcpu bytes] [-v vcpus]\n", name);
+       puts("");
+       printf(" -i: specify iteration counts (default: %"PRIu64")\n",
+              TEST_HOST_LOOP_N);
+       printf(" -p: specify guest physical test memory offset\n"
+              "     Warning: a low offset can conflict with the loaded test code.\n");
+       printf(" -m: specify the guest mode ID to test "
+              "(default: test all supported modes)\n"
+              "     This option may be used multiple times.\n"
+              "     Guest mode IDs:\n");
+       for (i = 0; i < NUM_VM_MODES; ++i) {
+               printf("         %d:    %s%s\n", i, vm_guest_mode_string(i),
+                      guest_modes[i].supported ? " (supported)" : "");
+       }
+       printf(" -b: specify the size of the memory region which should be\n"
+              "     dirtied by each vCPU. e.g. 10M or 3G.\n"
+              "     (default: 1G)\n");
+       printf(" -f: specify the fraction of pages which should be written to\n"
+              "     as opposed to simply read, in the form\n"
+              "     1/<fraction of pages to write>.\n"
+              "     (default: 1 i.e. all pages are written to.)\n");
+       printf(" -v: specify the number of vCPUs to run.\n");
+       puts("");
+       exit(0);
+}
+
+int main(int argc, char *argv[])
+{
+       unsigned long iterations = TEST_HOST_LOOP_N;
+       bool mode_selected = false;
+       uint64_t phys_offset = 0;
+       unsigned int mode;
+       int opt, i;
+       int wr_fract = 1;
+
+#ifdef USE_CLEAR_DIRTY_LOG
+       dirty_log_manual_caps =
+               kvm_check_cap(KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2);
+       if (!dirty_log_manual_caps) {
+               print_skip("KVM_CLEAR_DIRTY_LOG not available");
+               exit(KSFT_SKIP);
+       }
+       dirty_log_manual_caps &= (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE |
+                                 KVM_DIRTY_LOG_INITIALLY_SET);
+#endif
+
+#ifdef __x86_64__
+       guest_mode_init(VM_MODE_PXXV48_4K, true, true);
+#endif
+#ifdef __aarch64__
+       guest_mode_init(VM_MODE_P40V48_4K, true, true);
+       guest_mode_init(VM_MODE_P40V48_64K, true, true);
+
+       {
+               unsigned int limit = kvm_check_cap(KVM_CAP_ARM_VM_IPA_SIZE);
+
+               if (limit >= 52)
+                       guest_mode_init(VM_MODE_P52V48_64K, true, true);
+               if (limit >= 48) {
+                       guest_mode_init(VM_MODE_P48V48_4K, true, true);
+                       guest_mode_init(VM_MODE_P48V48_64K, true, true);
+               }
+       }
+#endif
+#ifdef __s390x__
+       guest_mode_init(VM_MODE_P40V48_4K, true, true);
+#endif
+
+       while ((opt = getopt(argc, argv, "hi:p:m:b:f:v:")) != -1) {
+               switch (opt) {
+               case 'i':
+                       iterations = strtol(optarg, NULL, 10);
+                       break;
+               case 'p':
+                       phys_offset = strtoull(optarg, NULL, 0);
+                       break;
+               case 'm':
+                       if (!mode_selected) {
+                               for (i = 0; i < NUM_VM_MODES; ++i)
+                                       guest_modes[i].enabled = false;
+                               mode_selected = true;
+                       }
+                       mode = strtoul(optarg, NULL, 10);
+                       TEST_ASSERT(mode < NUM_VM_MODES,
+                                   "Guest mode ID %d too big", mode);
+                       guest_modes[mode].enabled = true;
+                       break;
+               case 'b':
+                       guest_percpu_mem_size = parse_size(optarg);
+                       break;
+               case 'f':
+                       wr_fract = atoi(optarg);
+                       TEST_ASSERT(wr_fract >= 1,
+                                   "Write fraction cannot be less than one");
+                       break;
+               case 'v':
+                       nr_vcpus = atoi(optarg);
+                       TEST_ASSERT(nr_vcpus > 0,
+                                   "Must have a positive number of vCPUs");
+                       TEST_ASSERT(nr_vcpus <= MAX_VCPUS,
+                                   "This test does not currently support\n"
+                                   "more than %d vCPUs.", MAX_VCPUS);
+                       break;
+               case 'h':
+               default:
+                       help(argv[0]);
+                       break;
+               }
+       }
+
+       TEST_ASSERT(iterations >= 2, "The test should have at least two iterations");
+
+       pr_info("Test iterations: %"PRIu64"\n", iterations);
+
+       for (i = 0; i < NUM_VM_MODES; ++i) {
+               if (!guest_modes[i].enabled)
+                       continue;
+               TEST_ASSERT(guest_modes[i].supported,
+                           "Guest mode ID %d (%s) not supported.",
+                           i, vm_guest_mode_string(i));
+               run_test(i, iterations, phys_offset, wr_fract);
+       }
+
+       return 0;
+}
index 752ec15..54da9cc 100644 (file)
@@ -128,6 +128,78 @@ static uint64_t host_dirty_count;
 static uint64_t host_clear_count;
 static uint64_t host_track_next_count;
 
+enum log_mode_t {
+       /* Only use KVM_GET_DIRTY_LOG for logging */
+       LOG_MODE_DIRTY_LOG = 0,
+
+       /* Use both KVM_[GET|CLEAR]_DIRTY_LOG for logging */
+       LOG_MODE_CLEAR_LOG = 1,
+
+       LOG_MODE_NUM,
+
+       /* Run all supported modes */
+       LOG_MODE_ALL = LOG_MODE_NUM,
+};
+
+/* Mode of logging to test.  Default is to run all supported modes */
+static enum log_mode_t host_log_mode_option = LOG_MODE_ALL;
+/* Logging mode for current run */
+static enum log_mode_t host_log_mode;
+
+static bool clear_log_supported(void)
+{
+       return kvm_check_cap(KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2);
+}
+
+static void clear_log_create_vm_done(struct kvm_vm *vm)
+{
+       struct kvm_enable_cap cap = {};
+       u64 manual_caps;
+
+       manual_caps = kvm_check_cap(KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2);
+       TEST_ASSERT(manual_caps, "MANUAL_CAPS is zero!");
+       manual_caps &= (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE |
+                       KVM_DIRTY_LOG_INITIALLY_SET);
+       cap.cap = KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2;
+       cap.args[0] = manual_caps;
+       vm_enable_cap(vm, &cap);
+}
+
+static void dirty_log_collect_dirty_pages(struct kvm_vm *vm, int slot,
+                                         void *bitmap, uint32_t num_pages)
+{
+       kvm_vm_get_dirty_log(vm, slot, bitmap);
+}
+
+static void clear_log_collect_dirty_pages(struct kvm_vm *vm, int slot,
+                                         void *bitmap, uint32_t num_pages)
+{
+       kvm_vm_get_dirty_log(vm, slot, bitmap);
+       kvm_vm_clear_dirty_log(vm, slot, bitmap, 0, num_pages);
+}
+
+struct log_mode {
+       const char *name;
+       /* Return true if this mode is supported, otherwise false */
+       bool (*supported)(void);
+       /* Hook when the vm creation is done (before vcpu creation) */
+       void (*create_vm_done)(struct kvm_vm *vm);
+       /* Hook to collect the dirty pages into the bitmap provided */
+       void (*collect_dirty_pages) (struct kvm_vm *vm, int slot,
+                                    void *bitmap, uint32_t num_pages);
+} log_modes[LOG_MODE_NUM] = {
+       {
+               .name = "dirty-log",
+               .collect_dirty_pages = dirty_log_collect_dirty_pages,
+       },
+       {
+               .name = "clear-log",
+               .supported = clear_log_supported,
+               .create_vm_done = clear_log_create_vm_done,
+               .collect_dirty_pages = clear_log_collect_dirty_pages,
+       },
+};
+
 /*
  * We use this bitmap to track some pages that should have its dirty
  * bit set in the _next_ iteration.  For example, if we detected the
@@ -137,6 +209,44 @@ static uint64_t host_track_next_count;
  */
 static unsigned long *host_bmap_track;
 
+static void log_modes_dump(void)
+{
+       int i;
+
+       printf("all");
+       for (i = 0; i < LOG_MODE_NUM; i++)
+               printf(", %s", log_modes[i].name);
+       printf("\n");
+}
+
+static bool log_mode_supported(void)
+{
+       struct log_mode *mode = &log_modes[host_log_mode];
+
+       if (mode->supported)
+               return mode->supported();
+
+       return true;
+}
+
+static void log_mode_create_vm_done(struct kvm_vm *vm)
+{
+       struct log_mode *mode = &log_modes[host_log_mode];
+
+       if (mode->create_vm_done)
+               mode->create_vm_done(vm);
+}
+
+static void log_mode_collect_dirty_pages(struct kvm_vm *vm, int slot,
+                                        void *bitmap, uint32_t num_pages)
+{
+       struct log_mode *mode = &log_modes[host_log_mode];
+
+       TEST_ASSERT(mode->collect_dirty_pages != NULL,
+                   "collect_dirty_pages() is required for any log mode!");
+       mode->collect_dirty_pages(vm, slot, bitmap, num_pages);
+}
+
 static void generate_random_array(uint64_t *guest_array, uint64_t size)
 {
        uint64_t i;
@@ -195,7 +305,7 @@ static void vm_dirty_log_verify(enum vm_guest_mode mode, unsigned long *bmap)
                                    page);
                }
 
-               if (test_bit_le(page, bmap)) {
+               if (test_and_clear_bit_le(page, bmap)) {
                        host_dirty_count++;
                        /*
                         * If the bit is set, the value written onto
@@ -252,11 +362,12 @@ static struct kvm_vm *create_vm(enum vm_guest_mode mode, uint32_t vcpuid,
 
        pr_info("Testing guest mode: %s\n", vm_guest_mode_string(mode));
 
-       vm = _vm_create(mode, DEFAULT_GUEST_PHY_PAGES + extra_pg_pages, O_RDWR);
+       vm = vm_create(mode, DEFAULT_GUEST_PHY_PAGES + extra_pg_pages, O_RDWR);
        kvm_vm_elf_load(vm, program_invocation_name, 0, 0);
 #ifdef __x86_64__
        vm_create_irqchip(vm);
 #endif
+       log_mode_create_vm_done(vm);
        vm_vcpu_add_default(vm, vcpuid, guest_code);
        return vm;
 }
@@ -264,10 +375,6 @@ static struct kvm_vm *create_vm(enum vm_guest_mode mode, uint32_t vcpuid,
 #define DIRTY_MEM_BITS 30 /* 1G */
 #define PAGE_SHIFT_4K  12
 
-#ifdef USE_CLEAR_DIRTY_LOG
-static u64 dirty_log_manual_caps;
-#endif
-
 static void run_test(enum vm_guest_mode mode, unsigned long iterations,
                     unsigned long interval, uint64_t phys_offset)
 {
@@ -275,6 +382,12 @@ static void run_test(enum vm_guest_mode mode, unsigned long iterations,
        struct kvm_vm *vm;
        unsigned long *bmap;
 
+       if (!log_mode_supported()) {
+               print_skip("Log mode '%s' not supported",
+                          log_modes[host_log_mode].name);
+               return;
+       }
+
        /*
         * We reserve page table for 2 times of extra dirty mem which
         * will definitely cover the original (1G+) test range.  Here
@@ -317,14 +430,6 @@ static void run_test(enum vm_guest_mode mode, unsigned long iterations,
        bmap = bitmap_alloc(host_num_pages);
        host_bmap_track = bitmap_alloc(host_num_pages);
 
-#ifdef USE_CLEAR_DIRTY_LOG
-       struct kvm_enable_cap cap = {};
-
-       cap.cap = KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2;
-       cap.args[0] = dirty_log_manual_caps;
-       vm_enable_cap(vm, &cap);
-#endif
-
        /* Add an extra memory slot for testing dirty logging */
        vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS,
                                    guest_test_phys_mem,
@@ -362,11 +467,8 @@ static void run_test(enum vm_guest_mode mode, unsigned long iterations,
        while (iteration < iterations) {
                /* Give the vcpu thread some time to dirty some pages */
                usleep(interval * 1000);
-               kvm_vm_get_dirty_log(vm, TEST_MEM_SLOT_INDEX, bmap);
-#ifdef USE_CLEAR_DIRTY_LOG
-               kvm_vm_clear_dirty_log(vm, TEST_MEM_SLOT_INDEX, bmap, 0,
-                                      host_num_pages);
-#endif
+               log_mode_collect_dirty_pages(vm, TEST_MEM_SLOT_INDEX,
+                                            bmap, host_num_pages);
                vm_dirty_log_verify(mode, bmap);
                iteration++;
                sync_global_to_guest(vm, iteration);
@@ -410,6 +512,9 @@ static void help(char *name)
               TEST_HOST_LOOP_INTERVAL);
        printf(" -p: specify guest physical test memory offset\n"
               "     Warning: a low offset can conflict with the loaded test code.\n");
+       printf(" -M: specify the host logging mode "
+              "(default: run all log modes).  Supported modes: \n\t");
+       log_modes_dump();
        printf(" -m: specify the guest mode ID to test "
               "(default: test all supported modes)\n"
               "     This option may be used multiple times.\n"
@@ -429,18 +534,7 @@ int main(int argc, char *argv[])
        bool mode_selected = false;
        uint64_t phys_offset = 0;
        unsigned int mode;
-       int opt, i;
-
-#ifdef USE_CLEAR_DIRTY_LOG
-       dirty_log_manual_caps =
-               kvm_check_cap(KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2);
-       if (!dirty_log_manual_caps) {
-               print_skip("KVM_CLEAR_DIRTY_LOG not available");
-               exit(KSFT_SKIP);
-       }
-       dirty_log_manual_caps &= (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE |
-                                 KVM_DIRTY_LOG_INITIALLY_SET);
-#endif
+       int opt, i, j;
 
 #ifdef __x86_64__
        guest_mode_init(VM_MODE_PXXV48_4K, true, true);
@@ -464,7 +558,7 @@ int main(int argc, char *argv[])
        guest_mode_init(VM_MODE_P40V48_4K, true, true);
 #endif
 
-       while ((opt = getopt(argc, argv, "hi:I:p:m:")) != -1) {
+       while ((opt = getopt(argc, argv, "hi:I:p:m:M:")) != -1) {
                switch (opt) {
                case 'i':
                        iterations = strtol(optarg, NULL, 10);
@@ -486,6 +580,26 @@ int main(int argc, char *argv[])
                                    "Guest mode ID %d too big", mode);
                        guest_modes[mode].enabled = true;
                        break;
+               case 'M':
+                       if (!strcmp(optarg, "all")) {
+                               host_log_mode_option = LOG_MODE_ALL;
+                               break;
+                       }
+                       for (i = 0; i < LOG_MODE_NUM; i++) {
+                               if (!strcmp(optarg, log_modes[i].name)) {
+                                       pr_info("Setting log mode to: '%s'\n",
+                                               optarg);
+                                       host_log_mode_option = i;
+                                       break;
+                               }
+                       }
+                       if (i == LOG_MODE_NUM) {
+                               printf("Log mode '%s' invalid. Please choose "
+                                      "from: ", optarg);
+                               log_modes_dump();
+                               exit(1);
+                       }
+                       break;
                case 'h':
                default:
                        help(argv[0]);
@@ -507,7 +621,18 @@ int main(int argc, char *argv[])
                TEST_ASSERT(guest_modes[i].supported,
                            "Guest mode ID %d (%s) not supported.",
                            i, vm_guest_mode_string(i));
-               run_test(i, iterations, interval, phys_offset);
+               if (host_log_mode_option == LOG_MODE_ALL) {
+                       /* Run each log mode */
+                       for (j = 0; j < LOG_MODE_NUM; j++) {
+                               pr_info("Testing Log Mode '%s'\n",
+                                       log_modes[j].name);
+                               host_log_mode = j;
+                               run_test(i, iterations, interval, phys_offset);
+                       }
+               } else {
+                       host_log_mode = host_log_mode_option;
+                       run_test(i, iterations, interval, phys_offset);
+               }
        }
 
        return 0;
index 919e161..7d29aa7 100644 (file)
@@ -63,9 +63,11 @@ enum vm_mem_backing_src_type {
 
 int kvm_check_cap(long cap);
 int vm_enable_cap(struct kvm_vm *vm, struct kvm_enable_cap *cap);
+int vcpu_enable_cap(struct kvm_vm *vm, uint32_t vcpu_id,
+                   struct kvm_enable_cap *cap);
+void vm_enable_dirty_ring(struct kvm_vm *vm, uint32_t ring_size);
 
 struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm);
-struct kvm_vm *_vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm);
 void kvm_vm_free(struct kvm_vm *vmp);
 void kvm_vm_restart(struct kvm_vm *vmp, int perm);
 void kvm_vm_release(struct kvm_vm *vmp);
@@ -149,6 +151,7 @@ void vcpu_set_guest_debug(struct kvm_vm *vm, uint32_t vcpuid,
                          struct kvm_guest_debug *debug);
 void vcpu_set_mp_state(struct kvm_vm *vm, uint32_t vcpuid,
                       struct kvm_mp_state *mp_state);
+struct kvm_reg_list *vcpu_get_reg_list(struct kvm_vm *vm, uint32_t vcpuid);
 void vcpu_regs_get(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_regs *regs);
 void vcpu_regs_set(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_regs *regs);
 
@@ -294,6 +297,8 @@ int vm_create_device(struct kvm_vm *vm, struct kvm_create_device *cd);
        memcpy(&(g), _p, sizeof(g));                            \
 })
 
+void assert_on_unhandled_exception(struct kvm_vm *vm, uint32_t vcpuid);
+
 /* Common ucalls */
 enum {
        UCALL_NONE,
diff --git a/tools/testing/selftests/kvm/include/perf_test_util.h b/tools/testing/selftests/kvm/include/perf_test_util.h
new file mode 100644 (file)
index 0000000..2618052
--- /dev/null
@@ -0,0 +1,198 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * tools/testing/selftests/kvm/include/perf_test_util.h
+ *
+ * Copyright (C) 2020, Google LLC.
+ */
+
+#ifndef SELFTEST_KVM_PERF_TEST_UTIL_H
+#define SELFTEST_KVM_PERF_TEST_UTIL_H
+
+#include "kvm_util.h"
+#include "processor.h"
+
+#define MAX_VCPUS 512
+
+#define PAGE_SHIFT_4K  12
+#define PTES_PER_4K_PT 512
+
+#define TEST_MEM_SLOT_INDEX            1
+
+/* Default guest test virtual memory offset */
+#define DEFAULT_GUEST_TEST_MEM         0xc0000000
+
+#define DEFAULT_PER_VCPU_MEM_SIZE      (1 << 30) /* 1G */
+
+/*
+ * Guest physical memory offset of the testing memory slot.
+ * This will be set to the topmost valid physical address minus
+ * the test memory size.
+ */
+static uint64_t guest_test_phys_mem;
+
+/*
+ * Guest virtual memory offset of the testing memory slot.
+ * Must not conflict with identity mapped test code.
+ */
+static uint64_t guest_test_virt_mem = DEFAULT_GUEST_TEST_MEM;
+static uint64_t guest_percpu_mem_size = DEFAULT_PER_VCPU_MEM_SIZE;
+
+/* Number of VCPUs for the test */
+static int nr_vcpus = 1;
+
+struct vcpu_args {
+       uint64_t gva;
+       uint64_t pages;
+
+       /* Only used by the host userspace part of the vCPU thread */
+       int vcpu_id;
+};
+
+struct perf_test_args {
+       struct kvm_vm *vm;
+       uint64_t host_page_size;
+       uint64_t guest_page_size;
+       int wr_fract;
+
+       struct vcpu_args vcpu_args[MAX_VCPUS];
+};
+
+static struct perf_test_args perf_test_args;
+
+/*
+ * Continuously write to the first 8 bytes of each page in the
+ * specified region.
+ */
+static void guest_code(uint32_t vcpu_id)
+{
+       struct vcpu_args *vcpu_args = &perf_test_args.vcpu_args[vcpu_id];
+       uint64_t gva;
+       uint64_t pages;
+       int i;
+
+       /* Make sure vCPU args data structure is not corrupt. */
+       GUEST_ASSERT(vcpu_args->vcpu_id == vcpu_id);
+
+       gva = vcpu_args->gva;
+       pages = vcpu_args->pages;
+
+       while (true) {
+               for (i = 0; i < pages; i++) {
+                       uint64_t addr = gva + (i * perf_test_args.guest_page_size);
+
+                       if (i % perf_test_args.wr_fract == 0)
+                               *(uint64_t *)addr = 0x0123456789ABCDEF;
+                       else
+                               READ_ONCE(*(uint64_t *)addr);
+               }
+
+               GUEST_SYNC(1);
+       }
+}
+
+static struct kvm_vm *create_vm(enum vm_guest_mode mode, int vcpus,
+                               uint64_t vcpu_memory_bytes)
+{
+       struct kvm_vm *vm;
+       uint64_t pages = DEFAULT_GUEST_PHY_PAGES;
+       uint64_t guest_num_pages;
+
+       /* Account for a few pages per-vCPU for stacks */
+       pages += DEFAULT_STACK_PGS * vcpus;
+
+       /*
+        * Reserve twice the ammount of memory needed to map the test region and
+        * the page table / stacks region, at 4k, for page tables. Do the
+        * calculation with 4K page size: the smallest of all archs. (e.g., 64K
+        * page size guest will need even less memory for page tables).
+        */
+       pages += (2 * pages) / PTES_PER_4K_PT;
+       pages += ((2 * vcpus * vcpu_memory_bytes) >> PAGE_SHIFT_4K) /
+                PTES_PER_4K_PT;
+       pages = vm_adjust_num_guest_pages(mode, pages);
+
+       pr_info("Testing guest mode: %s\n", vm_guest_mode_string(mode));
+
+       vm = vm_create(mode, pages, O_RDWR);
+       kvm_vm_elf_load(vm, program_invocation_name, 0, 0);
+#ifdef __x86_64__
+       vm_create_irqchip(vm);
+#endif
+
+       perf_test_args.vm = vm;
+       perf_test_args.guest_page_size = vm_get_page_size(vm);
+       perf_test_args.host_page_size = getpagesize();
+
+       TEST_ASSERT(vcpu_memory_bytes % perf_test_args.guest_page_size == 0,
+                   "Guest memory size is not guest page size aligned.");
+
+       guest_num_pages = (vcpus * vcpu_memory_bytes) /
+                         perf_test_args.guest_page_size;
+       guest_num_pages = vm_adjust_num_guest_pages(mode, guest_num_pages);
+
+       /*
+        * If there should be more memory in the guest test region than there
+        * can be pages in the guest, it will definitely cause problems.
+        */
+       TEST_ASSERT(guest_num_pages < vm_get_max_gfn(vm),
+                   "Requested more guest memory than address space allows.\n"
+                   "    guest pages: %lx max gfn: %x vcpus: %d wss: %lx]\n",
+                   guest_num_pages, vm_get_max_gfn(vm), vcpus,
+                   vcpu_memory_bytes);
+
+       TEST_ASSERT(vcpu_memory_bytes % perf_test_args.host_page_size == 0,
+                   "Guest memory size is not host page size aligned.");
+
+       guest_test_phys_mem = (vm_get_max_gfn(vm) - guest_num_pages) *
+                             perf_test_args.guest_page_size;
+       guest_test_phys_mem &= ~(perf_test_args.host_page_size - 1);
+
+#ifdef __s390x__
+       /* Align to 1M (segment size) */
+       guest_test_phys_mem &= ~((1 << 20) - 1);
+#endif
+
+       pr_info("guest physical test memory offset: 0x%lx\n", guest_test_phys_mem);
+
+       /* Add an extra memory slot for testing */
+       vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS,
+                                   guest_test_phys_mem,
+                                   TEST_MEM_SLOT_INDEX,
+                                   guest_num_pages, 0);
+
+       /* Do mapping for the demand paging memory slot */
+       virt_map(vm, guest_test_virt_mem, guest_test_phys_mem, guest_num_pages, 0);
+
+       ucall_init(vm, NULL);
+
+       return vm;
+}
+
+static void add_vcpus(struct kvm_vm *vm, int vcpus, uint64_t vcpu_memory_bytes)
+{
+       vm_paddr_t vcpu_gpa;
+       struct vcpu_args *vcpu_args;
+       int vcpu_id;
+
+       for (vcpu_id = 0; vcpu_id < vcpus; vcpu_id++) {
+               vcpu_args = &perf_test_args.vcpu_args[vcpu_id];
+
+               vm_vcpu_add_default(vm, vcpu_id, guest_code);
+
+#ifdef __x86_64__
+               vcpu_set_cpuid(vm, vcpu_id, kvm_get_supported_cpuid());
+#endif
+
+               vcpu_args->vcpu_id = vcpu_id;
+               vcpu_args->gva = guest_test_virt_mem +
+                                (vcpu_id * vcpu_memory_bytes);
+               vcpu_args->pages = vcpu_memory_bytes /
+                                  perf_test_args.guest_page_size;
+
+               vcpu_gpa = guest_test_phys_mem + (vcpu_id * vcpu_memory_bytes);
+               pr_debug("Added VCPU %d with test mem gpa [%lx, %lx)\n",
+                        vcpu_id, vcpu_gpa, vcpu_gpa + vcpu_memory_bytes);
+       }
+}
+
+#endif /* SELFTEST_KVM_PERF_TEST_UTIL_H */
index 5eb01bf..ffffa56 100644 (file)
@@ -64,5 +64,7 @@ int64_t timespec_to_ns(struct timespec ts);
 struct timespec timespec_add_ns(struct timespec ts, int64_t ns);
 struct timespec timespec_add(struct timespec ts1, struct timespec ts2);
 struct timespec timespec_sub(struct timespec ts1, struct timespec ts2);
+struct timespec timespec_diff_now(struct timespec start);
+struct timespec timespec_div(struct timespec ts, int divisor);
 
 #endif /* SELFTEST_KVM_TEST_UTIL_H */
index 82b7fe1..8e61340 100644 (file)
@@ -36,6 +36,8 @@
 #define X86_CR4_SMAP           (1ul << 21)
 #define X86_CR4_PKE            (1ul << 22)
 
+#define UNEXPECTED_VECTOR_PORT 0xfff0u
+
 /* General Registers in 64-Bit Mode */
 struct gpr64_regs {
        u64 rax;
@@ -59,7 +61,7 @@ struct gpr64_regs {
 struct desc64 {
        uint16_t limit0;
        uint16_t base0;
-       unsigned base1:8, s:1, type:4, dpl:2, p:1;
+       unsigned base1:8, type:4, s:1, dpl:2, p:1;
        unsigned limit1:4, avl:1, l:1, db:1, g:1, base2:8;
        uint32_t base3;
        uint32_t zero1;
@@ -239,6 +241,11 @@ static inline struct desc_ptr get_idt(void)
        return idt;
 }
 
+static inline void outl(uint16_t port, uint32_t value)
+{
+       __asm__ __volatile__("outl %%eax, %%dx" : : "d"(port), "a"(value));
+}
+
 #define SET_XMM(__var, __xmm) \
        asm volatile("movq %0, %%"#__xmm : : "r"(__var) : #__xmm)
 
@@ -338,6 +345,35 @@ uint32_t kvm_get_cpuid_max_basic(void);
 uint32_t kvm_get_cpuid_max_extended(void);
 void kvm_get_cpu_address_width(unsigned int *pa_bits, unsigned int *va_bits);
 
+struct ex_regs {
+       uint64_t rax, rcx, rdx, rbx;
+       uint64_t rbp, rsi, rdi;
+       uint64_t r8, r9, r10, r11;
+       uint64_t r12, r13, r14, r15;
+       uint64_t vector;
+       uint64_t error_code;
+       uint64_t rip;
+       uint64_t cs;
+       uint64_t rflags;
+};
+
+void vm_init_descriptor_tables(struct kvm_vm *vm);
+void vcpu_init_descriptor_tables(struct kvm_vm *vm, uint32_t vcpuid);
+void vm_handle_exception(struct kvm_vm *vm, int vector,
+                       void (*handler)(struct ex_regs *));
+
+/*
+ * set_cpuid() - overwrites a matching cpuid entry with the provided value.
+ *              matches based on ent->function && ent->index. returns true
+ *              if a match was found and successfully overwritten.
+ * @cpuid: the kvm cpuid list to modify.
+ * @ent: cpuid entry to insert
+ */
+bool set_cpuid(struct kvm_cpuid2 *cpuid, struct kvm_cpuid_entry2 *ent);
+
+uint64_t kvm_hypercall(uint64_t nr, uint64_t a0, uint64_t a1, uint64_t a2,
+                      uint64_t a3);
+
 /*
  * Basic CPU control in CR0
  */
index 54d624d..e78d7e2 100644 (file)
@@ -573,6 +573,10 @@ struct vmx_pages {
        void *eptp_hva;
        uint64_t eptp_gpa;
        void *eptp;
+
+       void *apic_access_hva;
+       uint64_t apic_access_gpa;
+       void *apic_access;
 };
 
 union vmx_basic {
@@ -615,5 +619,7 @@ void nested_map_memslot(struct vmx_pages *vmx, struct kvm_vm *vm,
                        uint32_t memslot, uint32_t eptp_memslot);
 void prepare_eptp(struct vmx_pages *vmx, struct kvm_vm *vm,
                  uint32_t eptp_memslot);
+void prepare_virtualize_apic_accesses(struct vmx_pages *vmx, struct kvm_vm *vm,
+                                     uint32_t eptp_memslot);
 
 #endif /* SELFTEST_KVM_VMX_H */
index 2afa661..d6c32c3 100644 (file)
@@ -350,3 +350,7 @@ void vcpu_args_set(struct kvm_vm *vm, uint32_t vcpuid, unsigned int num, ...)
 
        va_end(ap);
 }
+
+void assert_on_unhandled_exception(struct kvm_vm *vm, uint32_t vcpuid)
+{
+}
index c8e0ec2..2f37b90 100644 (file)
@@ -94,6 +94,9 @@ uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc)
        struct kvm_run *run = vcpu_state(vm, vcpu_id);
        struct ucall ucall = {};
 
+       if (uc)
+               memset(uc, 0, sizeof(*uc));
+
        if (run->exit_reason == KVM_EXIT_MMIO &&
            run->mmio.phys_addr == (uint64_t)ucall_exit_mmio_addr) {
                vm_vaddr_t gva;
index 74776ee..126c672 100644 (file)
@@ -14,6 +14,7 @@
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <unistd.h>
 #include <linux/kernel.h>
 
 #define KVM_UTIL_PGS_PER_HUGEPG 512
@@ -85,6 +86,34 @@ int vm_enable_cap(struct kvm_vm *vm, struct kvm_enable_cap *cap)
        return ret;
 }
 
+/* VCPU Enable Capability
+ *
+ * Input Args:
+ *   vm - Virtual Machine
+ *   vcpu_id - VCPU
+ *   cap - Capability
+ *
+ * Output Args: None
+ *
+ * Return: On success, 0. On failure a TEST_ASSERT failure is produced.
+ *
+ * Enables a capability (KVM_CAP_*) on the VCPU.
+ */
+int vcpu_enable_cap(struct kvm_vm *vm, uint32_t vcpu_id,
+                   struct kvm_enable_cap *cap)
+{
+       struct vcpu *vcpu = vcpu_find(vm, vcpu_id);
+       int r;
+
+       TEST_ASSERT(vcpu, "cannot find vcpu %d", vcpu_id);
+
+       r = ioctl(vcpu->fd, KVM_ENABLE_CAP, cap);
+       TEST_ASSERT(!r, "KVM_ENABLE_CAP vCPU ioctl failed,\n"
+                       "  rc: %i, errno: %i", r, errno);
+
+       return r;
+}
+
 static void vm_open(struct kvm_vm *vm, int perm)
 {
        vm->kvm_fd = open(KVM_DEV_PATH, perm);
@@ -151,7 +180,7 @@ _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params)
  * descriptor to control the created VM is created with the permissions
  * given by perm (e.g. O_RDWR).
  */
-struct kvm_vm *_vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm)
+struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm)
 {
        struct kvm_vm *vm;
 
@@ -242,11 +271,6 @@ struct kvm_vm *_vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm)
        return vm;
 }
 
-struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm)
-{
-       return _vm_create(mode, phy_pages, perm);
-}
-
 /*
  * VM Restart
  *
@@ -664,13 +688,21 @@ void vm_userspace_mem_region_add(struct kvm_vm *vm,
 
        /* As needed perform madvise */
        if (src_type == VM_MEM_SRC_ANONYMOUS || src_type == VM_MEM_SRC_ANONYMOUS_THP) {
-               ret = madvise(region->host_mem, npages * vm->page_size,
-                            src_type == VM_MEM_SRC_ANONYMOUS ? MADV_NOHUGEPAGE : MADV_HUGEPAGE);
-               TEST_ASSERT(ret == 0, "madvise failed,\n"
-                           "  addr: %p\n"
-                           "  length: 0x%lx\n"
-                           "  src_type: %x",
-                           region->host_mem, npages * vm->page_size, src_type);
+               struct stat statbuf;
+
+               ret = stat("/sys/kernel/mm/transparent_hugepage", &statbuf);
+               TEST_ASSERT(ret == 0 || (ret == -1 && errno == ENOENT),
+                           "stat /sys/kernel/mm/transparent_hugepage");
+
+               TEST_ASSERT(ret == 0 || src_type != VM_MEM_SRC_ANONYMOUS_THP,
+                           "VM_MEM_SRC_ANONYMOUS_THP requires THP to be configured in the host kernel");
+
+               if (ret == 0) {
+                       ret = madvise(region->host_mem, npages * vm->page_size,
+                                     src_type == VM_MEM_SRC_ANONYMOUS ? MADV_NOHUGEPAGE : MADV_HUGEPAGE);
+                       TEST_ASSERT(ret == 0, "madvise failed, addr: %p length: 0x%lx src_type: %x",
+                                   region->host_mem, npages * vm->page_size, src_type);
+               }
        }
 
        region->unused_phy_pages = sparsebit_alloc();
@@ -1195,6 +1227,9 @@ int _vcpu_run(struct kvm_vm *vm, uint32_t vcpuid)
        do {
                rc = ioctl(vcpu->fd, KVM_RUN, NULL);
        } while (rc == -1 && errno == EINTR);
+
+       assert_on_unhandled_exception(vm, vcpuid);
+
        return rc;
 }
 
@@ -1252,6 +1287,35 @@ void vcpu_set_mp_state(struct kvm_vm *vm, uint32_t vcpuid,
 }
 
 /*
+ * VM VCPU Get Reg List
+ *
+ * Input Args:
+ *   vm - Virtual Machine
+ *   vcpuid - VCPU ID
+ *
+ * Output Args:
+ *   None
+ *
+ * Return:
+ *   A pointer to an allocated struct kvm_reg_list
+ *
+ * Get the list of guest registers which are supported for
+ * KVM_GET_ONE_REG/KVM_SET_ONE_REG calls
+ */
+struct kvm_reg_list *vcpu_get_reg_list(struct kvm_vm *vm, uint32_t vcpuid)
+{
+       struct kvm_reg_list reg_list_n = { .n = 0 }, *reg_list;
+       int ret;
+
+       ret = _vcpu_ioctl(vm, vcpuid, KVM_GET_REG_LIST, &reg_list_n);
+       TEST_ASSERT(ret == -1 && errno == E2BIG, "KVM_GET_REG_LIST n=0");
+       reg_list = calloc(1, sizeof(*reg_list) + reg_list_n.n * sizeof(__u64));
+       reg_list->n = reg_list_n.n;
+       vcpu_ioctl(vm, vcpuid, KVM_GET_REG_LIST, reg_list);
+       return reg_list;
+}
+
+/*
  * VM VCPU Regs Get
  *
  * Input Args:
index 2ef4465..f07d383 100644 (file)
@@ -50,6 +50,8 @@ struct kvm_vm {
        vm_paddr_t pgd;
        vm_vaddr_t gdt;
        vm_vaddr_t tss;
+       vm_vaddr_t idt;
+       vm_vaddr_t handlers;
 };
 
 struct vcpu *vcpu_find(struct kvm_vm *vm, uint32_t vcpuid);
index a88c5d6..7349bb2 100644 (file)
@@ -241,3 +241,7 @@ void vcpu_dump(FILE *stream, struct kvm_vm *vm, uint32_t vcpuid, uint8_t indent)
        fprintf(stream, "%*spstate: psw: 0x%.16llx:0x%.16llx\n",
                indent, "", vcpu->state->psw_mask, vcpu->state->psw_addr);
 }
+
+void assert_on_unhandled_exception(struct kvm_vm *vm, uint32_t vcpuid)
+{
+}
index fd589dc..9d3b0f1 100644 (file)
@@ -38,6 +38,9 @@ uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc)
        struct kvm_run *run = vcpu_state(vm, vcpu_id);
        struct ucall ucall = {};
 
+       if (uc)
+               memset(uc, 0, sizeof(*uc));
+
        if (run->exit_reason == KVM_EXIT_S390_SIEIC &&
            run->s390_sieic.icptcode == 4 &&
            (run->s390_sieic.ipa >> 8) == 0x83 &&    /* 0x83 means DIAGNOSE */
index 689e97c..8e04c0b 100644 (file)
@@ -4,10 +4,13 @@
  *
  * Copyright (C) 2020, Google LLC.
  */
-#include <stdlib.h>
+
+#include <assert.h>
 #include <ctype.h>
 #include <limits.h>
-#include <assert.h>
+#include <stdlib.h>
+#include <time.h>
+
 #include "test_util.h"
 
 /*
@@ -81,6 +84,21 @@ struct timespec timespec_sub(struct timespec ts1, struct timespec ts2)
        return timespec_add_ns((struct timespec){0}, ns1 - ns2);
 }
 
+struct timespec timespec_diff_now(struct timespec start)
+{
+       struct timespec end;
+
+       clock_gettime(CLOCK_MONOTONIC, &end);
+       return timespec_sub(end, start);
+}
+
+struct timespec timespec_div(struct timespec ts, int divisor)
+{
+       int64_t ns = timespec_to_ns(ts) / divisor;
+
+       return timespec_add_ns((struct timespec){0}, ns);
+}
+
 void print_skip(const char *fmt, ...)
 {
        va_list ap;
diff --git a/tools/testing/selftests/kvm/lib/x86_64/handlers.S b/tools/testing/selftests/kvm/lib/x86_64/handlers.S
new file mode 100644 (file)
index 0000000..aaf7bc7
--- /dev/null
@@ -0,0 +1,81 @@
+handle_exception:
+       push %r15
+       push %r14
+       push %r13
+       push %r12
+       push %r11
+       push %r10
+       push %r9
+       push %r8
+
+       push %rdi
+       push %rsi
+       push %rbp
+       push %rbx
+       push %rdx
+       push %rcx
+       push %rax
+       mov %rsp, %rdi
+
+       call route_exception
+
+       pop %rax
+       pop %rcx
+       pop %rdx
+       pop %rbx
+       pop %rbp
+       pop %rsi
+       pop %rdi
+       pop %r8
+       pop %r9
+       pop %r10
+       pop %r11
+       pop %r12
+       pop %r13
+       pop %r14
+       pop %r15
+
+       /* Discard vector and error code. */
+       add $16, %rsp
+       iretq
+
+/*
+ * Build the handle_exception wrappers which push the vector/error code on the
+ * stack and an array of pointers to those wrappers.
+ */
+.pushsection .rodata
+.globl idt_handlers
+idt_handlers:
+.popsection
+
+.macro HANDLERS has_error from to
+       vector = \from
+       .rept \to - \from + 1
+       .align 8
+
+       /* Fetch current address and append it to idt_handlers. */
+       current_handler = .
+.pushsection .rodata
+.quad current_handler
+.popsection
+
+       .if ! \has_error
+       pushq $0
+       .endif
+       pushq $vector
+       jmp handle_exception
+       vector = vector + 1
+       .endr
+.endm
+
+.global idt_handler_code
+idt_handler_code:
+       HANDLERS has_error=0 from=0  to=7
+       HANDLERS has_error=1 from=8  to=8
+       HANDLERS has_error=0 from=9  to=9
+       HANDLERS has_error=1 from=10 to=14
+       HANDLERS has_error=0 from=15 to=16
+       HANDLERS has_error=1 from=17 to=17
+       HANDLERS has_error=0 from=18 to=255
+
+.section        .note.GNU-stack, "", %progbits
index f6eb34e..d10c5c0 100644 (file)
 #include "../kvm_util_internal.h"
 #include "processor.h"
 
+#ifndef NUM_INTERRUPTS
+#define NUM_INTERRUPTS 256
+#endif
+
+#define DEFAULT_CODE_SELECTOR 0x8
+#define DEFAULT_DATA_SELECTOR 0x10
+
 /* Minimum physical address used for virtual translation tables. */
 #define KVM_GUEST_PAGE_TABLE_MIN_PADDR 0x180000
 
+vm_vaddr_t exception_handlers;
+
 /* Virtual translation table structure declarations */
 struct pageMapL4Entry {
        uint64_t present:1;
@@ -392,11 +401,12 @@ static void kvm_seg_fill_gdt_64bit(struct kvm_vm *vm, struct kvm_segment *segp)
        desc->limit0 = segp->limit & 0xFFFF;
        desc->base0 = segp->base & 0xFFFF;
        desc->base1 = segp->base >> 16;
-       desc->s = segp->s;
        desc->type = segp->type;
+       desc->s = segp->s;
        desc->dpl = segp->dpl;
        desc->p = segp->present;
        desc->limit1 = segp->limit >> 16;
+       desc->avl = segp->avl;
        desc->l = segp->l;
        desc->db = segp->db;
        desc->g = segp->g;
@@ -556,9 +566,9 @@ static void vcpu_setup(struct kvm_vm *vm, int vcpuid, int pgd_memslot, int gdt_m
                sregs.efer |= (EFER_LME | EFER_LMA | EFER_NX);
 
                kvm_seg_set_unusable(&sregs.ldt);
-               kvm_seg_set_kernel_code_64bit(vm, 0x8, &sregs.cs);
-               kvm_seg_set_kernel_data_64bit(vm, 0x10, &sregs.ds);
-               kvm_seg_set_kernel_data_64bit(vm, 0x10, &sregs.es);
+               kvm_seg_set_kernel_code_64bit(vm, DEFAULT_CODE_SELECTOR, &sregs.cs);
+               kvm_seg_set_kernel_data_64bit(vm, DEFAULT_DATA_SELECTOR, &sregs.ds);
+               kvm_seg_set_kernel_data_64bit(vm, DEFAULT_DATA_SELECTOR, &sregs.es);
                kvm_setup_tss_64bit(vm, &sregs.tr, 0x18, gdt_memslot, pgd_memslot);
                break;
 
@@ -1118,3 +1128,131 @@ void kvm_get_cpu_address_width(unsigned int *pa_bits, unsigned int *va_bits)
                *va_bits = (entry->eax >> 8) & 0xff;
        }
 }
+
+struct idt_entry {
+       uint16_t offset0;
+       uint16_t selector;
+       uint16_t ist : 3;
+       uint16_t : 5;
+       uint16_t type : 4;
+       uint16_t : 1;
+       uint16_t dpl : 2;
+       uint16_t p : 1;
+       uint16_t offset1;
+       uint32_t offset2; uint32_t reserved;
+};
+
+static void set_idt_entry(struct kvm_vm *vm, int vector, unsigned long addr,
+                         int dpl, unsigned short selector)
+{
+       struct idt_entry *base =
+               (struct idt_entry *)addr_gva2hva(vm, vm->idt);
+       struct idt_entry *e = &base[vector];
+
+       memset(e, 0, sizeof(*e));
+       e->offset0 = addr;
+       e->selector = selector;
+       e->ist = 0;
+       e->type = 14;
+       e->dpl = dpl;
+       e->p = 1;
+       e->offset1 = addr >> 16;
+       e->offset2 = addr >> 32;
+}
+
+void kvm_exit_unexpected_vector(uint32_t value)
+{
+       outl(UNEXPECTED_VECTOR_PORT, value);
+}
+
+void route_exception(struct ex_regs *regs)
+{
+       typedef void(*handler)(struct ex_regs *);
+       handler *handlers = (handler *)exception_handlers;
+
+       if (handlers && handlers[regs->vector]) {
+               handlers[regs->vector](regs);
+               return;
+       }
+
+       kvm_exit_unexpected_vector(regs->vector);
+}
+
+void vm_init_descriptor_tables(struct kvm_vm *vm)
+{
+       extern void *idt_handlers;
+       int i;
+
+       vm->idt = vm_vaddr_alloc(vm, getpagesize(), 0x2000, 0, 0);
+       vm->handlers = vm_vaddr_alloc(vm, 256 * sizeof(void *), 0x2000, 0, 0);
+       /* Handlers have the same address in both address spaces.*/
+       for (i = 0; i < NUM_INTERRUPTS; i++)
+               set_idt_entry(vm, i, (unsigned long)(&idt_handlers)[i], 0,
+                       DEFAULT_CODE_SELECTOR);
+}
+
+void vcpu_init_descriptor_tables(struct kvm_vm *vm, uint32_t vcpuid)
+{
+       struct kvm_sregs sregs;
+
+       vcpu_sregs_get(vm, vcpuid, &sregs);
+       sregs.idt.base = vm->idt;
+       sregs.idt.limit = NUM_INTERRUPTS * sizeof(struct idt_entry) - 1;
+       sregs.gdt.base = vm->gdt;
+       sregs.gdt.limit = getpagesize() - 1;
+       kvm_seg_set_kernel_data_64bit(NULL, DEFAULT_DATA_SELECTOR, &sregs.gs);
+       vcpu_sregs_set(vm, vcpuid, &sregs);
+       *(vm_vaddr_t *)addr_gva2hva(vm, (vm_vaddr_t)(&exception_handlers)) = vm->handlers;
+}
+
+void vm_handle_exception(struct kvm_vm *vm, int vector,
+                        void (*handler)(struct ex_regs *))
+{
+       vm_vaddr_t *handlers = (vm_vaddr_t *)addr_gva2hva(vm, vm->handlers);
+
+       handlers[vector] = (vm_vaddr_t)handler;
+}
+
+void assert_on_unhandled_exception(struct kvm_vm *vm, uint32_t vcpuid)
+{
+       if (vcpu_state(vm, vcpuid)->exit_reason == KVM_EXIT_IO
+               && vcpu_state(vm, vcpuid)->io.port == UNEXPECTED_VECTOR_PORT
+               && vcpu_state(vm, vcpuid)->io.size == 4) {
+               /* Grab pointer to io data */
+               uint32_t *data = (void *)vcpu_state(vm, vcpuid)
+                       + vcpu_state(vm, vcpuid)->io.data_offset;
+
+               TEST_ASSERT(false,
+                           "Unexpected vectored event in guest (vector:0x%x)",
+                           *data);
+       }
+}
+
+bool set_cpuid(struct kvm_cpuid2 *cpuid,
+              struct kvm_cpuid_entry2 *ent)
+{
+       int i;
+
+       for (i = 0; i < cpuid->nent; i++) {
+               struct kvm_cpuid_entry2 *cur = &cpuid->entries[i];
+
+               if (cur->function != ent->function || cur->index != ent->index)
+                       continue;
+
+               memcpy(cur, ent, sizeof(struct kvm_cpuid_entry2));
+               return true;
+       }
+
+       return false;
+}
+
+uint64_t kvm_hypercall(uint64_t nr, uint64_t a0, uint64_t a1, uint64_t a2,
+                      uint64_t a3)
+{
+       uint64_t r;
+
+       asm volatile("vmcall"
+                    : "=a"(r)
+                    : "b"(a0), "c"(a1), "d"(a2), "S"(a3));
+       return r;
+}
index da4d89a..a348997 100644 (file)
@@ -40,6 +40,9 @@ uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc)
        struct kvm_run *run = vcpu_state(vm, vcpu_id);
        struct ucall ucall = {};
 
+       if (uc)
+               memset(uc, 0, sizeof(*uc));
+
        if (run->exit_reason == KVM_EXIT_IO && run->io.port == UCALL_PIO_PORT) {
                struct kvm_regs regs;
 
index f1e00d4..2448b30 100644 (file)
@@ -542,3 +542,12 @@ void prepare_eptp(struct vmx_pages *vmx, struct kvm_vm *vm,
        vmx->eptp_hva = addr_gva2hva(vm, (uintptr_t)vmx->eptp);
        vmx->eptp_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->eptp);
 }
+
+void prepare_virtualize_apic_accesses(struct vmx_pages *vmx, struct kvm_vm *vm,
+                                     uint32_t eptp_memslot)
+{
+       vmx->apic_access = (void *)vm_vaddr_alloc(vm, getpagesize(),
+                                                 0x10000, 0, 0);
+       vmx->apic_access_hva = addr_gva2hva(vm, (uintptr_t)vmx->apic_access);
+       vmx->apic_access_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->apic_access);
+}
diff --git a/tools/testing/selftests/kvm/x86_64/kvm_pv_test.c b/tools/testing/selftests/kvm/x86_64/kvm_pv_test.c
new file mode 100644 (file)
index 0000000..b10a274
--- /dev/null
@@ -0,0 +1,234 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2020, Google LLC.
+ *
+ * Tests for KVM paravirtual feature disablement
+ */
+#include <asm/kvm_para.h>
+#include <linux/kvm_para.h>
+#include <stdint.h>
+
+#include "test_util.h"
+#include "kvm_util.h"
+#include "processor.h"
+
+extern unsigned char rdmsr_start;
+extern unsigned char rdmsr_end;
+
+static u64 do_rdmsr(u32 idx)
+{
+       u32 lo, hi;
+
+       asm volatile("rdmsr_start: rdmsr;"
+                    "rdmsr_end:"
+                    : "=a"(lo), "=c"(hi)
+                    : "c"(idx));
+
+       return (((u64) hi) << 32) | lo;
+}
+
+extern unsigned char wrmsr_start;
+extern unsigned char wrmsr_end;
+
+static void do_wrmsr(u32 idx, u64 val)
+{
+       u32 lo, hi;
+
+       lo = val;
+       hi = val >> 32;
+
+       asm volatile("wrmsr_start: wrmsr;"
+                    "wrmsr_end:"
+                    : : "a"(lo), "c"(idx), "d"(hi));
+}
+
+static int nr_gp;
+
+static void guest_gp_handler(struct ex_regs *regs)
+{
+       unsigned char *rip = (unsigned char *)regs->rip;
+       bool r, w;
+
+       r = rip == &rdmsr_start;
+       w = rip == &wrmsr_start;
+       GUEST_ASSERT(r || w);
+
+       nr_gp++;
+
+       if (r)
+               regs->rip = (uint64_t)&rdmsr_end;
+       else
+               regs->rip = (uint64_t)&wrmsr_end;
+}
+
+struct msr_data {
+       uint32_t idx;
+       const char *name;
+};
+
+#define TEST_MSR(msr) { .idx = msr, .name = #msr }
+#define UCALL_PR_MSR 0xdeadbeef
+#define PR_MSR(msr) ucall(UCALL_PR_MSR, 1, msr)
+
+/*
+ * KVM paravirtual msrs to test. Expect a #GP if any of these msrs are read or
+ * written, as the KVM_CPUID_FEATURES leaf is cleared.
+ */
+static struct msr_data msrs_to_test[] = {
+       TEST_MSR(MSR_KVM_SYSTEM_TIME),
+       TEST_MSR(MSR_KVM_SYSTEM_TIME_NEW),
+       TEST_MSR(MSR_KVM_WALL_CLOCK),
+       TEST_MSR(MSR_KVM_WALL_CLOCK_NEW),
+       TEST_MSR(MSR_KVM_ASYNC_PF_EN),
+       TEST_MSR(MSR_KVM_STEAL_TIME),
+       TEST_MSR(MSR_KVM_PV_EOI_EN),
+       TEST_MSR(MSR_KVM_POLL_CONTROL),
+       TEST_MSR(MSR_KVM_ASYNC_PF_INT),
+       TEST_MSR(MSR_KVM_ASYNC_PF_ACK),
+};
+
+static void test_msr(struct msr_data *msr)
+{
+       PR_MSR(msr);
+       do_rdmsr(msr->idx);
+       GUEST_ASSERT(READ_ONCE(nr_gp) == 1);
+
+       nr_gp = 0;
+       do_wrmsr(msr->idx, 0);
+       GUEST_ASSERT(READ_ONCE(nr_gp) == 1);
+       nr_gp = 0;
+}
+
+struct hcall_data {
+       uint64_t nr;
+       const char *name;
+};
+
+#define TEST_HCALL(hc) { .nr = hc, .name = #hc }
+#define UCALL_PR_HCALL 0xdeadc0de
+#define PR_HCALL(hc) ucall(UCALL_PR_HCALL, 1, hc)
+
+/*
+ * KVM hypercalls to test. Expect -KVM_ENOSYS when called, as the corresponding
+ * features have been cleared in KVM_CPUID_FEATURES.
+ */
+static struct hcall_data hcalls_to_test[] = {
+       TEST_HCALL(KVM_HC_KICK_CPU),
+       TEST_HCALL(KVM_HC_SEND_IPI),
+       TEST_HCALL(KVM_HC_SCHED_YIELD),
+};
+
+static void test_hcall(struct hcall_data *hc)
+{
+       uint64_t r;
+
+       PR_HCALL(hc);
+       r = kvm_hypercall(hc->nr, 0, 0, 0, 0);
+       GUEST_ASSERT(r == -KVM_ENOSYS);
+}
+
+static void guest_main(void)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(msrs_to_test); i++) {
+               test_msr(&msrs_to_test[i]);
+       }
+
+       for (i = 0; i < ARRAY_SIZE(hcalls_to_test); i++) {
+               test_hcall(&hcalls_to_test[i]);
+       }
+
+       GUEST_DONE();
+}
+
+static void clear_kvm_cpuid_features(struct kvm_cpuid2 *cpuid)
+{
+       struct kvm_cpuid_entry2 ent = {0};
+
+       ent.function = KVM_CPUID_FEATURES;
+       TEST_ASSERT(set_cpuid(cpuid, &ent),
+                   "failed to clear KVM_CPUID_FEATURES leaf");
+}
+
+static void pr_msr(struct ucall *uc)
+{
+       struct msr_data *msr = (struct msr_data *)uc->args[0];
+
+       pr_info("testing msr: %s (%#x)\n", msr->name, msr->idx);
+}
+
+static void pr_hcall(struct ucall *uc)
+{
+       struct hcall_data *hc = (struct hcall_data *)uc->args[0];
+
+       pr_info("testing hcall: %s (%lu)\n", hc->name, hc->nr);
+}
+
+static void handle_abort(struct ucall *uc)
+{
+       TEST_FAIL("%s at %s:%ld", (const char *)uc->args[0],
+                 __FILE__, uc->args[1]);
+}
+
+#define VCPU_ID 0
+
+static void enter_guest(struct kvm_vm *vm)
+{
+       struct kvm_run *run;
+       struct ucall uc;
+       int r;
+
+       run = vcpu_state(vm, VCPU_ID);
+
+       while (true) {
+               r = _vcpu_run(vm, VCPU_ID);
+               TEST_ASSERT(!r, "vcpu_run failed: %d\n", r);
+               TEST_ASSERT(run->exit_reason == KVM_EXIT_IO,
+                           "unexpected exit reason: %u (%s)",
+                           run->exit_reason, exit_reason_str(run->exit_reason));
+
+               switch (get_ucall(vm, VCPU_ID, &uc)) {
+               case UCALL_PR_MSR:
+                       pr_msr(&uc);
+                       break;
+               case UCALL_PR_HCALL:
+                       pr_hcall(&uc);
+                       break;
+               case UCALL_ABORT:
+                       handle_abort(&uc);
+                       return;
+               case UCALL_DONE:
+                       return;
+               }
+       }
+}
+
+int main(void)
+{
+       struct kvm_enable_cap cap = {0};
+       struct kvm_cpuid2 *best;
+       struct kvm_vm *vm;
+
+       if (!kvm_check_cap(KVM_CAP_ENFORCE_PV_FEATURE_CPUID)) {
+               pr_info("will skip kvm paravirt restriction tests.\n");
+               return 0;
+       }
+
+       vm = vm_create_default(VCPU_ID, 0, guest_main);
+
+       cap.cap = KVM_CAP_ENFORCE_PV_FEATURE_CPUID;
+       cap.args[0] = 1;
+       vcpu_enable_cap(vm, VCPU_ID, &cap);
+
+       best = kvm_get_supported_cpuid();
+       clear_kvm_cpuid_features(best);
+       vcpu_set_cpuid(vm, VCPU_ID, best);
+
+       vm_init_descriptor_tables(vm);
+       vcpu_init_descriptor_tables(vm, VCPU_ID);
+       vm_handle_exception(vm, GP_VECTOR, guest_gp_handler);
+
+       enter_guest(vm);
+       kvm_vm_free(vm);
+}
diff --git a/tools/testing/selftests/kvm/x86_64/vmx_apic_access_test.c b/tools/testing/selftests/kvm/x86_64/vmx_apic_access_test.c
new file mode 100644 (file)
index 0000000..1f65342
--- /dev/null
@@ -0,0 +1,142 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * vmx_apic_access_test
+ *
+ * Copyright (C) 2020, Google LLC.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.
+ *
+ * The first subtest simply checks to see that an L2 guest can be
+ * launched with a valid APIC-access address that is backed by a
+ * page of L1 physical memory.
+ *
+ * The second subtest sets the APIC-access address to a (valid) L1
+ * physical address that is not backed by memory. KVM can't handle
+ * this situation, so resuming L2 should result in a KVM exit for
+ * internal error (emulation). This is not an architectural
+ * requirement. It is just a shortcoming of KVM. The internal error
+ * is unfortunate, but it's better than what used to happen!
+ */
+
+#include "test_util.h"
+#include "kvm_util.h"
+#include "processor.h"
+#include "vmx.h"
+
+#include <string.h>
+#include <sys/ioctl.h>
+
+#include "kselftest.h"
+
+#define VCPU_ID                0
+
+/* The virtual machine object. */
+static struct kvm_vm *vm;
+
+static void l2_guest_code(void)
+{
+       /* Exit to L1 */
+       __asm__ __volatile__("vmcall");
+}
+
+static void l1_guest_code(struct vmx_pages *vmx_pages, unsigned long high_gpa)
+{
+#define L2_GUEST_STACK_SIZE 64
+       unsigned long l2_guest_stack[L2_GUEST_STACK_SIZE];
+       uint32_t control;
+
+       GUEST_ASSERT(prepare_for_vmx_operation(vmx_pages));
+       GUEST_ASSERT(load_vmcs(vmx_pages));
+
+       /* Prepare the VMCS for L2 execution. */
+       prepare_vmcs(vmx_pages, l2_guest_code,
+                    &l2_guest_stack[L2_GUEST_STACK_SIZE]);
+       control = vmreadz(CPU_BASED_VM_EXEC_CONTROL);
+       control |= CPU_BASED_ACTIVATE_SECONDARY_CONTROLS;
+       vmwrite(CPU_BASED_VM_EXEC_CONTROL, control);
+       control = vmreadz(SECONDARY_VM_EXEC_CONTROL);
+       control |= SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
+       vmwrite(SECONDARY_VM_EXEC_CONTROL, control);
+       vmwrite(APIC_ACCESS_ADDR, vmx_pages->apic_access_gpa);
+
+       /* Try to launch L2 with the memory-backed APIC-access address. */
+       GUEST_SYNC(vmreadz(APIC_ACCESS_ADDR));
+       GUEST_ASSERT(!vmlaunch());
+       GUEST_ASSERT(vmreadz(VM_EXIT_REASON) == EXIT_REASON_VMCALL);
+
+       vmwrite(APIC_ACCESS_ADDR, high_gpa);
+
+       /* Try to resume L2 with the unbacked APIC-access address. */
+       GUEST_SYNC(vmreadz(APIC_ACCESS_ADDR));
+       GUEST_ASSERT(!vmresume());
+       GUEST_ASSERT(vmreadz(VM_EXIT_REASON) == EXIT_REASON_VMCALL);
+
+       GUEST_DONE();
+}
+
+int main(int argc, char *argv[])
+{
+       unsigned long apic_access_addr = ~0ul;
+       unsigned int paddr_width;
+       unsigned int vaddr_width;
+       vm_vaddr_t vmx_pages_gva;
+       unsigned long high_gpa;
+       struct vmx_pages *vmx;
+       bool done = false;
+
+       nested_vmx_check_supported();
+
+       vm = vm_create_default(VCPU_ID, 0, (void *) l1_guest_code);
+       vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid());
+
+       kvm_get_cpu_address_width(&paddr_width, &vaddr_width);
+       high_gpa = (1ul << paddr_width) - getpagesize();
+       if ((unsigned long)DEFAULT_GUEST_PHY_PAGES * getpagesize() > high_gpa) {
+               print_skip("No unbacked physical page available");
+               exit(KSFT_SKIP);
+       }
+
+       vmx = vcpu_alloc_vmx(vm, &vmx_pages_gva);
+       prepare_virtualize_apic_accesses(vmx, vm, 0);
+       vcpu_args_set(vm, VCPU_ID, 2, vmx_pages_gva, high_gpa);
+
+       while (!done) {
+               volatile struct kvm_run *run = vcpu_state(vm, VCPU_ID);
+               struct ucall uc;
+
+               vcpu_run(vm, VCPU_ID);
+               if (apic_access_addr == high_gpa) {
+                       TEST_ASSERT(run->exit_reason ==
+                                   KVM_EXIT_INTERNAL_ERROR,
+                                   "Got exit reason other than KVM_EXIT_INTERNAL_ERROR: %u (%s)\n",
+                                   run->exit_reason,
+                                   exit_reason_str(run->exit_reason));
+                       TEST_ASSERT(run->internal.suberror ==
+                                   KVM_INTERNAL_ERROR_EMULATION,
+                                   "Got internal suberror other than KVM_INTERNAL_ERROR_EMULATION: %u\n",
+                                   run->internal.suberror);
+                       break;
+               }
+               TEST_ASSERT(run->exit_reason == KVM_EXIT_IO,
+                           "Got exit_reason other than KVM_EXIT_IO: %u (%s)\n",
+                           run->exit_reason,
+                           exit_reason_str(run->exit_reason));
+
+               switch (get_ucall(vm, VCPU_ID, &uc)) {
+               case UCALL_ABORT:
+                       TEST_FAIL("%s at %s:%ld", (const char *)uc.args[0],
+                                 __FILE__, uc.args[1]);
+                       /* NOT REACHED */
+               case UCALL_SYNC:
+                       apic_access_addr = uc.args[1];
+                       break;
+               case UCALL_DONE:
+                       done = true;
+                       break;
+               default:
+                       TEST_ASSERT(false, "Unknown ucall %lu", uc.cmd);
+               }
+       }
+       kvm_vm_free(vm);
+       return 0;
+}
index 30848ca..a5ce26d 100644 (file)
@@ -136,7 +136,7 @@ endif
 ifeq ($(OVERRIDE_TARGETS),)
 LOCAL_HDRS := $(selfdir)/kselftest_harness.h $(selfdir)/kselftest.h
 $(OUTPUT)/%:%.c $(LOCAL_HDRS)
-       $(LINK.c) $^ $(LDLIBS) -o $@
+       $(LINK.c) $(filter-out $(LOCAL_HDRS),$^) $(LDLIBS) -o $@
 
 $(OUTPUT)/%.o:%.S
        $(COMPILE.S) $^ -o $@
index 0bc64a6..17f2d84 100644 (file)
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
 unprivileged-remount-test
+nosymfollow-test
index 0268907..2d94548 100644 (file)
@@ -3,7 +3,7 @@
 CFLAGS = -Wall \
          -O2
 
-TEST_PROGS := run_tests.sh
-TEST_GEN_FILES := unprivileged-remount-test
+TEST_PROGS := run_unprivileged_remount.sh run_nosymfollow.sh
+TEST_GEN_FILES := unprivileged-remount-test nosymfollow-test
 
 include ../lib.mk
diff --git a/tools/testing/selftests/mount/nosymfollow-test.c b/tools/testing/selftests/mount/nosymfollow-test.c
new file mode 100644 (file)
index 0000000..650d6d8
--- /dev/null
@@ -0,0 +1,218 @@
+// SPDX-License-Identifier: GPL-2.0
+#define _GNU_SOURCE
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <sched.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/vfs.h>
+#include <unistd.h>
+
+#ifndef MS_NOSYMFOLLOW
+# define MS_NOSYMFOLLOW 256     /* Do not follow symlinks */
+#endif
+
+#ifndef ST_NOSYMFOLLOW
+# define ST_NOSYMFOLLOW 0x2000  /* Do not follow symlinks */
+#endif
+
+#define DATA "/tmp/data"
+#define LINK "/tmp/symlink"
+#define TMP  "/tmp"
+
+static void die(char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+       va_end(ap);
+       exit(EXIT_FAILURE);
+}
+
+static void vmaybe_write_file(bool enoent_ok, char *filename, char *fmt,
+               va_list ap)
+{
+       ssize_t written;
+       char buf[4096];
+       int buf_len;
+       int fd;
+
+       buf_len = vsnprintf(buf, sizeof(buf), fmt, ap);
+       if (buf_len < 0)
+               die("vsnprintf failed: %s\n", strerror(errno));
+
+       if (buf_len >= sizeof(buf))
+               die("vsnprintf output truncated\n");
+
+       fd = open(filename, O_WRONLY);
+       if (fd < 0) {
+               if ((errno == ENOENT) && enoent_ok)
+                       return;
+               die("open of %s failed: %s\n", filename, strerror(errno));
+       }
+
+       written = write(fd, buf, buf_len);
+       if (written != buf_len) {
+               if (written >= 0) {
+                       die("short write to %s\n", filename);
+               } else {
+                       die("write to %s failed: %s\n",
+                               filename, strerror(errno));
+               }
+       }
+
+       if (close(fd) != 0)
+               die("close of %s failed: %s\n", filename, strerror(errno));
+}
+
+static void maybe_write_file(char *filename, char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vmaybe_write_file(true, filename, fmt, ap);
+       va_end(ap);
+}
+
+static void write_file(char *filename, char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vmaybe_write_file(false, filename, fmt, ap);
+       va_end(ap);
+}
+
+static void create_and_enter_ns(void)
+{
+       uid_t uid = getuid();
+       gid_t gid = getgid();
+
+       if (unshare(CLONE_NEWUSER) != 0)
+               die("unshare(CLONE_NEWUSER) failed: %s\n", strerror(errno));
+
+       maybe_write_file("/proc/self/setgroups", "deny");
+       write_file("/proc/self/uid_map", "0 %d 1", uid);
+       write_file("/proc/self/gid_map", "0 %d 1", gid);
+
+       if (setgid(0) != 0)
+               die("setgid(0) failed %s\n", strerror(errno));
+       if (setuid(0) != 0)
+               die("setuid(0) failed %s\n", strerror(errno));
+
+       if (unshare(CLONE_NEWNS) != 0)
+               die("unshare(CLONE_NEWNS) failed: %s\n", strerror(errno));
+}
+
+static void setup_symlink(void)
+{
+       int data, err;
+
+       data = creat(DATA, O_RDWR);
+       if (data < 0)
+               die("creat failed: %s\n", strerror(errno));
+
+       err = symlink(DATA, LINK);
+       if (err < 0)
+               die("symlink failed: %s\n", strerror(errno));
+
+       if (close(data) != 0)
+               die("close of %s failed: %s\n", DATA, strerror(errno));
+}
+
+static void test_link_traversal(bool nosymfollow)
+{
+       int link;
+
+       link = open(LINK, 0, O_RDWR);
+       if (nosymfollow) {
+               if ((link != -1 || errno != ELOOP)) {
+                       die("link traversal unexpected result: %d, %s\n",
+                                       link, strerror(errno));
+               }
+       } else {
+               if (link < 0)
+                       die("link traversal failed: %s\n", strerror(errno));
+
+               if (close(link) != 0)
+                       die("close of link failed: %s\n", strerror(errno));
+       }
+}
+
+static void test_readlink(void)
+{
+       char buf[4096];
+       ssize_t ret;
+
+       bzero(buf, sizeof(buf));
+
+       ret = readlink(LINK, buf, sizeof(buf));
+       if (ret < 0)
+               die("readlink failed: %s\n", strerror(errno));
+       if (strcmp(buf, DATA) != 0)
+               die("readlink strcmp failed: '%s' '%s'\n", buf, DATA);
+}
+
+static void test_realpath(void)
+{
+       char *path = realpath(LINK, NULL);
+
+       if (!path)
+               die("realpath failed: %s\n", strerror(errno));
+       if (strcmp(path, DATA) != 0)
+               die("realpath strcmp failed\n");
+
+       free(path);
+}
+
+static void test_statfs(bool nosymfollow)
+{
+       struct statfs buf;
+       int ret;
+
+       ret = statfs(TMP, &buf);
+       if (ret)
+               die("statfs failed: %s\n", strerror(errno));
+
+       if (nosymfollow) {
+               if ((buf.f_flags & ST_NOSYMFOLLOW) == 0)
+                       die("ST_NOSYMFOLLOW not set on %s\n", TMP);
+       } else {
+               if ((buf.f_flags & ST_NOSYMFOLLOW) != 0)
+                       die("ST_NOSYMFOLLOW set on %s\n", TMP);
+       }
+}
+
+static void run_tests(bool nosymfollow)
+{
+       test_link_traversal(nosymfollow);
+       test_readlink();
+       test_realpath();
+       test_statfs(nosymfollow);
+}
+
+int main(int argc, char **argv)
+{
+       create_and_enter_ns();
+
+       if (mount("testing", TMP, "ramfs", 0, NULL) != 0)
+               die("mount failed: %s\n", strerror(errno));
+
+       setup_symlink();
+       run_tests(false);
+
+       if (mount("testing", TMP, "ramfs", MS_REMOUNT|MS_NOSYMFOLLOW, NULL) != 0)
+               die("remount failed: %s\n", strerror(errno));
+
+       run_tests(true);
+
+       return EXIT_SUCCESS;
+}
diff --git a/tools/testing/selftests/mount/run_nosymfollow.sh b/tools/testing/selftests/mount/run_nosymfollow.sh
new file mode 100755 (executable)
index 0000000..5fbbf03
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+./nosymfollow-test
index ef35247..fa5fa42 100644 (file)
@@ -21,6 +21,7 @@ TEST_PROGS += rxtimestamp.sh
 TEST_PROGS += devlink_port_split.py
 TEST_PROGS += drop_monitor_tests.sh
 TEST_PROGS += vrf_route_leaking.sh
+TEST_PROGS += bareudp.sh
 TEST_PROGS_EXTENDED := in_netns.sh
 TEST_GEN_FILES =  socket nettest
 TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy reuseport_addr_any
diff --git a/tools/testing/selftests/net/bareudp.sh b/tools/testing/selftests/net/bareudp.sh
new file mode 100755 (executable)
index 0000000..f366cad
--- /dev/null
@@ -0,0 +1,546 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+# Test various bareudp tunnel configurations.
+#
+# The bareudp module allows to tunnel network protocols like IP or MPLS over
+# UDP, without adding any intermediate header. This scripts tests several
+# configurations of bareudp (using IPv4 or IPv6 as underlay and transporting
+# IPv4, IPv6 or MPLS packets on the overlay).
+#
+# Network topology:
+#
+#   * A chain of 4 network namespaces, connected with veth pairs. Each veth
+#     is assigned an IPv4 and an IPv6 address. A host-route allows a veth to
+#     join its peer.
+#
+#   * NS0 and NS3 are at the extremities of the chain. They have additional
+#     IPv4 and IPv6 addresses on their loopback device. Routes are added in NS0
+#     and NS3, so that they can communicate using these overlay IP addresses.
+#     For IPv4 and IPv6 reachability tests, the route simply sets the peer's
+#     veth address as gateway. For MPLS reachability tests, an MPLS header is
+#     also pushed before the IP header.
+#
+#   * NS1 and NS2 are the intermediate namespaces. They use a bareudp device to
+#     encapsulate the traffic into UDP.
+#
+# +-----------------------------------------------------------------------+
+# |                                  NS0                                  |
+# |                                                                       |
+# |   lo:                                                                 |
+# |      * IPv4 address: 192.0.2.100/32                                   |
+# |      * IPv6 address: 2001:db8::100/128                                |
+# |      * IPv6 address: 2001:db8::200/128                                |
+# |      * IPv4 route: 192.0.2.103/32 reachable via 192.0.2.11            |
+# |      * IPv6 route: 2001:db8::103/128 reachable via 2001:db8::11       |
+# |      * IPv6 route: 2001:db8::203/128 reachable via 2001:db8::11       |
+# |                    (encapsulated with MPLS label 203)                 |
+# |                                                                       |
+# |   veth01:                                                             |
+# |   ^  * IPv4 address: 192.0.2.10, peer 192.0.2.11/32                   |
+# |   |  * IPv6 address: 2001:db8::10, peer 2001:db8::11/128              |
+# |   |                                                                   |
+# +---+-------------------------------------------------------------------+
+#     |
+#     | Traffic type: IP or MPLS (depending on test)
+#     |
+# +---+-------------------------------------------------------------------+
+# |   |                              NS1                                  |
+# |   |                                                                   |
+# |   v                                                                   |
+# |   veth10:                                                             |
+# |      * IPv4 address: 192.0.2.11, peer 192.0.2.10/32                   |
+# |      * IPv6 address: 2001:db8::11, peer 2001:db8::10/128              |
+# |                                                                       |
+# |   bareudp_ns1:                                                        |
+# |      * Encapsulate IP or MPLS packets received on veth10 into UDP     |
+# |        and send the resulting packets through veth12.                 |
+# |      * Decapsulate bareudp packets (either IP or MPLS, over UDP)      |
+# |        received on veth12 and send the inner packets through veth10.  |
+# |                                                                       |
+# |   veth12:                                                             |
+# |   ^  * IPv4 address: 192.0.2.21, peer 192.0.2.22/32                   |
+# |   |  * IPv6 address: 2001:db8::21, peer 2001:db8::22/128              |
+# |   |                                                                   |
+# +---+-------------------------------------------------------------------+
+#     |
+#     | Traffic type: IP or MPLS (depending on test), over UDP
+#     |
+# +---+-------------------------------------------------------------------+
+# |   |                              NS2                                  |
+# |   |                                                                   |
+# |   v                                                                   |
+# |   veth21:                                                             |
+# |      * IPv4 address: 192.0.2.22, peer 192.0.2.21/32                   |
+# |      * IPv6 address: 2001:db8::22, peer 2001:db8::21/128              |
+# |                                                                       |
+# |   bareudp_ns2:                                                        |
+# |      * Decapsulate bareudp packets (either IP or MPLS, over UDP)      |
+# |        received on veth21 and send the inner packets through veth23.  |
+# |      * Encapsulate IP or MPLS packets received on veth23 into UDP     |
+# |        and send the resulting packets through veth21.                 |
+# |                                                                       |
+# |   veth23:                                                             |
+# |   ^  * IPv4 address: 192.0.2.32, peer 192.0.2.33/32                   |
+# |   |  * IPv6 address: 2001:db8::32, peer 2001:db8::33/128              |
+# |   |                                                                   |
+# +---+-------------------------------------------------------------------+
+#     |
+#     | Traffic type: IP or MPLS (depending on test)
+#     |
+# +---+-------------------------------------------------------------------+
+# |   |                              NS3                                  |
+# |   v                                                                   |
+# |   veth32:                                                             |
+# |      * IPv4 address: 192.0.2.33, peer 192.0.2.32/32                   |
+# |      * IPv6 address: 2001:db8::33, peer 2001:db8::32/128              |
+# |                                                                       |
+# |   lo:                                                                 |
+# |      * IPv4 address: 192.0.2.103/32                                   |
+# |      * IPv6 address: 2001:db8::103/128                                |
+# |      * IPv6 address: 2001:db8::203/128                                |
+# |      * IPv4 route: 192.0.2.100/32 reachable via 192.0.2.32            |
+# |      * IPv6 route: 2001:db8::100/128 reachable via 2001:db8::32       |
+# |      * IPv6 route: 2001:db8::200/128 reachable via 2001:db8::32       |
+# |                    (encapsulated with MPLS label 200)                 |
+# |                                                                       |
+# +-----------------------------------------------------------------------+
+
+ERR=4 # Return 4 by default, which is the SKIP code for kselftest
+PING6="ping"
+PAUSE_ON_FAIL="no"
+
+readonly NS0=$(mktemp -u ns0-XXXXXXXX)
+readonly NS1=$(mktemp -u ns1-XXXXXXXX)
+readonly NS2=$(mktemp -u ns2-XXXXXXXX)
+readonly NS3=$(mktemp -u ns3-XXXXXXXX)
+
+# Exit the script after having removed the network namespaces it created
+#
+# Parameters:
+#
+#   * The list of network namespaces to delete before exiting.
+#
+exit_cleanup()
+{
+       for ns in "$@"; do
+               ip netns delete "${ns}" 2>/dev/null || true
+       done
+
+       if [ "${ERR}" -eq 4 ]; then
+               echo "Error: Setting up the testing environment failed." >&2
+       fi
+
+       exit "${ERR}"
+}
+
+# Create the four network namespaces used by the script (NS0, NS1, NS2 and NS3)
+#
+# New namespaces are cleaned up manually in case of error, to ensure that only
+# namespaces created by this script are deleted.
+create_namespaces()
+{
+       ip netns add "${NS0}" || exit_cleanup
+       ip netns add "${NS1}" || exit_cleanup "${NS0}"
+       ip netns add "${NS2}" || exit_cleanup "${NS0}" "${NS1}"
+       ip netns add "${NS3}" || exit_cleanup "${NS0}" "${NS1}" "${NS2}"
+}
+
+# The trap function handler
+#
+exit_cleanup_all()
+{
+       exit_cleanup "${NS0}" "${NS1}" "${NS2}" "${NS3}"
+}
+
+# Configure a network interface using a host route
+#
+# Parameters
+#
+#   * $1: the netns the network interface resides in,
+#   * $2: the network interface name,
+#   * $3: the local IPv4 address to assign to this interface,
+#   * $4: the IPv4 address of the remote network interface,
+#   * $5: the local IPv6 address to assign to this interface,
+#   * $6: the IPv6 address of the remote network interface.
+#
+iface_config()
+{
+       local NS="${1}"; readonly NS
+       local DEV="${2}"; readonly DEV
+       local LOCAL_IP4="${3}"; readonly LOCAL_IP4
+       local PEER_IP4="${4}"; readonly PEER_IP4
+       local LOCAL_IP6="${5}"; readonly LOCAL_IP6
+       local PEER_IP6="${6}"; readonly PEER_IP6
+
+       ip -netns "${NS}" link set dev "${DEV}" up
+       ip -netns "${NS}" address add dev "${DEV}" "${LOCAL_IP4}" peer "${PEER_IP4}"
+       ip -netns "${NS}" address add dev "${DEV}" "${LOCAL_IP6}" peer "${PEER_IP6}" nodad
+}
+
+# Create base networking topology:
+#
+#   * set up the loopback device in all network namespaces (NS0..NS3),
+#   * set up a veth pair to connect each netns in sequence (NS0 with NS1,
+#     NS1 with NS2, etc.),
+#   * add and IPv4 and an IPv6 address on each veth interface,
+#   * prepare the ingress qdiscs in the intermediate namespaces.
+#
+setup_underlay()
+{
+       for ns in "${NS0}" "${NS1}" "${NS2}" "${NS3}"; do
+               ip -netns "${ns}" link set dev lo up
+       done;
+
+       ip link add name veth01 netns "${NS0}" type veth peer name veth10 netns "${NS1}"
+       ip link add name veth12 netns "${NS1}" type veth peer name veth21 netns "${NS2}"
+       ip link add name veth23 netns "${NS2}" type veth peer name veth32 netns "${NS3}"
+       iface_config "${NS0}" veth01 192.0.2.10 192.0.2.11/32 2001:db8::10 2001:db8::11/128
+       iface_config "${NS1}" veth10 192.0.2.11 192.0.2.10/32 2001:db8::11 2001:db8::10/128
+       iface_config "${NS1}" veth12 192.0.2.21 192.0.2.22/32 2001:db8::21 2001:db8::22/128
+       iface_config "${NS2}" veth21 192.0.2.22 192.0.2.21/32 2001:db8::22 2001:db8::21/128
+       iface_config "${NS2}" veth23 192.0.2.32 192.0.2.33/32 2001:db8::32 2001:db8::33/128
+       iface_config "${NS3}" veth32 192.0.2.33 192.0.2.32/32 2001:db8::33 2001:db8::32/128
+
+       tc -netns "${NS1}" qdisc add dev veth10 ingress
+       tc -netns "${NS2}" qdisc add dev veth23 ingress
+}
+
+# Set up the IPv4, IPv6 and MPLS overlays.
+#
+# Configuration is similar for all protocols:
+#
+#   * add an overlay IP address on the loopback interface of each edge
+#     namespace,
+#   * route these IP addresses via the intermediate namespaces (for the MPLS
+#     tests, this is also where MPLS encapsulation is done),
+#   * add routes for these IP addresses (or MPLS labels) in the intermediate
+#     namespaces.
+#
+# The bareudp encapsulation isn't configured in setup_overlay_*(). That will be
+# done just before running the reachability tests.
+
+setup_overlay_ipv4()
+{
+       # Add the overlay IP addresses and route them through the veth devices
+       ip -netns "${NS0}" address add 192.0.2.100/32 dev lo
+       ip -netns "${NS3}" address add 192.0.2.103/32 dev lo
+       ip -netns "${NS0}" route add 192.0.2.103/32 src 192.0.2.100 via 192.0.2.11
+       ip -netns "${NS3}" route add 192.0.2.100/32 src 192.0.2.103 via 192.0.2.32
+
+       # Route the overlay addresses in the intermediate namespaces
+       # (used after bareudp decapsulation)
+       ip netns exec "${NS1}" sysctl -qw net.ipv4.ip_forward=1
+       ip netns exec "${NS2}" sysctl -qw net.ipv4.ip_forward=1
+       ip -netns "${NS1}" route add 192.0.2.100/32 via 192.0.2.10
+       ip -netns "${NS2}" route add 192.0.2.103/32 via 192.0.2.33
+
+       # The intermediate namespaces don't have routes for the reverse path,
+       # as it will be handled by tc. So we need to ensure that rp_filter is
+       # not going to block the traffic.
+       ip netns exec "${NS1}" sysctl -qw net.ipv4.conf.all.rp_filter=0
+       ip netns exec "${NS2}" sysctl -qw net.ipv4.conf.all.rp_filter=0
+       ip netns exec "${NS1}" sysctl -qw net.ipv4.conf.default.rp_filter=0
+       ip netns exec "${NS2}" sysctl -qw net.ipv4.conf.default.rp_filter=0
+}
+
+setup_overlay_ipv6()
+{
+       # Add the overlay IP addresses and route them through the veth devices
+       ip -netns "${NS0}" address add 2001:db8::100/128 dev lo
+       ip -netns "${NS3}" address add 2001:db8::103/128 dev lo
+       ip -netns "${NS0}" route add 2001:db8::103/128 src 2001:db8::100 via 2001:db8::11
+       ip -netns "${NS3}" route add 2001:db8::100/128 src 2001:db8::103 via 2001:db8::32
+
+       # Route the overlay addresses in the intermediate namespaces
+       # (used after bareudp decapsulation)
+       ip netns exec "${NS1}" sysctl -qw net.ipv6.conf.all.forwarding=1
+       ip netns exec "${NS2}" sysctl -qw net.ipv6.conf.all.forwarding=1
+       ip -netns "${NS1}" route add 2001:db8::100/128 via 2001:db8::10
+       ip -netns "${NS2}" route add 2001:db8::103/128 via 2001:db8::33
+}
+
+setup_overlay_mpls()
+{
+       # Add specific overlay IP addresses, routed over MPLS
+       ip -netns "${NS0}" address add 2001:db8::200/128 dev lo
+       ip -netns "${NS3}" address add 2001:db8::203/128 dev lo
+       ip -netns "${NS0}" route add 2001:db8::203/128 src 2001:db8::200 encap mpls 203 via 2001:db8::11
+       ip -netns "${NS3}" route add 2001:db8::200/128 src 2001:db8::203 encap mpls 200 via 2001:db8::32
+
+       # Route the MPLS packets in the intermediate namespaces
+       # (used after bareudp decapsulation)
+       ip netns exec "${NS1}" sysctl -qw net.mpls.platform_labels=256
+       ip netns exec "${NS2}" sysctl -qw net.mpls.platform_labels=256
+       ip -netns "${NS1}" -family mpls route add 200 via inet6 2001:db8::10
+       ip -netns "${NS2}" -family mpls route add 203 via inet6 2001:db8::33
+}
+
+# Run "ping" from NS0 and print the result
+#
+# Parameters:
+#
+#   * $1: the variant of ping to use (normally either "ping" or "ping6"),
+#   * $2: the IP address to ping,
+#   * $3: a human readable description of the purpose of the test.
+#
+# If the test fails and PAUSE_ON_FAIL is active, the user is given the
+# possibility to continue with the next test or to quit immediately.
+#
+ping_test_one()
+{
+       local PING="$1"; readonly PING
+       local IP="$2"; readonly IP
+       local MSG="$3"; readonly MSG
+       local RET
+
+       printf "TEST: %-60s  " "${MSG}"
+
+       set +e
+       ip netns exec "${NS0}" "${PING}" -w 5 -c 1 "${IP}" > /dev/null 2>&1
+       RET=$?
+       set -e
+
+       if [ "${RET}" -eq 0 ]; then
+               printf "[ OK ]\n"
+       else
+               ERR=1
+               printf "[FAIL]\n"
+               if [ "${PAUSE_ON_FAIL}" = "yes" ]; then
+                       printf "\nHit enter to continue, 'q' to quit\n"
+                       read a
+                       if [ "$a" = "q" ]; then
+                               exit 1
+                       fi
+               fi
+       fi
+}
+
+# Run reachability tests
+#
+# Parameters:
+#
+#   * $1: human readable string describing the underlay protocol.
+#
+# $IPV4, $IPV6, $MPLS_UC and $MULTIPROTO are inherited from the calling
+# function.
+#
+ping_test()
+{
+       local UNDERLAY="$1"; readonly UNDERLAY
+       local MODE
+       local MSG
+
+       if [ "${MULTIPROTO}" = "multiproto" ]; then
+               MODE=" (multiproto mode)"
+       else
+               MODE=""
+       fi
+
+       if [ $IPV4 ]; then
+               ping_test_one "ping" "192.0.2.103" "IPv4 packets over ${UNDERLAY}${MODE}"
+       fi
+       if [ $IPV6 ]; then
+               ping_test_one "${PING6}" "2001:db8::103" "IPv6 packets over ${UNDERLAY}${MODE}"
+       fi
+       if [ $MPLS_UC ]; then
+               ping_test_one "${PING6}" "2001:db8::203" "Unicast MPLS packets over ${UNDERLAY}${MODE}"
+       fi
+}
+
+# Set up a bareudp overlay and run reachability tests over IPv4 and IPv6
+#
+# Parameters:
+#
+#   * $1: the packet type (protocol) to be handled by bareudp,
+#   * $2: a flag to activate or deactivate bareudp's "multiproto" mode.
+#
+test_overlay()
+{
+       local ETHERTYPE="$1"; readonly ETHERTYPE
+       local MULTIPROTO="$2"; readonly MULTIPROTO
+       local IPV4
+       local IPV6
+       local MPLS_UC
+
+       case "${ETHERTYPE}" in
+               "ipv4")
+                       IPV4="ipv4"
+                       if [ "${MULTIPROTO}" = "multiproto" ]; then
+                               IPV6="ipv6"
+                       else
+                               IPV6=""
+                       fi
+                       MPLS_UC=""
+                       ;;
+               "ipv6")
+                       IPV6="ipv6"
+                       IPV4=""
+                       MPLS_UC=""
+                       ;;
+               "mpls_uc")
+                       MPLS_UC="mpls_uc"
+                       IPV4=""
+                       IPV6=""
+                       ;;
+               *)
+                       exit 1
+                       ;;
+       esac
+       readonly IPV4
+       readonly IPV6
+       readonly MPLS_UC
+
+       # Create the bareudp devices in the intermediate namespaces
+       ip -netns "${NS1}" link add name bareudp_ns1 up type bareudp dstport 6635 ethertype "${ETHERTYPE}" "${MULTIPROTO}"
+       ip -netns "${NS2}" link add name bareudp_ns2 up type bareudp dstport 6635 ethertype "${ETHERTYPE}" "${MULTIPROTO}"
+
+       # IPv4 over UDPv4
+       if [ $IPV4 ]; then
+               # Encapsulation instructions for bareudp over IPv4
+               tc -netns "${NS1}" filter add dev veth10 ingress protocol ipv4         \
+                       flower dst_ip 192.0.2.103/32                                   \
+                       action tunnel_key set src_ip 192.0.2.21 dst_ip 192.0.2.22 id 0 \
+                       action mirred egress redirect dev bareudp_ns1
+               tc -netns "${NS2}" filter add dev veth23 ingress protocol ipv4         \
+                       flower dst_ip 192.0.2.100/32                                   \
+                       action tunnel_key set src_ip 192.0.2.22 dst_ip 192.0.2.21 id 0 \
+                       action mirred egress redirect dev bareudp_ns2
+       fi
+
+       # IPv6 over UDPv4
+       if [ $IPV6 ]; then
+               # Encapsulation instructions for bareudp over IPv4
+               tc -netns "${NS1}" filter add dev veth10 ingress protocol ipv6         \
+                       flower dst_ip 2001:db8::103/128                                \
+                       action tunnel_key set src_ip 192.0.2.21 dst_ip 192.0.2.22 id 0 \
+                       action mirred egress redirect dev bareudp_ns1
+               tc -netns "${NS2}" filter add dev veth23 ingress protocol ipv6         \
+                       flower dst_ip 2001:db8::100/128                                \
+                       action tunnel_key set src_ip 192.0.2.22 dst_ip 192.0.2.21 id 0 \
+                       action mirred egress redirect dev bareudp_ns2
+       fi
+
+       # MPLS (unicast) over UDPv4
+       if [ $MPLS_UC ]; then
+               ip netns exec "${NS1}" sysctl -qw net.mpls.conf.bareudp_ns1.input=1
+               ip netns exec "${NS2}" sysctl -qw net.mpls.conf.bareudp_ns2.input=1
+
+               # Encapsulation instructions for bareudp over IPv4
+               tc -netns "${NS1}" filter add dev veth10 ingress protocol mpls_uc      \
+                       flower mpls_label 203                                          \
+                       action tunnel_key set src_ip 192.0.2.21 dst_ip 192.0.2.22 id 0 \
+                       action mirred egress redirect dev bareudp_ns1
+               tc -netns "${NS2}" filter add dev veth23 ingress protocol mpls_uc      \
+                       flower mpls_label 200                                          \
+                       action tunnel_key set src_ip 192.0.2.22 dst_ip 192.0.2.21 id 0 \
+                       action mirred egress redirect dev bareudp_ns2
+       fi
+
+       # Test IPv4 underlay
+       ping_test "UDPv4"
+
+       # Cleanup bareudp encapsulation instructions, as they were specific to
+       # the IPv4 underlay, before setting up and testing the IPv6 underlay
+       tc -netns "${NS1}" filter delete dev veth10 ingress
+       tc -netns "${NS2}" filter delete dev veth23 ingress
+
+       # IPv4 over UDPv6
+       if [ $IPV4 ]; then
+               # New encapsulation instructions for bareudp over IPv6
+               tc -netns "${NS1}" filter add dev veth10 ingress protocol ipv4             \
+                       flower dst_ip 192.0.2.103/32                                       \
+                       action tunnel_key set src_ip 2001:db8::21 dst_ip 2001:db8::22 id 0 \
+                       action mirred egress redirect dev bareudp_ns1
+               tc -netns "${NS2}" filter add dev veth23 ingress protocol ipv4             \
+                       flower dst_ip 192.0.2.100/32                                       \
+                       action tunnel_key set src_ip 2001:db8::22 dst_ip 2001:db8::21 id 0 \
+                       action mirred egress redirect dev bareudp_ns2
+       fi
+
+       # IPv6 over UDPv6
+       if [ $IPV6 ]; then
+               # New encapsulation instructions for bareudp over IPv6
+               tc -netns "${NS1}" filter add dev veth10 ingress protocol ipv6             \
+                       flower dst_ip 2001:db8::103/128                                    \
+                       action tunnel_key set src_ip 2001:db8::21 dst_ip 2001:db8::22 id 0 \
+                       action mirred egress redirect dev bareudp_ns1
+               tc -netns "${NS2}" filter add dev veth23 ingress protocol ipv6             \
+                       flower dst_ip 2001:db8::100/128                                    \
+                       action tunnel_key set src_ip 2001:db8::22 dst_ip 2001:db8::21 id 0 \
+                       action mirred egress redirect dev bareudp_ns2
+       fi
+
+       # MPLS (unicast) over UDPv6
+       if [ $MPLS_UC ]; then
+               # New encapsulation instructions for bareudp over IPv6
+               tc -netns "${NS1}" filter add dev veth10 ingress protocol mpls_uc          \
+                       flower mpls_label 203                                              \
+                       action tunnel_key set src_ip 2001:db8::21 dst_ip 2001:db8::22 id 0 \
+                       action mirred egress redirect dev bareudp_ns1
+               tc -netns "${NS2}" filter add dev veth23 ingress protocol mpls_uc          \
+                       flower mpls_label 200                                              \
+                       action tunnel_key set src_ip 2001:db8::22 dst_ip 2001:db8::21 id 0 \
+                       action mirred egress redirect dev bareudp_ns2
+       fi
+
+       # Test IPv6 underlay
+       ping_test "UDPv6"
+
+       tc -netns "${NS1}" filter delete dev veth10 ingress
+       tc -netns "${NS2}" filter delete dev veth23 ingress
+       ip -netns "${NS1}" link delete bareudp_ns1
+       ip -netns "${NS2}" link delete bareudp_ns2
+}
+
+check_features()
+{
+       ip link help 2>&1 | grep -q bareudp
+       if [ $? -ne 0 ]; then
+               echo "Missing bareudp support in iproute2" >&2
+               exit_cleanup
+       fi
+
+       # Use ping6 on systems where ping doesn't handle IPv6
+       ping -w 1 -c 1 ::1 > /dev/null 2>&1 || PING6="ping6"
+}
+
+usage()
+{
+       echo "Usage: $0 [-p]"
+       exit 1
+}
+
+while getopts :p o
+do
+       case $o in
+               p) PAUSE_ON_FAIL="yes";;
+               *) usage;;
+       esac
+done
+
+check_features
+
+# Create namespaces before setting up the exit trap.
+# Otherwise, exit_cleanup_all() could delete namespaces that were not created
+# by this script.
+create_namespaces
+
+set -e
+trap exit_cleanup_all EXIT
+
+setup_underlay
+setup_overlay_ipv4
+setup_overlay_ipv6
+setup_overlay_mpls
+
+test_overlay ipv4 nomultiproto
+test_overlay ipv6 nomultiproto
+test_overlay ipv4 multiproto
+test_overlay mpls_uc nomultiproto
+
+if [ "${ERR}" -eq 1 ]; then
+       echo "Some tests failed." >&2
+else
+       ERR=0
+fi
index 4d5df8e..614d547 100644 (file)
@@ -34,3 +34,10 @@ CONFIG_TRACEPOINTS=y
 CONFIG_NET_DROP_MONITOR=m
 CONFIG_NETDEVSIM=m
 CONFIG_NET_FOU=m
+CONFIG_MPLS_ROUTING=m
+CONFIG_MPLS_IPTUNNEL=m
+CONFIG_NET_SCH_INGRESS=m
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_ACT_TUNNEL_KEY=m
+CONFIG_NET_ACT_MIRRED=m
+CONFIG_BAREUDP=m
index 88d2472..675eff4 100755 (executable)
@@ -1,11 +1,37 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
-ALL_TESTS="reportleave_test"
+ALL_TESTS="v2reportleave_test v3include_test v3inc_allow_test v3inc_is_include_test \
+          v3inc_is_exclude_test v3inc_to_exclude_test v3exc_allow_test v3exc_is_include_test \
+          v3exc_is_exclude_test v3exc_to_exclude_test v3inc_block_test v3exc_block_test \
+          v3exc_timeout_test v3star_ex_auto_add_test"
 NUM_NETIFS=4
 CHECK_TC="yes"
 TEST_GROUP="239.10.10.10"
 TEST_GROUP_MAC="01:00:5e:0a:0a:0a"
+
+ALL_GROUP="224.0.0.1"
+ALL_MAC="01:00:5e:00:00:01"
+
+# IGMPv3 is_in report: grp 239.10.10.10 is_include 192.0.2.1,192.0.2.2,192.0.2.3
+MZPKT_IS_INC="22:00:9d:de:00:00:00:01:01:00:00:03:ef:0a:0a:0a:c0:00:02:01:c0:00:02:02:c0:00:02:03"
+# IGMPv3 is_in report: grp 239.10.10.10 is_include 192.0.2.10,192.0.2.11,192.0.2.12
+MZPKT_IS_INC2="22:00:9d:c3:00:00:00:01:01:00:00:03:ef:0a:0a:0a:c0:00:02:0a:c0:00:02:0b:c0:00:02:0c"
+# IGMPv3 is_in report: grp 239.10.10.10 is_include 192.0.2.20,192.0.2.30
+MZPKT_IS_INC3="22:00:5f:b4:00:00:00:01:01:00:00:02:ef:0a:0a:0a:c0:00:02:14:c0:00:02:1e"
+# IGMPv3 allow report: grp 239.10.10.10 allow 192.0.2.10,192.0.2.11,192.0.2.12
+MZPKT_ALLOW="22:00:99:c3:00:00:00:01:05:00:00:03:ef:0a:0a:0a:c0:00:02:0a:c0:00:02:0b:c0:00:02:0c"
+# IGMPv3 allow report: grp 239.10.10.10 allow 192.0.2.20,192.0.2.30
+MZPKT_ALLOW2="22:00:5b:b4:00:00:00:01:05:00:00:02:ef:0a:0a:0a:c0:00:02:14:c0:00:02:1e"
+# IGMPv3 is_ex report: grp 239.10.10.10 is_exclude 192.0.2.1,192.0.2.2,192.0.2.20,192.0.2.21
+MZPKT_IS_EXC="22:00:da:b6:00:00:00:01:02:00:00:04:ef:0a:0a:0a:c0:00:02:01:c0:00:02:02:c0:00:02:14:c0:00:02:15"
+# IGMPv3 is_ex report: grp 239.10.10.10 is_exclude 192.0.2.20,192.0.2.30
+MZPKT_IS_EXC2="22:00:5e:b4:00:00:00:01:02:00:00:02:ef:0a:0a:0a:c0:00:02:14:c0:00:02:1e"
+# IGMPv3 to_ex report: grp 239.10.10.10 to_exclude 192.0.2.1,192.0.2.20,192.0.2.30
+MZPKT_TO_EXC="22:00:9a:b1:00:00:00:01:04:00:00:03:ef:0a:0a:0a:c0:00:02:01:c0:00:02:14:c0:00:02:1e"
+# IGMPv3 block report: grp 239.10.10.10 block 192.0.2.1,192.0.2.20,192.0.2.30
+MZPKT_BLOCK="22:00:98:b1:00:00:00:01:06:00:00:03:ef:0a:0a:0a:c0:00:02:01:c0:00:02:14:c0:00:02:1e"
+
 source lib.sh
 
 h1_create()
@@ -79,38 +105,7 @@ cleanup()
        vrf_cleanup
 }
 
-# return 0 if the packet wasn't seen on host2_if or 1 if it was
-mcast_packet_test()
-{
-       local mac=$1
-       local ip=$2
-       local host1_if=$3
-       local host2_if=$4
-       local seen=0
-
-       # Add an ACL on `host2_if` which will tell us whether the packet
-       # was received by it or not.
-       tc qdisc add dev $host2_if ingress
-       tc filter add dev $host2_if ingress protocol ip pref 1 handle 101 \
-               flower dst_mac $mac action drop
-
-       $MZ $host1_if -c 1 -p 64 -b $mac -B $ip -t udp "dp=4096,sp=2048" -q
-       sleep 1
-
-       tc -j -s filter show dev $host2_if ingress \
-               | jq -e ".[] | select(.options.handle == 101) \
-               | select(.options.actions[0].stats.packets == 1)" &> /dev/null
-       if [[ $? -eq 0 ]]; then
-               seen=1
-       fi
-
-       tc filter del dev $host2_if ingress protocol ip pref 1 handle 101 flower
-       tc qdisc del dev $host2_if ingress
-
-       return $seen
-}
-
-reportleave_test()
+v2reportleave_test()
 {
        RET=0
        ip address add dev $h2 $TEST_GROUP/32 autojoin
@@ -118,12 +113,12 @@ reportleave_test()
 
        sleep 5
        bridge mdb show dev br0 | grep $TEST_GROUP 1>/dev/null
-       check_err $? "Report didn't create mdb entry for $TEST_GROUP"
+       check_err $? "IGMPv2 report didn't create mdb entry for $TEST_GROUP"
 
-       mcast_packet_test $TEST_GROUP_MAC $TEST_GROUP $h1 $h2
+       mcast_packet_test $TEST_GROUP_MAC 192.0.2.1 $TEST_GROUP $h1 $h2
        check_fail $? "Traffic to $TEST_GROUP wasn't forwarded"
 
-       log_test "IGMP report $TEST_GROUP"
+       log_test "IGMPv2 report $TEST_GROUP"
 
        RET=0
        bridge mdb show dev br0 | grep $TEST_GROUP 1>/dev/null
@@ -136,10 +131,424 @@ reportleave_test()
        bridge mdb show dev br0 | grep $TEST_GROUP 1>/dev/null
        check_fail $? "Leave didn't delete mdb entry for $TEST_GROUP"
 
-       mcast_packet_test $TEST_GROUP_MAC $TEST_GROUP $h1 $h2
+       mcast_packet_test $TEST_GROUP_MAC 192.0.2.1 $TEST_GROUP $h1 $h2
        check_err $? "Traffic to $TEST_GROUP was forwarded without mdb entry"
 
-       log_test "IGMP leave $TEST_GROUP"
+       log_test "IGMPv2 leave $TEST_GROUP"
+}
+
+v3include_prepare()
+{
+       local host1_if=$1
+       local mac=$2
+       local group=$3
+       local X=("192.0.2.1" "192.0.2.2" "192.0.2.3")
+
+       ip link set dev br0 type bridge mcast_igmp_version 3
+       check_err $? "Could not change bridge IGMP version to 3"
+
+       $MZ $host1_if -b $mac -c 1 -B $group -t ip "proto=2,p=$MZPKT_IS_INC" -q
+       sleep 1
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and .source_list != null)" &>/dev/null
+       check_err $? "Missing *,G entry with source list"
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and .filter_mode == \"include\")" &>/dev/null
+       check_err $? "Wrong *,G entry filter mode"
+       brmcast_check_sg_entries "is_include" "${X[@]}"
+}
+
+v3exclude_prepare()
+{
+       local host1_if=$1
+       local mac=$2
+       local group=$3
+       local pkt=$4
+       local X=("192.0.2.1" "192.0.2.2")
+       local Y=("192.0.2.20" "192.0.2.21")
+
+       v3include_prepare $host1_if $mac $group
+
+       $MZ $host1_if -c 1 -b $mac -B $group -t ip "proto=2,p=$MZPKT_IS_EXC" -q
+       sleep 1
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and .filter_mode == \"exclude\")" &>/dev/null
+       check_err $? "Wrong *,G entry filter mode"
+
+       brmcast_check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and
+                               .source_list[].address == \"192.0.2.3\")" &>/dev/null
+       check_fail $? "Wrong *,G entry source list, 192.0.2.3 entry still exists"
+}
+
+v3cleanup()
+{
+       local port=$1
+       local group=$2
+
+       bridge mdb del dev br0 port $port grp $group
+       ip link set dev br0 type bridge mcast_igmp_version 2
+}
+
+v3include_test()
+{
+       RET=0
+       local X=("192.0.2.1" "192.0.2.2" "192.0.2.3")
+
+       v3include_prepare $h1 $ALL_MAC $ALL_GROUP
+
+       brmcast_check_sg_state 0 "${X[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}"
+       brmcast_check_sg_fwding 0 "192.0.2.100"
+
+       log_test "IGMPv3 report $TEST_GROUP is_include"
+
+       v3cleanup $swp1 $TEST_GROUP
+}
+
+v3inc_allow_test()
+{
+       RET=0
+       local X=("192.0.2.10" "192.0.2.11" "192.0.2.12")
+
+       v3include_prepare $h1 $ALL_MAC $ALL_GROUP
+
+       $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW" -q
+       sleep 1
+       brmcast_check_sg_entries "allow" "${X[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}"
+       brmcast_check_sg_fwding 0 "192.0.2.100"
+
+       log_test "IGMPv3 report $TEST_GROUP include -> allow"
+
+       v3cleanup $swp1 $TEST_GROUP
+}
+
+v3inc_is_include_test()
+{
+       RET=0
+       local X=("192.0.2.10" "192.0.2.11" "192.0.2.12")
+
+       v3include_prepare $h1 $ALL_MAC $ALL_GROUP
+
+       $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_IS_INC2" -q
+       sleep 1
+       brmcast_check_sg_entries "is_include" "${X[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}"
+       brmcast_check_sg_fwding 0 "192.0.2.100"
+
+       log_test "IGMPv3 report $TEST_GROUP include -> is_include"
+
+       v3cleanup $swp1 $TEST_GROUP
+}
+
+v3inc_is_exclude_test()
+{
+       RET=0
+
+       v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "IGMPv3 report $TEST_GROUP include -> is_exclude"
+
+       v3cleanup $swp1 $TEST_GROUP
+}
+
+v3inc_to_exclude_test()
+{
+       RET=0
+       local X=("192.0.2.1")
+       local Y=("192.0.2.20" "192.0.2.30")
+
+       v3include_prepare $h1 $ALL_MAC $ALL_GROUP
+
+       ip link set dev br0 type bridge mcast_last_member_interval 500
+       check_err $? "Could not change mcast_last_member_interval to 5s"
+
+       $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_TO_EXC" -q
+       sleep 1
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and .filter_mode == \"exclude\")" &>/dev/null
+       check_err $? "Wrong *,G entry filter mode"
+
+       brmcast_check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and
+                               .source_list[].address == \"192.0.2.2\")" &>/dev/null
+       check_fail $? "Wrong *,G entry source list, 192.0.2.2 entry still exists"
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and
+                               .source_list[].address == \"192.0.2.21\")" &>/dev/null
+       check_fail $? "Wrong *,G entry source list, 192.0.2.21 entry still exists"
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "IGMPv3 report $TEST_GROUP include -> to_exclude"
+
+       ip link set dev br0 type bridge mcast_last_member_interval 100
+
+       v3cleanup $swp1 $TEST_GROUP
+}
+
+v3exc_allow_test()
+{
+       RET=0
+       local X=("192.0.2.1" "192.0.2.2" "192.0.2.20" "192.0.2.30")
+       local Y=("192.0.2.21")
+
+       v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
+
+       $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW2" -q
+       sleep 1
+       brmcast_check_sg_entries "allow" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "IGMPv3 report $TEST_GROUP exclude -> allow"
+
+       v3cleanup $swp1 $TEST_GROUP
+}
+
+v3exc_is_include_test()
+{
+       RET=0
+       local X=("192.0.2.1" "192.0.2.2" "192.0.2.20" "192.0.2.30")
+       local Y=("192.0.2.21")
+
+       v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
+
+       $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_IS_INC3" -q
+       sleep 1
+       brmcast_check_sg_entries "is_include" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "IGMPv3 report $TEST_GROUP exclude -> is_include"
+
+       v3cleanup $swp1 $TEST_GROUP
+}
+
+v3exc_is_exclude_test()
+{
+       RET=0
+       local X=("192.0.2.30")
+       local Y=("192.0.2.20")
+
+       v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
+
+       $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_IS_EXC2" -q
+       sleep 1
+       brmcast_check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "IGMPv3 report $TEST_GROUP exclude -> is_exclude"
+
+       v3cleanup $swp1 $TEST_GROUP
+}
+
+v3exc_to_exclude_test()
+{
+       RET=0
+       local X=("192.0.2.1" "192.0.2.30")
+       local Y=("192.0.2.20")
+
+       v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
+
+       ip link set dev br0 type bridge mcast_last_member_interval 500
+       check_err $? "Could not change mcast_last_member_interval to 5s"
+
+       $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_TO_EXC" -q
+       sleep 1
+       brmcast_check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "IGMPv3 report $TEST_GROUP exclude -> to_exclude"
+
+       ip link set dev br0 type bridge mcast_last_member_interval 100
+
+       v3cleanup $swp1 $TEST_GROUP
+}
+
+v3inc_block_test()
+{
+       RET=0
+       local X=("192.0.2.2" "192.0.2.3")
+
+       v3include_prepare $h1 $ALL_MAC $ALL_GROUP
+
+       $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_BLOCK" -q
+       # make sure the lowered timers have expired (by default 2 seconds)
+       sleep 3
+       brmcast_check_sg_entries "block" "${X[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and
+                               .source_list[].address == \"192.0.2.1\")" &>/dev/null
+       check_fail $? "Wrong *,G entry source list, 192.0.2.1 entry still exists"
+
+       brmcast_check_sg_fwding 1 "${X[@]}"
+       brmcast_check_sg_fwding 0 "192.0.2.100"
+
+       log_test "IGMPv3 report $TEST_GROUP include -> block"
+
+       v3cleanup $swp1 $TEST_GROUP
+}
+
+v3exc_block_test()
+{
+       RET=0
+       local X=("192.0.2.1" "192.0.2.2" "192.0.2.30")
+       local Y=("192.0.2.20" "192.0.2.21")
+
+       v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
+
+       ip link set dev br0 type bridge mcast_last_member_interval 500
+       check_err $? "Could not change mcast_last_member_interval to 5s"
+
+       $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_BLOCK" -q
+       sleep 1
+       brmcast_check_sg_entries "block" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "IGMPv3 report $TEST_GROUP exclude -> block"
+
+       ip link set dev br0 type bridge mcast_last_member_interval 100
+
+       v3cleanup $swp1 $TEST_GROUP
+}
+
+v3exc_timeout_test()
+{
+       RET=0
+       local X=("192.0.2.20" "192.0.2.30")
+
+       # GMI should be 3 seconds
+       ip link set dev br0 type bridge mcast_query_interval 100 mcast_query_response_interval 100
+
+       v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
+       ip link set dev br0 type bridge mcast_query_interval 500 mcast_query_response_interval 500
+       $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW2" -q
+       sleep 3
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and .filter_mode == \"include\")" &>/dev/null
+       check_err $? "Wrong *,G entry filter mode"
+
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and
+                               .source_list[].address == \"192.0.2.1\")" &>/dev/null
+       check_fail $? "Wrong *,G entry source list, 192.0.2.1 entry still exists"
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and
+                               .source_list[].address == \"192.0.2.2\")" &>/dev/null
+       check_fail $? "Wrong *,G entry source list, 192.0.2.2 entry still exists"
+
+       brmcast_check_sg_entries "allow" "${X[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}"
+       brmcast_check_sg_fwding 0 192.0.2.100
+
+       log_test "IGMPv3 group $TEST_GROUP exclude timeout"
+
+       ip link set dev br0 type bridge mcast_query_interval 12500 \
+                                       mcast_query_response_interval 1000
+
+       v3cleanup $swp1 $TEST_GROUP
+}
+
+v3star_ex_auto_add_test()
+{
+       RET=0
+
+       v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
+
+       $MZ $h2 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_IS_INC" -q
+       sleep 1
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and .src == \"192.0.2.3\" and \
+                               .port == \"$swp1\")" &>/dev/null
+       check_err $? "S,G entry for *,G port doesn't exist"
+
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and .src == \"192.0.2.3\" and \
+                               .port == \"$swp1\" and \
+                               .flags[] == \"added_by_star_ex\")" &>/dev/null
+       check_err $? "Auto-added S,G entry doesn't have added_by_star_ex flag"
+
+       brmcast_check_sg_fwding 1 192.0.2.3
+
+       log_test "IGMPv3 S,G port entry automatic add to a *,G port"
+
+       v3cleanup $swp1 $TEST_GROUP
+       v3cleanup $swp2 $TEST_GROUP
 }
 
 trap cleanup EXIT
diff --git a/tools/testing/selftests/net/forwarding/bridge_mld.sh b/tools/testing/selftests/net/forwarding/bridge_mld.sh
new file mode 100755 (executable)
index 0000000..ffdcfa8
--- /dev/null
@@ -0,0 +1,558 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+ALL_TESTS="mldv2include_test mldv2inc_allow_test mldv2inc_is_include_test mldv2inc_is_exclude_test \
+          mldv2inc_to_exclude_test mldv2exc_allow_test mldv2exc_is_include_test \
+          mldv2exc_is_exclude_test mldv2exc_to_exclude_test mldv2inc_block_test \
+          mldv2exc_block_test mldv2exc_timeout_test mldv2star_ex_auto_add_test"
+NUM_NETIFS=4
+CHECK_TC="yes"
+TEST_GROUP="ff02::cc"
+TEST_GROUP_MAC="33:33:00:00:00:cc"
+
+# MLDv2 is_in report: grp ff02::cc is_include 2001:db8:1::1,2001:db8:1::2,2001:db8:1::3
+MZPKT_IS_INC="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:54:00:01:fe:80:00:\
+00:00:00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:\
+00:05:02:00:00:00:00:8f:00:8e:d9:00:00:00:01:01:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:\
+00:00:00:00:cc:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:01:20:01:0d:b8:00:01:00:00:00:\
+00:00:00:00:00:00:02:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:03"
+# MLDv2 is_in report: grp ff02::cc is_include 2001:db8:1::10,2001:db8:1::11,2001:db8:1::12
+MZPKT_IS_INC2="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:54:00:01:fe:80:00:\
+00:00:00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:\
+05:02:00:00:00:00:8f:00:8e:ac:00:00:00:01:01:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:00:00:\
+00:00:cc:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:10:20:01:0d:b8:00:01:00:00:00:00:00:00:\
+00:00:00:11:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:12"
+# MLDv2 is_in report: grp ff02::cc is_include 2001:db8:1::20,2001:db8:1::30
+MZPKT_IS_INC3="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:44:00:01:fe:80:00:00:00:\
+00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:05:02:00:\
+00:00:00:8f:00:bc:5a:00:00:00:01:01:00:00:02:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:\
+01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:30"
+# MLDv2 allow report: grp ff02::cc allow 2001:db8:1::10,2001:db8:1::11,2001:db8:1::12
+MZPKT_ALLOW="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:54:00:01:fe:80:00:00:\
+00:00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:05:\
+02:00:00:00:00:8f:00:8a:ac:00:00:00:01:05:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:\
+00:cc:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:10:20:01:0d:b8:00:01:00:00:00:00:00:00:00:\
+00:00:11:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:12"
+# MLDv2 allow report: grp ff02::cc allow 2001:db8:1::20,2001:db8:1::30
+MZPKT_ALLOW2="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:44:00:01:fe:80:00:00:00:\
+00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:05:02:00:\
+00:00:00:8f:00:b8:5a:00:00:00:01:05:00:00:02:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:\
+01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:30"
+# MLDv2 is_ex report: grp ff02::cc is_exclude 2001:db8:1::1,2001:db8:1::2,2001:db8:1::20,2001:db8:1::21
+MZPKT_IS_EXC="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:64:00:01:fe:80:00:00:00:\
+00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:05:02:00:\
+00:00:00:8f:00:5f:d0:00:00:00:01:02:00:00:04:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:\
+01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:01:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:02:20:\
+01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:21"
+# MLDv2 is_ex report: grp ff02::cc is_exclude 2001:db8:1::20,2001:db8:1::30
+MZPKT_IS_EXC2="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:44:00:01:fe:80:00:00:00:\
+00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:05:02:00:\
+00:00:00:8f:00:bb:5a:00:00:00:01:02:00:00:02:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:\
+01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:30"
+# MLDv2 to_ex report: grp ff02::cc to_exclude 2001:db8:1::1,2001:db8:1::20,2001:db8:1::30
+MZPKT_TO_EXC="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:54:00:01:fe:80:00:00:00:\
+00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:05:02:00:\
+00:00:00:8f:00:8b:8e:00:00:00:01:04:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:\
+01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:01:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:\
+01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:30"
+# MLDv2 block report: grp ff02::cc block 2001:db8:1::1,2001:db8:1::20,2001:db8:1::30
+MZPKT_BLOCK="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:54:00:01:fe:80:00:00:00:00:\
+00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:05:02:00:00:\
+00:00:8f:00:89:8e:00:00:00:01:06:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:01:\
+0d:b8:00:01:00:00:00:00:00:00:00:00:00:01:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:01:\
+0d:b8:00:01:00:00:00:00:00:00:00:00:00:30"
+
+source lib.sh
+
+h1_create()
+{
+       simple_if_init $h1 2001:db8:1::1/64
+}
+
+h1_destroy()
+{
+       simple_if_fini $h1 2001:db8:1::1/64
+}
+
+h2_create()
+{
+       simple_if_init $h2 2001:db8:1::2/64
+}
+
+h2_destroy()
+{
+       simple_if_fini $h2 2001:db8:1::2/64
+}
+
+switch_create()
+{
+       ip link add dev br0 type bridge mcast_snooping 1 mcast_query_response_interval 100 \
+                                       mcast_mld_version 2 mcast_startup_query_interval 300 \
+                                       mcast_querier 1
+
+       ip link set dev $swp1 master br0
+       ip link set dev $swp2 master br0
+
+       ip link set dev br0 up
+       ip link set dev $swp1 up
+       ip link set dev $swp2 up
+
+       # make sure a query has been generated
+       sleep 5
+}
+
+switch_destroy()
+{
+       ip link set dev $swp2 down
+       ip link set dev $swp1 down
+
+       ip link del dev br0
+}
+
+setup_prepare()
+{
+       h1=${NETIFS[p1]}
+       swp1=${NETIFS[p2]}
+
+       swp2=${NETIFS[p3]}
+       h2=${NETIFS[p4]}
+
+       vrf_prepare
+
+       h1_create
+       h2_create
+
+       switch_create
+}
+
+cleanup()
+{
+       pre_cleanup
+
+       switch_destroy
+
+       h2_destroy
+       h1_destroy
+
+       vrf_cleanup
+}
+
+mldv2include_prepare()
+{
+       local host1_if=$1
+       local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::3")
+
+       ip link set dev br0 type bridge mcast_mld_version 2
+       check_err $? "Could not change bridge MLD version to 2"
+
+       $MZ $host1_if $MZPKT_IS_INC -q
+       sleep 1
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and .source_list != null)" &>/dev/null
+       check_err $? "Missing *,G entry with source list"
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and .filter_mode == \"include\")" &>/dev/null
+       check_err $? "Wrong *,G entry filter mode"
+       brmcast_check_sg_entries "is_include" "${X[@]}"
+}
+
+mldv2exclude_prepare()
+{
+       local host1_if=$1
+       local mac=$2
+       local group=$3
+       local pkt=$4
+       local X=("2001:db8:1::1" "2001:db8:1::2")
+       local Y=("2001:db8:1::20" "2001:db8:1::21")
+
+       mldv2include_prepare $h1
+
+       $MZ $host1_if -c 1 $MZPKT_IS_EXC -q
+       sleep 1
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                        .source_list != null and .filter_mode == \"exclude\")" &>/dev/null
+       check_err $? "Wrong *,G entry filter mode"
+
+       brmcast_check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and
+                               .source_list[].address == \"2001:db8:1::3\")" &>/dev/null
+       check_fail $? "Wrong *,G entry source list, 2001:db8:1::3 entry still exists"
+}
+
+mldv2cleanup()
+{
+       local port=$1
+
+       bridge mdb del dev br0 port $port grp $TEST_GROUP
+       ip link set dev br0 type bridge mcast_mld_version 1
+}
+
+mldv2include_test()
+{
+       RET=0
+       local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::3")
+
+       mldv2include_prepare $h1
+
+       brmcast_check_sg_state 0 "${X[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}"
+       brmcast_check_sg_fwding 0 "2001:db8:1::100"
+
+       log_test "MLDv2 report $TEST_GROUP is_include"
+
+       mldv2cleanup $swp1
+}
+
+mldv2inc_allow_test()
+{
+       RET=0
+       local X=("2001:db8:1::10" "2001:db8:1::11" "2001:db8:1::12")
+
+       mldv2include_prepare $h1
+
+       $MZ $h1 -c 1 $MZPKT_ALLOW -q
+       sleep 1
+       brmcast_check_sg_entries "allow" "${X[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}"
+       brmcast_check_sg_fwding 0 "2001:db8:1::100"
+
+       log_test "MLDv2 report $TEST_GROUP include -> allow"
+
+       mldv2cleanup $swp1
+}
+
+mldv2inc_is_include_test()
+{
+       RET=0
+       local X=("2001:db8:1::10" "2001:db8:1::11" "2001:db8:1::12")
+
+       mldv2include_prepare $h1
+
+       $MZ $h1 -c 1 $MZPKT_IS_INC2 -q
+       sleep 1
+       brmcast_check_sg_entries "is_include" "${X[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}"
+       brmcast_check_sg_fwding 0 "2001:db8:1::100"
+
+       log_test "MLDv2 report $TEST_GROUP include -> is_include"
+
+       mldv2cleanup $swp1
+}
+
+mldv2inc_is_exclude_test()
+{
+       RET=0
+
+       mldv2exclude_prepare $h1
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "MLDv2 report $TEST_GROUP include -> is_exclude"
+
+       mldv2cleanup $swp1
+}
+
+mldv2inc_to_exclude_test()
+{
+       RET=0
+       local X=("2001:db8:1::1")
+       local Y=("2001:db8:1::20" "2001:db8:1::30")
+
+       mldv2include_prepare $h1
+
+       ip link set dev br0 type bridge mcast_last_member_interval 500
+       check_err $? "Could not change mcast_last_member_interval to 5s"
+
+       $MZ $h1 -c 1 $MZPKT_TO_EXC -q
+       sleep 1
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and .filter_mode == \"exclude\")" &>/dev/null
+       check_err $? "Wrong *,G entry filter mode"
+
+       brmcast_check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and
+                               .source_list[].address == \"2001:db8:1::2\")" &>/dev/null
+       check_fail $? "Wrong *,G entry source list, 2001:db8:1::2 entry still exists"
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and
+                               .source_list[].address == \"2001:db8:1::21\")" &>/dev/null
+       check_fail $? "Wrong *,G entry source list, 2001:db8:1::21 entry still exists"
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "MLDv2 report $TEST_GROUP include -> to_exclude"
+
+       ip link set dev br0 type bridge mcast_last_member_interval 100
+
+       mldv2cleanup $swp1
+}
+
+mldv2exc_allow_test()
+{
+       RET=0
+       local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::20" "2001:db8:1::30")
+       local Y=("2001:db8:1::21")
+
+       mldv2exclude_prepare $h1
+
+       $MZ $h1 -c 1 $MZPKT_ALLOW2 -q
+       sleep 1
+       brmcast_check_sg_entries "allow" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "MLDv2 report $TEST_GROUP exclude -> allow"
+
+       mldv2cleanup $swp1
+}
+
+mldv2exc_is_include_test()
+{
+       RET=0
+       local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::20" "2001:db8:1::30")
+       local Y=("2001:db8:1::21")
+
+       mldv2exclude_prepare $h1
+
+       $MZ $h1 -c 1 $MZPKT_IS_INC3 -q
+       sleep 1
+       brmcast_check_sg_entries "is_include" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "MLDv2 report $TEST_GROUP exclude -> is_include"
+
+       mldv2cleanup $swp1
+}
+
+mldv2exc_is_exclude_test()
+{
+       RET=0
+       local X=("2001:db8:1::30")
+       local Y=("2001:db8:1::20")
+
+       mldv2exclude_prepare $h1
+
+       $MZ $h1 -c 1 $MZPKT_IS_EXC2 -q
+       sleep 1
+       brmcast_check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "MLDv2 report $TEST_GROUP exclude -> is_exclude"
+
+       mldv2cleanup $swp1
+}
+
+mldv2exc_to_exclude_test()
+{
+       RET=0
+       local X=("2001:db8:1::1" "2001:db8:1::30")
+       local Y=("2001:db8:1::20")
+
+       mldv2exclude_prepare $h1
+
+       ip link set dev br0 type bridge mcast_last_member_interval 500
+       check_err $? "Could not change mcast_last_member_interval to 5s"
+
+       $MZ $h1 -c 1 $MZPKT_TO_EXC -q
+       sleep 1
+       brmcast_check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "MLDv2 report $TEST_GROUP exclude -> to_exclude"
+
+       ip link set dev br0 type bridge mcast_last_member_interval 100
+
+       mldv2cleanup $swp1
+}
+
+mldv2inc_block_test()
+{
+       RET=0
+       local X=("2001:db8:1::2" "2001:db8:1::3")
+
+       mldv2include_prepare $h1
+
+       $MZ $h1 -c 1 $MZPKT_BLOCK -q
+       # make sure the lowered timers have expired (by default 2 seconds)
+       sleep 3
+       brmcast_check_sg_entries "block" "${X[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and
+                               .source_list[].address == \"2001:db8:1::1\")" &>/dev/null
+       check_fail $? "Wrong *,G entry source list, 2001:db8:1::1 entry still exists"
+
+       brmcast_check_sg_fwding 1 "${X[@]}"
+       brmcast_check_sg_fwding 0 2001:db8:1::100
+
+       log_test "MLDv2 report $TEST_GROUP include -> block"
+
+       mldv2cleanup $swp1
+}
+
+mldv2exc_block_test()
+{
+       RET=0
+       local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::30")
+       local Y=("2001:db8:1::20" "2001:db8:1::21")
+
+       mldv2exclude_prepare $h1
+
+       ip link set dev br0 type bridge mcast_last_member_interval 500
+       check_err $? "Could not change mcast_last_member_interval to 5s"
+
+       $MZ $h1 -c 1 $MZPKT_BLOCK -q
+       sleep 1
+       brmcast_check_sg_entries "block" "${X[@]}" "${Y[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+       brmcast_check_sg_state 1 "${Y[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
+       brmcast_check_sg_fwding 0 "${Y[@]}"
+
+       log_test "MLDv2 report $TEST_GROUP exclude -> block"
+
+       ip link set dev br0 type bridge mcast_last_member_interval 100
+
+       mldv2cleanup $swp1
+}
+
+mldv2exc_timeout_test()
+{
+       RET=0
+       local X=("2001:db8:1::20" "2001:db8:1::30")
+
+       # GMI should be 3 seconds
+       ip link set dev br0 type bridge mcast_query_interval 100 mcast_query_response_interval 100
+
+       mldv2exclude_prepare $h1
+       ip link set dev br0 type bridge mcast_query_interval 500 mcast_query_response_interval 500
+       $MZ $h1 -c 1 $MZPKT_ALLOW2 -q
+       sleep 3
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and .filter_mode == \"include\")" &>/dev/null
+       check_err $? "Wrong *,G entry filter mode"
+
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and
+                               .source_list[].address == \"2001:db8:1::1\")" &>/dev/null
+       check_fail $? "Wrong *,G entry source list, 2001:db8:1::1 entry still exists"
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and \
+                               .source_list != null and
+                               .source_list[].address == \"2001:db8:1::2\")" &>/dev/null
+       check_fail $? "Wrong *,G entry source list, 2001:db8:1::2 entry still exists"
+
+       brmcast_check_sg_entries "allow" "${X[@]}"
+
+       brmcast_check_sg_state 0 "${X[@]}"
+
+       brmcast_check_sg_fwding 1 "${X[@]}"
+       brmcast_check_sg_fwding 0 2001:db8:1::100
+
+       log_test "MLDv2 group $TEST_GROUP exclude timeout"
+
+       ip link set dev br0 type bridge mcast_query_interval 12500 \
+                                       mcast_query_response_interval 1000
+
+       mldv2cleanup $swp1
+}
+
+mldv2star_ex_auto_add_test()
+{
+       RET=0
+
+       mldv2exclude_prepare $h1
+
+       $MZ $h2 -c 1 $MZPKT_IS_INC -q
+       sleep 1
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and .src == \"2001:db8:1::3\" and \
+                               .port == \"$swp1\")" &>/dev/null
+       check_err $? "S,G entry for *,G port doesn't exist"
+
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and .src == \"2001:db8:1::3\" and \
+                               .port == \"$swp1\" and \
+                               .flags[] == \"added_by_star_ex\")" &>/dev/null
+       check_err $? "Auto-added S,G entry doesn't have added_by_star_ex flag"
+
+       brmcast_check_sg_fwding 1 2001:db8:1::3
+
+       log_test "MLDv2 S,G port entry automatic add to a *,G port"
+
+       mldv2cleanup $swp1
+       mldv2cleanup $swp2
+}
+
+trap cleanup EXIT
+
+setup_prepare
+setup_wait
+
+tests_run
+
+exit $EXIT_STATUS
index 927f9ba..98ea37d 100644 (file)
@@ -1270,3 +1270,110 @@ tcpdump_show()
 {
        tcpdump -e -n -r $capfile 2>&1
 }
+
+# return 0 if the packet wasn't seen on host2_if or 1 if it was
+mcast_packet_test()
+{
+       local mac=$1
+       local src_ip=$2
+       local ip=$3
+       local host1_if=$4
+       local host2_if=$5
+       local seen=0
+       local tc_proto="ip"
+       local mz_v6arg=""
+
+       # basic check to see if we were passed an IPv4 address, if not assume IPv6
+       if [[ ! $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
+               tc_proto="ipv6"
+               mz_v6arg="-6"
+       fi
+
+       # Add an ACL on `host2_if` which will tell us whether the packet
+       # was received by it or not.
+       tc qdisc add dev $host2_if ingress
+       tc filter add dev $host2_if ingress protocol $tc_proto pref 1 handle 101 \
+               flower ip_proto udp dst_mac $mac action drop
+
+       $MZ $host1_if $mz_v6arg -c 1 -p 64 -b $mac -A $src_ip -B $ip -t udp "dp=4096,sp=2048" -q
+       sleep 1
+
+       tc -j -s filter show dev $host2_if ingress \
+               | jq -e ".[] | select(.options.handle == 101) \
+               | select(.options.actions[0].stats.packets == 1)" &> /dev/null
+       if [[ $? -eq 0 ]]; then
+               seen=1
+       fi
+
+       tc filter del dev $host2_if ingress protocol $tc_proto pref 1 handle 101 flower
+       tc qdisc del dev $host2_if ingress
+
+       return $seen
+}
+
+brmcast_check_sg_entries()
+{
+       local report=$1; shift
+       local slist=("$@")
+       local sarg=""
+
+       for src in "${slist[@]}"; do
+               sarg="${sarg} and .source_list[].address == \"$src\""
+       done
+       bridge -j -d -s mdb show dev br0 \
+               | jq -e ".[].mdb[] | \
+                        select(.grp == \"$TEST_GROUP\" and .source_list != null $sarg)" &>/dev/null
+       check_err $? "Wrong *,G entry source list after $report report"
+
+       for sgent in "${slist[@]}"; do
+               bridge -j -d -s mdb show dev br0 \
+                       | jq -e ".[].mdb[] | \
+                                select(.grp == \"$TEST_GROUP\" and .src == \"$sgent\")" &>/dev/null
+               check_err $? "Missing S,G entry ($sgent, $TEST_GROUP)"
+       done
+}
+
+brmcast_check_sg_fwding()
+{
+       local should_fwd=$1; shift
+       local sources=("$@")
+
+       for src in "${sources[@]}"; do
+               local retval=0
+
+               mcast_packet_test $TEST_GROUP_MAC $src $TEST_GROUP $h2 $h1
+               retval=$?
+               if [ $should_fwd -eq 1 ]; then
+                       check_fail $retval "Didn't forward traffic from S,G ($src, $TEST_GROUP)"
+               else
+                       check_err $retval "Forwarded traffic for blocked S,G ($src, $TEST_GROUP)"
+               fi
+       done
+}
+
+brmcast_check_sg_state()
+{
+       local is_blocked=$1; shift
+       local sources=("$@")
+       local should_fail=1
+
+       if [ $is_blocked -eq 1 ]; then
+               should_fail=0
+       fi
+
+       for src in "${sources[@]}"; do
+               bridge -j -d -s mdb show dev br0 \
+                       | jq -e ".[].mdb[] | \
+                                select(.grp == \"$TEST_GROUP\" and .source_list != null) |
+                                .source_list[] |
+                                select(.address == \"$src\") |
+                                select(.timer == \"0.00\")" &>/dev/null
+               check_err_fail $should_fail $? "Entry $src has zero timer"
+
+               bridge -j -d -s mdb show dev br0 \
+                       | jq -e ".[].mdb[] | \
+                                select(.grp == \"$TEST_GROUP\" and .src == \"$src\" and \
+                                .flags[] == \"blocked\")" &>/dev/null
+               check_err_fail $should_fail $? "Entry $src has blocked flag"
+       done
+}
index 741a1c4..0faaccd 100644 (file)
@@ -5,3 +5,13 @@ CONFIG_INET_DIAG=m
 CONFIG_INET_MPTCP_DIAG=m
 CONFIG_VETH=y
 CONFIG_NET_SCH_NETEM=m
+CONFIG_NETFILTER=y
+CONFIG_NETFILTER_ADVANCED=y
+CONFIG_NETFILTER_NETLINK=m
+CONFIG_NF_TABLES=m
+CONFIG_NFT_COUNTER=m
+CONFIG_NFT_COMPAT=m
+CONFIG_NETFILTER_XTABLES=m
+CONFIG_NETFILTER_XT_MATCH_BPF=m
+CONFIG_NF_TABLES_IPV4=y
+CONFIG_NF_TABLES_IPV6=y
index 08f53d8..0d93b24 100755 (executable)
@@ -13,6 +13,24 @@ capture=0
 
 TEST_COUNT=0
 
+# generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) ||
+#                                (ip6 && (ip6[74] & 0xf0) == 0x30)'"
+CBPF_MPTCP_SUBOPTION_ADD_ADDR="14,
+                              48 0 0 0,
+                              84 0 0 240,
+                              21 0 3 64,
+                              48 0 0 54,
+                              84 0 0 240,
+                              21 6 7 48,
+                              48 0 0 0,
+                              84 0 0 240,
+                              21 0 4 96,
+                              48 0 0 74,
+                              84 0 0 240,
+                              21 0 1 48,
+                              6 0 0 65535,
+                              6 0 0 0"
+
 init()
 {
        capout=$(mktemp)
@@ -82,6 +100,26 @@ reset_with_cookies()
        done
 }
 
+reset_with_add_addr_timeout()
+{
+       local ip="${1:-4}"
+       local tables
+
+       tables="iptables"
+       if [ $ip -eq 6 ]; then
+               tables="ip6tables"
+       fi
+
+       reset
+
+       ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
+       ip netns exec $ns2 $tables -A OUTPUT -p tcp \
+               -m tcp --tcp-option 30 \
+               -m bpf --bytecode \
+               "$CBPF_MPTCP_SUBOPTION_ADD_ADDR" \
+               -j DROP
+}
+
 for arg in "$@"; do
        if [ "$arg" = "-c" ]; then
                capture=1
@@ -94,6 +132,17 @@ if [ $? -ne 0 ];then
        exit $ksft_skip
 fi
 
+iptables -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+       echo "SKIP: Could not run all tests without iptables tool"
+       exit $ksft_skip
+fi
+
+ip6tables -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+       echo "SKIP: Could not run all tests without ip6tables tool"
+       exit $ksft_skip
+fi
 
 check_transfer()
 {
@@ -135,6 +184,7 @@ do_transfer()
        connect_addr="$5"
        rm_nr_ns1="$6"
        rm_nr_ns2="$7"
+       speed="$8"
 
        port=$((10000+$TEST_COUNT))
        TEST_COUNT=$((TEST_COUNT+1))
@@ -159,7 +209,7 @@ do_transfer()
                sleep 1
        fi
 
-       if [[ $rm_nr_ns1 -eq 0 && $rm_nr_ns2 -eq 0 ]]; then
+       if [ $speed = "fast" ]; then
                mptcp_connect="./mptcp_connect -j"
        else
                mptcp_connect="./mptcp_connect -r"
@@ -250,26 +300,13 @@ run_tests()
        listener_ns="$1"
        connector_ns="$2"
        connect_addr="$3"
+       rm_nr_ns1="${4:-0}"
+       rm_nr_ns2="${5:-0}"
+       speed="${6:-fast}"
        lret=0
 
-       do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} 0 0
-       lret=$?
-       if [ $lret -ne 0 ]; then
-               ret=$lret
-               return
-       fi
-}
-
-run_remove_tests()
-{
-       listener_ns="$1"
-       connector_ns="$2"
-       connect_addr="$3"
-       rm_nr_ns1="$4"
-       rm_nr_ns2="$5"
-       lret=0
-
-       do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} ${rm_nr_ns1} ${rm_nr_ns2}
+       do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \
+               ${rm_nr_ns1} ${rm_nr_ns2} ${speed}
        lret=$?
        if [ $lret -ne 0 ]; then
                ret=$lret
@@ -491,12 +528,21 @@ run_tests $ns1 $ns2 10.0.1.1
 chk_join_nr "multiple subflows and signal" 3 3 3
 chk_add_nr 1 1
 
+# add_addr timeout
+reset_with_add_addr_timeout
+ip netns exec $ns1 ./pm_nl_ctl limits 0 1
+ip netns exec $ns2 ./pm_nl_ctl limits 1 1
+ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
+run_tests $ns1 $ns2 10.0.1.1 0 0 slow
+chk_join_nr "signal address, ADD_ADDR timeout" 1 1 1
+chk_add_nr 4 0
+
 # single subflow, remove
 reset
 ip netns exec $ns1 ./pm_nl_ctl limits 0 1
 ip netns exec $ns2 ./pm_nl_ctl limits 0 1
 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
-run_remove_tests $ns1 $ns2 10.0.1.1 0 1
+run_tests $ns1 $ns2 10.0.1.1 0 1 slow
 chk_join_nr "remove single subflow" 1 1 1
 chk_rm_nr 1 1
 
@@ -506,7 +552,7 @@ ip netns exec $ns1 ./pm_nl_ctl limits 0 2
 ip netns exec $ns2 ./pm_nl_ctl limits 0 2
 ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow
 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
-run_remove_tests $ns1 $ns2 10.0.1.1 0 2
+run_tests $ns1 $ns2 10.0.1.1 0 2 slow
 chk_join_nr "remove multiple subflows" 2 2 2
 chk_rm_nr 2 2
 
@@ -515,7 +561,7 @@ reset
 ip netns exec $ns1 ./pm_nl_ctl limits 0 1
 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
 ip netns exec $ns2 ./pm_nl_ctl limits 1 1
-run_remove_tests $ns1 $ns2 10.0.1.1 1 0
+run_tests $ns1 $ns2 10.0.1.1 1 0 slow
 chk_join_nr "remove single address" 1 1 1
 chk_add_nr 1 1
 chk_rm_nr 0 0
@@ -526,7 +572,7 @@ ip netns exec $ns1 ./pm_nl_ctl limits 0 2
 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
 ip netns exec $ns2 ./pm_nl_ctl limits 1 2
 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
-run_remove_tests $ns1 $ns2 10.0.1.1 1 1
+run_tests $ns1 $ns2 10.0.1.1 1 1 slow
 chk_join_nr "remove subflow and signal" 2 2 2
 chk_add_nr 1 1
 chk_rm_nr 1 1
@@ -538,7 +584,7 @@ ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
 ip netns exec $ns2 ./pm_nl_ctl limits 1 3
 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
 ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow
-run_remove_tests $ns1 $ns2 10.0.1.1 1 2
+run_tests $ns1 $ns2 10.0.1.1 1 2 slow
 chk_join_nr "remove subflows and signal" 3 3 3
 chk_add_nr 1 1
 chk_rm_nr 2 2
index 6bbf69a..464e31e 100755 (executable)
@@ -355,7 +355,7 @@ setup_fou_or_gue() {
        encap="${3}"
 
        if [ "${outer}" = "4" ]; then
-               modprobe fou || return 2
+               modprobe fou || return $ksft_skip
                a_addr="${prefix4}.${a_r1}.1"
                b_addr="${prefix4}.${b_r1}.1"
                if [ "${inner}" = "4" ]; then
@@ -366,7 +366,7 @@ setup_fou_or_gue() {
                        ipproto="41"
                fi
        else
-               modprobe fou6 || return 2
+               modprobe fou6 || return $ksft_skip
                a_addr="${prefix6}:${a_r1}::1"
                b_addr="${prefix6}:${b_r1}::1"
                if [ "${inner}" = "4" ]; then
@@ -380,8 +380,8 @@ setup_fou_or_gue() {
                fi
        fi
 
-       run_cmd ${ns_a} ip fou add port 5555 ipproto ${ipproto} || return 2
-       run_cmd ${ns_a} ip link add ${encap}_a type ${type} ${mode} local ${a_addr} remote ${b_addr} encap ${encap} encap-sport auto encap-dport 5556 || return 2
+       run_cmd ${ns_a} ip fou add port 5555 ipproto ${ipproto} || return $ksft_skip
+       run_cmd ${ns_a} ip link add ${encap}_a type ${type} ${mode} local ${a_addr} remote ${b_addr} encap ${encap} encap-sport auto encap-dport 5556 || return $ksft_skip
 
        run_cmd ${ns_b} ip fou add port 5556 ipproto ${ipproto}
        run_cmd ${ns_b} ip link add ${encap}_b type ${type} ${mode} local ${b_addr} remote ${a_addr} encap ${encap} encap-sport auto encap-dport 5555
@@ -455,7 +455,7 @@ setup_ipvX_over_ipvY() {
                fi
        fi
 
-       run_cmd ${ns_a} ip link add ip_a type ${type} local ${a_addr} remote ${b_addr} mode ${mode} || return 2
+       run_cmd ${ns_a} ip link add ip_a type ${type} local ${a_addr} remote ${b_addr} mode ${mode} || return $ksft_skip
        run_cmd ${ns_b} ip link add ip_b type ${type} local ${b_addr} remote ${a_addr} mode ${mode}
 
        run_cmd ${ns_a} ip link set ip_a up
@@ -713,7 +713,7 @@ setup_routing() {
 }
 
 setup_bridge() {
-       run_cmd ${ns_a} ip link add br0 type bridge || return 2
+       run_cmd ${ns_a} ip link add br0 type bridge || return $ksft_skip
        run_cmd ${ns_a} ip link set br0 up
 
        run_cmd ${ns_c} ip link add veth_C-A type veth peer name veth_A-C
@@ -765,7 +765,7 @@ setup_ovs_vxlan6() {
 }
 
 setup_ovs_bridge() {
-       run_cmd ovs-vsctl add-br ovs_br0 || return 2
+       run_cmd ovs-vsctl add-br ovs_br0 || return $ksft_skip
        run_cmd ip link set ovs_br0 up
 
        run_cmd ${ns_c} ip link add veth_C-A type veth peer name veth_A-C
@@ -887,7 +887,7 @@ check_pmtu_value() {
 test_pmtu_ipvX() {
        family=${1}
 
-       setup namespaces routing || return 2
+       setup namespaces routing || return $ksft_skip
        trace "${ns_a}"  veth_A-R1    "${ns_r1}" veth_R1-A \
              "${ns_r1}" veth_R1-B    "${ns_b}"  veth_B-R1 \
              "${ns_a}"  veth_A-R2    "${ns_r2}" veth_R2-A \
@@ -985,11 +985,11 @@ test_pmtu_ipvX_over_vxlanY_or_geneveY_exception() {
        ll_mtu=4000
 
        if [ ${outer_family} -eq 4 ]; then
-               setup namespaces routing ${type}4 || return 2
+               setup namespaces routing ${type}4 || return $ksft_skip
                #                      IPv4 header   UDP header   VXLAN/GENEVE header   Ethernet header
                exp_mtu=$((${ll_mtu} - 20          - 8          - 8                   - 14))
        else
-               setup namespaces routing ${type}6 || return 2
+               setup namespaces routing ${type}6 || return $ksft_skip
                #                      IPv6 header   UDP header   VXLAN/GENEVE header   Ethernet header
                exp_mtu=$((${ll_mtu} - 40          - 8          - 8                   - 14))
        fi
@@ -1060,11 +1060,11 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() {
        ll_mtu=4000
 
        if [ ${outer_family} -eq 4 ]; then
-               setup namespaces routing bridge bridged_${type}4 || return 2
+               setup namespaces routing bridge bridged_${type}4 || return $ksft_skip
                #                      IPv4 header   UDP header   VXLAN/GENEVE header   Ethernet header
                exp_mtu=$((${ll_mtu} - 20          - 8          - 8                   - 14))
        else
-               setup namespaces routing bridge bridged_${type}6 || return 2
+               setup namespaces routing bridge bridged_${type}6 || return $ksft_skip
                #                      IPv6 header   UDP header   VXLAN/GENEVE header   Ethernet header
                exp_mtu=$((${ll_mtu} - 40          - 8          - 8                   - 14))
        fi
@@ -1144,11 +1144,11 @@ test_pmtu_ipvX_over_ovs_vxlanY_or_geneveY_exception() {
        ll_mtu=4000
 
        if [ ${outer_family} -eq 4 ]; then
-               setup namespaces routing ovs_bridge ovs_${type}4 || return 2
+               setup namespaces routing ovs_bridge ovs_${type}4 || return $ksft_skip
                #                      IPv4 header   UDP header   VXLAN/GENEVE header   Ethernet header
                exp_mtu=$((${ll_mtu} - 20          - 8          - 8                   - 14))
        else
-               setup namespaces routing ovs_bridge ovs_${type}6 || return 2
+               setup namespaces routing ovs_bridge ovs_${type}6 || return $ksft_skip
                #                      IPv6 header   UDP header   VXLAN/GENEVE header   Ethernet header
                exp_mtu=$((${ll_mtu} - 40          - 8          - 8                   - 14))
        fi
@@ -1230,7 +1230,7 @@ test_pmtu_ipvX_over_fouY_or_gueY() {
        encap=${3}
        ll_mtu=4000
 
-       setup namespaces routing ${encap}${outer_family}${inner_family} || return 2
+       setup namespaces routing ${encap}${outer_family}${inner_family} || return $ksft_skip
        trace "${ns_a}" ${encap}_a   "${ns_b}"  ${encap}_b \
              "${ns_a}" veth_A-R1    "${ns_r1}" veth_R1-A \
              "${ns_b}" veth_B-R1    "${ns_r1}" veth_R1-B
@@ -1309,7 +1309,7 @@ test_pmtu_ipvX_over_ipvY_exception() {
        outer=${2}
        ll_mtu=4000
 
-       setup namespaces routing ip${inner}ip${outer} || return 2
+       setup namespaces routing ip${inner}ip${outer} || return $ksft_skip
 
        trace "${ns_a}" ip_a         "${ns_b}"  ip_b  \
              "${ns_a}" veth_A-R1    "${ns_r1}" veth_R1-A \
@@ -1363,7 +1363,7 @@ test_pmtu_ipv6_ipv6_exception() {
 }
 
 test_pmtu_vti4_exception() {
-       setup namespaces veth vti4 xfrm4 || return 2
+       setup namespaces veth vti4 xfrm4 || return $ksft_skip
        trace "${ns_a}" veth_a    "${ns_b}" veth_b \
              "${ns_a}" vti4_a    "${ns_b}" vti4_b
 
@@ -1393,7 +1393,7 @@ test_pmtu_vti4_exception() {
 }
 
 test_pmtu_vti6_exception() {
-       setup namespaces veth vti6 xfrm6 || return 2
+       setup namespaces veth vti6 xfrm6 || return $ksft_skip
        trace "${ns_a}" veth_a    "${ns_b}" veth_b \
              "${ns_a}" vti6_a    "${ns_b}" vti6_b
        fail=0
@@ -1423,7 +1423,7 @@ test_pmtu_vti6_exception() {
 }
 
 test_pmtu_vti4_default_mtu() {
-       setup namespaces veth vti4 || return 2
+       setup namespaces veth vti4 || return $ksft_skip
 
        # Check that MTU of vti device is MTU of veth minus IPv4 header length
        veth_mtu="$(link_get_mtu "${ns_a}" veth_a)"
@@ -1435,7 +1435,7 @@ test_pmtu_vti4_default_mtu() {
 }
 
 test_pmtu_vti6_default_mtu() {
-       setup namespaces veth vti6 || return 2
+       setup namespaces veth vti6 || return $ksft_skip
 
        # Check that MTU of vti device is MTU of veth minus IPv6 header length
        veth_mtu="$(link_get_mtu "${ns_a}" veth_a)"
@@ -1447,10 +1447,10 @@ test_pmtu_vti6_default_mtu() {
 }
 
 test_pmtu_vti4_link_add_mtu() {
-       setup namespaces || return 2
+       setup namespaces || return $ksft_skip
 
        run_cmd ${ns_a} ip link add vti4_a type vti local ${veth4_a_addr} remote ${veth4_b_addr} key 10
-       [ $? -ne 0 ] && err "  vti not supported" && return 2
+       [ $? -ne 0 ] && err "  vti not supported" && return $ksft_skip
        run_cmd ${ns_a} ip link del vti4_a
 
        fail=0
@@ -1485,10 +1485,10 @@ test_pmtu_vti4_link_add_mtu() {
 }
 
 test_pmtu_vti6_link_add_mtu() {
-       setup namespaces || return 2
+       setup namespaces || return $ksft_skip
 
        run_cmd ${ns_a} ip link add vti6_a type vti6 local ${veth6_a_addr} remote ${veth6_b_addr} key 10
-       [ $? -ne 0 ] && err "  vti6 not supported" && return 2
+       [ $? -ne 0 ] && err "  vti6 not supported" && return $ksft_skip
        run_cmd ${ns_a} ip link del vti6_a
 
        fail=0
@@ -1523,10 +1523,10 @@ test_pmtu_vti6_link_add_mtu() {
 }
 
 test_pmtu_vti6_link_change_mtu() {
-       setup namespaces || return 2
+       setup namespaces || return $ksft_skip
 
        run_cmd ${ns_a} ip link add dummy0 mtu 1500 type dummy
-       [ $? -ne 0 ] && err "  dummy not supported" && return 2
+       [ $? -ne 0 ] && err "  dummy not supported" && return $ksft_skip
        run_cmd ${ns_a} ip link add dummy1 mtu 3000 type dummy
        run_cmd ${ns_a} ip link set dummy0 up
        run_cmd ${ns_a} ip link set dummy1 up
@@ -1579,10 +1579,10 @@ test_cleanup_vxlanX_exception() {
        encap="vxlan"
        ll_mtu=4000
 
-       check_command taskset || return 2
+       check_command taskset || return $ksft_skip
        cpu_list=$(grep -m 2 processor /proc/cpuinfo | cut -d ' ' -f 2)
 
-       setup namespaces routing ${encap}${outer} || return 2
+       setup namespaces routing ${encap}${outer} || return $ksft_skip
        trace "${ns_a}" ${encap}_a   "${ns_b}"  ${encap}_b \
              "${ns_a}" veth_A-R1    "${ns_r1}" veth_R1-A \
              "${ns_b}" veth_B-R1    "${ns_r1}" veth_R1-B
@@ -1644,7 +1644,7 @@ run_test() {
                fi
                err_flush
                exit 1
-       elif [ $ret -eq 2 ]; then
+       elif [ $ret -eq $ksft_skip ]; then
                printf "TEST: %-60s  [SKIP]\n" "${tdesc}"
                err_flush
        fi
@@ -1652,7 +1652,19 @@ run_test() {
        return $ret
        )
        ret=$?
-       [ $ret -ne 0 ] && exitcode=1
+       case $ret in
+               0)
+                       all_skipped=false
+                       [ $exitcode=$ksft_skip ] && exitcode=0
+               ;;
+               $ksft_skip)
+                       [ $all_skipped = true ] && exitcode=$ksft_skip
+               ;;
+               *)
+                       all_skipped=false
+                       exitcode=1
+               ;;
+       esac
 
        return $ret
 }
@@ -1667,7 +1679,7 @@ run_test_nh() {
 }
 
 test_list_flush_ipv4_exception() {
-       setup namespaces routing || return 2
+       setup namespaces routing || return $ksft_skip
        trace "${ns_a}"  veth_A-R1    "${ns_r1}" veth_R1-A \
              "${ns_r1}" veth_R1-B    "${ns_b}"  veth_B-R1 \
              "${ns_a}"  veth_A-R2    "${ns_r2}" veth_R2-A \
@@ -1721,7 +1733,7 @@ test_list_flush_ipv4_exception() {
 }
 
 test_list_flush_ipv6_exception() {
-       setup namespaces routing || return 2
+       setup namespaces routing || return $ksft_skip
        trace "${ns_a}"  veth_A-R1    "${ns_r1}" veth_R1-A \
              "${ns_r1}" veth_R1-B    "${ns_b}"  veth_B-R1 \
              "${ns_a}"  veth_A-R2    "${ns_r2}" veth_R2-A \
@@ -1786,6 +1798,7 @@ usage() {
 #
 exitcode=0
 desc=0
+all_skipped=true
 
 while getopts :ptv o
 do
@@ -1840,7 +1853,7 @@ for t in ${tests}; do
        if [ $run_this -eq 1 ]; then
                run_test "${name}" "${desc}"
                # if test was skipped no need to retry with nexthop objects
-               [ $? -eq 2 ] && rerun_nh=0
+               [ $? -eq $ksft_skip ] && rerun_nh=0
 
                if [ "${rerun_nh}" = "1" ]; then
                        run_test_nh "${name}" "${desc}"
index 2c522f7..db45213 100644 (file)
 
 #define RING_NUM_FRAMES                        20
 
+static uint32_t cfg_max_num_members;
+
 /* Open a socket in a given fanout mode.
  * @return -1 if mode is bad, a valid socket otherwise */
 static int sock_fanout_open(uint16_t typeflags, uint16_t group_id)
 {
        struct sockaddr_ll addr = {0};
-       int fd, val;
+       struct fanout_args args;
+       int fd, val, err;
 
        fd = socket(PF_PACKET, SOCK_RAW, 0);
        if (fd < 0) {
@@ -83,8 +86,18 @@ static int sock_fanout_open(uint16_t typeflags, uint16_t group_id)
                exit(1);
        }
 
-       val = (((int) typeflags) << 16) | group_id;
-       if (setsockopt(fd, SOL_PACKET, PACKET_FANOUT, &val, sizeof(val))) {
+       if (cfg_max_num_members) {
+               args.id = group_id;
+               args.type_flags = typeflags;
+               args.max_num_members = cfg_max_num_members;
+               err = setsockopt(fd, SOL_PACKET, PACKET_FANOUT, &args,
+                                sizeof(args));
+       } else {
+               val = (((int) typeflags) << 16) | group_id;
+               err = setsockopt(fd, SOL_PACKET, PACKET_FANOUT, &val,
+                                sizeof(val));
+       }
+       if (err) {
                if (close(fd)) {
                        perror("close packet");
                        exit(1);
@@ -286,6 +299,56 @@ static void test_control_group(void)
        }
 }
 
+/* Test illegal max_num_members values */
+static void test_control_group_max_num_members(void)
+{
+       int fds[3];
+
+       fprintf(stderr, "test: control multiple sockets, max_num_members\n");
+
+       /* expected failure on greater than PACKET_FANOUT_MAX */
+       cfg_max_num_members = (1 << 16) + 1;
+       if (sock_fanout_open(PACKET_FANOUT_HASH, 0) != -1) {
+               fprintf(stderr, "ERROR: max_num_members > PACKET_FANOUT_MAX\n");
+               exit(1);
+       }
+
+       cfg_max_num_members = 256;
+       fds[0] = sock_fanout_open(PACKET_FANOUT_HASH, 0);
+       if (fds[0] == -1) {
+               fprintf(stderr, "ERROR: failed open\n");
+               exit(1);
+       }
+
+       /* expected failure on joining group with different max_num_members */
+       cfg_max_num_members = 257;
+       if (sock_fanout_open(PACKET_FANOUT_HASH, 0) != -1) {
+               fprintf(stderr, "ERROR: set different max_num_members\n");
+               exit(1);
+       }
+
+       /* success on joining group with same max_num_members */
+       cfg_max_num_members = 256;
+       fds[1] = sock_fanout_open(PACKET_FANOUT_HASH, 0);
+       if (fds[1] == -1) {
+               fprintf(stderr, "ERROR: failed to join group\n");
+               exit(1);
+       }
+
+       /* success on joining group with max_num_members unspecified */
+       cfg_max_num_members = 0;
+       fds[2] = sock_fanout_open(PACKET_FANOUT_HASH, 0);
+       if (fds[2] == -1) {
+               fprintf(stderr, "ERROR: failed to join group\n");
+               exit(1);
+       }
+
+       if (close(fds[2]) || close(fds[1]) || close(fds[0])) {
+               fprintf(stderr, "ERROR: closing sockets\n");
+               exit(1);
+       }
+}
+
 /* Test creating a unique fanout group ids */
 static void test_unique_fanout_group_ids(void)
 {
@@ -426,8 +489,11 @@ int main(int argc, char **argv)
 
        test_control_single();
        test_control_group();
+       test_control_group_max_num_members();
        test_unique_fanout_group_ids();
 
+       /* PACKET_FANOUT_MAX */
+       cfg_max_num_members = 1 << 16;
        /* find a set of ports that do not collide onto the same socket */
        ret = test_datapath(PACKET_FANOUT_HASH, port_off,
                            expect_hash[0], expect_hash[1]);
index f4bb4fe..21091be 100644 (file)
@@ -59,7 +59,8 @@ static void usage(const char *error)
               "  SOF_TIMESTAMPING_SOFTWARE - request reporting of software time stamps\n"
               "  SOF_TIMESTAMPING_RAW_HARDWARE - request reporting of raw HW time stamps\n"
               "  SIOCGSTAMP - check last socket time stamp\n"
-              "  SIOCGSTAMPNS - more accurate socket time stamp\n");
+              "  SIOCGSTAMPNS - more accurate socket time stamp\n"
+              "  PTPV2 - use PTPv2 messages\n");
        exit(1);
 }
 
@@ -115,13 +116,28 @@ static const unsigned char sync[] = {
        0x00, 0x00, 0x00, 0x00
 };
 
-static void sendpacket(int sock, struct sockaddr *addr, socklen_t addr_len)
+static const unsigned char sync_v2[] = {
+       0x00, 0x02, 0x00, 0x2C,
+       0x00, 0x00, 0x02, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0xFF,
+       0xFE, 0x00, 0x00, 0x00,
+       0x00, 0x01, 0x00, 0x01,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+};
+
+static void sendpacket(int sock, struct sockaddr *addr, socklen_t addr_len, int ptpv2)
 {
+       size_t sync_len = ptpv2 ? sizeof(sync_v2) : sizeof(sync);
+       const void *sync_p = ptpv2 ? sync_v2 : sync;
        struct timeval now;
        int res;
 
-       res = sendto(sock, sync, sizeof(sync), 0,
-               addr, addr_len);
+       res = sendto(sock, sync_p, sync_len, 0, addr, addr_len);
        gettimeofday(&now, 0);
        if (res < 0)
                printf("%s: %s\n", "send", strerror(errno));
@@ -134,9 +150,11 @@ static void sendpacket(int sock, struct sockaddr *addr, socklen_t addr_len)
 static void printpacket(struct msghdr *msg, int res,
                        char *data,
                        int sock, int recvmsg_flags,
-                       int siocgstamp, int siocgstampns)
+                       int siocgstamp, int siocgstampns, int ptpv2)
 {
        struct sockaddr_in *from_addr = (struct sockaddr_in *)msg->msg_name;
+       size_t sync_len = ptpv2 ? sizeof(sync_v2) : sizeof(sync);
+       const void *sync_p = ptpv2 ? sync_v2 : sync;
        struct cmsghdr *cmsg;
        struct timeval tv;
        struct timespec ts;
@@ -210,10 +228,9 @@ static void printpacket(struct msghdr *msg, int res,
                                        "probably SO_EE_ORIGIN_TIMESTAMPING"
 #endif
                                        );
-                               if (res < sizeof(sync))
+                               if (res < sync_len)
                                        printf(" => truncated data?!");
-                               else if (!memcmp(sync, data + res - sizeof(sync),
-                                                       sizeof(sync)))
+                               else if (!memcmp(sync_p, data + res - sync_len, sync_len))
                                        printf(" => GOT OUR DATA BACK (HURRAY!)");
                                break;
                        }
@@ -257,7 +274,7 @@ static void printpacket(struct msghdr *msg, int res,
 }
 
 static void recvpacket(int sock, int recvmsg_flags,
-                      int siocgstamp, int siocgstampns)
+                      int siocgstamp, int siocgstampns, int ptpv2)
 {
        char data[256];
        struct msghdr msg;
@@ -288,7 +305,7 @@ static void recvpacket(int sock, int recvmsg_flags,
        } else {
                printpacket(&msg, res, data,
                            sock, recvmsg_flags,
-                           siocgstamp, siocgstampns);
+                           siocgstamp, siocgstampns, ptpv2);
        }
 }
 
@@ -300,6 +317,7 @@ int main(int argc, char **argv)
        int siocgstamp = 0;
        int siocgstampns = 0;
        int ip_multicast_loop = 0;
+       int ptpv2 = 0;
        char *interface;
        int i;
        int enabled = 1;
@@ -335,6 +353,8 @@ int main(int argc, char **argv)
                        siocgstampns = 1;
                else if (!strcasecmp(argv[i], "IP_MULTICAST_LOOP"))
                        ip_multicast_loop = 1;
+               else if (!strcasecmp(argv[i], "PTPV2"))
+                       ptpv2 = 1;
                else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_TX_HARDWARE"))
                        so_timestamping_flags |= SOF_TIMESTAMPING_TX_HARDWARE;
                else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_TX_SOFTWARE"))
@@ -369,6 +389,7 @@ int main(int argc, char **argv)
                HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF;
        hwconfig.rx_filter =
                (so_timestamping_flags & SOF_TIMESTAMPING_RX_HARDWARE) ?
+               ptpv2 ? HWTSTAMP_FILTER_PTP_V2_L4_SYNC :
                HWTSTAMP_FILTER_PTP_V1_L4_SYNC : HWTSTAMP_FILTER_NONE;
        hwconfig_requested = hwconfig;
        if (ioctl(sock, SIOCSHWTSTAMP, &hwtstamp) < 0) {
@@ -496,16 +517,16 @@ int main(int argc, char **argv)
                                        printf("has error\n");
                                recvpacket(sock, 0,
                                           siocgstamp,
-                                          siocgstampns);
+                                          siocgstampns, ptpv2);
                                recvpacket(sock, MSG_ERRQUEUE,
                                           siocgstamp,
-                                          siocgstampns);
+                                          siocgstampns, ptpv2);
                        }
                } else {
                        /* write one packet */
                        sendpacket(sock,
                                   (struct sockaddr *)&addr,
-                                  sizeof(addr));
+                                  sizeof(addr), ptpv2);
                        next.tv_sec += 5;
                        continue;
                }
index bb11de9..f6f2965 100644 (file)
@@ -4,3 +4,4 @@ CONFIG_USER_NS=y
 CONFIG_PID_NS=y
 CONFIG_NET_NS=y
 CONFIG_CGROUPS=y
+CONFIG_CHECKPOINT_RESTORE=y
index 7758c98..0930e24 100644 (file)
@@ -204,7 +204,10 @@ TEST_F(child, fetch_fd)
        fd = sys_pidfd_getfd(self->pidfd, self->remote_fd, 0);
        ASSERT_GE(fd, 0);
 
-       EXPECT_EQ(0, sys_kcmp(getpid(), self->pid, KCMP_FILE, fd, self->remote_fd));
+       ret = sys_kcmp(getpid(), self->pid, KCMP_FILE, fd, self->remote_fd);
+       if (ret < 0 && errno == ENOSYS)
+               SKIP(return, "kcmp() syscall not supported");
+       EXPECT_EQ(ret, 0);
 
        ret = fcntl(fd, F_GETFD);
        ASSERT_GE(ret, 0);
index b9fe75f..8a59438 100644 (file)
@@ -6,7 +6,6 @@
 #include <inttypes.h>
 #include <limits.h>
 #include <linux/types.h>
-#include <linux/wait.h>
 #include <sched.h>
 #include <signal.h>
 #include <stdbool.h>
index 4b11544..6108112 100644 (file)
@@ -3,7 +3,6 @@
 #define _GNU_SOURCE
 #include <errno.h>
 #include <linux/types.h>
-#include <linux/wait.h>
 #include <poll.h>
 #include <signal.h>
 #include <stdbool.h>
index 1f085b9..6e2f2cd 100644 (file)
@@ -16,7 +16,6 @@
 #include <unistd.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
-#include <linux/kcmp.h>
 
 #include "pidfd.h"
 #include "../clone3/clone3_selftests.h"
index c585aaa..529eb70 100644 (file)
@@ -330,7 +330,7 @@ static int test_pidfd_send_signal_recycled_pid_fail(void)
                ksft_exit_fail_msg("%s test: Failed to recycle pid %d\n",
                                   test_name, PID_RECYCLE);
        case PIDFD_SKIP:
-               ksft_print_msg("%s test: Skipping test\n", test_name);
+               ksft_test_result_skip("%s test: Skipping test\n", test_name);
                ret = 0;
                break;
        case PIDFD_XFAIL:
index 2a0503b..cb53a8b 100644 (file)
@@ -266,8 +266,12 @@ int do_test(char *test_name, void (*test_func)(char *, char *))
        }
 
        rc = 0;
-       /* offset = 0 no alignment fault, so skip */
-       for (offset = 1; offset < 16; offset++) {
+       /*
+        * offset = 0 is aligned but tests the workaround for the P9N
+        * DD2.1 vector CI load issue (see 5080332c2c89 "powerpc/64s:
+        * Add workaround for P9 vector CI load issue")
+        */
+       for (offset = 0; offset < 16; offset++) {
                width = 16; /* vsx == 16 bytes */
                r = 0;
 
index 471e2aa..fb4fe91 100644 (file)
@@ -14,7 +14,6 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 /* Test that /proc/loadavg correctly reports last pid in pid namespace. */
-#define _GNU_SOURCE
 #include <errno.h>
 #include <sched.h>
 #include <sys/types.h>
index 9f6d000..8511dcf 100644 (file)
@@ -13,7 +13,6 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <sys/syscall.h>
 #include <sys/types.h>
index 30e2b78..e7ceabe 100644 (file)
@@ -15,7 +15,6 @@
  */
 // Test that values in /proc/uptime increment monotonically
 // while shifting across CPUs.
-#define _GNU_SOURCE
 #undef NDEBUG
 #include <assert.h>
 #include <unistd.h>
index bb543bf..361235a 100644 (file)
         ],
         "cmdUnderTest": "$TC filter add dev $DEV2 protocol ip pref 1 ingress flower dst_mac e4:11:22:11:4a:51 action drop",
         "expExitCode": "0",
-        "verifyCmd": "$TC filter show terse dev $DEV2 ingress",
+        "verifyCmd": "$TC -br filter show dev $DEV2 ingress",
         "matchPattern": "filter protocol ip pref 1 flower.*handle",
         "matchCount": "1",
         "teardown": [
         ],
         "cmdUnderTest": "$TC filter add dev $DEV2 protocol ip pref 1 ingress flower dst_mac e4:11:22:11:4a:51 action drop",
         "expExitCode": "0",
-        "verifyCmd": "$TC filter show terse dev $DEV2 ingress",
+        "verifyCmd": "$TC -br filter show dev $DEV2 ingress",
         "matchPattern": "  dst_mac e4:11:22:11:4a:51",
         "matchCount": "0",
         "teardown": [
index b4fd9a9..3a5936c 100644 (file)
@@ -1,4 +1,4 @@
-TEST_GEN_PROGS := timens timerfd timer clock_nanosleep procfs exec
+TEST_GEN_PROGS := timens timerfd timer clock_nanosleep procfs exec futex
 TEST_GEN_PROGS_EXTENDED := gettime_perf
 
 CFLAGS := -Wall -Werror -pthread
diff --git a/tools/testing/selftests/timens/futex.c b/tools/testing/selftests/timens/futex.c
new file mode 100644 (file)
index 0000000..6b2b926
--- /dev/null
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: GPL-2.0
+#define _GNU_SOURCE
+#include <sched.h>
+
+#include <linux/unistd.h>
+#include <linux/futex.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "log.h"
+#include "timens.h"
+
+#define NSEC_PER_SEC 1000000000ULL
+
+static int run_test(int clockid)
+{
+       int futex_op = FUTEX_WAIT_BITSET;
+       struct timespec timeout, end;
+       int val = 0;
+
+       if (clockid == CLOCK_REALTIME)
+               futex_op |= FUTEX_CLOCK_REALTIME;
+
+       clock_gettime(clockid, &timeout);
+       timeout.tv_nsec += NSEC_PER_SEC / 10; // 100ms
+       if (timeout.tv_nsec > NSEC_PER_SEC) {
+               timeout.tv_sec++;
+               timeout.tv_nsec -= NSEC_PER_SEC;
+       }
+
+       if (syscall(__NR_futex, &val, futex_op, 0,
+                   &timeout, 0, FUTEX_BITSET_MATCH_ANY) >= 0) {
+               ksft_test_result_fail("futex didn't return ETIMEDOUT\n");
+               return 1;
+       }
+
+       if (errno != ETIMEDOUT) {
+               ksft_test_result_fail("futex didn't return ETIMEDOUT: %s\n",
+                                                       strerror(errno));
+               return 1;
+       }
+
+       clock_gettime(clockid, &end);
+
+       if (end.tv_sec < timeout.tv_sec ||
+           (end.tv_sec == timeout.tv_sec && end.tv_nsec < timeout.tv_nsec)) {
+               ksft_test_result_fail("futex slept less than 100ms\n");
+               return 1;
+       }
+
+
+       ksft_test_result_pass("futex with the %d clockid\n", clockid);
+
+       return 0;
+}
+
+int main(int argc, char *argv[])
+{
+       int status, len, fd;
+       char buf[4096];
+       pid_t pid;
+       struct timespec mtime_now;
+
+       nscheck();
+
+       ksft_set_plan(2);
+
+       clock_gettime(CLOCK_MONOTONIC, &mtime_now);
+
+       if (unshare_timens())
+               return 1;
+
+       len = snprintf(buf, sizeof(buf), "%d %d 0",
+                       CLOCK_MONOTONIC, 70 * 24 * 3600);
+       fd = open("/proc/self/timens_offsets", O_WRONLY);
+       if (fd < 0)
+               return pr_perror("/proc/self/timens_offsets");
+
+       if (write(fd, buf, len) != len)
+               return pr_perror("/proc/self/timens_offsets");
+
+       close(fd);
+
+       pid = fork();
+       if (pid < 0)
+               return pr_perror("Unable to fork");
+       if (pid == 0) {
+               int ret = 0;
+
+               ret |= run_test(CLOCK_REALTIME);
+               ret |= run_test(CLOCK_MONOTONIC);
+               if (ret)
+                       ksft_exit_fail();
+               ksft_exit_pass();
+               return 0;
+       }
+
+       if (waitpid(pid, &status, 0) != pid)
+               return pr_perror("Unable to wait the child process");
+
+       if (WIFEXITED(status))
+               return WEXITSTATUS(status);
+
+       return 1;
+}
index d77f482..74c69b7 100755 (executable)
@@ -316,6 +316,14 @@ pp sleep 3
 n2 ping -W 1 -c 1 192.168.241.1
 n1 wg set wg0 peer "$pub2" persistent-keepalive 0
 
+# Test that sk_bound_dev_if works
+n1 ping -I wg0 -c 1 -W 1 192.168.241.2
+# What about when the mark changes and the packet must be rerouted?
+n1 iptables -t mangle -I OUTPUT -j MARK --set-xmark 1
+n1 ping -c 1 -W 1 192.168.241.2 # First the boring case
+n1 ping -I wg0 -c 1 -W 1 192.168.241.2 # Then the sk_bound_dev_if case
+n1 iptables -t mangle -D OUTPUT -j MARK --set-xmark 1
+
 # Test that onion routing works, even when it loops
 n1 wg set wg0 peer "$pub3" allowed-ips 192.168.242.2/32 endpoint 192.168.241.2:5
 ip1 addr add 192.168.242.1/24 dev wg0
index d531de1..4eecb43 100644 (file)
@@ -18,10 +18,12 @@ CONFIG_NF_NAT=y
 CONFIG_NETFILTER_XTABLES=y
 CONFIG_NETFILTER_XT_NAT=y
 CONFIG_NETFILTER_XT_MATCH_LENGTH=y
+CONFIG_NETFILTER_XT_MARK=y
 CONFIG_NF_CONNTRACK_IPV4=y
 CONFIG_NF_NAT_IPV4=y
 CONFIG_IP_NF_IPTABLES=y
 CONFIG_IP_NF_FILTER=y
+CONFIG_IP_NF_MANGLE=y
 CONFIG_IP_NF_NAT=y
 CONFIG_IP_ADVANCED_ROUTER=y
 CONFIG_IP_MULTIPLE_TABLES=y